content
stringlengths
1
15.9M
\section{Introduction} \label{sec:introduction} The identity of dark matter (DM) in the Universe remains to be a mystery. While the gravitational manifestations of DM are numerous and well studied, the connection between DM and the Standard Model (SM) of particles and fields is unknown. A large amount of effort and resources have been invested in the attempts to detect the non-gravitational interaction of SM particles with DM. Thus far, these efforts have resulted in stringent limits on the strength of interaction for certain types of DM. In particular, DM in the form of individual particles with masses comparable to the masses of SM particles has been constrained~\cite{Bauer:2013ihz}. While many of these searches were targeting weakly interacting massive particles (or WIMPs), over time it has become clear that the sensitivity of the existing experiments extends beyond WIMP-nucleon scattering and beyond the electroweak scale for DM masses, see {\em e.g.} \cite{Pospelov:2008jk,Essig:2011nj,Graham:2012su,Kouvaris:2016afs,Hochberg:2016sqx,Ibe:2017yqa}. In parallel to the experimental developments, the last two decades brought a more general view on DM physics. Early on ({\em e.g.}~with the example of supersymmetric WIMP relics \cite{Ellis:1983ew}) it was understood that the DM may not come ``in isolation'', but be, in fact, a member of a more generic dark sector. This sector could comprise additional heavy particles charged under the SM gauge group ({\em e.g.} weak scale supersymmetry), or alternatively may include the mediators of interaction or carriers of a ``dark force'', as well as new very light degrees of freedom known as dark radiation (DR). Light particles from dark sectors would almost invariably have to have a small coupling to the SM. Dark forces and light mediators have received significant attention in the literature, both in the cosmological and laboratory settings~\cite{Alexander:2016aln,Battaglieri:2017aum,Tulin:2017ara,Beacham:2019nyx,Lanfranchi:2020crw}. In comparison, dark radiation has mostly been studied in the context of its contribution to the cosmological expansion rate, parametrized by $N_{\rm eff}$. One interesting aspect of DR (for a set of representative ideas see Refs.~\cite{Hasenkamp:2012ii,Buen-Abad:2015ova,Ko:2016fcd,Cui:2017ytb,Pospelov:2018kdh,Bringmann:2018jpr,McKeen:2018pbb,McKeen:2018xyz,Chacko:2018uke,Bondarenko:2020vta,Berghaus:2020ekh,Dror:2021nyr,Jaeckel:2021gah}) is that it can be created in a non-thermal way, and therefore differ in energy from the characteristic energies of the quanta of the cosmic microwave background. In this paper we will discuss some observable signatures of interacting DR in the regime when $\omega_{\rm DR} \gg \omega_{\rm CMB}$ holds for the respective typical energies. The goal of the present paper is to consider a class of dark radiation models that interacts with the SM via a single photon exchange. We will consider DR originating from the late decays of DM particles with mass $m_{X} > {\rm keV}$. This range will allow to probe such scenarios using DM direct detection experiments, and for $\omega_{\rm DR}$ above 200\,keV, using sensitive underground neutrino experiments. The first goal of this project is to map the sensitivity of the best existing experiments vs.~the strength of DR electromagnetic form factors controlling the interaction and available DR fluxes. The latter depend on the mass and lifetime of decaying progenitor particles. The second goal of this paper is to consider DR and the multitude of possible electromagnetic form factors as candidates for the explanation of the recently reported signal excess in the XENON1T experiment \cite{Aprile:2020tmw}. The excess, consistent with the injection of $O(2-3)$\,keV electromagnetic energy, has numerous candidate explanations. The collaboration itself has tried to connect it with DR coming from the Sun, in form of the axions and/or neutrinos with electromagnetic dipole interaction. Our goal is then to generalize it to a number of possible form factors, in the situation when the DR radiation flux is maximized by employing the DM$\to$DR decay. It is unclear if the explanation of this excess can be achieved with DR without being in conflict with other measurements and constraints. We will adopt a fairly minimal scheme, where the progenitor decay, $X\to \bar \chi \chi$, is sourcing DR in form of $\chi$'s, which we assume to be a Dirac fermion. The Lagrangians specifying the~$\chi$ interactions with the photon $A_{\mu}$ or its field strength tensor $F_{\mu\nu}$ in ascending order of their dimensionality read, \begin{subequations} \label{eq:Lagrangians} \begin{align} \mathcal{L}_{\rm dim = 4} & = \epsilon e \, \bar\chi \gamma^{\mu} \chi A_{\mu} , \\ \mathcal{L}_{\rm dim = 5} & = \frac{1}{2} \mu_\chi \, \bar\chi \sigma^{\mu\nu} \chi F_{\mu\nu} + \frac{i}{2} d_\chi \, \bar\chi \sigma^{\mu\nu}\gamma^5 \chi F_{\mu\nu} , \\ \mathcal{L}_{\rm dim = 6} & = - a_\chi \, \bar\chi \gamma^{\mu} \gamma^5\chi \partial^{\nu} F_{\mu\nu} + b_\chi \, \bar\chi \gamma^{\mu} \chi \partial^{\nu} F_{\mu\nu} . \end{align} \end{subequations} Here $\epsilon e $ is the millicharge (mQ), $\mu_\chi$ and $d_\chi$ are the magnetic and electric dipole moments (MDM and EDM), and $a_\chi$ and $b_\chi$ are the anapole moment and charge radius interaction (AM and CR), respectively. If $\chi$ were a single Majorana fermion, then only the $a_\chi$ interaction is allowed. If $\chi$ is instead a complex scalar, $\mu_\chi$, $d_\chi$ and $a_\chi$ will vanish. For a real scalar such form factors simply do not exist. Thus, we consider DR with the Dirac fermion case to have the most variety of phenomenological consequences. In the past, various aspects of (effective) electromagnetic couplings of dark sector particles (including constraints from direct detection, beam dump limits, SM precision observables, colliders and stellar constraints) were explored in a number of publications \cite{Pospelov:2000bq,Sigurdson:2004zp,Barger:2010gv,Ho:2012bg,Schmidt:2012yg,Kopp:2014tsa,Ibarra:2015fqa,Sandick:2016zut,Kavanagh:2018xeh,Trickle:2019ovy,Chu:2018qrm,Chu:2019rok,Chang:2019xva,Chu:2020ysb,Marocco:2020dqu,Arina:2020mxo}; for the mQ interaction, see the recent review~\cite{Lanfranchi:2020crw} and references therein. The paper is organized as follows: In Sec.~\ref{Sec:flux}, we compute the DR flux from decaying DM (DDM), followed by an overview of experiments in Sec.~\ref{Sec:exp}. In Sec.~\ref{Sec:event_rate}, we derive the expected electron recoil (ER) or nuclear recoil (NR) event rate by the DR. In Sec.~\ref{sec:result}, we demonstrate the constraints and the forecasts of sensitivity on the parameter space and present the fit to the XENON1T excess. Finally, in Sec.~\ref{sec:conclusions}, we conclude and give outlooks. \section{Dark radiation flux} \label{Sec:flux} In this section, we collect the ingredients for the calculation of the DR flux from DDM. For simplicity, we consider a two-body decay $X \rightarrow \bar \chi \chi $ and assume a single decay channel for~$X$. In that case, $X\bar\chi\chi$ coupling can be traded for the lifetime of $X$. The expected Galactic energy differential flux is given by \begin{equation} \label{Eq:galactic_differential_flux} \dfrac{d \phi_\chi^{\rm gal}}{dE_\chi} = \dfrac{e^{-t_0 /\tau_X}}{m_X \tau_X} \dfrac{dN_\chi}{dE_\chi} R_\odot \rho_\odot \langle D \rangle\,, \end{equation} where $t_0$ is the age of the universe, $m_X$ and $\tau_X$ are the DM mass and lifetime, $R_\odot \simeq 8.33\,{\rm kpc}$ is the distance between the Sun and the Galactic center, $\rho_\odot = 3\times 10^5 \,{\rm keV}/{\rm cm}^3$ is the local DM energy density and $\langle D \rangle \simeq 2.1$ is the averaged $D$-factor assuming a NFW profile~\cite{Navarro:1995iw}. For simplicity, we assume a 100\% decaying fraction of DM; if this is not the case, the formulas are to be dressed with the DDM fraction in an obvious way. The DR injection spectrum is monochromatic, \begin{equation} \dfrac{dN_\chi}{dE_\chi} = 2 \delta\left( E_\chi - \dfrac{m_X}{2} \right)\,, \end{equation} with a negligible spread by the parent DM velocity dispersion. In turn, the energy differential DR flux that originates from DDM cosmologically reads~\cite{Cui:2017ytb}, \begin{equation} \dfrac{d \phi_\chi^{\rm ext}}{dE_\chi} = \dfrac{2\Omega_X \rho_c}{ m_X \tau_X H_0 p_\chi} \dfrac{e^{-t(\xi -1)/\tau_X}}{\sqrt{\xi^3 \Omega_m +\Omega_\Lambda}} \Theta(\xi -1)\,, \end{equation} where $\Omega_X = 0.2607$ is the DM density parameter~\cite{Aghanim:2018eyx} and $\rho_c = 4.82 \,{\rm keV}\,{\rm cm}^{-3}$ is the critical density of the Universe at present, $\Theta (\xi -1)$ is a Heaviside step function, and $\xi \equiv p_{\rm in}/ p_\chi$ is the ratio of injected momentum $p_{\rm in}$ to arriving momentum $p_\chi$, $p_{\rm in}^2 = (m_X/2)^2 - m_\chi^2$. In the exponential $t(\xi - 1 )$ is the cosmic time at redshift $z = \xi -1$. For a spacially flat cosmology, for $z\lesssim 10^3$, it is given by \begin{equation} t(z) = \dfrac{1}{3H_0 \sqrt{\Omega_\Lambda}} \ln \left[ \dfrac{\sqrt{1+(\Omega_m /\Omega_\Lambda) (1+z)^3}+1}{\sqrt{1+(\Omega_m /\Omega_\Lambda) (1+z)^3}-1}\right]\,, \end{equation} where $\Omega_m = 0.3111$, $\Omega_\Lambda = 0.6889$ are the cosmological density parameters for matter and dark energy, respectively; $H_0 = 67.66 \,{\rm km\,s^{-1}\, Mpc^{-1}}$ is our adopted present day Hubble rate~\cite{Aghanim:2018eyx}. \begin{figure}[tb] \centering \includegraphics[width=\columnwidth]{Fig/nu_flux.pdf} \caption{The solar neutrino flux (solid black) and the DR flux from the DDM for $\tau_X = 35t_0$ and various choices of $m_X$. Both, galactic and extragalactic DR flux from DDM can reach comparable levels of flux with respect to the solar neutrinos. } \label{Fig:nu_flux} \end{figure} As benchmark value for the DM lifetime, we take $\tau_X = 35 t_0$~\cite{Chen:2020iwm}, which saturates the limit on invisibly DDM from a joint data set that includes cosmic microwave background measurements~\cite{Aghanim:2018eyx,Aghanim:2019ame}, the Pantheon data of type Ia supernovae~\cite{Scolnic:2017caz} and baryon acoustic oscillation measurements~\cite{2012MNRAS.423.3430B,Ross:2014qpa,Alam:2016hwk}; for previous constraints on $\tau_X$ or the fraction of DDM, see~\cite{Enqvist:2015ara,Poulin:2016nat,Nygaard:2020sow}. The DR mass is not entering the analysis in an appreciable way, as we focus on the relativistic daughter particles, unless the value of $m_\chi $ is explicitly stated. Therefore, we have two free parameters: the DM mass $m_X$ and the coupling between the DR and the SM sector. In Fig.~\ref{Fig:nu_flux}, we compare the solar neutrino flux and the expected galactic DR flux (dashed lines) and the extragalactic DR flux (solid lines) originating from DDM with $m_X = 50, 100 , 500\,{\rm keV}$; we apply a 2\% Gaussian smearing on the monochromatic Galactic flux for visualization. The fluxes are compared to the solar neutrino flux (solid black line) taken from~\cite{Bahcall:1987jc,Bahcall:1996qv,Bahcall:1997eg}; below 10~keV, we include the contribution from plasmon decay, photoproduction, and bremsstrahlung from~\cite{Vitagliano:2017odj}. As can be seen, both galactic and extragalactic DR fluxes are, in magnitude, in roughly the same ballpark as the solar neutrino flux. \section{Experiments} \label{Sec:exp} \begin{table*}[t] \centering \begin{tabular}{lcccr} \toprule &Exposure (ton$\times$yr) & Signal Range & Signal Type & Reference \\ \midrule XENON1T (fit) & $0.65$ & $[1,10]\,{\rm keV}$ & ER & \cite{Aprile:2020tmw} \\ XENON1T (S1+S2) & $0.65$ & $[3,66]\,{\rm PE_{S1}}$ & ER & \cite{Aprile:2020tmw} \\ XENON1T (S2) & $0.06$ & $[150,526]\,{\rm PE}$ & ER & \cite{Aprile:2019xxb} \\ Borexino & $2.1\times10^2$ & $[0.32,2.64]\,{\rm MeV}$ & ER, NR & \cite{Agostini:2020lci,Agostini:2020mfq} \\ Super-Kamiokande & $9.2 \times 10^4$ & $[16,88]\,{\rm MeV}$ & ER & \cite{Bays:2011si} \\ & $1.6 \times 10^5$ & $[0.1,1.33]\,{\rm GeV}$ & ER & \cite{Kachulis:2017nci} \\ Hyper-Kamiokande$^*$ & $2.3 \times 10^6$ & $[16,88]\,{\rm MeV}$ & ER & \cite{Abe:2011ts,Kearns:2013lea} \\ & $4.0\times 10^6$ & $[0.1,1.33]\,{\rm GeV}$ & ER & \cite{Abe:2011ts,Kearns:2013lea} \\ DUNE$^*$ (10/40\,kton) & $7.2 \times 10^4 \,(2.9 \times 10^5)$ & $[0.03,1.33]\,{\rm GeV}$ & ER & \cite{Necib:2016aez} \\ \bottomrule \end{tabular} \caption{Summary of experiments with (effective) exposures, our considered signal ranges, signal type, and main reference for the reported data used in this work; the star indicates that a forecast on the sensitivity is derived.} \label{tab:experiment} \end{table*} In this section, we outline the considered experiments and the way to derive constraints and forecasts of sensitivity on the parameter space. For ER in the $\mathcal{O}({\rm keV})$ energy ballpark, we consider the scattering of DR in the XENON1T detector. Neutrino experiments such as Borexino, Super-Kamiokande (SK) as well as the future Hyper-Kamiokande (HK) and Deep Underground Neutrino Experiment (DUNE) have larger energy threshold, ${\rm MeV}\text{--}{\rm GeV}$ range, and we consider DR-electron scattering for which the solar neutrinos ($E_R < 30 \,{\rm MeV}$) and atmospheric neutrinos $(E_R > 30 \,{\rm MeV})$ become the main background. For Borexino, we consider DR-proton scattering in addition. \subsection{XENON1T} The XENON1T detector, located underground at the Gran Sasso laboratory, is a dual-phase time projection chamber with liquid and gaseous xenon. The registered signals include prompt scintillation (S1) and secondary scintillation from ionization (S2). In a recent analysis~\cite{Aprile:2020tmw}, an excess of events was identified in the S1 data at $\mathcal{O}({\rm keV})$. Although poorly understood backgrounds exist~\cite{Aprile:2020tmw,Szydagis:2020isq}, the possibility that this signal is due to new physics has been entertained abundantly, see~\cite{Aprile:2020tmw,Boehm:2020ltd,Takahashi:2020bpq,An:2020bxd,Khan:2020vaf,Bloch:2020uzh,DiLuzio:2020jjp,*Buch:2020mrg,*Gao:2020wer,*Dent:2020jhf,*Dessert:2020vxy,*Sun:2020iim,*Cacciapaglia:2020kbf,*Croon:2020ehi,*Li:2020naa,*Athron:2020maw,*Millea:2020xxp,*Arias-Aragon:2020qtn,*Alonso-Alvarez:2020cdv,*Choi:2020kch,*Chiang:2020hgb,*Kannike:2020agf,*Fornal:2020npv,*Su:2020zny,*Chen:2020gcl,*Cao:2020bwd,*Jho:2020sku,*DelleRose:2020pbh,*Alhazmi:2020fju,*Basu:2020gsy,*Davoudiasl:2020ypv,*Choudhury:2020xui,*Ema:2020fit,*Cao:2020oxq,*Bally:2020yid,*AristizabalSierra:2020edu,*Ge:2020jfn,*Coloma:2020voz,*Miranda:2020kwy,*Babu:2020ivd,*Shoemaker:2020kji,*Arcadi:2020zni,*Karmakar:2020rbi,*Harigaya:2020ckz,*Bell:2020bes,*Lee:2020wmh,*Bramante:2020zos,*An:2020tcg,*Chao:2020yro,*Baek:2020owl,*He:2020wjs,*Borah:2020jzi,*Du:2020ybt,*Choi:2020udy,*Paz:2020pbc,*Dey:2020sai,*Budnik:2020nwz,*Zu:2020idx,*Lindner:2020kko,*McKeen:2020vpf,*Gao:2020wfr,*Ko:2020gdg,*Okada:2020evk}. The excess is not in conflict with an earlier S2-only analysis by the experiment~\cite{Aprile:2019xxb}. Here we derive both, the favored region for the anomaly and the constraints on the parameter space using the S1+S2 and S2-only data. Details on the limit-setting procedure can be found in~\cite{An:2020bxd} which we follow here; see also~\cite{An:2017ojc}. \subsection{Borexino} \begin{figure}[tb] \begin{center} \includegraphics[width=0.49\textwidth]{Fig/Borexino_spectrum.pdf} \end{center} \caption{The Borexino observed event rate together with the reported best-fit background model (solid black), and exemplary event rates for mQ (red), MDM/EDM (blue) AM/CR (green) as a function of the visible energy $E_{\rm vis}$. Solid curves are for ER, while dashed ones are for NR. The differing energy-dependence of the operators of differing dimensionality can be clearly observed. } \label{Fig:Borexino_spectrum} \end{figure} The Borexino experiment features a liquid scintillator-based detector with $280\,{\rm ton}$ fiducial mass, primarily designed to measure solar neutrinos in the quasi-elastic scattering signal with electrons~\cite{Alimonti:2008gc}. We use the latest data from the CNO neutrino search of phase-III~\cite{Agostini:2020lci,Agostini:2020mfq} of the experiment, with an exposure of 209.4~${\rm ton}\text{-}{\rm yr}$. Between the threshold energy $320\,{\rm keV}$ and $2640\,{\rm keV}$, the observed event rate and the best-fit background plus solar neutrino-induced rate are reported for each energy bin. Note that the standard neutrino events are a background in our consideration. The detection efficiency is assumed to be unity. We derive $95\%$ C.L. limits using the ${\rm CL}_s$ method~\cite{Read:2002hq}. For heavier progenitor masses, we further consider the proton recoil signal in the Borexino detector. Here, we adopt Birk's law to account for the energy quenching in the organic scintillator, \begin{equation} E_{\rm vis} = \int_0^{E_R} \dfrac{dE}{1+k_B dE/dx}\,, \end{equation} where $E_{\rm vis}$ is the visible energy, $k_B \simeq 0.01\,{\rm cm}/{\rm MeV}$ is Birk's constant and $dE/dx$ is the stopping power which we compute using the \texttt{SRIM} computer package; see also~\cite{Pospelov:2012gm}. For the scintillator pseudocumine ${\rm C}_9 {\rm H}_{12}$ with a mass density of $\rho = 0.88\,{\rm g}/{\rm cm}^3$, the stopping power for protons is roughly $dE/dx \sim \mathcal{O}(100)\,{\rm MeV}/{\rm cm}$, albeit energy-dependent. For electrons, $dE/dx \sim \mathcal{O}(10^{-3})\,{\rm MeV}/{\rm cm}$ so that we are allowed to neglect the energy quenching since $dE/dx \ll k_B^{-1}$. We utilize the same data and method presented above to derive the corresponding constraint. See Fig.~\ref{Fig:Borexino_spectrum} for a demonstration of the event rate from different operators and the Borexino data. \subsection{Super-Kamiokande} \label{Sec:SK} Super-Kamiokande (SK) is a neutrino experiment with a water-based Cherenkov detector located $2.7\,{\rm km}$ underground in Japan. The fiducial mass is $22.5\,{\rm kton}$. First, we consider the low-energy $e^-$-recoil data with $E_R = 16\text{--}88\,{\rm MeV}$ from a diffuse supernova neutrino background search in the SK-I run~\cite{Bays:2011si}. With 1497 days of observation, 239 events are reported with $N_{\rm bkg} = 238$ from the best-fit model, which has also been utilized to set bounds on neutrino DR~\cite{Cui:2017ytb} and cosmic-ray upscattered DM~\cite{Cappiello:2019qsw}. The corresponding efficiency is taken from~\cite{Bays:2011si}. At the higher recoil energy range, a recent analysis~\cite{Kachulis:2017nci} provides three energy bins of $161.9\,{\rm kton}\text{-}{\rm yr}$ fiducialized fully-contained data from the SK-IV run, with cuts applied for a single relativistic electron and no accompanying nuclear interaction. We use the first energy interval ranging from $100\,{\rm MeV}$ to $1.33\,{\rm GeV}$ with a total number of $N_{\rm obs} = 4042$ events and an efficiency $\epsilon (0.5\,{\rm GeV}) = 0.93$. The estimated background is 3993 $e^-$-recoil events during its data-taking time~\cite{Kachulis:2017nci}. The ensuing $90\%$~C.L.~limits on the various signal strengths can be derived by requiring that the DR-induced events $N_{\rm sig}^{\rm DR}$ satisfy, \begin{equation} \label{Eq:90CL} N_{\rm sig}^{\rm DR} \leq {\rm Max}[0,N_{\rm obs} - N_{\rm bkg}] + 1.28 \sqrt{N_{\rm obs}}\, . \end{equation} \subsection{Hyper-Kamiokande} Hyper-Kamiokande (HK) will be equipped with 25 times larger fiducial mass than SK~\cite{Abe:2011ts,Kearns:2013lea}. It will provide supreme sensitivity to solar, atmospheric and supernova neutrinos. We consider the same low and high recoil energy ranges as in SK. The background estimation is done by rescaling the background events of SK according to their difference in the fiducial mass. Under the assumption of same data-taking time as SK and a constant efficiency of $0.8$, we derive the projected sensitivity of HK by imposing % $N_{\rm sig}^{\rm DR} \leq 1.28 \sqrt{N_{\rm bkg}}$ assuming $N_{\rm obs} = N_{\rm bkg}$. \subsection{DUNE} DUNE is a proposed long-baseline neutrino facility, which serves as the far detector for the neutrino beam generated from $1300\,{\rm km}$ away~\cite{Abi:2017aow}. As an add-on, its liquid argon (LAr)-based detector can also probe light dark sector physics~\cite{Acciarri:2015uup}. DUNE will be comprised of four $10\,{\rm kton}$ detectors. In the following we consider both the $10\,{\rm kton}$ and $40\,{\rm kton}$ configurations. To avoid the immense solar neutrino background, the electron energy threshold is set to $30\,{\rm MeV}$~\cite{Necib:2016aez}. The expected (all-sky) number of $e^-$-recoil background events per year is $N_{\rm bkg} = 128\, (512)$ for the $10\,(40)\,{\rm kton}$ detector~\cite{Necib:2016aez}. The detection efficiency for the LAr time projection chamber is assumed to be 0.5. Finally, we obtain the future projection on the couplings for each progenitor mass by the condition $N_{\rm sig}^{\rm DR}\leq 1.28 \sqrt{N_{\rm bkg}}$, assuming $N_{\rm obs} = N_{\rm bkg}$ and the same data-taking time as well as the upper boundary of recoil energy as the SK high-$E_R$ data in Sec.~\ref{Sec:SK}. \section{event rate} \label{Sec:event_rate} \subsection{Scattering on bound electrons} For small progenitor mass, the resulting DR is low-energetic enough that we need to account for bound state effects in the DR-electron scattering and resulting atomic ionization process. Combining the DR flux from Sec.~\ref{Sec:flux} and the differential cross section given in App.~\ref{App:xsec_electron}, the differential event rate for scattering with the electrons is \begin{equation} \label{Eq:differential_rate} \dfrac{dR}{dE_R} = \kappa N_T \varepsilon(E_R) \int_{q_-}^{q_+} dq \int_{p_\chi^{\rm min}}^{p_\chi^{\rm max}} dp_\chi \, \dfrac{p_\chi}{ E_\chi}\dfrac{d\phi_\chi}{dE_\chi} \dfrac{d \sigma v}{dq dE_R}\,, \end{equation} where $\kappa$ is the exposure of the experiment, $N_T$ is the number of targets per detector mass, $ \varepsilon(E_R)$ is the detection efficiency, and $d\phi_\chi/ dE_\chi$ is the differential $\chi$ flux from DDM that includes both, the galactic and extragalactic components. The minimum $\chi$-momentum for a given recoil energy $E_R$ and momentum transfer $q$ is \begin{equation} \label{Eq:pchiminbound} p_\chi^{\rm min} = \dfrac{q}{2 x} \left[ x + \dfrac{\Delta E}{q}\sqrt{x\left(x+ \dfrac{4m_\chi^2}{q^2} \right)}\right]\,, \end{equation} where $x = 1 - \Delta E^2/ q^2$ with $\Delta E = E_R + |E_B^{n,l}|$ being the deposited energy and $E_B^{n,l}$ is the binding energy of the bound state orbital $(n,l)$. The upper boundary of the $p_\chi$ integration is given by $p_\chi^{\rm max} = p_{\rm in} $. The integration boundaries of $q$ are given by \begin{equation} q_+ = p_\chi^{\rm max} + \dfrac{\sqrt{(m_X - 2 \Delta E)^2 -4 m_\chi^2}}{2}\,,\,\, q_- = \Delta E\,. \end{equation} To obtain the total event rate, we sum up the contributions from all kinematically available $(n,l)$ shells. \subsection{Scattering on free particles} For larger progenitor mass, the $\mathcal{O}({\rm MeV}\text{--}{\rm GeV})$ ER signals induced by DR are best probed in the large-volume neutrino experiments mentioned in Sec.~\ref{Sec:exp}. For such recoil energies, the initial electron can be considered as a free particle. With the recoil cross section given in Appendix.~\ref{App:xsec_free}, the total differential event rate reads \begin{equation} \dfrac{dR}{dE_R} = \kappa N_T \varepsilon(E_R) \int_{p_\chi^{\rm min}}^{p_\chi^{\rm max}} dp_\chi \dfrac{p_\chi}{ E_\chi}\dfrac{d\phi_\chi}{dE_\chi} \dfrac{d\sigma}{dE_R}\,. \end{equation} Here, the lower integration boundaries of $p_\chi$ is given through $ p_\chi^{\rm min} =\sqrt{(E_\chi^{\rm min})^2 - m_\chi^2}$ with \begin{align} E_\chi^{\rm min} &=\dfrac{E_R}{2}+\frac{1}{2 m_e}\sqrt{m_e(E_R +2m_e)(E_R m_e +2 m_\chi^2)} , \end{align} and the upper boundary as before. The expected number of events is given by, \begin{equation} N_{\rm sig}^{\rm DR} = \int_{E_{\rm th}}^{E_R^{\rm max}} dE_R \, \dfrac{dR}{dE_R}\,, \end{equation} where $E_{\rm th}$ is the threshold recoil energy. The maximal recoil energy $E_R^{\rm max}$ is either given by the energy range of the experimental data or half of the progenitor mass. For large enough $m_X$, the DR is energetic enough to generate $\mathcal{O}({\rm keV}\text{--}{\rm MeV})$ NR in direct detection and neutrino experiments. The framework for NR is the same as scattering on free electrons discussed above, but the recoil cross section become target-dependent; see~\cite{Chu:2018qrm} for detailed formulas of the nuclear recoil cross section. \section{Results} \label{sec:result} \subsection{Constraints on the effective couplings} \begin{figure*}[t] \begin{center} \includegraphics[width=0.49\textwidth]{Fig/mQ_bound.pdf} \includegraphics[width=0.49\textwidth]{Fig/MDM_bound.pdf} \end{center} \caption{Constraints and forecasts of sensitivity on the mQ (left panel) and effective MDM/EDM (right panel) interaction of the DR. In addition, the best-fit values (indicated by the red dots) and the favoured regions explaining the XENON1T excess are shown. The strongest bounds in the literature, taken from~\cite{Davidson:2000hf,Chu:2019rok}, from the anomalous energy loss inside red giant stars are included for comparison; their strength depends on the DR mass. For dimension~5 operators, we also show the constraints from the anomalous cooling of SN1987A and taken from~\cite{Chu:2019rok}. } \label{Fig:bound} \end{figure*} \begin{figure}[tb] \begin{center} \includegraphics[width=0.49\textwidth]{Fig/AM_bound.pdf} \end{center} \caption{The constraints and the forecasts of sensitivity on the effective AM/CR interaction as labeled. The hatched region shows the anomalous cooling constraint from SN1987A and the horizontal dashed lines are constraints from the energy loss inside RG stars~\cite{Chu:2019rok}. } \label{Fig:bound_dim6} \end{figure} We show the resulting constraints (shaded regions) and forecasts of sensitivity (lines) for millicharged DR in the left panel of Fig.~\ref{Fig:bound}, for MDM/EDM interactions in the right panel of Fig.~\ref{Fig:bound} and for AM/CR interactions in Fig.~\ref{Fig:bound_dim6}. We also show the XENON1T excess favored region, with details on the fitting procedure given in Sec.~\ref{Sec:XE1T_excesss}. Previous constraints derived from the anomalous energy loss in red giant stars (RG) and SN1987A cooling are included for comparison~\cite{Davidson:2000hf,Chu:2019rok}, which apply when $m_\chi$ is smaller than the plasma frequency in the stellar environment: $m_\chi \leq 10\,{\rm keV} (20\,{\rm MeV})$ for RG (SN1987A); see also~\cite{Chang:2018rso,Chang:2019xva}. For mQ, we note that there exist additional bounds from galaxy cluster magnetic fields~\cite{Kadota:2016tqq} and the timing of radio waves~\cite{Caputo:2019tms}. However, both of them scale with the DR mass, thus they are not included in the figures. Due to the energy dependence in the cross sections, the experiments with higher threshold are more important for higher dimensional operators. We see that current SK and future HK and DUNE can all provide better sensitivity than current best limit from the stellar energy loss for dimension~5 and~6 operators, assuming $\tau_X = 35 t_0$. For mQ, the improvement of sensitivity between experiments that probe free electron scattering and XENON1T is not so notable compared to higher dimensional operators. The constraints derived in this paper for $m_\chi = 0$ also apply to electromagnetic form factors of neutrinos if they play the role of DR. On the other hand, if only taking the SM weak interactions of neutrinos, direct detection and neutrino experiments put bounds on the mass and lifetime of the progenitor $X$; see, \textit{e.g.}, Ref.~\cite{Cui:2017ytb}. \subsection{XENON1T excess} \label{Sec:XE1T_excesss} \begin{figure}[tb] \centering \includegraphics[width=\columnwidth]{Fig/2020fit.pdf} \caption{Best-fit event rate to the XENON1T excess for each effective electromagnetic interaction. We demonstrate cases including/excluding the first bin in the fit by the solid/dashed lines; the event rates are summed with the background expectation given by the gray solid line.} \label{fig:XE1T_fit} \end{figure} \begin{table}[t] \centering \begin{tabular}{lccc} \toprule & $m_X\,({\rm keV})$& coupling & $\chi^2/{\rm dof}$ \\ \midrule mQ & $472$ & $\epsilon = 6.8\times 10^{-11}$ & $9.2/7$ \\ \quad excl.~first bin & $183$ & $\epsilon = 8.9\times 10^{-11}$ & $1.5/6$ \\ MDM, EDM & $243$ & $\mu_\chi,d_\chi = 1.8\times 10^{-9}\,\mu_B$ & $5.8/7$ \\ \quad excl.~first bin & $81$ & $\mu_\chi,d_\chi = 1.8\times 10^{-9}\,\mu_B$ & $1.1/6$ \\ AM, CR & $86$ & $a_\chi,b_\chi = 8.6\times 10^{-3}\,{\rm GeV}^{-2}$ & $3.6/7$ \\ \quad excl.~first bin & $71$ & $a_\chi,b_\chi = 1.1\times 10^{-2}\,{\rm GeV}^{-2}$ & $1.1/6$ \\ \bottomrule \end{tabular} \caption{Best-fit values of $m_X$ and strength of the electromagnetic interaction as well as the corresponding $\chi^2/{\rm dof}$. A lifetime of $\tau_X=35t_0$ is assumed.} \label{tab:bestfit} \end{table} \begin{figure*}[t] \begin{center} \includegraphics[width=0.32\textwidth]{Fig/mQ_bound_70keV.pdf} \includegraphics[width=0.32\textwidth]{Fig/MDM_bound_70keV.pdf} \includegraphics[width=0.32\textwidth]{Fig/AM_bound_70keV.pdf} \end{center} \caption{Zoom-in figures with massive DR ($m_\chi = 70\,{\rm keV}$) for the parameter space favoured by the XENON1T excess. {\em Left panel (mQ)}: the parameter space for explaining the XENON1T excess is not constrained by either stellar energy loss arguments or $N_{\rm eff}$. {\em Middle panel (MDM/EDM)}: the parameter space is fully covered by the SN1987A bound. {\em Right panel (AM/CR)}: part of the parameter space is ruled out by $N_{\rm eff}$. The SN1987A and $N_{\rm eff}$ constraints are adopted from~\cite{Davidson:2000hf,Chu:2019rok}. Here we neglect the differences between EDM and MDM as well as between AM and CR operators as they are not resolved except at the very kinematic endpoint $m_X\simeq 140\,\ensuremath{\mathrm{keV}}$ as DR remains (semi-)relativistic everywhere else. } \label{Fig:70keV} \end{figure*} In light of the recent excess in the $\mathcal{O}({\rm keV})$ recoil energy range observed by XENON1T~\cite{Aprile:2020tmw}, we also explore the possibility of explaining the excess with DR. assuming the background modelling is correct. This lines up with several other new physics scenarios and their constraints that have been investigated in this context~\cite{Aprile:2020tmw,Boehm:2020ltd,Takahashi:2020bpq,An:2020bxd,Khan:2020vaf,Bloch:2020uzh,DiLuzio:2020jjp,*Buch:2020mrg,*Gao:2020wer,*Dent:2020jhf,*Dessert:2020vxy,*Sun:2020iim,*Cacciapaglia:2020kbf,*Croon:2020ehi,*Li:2020naa,*Athron:2020maw,*Millea:2020xxp,*Arias-Aragon:2020qtn,*Alonso-Alvarez:2020cdv,*Choi:2020kch,*Chiang:2020hgb,*Kannike:2020agf,*Fornal:2020npv,*Su:2020zny,*Chen:2020gcl,*Cao:2020bwd,*Jho:2020sku,*DelleRose:2020pbh,*Alhazmi:2020fju,*Basu:2020gsy,*Davoudiasl:2020ypv,*Choudhury:2020xui,*Ema:2020fit,*Cao:2020oxq,*Bally:2020yid,*AristizabalSierra:2020edu,*Ge:2020jfn,*Coloma:2020voz,*Miranda:2020kwy,*Babu:2020ivd,*Shoemaker:2020kji,*Arcadi:2020zni,*Karmakar:2020rbi,*Harigaya:2020ckz,*Bell:2020bes,*Lee:2020wmh,*Bramante:2020zos,*An:2020tcg,*Chao:2020yro,*Baek:2020owl,*He:2020wjs,*Borah:2020jzi,*Du:2020ybt,*Choi:2020udy,*Paz:2020pbc,*Dey:2020sai,*Budnik:2020nwz,*Zu:2020idx,*Lindner:2020kko,*McKeen:2020vpf,*Gao:2020wfr,*Ko:2020gdg,*Okada:2020evk}.% \footnote{Reference~\cite{Khan:2020vaf} considers all form factors of~\eqref{eq:Lagrangians} but for SM neutrinos, fitting the excess with their solar flux. The required interaction strengths are excluded from stellar energy loss constraints~\cite{Chu:2019rok}, disfavoring the ``solar option'' altogether.}% Moreover, PandaX-II reports for its own data that it is both, consistent with a new physics contribution as well as with a fluctuation of background~\cite{Zhou:2020bvf}. Thus the observational status of an excess in XENON1T remains unclear at the moment. In Fig.~\ref{fig:XE1T_fit}, we show the best-fit event rate induced by DR and the data in the energy range $[0,10]\,{\rm keV}$ in two fitting scenarios, including and excluding the first bin. By excluding the first bin, the recoil spectrum can better fit to the peak of excess, but at the expense of significantly overshooting the first bin, (See also related discussions in Refs. \cite{Bloch:2020uzh,Harnik:2020ugb}). When the first bin is included in the fit, the second bin cannot be filled but the overall fit is still satisfactory, similar to the anomalous neutrino magnetic dipole moment explanation~\cite{Aprile:2020tmw,Boehm:2020ltd}. The corresponding best-fit parameters and $\chi^2/{\rm dof}$ are given in Table.~\ref{tab:bestfit}. We observe that higher-dimensional operators yield improved fits to the excess, as their recoil spectra are less peaked at low $E_R$. We also note that the best-fit coupling of dimension~5 operator is consistent with the best-fit anomalous magnetic dipole moment of neutrino~\cite{Boehm:2020ltd},~\textit{i.e.}, \begin{equation} \phi_\chi^{\rm best} \times \left(\mu_\chi^{\rm best} \right)^2 \simeq \phi_\nu^{\rm solar} \times \left(\mu_\nu^{\rm best} \right)^2\,, \end{equation} although the free electron approximation is adopted in~\cite{Boehm:2020ltd}. For massless DR, the favoured parameter space for the excess is excluded by stellar energy loss constraints, such as red giant stars for dimension~4 and~5 operators and SN1987A for the dimension~6 operators, shown in Fig.~\ref{Fig:bound}, and taken from~\cite{Davidson:2000hf,Chu:2019rok}; see also~\cite{Chang:2018rso,Chang:2019xva}. However, stellar energy loss is effective only when $\chi$ production is kinematically allowed. Taking DR with $m_\chi = 70\,{\rm keV}$, the constraints from the stellar energy loss are alleviated, while, at the same time, leaving the fits to the XENON1T excess to remain unchanged. This is owed to the relatvistic nature of considered DR. Finally, we consider the constraint from the measured number of relativistic degrees of freedom $N_{\rm eff}$, as $\chi$ particles are also populated in the early universe through plasmon decay and electron-positron annihilation~\cite{Davidson:2000hf,Chu:2019rok,Chang:2019xva}. As shown in Fig.~\ref{Fig:70keV} for mQ (left panel), MDM/EDM (middle panel) and AM/CR (right panel), there remains allowed parameter space for explaining the XENON1T excess for dimension~4 and~6 operators. For dimension~5 operators, the viable parameter space is covered by the SN1987A bound. \section{Conclusion} \label{sec:conclusions} In this paper we have considered the possibility that DM $X$ is unstable and decays to a pair $\bar \chi \chi$ which itself couples to the SM through effective interactions mediated by the photon. We consider the possibility of millicharge of $\chi$, magnetic and electric dipole moments, and the less familiar anapole moment and charge radius interaction. The emerging DR flux from DDM is then probed in underground rare-event searches. For $m_X \lesssim 1~\ensuremath{\mathrm{MeV}}$ direct detection experiments offer the best sensitivity with their ability of registering keV-scale energy depositions and below. Heavier progenitors are better probed with neutrino experiments, as $\chi$-induced events leave MeV-scale signals. For concreteness, in this work we have chosen a benchmark value of $\tau_X = 35 t_0$ with the bulk of DM still to decay in the distant future. The scattering of $\chi$ on electrons is the most important signal channel. We demonstrate that the recent (S1+S2) data from the XENON1T experiment yields $\epsilon\lesssim 2\times 10^{-11}$ at $m_X\simeq 10~\ensuremath{\mathrm{keV}}$, and $d_\chi,\mu_\chi \lesssim 2\times 10^{-9}\mu_B$ as well as $a_\chi,b_\chi \lesssim 2\times 10^{-2}\ensuremath{\mathrm{GeV}}^{-2}$ at $m_X\simeq 100\,\ensuremath{\mathrm{keV}}$. In addition, we find that it is also possible to reach a satisfactory fit to the reported excess of events seen in the XENON1T data at few~keV energy. The fit improves by increasing the dimensionality of the operator, as the lowest energy bin in the data prohibits too strong of an IR-biased signal. The AM/CR interaction thereby yields the best fit. The DR mass-dependence is relatively mild in those drawn conclusions as these particles retain their (semi-)relativistic nature except at the very kinematic edge $2m_\chi \simeq m_X$. However, stellar and cosmological constraints critically depend on $m_\chi$. By choosing a benchmark value of $m_\chi = 70\,\ensuremath{\mathrm{keV}}$ we demonstrate that a XENON1T explanation remains intact for mQ and for the dim-6 AM and CR operators, evading bounds from the anomalous energy loss inside RG stars, of the proto-neutron star of SN1987A and from the cosmological $N_{\rm eff}$ limit. For progenitor masses $m_X\gtrsim 1\,\ensuremath{\mathrm{MeV}}$ Borexino has the best sensitivity reaching $\epsilon\lesssim 10^{-12}$, $d_\chi,\mu_\chi \lesssim 3\times 10^{-12}\,\mu_B$ and $a_\chi,b_\chi \lesssim 2\times 10^{-6}\,\ensuremath{\mathrm{GeV}}^{-2}$ at $m_X\simeq 1\,\ensuremath{\mathrm{MeV}}$. These limits rely on the detailed modeling of Borexino backgrounds and its solar neutrino-induced events. The limits are eventually surpassed by the ones from SK, once DR induces electron recoils above the solar neutrino endpoint energies. Best sensitivity is attained for $m_X \simeq 100\,\ensuremath{\mathrm{MeV}}$ with $\epsilon\lesssim 4\times 10^{-13}$, $d_\chi,\mu_\chi \lesssim 10^{-13}\,\mu_B$ and $a_\chi,b_\chi \lesssim 4\times 10^{-9}\,\ensuremath{\mathrm{GeV}}^{-2}$. Finally, we also provide forecasts for HK and DUNE, with relatively mild expected improvements. \vspace{.3cm} \paragraph*{Acknowledgments} JLK is supported by the Austrian Science Fund FWF under the Doctoral Program W1252-N27 Particles and Interactions. JP is supported by the New Frontiers program of the Austrian Academy of Sciences. MP is supported in part by U.S. Department of Energy (Grant No. desc0011842). We acknowledge the use of computer packages for algebraic calculations~\cite{Mertig:1990an,Shtabovenko:2016sxi}.
\section*{Abstract} Polygenic risk score (PRS) analysis is a powerful method been used to estimate an individual's genetic risk towards targeted traits. PRS analysis could be used to obtain evidence of a genetic effect beyond Genome-Wide Association Studies (GWAS) results i.e. when there are no significant markers. PRS analysis has been widely applied to investigate the genetic basis of several traits including rare diseases. However, the accuracy of PRS analysis depends on the genomic data of the underlying population. For instance, several studies showed that obtaining higher prediction power of PRS analysis is challenging for non-Europeans. In this manuscript, we reviewed the conventional PRS methods and their application to sub-saharan Africa communities. We concluded that the limiting factor of applying PRS analysis to sub-saharan populations is the lack of sufficient GWAS data. Also, we recommended developing African-specific PRS tools. \\ \textbf{keywords}\\ Prediction medicine, GWAS, post-GWAS, PRS analysis, Africa population \section*{Author summary} PRS analysis is currently not applicable to African communities due to the current data sparsity with respect to Genome-Wide Association Studies (GWAS) in non-European ancestries. Therefore, extending the current PRS tools to handle diverse multi-ethnic data is crucial to estimate PRS values for personalized medicine across ethnic groups. \section{Introduction} Genome-wide association studies (GWAS) have been applied successfully to identify the associations between hundreds of genomic variations with complex human traits\cite{Bush2019}. In general, GWAS report single nucleotides polymorphisms (SNPs) as statistically significant genomic variations associated with the trait of interest, when their \emph{p}-values are less than 5e-09 in Africa population (which also statistically depends on the number of SNPs analyzed)\cite{Gurdasani2019}. The statistically significant SNPs reported by GWAS are used to understand the biomolecular mechanisms of many phenotypic traits, including various human diseases. However, due to the statistical threshold, GWAS might fail to detect SNPs that are associated with low or moderate risks \cite{Cantor2010,Zhang2014}. The limitation of filtering variants associated with low disease risk increases the GWAS false negative rate. Also, traditional GWAS cannot be used to integrate the polygenic nature of many complex traits \cite{Krapohl2017}. Therefore, several post-GWAS approaches have been introduced to overcome them \cite{Pasaniuc2016,Chimusa2019}. Due to the privacy issues such as access to individual level GWAS data sets, most post-GWAS approaches require only GWAS summary statistics. There are many public resources for GWAS summary statistics and they include the GWAS Catalog\cite{Buniello2019}, GWAS Central\cite{Beck2019} and the dbGaP database \cite{Mailman2007,Tryka2013}. A distinct approach of performing post-GWAS analysis is known as PRS analysis. The PRS methods map genotype data from a GWAS summary into a single variable used to estimate an individual-level risk score for the phenotypic trait. PRS analysis is used to predict an individual heritability by incorporating all SNPs \cite{Dudbridge2013}. Therefore, obtaining a precise PRS value from case-control studies can be used in personalized medicine. However, challenges exist when translating PRS values to clinical care \cite{Lewis2017}. To successfully perform PRS analysis, two distinct GWAS summaries are required. The first sample (training sample) is used to select the SNPs for PRS analysis. The second sample (discovery sample) is used to evaluate the prediction value of PRS methods. The following PRS approaches are discussed in the literature; (i) weighted methods that consider the effect sizes derived from GWAS result, (ii) unweighted methods that consider the single marker analysis and (iii) shrinkage methods that consider the multivariate analysis. In this review, we focused on the tools and methods that perform PRS analysis and their applications in understanding the predictive power of PRS analysis. The reviewed PRS tools are chosen based on the following criteria: \begin{enumerate} \item The approach must perform PRS analysis based on "base" (GWAS) data (summary statistics) and "target" data (genotypes and phenotypes in each of the target sample). \item The approach may involve linkage disequilibrium pruning. \item The method or approach should be readily available in form of a tool or package to be able to execute the method on any data set. \end{enumerate} Besides reviewing the PRS methods, we aim to investigate the application of PRS analysis on African population. It is important to note that the term "African population" includes all those whose ancestors are African (i.e. Africans in diaspora). However, in this manuscript, we will review the PRS studies only on sub-saharan Africa. \section{Classification of PRS methods} The different approaches under the umbrella of PRS analysis are presented in Figure \ref{Fig1} and Table \ref{table1}. We can categorize PRS methods into two groups; (i) Bayesian-based methods (ii) non-Bayesian methods. Also, we can classify PRS methods into two with respect to their treatments of linkage disequilibrium: (i) PRS methods that incorporate linkage disequilibrium (LD), and (ii) PRS methods that apply LD pruning. However, to ease the understanding of their underlying algorithms, we grouped the PRS analysis approaches into four (See Table \ref{Tab2}): \begin{enumerate} \item Clumping with thresholding (C+T) is the standard approach of polygenic scores analysis. \item \emph{p}-value thresholding approach. \item Penalized regression approach. \item Bayesian shrinkage approach. \end{enumerate} \subsection{PRS methods that incorporate LD} In practice, the prediction accuracy of PRS analysis tends to improve if the markers are LD pruned. However, as noted in Chatterjee \textit{et al} \cite{Chatterjee2013}, the absence of linkage disequilibrium (LD) limits the predictive accuracy of PRS analysis. In addition, a simulation test performed by Vilhjálmsson \textit{et al} \cite{Yang2015} shows that in the presence of LD, the prediction accuracy of the PRS analysis widely used approach of LD pruning followed by \emph{p}-value thresholding (P + T) under-predicts the heritability explained by the SNPs. One special method that incorporated LD in its study is LDPred (Subsection \ref{LDPred}), a Bayesian approach in the presence of LD. If loci are to be linked, then the posterior mean effect can be derived analytically under a Gaussian infinitesimal prior. An arguably more reasonable prior for the effect sizes is a non-infinitesimal model where only a fraction of the markers are causal. For this reason, consider the following Gaussian mixture prior: \begin{eqnarray} \beta\sim iid \begin{cases} N\left(0, \frac{h^{n}_{g}}{M_{p}} \right) & \text{ with probability p} \\ 0 & \text{ with probability (1-p)} \end{cases}, \end{eqnarray} where $p$ is the probability that a marker is drawn from a Gaussian distribution i.e. the fraction of causal marker. Similarly, from this model the posterior mean can be derived as \begin{eqnarray} E\left(\frac{\beta_{i}}{\widetilde{\beta}^{l}}, D\right) \approx \left(\frac{M}{N h^{2}_{g}} I + D_{i} \right)^{-1}\widetilde{\beta}^{l}, \end{eqnarray} where $D_i$ denotes the regional LD matrix within the region of LD and $\widetilde{\beta}^{l}$ denotes the least-squares estimated effects within that region. The approximation assumes that the heritability explained by the region is small and that LD with SNPs outside of the region is negligible \subsection{PRS methods that apply LD pruning} These PRS methods are non-Bayesian approaches that apply informed LD pruning (LD clumping) (figure \ref{Fig1}). Moreover, these methods are referred to as pruning and thresholding (P+T) PRS methods. For instance, using a univariate regression coefficient ($r^2$) with a threshold of 0.2, we could apply \emph{p}-value thresholding. The \emph{p}-value thresholding process is optimized over a grid concerning prediction accuracy in the validation data. LD pruning that preferentially prunes the less significant marker could yield more accurate predictions than pruning random markers. For the \emph{p}-value selection threshold, researchers should include only SNPs that are statistically significant in GWAS. This technique essentially shrinks all omitted SNPs to zero estimate and does not perform shrinkage on the effect size estimates of the included SNPs. PRS is often computed over a variety of thresholds given that the optimal \emph{p}-value threshold is a priori unknown and the target phenotype being evaluated for the given threshold while the forecast adjusted accordingly. This technique can be interpreted as a variable selection process which essentially executes the GWAS \emph{p}-value forward selection based on the size of the increment in the \emph{p}-value threshold. \subsection{Bayesian approach in PRS analysis} Bayesian approaches have been used to explicitly model pre-existing genetic architecture thereby accounting for the distribution of effect sizes with a prior that should improve the accuracy of a polygenic score. The main advantage of Bayesian-based PRS analysis is its ability to improve genomic risk prediction from summary statistics by taking into account linkage disequilibrium (LD) among markers \cite{So2017}. \subsubsection{Empirical Bayes PRS (EB-PRS) method} In general, EB-PRS method is a novel approach based on the Empirical Bayes theorem incorporating information across markers to improve prediction accuracy \cite{Song2020}. EB-PRS method aims at minimizing the prediction error by leveraging on the estimated distribution of effect sizes. Assuming the SNPs are independent, the optimal PRS value (in terms of achieving the best classification accuracy) is \begin{eqnarray} S=\beta^{T} X=\sum_{i=1}^{m}\beta_{i}X_{i}, \end{eqnarray} where $m$ is the total number of genotyped SNPs. $X_i$ is the genotypic value and $\beta_i$ is the log-odds ratio (OR) of the $i$th SNP. The log-OR is a measure of the effect size defined in the following formula: \begin{eqnarray} \beta_{i}=\log\left(\frac{f_{i1}(1-f_{i0})}{f_{i0}(1-f_{i1})}\right), \end{eqnarray} where $f_{i0}$ and $f_{i1}$ are the reference allele frequencies among controls and cases respectively. If the SNP is not associated with disease, then $\beta_{i}=0$. In practice, the true values of effect sizes are usually unknown and need to be estimated from the data. Song \textit{et al.} \cite{Song2020}, in their method use the Empirical Bayes approach to estimate $\beta$ which is the minimizer of the Bayes risk under the distribution estimated from the data. The estimators can be derived directly from GWAS summary statistics. Compared to other improved genetic risk prediction methods \cite{Hu2017,Yang2015}, the EB-PRS method does not require external panels or datasets. While there are other methods which utilize effect size distributions for PRS value calculations, methods in this category such as \cite{So2017,Mak2017} have no tuning parameters or external input. However, the EB-PRS method has a theoretical superiority compared with the existing methods in this category in terms of minimizing the prediction error. This method was applied to the following six complex disease traits; asthma (AS), breast cancer (BC), celiac disease (CEL), Crohn's disease (CD), Parkinson's disease (PD) and type-2 diabetes (T2D) to illustrate the improved risk prediction performance in real data (Table 1). Furthermore, the authors recorded significant improvement when comparing the EB-PRS method with all other methods that include the unadjusted PRS method, $P+T$, LDpred-inf, LDpred, Mak \textit{et al.}'s \cite{Mak2017}. Although the EB-PRS method can achieve better performance without tuning any parameters and utilizing external information, its performance may be improved with external information e.g. the LD information as used in LDpred. Also, in order to increase the prediction accuracy, Song \textit{et al.} \cite{Song2020} suggested that the EB-PRS method could be further improved by combining other available datasets in the future such as annotations or other GWAS summary statistics studying genetically correlated traits. \subsubsection{Polygenic Risk Score-Continuous Shrinkage (PRS-CS) method} The PRS-CS method is based on a Bayesian high-dimensional regression framework for polygenic modeling and prediction: \begin{eqnarray} Y_{N\times 1}=X_{N\times M}\beta_{M\times 1}+\epsilon_{N\times1}, \end{eqnarray} where $N$ and $M$ denote the sample size and number of genetic markers respectively. $Y$ is a vector of traits while $X$ is the genotype matrix. $\beta$ is a vector of effect sizes for the genetic markers and $\epsilon$ is a vector of residuals. By assigning appropriate priors on the regression coefficients $\beta$ to impose regularization, additive PRS value can be calculated using posterior mean effect sizes. Unlike LDpred \cite{Yang2015} and the normal-mixture model recently developed \cite{Zhang2018,LloydJones2019} which can incorporate genome-wide markers having varying genetic architectures with enhanced performance and flexibility, the PRS-CS method utilizes a Bayesian regression framework and places a conceptually different class of priors—the continuous shrinkage (CS) priors—on SNP effect sizes \cite{Feng2019}. Continuous shrinkage priors allow for marker-specific adaptive shrinkage i.e. the amount of shrinkage applied to each genetic marker is adaptive to the strength of its association signal in GWAS which can accommodate diverse underlying genetic architectures. Feng \& Smoller \cite{Feng2019} presented the PRS-CS-auto method, a fully Bayesian approach that enables automatic learning of a tuning parameter $\phi$, from GWAS summary statistics. Although analyses conducted from the Biobank indicate that for many disease phenotypes, the current GWAS sample sizes may not be large enough to accurately learn $\phi$ and the prediction accuracy of PRS-CS-auto method may be lower than PRS-CS method and LDpred. However, simulation studies and quantitative trait analyses suggest that PRS-CS-auto method can be useful when the training sample size is large or when an independent validation set is difficult to acquire. Although the PRS-CS method provides a substantial improvement over existing methods for polygenic prediction \cite{Yang2015}, current prediction accuracy of PRS value is still lower than what can be considered clinically useful. Much work is still needed to further improve the predictive performance and translational value of PRS methods. Recent studies by \cite{MrquezLuna2018,Shi2016,Turley2019} argued that jointly modeling multiple genetically correlated traits and functional annotations in polygenic modeling are expected to increase the predictive performance of PRS methods. \subsection{PRS methods based on Shrinkage of GWAS effect size estimates} Since SNP effects are calculated with uncertainty and not all SNPs have an impact on the traits, unadjusted effect size estimates of all SNPs can lead to low-estimated PRS, with high standards error \cite{Choi2018}. Two shrinkage methods have been implemented to solve these problems: shrinkage of the effect estimates of all SNPs by adapted statistical techniques, and use of \emph{p}-value filtering thresholds as the criterion for inclusion of SNPs. \subsubsection{Shrinkage of the effect estimates of all SNPs by adapted statistical techniques} PRS methods performing shrinkage of all SNPs \cite{Wray2014,Yang2015} typically apply shrinkage/regularisation techniques such as LASSO/ridge regression\cite{Wray2014}, or Bayesian approaches performing shrinkage by prior distribution specification\cite{Yang2015}. Varying degrees of shrinkage may be accomplished under varying methods or parameter settings. The most suitable shrinkage to be implemented depends on the underlying mixture of distributions of null and true effect size which is likely to be a complex mixture of distributions that differ by traits. PRS estimation is usually tailored over a number of (tuning) parameters since the optimum shrinkage parameters are a priori unknown. For example, in the case of LDpred, it includes a setting for a fraction of causal variant \cite{Yang2015}. \subsubsection{\emph{p}-value filtering thresholds as the criterion for inclusion of SNPs} In this process, the PRS estimate includes SNPs with a GWAS P-value below a certain level (e.g. \emph{p}-value $< 23^{-5}$) while all other SNPs are removed. This method shrinks all omitted SNPs to an estimated effect size of zero and does not perform shrinkage on the effect size estimates of the included SNPs. Since the optimum \emph{p}-value threshold is a priori unknown, PRS is computed over a range of thresholds, associated with each of the tested target trait and optimized appropriately for the prediction \ref{Fig1}). In systematic shrinkage techniques, this method is similar to tuning parameter optimization. This technique is regarded as a parsimonious method of selection of variables. It is efficient in performing the forward selection of variables (SNPs) using GWAS \emph{p}-value with the sizes depending on the increment of P-value threshold. Therefore, only in the sense of this forward selection method is the chosen 'optimal threshold' defined; a PRS derived from another subset of the SNPs may be more predictive of the target trait. However, considering the fact that GWAS is focused on millions of SNPs, the number of subsets of SNPs that could be chosen for study is too high. \subsection{Linkage Disequilibrium Control} Usually, association studies in GWAS are done one-SNP-at-a-time \cite{Choi2018}. It combines with high genome-wide correlation structure, making it incredibly difficult to classify the independent genetic effects. Though GWAS' power can be enhanced by leveraging on the results of several SNPs concurrently \cite{Loh2018}, provided that raw data on all samples are available. Generally, researchers need to take advantage of standard GWAS (one SNP at a time) summary statistics for polygenic scoring. To estimate the PRS, there are two key options: (i) SNPs are clumped such that the retained SNPs are mostly independent of each other, (ii) all SNPs are included and the linkage disequilibrium (LD) between them is adjusted. In the 'normal approach' to polygenic scoring, option (i) is normally preferred, requiring \emph{p}-value thresholding, while option (ii) is commonly preferred in methods that incorporate conventional methods of shrinkage \cite{Mak2017,Yang2015} (see Table \ref{Tab2}). As for option (i) without clumping, some researchers tend to perform the \emph{p}-value thresholding method. Although breaking this presumption could lead to marginal losses in certain situations\cite{Mak2017}, Choi \textit{et al.} \cite{Choi2018} suggested that clumping be done where GWAS estimates of non-shrunk effect sizes are used. The standard method tends to work comparably to more advanced approaches \cite{Mak2017,Yang2015}. This could well be due to the clumping mechanism capturing conditionally independent effects. However, a critique of clumping is that for the elimination of SNPs in LD, researchers usually use an arbitrarily selected correlation threshold \cite{Wray2013}. Thus, no technique is without arbitrary features, this could be an area for the potential development of the classical method. \begin{figure}[!h] \centering \includegraphics[scale=.25]{PRS-workflow.png} \caption{A general PRS analysis workflow. This is a typical polygenic risk score analysis workflow showing base data, target data and encapsulating different approaches. Using summary statistics and individual-level genotype and phenotype data, approaches such as lasso/ridge regression, clumping and \emph{p}-value thresholding can be employed to increase the predictive accuracy of PRS analysis. In addition, results may predict health or disease risk and provide insights for effective therapeutic interventions. } \label{Fig1} \end{figure} \clearpage \begin{landscape} \renewcommand{\arraystretch}{1.2} \begin{longtable}{|p{2.5cm}|p{3cm}|p{2.5cm}|p{2cm}|p{7.5cm}|p{3cm}|} \caption{Summary of polygenic risk score tools.} \label{table1} \\ \hline Tool & Approach & Computational Platform & User Friendly & Functionality & Link \\ \hline \endfirsthead \multicolumn{6}{@{}l}{Summary of polygenic risk score tools\ldots continued.}\\ \hline Tool & Approach & Computational Platform & User Friendly & Functionality & Link\\ \hline \endhead LDpred\cite{Yang2015} & Bayesian Shrinkage Prior & Python & Difficult & Method that uses a prior on effect sizes and LD information from an external reference panel &{\tiny \url{ https://bitbucket.org/bjarni_vilhjalmsson/ldpred}} \\ [1em] \hline PRS-CS\cite{Feng2019} & Bayesian regression framework & Python & Difficult & utilizes a high- dimensional Bayesian regression framework, by placing a continuous shrinkage (CS) prior on SNP effect sizes & \tiny \url{https://github.com/getian107/PRScs} \\ [5em] \hline EB-PRS\cite{Song2020} & Empirical Bayes approach & R & Difficult & A novel method that leverages information for effect sizes across all the markers & R CRAN \\ [1em] \hline AnnoPred\cite{Hu2017} & Bayesian Shrinkage Prior & Python & Difficult & A framework that leverages diverse types of genomic and epigenomic functional annotations &\tiny \url{https://github.com/yiminghu/AnnoPred}\\ [1em] \hline PRSice\cite{Euesden2015} & Clumping + thresholding (C+T) & R & Difficult & for calculating, applying, evaluating and plotting the results of PRS analysis & \tiny \url{http://PRSice.info}\\ [1em] \hline PRSice2\cite{Choi2019} & Clumping +thresholding (C+T) & C++, R & Easy & an efficient and scalable software program for automating and simplifying PRS analyses on large-scale data & \tiny \url{http://PRSice.info}\\ [1em] \hline LDpred2\cite{Priv2020} & Bayesian Shrinkage & R & Difficult & A faster and more robust implementation of LDpred in R package bigsnpr & \tiny \url{https://privefl.github.io/bigsnpr/articles/LDpred2.html}\\ [1em] \hline BSLMM\cite{Yang2020} & Bayesian sparse linear mixed model & R & Difficult & Prior specification for the hyper-parameters and a novel Markov chain Monte Carlo algorithm for posterior inference & \tiny \url{http://stephenslab.chicago.edu/software.html} \\[1em] \hline BayesR\cite{LloydJones2019} & Hierarchical Bayesian Mixture Model & Fortran & Difficult & Bayesian mixture model that simultaneously allows variant discovery, estimation of genetic variance explained by all variants. & \tiny \url{https://github.com/syntheke/bayesR}\\ [5em] \hline DPR software\cite{Zeng2017} & Latent Dirichlet process regression model & C++ & Easy & Dirichlet process regression to flexibly and adaptively model the effect size distribution & \tiny \url{http://www.xzlab.org/software.html}\\ [1em] \hline SMTpred\cite{Maier2018}& & Python & Difficult & Combines SNP effects or individual scores from multiple traits according to their sample size, SNP-heritability ($h^2$) and genetic correlation ($r_G$). & \tiny \url{https://github.com/uqrmaie1/smtpred} \\ [1em] \hline Lassosum \cite{Mak2017}& Penalised Regression & R & Difficult & A method for constructing PGS using summary statistics and a reference panel in a penalized regression framework & \tiny \url{https://github.com/tshmak/lassosum}\\ [1em] \hline Plink\cite{Chang2015} & \emph{p}-value thresholding approach & C/C++ & Easy & Open-source C/C++ toolset for genome-wide association studies (GWAS) and research in population genetics & \tiny{\url{http://zzz.bwh.harvard.edu/plink/}}\\ \hline \end{longtable} \end{landscape} \begin{table}[h] \begin{adjustwidth}{-2.25in}{0in} \caption{Comparison of different approaches for performing PRS analyses.} \centering \begin{tabular}{|p{2.1cm}|p{3cm}|p{3cm}|p{3cm}|p{3cm}|} \hline \multirow{2}{*}{Key Factors} & \multicolumn{4}{c|}{Approaches}\\ [3ex] \cline{2-5} & \emph{p}-value thresholding with clumping & Penalised Regression & Clumping + Thresholding (C+T) & Bayesian Shrinkage Prior\\ [3ex] \hline Controlling for Linkage Disequilibrium & N/A & LD matrix is integral to algorithm & Clumping & Shrink effect sizes with respect to LD \\ \hline Shrinkage of GWAS effect size estimates & \emph{P}-value threshold & LASSO, Elastic Net, penalty parameters Bayesian & P-value threshold Standard & Prior distribution, e.g. fraction of causal SNPs \\ [3ex] \hline \end{tabular} \label{Tab2} \end{adjustwidth} \end{table} \section{PRS and Population structure/Global heterogeneity} The key cause of confounding in GWAS (post-QC) is population structure, hence the possibility of false-positive results \cite{Choi2018}. In general, structure in mating patterns induces structure in genetic variation, closely associated with geographic location. Furthermore, environmental risk factors may be organized in a similar manner, creating the possibility for correlations between certain genetic variations and the characteristics examined that are confounded by, for example, location \cite{Price2006,Astle2009}. Usually, this issue is solved in GWAS by modifying the principal components (PCs)\cite{Price2006} or by using mixed models \cite{Price2010}. However, population composition in the PRS study presents a possible greater issue since a significant number of null variants usually are included in PRS estimation. For example, allele frequencies are systematically different between the base and target data that can be obtained from genetic drift or genotyped variant \cite{Kim2018}. In addition, there is a danger that variations in null SNPs may result in the correlation between the PRS and target traits if the distributions of the environmental risk factors for the phenotype vary in both (base and target data) – both highly probable in most PRS studies. Even if the GWAS had completely regulated its population structure, confounding is possibly reintroduced. Correlated variations between the base and target data in allele frequencies and risk factors are not taken into consideration. The regulation of structure in the PRS study should be adequate to prevent false-positive if the base and target samples are drawn from the same or genetically similar populations. Choi \textit{et al.} advised that care should be taken, provided that there are drastic variations between populations in the distribution of PRS \cite{Kim2018,Martin2017,Duncan2018}. Such observations do not indicate large differences between populations in aetiology while genuine differences are likely to contribute due to geographical, cultural and selection pressure variations. It challenges the accurate use of base and target data from different populations in PRS studies that do not tackle the problem of possible uncertainty generated by geographical stratification\cite{Martin2017}. It is therefore important to be mindful that, by exploiting large sampling sizes, extremely significant effects can be obtained due to subtle confounding. Population structure issues are as significant as the variations between individuals in the base and target populations in genetics and the environment. In the coming years, the topic of generalizability of PRS methods across populations is expected to be an active field \cite{Duncan2018,MrquezLuna2017}. \section{PRS tools} The next sections would provide an example of some PRS tools that are commonly used to perform PRS analysis. \subsubsection{Linkage Disequilibrium Pred (LDpred)}{\label{LDPred}} This method infers the posterior mean effect size of each marker by using a prior on effect sizes and LD information from an external reference panel \cite{Yang2015}. LDpred calculates the posterior mean effects from GWAS summary statistics by conditioning on a genetic architecture prior and on LD information from a reference panel. The inner product of these is re-weighted and the test-sample genotypes is the posterior mean phenotype, and under the model assumptions and available data, posterior mean phenotype is an optimal (minimum variance and unbiased) predictor. The prior of the effect sizes is a point-normal mixture distribution which allows for non-infinitesimal genetic architectures. The prior has two parameters; the heritability, explained by the genotypes and the fraction of causal markers i.e. the fraction of markers with non-zero effects. The heritability parameter is estimated from GWAS summary statistics and accounts for sampling noise and LD \cite{Finucane2015}. By applying LDpred to five diseases: Sczherhernia (SCZ), Muscular dystrophy (MS), BC, Type II diabetes (T2D) and Coronary artery disease (CAD) for which the GWAS summary statistics for large sample sizes ranging from 27,000 to 86,000 individuals and raw genotypes for an independent validation dataset, LDpred outperforms the approach of pruning followed by thresholding \cite{So2017}, particularly at large sample sizes. For instance, in a large dataset of schizophrenia and multiple sclerosis, the predicted $R^2$ increased from 20.1\% to 25.3\% and from 9.8\% to 12.0\%, respectively. In another test, LDpred was applied to predict SCZ risk in non-European validation samples of both African and Asian descents. Although prediction accuracies were lower in absolute terms, similar relative improvements were observed for LDpred over other methods. LDpred is a popular and powerful method for deriving polygenic scores based on summary statistics and a Linkage Disequilibrium (LD) matrix only \cite{Vilhjlmsson2015}. It assumes there is a proportion p of variants that are causal. However, LDpred has several limitations that may result in limited predictive performance. The non-infinitesimal version of LDpred, a Gibbs sampler, is particularly sensitive to model misspecification when applied to summary statistics with large sample sizes. It is also unstable in long range LD regions such as the human leukocyte antigen (HLA) region of chromosome 6. This issue has led to the removal of such regions from analyses \cite{LloydJones2019,MrquezLuna2018} which is unfortunate since this region of the genome contains many known disease-associated variants, particularly with autoimmune diseases and psychiatric disorders \cite{Mokhtari2016, Matzaraki2017}. In a recent development, a new version of LDpred that addresses these issues while markedly improving its computational efficiency was presented by Privé \textit{et al.} \cite{Priv2020}. This is a faster and more robust implementation of LDpred in the R package bigsnpr. \subsection{LDpred2} A new version of LDpred, LDpred2, has a \textit{sparse} option that can learn effects that are exactly $0$ and an \textit{auto} option that directly learns parameters from data. LDpred is widely used and has the potential to provide polygenic models with good predictive performance \cite{Khera2018}. Yet, it has some instability issues that have been pointed out by Marquez-Luna \textit{et al.} \cite{MrquezLuna2018} and by Lloyd-Jones \textit{et al.} \cite{LloydJones2019} and likely contributed to the discrepancies in reported prediction accuracies \cite{Choi2019,Ge2019}. For instance, LDpred1 performs poorly in the simulations where causal variants are in the HLA region. In contrast, LDpred2 performs very well. It uses a window size of 3 centiMorgan (cM), which is larger than the default value used in LDpred1 and enables LDpred2 to work well even when causal variants are in long-range LD regions. In another scenario, LDpred2-auto which automatically computes values for hyper-parameters $p$ and $h^2$, equally performs well compared to other LDpred2 models in simulations but does not perform well for some of the real traits. Typically, Type 1 diabetes (T1D) is mainly composed of large effects in the HLA region because summary statistics have a small sample size. It is unknown why LDpred2-auto performs poorly specifically for pure red cell aplasi (PRCA). More studies need to be performed to understand the poor results of LDpred2-auto in these two cases. \subsection{PRSice} In 2015, Euesden \textit{et al.} \cite{Euesden2015} developed the first dedicated PRS analysis software, naming the resulting methodology PRSice. PRSice is written in R, with wrappers for bash data management scripts and PLINK-1.9 to minimize computational time (Table 1). Considering $n$ individuals from the 'target phenotype' data set using a list of $m$ SNPs, the genotypes have some effect (or not) on the 'base phenotype'. The base and target phenotype may be the same if assessing the shared genetic overlap of a phenotype between samples/populations. These genotype effects can be estimated from a univariate regression on the base phenotype for each SNP, such as from a genome-wide association study (GWAS). In such a GWAS for a SNP $i$, where $i$ = 1, 2, ..., $m$, a \emph{p}-value, $P_i$, is calculated for the association between the SNP genotypes, $G_i$,$j = \{0,1,2\}$ for individual $j$ where $j$ = 1, 2, … , $n$ and the phenotype. Under the usual additive assumption made in GWAS, a corresponding effect size is estimated by $\beta_i$ for the effect of a unit increase in genotype $G_{ij}$, on the phenotype. SNPs are generally selected for inclusion in a PRS value based on the degree of evidence according to \emph{p}-value for their association with the base phenotype in a GWAS – SNP $i$ will be included in a PRS calculation if $P_i$ is smaller than a threshold, $P_T$. PRS values are typically calculated at a number of different \emph{p}-value thresholds, $P_T$. At threshold $P_T$, the PRS value for individual $j$ can be calculated as: \begin{eqnarray} PRS_{PT,j}=\sum_{i=1}^{m}\beta_{i}G_{i,j}. \end{eqnarray} The PRS value is calculated across all individuals giving $n$ scores per threshold, $P_T$. The association between these PRS values and the target phenotype can then be evaluated in an appropriate regression model (depending on the data type of the target phenotype, e.g. linear regression if the phenotype is continuous). PRSice tool has been developed to fully automate PRS analyses, substantially expanding the capability of PLINK-1.9 \cite{Chang2014}. In real data, there is usually some missing genotype data unless genotypes have already been imputed. PLINK-1.9 imputes any missing data according to mean allele frequencies. However, it is not equipped to handle very large data sets, and a more memory-efficient approach is used in its advanced version, PRSice-2. \subsection{PRSice-2} PRSice-2 which is an enhancement of PRSice, handles both genotyped and imputed data, provides empirical association \emph{p}-values free from inflation due to overfitting, supports different inheritance models and evaluates multiple continuous and binary target traits simultaneously \cite{Choi2019}. This method streamlines the entire PRS analysis pipeline without generating intermediate files and performs all the main computations in C++, leading to a drastic speed-up in run time and reduction in memory burden. Furthermore, using best-guess genotypes (BGEN) imputation format, PRSice-2 can directly process the BGEN imputed format and convert to either best-guess genotypes or dosages when calculating the PRS value without generating a large intermediate file. While PRS values based on best-guess genotypes are calculated as for genotyped input, dosage-based PRS values are calculated as \begin{eqnarray} PRS=\sum_{i}^{m}\beta_{i}\left(\sum_{j}^{2}w_{ij}X_{j}\right). \end{eqnarray} Where $\omega_{ij}$ is the probability of observing genotype $j$,where $j \in \{0,1,2\}$ , for the $i^{th}$ SNP; $m$ is the number of SNPs; and $\beta_i$ is the effect size of the $i^{th}$ SNP estimated from the relevant base genome-wide association study (GWAS) data. A simulation study has been used to compare the performance of PRSice-2 to alternative polygenic score software lassosum\cite{Mak2017} and LDpred \cite{Yang2015} in terms of run time, memory usage and predictive power on servers equipped with 286 Intel 8168 24 core processors at 2.7 GHz and 192 GB of RAM. Based on the simulation results, PRSice-2 showed best performance in all settings, significantly faster than lassosum and LDpred. Specifically, PRSice-2 can complete the full PRS analysis on 100,000 samples within 4 minutes, which is 179 times faster than the 10 hours required by lassosum and 241 times faster than the 13 hours 27 minutes required by LDpred. Similarly, PRSice-2 requires significantly less memory than lassosum and LDpred, requiring $<$500 MB of memory for 100,000 samples as opposed to 11.2 GB required by lassosum and 45.2 GB required by LDpred. Another case study compared the predictive power of PRSice-2 to lassosum and LDpred for quantitative traits with heritability of 0.2, base sample size of 50,000 and target sample size of 10,000. PRSice-2 has comparable predictive power to lassosum and LDpred, typically generating PRS values with predictive power higher than those of LDpred but not as high as lassosum. The details of the simulation code can be found here (\href{https://github.com/choishingwan/PRSice-paper-script}{simulation code}), for others to inspect and repeat the analyses. While PRS values generated by PRSice-2 do not seem to fully optimize predictive accuracy, the simple approach and typically fewer SNPs exploited allow for easier interpretation of the results compared with methods that use all SNPs \cite{Cecile2019}. \subsection{Lassosum} It is an alternative method that uses summary statistical data to estimate PRS, and takes LD into account by using reference panels \cite{Mak2017} on the basis of the commonly used LASSO and elastic net regression \cite{Tibshirani1996,Zou2005}. Consider the linear regression given below: \begin{eqnarray} y=X\beta + \epsilon. \end{eqnarray} For which $X$ represents a data matrix of \emph{n}-by-\emph{p}, and $y$ denotes a vector of the observed outcome. LASSO is a commonly used method for deriving $\beta$ estimates and y predictors, especially in cases where p is high and where it is rational to conclude that many $\beta$ are 0. By minimizing the objective function, LASSO also obtains estimates of $\beta$ given $y$ and X. To test the efficiency of lassosum relative to LDpred, simulation studies\cite{Vilhjlmsson2015} were carried out using summary statistics for which LD was accounted for and Welcome Trust Case Control Consortium (WTCCC) Phase 1 data for seven diseases. The outcome of LDpred, lassosum, and simple soft-thresholding (setting s = 1 in lassosum) was comparable for most of the diseases in the WTCCC dataset, except for T1D, where lassosum seem to outperform LDPred. The performance of LDpred and lassosum was comparable when the number of causal SNPs was 1,000 and the sample size was 11,200 for the simulated phenotypes, and both were superior to soft thresholding. However, LDpred's performance was considerably reduced when the sample size was halved. The lassosum was not influenced in the same way when reducing the sample size by halve. All methods performed equally when the number of causal SNPs was 25,000 and the sample size was 11,200. The fact that summary statistics can be confounded by population stratification and population heterogeneity, makes real-life application of PRS difficult. However, these problems in the lassosum design were not considered. One possible issue with the use of meta-analytical summary statistics is that the original data produced by the summary statistics is an amalgamation of datasets around the world with correction for population stratification. Possibly, there is no one homogenous dataset suitable as a reference panel. Further research is therefore required to explain what is the best approach here. Schork \textit{et al.} \cite{Schork2013} have demonstrated that different genome regions have different false discovery rates, thus different chances of being causally correlated with a phenotype. Therefore, genome annotation information can theoretically be used to enhance the performance. Similarly, it is possible to utilize the fact that certain phenotypes have common genetic determinants (pleiotropy) to improve PRS. \subsection{PLINK SOFTWARE (Second-generation PLINK)} PLINK 1 is an open-source C/C++ tool set for performing genome-wide association studies (GWAS) and research in population genetics. However, the steady growth of data from imputation and whole-genome sequencing studies called for an urgent need for faster and scalable implementations of its key functions. In addition, GWAS and population-genetic data now frequently contain genotype likelihoods, phase information, and/or multiallelic variants, none of which can be represented by PLINK 1's primary data format. To address these problems, Chang \textit{et al.} \cite{Chang2015} developed a second-generation codebase for PLINK. The first major release from this codebase, PLINK 1.9, introduces extensive use of bit-level parallelism, $O(\sqrt{n})$ -time/constant-space Hardy-Weinberg equilibrium calculation and Fisher's exact tests and many other algorithmic improvements. In combination, these changes accelerate most operations by 1-4 orders of magnitude and allow the program to handle data sets too large to fit into RAM. PLINK 1.9's core functional domains are unchanged from that of its predecessor, and it is usable as a drop-in replacement in most cases with no changes to existing scripts. To support easier interoperation with newer software, features such as the import/export of VCF and Oxford-format files and an efficient cross-platform genomic relationship matrix (GRM) calculator have been introduced. Most pipelines currently employing PLINK 1.07 can expect to benefit from upgrading to PLINK 1.9. Despite its computational advances, PLINK 1.9 can still be an unsatisfactory tool for working with imputed genomic data due to the limitations of the PLINK 1 binary file format. To address this issue, the authors designed a new core file format in PLINK 2.0 capable of representing most of the information emitted by modern imputation tools. \subsection{PRS tools that are applicable to diverse populations} Applying PRS analysis for multi-ethnic groups is still limited. However, novel PRS methods have been developed to address the applicability of PRS analysis across ethnic groups. \subsubsection{Multi-ethnic PRS analysis} Multi-ethnic PRS analysis is a new PRS approach that combines PRS analysis based on two distinct populations \cite{MrquezLuna2017}. For instance, multi-ethnic PRS analysis could merge PRS analysis based on European training data with PRS analysis based on training data from another population. The multi-ethnic PRS approach computes PRS value given a target individual with genotypes $g$ as follows: \begin{eqnarray} PRS=\sum_{i=1}^{M}{ \hat{b}_{i} g_{i}}, \end{eqnarray} where $M$ is the total number of individual's genetic markers, and $\hat{b}_{i}$ is an estimate of effect sizes. For a multi-ethnic PRS analysis, this approach uses a linear combination of the two distinct PRS values and applying mixing weights parameters $\alpha_{i}$. \subsubsection{Linear Unbiased Predictors (BLUP)} PRS analysis could be molded using the well-known approach of best linear unbiased predictors (BLUP) \cite{Chen2015}. BLUP is used to consider and linearly model both random effects and fixed effects. It is also known as genomic best linear unbiased prediction (gBLUP). \cite{Clark2013}. BLUP/gBLUP estimates PRS values using the following formula \begin{eqnarray} PRS=X\beta + g + \epsilon, \end{eqnarray} where $\beta$ is a vector of fixed effects, $g$ is the total genetic effects of the training samples and $\epsilon$ are the normally distributed residuals. To evaluate the fixed effects, BLUP considers an individual GWAS indicator, the top 5 principal components (PCs) derived with all samples together and/or a list of the significant SNPs. The BLUP approach is a computationally efficient algorithm. However, the limitation of BLUP arose due to its requirement of the Individual-level genotype data. BLUP has been implemented in GCTA software (Genome-wide Complex Trait Analysis) \url{https://cnsgenomics.com/software/gcta/#Overview}. Moreover, it has been extended to XP-BLUP to model PRS values for admixed populations\cite{Clark2013}. Also, BLUP has been extended to MultiBLUP to include multiple random effects \cite{Speed2014}. \subsubsection{Genetic Risk Scores Inference (GeRSI)} GeRSI uses mixed models by combing fixed-effects models and random-effects models for controlling population structure \cite{Golan2014}. GeRSI performs Gibbs sampling to estimate individuals' genetic risk score given the case-control study's genotypes under a random-effects model. GeRSI proposed conditional distributions of the genetic and environmental using the standard liability-threshold model. However, the limitation of GeRSI is that it requires individual-level genotypes which will not be available to many bioinformaticians. \subsubsection{Cross-population BLUP (XP-BLUP)} XP-BLUP is an extension of the BLUP method that could be applied to trans-ethnic populations \cite{Clark2013}. XP-BLUP utilizes trans-ethnic information to improve PRS value predictive accuracy in minority populations. XP-BLUP combines the linear mixed-effects model (LMM) of the GeRSI method with the BLUP method. \section{The predictive power of PRS analysis} Within the current literature that addresses the statistical power of the PRS analysis, most of these articles consider the sample size as a milestone to power the PRS analysis. For instance, in 2013, Dudbridge estimated the predictive power of the polygenic score using results from several published studies \cite{Dudbridge2013}. Dudbridge has concluded that all published studies with a significant association of PRS values are statistically well-powered. Also, Dudbridge pointed out that the accuracy of the PRS analysis depends only on the size of the initial sample (training sample). Furthermore, he provided a mathematical model to estimate the statistical power of PRS value as a function of sample size. In 2014, Middeldorp \textit{et al.} \cite{Wray2014} suggested performing PRS analysis on a sample size of 2000 individuals is good enough to obtain a statistically powered PRS value. However, Dima and Breen in 2015 \cite{Dima2015} demonstrated that a sample size of 1500 is enough to increase the predictive power to a statistically significant point. However, they stated that the predictive power of polygenic risk scores is not good enough for clinical applications but it could be used as a biomarker for traits of interest within individuals. Recently, in 2017, Krapohl \textit{et al.} \cite{Krapohl2017} introduced a multi-polygenic score that is capable of increasing the predictive power of PRS analysis. Regarding the relative accuracy of PRS values across ancestries, Yengo \textit{et al.} \cite{Wang2020} proposed a theoretical model to estimate the relative accuracy of PRS value across ancestries. Their method utilizes the frequencies of the minor alleles (MAF) in the two populations, the LD between the causal SNPs and the heritabilities. The authors assumed that causal variants are shared across ancestries. However, their effect sizes might vary. Based on their model, \cite{Wang2020} concluded that LD and MAF differences across ancestries explained 70-80\% of the loss of relative accuracy of European-based PRS value in African ancestry. \section{PRS analysis on the African population} The approach of the PRS analysis is still not applied to study traits in the African population. For instance, upon searching PubMed using the keywords: "polygenic risk" + "African", only 78 hits was obtained. This number represents about 5.45\% of total hits that were obtained without using the keyword "African". The traits studied using PRS analysis in the African population include types 1 \& 2 diabetes mellitus, depression, ischemic stroke, schizophrenia, sarcoidosis , alzheimer's disease, obesity, insomnia disorder, post-traumatic stress and cancer. The following paragraphs will demonstrate the selected PRS studies done on the African sub-saharan populations. Also, we will highlight their outcomes. In 2020, Ekoru and his colleagues investigated the genetic risk scores for cardiometabolic traits in several African ancestries, including sub-saharan African populations \cite{Ekoru2020}. They concluded that the predictive power of the risk score is limited in the African ancestry populations. They stated that this limitation is due to the insufficient diversity among their samples of genomic discovery. Therefore, they adjusted for ancestry-derived principal components to obtain up to 5-fold and 20-fold higher predictive power. However, they observed that the predictive power of genetic risk scores was higher in the African Americans (n=9139) and the European Americans (n=9594) relative to the sub-saharan African populations (n=5200). Based on their outcome, Ekoru and his colleagues concluded that PRS analysis performs poorly in sub-saharan African populations. Also, they recommended paying attention to the representation of multi-ethnic populations in genomic studies to improve the power of the genetic risk scores. In 2020, Hayat and her colleagues investigated the genetic associations between serum low LDL-cholesterol levels and selected genetics variants in sub-saharan African of four countries; Kenya, South Africa, Ghana and Burkina Faso \cite{Hayat2020}. Using 1000 genomes data from the African populations, they selected four genes for their investigation (\textit{LDLR}, \textit{APOB}, \textit{PCSK9}, and \textit{LDLRAP1}). They performed genotyping of 19 SNPs using 1000 participants in the Human Heredity and Health in Africa (H3Africa) AWI-Gen Collaborative Center (Africa, Wits-INDEPTH Partnership for GENomic studies). Although they used a limited number of variants, their outcome showed significant associations of these SNPs with lower LDL-cholesterol levels in sub-saharan Africans. In 2020, Cavazos and Witte have proposed the inclusion of variants discovered from various populations to improve PRS transferability for diverse populations \cite{Cavazos2020}. They used both simulated data for the Yoruba group for the sub-saharan African population and European populations. They tested their findings on real data consisting of diabetes-free training samples of European ancestry (\emph{n} = 123,665) and African descent (\emph{n} = 7,564). They evaluated performance of PRS analysis using genotype and phenotype data for a test (predictive) sample of European ancestry (\emph{n} = 394,472) individuals of African origin from the UK Biobank (\emph{n} = 5,886). Based on their findings, they concluded that incorporating variants selected from the European population will limit the accuracy of PRS values in non-Europeans populations including African communities. Also, they commented on the need for diverse GWAS data to improve PRS accuracy across populations. In 2017, Marquez-Luna \textit{et al.} \cite{MrquezLuna2017} proposed a multi-ethnic PRS analysis to improve risk prediction in diverse populations including the African community. To overcome the lack of enough training data for the African populations, the authors combined the training data to involve data from European samples and training data from the target population. As the authors did not state whether they used sub-saharan African communities, we did not include their study. However, this highlights the challenge of performing PRS analysis in sub-saharan African populations due to lack of enough training data. In 2017, Vassos \textit{et al.} had examined PRS values in a group of individuals with first-episode psychosis \cite{Vassos2017}. For the control sample, they combined African European (\emph{n} = 70) and a sample of sub-saharan African ancestry (\emph{n}=828). Their finding showed that PRS value was more potent in Europeans i.e. 9.4\% discriminative ability than in Africans i.e. only 1.1\% discriminative ability in Africans. Moreover, PRS analysis has been applied to investigate the risk score for prostate cancer. Prostate cancer is considered a complex genetic disease with high heritability and disproportionally affects men of African descent\cite{Rebbeck2017}. In a study to predict the risks of prostate cancer in urban African populations, involving seven African study sites as well as European men from the 1000 Genomes Project. It was determined that risks of prostate cancer are much more significant for African genomes than European genomes (\emph{p}-value $<$ 2.2 x 10-16, Wilcoxon rank-sum test). This continental level pattern is consistent with public health data\cite{Bray2018}. A further investigation done by the team of MADCaP (Men of African Descent and Carcinoma of the Prostate Consortium) to study sites portrayed a substantial amount of overlap in the PRS distributions of different African populations. Based on their findings, the investigators of MADCaP observed within-continent heterogeneity for the predicted risk of prostate cancer. Their findings showed that individuals from Dakar, Senegal have lower predicted risks of prostate cancer than other African study sites while individuals from Abuja, Nigeria have higher predicted risks of prostate cancer than other African study sites. The MADCaP team concluded that allele frequency differences at common disease-associated loci could contribute to population-level differences in prostate cancer risk. \section{Challenges of PRS analysis for the African population} Many PRS methods have been developed and applied to test the risk score of individuals. Nevertheless, PRS analysis has not yet been used in the clinical field for the African population. There are still many limitations and challenges regarding the application of PRS analysis in the African population. One of these challenges is lack of sufficient data to perform PRS analysis. For instance, querying the a term "sub-saharan" in the GWAS Catalog repository, the search resulted in only 70 publications out of 4,628 papers. Considering that several publications might use the same GWAS data, we could affirm that more GWAS experiments need to be done for the sub-saharan African population. This might be due to lack of infrastructure and funding to perform GWAS experiments in many countries in Africa. Also, such restrictions might be due to the fact that many African scientists are still focusing their research on infectious diseases like malaria, tuberculosis and HIV. However, providing funding priority for infectious diseases is necessary for the African communities as they account for a higher mortality rate in Africa. Due to lack of enough training and test data sets, some scientists choose to use training data from European samples which results in decreasing PRS prediction accuracy. Therefore, PRS analysis is not widely applied to clinical research in Africa. Moreover, considering the diversity among African population, the model used for PRS analysis might not work for African sub-populations. Therefore, our future direction would be to develop African-specific PRS methods that combine different sources of information. Another challenge in performing and applying PRS analysis in the African population is the lack of long-term funds for GWAS experiments. Therefore, African state authorities should be made aware of this challenge, so as to make more funds available for genomic research. Howbeit, the funds should not be limited to the research institutes and principal investigators alone, they should equally be directed towards the provision of scholarships (postgraduate programs like PhD) and financial aids for young African researchers. We have some promising African research consortiums (e.g. the pan African Bioinformatics Network for the Human Heredity and Health in Africa (H3ABioNet, {\it h3abionet.org}) and the Human Heredity and Health in Africa (H3Africa, {\it h3africa.org})) that are contributing in this regard. However, their funds come from outside Africa. There are also regional African efforts like the World Bank funded Africa Center of Excellence (ACE) I and the one following this, the ACE Impact, but these initiatives consist of few genomic research projects. A follow up project to the H3Africa, dedicated to data science health research, entitled Harnessing Data Science for Health Discovery and Innovation in Africa (DS-I Africa) will soon commence. Moreover, lack of a pan-African genomic advisory board remains another challenge for genomic research in Africa including PRS analysis. The existence of such a research advisory board would help research transparency and establish ethical guidelines to perform genomic research. This could open the window to get more grants from funding agencies such as the National Center for Biotechnology Information (NCBI). It is clear that without a rigorous ethical guide and transparency policies, it is hard to get long-term funds. \section{PRS analysis on type-2 diabetes, breast and prostate cancers} PRS analysis has been successfully applied to estimate and identify individuals with genetic risk for many biological traits especially type-2 diabetes, breast cancer and prostate cancer (See supplementary file S1). Most of these studies provide significant evidence of the success of PRS analysis in identifying patients who are at high risk of developing disease complications. Hence, the primary strength of PRS analysis is its capability of stratifying individuals based on their probability of developing a disease. Also, the biological power of PRS analysis arose due to its potential capacity to identify therapeutic and genomic pathways for type-2 diabetes, breast cancer and prostate cancer. Moreover, applying PRS analysis on these traits showed that PRS results are reproducible in the European population. Nonetheless, one weakness of applying PRS analysis on these traits is its limited ability in detecting the false-positive results. Also, it is observed that most PRS studies are only available for European ancestries. Therefore, we can not apply them to non-European communities. In addition, performing PRS analysis on a sizeable multi-ethnic data is indispensable for obtaining more accurate PRS values across populations. Furthermore, the possibility of applying PRS outcomes for personalized medicine requires robust validation procedures before broad clinical applications for multi-ethnic communities. \section{Conclusion and future research} There are several approaches under the umbrella of PRS analysis. GWAS are conducted on finite samples extracted from particular subsets of the human population. Moreover, the SNP effect size estimates are some combination of true effect and stochastic variation, thus producing 'winner's curse' among the top-ranking associations, and the estimated effects may not generalized well to different populations. Furthermore, the correlation complicates the aggregation of SNP effects across the genome, therefore to apply PRS analysis across ethnic groups, 'Linkage Disequilibrium' (LD) holds the key. Thus, critical factors in the development of methods for calculating PRS values are \begin{itemize} \item The potential adjustment of GWAS estimated effect sizes e.g. via shrinkage and incorporation of their uncertainty; \item The tailoring of PRS values to target populations; and \item The task of dealing with LD. \end{itemize} As members of the H3Africa consortium and the associated bioinformatics consortium, H3ABioNet (see \url{h3abionet.org} and \url{https://sysbiolpgwas.waslitbre.org}), we are working to extend existing methods to be applicable to African populations. Also, one future direction will be to develop an African-specific PRS method that combines the different sources of information. \section{Acknowledgements} Research reported in this publication is supported by the National Human Genome Research Institute (NHGRI), Office Of The Director, National Institutes Of Health (OD) under award number U24HG006941 and the World Bank funding for the ACE Impact projects. The content is solely the responsibility of the authors and does not necessarily represent the official views of the National Institutes of Health and the World Bank. Our special thanks to Kalyani Dhusia for her editorial assistance. \section{Competing interests} The authors declare that they have no competing interests \section{Organization Description} H3ABioNet is a pan-African bioinformatics network comprising 28 bioinformatics research groups distributed amongst 16 African countries and 2 partner institutions in the USA. The consortium supports H3Africa researchers and their projects whilst developing bioinformatics capacity within Africa \nolinenumbers \bibliographystyle{unsrt}
\section{Introduction} Lung cancer is the leading cause of cancer-related deaths in both men and women in the United States\citep{seigel2020}. The standard treatment for inoperable or unresectable stage III \textcolor{black}{\textcolor{black}{locally advanced non-small cell lung cancer} (LA-NSCLC)} cancers is definitive/curative radiotherapy to 60 Gy in 30 fractions with concomittant chemotherapy\citep{bradley2020}. Recently, dose escalation trials and high-dose adaptive radiotherapies\citep{Weiss2013,Kavanaugh2019} have shown the feasibility to improve local control and survival in LA-NSCLC. However, a key technical challenge in delivering high-dose treatments, both at the time of planning and delivery is accurate and precise delineation of both target tumors and normal organs\citep{Sonke2010}. Importantly, X-ray cone beam CT (CBCT) imaging is available as part of standard equipment. However, much of the in-treatment-room CBCT information cannot be used routinely beyond basic positioning corrections. In fact, a key obstacle for clinical adoption of adaptive radiotherapy for LA-NSCLC is the lack of reliable segmentation tools, needed for geometric corrections in target and possibly the critical OARs\citep{Kavanaugh2019,Sonke2019}. Despite the widespread development of deep learning segmentation methods, to our best knowledge, there are no reliable CBCT methods for routine lung cancer treatment. The latest works published were primarily focused on the pelvic regions for prostate cancer radiotherapy\citep{jia2019,Fu2020,Lei2020}. The difficulty in generating accurate segmentation results from the lack of sufficient soft-tissue contrast on CBCT imaging, especially for centrally located cancers. Low soft-tissue contrast makes it inherently difficult to extract features that clearly differentiate the target from its background structures even for a deep learning method. Prior works\citep{Fu2020,Lei2020} have used pseudo MRI (pMRI) produced from CBCT to produce more accurate pelvic organs segmentation than CBCT alone. The key idea is that pMRI, which mimics the statistical intensity characteristics of MRI contains better soft tissue contrast than CBCT, which helps accuracy. Our approach improves this idea whereby MRI is used to regularize the extraction of more informative CBCT segmentation features even on less informative CBCT modality. Unlike the approach in Fu et.al\citep{Fu2020}, which required paired CT and MRI image sets, our approach uses unpaired CBCT and MRI images, which are easier to obtain and practically applicable without requiring specialized imaging protocols for algorithm development. Our approach introduces unpaired cross-modality distillation learning. Distillation learning was introduced to compress the knowledge contained in an information rich, high-capacity network (trained with a large training data) into a small, low-capacity network\citep{hinton2015distilling}, using paired images. Model compression is meaningful when a high-capacity model is not required for a task or the computational limitation of using such a large classifier necessitates the use of simpler and computationally fast model \citep{bucilua2006model} for real-time analysis. The approach in\citep{hinton2015distilling} used same modality images and was used to solve different image-based classification tasks. Distillation itself was done by using the probabilistic ''softMax" outputs of the teacher as target output for the student (compressed) network. Improvements to this approach included hint learning for image classification, where features from intermediate layers in the student network are constrained to mimic the features from the teacher network \citep{romero2014fitnets,li2017mimicking}. Recent works in computer vision, extended this approach using low- and high-resolution images\citep{su2016cross}, as well as for different modality distillation between paired (Red, Green, Blue) or RGB and depth images\citep{gupta2016cross} for semantic segmentation. Our work extends this approach to unpaired distillation learning using explicit hints between MRI and CBCT images. Also, we modify how the knowledge distillation is employed, whereby instead of transferring knowledge from a very deep network into a smaller network, the teacher and student networks are identical except for the imaging modalities used to train them. The teacher network is trained with a more informative MRI, \textcolor{black}{while the student CBCT network is \textcolor{black}{regularized} to extract similar features for inference like the teacher network.} As a result, only the CBCT segmentation network is required for testing. Methods that require pMRI as an additional input\citep{Fu2020,jia2019} need both cross-modality I2I translation and the segmentation network at testing time. This work builds on our prior work that used unpaired MRI and contrast enhanced CT (CECT) datasets to improve CECT lung tumor segmentation\citep{jiang2019}. Our approach called cross-modality educed distillation learning (or CMEDL) extends this approach to more challenging CBCT images. We tested the hypothesis that MRI information extracted using unpaired CBCT and MRI can \textcolor{black}{regularize features} computed by the CBCT network and improve performance over CBCT only segmentation. End-to-end network training also benefits from these losses to improve I2I translation. Our contributions include: (i) a new unpaired cross-modality educed distillation-based segmentation framework for regularizing inference on less informative modality by using more informative imaging modality, (ii) application of this framework to the challenging CBCT lung tumor segmentation, and (iii) implementation of our framework using two different segmentation networks, with performance comparisons done against other related approaches. \section{Materials and Methods} \subsection{Patient and image characteristics} \textcolor{black}{A total of 274 weekly CBCT scans from 69 unique patients diagnosed with LA-NSCLC and treated with conventionally fractionated radiotherapy, and sourced from 49 internal and 20 external institution dataset\citep{hugo2017} were analyzed. The internal scans had segmentations on weekly CBCTs with a maximum of 7 per patient. \textcolor{black}{Only week 1 CBCTs from the external dataset were analyzed.} \textcolor{black}{Two of 49 internal patients had seven weekly CBCTs; 18 had six weekly CBCTs; 18 had five weekly CBCTs; 9 had four weekly CBCTs and the remaining 2 had three weeks CBCT segmented.}} The internal CBCT scans were acquired for routinely monitoring geometric changes of tumor in response to radiotherapy. The external institution 4D CBCT scans were orginally collected for investigating breathing patterns of LA-NSCLC patients undergoing chemoradiotherapy. Image resolution for the weekly 4DCBCT were 0.98 to 1.17 mm in-plane spacing and 3mm slice thickness. Each CBCT image was standardized and normalized using its global mean and standard deviation and then registered to the planning CT scans using a multi-resolution B-spline regularized diffeomorphic image registration\cite{Tustison2013, alam2020}. All contours were reviewed by a radiation oncologist and modified when necessary and served as expert delineation. B-spline registration was performed using a mesh size of 32mm at the coarsest level and was reduced by a factor of two at each sequential level. The optimization step was set to 0.2 with the number of iterations (100, 70, 30) at each level. Additional details of this registration for these datasets are in\cite{alam2020}. Eighty one T2-weighted turbo spin echo (TSE) MRI for cross-modality learning was obtained from 28 stage II-III LA-NSCLC patients scanned every week on a 3T Philips Ingenia scanner. \textcolor{black}{Eleven out of these 28 had weekly MRI scans ranging between 6 to 7 weeks. Seven of these 11 patients overlapped with the internal MSK CBCT cohort. However, the MRI and CBCT images were neither co-registered nor treated as paired image sets for the purpose of training.} The MRI scan parameters were: 16-element phased array anterior coil and a 44-element posterior coil (TE/TR = 120/3000-6000ms, slice thickness of 2.5mm, in-plane pixel size of 1.1 $\times$ 0.97$mm^2$, flip angle of 90$^{\deg}$, number of averages = 2, and field of view of 300 $\times$ 222 $\times$ 150$mm^3$. \subsection{Approach} An overview of our cross-modality educed distillation (CMEDL) approach is shown in Fig.~\ref{fig:methods}. The end-to-end trained network consists of an unpaired cross-domain adaptation (UDA) network composed of a generational adversarial network (GAN)\cite{goodfellow2014generative} and a segmentation distillation network (SDN), which includes a teacher MRI and student CBCT segmentation network. The teacher network is trained with expert segmented MRI and pMRI images. TheCBCT network is trained with expert-segmented CBCT images. Feature distillation is performed by hint learning\cite{romero2014fitnets}, whereby feature activations on the CBCT network in specific layers (last and penultimate) are forced to mimic the corresponding layer feature activations of the teacher network extracted from corresponding synthesized pMRI images. \subsection{Notations} The network is trained using a set of expert-segmented CBCT $\{x_c, y_c\} \in \{X_{C}, Y_{C}\}$ and MRI $\{x_m, y_m\} \in \{X_{M}, Y_{M}\}$ datasets. The CBCT and MRI do not have to arise from the same sets of patients and are not aligned for network training. The cross-modality adaptation network consists of generators $G_{C \rightarrow M}: x_{c} \mapsto x_{m}$ to produce pseudo MRI $x_{m}^{\prime}$, $G_{M \rightarrow C}: x_{m} \mapsto x_{c}$ to produce pseudo CT images $x_{c}^{\prime}$, and domain discriminators $D_M$ and $D_C$. The sub-networks $G_{M \rightarrow C}$ and $D_{C}$ are used to enforce cyclically consistent transformation when using unpaired CBCT and MRI datasets. Feature vectors produced through a mapping function $F(x): x \mapsto f(x)$ are indicated using italized text \textit{$f_j$\/}\rm, where $j=1, \ldots K$, for $K = H \times W \times C$ for 2D and $K = H \times W \times Z \times C$ for 3D, is the number of features for an image of height $H$, width $W$, depth $Z$, and channels $C$. \subsection{Stage I: Unpaired cross-domain adaptation for image-to-image translation} The UDA network is composed of a pair of GANs for producing pseudo MRI $x_{m}^{\prime}$ and pseudo CT $x_{c}^{\prime}$ images using generator networks $G_{C \rightarrow M}$ and $G_{M \rightarrow C}$, respectively. The images produced by these generators are constrained by global intensity discriminators $D_M$ and $D_C$ for MRI and CBCT images, respectively. The adversarial loss for these two networks are computed as: \begin{equation} \begin{split} \setlength{\abovedisplayskip}{0pt} \setlength{\belowdisplayskip}{0pt} & L^{M}_{adv}(G_{C \rightarrow M}, D_{M}, X_{M}, X_{C})= \mathbb{E}_{x_{m} \sim X_{M}} [log(D_{M}(x_{m}))] + \mathbb{E}_{x_{c} \sim X_{C}} [log(1-(D_{M}(G_{C \rightarrow M}(x_{c}))] \\ & L^{C}_{adv}(G_{M \rightarrow C}, D_{C}, X_{C}, X_{M}) = \mathbb{E}_{x_{c} \sim X_{C}} [log(D_{C}(x_{c}))] + \mathbb{E}_{x_{m} \sim X_{M}} [log(1-(D_{C}(G_{M \rightarrow C}(x_{m}))]. \end{split} \label{eqn:adversary loss_MRI} \end{equation} Because the networks are trained with unpaired images, cyclical consistency is enforced to shrink the space of possible mappings computed by the generator networks. The loss to enforce this constraint is computed by minimizing the pixel-to-pixel loss (e.g. L1-norm) between the generated (e.g. $G_{ \circlearrowleft M} = G{M \rightarrow C}(G_{C \rightarrow M}(x_c))$) and original images as: \begin{equation} \begin{split} L_{cyc}(G_{C \rightarrow M}, G_{M \rightarrow C},X_{c}, X_{m}) = \mathbb{E}_{x_{c} \sim X_{c}}\left[\left\|G_{C\circlearrowleft M}(x_{c}) - x_{c}\right\|_{1}\right] + \mathbb{E}_{x_{m} \sim X_{m}}\left[\left\|G_{M\circlearrowleft C}(x_{m}) - x_{m}\right\|_{1}\right]. \end{split} \end{equation} However, the cyclical consistency loss alone can only preserve global statistics while failing to preserve organ or target specific constraints\cite{jiang2018tumor}. Furthermore, when performing unpaired adaptation between unaligned images, pixel-to-pixel matching losses are inadequate to preserve spatial fidelity of the structures \cite{mechrez2018contextual}. Therefore, we used the contextual loss that was introduced in\cite{mechrez2018contextual}. The contextual loss is computed by matching the low- or mid-level features extracted from the generated and the target images using a pre-trained network like the VGG19\cite{simonyan2014very} (default network used in this work). This loss is computed by treating the features as a collection and by computing all feature-pair similarities, thereby, ignoring the spatial locations. In other words, the similarity between the generated ($f(G(x_{c})) = {g_{j}}$) and target feature maps ($f(x_{m})={m_{i}}$) are marginalized over all feature pairings and the maximal similarity is taken as the similarity between those two images. Therefore, this loss also considers the textural aspects of images when computing the generated to target domain matching. It is similar to perceptual losses, but ignores the spatial alignment of these images, which is advantageous when comparing non-corresponding target and source modality generated images. The contextual similarity is computed by normalizing the inverse of cosine distances between the features $g_j$ and $m_i$ as: \begin{equation} CX(g,m) = \frac{1}{N}\sum_{j} \underset{i}max CX(g_{j},m_{i}), \end{equation} where, $N$ corresponds to the number of features. The loss is computed as: \begin{equation} L_{cx} = -log(CX(f(G(x_{c})), f(x_{m})). \end{equation} The pseudo MRI images produced through I2I translation from this stage are used in the distillation learning as described below. \subsection{Stage II: Cross-modality distillation-based segmentation} This stage consists of a teacher (or MRI) segmentation and a student (or CBCT) segmentation network. The goal of distillation learning is to provide hints to the student network such that features extracted in specific layers of the student network match the feature activations for those same layers in the teacher network. Both teacher ($S_M$) and student ($S_C$) networks use the same network architecture (Unet is the default architecture), but process different imaging modalities. Both networks are trained from scratch. The teacher network is trained using expert segmented T2w TSE MRI ($\{x_m, y_m \in \{X_M, Y_M\}$) and pseudo MRI datasets ($\{x_{m}^{\prime}, y_{c}\} \in \{X_{C}, Y_{C}\}$) obtained from expert-segmented CBCT datasets. The CBCT network is trained with the expert-segmented CBCT datasets. The two networks are optimized using Dice overlap loss: \begin{equation} \setlength{\abovedisplayskip}{1pt} \setlength{\belowdisplayskip}{1pt} \begin{split} L_{seg} & = L_{seg}^{M}+L_{seg}^{C}\\ & =\mathbb{E}_{x_{m}\sim X_{M}}[-log P(y_{m}|S_{M}(x_{m}))] + \mathbb{E}_{x_{m}^{\prime}\sim G_{C\rightarrow M}(X_{C})}[-log P(y_{c}|S_{M}(x_{m}^{\prime}))] \\ & + \mathbb{E}_{x_{c}\sim X_{C}}[-log P(y_{c}|S_{C}(x_{c}))]. \label{eqn:Seg} \end{split} \end{equation} Feature distillation is performed by matching the feature activations computed on the pseudo MRI using $S_M$ and the feature activations extracted on corresponding CBCT images from the $S_C$ networks. Because the features closest to the output are the most correlated with the task\citep{lin2017refinenet}, we match the features computed from the last two network layers by minimizing the L2 loss: \begin{equation} \setlength{\abovedisplayskip}{1pt} \setlength{\belowdisplayskip}{1pt} \begin{split} L_{hint} & = \sum_{i=1}^{N} \|\phi{_{C,i}}(x_{c})-\phi{_{M,i}}(G_{C\rightarrow M}(x_{c}))||^{2} \label{eqn:Feature} \end{split} \end{equation} where $\phi_{C,i}, \phi_{M,i}$ are the $i_{th}$ layer features computed from the two networks, $N$ is the total number of features. As identical network architecture is used in both networks, the features can be matched directly without requiring an additional step to adapt the features size as shown in \citep{romero2014fitnets}. We call this loss the hint loss. \\ The total loss is expressed as: \begin{equation} \textrm{Loss} = L_{adv} + \lambda_{cyc} L_{cyc} + \lambda_{CX} L_{CX} + \lambda_{hint} L_{hint} + \lambda_{seg} L_{seg} \label{eqn:Total_loss} \end{equation} where $\lambda_{cyc}$, $\lambda_{CX}$, $\lambda_{hint}$ and $\lambda_{seg}$ are the weighting coefficients for each loss.\\ The network update alternates between the cross-modality adaptation and segmentation distillation. The network is updated with the following gradients, $-\Delta_{\theta_{G}}(L_{adv}+ \lambda_{cyc}{L_{cyc}}+ \lambda_{CX}{L_{CX}}+ \lambda_{hint}L_{hint}+ \lambda_{seg}L_{seg}$, $-\Delta_{\theta_{D}}(L_{adv})$ and $-\Delta_{\theta_{S}}(L_{hint}+L_{seg})$. \subsection{Implementation details} \paragraph{Cross-modality adaptation network structure: \/} \textcolor{black}{The UDA network architectures were constructed based on well-proven architectures as used in our prior work for CT and MRI domain adaptation\citep{jiang2018tumor,jiang2019MIC,jiang2020} for tumor and organ at risk segmentation.} The generator architectures were adopted from DCGAN \citep{radford2015unsupervised}, \textcolor{black}{which has been proven to avoid issues of mode collapse.} Specifically, the generators consisted of two stride-2 convolutions \citep{radford2015unsupervised}, 9 residual blocks \citep{He2015} and two fractionally strided convolutions with half strides. Generator network used rectified linear unit (ReLU) \citep{radford2015unsupervised} \textcolor{black}{in order to increase stability of training. Similary, instance normalization \citep{ulyanov2017improved} as done in \cite{zhu2017unpaired} in all but the last layer, which has a \textit{tanh} activation for image generation to increase training stability.} \begin{figure*} \begin{center} \includegraphics[width=0.9\columnwidth,scale=0.5]{ct_smri_method_redraw.pdf} \vspace{-0.05cm}\setlength{\belowcaptionskip}{-0.4cm}\setlength{\abovecaptionskip}{0.08cm}\caption{\label{fig:methods} \small Approach overview. $x_{c}, x_{m}$ are the CBCT and MR images from unrelated patient sets; $G_{C \rightarrow M}$ and $G_{M \rightarrow C}$ are the CBCT and MRI translation networks; $x_{m}^{'}$ is the pseudo MRI (pMRI) image; $x_{c}^{'}$ is the pseudo CBCT image; $S_{MR}$ is the teacher network; $S_{CT}$ is the student CBCT segmentation network; CX loss is contextual loss. $L^{rM}_{seg}, L^{pM}_{seg}$ are segmentation losses used to train the teacher network, while $L^{ct}_{seg}$ is the loss for the student CBCT network.} \end{center} \end{figure*} \begin{figure*} \begin{center} \includegraphics[width=1\columnwidth,scale=1]{Segmentation_structure_1.pdf} \vspace{-0.05cm}\setlength{\belowcaptionskip}{-0.4cm}\setlength{\abovecaptionskip}{0.08cm}\caption{\label{fig:seg_structure} \small The segmentation structure of Unet \citep{ronneberger2015u} and DenseFCN57 \citep{jegou2017one}. The red arrow indicates that the output of these layers are used for distilling information from MR into CT. This is done by minimizing the L2-norm between the features in these layers between the two networks. The blue blocks indicate the lower layer; the green blocks indicate the middle layer; the orange blocks indicate the upper layer in Unet. Best viewed in color.} \end{center} \end{figure*} \textcolor{black}{A patchGAN discriminator as suggested in \citep{isola2017image}, and which uses 70$\times$70 overlapping pixel image patches was used to increase the number of pixel patches to distinguish real vs. fake images to improve the stability of the discriminator. We have used a patchGAN discriminator in our prior works\citep{jiang2018tumor,jiang2020} and found it to achieve stable performance for both tumor and organ segmentation from CT and MRI. Leaky ReLU instead of ReLU was used based on the results from DCGAN\citep{radford2015unsupervised}, along with batch normalization \citep{ioffe2015batch} in all except the first and last layers to increase discriminator stability in training.} \\ \textcolor{black}{A pre-trained VGG19 based on the standard VGGNet\citep{simonyan2014very} was used for memory efficiency.} The VGG19 consists of 16 layers of convolution filter with size 3$\times$3, 3 layers of fully connection layers and 5 maxpool layers. The lower level feature convolution filters which were of size 3$\times$3$\times$64, were progressively doubled to increase the number of feature channels while reducing the feature size through subsampling using \textit{maxpool} operation. \paragraph{Segmentation networks structure:} We implemented Unet \citep{ronneberger2015u} and DenseFCN \citep{jegou2017one} networks. \textcolor{black}{We chose these networks as these are the most commonly used segmentation architectures in medical image segmentation and have shown fairly good performance for multiple disease sites.} \\ The U-Net \citep{ronneberger2015u} is composed of series of convolutional blocks, with each block consisting of convolution, batch normalization and ReLU activation. Skip connections are implemented to concatenate high-level and lower level features. Max-pooling layers and up-pooling layers are used to down-sample and up-sample feature resolution size. We use 4 max-pooling and 4 up-pooling in the implemented U-Net structure. The layers from the last two block of Unet with feature size of 128$\times$128$\times$64 and 256$\times$256$\times$64 are used to tie the features, shown as red arrow in Fig. \ref{fig:seg_structure} (a). This network had 13.39 M parameters and 33 layers\footnote{layers are only counted on layers that have tunable weights} of Unet. The Dense-FCN \citep{jegou2017one} is composed of Dense Blocks (DB) \citep{huang2017densely}, which successively concatenates feature maps computed from previous layers, thereby increasing the size of the feature maps. A dense block is produced by iterative concatenation of previous layer feature maps within that block, where a layer is composed of a Batch Normalization, ReLU and 3$\times$3 convolution operation, as shown in Fig.4 (b). Such a connection also enables the network to implement an implicit dense supervision to better train the features required for the analysis. Transition Down (TD) and Transition UP (TU) are used for down-sampling and up-sampling the feature size, respectively, where TD is composed of Batch Normalization, ReLU, 1$\times$1 convolution, 2$\times$2 max-pooling while TU is composed of 3$\times$3 transposed convolution. We use the DenseFCN57 layer structure \citep{jegou2017one}, that uses dense blocks with 4 layers for feature concatenation and 5 TD for feature down-sampling and 5 TU for feature up-sampling with a growing rate of 12. \textcolor{black}{Although the authors of DenseFCN\citep{jegou2017one} provide implementations for deeper networks, including DenseFCN67, DenseFCN120, we used DenseFCN57 as it has the least cost when combined with the cross-modality adaptation network using the CycleGan framework.} This resulted in 1.37 M parameters and 106 layers of DenseFCN. \paragraph{Networks training:} All networks were implemented using the Pytorch \citep{paszke2017automatic} library and trained end to end on Tesla V100 with 16 GB memory and a batch size of 2. The ADAM algorithm \citep{kingma2014adam} with an initial learning rate of 1e-4 was used during training for the image translation networks. The segmentation networks were trained with a learning rate of 2e-4. We set $\lambda_{adv}$=1, $\lambda_{cyc}$=10, $\lambda_{CX}$=1, $\lambda_{hint}$=1 and $\lambda_{seg}$=5 for the coeffcient of equation \ref{eqn:Total_loss}. A pre-trained VGG19 network using the ImageNet dataset was used to compute the contextual loss. The low level features extracted using VGG19 quantify edge and textural characteristics of images. Although such features could be more useful for quantifying the textural differences between the activation maps, the substantial memory requirement for extracting these features precluded their use in this work. Instead we used higher level features computed from layers Conv7, Conv8, and Conv9 that capture the mid- and high-level contextual information between the various organ structures. The feature sizes were 64$\times$64$\times$256, 64$\times$64$\times$256 and 32$\times$32$\times$512, respectively. \textcolor{black}{Two hundred and sixteen CBCT scans composed of 206 weekly scans from 40 internal patient, and 10 external dataset\citep{hugo2017} were used for network training. In order to increase the number of training examples and obtain a more generalizable model, the networks were trained with 42,740 2D image slices containing the tumor after cropping the original images (512 $\times$ 512) into 256 $\times$ 256 image patches of CBCT and 21,967 2D image slices of MRI image. Image cropping was done by automatic removal of regions outside the body region through intensity thresholding, followed by hole filling, and connected components extraction to identify the largest component or body region. Online data augmentation including horizontal flipping, scaling, rotation, and elastic deformation was used. Early stopping strategy was used to avoid over-fitting and the networks were trained up to utmost 100 epochs.} \textcolor{black}{The trained models were validated on an independent set of 20 CBCT scans arising from 3 internal patients with 15 weekly segmented CBCTs and 5 week 1 CBCT from the external institution dataset.} \textcolor{black}{Testing was done on 38 CBCT scans from 6 internal patients with 33 weekly segmented CBCTs and 5 week 1 CBCT from the external institution dataset. Image sets from patients were separated such that all CBCT scans pertaining to a patient did not overlap across the training, validation, and testing sets to prevent any potential for data leak.} In order to support reproducible research, we will make the code for our approach available with reasonable request upon acceptance for publication. \section{Experiments and Results} Experiments were done to test the hypothesis \textcolor{black}{that guiding the CBCT network training to extract as informative features as the MRI network will produce more accurate tumor segmentation on CBCT. In other words, the CBCT network is regularized to extract features similar to those extracted by the teacher network.} We tested our distillation learning framework on two different commonly used segmentation networks, the Unet and denseFCN to measure performance differences due to network architecture. We also evaluated whether the pMRI images produced through the UDA network were more useful than the CBCT images for segmentation. For this purpose, we used the UDA and the teacher network of the CMEDL architecture. The default CMEDL network only requires the student CBCT network during testing. We also evaluated the performance of pMRI based segmentation using standard cycleGAN and a Unet segmentator, which is somewhat similar to the work in Lei et.al\citep{Lei2020} and the more advanced variational auto-encoder using the unpaired image to image translation (UNIT)\citep{li2017universal} with the Unet network. \textcolor{black}{Additionally, we evaluated whether combining the pMRI with the CBCT as an additional channel in the input resulted in performance improvement. For this experiment, the pMRI was generated using a cycleGAN . Finally, we benchmarked the performance of the 2D CMEDL network against a 3DUnet network\cite{cciccek20163d}}. \\ All networks were trained from scratch using identical sets of training and testing datasets. Reasonable hyper-parameter optimization was done to ensure good performance by all networks. \subsection{Network training stability} \textcolor{black}{Fig.\ref{fig:train_curve} shows the training and validation loss curves for both Unet and denseFCN networks trained with and without CMEDL approach. As shown, all networks achieved stable loss performance, albeit the CMEDL approach resulted in better loss performance with the same length of training as the CBCT only network architectures.} \subsection{Evaluation Metrics} Segmentation performance was evaluated from 3D volumetric segmentations produced by combining segmentations from 256$\times$256 pixel 2D image patches. In order to establish the clinical utility of the developed method, we computed surface Dice similarity coefficient (SDSC) metric\cite{nikolov2018deep}, which was shown to be more representative of any additional effort needed for clinical adaptation\cite{Vassen2020} than the more commonly used geometric metrics like DSC and Hausdroff distances. For completeness, we also report the DSC and Hausdroff distance metric at 95th percentile (HD95) as recommended in prior works\cite{menze2015multimodal}. The surface DSC metric emphasizes the incorrect segmentations on the boundary, as this is where the edits are most likely to be performed by clinicians for clinical acceptance. It is computed as: \begin{equation} \begin{split} D_{i,j}^{(\tau)}=\frac{\mid S_{i}\cap B_{j}^{(\tau)} \mid + \mid S_{j}\cap B_{i}^{(\tau)} \mid }{\mid S_{i} \mid + \mid S_{j} \mid} \end{split} \label{eqn:Surface DSC metric} \end{equation} where $B_{i}^{(\tau)}$ $\subset$ $R^{3}$ is a border region of the segmented surface $S_{i}$. The tolerance threshold $\tau =$ 4.38$mm$ was computed using the standard deviation of the HD95 distances of 8 segmentations performed by two different experts blinded to each other. Statistical comparisons between the various methods was performed to assess the difference between the CMEDL vs. other approaches using paired Wilcoxon two-sided tests using the DSC accuracy measure. Adjustments for multiple comparisons were performed using Holm-Bonferroni method. \subsection{\textcolor{black}{Comparison of CMEDL and CBCT segmentation accuracy}} Table. \ref{tab:CBCT_result_Unet} shows the segmentation accuracies on the validation and test sets produced by various methods for the Unet network. The accuracies for DenseFCN method are also shown in Table.\ref{tab:CBCT_result_Dense}. CMEDL and pMRI-CMEDL methods were significantly more accurate than CBCT only networks using both Unet ($P <0.001$ using DSC and SDSC) and DenseFCN ($P<0.001$ using DSC and SDSC) networks. These two methods were also more accurate than also the networks using pMRI computed from UNIT and cycleGAN networks trained separately from the segmentation network. \textcolor{black}{The approach combining pMRI as a separate channel with the CBCT in the input was the least accurate compared to all other methods indicating that just adding a pMRI as a second channel doesn't contribute to a higher accuracy, possibly as the features from the two modalities are averaged early on. Finally, the CMEDL approach also outperformed a 3DUnet network, underscoring the importance of extracting better features for differentiating target from background than incorporating information from the slices.} Fig.~\ref{fig:CBCT_Seg} shows example segmentations generated on the CBCT images by using the CBCT only, pMRI-Cycle, pMRI-UNIT, and CMEDL methods using Unet network. \begin{figure*} \begin{center} \includegraphics[width=0.9\columnwidth,scale=0.5]{train_plot.pdf} \vspace{-0.05cm}\setlength{\belowcaptionskip}{-0.4cm}\setlength{\abovecaptionskip}{0.08cm}\caption{\label{fig:train_curve} \small \textcolor{black}{The training and validation loss (1.0 - DSC) curves for Unet and DenseFCN networks trained with and without CMEDL approach. }} \end{center} \end{figure*} \begin{figure*} \begin{center} \includegraphics[width=0.7\columnwidth,scale=0.5]{segOverlay3.pdf} \vspace{-0.05cm}\setlength{\belowcaptionskip}{-0.4cm}\setlength{\abovecaptionskip}{0.08cm}\caption{\label{fig:CBCT_Seg} \small Segmentation of representative CBCT images from test set using the CMEDL approach compared with CBCT-only segmentation. Both methods used U-net as a segmentation architecture. Yellow contour indicates the manual segmentation while the red contour indicates the algorithm segmentation. The \textcolor{black}{slice-wise} DSC score of each example is also shown in the blue rectangle area. } \end{center} \end{figure*} \subsection{Pseudo MRI translation accuracy} We also measured the accuracy of translating the CBCT into pseudo MRI images using the CMEDL, CycleGAN and UNIT methods using Kullback-Leibler (KL) divergence measure. The CMEDL approach resulted in the most accurate translation with the lowest KL divergence of 0.082 when compared with 0.42 for CycleGAN and 0.29 for the UNIT method. Fig.~\ref{fig:CBCT_Translation} shows representative examples from the test set of translated pMRI images produced using the CMEDL method. As seen, tumor and various structures in the MRI are clearly visualized with clear boundary seen between tumor and central structures compared to the corresponding CBCT image. \begin{table*} \centering{\caption{Segmentation accuracy for CBCT dataset using the various approaches using Unet networks.} \label{tab:CBCT_result_Unet} \centering \scriptsize \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline \hline {\multirow{2}{*}{Net}}&\multicolumn{1}{|c|}{ }& \multicolumn{3}{|c|}{Validation (N = 20)} & \multicolumn{3}{|c|}{Test (N = 38)}\\ \cline{2-8} {}&{ Method } & { DSC } & { Surface DSC } & { HD95 $mm$ }& { DSC }& { Surface DSC} & { HD95 $mm$ }\\ \hline \hline {\multirow{5}{*}{\rotatebox[origin=c]{90}{Unet}}}\multirow{1}{*}&{CBCT only } & { 0.64$\pm$0.21 }& { 0.72$\pm$0.11 } & { 16.19$\pm$11.55 }& { 0.62$\pm0.15$ }& {0.69$\pm$0.11 } & { 21.70$\pm16.34$ }\\ &\multirow{1}{*}{pMRI-Cycle } & { 0.65$\pm$0.20}& { 0.72$\pm$0.11 } & { 11.30$\pm$7.64 }& {0.66$\pm$0.12 }& { 0.74$\pm$0.13 } & { 14.43$\pm$12.22}\\ &\multirow{1}{*}{pMRI-UNIT } & {0.66$\pm$0.19 }& {0.71$\pm$0.10 } & { 10.55$\pm$6.98 }& { 0.66$\pm$0.11 }& { 0.76$\pm$0.13 } & {14.56$\pm$11.80 }\\ &\multirow{1}{*}{\textcolor{black}{3DUnet}} & {0.66$\pm$0.20 }& {0.70$\pm$0.21 } & { 16.33$\pm$13.07 }& { 0.60$\pm$0.21 }& { 0.72$\pm$0.20 } & {15.01$\pm$12.98 }\\ &\multirow{1}{*}{\textcolor{black}{CT+pMRI} } & {0.64$\pm$0.16 }& {0.64$\pm$0.13 } & { 20.01$\pm$8.09 }& { 0.61$\pm$0.17 }& { 0.67$\pm$0.15 } & {19.67$\pm$15.52 }\\ \cline{2-8} \cline{2-8} &\multirow{1}{*}{pMRI-CMEDL } & {0.74$\pm$0.18}& {0.80$\pm$0.09 } & { 8.87$\pm$8.98 }& { 0.69$\pm$0.10 }& { 0.79$\pm$0.11 } & {10.42$\pm$10.58 }\\ &\multirow{1}{*}{CMEDL} & {0.73$\pm$0.18}& {0.80$\pm$0.09 } & { 6.39$\pm$6.27 }& { 0.73$\pm$0.10 }& { 0.83$\pm$0.08 } & { 7.69$\pm$7.86 }\\ \hline \hline \end{tabular} } \end{table*} \begin{table*} \centering{\caption{Segmentation accuracy for CBCT dataset using the various approaches using the DenseFCN network.} \label{tab:CBCT_result_Dense} \centering \scriptsize \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline \hline {\multirow{2}{*}{Net}}&\multicolumn{1}{|c|}{ }& \multicolumn{3}{|c|}{Validation (N = 20)} & \multicolumn{3}{|c|}{Test (N = 38)}\\ \cline{2-8} {}&{ Method } & { DSC } & { Surface DSC } & { HD95 $mm$ }& { DSC }& { Surface DSC} & { HD95 $mm$ }\\ \hline \hline {\multirow{5}{*}{\rotatebox[origin=c]{90}{DenseFCN}}}\multirow{1}{*}&{CBCT only } & { 0.63$\pm$0.18 }& { 0.59$\pm$0.12 } & { 22.88$\pm$12.91 }& { 0.58$\pm0.14$ }& {0.66$\pm$0.15 } & { 22.15$\pm17.19$ }\\ &\multirow{1}{*}{pMRI-Cycle } & { 0.65$\pm$0.13}& { 0.63$\pm$0.12 } & { 14.83$\pm$11.83 }& {0.57$\pm$0.14 }& { 0.66$\pm$0.18 } & { 21.82$\pm$15.97}\\ &\multirow{1}{*}{pMRI-UNIT } & {0.66$\pm$0.14 }& {0.65$\pm$0.15 } & { 20.98$\pm$15.60 }& { 0.64$\pm$0.15 }& { 0.62$\pm$0.17 } & {25.28$\pm$15.94 }\\ \cline{2-8} \cline{2-8} &\multirow{1}{*}{pMRI-CMEDL } & {0.69$\pm$0.18 }& {0.69$\pm$0.10 } & { 17.60$\pm$9.25 }& { 0.68$\pm$0.12 }& { 0.73$\pm$0.13 } & {14.46$\pm$11.87 }\\ &\multirow{1}{*}{CMEDL } & { 0.69$\pm$0.17}& {0.70$\pm$0.11 } & {11.43$\pm$6.91 }& { 0.72$\pm$0.13 }& {0.75$\pm$0.13 } & { 11.42$\pm$9.87 }\\ \hline \hline \end{tabular} } \end{table*} \begin{figure*} \begin{center} \includegraphics[width=0.7\columnwidth,scale=0.5]{translation5.pdf} \vspace{-0.05cm}\setlength{\belowcaptionskip}{-0.4cm}\setlength{\abovecaptionskip}{0.08cm}\caption{\label{fig:CBCT_Translation} \small Representative examples of pMRI generated from CBCT images using the CMEDL method. The tumor region is enclosed in the red contour.} \end{center} \end{figure*} \begin{figure*} \begin{center} \includegraphics[width=1.0\columnwidth,scale=0.5]{feature_visulization.pdf} \vspace{-0.05cm}\setlength{\belowcaptionskip}{-0.4cm}\setlength{\abovecaptionskip}{0.08cm}\caption{\label{fig:feature_map} \small Feature activaton maps computed from (a) CBCT Unet, (b) teacher network of CMEDL, and (c) student CBCT network.} \end{center} \end{figure*} \begin{figure*} \begin{center} \includegraphics[width=0.6\columnwidth,scale=0.5]{tsne_map2.pdf} \vspace{-0.05cm}\setlength{\belowcaptionskip}{-0.4cm}\setlength{\abovecaptionskip}{0.08cm}\caption{\label{fig:TSNE} \small \textcolor{black}{TSNE map of Feature activaton maps computed from (a) CBCT Unet, (b) CMEDL-CBCT Unet.}} \end{center} \end{figure*} \begin{figure*} \begin{center} \includegraphics[width=1.0\columnwidth,scale=0.5]{sensitivity_analysis_case2.pdf} \vspace{-0.05cm}\setlength{\belowcaptionskip}{-0.4cm}\setlength{\abovecaptionskip}{0.08cm}\caption{\label{fig:sensitivity} \small \textcolor{black}{Sensitivity analysis using test time dropout for CMEDL vs. CBCT only networks: (a) Unet, (b) DenseFCN. The segmentation variabilities per each test case for these methods are also shown.}} \end{center} \end{figure*} \subsection{Sensitivity analysis} \textcolor{black}{We evaluated the robustness of the networks' segmentation by introducing noise into the learned models. This was done by performing random dropout of the weights in the last two network layers during testing. Test-time dropout was performed by keeping the dropout rate at 0.5 and randomly zeroing out the learned weights. Dropout was run 10 times for each data and the average of each case is shown in Figure \ref{fig:sensitivity}. Both of the CMEDL networks resulted in lower variabilities in the segmentation as shown in Fig.~\ref{fig:sensitivity} for each test case. The \textcolor{black}{mean standard deviation (mSD) was 0.016 using DSC for CMEDL-Unet, 0.016 using DSC for CMEDL-DenseFCN. Whereas the mSD was higher for both networks trained using only CBCT data with a 0.024 mSD for DSC of Unet and 0.027 mSD of DSC for denseFCN.}} \subsection{Separation of target from background using feature maps extracted from CMEDL and CBCT only networks} Finally, we \textcolor{black}{studied} how the cross-modality anatomical information from MRI lead to segmentation improvement on CBCT. Fig.\ref{fig:feature_map} shows an example case with eight randomly chosen feature maps selected from the last layer (with size of 256$\times$256$\times$64) of Unet network trained with only CBCT (Fig.\ref{fig:feature_map}(a)) and the corresponding feature maps and the same case when computed from a CMEDL-Unet (Fig.\ref{fig:feature_map}(c)). For reference, the feature maps computed in the same layer for the teacher MRI network that used the translated pMRI are also shown (Fig.\ref{fig:feature_map}(b)). As seen, the feature maps extracted using the CBCT only method are less effective in differentiating the tumor regions from the background parenchyma when compared to the CMEDL CBCT network. \textcolor{black}{The feature maps extracted from CBCT using the student network are highly similar to the feature maps extracted from the corresponding pMRI images extracted from the teacher network, indicating sufficient knowledge distillation between the teacher and student networks. As a result, the CBCT student network extracted features that clearly distinguished the tumor from the background even when it is fed only CBCT images. This in turn produced more accurate segmentation than a CBCT only network trained without CMEDL approach.} \textcolor{black}{Fig.\ref{fig:TSNE} shows the result of unsupervised clustering the feature maps from the last layer (256$\times$256$\times$64) for the CMEDL and CBCT only Unet networks for all \textcolor{black}{the 38 test cases.} Note that during test only the student CBCT Unet network of the CMEDL method is used. The input to the clustering method consisted of randomly selected set of pixel features chosen from inside a \textcolor{black}{160$\times$160} pixels region of interest enclosing the tumor in each slice containing the tumor, resulting in a total of 200,000 pixels. The number of pixels corresponding to target and background was balanced. Clustering was done by using the t-distributed stochastic neighbor embedding (t-SNE)\cite{van2008visualizing} method using the Matlab. Briefly, the t-SNE method computes an unsupervised clustering of high dimensional data by computing a high dimensional and low-dimensional embedding of the data as probability distributions. Gradient descent is used to minimize the Kullback-Leibler divergence between the two distributions either until convergence or a maximum number of iterations. The clustering parameters, namely perplexity, which is related to the number of nearest neighbors was set of 60 and the number of gradient descent iterations to 1000. As seen in Fig.~\ref{fig:TSNE}, the features extracted from the CBCT Unet network trained using CMEDL are better able to distinguish the tumor from background pixels than the features extracted from a CBCT Unet alone.} \section{Discussion} We introduced a new approach to leverage higher contrast information from more informative MRI modality to improve CBCT segmentation. Our approach uses unpaired sets of MRI and CBCT images from different sets of patients and learns to extract informative features on CBCT that help to obtain a good lung tumor segmentation, even for some centrally located tumors. Our approach shows a clear improvement over CBCT only segmentation \textcolor{black}{using both 2D and 3D methods} as well as pMRI based segmentation when the pMRI is generated using UDA networks trained independent of the CMEDL framework. \textcolor{black}{Importantly, our results also showed that the CMEDL approach enables the CBCT network to extract more informative features that better distinguish tumor from background. This arises by guiding the CBCT student network to extract features that match the statistical distribution of the teacher MRI network.} To our best knowledge, this is one of the first works to address the problem of fully automatic lung tumor segmentation on CBCT images. Prior work on CBCT used semi-automated segmentation\citep{Veduruparthi2018}, and the CBCT deep learning methods were applied to segment pelvic normal organs\citep{Fu2020,Lei2020}. \textcolor{black}{A clear difference of our approach from the deep learning methods is the use of pMRI as side information during training to guide feature extraction from the CBCT network. The method in Fu et.al\citep{Fu2020} combined pMRI with the CBCT features even during testing as a late fusion network while\cite{Lei2020} performed segmentation from pMRI image patches using attention gated Unet. The main advantage of our method is that only a lightweight CBCT segmentation network is needed for testing and the requirements for pMRI accuracy are less stringent than the methods\cite{Fu2020,Lei2020}, which use pMRI as an input modality.} Our results showed that the MRI information educed on CBCT is most useful when used as hints through cross-modality distillation. \textcolor{black}{This is because the teacher network provides additional regularization to guide the extraction of CBCT features that yeild the best possible segmentation performance during training. This regularization is accomplished by matching the features computed from CBCT with the features computed from the corresponding pMRI images. On the other hand, a CBCT network that does not use such constraints may result in a local minimum after training, but this is not guaranteed to extract features that better distinguish tumor from background as shown in our results.} Similarly, the frameworks that used the synthesized pMRIs directly for segmentation were also less accurate than the CMEDL CBCT network. In the extreme case using pMRI as a secondary input channel with CBCT led to degradation in performance. This is because distillation learning itself only provides additional regularization to constrain the set of features extracted by the student CBCT network, which does not require as accurate pMRI translation as would be needed when using pMRI itself as input for the segmentation network. On the other hand, accurate I2I translation is more important when using the translated image for segmentation. As shown, both pMRI-Cycle and pMRI-UNIT were comparable in performance. On the other hand, the pMRI-CMEDL approach, which uses side information from CBCT student network to also constrain the I2I translation improves the accuracy of the teacher network for segmenting CBCT. \textcolor{black}{However, all these methods were less accurate than when using the student CMEDL CBCT network for segmentation.} As opposed to standard distillation methods that used a pre-trained teacher network as done in \cite{chen2017learning, romero2014fitnets, gupta2016cross}, which required paired image sets, ours is the first, to our best knowledge, that works with completely unrelated set of images from widely different imaging modalities. Removing the constraint of paired image sets makes our approach more practical for medical applications, including new image-guided cancer treatments. \textcolor{black}{As a limitation, our approach used a modest number of CBCT images for training and testing. Addition of more training sets would likely improve performance even more. Similarly, use of a 3D architecture instead of a 2D architecture could enable obtaining more accurate volume segmentations. Also, testing on multi-institutional datasets with different imaging acquisitions is essential to establish the generality of the developed approach and is work for future.} To summarize, to our best knowledge, this is the first approach to tackle the problem of CBCT lung tumor segmentation. \section{Conclusion} We introduced a novel cross-modality educed distillation learning approach for segmenting lung tumors on cone-beam CT images. Our approach uses unpaired MRI and CBCT image sets to constrain the features extracted on CBCT to improve inference and segmentation performance. Our approach implemented on two different segmentation networks showed clear performance improvements over CBCT only methods. Evaluation on much larger datasets is essential to assess potential for clinical translation. \section{Acknowledgements} This research was supported by NCI [grant number R01-CA198121]. It was also partially supported through the NIH/NCI Cancer Center Support Grant [grant number P30 CA008748] who had no involvement in the study design; the collection, analysis and interpretation of data; the writing of the report; and the decision to submit the article for publication. \section{References} \bibliographystyle{medphy}
\section{Introduction} Four seemingly independent fundamental energy scales we know in the elementary particle physics, the Planck scale $\simeq 1.2\times 10^{19}\, \mbox{GeV}$ (energy scale of gravitational interaction), the cosmological constant $\simeq (2.2\, \mbox{meV})^4$ (accelerated expansion of the universe), the weak scale $v\simeq 246\, \mbox{GeV}$ (masses of elementary particles), and the QCD scale $\simeq 300\, \mbox{MeV}$ (masses of hadrons). Among these four known fundamental energy scales, the most well understood one is the QCD scale. High energy hadronic particle collisions much above the QCD scale can be successfully investigated perturbatively, while the low energy hadron physics can be described in terms of low energy effective field theories. The QCD scale is generated dynamically through the dimensional transmutation mechanism in the $SU(3)$ QCD gauge dynamics. Since the scale generation is forbidden at the classical level, the QCD scale is stable against the quantum loop corrections. Moreover, the global symmetry structure of QCD allows us to develop systematic expansions in these effective field theories. Especially, the low energy pion physics can be described in terms of the chiral perturbation theory~\cite{Weinberg:1978kz,Gasser:1983yg,Gasser:1984gg,Georgi:1994qn,Donoghue:1992dd}, in which the pions are treated as pseudo-Nambu-Goldstone bosons associated with the spontaneous breaking of the global chiral symmetry. The low energy theorems in the pion scattering amplitudes are reproduced in the chiral perturbation theory at its leading order. It is also possible to include higher order corrections in a systematic manner, by computing the quantum loop corrections and by introducing higher order terms in the effective chiral Lagrangian arranged in accord with the chiral order counting rules. Although the chiral perturbation does not converge above the resonance mass energy scale, the situation can be improved by explicitly introducing the resonances such as the spin-1 $\rho$ meson in the effective chiral Lagrangian~\cite{Bando:1984ej,Bando:1987br,Ecker:1988te}. Actually, it is possible to formulate the chiral perturbation theory even in the effective chiral Lagrangian including the $\rho$ meson~\cite{Tanabashi:1993np,Harada:1992np,Harada:2003jx}. On the other hand, the standard model (SM) of particle physics provides a consistent gauge theory framework to describe the physics associated with the weak scale. A Higgs field and Higgs potential are introduced in the SM to generate the weak scale. It has been shown that the 125GeV scalar particle discovered at the LHC experiments can be identified successfully as a Higgs particle associated with the SM Higgs field~\cite{LHCHIGGSXSWG}. Unlike the QCD scale generation mechanism, however, in the SM, the Higgs potential responsible for the weak scale is not classically forbidden and the weak scale is subject to huge quantum loop corrections. Fine-tuning of parameters is required in the SM to explain the smallness of the weak scale compared with the Planck scale (naturalness problem). It is a common belief that the certain beyond-standard-model (BSM) new physics exist not far above the weak scale, guaranteeing the naturalness of the weak scale. Unfortunately, however, it turned out that the current collider energy is not enough high to reveal the nature of the BSM physics. Currently, we have no direct collider physics evidences supporting the existence of the BSM physics. As compared with the QCD scale, current understanding of the weak scale physics is highly restricted in this sense, mainly due to the lack of our knowledge on the physics far above the weak scale. It should be useful if we establish a weak scale-analogue to the chiral perturbation theory. Assuming BSM is weakly interacting, the standard-model effective-field-theory (SMEFT)~\cite{Buchmuller:1985jz} along with recent reviews \cite{Brivio:2017vri, Manohar:2018aog}, in which the electroweak symmetry $SU(2)\times U(1)$ is realized linearly, can be used for such a purpose. The SMEFT cannot be applied, however, for strongly interacting BSM, in which heavy BSM particles do not decouple from the low energy physics. For strongly interacting BSM, we can use the Higgs effective-field-theory (HEFT)~\cite{Feruglio:1992wf,Burgess:1999ha,Giudice:2007fh,Grinstein:2007iv,Alonso:2012px,Buchalla:2012qq,Azatov:2012bz,Contino:2013kra,Jenkins:2013fya,Buchalla:2013rka,Alonso:2014rga,Guo:2015isa,Buchalla:2015qju,Alonso:2017tdy,Buchalla:2017jlu,Buchalla:2018yce}, in which the electroweak symmetry $SU(2)\times U(1)$ is realized nonlinearly. Weak scale-analogues to the resonance chiral perturbation theory have also been studied. Phenomenologies of the weak scale analogues to the spin-1 $\rho$ resonance have been investigated by using the resonance electroweak chiral Lagrangian techniques~\cite{Casalbuoni:1985kq,Pappadopulo:2014qza,Abe:2015jra,Abe:2016fjs,Sanz-Cillero:2020szj}. We have proposed the generalized Higgs-effective-field-theory (GHEFT) framework~\cite{Nagai:2019tgi}, in which arbitrary number of spin-0 resonances/particles with arbitrary electric charges are introduced in the HEFT Lagrangian. In order to explain the naturalness of the weak scale, it is tempting to consider BSM scenarios having larger global symmetry and thus with extra pseudo-Nambu-Goldstone particles. Actually, in composite Nambu-Goldstone Higgs models~\cite{Panico:2015jxa}, global symmetries larger than the SM gauge group are introduced. There exist extra pseudo-Nambu-Goldstone particles in non-minimal composite Higgs models~\cite{Gripaios:2009pe, Mrazek:2011iu, Bertuzzo:2012ya, Frigerio:2012uc, DeCurtis:2018iqd, DeCurtis:2018zvh,DeCurtis:2019rxl}. We emphasize that these extra pseudo-Nambu-Goldstone particles can be successfully investigated in the GHEFT framework. We here stress the difference between the weak scale $v\simeq 246$GeV and the compositeness scale $\Lambda \simeq 4\pi f$ in the composite Higgs scenarios. It is known that $f$ needs to be several times larger than the weak scale in order to keep the consistency with electroweak and flavor precision constraints. In the GHEFT framework, $\Lambda \simeq 4\pi f$ can be regarded as the scale of perturbative unitarity violations, which can be pushed up to high energy scale independently of $v$ enough to meet these phenomenological constraints. Although the electroweak symmetry is realized nonlinearly in our GHEFT Lagrangian, our theory should be regarded to be valid below the compositeness scale $4\pi f$ keeping the perturbative unitarity. This fact motivates us to introduce TeV scale resonances in the GHEFT framework. There is a difficulty in the studies of the effective field theories, {\it{i.e.}}, non-uniqueness of its parametrization methods. Kamefuchi-O'Raifeartaigh-Salam (KOS) theorem~\cite{Kamefuchi:1961sb} tells us that there exist equivalent class of seemingly different effective field theories which describe the same physics. As the KOS theorem suggests us, there exist many equivalent formulation of the effective theories connected with each other through the changes of effective field variables (coordinates). This makes us difficult to compare results computed in an effective field theory with results in seemingly different, but equivalent field theory which may be generated more directly from the UV physics. Warsaw basis \cite{Grzadkowski:2010es} is often assumed to resolve the non-uniqueness in the SMEFT. The Warsaw basis should be understood to be a symptomatic treatment effective only at the lowest order, however. It does not provide a systematic prescription to fix the issue beyond the leading oder. The same problem exists in the electroweak resonance chiral perturbation theories. The existing studies of the electroweak resonance chiral perturbation theories rely on particular field parameterizations. In our previous paper on GHEFT~\cite{Nagai:2019tgi}, we have shown that the GHEFT (electroweak resonance chiral perturbation theory) can be described by using the covariant tensors of the scalar manifolds, which allows us to parametrize the particle scattering amplitudes and the quantum corrections in a covariant manner under the changes of effective field variables (coordinates) \cite{Alonso:2015fsp, Alonso:2016oah}. It has been shown that the uses of the normal coordinate simplify the computation of the scattering amplitudes significantly. We have then shown that, once the perturbative unitarity at the tree level is ensured, then one-loop finiteness is automatically guaranteed in the GHEFT framework. There remains an issue we need to investigate in the electroweak resonance chiral perturbation theory analysis. As far as we know, there is no studies on the electroweak resonance chiral perturbation theory including fermionic spin-1/2 particles strongly coupled with the Higgs sector. It should be emphasized, however, that the SM Higgs particle couples with top-quark (fermion) most strongly. The existence of BSM spin-1/2 particles is widely expected in BSM models explaining the naturalness of the weak scale. Actually, in the composite Higgs models, top-quark partner fermion is usually introduced to explain the mass of the top quark. In the present paper, we generalize the findings we made in our previous paper to include fermionic heavy particles in the GHEFT Lagrangian. The particle scattering amplitudes are expressed using covariant quantities of the bosonic and fermionic field coordinates. The scattering amplitude formulas given in this paper can therefore be easily compared with the formulas computed in other equivalent formulation of the fermionic resonance electroweak chiral perturbation theories. This paper is organized as follows: In \S.~\ref{sec:GHEFT}, we introduce extended GHEFT Lagrangian including the extra spin-1/2 fermionic particles. We then provide a chiral order counting rule which allows us to perform a systematic expansion in the computation of the scattering amplitudes in a manner similar to the well-known chiral perturbation theory. In \S.~\ref{sec:NC}, the normal coordinate technique is generalized to include fermionic field coordinates. We investigate tree-level spin-0 and spin-1/2 particles' scattering amplitudes in \S.~\ref{sec:amplitude}, applying the normal coordinate technique. It is shown that these scattering amplitudes can be expressed in terms of the covariant quantities of the GHEFT field manifold. We conclude in \S.~\ref{sec:summary}. A quick review on HEFT is given in Appendix~\ref{app:HEFT}. Notation on the helicity eigenstate wavefunctions is summarized in Appendix~\ref{app:helicitystate}. Appendix~\ref{sec:higerod-nc} is for the explicit computations of higher order coefficients in the normal coordinate expansion, and a proof of Bianchi-identity. \section{Generalized Higgs Effective Field Theory} \label{sec:GHEFT} We need to incorporate new BSM particles in effective field theories (EFTs) so as to compute production cross sections and decay widths involving these new BSM particles. These new particles are not included in minimal EFTs such as the standard-model effective-field-theory (SMEFT) \cite{Buchmuller:1985jz, Grzadkowski:2010es, Brivio:2017vri, Manohar:2018aog}\, and the Higgs effective-field-theory (HEFT) \refheft, however. We have proposed, in our previous paper~\cite{Nagai:2019tgi}, the generalized Higgs-effective-field-theory (GHEFT) framework in which arbitrary number of spin-0 resonances/particles with arbitrary electric charges are introduced. In this section we further generalize our GHEFT framework to incorporate BSM spin-1/2 fermions, as well as the 125\,GeV Higgs boson, BSM scalar particles, quarks and leptons. The electroweak gauge symmetry, $G=SU(2)_W\times U(1)_Y$, is spontaneously broken to the electromagnetic $H=U(1)_{\rm em}$ at the electroweak symmetry breaking (EWSB) scale. If the EWSB is triggered by new strong dynamics in BSM, the spontaneously broken symmetry $G$ should be realized non-linearly at the low-energy scale. Electroweakly charged particles, in such a case, transform non-linearly under the electroweak gauge symmetry. We use the celebrated Callan-Coleman-Wess-Zumino (CCWZ) formalism~\cite{Coleman:1969sm,Callan:1969sn,Bando:1987br} to formulate the low-energy EFT Lagrangian in a manner consistent with the EWSB. We note here that the CCWZ formalism can also be applied even if the electroweak symmetry is broken by perturbative dynamics. We then provide a chiral order counting rule in GHEFT which allows us to perform a systematic expansion in the computation of the scattering amplitudes in a manner similar to the well-known chiral perturbation theory~\cite{Weinberg:1978kz,Gasser:1983yg,Gasser:1984gg,Georgi:1994qn,Donoghue:1992dd}. \subsection{Leading order GHEFT Lagrangian} We start the discussion in the gaugeless limit ($g_W=g_Y=0$) for simplicity. The couplings with the SM gauge fields will be introduced at the end of this subsection. The minimal EFT for strongly interacting EWSB is described by HEFT Lagrangian~\refheft{} in the gaugeless limit, \begin{align} \mathcal{L}_{\rm{HEFT}} &= \mathcal{L}_{\rm{HEFT, boson}} + \mathcal{L}_{\rm{HEFT, fermion}} \label{eq:LHEFT2} \end{align} with the bosonic sector Lagrangian $\mathcal{L}_{\rm{HEFT,boson}}$ being \begin{eqnarray} \mathcal{L}_{\rm{HEFT, boson}} &=& G(h)\, \mbox{tr}[\partial^\mu U^\dag \partial_\mu U] \nonumber\\ &+& \frac{1}{2}G_Z(h)\, \mbox{tr}[ U^\dag \partial^\mu U\tau^3] \mbox{tr}[ U^\dag \partial_\mu U\tau^3] \nonumber\\ &+& \frac{1}{2}(\partial_\mu h)(\partial^\mu h) -V(h) \, . \label{eq:LHEFTboson} \end{eqnarray} The fermionic sector Lagrangian $\mathcal{L}_{\rm{HEFT, fermion}}$ is given in appendix~\ref{app:HEFT}. The bosonic sector HEFT Lagrangian~(\ref{eq:LHEFTboson}) should be regarded as a starting point of the GHEFT framework~\cite{Nagai:2019tgi}. The 125\, GeV Higgs boson field is denoted by $h$, while $U$ is an exponential function of the Nambu-Goldstone (NG) boson fields, \begin{equation} U= \xi_W\xi_Y \,, \end{equation} where \begin{eqnarray} \xi_W(x) &=& \exp\left(i\sum_{a=1,2}\pi^a(x)\frac{\tau^a}{2}\right) \,,\label{eq:xiW}\\ \xi_Y(x) &=& \exp\left(i\pi^3(x)\frac{\tau^3}{2}\right) \,,\label{eq:xiY} \end{eqnarray} with $\tau^a$ and $\pi^a~(a=1,2,3)$ being the Pauli spin matrices and the NG boson fields. $G(h)$, $G_Z(h)$ and $V(h)$ are arbitrary functions of $h$, which determine the interactions among the 125\, GeV Higgs field and the NG boson fields. Custodial symmetry implies $G_Z(h)=0$. We here do not impose $G_Z(h)=0$, however, to keep the generality. For later convenience, we rewrite the HEFT Lagrangian (\ref{eq:LHEFTboson}) in terms of the CCWZ formalism, {\it{i.e.}}, by using the $G/H$ Lie-algebra valued Maurer-Cartan (MC) one-forms of the NG boson fields, \begin{equation} \alpha^a_{\perp\mu} = \mbox{tr}\biggl[ \frac{1}{i}\xi^\dag_W(\partial_\mu \xi_W)\tau^a \biggr] \,,~~~(a=1,2) \,, \end{equation} and \begin{equation} \alpha^3_{\perp\mu} = \mbox{tr}\biggl[ \frac{1}{i}\xi^\dag_W(\partial_\mu \xi_W)\tau^3 \biggr] + \mbox{tr}\biggl[ \frac{1}{i}(\partial_\mu \xi_Y)\xi^\dag_Y\tau^3 \biggr] \,. \end{equation} The HEFT Lagrangian (\ref{eq:LHEFTboson}) is expressed as \begin{equation} \mathcal{L}_{\rm{HEFT, boson}} = \frac{1}{2}{G}_{ab}(h)\alpha^a_{\perp\mu}\alpha^{b\mu}_{\perp} + \frac{1}{2}(\partial^\mu h)(\partial_\mu h) -V(h) \,, \label{eq:LHEFTboson2} \end{equation} where $G_{11}(h)=G_{22}(h)=G(h)$, $G_{33}(h)=G(h)+G_Z(h)$ and $G_{ab}(h)=0$ for $a\neq b$. In the expression (\ref{eq:LHEFTboson2}) and hereafter, summation $\displaystyle \sum_{a=1,2,3}$ is implied whenever an index $a$ is repeated in a product. The CCWZ formalism allows us to systematically introduce BSM extra scalar particles in the low energy EFT. Here we introduce extra $(n_R-1)$ BSM real scalars and $n_C$ BSM complex scalars in addition to the 125\,GeV Higgs boson. Therefore there are $n_s=n_R+2n_C$ real scalars in total. It is convenient to introduce a real scalar multiplet $\phi^I~(I=1,2,\cdots,n_s)$ as \begin{eqnarray} \phi^I &=& (\, \overbrace{\phi^1,\phi^2,\cdots,\phi^{n_N}}^{ n_R }, \overbrace{\phi^{n_N+1}\,\cdots\,\phi^{n_s}}^{ 2n_C } \,) \,, \end{eqnarray} where we identify $\phi^1$ as the 125\,GeV Higgs boson, $\phi^1=h$. The $H=U(1)_{\rm{em}}$ transformation for the scalar multiplet is defined as \begin{equation} \phi^I \xrightarrow{H} \biggl[\exp\biggl(iQ_\phi \theta_h\biggr)\biggr]^I_{\, \, \, J} \phi^J \,, \end{equation} where $\theta_h$ is a real constant parameter, and the $(n_s\times n_s)$ matrix $Q_\phi$ is defined as \begin{align} Q_\phi= \left( \begin{array}{cccccc} \bovermat{$n_R$} {\diagentry{0} & \phantom{\diagentry{\ddots}} & \phantom{\diagentry{0}}} & \bovermat{$2n_C$} {\phantom{\diagentry{-q_{1}\sigma_2}} & \phantom{\diagentry{\ddots}} & \phantom{\diagentry{-q_{1}\sigma_2}}} \\ & \diagentry{\ddots} & & & & \\ & & \diagentry{0} & & & \\ & & & \diagentry{-q_{1}\sigma_2} & & \\ & & & & \diagentry{\ddots} & \\ & & & & & \diagentry{-q_{n_C}\sigma_2\qquad} \end{array} \right)\,. \end{align} Here $\sigma_2=\tau^2$ and $q_i~(i=1,2,\cdots n_C)$ denotes the $U(1)_{\rm{em}}$ charges of the scalar fields. The $G=SU(2)_W\times U(1)_Y$ transformation of $\phi^I$ is given by \begin{equation} \phi^I \xrightarrow{G} [\rho_\phi]^I_{~J} \phi^J \,, ~~~ \rho_\phi = \exp\biggl(iQ_\phi \theta_h(\pi,\mathfrak{g}_W,\mathfrak{g}_Y)\biggr) \,, \end{equation} where $\theta_h$ is a real function of group elements $\mathfrak{g}_W\in SU(2)_W$, $\mathfrak{g}_Y\in U(1)_Y$, and the NG boson fields ($\pi^a$). There may exist $SU(3)_C$ colored scalar particles such as the leptoquark scalars and the colored superpartner bosonic particles. The flavor index $I$, $J$ are understood to include the color index for these colored bosons. It is straightforward to write down the $SU(3)_C$ transformation matrix for $\phi^I$. Since the $G$ transformation matrix $\rho_\phi$ depends on the NG boson fields, the derivative of the scalar multiplet $\partial_\mu\phi^I$ transforms nonhomogeneously under $G$, \begin{equation} \partial_\mu \phi^I \xrightarrow{G} [\rho_\phi]^I_{~J} (\partial_\mu \phi^J) + (\partial_\mu \rho_\phi )^I_{~J}\phi^J \,. \end{equation} Therefore, if $\phi^I$ contains the charged scalar (namely $\rho_\phi\neq{\bf{1}}$), the kinetic operator $(\partial_\mu\phi^I)(\partial^\mu\phi^I)$ is not invariant under the $G$-transformation. $G$-invariant kinetic terms for the charged scalar fields are formulated by introducing the covariant derivative on the $G/H$ coset space. The covariant derivative is defined as \begin{equation} \mathcal{D}_\mu \phi^I := \partial_\mu \phi^I +i\,\mathcal{V}^3_\mu \,[Q_\phi]^I_{~J}\phi^J \,, \end{equation} where \begin{equation} \mathcal{V}^3_\mu := -\mbox{tr} \biggl[ \frac{1}{i}(\partial_\mu \xi_Y)\xi^\dag_Y\tau^3 \biggr] + c\,\alpha^3_{\perp\mu} \,, \label{eq:covdel} \end{equation} with $c$ being an arbitrary constant. The $\mathcal{V}^3_\mu$ corresponds to the $H$ Lie-algebra valued MC one-form, which plays the role of the connection field on the $G/H$ coset space. It is straightforward to show that the covariant derivative $\mathcal{D}_\mu\phi^I$ homogeneously transforms under $G$, \begin{equation} \mathcal{D}_\mu \phi^I \xrightarrow{G} [\rho_\phi]^I_{~J} (\mathcal{D}_\mu \phi^J) \,. \end{equation} The ``covariant'' kinetic term $(\mathcal{D}_\mu \phi^I)(\mathcal{D}^\mu \phi^I)$ respects the $G$-invariance. Using the $G$-covariant objects $\alpha^a_{\perp\mu}$, $\phi^I$, and $\mathcal{D}_\mu\phi^I$, we can systematically write down $G$ invariant Lagrangians. As we will see later, the lowest order Lagrangian is written as \cite{Nagai:2019tgi} \begin{eqnarray} \mathcal{L}_{\rm{GHEFT, boson}} &=& \frac{1}{2}G_{ab}(\phi)\alpha^a_{\perp\mu}\alpha^{b\mu}_{\perp} \nonumber\\ &+& G_{aI}(\phi)\alpha^a_{\perp\mu}(\mathcal{D}^\mu \phi^I) \nonumber\\ &+& \frac{1}{2}G_{IJ}(\phi)(\mathcal{D}^\mu \phi^I)(\mathcal{D}_\mu \phi^J) \nonumber\\ &-& V(\phi) \, . \label{eq:LGHEFT-boson} \end{eqnarray} $G_{ab}$, $G_{aI}$, $G_{IJ}$, and $V$ are functions of the scalar fields $\phi^I$, which homogeneously transform under the $G$ transformation. These functions determine the interactions among the scalar fields. Again, we do not impose the custodial symmetry in (\ref{eq:LGHEFT-boson}) to keep the generality. Once we specify the ultraviolet completion of the EFT, $G_{ab}$, $G_{aI}$, $G_{IJ}$, and $V$ are determined up to the uncertainty associated with the field redefinition. We next discuss the fermion sector. We need to introduce, at least, SM quarks and leptons in our EFT framework. Moreover, the existence of BSM spin-1/2 particles is widely expected in BSM models explaining the naturalness of the weak scale. For this purpose, we incorporate $\hat{n}_M$ Majorana fermions and $\hat{n}_D$ Dirac fermions in the EFT Lagrangian (\ref{eq:LGHEFT-boson}). We describe these fermions by using $\hat{n}_f=\hat{n}_M+2\hat{n}_D$ two-component spinor fields $\psi^{\hat{i}}_\alpha~({\hat{i}}={\hat{1}},\cdots,{\hat{n}}_f)$, \begin{eqnarray} \psi^{\hat{i}}_\alpha &=& (\, \overbrace{\psi^{\hat{1}}_\alpha,\psi^{\hat{2}}_\alpha,\cdots,\psi^{\hat{n}_M}_\alpha}^{ \hat{n}_M }, \overbrace{\psi^{\hat{n}_M+1}_\alpha ~~ \,\cdots\,\psi^{\hat{n}_f}_\alpha}^{2\hat{n}_D} \,) \,, \label{eq:psimultiplet} \end{eqnarray} where $\alpha$ is the spinor index which takes 1 or 2. The Hermitian conjugate of $\psi^{\hat{i}}_\alpha$ is denoted as $\psi^{\dag {\hat{i}}^*}_{\dot{\alpha}}:=(\psi^{\hat{i}}_\alpha)^\dag$. The $U(1)_{\rm{em}}$ transformation for the fermion multiplet (\ref{eq:psimultiplet}) is defined as \begin{equation} \psi^{\hat{i}}_\alpha \xrightarrow{H} \biggl[\exp\biggl(iQ_\psi \theta_h\biggr)\biggr]^{\hat{i}}_{~{\hat{j}}} \psi^{\hat{j}}_\alpha \,, \end{equation} where $\theta_h$ is a real constant parameter, and the $(\hat{n}_f\times \hat{n}_f)$ matrix $Q_\psi$ is defined as \begin{align} Q_\psi= \left( \begin{array}{cccccc} \bovermat{$\hat{n}_M$} {\diagentry{0} & \phantom{\diagentry{\ddots}} & \phantom{\diagentry{0}}} & \bovermat{$2\hat{n}_D$} {\phantom{\diagentry{q_{\hat{1}}\sigma_3}} & \phantom{\diagentry{\ddots}} & \phantom{\diagentry{q_{\hat{1}}\sigma_3}}} \\ & \diagentry{\ddots} & & & & \\ & & \diagentry{0} & & & \\ & & & \diagentry{q_{\hat{1}}\sigma_3} & & \\ & & & & \diagentry{\ddots} & \\ & & & & & \diagentry{q_{\hat{n}_D}\sigma_3\quad} \end{array} \right)\,. \end{align} Here $\sigma_3=\tau^3$ and $q_{\hat{i}}~({\hat{i}}={\hat{1}},{\hat{2}},\cdots {\hat{n}}_D)$ denotes the $U(1)_{\rm{em}}$ charges of the fermion fields. There certainly exist $SU(3)_C$ colored spin-1/2 particles. The flavor index $\hat{i}$, $\hat{j}$ are understood to include the color index for these colored fermions. It is straightforward to write down the $SU(3)_C$ transformation matrix for $\psi^{\hat{i}}_\alpha$. The $G=SU(2)_W\times U(1)_Y$ transformation of $\psi^{\hat{i}}_\alpha$ is given by \begin{equation} \psi^{\hat{i}}_\alpha \xrightarrow{G} [\rho_\psi]^{\hat{i}}_{~{\hat{j}}} \psi^{\hat{j}}_\alpha \,, ~~~ \rho_\psi = \exp\biggl(iQ_\psi \theta_h(\pi,\mathfrak{g}_W,\mathfrak{g}_Y)\biggr) \,, \label{eq:fermiontr} \end{equation} where $\theta_h$ is a real function of group elements $\mathfrak{g}_W\in SU(2)_W$, $\mathfrak{g}_Y\in U(1)_Y$, and the NG boson fields ($\pi^a$). We note that the derivative of the fermion field, $\partial_\mu \psi^{\hat{i}}$, nonhomogeneously transforms under the $G$ transformation as the derivative of the scalar field $\partial_\mu\phi^I$ does. The covariant derivative can be defined as \begin{equation} \mathcal{D}_\mu\psi^{\hat{i}}_\alpha := \partial_\mu \psi^{\hat{i}}_\alpha +i\,\mathcal{V}^3_\mu \,[Q_\psi]^{\hat{i}}_{~{\hat{j}}}\psi^{\hat{j}}_\alpha \,, \end{equation} where the connection field $\mathcal{V}^3_\mu$ is defined in Eq.\,(\ref{eq:covdel}). It is easy to show that the covariant derivative $\mathcal{D}_\mu \psi^{\hat{i}}$ transforms homogeneously under the $G$ transformation, \begin{equation} \mathcal{D}_\mu \psi^{\hat{i}}_\alpha \xrightarrow{G} [\rho_\psi]^{\hat{i}}_{~{\hat{j}}}\, (\mathcal{D}_\mu \psi^{\hat{j}}_\alpha)\,. \label{eq:Dfermiontr} \end{equation} It is now straightforward to construct $G$-invariant Lagrangian for the scalar and fermion fields. We can systematically construct $G$-invariant operators by using the $G$-covariant objects, $\alpha^a_{\perp\mu}$, $\phi^I$, $\psi^{\hat{i}}$, $\mathcal{D}_\mu\phi^I$, and $\mathcal{D}_\mu\psi^{\hat{i}}$. Applying the chiral order counting rule which we will introduce in the next subsection \ref{sec:powercounting}, we write down the leading order Lagrangian of GHEFT as \begin{eqnarray} \mathcal{L}_{\rm{GHEFT}} &=& \frac{1}{2}G_{ab}(\phi)\,\alpha^a_{\perp\mu}\,\alpha^{a\mu}_{\perp} \nonumber\\ &+& G_{aI}(\phi)\,\alpha^a_{\perp\mu}\,(\mathcal{D}^\mu \phi^I) \nonumber\\ &+& \frac{1}{2}G_{IJ}(\phi)(\mathcal{D}^\mu \phi^I)(\mathcal{D}_\mu \phi^J) -V(\phi) \nonumber\\ &+&\frac{i}{2}G_{{\hat{i}}{\hat{j}}^*}(\phi) \biggl( \psi^{\dag {\hat{j}}^*}\,\bar{\sigma}^\mu \,(\mathcal{D}_\mu \psi^{\hat{i}}) - (\mathcal{D}_\mu\psi^{\dag {\hat{j}}^*})\,\bar{\sigma}^\mu \, \psi^{\hat{i}} \biggr) \nonumber\\ &+&V_{{\hat{i}}{\hat{j}}^*a}(\phi) \, \psi^{\dag {\hat{j}}^*}\, \bar{\sigma}^\mu \, \psi^{{\hat{i}}} \, \alpha^a_{\perp\mu} \nonumber\\ &+& V_{{\hat{i}}{\hat{j}}^*I}(\phi) \, \psi^{\dag {\hat{j}}^*}\, \bar{\sigma}^\mu \, \psi^{{\hat{i}}} \, (\mathcal{D}_\mu \phi^I) \nonumber\\ &-&\frac{1}{2}M_{{\hat{i}}{\hat{j}}}(\phi)\,\psi^{\hat{i}}\psi^{\hat{j}} -\frac{1}{2}M_{{\hat{i}}^*{\hat{j}}^*}(\phi)\,\psi^{\dag {\hat{i}}^*}\psi^{\dag {\hat{j}}^*} \nonumber\\ &+& \frac{1}{8} S_{{\hat{i}}{\hat{j}}{\hat{k}}{\hat{l}}}(\phi) (\psi^{{\hat{i}}}\psi^{{\hat{j}}})(\psi^{{\hat{k}}}\psi^{{\hat{l}}}) \nonumber\\ &+& \frac{1}{8} S_{{\hat{i}}^*{\hat{j}}^*{\hat{k}}^*{\hat{l}}^*}(\phi) (\psi^{\dag {\hat{i}}^*}\psi^{\dag {\hat{j}}^*}) (\psi^{\dag {\hat{k}}^*}\psi^{\dag {\hat{l}}^*}) \nonumber\\ &+& \frac{1}{4} S_{{\hat{i}}{\hat{j}}{\hat{k}}^*{\hat{l}}^*}(\phi) (\psi^{{\hat{i}}}\psi^{{\hat{j}}}) (\psi^{\dag {\hat{k}}^*}\psi^{\dag {\hat{l}}^*}) \,, \label{eq:LGHEFT-sym} \end{eqnarray} where we use the spinor-index free notation for the fermion bilinear operators \cite{Dreiner:2008tw}, {\it{{\it{i.e.}}}}, \begin{align} (\psi^{\hat{i}} \psi^{\hat{j}}) &:= \varepsilon^{\alpha \beta} \, \psi_{\beta}^{{\hat{i}}} \, \psi_{\alpha}^{{\hat{j}}} \, , \\ (\psi^{\dagger {\hat{i}}^*} \psi^{\dagger {\hat{j}}^*} ) &:= \psi_{\dot{\alpha}}^{\dagger {\hat{i}}^*} \, \varepsilon^{\dot{\alpha} \dot{\beta}} \, \psi_{\dot{\beta}}^{\dagger {\hat{j}}^*} \, , \\ \psi^{\dagger {\hat{j}}^*} \, \bar{\sigma}^\mu \, \psi^{{\hat{i}}} &:= \psi_{\dot{\alpha}}^{\dagger {\hat{j}}^*} \, (\bar{\sigma}^\mu)^{\dot{\alpha}\alpha}\, \psi_{\alpha}^{{\hat{i}}} \,, \\ \psi^{\hat{i}} \sigma^{\mu\nu} \psi^{\hat{j}} &:= \varepsilon^{\gamma\alpha} \psi^{\hat{i}}_\alpha (\sigma^{\mu\nu})_{\gamma}{}^{\beta} \psi^{\hat{j}}_\beta \, , \\ \psi^{\dagger \hat{i}^*} \bar{\sigma}^{\mu\nu} \psi^{\dagger \hat{j}^*} &:= \psi^{\dagger \hat{i}^*}_{\dot{\alpha}} (\bar{\sigma}^{\mu\nu})^{\dot{\alpha}}{}_{\dot{\beta}} \varepsilon^{\dot{\beta}\dot{\gamma}} \psi^{\dagger \hat{j}^*}_{\dot{\gamma}} \, , \end{align} with $\varepsilon^{12} = -\varepsilon^{21} = -\varepsilon_{12} = \varepsilon_{21} = 1$. The spinor matrices $\bar{\sigma}^\mu$, $\sigma^\mu$, $\sigma^{\mu\nu}$, $\bar{\sigma}^{\mu\nu}$ are defined as \begin{align} (\bar{\sigma}^\mu)^{\dot{\alpha} \alpha} &:=({\bf{1}}^{\dot{\alpha}\alpha}, -(\sigma^a)^{\dot{\alpha}\alpha} ) \, , \\ (\sigma^\mu)_{\alpha\dot{\alpha}} &:= \varepsilon_{\alpha\beta} \varepsilon_{\dot{\alpha}\dot{\beta}} (\bar{\sigma}^\mu)^{{\dot{\beta}\beta}} \, , \\ (\sigma^{\mu\nu})_{\alpha}{}^\beta &:= \dfrac{i}{4} \left[ (\sigma^\mu)_{\alpha\dot{\gamma}} (\bar{\sigma}^\nu)^{\dot{\gamma}\beta} -(\sigma^\nu)_{\alpha\dot{\gamma}} (\bar{\sigma}^\mu)^{\dot{\gamma}\beta} \right] \, , \\ (\bar{\sigma}^{\mu\nu})^{\dot{\alpha}}{}_{\dot{\beta}} &:= \dfrac{i}{4} \left[ (\bar{\sigma}^\mu)^{\dot{\alpha}\gamma} (\sigma^\nu)_{\gamma\dot{\beta}} -(\bar{\sigma}^\nu)^{\dot{\alpha}\gamma} (\sigma^\mu)_{\gamma\dot{\beta}} \right] \, , \end{align} where ${\bf{1}}$ and $\sigma^a~(a=1,2,3)$ denote a $2\times 2$ unit matrix and the Pauli spin matrices, respectively. Since $\phi^I$ transforms homogeneously under $G$-transformation, the functions $G_{ab}$, $G_{aI}$, $G_{IJ}$, $G_{{\hat{i}}{\hat{j}}^*}$, $V_{{\hat{i}}{\hat{j}}^*a}$, $V_{{\hat{i}}{\hat{j}}^*I}$, $M_{{\hat{i}}{\hat{j}}}$, $M_{{\hat{i}}^*{\hat{j}}^*}$, $S_{{\hat{i}}{\hat{j}}{\hat{k}}{\hat{l}}}$, $S_{{\hat{i}}^*{\hat{j}}^*{\hat{k}}^*{\hat{l}}^*}$, and $S_{{\hat{i}}{\hat{j}}{\hat{k}}^*{\hat{l}}^*}$ also transform homogeneously under $G$. They are also assumed to satisfy the index-exchange symmetry, \begin{eqnarray} && G_{ab}(\phi) =G_{ba}(\phi) \, , \\ && G_{IJ}(\phi) =G_{JI}(\phi) \, , \\ && M_{{\hat{i}}{\hat{j}}}(\phi) = M_{{\hat{j}}{\hat{i}}}(\phi) \,,\\ && M_{{\hat{i}}^*{\hat{j}}^*}(\phi) = M_{{\hat{j}}^*{\hat{i}}^*}(\phi) \,,\\ && S_{{\hat{i}}{\hat{j}}{\hat{k}}{\hat{l}}}(\phi) = S_{{\hat{j}}{\hat{i}}{\hat{k}}{\hat{l}}}(\phi) = S_{{\hat{i}}{\hat{j}}{\hat{l}}{\hat{k}}}(\phi) = S_{{\hat{k}}{\hat{l}}{\hat{i}}{\hat{j}}}(\phi) \,,\\ && S_{{\hat{i}}{\hat{j}}{\hat{k}}^*{\hat{l}}^*}(\phi) = S_{{\hat{j}}{\hat{i}}{\hat{k}}^*{\hat{l}}^*}(\phi) = S_{{\hat{i}}{\hat{j}}{\hat{l}}^*{\hat{k}}^*}(\phi) \,. \end{eqnarray} The Hermiticity of the Lagrangian requires \begin{eqnarray} && [G_{ab}(\phi)]^* = G_{ab}(\phi) \, , \\ && [G_{aI}(\phi)]^* = G_{aI}(\phi) \, , \\ && [G_{IJ}(\phi)]^* = G_{IJ}(\phi) \, , \\ && [V(\phi)]^* =V(\phi) \, , \\ &&[G_{{\hat{i}}{\hat{j}}^*}(\phi)]^* = G_{{\hat{j}}{\hat{i}}^*}(\phi) \,, \label{eq:G-sym} \\ &&[V_{{\hat{i}}{\hat{j}}^*a}(\phi)]^* = V_{{\hat{j}}{\hat{i}}^*a}(\phi) \,,\\ &&[V_{{\hat{i}}{\hat{j}}^*I}(\phi)]^* = V_{{\hat{j}}{\hat{i}}^*I}(\phi) \,, \label{eq:V-sym}\\ &&[M_{{\hat{i}}{\hat{j}}}(\phi)]^* = M_{{\hat{j}}^*{\hat{i}}^*}(\phi) \,,\\ && [S_{{\hat{i}}{\hat{j}}{\hat{k}}{\hat{l}}}(\phi)]^* = S_{{\hat{i}}^*{\hat{j}}^*{\hat{k}}^*{\hat{l}}^*}(\phi) \,,\\ && [S_{{\hat{i}}{\hat{j}}{\hat{k}}^*{\hat{l}}^*}(\phi)]^* = S_{{\hat{k}}{\hat{l}}{\hat{i}}^*{\hat{j}}^*}(\phi) \,. \end{eqnarray} These functions determine the interactions among the scalar bosons and the spin-1/2 fermions. The operator $\tilde{G}_{{\hat{i}}{\hat{j}}^*}(\phi)\mathcal{D}_\mu(\psi^{\dag {\hat{j}}^*}\bar{\sigma}^\mu \psi^{\hat{i}} )$ is absent in the Lagrangian (\ref{eq:LGHEFT-sym}), because it can be eliminated by adding the total derivative operator $\partial_\mu (\tilde{G}_{{\hat{i}}{\hat{j}}^*}(\phi)\psi^{\dag {\hat{j}}^*}\bar{\sigma}^\mu \psi^{\hat{i}})$ and redefining $V_{{\hat{i}}{\hat{j}}^*a}$ and $V_{{\hat{i}}{\hat{j}}^*I}$ appropriately. As we will see in the next subsection~\ref{sec:powercounting}, four-fermion operators should be introduced in the leading order Lagrangian (\ref{eq:LGHEFT-sym}), while we do not introduce operators like \begin{align} (\psi^{\hat{i}}\sigma^{\mu\nu} \psi^{\hat{j}}) \,[\alpha^a_{\perp\mu}, \alpha^b_{\perp\nu}] \, , \end{align} which seemingly possess lower mass dimensions. The four-fermion operators \begin{align*} & (\psi^{\dagger \hat{i}^*} \bar{\sigma}^\mu \psi^{\hat{i}}) (\psi^{\dagger \hat{j}^*} \bar{\sigma}_\mu \psi^{\hat{j}}) \, , \quad (\psi^{\hat{i}} \sigma^{\mu\nu} \psi^{\hat{j}}) (\psi^{\hat{k}} \sigma_{\mu\nu} \psi^{\hat{l}}) \, , \\ & (\psi^{\dagger \hat{i}^*} \bar{\sigma}^{\mu\nu} \psi^{\dagger\hat{j}^*}) (\psi^{\dagger \hat{k}^*} \bar{\sigma}_{\mu\nu} \psi^{\dagger\hat{l}^*}) \, , \quad (\psi^{\dagger \hat{i}^*} \bar{\sigma}^{\mu\nu} \psi^{\dagger\hat{j}^*}) (\psi^{\hat{i}} \sigma_{\mu\nu} \psi^{\hat{j}}) \end{align*} are Fierz rearranged to the standard forms \begin{align*} (\psi^{\dagger \hat{i}^*} \psi^{\dagger \hat{j}^*}) (\psi^{\hat{i}} \psi^{\hat{j}}) \, , \,\, (\psi^{\hat{i}} \psi^{\hat{j}}) (\psi^{\hat{k}} \psi^{\hat{l}}) \, , \, \, (\psi^{\dagger \hat{i}^*} \psi^{\dagger \hat{j}^*}) (\psi^{\dagger \hat{k}^*} \psi^{\dagger \hat{l}^*}) \end{align*} in the Lagrangian~(\ref{eq:LGHEFT-sym}) The HEFT Lagrangian~(\ref{eq:LHEFT2}) can be reproduced by restricting the particle contents and the structures of the coupling functions. We summarize the relationship between GHEFT~(\ref{eq:LGHEFT-sym}) and HEFT~(\ref{eq:LHEFT2}) in appendix \ref{app:HEFT}. The minimal electroweak gauge interactions are introduced to the EFT Lagrangian by replacing $\partial_\mu\xi_W$ and $\partial_\mu\xi_Y$ with the covariant derivatives; \begin{eqnarray} D_\mu\xi_W &=& \partial_\mu \xi_W-ig_W W^a_\mu\frac{\tau^a}{2}\xi_W\,, \label{eq:DxiW}\\ D_\mu\xi_Y &=& \partial_\mu \xi_Y+ig_Y \xi_YB_\mu\frac{\tau^3}{2}\,, \label{eq:DxiY} \end{eqnarray} with $W^a_\mu~(a=1,2,3)$, $B_\mu$, $g_W$ and $g_Y$ being the $SU(2)_W$ and $U(1)_Y$ gauge fields and gauge coupling strengths. It is also straightforward to introduce minimal QCD interactions with gluons by gauging the bosonic indices $I$, $J$ and fermionic indices $\hat{i}$, $\hat{j}$, $\hat{i}^*$, $\hat{j}^*$ in an appropriate manner. We can also include non-minimal gauge interactions through operators like $g_V (\psi^{\hat{i}}\sigma^{\mu\nu} \psi^{\hat{j}}) V_{\mu\nu}$ with $V_{\mu\nu}$, $g_V$ being the field strength and the coupling strength of the gauge boson. As we will discuss in the next subsection, however, these operators do not appear at the leading order in the chiral order counting rule. \subsection{Chiral order counting rule} \label{sec:powercounting} Low energy effective theories are not renormalizable. They therefore contain infinitly many free parameters. In order to compute scattering amplitudes keeping certain predictability in effective theories, we need to introduce an order counting rule which enables us to distinguish phenomenologically relevant parameters from irrelevant ones. If the underlying physics behind the effective theory is a perturbative theory, the operators in the effective theory can simply be organized by their mass dimensions. Higher dimensional operators decouple from the low energy physics quickly and the associated parameters are suppressed by the inverse power of the cutoff scale. The SMEFT \cite{Buchmuller:1985jz, Grzadkowski:2010es, Brivio:2017vri, Manohar:2018aog}~is constructed based on this idea. This idea cannot be applied to non-perturbative physics, however. The chiral perturbation theory describing the low energy pion scattering amplitudes in the hadron physics is a well-known example~\cite{Weinberg:1978kz,Gasser:1983yg,Gasser:1984gg,Georgi:1994qn,Donoghue:1992dd}. In the chiral perturbation theory, the operators in the effective theory are not organized by their mass dimensions. They are organized by the number of derivatives, instead. The chiral order counting rule in the chiral perturbation theory is known to be consistent with the expansion in terms of the energy in the scattering amplitudes, with the expansion in terms of loops, and also with the expansion in terms of light quark masses. How can we organize the chiral order counting rule in our effective Lagrangian? The rule should be consistent with the expansion in terms of the energy and also with the expansion in terms of loops. In order to construct such a chiral order counting rule, we next study divergence structure in the radiative corrections, and we justify that (\ref{eq:LGHEFT-sym}) is regarded as the leading order Lagrangian in the loop expansion. We first consider an amputated connected $L$-loop Feynman diagram ${\mathscr D}$ made only from the interactions in the Lagrangian~(\ref{eq:LGHEFT-sym}). The diagram possesses $I_\phi$ scalar internal propagators and $I_\psi$ fermion internal propagators. The vertices in the diagram are labelled by an integer $n=1, 2, \cdots, N_v$, with $N_v$ being the total number of vertices in the diagram. The superficial degree of divergence for ${{\mathscr D}}$ is denoted by $d({{\mathscr D}})$. It can be calculated from \begin{equation} \int (d^4 p)^{L} \, p^{(\# \partial)} \left(\frac{1}{p^2}\right)^{I_\phi}\left(\frac{1}{p}\right)^{I_\psi}\, , \quad (\# \partial) := \sum_{n=1}^{N_v} (\# \partial)_n \, . \end{equation} Here the $n$-th vertex appears from the operator with $(\# \partial)_n$ derivatives and $2\times (\# \psi\psi)_n$ fermions. We also introduce spurions for later convenience. The $n$-th vertex operator is assigned to have $(\# s)_n$ spurion fields. These numbers for the operators in the Lagrangian (\ref{eq:LGHEFT-sym}) are listed in table~\ref{tab:numbers}. \begin{table} \centering \begin{tabular}{c|ccccccccc} & $G_{ab}$ & $G_{aI}$ & $G_{IJ}$ & $V$ & $G_{\hat{i}\hat{j}^*}$ & $V_{\hat{i}\hat{j}^* a}$ & $V_{\hat{i}\hat{j}^* I}$ & $M_{\hat{i}\hat{j}}$ & $S_{\hat{i}\hat{j}\hat{k}\hat{l}}$ \\ \hline $(\# \partial)_n$ & 2 & 2 & 2 & 0 & 1 & 1 & 1 & 0 & 0 \\ $(\# \psi\psi)_n$ & 0 & 0 & 0 & 0 & 1 & 1 & 1 & 1 & 2 \\ $(\# s)_n$ & 0 & 0 & 0 & 2 & 0 & 0 & 0 & 1 & 0 \end{tabular} \caption{ \label{tab:numbers} The number of derivatives, the number of fermion bilinears, and the number of spurions for operators in the lowest order Lagrangian. } \end{table} We obtain \begin{equation} d({\mathscr D}) = 4L + \sum_{n=1}^{N_v} (\# \partial)_n - 2 I_\phi - I_\psi \, . \end{equation} We next expand the diagram ${\mathscr D}$ in terms of the external momentum $p$, \begin{align} {{\mathscr D}} &= \sum_{(\# p)=0,1,2,\cdots} {{\mathscr D}}_{(\# p)} \, p^{(\# p)} \nonumber\\ &= {{\mathscr D}}_0 + {{\mathscr D}}_1\,p + {{\mathscr D}}_2 \,p^2 + \cdots \, . \end{align} The superficial degree of divergence for ${{\mathscr D}}_{(\# p)}$ is thus \begin{equation} d({{\mathscr D}}_{(\# p)}) = 4L + \sum_{n=1}^{N_v} (\# \partial)_n - (\# p) - 2 I_\phi - I_\psi \, . \label{eq:superficial} \end{equation} The number of scalar propagators $I_\phi$ can be removed from Eq.\,(\ref{eq:superficial}) by using the graph-theoretical Euler formula \begin{equation} L + N_v - I_\phi - I_\psi = 1 \, . \end{equation} We find \begin{equation} d({{\mathscr D}}_{(\# p)}) = 2L + \sum_{n=1}^{N_v} \left[ (\# \partial)_n -2 \right] - (\# p) + 2 + I_\psi \, . \label{eq:superficial2} \end{equation} We next turn to the renormalization of the effective theory. We assume that the effective theory is non-anomalous. The divergences associated with $d({{\mathscr D}}_{(\# p)}) \ge 0$ can thus be subtracted by introducing local operator counter terms ${\cal O}$. The number of derivatives, the number of fermions, and the number of spurions in ${\cal O}$ are computed as \begin{align} & (\# \partial)_{\cal O} = (\# p) \,,\nonumber\\ & (\# \psi\psi)_{\cal O} = \sum_{n=1}^{N_v} (\# \psi\psi)_n - I_\psi \,, \nonumber\\ & (\# s)_{\cal O} = \sum_{n=1}^{N_v} (\# s)_n \, . \end{align} Using the relations above, the inequality $d({{\mathscr D}}_{(\# p)}) \ge 0$ can be rewritten as \begin{align} 2L & + \sum_{n=1}^{N_v} \left[ (\# \partial)_n + (\# \psi\psi)_n + (\# s)_n -2 \right] \nonumber\\ & \ge (\# \partial)_{\cal O} + (\# \psi\psi)_{\cal O} + (\# s)_{\cal O} -2 \, . \label{eq:superficial3} \end{align} We define ``chiral dimension'' of the operator ${\cal O}$ as \begin{equation} C({\cal O}) := (\# \partial)_{\cal O} + (\# \psi\psi)_{\cal O} + (\# s)_{\cal O} \, . \label{eq:chira-dimension-counting} \end{equation} The spurion field dependences $(\# s)_n$ in the table~\ref{tab:numbers} are determined so as to keep $C(n)=2$ in the lowest order Lagrangian. Here we define $C(n)$ as the chiral dimension for operator from which $n$-th vertex arises in the Feynman diagram ${{\mathscr D}}$. The counter terms ${\cal O}$ we need to introduce to subtract the divergences in the diagram ${{\mathscr D}}_{(\# p)}$ therefore satisfy an inequality \begin{equation} 2 L + \sum_{n=1}^{N_v} \left[ C(n) - 2 \right] \ge C({\cal O}) -2 \, . \label{eq:condition} \end{equation} Here the equality corresponds to the logarithmic divergence. Since $C(n)=2$ for operators in the lowest order Lagrangian, we obtain \begin{equation} 2 L + 2 \ge C({\cal O}) \, . \label{eq:chiral-order-condition2} \end{equation} The divergences in the $L$ loop diagram made from the lowest order Lagrangian can thus be subtracted by using finite number of counter terms having ``chiral dimensions'' less than or equal to $2L+2$. We need to pay a special attention to the four-fermion operators~\cite{Nyffeler:1999ap,Hirn:2004ze,Hirn:2005fr,Hirn:2005sj} in the Lagrangian~(\ref{eq:LGHEFT-sym}). These four-fermion operators would arise at leading-order for instance from the exchange of a heavy resonance with a strong coupling. The coefficients of the four-fermion operators {\em do not decouple} and appear at the leading order in the low energy effective theory due to the strong interaction with the heavy resonance\footnote{ The four-fermion operators have been ignored in the HEFT approach \refheft , however. This is because that, in the HEFT, quarks and leptons are assumed to couple with the heavy resonance only perturbatively. Therefore, the number of spurions $(\# s)_n$ for the four-fermion operators is assigned to be $(\# s)_n>0$ in the HEFT approach. They therefore can be treated as the next-to-leading order Lagrangian in the HEFT \cite{Buchalla:2013eza}. The assumptions made in the HEFT approach need not to hold, however, if we do not assume underlying UV physics behind our effective theory. }. Moreover, the SM quarks and leptons may be composite states arising from new strong dynamics. The exchange of common constituent in the composite state naturally produce large coefficient $(4\pi)^2/\Lambda^2$ for the composite four-fermion operators~\cite{Eichten:1983hw,Hagiwara:1985wt,Baur:1987ga}. Even if the SM quarks and leptons are assumed to be elementary fermions, there may also exist relatively light partner fermions in the strongly interacting EWSB sector. The four-fermion operators involving these strongly interacting partner fermions appear at the leading-order in our effective Lagrangian. These are the reasons why we {\em did not} assign $(\# s)_n > 0$ for the four-fermion operators in the table~\ref{tab:numbers}. We also note that the assignments of the spurion field dependences of $V$ and $M_{\hat{i}\hat{j}}$ terms in the table~\ref{tab:numbers} are determined to balance the chiral dimensions of mass- and kinetic-terms in scalar and fermion propagators. There exist one-loop divergence which can be subtracted by the counter term $s\, \psi^{\hat{i}}\sigma^{\mu\nu} \psi^{\hat{j}}\,[\alpha^a_{\perp\mu}, \alpha^b_{\perp\nu}]$. Note that, due to the chirality-flip structure of the operator, the divergence appears only with the chirality flipping spurion field $s$. The chiral dimension of the counter term is therefore counted as 4. The appearance of the one-loop divergence associated with this operator is consistent with the expectation from the chiral order counting rule (\ref{eq:chiral-order-condition2}). It should also be stressed that, if we included the operator $s\, \psi^{\hat{i}}\sigma^{\mu\nu} \psi^{\hat{j}}\,[\alpha^a_{\perp\mu}, \alpha^b_{\perp\nu}]$ in the lowest order Lagrangian, we were not able to perform systematic expansion in the computation of the amplitudes based on the chiral order counting rule. It is now straightforward to construct a systematic expansion of the amplitudes based on the chiral order counting rule. Note here that the inequality (\ref{eq:condition}) holds even in general $L$-loop diagram with $C(n)\ge 2$. It therefore assures us to obtain finite amplitude by applying the standard subtraction procedure with these counter terms. The loop expansion should therefore be performed simultaneously with the expansion in terms of the chiral dimension (\ref{eq:chira-dimension-counting}). If we restrict ourself to the operators with $(\#\psi\psi)_{\cal O}=0$, this result is well-known in the context of the chiral perturbation theory (low-energy effective theory for QCD pion)~\cite{Weinberg:1978kz,Gasser:1983yg,Gasser:1984gg,Georgi:1994qn,Donoghue:1992dd}. Our finding therefore can be regarded as a fermionic generalization of the chiral perturbation theory. Finally let us give a comment on the chiral order counting of the gauge sector. We remark that, in order to make the gauge boson kinetic Lagrangian \begin{eqnarray} \mathcal{L}_{\rm{gauge,kin}} = -\frac{1}{4}W^a_{\mu\nu}W^{a\mu\nu} -\frac{1}{4}B_{\mu\nu}B^{\mu\nu}\,, \end{eqnarray} to be at the leading-order (chiral dimension 2), we need to assign the chiral dimensions of the field strengths as \begin{eqnarray} && C(W^a_{\mu\nu})=C(B_{\mu\nu})=1\,.\label{eq:chiraldim-Vmunu} \end{eqnarray} Since $C(\partial)=1$, (\ref{eq:chiraldim-Vmunu}) implies \begin{eqnarray} &&C(W^a_{\mu})=C(B_{\mu})=0\,.\label{eq:chiraldim-Vmu} \end{eqnarray} Furthermore, since the gauge bosons are introduced as Eqs.~(\ref{eq:DxiW}) and (\ref{eq:DxiY}), the chiral dimension of the gauge coupling parameters should be \begin{eqnarray} &&C(g_W)=C(g_Y)=1\,. \end{eqnarray} Computing the one-loop diagrams with an external gauge line, we find there exist divergences in the operator, \begin{equation} g_V s (\psi^{\hat{i}} \sigma^{\mu\nu} \psi^{\hat{j}}) V_{\mu\nu} \, . \label{eq:dipole-operator} \end{equation} The chiral dimension of (\ref{eq:dipole-operator}) is \begin{equation} C(g_V s (\psi^{\hat{i}} \sigma^{\mu\nu} \psi^{\hat{j}}) V_{\mu\nu} ) = 4 \, . \end{equation} The appearance of the one-loop divergence associated with this operator is consistent with the expectation from the chiral order counting rule (\ref{eq:chiral-order-condition2}). It should also be stressed that, if we included the operator $g_V s (\psi^{\hat{i}} \sigma^{\mu\nu} \psi^{\hat{j}}) V_{\mu\nu}$ in the lowest order Lagrangian, we were not able to perform systematic expansion in the computation of the amplitudes based on the chiral order counting rule. \subsection{Geometrical form} The scalar fields in the leading order GHEFT Lagrangian (\ref{eq:LGHEFT-sym}) consist of NG boson fields $\pi^a$ and the non-NG boson fields $\phi^I$. It is convenient to introduce a scalar field multiplet notation $\phi^i$, not distinguishing the NG bosons from the non-NG bosons, \begin{equation} \phi^i = (\pi^a,\phi^I) = (\pi^1,\pi^2,\pi^3,\phi^1,\cdots,\phi^{n_s}) \,. \end{equation} Using the scalar multiplet $\phi^i$, the EFT Lagrangian (\ref{eq:LGHEFT-sym}) can be expressed in a geometrical form: \begin{eqnarray} \mathcal{L}_{\rm{GHEFT}} &=& \frac{1}{2}g_{ij}(\phi)(\partial_\mu \phi^i)(\partial^\mu \phi^j)-V(\phi) \nonumber\\ &+& \frac{i}{2}g_{{\hat{i}}{\hat{j}}^*}(\phi) \biggl( \psi^{\dag {\hat{j}}^*}\bar{\sigma}^\mu (\partial_\mu \psi^{\hat{i}}) - (\partial_\mu\psi^{\dag {\hat{j}}^*})\bar{\sigma}^\mu \psi^{\hat{i}} \biggr) \nonumber\\ &+& v_{{\hat{i}}{\hat{j}}^*i}(\phi) \, \psi^{\dag {\hat{j}}^*}\bar{\sigma}^\mu \psi^{\hat{i}} (\partial_\mu \phi^i) \nonumber\\ &-& \frac{1}{2} M_{{\hat{i}}{\hat{j}}}(\phi)\, \psi^{\hat{i}}\psi^{\hat{j}} -\frac{1}{2} M_{{\hat{i}}^*{\hat{j}}^*}(\phi)\, \psi^{\dag {\hat{i}}^*}\psi^{\dag {\hat{j}}^*} \nonumber\\ &+& \frac{1}{8} S_{{\hat{i}}{\hat{j}}{\hat{k}}{\hat{l}}}(\phi) (\psi^{{\hat{i}}}\psi^{{\hat{j}}})(\psi^{{\hat{k}}}\psi^{{\hat{l}}}) \nonumber\\ &+& \frac{1}{8} S_{{\hat{i}}^*{\hat{j}}^*{\hat{k}}^*{\hat{l}}^*}(\phi) (\psi^{\dag {\hat{i}}^*}\psi^{\dag {\hat{j}}^*}) (\psi^{\dag {\hat{k}}^*}\psi^{\dag {\hat{l}}^*}) \nonumber\\ &+& \frac{1}{4} S_{{\hat{i}}{\hat{j}}{\hat{k}}^*{\hat{l}}^*}(\phi) (\psi^{{\hat{i}}}\psi^{{\hat{j}}}) (\psi^{\dag {\hat{k}}^*}\psi^{\dag {\hat{l}}^*}) \,, \label{eq:gheft1} \end{eqnarray} where $g_{{\hat{i}}{\hat{j}}^*}$ and $v_{{\hat{i}}{\hat{j}}^*i}$ satisfy \begin{eqnarray} &&[g_{{\hat{i}}{\hat{j}}^*}(\phi)]^* = g_{{\hat{j}}{\hat{i}}^*}(\phi) \,,\\ &&[v_{{\hat{i}}{\hat{j}}^*i}(\phi)]^* = v_{{\hat{j}}{\hat{i}}^*i}(\phi) \,. \end{eqnarray} The coefficients $g_{{\hat{i}}{\hat{j}}^*}$ and $v_{{\hat{i}}{\hat{j}}^*i}$ are calculated from $G_{{\hat{i}}{\hat{j}}^*}$, $V_{{\hat{i}}{\hat{j}}^*a}$, and $V_{{\hat{i}}{\hat{j}}^*I}$ as \begin{eqnarray} g_{{\hat{i}}{\hat{j}}^*} &=& G_{{\hat{i}}{\hat{j}}^*} \,,\\ v_{{\hat{i}}{\hat{j}}^*1} &=& V_{{\hat{i}}{\hat{j}}^*1} - \frac{1}{2} V_{{\hat{i}}{\hat{j}}^*3}\pi^2 \nonumber\\ &-& \frac{1}{6} V_{{\hat{i}}{\hat{j}}^*1} \pi^2\pi^2 + \frac{1}{6} V_{{\hat{i}}{\hat{j}}^*2}\pi^1\pi^2 + \mathcal{O}((\pi)^3) \,,\\ v_{{\hat{i}}{\hat{j}}^*2} &=& V_{{\hat{i}}{\hat{j}}^*2} + \frac{1}{2} V_{{\hat{i}}{\hat{j}}^*3}\pi^1 \nonumber\\ &-& \frac{1}{6}V_{{\hat{i}}{\hat{j}}^*2}\pi^1\pi^1 + \frac{1}{6} V_{{\hat{i}}{\hat{j}}^*1}\pi^1\pi^2 + \mathcal{O}((\pi)^3) \,,\\ v_{{\hat{i}}{\hat{j}}^*3} &=& V_{{\hat{i}}{\hat{j}}^*3} + \frac{1}{2} ( G_{\hat{i}'\hat{j}^*}[Q_\psi]^{\hat{i}'}_{~\hat{i}} + G_{\hat{i}\hat{j}'^*}[Q_\psi]^{\hat{j}'^*}_{~\hat{j}^*} ) \nonumber\\ &-& iV_{{\hat{i}}{\hat{j}}^*I}[Q_\phi]^I_{~J}\phi^J + \mathcal{O}((\pi)^3) \,,\\ v_{{\hat{i}}{\hat{j}}^*I} &=& V_{{\hat{i}}{\hat{j}}^*I} \,. \end{eqnarray} and the scalar metric tensor $g_{ij}$ are calculated from $G_{ab}$, $G_{aI}$, and $G_{IJ}$ \cite{Nagai:2019tgi}. It may also be illuminating to point out a similarity between our GHEFT Lagrangian (\ref{eq:gheft1}) and the supersymmetric non-linear sigma model Lagrangian, \begin{align} {\cal L} &= g_{ii^*} (\partial_\mu \phi^i) \eta^{\mu\nu} (\partial_\nu \phi^{\dagger i^*}) -g^{ii^*} P_{, i} P^\dagger_{, i^*} \nonumber\\ &\quad +\dfrac{i}{2} g_{ii^*}\, \left( \psi^{\dagger i^*} \bar{\sigma}^\mu (\partial_\mu \psi^i) -(\partial_\mu \psi^{\dagger i^*}) \bar{\sigma}^\mu \psi^i \right) \nonumber\\ &\quad +\dfrac{i}{2} (\psi^{\dagger i^*} \bar{\sigma}^\mu \psi^i) \, \left( g_{ii^* , j} \partial_\mu \phi^j -g_{ii^*, j^*} \partial_\mu \phi^{\dagger j^*} \right) \nonumber\\ &\quad -\left( P_{, ij}-P_{,i'} g^{i' i^*} g_{ii^*, i} \right) (\psi^i \psi^j) \nonumber\\ &\quad -\left( P^\dagger_{, i^*j^*}-P^\dagger_{,i^{\prime *}} g^{i i^{\prime *}} g_{ii^*, j^*} \right) (\psi^{\dagger i^*} \psi^{\dagger j^*}) \nonumber\\ &\quad +\dfrac{1}{4} (g_{ii^* , jj^*} - g^{i' i^{\prime *}} g_{i' i^*, j^*} g_{ii^{\prime *}, j}) (\psi^{\dagger i^*} \psi^{\dagger j^*}) (\psi^i \psi^j) \, , \label{eq:susynlsm} \end{align} with $P(\phi)$ being the superpotential and the K\"{a}hler metric $g_{ij^*}(\phi, \phi^\dagger)$ is computed from the K\"{a}hler potential $K(\phi, \phi^\dagger)$, \begin{align} g_{ij^*}(\phi, \phi^\dagger) &= \dfrac{\partial^2 K}{\partial \phi^i \partial \phi^{\dagger j^*}} \, . \end{align} Here we use a comma-derivative notation \begin{align} g_{ii^* , j} := \dfrac{\partial}{\partial \phi^j} g_{ii^*} \, , \quad g_{ii^* , j^*} := \dfrac{\partial}{\partial \phi^{\dagger j^*}} g_{ii^*} \, , \quad \cdots \, , \end{align} to keep the expression as simple as possible. Not only the scalar and fermion kinetic terms, but also the counter parts to $v_{\hat{i}\hat{j}^* i}(\phi)$ and four-fermion terms in the GHEFT Lagrangian (\ref{eq:gheft1}) are expressed in terms of K\"{a}hler manifold geometry. Even though the scalar manifold of our GHEFT Lagrangian (\ref{eq:gheft1}) does not possess K\"{a}hler properties, as we will show later, the particle scattering amplitudes in the GHEFT Lagrangian can also be described in terms of the covariant tensors of the manifold. \section{Normal coordinate} \label{sec:NC} \subsection{Field coordinate transformations} Kamefuchi-O'Raifeartaigh-Salam (KOS) theorem \cite{Kamefuchi:1961sb} tells us that seemingly different effective Lagrangians connected through the field coordinate transformations can describe the identical scattering amplitudes. Effective Lagrangian therefore cannot be determined uniquely. We here summarize the field coordinate transformation properties in the effective Lagrangian. We consider a field transformation which keeps the chiral dimension of the fields. Under such a redefinition of the field coordinates $\psi^{\hat{i}}$, $\psi^{\dagger {\hat{i}}^*}$, $\phi^i$: \begin{align} &\phi^i \to f^i{}(\phi) \, ,\nonumber\\ & \psi^{\hat{i}} \to f^{\, {\hat{i}}}{}_{{\hat{j}}}(\phi) \, \psi^{\hat{j}} \, , \nonumber\\ & \psi^{\dagger {\hat{i}}^*} \to f^{* \, {\hat{i}}^*}{}_{{\hat{j}}^*}(\phi) \, \psi^{\dagger {\hat{j}}^*} \, , \label{eq:redef} \end{align} the functions $g_{ij}(\phi)$, $g_{{\hat{i}}{\hat{j}}^*}(\phi)$, $v_{{\hat{i}}{\hat{j}}^* i}(\phi)$, $M_{{\hat{i}}{\hat{j}}}(\phi)$, $M_{{\hat{i}}^*{\hat{j}}^*}(\phi)$, $S_{{\hat{i}}{\hat{j}}{\hat{k}}{\hat{l}}}(\phi)$, $S_{{\hat{i}}^* {\hat{j}}^* {\hat{k}}^* {\hat{l}}^*}(\phi)$, and $S_{{\hat{i}}{\hat{j}} {\hat{k}}^* {\hat{l}}^*}(\phi)$ in Eq.\,(\ref{eq:gheft1}) transform as \begin{align} g_{ij}(\phi) &\to g_{i'j'}(f(\phi)) \, f^{i'}{}_{,\, i}(\phi) \, f^{j'}{}_{,\, j}(\phi) \, , \label{eq:transf1} \\ g_{{\hat{i}}{\hat{j}}^*}(\phi) &\to g_{{\hat{i}}'{\hat{j}}'^*}(f(\phi)) \, f^{{\hat{i}}'}{}_{{\hat{i}}}(\phi) \, f^{*{\hat{j}}'^*}{}_{{\hat{j}}^*}(\phi) \, , \\ v_{{\hat{i}}{\hat{j}}^*i}(\phi) &\to v_{{\hat{i}}'{\hat{j}}'^* i'}(f(\phi)) \, f^{i'}{}_{,\, i}(\phi) \, f^{{\hat{i}}'}{}_{{\hat{i}}}(\phi) \, f^{*{\hat{j}}'^*}{}_{{\hat{j}}^*}(\phi) \nonumber\\ & \quad +\dfrac{i}{2} g_{{\hat{i}}'{\hat{j}}'^*}(f(\phi)) \, \biggl( f^{{\hat{i}}'}{}_{{\hat{i}},\, i}(\phi) \, f^{*{\hat{j}}'^*}{}_{{\hat{j}}^*}(\phi) \nonumber\\ &\qquad \qquad \qquad \qquad - f^{{\hat{i}}'}{}_{\hat{i}}(\phi) \, f^{*{\hat{j}}'^*}{}_{{\hat{j}}^*, \, i}(\phi) \biggr) \, , \end{align} \begin{align} M_{{\hat{i}}{\hat{j}}}(\phi) &\to M_{{\hat{i}}'{\hat{j}}'}(\phi) f^{{\hat{i}}'}{}_{{\hat{i}}}(\phi) \, f^{{\hat{j}}'}{}_{{\hat{j}}}(\phi) \, , \\ M_{{\hat{i}}^* {\hat{j}}^*}(\phi) &\to M_{{\hat{i}}'^* {\hat{j}}'^*}(\phi) f^{* {\hat{i}}'^*}{}_{{\hat{i}}}(\phi) \, f^{* {\hat{j}}'^*}{}_{{\hat{j}}}(\phi) \, , \end{align} and \begin{align} \lefteqn{S_{{\hat{i}}{\hat{j}}{\hat{k}}{\hat{l}}}(\phi)}\nonumber\\ &\to S_{{\hat{i}}'{\hat{j}}'{\hat{k}}'{\hat{l}}'}(\phi) \, f^{{\hat{i}}'}{}_{{\hat{i}}}(\phi) \, f^{{\hat{j}}'}{}_{{\hat{j}}}(\phi) \, f^{{\hat{k}}'}{}_{{\hat{k}}}(\phi) \, f^{{\hat{l}}'}{}_{{\hat{l}}}(\phi) \, , \\ \lefteqn{ S_{{\hat{i}}^* {\hat{j}}^* {\hat{k}}'^* {\hat{l}}'^*}(\phi)}\nonumber\\ &\to S_{{\hat{i}}'^* {\hat{j}}'^* {\hat{k}}'^* {\hat{l}}'^*}(\phi) \, f^{* {\hat{i}}'^*}{}_{\!\!\!{\hat{i}}^*}(\phi) \, f^{* {\hat{j}}'^*}{}_{\!\!\!{\hat{j}}^*}(\phi) \, f^{* {\hat{k}}'^*}{}_{\!\!\!{\hat{k}}^*}(\phi) \, f^{* {\hat{l}}'^*}{}_{\!\!\!{\hat{l}}^*}(\phi) \, , \\ \lefteqn{S_{{\hat{i}} {\hat{j}} {\hat{k}}^* {\hat{l}}^*}(\phi)}\nonumber\\ &\to S_{{\hat{i}}' {\hat{j}}' {\hat{k}}'^* {\hat{l}}'^*}(\phi) \, f^{{\hat{i}}'}{}_{{\hat{i}}}(\phi) \, f^{{\hat{j}}'}{}_{{\hat{j}}}(\phi) \, f^{* {\hat{k}}'^*}{}_{\!\!\!{\hat{k}}'^*}(\phi) \, f^{* {\hat{l}}'^*}{}_{\!\!\!{\hat{l}}'^*}(\phi) \, . \label{eq:transf2} \end{align} The model parametrization in the GHEFT Lagrangian (\ref{eq:gheft1}) is, therefore, not unique. Seemingly different Lagrangians can describe the same scattering amplitudes, if these Lagrangians are connected with each other through the field redefinitions (\ref{eq:redef}). The GHEFT Lagrangian (\ref{eq:gheft1}) therefore contains the redundancy in its model parametrization, which leads to a lot of inconveniences in its phenomenological analysis. Clearly, we need a method which can uniquely identify the class of GHEFT Lagrangians which describe the same scattering amplitudes. Note that the field redefinitions (\ref{eq:redef}) can be regarded as a general coordinate transformation in the field space manifold. Therefore, the scattering amplitudes are expected to be described in terms of covariantly transforming tensors under these general coordinate transformations. We can consider more general field redefinitions than Eq.\,(\ref{eq:redef}) such as $\phi \to \phi + \psi \psi $ and $\phi \to \phi + \partial_\mu \phi\, \partial^\mu \phi$. These field transformations, however, violate the chiral-order counting rule. Amplitudes computed with finite order in the chiral order counting are affected by these field redefinitions. We therefore restrict ourselves within the field coordinate transformations given in Eq.\,(\ref{eq:redef}). In our previous paper \cite{Nagai:2019tgi}, we have explicitly shown that the scalar scattering amplitudes are described in terms of the Riemann curvature tensor $R_{i_1 i_2 i_3 i_4}(\phi)$ in the scalar field space and the scalar potential $V(\phi)$ and their covariant derivatives. We have also shown that the use of the Riemann Normal Coordinate (RNC) can reduce the computational tasks significantly. In the present paper, we generalize these findings to the fermionic GHEFT Lagrangian (\ref{eq:gheft1}). \subsection{Scalar sector} As we have shown in Ref.\,\cite{Nagai:2019tgi}, the use of RNC significantly reduces the computational task of the scalar boson scattering amplitudes. This is because of the fact that, in RNC, the Taylor expansion of the field metric tensor $g_{ij}(\phi)$ is expressed in terms of covariant quantities, {\it{i.e.}}, the Riemann curvature tensor and its covariant derivatives. On the other hand, although the RNC is defined by using the geodesics on the manifold, there is no direct connection between the computation of the scattering amplitudes and the geodesic equations on the scalar manifold. Moreover, the GHEFT Lagrangian we gave in Eq.\,(\ref{eq:gheft1}) contains a complex valued fermion metric $g_{{\hat{i}}{\hat{j}}^*}(\phi)$, in addition to the real valued scalar manifold metric $g_{ij}(\phi)$ and the meaning of the geodesic equations in fermionic metric $g_{{\hat{i}}{\hat{j}}^*}(\phi)$ is not clear \cite{Higashijima:2002fq}. It should therefore be illuminating, before going to the fermionic sector of the GHEFT Lagrangian, to reconsider the derivation of the normal coordinate in the scalar manifold in a manner not relying on the geodesic equations. Here the normal coordinate is defined as a coordinate in which Taylor expansion coefficients of metric tensor around the vacuum are all expressed in terms of covariant tensors. We introduce contravariant and covariant vectors, \begin{equation} v^i(\phi) \, , \qquad a_i(\phi) \, , \end{equation} which transform as \begin{align} v^i(\phi) \to v^{i'}(f(\phi)) \, f^i_{,\, i'}(\phi) \, , \quad a_i(\phi) \to a_{i'}(f(\phi)) \, f^{i'}_{,\, i}(\phi) \, . \end{align} The covariant derivative of $v^i$ and $a_i$ are expressed by using the ``semi-colon'' covariant-derivative notation, \begin{align} v^i_{;\, j} = v^i_{,\, j} + v^{i'} \Gamma^i_{i'j} \, , \qquad a_{i;\, j} = a_{i,\, j} - a_{i'} \Gamma^{i'}_{ij} \, , \end{align} with the bosonic Affine connection $\Gamma^i_{jk}$ being defined as \begin{equation} \Gamma^i_{jk} = \dfrac{1}{2} g^{ii'} \left( g_{i'j, \, k} + g_{i'k, \, j} - g_{jk, \, i'} \right) \, , \end{equation} with $g^{ii'}$ being the inverse of the metric tensor, \begin{equation} g^{ii'} \, g_{i'j} = \delta^i_j \, . \end{equation} We consider \begin{align} a_{i;\, jk}-a_{i;\, kj} &= a_{i''} \left( \Gamma^{i''}_{ik,\, j} - \Gamma^{i''}_{ij,\, k} +\Gamma^{i''}_{i'j} \Gamma^{i'}_{ik} -\Gamma^{i''}_{i'k} \Gamma^{i'}_{ij} \right) \nonumber\\ &= a_{i''} R^{i''}{}_{ijk} \, , \end{align} where we define Riemann curvature tensor as \begin{align} R^{i''}{}_{ijk} &= \Gamma^{i''}_{ik,\, j} - \Gamma^{i''}_{ij,\, k} +\Gamma^{i''}_{i'j} \Gamma^{i'}_{ik} -\Gamma^{i''}_{i'k} \Gamma^{i'}_{ij} \, . \end{align} We also introduce \begin{align} R_{ii'jk} &:= g_{ii''} R^{i''}{}_{i'jk} \end{align} for later convenience. We assume the field values at the vacuum are $\phi^i=0$. If the eigenvalues of the scalar manifold metric $g_{ij}$ are all positive definite{\footnote{ This condition guarantees the absence of ghost particles in GHEFT framework. See \cite{Abe:2020ikj, Abe:2018rwb} for the discussion on the pseudo unitarity in theories with ghost particles. }}, we are able to find a normal coordinate in which $g_{ij}(\phi)$ is written as \begin{align} g_{ij}(\phi) &= \delta_{ij} + \dfrac{1}{2} G_{ijk_1 k_2} \, \phi^{k_1} \phi^{k_2} \nonumber\\ & \quad + \dfrac{1}{3!} G_{ij k_1 k_2 k_3 } \, \phi^{k_1} \phi^{k_2} \phi^{k_3} \nonumber\\ & \quad + \dfrac{1}{4!} G_{ij k_1 k_2 k_3 k_4 } \, \phi^{k_1} \phi^{k_2} \phi^{k_3} \phi^{k_4} + \cdots \nonumber\\ &= \delta_{ij} + \dfrac{1}{2} G_{ij(k_1 k_2)} \, \phi^{k_1} \phi^{k_2} \nonumber\\ & \quad + \dfrac{1}{3!} G_{ij (k_1 k_2 k_3)} \, \phi^{k_1} \phi^{k_2} \phi^{k_3} \nonumber\\ & \quad + \dfrac{1}{4!} G_{ij (k_1 k_2 k_3 k_4)} \, \phi^{k_1} \phi^{k_2} \phi^{k_3} \phi^{k_4} + \cdots \label{eq:metric-taylor} \end{align} with coefficients $G_{ijk_1 k_2}$, $G_{ijk_1 k_2 k_3}$, $\cdots$ being expressed in terms of covariant tensors at the vacuum \begin{align} {R}_{ijk_1k_2}\biggl|_{0} & :={R}_{ijk_1k_2}\biggl|_{\phi^i=0} \, ,\nonumber\\ {R}_{ijk_1k_2; \, k_3}\biggl|_{0} &:={R}_{ijk_1 k_2 ; \, k_3}\biggl|_{\phi^i=0} \, , \nonumber\\ & \vdots \, \label{eq:4} \end{align} Here the indices between the parentheses are understood to be symmetrized, {\it{i.e.}}, \begin{align} G_{ij(k_1 k_2)} &:= \dfrac{1}{2} \left( G_{ijk_1 k_2} + G_{ij k_2 k_1} \right) \, , \\ G_{ij(k_1 k_2 k_3)} &:= \dfrac{1}{3!} \left( G_{ijk_1 k_2 k_3} + G_{ij k_2 k_3 k_1} + G_{ij k_3 k_1 k_2} \right.\nonumber\\ & \left. +\,G_{ijk_1 k_3 k_2} + G_{ij k_2 k_1 k_3} + G_{ij k_3 k_2 k_1} \right) \, . \end{align} Since the metric tensor $g_{ij}$ is symmetric under the $i\leftrightarrow j$ exchange, the coefficients $G_{ijk_1 k_2}$, $G_{ijk_1 k_2 k_3}$, $\cdots$ need to satisfy \begin{equation} G_{ijk_1 k_2} = G_{jik_1k_2} \, , \quad G_{ijk_1 k_2 k_3 } = G_{jik_1k_2 k_3} \, , \quad \cdots \, . \end{equation} The Riemann curvature tensor can be computed as \begin{align} R_{i' ijk} &= \dfrac{1}{2} \left( G_{i' k(ij)} - G_{ik(i'j)} - G_{i'j(ik)} + G_{ij(i'k)} \right) \nonumber\\ &\quad +\dfrac{1}{2} \left( G_{i'k(ijk_1)} - G_{ik(i'jk_1)} \right.\nonumber\\ &\quad \qquad \left.- G_{i'j(ik k_1)} + G_{ij(i'k k_1)} \right) \phi^{k_1} \nonumber\\ &\quad +\dfrac{1}{4} \left( G_{i'k(ijk_1 k_2)} - G_{ik(i'jk_1 k_2)} \right.\nonumber\\ &\quad \qquad \left.- G_{i'j(ik k_1 k_2)} + G_{ij(i'k k_1 k_2)} \right) \phi^{k_1} \phi^{k_2} \nonumber\\ &\quad -\dfrac{1}{4} \left( G_{i' j'(jk_1)} + G_{jj'(i' k_1)} - G_{i'j(j'k_1)} \right) \delta^{j' j''} \times \nonumber\\ &\quad\quad \times \left( G_{j''i (k k_2)} + G_{j'' k (i k_2)} - G_{ik(j'' k_2)} \right) \phi^{k_1} \phi^{k_2} \nonumber\\ &\quad +\dfrac{1}{4} \left( G_{i' j'(k k_1)} + G_{k j'(i' k_1)} - G_{i' k (j'k_1)} \right) \delta^{j' j''} \times \nonumber\\ &\quad\quad \times \left( G_{j''i (j k_2)} + G_{j'' j (i k_2)} - G_{i j (j'' k_2)} \right) \phi^{k_1} \phi^{k_2} \nonumber\\ & \quad + \cdots . \label{eq:curvature-expansion} \end{align} We therefore obtain an expression for the Riemann curvature tensor at the vacuum, \begin{align} R_{i12j} \biggr|_0 &= \dfrac{1}{2} \left( G_{ij(12)} - G_{1j(i2)} - G_{i2(1j)} + G_{12(ij)} \right) \, , \label{eq:zero-R} \end{align} and thus \begin{align} R_{i(12)j} \biggr|_0 &= \dfrac{1}{4} \left( 2G_{ij(12)} - G_{1j(i2)} - G_{1i(j2)} \right.\nonumber\\ &\qquad \left.- G_{i2(1j)} - G_{j2(1i)} + 2G_{12(ij)} \right) \, . \label{eq:zero-R1} \end{align} We here introduced a shorthand abbreviation with which $1$, $2$, $\cdots$ are understood to be $k_1$, $k_2$, $\cdots$, respectively. Note that, as we explained earlier, the coefficient $G_{ij(kl\cdot \, \cdot)}$ should be expressed in terms of the Riemann curvature tensor and its covariant derivatives at the vacuum. The form of $G_{ij(12)}$ is uniquely determined as \begin{equation} G_{ij(12)} = a R_{i(12)j} \biggr|_0 \, , \label{eq:assumption1} \end{equation} with $a$ being a constant, thanks to the Riemann tensor symmetry \begin{eqnarray} & R_{1234} + R_{1243} = 0 \, , \nonumber\\ & R_{1234} + R_{2134} = 0 \, , \nonumber\\ & R_{1234} - R_{3412} = 0 \, , \label{eq:r-symmetry} \end{eqnarray} Actually, all other index structures even under the $1 \leftrightarrow 2$ exchange can be reduced to the form of Eq.\,(\ref{eq:assumption1}): \begin{align} R_{ij12} + R_{ij21} &= 0 \, , \\ R_{i1j2} + R_{i2j1} &= - R_{i12j} - R_{i21j} \nonumber\\ &= - 2R_{i(12)j} \ , \\ R_{i12j} + R_{i21j} &= 2R_{i(12)j} \ . \end{align} Plugging Eq.\,(\ref{eq:assumption1}) into the RHS of Eq.\,(\ref{eq:zero-R1}), we obtain \begin{align} R_{i(12)j} \biggr|_0 &= \dfrac{3}{2} a R_{i(12)j} \biggr|_0 \end{align} and therefore we find \begin{align} a = \dfrac{2}{3} \, . \end{align} The coefficient $G_{ij(12)}$ is now determined as \begin{align} G_{ij(12)} &= \dfrac{2}{3} R_{i(12)j} \biggr|_0 \, . \label{eq:zero-result} \end{align} Note that, in our derivation of Eq.\,(\ref{eq:zero-result}), we used the $1\leftrightarrow 2$ symmetrized condition (\ref{eq:zero-R1}) only. We did not use the original condition (\ref{eq:zero-R}). Since Eq.\,(\ref{eq:zero-R}) contains more information than its symmetrized form Eq.\,(\ref{eq:zero-R1}), we should check whether Eq.\,(\ref{eq:zero-result}) does satisfy the original condition (\ref{eq:zero-R}) or not. Plugging Eq.\,(\ref{eq:zero-result}) in the RHS of Eq.\,(\ref{eq:zero-R}), we see \begin{align} \lefteqn{ \dfrac{1}{2} ( G_{ij(12)} - G_{1j(i2)} - G_{i2(1j)} + G_{12(ij)} )}\nonumber\\ &= \dfrac{1}{3} \left( 2 R_{i12j} + R_{i21j} - R_{ij12} \right) \biggr|_0 \nonumber\\ &= R_{i12j} \biggr|_0 \, , \label{eq:zero-R-check} \end{align} and Eq.\,(\ref{eq:zero-R}) is actually satisfied with our result Eq.\,(\ref{eq:zero-result}). In the last line computation of Eq.\,(\ref{eq:zero-R-check}), we used the Bianchi identity \begin{equation} R_{i123} + R_{i231} + R_{i312} = 0 \, . \label{eq:r-bianchi} \end{equation} Since $R_{i12j} \ne R_{i21j}$ in general manifolds, the Bianchi identity plays an essential role for the consistency of the normal coordinates. The higher order terms in the Taylor expansion of $g_{ij}$ in the normal coordinate are computed in appendix~\ref{sec-taylor-gij}. We find the function $g_{ij}(\phi)$ can be expanded in terms of the covariant tensors as \begin{align} g_{ij}(\phi) &= \delta_{ij} + \dfrac{1}{2} G_{ij(k_1 k_2)} \, \phi^{k_1} \phi^{k_2} \nonumber\\ & \quad + \dfrac{1}{3!} G_{ij (k_1 k_2 k_3)} \, \phi^{k_1} \phi^{k_2} \phi^{k_3} \nonumber\\ & \quad + \dfrac{1}{4!} G_{ij (k_1 k_2 k_3 k_4)} \, \phi^{k_1} \phi^{k_2} \phi^{k_3} \phi^{k_4} + \cdots \label{eq:taylor-gij} \end{align} with \begin{align} G_{ij(12)} &= \dfrac{2}{3} R_{i(12)j} \biggr|_0 \, , \\ G_{ij(123)} &= \dfrac{1}{3} \left[ R_{i(12)j; 3} + R_{i(23)j; 1} + R_{i(31)j; 2} \right] \biggr|_0 \, , \\ G_{ij(1234)} &= \dfrac{1}{5} \left[ R_{i(12)j; (34)} + R_{i(34)j; (12)} \right.\nonumber\\ &\left. \phantom{\dfrac{1}{5} \biggl\{} +\, R_{i(13)j; (24)} + R_{i(24)j; (13)} \right.\nonumber\\ & \left. \phantom{\dfrac{1}{5} \biggl\{} +\, R_{i(14)j; (23)} + R_{i(23)j; (14)} \right] \biggr|_0 \nonumber\\ & \quad + \dfrac{8}{45} g^{i' j'} \left[ R_{i'(12)i} R_{j'(34)j} + R_{i'(13)i} R_{j'(24)j} \right.\nonumber\\ &\left. \phantom{\dfrac{8}{45} \biggl\{} +\, R_{i'(14)i} R_{j'(23)j} +R_{i'(34)i} R_{j'(12)j} \right.\nonumber\\ & \left. \phantom{\dfrac{8}{45} \biggl\{} +\, R_{i'(24)i} R_{j'(13)j}+R_{i'(23)i} R_{j'(14)j} \right] \biggr|_0 . \end{align} The Taylor expansion of the potential term $V(\phi)$ can also be given in a similar manner. We obtain \begin{align} V_{, 12} \biggr|_0 &= V_{; 12} \biggr|_0 \, , \\ V_{, 123} \biggr|_0 &= V_{; 123} \biggr|_0 \, , \\ V_{, 1234} \biggr|_0 &= V_{; 1234} \biggr|_0 -\dfrac{2}{3} \left[ V_{;1i} R^i{}_{(23)4} +V_{;2i} R^i{}_{(13)4} \right.\nonumber\\ &\quad \left.+\, V_{;3i} R^i{}_{(12)4} +V_{;4i} R^i{}_{(12)3} \right] \biggr|_0 \, , \\ V_{, 12345} \biggr|_0 &= V_{; 12345} \biggr|_0 - \dfrac{2}{3} \biggl\{ V_{;34i} R^i{}_{(12)5} +V_{;35i} R^i{}_{(12)4} \nonumber\\ &\quad \phantom{-\dfrac{2}{3} \biggl\{} +V_{;45i} R^i{}_{(12)3} +V_{;24i} R^i{}_{(13)5} \nonumber\\ & \quad \phantom{-\dfrac{2}{3} \biggl\{} +V_{;25i} R^i{}_{(13)4} +V_{;14i} R^i{}_{(23)5} \nonumber\\ & \quad \phantom{-\dfrac{2}{3} \biggl\{} +V_{;15i} R^i{}_{(23)4} +V_{;23i} R^i{}_{(14)5} \nonumber\\ & \quad \phantom{-\dfrac{2}{3} \biggl\{} +V_{;13i} R^i{}_{(24)5} +V_{;12i} R^i{}_{(34)5} \biggr\} \biggr|_0 \nonumber\\ & \quad +\dfrac{1}{6} \biggl\{ V_{;1i} (R^i{}_{(45)(2; \, 3)} - 5 R^i{}_{(23)(4; \, 5)}) \nonumber\\ & \quad \phantom{+\dfrac{1}{6} \biggl\{} +V_{;2i} (R^i{}_{(45)(1; \, 3)} - 5 R^i{}_{(13)(4; \, 5)}) \nonumber\\ & \quad \phantom{+\dfrac{1}{6} \biggl\{} +V_{;3i} (R^i{}_{(45)(1; \, 2)} - 5 R^i{}_{(12)(4; \, 5)}) \nonumber\\ & \quad \phantom{+\dfrac{1}{6} \biggl\{} +V_{;4i} (R^i{}_{(35)(1; \, 2)} - 5 R^i{}_{(12)(3; \, 5)}) \nonumber\\ & \quad \qquad +V_{;5i} (R^i{}_{(34)(1; \, 2)} - 5 R^i{}_{(12)(3; \, 4)}) \biggr\} \biggr|_0 \end{align} and therefore \begin{align} V_{, 12} \biggr|_0 &= V_{; (12)} \biggr|_0 \, , \\ V_{, 123} \biggr|_0 &= V_{; (123)} \biggr|_0 \, , \\ V_{, 1234} \biggr|_0 &= V_{; (1234)} \biggr|_0 \, , \\ V_{, 12345} \biggr|_0 &= V_{; (12345)} \biggr|_0 \, , \\ & \vdots \nonumber \end{align} in the normal coordinate. The potential term in the Lagrangian (\ref{eq:gheft1}) can also be expanded in terms of the covariant tensors \begin{align} V(\phi) &= V \biggr|_0 + \dfrac{1}{2} V_{; (k_1 k_2)} \biggr|_0 \phi^{k_1} \phi^{k_2} \nonumber\\ &\qquad + \dfrac{1}{3!} V_{; (k_1 k_2 k_3)} \biggr|_0 \phi^{k_1} \phi^{k_2} \phi^{k_3} \nonumber\\ &\qquad + \dfrac{1}{4!} V_{; (k_1 k_2 k_3 k_4)} \biggr|_0 \phi^{k_1} \phi^{k_2} \phi^{k_3} \phi^{k_4} \nonumber\\ & \qquad + \dfrac{1}{5!} V_{; (k_1 k_2 k_3 k_4 k_5)} \biggr|_0 \phi^{k_1} \phi^{k_2} \phi^{k_3} \phi^{k_4} \phi^{k_5} \nonumber\\ &\qquad + \cdots \end{align} in the normal coordinate. \subsection{Fermion bilinear sector} We next move to the fermion bilinear sector in the GHEFT Lagrangian (\ref{eq:gheft1}). The fermion bilinear sector depends on the three kinds of coupling functions, $g_{\hat{i}\hat{j}^*}$, $v_{\hat{i}\hat{j}^*i}$, and $M_{\hat{i}\hat{j}}$. We define a normal coordinate on the fermion field space so that the coupling functions are expanded in terms of the covariantly transforming tensors. Before computing the expansion coefficients, we introduce the covariant quantities on the fermion field transformation. We first define the ``Affine connection'' as \begin{align} \Gamma^{\hat{i}}_{j{\hat{k}}} &:= \dfrac{1}{2} g^{{\hat{i}} {\hat{l}}^*} \left[ g_{{\hat{k}}{\hat{l}}^*, j} + g_{j{\hat{l}}^*, {\hat{k}}} - g_{j{\hat{k}}, {\hat{l}}^*} \right] \, , \label{eq:affine-f1} \\ \Gamma^{{\hat{i}}^*}_{j{\hat{k}}^*} &:= \dfrac{1}{2} g^{{\hat{l}} {\hat{i}}^*} \left[ g_{{\hat{l}}{\hat{k}}^*, j} + g_{j{\hat{k}}, {\hat{l}}^*} - g_{j{\hat{k}}^*, {\hat{l}}} \right] \, , \label{eq:affine-f2} \end{align} where $g^{{\hat{i}} {\hat{j}}^*}$ is defined as the inverse of $g_{{\hat{i}} {\hat{j}}^*}$, {\it{i.e.}}, \begin{align} g^{{\hat{i}} {\hat{k}}^*} g_{{\hat{j}} {\hat{k}}^*} = \delta^{\hat{i}}_{\hat{j}} \, , \qquad g^{{\hat{k}}{\hat{i}}^*} g_{{\hat{k}}{\hat{j}}^*} = \delta^{{\hat{i}}^*}_{{\hat{j}}^*} \, . \end{align} Got inspiration from the supersymmetric non-linear sigma model Lagrangian (\ref{eq:susynlsm}), we introduce $g_{i{\hat{j}}^*, {\hat{i}}}$ and $g_{i{\hat{i}}, {\hat{j}}^*}$ satisfying \begin{align} v_{{\hat{i}}{\hat{j}}^* i}(\phi) = \dfrac{i}{2} \biggl( g_{i{\hat{j}}^*, {\hat{i}}}(\phi) -g_{i{\hat{i}}, {\hat{j}}^*}(\phi) \biggr) \,, \label{eq:defv} \end{align} which allows us to study supersymmetric theories in the GHEFT framework. There is an ambiguity in the decomposition (\ref{eq:defv}) which will be discussed later. We introduce a function $\chi^{\hat{i}}(\phi)$ and its covariant derivative \begin{align} \chi^{\hat{i}}_{;i} &:= \chi^{\hat{i}}_{, i} + \chi^{{\hat{i}}'} \Gamma^{\hat{i}}_{i{\hat{i}}'} \, . \label{eq:covdel-psi} \end{align} It is easy to show that the derivative (\ref{eq:covdel-psi}) covariantly transforms under the field transformation (\ref{eq:redef}). Moreover, the covariant derivative on the fermionic metric satisfies \begin{align} g_{{\hat{i}}{\hat{j}}^* ; i } := g_{{\hat{i}}{\hat{j}}^*, i} - g_{{\hat{i}}' {\hat{j}}^*} \Gamma^{{\hat{i}}'}_{i{\hat{i}}} - g_{{\hat{i}}{\hat{j}}'^*} \Gamma^{{\hat{j}}'^*}_{i{\hat{j}}^*} = 0 \, . \end{align} The formulas (\ref{eq:affine-f1}) and (\ref{eq:affine-f2}) are therefore considered to be ``Affine connections''. The covariant derivative of $\chi^{\hat{i}}_{;i}(\phi)$ is also defined as usual \begin{align} \chi^{\hat{i}}_{;ij} &:= (\chi^{\hat{i}}_{;i})_{,j} + \chi^{{\hat{i}}'}_{;i} \Gamma^{\hat{i}}_{i{\hat{i}}'} - \chi^{\hat{i}}_{;i'} \Gamma^{i'}_{ij} \, . \end{align} We therefore obtain \begin{align} \chi^{\hat{i}}_{; ij} -\chi^{\hat{i}}_{; ji} &= - \chi^{{\hat{i}}'} \left[ \Gamma^{{\hat{i}}'}_{j{\hat{i}}', i} - \Gamma^{{\hat{i}}}_{i{\hat{i}}', j} +\Gamma^{\hat{i}}_{i{\hat{i}}''} \Gamma^{{\hat{i}}''}_{j{\hat{i}}'} - \Gamma^{\hat{i}}_{j{\hat{i}}''} \Gamma^{{\hat{i}}''}_{i{\hat{i}}'} \right] \nonumber\\ & = - \chi^{{\hat{i}}'} R^{\hat{i}}{}_{{\hat{i}}' ij} \, . \label{eq:half-fermionic-curvature2} \end{align} Here we define the ``Riemann curvature'' tensor $R^{\hat{i}}{}_{{\hat{j}}kl}$ as \begin{align} R^{\hat{i}}{}_{{\hat{j}}kl} &:= \Gamma^{\hat{i}}_{l{\hat{j}}, k} - \Gamma^{\hat{i}}_{k{\hat{j}},l} +\Gamma^{\hat{i}}_{k{\hat{l}}} \Gamma^{{\hat{l}}}_{l{\hat{j}}} -\Gamma^{\hat{i}}_{l{\hat{l}}} \Gamma^{{\hat{l}}}_{k{\hat{j}}} \, . \label{eq:half-fermionic-curvature} \end{align} Note that the definition of ``Riemann curvature tensor'' leads \begin{align} R^{\hat{i}}{}_{{\hat{j}}kl} + R^{\hat{i}}{}_{{\hat{j}}lk} = 0\, . \end{align} It is easy to show that $R^{\hat{i}}{}_{{\hat{j}}kl}$ transforms covariantly under the coordinate transformation given in Eq.\,(\ref{eq:redef}). For the latter convenience, we also define \begin{align} R_{{\hat{j}}^* {\hat{i}} kl} &:= g_{{\hat{l}}{\hat{j}}^*} R^{\hat{l}}{}_{{\hat{i}}kl} \, ,\\ R_{{\hat{i}} {\hat{j}}^* kl} &:= - R_{{\hat{j}}^* {\hat{i}} kl} \, . \end{align} We are now ready to compute the expansion coefficients of the coupling functions in the normal coordinate. The normal coordinate on the fermion field space is defined so that the coupling functions $g_{\hat{i}\hat{j}^*}$ and $v_{\hat{i}\hat{j}^*i}$ are expanded in terms of the covariantly transforming tensors. We first focus on $g_{\hat{i}\hat{j}^*}$. Thanks to the Hermiticity of $g_{\hat{i}\hat{j}^*}$, and since $g_{\hat{i}\hat{j}^*}$ does note depend on the fermion fields, it is always possible to take a fermion coordinate satisfying \begin{align} g_{{\hat{i}}{\hat{j}}^*}(\phi) &= \delta_{{\hat{i}}{\hat{j}}^*} \, . \end{align} The expansion of the fermionic metric is therefore trivial. We next consider the expansion of $v_{\hat{i}\hat{j}^*i}$. Neglecting the anomaly factor only appearing in the loop level, we are allowed to take a coordinate satisfying \begin{align} v_{{\hat{i}}{\hat{j}}^* i}(\phi) &= A_{{\hat{i}}{\hat{j}}^* ij}(\phi) \, \phi^j \, , \label{eq:normal} \end{align} with \begin{align} A_{{\hat{i}}{\hat{j}}^* ij}(\phi) &= -A_{{\hat{i}}{\hat{j}}^* ji}(\phi) \, . \label{eq:anti-sym-temp} \end{align} We resolve the ambiguity in Eq.\,(\ref{eq:defv}) as \begin{align} g_{i{\hat{j}}^*,\, {\hat{i}}}(\phi) = - i A_{{\hat{i}}{\hat{j}}^* ij}(\phi) \, \phi^j \, , \quad g_{i{\hat{i}}, \,{\hat{j}}^*}(\phi) = i A_{{\hat{i}}{\hat{j}}^* ij}(\phi) \, \phi^j \, . \end{align} It is now straightforward to obtain \begin{align} \Gamma^{\hat{i}}_{i{\hat{j}}} = - ig^{{\hat{i}}{\hat{k}}^*} A_{{\hat{j}}{\hat{k}}^* ij} \phi^j \, , \quad \Gamma^{{\hat{i}}^*}_{i{\hat{j}}^*} = ig^{{\hat{k}}{\hat{i}}^*} A_{{\hat{k}}{\hat{j}}^* ij} \phi^j \, . \label{eq:fermion-conn2} \end{align} We next determine the expansion coefficient of $A_{\hat{i}\hat{j}ij}$. Combining Eq.\,(\ref{eq:half-fermionic-curvature}) and Eq.\,(\ref{eq:fermion-conn2}), we obtain the master formula for the determination of the coefficients; \begin{align} R_{{\hat{i}}{\hat{j}}^* ij} &= i (A_{{\hat{i}}{\hat{j}}^* jk} \phi^k )_{, \,i} -i (A_{{\hat{i}}{\hat{j}}^* ik} \phi^k )_{, \,j} \nonumber\\ & \qquad + A_{{\hat{i}}' {\hat{j}}^* ik_1} g^{{\hat{i}}' {\hat{j}}'^*} A_{{\hat{i}} {\hat{j}}'^* jk_2} \phi^{k_1} \phi^{k_2} \nonumber\\ & \qquad - A_{{\hat{i}}' {\hat{j}}^* jk_1} g^{{\hat{i}}' {\hat{j}}'^*} A_{{\hat{i}} {\hat{j}}'^* ik_2} \phi^{k_1} \phi^{k_2} \, . \label{eq:fermion-curvature} \end{align} Plugging the vacuum condition $\phi^i = 0$ in Eq.\,(\ref{eq:fermion-curvature}), we obtain \begin{align} R_{{\hat{i}}{\hat{j}}^* ij} \biggr|_0 &= i A_{{\hat{i}}{\hat{j}}^* ji} \biggr|_0 - i A_{{\hat{i}}{\hat{j}}^* ij} \biggr|_0 \, . \label{eq:temp1} \end{align} Since the function $A_{{\hat{i}}{\hat{j}}^* ij}(\phi)$ is anti-symmetric under the exchange of $i\leftrightarrow j$, Eq.\,(\ref{eq:temp1}) can be expressed as \begin{align} R_{{\hat{i}}{\hat{j}}^* ij} \biggr|_0 &= -2i A_{{\hat{i}}{\hat{j}}^* ij} \biggr|_0 \end{align} and we thus obtain \begin{align} A_{{\hat{i}}{\hat{j}}^* ij} \biggr|_0 &= \dfrac{i}{2} R_{{\hat{i}}{\hat{j}}^* ij} \biggr|_0 \, . \label{eq:fermion-a1} \end{align} Combining Eq.\,(\ref{eq:fermion-a1}) with Eq.\,(\ref{eq:fermion-conn2}), we obtain formulas for the fermionic Affine connections and their derivatives at the vacuum, \begin{align} &\Gamma^{\hat{i}}_{i{\hat{j}}} \biggr|_0 = 0 \, ,& &\Gamma^{{\hat{i}}^*}_{i{\hat{j}}^*} \biggr|_0 = 0 \, , \label{eq:fermionic-affine02} \\ &\Gamma^{\hat{i}}_{i{\hat{j}}, \, j} \biggr|_0 = \dfrac{1}{2} g^{{\hat{i}}{\hat{k}}^*} R_{{\hat{j}}{\hat{k}}^* ij} \biggr|_0 \, ,& &\Gamma^{{\hat{i}}^*}_{i{\hat{j}}^*, \, j} \biggr|_0 = -\dfrac{1}{2} g^{{\hat{k}}{\hat{i}}^*} R_{{\hat{k}}{\hat{j}}^* ij} \biggr|_0 \, . \label{eq:fermionic-affine12} \end{align} The higher order terms in the Taylor expansion of $v_{{\hat{i}}{\hat{j}}^*i}$ in the normal coordinate are computed in appendix~\ref{sec-taylor-vnni}. We find \begin{align} g_{{\hat{i}}{\hat{j}}^*}(\phi) &= \delta_{{\hat{i}}{\hat{j}}^*} \end{align} and the function $v_{{\hat{i}}{\hat{j}}^* i}(\phi)$ can be expanded in terms of the covariant tensors as \begin{align} v_{{\hat{i}}{\hat{j}}^* i}(\phi) &= A_{{\hat{i}}{\hat{j}}^* i k_1} \phi^{k_1} +\dfrac{1}{2!} A_{{\hat{i}}{\hat{j}}^* i k_1 k_2} \phi^{k_1} \phi^{k_2} \nonumber\\ & \qquad +\dfrac{1}{3!} A_{{\hat{i}}{\hat{j}}^* i k_1 k_2 k_3} \phi^{k_1} \phi^{k_2} \phi^{k_3} +\cdots \, , \label{eq:taylor-expansion-vnni} \end{align} with \begin{align} A_{{\hat{i}}{\hat{j}}^* i1} &= \dfrac{i}{2} R_{{\hat{i}}{\hat{j}}^* i1} \biggr|_0 \, , \\ A_{{\hat{i}}{\hat{j}}^* i12} &= \dfrac{i}{3} R_{{\hat{i}}{\hat{j}}^* i(1 ; \, 2)} \biggr|_0 \, , \\ A_{{\hat{i}}{\hat{j}}^* i123} &= \dfrac{i}{4} R_{{\hat{i}}{\hat{j}}^* i(1 ; \, 23)} \biggr|_0 +\dfrac{i}{36} \left[ R_{{\hat{i}}{\hat{j}}^* i' 1} R^{i'}{}_{(23)i} \right.\nonumber\\ &\left.\qquad +R_{{\hat{i}}{\hat{j}}^* i' 2} R^{i'}{}_{(31)i} +R_{{\hat{i}}{\hat{j}}^* i' 3} R^{i'}{}_{(12)i} \right] \biggr|_0 \, , \\ &\vdots \nonumber \end{align} in the normal coordinate. We next move to $M_{{\hat{i}}{\hat{j}}}(\phi)$. Evaluating the Affine connection in the normal coordinate, we obtain Eqs.~(\ref{eq:fermionic-affine02}), (\ref{eq:fermionic-affine12}), and \begin{align} \Gamma^{\hat{i}}_{1{\hat{j}}, 23} \biggr|_0 &= -\dfrac{2}{3} R^{\hat{i}}{}_{{\hat{j}}1(2; \, 3)} \biggr|_0 \, . \end{align} It is now easy to evaluate \begin{align} M_{{\hat{i}}{\hat{j}}, \, 1} \biggr|_0 &= M_{{\hat{i}}{\hat{j}}; \, 1} \biggr|_0 \, , \\ M_{{\hat{i}}{\hat{j}}, \, 12} \biggr|_0 &= M_{{\hat{i}}{\hat{j}};\, 12} \biggr|_0 -\dfrac{1}{2} \left[ M_{{\hat{i}}'{\hat{j}}} R^{{\hat{i}}'}{}_{{\hat{i}}12} + M_{{\hat{i}}{\hat{j}}'} R^{{\hat{j}}'}{}_{{\hat{j}}12} \right] \biggr|_0 \, , \\ M_{{\hat{i}}{\hat{j}}, \, 123} \biggr|_0 &= M_{{\hat{i}}{\hat{j}}; \, 123} \biggr|_0 \nonumber\\ &\!\!\!\!\!\!\!\! -\dfrac{1}{2} \left[ M_{{\hat{i}}' {\hat{j}}; 1} R^{{\hat{i}}'}{}_{{\hat{i}}23} +M_{{\hat{i}}' {\hat{j}}; 2} R^{{\hat{i}}'}{}_{{\hat{i}}13} +M_{{\hat{i}}' {\hat{j}}; 3} R^{{\hat{i}}'}{}_{{\hat{i}}12} \right] \biggr|_0 \nonumber\\ &\!\!\!\!\!\!\!\! -\dfrac{1}{2} \left[ M_{{\hat{i}} {\hat{j}}'; 1} R^{{\hat{j}}'}{}_{{\hat{j}}23} +M_{{\hat{i}} {\hat{j}}'; 2} R^{{\hat{j}}'}{}_{{\hat{j}}13} +M_{{\hat{i}} {\hat{j}}'; 3} R^{{\hat{j}}'}{}_{{\hat{j}}12} \right] \biggr|_0 \nonumber\\ &\!\!\!\!\!\!\!\! -\dfrac{2}{3} M_{{\hat{i}}{\hat{j}}; i} R^i{}_{(12)3} \biggr|_0 \nonumber\\ &\!\!\!\!\!\!\!\! -\dfrac{2}{3} \left[ M_{{\hat{i}}'{\hat{j}}} R^{{\hat{i}}'}{}_{{\hat{i}}1(2; 3)} + M_{{\hat{i}}{\hat{j}}'} R^{{\hat{j}}'}{}_{{\hat{j}}1(2; 3)} \right] \biggr|_0 \end{align} and therefore \begin{align} M_{{\hat{i}}{\hat{j}}, \, 1} \biggr|_0 &= M_{{\hat{i}}{\hat{j}}; \, 1} \biggr|_0 \, , \\ M_{{\hat{i}}{\hat{j}}, \, 12} \biggr|_0 &= M_{{\hat{i}}{\hat{j}};\, (12)} \biggr|_0 \, , \\ M_{{\hat{i}}{\hat{j}}, \, 123} \biggr|_0 &= M_{{\hat{i}}{\hat{j}}; \, (123)} \biggr|_0 \, . \end{align} The fermion mass term in the Lagrangian (\ref{eq:gheft1}) can also be expanded in terms of the covariant tensors \begin{align} M_{{\hat{i}}{\hat{j}}}(\phi) &= M_{{\hat{i}}{\hat{j}}} \biggr|_0 + M_{{\hat{i}}{\hat{j}};\, k_1} \biggr|_0 \phi^{k_1} + \dfrac{1}{2!} M_{{\hat{i}}{\hat{j}}; (k_1 k_2)} \biggr|_0 \phi^{k_1} \phi^{k_2} \nonumber\\ & + \dfrac{1}{3!} M_{{\hat{i}}{\hat{j}}; (k_1 k_2 k_3)} \biggr|_0 \phi^{k_1} \phi^{k_2} \phi^{k_3} + \cdots \label{eq:M-exp} \end{align} in the normal coordinate. It is worth emphasizing that the introduction of the metric-like objects $g_{i\hat{j}}$ and $g_{i\hat{j}^*}$ in (\ref{eq:defv}) allows us to express covariant formulas (\ref{eq:taylor-expansion-vnni}) and (\ref{eq:M-exp}) in compact forms. These metric-like objects, which mix the scalars and fermions, may be understood as ``convenient abbreviations'' in the present non-supersymmetric case. They can be regarded as ``metrics'', however, in a real sense if we embed the theory in supersymmetric models. \subsection{Holomorphic four-fermion sector} We consider holomorphic four-fermion operators \begin{equation} {\cal O}^{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))} := (\psi^{{\hat{i}}_1}_\alpha \, \varepsilon^{\alpha\beta} \, \psi^{{\hat{i}}_2}_\beta ) \, (\psi^{{\hat{i}}_3}_\gamma \, \varepsilon^{\gamma\delta} \, \psi^{{\hat{i}}_4}_\delta ) \, . \label{eq:four-fermion-type} \end{equation} We put the indices $\hat{i}_1$, $\hat{i}_2$, $\hat{i}_3$, $\hat{i}_4$ in parentheses so as to emphasize the index-exchange symmetry, \begin{equation} {\cal O}^{(({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}}))} = {\cal O}^{(({\hat{1}}{\hat{2}})({\hat{4}}{\hat{3}}))} = {\cal O}^{(({\hat{2}}{\hat{1}})({\hat{3}}{\hat{4}}))} = {\cal O}^{(({\hat{3}}{\hat{4}})({\hat{1}}{\hat{2}}))} \, , \label{eq:riemann-like} \end{equation} with $\hat{i}_1$, $\hat{i}_2$, $\cdots$ being abbreviated by $\hat{1}$, $\hat{2}$, $\cdots$. Furthermore, multiplying the fermion fields $\psi^{{\hat{1}}}_\alpha \, \psi^{{\hat{2}}}_\beta \, \psi^{{\hat{3}}}_\gamma \, \psi^{{\hat{4}}}_\delta$ to the Schouten identity \begin{equation} \varepsilon^{\alpha\beta} \, \varepsilon^{\gamma\delta} + \varepsilon^{\alpha\gamma} \, \varepsilon^{\delta\beta} + \varepsilon^{\alpha\delta} \, \varepsilon^{\beta\gamma} \equiv 0 \, , \label{eq:Schouten} \end{equation} we obtain a Bianchi-like identity \begin{equation} {\cal O}^{(({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}}))} + {\cal O}^{(({\hat{1}}{\hat{3}})({\hat{4}}{\hat{2}}))} + {\cal O}^{(({\hat{1}}{\hat{4}})({\hat{2}}{\hat{3}}))} \equiv 0 \, . \label{eq:bianchi-like} \end{equation} Using the Bianchi-like identity (\ref{eq:bianchi-like}), we are able to show \begin{equation} {\cal O}^{(({\hat{1}}{\hat{1}})({\hat{1}}{\hat{1}}))} + {\cal O}^{(({\hat{1}}{\hat{1}})({\hat{1}}{\hat{1}}))} + {\cal O}^{(({\hat{1}}{\hat{1}})({\hat{1}}{\hat{1}}))} \equiv 0 \, , \end{equation} therefore, \begin{equation} {\cal O}^{(({\hat{1}}{\hat{1}})({\hat{1}}{\hat{1}}))} \equiv 0 \, . \label{eq:cond1} \end{equation} In a similar manner, we find \begin{align} {\cal O}^{(({\hat{1}}{\hat{2}})({\hat{2}}{\hat{2}}))} &\equiv 0 \, , \label{eq:cond2} \\ {\cal O}^{(({\hat{1}}{\hat{1}})({\hat{2}}{\hat{2}}))} &\equiv -2 {\cal O}^{(({\hat{1}}{\hat{2}})({\hat{1}}{\hat{2}}))} \, . \label{eq:cond3} \\ {\cal O}^{(({\hat{1}}{\hat{1}})({\hat{2}}{\hat{3}}))} &\equiv - 2 {\cal O}^{(({\hat{1}}{\hat{2}})({\hat{1}}{\hat{3}}))} \, , \label{eq:cond4} \\ {\cal O}^{(({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}}))} &\equiv - {\cal O}^{(({\hat{1}}{\hat{3}})({\hat{2}}{\hat{4}}))} - {\cal O}^{(({\hat{1}}{\hat{4}})({\hat{2}}{\hat{3}}))} \, . \label{eq:cond5} \end{align} We next count the independent degrees of freedom (DOF) of the four fermion operators. The number of independent DOF satisfying the condition (\ref{eq:riemann-like}) is \begin{equation} \dfrac{1}{2} \left[ \dfrac{1}{2} N (N+1) \right] \, \left[ \dfrac{1}{2} N (N+1) + 1 \right] \, . \end{equation} Among them, the four-fermion operators having the identical flavor index automatically vanish as shown in Eq.\,(\ref{eq:cond1}), which reduces the DOF by $N$. In a similar manner, the operator identities (\ref{eq:cond2}), (\ref{eq:cond3}), (\ref{eq:cond4}), and (\ref{eq:cond5}) reduce the DOF by \begin{align} & N(N-1) \, , \qquad \dfrac{1}{2} N(N-1) \, , \nonumber\\ & \dfrac{1}{2} N(N-1)(N-2) \, , \qquad \dfrac{1}{4!} N(N-1)(N-2)(N-3) \, , \nonumber \end{align} accordingly. We therefore find the DOF of the four-fermion operator ${\cal O}^{((12)(34))}$ is given by \begin{align} & \dfrac{1}{2} \left[ \dfrac{1}{2} N (N+1) \right] \, \left[ \dfrac{1}{2} N (N+1) + 1 \right] \nonumber\\ & - N -N(N-1) -\dfrac{1}{2} N(N-1) -\dfrac{1}{2} N(N-1)(N-2) \nonumber\\ & -\dfrac{1}{4!} N(N-1)(N-2)(N-3) =\dfrac{1}{12} N^2(N^2-1) \, , \label{eq:DOF-O} \end{align} which accords the DOF of the $N$-dimensional Riemann curvature tensor. We are now ready to consider the holomorphic four-fermion interactions of the type shown in Eq.\,(\ref{eq:four-fermion-type}), \begin{align} {\cal L} &\ni \dfrac{1}{8} S_{{\hat{i}}_1 {\hat{i}}_2 {\hat{i}}_3 {\hat{i}}_4} (\psi^{{\hat{i}}_1}_\alpha \, \varepsilon^{\alpha\beta} \, \psi^{{\hat{i}}_2}_\beta ) \, (\psi^{{\hat{i}}_3}_\gamma \, \varepsilon^{\gamma\delta} \, \psi^{{\hat{i}}_4}_\delta ) \, . \nonumber\\ &= \dfrac{1}{8} S_{{\hat{i}_1}{\hat{i}_2} {\hat{i}_3}{\hat{i}_4}} {\cal O}^{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))} \, . \end{align} Thanks to the index-exchange symmetry (\ref{eq:riemann-like}), we are able to show \begin{equation} S_{{\hat{i}_1}{\hat{i}_2} {\hat{i}_3}{\hat{i}_4}} {\cal O}^{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))} = S_{(({\hat{i}_1}{\hat{i}_2}) ({\hat{i}_3}{\hat{i}_4}))} {\cal O}^{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))} \, , \end{equation} with \begin{align*} S_{((\hat{1} \hat{2}) (\hat{3} \hat{4}))} &:= \dfrac{1}{2} \left[ S_{(\hat{1} \hat{2}) (\hat{3} \hat{4})} +S_{(\hat{3} \hat{4}) (\hat{1} \hat{2}) } \right] \, , \\ S_{(\hat{1} \hat{2})(\hat{3}\hat{4})} &:= \dfrac{1}{4} \left[ S_{\hat{1} \hat{2} \hat{3} \hat{4}} +S_{\hat{2} \hat{1} \hat{3} \hat{4}} +S_{\hat{1} \hat{2} \hat{4} \hat{3}} +S_{\hat{2} \hat{1} \hat{4} \hat{3}} \right] \, , \end{align*} which, of course, satisfies the index-exchange symmetry \begin{align} S_{(({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}}))} = S_{(({\hat{2}}{\hat{1}})({\hat{3}}{\hat{4}}))} = S_{(({\hat{1}}{\hat{2}})({\hat{4}}{\hat{3}}))} = S_{(({\hat{3}}{\hat{4}})({\hat{1}}{\hat{2}}))} \, . \label{eq:symmetry-s} \end{align} Therefore the DOF of $S_{(({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}}))}$ is counted as \begin{align} \dfrac{1}{2} \left[ \dfrac{1}{2} N (N+1) \right] \, \left[ \dfrac{1}{2} N (N+1) + 1 \right] \, , \end{align} which is larger than the DOF of the operator ${\cal O}^{(({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}}))}$ as counted in Eq.\,(\ref{eq:DOF-O}). The $S_{(({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}}))}$ parametrization therefore contains redundancy. It is desired to describe the four-fermion interactions in a non-redundant parametrization. For such a purpose, we rewrite the four-fermion interactions as \begin{align} \lefteqn{ S_{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))} {\cal O}^{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))}} \nonumber\\ &= \dfrac{2}{3} \left[ S_{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))} - S_{(({\hat{i}_1}{\hat{i}_3})({\hat{i}_2}{\hat{i}_4}))} \right] {\cal O}^{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))} \, , \label{eq:rewrite} \end{align} where we used the Bianchi-like identity (\ref{eq:bianchi-like}) and the index-exchange symmetry (\ref{eq:symmetry-s}). We are now ready to introduce a non-redundant parametrization for holomorphic four-fermion interactions, \begin{align} R_{{\hat{1}}{\hat{4}}{\hat{2}}{\hat{3}}} := S_{({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}})} - S_{({\hat{1}}{\hat{3}})({\hat{2}}{\hat{4}})} \, . \label{eq:new-coeff} \end{align} which satisfies the index-exchange symmetries \begin{align} &R_{{\hat{1}}{\hat{2}}{\hat{3}}{\hat{4}}} + R_{{\hat{1}}{\hat{2}}{\hat{4}}{\hat{3}}} =0\, , \\ & R_{{\hat{1}}{\hat{2}}{\hat{3}}{\hat{4}}} + R_{{\hat{2}}{\hat{1}}{\hat{3}}{\hat{4}}} =0\, , \\ & R_{{\hat{1}}{\hat{2}}{\hat{3}}{\hat{4}}} - R_{{\hat{3}}{\hat{4}}{\hat{1}}{\hat{2}}} =0\, , \end{align} and the Bianchi identity \begin{align} R_{{\hat{1}}{\hat{2}}{\hat{3}}{\hat{4}}} +R_{{\hat{1}}{\hat{3}}{\hat{4}{\hat{2}}}} +R_{{\hat{1}}{\hat{4}}{\hat{2}}{\hat{3}}} = 0 \, . \end{align} The DOF of $R_{\hat{1}\hat{2}\hat{3}\hat{4}}$ is \begin{align} & \dfrac{1}{2} \left[ \dfrac{1}{2} N (N-1) \right] \, \left[ \dfrac{1}{2} N (N-1) + 1 \right] \nonumber\\ & -\dfrac{1}{4!} N(N-1)(N-2)(N-3) =\dfrac{1}{12} N^2(N^2-1) \, , \label{eq:DOF-A} \end{align} which coincides with the DOF of the operators ${\cal O}^{(({\hat{1}}{\hat{2}})({\hat{3}}{\hat{4}}))}$. The parametrization \begin{align} {\cal L}_{\mbox{\scriptsize four-fermion}} = \dfrac{1}{12} R_{{\hat{i}_1}{\hat{i}_4}{\hat{i}_2}{\hat{i}_3}} \,{\cal O}^{(({\hat{i}_1}{\hat{i}_2})({\hat{i}_3}{\hat{i}_4}))} \end{align} therefore describes the holomorphic four-fermion interactions in a non-redundant manner. \subsection{Non-holomorphic four-fermion sector} We next consider non-holomorphic four-fermion operators \begin{align} {\cal O}^{({\hat{i}_1}{\hat{i}_2})({\hat{i}}_3^* {\hat{i}}_4^*)} := (\psi_\alpha^{{\hat{i}}_1} \varepsilon^{\alpha\beta} \psi_\beta^{{\hat{i}}_2}) \, (\psi_{\dot{\alpha}}^{\dagger {\hat{i}}_3^*} \varepsilon^{\dot{\alpha}\dot{\beta}} \psi_{\dot{\beta}}^{\dagger {\hat{i}}_4^*}) \, . \end{align} Again, we put the indices in parentheses in order to emphaize the index-exhange symmetry \begin{align} {\cal O}^{({\hat{1}}{\hat{2}})({\hat{3}}^* {\hat{4}}^*)} = {\cal O}^{({\hat{1}}{\hat{2}})({\hat{4}}^* {\hat{3}}^*)} = {\cal O}^{({\hat{2}}{\hat{1}})({\hat{3}}^* {\hat{4}}^*)} \, , \label{eq:condition1} \end{align} with $\hat{i}_1$, $\hat{i}_2$, $\hat{i}_3^*$, $\hat{i}_4^*$ being abbreviated by $\hat{1}$, $\hat{2}$, $\hat{3}^*$, $\hat{4}^*$. The DOF of the four fermion operators satisfying the conditions (\ref{eq:condition1}) is \begin{align} \left[ \dfrac{1}{2} N (N+1) \right]^2 \, . \label{eq:dof-non-holomorphic} \end{align} Note \begin{align} [{\cal O}^{({\hat{1}}{\hat{2}})({\hat{3}}^* {\hat{4}}^*)}]^\dagger = {\cal O}^{({\hat{3}}{\hat{4}})({\hat{1}}^* {\hat{2}}^*)} \, . \label{eq:condition2} \end{align} The DOF as counted in (\ref{eq:dof-non-holomorphic}) is therefore regarded as the degrees of freedom counted in {\em real} parameters. This is in contrast to the DOF of holomorphic four-fermion operators (\ref{eq:DOF-O}) counted in {\em complex} parameters. Nonholomorphic four-fermion interactions in the lowest order GHEFT Lagrangian can be expressed as \begin{align} {\cal L} & \ni -\dfrac{1}{4} S_{{\hat{i}}_1 {\hat{i}}_2 {\hat{i}}_3^* {\hat{i}}_4^*} (\psi_\alpha^{{\hat{i}}_1} \varepsilon^{\alpha\beta} \psi_\beta^{{\hat{i}}_2}) \, (\psi_{\dot{\alpha}}^{\dagger {\hat{i}}_3^*} \varepsilon^{\dot{\alpha}\dot{\beta}} \psi_{\dot{\beta}}^{\dagger {\hat{i}}_4^*}) \nonumber\\ &= -\dfrac{1}{4} S_{{\hat{i}_1}{\hat{i}_2} {\hat{i}}_3^* {\hat{i}}_4^*} \, {\cal O}^{({\hat{i}_1}{\hat{i}_2})({\hat{i}}_3^* {\hat{i}}_4^*)} \, . \end{align} Thanks to the index-exchange symmetry (\ref{eq:condition1}), we are able to show \begin{align} S_{\hat{i}_1 \hat{i}_2 \hat{i}_3^* \hat{i}_4^*} {\cal O}^{(\hat{i}_1 \hat{i}_2) (\hat{i}_3^* \hat{i}_4^*)} = S_{(\hat{i}_1 \hat{i}_2) (\hat{i}_3^* \hat{i}_4^*)} {\cal O}^{(\hat{i}_1 \hat{i}_2) (\hat{i}_3^* \hat{i}_4^*)} \, , \end{align} with \begin{align*} S_{(\hat{1} \hat{2})(\hat{3}^*\hat{4}^*)} &:= \dfrac{1}{4} \left[ S_{\hat{1} \hat{2} \hat{3}^* \hat{4}^*} +S_{\hat{2} \hat{1} \hat{3}^* \hat{4}^*} +S_{\hat{1} \hat{2} \hat{4}^* \hat{3}^*} +S_{\hat{2} \hat{1} \hat{4}^* \hat{3}^*} \right] \, . \end{align*} It is easy to show \begin{align} S_{(\hat{1} \hat{2})(\hat{3}^*\hat{4}^*)} = S_{(\hat{2}\hat{1} )(\hat{3}^*\hat{4}^*)} = S_{(\hat{1} \hat{2})(\hat{4}^*\hat{3}^*)} \, . \end{align} Since the Hermiticity of the Lagrangian requires \begin{align} [S_{({\hat{1}}{\hat{2}})({\hat{3}}^* {\hat{4}}^*)}]^* = S_{({\hat{3}}{\hat{4}})({\hat{1}}^* {\hat{2}}^*)} \, , \end{align} we find the number of DOF of $S_{(\hat{1} \hat{2})(\hat{3}^*\hat{4}^*)}$ is $N^2 (N+1)^2/4$ {\em real} parameters, which agrees with the DOF of the nonholomorphic four-fermion operators (\ref{eq:dof-non-holomorphic}). Therefore, the non-holomorphic four-fermion interactions can be parametrized by using $S_{({\hat{1}}{\hat{2}})({\hat{3}}^* {\hat{4}}^*)}$ in a non-redundant manner. We finally remark that the nonholomorphic four fermion operators appear in the supersymmetric non-linear sigma model as \begin{equation} {\cal L} \ni \dfrac{1}{4} R_{\hat{i}_1 \hat{i}_3^* \hat{i}_2 \hat{i}_4^*} (\psi^{\hat{i}_1} \psi^{\hat{i}_2}) (\psi^{\dagger \hat{i}^*_3} \psi^{\dagger \hat{i}^*_4}) \,, \end{equation} where \begin{equation} R_{\hat{i}_1 \hat{i}_3^* \hat{i}_2 \hat{i}_4^*} = g_{\hat{i}_1 \hat{i}_3^* , \, \hat{i}_2 \hat{i}_4^*} -g^{\hat{i}' \hat{i}^{\prime *}} g_{\hat{i}' \hat{i}_3^*, \, \hat{i}_4^*} g_{\hat{i}_1 \hat{i}^{\prime *}, \, \hat{i}_2} \, , \end{equation} with $g_{\hat{i}\hat{j}^*}$ being the K\"{a}hler metric. We therefore define \begin{equation} R_{\hat{1}\hat{3}^* \hat{2} \hat{4}^*} := S_{(\hat{1}\hat{2})(\hat{3}^* \hat{4}^*)} \, , \label{eq:Rnonh} \end{equation} for the non-holomorphic four-fermion couplings even in non-supersymmetric GHEFT. \section{On-shell amplitudes} \label{sec:amplitude} The purpose of the GHEFT Lagrangian is to compute the production cross sections and the decay widths involving the new BSM particles. As we have shown in the previous section, the non-uniqueness of the parametrization in the effective Lagrangian associated with the KOS theorem~\cite{Kamefuchi:1961sb} can be resolved by using the normal coordinate. The scattering amplitudes can now be computed straightforwardly in the normal coordinate as functions of the covariant tensors. Applying the normal coordinate in the GHEFT, the on-shell amplitudes are expressed by covariant quantities on the coupling functions evaluated at the vacuum. In this section, we explicitly compute tree-level on-shell helicity amplitudes applying the normal coordinate in the lowest order GHEFT Lagrangian. In the computation of the on-shell amplitudes, we ignore the gauge boson contributions for simplicity. The computation on the on-shell amplitudes including spin-1 gauge bosons will be published elsewhere. The high-energy behavior of the longitudinally polarized gauge boson scattering amplitudes can be computed even in the gaugeless limit, thanks to equivalence theorem between the longitudinally polarized gauge boson scattering amplitudes and the corresponding would-be NG boson amplitudes~\cite{Cornwall:1974km,Chanowitz:1985hj,Gounaris:1986cr,He:1993yd,He:1993qa}. In what follows, we also study the high-energy behaviors of the on-shell amplitudes and discuss their implications. \subsection{Notation} We express an $N$-particle invariant amplitude generally as \begin{equation} {\cal A}_N(12\cdots N) \, . \end{equation} Generalized Mandelstam variables and particle masses are \begin{equation} s_{ij} := (p_i + p_j)^2 \, , \qquad m_i := \sqrt{p_i^2} \, . \end{equation} with the momentum of $i$-th particle $p_i$ is understood to be outgoing. For an example, the amplitude involving two-fermions and one-scalar is denoted as \begin{equation} \mathcal{A}_3(123) = \mathcal{A}_3 ( {\bf{{1}}}^{\lambda_{{1}}}, {\bf{{2}}}^{\lambda_{{2}}}, 3) \,, \label{eq:amplitude-in-bold} \end{equation} where ${\bf 1}^{\lambda_1}$, ${\bf 2}^{\lambda_2}$ denote the momentum, helicity and flavor quantum numbers for the on-shell fermions, and $3$ denotes the momentum and flavor quantum numbers for the on-shell bosons. $\lambda_i$ labels the helicity of the fermion state. If the fermion masses could be neglected in the amplitude, we were able to use the celebrated spinor-helicity formalism in the massless limit~\cite{Dixon:2013uaa}. The masses of heavy particles including BSM particles cannot be neglected, however, in the GHEFT framework. We therefore employ the Dreiner-Haber-Martin (DHM) notation~\cite{Dreiner:2008tw} for the two-component fermion wavefunctions in the amplitudes. The fermion wavefunction carrying three momentum $\vec{p}$ is expressed by two-component spinors, \begin{equation} x_\alpha (\vec{p},\lambda)\,,~~~~~ y_\alpha (\vec{p},\lambda)\,,~~~~~ \end{equation} with $x_\alpha (\vec{p},\lambda)$ and $y_\alpha (\vec{p},\lambda)$ being positive and negative frequency wavefunctions, respectively. $\lambda=\pm 1$ labels the little group representation index for the massive spin-1/2 fermion \cite{Arkani-Hamed:2017jhn}. The explicit forms of the spinor wavefunctions are summarized in appendix \ref{app:helicitystate}. For later convenience, we introduce square/angle bras and kets denoting massive spinor wavefunctions, \begin{align} ( \, [{\bf 1}^{\lambda_1} \, )^\alpha & := y^\alpha(\vec{p}_1, \lambda_1) \, , \label{eq:defmassivebraket1} \\ (\, {\bf 1}^{\lambda_1}] \, )_\alpha & := y_\alpha(\vec{p}_1, \lambda_1) \, , \label{eq:defmassivebraket2} \\ (\, \langle {\bf 1}^{\lambda_1} \, )_{\dot{\alpha}} &:= x^\dagger_{\dot{\alpha}} (\vec{p}_1 , \lambda_1) \, , \label{eq:defmassivebraket3} \\ (\, {\bf 1}^{\lambda_1} \rangle \, )^{\dot{\alpha}} &:= x^{\dagger{\dot{\alpha}}} (\vec{p}_1 , \lambda_1) \, , \label{eq:defmassivebraket4} \end{align} where \begin{eqnarray} && x^\alpha(\vec{p},\lambda) := \varepsilon^{\alpha\beta}\, x_\beta(\vec{p},\lambda) \,,\\ && y^\alpha(\vec{p},\lambda) := \varepsilon^{\alpha\beta}\, y_\beta(\vec{p},\lambda) \,,\\ && x^\dag_{\dot{\alpha}}(\vec{p},\lambda) := \varepsilon_{\dot{\alpha}\dot{\beta}}\, x^{\dag\dot{\beta}} (\vec{p},\lambda) \,,\\ && y^\dag_{\dot{\alpha}}(\vec{p},\lambda) := \varepsilon_{\dot{\alpha}\dot{\beta}}\, y^{\dag\dot{\beta}} (\vec{p},\lambda) \,. \end{eqnarray} Bracket notations for $x_\alpha$ and $y^\dagger_{\dot{\alpha}}$ do not need to be introduced, since the amplitudes can be expressed without using $x_\alpha$ and $y^\dagger_{\dot{\alpha}}$. The inner products among these spinor wavefunctions are expressed as \begin{eqnarray} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} &=& y^\alpha(\vec{p}_1,\lambda_1)\, y_\alpha(\vec{p}_2,\lambda_2) \,, \label{eq:defspb} \\ \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} &=& x^\dag_{\dot{\alpha}}(\vec{p}_1,\lambda_1)\, x^{\dag{\dot{\alpha}}}(\vec{p}_2,\lambda_2) \, , \label{eq:defspa} \end{eqnarray} In the massless limit, these brackets reduce to the massless angle/square brackets, \begin{align} \spa{\bf{1}^{\lambda_1}}.{\bf{2}^{\lambda_2}} & \to \left\{ \begin{array}{cc} \spa{1}.{2} & \mbox{ for } \lambda_1 = \lambda_2 = -1 \, , \\ 0 & \mbox{ otherwise} \end{array} \right. \label{eq:massless1} \\ \spb{\bf{1}^{\lambda_1}}.{\bf{2}^{\lambda_2}} & \to \left\{ \begin{array}{cc} \spb{1}.{2} & \mbox{ for } \lambda_1 = \lambda_2 = +1 \, , \\ 0 & \mbox{ otherwise} \end{array} \right. \label{eq:massless2} \end{align} Here the massless spinor wavefunctions are denoted by non-bold bras and kets $\langle 1$, $\langle 2$, $[ 1$, $[ 2$, $1 \rangle$, $2 \rangle$, $1]$, $2]$. See Ref.~\cite{Dixon:2013uaa} for the detail of the massless spinor formalism. Note that the index $\lambda=\pm 1$ in $\langle {\bf 1}^{\lambda}$ and $[ {\bf 1}^{\lambda}$ corresponds to the helicity of the outgoing state. Here we briefly summarize the properties of massless spinor wavefunctions. The massless spinor wavefunctions satisfy the exchange (anti)symmetries, \begin{align} & \spa{1}.{2} = -\spa{2}.{1} \, ,\nonumber\\ & \spb{1}.{2} = -\spb{2}.{1} \, , \nonumber\\ & \langle 1 \bar{\sigma}^\mu 2 ] = [2 \sigma^\mu 1 \rangle \, , \end{align} and the Fierz identity \begin{align} \langle 1 \bar{\sigma}^\mu 2 ] \, [3 \sigma^\mu 4 \rangle = 2 \spa{1}.{4} \spb{3}.{2} \, . \end{align} Eq.\,(\ref{eq:Schouten}) leads to the Schouten identities, \begin{align} & \spb{1}.{2} \spb{3}.{4} + \spb{1}.{3} \spb{4}.{2} + \spb{1}.{4} \spb{2}.{3} = 0\,,\\ & \spa{1}.{2} \spa{3}.{4} + \spa{1}.{3} \spa{4}.{2} + \spa{1}.{4} \spa{2}.{3} = 0\,. \end{align} The matrices $\sigma^\mu$ and $\bar{\sigma}^\mu$ can be decomposed into spinor products as \begin{equation} (\, p\, ])_\alpha \, (\langle \, p)_{\dot{\alpha}} = p_\mu \, ({\sigma}^\mu)_{\alpha\dot{\alpha}} \, , \quad (\, p \, \rangle )^{\dot{\alpha}} \, ([\, p)^{\alpha} = p_\mu \, (\bar{\sigma}^\mu)^{\dot{\alpha}\alpha} \, . \label{eq:massless-decomposition} \end{equation} The complex conjugates are given by \begin{align} (\spa{1}.{2})^* = \spb{2}.{1} \, , \qquad (\spb{1}.{2})^* = \spa{2}.{1} \, . \label{eq:spinor-conjugate} \end{align} Combining Eq.\,(\ref{eq:massless-decomposition}) and Eq.\,(\ref{eq:spinor-conjugate}), we are able to show \begin{align} |\spa{1}.{2}|^2 =|\spb{1}.{2}|^2 = 2 p_1 \cdot p_2 = (p_1+p_2)^2 \, . \end{align} Similarly, the massive spinor wavefunctions satisfy the exchange (anti)symmetries, \begin{align} & \spa{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}} = -\spa{{\bf 2}^{\lambda_2}}.{{\bf 1}^{\lambda_1}} \, ,\nonumber\\ & \spb{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}} = -\spb{{\bf 2}^{\lambda_2}}.{{\bf 1}^{\lambda_1}} \, , \nonumber\\ & \langle {\bf 1}^{\lambda_1} \bar{\sigma}^\mu {\bf 2}^{\lambda_2} ] = [{\bf 2}^{\lambda_2} \sigma^\mu {\bf 1}^{\lambda_1} \rangle \, , \end{align} and the Fierz identity \begin{align} \langle {\bf 1}^{\lambda_1} \bar{\sigma}^\mu {\bf 2}^{\lambda_2} ] \, [{\bf 3}^{\lambda_3} \sigma_\mu {\bf 4}^{\lambda_4} \rangle = 2 \spa{{\bf 1}^{\lambda_1}}.{{\bf 4}^{\lambda_4}} \spb{{\bf 3}^{\lambda_3}}.{{\bf 2}^{\lambda_2}} \, . \end{align} The Schouten identites among the massive spinor wavefunctions are \begin{align} & \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \spb{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \nonumber\\ &\qquad + \spb{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \spb{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ &\qquad \qquad + \spb{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \spb{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} = 0\,, \label{eq:bracket-schouten1} \\ & \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \spa{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \nonumber\\ &\qquad + \spa{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \spa{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ &\qquad \qquad + \spa{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \spa{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} = 0\,. \label{eq:bracket-schouten2} \end{align} The completeness relations are expressed as \begin{align} &\left( \sum_{\lambda=\pm 1} {\bf 1}^\lambda ] \, \lambda \, \langle {\bf 1}^{-\lambda} \right)_{\alpha\dot{\alpha}} = \left( p_{1\mu} \sigma^\mu \right)_{\alpha\dot{\alpha}} \, , \label{eq:completeness1} \\ &\left( \sum_{\lambda=\pm 1} {\bf 1}^\lambda ] \, \lambda \, [ {\bf 1}^{-\lambda} \right)_{\alpha}^{\, \, \, \, \beta} = m_1 \delta_\alpha^\beta \, , \label{eq:completeness2} \\[2ex] &\left( \sum_{\lambda=\pm 1} {\bf 1}^{-\lambda} \rangle \, \lambda \, [{\bf 1}^{\lambda} \right)^{\dot{\alpha}\alpha} = \left( p_{1\mu} \bar{\sigma}^\mu \right)^{\dot{\alpha} \alpha} \, , \label{eq:completeness3} \\ &\left( \sum_{\lambda=\pm 1} {\bf 1}^{-\lambda} \rangle \, \lambda \, \langle {\bf 1}^{\lambda} \right)^{\dot{\alpha}}_{\, \, \, \, \dot{\beta}} = m_1 \delta^{\dot{\alpha}}_{\dot{\beta}} \, . \label{eq:completeness4} \end{align} The complex conjugates are given by \begin{align} & (\spa{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}})^* = \spb{{\bf 2}^{-\lambda_2}}.{{\bf 1}^{-\lambda_1}} \, , \nonumber\\ & (\spb{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}})^* = \spa{{\bf 2}^{-\lambda_2}}.{{\bf 1}^{-\lambda_1}} \, . \end{align} The amplitude ${\cal A}_{n_s+n_f}$ depends on the coupling functions at the vacuum, {\it{e.g.}}, \begin{align} & {V}_{; (123)} \biggr|_0 \, , \quad {V}_{; (1234)} \biggr|_0 \, , \quad {R}_{1234} \biggr|_0 \, ,\quad \nonumber\\ & {R}_{1234; 5} \biggr|_0 \, , \quad {M}_{\hat{1}\hat{2}; 3} \biggr|_0 , \quad {R}_{\hat{1}\hat{2}34} \biggr|_0 , \quad \cdots \, . \end{align} Hereafter we omit the vertical bar symbols so that \begin{align} & {V}_{; (123)} \, , \quad {V}_{; (1234)} \, , \quad {R}_{1234} \, ,\nonumber\\ & {R}_{1234; 5} \, , \quad {M}_{\hat{1}\hat{2}; 3} , \quad {R}_{\hat{1}\hat{2}34} , \quad \cdots \, , \end{align} are understood to be evaluated at the vacuum. \subsection{Three scalars} \begin{figure} \centering \includegraphics[width=2cm,clip]{s1s2s3.pdf} \caption{Feynman diagram for $\mathcal{A}_3({{1}},{{2}},{{3}})$.} \label{fig:sss} \end{figure} We start with a three-point scalar amplitude $\mathcal{A}_3({{1}},{{2}},{{3}})$, which is given by the contact diagram shown in Fig.~\ref{fig:sss}. We have calculated the on-shell three-point scalar amplitude in Ref.~\cite{Nagai:2019tgi}. The amplitude is simply given by \begin{equation} i\mathcal{A}_3({{1}},{{2}},{{3}}) = -i{V}_{;(123)} \,. \label{eq:scalar-three-point-amplitude} \end{equation} As we have shown in Ref.~\cite{Nagai:2019tgi}, if we do not use the normal coordinate, we need to perform much involved computations to get the final expression of the amplitude (\ref{eq:scalar-three-point-amplitude}). \subsection{Two fermions and one scalar} \begin{figure} \centering \includegraphics[width=2cm,clip]{f1f2s3.pdf} \caption{Feynman diagram for $\mathcal{A}_3({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}})$. We assign the out-going momenta $p_1$, $p_2$ and $p_3$ to $\psi^{{\hat{1}}}$, $\psi^{{\hat{2}}}$, and $\phi^3$. } \label{fig:ffs} \end{figure} We next consider a three-point amplitude with two fermions and one scalar, $\mathcal{A}_3({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}})$. The amplitude is given by the diagram shown in Fig.~\ref{fig:ffs}, where the three-point vertex is read from the normal coordinate formula (\ref{eq:M-exp}). The on-shell amplitude is given as \begin{equation} i\mathcal{A}_3({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}}) = -i{M}_{{\hat{1}}{\hat{2}};3} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} - i{M}_{{\hat{1}}^*{\hat{2}}^*;3} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \, . \label{eq:two-fermions-one-scalar-amplitude} \end{equation} We have confirmed the formula (\ref{eq:two-fermions-one-scalar-amplitude}) without using the normal coordinate technique. Once we specify the kinematics and helicities of the external states, we can explicitly estimate the spinor inner products in terms of the kinematical variables. See appendix \ref{app:helicitystate} for the explicit expressions. For an example, we consider the decay process of the scalar $3$ into the fermion pair ${\bf 1}$ and ${\bf 2}$, \begin{equation} \phi^3(-p_3)\to \psi^{{\hat{1}}}(p_1)\,\psi^{{\hat{2}}}(p_2) \,. \end{equation} Initial state momentum is assigned to be $-p_3$ in our notation of the amplitude. We evaluate the decay amplitudes in the rest frame of $\phi^3$. Note that the final state angular momentum should vanish in this process, since the interaction vertex does not contain derivatives. The conservation of the total angular momentum implies that the final state spin momentum should also be zero. We therefore expect \begin{equation} \mathcal{A}_3({\bf{1}}^{\pm},{\bf{2}}^{\mp},{{3}}) = 0 \, , \end{equation} which actually is confirmed in our explicit computation, since $\spb{{\bf{1}}^\pm}.{{\bf{2}}^\mp}=\spa{{\bf{1}}^\pm}.{{\bf{2}}^\mp}=0$ in the center-of-mass frame as we show in Appendix~\ref{app:helicitystate}. On the other hand, $\mathcal{A}_3({\bf{1}}^{\pm},{\bf{2}}^{\pm},{{3}})$ can be non-zero. The masses of fermions and scalar are denoted by $m_{{1}}$, $m_{{2}}$ and $m_{3}$, respectively. For $m_3 \gg m_1 , m_2$, we find \begin{align} &\spb{{\bf 1}^+}.{{\bf 2}^+} \simeq \spb{1}.{2} = - m_3 \, , \qquad \spb{{\bf 1}^-}.{{\bf 2}^-} \simeq 0 \, , \\ &\spa{{\bf 1}^-}.{{\bf 2}^-} \simeq \spa{1}.{2} = + m_3 \, , \qquad \spa{{\bf 1}^+}.{{\bf 2}^+} \simeq 0 \, , \end{align} and thus \begin{align} \mathcal{A}_3({\bf{1}}^{+},{\bf{2}}^{+},{{3}}) & \simeq m_3\,{M}_{{\hat{1}}{\hat{2}};3} \,,\nonumber\\ \mathcal{A}_3({\bf{1}}^{-},{\bf{2}}^{-},{{3}}) & \simeq -m_3\,{M}_{{\hat{1}}^*{\hat{2}}^*;3} \, , \end{align} where we ignore $\mathcal{O}(m^2_{{1}}/m^2_3, m^2_{{2}}/m^2_3)$ corrections. \subsection{Four scalars} \begin{figure} \centering \includegraphics[width=8.5cm,clip]{s1s2s3s4.pdf} \caption{Feynman diagram for $\mathcal{A}_4({{1}},{{2}},{{3}},{{4}})$. We assign the out-going momenta $p_1$, $p_2$, $p_3$ and $p_4$ to $\phi^1$, $\phi^2$, $\phi^3$ and $\phi^4$. } \label{fig:ssss} \end{figure} We next consider a four-point scalar amplitude $\mathcal{A}_4({{1}},{{2}},{{3}},{{4}})$. The amplitude is given by the sum of the contact diagram and the scalar-exchange diagrams as shown in Fig. \ref{fig:ssss}; \begin{align} \mathcal{A}_4({{1}},{{2}},{{3}},{{4}}) &= \mathcal{A}^{(c)}_4({{1}},{{2}},{{3}},{{4}}) \nonumber\\ &+ \mathcal{A}^{(\phi)}_4({{1}},{{2}},{{3}},{{4}}) \,. \end{align} We have estimated the four-point amplitudes in Ref.~\cite{Nagai:2019tgi}. The results are \begin{eqnarray} i\mathcal{A}^{(c)}_4({{1}},{{2}},{{3}},{{4}}) = &-& \frac{2i}{3} {R}_{1(34)2} s_{12} - \frac{2i}{3} {R}_{1(24)3} s_{13} \nonumber\\ &-& \frac{2i}{3} {R}_{1(23)4} s_{14} -{V}_{;(1234)} \,, \label{eq:ssss1} \end{eqnarray} and \begin{align} i\mathcal{A}^{(\phi)}_4({{1}},{{2}},{{3}},{{4}}) = &- \sum_{i,j} {V}_{;(12i)}\,[D(s_{12})]^{ij}\,{V}_{;(34j)} \nonumber\\ &- \sum_{i,j} {V}_{;(13i)}\,[D(s_{13})]^{ij}\,{V}_{;(24j)} \nonumber\\ &- \sum_{i,j} {V}_{;(14i)}\,[D(s_{14})]^{ij}\,{V}_{;(23j)} \, , \label{eq:ssss2} \end{align} where $[D(s)]^{ij}$ denotes the scalar propagator, \begin{equation} [D(s)]^{ij} := \frac{i}{s-m^2_{i}}\,{g}^{ij} \,. \label{eq:scalarprop} \end{equation} with $m_i$ being the scalar mass. The scalar four-point amplitude diverges in the high energy limit, $s=s_{12}\gg m_1^2$, $m_2^2$, $m_3^2$, $m_4^2$. For an example, we consider \begin{equation} \phi^1(-p_1)\,\phi^2(-p_2)\,\to\phi^3(p_3)\,\phi^4(p_4) \, . \end{equation} In the high-energy limit, the corresponding scattering amplitude behaves as \begin{equation} \mathcal{A}_4({{1}},{{2}},{{3}},{{4}}) \simeq {R}_{1423}\,s +\frac{1}{2}{R}_{1234}\,s\,(1+\cos\theta) \,, \label{eq:ssss} \end{equation} with $\theta$ being the scattering angle in the center of mass. This result implies that, with ${R}_{1423} \ne 0$ or ${R}_{1234} \ne 0$, the perturbative unitarity is violated in the high energy scattering amplitude among the scalar bosons. This observation indicates that the longitudinally polarized gauge boson scattering amplitudes violates the perturbative unitarity if the scalar manifold is curved~\cite{Alonso:2015fsp,Alonso:2016oah,Nagai:2019tgi}. The Lee-Quigg-Thacker sum rules~\cite{Lee:1977yc,Lee:1977eg} for the perturbative unitarity in the $W_L W_L \to W_L W_L$ amplitude can thus be regarded as conditions on the scalar curvature tensor $R_{\pi\pi\pi\pi}=0$. \subsection{Two fermions and two scalars} \begin{figure} \centering \includegraphics[width=8.5cm,clip]{f1f2s3s4.pdf} \caption{Feynman diagram for $\mathcal{A}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}})$. We assign the out-going momenta $p_1$, $p_2$, $p_3$ and $p_4$ to $\psi^{{\hat{1}}}$, $\psi^{{\hat{2}}}$, $\phi^3$ and $\phi^4$. } \label{fig:ffss} \end{figure} We next consider a four-point amplitude with two fermions and two scalars, $\mathcal{A}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}})$. As shown in Fig.~\ref{fig:ffss}, the amplitude consists of contact, scalar-exchange, and fermion-exchange diagrams, \begin{align} \mathcal{A}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) &= \mathcal{A}^{(c)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) \nonumber\\ &+ \mathcal{A}^{(\phi)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) \nonumber\\ &+\mathcal{A}^{(\psi)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) \,. \end{align} We first focus on the contact diagram $\mathcal{A}^{(c)}_4$, which appears from the vertices, $R_{\hat{i}\hat{j}^* kl}$, $M_{\hat{i}\hat{j}; \, (kl)}$ and $M_{\hat{i}^*\hat{j}^*; \, (kl)}$ in the normal coordinate. We find \begin{align} \lefteqn{ i\mathcal{A}^{(c)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}})}\nonumber\\ &= - \frac{i}{2}{R}_{{\hat{2}}{\hat{1}}^*34} (p_3-p_4)_\mu\, x^\dag_{\dot{\alpha}}(\vec{p}_1,\lambda_1)\, (\bar{\sigma}^\mu)^{\dot{\alpha}\beta}\, y_\beta(\vec{p}_2,\lambda_2) \nonumber\\ & \quad - \frac{i}{2}{R}_{{\hat{2}}^*{\hat{1}}34} (p_3-p_4)_\mu\, y^{\alpha}(\vec{p}_1,\lambda_1)\, ({\sigma}^\mu)_{\alpha\dot{\beta}}\, x^{\dag\dot{\beta}}(\vec{p}_2,\lambda_2) \nonumber\\ & \quad - i{M}_{{\hat{1}}^*{\hat{2}}^*;(34)} x^\dag_{\dot{\alpha}}(\vec{p}_1,\lambda_1)\, x^{\dag{\dot{\alpha}}}(\vec{p}_2,\lambda_2) \nonumber\\ & \quad - i{M}_{{\hat{1}}{\hat{2}};(34)} y^\alpha(\vec{p}_1,\lambda_1)\, y_\alpha(\vec{p}_2,\lambda_2) \, . \end{align} Rewriting the amplitude in terms of the angle/square spinors (\ref{eq:defmassivebraket1})-(\ref{eq:defmassivebraket4}), the spinor wavefunction structure becomes clearer \begin{align} \lefteqn{ i\mathcal{A}^{(c)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}})}\nonumber\\ &= - \frac{i}{2}{R}_{{\hat{2}}{\hat{1}}^*34} \left( \sum_{\lambda_3} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{-\lambda_3}} \lambda_3 \spb{{\bf{3}}^{\lambda_3}}.{{\bf{2}}^{\lambda_2}} \right.\nonumber\\ &\qquad \qquad \qquad \left. -\sum_{\lambda_4} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{-\lambda_4}} \lambda_4 \spb{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \right) \nonumber\\ &\quad - \frac{i}{2}{R}_{{\hat{2}}^*{\hat{1}}34} \left( \sum_{\lambda_3} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \lambda_3 \spa{{\bf{3}}^{-\lambda_3}}.{{\bf{2}}^{\lambda_2}} \right.\nonumber\\ &\qquad \qquad \qquad \left. -\sum_{\lambda_4} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \lambda_4 \spa{{\bf{4}}^{-\lambda_4}}.{{\bf{2}}^{\lambda_2}} \right) \nonumber\\ &\quad - i{M}_{{\hat{1}}^*{\hat{2}}^*;(34)} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} - i{M}_{{\hat{1}}{\hat{2}};(34)} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \, , \label{eq:four-point-2f2b-contact} \end{align} where we decomposed $(p_{3} -p_4)_\mu \bar{\sigma}^\mu$ and $(p_{3} -p_4)_\mu {\sigma}^\mu$ into products of massive spinor wavefunctions using Eqs.\,(\ref{eq:completeness1})-(\ref{eq:completeness4}). The computation of the scalar-exchange amplitude is easy. It is given by \begin{align} \lefteqn{i\mathcal{A}^{(\phi)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}})}\nonumber\\ = &- \sum_{i,j} {V}_{;(34i)}\,[D(s_{12})]^{ij}\, \biggl( {M}_{12;j} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ & \qquad \qquad \qquad \qquad \qquad + {M}_{1^*2^*;j} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \biggr) \, , \end{align} where $[D(s)]^{ij}$ is defined in Eq.\,(\ref{eq:scalarprop}). On the other hand, the computation of the fermion exchange amplitude $\mathcal{A}^{(\psi)}_4$ \begin{align} i\mathcal{A}^{(\psi)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) &= i \mathcal{A}^{[ \, ]}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) \nonumber\\ & \quad +i \mathcal{A}^{\langle \, \rangle}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) \nonumber\\ & \quad +i \mathcal{A}^{[ \, \rangle}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) \nonumber\\ & \quad +i \mathcal{A}^{\langle \, ]}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) \label{eq:scalar-exchange-amp1} \end{align} is a bit involved. Here we organized the amplitude in accord with the spinor structure, {\it{i.e.}}, \begin{align} \lefteqn{\mathcal{A}^{[\, ]}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) }\nonumber\\ &= \sum_{\hat{i}, \hat{j}} M_{\hat{1}\hat{i}; \, 3} \, [{\bf 1}^{\lambda_1} \, D^{\hat{i}\hat{j}}_{][}(p_{13}) \, {\bf 2}^{\lambda_2} ] \, M_{\hat{j} \hat{2}; \, 4} \nonumber\\ &\quad +\sum_{\hat{i}, \hat{j}} M_{\hat{1}\hat{i}; \, 4} \, [{\bf 1}^{\lambda_1} \, D^{\hat{i}\hat{j}}_{][}(p_{14}) \, {\bf 2}^{\lambda_2} ] \, M_{\hat{j} \hat{2}; \, 3} \, , \label{eq:scalar-exchange-amp2} \\ \lefteqn{ \mathcal{A}^{\langle \, \rangle}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) }\nonumber\\ &= \sum_{\hat{i}^*, \hat{j}^*} M_{\hat{1}^*\hat{i}^*; \, 3} \, \langle {\bf 1}^{\lambda_1} \, D^{\hat{i}^*\hat{j}^*}_{\rangle\langle}(p_{13}) \, {\bf 2}^{\lambda_2} \rangle M_{\hat{j}^*\hat{2}^*; \, 4} \nonumber\\ &\quad +\sum_{\hat{i}^*, \hat{j}^*} M_{\hat{1}^*\hat{i}^*; \, 4} \, \langle {\bf 1}^{\lambda_1} \, D^{\hat{i}^*\hat{j}^*}_{\rangle\langle}(p_{14}) \, {\bf 2}^{\lambda_2} \rangle M_{\hat{j}^*\hat{2}^*; \, 3} \, , \label{eq:scalar-exchange-amp3} \end{align} \begin{align} \lefteqn{ \mathcal{A}^{[ \, \rangle}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) }\nonumber\\ &= \sum_{\hat{i}, \hat{j}^*} M_{\hat{1}\hat{i}; \, 3} \, [{\bf 1}^{\lambda_1} \, D^{\hat{i}\hat{j}^*}_{]\langle}(p_{13}) \, {\bf 2}^{\lambda_2} \rangle \, M_{\hat{j}^*\hat{2}^*; \, 4} \nonumber\\ &\quad +\sum_{\hat{i}, \hat{j}^*} M_{\hat{1}\hat{i}; \, 4} \, [{\bf 1}^{\lambda_1} \, D^{\hat{i}\hat{j}^*}_{]\langle}(p_{14}) \, {\bf 2}^{\lambda_2} \rangle \, M_{\hat{j}^*\hat{2}^*; \, 3} \, , \label{eq:scalar-exchange-amp4} \\ \lefteqn{ \mathcal{A}^{\langle \, ]}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) }\nonumber\\ &=\sum_{\hat{i}^*, \hat{j}} M_{\hat{1}^*\hat{i}^*; \, 3} \langle {\bf 1}^{\lambda_1} \, D^{\hat{i}^*\hat{j}}_{\rangle[}(p_{13}) \, {\bf 2}^{\lambda_2} ] \, M_{\hat{j}\hat{2}; \, 4} \nonumber\\ &\quad +\sum_{\hat{i}^*, \hat{j}} M_{\hat{1}^*\hat{i}^*; \, 4} \langle {\bf 1}^{\lambda_1} \, D^{\hat{i}^*\hat{j}}_{\rangle[}(p_{14}) \, {\bf 2}^{\lambda_2} ] \, M_{\hat{j}\hat{2}; \, 3} \, . \label{eq:scalar-exchange-amp5} \end{align} with \begin{align} p_{13} := p_1 + p_3 \, , \qquad p_{14} := p_1 + p_4 \, . \end{align} In the expressions above, the internal fermion propagators are \begin{align} (\, D_{][}^{\hat{i}\hat{j}}(p) \, )_{\alpha}{}^{\beta} &:= \dfrac{i m_{\hat{i}}}{p^2-m_{\hat{i}}^2} \delta^{\hat{i}\hat{j}} \, \delta_\alpha^\beta \, , \\ (\, D_{\rangle\langle}^{\hat{i}^*\hat{j}^*}(p) \, )^{\dot{\alpha}}{}_{\dot{\beta}} &:= \dfrac{i m_{\hat{i}^*}}{p^2-m_{\hat{i}^*}^2} \delta^{\hat{i}^*\hat{j}^*} \, \delta^{\dot{\alpha}}_{\dot{\beta}} \, , \\ (\, D_{]\langle}^{\hat{i}\hat{j}^*}(p) \, )_{\alpha\dot{\beta}} &:= \dfrac{i}{p^2-m_{\hat{i}}^2} \delta^{\hat{i}\hat{j}^*} (\, p] \, )_{\alpha} \, (\, \langle p \, )_{\dot{\beta}} \, , \\ (\, D_{\rangle[}^{\hat{i}^*\hat{j}}(p) \, )^{\dot{\alpha}\beta} &:= \dfrac{i}{p^2-m_{\hat{i}^*}^2} \delta^{\hat{i}^*\hat{j}} (\, p\rangle \, )^{\dot{\alpha}} \, (\, [p \, )^\beta \, . \end{align} The amplitudes (\ref{eq:scalar-exchange-amp2}) and (\ref{eq:scalar-exchange-amp3}) are computed by using \begin{align} [{\bf 1}^{\lambda_1} \, D^{\hat{i}\hat{j}}_{][}(p_{13}) \, {\bf 2}^{\lambda_2} ] &= ( \, \hat{D}(s_{13}) \, )^{\hat{i}\hat{j}} m_{\hat{i}} \spb{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}} \, , \\ \langle{\bf 1}^{\lambda_1} \, D^{\hat{i}^*\hat{j}^*}_{\rangle\langle}(p_{13}) \, {\bf 2}^{\lambda_2} \rangle &= ( \, \hat{D}(s_{13}) \, )^{\hat{i}^*\hat{j}^*} m_{\hat{i}^*} \spa{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}} \, , \end{align} with \begin{equation} ( \, \hat{D}(s) \, )^{\hat{i}\hat{j}} := \dfrac{i}{s-m_{\hat{i}}^2} \delta^{\hat{i}\hat{j}} \, , \quad ( \, \hat{D}(s) \, )^{\hat{i}^*\hat{j}^*} := \dfrac{i}{s-m_{\hat{i}^*}^2} \delta^{\hat{i}^*\hat{j}^*} \, . \end{equation} In the computation of the amplitudes (\ref{eq:scalar-exchange-amp4}) and (\ref{eq:scalar-exchange-amp5}), we use identities on the spinor wavefunctions, \begin{align} \lefteqn{ [ {\bf 1}^{\lambda_1} \, D^{\hat{i}\hat{j}^*}_{]\langle}(p_{13}) \, {\bf 2}^{\lambda_2} \rangle }\nonumber\\ &= \dfrac{1}{2} ( \, \hat{D}(s_{13}^2) \, )^{\hat{i}\hat{j}^*} \biggl( m_1 \, \spa{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}} + m_2 \, \spb{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}} \nonumber\\ & \qquad +\sum_{\lambda_3= \pm 1} \spb{{\bf 1}^{\lambda_1}}.{{\bf 3}^{\lambda_3}} \, \lambda_3 \, \spa{{\bf 3}^{-\lambda_3}}.{{\bf 2}^{\lambda_2}} \nonumber\\ & \qquad -\sum_{\lambda_4=\pm 1} \spb{{\bf 1}^{\lambda_1}}.{{\bf 4}^{\lambda_4}} \, \lambda_4 \, \spa{{\bf 4}^{-\lambda_4}}.{{\bf 2}^{\lambda_2}} \biggr) \, , \\ \lefteqn{ \langle {\bf 1}^{\lambda_1} \, D^{\hat{i}^*\hat{j}}_{\rangle[}(p_{13}) \, {\bf 2}^{\lambda_2} ] }\nonumber\\ &= \dfrac{1}{2} ( \, \hat{D}(s_{13}^2) \, )^{\hat{i}^*\hat{j}} \biggl( m_1 \, \spb{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}} + m_2 \, \spa{{\bf 1}^{\lambda_1}}.{{\bf 2}^{\lambda_2}} \nonumber\\ & \qquad +\sum_{\lambda_3=\pm 1} \spa{{\bf 1}^{\lambda_1}}.{{\bf 3}^{-\lambda_3}} \, \lambda_3 \, \spb{{\bf 3}^{\lambda_3}}.{{\bf 2}^{\lambda_2}} \nonumber\\ & \qquad -\sum_{\lambda_4=\pm 1} \spa{{\bf 1}^{\lambda_1}}.{{\bf 4}^{-\lambda_4}} \, \lambda_4 \, \spb{{\bf 4}^{\lambda_4}}.{{\bf 2}^{\lambda_2}} \biggr) \, , \end{align} with \begin{equation} ( \, \hat{D}(s) \, )^{\hat{i}\hat{j}^*} := \dfrac{i}{s-m_{\hat{i}}^2} \delta^{\hat{i}\hat{j}^*} \, , \quad ( \, \hat{D}(s) \, )^{\hat{i}^*\hat{j}} := \dfrac{i}{s-m_{\hat{i}^*}^2} \delta^{\hat{i}^*\hat{j}} \, . \end{equation} These identities are derived from \begin{align} p_{13} &= \dfrac{1}{2} ( p_1 - p_2 + p_3 - p_4 ) \, , \nonumber\\ p_{14} &= \dfrac{1}{2} ( p_1 - p_2 - p_3 + p_4 ) \, , \end{align} and \begin{align} &[ {\bf 1}^{\lambda_1} \, (p_{1\mu} \sigma^\mu) = m_1 \langle {\bf 1}^{\lambda_1} \, , &( p_{2\mu} \bar{\sigma}^\mu) \, {\bf 2}^{\lambda_2} ] = - {\bf 2}^{\lambda_2} \rangle m_2 \, , \\ &\langle {\bf 1}^{\lambda_1} \, (p_{1\mu} \bar{\sigma}^\mu) = m_1 [ {\bf 1}^{\lambda_1} \, &( p_{2\mu} \sigma^\mu) \, {\bf 2}^{\lambda_2} \rangle = - {\bf 2}^{\lambda_2} ] m_2 \, . \end{align} We are now ready to compute the fermion-exchange amplitude (\ref{eq:scalar-exchange-amp1}). Combining the above formulas, we obtain \begin{align} \lefteqn{ i\mathcal{A}^{(\psi)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{{3}},{{4}}) } \nonumber\\ &= i\mathcal{A}^{(\psi,yx)}_4 \left( \sum_{\lambda_3=\pm 1} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \, \lambda_3 \, \spa{{\bf{3}}^{-\lambda_3}}.{{\bf{2}}^{\lambda_2}} \right.\nonumber\\ &\qquad \qquad \qquad \left. -\sum_{\lambda_4=\pm 1} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \, \lambda_4 \, \spa{{\bf{4}}^{-\lambda_4}}.{{\bf{2}}^{\lambda_2}} \right) \nonumber\\ & \quad + i\mathcal{A}^{(\psi,xy)}_4 \left( \sum_{\lambda_3=\pm 1} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{-\lambda_3}} \, \lambda_3 \, \spb{{\bf{3}}^{\lambda_3}}.{{\bf{2}}^{\lambda_2}} \right.\nonumber\\ &\qquad \qquad \qquad \left. - \sum_{\lambda_4=\pm 1} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{-\lambda_4}} \, \lambda_4 \, \spb{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \right) \nonumber\\ & \quad + i\mathcal{A}^{(\psi,yy)}_4 \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} + i\mathcal{A}^{(\psi,xx)}_4 \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \, , \end{align} with \begin{align} i\mathcal{A}^{(\psi,yx)}_4 &= -\frac{1}{2} \sum_{\hat{i}, \hat{j}^*} \left( {M}_{{\hat{i}}{\hat{1}};3}\,[\hat{D}(s_{13})]^{{\hat{i}}{\hat{j}}^*}\,{M}_{{\hat{j}}^*{\hat{2}}^*;4} \right.\nonumber\\ &\qquad \qquad \left. + {M}_{{\hat{i}}{\hat{1}};4}\,[\hat{D}(s_{14})]^{{\hat{i}}{\hat{j}}^*}\,{M}_{{\hat{j}}^*{\hat{2}}^*;3} \right)\,,\\ i\mathcal{A}^{(\psi,xy)}_4 &= -\frac{1}{2} \sum_{\hat{i}, \hat{j}^*} \left( {M}_{{\hat{j}}^*{\hat{1}}^*;3}\,[\hat{D}(s_{13})]^{{\hat{j}}^*{\hat{i}}}\,{M}_{{\hat{i}}{\hat{2}};4} \right.\nonumber\\ &\qquad \qquad \left. + {M}_{{\hat{j}}^*{\hat{1}}^*;4}\,[\hat{D}(s_{14})]^{{\hat{j}}^*{\hat{i}}}\,{M}_{{\hat{i}}{\hat{2}};3} \right)\,, \end{align} and \begin{align} i\mathcal{A}^{(\psi,yy)}_4 &= -\frac{1}{2} m_1 \sum_{\hat{i}^*, \hat{j}} \left( {M}_{{\hat{i}}^*{\hat{1}}^*;3}\,[\hat{D}(s_{13})]^{{\hat{i}}^*{\hat{j}}}\,{M}_{{\hat{j}}{\hat{2}};4} \right.\nonumber\\ &\qquad \qquad \left. + {M}_{{\hat{i}}^*{\hat{1}}^*;4}\,[\hat{D}(s_{14})]^{{\hat{i}}^*{\hat{j}}}\,{M}_{{\hat{j}}{\hat{2}};3} \right) \nonumber\\ & \quad - \frac{1}{2} m_2 \sum_{\hat{i} , \hat{j}^*} \left( {M}_{{\hat{i}}{\hat{1}};3}\,[\hat{D}(s_{13})]^{{\hat{i}}{\hat{j}}^*}\,{M}_{{\hat{j}}^*{\hat{2}}^*;4} \right.\nonumber\\ &\qquad \qquad \left. + {M}_{{\hat{i}}{\hat{1}};4}\,[\hat{D}(s_{14})]^{{\hat{i}}{\hat{j}}^*}\,{M}_{{\hat{j}}^*{\hat{2}}^*;3} \right) \nonumber\\ & \quad - \sum_{\hat{i}, \hat{j}} m_{\hat{i}} \left( {M}_{{\hat{i}}{\hat{1}};3} [\hat{D}(s_{13})]^{\hat{i}\hat{j}} \, {M}_{{\hat{j}}{\hat{2}};4} \right.\nonumber\\ &\qquad \qquad \left. + {M}_{{\hat{i}}{\hat{1}};4}\, [\hat{D}(s_{14})]^{\hat{i}\hat{j}} \, \,{M}_{{\hat{j}}{\hat{2}};3} \right) \,, \label{eq:ffssf1} \\ i\mathcal{A}^{(\psi,xx)}_4 &= -\frac{1}{2} m_1 \sum_{\hat{i}, \hat{j}^*} \left( {M}_{{\hat{i}}{\hat{1}};3}\,[\hat{D}(s_{13})]^{{\hat{i}}{\hat{j}}^*} \,{M}_{{\hat{j}}^*{\hat{2}}^*;4} \right.\nonumber\\ &\qquad \qquad \left. + {M}_{{\hat{i}}{\hat{1}};4}\,[\hat{D}(s_{14})]^{{\hat{i}}{\hat{j}}^*}\, {M}_{{\hat{j}}^*{\hat{2}}^*;3} \right) \nonumber\\ & \quad - \frac{1}{2} m_2 \sum_{\hat{i}^* , \hat{j}} \left( {M}_{{\hat{i}}^*{\hat{1}}^*;3}\,[\hat{D}(s_{13})]^{{\hat{i}}^*{\hat{j}}}\, {M}_{{\hat{j}}{\hat{2}};4} \right.\nonumber\\ &\qquad \qquad \left. + {M}_{{\hat{i}}^*{\hat{1}}^*;4}\,[\hat{D}(s_{14})]^{{\hat{i}}^*{\hat{j}}}\, {M}_{{\hat{j}}{\hat{2}};3} \right) \nonumber\\ & \quad - \sum_{\hat{i}^*, \hat{j}^*} m_{\hat{i}^*} \left( {M}_{{\hat{i}}^*{\hat{1}}^*;3} [\hat{D}(s_{13})]^{\hat{i}^*\hat{j}^*} \, {M}_{{\hat{j}}^*{\hat{2}}^*;4} \right.\nonumber\\ &\qquad \qquad \left. + {M}_{{\hat{i}}^*{\hat{1}}^*;4}\, [\hat{D}(s_{14})]^{\hat{i}^*\hat{j}^*} \, \,{M}_{{\hat{j}}^*{\hat{2}}^*;3} \right)\, . \label{eq:ffssf2} \end{align} We evaluate the scattering amplitude \begin{align} \phi^3(-p_3) \phi^4(-p_4) \to \psi^{\hat{1}}(p_1) \psi^{\hat{2}}(p_2) \end{align} in the center-of-mass frame, which implies \begin{align} &\spb{{\bf 1}^+}.{{\bf 2}^-} = 0 \, , \qquad \spb{{\bf 1}^-}.{{\bf 2}^+} = 0 \, , \\ &\spa{{\bf 1}^+}.{{\bf 2}^-} = 0 \, , \qquad \spa{{\bf 1}^-}.{{\bf 2}^+} = 0 \, . \end{align} The contact amplitudes (\ref{eq:four-point-2f2b-contact}) dominate in the computation for the high-energy limit $s=s_{12} \gg m_1^2, m_2^2, m_3^2, m_4^2$. We find \begin{align} &\spb{{\bf 1}^+}.{{\bf 2}^+} \simeq \spb{1}.{2} = - \sqrt{s} \, , \qquad \spb{{\bf 1}^-}.{{\bf 2}^-} \simeq 0 \, , \\ &\spa{{\bf 1}^-}.{{\bf 2}^-} \simeq \spa{1}.{2} = + \sqrt{s} \, , \qquad \spa{{\bf 1}^+}.{{\bf 2}^+} \simeq 0 \, , \end{align} and \begin{align} \sum_{\lambda_3} \spa{{\bf 1}^-}.{{\bf 3}^{-\lambda_3}} \, \lambda_3 \, \spb{{\bf 3}^{\lambda_3}}.{{\bf 2}^+} &\simeq \spa{1}.{3} \, \spb{3}.{2} \nonumber\\ & = -\spa{1}.{3} \, \spb{2}.{3} \nonumber\\ & = \sqrt{s_{13} \, s_{23}} \, , \\ \sum_{\lambda_4} \spa{{\bf 1}^-}.{{\bf 4}^{-\lambda_4}} \, \lambda_4 \, \spb{{\bf 4}^{\lambda_3}}.{{\bf 2}^+} &\simeq \spa{1}.{4} \, \spb{4}.{2} \nonumber\\ & =-\sqrt{s_{14} \, s_{42}} \, , \end{align} \begin{align} & \sum_{\lambda_3} \spa{{\bf 1}^+}.{{\bf 3}^{-\lambda_3}} \, \lambda_3 \, \spb{{\bf 3}^{\lambda_3}}.{{\bf 2}^+} -\sum_{\lambda_4} \spa{{\bf 1}^+}.{{\bf 4}^{-\lambda_4}} \, \lambda_4 \, \spb{{\bf 4}^{\lambda_4}}.{{\bf 2}^+} \nonumber\\ & \simeq -\,m_1 \dfrac{s_{13} - s_{14} }{\sqrt{s_{12}}} \, . \end{align} We obtain \begin{align} \mathcal{A}_4({\bf{1}}^{+},{\bf{2}}^{+},{{3}},{{4}}) &\simeq \sqrt{s}\, \biggl( {M}_{{\hat{1}}{\hat{2}};(34)} \nonumber\\ & \hspace{-0.5cm} -\frac{1}{2}( m_{2}{R}_{{\hat{1}}{\hat{2}}^*34} + m_{1}{R}_{{\hat{1}}^*{\hat{2}}34}) \cos\theta \biggr) \,, \\ \mathcal{A}_4({\bf{1}}^{+},{\bf{2}}^{-},{{3}},{{4}}) &\simeq \frac{1}{2}{R}_{{\hat{1}}{\hat{2}}^*34}\, s\,\sin\theta \,, \end{align} with $\theta$ being the scattering angle in the center-of-mass frame, \begin{align} \sin\theta \simeq 2 \dfrac{\sqrt{s_{13} s_{14}}}{s_{12}} \, , \qquad \cos\theta \simeq \dfrac{s_{13}-s_{14}}{s_{12}} \, . \end{align} It is also straightforward to compute $\mathcal{A}_4({\bf{1}}^{-},{\bf{2}}^{-},{{3}},{{4}})$ and $\mathcal{A}_4({\bf{1}}^{-},{\bf{2}}^{+},{{3}},{{4}})$ amplitudes. Unless $M_{\hat{1}\hat{2}; (34)}=M_{\hat{1}^*\hat{2}^*; (34)}=0$ and $R_{\hat{1}\hat{2}^*34}=R_{\hat{1}^*\hat{2}34}=0$, these amplitudes eventually violate the perturbative unitarity at the high-energy scale. Considering the equivalence theorem, these results indicate that the scattering amplitudes of the fermion pair scattering to longitudinally polarized gauge-boson violate the perturbative unitarity at a certain high-energy scale unless ${M}_{{\hat{1}}{\hat{2}};(34)}=0$ and ${R}_{{\hat{1}}{\hat{2}}^*34}=0$. The Appelquist-Chanowitz sum rules~\cite{Chanowitz:1978uj, Chanowitz:1978mv, Appelquist:1987cf,Maltoni:2001dc,Dicus:2004rg,Chivukula:2007gse} for the perturbative unitarity in the $W_L W_L \to t \bar{t}$ amplitude can thus be regarded as conditions on $R_{t\bar{t} \pi\pi}$ and $M_{\bar{t}t; (\pi\pi)}$. \subsection{Four fermions} \begin{figure} \centering \includegraphics[width=8.5cm,clip]{f1f2f3f4.pdf} \caption{Feynman diagram for $\mathcal{A}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4})$. We assign the out-going momenta $p_1$, $p_2$, $p_3$ and $p_4$ to $\psi^{{\hat{1}}}$, $\psi^{{\hat{2}}}$, $\psi^{{\hat{3}}}$ and $\psi^{{\hat{4}}}$. } \label{fig:ffff} \end{figure} The four-points fermion amplitude is computed from the Feynman diagram Fig.~\ref{fig:ffff}. We decompose the amplitude into three categories; \begin{align} \mathcal{A}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4}) &= \mathcal{A}^{(c)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4}) \nonumber\\ &+ \mathcal{A}^{(c')}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4}) \nonumber\\ &+ \mathcal{A}^{(\phi)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4}) \,, \end{align} where $\mathcal{A}^{(c)}$ and $\mathcal{A}^{(c')}$ respectively denote the holomolophic and non-holomolophic contact diagrams, and $\mathcal{A}^{(\phi)}$ denotes the scalar-exchange diagram. Let us first focus on the contact diagram induced from the holomolophic contact interactions ($\psi\psi\psi\psi$ and $\psi^\dag\psi^\dag\psi^\dag\psi^\dag$). The amplitude is given as \begin{align} \lefteqn{ i\mathcal{A}^{(c)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4})}\nonumber\\ &= i{S}_{{\hat{1}}{\hat{2}}{\hat{3}}{\hat{4}}} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \spb{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \nonumber\\ &\quad + i{S}_{{\hat{1}}{\hat{3}}{\hat{4}}{\hat{2}}} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \spb{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ &\quad + i{S}_{{\hat{1}}{\hat{4}}{\hat{2}}{\hat{3}}} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \spb{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} \nonumber\\ &\quad + i{S}_{{\hat{1}}^*{\hat{2}}^*{\hat{3}}^*{\hat{4}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \spa{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \nonumber\\ &\quad + i{S}_{{\hat{1}}^*{\hat{3}}^*{\hat{4}}^*{\hat{2}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \spa{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ &\quad + i{S}_{{\hat{1}}^*{\hat{4}}^*{\hat{2}}^*{\hat{3}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \spa{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} \,, \label{eq:Affff1} \end{align} Using the Schouten identities (\ref{eq:bracket-schouten1}) and (\ref{eq:bracket-schouten2}), the amplitude are expressed in terms of non-redundant parameters $R_{\hat{i}\hat{j}\hat{k}\hat{l}}$, \begin{align} \lefteqn{i\mathcal{A}^{(c)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4})}\nonumber\\ &=- \frac{2i}{3} {R}_{{\hat{1}}({\hat{3}}{\hat{4}}){\hat{2}}} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \spb{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \nonumber\\ &\quad - \frac{2i}{3} {R}_{{\hat{1}}({\hat{2}}{\hat{4}}){\hat{3}}} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \spb{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ &\quad - \frac{2i}{3} {R}_{{\hat{1}}({\hat{2}}{\hat{3}}){\hat{4}}} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \spb{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} \nonumber\\ &\quad - \frac{2i}{3} {R}_{{\hat{1}}^*({\hat{3}}^*{\hat{4}}^*){\hat{2}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \spa{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \nonumber\\ &\quad - \frac{2i}{3}{R}_{{\hat{1}}^*({\hat{2}}^*{\hat{4}}^*){\hat{3}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \spa{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ &\quad - \frac{2i}{3} {R}_{ {\hat{1}}^* ({\hat{2}}^* {\hat{3}}^*) {\hat{4}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \spa{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} \, . \label{eq:Affff2} \end{align} with $R_{\hat{i}\hat{j}\hat{k}\hat{l}}$ being ``curvature'' tensors as defined in (\ref{eq:new-coeff}). Similary, the amplitude from the non-holomorophic contact interaction ($\psi\psi\psi^\dag\psi^\dag$) is given by \begin{align} \lefteqn{i\mathcal{A}^{(c')}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4})}\nonumber\\ &= i{R}_{{\hat{1}}{\hat{3}}^*{\hat{2}}{\hat{4}}^*} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \spa{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \nonumber\\ &\quad + i{R}_{{\hat{1}}{\hat{4}}^*{\hat{3}}{\hat{2}}^*} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \spa{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ &\quad + i{R}_{{\hat{1}}{\hat{2}}^*{\hat{4}}{\hat{3}}^*} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \spa{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} \nonumber\\ &\quad + i{R}_{{\hat{3}}{\hat{1}}^*{\hat{4}}{\hat{2}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \spb{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \nonumber\\ &\quad + i{R}_{{\hat{4}}{\hat{1}}^*{\hat{2}}{\hat{3}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \spb{{\bf{4}}^{\lambda_4}}.{{\bf{2}}^{\lambda_2}} \nonumber\\ &\quad + i{R}_{{\hat{2}}{\hat{1}}^*{\hat{3}}{\hat{4}}^*} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \spb{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} \,. \end{align} Here the ``curvature'' tensor $R_{\hat{i}\hat{j}^*\hat{k}\hat{l}^*}$ is defined in (\ref{eq:Rnonh}). The scalar-exchange amplitude is computed as \begin{align} \lefteqn{ i\mathcal{A}^{(\phi)}_4({\bf{1}}^{\lambda_1},{\bf{2}}^{\lambda_2},{\bf{3}}^{\lambda_3},{\bf{4}}^{\lambda_4}) } \nonumber\\ & = - \sum_{i, j} \biggl( {M}_{{\hat{1}}{\hat{2}};i} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} +{M}_{{\hat{1}}^*{\hat{2}}^*;i} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{2}}^{\lambda_2}} \biggr) \nonumber\\ & \qquad \,[D(s_{12})]^{ij}\, \biggl( {M}_{{\hat{3}}{\hat{4}};i} \spb{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} +{M}_{{\hat{3}}^*{\hat{4}}^*;i} \spa{{\bf{3}}^{\lambda_3}}.{{\bf{4}}^{\lambda_4}} \biggr) \nonumber\\ & \quad - \sum_{i, j} \biggl( {M}_{{\hat{1}}{\hat{3}};i} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} +{M}_{{\hat{1}}^*{\hat{3}}^*;i} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{3}}^{\lambda_3}} \biggr) \nonumber\\ & \qquad \,[D(s_{13})]^{ij}\, \biggl( {M}_{{\hat{2}}{\hat{4}};i} \spb{{\bf{2}}^{\lambda_2}}.{{\bf{4}}^{\lambda_4}} +{M}_{{\hat{2}}^*{\hat{4}}^*;i} \spa{{\bf{2}}^{\lambda_2}}.{{\bf{4}}^{\lambda_4}} \biggr) \nonumber\\ & \quad - \sum_{i, j} \biggl( {M}_{{\hat{1}}{\hat{4}};i} \spb{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} +{M}_{{\hat{1}}^*{\hat{4}}^*;i} \spa{{\bf{1}}^{\lambda_1}}.{{\bf{4}}^{\lambda_4}} \biggr) \nonumber\\ & \qquad \,[D(s_{14})]^{ij}\, \biggl( {M}_{{\hat{2}}{\hat{3}};i} \spb{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} +{M}_{{\hat{2}}^*{\hat{3}}^*;i} \spa{{\bf{2}}^{\lambda_2}}.{{\bf{3}}^{\lambda_3}} \biggr) \,, \nonumber\\ \label{eq:Affff3} \end{align} where $[D(s)]^{ij}$ denotes the scalar propagator (\ref{eq:scalarprop}). We are now ready to discuss the high-energy behavior of the four-fermion amplitude, \begin{eqnarray} \psi^{{\hat{1}}}(-p_1)\,\psi^{{\hat{2}}}(-p_2) \to \psi^{{\hat{3}}}(p_3)\,\psi^{{\hat{4}}}(p_4) \, , \end{eqnarray} in the center-of-mass frame. Taking the high-energy limit, $s=s_{12}\gg m_1^2$, $m_2^2$, $m_3^2$, $m_4^2$, we find the eight helicity amplitudes \begin{align} \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^+,{\bf{3}}^+,{\bf{4}}^+) \, , \quad \mathcal{A}_{4} ({\bf{1}}^-,{\bf{2}}^-,{\bf{3}}^-,{\bf{4}}^-) \, , \end{align} and \begin{align} & \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^+,{\bf{3}}^-,{\bf{4}}^-) \, , \quad \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^-,{\bf{3}}^+,{\bf{4}}^-) \, , \nonumber\\ & \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^-,{\bf{3}}^-,{\bf{4}}^+) \, , \quad \mathcal{A}_{4}({\bf{1}}^-,{\bf{2}}^-,{\bf{3}}^+,{\bf{4}}^+) \, , \nonumber\\ & \mathcal{A}_{4} ({\bf{1}}^-,{\bf{2}}^+,{\bf{3}}^-,{\bf{4}}^+) \, , \quad \mathcal{A}_{4} ({\bf{1}}^-,{\bf{2}}^+,{\bf{3}}^+,{\bf{4}}^-) \, , \end{align} grow as energy squared. We obtain \begin{align} \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^+,{\bf{3}}^+,{\bf{4}}^+) &\simeq {R}_{{\hat{1}}{\hat{4}}{\hat{2}}{\hat{3}}}\,s +\frac{1}{2}{R}_{{\hat{1}}{\hat{2}}{\hat{3}}{\hat{4}}}\,s\,(1+\cos\theta) \,, \label{eq:ffff++++} \,\\ \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^+,{\bf{3}}^-,{\bf{4}}^-) &\simeq {R}_{{\hat{1}}{\hat{3}}^*{\hat{2}}{\hat{4}}^*}\,s \label{eq:ffff++--} \, . \end{align} We also find that the eight of sixteen helicity amplitudes \begin{align} & \mathcal{A}_{4} ({\bf{1}}^-,{\bf{2}}^+,{\bf{3}}^+,{\bf{4}}^+) \, , \quad \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^-,{\bf{3}}^+,{\bf{4}}^+) \, , \nonumber\\ & \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^+,{\bf{3}}^-,{\bf{4}}^+) \, , \quad \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^+,{\bf{3}}^+,{\bf{4}}^-) \, , \nonumber\\ & \mathcal{A}_{4} ({\bf{1}}^+,{\bf{2}}^-,{\bf{3}}^-,{\bf{4}}^-) \, , \quad \mathcal{A}_{4} ({\bf{1}}^-,{\bf{2}}^+,{\bf{3}}^-,{\bf{4}}^-) \, , \nonumber\\ & \mathcal{A}_{4} ({\bf{1}}^-,{\bf{2}}^-,{\bf{3}}^+,{\bf{4}}^-) \, , \quad \mathcal{A}_{4} ({\bf{1}}^-,{\bf{2}}^-,{\bf{3}}^-,{\bf{4}}^+) \, , \end{align} behave as $\sqrt{s}$ in high-energy limit. For an example, we obtain \begin{align} \lefteqn{\mathcal{A}_{4} ({\bf{1}}^-,{\bf{2}}^+,{\bf{3}}^+,{\bf{4}}^+)}\nonumber\\ &\simeq \frac{\sqrt{s}}{2} \,\sin\theta \biggl( m_{{1}}{R}_{{\hat{1}}{\hat{2}}{\hat{3}}{\hat{4}}} - m_{{3}}{R}_{{\hat{2}}{\hat{1}}^*{\hat{4}}{\hat{3}}^*} + m_{{4}}{R}_{{\hat{2}}{\hat{1}}^*{\hat{3}}{\hat{4}}^*} \biggr) \, . \end{align} Note that the helicity structure determines the difference of the high-energy behaviors. \section{Summary} \label{sec:summary} We have formulated an extension of Higgs effective field theory (Generalized HEFT; GHEFT) which includes arbitrary number of spin-0 and spin-1/2 particles with arbitrary electric and chromoelectric charges. These particles include the SM quarks and leptons, and also BSM Higgs bosons and fermions. GHEFT can therefore describe the amplitude involving these non-SM particles. This is in contrast to the usual EFT frameworks such as SMEFT and HEFT, which cannot compute the cross sections and decay-widths of these new particles, because these new particles are integrated out in these EFTs. The leading order GHEFT Lagrangian has been expressed in accord with the GHEFT chiral order counting rule, which clarifies the relationship between the loop expansion and the operator expansion. The $S$-matrix of a quantum field theory is unchanged by field redefinitions. This fact, known as the Kamefuchi-O'Raifeartaigh-Salam (KOS) theorem, tells us that seemingly different effective Lagrangians connected through the field coordinate transformations can describe the identical scattering amplitudes. The parametrization of the effective Lagrangian is therefore not unique. In this paper, we have proposed to use the geometric quantities such as the curvature of field space in the GHEFT Lagrangian to resolve the redundancy. We have also shown that, by introducing a useful coordinate (Normal coordinate) in the field space manifold, the computations of the scattering amplitudes are significantly simplified. We have also estimated tree-level on-shell amplitudes in section \ref{sec:amplitude}. These on-shell amplitudes are expressed in terms of the square and angle bracket notation of the spinor wavefunction. The high-energy behaviors of the on-shell scattering amplitudes are computed. We found that the four-point scattering amplitudes grow as the scattering energy, and the coefficient of the energy-growing terms relate with the covariant tensors such as the curvature tensors on the field space. Perturbative unitarity in the scattering amplitudes requires the flatness in the scalar/fermion field space around the vacuum, {\it{i.e.}}, \begin{align} &R_{1234}\biggr|_0 = R_{\hat{1}\hat{2}^* 34}\biggr|_0 = R_{\hat{1}\hat{2}\hat{3}\hat{4}}\biggr|_0 \nonumber\\ &= R_{\hat{1}^*\hat{2}^*\hat{3}^*\hat{4}^*}\biggr|_0 = R_{\hat{1}\hat{2}^* \hat{3}\hat{4}^*} \biggr|_0 =0 \, \nonumber. \end{align} The GHEFT framework should be studied further. In order to apply the geometrical formulation in phenomenological studies, we need to compute the on-shell amplitudes involving the SM spin-1 particles $W$ and $Z$ in a geometrical language. It should also be emphasized extra spin-1 particles often appear in models beyond the SM. For example, extra gauge bosons exist in the extensions of the SM gauge group. Spin-1 resonances like techni-$\rho$ may appear in the strong dynamics models of the electroweak symmetry breaking. These spin-1 particles have been studied in the electroweak resonance chiral perturbation theories. It will be illuminating to investigate the geometrical formulations for these spin-1 resonances in the GHEFT framework. Radiative corrections should also be incorporated. In order to compute the $\gamma\gamma$ decays of the Higgs particles, for an example, we need to investigate radiative corrections in the GHEFT framework. As we have shown in this paper, the chiral order counting rule provides a basis to compute these radiative corrections. A geometrical formulation for the next-to-leading operators will also be useful in such a computation. \section*{Acknowledgments} We thank Keisuke Izumi for valuable comments on the manuscript. This work was supported by JSPS KAKENHI Grant Numbers JP19K14701 (RN), JP19K03846 (MT), and JP18H05543 (KT). The work of R.N. was also supported by the University of Padua through the ``New Theoretical Tools to Look at the Invisible Universe'' project and by Istituto Nazionale di Fisica Nucleare (INFN) through the ``Theoretical Astroparticle Physics'' (TAsP) project.
\section{Introduction} Nonuniform (or nonequispaced) fast Fourier transforms (NUFFTs) are fast algorithms that generalize the FFT to the case of off-grid points. They thus have a wealth of applications in engineering and scientific computing, including image reconstruction from off-grid Fourier data (e.g.\ MRI gridding \cite{fessler}, optical coherence tomography \cite{octnufft}, cryo electron microscopy \cite{wang13cryo,cryo,Strelak2019,anden2018structural, zhao2016fast}, radioastronomy \cite{arras20}, coherent diffraction X-ray imaging \cite{donatelli2017}); wave diffraction \cite{fresnaq}; partial differential equations \cite{gimbutasgrid,ludvig_nufft}; and long-range interactions in molecular \cite{salomon2013routine} and particle dynamics \cite{fiore2017}. For reviews, see \cite{dutt,nufft,usingnfft,Barnett_2019}. In 2D, the type 1 NUFFT \cite{dutt} (also known as the ``adjoint nonequispaced fast Fourier transform'' or ``adjoint NFFT'' \cite{usingnfft}) evaluates the uniform $N_1\times N_2$ grid of {\em Fourier series coefficients} $f_{k_1,k_2}$ due to a set of point masses of arbitrary strengths $c_j$ and locations $(x_j, y_j) \in [-\pi, \pi)^2$, $j=1,\dots,M$: \begin{equation} f_{k_1, k_2} \vcentcolon= \sum_{j=1}^{M} c_j e^{-i (k_1x_j + k_2y_j)} ~, \quad (k_1, k_2) \in \mathcal{I}_{N_1, N_2}, \label{eq:2d1} \end{equation} where the 1D integer Fourier frequency grid is defined by \begin{equation} \mathcal{I}_{N}\vcentcolon= \{k\in\mathbb{Z}: -N/2 \le k < N/2\} ~, \label{I} \end{equation} and we use the notation $\mathcal{I}_{N_1,N_2} \vcentcolon= \mathcal{I}_{N_1}\times \mathcal{I}_{N_2}$ for a 2D grid of Fourier frequencies. The type 2 NUFFT (or ``NFFT'' \cite{usingnfft}) is the adjoint of the type 1. Given a grid of Fourier coefficients $f_{k_1,k_2}$ it evaluates the resulting Fourier series at arbitrary (generally nonuniform) targets $(x_j, y_j) \in [-\pi, \pi)^2$, to give \begin{equation} c_j \vcentcolon= \sum_{(k_1, k_2)\in\mathcal{I}_{N_1, N_2}} f_{k_1,k_2} e^{i (k_1x_j +k_2y_j)} ~, \quad j = 1, \dots, M.\label{eq:2d2} \end{equation} In contrast to the FFT, type 1 is generally {\em not} the inverse of type 2: inverting a NUFFT usually requires iterative solution of a linear system \cite{fastsinc,usingnfft}. Definitions \eqref{eq:2d1} and \eqref{eq:2d2} generalize to 1D and 3D in the obvious fashion \cite{dutt}. Naively the exponential sums in \eqref{eq:2d1} and \eqref{eq:2d2} take ${\mathcal O}(NM)$ effort, where $N:=N_1\times\cdots\times N_d$ is the total number of Fourier modes, and $d$ the dimension. The NUFFT uses {\em fast algorithms} \cite{dutt,steidl98} to approximate these sums to a user-prescribed tolerance $\varepsilon$, typically with effort of only ${\mathcal O}(N\log N + M \log^d (1/\varepsilon))$, i.e., quasi-linear in the data size. Most algorithms internally set up a ``fine'' grid of size $n_1\times \dots \times n_d$, where each $n_i=\sigma N_i$, for a given upsampling factor $\sigma>1$. Then the type 1 transform has three steps: \begin{itemize} \item[i)] {\em spreading} (convolution) of each weighted nonuniform point by a localized kernel, writing into the fine grid, \item[ii)] performing a $d$-dimensional FFT of this fine grid, then \item[iii)] selecting the central $N$ output modes from this fine grid, after pointwise division (deconvolution) by the kernel Fourier coefficients. \end{itemize} Type 2 simply reverses (transposes) these steps, with i) becoming kernel-weighted {\em interpolation} from the fine grid to the nonuniform target points. See Sec.~\ref{sec:algorithm} for details. The NUFFT is often the rate-limiting step in applications, especially for iterative reconstruction \cite{fessler}, motivating the need for high throughput. Spreading and interpolation are often the dominant steps of NUFFTs, due to scattered memory writes and reads of kernel-sized blocks. Since it demands high memory bandwidth, yet is data parallel, it is a task well suited for acceleration by a general-purpose GPU \cite{cheng2014}. This potential of GPUs to accelerate the NUFFT has of course been noted, and to some extent exploited, in prior implementations \cite{cunfft,lin2018,gpunufft,gai2013}. However, the present work shows that it is possible to increase the efficiency significantly beyond that of prior codes, in the same hardware, via algorithmic innovations. With few exceptions \cite{cunfft}, most prior GPU NUFFT implementations are packaged in a manner specific to a single science application (e.g. MRI \cite{gai2013,gpunufft,lin2018}, OCT \cite{octnufft}, MD \cite{salomon2013routine}, or cryo-EM \cite{Strelak2019}), have unknown or limited accuracy, and lack mathematical documentation and testing, rendering them almost inaccessible to the general user. This motivates the need for an efficient, tested, general-purpose GPU code. \subsection{Contributions of this work} \label{s:contrib} We present {cuFINUFFT}, a general-purpose GPU-based CUDA NUFFT library. It exploits a recently-developed kernel with optimally small width for a full range of user-chosen tolerances ($10^{-1}$ to $10^{-12}$), yet more efficient to evaluate than prior ones \cite{Barnett_2019,keranal}. Its throughput is high---and largely insensitive to the point distribution. One main contribution is to accelerate spreading in the type 1 NUFFT. Broadly speaking there have been two styles of parallelization in prior work: ``input driven'' \cite{Gregerson2008} (or scatter \cite{Strelak2019}), which assigns one thread to each nonuniform point, and ``output driven'' \cite{usingnfft,gai2013,Strelak2019,smith2019} (gather), which assigns each thread a distinct portion of the fine output grid to spread to. The input driven scheme, accumulating to GPU global memory, has been used in many prior GPU codes \cite{cunfft,yang2018,fiore2017}; we will refer to our implementation of this baseline method as \textbf{GM} (global memory). While load-balanced, the memory access is arbitrary and can suffer from atomic collisions between writes (see Sec.~\ref{s:spreadperf}). Yet, a naive output driven approach, although collision-free, is poorly load-balanced for highly nonuniform point distributions \cite[Rmk.~12]{Barnett_2019}. To address these issues we propose two new spreading methods: \begin{itemize} \item \textbf{GM-sort} (global memory, sorted). This improves upon \textbf{GM} in that the work order of the nonuniform points is chosen by spatial sorting into bins (boxes) covering the fine grid. This regularizes the memory access pattern, enabling cache reuse. \item \textbf{SM} (shared memory). This sets up spreading ``subproblems'' executed in faster GPU shared memory. This is a hybrid scheme (see Fig.~\ref{fig:spreadoverview}): each subproblem has a local copy of the fine grid lying within the kernel half-width of one bin (output driven), yet is load-balanced by capping its subset of nonuniform points (input driven). Local fine grids are added back into global memory using far fewer global atomic operations than \textbf{GM} methods, avoiding collisions. The result is 2--10$\times$ faster than \textbf{GM-sort} (depending on $d$ and clustering). \end{itemize} Bin sizes and shapes have been hand-tuned for performance; this is crucial for \textbf{SM} to ensure optimal use of limited shared memory. Turning to the interpolation task in type 2, we propose to use the adjoint version of \textbf{GM-sort}, where grid writes are replaced by reads. We will also refer to this algorithm as \textbf{GM-sort}. For both tasks, while bin-sorting nonuniform points adds time, it accelerates the execution of spreading/interpolation. Thus our library uses a ``plan, setup, execute, destroy'' interface that allows efficient {\em reuse} of the same (sorted) nonuniform points with new strength vectors (e.g.\ new $c_i$ in \eqref{eq:2d1}). This use case is common, e.g.\ in iterative methods for NUFFT inversion. We benchmark in detail the speedup of {cuFINUFFT} over existing NUFFT libraries, for a range of accuracies, problem sizes, and point distributions. For example, including GPU memory allocation and transfer time, for low accuracy and quasi-uniform points, {cuFINUFFT} is on average 8$\times$ faster than {FINUFFT} \cite{Barnett_2019} (28 threads), 5$\times$ faster than {CUNFFT}\cite{cunfft} and 78$\times$ faster than {gpuNUFFT}\cite{gpunufft} for type 1 transforms. For type 2, {cuFINUFFT} is on average 6$\times$ faster than {FINUFFT}, 5$\times$ faster than {gpuNUFFT}, and performs similarly to {CUNFFT} but with 2--5$\times$ faster ``execute'' times. The library also enables multi-GPU parallelism, essential for larger problems in HPC environments. In Sec.~\ref{s:multi} we show this in the setting of 3D single particle reconstruction from coherent X-ray diffraction data, which demands thousands of 3D NUFFTs. For NSERC and OLCF supercomputer nodes, we demonstrate an order of magnitude speedup over the CPU version, and excellent weak scaling with respect to the number of GPU processes, up to one process per GPU. The code and documentation for the library is available on GitHub\footnote{\url{https://github.com/flatironinstitute/cufinufft}} and installable as a PyPI package in Python through {\tt pip install cufinufft}. \subsection{Limitations} \label{s:limit} Our library has a few limitations. (1) Both \textbf{GM-sort} and \textbf{SM} have some GPU memory overhead, due to sorting index arrays. Yet, for a large 3D transform ($N_i=256,~i=1,2,3$, and $M=1.3\times 10^8$), this overhead is only around $20\%$. (2) The \textbf{SM} method, while providing a large acceleration for type 1, is currently limited to single precision, due to the small GPU shared memory per thread block (49 kB). (3) We fixed the upsampling factor $\sigma=2$; reducing this could reduce memory overhead and run times \cite{Barnett_2019}. (4) Our library does not yet provide NUFFTs in 1D, nor of type 3 (nonuniform to nonuniform) \cite{nufft3}. \section{Algorithms} \label{sec:algorithm} We follow the standard three-step scheme presented in the previous section. Our Fourier transform convention is \begin{equation} \hat{\phi} (k) = \int_{-\infty}^{\infty} \!\!\!\phi(x) e^{-ikx}dx \,,\; \phi (x) = \frac{1}{2\pi}\int_{-\infty}^{\infty}\!\! \hat{\phi}(k) e^{ikx}dk. \end{equation} We fix the upsampling factor $\sigma = 2$, and use the ``exponential of semicircle'' (ES) kernel from FINUFFT \cite{Barnett_2019,keranal}, \begin{equation} \phi_\beta(z)\vcentcolon= \begin{cases} e^{\beta(\sqrt{1-z^2}-1)}, &|z|\leq 1\\ 0, & \text{otherwise}. \end{cases} \label{es} \end{equation} Given a user-requested tolerance $\varepsilon$, the kernel width $w$ in fine grid points, and parameter $\beta$ in \eqref{es}, are set via \begin{equation} w = \lceil \log_{10} 1/\varepsilon \rceil+1, \quad \beta = 2.30w. \end{equation} This typically gives relative $\ell_2$ errors close to $\varepsilon$ \cite{Barnett_2019}. As in FINUFFT, for FFT efficiency, the fine grid size $n_i$ is set to be the smallest integer of the form $2^{q_i}3^{p_i}5^{r_i}$, greater than or equal to $\max\left(\sigma N_i, 2w\right)$, in each dimension $i=1,\dots,d$. \subsection{Type 1: nonuniform to uniform} \label{algo:type1} We use the same algorithm as FINUFFT to compute $\tilde{f}_{k_1,k_2}$, an approximation to $f_{k_1,k_2}$ in \eqref{eq:2d1}. We will write only the 2D case, the generalization to 3D being clear. \paragraph{Step 1 (spreading)} For each index $(l_1,l_2)$ in the fine grid $0\le l_1<n_1$, $0\le l_2<n_2$, compute \begin{equation} b_{l_1, l_2} = \sum_{j=1}^M c_j \psiper(l_1h_1-x_j, l_2h_2-y_j), \end{equation} where $h_i\vcentcolon= 2\pi/n_i$ is the fine grid spacing, and $\psiper(x,y)$ is the periodized tensor product of rescaled ES kernels \begin{align} &\psi(x,y) := \phi_\beta(x/\alpha_1)\phi_\beta(y/\alpha_2),\enskip \alpha_i =w\pi/n_i, \enskip i=1,2, \nonumber \\ &\psiper(x,y) := \sum_{(m_1,m_2)\in \mathbb{Z}^2} \psi(x-2\pi m_1,y-2\pi m_2). \end{align} Note that each nonuniform point $(x_j,y_j)$ only affects a nearby square of $w^2$ fine grid points. \paragraph{Step 2} Use a plain 2D FFT to evaluate \begin{multline} \hat{b}_{k_1,k_2} = \sum_{l_2 = 0}^{n_2-1}\sum_{l_1 = 0}^{n_1-1} b_{l_1,l_2}e^{-2\pi i (l_1k_1/n_1 + l_2k_2/n_2)},\\ (k_1,k_2)\in \mathcal{I}_{n_1,n_2}. \end{multline} \paragraph{Step 3 (correction)} Truncate the Fourier coefficients to the central $N_1\times N_2$ frequencies, and scale them to give the final outputs \begin{equation} \tilde{f}_{k_1,k_2} = p_{k_1,k_2}\hat{b}_{k_1,k_2}, \quad (k_1,k_2)\in \mathcal{I}_{N_1,N_2}. \end{equation} Here, correction (deconvolution) factors $p_{k_1,k_2}$ are precomputed from samples of the kernel Fourier transform, via $$ p_{k_1,k_2} = h_1h_2\hat{\psi}(k_1,k_2)^{-1} = (2/w)^2(\hat{\phi}_\beta(\alpha_1k_1)\hat{\phi}_\beta(\alpha_2k_2))^{-1}. $$ \subsection{Type 2: uniform to nonuniform} \label{algo:type2} To compute $\tilde{c}_j$, an approximation to ${c}_j$ in \eqref{eq:2d2}, as in FINUFFT, the above steps for type 1 are reversed. The correction factors $p_{k_1,k_2}$ and the periodized kernel $\psiper$ remain as above. \paragraph{Step 1 (correction)} Pre-correct then zero-pad the coefficients $f_{k_1,k_2}$ to the fine grid, i.e., for all indices $(l_1,l_2)$, \begin{equation} \hat{b}_{l_1, l_2} = \begin{cases} p_{k_1,k_2}f_{k_1,k_2}, & (k_1,k_2)\in \mathcal{I}_{N_1,N_2}\\ 0, & (k_1,k_2)\in \mathcal{I}_{n_1,n_2}\backslash \mathcal{I}_{N_1,N_2} \end{cases}\\ \end{equation} \paragraph{Step 2} Use a plain inverse 2D FFT to evaluate \begin{multline} b_{l_1,l_2} = \sum_{(k_1,k_2)\in \mathcal{I}_{n_1,n_2}} \hat{b}_{k_1,k_2}e^{2\pi i (l_1k_1/n_1 + l_2k_2/n_2)},\\ l_i =0, \dots, n_i-1, \enskip i=1,2. \end{multline} \paragraph{Step 3 (interpolation)} Compute a weighted sum of the $w^2$ grid values near each target nonuniform point $(x_j,y_j)$, $$ \tilde{c}_j = \sum_{l_1 = 0}^{n_1-1}\sum_{l_2 = 0}^{n_2-1} b_{l_1,l_2}\psiper(l_1h_1-x_j,l_2h_2-y_j),\; j=1,\cdots,M. $$ \section{GPU implementation} This section shows how the above three-step algorithms are implemented on the GPU using the CUDA API. For the FFT in both types, we use NVIDIA's {cuFFT} library. For the correction steps, since the task is embarrassingly parallel, we simply launch one thread for each of the $N_1\times N_2$ Fourier modes. The factors $p_{k_1,k_2}$ are precomputed once in the planning stage. The major work lies in the spreading (type 1) and interpolation (type 2), to which we now turn. \begin{figure*}[ht] \centering \includegraphics[width=\textwidth]{fig/overview.png} \caption{\textbf{SM} spreading scheme. The shaded gray squares (each $w \times w$ fine grid points) show the support of the spreading kernel, centered on each nonuniform point (black dots). Colors indicate the different nonempty bins. \textbf{Step 0:} Divide the $n_1\times n_2$ fine grid into bins of size $m_1\times m_2$. \textbf{Step 1:} Assign subproblems by bin-sorting non-uniform points, and, if needed, further splitting so that there are at most $M_\text{sub}$ points per subproblem. \textbf{Step 2:} Spread the points inside each subproblem into a padded bin copy in faster shared memory (size $p_1\times p_2$). \textbf{Step 3:} Atomic add each padded bin result back into global memory. } \label{fig:spreadoverview} \end{figure*} \subsection{Spreading} \label{sec:spreading} Recall that we use \textbf{GM} to denote a baseline input driven spreading implementation in global memory (as used in CUNFFT \cite{cunfft}). This launches one thread per nonuniform point, i.e.\ $M$ in total, in their user-supplied order. The thread given nonuniform point $j$ spreads it to the fine grid $b$ array: $$ b_{l_1, l_2} \;\mapsfrom\; b_{l_1, l_2} + c_j \psiper(l_1h_1-x_j,l_2h_2-y_j), \quad \forall (l_1,l_2)~. $$ This task comprises (a) reading $x_j$, $y_j$, $c_j$ from GPU global memory, (b) $2w$ evaluations of the kernel function $\psi$, and (c) $w^2$ atomic adds to the $b$ array residing in GPU global memory. One downside of this approach is that nonuniform points assigned to threads within a thread block and hence within a warp can reside far from each other on the grid, which results in uncoalesced memory loads. (Note that assigning one {\em thread block} per nonuniform point may alleviate this issue \cite{fiore2017}.) Another downside is that global atomic operations for clustered points can essentially serialize the method. \textbf{GM-sort} is a scheme to address the issue of uncoalesced access. We partition the $n_1\times n_2$ fine grid into rectangular ``bins'' $R_i$, $i=1, \dots, \nbins$, each of integer sizes $m_1\times m_2$ if possible, otherwise smaller. (A typical choice is $m_1=m_2=32$.) Thus $\nbins = \lceil\frac{n_1}{m_1}\rceil\times \lceil \frac{n_2}{m_2}\rceil$. Bins are ordered in a Cartesian grid with the $x$ axis fast and $y$ slow, which echoes on a larger scale the ordering of the fine grid itself. We will say that nonuniform point $j$ is ``inside'' bin $R_i$ if the point's rounded integer fine grid coordinates $$ l_1 = \lfloor (x_j+\pi)/h_1 \rfloor ~, \qquad l_2 = \lfloor (y_j+\pi)/h_2 \rfloor ~, $$ lie in $R_i$. Suppose that there are $M_i$ nonuniform points inside bin $R_i$ for $i=1,\dots, \nbins$. We set up a permutation $t$ (a bijection from $\{1,\dots,M\}$ to itself), such that the nonuniform points with indices $t(1),t(2),\dots,t(M_1)$ are precisely those lying in bin $R_1$, then those with indices $t(M_1+1),t(M_1+2),\dots,t(M_1+M_2)$ are precisely those in bin $R_2$, etc. This is done in practice by first recording the bin index of each point, reading out this list in bin ordering, then inverting this permutation to give $t$. Nonuniform points are then assigned to threads in the permuted index order $t(1),\dots,t(M)$. This means that the threads within a warp now access parts of the $b$ fine grid array that, most of the time, are approximately adjacent. The GPU therefore has a better chance of coalescing these accesses into fewer global memory transactions. \textbf{SM} is a hybrid scheme which exploits GPU shared memory to further address the issue of slow global atomic operations. It partitions the fine grid into bins $R_i$ as above, then has three remaining steps, as follows (see Fig.~\ref{fig:spreadoverview}). \textit{Step 1: Assign subproblems using bin-sorting and blocking of nonuniform points}. The nonuniform point index list $1,\dots,M$ is broken into the union of disjoint subsets $S_1,S_2,\dots$, each of which we call a ``subproblem''. This is done as follows. For bin $R_1$, if the number of points $M_1$ is larger than $M_\text{sub}$, a parameter controlling the maximum subproblem size, then it is further broken into subsets (subproblems) of size at most $M_\text{sub}$. These one or more subproblems are all associated to the bin $R_1$, in which their points lie. The same is repeated for the remainder of the bins $R_i$. Thread blocks are then launched, one per subproblem. Note that the cap on subproblem size is a (blocked) form of input driven load-balancing: if many points lie in a bin, their spreading tasks are well parallelized. \textit{Step 2: Spread nonuniform points inside each subproblem to shared memory.} By the above partition, within a subproblem (a thread block), the nonuniform points can only affect the fine grid array $b$ within a {\em padded bin} of dimensions $p_1\times p_2$, where \begin{equation} p_i = \left(m_i + 2 \lceil w/2\rceil\right),\quad i=1,2. \end{equation} For the $k$th subproblem $S_k$, we accumulate its spreading result on a shared memory copy $b^{\text{shared}}$ of its padded bin, local to its thread block, \begin{multline} b^{\text{shared}}_{s_1, s_2} \;\;\mapsfrom\;\; b^{\text{shared}}_{s_1, s_2} \; +\\ \sum_{j \in S_k} c_j \psiper((s_1+\Delta_1)h_1-x_j,(s_2+\Delta_2)h_2-y_j),\\ s_i = 0,\dots,p_i-1,\quad i=1,2, \end{multline} where $(s_1,s_2)$ are local indices within the padded bin copy, and $(\Delta_1,\Delta_2)$ its offset within the fine grid (see Fig.~\ref{fig:spreadoverview}). \textit{Step 3: Atomic add the results back to global memory.} Once the spreading subproblem result is accumulated in the shared memory padded bin, we atomically add it back to the corresponding region of global memory array $b$, \begin{equation} b_{l_1(s_1),l_2(s_2)} \;\mapsfrom\; b_{l_1(s_1),l_2(s_2)} + b^{\text{shared}}_{s_1,s_2}, \enskip \forall (s_1,s_2) \label{eq:addtoglobal} \end{equation} where $l_i(s_i) := (s_i+\Delta_i)\, \mbox{mod}\, n_i$, $i=1,2$, maps each coordinate in the padded bin back to the fine grid, with periodic wrapping (see Fig.~\ref{fig:spreadoverview}). This completes the spreading process. When there are many nonuniform points per bin, this incurs many fewer global atomic writes than \textbf{GM-sort}. We generalize both the implementations \textbf{GM-sort} and \textbf{SM} to 3D by using cuboid bins of maximum dimension $m_1\times m_2\times m_3$. \begin{rem} In both methods \textbf{GM-sort} and \textbf{SM}, the performance is sensitive to the bin sizes. By hand-tuning (in powers of two), we have found $32\times 32$ in 2D and $16\times16\times2$ in 3D to be optimal. This takes account of the area (or volume) ratio of bin to padded bin, the ordering of fine grid data, and the maximum size of GPU shared memory per thread block (49 kB), and are based on speed tests on an NVIDIA Tesla V100. We similarly set $M_\text{sub}=1024$, although we believe that its optimal value is problem-dependent. \end{rem} \begin{rem} We implemented \textbf{SM} in both dimensions and precisions, apart from 3D double precision where it is no longer advantageous. Here the shared memory constraint $16(m_1+w)(m_2+w)(m_3+w) \le 49000$, for widths $w>8$ needed when $\varepsilon<10^{-7}$, forces the bin volume to be tiny compared to the padded bin volume, dramatically increasing the number of global operations. We test only \textbf{GM-sort} in this case. \end{rem} \subsection{Interpolation} \label{sec:interpolation} For interpolation, we use the same idea as \textbf{GM-sort} for spreading, with read and write memory operations reversed. Threads are assigned to nonuniform points in the permuted order $t(1),\dots,t(M)$ coming from bin-sorting. Thus the $j$th thread performs the task $$ \tilde{c}_{t(j)} = \sum_{l_1 = 0}^{n_1-1}\sum_{l_2 = 0}^{n_2-1} b_{l_1,l_2}\psiper(l_1h_1-x_{t(j)},l_2h_2-y_{t(j)})~. $$ We refer to the method by the same name, \textbf{GM-sort}, and use \textbf{GM} to refer to the unsorted version. The reason to bin-sort the nonuniform points is to coalesce the reads from the fine grid. Since there is no conflict between threads reading the same location in memory, this is fast; the benefit of applying an idea like \textbf{SM} to interpolation would be limited. \section{Performance Tests} \label{sec:performance} In this section, we report the performance of our GPU library, {cuFINUFFT}. We first show how the proposed spreading methods \textbf{GM-sort} and \textbf{SM} perform against \textbf{GM}. Then, we compare the performance of the interpolation step with (\textbf{GM-sort}) and without (\textbf{GM}) bin-sorting the nonuniform points. Finally, we show how the whole pipeline performance (spreading/interpolation, FFT, correction) of cuFINUFFT compares with the fastest known multithreaded CPU library {FINUFFT} \cite{Barnett_2019}, and two established GPU libraries {CUNFFT} \cite{cunfft} and {gpuNUFFT} \cite{Strelak2019}. All GPU timings are for a NVIDIA Tesla V100 (released in 2017), with memory bandwidth 900 GB/s. We compile all codes with GCC v7.4.0 and NVCC v10.0.130. Unless specified, single precision and $M_\text{sub}=1024$ are used in all the tests. \textbf{\textit{Tasks.}} We present results for the following two nonuniform point distributions, which are extreme cases: \begin{itemize} \item ``rand'': nonuniform points are independent and identically distributed uniform random variables across the entire periodic domain box $[-\pi, \pi)^d$, $d=2,3$. \item ``cluster'': points are iid random in the small box $[0, 8h_1]\times\dots\times [0, 8h_d]$, recalling that $h_i$ are the fine grid spacings. \end{itemize} We restrict to square/cube problems, i.e.\ $N_1=N_2(=N_3)$, being the most common application problem. We define problem {\em density} $\rho$ to be the ratio of number of nonuniform points to number of upsampled grid points, i.e., \begin{equation} \label{eq:den} \rho \; := \; \frac{M}{\prod_{i=1}^d n_i} \;=\; \frac{M}{\sigma^d \prod_{i=1}^d N_i}~. \end{equation} We report tests with $\rho$ of order 1, since a) this is common in applications, and b) in the uncommon case $\rho\ll 1$ one ends up essentially comparing plain FFT speeds. In fact we have tested $\rho=0.1$ and $\rho=10$, as well as less extreme nonuniform point distributions; the conclusions are rather similar. \begin{figure}[t] \centering \input{fig/spread23d} \caption{Spreading method comparisons. Execution time per nonuniform point (smaller is better) is shown, for various fine grid sizes, and distributions ``rand'' and ``cluster'', in 2D and 3D. For \textbf{GM-sort} (cyan) and \textbf{SM} (dark blue), the ``total'' time (solid lines) includes the precomputation (bin-sorting or subproblem setup), whereas the ``spread'' time (dotted lines) excludes this precomputation. The baseline \textbf{GM} (red) needs no precomputation. Annotations are the speedups over \textbf{GM}.} \label{spreading2D} \end{figure} \subsection{Spreading performance} \label{s:spreadperf} For high-accuracy single precision ($\varepsilon=10^{-5}$, i.e.\ $w=6$), Fig. \ref{spreading2D} compares our spreading methods \textbf{GM-sort} and \textbf{SM} against the baseline method \textbf{GM}, in 2D (top), 3D (bottom), and for ``rand'' (left) and ``cluster'' (right) distributions. Solid lines show total times (in nanoseconds per nonuniform point) including preprocessing (sorting) of new nonuniform points. Dotted lines show execution excluding this, so are relevant for {\em repeated transforms} with same set of nonuniform points. We can see from the ``rand'' results that for large grids ($n_1=n_2\geq 2^{10}$ in 2D, or $n_1=n_2=n_3 \geq 2^7$ in 3D) bin-sorting brings a large gain. In the extreme case (the largest $n_i$ tested), \textbf{GM-sort} is 3.9$\times$ faster than \textbf{GM} in 2D, and 7.6$\times$ faster in 3D. On the other hand, for small grids, because the memory accesses are already localized, we do not see any benefit of bin-sorting. From the ``cluster'' results, since nonuniform points all reside in a small region, bin-sorting brings no benefit. However, we see the clear advantage of doing local spreading on shared memory, in that \textbf{SM} is up to 12.8$\times$ faster than \textbf{GM} in 2D, and up to 3.2$\times$ faster in 3D. The speedup in 3D is limited because the padding of the bins, especially in the $z$ direction, grows the volume of global atomic adds needed in {\em Step 3}. Comparing the dark blue curves in the left and right plots, we see a distribution-robust performance for \textbf{SM}, in that similar throughput is achieved for ``rand'' and ``cluster'' distributions. In comparison, \textbf{GM-sort} is on average 3.9$\times$ slower in 2D comparing ``cluster'' and ``rand'' distributions. The 2D execution throughput (excluding precomputation) exceeds $10^9$ points/sec for large grids, and is close even when including precomputation. \begin{figure}[t] \centering \input{fig/interp23d} \caption{Interpolation comparisons. Execution time per nonuniform point is shown, for various fine grid sizes, and distribution ``rand'', in 2D and 3D. The ``total'' time (solid lines) includes the bin-sorting precomputation, whereas the ``interp'' time (dotted lines) excludes this precomputation.} \label{interpolation2D} \end{figure} \subsection{Interpolation performance} For the same accuracy, Fig. \ref{interpolation2D} compares interpolation method \textbf{GM-sort} against \textbf{GM} in 2D and 3D, for the ``rand'' distribution. (We exclude the ``cluster'' results, since, as with spreading, bin-sorting nonuniform points has no effect.) We see that again \textbf{GM-sort} improves the performance for large grids ($n_1=n_2\geq 2^{11}$ in 2D, or $n_1=n_2=n_3\geq 2^6$ in 3D). It is 4.5$\times$ faster than \textbf{GM} in 2D, and 12.7$\times$ faster in 3D, for the largest $n_i$ tested. A difference with spreading is that, because there are no global write conflicts, the execution time of \textbf{GM-sort} (excluding precomputation) never becomes slower than \textbf{GM}. \subsection{Benchmark comparisons against existing libraries} \label{sec:bc} We now compare {cuFINUFFT} against the CPU library {FINUFFT} (which has already benchmarked favorably against other CPU libraries \cite{Barnett_2019}), and GPU libraries {CUNFFT} \cite{cunfft} and {gpuNUFFT} \cite{Strelak2019}. For {FINUFFT}, we used a high-end compute node equipped with 512 GB RAM and two Intel Xeon E5-2680 v4 processors (released in 2016). Each processor has 14 physical cores at 2.40 GHz. We ran multithreaded {FINUFFT} with 28 threads (1 thread per physical core). \begin{itemize} \item {cuFINUFFT} version 1.0. We used host compiler flags \texttt{-fPIC -O3 -funroll-loops -march=native}. \item {FINUFFT} version 2.0.2. Compiler flags were \texttt{-O3 -funroll-loops -march=native -fcx-limited-range}. We fixed upsampling factor $\sigma=2$ to match that used in cuFINUFFT. \item {CUNFFT} version 2.0. We compiled with fast Gaussian gridding (\texttt{-DCOM\_FG\_PSI=ON}). Default dimensions of thread blocks (\texttt{THREAD\_DIM\_X=16}, \texttt{THREAD\_DIM\_Y=16}) are used. \item {gpuNUFFT} version 2.1.0. We use its MATLAB interface. We used default host compiler flags (\texttt{-std=c++11 -fPIC}). We set \texttt{MAXIMUM\_ALIASING\_ERROR} to $10^{-6}$ to get more accurate results. We use the same sector width $8$ and \texttt{THREAD\_BLOCK\_SIZE=256} as the demo codes. \end{itemize} We present three different timings for NUFFT executions: \begin{itemize} \item ``total'': Execution time (per nonuniform point) for inputs and output on the GPU. \item ``total+mem'': Execution time (per nonuniform point), including the time for GPU memory allocation plus transferring data from host to GPU and back. \item ``exec'': Execution time (per nonuniform point) for a transform, after its nonuniform points have already been preprocessed. This is a subset of the ``total'' time. It is the relevant time for the case of multiple fixed-size transforms with a fixed set of nonuniform points, but new strength or coefficient vectors. \end{itemize} There is a constant start-up cost (about 0.1--0.2 second) for calling the {cuFFT} library, so to exclude it we add a dummy call of \texttt{cuFFTPlan1d} before calling {cuFINUFFT} or {CUNFFT}. For gpuNUFFT, in ``total+mem'', we exclude the time for building the nonuniform FFT operator and creating the cuFFT plan. Note also that gpuNUFFT sorts the nonuniform points into sectors on the CPU and copies the arrays to the GPU when it builds the operator, so, to be generous, we do not include this in ``total+mem'' either. Finally, ``total'' is not shown for {gpuNUFFT} and {CUNFFT}, because {gpuNUFFT} takes CPU arrays as inputs and outputs, and {CUNFFT} allocates GPU memory in the initialization stage (\texttt{cunfft\_init}) in a way that did not allow us to separate its timing. We now discuss the results (\Cref{fig:single,fig:singleexec,fig:double,fig:type12} and Table \ref{table:3dtype1}). A wide range of relative $\ell_2$ errors, $\epsilon$, are explored by varying the requested tolerance, or kernel parameters (usually the width $w$), for each library. Error is measured against a ground truth of FINUFFT with tolerance $\varepsilon=10^{-14}$ for double precision runs, and $\varepsilon=6\times 10^{-8}$ for single precision runs. \begin{figure}[ht] \centering \input{fig/compaccsingletotal} \caption{Single precision NUFFT comparisons in 2D (left) and 3D (right), for type 1 (upper) and 2 (lower). ``total+mem'' (``total'' for FINUFFT) time per nonuniform point vs accuracy is shown, for the named libraries, for the distribution ``rand''. } \label{fig:single} \end{figure} \begin{figure}[ht] \centering \input{fig/compaccsingleexec} \caption{Single precision comparisons in 2D and 3D. ``exec'' time per nonuniform point vs accuracy is shown for the tested libraries, except for gpuNUFFT. For explanation see caption of Fig. \ref{fig:single}. } \label{fig:singleexec} \end{figure} \begin{table*}[ht] \centering \pgfplotstableread[col sep=comma]{\compdata/3d1_sepcufinufft.dat}{\table} \pgfkeys{ /pgf/number format/.cd, sci, sci generic={mantissa sep=\times,exponent={10^{#1}}}} \pgfplotstabletypeset[ every head row/.style={ before row={ \toprule }, after row=\midrule}, every last row/.style={after row=\bottomrule}, every nth row={4}{before row=\midrule}, columns={tol,N1,M,code,exec,ram, speedupoverall,spreadpercent}, columns/code/.style={column type=l,string type,column name=Method}, columns/tol/.style={string type,column name=$\varepsilon$}, columns/N1/.style={int detect, column name={$N_1=N_2=N_3$}}, columns/spreadpercent/.style={fixed,column name=Spread fraction (\%), precision=1}, columns/exec/.style={column type=c,column name=``Exec'' time (sec), fixed, precision=4}, columns/ram/.style={set thousands separator={},int detect, column type=c,column name=RAM (MB)}, columns/speedupoverall/.style={fixed,column name=Speedup vs FINUFFT, postproc cell content/.append style={ /pgfplots/table/@cell content/.add={$\bf}{$}, },postproc cell content/.append style={ /pgfplots/table/@cell content/.add={}{$\times$}, },precision=1}, multicolumn names=c, ] {\table} \caption{{cuFINUFFT} 3D type 1 NUFFT GPU memory usage, and ``exec'' time, for distribution ``rand'' and for two relative tolerances $\varepsilon=10^{-2}, 10^{-5}$. Speedup is computed relative to the ``exec'' time from {FINUFFT}. Spread fraction is the percentage of ``exec'' time spent on spreading. RAM is measured using \texttt{nvidia-smi}. For the baseline spreading method \textbf{GM}, RAM use is 381 MB for $N_i=32$ and 5113 MB for $N_i=256$).} \label{table:3dtype1} \end{table*} \begin{figure}[ht] \centering \input{fig/comp2d1} \caption{Detailed 2D Type 1 (top) and 2 (bottom) NUFFT comparisons (single precision). Execution time per nonuniform point vs number of Fourier modes are shown for the named libraries, comparing ``rand'' (left) and ``cluster'' (right). Annotations give the speedup of ``exec'' of {cuFINUFFT} (SM) for type 1, {cuFINUFFT} (GM-sort) for type 2, vs ``exec'' of {FINUFFT}. } \label{fig:type12} \end{figure} \paragraph{Single precision comparisons} Figs.~\ref{fig:single} and \ref{fig:singleexec} compare performance of both type 1 (top) and type 2 (bottom) in 2D (left), 3D (right), for all libraries in single precision. We can see from the top plots that for type 1, {cuFINUFFT} outperforms all other libraries. For type 1, the best performance is achieved using the \textbf{SM} method (dark blue). The ``exec'' time of {cuFINUFFT ({SM})} in 2D is around 10$\times$ faster than ``exec'' time of {FINUFFT}, independent of the accuracy; and in 3D, it is 3--12$\times$ faster from high to low accuracy. For type 2 (bottom plots), except for 2D low accuracy ($\epsilon>10^{-2}$) where CUNFFT is comparable to {cuFINUFFT}, {cuFINUFFT} is again the fastest. Its ``exec'' time is 4--7$\times$ and 6--8$\times$ faster than the ``exec'' time of {FINUFFT} in 2D and 3D respectively. In Fig. \ref{fig:type12}, we fix a tolerance $\varepsilon=10^{-2}$ (achievable by all libraries), and examine the effect of nonuniform point distribution and number of Fourier modes (fixing density $\rho=1$) on library performance. From the top plots, for type 1, we observe distribution-robust performance in {cuFINUFFT} ({SM}), {FINUFFT} and {gpuNUFFT}. The others, {cuFINUFFT} ({GM-sort}) and {CUNFFT}, slow down when the points are clustered: for an intermediate problem size ($N_i=2^9$), {cuFINUFFT} ({GM-sort}) ``exec'' is slowed by a factor of 3 when switching from ``rand'' to ``cluster'' to ``rand''. Dramatically, {CUNFFT} is slowed by a factor of 200: it is very slow for clustered type 1 transforms. For type 2 (lower plots in Fig.~\ref{fig:type12}), the sensitivity to clustering is much weaker: all libraries tackle ``cluster'' at about the same speed they tackle ``rand'', apart from {cuFINUFFT} which becomes 3--4$\times$ faster. While {cuFINUFFT} has similar ``total+mem'' time as {CUNFFT}, its ``exec'' time is 2--5$\times$ faster than that of {CUNFFT}. In 3D our detailed findings are quite similar, and we do not show them. Lastly, in Table \ref{table:3dtype1} we detail the type 1 performance and RAM usage of cuFINUFFT in 3D, for two tolerances. We see again that higher speedup with respect to FINUFFT is achieved for \textit{low accuracy} and \textit{large problem sizes}. The spreading method \textbf{SM} achieves better performance, but at a cost of slightly more GPU RAM usage for large problems. Lastly, spreading is still the performance bottleneck for 3D type 1: it occupies over $90\%$ of ``exec'' time for all accuracies and problem sizes. \begin{figure}[ht] \centering \input{fig/compaccdouble} \caption{Double precision comparisons. All three timings ``exec'', ``total'', and ``total+mem'' are shown. For more explanation see caption of Fig.~\ref{fig:single}.} \label{fig:double} \end{figure} \paragraph{Double precision comparisons} Fig. \ref{fig:double} compares the performance for both types in 2D and 3D, for all libraries (except gpuNUFFT, whose $\epsilon$ appears always to exceed $10^{-3}$). We see from the top left plot that for 2D type 1, {cuFINUFFT} outperforms the others by 1--2 orders of magnitude. The best performance is achieved by \textbf{SM} (blue) for high accuracy ($\epsilon\leq 10^{-5}$) and by \textbf{GM-sort} (cyan) for low accuracy. The ``exec'' speedup of {cuFINUFFT} (taking the faster of \textbf{SM} and \textbf{GM-sort}), vs {FINUFFT}, ranges from 4--11$\times$. From the top right plot, for 3D type 1, {cuFINUFFT} is only faster than {FINUFFT} for relative error $\epsilon\geq 10^{-10}$, merely matching its speed at the highest accuracies. From the bottom plots, for type 2, {cuFINUFFT} is always the fastest, and by a large factor at high accuracies. The ``exec'' time of {cuFINUFFT} is on average 6$\times$ faster than that {FINUFFT} in both dimensions. In 2D, and low-accuracy 3D, we see that host-to-device transfer dominates: a several-fold speedup is available by maintaining data on the GPU. \section{Multi-GPU Applications} \label{s:multi} Finally, we illustrate the multi-GPU performance of cuFINUFFT in 3D coherent X-ray image reconstruction. Single particle imaging is a technique whereby the 3D electron density of a molecule may be recovered at sub-nanometer resolution from a large ($\le 10^5$) set of 2D far-field diffraction images, each taken in a single shot of a free-electron laser with a random {\em unknown} molecular orientation \cite{donatelli2017}. Each 2D image measures the squared magnitude Fourier transform of the density on an (Ewald sphere) slice passing through the origin; see Fig.~\ref{fig:mtip:merging}. The {\em multitiered iterative phasing} (M-TIP) algorithm is used for reconstruction \cite{donatelli2017}. Broadly speaking, one starts with a Fourier transform estimate on a 3D Cartesian grid, and estimated orientations, then iterates the following four steps: \begin{enumerate} \item[i)] ``Slicing'': a 3D type 2 NUFFT is used to evaluate the Fourier transform on a large set of Ewald sphere slices. \item[ii)] Orientation matching: adjust each slice orientation using its 2D image data. \item[iii)] ``Merging'': solve for 3D Fourier transform data matching the 2D images on known slices, as in Fig.~\ref{fig:mtip:merging}; this needs two 3D type 1 NUFFTs. \item[iv)] Phasing: find the most likely phase of the 3D Fourier transform to give a real-space density of known support. \end{enumerate} \begin{figure} \centering \includegraphics[width=0.4\textwidth]{NUFFT.png} \caption{% M-TIP merging step: 3D Fourier transform data, collected on multiple Ewald sphere slices with arbitrary orientations, is merged onto a single uniform grid. Image credit: Jeffrey Donatelli (Lawrence Berkeley National Laboratory). \label{fig:mtip:merging}% } \end{figure} The code acceleration strategy, a part of the Exascale Computing Project, has been to offload the intensive steps i)--iii) to GPUs. \subsection{Work management and the {cuFINUFFT} Python interface} We use MPI to manage parallel processes, via the mpi4py package. Each MPI {\em rank} (i.e.\ process) is assigned some data to handle and a GPU. Since slicing and merging are linear operations, we can scatter (\texttt{mpi4py.scatter}) before the slicing step, and reduce (\texttt{mpi4py.reduce}) after the merging step. In modern HPC environments each compute node is furnished with several GPUs---e.g. NERSC's Cori GPU system has 8 NVIDIA V100 per node, while OLCF's Summit system has 6 V100 per node. Thus, depending on the ratio of GPUs to CPU cores, we can have several MPI ranks share the same GPU. For M-TIP, load balancing is simple because each rank does (roughly) the same amount of work, thus we assign GPUs in a round-robin fashion. We use PyCUDA to transfer data between device and host. This allows cuFINUFFT to access \texttt{numpy.ndarray} objects as \texttt{double []}, hence requiring no specialized API calls to convert data between Python and cuFINUFFT. In order to ensure that the PyCUDA API sends the data to the correct device, we manually define the device context. Here is an example of taking a type 1 3D NUFFT with nonuniform coordinates {\tt X}, {\tt Y}, {\tt Z}, and strengths {\tt nuvect} (note: mpi4py provides \texttt{rank}): \begin{python}[language=python] from cufinufft import cufinufft from pycuda.gpuarray import GPUArray, to_gpu # Initialize GPU using round-robin assignment GPUS_PER_NODE = 8 # Cori GPU device_id = rank pycuda.driver.init() device = pycuda.driver.Device(device_id) ctx = device.make_context() ugrid_gpu = GPUArray(shape) # Memory for result plan = cufinufft(1, shape, eps=eps, gpu_device_id=device_id) plan.set_pts(to_gpu(X), to_gpu(Y), to_gpu(Z)) plan.execute(to_gpu(nuvect), ugrid_gpu) \end{python} The cuFINUFFT Python interface allows the user to assign a {\tt cufinufft} plan to a specific device by setting the {\tt gpu\_device\_id} option. See the documentation on GitHub for details. The M-TIP code requires a tolerance of $\varepsilon=10^{-12}$. \begin{table*} \begin{center} \begin{tabular}{c c c c c c c c} \toprule Task & Uniform grid (per rank) & Nonuniform points (per rank) & Density & Parallelism & CPU time [s] & GPU time [s] & GPU time [s] \\ & $N_1=N_2=N_3$ & $M$ & $\rho$ & & (Intel Skylake) & (Cori GPU) & (Summit) \\ \midrule Slicing & $41$ & $1.02\times 10^6$ & $1.86$ & single-rank & $0.11$ & $0.075\quad(1.5\times)$ & $0.076\quad(1.5\times)$ \\ (type 2) & & & & whole-node & $0.95$ & $0.078\quad(12\times)$ & $0.11\quad(8.6\times)$ \\ \midrule Merging & $81$ & $1.64\times 10^7$ & $3.85$ & single-rank & $1.62$ & $1.89\quad(0.9\times)$ & $1.76\quad(0.9\times)$ \\ (type 1) & & & & whole-node & $9.97$ & $1.94\quad(5.1\times)$ & $1.76\quad(5.7\times)$ \\ \bottomrule \end{tabular} \caption{% Problem sizes and average NUFFT wallclock times for a representative M-TIP iteration: NERSC's Cori GPU (Intel Skylake with $8$ NVIDIA V100's) and OLCF's Summit (IBM Power9 with $6$ NVIDIA V100's). The problem sizes are fixed per MPI rank. The CPU code is FINUFFT v1.1.2, with 40 threads on the Intel Skylake. The speedup ratio of single- or multi-GPU cuFINUFFT over the CPU code is shown in parentheses. Rows labeled ``whole-node'' use problems scaled up by the number of GPUs per node---8 for Cori GPU and 6 for Summit---using this same number of ranks (i.e., one rank per GPU). \label{tab:mtip}% } \end{center} \end{table*} \subsection{cuFINUFFT Performance on Cori GPU and Summit} To perform a single-node weak scaling study we used, per rank, the NUFFT problem sizes in Table~\ref{tab:mtip}, which correspond to $10^3$ images. The table shows the average wall-clock time spent performing NUFFTs during slicing (type 2 NUFFT) and merging (type 1 NUFFT) steps for one M-TIP iteration. Comparing the GPU wall-clock times (including data movement) to the equivalent problem running on 40 CPU threads on a single Intel Skylake Cori GPU node (using the FINUFFT code), we find that cuFINUFFT on a single GPU is roughly similar to the CPU times, while for the larger problem distributed over the whole node (multi-GPU) it is 5--12$\times$ faster than on the CPU. \begin{figure} \centering \includegraphics[width=0.48\textwidth]{gpu_weak_large.png} \caption{% Single-node multi-GPU weak scaling on NERSC Cori GPU (left) and OLCF Summit (right). We achieve close to ideal weak scaling (flat lines) up to a number of ranks matching the number of GPUs on the node (vertical dotted line). \label{fig:mtip:scaling}% } \end{figure} Fig.~\ref{fig:mtip:scaling} shows the weak scaling performance on single nodes of NERSC's Cori GPU and OLCF's Summit. Each rank is given the single-rank problem size from Table~\ref{tab:mtip}. Solid lines show the total time including host-device transfer. Crosses show setup time (plan, input and nonuniform point sorting), while squares show NUFFT execution time. In all cases (except type 2 on Summit), we see ideal weak scaling up to one rank per GPU. We found that enabling multi-process service (MPS) made no measurable difference. We see rapid deterioration of weak scaling once each GPU is used by more than one rank, suggesting that cuFINUFFT uses each GPU to capacity. \section{Conclusions} We presented a general-purpose GPU-based library for nonuniform fast Fourier transforms: cuFINUFFT. It supports both transforms of type 1 (nonuniform to uniform) and type 2 (uniform to nonuniform), in 2D and 3D, with adjustable accuracies. By using an efficient kernel function, sorting the nonuniform points into bins, and leveraging shared memory to reduce write collisions, cuFINUFFT obtains a significant speedup compared to established CPU- and GPU-based libraries. On average, we observe a speedup of one order of magnitude over the FINUFFT parallel CPU library. We also observe up to an order of magnitude speedup compared to the CUNFFT GPU library, and more in the case of clustered type 1 transforms. We also see excellent multi-GPU weak scaling in an iterative 3D X-ray reconstruction application. There are several directions for future work. One is extending the library to include 1D and type 3 transforms, but also to use smaller upsampling factors $\sigma$, which can significantly reduce memory size. It is also worth exploring supporting other GPUs via a library that provides a unified hardware API, such as OCCA or Kokkos. \section{Acknowledgments} This research used resources of two U.S. Department of Energy Office of Science User Facilities: NERSC and OLCF (contract \# DE-AC02-05CH11231 and DE-AC05-00OR22725). Johannes Blaschke's work is supported by the DOE OOS in part through DOE's ECP ExaFEL project, Project \# 17-SC-20-SC, a collaborative effort of the Office of Science and the National Nuclear Security Administration. We thank Jeff Donatelli, Chuck Yoon, and Christine Sweeney for work on the M-TIP code, and Georg Stadler for helpful suggestions at various stages of this work. The work was conducted while Joakim And\'en was a visiting scholar at CCM. Part of Yu-hsuan Shih's work was supported through the CCM internship program. The Flatiron Institute is a division of the Simons Foundation. The work of Garrett Wright was supported by the Moore Foundation Award \#9121 Cryo-EM Software Grant. \bibliographystyle{unsrt}
\section{Outline} \singlespacing \section*{Abstract} The year 2020 will be remembered for two events of global significance: the COVID-19 pandemic and 2020 U.S. Presidential Election. In this chapter, we summarize recent studies using large public Twitter data sets on these issues. We have three primary objectives. First, we delineate epistemological and practical considerations when combining the traditions of computational research and social science research. A sensible balance should be struck when the stakes are high between advancing social theory and concrete, timely reporting of ongoing events. We additionally comment on the computational challenges of gleaning insight from large amounts of social media data. Second, we characterize the role of social bots in social media manipulation around the discourse on the COVID-19 pandemic and 2020 U.S. Presidential Election. Third, we compare results from 2020 to prior years to note that, although bot accounts still contribute to the emergence of echo-chambers, there is a transition from state-sponsored campaigns to domestically emergent sources of distortion. Furthermore, issues of public health can be confounded by political orientation, especially from localized communities of actors who spread misinformation. We conclude that automation and social media manipulation pose issues to a healthy and democratic discourse, precisely because they distort representation of pluralism within the public sphere. \section{Introduction} In 2013, the World Economic Forum (WEF)'s annual \textit{Global Risk} report highlighted the multidimensional problems of misinformation in a highly connected world~\cite{WorldEconomicForum2013}. The WEF described one of the first large-scale misinformation instances that shocked America: an event from 1938, when thousands of Americans confused a radio adaptation of the H.G. Wells novel \textit{The War of the Worlds} with an official news broadcast. Many started panicking, in the belief that the United States had been invaded by Martians. Today, it would be hard for a radio broadcast to cause comparably widespread confusion. First, broadcasters have learned to be more cautious and responsible; and second, listeners have learned to be more savvy and sceptical. However, with social media, we are witnessing comparable phenomena on a global scale and with severe geopolitical consequences. A relatively abrupt transition from a world in which few traditional media outlets dominated popular discourse, to a multicentric highly-connected world where information consumers and producers coalesced into one, can bring unparalleled challenges and unforeseen side effects. A sudden democratization in the media ecosystem enables everyone online to broadcast their ideas to potentially massive audiences, thus allowing content that is not necessarily moderated or curated to be broadly accessible. Extreme opinions can become increasingly more visible and fringe groups can start gaining unprecedented attention. Eccentric ideas that would otherwise garner little support within fringe communities, now could make their way into the mainstream. Furthermore, the free canvas of highly connected social media systems has been reportedly exploited by malicious actors, including foreign governments and state-sponsored groups, willing to deliberately misinform for their financial or political gain. Nowadays, the use of social media to spread false news, provoke anxiety and incite fear for political reasons has been demonstrated around the World \cite{Bessi2016, Shao2018, badawy2019falls, Derczynski2019, Badrinathan2020, Mujani2020, Schroeder2020, luceri2019red}. However, social media manipulation is not exclusively tied to political discourse. Public health can also be endangered by the spread of false information. For instance, in January 2019, panic erupted in Mumbai schools caused by social media rumors that the vaccines were a plot by the government to sterilize Muslim children: That led to only 50\% of those who were expected to be vaccinated to actually get the vaccine~\cite{Larson2020}. Researchers from the \textit{Democracy Fund} and \textit{Omidyar Network} in their investigative report titled ``\textit{Is Social Media a Threat to Democracy?}'',~\cite{Deb2017} warn that the fundamental principles underlying democracy ---trust, informed dialogue, a shared sense of reality, mutual consent, and participation--- are being put to the ultimate litmus test by certain features and mechanisms of social media. They point out six main issues: 1) Echo chambers, polarization, and hyper-partisanship; 2) Spread of false and/or misleading information; 3) Conversion of popularity into legitimacy; 4) Manipulation by populist leaders, governments, and fringe actors; 5) Personal data capture and targeted messaging/advertising; and 6) Disruption of the public square. As a matter of research, these six issues can be studied through multiple academic and epistemological angles. \textit{Computational Social Science} has evolved swiftly in the past few years: Students of the social sciences are becoming masters of machine learning, while students of computer science interested in social phenomenon develop domain expertise in sociology, political science, and communication. More so than a methodological evolution, it is a shared critical interest in the growing impact social media platforms play in the very fabric of our society. A special issue documenting ``Dark Participation''~\cite{quandt2018dark} contrasts various issues of misinformation across different governments~\cite{quandt2021can}. Scholars point out an increasingly shared challenge: the balance of combating foreign interference without compromising domestic free speech~\cite{chang2021digital}. The resolution of these issues requires iteration between computational insights and policy-makers, as any type of intervention will inadvertently attract critiques of suppression or create unforeseen side effects. \subsection{Focus of this Chapter} In this chapter, we focus on spread of false and/or misleading information across two salient dimensions of social media manipulation, namely (i) automation (e.g., prevalence of bots), and (ii) distortion (misinformation, disinformation, injection of conspiracies or rumors). We provide direct insight into two case studies: a) the COVID-19 pandemic and b) the 2020 U.S. Presidential Election. We detail the many aspects of large-scale computational projects: a) tracking and cleaning billions of tweets, b) enriching the data through state-of-the-art machine learning, and c) recommendation of actionable interventions in regards to platform governance and online speech policy. While misleading information can materialize in many different forms, it is often scrutinized in the context of current events. Social media allows users to actively engage in discourse in real-time, reacting to breaking news and contributing to the conversation surrounding a particular topic or event with limited filters for what can or cannot be posted prior to publication. Although many social media companies have terms of services and automated filters that remove posts that violate their community guidelines, many of these posts are either able to evade detection long enough such that a wide audience has already seen or engaged with a post, or elude these automated or human-assisted filters completely. Politics and current events as a whole have created an environment that is rife and conducive to the spread of misleading information. Regardless of the alacrity of a post’s removal and the original poster’s broader visibility, as long as misinformation has been posted online, there is the potential for this information to have been seen and consequently consumed by others who can further disseminate it. Social media companies such as Twitter, Facebook and YouTube have recently begun active campaigns to reduce the spread of misinformation and conspiracy theories~\cite{jones2020youtube,yurieff2020twitter}. Fact checkers actively monitor rumors and events. However, the virality and speed at which this information propagates makes it difficult to catch and contain, particularly as alternative social media platforms, such as Parler and Gab, with fewer mitigation measures emerge to allow further misinformation circulation in the ecosystem~\cite{lima2018inside,aliapoulios2021early}. With the recent 2020 U.S. Presidential Election and ongoing COVID-19 pandemic, the need to understand the distortion of information becomes ever more urgent. When we discuss distortion of information, we note a subtle but important distinction between (a) misinformation, the \textit{organic} spread of false or inaccurate information, and (b) disinformation, the \textit{deliberate} spread of misinformation. Although the two terms are closely related, the nuance of purpose differentiates the intent of the distortion. Disinformation, in particular, is often promulgated on social media platforms not only by human users, but also by bots~\cite{shao2017spread, ferrara2018measuring, starbird2019disinformation}. A ``bot'', which is shorthand for the word ``software robot'', is a software based unit whose actions are controlled by software instead of human intervention. While there are many disciplines that leverage this term, we use the term ``bot'' in the context of ``social bots'', which are social media accounts that are either fully controlled by software or have some level of human intervention (semi-automated)~\cite{ferrara2016rise}. \section{Background and Framing} The term \textit{computational social science} evokes not just two disciplines, but their own practices and traditions. In the following, we highlight some important epistemological concepts that inform the study of social media manipulation through the lens of computational and social science theory. \subsection{Epistemology} Although both inductive and deductive reasoning is common in social science research methods, quantitative social science research traditionally holds deductive methods in higher regard. A deductive approach starts from theories and uses data to test the hypotheses stemmed from the theories. Computational social science work conducted by computer scientists often exhibits a data-driven, inductive approach. However, as data science and domain expertise in the social sciences are brought together, computational social science bears great promise to reconcile inductive and deductive reasoning~\cite{evans2016machine}. Exploring large volumes of data, even sans prior theoretical assumptions, may yield new insights or surprising evidence. The findings from this initial, data-driven step will guide us to discern emerging hypotheses and collect new data to test them. This is called the \textit{abductive} analysis~\cite{timmermans2012theory}. It starts with observations, which serve to generate new hypotheses or filter existing hypotheses. The promising hypotheses emerged from data analysis can then be tested deductively with new data. This deductive approach can be used to study the relationship between social media and democratic discourse, which is hardly a direct or linear one. Social media do not inherently undermine or improve democracy. Instead, they affects the quality of democracy through multiple mechanisms such as political polarization and disinformation~\cite{tucker2018social}. These intermediate variables operate in varying contexts shaped by political institutions, political culture and media ecosystems. Therefore, the effects of social media on democracy differ despite the same technological affordances~\cite{benkler2018network}. The political system, ideological distribution, how political elites use social media and the behavioral patterns of different political actors in a given context interact with one another to determine whether political polarization and disinformation are amplified on social media platforms. The interactions amongst all potential political, social and technological variables form a complex system. Data exploration and analysis can help uncover crucial variables operating in a specific context. Our case studies of misinformation in the context of the COVID-19 pandemic and the 2020 U.S. Presidential Election described next will reveal significant factors underlying the relationship between social media use and democracy in the U.S. context and help identify social scientific hypotheses that are worth further investigation. \section{Case-studies} \subsection{Misinformation and COVID-19} We recently found ourselves at the intersection of two important events that have changed the way the world has functioned. 2020 was already going to be a big year for U.S. politics due to the contentious nature of the current political climate. The United States has become more polarized, leading to high anticipation over whether or not the then incumbent President Trump would win re-election. While Trump cinched the Republican nomination, there was a high anticipated battle for the Democratic Presidential nominee~\cite{jacobson2020politifact}. In the midst of the political furor, in late December 2019, the first cases of \textit{novel SARS-COV-2 Coronavirus} (whose caused disease was later named COVID-19) were reported from Wuhan, China~\cite{taylor2021timeline}. As the world began to understand the severity of the illness, whose status was later classified as a pandemic, many countries began to impose lockdowns in attempts to contain the outbreaks~\cite{wu2020coronavirus, taylor2021timeline}. For years, our conversations had already been shifting toward online, with the advent of social media platforms that foster environments for sharing information. Social media has also become more integrated into the fabric of political communication~\cite{romero2011differences}. With the lockdowns that closed offices and forbade gatherings, the discourse surrounding current events was pushed even further onto online platforms~\cite{hadden2020latest, hadden2020companies, fischer2020social, jungherr2016twitter}. This created a breeding ground for potential misinformation and disinformation campaigns to flourish, particularly surrounding health initiatives during a time of heightened political tensions during the 2020 U.S. Presidential Election~\cite{benkler2020mailin}. In our paper published in the \textit{Harvard Misinformation Review} special issue on \textit{U.S. Elections and Disinformation}, we study the politicization of and misinformation surrounding health narratives during this time. We found several major narratives present in our data, and further explored two health-related narratives that were highly politicized: \textit{mask wearing} and \textit{mail-in ballots}. \subsubsection{General Dataset}\label{sec:dataset} We have been actively collecting and maintaining two publicly released Twitter datasets: one focusing on COVID-19 related discourse and the other on the 2020 U.S. Presidential Election \cite{Chen2020, chen2020tracking}. We began the former collection in late January 2020 and the latter in late May 2019. These tweets are collected using the Twitter streaming API, which enables us to gather tweets that match specific keywords or accounts~\cite{twitter_stream}. We note here that, at the time of this writing, the free Twitter streaming API only returns 1\% of the full Twitter data stream. Because of this limitation, we are unable to collect all tweets relevant to COVID-19 and the elections. However, the 1\% returned is still a representative sample of the discourse occurring during that day~\cite{morstatter2013sample}. In this particular case study, we capitalized on both our COVID-19 (v1.12) and elections (v1.3) Twitter datasets, with a focus on the time period from March 1, 2020 through August 30, 2020. At the time that this study was conducted, we had only processed our election data from March 1, 2020 onward. This timeframe covers from Super Tuesday, when a significant number of states hold their primaries, through the end of the Democratic presidential primaries. \subsubsection{COVID-19 and the Democratic Primaries Filtered Dataset} We first filtered our COVID-19 dataset for keywords related to the elections, including the last names of the candidates as well as general elections-related keywords (vote, mailin, mail-in, mail in, ballot). We then conducted Latent Dirichlet allocation (LDA) to identify 8 topics present within the data, using the highest coherence score to determine the optimal number of topics~\cite{blei2003lda}. After sorting tweets into their most probable topic, we leveraged the most frequent hashtags, keywords, bigrams and trigrams to understand the narratives within each identified topic. Four broader narratives emerged: general Coronavirus discourse, lockdowns, mask wearing and mail-in balloting. We then filtered our general COVID-19 and elections dataset for tweets that contained at least one of the aforementioned elections-related keywords and a representative keyword or hashtag from the four major identified topics. This netted us a final dataset of 67,846,555 tweets, with 10,536,524 general Coronavirus tweets, 619,914 regarding lockdowns, 1,283,450 tweets on mask-wearing and 5,900,737 on mail-in balloting. \subsubsection{Discourse} We first wanted to understand how discourse surrounding our four narratives (Coronavirus, lockdowns, mask wearing and mail in balloting) fluctuated over time (see figures \ref{fig:HKS-ballot-covid} and \ref{fig:HKS-lockdown-masks}). We tracked the percentage of all collected tweets on a particular day that contained selected keywords and hashtags that are representative of each narrative. \begin{figure}[!htb] \centering \includegraphics[width =0.9\linewidth]{figures/hks_mailin_covid.png} \caption{Coronavirus and mail-in ballot related tweets within primaries related tweets, plotted as a 3-day rolling average of the percentage of primary related tweets. State abbreviations aligned with the day on which the respective state conducted their Democratic primary.} \label{fig:HKS-ballot-covid} \end{figure} \begin{figure}[!htb] \centering \includegraphics[width =0.9\linewidth]{figures/hks_lockdown_masks.png} \caption{Lockdown and mask related tweets within primaries related tweets, plotted as a 3-day rolling average of the percentage of primary related tweets. State abbreviations aligned with the day on which the respective state conducted their Democratic primary.} \label{fig:HKS-lockdown-masks} \end{figure} \paragraph{Coronavirus.} The pervasiveness of Coronavirus-related tweets in our Twitter dataset is by construction hence unsurprising. Not only was our COVID-19 dataset tracking Coronavirus-related keywords, but this topic has dominated political discourse in the United States since the first case was reported in Washington state on January 21, 2020. In this narrative, we find several prevalent misinformation subnarratives --- including the belief that COVID-19 is a hoax created by the Democratic party and that COVID-19 will disappear by itself~\cite{egan2020trump}. This has also been driven in tandem with the anti-vaccine movement, which has staged protests at COVID-19 vaccine distribution locations~\cite{lozano2021antivaccine}. Hydroxychloroquine (HCQ) also became a highly divisive topic within the Twitter community debating its effectiveness as treatment for COVID-19. During a press conference, then-President Trump stated that he was taking HCQ as a preventative measure~\cite{oprysko2020trump}. The \textit{United States Food and Drug Administration} (FDA) initially issued an emergency use authorization (EUA) for HCQ and the \textit{World Health Organization} included it in its treatment trials. However, the EUA was rescinded and the trials halted as results began to show that HCQ was not an effective treatment or preventative for COVID-19~\cite{edwards2020who, who2020hcq}. The controversy surrounding HCQ shows a shift in factuality surrounding the viability of HCQ, as it was initially unknown if HCQ was indeed viable. Information can develop into misinformation as its factuality changes, which further emphasizes the dangers of spreading medical information without substantive, corroborated scientific evidence. Despite evidence showing that HCQ should not be used as a treatment for COVID-19, this narrative promoting HCQ continued to spread and for many to seek this treatment. \paragraph{Mail-in Ballots.} As fears surrounding COVID-19 began to grow throughout the United States, one of the major concerns with the U.S. Democratic primaries and the upcoming Presidential Election was how voters would be able to vote safely~\cite{bogage2020postmaster}. This caused many states to begin promoting mail-in ballots as a way to safely vote from home during the Democratic primaries. In August 2020, then-President Trump appointed Postmaster Louis DeJoy began reappropriating the United States Postal Service resources, making budget cuts and changing standard mail delivery protocols. This led to a significant slowdown of mail being processed and delivered, including the delivery of ballots, particularly as the U.S. began to prepare for the Presidential Election~\cite{pransky2020mail, cochrane2020postal}. While many were advocating for mail in ballots to be more widely used as COVID-19 precaution, others pushed the narrative that mail in ballots would increase ballot fraud. This misinformation has been proven false by fact checkers, as no evidence in previous election cycles have indicated that mail in ballots or absentee ballots increase voter fraud~\cite{farley2020trump}. This misinformation narrative that was incubating during the primaries season became an even larger misinformation campaign during the U.S. Presidential Election. \paragraph{Lock downs and Masking.} Finally, lock downs and masks were also major themes in our dataset. This is expected, as the United States began to implement social distancing ordinances, such as stay-at-home orders, in March 2020. As more states held their primaries, we see that mentions of lock downs and masks increase, suggesting that online conversation surrounding social distancing and mask wearing is driven by current events. This included misinformation narratives that claimed masks are ineffective and harmful towards one's health, when studies have shown that masks can effectively reduce COVID-19 transmission rates \cite{mueller2020quantitative, farley2020trump, khazan2020bizzare}. \subsubsection{Echo chambers and populist leaders} Out of the four narratives, we further investigate mask-wearing and mail-in balloting, as these two topics contain health-related discourse that became highly politicized and subsequently prone to misinformation. One of the more startling findings was the source of misinformation, specifically the communities in which distortions were concentrated. Figure~\ref{fig:HKS-Network} shows the network topology of Twitter users who have engaged in COVID-19 related elections discourse (see~\cite{Chen2021} for details on the methodology to generate this plot). \begin{figure}[!htb] \centering \includegraphics[width =0.9\linewidth]{figures/HKS-Network.png} \caption{Community structure of COVID-19 related elections discourse~\cite{Chen2021}. a) Shows the political diet of users. b) shows where general misinformation is found. c) shows the distribution of mail-in voting and mask wearing, and the position of the Twitter users. } \label{fig:HKS-Network} \end{figure} Figure~\ref{fig:HKS-Network}a shows the users in our dataset, each data point being colored by ``political information diet''. In order to categorize a user’s information diet, we labeled users who have shared at least 10 posts containing URLs that have been pre-tagged by the Media-Bias/Fact-Check database.\footnote{https://mediabiasfactcheck.com/} This database contains a political leanings-tagged list of commonly-shared domains (left, center-left, center, center-right and right). We found that the majority of the users are center or left-leaning. However, there is also a fairly clear distinction between more homogeneous conservative and liberal clusters near the top of the topology. This suggests that while the majority of users ingest a variety of information from both sides of the aisle, there are still clear signs of polarization based on political views that can be detected in the network topology. This polarization of highly connected clusters also indicates the presence of ``echo chambers''~\cite{jamieson2008echo, du2017echo}. Media-Bias/Fact-Check also contains a list of domains which they deem ``questionable sources'', or sources that are known to prompt conspiracy theories and misinformation. We use this to tag each user with both their political affiliation (Left or Right) and their tendency to spread misinformation or fact. We indicate the users who is more likely to spread misinformation in green in Figure~\ref{fig:HKS-Network}b. From this we observe that while misinformation does occur throughout the user base, conservative clusters are more likely to spread misinformation. We specifically identify a dense cluster of conservative users in the upper right hand of the topology that are more prone to engage with misinformation. Within the mask wearing and mail-in ballot narratives, we manually identified representative hashtags and co-occurring hashtags promoting misinformation or factual information (e.g., \#WearAMask, \#MasksOff, \#VoteByMail, \#VoterFraud). When we visualize this information on the same network topology, it is evident that there is a heterogeneity in the majority of the user’s likelihood to participate in discourse surrounding mask and mail-in ballot misinformation and fact. However, the same dense conservative cluster that we identified earlier appears to have posted tweets related to mail-in ballot and mask misinformation, compared to the left leaning clusters who tended to tweet factual information surrounding mail-in ballots and masks. Interestingly, there seems to be a divide between conservatives who push mail-in ballot misinformation and those that push mask misinformation. Upon closer inspection of the tweets in each cluster, we find that conservatives are not the only ones to participate in misinformation. One of the factual narratives~\cite{sherman2020politifact} that was challenged by left-leaning users was that the Obama administration had not restocked the nation’s supply of N95 masks after the H1N1 outbreak in 2009. However, the divide in misinformation narrative focus in the dense conservative cluster suggests that users within that cluster were prone to engage in misinformation about specific subjects (such as masks or mail-in ballots) instead of misinformation in general. Our findings on the ideological patterns of misinformation on Twitter are consistent with a rising line of research that focuses on the asymmetric polarization in the U.S. context: Some political scientists argue that party polarization in the U.S. is asymmetrical, with Republicans moving more to the right than Democrats to the left~\cite{carmines2011class,hacker2006off,theriault2013gingrich}. This trend was evolving even before the advent of social media. The existing ideological asymmetry affects the exposure to media sources on digital platforms~\cite{faris2017partisanship,brady2019ideological} and leads to asymmetrical consumption of misinformation~\cite{tucker2018social}. It lends support to the existing asymmetric polarization hypothesis and highlights its important role in mediating the relationship between social media and democracy in the United States. \subsection{Misinformation and 2020 U.S. Presidential Election} There is a well known saying that ``the first casualty of war is truth''. In times of unusual social tensions caused by the political struggle with relatively high stakes, the proliferation of false news, misinformation and other sorts of media manipulation is to be expected. The importance of voter competence is one of the postulates of modern democracy~\cite{gant,Stucki2018} and information vacuums can undermine electoral accountability~\cite{ashworth}. An ideal democracy assumes an informed and rational voter, but the former aspect is something that can be undermined or compromised. During the 2020 U.S. Presidential Election, social media manipulation has been observed in the form of (i) automation, that is the evidence for adoption of automated accounts governed predominantly by software rather than human users, and (ii) distortion, in particular of salient narratives of discussion of political events, e.g., with the injection of inaccurate information, conspiracies or rumors. In the following, we describe ours and others' findings in this context. \subsubsection{Dataset} For this study, we again leverage one of our ongoing and publicly released Twitter datasets centered around the 2020 U.S. Presidential Election. Please refer to Section~\ref{sec:dataset} for more details on the collection methods; this particular dataset is further described in ~\cite{Chen2020}. While this dataset now has over 1.2 billion tweets, we focused on tweets posted between June 20, 2020 and September 9, 2020 in advance of the November 3, 2020 election. This subset yielded 240 million tweets and 2 TB of raw data. The period of observation includes several salient real-world political events, such as the \textit{Democratic National Committee} (DNC) and \textit{Republican National Committee} (RNC) conventions. \subsubsection{Automation Detection} The term \textit{bot} (shorthand for robot) in Computational Social Science commonly refers to fully automated or semi-automated accounts on social media platforms~\cite{ferrara2016rise}. Research into automation on social media platforms has spurned its own sub-field not only in computational social sciences but in social media research at large~\cite{ferrara2016rise, shao2017spread, aiello2012people, zelenkauskaite2017information, yang2019arming}. One of the major challenges with automation is the ability to detect accounts that are bots as opposed to accounts fully operated by humans. Although there are benign accounts that publicly advertise the fact that they are automated, bots used for malicious purposes try to evade detection. As platforms and researchers study the behavior of bots and devise algorithms and systems that are able to automatically flag accounts as bots, bot developers are also actively developing new systems to subvert these detection attempts by mimicking behavioral signals of human accounts~\cite{sayyadiharikandeh2020detection, yang2020scalable} Botometer is a tool developed and released by researchers at \textit{Indiana University}, as part of the \textit{Observatory on Social Media} (OSoMe~\cite{davis2016osome}), that allows users to input a Twitter user's screen name, and returns a score of how likely an account is to be automated.\footnote{https://botometer.osome.iu.edu/} These scores range from 0 to 5, with 0 indicating that the account has been labeled as most likely human and 5 indicating that the account is most likely a bot account. We will be referring to accounts that are most likely human accounts as ``human'' and bot-like accounts as ``bots'' for brevity. Botometer itself has gone through several iterations, with the most recent version Botometer v4 released in September 2020~\cite{sayyadiharikandeh2020detection}. Botometer v4 extracts thousands of features from an input account and leverages machine learning models trained on a large repository of labeled tweets to predict the likelihood of an account being a bot. Botometer v4 \cite{yang2020scalable} can identify different types of bots, including bots that are fake followers, spammers and astroturfers~\cite{yang2019arming, ferrara2019history}. \subsubsection{Automation in social media manipulation during 2020 U.S. Presidential Election} In the following analysis, we leveraged Botometer v3~\cite{yang2019arming}, as that was the latest version at the time we performed our study~\cite{Ferrara2020}. We tagged 32 percent of the users within our complete dataset, and removed all tweets not posted by the users for whom we have bot scores for. We labeled the top decile of users according to Botometer scores as ``bots'' and the bottom decile as ``humans''~\cite{Ferrara2020_1}. Our final dataset contains more that four million tweets posted by bots and more than one million tweets posted by humans. We found that a number of the top hashtags used in tweets by bots are affiliated with well known conspiracy theories that will be studied later in this chapter (e.g., \#wwg1wga, \#obamagate, \#qanon) and others are Trump’s campaign related hashtags. In contrast, tweets from humans contain a mix of both Trump and Biden campaign hashtags. We use campaign-related hashtags in order to distinguish between users who engage in left-leaning (Biden campaign) and right-leaning (Trump campaign) political discourse. We find that there are over 2.5 million left-leaning humans, and a little over 18,000 left-leaning bots. Comparatively, we found over 8.5 million right-leaning humans and almost 85,000 right-leaning bots. This enables us to take a snapshot of how right-leaning bots and humans engage in election-related narratives compared to their left-leaning counterparts. What is interesting here is whether or not there are distinguishable features of bots and humans based on their political affiliations and engagements within the network~\cite{luceri2019red}. What we find is that right leaning bots tend to post right-leaning news, with many accounts also posting highly structured (i.e., templated, or copy-pasted) tweets. When we manually inspected a random sample of these tweets, we found that these tweets contained similar combinations of hashtags and oftentimes similarly structured content. Many of the tweets also contained URLs to well known conspiracy news websites. Right-leaning bots also tended to have higher bot scores compared to their left-leaning counterparts, suggesting a more profound use of automation. A manual inspection of a random set of left-leaning bot tweets found that these tweets are significantly less structured, exhibiting fewer automation cues. Although disambiguation by means of specific campaign-related hashtags is not perfect, prior studies investigating political polarization has shown that the vast majority of users posting campaign-specific hashtags align with the same political party~\cite{jiang2020political,bail2018exposure}. We also find that the bot scores for bots range from 0.485 through 0.988, suggesting that the broad range of scores captures accounts that are hybrid accounts, partially automated and partially controlled by humans. \begin{figure}[!htb] \centering \includegraphics[width =0.9\linewidth]{figures/FirstMonday_TS.png} \caption{Time series of activity of bot vs human accounts with political affiliation~\cite{Ferrara2020}.} \label{fig:FM-TS} \end{figure} When isolating the activity of these bot and human accounts and then examining their temporal activity, we see that each group behaves differently. Despite being outnumbered by several orders of magnitude, just a few thousand bots generated spikes of conversations around real-world political events comparable with the volume of activity of humans~\cite{Ferrara2020}. We find that conservatives, both bot and humans, tend to tweet more regularly than liberal users. The more interesting question, beyond raw volume, is whether bots play a community role in polarization. We found both surprising similarities and stark differences across the partisan divide. Figure~\ref{fig:FM-TS} shows the discourse volume of the top 10\% of bots and top 10\% of humans, split between left-leaning accounts (top) and right-leaning accounts (bottom). Although bots tweet in higher volumes in both cases, the activities of left-leaning bots are more localized to specific events. In contrast, right-leaning bots generate large amounts of discourse in general, showing high level of background activity. \begin{figure}[!htb] \centering \includegraphics[width =0.9\linewidth]{figures/FirstMonday_bots.png} \caption{Meso-flow of bot and human accounts by political leaning. a) Total volume of retweets between the four groups. b) Relative volume of retweets between the groups.} \label{fig:FM-meso} \end{figure} Next, we illustrate how do these four groups interact with each other. Figure~\ref{fig:FM-meso} shows the interactions between human and bot accounts divided by political leaning. Bots predominantly retweet humans from within their own party lines, whereas humans retweet other humans from within their party lines. At a relative retweet rate within the same party as more than 80\%, this indicates a significant level of political polarization. \subsubsection{Distortion in social media manipulation during 2020 U.S. Presidential Election} Next, we broaden an analysis to \textit{distortion}, an umbrella concept that also includes completely fabricated narratives that do not have a hold in reality. Fake news are an example of distorted narratives and are conceptualized as \textit{distorted signals uncorrelated with the truth}~\cite{Allcott2017}. To avoid the conundrum of establishing what is true and what is false to qualify a piece of information as fake news (or not), in this study we focus on conspiracy theories, another typical example of distorted narratives. Conspiracy theories can be (and most often are) based upon falsity, rumors, or unverifiable information that resist falsification; other times they are instead postulated upon rhetoric, divisive ideology, and circular reasoning based on prejudice or uncorroborated (but not necessarily false) evidence. Conspiracies can be shared by users or groups with the aim to deliberately deceive or indoctrinate unsuspecting individuals who genuinely believe in such claims~\cite{VanProoijen2019}. Conspiracy theories are attempts to explain the ultimate causes of significant social and political events and circumstances with claims of secret plots by powerful actors. While often thought of as addressing governments, conspiracy theories could accuse any group perceived as powerful and malevolent~\cite{Douglas2019}. They evolve and change over time, depending on the current important events. Upon manual inspection, we found that some of the most prominent conspiracy theories and groups in our dataset revolve around topics such as: objections to vaccinations, false claims related to 5G technology, a plethora of Coronavirus related false claims and the flat earth movement~\cite{Ferrara2020_1}. Opinion polls carried out around the world reveal that substantial proportions of population readily admit to believing in some kind of conspiracy theories~\cite{Byford2011}. In the context of democratic processes including the 2020 U.S. Presidential Election, the proliferation of political conspiratorial narratives could have an adverse effect on political discourse and democracy. In our analysis, we focused on three main conspiracy groups: \begin{enumerate} \item \textbf{QAnon conspiracies:} A far-right conspiracy movement whose theory suggests that President Trump has been battling against a Satan worshipping global child sex-trafficking ring and an anonymous source called 'Q' is cryptically providing secret information about the ring~\cite{Zuckerman2019}. The users who support such ideas frequently use hashtags such as \#qanon, \#wwg1wga (where we go one, we go all), \#taketheoath, \#thegreatawakening and \#qarmy. The examples of a typical tweet from the QAnon supporters are: \begin{displayquote} \textit{''@potus @realDonaldTrump was indeed correct,the beruit fire was hit by a missile, oh and to the rest of you calling this fake,you are not a qanon you need to go ahead and change to your real handles u liberal scumbags just purpously put out misinfo and exposed yourselves,thnxnan''} \end{displayquote} \begin{displayquote} \textit{''I've seen enough. It's time to \#TakeTheOath There's no turning back now. We can and only will do this together. \#WWG1WGA \#POTUS @realDonaldTrump \#Qanon''} \end{displayquote} \item \textbf{``gate'' conspiracies:} Another indicator of conspiratorial content is signalled by the suffix '-gate' with theories such as pizzagate, a debunked claim that connects several high-ranking Democratic Party officials and U.S. restaurants with an alleged human trafficking and child sex ring. The examples of the typical conspiratorial tweets related to these two conspiracies are: \begin{displayquote} \textit{''\#obamagate when will law enforcement take anything seriously? there is EVIDENCE!!!! everyone involved in the trafficking ring is laughing because they KNOW nothing will be done. @HillaryClinton @realDonaldTrump. justice will be served one way or another. literally disgusting.''} \end{displayquote} \begin{displayquote} \textit{''\#Obama \#JoeBiden, \& their top intel officers huddled in the Oval Office shortly before @realDonaldTrump was inaugurated to discuss what they would do about this new president they despised, @TomFitton in Breitbart. Read:...''} \end{displayquote} \item \textbf{Covid conspiracies:} A plethora of false claims related to the Coronavirus emerged right after the pandemic was announced. They are mostly related to scale of the pandemic and the origin, prevention, diagnosis, and treatment of the disease. The false claims typically go alongside the hashtags such as \#plandemic, \#scandemic or \#fakevirus. The typical tweets referring to the false claims regarding the origins of the Coronavirus are: \begin{displayquote} \textit{''@fyjackson @rickyb\_sports @rhus00 @KamalaHarris @realDonaldTrump The plandemic is a leftist design. And it's backfiring on them. We've had an effective treatment for COVID-19, the entire time. Leftists hate Trump so much, they are willing to murder 10's of thousands of Americans to try to make him look bad. The jig is up.''} \end{displayquote} \begin{displayquote} \textit{''The AUS Govt is complicit in the global scare \#Plandemic. They are scarifying jobs, businesses freedom and families in an attempt to stop @realDonaldTrump from being reelected. Why?''} \end{displayquote} \end{enumerate} During the period preceding the 2020 U.S. Presidential Election, \textit{QAnon} related material has more highly active and engaged users than other narratives. This is measured by the average number of tweets an active user has made on a topic. For example, the most frequently used hashtag, \#wwg1wga, had more than 600K tweets from 140K unique users; by contrast \#obamagate had 414K tweets from 125K users. This suggests that the \textit{QAnon} community has a more active user base strongly dedicated to the narrative. When we analyze how the conspiratorial narratives are endorsed by the users, conditioned upon where they fall on the political spectrum, we discover that conspiratorial ideas are strongly skewed to the right. Almost a quarter of users who endorse predominantly right-leaning media platforms are likely to engage in sharing conspiracy narratives. Conversely, out of all users who endorse left-leaning media, approximately two percent are likely to share conspiracy narratives. Additionally, we explore the usage of conspiracy language among automated accounts. Bots can appear across the political spectrum and are likely to endorse polarizing views. Therefore, they are likely to be engaged in sharing heavily discussed topics including conspiratorial narratives. Around 13\% of Twitter accounts that endorse some conspiracy theory are likely bots. This is significantly more than users who never share conspiracy narratives, which have only 5\% of automated accounts. It is possible that such observations are in part the byproduct of the fact that bots are programmed to interact with more engaging content, and inflammatory topics such as conspiracy theories provide fertile ground for engagement~\cite{Stella2018}. On the other hand, bot activity can inflate certain narratives and make them popular. The narratives of these conspiracy theories during the 2020 U.S. Presidential Election call attention to the so-called ``new conspiracism'' and the partisan differences in practicing it~\cite{rosenblum2020lot}. Rosenblum and Muirhead argue that the new conspiracism in the contemporary age is ``conspiracy without theory''. Whereas the ``classic conspiracy theory'' still strives to collect evidence, find patterns and logical explanations to construct a ``theory'' of how malignant forces are plotting to do harm, the new conspiracism skips the burdens of ``theory construction'' and advances itself by bare assertion and repetition~\cite{rosenblum2020lot}. Repetition produces familiarity, which in turn increases acceptance~\cite{paul2016russian,lewandowsky2012misinformation}. A conspiracy becomes credible to its audience, simply because many people are repeating it~\cite{rosenblum2020lot}. The partisan asymmetry in the circulation of conspiracy theories is also consistent with others’ claims that the new conspiracism is asymmetrically aligned with the radical right in the U.S. context~\cite{benkler2018network,rosenblum2020lot}, although this species of conspiracism is not ideologically attached to liberals or conservatives~\cite{rosenblum2020lot}. Our analysis shows the promising direction of testing the theories of asymmetrical polarization and exploring the nature and consequences of asymmetrical media ecosystem, ideally using multi-platform data. The findings about the bot behaviors relative to humans on Twitter reveal some patterns of conspiracy transmission in the 2020 U.S. Presidential Election. Their high-volume and echo-chamber retweeting activities attest to the role that automation plays in stoking the new conspiracism. Bots are capable of retweeting and repeating the same information efficiently. However, bots are not solely to blame for the prevalence of conspiracy-theory stories. False information are found to spread faster than true information due to the human tendency to retweet it. A comprehensive study conducted by Vosoughi \textit{et al.} compared the diffusion of verified true and false news stories on Twitter from 2006 to 2017. They discovered that falsity travels wider and deeper than truth, even after bots were removed, suggesting that humans are more likely to retweet false rumors than true information. Among all topics, political rumors are particularly viral. False rumors peaked before and around the 2012 and 2016 U.S. Presidential Election~\cite{vosoughi2018spread}. Additionally, automated accounts that are part of an organized campaign can purposely propel some of the conspiracy narratives, further polarizing the political discourse. Although bots present a threat to the ideal, well-informed democratic citizenship, the susceptibility of humans to believing and spreading false information is worth equal attention. Further examinations of how distorted narratives go viral will help us better diagnose the problem. Some new research points to the hypothesis that the nature and structure of false rumors and conspiracy-theory stories evoke human interest. For example, Vosoughi \textit{et al.} suggested that false rumors tend to be more novel, hence more salient. False rumors also elicit stronger emotions of surprise and disgust~\cite{vosoughi2018spread}. Tangherlini \textit{et al.} studied the conspiracy theory narrative framework using the cases of \textit{Bridgegate} and \textit{Pizzagate}. They deconstructed those stories into multi-scale narrative networks and found that conspiracy theories are composed of a small number of entities, multiple interconnected domains and separable disjoint subgraphs. By construction, conspiracy theories can form and stabilize faster. In contrast, the unfolding of true conspiracy stories will admit new evidence and result in a denser network over time~\cite{tangherlini2020automated}. Therefore, true stories could be at a disadvantage when competing with false rumors as they are less stable and grow in complexity as events develop. \section{Conclusions} In this chapter, we presented the findings that emerged from two significant events of 2020. In the first study, we showed how political identity aligns with narratives of public health. Four narratives were identified: (i) mail-in ballots, (ii) reference to the pandemic, (iii) lock-downs, and (iv) mask-wearing. Spikes in these narratives were found to be driven by predetermined events, predominantly the primaries. When observing the policy stance of mail-in ballots and mask-wearing, we observe users against mask-wearing and mail-in ballots arise from a dense group of conservative users separate from the majority. Topological distinctions between these two groups are further observed. Further details are found in our recent paper~\cite{chang2021digital}. When investigating the 2020 U.S. Presidential Election more broadly, we find bots not only generate much higher volumes of election-related tweets per capita, but also tweet primarily within their own political lines (more than 80\% for both left- and right-leaning communities). An analysis of content from QAnon-driven conspiracies, politicized ``gate''-related, and COVID-related conspiracies suggested that users self-organize to promulgate false information and also leverage automation to amplify hyperpartizan and conspiratorial news sites: more details are discussed in our associated study~\cite{Ferrara2020_1}. What do these results tell us? First, although bots still generate significant distortions in volume and self-reinforcement across party lines as observed in the 2016 U.S. Presidential Election~\cite{Bessi2016}, this is overshadowed by the self-organization of extremism and ``new conspiracism'' in the public sphere. A further contrast is the shift from foreign interference in 2016 to domestic, ingrown social media manipulation in 2020. This phenomenon can be observed across a variety of case studies, including the populism in EU~\cite{muis2017causes}, xenophobia in Russia, hate speech in Germany~\cite{zhuravskaya2020political}, and foreign interference in Taiwan~\cite{chang2021digital}. Finally, the case study of COVID-19 demonstrates the interplay between public health and politics on a national level. In the past, computational studies on anti-vaccination focused on smaller, community level scales~\cite{lozano2021antivaccine}. Given the high levels of alignment between political information diet and health misinformation, the polarization and subsequent distortions not only can have ramifications on the democratic process, but also tangible effects on public health. \bibliographystyle{unsrt}
\section{Introduction}\label{sec:introduction} \IEEEPARstart{S}{atellite} imagery is mostly acquired from two types of sensors for the purpose of remote sensing. The panchromatic sensor provides a single channel high resolution panchromatic image (HR-PAN) that has high spatial resolution but lacks spectral colors. The second sensor provides a low resolution multispectral image (LR-MSI) containing several bands but lacks high spatial resolution. Combining spatial and spectral characteristics of both sensors (as shown in figure \ref{fig:pansharpening}) is a challenging task in pansharpening. The process of pansharpening aims to produce a high-resolution multispectral image (HR-MSI) by fusing high spatial resolution of panchromatic image and rich spectral information of multispectral image. This results in a tradeoff between spectral and spatial information in the output HR-MSI \cite{loncan2015hyperspectral}. \begin{figure}[h] \centering {\includegraphics[scale=0.8]{Img/fig1_pan.png}} {\includegraphics[scale=0.8]{Img/fig1_mul.png}} {\includegraphics[scale=0.8]{Img/fig1_fused.png}} \caption{\footnotesize Pansharpening example on WorldView-3 Satellite Imagery: Left: Panchromatic Image acquired at $0.31m$ spatial resolution, Middle: Interpolated multispectral image (originally acquired at $1.24m$ spatial resolution), Right: Fused Output } \label{fig:pansharpening} \end{figure} \normalsize \section{Literature Review} The traditional pansharpening methods can be classified into three classes; spectral transformation based component substitution (CS) methods, spatial transformation based multi-resolution analysis (MRA) methods and model based methods. In CS based methods, components such as intensity obtained through spectral transformation of LR-MSI is merged with HR-PAN. Intensity hue saturation (IHS) \cite{ghahremani2016nonlinear}, \cite{li2019model}, multivariate statistical methods such as principal component substitution (PCS) \cite{rahimzadeganasl2019approach}, Gram-Schmidt (GS) spectral transformation \cite{Li2020improving}, and band-dependent spatial-detail (BDSD) schemes \cite{vivone2019robust} are representative methods of this class. The non-linear (NL) IHS method is proposed in \cite{ghahremani2016nonlinear} to optimize the intensity component. In \cite{li2019model} Fast generalized IHS (FGIHS) method uses variational optimization to increase the accuracy of estimated intensity image in the IHS space and to minimize the associated spectral distortion. The authors in \cite{rahimzadeganasl2019approach} recently proposed CS based approach to target HR-MSI by replacing the histogram matched luminance component of upscaled LR-MSI represented in $CIELab$ color space with original HR-PAN. In \cite{Li2020improving} spectral sensitivity is used in conjunction with IHS and Gram-Schmidt transformation. These methods achieve comparable spatial sharpness and improved spectral information in the fused image as compared to conventional CS methods. \textit{Vivone} \cite{vivone2019robust} recently proposed regression and physical constraints based variants of band-dependent spatial-detail (BDSD) approach. In general, CS based methods suffer from distortion owing to the difference between estimated component values and PAN data. % The MRA based methods commonly use multiresolution representations such as Laplacian pyramids (LP) \cite{9024138}, wavelet family transforms \cite{wady2020new}, non-subsampled transforms \cite{lu2017improved}-{\cite{jiao2019pansharpening}, latent low rank (LLR) decomposition \cite{hallabia2019pan} and morphological pyramids (MP) \cite{restaino2016fusion} to extract information from spatially enriched PAN image. MRA based methods are generally superior in terms of spectral preservation but artifacts appear due to subsampling in the PAN image \cite{meng2019review}. Regression based generalised LP framework proposed in \cite{9024138} achieves high quality results on different satellite imagery with heavy computational burden. MRA based method proposed in \cite{wady2020new} decomposes HR-PAN image using non-decimated "$\grave{a}$trous" wavelet transform (ATWT) to produce low resolution PAN image (LR-PAN). Then linearly weighted LR-PAN and re-sampled multispectral image is used to achieve color preservation. In \cite{lu2017improved} non-subsampled contourlet transform (NSCT) has shown comparable performance to BDSD. \textit{Kumar} \cite{kumar2019pan} uses non subsampled shearlet transform (NSST) in order to avoid frequency aliasing and achieving better directional selectivity and shift invariance. In \cite{jiao2019pansharpening}, NSST is used with guided filtering based MRA approach, however the process introduces blurry edges consequently affecting spatial quality. MRA of LLR based composite image is proposed in \cite{hallabia2019pan}. This framework extracts details from reconstructed image using LLR decomposition of HR-PAN and LR-MSI data. In \cite{restaino2016fusion} morphological gradients have been used in a nonlinear pyramidical setting. This scheme shows good results for various satellite imagery. Recently in \cite{li2020image} image segmentation based pansharpening method is proposed to reduce the effect of spectral distortion caused by fused spectra of mixed pixels in MRA based methods In addition to CS and MRA based methods, model based methods pose pansharpening as a local optimization problem. In \cite{chen2019pan} sparse representation and low rank regularization is used in a variational optimization setup however this scheme requires empirical parameter setting and suffers from computational cost for high quality pan sharpening. \textit{Khatheri et al.} \cite{khateri2019model} proposed a model based pan sharpening that uses sparse coefficients with patch dictionary to generate HR-MSI. The fused output preserves image and patch energy ratio as that of LR-MSI. In \cite{wang2019regularised} spatial information regularization is carried out to combat local dissimilarities by optimizing a convex energy function. Spectral consistency based variational optimization model based on half quadratic optimization \cite{yang2009fast} presented in \cite{khateri2019regularised} aims to reduce spectral distortion during pansharpening. This model shows good spectral preservation while also preserving spatial smoothness of HR-PAN. \textit{Tian et al.} \cite{tian2020variational} reported that a general assumption regarding sparse representation based methods is that multi-resolution images are represented by same sparse coding under some dictionaries. They proposed gradient sparse coding based variational model and used gradient similarity based pansharpening. In \cite{wang2018high}, Bayesian model is used to jointly express the LR-MSI, HR-PAN and HR-MSI using multiorder gradients (MoG) optimized by alternating direction method of multipliers (ADMM). In \cite{yang2018pansharpening} spectral and intensity modulation coefficients obtained from spectral and statistical measures of LR-MSI and HR-PAN are combined in an adaptive linear model to strike a balance between spectral and spatial details in target HR-MSI. \textit{Fu et al.} \cite{fu2019variational} formulated HR-MSI problem as a variational optimization problem based on regression and gradient difference of HR-PAN and LR-MSI for spatial preservation. In general, model based methods focus on certain aspects and have high computational cost due to local optimization solvers. Deep learning (DL) based methods assume non-linear mapping between LR-MSI and HR-PAN images. Such methods can be used both in supervised and unsupervised setting. Recently \textit{Guo et al.} \cite{guo2020bayesian} proposed mulitscale recursive block based convolutional neural network (CNN) trained in MOG domain for pansharpening. Residual blocks with multi-scale LP and parameter sharing along network branches is used in \cite{jiang2020learning} to improve fusion performance. In \cite{8668404}, convolutional auto-encoders (CAE) learns the mapping between LR and HR space using degraded PAN and HR-PAN patches. Afterwards CAE based estimated HR-MSI is used to preserve spectral-spatial details in the target HR-MSI. In \cite{li2019cnn} the mapping is estimated by CNN based on pyramid structure to minimize the spectral and spatial dissimilarity in HR-PAN and LR-MSI. \textit{Masi et al.} \cite{masi2016pansharpening} proposed CNN based pansharpening (PNN) method using three-layered architecture. Their stacked network uses interpolated LR-MSI along with HR-PAN image allowing training at the target resolution. \textit{Scarpa et al.} \cite{scarpa2018target} proposed the target-adaptive enhanced version of PNN acronym as PNNplus or PNN+. The deeper network is trained to produce residual pansharpened image corrected by up-sampled LR-MSI through skip connections. In comparison to PNN \cite{masi2016pansharpening} this network achieves better performance using $L1$ loss function for different types of satellite imagery. Inspired by residual network (ResNet)\cite{he2016deep}, \textit{Wei et al.} \cite{wei2017boosting} proposed deep residual PNN (DRPNN) with multiple sparse residual layers to boost the network efficiency. Pansharpening network (PanNet) \cite{yang2017pannet} is a ResNet based DL scheme that incorporates up-sampled LR-MSI for spectral correction in the target super resolved image and high frequency components for edge preservation and avoiding inconsistencies between HR-PAN and HR-MSI image data. PanNet shows good quality fusion for variety of satellite imagery. \textit{Liu et al.} \cite{liu2018psgan} and \textit{Ma et al.} \cite{ma2020pan} demonstrated the use of generative adversarial networks (GANs) for pansharpening. \textit{Lou et al.} \cite{luo2020pansharpening} formulated a new loss function based on original HR-PAN and LR-MSI input pair and target HR-MSI, achieving good spatio-spectral performance for small scale objects. Differential Information residual CNN \cite{jiang2020differential} learns mapping between HR-PAN and LR-MSI and HR-PAN and HR-MSI based on residual block and attention modules to fully cascade high and low frequency components and feature refinement. Deep leaning with CS method is proposed in \cite{qu2020unsupervised} where stacked self-attention modules are used and sub-pixel level spectral details are injected in LR-MSI to obtain target HR-MSI. Similarly \textit{Ozcelik et al.} \cite{ozcelik2020rethinking} have shown in their PSColorGAN that along with color injection, adopting random scale down-sampling strategy during training enhances the overall performance of the network and minimizes the blurring effect. \section{Proposed Scheme} Since most of the satellite sensors including Worldview-4, Ikonos, QuickBird etc provide multispectral image that is acquired at a quarter of a spatial resolution compared to the panchromatic band, the proposed pyramid framework in figure \ref{fig:proposed} uses a two stage decomposition and reconstruction. The proposed pansharpening procedure inherently assumes that, \begin{itemize} \item The low frequencies of the output fused image can be directly obtained by the input multispectral image. \item At each scale, the high frequencies of the output can be estimated by the corresponding high frequencies of panchromatic band but this estimation should be coherent with the low frequencies obtained at the coarser scale. \item The spatial consistency assumption should be followed. For instance, once the output multispectral image is downsampled from $1m$ to $2m$, the residual high frequencies should be proportional to the ones obtained if the current image is again downsampled from $2m$ to $4m$. Figure \ref{fig:proposed} ensures this by sharing the network parameters across two levels of the pyramid. \end{itemize} \begin{figure*}[t] \centering {\includegraphics[scale=0.9]{Img/proposed.png}} \caption{Proposed architecture for pansharpening} \label{fig:proposed} \end{figure*} \begin{figure*}[t] \centering {\includegraphics[scale=0.8]{Img/convNet.png}} \caption{Proposed Network} \label{fig:network} \end{figure*} \begin{figure*}[t] \centering \subfloat[\footnotesize Original Image]{\includegraphics[scale=1]{Img/fig4-Original.png}} \hspace{2pt} \subfloat[\footnotesize PNN \cite{masi2016pansharpening}]{\includegraphics[scale=1]{Img/fig4-PNN.png}} \hspace{2pt} \subfloat[\footnotesize PNN+ \cite{scarpa2018target}]{\includegraphics[scale=1]{Img/fig4-PNNplus.png}} \\ \subfloat[\footnotesize DRPNN \cite{wei2017boosting}]{\includegraphics[scale=1]{Img/fig4-DRPNN.png}} \hspace{2pt} \subfloat[\footnotesize PanNet \cite{yang2017pannet} ]{\includegraphics[scale=1]{Img/fig4-PANNET.png}} \hspace{2pt} \subfloat[\footnotesize VPLG \cite{fu2019variational} ]{\includegraphics[scale=1]{Img/fig4-VPLG.png}} \hspace{2pt} \subfloat[\footnotesize Proposed FuseNet]{\includegraphics[scale=1]{Img/fig4-proposed.png}} \caption{\footnotesize Worldview 2 Pansharpening} \label{fig4:results} \end{figure*} \normalsize \begin{figure*}[t] \centering \subfloat[\footnotesize PNN difference]{\includegraphics[scale=0.4]{Img/fig4-PNN-diff.png}} \hspace{1pt} \subfloat[\footnotesize PNN+ difference]{\includegraphics[scale=0.4]{Img/fig4-PNNplus-diff.png}} \hspace{1pt} \subfloat[\footnotesize DRPNN difference]{\includegraphics[scale=0.4]{Img/fig4-DRPNN-diff.png}} \hspace{1pt} \subfloat[\footnotesize PanNET difference ]{\includegraphics[scale=0.4]{Img/fig4-PANNET-diff.png}} \hspace{1pt} \subfloat[\footnotesize VPLG difference ]{\includegraphics[scale=0.4]{Img/fig4-VPLG-diff.png}} \hspace{1pt} \subfloat[\footnotesize Proposed difference]{\includegraphics[scale=0.4]{Img/fig4-proposed-diff.png}} \caption{\footnotesize Absolute Difference between input and different output images presented in figure \ref{fig4:results}} \label{fig5:diffResults} \end{figure*} \normalsize \subsection{Pyramid based fusion} Let the input panchromatic image $\left(P\right)$ be decomposed into $J$ levels using laplacian pyramids such that, \begin{equation}\label{eq:1} \overline{P}_{j}=\Big(\overline{P}_{j-1}\ast h\Big) \downarrow_2 \hspace{10pt} \forall \hspace{5pt} j\in\{1,2,...,J\} \end{equation} where $\overline{P}_{j}$ represents a low pass output of $j^{th}$ level. For initialization, $\overline{P}_0=P$, while $h$ can be a symmetric and separable low pass filter such as that used in \cite{burt1983laplacian}. The high frequencies at $j^{th}$ level are estimated as an input-output difference, i.e., \begin{equation}\label{eq:2} \hat{P}_{j}=\overline{P}_{j-1} - \Big(\overline{P}_{j}\uparrow_2\Big) \end{equation} Similarly let the $j^{th}$ approximation of the $b^{th}$ band of the multispectral image ($\overline{M}_{b}$) be represented as $\overline{M}_{b,j}$. The upsampled version of the input multispectral image provides the approximation for the $1^{st}$ scale, i.e., \begin{equation}\label{eq:3} \overline{M}_{b,1}=\Big(\overline{M}_{b}\uparrow_2\Big) \end{equation} At each scale the corresponding high frequencies of the panchromatic image are stacked together with low pass approximations of the coarser scale and the image stack is passed through the fusion network to obtain the corresponding scale approximation of the fused image, i.e., \begin{equation}\label{eq:4} S_j = \Big[ \hat{P}_{j}, \overline{M}_{1,j}, \overline{M}_{2,j}, ... , \overline{M}_{B,j} \Big] \end{equation} where $B$ is the total number of input multispectral bands. $S_j$ represents image stack at $j^{th}$ scale obtained by channelwise concatenation of high frequency and low frequency bands. This stack is then passed through the fusion network that estimates the $j^{th}$ scale approximation of the fused image. \begin{equation}\label{eq:recursive} \overline{M}_{b,j+1} = \Big( f_{\text{FuseNet}}(S_j) + \overline{M}_{b,j} \Big) \uparrow_2 \end{equation} where $f_{\text{FuseNet}}(\cdot)$ provides a deep convolutional mapping discussed in the next section. Note that this mapping doesn't vary across scales due to parameter sharing. The skip connection in the form of $\overline{M}_{b,j}$ in eq. (\ref{eq:recursive}) preserves the identity mapping and allows the framework to output the interpolated version of the low resolution input multispectral image in the worst case scenario. The output image $\overline{M}_{b,J}$ is obtained via eq. (\ref{eq:recursive}) in recursive fashion. Given a ground truth image, $M_{b}$, the parameters of $f_{\text{FuseNet}}$ are optimized by minimizing the following loss function, \begin{equation}\label{eq:loss} \mathcal{L}_{2} = \sum_j {\| M_{b,j} - \overline{M}_{b,j} \|} ^ 2 \end{equation} where $M_{b,j}$ represents $j^{th}$ scale approximation of ground truth obtained by summing low and high frequency components of the pyramid, \begin{equation}\label{eq:7} M_{b,j} = \hat{M}_{b,j} + \overline{M}_{b,j} \end{equation} where $\overline{M}_{b,j}$ and $\hat{M}_{b,j}$ represent low and high pass components respectively which are obtained by following eq. (\ref{eq:1}) and eq. (\ref{eq:2}) respectively. \begin{figure*}[t] \centering \subfloat[\footnotesize Panchromatic Image]{\includegraphics[scale=0.6]{Img/fig6-pan.png}} \subfloat[\footnotesize Interpolated Multispectral Image]{\includegraphics[scale=0.6]{Img/fig6-Bilinear.png}} \subfloat[\footnotesize PNN \cite{masi2016pansharpening}]{\includegraphics[scale=0.6]{Img/fig6-PNN.png}} \subfloat[\footnotesize PNN+ \cite{scarpa2018target}]{\includegraphics[scale=0.6]{Img/fig6-PNNplus.png}} \\ \subfloat[\footnotesize DRPNN \cite{wei2017boosting}]{\includegraphics[scale=0.6]{Img/fig6-DRPNN.png}} \subfloat[\footnotesize PanNET \cite{yang2017pannet} ]{\includegraphics[scale=0.6]{Img/fig6-PANNET.png}} \subfloat[\footnotesize VPLG \cite{fu2019variational} ]{\includegraphics[scale=0.6]{Img/fig6-VPLG.png}} \subfloat[\footnotesize Proposed FuseNet]{\includegraphics[scale=0.6]{Img/fig6-proposed.png}} \caption{\footnotesize Full scale Worldview 3 Pansharpening} \label{fig6:results} \end{figure*} \normalsize \subsection{Proposed FuseNet} The proposed fully convolutional FuseNet (shown in figure \ref{fig:network}) provides a residual learning framework while simultaneously combining local and global features in a hierarchical fashion. The output $F_n$ at $n^{th}$ layer is calculated as, \begin{equation}\label{eq:8} F_n = \sigma \Big( W_n \ast F_{n-1} + b_n \Big) \end{equation} where $W_n$ and $b_n$ represent filter weights and bias at $n^{th}$ layer respectively while $\ast$ and $\sigma$ represents convolution and activation function respectively. The first layer extracts a shallow representation from $j^{th}$ input stack $S_j$, i.e., $F_0 = S_j$. The output $F_1$ is then passed onto the stack of $K$ residual learning blocks, each of which learns the local features for fusion. \subsection{Local Feature Fusion Block} The local feature fusion is obtained by passing the input of the block to two consecutive $5\times5$ convolutional layers and then concatenating the two layers alongside the input. The final output feature map of the block is estimated by linear weighting of the concatenated channels which is done using $1\times1$ convolution. Let the output of $n^{th}$ layer at $k^{th}$ local fusion block be represented as $F_{k,n}$, such that, \begin{equation}\label{eq:9} F_{k,n} = \sigma \Big( W_{k,n} \ast F_{k,n-1} + b_{k,n} \Big) \end{equation} Since the filter weights are biases are shared across $K$ blocks, we have, \begin{equation}\label{eq:10} W_{k,n} = W_{k+1,n} = W_{k+2,n} = . . . = W_{K,n} \end{equation} Likewise, \begin{equation}\label{eq:11} b_{k,n} = b_{k+1,n} = b_{k+2,n} = . . . = b_{K,n} \end{equation} The third layer is channel-wise concatenation of the preceding layers, i.e., \begin{equation}\label{eq:12} F_{k,3} = \big[F_{k,0}, F_{k,1}, F_{k,2} \big] \end{equation} The output of $k^{th}$ block \big($F_{k,4}$\big) is finally determined as channel-wise linear weighting of the concatenated layers. \subsection{Global Feature Fusion} Just like feature maps fusion within a block, the output feature maps of multiple blocks are also fused in a hierarchical manner. The shallow feature map ($F_1$) is used as a skip connection and passed as an additional input to each local fusion block, i.e., \begin{equation}\label{eq:13} F_{k,0} = F_{k-1,0} + F_1 \end{equation} Finally the feature output maps of each block are concatenated, \begin{equation}\label{eq:14} F = \big[F_{k,4}, F_{k+1,4}, F_{k+2,4}, . . . , F_{K,4} \big] \end{equation} The feature maps in $F$ are then linearly weighted via $1\times1$ convolution and passed through another $5\times5$ convolutional layer, which outputs $B$ number of output channels. \begin{center} \begin{table*}[t] \centering \renewcommand{\arraystretch}{1.5} \caption{Reduced scale pansharpening quality assessment. Best value according to each metric is highlighted.} \begin{tabular}{|p{2cm}|p{1.35cm}|p{1.35cm}|p{1.35cm}|p{1.35cm}||p{1.35cm}|p{1.35cm}|p{1.35cm}|p{1.35cm}|} \hline Scheme & \multicolumn{4}{c||}{WorldView 2 (Average on 171 Images) } & \multicolumn{4}{c|}{WorldView 3 (Average on 100 Images) } \\ \cline{2-9} & QAVE & SAM & ERGAS & SCC & QAVE & SAM & ERGAS & SCC \\ \hline PNN \cite{masi2016pansharpening} & 0.7300 & 5.5836 & 4.0532 & 0.8440 & 0.7711 & 8.3305 & 7.3133 & 0.7888 \\ \hline PNN+ \cite{scarpa2018target} & 0.7193 & 5.7245 & 4.2630 & 0.8167 & 0.6385 & 9.4245 & 7.7605 & 0.4968 \\ \hline DRPNN \cite{wei2017boosting} & 0.7569 & 5.1577 & 4.0459 & 0.8539 & 0.8269 & 7.0739 & 5.1512 & 0.8331 \\ \hline PanNet \cite{yang2017pannet} & 0.7458 & 4.7030 & 3.9146 & 0.8394 & 0.8607 & 4.8948 & 4.2456 & 0.8674 \\ \hline VPLG \cite{fu2019variational} & 0.7479 & 3.9255 & 3.1048 & 0.8771 & 0.9117 & 4.3710 & 3.2945 & 0.8944 \\ \hline Proposed & \textbf{0.7905} & \textbf{3.7099} & \textbf{2.8622} & \textbf{0.9014} &\textbf{0.9145} &\textbf{3.9535} & \textbf{2.8946} &\textbf{0.9297} \\ \hline \end{tabular} \label{table:1} \end{table*} \end{center} \begin{center} \begin{table*}[t] \centering \renewcommand{\arraystretch}{1.5} \caption{Full scale pansharpening quality assessment. Best value according to each metric is highlighted.} \begin{tabular}{|p{2cm}|p{1.35cm}|p{1.35cm}|p{1.35cm}||p{1.35cm}|p{1.35cm}|p{1.35cm}|} \hline Scheme & \multicolumn{3}{c||}{WorldView 2 (Average on 254 Images) } & \multicolumn{3}{c|}{WorldView 3 (Average on 177 Images) } \\ \cline{2-7} & $Q_\lambda$ & $Q_s$ & $QNR$ & $Q_\lambda$ & $Q_s$ & $QNR$ \\ \hline PNN \cite{masi2016pansharpening} & 0.1318 & 0.2189 & 0.6908 & 0.0870 & 0.1044 & 0.8221 \\ \hline PNN+ \cite{scarpa2018target} & 0.0829 & 0.1624 & 0.7734 & 0.0558 & 0.1098 & 0.8410 \\ \hline DRPNN \cite{wei2017boosting} & 0.1192 & 0.2207 & 0.7043 & 0.0661 & 0.0662 & 0.8742 \\ \hline PanNet \cite{yang2017pannet} & 0.0779 & 0.1719 & 0.7726 & 0.0402 & 0.0576 & 0.9058 \\ \hline VPLG \cite{fu2019variational} & \textbf{0.0315} & 0.1661 & 0.8100 & \textbf{0.0132} & 0.0462 & \textbf{0.9412} \\ \hline Proposed & 0.0504 & \textbf{0.1237 }&\textbf{0.8377} & 0.0224 & \textbf{0.0418 } & 0.9372 \\ \hline \end{tabular} \label{table:2} \end{table*} \end{center} \section{Experiments} Every convolutional layer of FuseNet uses $48$ number of feature maps except the last $5\times5$ layer which outputs $B$ number of output channels. The parameters at each layer are initialized using Xavier initialization \cite{glorot2010understanding} while the total loss is minimized using ADAM optimizer \cite{kingma2014adam} with a learning rate of $1e^{-3}$. Training is done with a batch size of $20$ and patch size of $192\times192$. Leaky rectified linear unit (Leaky ReLU) with a negative slope of $0.2$ is used as activation function throughout the network. The tensorflow code alongwith training and testing dataset is available at \href{https://github.com/sohaibali01/deep_pyramid_fusion}{github} \footnote{\url{https://github.com/sohaibali01/deep_pyramid_fusion}}. \subsection{Reduced Scale Quality Assessment} Since satellite sensors do not provide a ground truth multispectral image at the same high resolution as that of panchromatic image, a common trend is to consider the available low resolution multispectral image as ground truth and simulate the input panchromatic and multispectral images by following Wald's protocol \cite{loncan2015hyperspectral} \cite{wald1997}. Like \cite{yang2017pannet} the input panchromatic and multispectral images are simulated by downsampling original images with a factor of $4$. The output is then compared against the ground truth multispectral image using SAM \cite{yuhas1992discrimination}, relative dimensionless global error in synthesis (ERGAS) \cite{wald2002data}, universal image quality index averaged over the bands (QAVE) \cite{wang2002universal} and spatial correlation coefficient (SCC) \cite{zhou1998wavelet}. \subsubsection{8-band Pansharpening} The current work focusses on sensors that provide $8$ multispectral bands alongwith the panchromatic band. These include Worldview2 and Worldview3 which acquire images at different spatial resolutions. Free sample imagery is collected from the internet and a dataset comprising of $431$ images is created, with each image having dimensions of $512 \times 512$. $254$ samples out of $431$ belong to Worldview2 satellite and the remaining $177$ come from Worldview3 satellite. Instead of training the model separately for these two sensors, we train the model jointly on $160$ out of $431$ images selected randomly. The testing is performed on all of the remaining samples. The proposed scheme is compared with state of the art deep learning models including Pansharpening with convolutional Neural Networks (PNN) \cite{masi2016pansharpening}, PNN+ \cite{scarpa2018target}, Deep Residual Pansharpening Neural Network (DRPNN) \cite{wei2017boosting} and PanNet \cite{yang2017pannet}. The pre-trained models of all of these schemes are already available online. In addition to deep learning models, recently proposed Variational Pansharpening with Local Gradient constraints (VPLG) \cite{fu2019variational} is also included in comparison. Figure \ref{fig4:results} presents a sample visual comparison between state of the art pansharpening schemes on Worldview2 satellite image while figure \ref{fig5:diffResults} shows the difference of each output scheme with the reference image. PNN produces color distortion in figure \ref{fig4:results}(b) which is also confirmed since the difference image in figure \ref{fig5:diffResults}(a) seems biased towards red channel. Visually figure \ref{fig4:results}(e) appears the most crisp image but the corresponding difference image in figure \ref{fig5:diffResults}(d) suggests that PanNET produces extra sharp edges that are not present in the reference image. VPLG produces blurring artifacts highlighted in red box in figure \ref{fig4:results}(f). Compared with the rest, the proposed scheme in \ref{fig5:diffResults}(f) produces least amount of differential edges. Table \ref{table:1} quantifies state of the art pansharpening schemes using SAM \cite{yuhas1992discrimination}, ERGAS \cite{wald2002data}, QAVE \cite{wang2002universal} and SCC \cite{zhou1998wavelet}. QAVE and ERGAS measure global distortion while SAM and SCC measure spectral and spatial distortion in the output respectively. Table \ref{table:1} suggests that the proposed scheme outperforms state of art in minimizing both spatial and spectral distortions. \subsection{Full Scale Quality Assessment} The models pretrained on reduced scale images are also tested on input images at full scale. In the absence of ground truth, the input low resolution multispectral image is used as spectral reference and the panshromatic image is used as spatial reference. QNR \cite{alparone2008multispectral} is used as an evaluation metric that doesn't need a ground truth reference. QNR itselt measures global distortion but internally measures spectral distortion ($D_\lambda$) and spatial distortion ($D_s$) separately. The values of $D_\lambda$ and $D_s$ should be low, resulting in high value of QNR in the ideal scenario. Figure \ref{fig6:results} shows visual comparison of different pansharpening schemes on Worldview3 satellite images at full scale. One can see the artifacts around edges of rooftop most noticeably in PNN+ (figure \ref{fig6:results}d) and VPLG (figure \ref{fig6:results}g). Table \ref{table:2} suggests that VPLG performs quite close to the proposed scheme. A major difference in table \ref{table:2} is that VPLG minimizes spectral distortion ($D_\lambda$) better while the proposed scheme minimizes spatial distortion ($D_s$) better in comparison with the rest. \section{Conclusion} This paper proposes a pyramid based deep pansharpening network that minimizes spatial and spectral distortions in a hierarchial fashion. Each level of the pyramid is trained by stacking the low resolution multispectral image obtained at the previous level and the corresponding high frequencies of the panchromatic image at that particular level. The residual component in the form of low resolution multispectral components preserves the spectral mapping between input and output. Experiments suggest that the proposed multiresolution framework outperforms state of the pansharpening models. \bibliographystyle{IEEEtran}
\section{Introduction} \citeasnoun{warren1941x} was ahead of his time when he observed that certain heat treated carbon blacks appear to comprise a sequence of equally spaced graphite layers with some random rotation and parallel translation between them. In a paper published the next year, \citeasnoun{Warren1942} decided to name this type of disorder among layers \emph{turbostratic disorder}. The authors used the word to describe \emph{``graphite layers stacked together roughly parallel and equidistant, but with each layer having a completely random orientation about the layer normal"} while \citeasnoun{Disorder_first_second} state \emph{``When all the layers are randomly misoriented, the stack is (ideally) turbostratic and there are no Bragg reflections other than those belonging to the $00l$ series."} In the ensuing years, the meaning of the word turbostratic has evolved, with a widely cited paper by \citeasnoun{LI20071686} allowing turbostratic disorder to include layers that are shifted, rotated and curved over some non-uniform probability distribution. This broad definition of the word turbostratic is the definition we will use in this paper, with the goal of bringing together a broad range of disorders under the same mathematical framework. The notion of turbostratic disorder was developed by \citeasnoun{ShiThesis} to model carbon blacks as a sequence of turbostratically disordered carbon layers that each depend on their preceding layer. Moreover, \citeasnoun{Shihw0018} have written a program CARBONXS that computes the scattering cross section of their theoretical carbon blacks. The performance of CARBONXS has been compared by \citeasnoun{ZHOU201417} to GSAS, a traditional Rietveld refinement program that does not take turbostratic effects into account, suggesting that an appreciation of turbostratic disorder is necessary to obtain a good fit to X-ray diffraction data. Since Shi's models are a good fit for carbon blacks, the material appears to truly comprise a Markov chain of turbostratically disordered carbon layers. However, since Shi's model allows carbon layers to be shifted both parallel and perpendicular to the basal plane by any magnitude, there is an uncountable infinity of positions a carbon layer may find itself in. Carbon blacks therefore comprise a Markov chain of layers with infinite state space, and are therefore not fully understood by the analysis of chains with finite state space explored by \citeasnoun{riechers2015pairwise} \citeasnoun{varn2016did} and \citeasnoun{MarkovPaper1}. The properties of carbon blacks are well worth exploring, as the material has many applications including the moderation of neutrons \cite{ZHOU201417}, lithium-ion batteries \cite{ShiThesis}, and the manufacture of rubber \cite{UNGAR2002929} Aside from carbon blacks, it is now well known \cite{Huang2017} \cite{Razado-Colambo2016} that layers of \emph{graphene} can be stacked atop one another with rotation between them adopting an angle $\theta \in [-\frac{\pi}{6}, \frac{\pi}{6}]$ taking one of an uncountable infinity of values. The rotation can adopt any angle, but the 6 fold rotational symmetry of graphene allows us to work in the restricted range $\theta \in [-\frac{\pi}{6}, \frac{\pi}{6}]$. It is intriguing that a particular countably infinite subset of $[-\frac{\pi}{6}, \frac{\pi}{6}]$ has been the object of great interest and fruitful research among the nanoscience community; specifically the countable set of angles $\theta_i$ for which a pair of layers differing by these angles form a moir\'{e} pattern. Under these angles a twisted bilayer forms a superlattice, and the resultant crystal takes on a so called commensurate structure. \citeasnoun{PhysRevLett.99.256802} derived an expression for the moir\'{e} angles $\theta_i$ as exactly the set of angles satisfying \begin{align} \cos(\theta_i) = \frac{3i^2 + 3i + 1/2}{3i^2 + 3i + 1} \end{align} for $i = 0, \ 1, \ 2, \ ...$ . An illustration of the superlattice produced when a pair of layers differ by an angle $\theta_1$ is shown in Figure \ref{superlattice}. The electronic properties of moir\'{e} graphene are rich and exotic, and have become subject of a huge international research effort; see for example \citeasnoun{Huang2017}, \citeasnoun{Razado-Colambo2016} \citeasnoun{doi:10.1021/nl204547v}, \citeasnoun{doi:10.1021/nl301137k}, or \citeasnoun{superconducting_angle}, where the most recent authors identified a magic angle where a twisted bilayer becomes a superconductor. Though the moir\'{e} angles are importantly distinct from the other rotation angles, the latter are still of interest, in fact \citeasnoun{Bistritzer26072011} have remarked that for all other angles $\theta$, a twisted bilayer has no unit cell, but has instead a quasi-periodic structure with its own set of properties. \begin{figure} \centering \includegraphics[]{Moire_graphene.pdf} \caption{An example of a moir\'{e} superlattice with angle $\theta_1 \approx 21.8^\circ$.} \label{superlattice} \end{figure} Most of the relevant nanoscience literature is focused on the simplest interesting model - a single twisted bilayer - but by stacking several layers atop eachother one can form twisted $n$-layer graphene \cite{doi:10.1021/nl301137k}. Assuming any one of the $n$ layers' angle of rotation depends only on a previous layer's angle of rotation, twisted $n$-layer graphene can be described by Markov chain with either a countable or an uncountable number of layer types; depending on whether we insist the rotation angles are moir\'{e}, or allow them to take any value in $[-\frac{\pi}{6},\frac{\pi}{6}]$. In any case, the rotation angles would follow a probability distribution, which has been sought experimentally by \citeasnoun{doi:10.1021/nl204547v} who attempted to infer it from scattering data. Their empirical distribution is compared to torque each atom is subject to, as well as the potential energy per atom. Smectites (clays) are another class of turbostratically disordered materials. They have been scrutinised under Rietveld refinement by \citeasnoun{Ufer:2008:0009-8604:272} and \citeasnoun{Turbostratic2009} but the turbostratic effects have not been treated rigorously, and may have a more natural description in the framework presented here. \section{The scattering cross section} For a crystal composed of otherwise identical layers that differ only by rotation, translation, or change in curvature, the structure factor of the layers are related too. In particular, a layer's structure factor is related by a Fourier transform to the layer's atomic positions, which are related by some rotation, translation or curvature map to the atomic positions of some other layer. To formalise this idea, suppose an arbitrarily chosen reference layer is composed of a periodic array of unit cells. Then for a given unit cell, we express positions in reciprocal space $\vec{Q}$ with reciprocal primitive lattice vectors $\vec{a}^*, \vec{b}^*,$ $\vec{c}^*$ and real numbers $h,k,$ and $l$ such that \begin{align} \vec{Q} = 2 \pi (h \vec{a}^* + k \vec{b}^* + l \vec{c}^*). \end{align} Hence, a unit cell comprising $N$ atoms, each with an atomic form factor $f_j$ and position $\vec{r}_j$ with $j = 1 \ ... \ N$ has structure factor $ F_{\text{unit}}$ given by \begin{align} F_{\text{unit}} = \sum_{j=1}^{N}f_{j}e^{-i \vec{Q}\cdot\vec{r}_j}. \end{align} The structure factor of an entire layer of unit cells is \begin{align} F = \sum_{(m_1 , m_2) \in \mathcal{D}}\sum_{j=1}^{N}f_{j}e^{-i \vec{Q}\cdot(\vec{r}_j + m_1\vec{a} + m_2\vec{b})} \\ = F_{\text{unit}}\sum_{(m_1 , m_2) \in \mathcal{D}}e^{-i(m_1\vec{Q}\cdot\vec{a} + m_2\vec{Q}\cdot\vec{b})} \\ = F_{\text{unit}}\sum_{(m_1 , m_2) \in \mathcal{D}}e^{- 2 \pi i(m_1 h + m_2 k)} \end{align} where $\vec{a}$ and $\vec{b}$ are the primitive lattice vectors that span the basal plane and $\mathcal{D}$ is some subset of $\mathbb{Z}^2$ defining the shape of the layer. If for example the layers are elliptical then $\mathcal{D} \subset \mathbb{Z}^2$ represents some set of lattice nodes enclosed by an ellipse, which we might expect for layers of carbon black crystallites given that \citeasnoun{UNGAR2002929} found the crystallites themselves to be ellipsoidal. If we consider a simpler case of each layer being rectangular with equal dimensions \begin{align} \mathcal{D} = [0, ... ,N_a-1] \times [0, ... , N_b-1] \end{align} then we obtain the structure factor of a single layer \begin{align} F = F_{\text{unit}}\sum_{(m_1 , m_2) \in \mathcal{D}}e^{-2 \pi i(m_1 h + m_2 k)} \\ = F_{\text{unit}}\sum_{m_1 = 0}^{N_a-1} e^{-2 \pi im_1 h} \sum_{m_2 = 0}^{N_b-1} e^{-2 \pi im_2 k} \\ = F_{\text{unit}}\frac{\sin(N_a \pi h)}{\sin(\pi h)}\frac{\sin(N_b \pi k)}{\sin(\pi k)}e^{-i(N_a-1)\pi h}e^{-i(N_b-1)\pi k} \label{structure_factor_of_layer} \end{align} where the last line follows from the definition of the Dirichlet kernel. The contribution of this layer to the scattering pattern $S$ is $\abs{F}^2$ allowing us to recover a perhaps familiar expression \begin{align} S = \abs{F_{\text{unit}}}^2\frac{\sin(N_a \pi h)^2}{\sin(\pi h)^2}\frac{\sin(N_b \pi k)^2}{\sin(\pi k)^2}. \end{align} The term \begin{align} \eta(\vec{Q}) = \frac{\sin(N_a \pi h)^2}{\sin(\pi h)^2}\frac{\sin(N_b \pi k)^2}{\sin(\pi k)^2} \end{align} is called the shape function, can be modified to represent the different shapes crystallites can take. This is discussed by \citeasnoun{Shihw0018}, \citeasnoun{Warren_text} and \citeasnoun{ERGUN1976139}. Next, we consider the structure factors of two layers that differ by some rotation. Suppose the rotation is defined by the orthonormal matrix $X$, then we multiply $X$ to the position $\vec{r}_j$ of each atom in the unit cell, as well as the lattice vectors themselves, and find the structure factor $F^X$ of the rotated layer is \begin{align} F^X = \sum_{(m_1 , m_2) \in \mathcal{D}}\sum_{j=1}^{N}f_{j}e^{-i \vec{Q}\cdot(X\vec{r}_j + m_1X\vec{a} + m_2X\vec{b})} \\ = F_{\text{unit}}^X \sum_{(m_1 , m_2) \in \mathcal{D}} e^{-i(m_1\vec{Q}\cdot (X\vec{a}) + m_2\vec{Q}\cdot (X\vec{b}))} \end{align} where $F_{\text{unit}}^X$ is the unit cell of a rotated layer with expression \begin{align} F_{\text{unit}}^X = \sum_{j=1}^{N}f_{j}e^{-i \vec{Q}\cdot (X \vec{r}_j)}. \end{align} It follows that the structure factor of a rotated layer that is also rectangular is \begin{align} F^X = F_{\text{unit}}\frac{\sin(N_a \pi h_{X})}{\sin(\pi h_{X})}\frac{\sin(N_b \pi k_{X})}{\sin(\pi k_{X})}e^{-i(N_a-1)\pi h_{X}}e^{-i(N_b-1)\pi k_{X}} \label{rotated_layer} \end{align} where \begin{align} h_{X} = \vec{Q} \cdot ( X \vec{a} ) \\ k_{X} = \vec{Q} \cdot ( X \vec{b} ) \nonumber \\ l_{X} = \vec{Q} \cdot ( X \vec{c} ). \nonumber \end{align} The next example is a layer that differs only by a translation $\vec{v}$ from a layer with structure factor $F$. The translated layer has structure factor $F^{\vec{v}}$ related to $F$ via the simple relation \begin{align} F^{\vec{v}} = Fe^{-i \vec{Q}\cdot\vec{v}}. \end{align} Usefully, when layers differ by some linear transformation (rotation or translation) the structure factor of each layer can be expressed as a periodic arrangement of unit cells with translational symmetry, where each layer type's unit cell is related by some transformation to the unit cell of another layer type. However, this feature does not apply to layers that differ by some nonlinear transformation like change in curvature, which was discussed by \citeasnoun{LI20071686} when describing disordered layers of graphite. In fact for a reference layer with structure factor $F$, a second layer differing from the reference by a nonlinear transformation $\phi$ has structure factor \begin{align} F^{\phi} = \sum_{(m_1 , m_2) \in \mathcal{D}}\sum_{j=1}^{N}f_{j}e^{-i \vec{Q}\cdot\big(\phi(\vec{r}_j + m_1\vec{a} + m_2\vec{b})\big)}. \end{align} The nonlinearity of $\phi$ means we cannot factorise out the structure factor of a unit cell; which is consistent with physical intuition. One would not expect a curved layer to comprise a periodic array of identical unit cells because some cells would be curved more than others. Consequently, instead of thinking about aperiodic crystals as comprised of unit cells, it is safer to think of them as comprised of layers, that cannot (in general) be broken down into constituent cells. With the preamble about structure factors out the way, we are in a position to approach the differential scattering cross section (or scattering pattern) of an aperiodic crystal. First of all, suppose a crystal is composed of a sequence of layers, labelled in order from $n = 0, ... ,N_c$. Each layer has a type (or structure factor) indexed by the set $\mathcal{A}$. If the number of layer types is finite, then $\mathcal{A}$ is some finite subset of the positive integers $\mathbb{N}$. If $\mathcal{A}$ is countably infinite then we let $\mathcal{A} = \mathbb{N}$ and if uncountably infinite we allow $\mathcal{A} \subset \mathbb{R}^n$ to be open and connected. The structure factor of each layer is labelled $F_n$, so the structure factor of the entire crystal $\psi$ is \begin{align} \psi = \sum_{n=0}^{N_c} F_n e^{2 \pi i n l} \end{align} and it follows that the cross section has expression \begin{align} \frac{d \sigma}{d \Omega} = \abs{\psi}^2 = \sum_{n=0}^{N_c}\sum_{m=0}^{N_c} F_n F^*_{m} e^{2 \pi i (n - m) l}. \end{align} Now, $F_n F_m^*$ is the average structure factor product $Y_{m-n}$ discussed by \citeasnoun{PhysRevB.34.3586}, obtained by taking expectation over the distribution of structure factor pairs separated by $m-n$ layers. When $\mathcal{A}$ is countable, we can write this down as \begin{align} Y_{m-n} = F_n F_m^* = \sum_{x \in \mathcal{A}}\sum_{y \in \mathcal{A}}F(x)G_{m-n}(x,y)F^*(y) \end{align} where $G_{m}(x,y)$ is the pair correlation function between layers $x,y \in \mathcal{A}$ where $y$ is $m$ layers ahead of $x$, and $F(x)$ and $F(y)$ are the structure factors of $x$ and $y$ respectively. If $\mathcal{A} \subset \mathbb{R}^n$ then similarly \begin{align} Y_{m-n} = \int_{ \mathcal{A}}\int_{ \mathcal{A}}F(x)G_{m-n}(x,y) F^*(y) dx dy. \label{Average_structure_factor_product} \end{align} We can then recover the expression for the differential scattering cross section presented by \citeasnoun{PhysRevB.34.3586} and derived by \citeasnoun{wilson1942imperfections} \begin{align} \frac{d \sigma}{d \Omega} = \sum_{n=0}^{N_c}\sum_{m=0}^{N_c} Y_{m-n} e^{2 \pi i (n - m) l} \\ = \sum_{m_3 =-N_c}^{N _c}(N_c - \abs{m_3})Y_{m_3} e^{2 \pi i m_3 l}. \label{Cross_section} \end{align} For completeness, we note that the dimension of the crystal $N_a, N_b, N_c$ may not be the same for every crystal in a sample, but could in general follow some distribution. \citeasnoun{UNGAR2002929} for example, report that carbon blacks have log-normal size distribution. In this case the observed scattering pattern would be obtained by summing the cross section over each dimension times the probability of a crystallite adopting that dimension. \subsection{Powder averaging} Suppose a powder sample of a crystal is placed into a flat tray with normal vector $\hat{n}$. The powder average $I(Q)$ of the cross section is given by \begin{align} I(Q) = \int_{\partial B_Q} \frac{d \sigma}{d \Omega} (\vec{Q}) \omega(\vec{Q}) \ dS(\vec{Q}) \end{align} where we are integrating over the sphere of radius $Q = |\vec{Q}|$ and have introduced the spherically symmetric preferred orientation function $\omega(\vec{Q})$ to represent the probability density that crystallite's normal vector is rotated by angles $(\theta, \varphi)$ from $\hat{n}$ where $(\theta, \varphi)$ are the spherical polar angles of the vector $\vec{Q}$. An illustration of this is shown in Figure \ref{polar_coords}. \begin{figure} \includegraphics[]{polar_coords.pdf} \label{polar_coords} \caption{The probability density that a crystallite centred at the origin is oriented such that it's normal vector is in the direction of the vector $\vec{Q}$ with polar angle $(\theta,\varphi)$ is $\omega(\vec{Q})$. A point in the reciprocal lattice coordinates $\vec{Q} = (h,k,l)$ is represented in Cartesian coordinates by $(h',k',l')$. The vector normal to the sample tray $\hat{n}$ is parallel to $l'$.} \end{figure} The preferred orientation function $\omega$ is introduced because crystallites in a container often align with the geometry of the container, resulting in some orientations being more likely than others. In the special case that all orientations are equally likely, \begin{align} I(Q) = \frac{1}{4 \pi Q^2}\int_{\partial B_Q} \frac{d \sigma}{d \Omega} (\vec{Q}) \ dS(\vec{Q}). \end{align} Numerically computing either of these integrals is not easy because the the cross section $\frac{d \sigma}{d \Omega}(\vec{Q})$ is, roughly speaking, close to zero everywhere except for points surrounding $\vec{Q}$ where $h,k,l$ are all integers. At these points the cross section is highly peaked. As the size of a crystallite grows the peaks become taller and thinner, converging to delta functions in the limit of infinite crystallite size. Na\"{i}ve quadrature does not perform well on integrands with many thin peaks, so should be avoided for computing the powder average of big crystallites. If the crystals are indeed big, a common method of computing the powder average is to numerically integrate each peak separately and sum the contributions. One can also employ the tangent-cylinder approximation derived by \citeasnoun{doi:10.1107/S0365110X51001409} and discussed by \citeasnoun{Shihw0018} to speed up the integration of each peak. An alternative to numerical integration is to derive an expression for the powder average using a Harmonic expansion, which does not require numerical integration over the sphere! We shall present a version of this for the simplest case that $\omega(\vec{Q}) = 1 / 4\pi Q^2$, which may be adequate for a highly disordered material. Let $L^{m_3}_{ij}(x,y)$ denote the distance between the $i$th atom in a layer of type $x$ and the $j$th atom of a layer type $y$ for layers $x,y$ separated vertically by $m_3$ layers. When we talk about distance, we assume a unit length is $2 \pi |\vec{c}^*|$. It is shown in Appendix \ref{powder_average_appendix} that \begin{align} I(Q) = \sum_{m_3 =-N_c}^{N _c}(N_c - \abs{m_3}) \int_{\mathcal{A}}\int_{\mathcal{A}} G_{m_3}(x,y) \\ \times \sum_{i = 1}^{n_x} \sum_{j = 1}^{n_y} f_i f_j \text{sinc}\big(QL^{m_3}_{ij}(x,y)\big) dx dy. \nonumber \label{powder_avg} \end{align} The term \begin{align} \sum_{i = 1}^{n_x} \sum_{j = 1}^{n_y} f_i f_j\text{sinc}\big(QL^{m_3}_{ij}(x,y)\big) \end{align} is highly related to Debye's equation, who's 100th birthday was recently celebrated by \citeasnoun{Scardi:me0628}. \section{Finitely many hidden states} It remains now to define the pair correlation function $G_m(x,y)$ which captures the probability of sampling from a crystal a layer of type $x$, then finding a layer of type $y$ $m$ layers ahead of $x$. To this end, we maintain the assumption of \citeasnoun{varn2013machine}, \citeasnoun{riechers2015pairwise}, and \citeasnoun{Varn201547} that the sequence of layers follows a Hidden Markov Model. In particular when the set of hidden states $\mathbb{S}$ and layer types $\mathcal{A}$ are finite, the Hidden Markov Model (HMM) is an ordered quintuple $\Gamma = (\mathcal{A},\mathbb{S},\mu_0,\mathcal{T},V)$ where the terms are exactly those defined by \citeasnoun{MarkovPaper1} in their Appendix A. In particular the probability of a layer adopting a hidden state $j \in \mathbb{S}$ can be represented as the element of a vector $v$. Given the hidden state of the HMM is $i \in \mathbb{S}$, then the probability of a transition to $j \in \mathbb{S}$ is the $ij$th element of a transition matrix $\mathcal{T}$. This matrix represents an operator which maps a distribution of hidden states $v$ of some layer to the distribution of hidden states $w$ of the next layer, which is to say \begin{align} \mathcal{T} v = w. \end{align} For a layer with hidden states following a distribution $v$, the layer found $m$ layers ahead has hidden state following the distribution $u$ which is related to $v$ by \begin{align} \mathcal{T}^m v = u. \end{align} The stationary distribution $\pi$ of $\mathcal{T}$ represents the probability distribution over the set of hidden states obtained by sampling a layer from the crystal. A sufficient condition for $\pi$ to exist and be unique is that the Markov Chain induced by $\mathcal{T}$ is positive recurrent, which means from any state $s$ the probability of eventual return to $s$ state is unity. Further since, \begin{align} \mathcal{T} \pi = \pi \end{align} we have that $\pi$ is an eigenvector of $\mathcal{T}$ with eigenvalue $1$. Every hidden state emits a symbol from the alphabet according to some distribution that depends on the hidden state. Even if the number of hidden states is finite, the alphabet of symbols $\mathcal{A}$ could be finite, countably infinite or uncountably infinite. The theory presented by \citeasnoun{riechers2015pairwise} and \citeasnoun{MarkovPaper1} assumes $\mathcal{A}$ is finite, and therefore that the probability distribution over symbols from the hidden state $s \in \mathbb{S}$ is a vector $v_s \in V$. Further, the probability of emitting a symbol $x \in \mathcal{A}$ is one of the entries of the vector $v_s$, denoted $v_s(x)$. This present paper extends the existing theory by stating that if $\mathcal{A}$ is countably infinite then $v_s$ is an infinite sequence with $x$th term $v_s(x)$ and if $\mathcal{A} \subset \mathbb{R}^n$ is uncountably infinite, then $v_s$ is a probability density function $v_s(x)$. To distinguish these cases, the ordered quintuple $\Gamma$ defining the HMM either contains vectors, sequences, or probability density functions for $\mathcal{A}$ finite, countably infinite and uncountably infinite respectively. Whatever the cardinality of $\mathcal{A}$, the pair correlation function $G_m(x,y)$ is given by \begin{align} G_{m}(x,y) = \sum_{r \in \mathbb{S}}\sum_{s \in \mathbb{S}} v_r(x) \pi_{r}\mathcal{T}^m_{rs} v_s(y) \label{Pair_Correlation_Finite_S} \end{align} where $\mathcal{T}^m_{rs}$ is the $rs$th element of the matrix $\mathcal{T}^m$. With the expression for the pair correlation \eqref{Pair_Correlation_Finite_S} and cross section \eqref{Cross_section} together, we obtain a direct expression for the cross section of a crystal with finitely many hidden states, and any of finitely, countably infinitely or uncountably infinitely layer types. Section \ref{finite_state_space_uncountable_alphabet} runs through an application of this expression. \subsection{A finite state space and uncountable alphabet} \label{finite_state_space_uncountable_alphabet} Suppose we have a finite state space and uncountable alphabet. Then for each state $r \in \mathbb{S}$ there is a probability density function $v_r(x)$ over the alphabet of symbols $\mathcal{A} \subset \mathbb{R}^n$. It is shown in Appendix \ref{FSSUA} that the cross section for such a crystal can be expressed \begin{align} \frac{d \sigma}{d \Omega} = Re \bigg\{\Tr \big( \Diag(\pi)H(2S + N_c I) \big) \bigg\} \label{Finite_state_space_cross_section} \end{align} where $H$ is a Hermitian matrix with dimension equal to that of $\mathcal{T}$ with $rs$th element \begin{align} h_{rs} = \int_{\mathcal{A}} v_r(x)F(x) dx \int_{\mathcal{A}} v_s(y)F^*(y) dy. \end{align} Moreover \begin{align} S = \sum^{N_c}_{m = 1}(N_c - m) (\mathcal{T}e^{2 \pi i l})^m \end{align} while $\Diag(\pi)$ is the diagonal matrix with elements the stationary vector $\pi$, $I$ is the identity matrix, $\Tr$ is the trace operator and $Re\{ z \}$ denotes the real part $z \in \mathbb{C}$. It may be useful to note that \begin{align} S = \sum^{N_c}_{m = 1}(N_c - m) (\mathcal{T}e^{2 \pi i l})^m \\ = \mathcal{T} e^{2 \pi i l} \big( (\mathcal{T} e^{2 \pi i l})^{N_c} - N_c( \mathcal{T} e^{2 \pi i l} - I ) - I \big)\big( \mathcal{T} e^{2 \pi i l} - I \big)^{-2} \end{align} when $\big( \mathcal{T} e^{2 \pi i l} - I \big)^{-2}$ exists. This model includes a class of crystals that, in the absence of turbostratic disorder, comprise a finite number of layer types, where the probability of some layer type following another depends on the previous layer type. Each hidden state represents a layer type without turbostratic disorder, while the distribution over the alphabet of symbols represents the distribution over possible disorders a particular layer type could adopt. A simple, if perhaps unrealistic, example is a crystal composed of $2$ layer types labelled $A$ and $B$, which adopt some turbostratic disorder like a rotation, translation, or nonlinear deformation over some distributions $v_1(x)$ and $v_2(x)$ respectively. Suppose the probability given a layer is type $A$ that the next is also type $A$ is $\alpha$ and the probability that if a layer is type $B$ that the next will be type $A$ is $\beta$. Then the transition matrix between hidden states $A$ and $B$ takes the form \begin{align} \mathcal{T} = \begin{bmatrix} \alpha & 1-\alpha \\ \beta & 1-\beta \end{bmatrix}. \end{align} For this toy model, we can expand the expression for the cross section $\eqref{Finite_state_space_cross_section}$ and arrive at \begin{align} \frac{d \sigma}{d \Omega} = \frac{2}{(1-\alpha)(\beta - \alpha + 1)} \\ \times Re \bigg\{ s_1\big[\beta(h_{11} - h_{12}) + (1-\alpha)(h_{22} - h_{21})\big] \nonumber \\ + s_2\big[ (1-\alpha)(h_{11} + h_{12}) + \beta(h_{22} + h_{21}) \big]\bigg\} \nonumber \\ + \frac{h_{11} + h_{22}}{1 - \alpha} \nonumber \end{align} where \begin{align} s_{1} = \begin{cases} \frac{N_c}{2}(N_c - 1) \text{ if $e^{2 \pi i l} = 1$ } \\ \frac{e^{2 \pi i l} (e^{2 \pi i l N_c} + N_c(1 - e^{2 \pi i l} ) - 1)}{(1 - e^{2 \pi i l})^2} \text{ otherwise,} \end{cases} \end{align} and \begin{align} s_{2} = \begin{cases} \frac{N_c}{2}(N_c - 1) \text{ if $(\alpha - \beta)e^{2 \pi i l}$ = 1} \\ \frac{(\alpha-\beta) e^{2 \pi i l} ( (\alpha-\beta)^{N_c} e^{2 \pi i l N_c} + N_c(1 -(\alpha-\beta) e^{2 \pi i l} ) - 1)}{(1 - (\alpha-\beta) e^{2 \pi i l})^2} \text{ otherwise.} \end{cases} \end{align} We can see that multiplying out the matrices and taking the trace generates an expression that is long and hard to read even for the simplest case of a crystal with 2 hidden states! Consequently, we consider a cross section defined once we have determined the transition matrix $\mathcal{T}$, the stationary distribution $\pi$ and the matrix $H$. We will now explore a more sophisticated model, with a concrete application to carbon blacks. \subsubsection{Recovery of Shi's model} \citeasnoun{ShiThesis} wrote a thesis about the crystal structure of disordered carbons to better understand their role as an electrode in lithium-ion batteries. Part of this document includes two sophisticated models of turbostratic carbon blacks, which can be fitted to scattering data using the program CARBONX written by \citeasnoun{Shihw0018}. CARBONX was recently picked up by \citeasnoun{ZHOU201417} who compared the performance of Shi's model to the standard Rietveld refinement program GSAS for describing the cross section of disordered carbons obtained from a range of sources. \citeasnoun{ZHOU201417} found that Shi's account of turbostratic disorder improved the fit, suggesting the turbostratic disorder is much like \citeasnoun{ShiThesis} describes. The remainder of this section will express both Shi's 1 layer model and 2 layer model as hidden Markov models, where each hidden states emits a disordered layer over some distribution dependent on the state. For both of these models, we will obtain the transition matrix $\mathcal{T}$, the matrix $H$ and stationary vector $\pi$, hence arrive at an expression for the cross section. We'll start with the 1 layer model, noting that these carbon blacks have 4 hidden states, we will label 1, 2, 3, 4. States $1,2,3$ enumerate the layer types $A,B,C$ while the hidden state $4$ represents a layer that has slipped across the basal plane in a random direction with random magnitude with uniform probability. According to Shi's 1 layer model model, for some probability $P$ of slippage across the basal plane, the transition matrix looks like \begin{align} \mathcal{T} = \begin{bmatrix} 0 & \frac{1 - P}{2} &\frac{1 - P}{2} &P \\ \frac{1 - P}{2} & 0 & \frac{1 - P}{2} & P \\ \frac{1 - P}{2} & \frac{1 - P}{2} & 0 & P \\ \frac{1 - P}{3} & \frac{1 - P}{3} & \frac{1 - P}{3} & P \end{bmatrix} \end{align} which has stationary vector \begin{align} \pi = \frac{1}{4} \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \end{bmatrix}. \end{align} In addition to the possibility of a layer slipping across the basal plane, Shi's model stipulates that all layers may be shifted in the direction orthogonal to the basal plane. The probability of no shift occurring is denoted $g$, but if some shift does occur, the shift adopts a magnitude following a normal distribution centred at zero with variance $\sigma^2$. The probability density of a layer $n = 1, 2, 3$ being displaced by $z$ in the direction orthogonal to the basal plane therefore has expression \begin{align} w(z) = g \delta(z) + (1-g)\frac{1}{\sqrt{2 \pi}\sigma}\exp\bigg(\frac{-z^2}{2 \sigma^2}\bigg). \label{norm_dist} \end{align} The alphabet $\mathcal{A}$ for Shi's 1 layer model is uncountable and comprises ordered pairs $x = (z,n)$ where $n \in \{1,2,3,4 \}$ denotes whether the 0 disorder layer is type $A,B,C$ or the 4th type that slipped across the basal plane, while $z$ is the displacement of that layer orthogonal to the basal plane and follows distribution $\eqref{norm_dist}$. The structure factor of a layer $x \equiv (n,z)$ can therefore be written \begin{align} F(x) = F(z,n) = F_n(z) \end{align} and we have that a layer $A$ (which has hidden state $1$) with 0 displacement orthogonal to the basal plane has unit cells with a structure factor \begin{align} F_1^{\text{unit}}(0) = 2 f \cos\bigg( \frac{2 \pi}{3}(h+k) \bigg) \end{align} where $f$ is the form factor of a carbon atom. Consequently, if we make the simplifying assumption that all layers are rectangular with the same dimensions, then the structure factor of the layer $A$ with 0 orthogonal displacement is (by equation \eqref{structure_factor_of_layer}) \begin{align} F_1(0) = 2 f \cos\bigg( \frac{2 \pi}{3}(h+k) \bigg)\frac{\sin(N_a \pi h)}{\sin(\pi h)}\frac{\sin(N_b \pi k)}{\sin(\pi k)} \\ \times e^{-i(N_a-1)\pi h}e^{-i(N_b-1)\pi k}. \nonumber \end{align} The layers $A,B,C$ with displacement $z$ have structure factors \begin{align} &F_1(z) = F_1(0) e^{2 \pi i z l} \\ &F_2(z) = F_1(0) e^{2 \pi i( z l + (h + k)/3)} \nonumber \\ &F_3(z) = F_1(0) e^{2 \pi i( z l - (h + k)/3)} \nonumber \end{align} respectively. Now the probability of a hidden state $n$ emitting a symbol $x \in \mathcal{A}$ is given by the probability density function $v_n(x)$ so \begin{align} \int_{\mathcal{A}}v_n(x) F(x) dx = \int_{\mathbb{R}}w(z) F_n(z) dz \\ = e^{2 \pi i \phi_n}F_1(0)\int_{\mathbb{R}}w(z) e^{2 \pi i zl} dz \\= e^{2 \pi i \phi_n}F_{1}(0)\mathcal{F}[w](l) \end{align} where $\mathcal{F}[w]$ is the Fourier transform of $w$ \begin{align} \mathcal{F}[w](l) = g + (1-g)\exp \bigg( -\frac{ \sigma^2 l^2}{2} \bigg) \end{align} and \begin{align} \phi_n = \begin{cases} 0 &\text{ if $n = 1$} \\ (h+k)/3 &\text{ if $n = 2$} \\ -(h+k)/3 &\text{ if $n = 3$} \end{cases} \end{align} is introduced for notational convenience. Shi made the assumption that total contribution to the scattering pattern from the layers translated across the basal plane is zero, so we choose $v_4(x)$ and $F(x)$ such that \begin{align} \int_\mathcal{A} v_{4}(x)F(x)dx = 0. \end{align} This gives us an expression for $H$ \begin{align} H = \abs{F_1(0)\mathcal{F}[w](l)}^2 \\ \times \begin{bmatrix} 1 & e^{-2/3 \pi i(h + k)} &e^{2/3 \pi i(h + k)} &0 \\ e^{2/3 \pi i(h + k)} & 1 & e^{-2/3 \pi i(h + k)} & 0 \\ e^{-2/3 \pi i(h + k)} & e^{2/3 \pi i(h + k)} & 1 & 0 \\ 0 & 0 & 0 & 0 \end{bmatrix} \nonumber. \end{align} With $\mathcal{T}$, $\pi$ and $H$ we have all we need to evaluate equation \eqref{Finite_state_space_cross_section} and obtain the cross section for Shi's 1 layer model. Shi's 2 layer model is similar, and in the formalism of this paper has 7 hidden states each comprising pairs of conventional layers $AB$, $AC$, $BA$, $BC$, $CA$, $CB$ as well as a layer $XX$ translated somewhere across the basal plane. Like the 1 layer model, layers are displaced in the direction orthogonal to the basal plane according to distribution \eqref{norm_dist}, but this time with $g = 0$. We enumerate these layer types from $1$ to $7$ and obtain the transition matrix according to Shi's description \begin{align} \mathcal{T} = \begin{bmatrix} P_t & 0 & 0 & 0 & \bar{P} & 0 & P \\ 0 & P_t & \bar{P} & 0 & 0 & 0 & P \\ 0 & 0 & P_t & 0 & 0 & \bar{P} & P \\ \bar{P} & 0 & 0 & P_t & 0 & 0 & P \\ 0 & 0 & 0 & \bar{P} & P_t & 0 & P \\ 0 & \bar{P} & 0 & 0 & 0 & P_t & P \\ \frac{1-P}{6} & \frac{1-P}{6} & \frac{1-P}{6} & \frac{1-P}{6} & \frac{1-P}{6} & \frac{1-P}{6} & P \end{bmatrix} \end{align} where $\bar{P} = 1 - P_t - P$ and $P_t$, $P$ and $\bar{P}$ are probabilities summing to 1. The stationary vector is \begin{align} \pi = \frac{1}{7} \begin{bmatrix} 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \\ 1 \end{bmatrix}. \end{align} Now to obtain $H$, first let \begin{align} &\varphi_1 = 1 + e^{2 \pi i( c l + (h + k)/3)} \\ &\varphi_2 = 1 + e^{2 \pi i( c l - (h + k)/3)} \nonumber \\ &\varphi_3 = e^{2 \pi i(h + k)/3} + e^{2 \pi i c l} \nonumber \\ &\varphi_4 = e^{2 \pi i (h + k)/3} + e^{2 \pi i( c l - (h + k)/3)} \nonumber \\ &\varphi_5 = e^{- 2 \pi i (h + k)/3} + e^{2 \pi i c l} \nonumber \\ &\varphi_6 = e^{ - 2 \pi i (h + k)/3} + e^{2 \pi i ( c l + (h + k)/3)} \nonumber \\ &\varphi_7 = 0, \nonumber \end{align} which we have introduced for notational convenience. The structure factor for layer types $(n,z)$ are \begin{align} F_n(z) = F_1(0)e^{2 \pi i z l}\varphi_n \end{align} for $n = 1$ to $6$. Now the matrix $H$ has elements \begin{align} h_{nm} = \abs{F_1(0)\mathcal{F}[w](l)}^2\varphi_n\varphi_m, \end{align} where we have for $n > 6$ or $m > 6$ that $h_{nm} = 0$ by construction, because the 2 layer model (similar to the 1 layer model) assumes \begin{align} \int_\mathcal{A} v_{7}(x)F(x)dx = 0. \end{align} Both of Shi's models make specific assumptions that simplify the mathematics and allow the models to be expressed concisely, but are not necessarily physically principled. For example the 2 layer model accounts for normally distributed turbostratic spacing between pairs of layers, but not for disorder within a pair of layers. Moreover, certain transitions e.g. $AB$ to $AC$ are assumed impossible, even though they are physically plausible. By framing Shi's model in the HMM framework, we can straight forwardly modify the model to encompass any disorder we like, while retaining a neat expression for the cross section. Recommending specific improvements to Shi's model is beyond the scope of this paper, which instead presents these examples to demonstrate that the HMM framework is flexible and general enough to describe a wide range of turbostatic materials. \section{Uncountably many hidden states} Having examined a HMM with a finite number of hidden states, we will now move on the stranger world of uncountably many hidden states. If $\mathbb{S}$ is uncountably infinite then a probability distribution over $\mathbb{S}$ is given by some probability density function $v$. We suppose $\mathbb{S} \subset \mathbb{R}^n$ is open, connected and bounded. Since the integral of $v$ over $\mathbb{S}$ must equal unity, $v$ is necessarily square integrable and therefore in the Hilbert space of square integrable functions $L^2$. Given the states are distributed according to $v$, the distribution over hidden states at the next layer $w \in L^2$ is \begin{align} \int_{\mathbb{S}}k(r,s)v(r) dx = w(s) \end{align} where $k(r,s)$ represents the probability density of $s \in \mathbb{S}$ following $r \in \mathbb{S}$ and is called the transition kernel. This gives rise to an integral operator $\mathcal{T}:L^2 \to L^2$ defined \begin{align} (\mathcal{T}v)(s) = \int_{\mathbb{S}}k(r,s)v(r) dx. \end{align} The probability of sampling from the crystal a layer with hidden type $r$ is given by the probability density function $\pi(r)$ which exists, is unique and satisfies \begin{align} \mathcal{T}\pi = \pi \end{align} if the transition kernel $k(r,s)$ is positive recurrent. If it exists, the stationary distribution $\pi$ is an eigenvector of the operator $\mathcal{T}$ with eigenvalue one. Given a distribution over hidden states $v$, the distribution over hidden states of a layer $w$ after $m$ transitions satisfies \begin{align} \mathcal{T}^m v = w. \end{align} The pair correlation function for a crystal with uncountably many hidden states is therefore \begin{align} G_m(x,y) = \int_{\mathbb{S}}\int_{\mathbb{S}} v(r,x)\pi(r)(\mathcal{T}^m \delta_r)(s)v(s,y) dr ds \end{align} where $\delta_r(s)$ is the shifted delta function $\delta(r-s)$ where we interpret \begin{align} (\mathcal{T}^m\delta_r)(s) = (\mathcal{T}^{m - 1}\mathcal{T}\delta_r)(s) \\ = (\mathcal{T}^{m - 1}k_r)(s) \end{align} where $k_r$ is the probability density function $k_r(s) \equiv k(r,s)$. \subsection{Special case of a Markov chain} Suppose the probability of a layer being a certain type depends only on the type of the previous layer, then we have a Markov chain of layer types. This is a special case of a HMM where every hidden state emits a symbol with probability 1 and no two states emit the same symbol. Formally, this is obtained by letting $\mathbb{S}=\mathcal{A}$ and letting $V$ be the identity map. For a Markov chain of layers adopting one of uncountably many layer types, the pair correlation function reduces to \begin{align} G_m(x,y) = \pi(x)(\mathcal{T}^m \delta_x)(y). \end{align} With this, we show in Appendix \ref{UncountableAppendix} that the cross section of a crystal described by a Markov chain, with an uncountable infinite of layer types is \begin{align} \frac{d \sigma}{d \Omega} = \label{UCCS} 2 Re \Bigg\{ \int_{\mathcal{A}}\int_{\mathcal{A}}F(x)F^*(y)\pi(x)Z\delta_x(y) dx dy \Bigg\} \\ + N_c \int_{\mathcal{A}} \abs{F(x)}^2 \pi(x) dx \nonumber \end{align} where $Re\{z\}$ represents the real part of the complex number $z \in \mathbb{C}$, while $\delta_x(y)$ is the shifted delta function $\delta(x-y)$ and $Z:L^2 \to L^2$ is a linear operator defined \begin{align} Z &\equiv \sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3})(e^{2 \pi i l}\mathcal{T})^{m_3} \end{align} where we interpret $Z\delta_x(y)$ as the evaluation at $y$ of the function $Z\delta_x$. Expression \eqref{UCCS} for the cross section is quite unwieldy, demanding the evaluation of both a double integral and repeated application of the operator $\mathcal{T}$. Using numerical integration for this task may not be a good idea. A possible approach is to approximate the infinite state space as large but finite, hence discretising the structure factors and state distributions - collapsing the problem to the case of a large but finite state space. Alternatively, one can follow the lead of \citeasnoun{PhysRevB.34.3586}, \citeasnoun{Hansen2008}, \citeasnoun{0953-8984-20-28-285105} and compute the cross section using a Monte Carlo simulation. When the state space $\mathbb{S}$ is finite, \citeasnoun{MarkovPaper1} argue that the Monte Carlo approach is much slower than computing the cross section explicitly using matrix operations. However, for an uncountable state space the problem of computing the cross section explicitly boils down to recursively computing integrals, which is generally much harder. In the upcoming sections, we consider special cases of \eqref{UCCS} that admit to further analysis and yield expressions that are faster to compute and perhaps more informative. \subsection{Compact and self-adjoint transition operator} The first of these cases requires that $\mathcal{T}$ is a compact, self-adjoint operator on the Hilbert space of square integrable functions $L^2$. These conditions hold for a crystal where the probability density of a state $y$ following state $x$ is equal to the probability density of state $x$ following $y$; which is to say $k(x,y) = k(y,x)$. This condition is sufficient (but not necessary) to imply that the Markov chain of layers describing the crystal is \emph{reversible}, representing a special type of crystal that appears the same (in some statistical sense) when turned upside-down. The significance of these reversible crystals is treated extensively by \citeasnoun{Ellison2009} and discussed in the context of ice and opal by \citeasnoun{MarkovPaper1}. For a crystal comprising layers that differ (for example) only by some rotation or translation, the probability density of a layer rotated to angle or position $y$ following a layer rotated to angle or position $x$ must equal the probability density of a layer at angle or position $x$ following one at angle or position $y$. We note here that this idea could in principle apply to a much broader class of disorders. With the assumption that $\mathcal{T}$ is a compact self-adjoint operator on some Hilbert space, the Spectral Theorem provides an expression for the cross section \begin{align} \frac{d \sigma}{d \Omega} = \label{UCCSadj} 2 Re \Bigg\{ \sum_{n \in \Lambda} s_n\int_{\mathcal{A}}F(x) \pi(x) u_n(x) dx \int_{\mathcal{A}} F^*(y) u_n(y) dy \Bigg\} \\ + N_c \int_{\mathcal{A}} \pi(x) \abs{F(x)}^2 dx \nonumber \end{align} where \begin{align} s_{n} = \begin{cases} \frac{N_c}{2}(N_c - 1) \text{ if $\lambda_n e^{2 \pi i l}=1$ } \\ \frac{\lambda_n e^{2 \pi i l} ( \lambda_n^{N_c} e^{2 \pi i l N_c} + N_c(1 - \lambda_n e^{2 \pi i l} ) - 1)}{(1 - \lambda_n e^{2 \pi i l})^2} \text{ otherwise,} \end{cases} \label{s_n} \end{align} and $u_n$ and $\lambda_n e^{2 \pi i l}$ the eigenvectors and eigenvalues of $e^{2 \pi i l}\mathcal{T}$ indexed by the set $\Lambda$ which repeats eigenvalues according to their algebraic multiplicity. The details are fleshed out in Appendix \ref{self_adj_app}. \subsection{A convolution kernel} \label{conv_ker} The second case applies to a so-called convolution kernel $k$ on an uncountable state space, which requires for some $n \in \mathbb{N}$ that $\mathcal{A}$ is the open hypercube of dimension $n$ denoted $\mathcal{A} = (0,1)^n$ and that \begin{align} k(x,y) \equiv \sum_{m \in \mathbb{Z}^n}P(m+y-x) \label{conv_ker_defn} \end{align} for some probabilty distribution $P$ in the Hilbert space of square integrable functions $L^2$. If we return to the example of a crystal composed of layers that differ only by a rotation, we can interpret condition \eqref{conv_ker_defn} as insisting that the angle of rotation between any pair of layers follows the same probability distribution $P$. The summation over $m$ represents the fact that a rotation to angle $\theta$ is equal to a rotation to angle $\theta + 2m\pi$ for all $m \in \mathbb{Z}$ so we let the space $\mathcal{A} = (0,1)$ and interpret for $x \in \mathcal{A}$ that $2\pi x$ is a layer's angle of rotation. Now $n$ represents the dimension of the state space $\mathcal{A}$, and equals 1 here. If for example, layers were identical up to some translation in any of three directions, then the state space $\mathcal{A}$ would be three dimensional and $n$ would adopt the value 3 and $\mathcal{A} = (0,1)^3$. We note that $P(y-x) = P(x-y)$ does not hold in general, so $\mathcal{T}$ is not necessarily self-adjoint even if it has a convolution kernel. We also remark that the stationary distribution $\pi$ of the operator $\mathcal{T}$ with convolution kernel is uniform. With this established, we present in Appendix \ref{UncountableAppendix} a derivation for the cross section of a crystal with kernel $P$ \begin{align} \frac{d \sigma}{d \Omega} = Re \Bigg\{ \int_{\mathcal{A}}2F(x)(F^* \circledast s)(x) + N_c \abs{F(x)}^2 dx \Bigg\} \label{UCCS_wS} \end{align} with $a \circledast b$ representing the convolution of $a$ with $b$ and the function $s \in L^2$ satisfying \begin{align} \mathcal{F}[s] = \begin{cases} \frac{N_c}{2}(N_c - 1) \text{ if $\mathcal{F}[P]e^{2 \pi i l} = 1$} \\ \frac{\mathcal{F}[P] e^{2 \pi i l} ( \mathcal{F}[P]^{N_c} e^{2 \pi i l N_c} + N_c(1 - \mathcal{F}[P] e^{2 \pi i l} ) - 1)}{(1 - \mathcal{F}[P] e^{2 \pi i l})^2} \text{ otherwise,} \end{cases} \label{s_in_L2} \end{align} where $\mathcal{F}[\phi]$ represents the Fourier transform of $\phi \in L^2$. Given a choice of $P$, the function $s \in L^2$ does not have an analytic form in general, but can be approximated numerically using at most 2 Fast Fourier Transforms (FFTs). The first FFT is used to compute $\mathcal{F}[P]$, if the transform cannot be obtained analytically, from which we can find $\mathcal{F}[s]$ via equation \eqref{s_in_L2}. The second FFT is used to find the inverse transform of $\mathcal{F}[s]$, yielding $s$. That said, computing $s$ explicitly may not even be necessary if we observe that \begin{align} F^* \circledast s = \mathcal{F}^{-1}\big[ \mathcal{F}[F^*]\mathcal{F}[s] \big] \end{align} by the convolution theorem. \paragraph{Application to twisted $n$-layer graphene} With the theory outlined, we now have a lens through which to examine a toy model of twisted $n$-layer graphene. Suppose first of all that the layers of graphene can adopt any of the uncountably many angles of rotation $\theta \in [\frac{-\pi}{6},\frac{-\pi}{6}] = \mathcal{A}$ relative to some arbitrary $2$D coordinate system. We assume that the probability of a rotation to angle $y$ given a previous layer is at angle $x$ is given by a symmetric function $P \in L^2$ such that $P(y-x) \equiv P(x-y)$. Consequently, the cross section of this model satisfies both equations \eqref{UCCSadj} and \eqref{UCCS_wS}. In order to express the cross section more concretely, we first note that the structure factor of the graphene unit cell has expression \begin{align} F^{\text{unit}}(0) = f e^{\frac{2}{3} \pi i (h + k) } + f e^{\frac{4}{3} \pi i (h + k) } \end{align} so the structure factor of the unit cell at some arbitrary rotation $\theta$ is therefore \begin{align} F^{\text{unit}}(\theta) = f e^{\frac{2}{3} \pi i (h(\cos(\theta) - \sin(\theta)) + k(\cos(\theta) + \sin(\theta))) } \\ + f e^{\frac{4}{3} \pi i (h(\cos(\theta) - \sin(\theta)) + k(\cos(\theta) + \sin(\theta)))}. \nonumber \end{align} Then by the derivation of equation \eqref{rotated_layer}, the structure factor of a graphene layer is \begin{align} F(\theta) = F^{\text{unit}}(\theta)\frac{\sin(N_a \pi h_{\theta})}{\sin(\pi h_{\theta})}\frac{\sin(N_b \pi k_{\theta})}{\sin(\pi k_{\theta})} \\ \times e^{-i(N_a-1)\pi h_{\theta}}e^{-i(N_b-1)\pi k_{\theta}} \nonumber \end{align} where \begin{align} h_{\theta} = \vec{Q} \cdot ( X \vec{a} ) \\ k_{\theta} = \vec{Q} \cdot ( X \vec{b} ) \nonumber \end{align} where $X$ is the rotation matrix \begin{align} X = \begin{bmatrix} \cos(\theta) & -\sin(\theta) \\ \sin(\theta) & \cos(\theta) \end{bmatrix}. \end{align} Next, we observe that since $\mathcal{T}$ has a convolution kernel $P(y-x)$, the operator $\mathcal{T}$ has a uniform stationary distribution $\pi$, which integrates to unity over its domain $[\frac{-\pi}{6},\frac{\pi}{6}]$, so we deduce \begin{align} \pi(\theta) \equiv \frac{3}{\pi}. \end{align} Now, the angle of rotation between some pair of layers follows a distribution $P$, which would ideally be chosen with some physical motivation, and be consistent with empirical data, like that presented by \citeasnoun{doi:10.1021/nl204547v}. With a choice of $P$, we have an expression for the cross section of $n$-layer twisted graphene \begin{align} \frac{d \sigma}{d \Omega} = \frac{6}{\pi} Re \Bigg\{ \int\displaylimits_{-\frac{\pi}{6}}^{\frac{\pi}{6}}F(\theta)(F^*\circledast s)(\theta) + N_c \abs{F(\theta)}^2 d\theta \Bigg\} \end{align} which can be numerically integrated in good time to high precision. \subsection{A convolution kernel with layers identical up to translation} We considered in section \ref{conv_ker} a crystal with transition operator $\mathcal{T}$ imbued with a convolution kernel where layers can exhibit a broad range of turbostratic disorder. In this section we zoom into a special case where all layers are identical up to some translation, and show in Appendix \ref{conv_ker_appendix} that the cross section of these crystals has expression \begin{align} \frac{d \sigma}{d \Omega} = \abs{F(0)}^2 \bigg( 2 Re\big\{ \mathcal{F}[s](\vec{Q}) \big\} + N_c\bigg). \end{align} One can intuit the relevance of this model by considering a crystal where a layer may slip across the basal plane by some magnitude following some distribution. For example the centre of one layer may slip by some magnitude away from the centre of the next layer. As we move up through the crystal, the centre of each layer performs a random walk, and the centre of the $n$th layer will gradually drift away from the centre of the 1st layer as $n$ grows. Alternatively, one might consider a sequence of layers with expected vertical separation $c$ (where vertical is orthogonal to the basal plane) but due to the effects of disorder, a layer is separated vertically from its predecessor by some random value following a normal distribution centred at $c$. \citeasnoun{Disorder_first_second} and \citeasnoun{Guinier1964} describe this type of disorder as \emph{disorder of the second type}. This is subtly different from Shi's model, where the layers adopt positions following independent and identical normal distribution centred at each of the layers' expected position, an example of \emph{disorder of the first type}. Figure \ref{drift} illustrates this difference. \begin{figure} \caption{Here, the layers nearest the axis perpendicular to the basel plane have position normally distributed about their expected positions $0, c, 2c, 3c ...$ so exhibit disorder of the first type. The layers furthest from the axis have normally distributed pairwise separation hence undergo disorder of the second type and form a less coherent scattering pattern. The distributions have the same variance $0.1c$.} \centering \includegraphics[]{Disorder.pdf} \label{drift} \end{figure} This distinction is important because the different disorders would arise from different physics, and the different disorders give rise to different scattering patterns. In particular, Shi's model of disorder suggests that if a layer is separated by its neighbour by some distance approximately $c$, then the next layer is separated by approximately $2c$, and the next approximately $3c$, and this continues for arbitrary $nc$, without reduction in the accuracy of the approximation. However for the model incorperating disorder of the second type, this approximation would gradually get worse with increasing $n$. This suggests that the form of the scattering pattern, which depends strongly on the periodicity of layers, would differ, and this is reflected in the different expressions for the cross section. To provide a specific example of disorder of the second type, suppose we have a sequence of graphite layers that are identical, except for some vertical displacement $z$ that follows a distribution \begin{align} P(z) = g \delta(z-c) + (1-g) \frac{1}{\sqrt{2\pi}\sigma}\exp\bigg( \frac{(z-c)^2}{2 \sigma^2} \bigg) \end{align} inspired by Shi's 1 layer model. Then by noting \begin{align} |F(0)|^2 = 4f^2\cos \bigg(\frac{2 \pi}{3}(h+k)\bigg)^2 \frac{\sin(N_a \pi h)^2}{\sin(\pi h)^2}\frac{\sin(N_b \pi k)^2}{\sin(\pi k)^2} \end{align} we have all we need to compute the cross section explicitly. This model is overly simple of course, but admits to much extension, and could therefore capture a large range of possible disorders. \section{A countable infinity of hidden states} Having delved into both uncountable and finite state spaces, this section presents a short treatment of countably infinite state spaces. Suppose $\mathbb{S}$ is countably infinite, then the probability of a HMM adopting each state is enumerated as a sequence. Since this sequence sums to $1$ it is necessarily square summable hence an element of the Hilbert space of square summable sequences $\ell^2$. For a probability distribution $v \in \ell^2$ over hidden states, the probability distribution over states for the next state $w$ is given by \begin{align} \sum_{i \in \mathbb{N}} k_{ij}v_j = w_i \end{align} where $k_{ij}$ is the transition kernel denoting the probability of the state $j$ following the state $i$. Much like HMMs with finite and uncountable hidden states, the transition kernel gives rise to the transition operator $\mathcal{T} : \ell^2 \to \ell^2$ with stationary distribution an eigensequence with associated eigenvalue 1. The alphabet of symbols can be finite, countably infinite or uncountably infinite. In the special case that every state emits a unique symbol with probability 1, the HMM is just a Markov chain. This forms a simple model of $n$-layer moir\'{e} graphene, where the set of all layer pairs forming a moir\'{e} pattern is countably infinite. We call each of these layer pairs a superlattice and suppose each superlattice is labelled by some $i \in \mathbb{N}$ and given that a superlattice is type $i$ the probability that the next superlattice is type $j$ depends only on $i$ and $j$. Then the sequence of superlattices forms a Markov chain with uncountable state space $\mathbb{S}$. The cross section of a Markovian crystal with countably infinite state space is shown in Appendix \ref{UncountableAppendix} to satisfy \begin{align} \frac{d \sigma}{d \Omega} = \label{CCS} \Bigg( 2 Re \Bigg\{ \sum_{i \in \mathbb{N}}\sum_{j \in \mathbb{N}}F_iF^*_j\pi_i Z\delta_{ij} \Bigg\} + N_c \sum_{i \in \mathbb{N}} F^*_i F_i \pi_i \Bigg) \nonumber \end{align} where $F_i$ is structure factor of the state indexed by $i$, $\pi_{i}$, is the $i$th element of the stationary distribution $\pi$,$\delta_{ij}$ is the Kronecker delta, and $Z: \ell^2 \to \ell^2$ is defined \begin{align} Z &\equiv \sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3})(e^{2 \pi i l}\mathcal{T})^{m_3}. \end{align} We note here that if $\pi$ is uniform, then for any sequence $\phi_i \in \ell^2$ we interpret \begin{align} \sum_{i \in \mathbb{N}} \pi_i \phi_i \equiv \lim_{n \to \infty}\frac{1}{n}\sum_{i = 0}^{n}\phi_i. \end{align} Moreover, if $k_{ij} = k_{ji}$ then by the Spectral Theorem \begin{align} \frac{d \sigma}{d \Omega} = \label{CCSadj} 2 Re \Bigg\{ \sum_{n \in \Lambda} s_n\sum_{i \in \mathbb{N}}F_i \pi_i u_n^i \sum_{j \in \mathbb{N}} F^*_j u_n^j \Bigg\} + N_c \sum_{i \in \mathbb{N}} \pi_i F^*_i F_i \end{align} with \begin{align} s_{n} = \begin{cases} \frac{N_c}{2}(N_c - 1) \text{ if $\lambda_n e^{2 \pi i l}=1$ } \\ \frac{\lambda_n e^{2 \pi i l} ( \lambda_n^{N_c} e^{2 \pi i l N_c} + N_c(1 - \lambda_n e^{2 \pi i l} ) - 1)}{(1 - \lambda_n e^{2 \pi i l})^2} \text{ otherwise,} \end{cases} \end{align} where $u_n$ and $\lambda_n$ are the eigensequences and eigenvalues of $\mathcal{T}$ indexed by $\Lambda$ repeating eigenvalues according to their algebraic multiplicity. A derivation is presented in Appendix \ref{general_kernel}. \section{Outlook} We began to extend the study of chaotic crystallography to crystals with infinitely many layer types - describing turbostratically disordered materials like carbon blacks, smectites, and $n$-layer graphene. In particular, we derived an explicit cross section for carbon blacks related to the two models proposed by \citeasnoun{ShiThesis}. There are many other disordered materials that could be examined under the framework presented here, smectites for example, are often studied with a qualitative look at diffraction peaks \cite{Ufer:2008:0009-8604:272} \cite{Turbostratic2009}, suggesting a mathematical framework could be well received. It may be that the HMM is a good setting to formulate a well principled model of disorder, then test its validity by comparing theoretical and experimental cross sections. This framework is open to much theoretical development. For example, for a crystal with uncountably many hidden states, the operator $\mathcal{T}$ is a Fredholm integral operator connecting the mathematical theory to the well developed mathematical field of Fredholm theory. Exploring this connection may answer some practical questions, like how the eigenvalues of $\mathcal{T}$ are related to the convergence of the state distribution to steady state, which is discussed for the case of finitely many hidden states by \citeasnoun{riechers2015pairwise}. These authors pose the major problem of chaotic crystallography as reconstructing a crystal's $\varepsilon$-machine from scattering data, where the $\varepsilon$-machine is (roughly speaking) the most information theoretically simple process that could give rise to the observed scattering pattern. Developing a theory of how to construct the $\varepsilon$-machine of a turbostratic material could be of great use to any community studying a turbostratically disordered material. Moreover, our treatment of countably infinite spaces is brief, and could plausibly be developed into something more readily applicable to crystals with a countably infinite number of layer types like moir\'{e} graphene. Bringing moir\'{e} graphene into the purview of chaotic crystallography could shed some new light on the mysterious material, and be a fruitful area of research. \begin{appendix} \section{Powder average} \label{powder_average_appendix} To make sense of our expression, consider a Cartesian coordinate system, where the unit length is equal to $2 \pi |\vec{c}^*|$. A point $\vec{Q} = (h,k,l)$ in the reciprocal lattice coordinates will be denoted $\vec{Q}' = (h',k',l')$ in the Cartesian coordinates. Suppose a layer of type $x$ is composed of $n_x$ atoms and the $i$th atom is found at position $\big( a_i(x) , b_i(x), c_i(x) \big)$ in these Cartesian coordinates. Then the square distance between the $i$th atom in a layer of type $x$ and the $j$th atom in a layer of type $y$ for layers $x,y$ separated by $m_3$ is \begin{align} \big( L^{m_3}_{ij}(x,y) \big)^2 = ( a_i(x) - a_j(y) )^2 + ( b_i(x) - b_j(y) )^2 \\ + ( c_i(x) - c_j(y) + m_3)^2. \nonumber \end{align} In the Cartesian system the structure factor of a layer $x$ is \begin{align} F(x) = \sum^{n_x}_{i = 1} f_i e^{i ( a_i(x) h' + b_i(x) k' + c_i(x) l'} \end{align} and the structure factor product \begin{align} F(x) F^*(y) = \sum^{n_x}_{i = 1}\sum^{n_y}_{j = 1} f_i f_j e^{i \big( (a_i(x) - a_j(y)) h' + ( b_i(x) - b_j(y) ) k' + ( c_i(x) - c_j(y) ) l' \big)} \end{align} Now, to derive our expression for the cross section, we will use the Harmonic expansion presented by \citeasnoun{doi:10.1002/zamm.19860660108} \begin{align} \frac{1}{4 \pi Q^2}\int_{\partial B_Q} \frac{d \sigma}{d \Omega} dS = \sum^{\infty}_{n=0} \frac{Q^{2n}}{(2n+1)!} \Delta^n \bigg( \frac{d \sigma}{d \Omega} \bigg) \bigg\rvert_{\vec{Q}' = 0} \end{align} where \begin{align} \Delta^n = \bigg( \frac{\partial^2}{\partial h'^2} + \frac{\partial^2}{\partial k'^2} + \frac{\partial^2}{\partial l'^2} \bigg)^n. \end{align} We will begin by writing down the cross section \begin{align} \frac{d \sigma}{d \Omega} = \sum_{m_3 = -N_c}^{N_c} (N_c - m_3) \int_{\mathcal{A}} \int_{\mathcal{A}} G_{m_3}(x,y) F(x)F^*(y) e^{2 \pi i m_3 l} dx dy \end{align} and then seek a nice expression for $\Delta^n \big( \frac{d \sigma}{d \Omega} \big) \big\rvert_{\vec{Q}' = 0}$. So we consider \begin{align} \Delta^n \bigg( \frac{d \sigma}{d \Omega} \bigg) \bigg \rvert_{\vec{Q}' = 0} = \sum_{m_3 = -N_c}^{N_c} (N_c - m_3) \int_{\mathcal{A}} \int_{\mathcal{A}} G_{m_3}(x,y) \\ \times \Delta^n \bigg( F(x)F^*(y) e^{2 \pi i m_3 l} \bigg) \bigg\lvert_{\vec{Q}' = 0} dx dy \nonumber \end{align} and bring our attention to \begin{align} \Delta^n \bigg( F(x)F^*(y) e^{2 \pi i m_3 l} \bigg) \bigg\lvert_{\vec{Q}' = 0} \\ = \sum^{n_x}_{i = 1} \sum^{n_y}_{j = 1} \Delta^n \bigg( f_i f_j \exp\big( i( (a_i(x) &- a_j(y))h' \nonumber \\ + ( b_i(x) &- b_j(y) )k' \nonumber \\ + ( c_i(x) &- c_j(y) + m_3)l' )\big) \bigg) \bigg\rvert_{\vec{Q}'} \nonumber \\ = \sum^{n_x}_{i = 1} \sum^{n_y}_{j = 1} f_i f_j (-1)^n \big( (a_i(x) &- a_j(y) )^2 \\ + ( b_i(x) &- b_j(y) )^2 \nonumber \\ + ( c_i(x) &- c_j(y) + m_3 )^2 \big)^n \nonumber \\ = \sum^{n_x}_{i = 1} \sum^{n_y}_{j = 1} f_i f_j (-1)^n \big( L^{m_3}_{ij}(x,y) \big)^{2n}. \nonumber \end{align} Next, we notice \begin{align} \sum^{\infty}_{n=0}\frac{Q^{2n}}{(2n+1)!} \Delta^n \bigg( F(x)F^*(y) e^{2 \pi i m_3 l} \bigg) \bigg\lvert_{\vec{Q}' = 0} \\ = \sum^{\infty}_{n=0}\frac{Q^{2n}}{(2n+1)!} \sum^{n_x}_{i = 1} \sum^{n_y}_{j = 1} f_i f_j (-1)^n \big( L^{m_3}_{ij}(x,y) \big)^{2n} \nonumber \\ = \sum^{n_x}_{i = 1} \sum^{n_y}_{j = 1} f_i f_j \sum^{\infty}_{n=0}\frac{( Q L^{m_3}_{ij}(x,y) )^{2n}}{(2n+1)!} (-1)^n \nonumber \\ = \sum^{n_x}_{i = 1} \sum^{n_y}_{j = 1} f_i f_j \text{sinc}(Q L^{m_3}_{ij}(x,y)) \end{align} where we have used the series expansion of $\text{sinc}$ \begin{align} \text{sinc}(x) = \sum_{n=0}^{\infty}\frac{x^{2n}}{(2n+1)!}(-1)^n. \end{align} Putting all this together \begin{align} \frac{1}{4 \pi Q^2}\int_{\partial B_{Q}} \frac{d \sigma}{d \Omega} dS &= \sum^{\infty}_{n=0} \frac{Q^{2n}}{(2n+1)!} \Delta^n \bigg( \frac{d \sigma}{d \Omega} \bigg) \bigg \rvert_{\vec{Q}' = 0} \\ &= \sum_{m_3 = -N_c}^{N_c} (N - m_3) \int_{\mathcal{A}} \int_{\mathcal{A}} G_{m_3}(x,y) \\ \times \sum^{\infty}_{n=0}\frac{Q^{2n}}{(2n+1)!}& \Delta^n \bigg( F(x)F^*(y) e^{2 \pi i m_3 l} \bigg) \bigg\lvert_{\vec{Q}' = 0} dx dy \nonumber \\ &= \sum_{m_3 = -N_c}^{N_c} (N_c - m_3) \int_{\mathcal{A}} \int_{\mathcal{A}} G_{m_3}(x,y) \\ &\times \sum^{n_x}_{i = 1} \sum^{n_y}_{j = 1} f_i f_j \text{sinc}(Q L^{m_3}_{ij}(x,y)) dx dy \nonumber. \end{align} \section{Finite state space, uncountable alphabet} \label{FSSUA} Suppose we have a finite state space $\mathbb{S}$ and alphabet $\mathcal{A} \subset \mathbb{R}^n$ an open connected set. Then by combining the expression for the pair correlation function \eqref{Pair_Correlation_Finite_S} with the average structure factor product \eqref{Average_structure_factor_product} we arrive at \begin{align} Y_m = \int_{\mathcal{A}}\int_{\mathcal{A}}\sum_{r \in \mathbb{S}}\sum_{s \in \mathbb{S}} \pi_s \mathcal{T}^m_{sr}v_{r}(x)F(x)F^*(y)v_s (y) dx dy \\ = \sum_{r \in \mathbb{S}}\sum_{s \in \mathbb{S}} \pi_s \mathcal{T}^m_{sr} \int_{\mathcal{A}} v_r(x)F(x) dx \int_{\mathcal{A}} v_s(y)F^*(y) dy \\ = \sum_{r \in \mathbb{S}}\sum_{s \in \mathbb{S}} \pi_s \mathcal{T}^m_{sr} h_{rs} \\ = \Tr \big( \Diag(\pi)\mathcal{T}^m H \big) \end{align} where $H$ is a Hermitian matrix with dimension equal to the number of states in the space $\mathbb{S}$, and has elements \begin{align} h_{rs} = \int_{\mathcal{A}} v_r(x)F(x) dx \int_{\mathcal{A}} v_s(y)F^*(y) dy. \end{align} Next, we note that $Y_m = Y_{-m}^*$ so \begin{align} \frac{d \sigma}{d \Omega} = \sum_{m_3 =-N_c}^{N _c}(N_c - \abs{m_3})Y_{m_3} e^{2 \pi i m_3 l} \\ = \sum_{m_3 = 1}^{N _c}(N_c - m_3)Y_{m_3} e^{2 \pi i m_3 l} \\ + N_c Y_0 \nonumber \\ + \sum_{m_3 = 1}^{N _c}(N_c - m_3)Y_{m_3}^* e^{-2 \pi i m_3 l} \nonumber \\ = \sum_{m_3 = 1}^{N _c}(N_c - m_3)\Tr \big( \Diag(\pi)\mathcal{T}^m H \big)e^{2 \pi i m_3 l} \\ + N_c \Tr \big( \Diag(\pi) H \big) \nonumber \\ + \sum_{m_3 = 1}^{N _c}(N_c - m_3)\Tr \big( \Diag(\pi)\mathcal{T}^m H^* \big)e^{- 2 \pi i m_3 l} \nonumber \\ = \Tr \Bigg( \Diag(\pi)\bigg(\sum_{m_3 = 1}^{N _c}(N_c - m_3)(\mathcal{T}e^{2 \pi i l})^{m_3}\bigg) H \Bigg) \\ + N_c \Tr \big( \Diag(\pi) H \big) \nonumber \\ + \Tr \Bigg( \Diag(\pi)\bigg(\sum_{m_3 = 1}^{N _c}(N_c - m_3)(\mathcal{T}e^{-2 \pi i l})^{m_3}\bigg) H^* \Bigg) \nonumber \\ = \Tr \big( \Diag(\pi)S H \big) \\ + N_c \Tr \big( \Diag(\pi) H \big) \nonumber \\ + \Tr \big( \Diag(\pi)S^* H^* \big) \nonumber \\ = 2 Re \bigg\{\Tr \big( \Diag(\pi)H(2S + N_c I) \big) \bigg\} \end{align} and we arrive at the expression for cross section. \section{Infinite state space} \label{UncountableAppendix} This section describes a crystal comprising infinitely many layer types, where the probability distribution over the set of layers follows a Markov chain. In some cases, the arguments for an uncountable space represented by $\mathbb{R}^n$ (open and connected) and a countable space represented by $\mathbb{N}$ are essentially the same, and in these cases arguments may be made over a general Hilbert space $\mathcal{H}$ that apply to both the square summable sequences $\ell^2$ and the square integrable functions $L^2$, representing distributions over the countable state space $\mathbb{N}$ or uncountable state space $\mathbb{R}^n$ (open and connected) respectively. For brevity, we allow the symbols of integration \begin{align} \int \cdot \ dx \end{align} to represent either integration over the open connected set $\mathcal{A} \subset \mathbb{R}^n$ or summation over $\mathbb{N}$. \subsection{The most general kernel} \label{general_kernel} The cross section of a crystal with a countable infinity or uncountable infinity of hidden layers is \begin{align} \sum_{m_{3} = -N_{c}}^{N_{c}}(N_c - \abs{m_3}) \int \int F(x)F^*(y)G_{m_3}(x,y)e^{2 \pi i m_3 l} dx dy, \nonumber \end{align} which we can split into three terms \begin{align} &\sum_{m_{3} = -N_{c}}^{N_{c}}(N_c - \abs{m_3}) \int \int F(x)F^*(y)G_{m_3}(x,y)e^{2 \pi i m_3 l} dx dy \label{simpUncCS} \\ =&\sum_{m_{3} = 1}^{N_{c}}(N_c - \abs{m_3}) \int \int F(x)F^*(y)G_{m_3}(x,y)e^{2 \pi i m_3 l} dx dy \nonumber \\ +& N_c \int \int F(x)F^*(y)G_{0}(x,y)dx dy \nonumber \\ +&\sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3}) \int \int F(x)F^*(y)G_{-m_3}(x,y)e^{-2 \pi i m_3 l} dx dy. \nonumber \end{align} Now the second term of the RHS of equation \eqref{simpUncCS} requires an expression for $G_{0}(x,y)$, which represents the probability (density) of sampling a layer that is type $x$, and given it is type $x$ that it is itself type $y$. In an uncountable space we let $\delta_a(y) \equiv \delta(a-y)$ for $a \in \mathcal{A}$ represent the shifted Dirac delta function evaluated at $y \in \mathcal{A}$ and notice $G_{0}(x,y) = \pi(x)\delta_x(y)$. In a countable space, $G_{0}(i,j) = \pi_i\delta_{ij}$ for $ij \in \mathbb{N}$ by the same arguments. Again, to avoid writing essentially the same thing twice, we continue by allowing $\delta_x(y)$ to represent $\delta_{xy}$ for countable spaces. With this, we have that the second term satisfies \begin{align} & N_c \int \int F(x)F^*(y)G_{0}(x,y)dx dy \\ =& N_c \int \pi(x) F^*(x) F(x) dx. \nonumber \end{align} Next, we focus on the third term, noting the probability (density) of sampling a state $x$ then finding a state $y$ after moving forward $m_3$ blocks is the same as sampling a state $y$ then finding a state $x$ after moving backward $m_3$ blocks. Thus \begin{equation} F(x)F^*(y) G_{m_3}(x,y) = F^*(x) F(y) G_{-m_3}(x,y) \end{equation} so we have that the LHS of \eqref{simpUncCS} equals \begin{align} &\sum_{m_{3} = 1}^{N_{c}}(N_c - \abs{m_3}) \int \int F(x)F^*(y)G_{m_3}(x,y)e^{2 \pi i m_3 l} dx dy \\ +& N_c \int \pi(x) F^*(x) F(x) dx \nonumber \\ +&\sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3}) \int \int F^*(x) F(y)G_{m_3}(x,y)e^{-2 \pi i m_3 l} \nonumber dx dy \end{align} hence we can see that the third term is just the complex conjugate of the first. With this information, note that the sum of the first and third term is just twice the real part of the first, so we proceed by only considering the first term and noting \begin{align} G_{m_3}(x,y) \equiv \pi(x)\mathcal{T}^{m_3}\delta_x(y) \text{ for $m_3 > 0$} \end{align} so \begin{align} &\sum_{m_{3} = 1}^{N_{c}}(N_c - \abs{m_3}) \int \int F(x)F^*(y)G_{m_3}(x,y)e^{2 \pi i m_3 l} dx dy \label{uncountableCS} \\ =&\int\int F(x)F^*(y) \pi(x) \sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3})(e^{2 \pi i l}\mathcal{T})^{m_3} \delta_x(y) dx dy \nonumber \\ =& \int\int F(x)F^*(y)\pi(x)Z\delta_x(y) dx dy \end{align} where $z \in \mathbb{C}$ and $Z$ is an operator with expression \begin{align} Z &\equiv \sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3})(e^{2 \pi i l}\mathcal{T})^{m_3}. \end{align} Putting all this together, we have \begin{align} \frac{d \sigma}{d \Omega} = 2 Re \Bigg\{ \int\int F(x)F^*(y)\pi(x)Z\delta_x(y) dx dy \Bigg\} \\ + N_c \int \abs{F(x)}^2 \pi(x) dx \nonumber \end{align} where $Re\{z\}$ represents the real part of the complex number $z \in \mathbb{C}$. This completes the derivation of the general cross section for both countable and uncountable state spaces. \subsection{The case of a symmetric kernel} \label{self_adj_app} With the general expression established for both countable and uncountable spaces, we consider the special case where $k(x,y) = k(y,x)$ so $\mathcal{T}$ is self-adjoint. Since $\mathcal{T}$ is compact, we observe by the Spectral Theorem for compact self-adjoint operators that \begin{align} (e^{2 \pi i l}\mathcal{T})^{m_3} \delta_x(y) &= \sum_{n \in \Lambda} \langle \delta_x , u_n \rangle (\lambda_n e^{2 \pi i l})^{m_3} u_{n}(y) \\ &= \sum_{n \in \Lambda} u_n(x) u_{n}(y) (\lambda_ne^{2 \pi i l})^{m_3} \end{align} where $u_n$ and $\lambda_n e^{2 \pi i l}$ are the eigenvectors and eigenvalues of $e^{2 \pi i l}\mathcal{T}$ indexed by the set $\Lambda$ which repeats eigenvalues according to their algebraic multiplicity. Here we have also used $\langle \phi , \psi \rangle$ to denote inner product on the Hilbert space $\mathcal{H}$ of $\phi, \psi \in \mathcal{H}$. With this, we can proceed from equation \eqref{uncountableCS} and deduce \begin{align} &\int\int F(x)F^*(y) \pi(x) \times \\ &\sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3})(e^{2 \pi i l}\mathcal{T})^{m_3} \delta_x(y) dx dy \nonumber \\ = &\int \int F(x)F^*(y) \pi(x) \times \nonumber \\ &\sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3})\sum_{n \in \Lambda} u_n(x) u_{n}(y) (\lambda_n e^{2 \pi i l})^{m_3} dx dy \nonumber \\ = &\sum_{n \in \Lambda}\int F(x) \pi(x) u_n(x) \int F^*(y) u_n(y) \times \\ &\sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3}) (\lambda_n e^{2 \pi i l})^{m_3} dx dy \nonumber \\ = &\sum_{n \in \Lambda} s_n\int F(x) \pi(x) u_n(x) dx \int F^*(y) u_n(y) dy \label{uncountableSA} \end{align} where \begin{align} s_{n} = \begin{cases} \frac{N_c}{2}(N_c - 1) \text{ if $l \in \mathbb{Z}$ and $\lambda_n = 1$ } \\ \frac{\lambda_n e^{2 \pi i l} ( \lambda_n^{N_c} e^{2 \pi i l N_c} + N_c(1 - \lambda_n e^{2 \pi i l} ) - 1)}{(1 - \lambda_n e^{2 \pi i l})^2} \text{ otherwise,} \end{cases} \end{align} and the expression for the cross section follows immediately. We can evaluate \eqref{uncountableSA} approximately by summing over only the first few values of $n$, requiring only a few eigenvalues and eigenvectors. Unfortunately, there is no method of deriving closed form solutions for $u_n$ for a general kernel $k$; but analytic solutions do exist in some special cases. In the case of an uncountable space represented by $\mathcal{A}$ it may be fruitful to note that solutions to the eigenvalue equation \begin{align} \lambda_n u_n(x) = \int_{\mathcal{A}}k(x,y)u_n(y)dy \end{align} also satisfy \begin{align} Lu_n = \lambda_n^{-1} u_n \label{DE} \end{align} for $L$ a differential operator with kernel $k$. Finding the eigenvalues and eigenvectors of $L$ is then a question of solving the differential equation \eqref{DE}. \subsection{The case of a convolution kernel} \label{conv_ker_appendix} Let $\mathcal{A} = (0,1)^n$, $\phi \in L^2$ and \begin{align} k(x,y) = \sum_{m \in \mathbb{Z}^n} P(m + y-x) \end{align} where $P$ is a square integrable probability distribution over $\mathbb{R}^n$. Then \begin{align} \mathcal{T} \phi = \int_{\mathcal{A}}k(x,y)\phi(x) dx \\ = \sum_{m \in \mathbb{Z}^n}\int_{\mathcal{A}}P(m+y-x)\phi(x) dx \\ = \int_{\mathbb{R}^n}P(y-x)\phi(x) dx \equiv P \circledast \phi \end{align} where $\circledast$ denotes the convolution. Now define the sequence of functions \begin{align} \mathcal{T}^{n+1}\phi = P \circledast \mathcal{T}^{n} \phi \end{align} for which we denote the $n$th term by $P\circledast^{n} \phi$, and identify this sequence with $\mathcal{T}^n \phi$. Next, we denote the Fourier transform by $\mathcal{F}: L^2 \to L^2$ and use the convolution theorem to deduce \begin{align} \mathcal{F} \big[ P\circledast^{n} \phi \big] = (\mathcal{F} [P])^n\mathcal{F}[\phi]. \end{align} We now observe that \begin{align} Z \delta_x &= \sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3})(e^{2 \pi i l}\mathcal{T})^{m_3}\delta_x\\ &= \sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3}) e^{2 \pi i m_3 l}P \circledast^{m_3}\delta_x\\ &= \mathcal{F}^{-1}\bigg[\sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3}) e^{2 \pi i m_3 l}\mathcal{F}\big[P \circledast^{m_3}\delta_x\big] \bigg]\\ &= \mathcal{F}^{-1}\bigg[\sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3}) e^{2 \pi i m_3 l}\mathcal{F}[P]^{m_3}\mathcal{F}[\delta_x] \bigg] \\ &= \mathcal{F}^{-1}\bigg[\mathcal{F}[s]\mathcal{F}[\delta_x] \bigg] \\ &= s \circledast \delta_x \\ &= s_x \end{align} where $s \in L^2$ is defined \begin{align} s \equiv \mathcal{F}^{-1}\bigg[ \sum_{m_{3} = 1}^{N_c}(N_c - \abs{m_3}) e^{2 \pi i m_3 l}\mathcal{F}[P]^{m_3}\bigg] \end{align} so satisfies \begin{align} \mathcal{F}[s] = \begin{cases} \frac{N_c}{2}(N_c - 1) \text{ if $\mathcal{F}[P]e^{2 \pi i l} = 1$} \\ \frac{\mathcal{F}[P] e^{2 \pi i l} ( \mathcal{F}[P]^{N_c} e^{2 \pi i l N_c} + N_c(1 - \mathcal{F}[P] e^{2 \pi i l} ) - 1)}{(1 - \mathcal{F}[P] e^{2 \pi i l})^2} \text{ otherwise,} \end{cases} \end{align} and $s_x(y) \equiv s(y-x)$ allowing us to arrive at an expression for the cross section \begin{align} \frac{d \sigma}{d \Omega} = 2 Re \Bigg\{ \int_{\mathcal{A}}\int_{\mathbb{R}^n}F(x)F^*(y)s(y-x) dx dy \Bigg\} \label{conv_ker_cs} \\ + N_c \int_{\mathcal{A}} \abs{F(x)}^2 dx \nonumber \\ = Re \Bigg\{ \int_{\mathcal{A}}2F^*(x)(F \circledast s)(x) dy + N_c \abs{F(x)}^2 dx \Bigg\}. \end{align} If we make the further assumption that layers are identical up to translation, then starting from equation \eqref{conv_ker_cs} \begin{align} \frac{d \sigma}{d \Omega} = 2 Re \bigg\{ \int_{\mathcal{A}}\int_{\mathbb{R}^n} F(x)F^*(y)s(y-x) dx dy \bigg\} \\ + N_c \int_\mathcal{A}\abs{F(x)}^2 dx \nonumber \\ = 2 Re \bigg\{ \abs{F(0)}^2\int_{\mathcal{A}}\int_{\mathbb{R}^n} e^{2 \pi i \vec{x}\cdot\vec{Q}}e^{-2 \pi i \vec{y}\cdot\vec{Q}} s(y-x) dx dy \bigg\} \\ + N_c \abs{F(0)}^2\int_\mathcal{A} dx \nonumber \\ = 2 Re \bigg\{ \abs{F(0)}^2\int_{\mathcal{A}} e^{2 \pi i \vec{x}\cdot\vec{Q}}\int_{\mathbb{R}^n}e^{-2 \pi i \vec{y}\cdot\vec{Q}} s(y-x) dy dx \bigg\} \\ + N_c \abs{F(0)}^2 \nonumber \\ = 2 Re \bigg\{ \abs{F(0)}^2\int_{\mathcal{A}} e^{2 \pi i \vec{x}\cdot\vec{Q}} \mathcal{F}[s](\vec{Q})e^{- 2 \pi i \vec{x}\cdot\vec{Q}} dx \bigg\} \\ + N_c \abs{F(0)}^2 \nonumber \\ = 2 Re \bigg\{ \abs{F(0)}^2 \mathcal{F}[s](\vec{Q}) \int_{\mathcal{A}}dx \bigg\} \\ + N_c \abs{F(0)}^2 \nonumber \\ = \abs{F(0)}^2 \bigg( 2 Re\big\{ \mathcal{F}[s](\vec{Q}) \big\} + N_c\bigg) \end{align} and we arrive at the expression for the cross section of a crystal with convolution kernel composed of layers that are identical up to translation. \end{appendix} \bibliographystyle{iucr}
\section{Introduction} Visual place recognition is a fundamental yet challenging task in the field of mobile robotics [1]. It may be defined as the ability of a robot to recognize a previously visited location. Viewpoint changes [2], [3], seasonal variations [4], [5], presence of dynamic objects [6], [7] and illumination changes [8], [9] encountered in real world scenarios make this apparently simple task non-trivial [4], [10]. Several techniques have been presented to solve this problem (such as [11]-[14]), however, every VPR method has its own pros and cons [15]-[18], and there is no universal technique that may be used in all conditions and scenarios . \\ \begin{figure}[htb!] \centering \scalebox{0.5} \includegraphics[width=6.5cm,height=5cm]{radar_new_new.png} \caption{Sample output of the proposed complementarity framework. Here, VPR-Tech1 is the primary VPR technique which may be combined with other available secondary VPR methods (VPR-Tech2, VPR-Tech3 etc). The green line (\textbf{min}) shows the lower complementarity bound of VPR-Tech1 with other methods; the blue line (\textbf{max}) depicts the maximum complementarity bound; the yellow line (\textbf{median}) shows the median complementarity bound.} \label{fig:my_label} \end{figure} Recently, a new approach named multi-process fusion has been introduced that combines several image processing methods and negates the requirement of multiple sensors to improve VPR performance [19], [20]. The concept comes from the empirical data which suggests that some VPR methods are more suitable for certain types of environments and scenarios than others [10]. Hence, utilising multiple VPR techniques simultaneously may compensate for each other’s weaknesses. Although the systems presented in [19], [20] exhibit promising results, they do not provide a well-defined criterion for selection of VPR techniques based on complementarity out of the available options. Supposing that the fused VPR methods will complement each other in all cases is not a valid assumption and may have detrimental effect on performance and computation. For example, if the VPR techniques that are combined are redundant, they will not achieve higher performance and will only add to the computational cost which may not be suitable for resource-constrained systems. Hence, complementarity information is vital and can enable a multi-process fusion based system to make an informed decision regarding selection of VPR techniques from available options.\\ To the best of our knowledge, complementarity of VPR methods has not been studied systematically so far. Through this paper, we attempt to bridge this gap and intend to design a framework that can be used as a sanity check for the selection of complementary pairs of VPR techniques for multi-process fusion systems. Our proposed framework is based on a McNemar's test-like approach [21], [22] that categorizes each VPR outcome from a technique as either success or failure (considering ground truth information). The framework allows estimation of upper and lower complementarity bounds for the VPR techniques to be combined, along with an estimate of maximum VPR performance that may be achieved. This framework is then employed for eight state-of-the-art VPR methods to identify highly complementary pairs on widely used VPR data sets. \\ The rest of this paper is organized as follows. Section II provides an overview of related work. Section III presents the framework for computing complementarity between VPR techniques, and for estimating upper and lower complementarity bounds along with an assessment of maximum achievable VPR performance. Section IV describes the experimental setup. The results based on the proposed framework are presented in Section V. Finally, conclusions are given in section VI. \section{Related Work} This section provides an overview of the related work in the domain of visual place recognition. The methods used for VPR may be divided into three categories: handcrafted feature descriptor-based techniques, deep-learning-based methods, and Region-of-interest-based approaches. All these categories have their own strengths and weaknesses that influence the selection of any methods from among them. Some state-of-the-art handcrafted feature descriptors used for VPR are Scale Invariant Feature Transform (SIFT) [23], Speeded-Up Robust Features (SURF) [24], and GIST [25]. Convolutional Neural Networks (CNNs) have turned out to be revolutionary in the field of VPR and provide significant improvement in performance [26] even under extreme environmental variations. Some of the widely used techniques include NetVLAD [11], AMOSNet [12], and HybridNet [12]. Region-of-interest-based VPR techniques make use of the static and definite regions of images to perform place recognition, such as Regions of Maximum Activated Convolutions (R-MAC) [27]. \\ Fusing multiple sensors to improve place recognition performance has been the focus of several research works [28]-[30]. Although multi-sensor approaches help boost performance, they do carry certain disadvantages, such as expensive and bulky sensors, and potential significant increase in computation. To overcome these shortcomings, the concept of fusing multiple VPR techniques has gained popularity. The authors of [31] combined multiple image processing methods into a merged feature vector using a convex optimization approach to decide the best match from the sequence of images generated. The effort did generate some promising results over multiple datasets but had limited overall performance due to the absence of sequential information. Similarly, a multi-process fusion system is introduced in [19] which combines multiple VPR methods using a Hidden Markov Model (HMM) to identify the optimal estimated location over a sequence of images. \begin{figure}[!htb] \centering \vspace*{0.1in} \includegraphics[width=1\columnwidth]{resized_quad.png} \caption{Possible outcomes of pairwise analysis of VPR methods on a case-by-case basis over the same dataset.} \label{fig:my_label} \end{figure} The authors of [20] have presented a three-tier hierarchical multi-process fusion system which is customizable and may be extended to any arbitrary number of tiers. A different place recognition method is used in each tier to compare the query image with the provided sequence of images. \section{Proposed Framework} This section presents the framework for computing complementarity, for establishing the upper and lower complementarity bounds, and for estimating the maximum achievable VPR performance by a muti-process fusion system. This framework may be employed on an arbitrary number of VPR methods to determine the optimal pairing from among the pool of techniques available.It may also be utilised as a sanity check on whether the VPR techniques that a multi-process fusion system has assembled for integration are even viable. The framework employs a McNemar’s test like approach to perform a case-by-case analysis of each VPR technique to compute the complementarity of the given technique with other available methods. Precision-recall curves, F-scores and accuracy percentage [9] are usually utilised as performance metrics for VPR methods. Although viable for some applications / scenarios, these performance metrics do not provide the specific information that tells where exactly does a VPR method succeeds or fails, and do not show the whole picture. For example, two VPR methods compared over a dataset of 100 images using these performance metrics may appear to have same performance if they both are able to match 70 images (out of 100). However, it is highly likely that the set of 70 images successfully matched by the first VPR method is not the same set that is also correctly matched by the second VPR technique. We believe that this neglected piece of information is critical for determining complementarity of different VPR methods, and is vital knowledge to have specifically when dealing with multi-process fusion systems. McNemar's test is a form of chi-squared test with one degree of freedom that evaluates the performance of two algorithms based on their outcomes on a case-by-case basis over the same dataset. For utilizing McNemar’s test, a criterion is needed to determine whether a test case results in success or failure. Our proposed framework is loosely inspired by the McNemar's test as we do pairwise analysis of VPR methods on a case-by-case basis over the same dataset. The two VPR methods in question would produce results in the form of correct or incorrect matches verified using ground truth. This data may then be divided into four possible cases as shown in Fig. 2: first being the number of images where both algorithms are able to match the images correctly, second where the first algorithm matched correctly while the second produced an incorrect match, then vice versa and finally where both algorithms failed and produced incorrect matches. For computing complementarity, our prime focus remains on case two and three as these hold the number of images where the two algorithms perform differently and can help boost each other’s performance. \textbf{Computing complementarity.} Let \textit{A} be our primary VPR technique. Let \textit{B} be a VPR method that may be combined with \textit{A} in a multi-process fusion system to enhance VPR performance over an image dataset \textit{D}. VPR performance is defined as the ratio of number of images of \textit{D} that are correctly matched (verified by groundtruth) to the total number of images of \textit{D}. The complementarity is calculated by the following equation: \begingroup \small \begin{equation} CBA = \frac{T} {M}\\ \end{equation} \endgroup Where \textit{CBA} is the complementarity of \textit{B} with \textit{A}; \textit{T} is the number of images of \textit{D} which are incorrectly matched by \textit{A} but correctly matched by \textit{B} when the two methods are run; \textit{M} is the number of images of \textit{D} that are incorrectly matched by \textit{A} when run. A large value of \textit{CBA} implies that \textit{B} complements \textit{A} well on dataset \textit{D} and will result in potential increase in VPR performance. On the other hand, a small value of \textit{CBA} means that \textit{B} does not complement \textit{A} well. In other words, \textit{A} and \textit{B} are redundant and combining \textit{A} with \textit{B} will increase computational cost without any substantial increase in VPR performance. \textbf{Establishing complementarity bounds.} It is interesting to further explore the upper and lower extremities of complementarity of \textit{B} with \textit{A}. Let \textit{K} be the set of \textit{n} individual datasets on which \textit{A} and \textit{B} are run. \begin{equation} \centering K = \{D_1, D_2, D_3,….D_n\} \end{equation} Let \textit{J} be the set of complementarity scores (\textit{B} with \textit{A}) computed over \textit{n} dataset in \textit{K}. \begin{equation} \centering J = \{CBA_1, CBA_2, CBA_3…CBA_n\} \end{equation} The upper complementarity bound is then established as \begin{equation} \centering U = max \{CBA_1, CBA_2, CBA_3…CBA_n\} \end{equation} The lower complementarity bound is estimated as \begin{equation} \centering L = min \{CBA_1, CBA_2, CBA_3…CBA_n\} \end{equation} The median of complementarity of \textit{B} with \textit{A} is computed as \begin{equation} \centering Q = median \{CBA_1, CBA_2, CBA_3…CBA_n\} \end{equation} \textbf{Estimating maximum achievable performance.} It is beneficial to estimate the maximum achievable VPR performance of a multi-process fusion system over a dataset at an early stage. This is estimated as follows: \begingroup \small \begin{equation} \small MAPE = \frac{(T + W + X )}{Y} \end{equation} \endgroup Where \textit{MAPE} is the maximum achievable VPR performance estimate for the multi-process fusion system over a dataset \textit{D}; \textit{T} is the number of images of \textit{D} which are incorrectly matched by \textit{A} but correctly matched by \textit{B} when the two methods are run; \textit{W} is the number of images of \textit{D} which are correctly matched by \textit{A} but incorrectly matched by \textit{B} when the two methods are run; ; \textit{X} is the number of images of \textit{D} which are correctly matched by both \textit{A} and \textit{B} when the two methods are run; \textit{Y} is the total number of images of \textit{D}. \section{Experimental Setup} This section provides details of the experimental setup used for obtaining results by utilising the proposed framework. Table 1 lists the widely used VPR datasets [31] that are used for our experiments, namely GardensPoint, 24/7 Query [33], Essex3in1 [34], SPEDTest, Cross-Seasons [35], Synthia [36], Corridor, 17-Places, Living room, and Nordland [37]. The implementation details of the eight state-of-the-art VPR techniques that are utilised in the experiments are given below. \textbf{AlexNet:} The use of AlexNet for VPR was studied by [40], who suggested that \textit{conv3} is the most robust to conditional variations. Gaussian random projections are used to encode the activation-maps from conv3 into feature descriptors. Our implementation of AlexNet is similar to the one employed by [41]. \textbf{NetVLAD:} The original implementation of NetVLAD was in MATLAB, as released by [11]. The Python part of this code was open-sourced by [38]. The model selected for evaluation is VGG-16, which has been trained in an end-to-end manner on Pittsburgh 30K dataset [11] with a dictionary size of 64 while performing whitening on the final descriptors. \textbf{AMOSNet:} This technique was proposed by [12], where a CNN was trained from scratch on the SPED dataset. The authors presented results from different convolutional layers by implementing spatial pyramidal pooling on the respective layers. While the original implementation is not fully open-sourced, the trained model weights are shared by authors. \textbf{HybridNet:} While AMOSNet was trained from scratch, [12] took inspiration from transfer learning for HybridNet and re-trained the weights initialised from Top-5 convolutional layers of CaffeNet [39] on SPED dataset. We have implemented HybridNet using 'conv5' of the shared HybridNet model. \begin{figure*}[!htb] \vspace*{0.1in} \includegraphics[width=2\columnwidth]{fig_b_1.png} \caption{Complementarity of state-of-the-art VPR methods with: AlexNet (top left); AMOSNet (top right); CALC (bottom left); CoHoG (bottom right).} \label{figurelabel} \end{figure*} \textbf{RegionVLAD:} This technique is introduced and open-sourced by [14]. We have used AlexNet (trained on Places365 dataset) as the underlying CNN. The total number of regions of interest is set to 400, and we have used ‘conv3’ for feature extraction. The dictionary size is set to 256 visual words for VLAD retrieval. Cosine similarity is subsequently used for matching descriptors of query and reference images \textbf{CALC:} The use of convolutional auto-encoders for VPR was proposed by [13], where an auto-encoder network was trained in an unsupervised manner to re-create similar HOG descriptors for viewpoint variant (cropped) images of the same place. We use model parameters from 100,000 training iteration. Cosine-matching is used for descriptor comparison. \textbf{HoG:} Histogram-of-oriented-gradients (HoG) is one of the most widely used handcrafted feature descriptor, which actually performs very well for VPR compared to other handcrafted feature descriptors. We use a cell size of $16 \times 16$ and a block size of $32 \times 32$ for an image-size of $512 \times 512$ for our implementation. The total number of histogram bins are set equal to 9. We use cosine-matching between HOG-descriptors of various images to find the best place match. \textbf{CoHoG:} It is a recently proposed handcrafted feature descriptor-based technique, which uses image-entropy for region-of-interest extraction. The regions are subsequently described by dedicated HoG descriptors and these regional descriptors are convolutionally matched to achieve lateral viewpoint-invariance. It is an opensource technique and we have used an image size of $512 \times 512$, cell size of $16 \times 16$, bin-size of 8 and an entropy-threshold (ET) of 0.4. CoHoG also uses cosine-matching for descriptor comparison. \section{Results and Discussion} \begin{figure*}[!htb] \vspace*{0.1in} \includegraphics[width=2\columnwidth]{fig_b_2.png} \caption{Complementarity of state-of-the-art VPR methods with: HoG (top left); HybridNet (top right); NetVLAD (bottom left); RegionVLAD (bottom right).} \label{figurelabel} \end{figure*} \begin{table*}[] \centering \caption{VPR-Bench Datasets[32]} \begin{tabular}{|c|c|c|c|c|c|} \hline \textbf{Dataset} & \textbf{Environment} & \textbf{Query Images} & \textbf{Ref Images} & \textbf{Viewpoint-Variation} & \textbf{Conditional-Variation} \\ \hline GardensPoint & University Campus & 200 & 200 & Lateral & Day-Night \\ \hline 24/7 Query & Outdoor & 375 & 750 & 6-DOF & Day-Night \\ \hline ESSEX3IN1 & University Campus & 210 & 210 & 6-DOF & Illumination \\ \hline SPEDTest & Outdoor & 607 & 607 & None & Seasonal and Weather \\ \hline Cross-Seasons & City-Like & 191 & 191 & Lateral & Dawn-Dusk \\ \hline Synthia & City-like(Synthetic) & 947 & 947 & Lateral & Seasonal \\ \hline Nordland & Train Journey & 1622 & 1622 & None & Seasonal \\ \hline Corridor & Indoor & 111 & 111 & Lateral & None \\ \hline 17-Places & Indoor & 406 & 406 & Lateral & Day-Night \\ \hline Living-room & Indoor & 32 & 32 & Lateral & Day-Night \\ \hline \end{tabular} \end{table*} \begin{table*}[htbp] \vspace*{0.2in} \caption{ Maximum achievable performance estimate for different combinations of state-of-the-art VPR methods on standard datasets in percentage} \label{tab:caption} \begin{adjustbox}{width=\textwidth} \begin{tabular}{|l|l|l|l|l|l|l|l|l|l|l|l|l|} \hline \textbf{VPR Combinations} & \textbf{17Places} & \textbf{24-7} & \textbf{Corridor} & \textbf{CrossSeasons} & \textbf{Essex3in1} & \textbf{Garden Point} & \textbf{Livingroom} & \textbf{Nordland} & \textbf{SPED} & \textbf{SYNTHIA} \\ \hline AlexNet + AMOSNet & 43.1 & 87.2 & 73.8 & 32.9 & 28.0 & 54.0 & 62.5 & 83.6 & 81.3 & 32.2 \\ \hline AlexNet + CALC & 36.2 & 72.0 & 54.0 & 31.9 & 19.0 & 34.0 & 59.3 & 53.8 & 59.6 & 30.62 \\ \hline AlexNet + CoHoG & 44.0 & 95.7 & 71.17 & 28.7 & 82.8 & 48.5 & 96.8 & 50.8 & 63.4 & 32.7 \\ \hline AlexNet + HoG & 33.7 & 69.3 & 62.1 & 28.2 & 15.7 & 36.0 & 59.3 & 79.9 & 65.2 & 32.1 \\ \hline AlexNet + HybridNet & 43.3 & 90.6 & 74.7 & 35.0 & 30.1 & 52.0 & 68.7 & 87.4 & 81.7 & 31.3 \\ \hline AlexNet + NetVLAD & \textbf{48.2} & 97.6 & 65.7 & \textbf{36.1} & 70.9 & 65.5 & 96.8 & 52.7 & 76.2 & \textbf{34.2} \\ \hline AlexNet + RegionVLAD & 44.5 & 94.1 & 58.5 & 31.9 & 60 & 53.5 & 71.8 & 57.1 & 67.2 & 31.2 \\ \hline AMOSNet + CALC & 41.8 & 85.6 & 63.0 & 35.0 & 30.0 & 55.5 & 56.2 & 83.4 & 81.3 & 30.4 \\ \hline AMOSNet + CoHoG & 44.0 & 95.4 & 69.3 & 29.3 & 84.2 & 60.5 & \textbf{100} & 83.1 & 84.1 & 32.5 \\ \hline AMOSNet + HoG & 42.11 & 85.6 & 69.3 & 30.8 & 27.1 & 52.5 & 56.2 & 90.3 & 82.8 & 32.5 \\ \hline AMOSNet + HybirdNet & 42.11 & 89.8 & 72.0 & 34.5 & 30.9 & 57.9 & 62.5 & 89.5 & 82.5 & 29.8 \\ \hline AMOSNet + NetVLAD & 47.2 & 97.6 & 66.6 & 35.0 & 73.8 & 75.5 & 96.8 & 83.6 & \textbf{86.1} & 34.1 \\ \hline AMOSNet + RegionVLAD & 44.5 & 94.6 & 65.7 & 33.5 & 61.9 & 62.0 & 68.7 & 83.4 & 84.0 & 31.2 \\ \hline CALC + CoHoG & 42.3 & 94.3 & 54.9 & 25.1 & 83.3 & 45.5 & 96.8 & 26.6 & 59.1 & 29.6 \\ \hline CALC +HoG & 34.4 & 63.4 & 47.7 & 27.2 & 13.3 & 33.0 & 53.1 & 75.0 & 60.1 & 30.6 \\ \hline CALC + HybridNet & 42.3 & 94.3 & 54.9 & 25.1 & 83.3 & 45.5 & 96.8 & 26.6 & 59.1 & 29.6 \\ \hline CALC + NetVLAD & 47.0 & 97.3 & 47.7 & 34.5 & 71.4 & 63.5 & 96.8 & 30.0 & 74.4 & 32.1 \\ \hline CALC + RegionVLAD & 43.3 & 93.0 & 43.2 & 32.9 & 61.4 & 51.5 & 65.6 & 35.1 & 64.4 & 28.4 \\ \hline CoHoG + HoG & 42.8 & 94.6 & 63.9 & 19.3 & 82.3 & 47.5 & 96.8 & 73.5 & 62.9 & 31.2 \\ \hline CoHoG + HybridNet & 45.0 & 95.4 & \textbf{77.4} & 31.9 & 84.7 & 58.5 & \textbf{100} & 86.2 & 83.1 & 31.4 \\ \hline CoHoG + NetVLAD & 45.8 & 97.6 & 61.2 & 27.2 & \textbf{88.5} & 74.5 & 96.8 & 22.3 & 74.6 & 32.9 \\ \hline CoHoG + RegionVLAD & 44.0 & 97.0 & 59.4 & 25.6 & 86.1 & 59.5 & 96.8 & 28.4 & 64.0 & 31.5 \\ \hline HoG + HybridNet & 42.6 & 90.1 & 75.6 & 33.5 & 29.5 & 50.5 & 62.5 & \textbf{91.4} & 82.5 & 31.3 \\ \hline HoG + NetVLAD & 45.8 & 97.6 & 61.2 & 27.2 & \textbf{88.5} & 74.5 & 96.8 & 22.3 & 74.6 & 32.5 \\ \hline HoG + RegionVLAD & 43.3 & 93.8 & 54.9 & 26.1 & 59.0 & 50.0 & 65.6 & 74.3 & 68.6 & 32.5 \\ \hline HybridNet + NetVLAD & 45.0 & 94.9 & 72.9 & \textbf{36.1} & 61.4 & 61.0 & 75.0 & 86.4 & 83.0 & 29.7 \\ \hline HybridNet + RegionVLAD & 45.0 & 94.9 & 72.9 & \textbf{36.1} & 61.4 & 61.0 & 75.0 & 86.4 & 83.0 & 29.7 \\ \hline NetVLAD + RegionVLAD & 46.7 & \textbf{98.4} & 51.3 & 35.6 & 79.5 & \textbf{77.0} & 96.8 & 31.3 & 77.5 & 33.1 \\ \hline \end{tabular} \end{adjustbox} \end{table*} \begin{figure*}[!htb] \centering \vspace*{0.2in} \includegraphics[width=2\columnwidth,height=13cm]{RADAR_SMALL_CON.png} \caption{Max (upper bound), Min (lower bound), and Median complementarity of state-of-the-art VPR methods with: AlexNet (top left); AMOSNet (top centre); CALC (top right); CoHoG (middle left); HoG (middle centre) HybridNet (middle right); NetVLAD (bottom left); RegionVLAD (bottom right).} \label{figurelabel} \end{figure*} This section presents the results generated by utilising the proposed framework over a set of eight state-of-the-art VPR techniques on a variety of standard VPR data sets. Fig. 3 and Fig. 4 depict the complementarity scores of different VPR methods with each other on various standard data sets. Fig. 3 depicts how AlexNet has a high complementairty to NetVLAD, HybridNet and RegionVLAD while other methods have a significantly lower complementarity. This can be observed from 24-7, Essex3in1, GardenPoint and Livingroom datasets for NetVLAD (0.9, 0.65, 0.65 and 0.9 respectively). While the combination with HybridNet performs well on 24-7, Corridor, Nordland and SPED data sets (0.7, 0.5, 0.75 and 0.6 respectively) and the combination with RegionVLAD has the highest scores on 24-7 and Essex3in1 dataset. The remaining options are either not as complementary to AlexNet or perform well for only one data set but not the others. Except CoHoG and NetVLAD all other methods considered do not complement AMOSNet well. This can be noticed from the high complementarity scores of AMOSNet with CoHoG on 24/7 and Essex3in1 and Livingroom datasets (0.7, 0.8 ,1 respectively). Similarly, the combination of AMOSNet with NetVLAD achieves complementarity scores of 0.85, 0.65, 0.9 for the same three datasets respectively. Any one of the two techniques (CoHoG and NetVLAD) would be a viable fit for combining with AMOSNet in a system, while the least fit technique to be fused with AMOSNet on the basis of complementarity appears to be CALC which consistently scores low on all the datasets. Considering CALC as the primary VPR technique, it is evident from Fig. 3 that there are several suitable options with high complementarity scores over several data sets that are available. For example, CoHoG complements CALC well as shown by high scores on 24/7, Essex3in1, Livingroom and SPED datasets with exceptions present for Cross-Seasons and Nordland datasets. The second-best option for combining with CALC appears to be HybridNet which achieves high complementarity scores for several datasets including 24-7, Corridor, Nordland and SPED. Another promising technique to combine with CALC as the primary technique is NetVLAD as it performs as well as CoHoG on 24-7, Essex3in1, GardenPoint and Livingroom datasets (0.9, 0.6, 0.7, 0.9 respectively). The least complementary techniques with CALC appear to be AlexNet and RegionVLAD as evident from low scores over all datasets. When utilising CoHoG as the primary VPR technique, fusing HybridNet, AMOSNet and NetVLAD seem to be suitable options (see Fig. 3) and the least favorable option appears to be CALC. Fig. 4 displays the complementarity of HoG as the primary technique and presents several viable options including CoHoG, NetVLAD, HybridNet and AMOSNet. On the other hand, HybridNet as the primary technique has some substantially varying results with high complementarity scores achieved by CoHoG and NetVLAD reaching close to 0.8 for 24/7, Essex3in1 and Livingroom datasets. However, combinations with AMOSNet and CALC mostly have low scores remaining below 0.4 and 0.1 for all datasets. Combinations formed with NetVLAD (as the primary VPR technique), the complementarity scores indicate that different combinations work well for different datasets although HybridNet seems to outshine other combinations on Livingroom and Nordland datasets along with substantial scores for other datasets as well. The consistently low complementarity scores belong to RegionVLAD and CALC, thus making them the least suitable options with NetVLAD. Finally, RegionVLAD complements well with CoHoG, NetVLAD and HybridNet while having the lowest complementarity with CALC and AlexNet. It may be concluded from Fig. 3 and Fig. 4 that the most suitable VPR technique to form viable combinations with all other VPR methods is NetVLAD, while the least favorable technique is found to be CALC that holds low complementarity with all other state-of-the-art VPR techniques Fig. 5 depicts the lower and upper bounds of complementarity for the different VPR combinations that are discussed above. Beginning from combinations formed with AlexNet the largest upper bounds can be observed for NetVLAD, RegionVLAD and then HybridNet. HoG has a slightly smaller upper bound value, but the smallest upper bound value is for CALC. AMOSNet (as the primary VPR technique), the largest upper bounds are held by NetVLAD and CoHoG, while the smallest upper bound values belong to HybridNet and CALC. The lower bounds for AMOSNet combinations are somewhat similar and remain within the 0.1 boundary. For combinations of CALC with other VPR techniques, the upper bounds for all combinations appear to have high values. The highest upper bound values, however, are held by NetVLAD and CoHoG and is almost 1.0. The smallest upper bound value in this case is for AlexNet and as for the lower bounds, these again appear to have similar values all below 0.2 for all combinations. With CoHoG (as the primary VPR technique), out of different combinations, the highest upper bound value belongs to HybridNet and AMOSNet (above 0.8). NetVLAD is also close with an upper bound value of 0.6. The lowest value is achieved by CALC which is around 0.1 quite similar to it's lower bound value. For HoG (as the primary VPR technique) the highest upper bound values are possessed by NetVLAD and CoHoG, while RegionVLAD and HybridNet fall next in line. The smallest upper bound value belongs to CALC and AlexNet. The lower bound score correspond to the upper bound values with the largest for NetVLAD and CoHoG and smallest for CALC and AlexNet. For combinations of HybridNet (as the primary VPR technique) with other state-of-the-art methods, the highest upper bound values are achieved by NetVLAD and CoHoG, while AMOSNet and RegionVLAD have significantly lower values in comparison (around 0.4 and 0.6 respectively). The lowest value, however, is still achieved by CALC and AlexNet which are almost the same as their lower bound value. For combinations of NetVLAD, the highest upper bounds are held by AMOSNet and HybridNet, with CoHoG next in line. As for the lower bounds, the values seem to be quite uniform and remain low for all combinations (below 0.1). Finally, for combinations of RegionVLAD with other state-of-the-art VPR techniques, the highest upper bound values are achieved by NetVLAD, HybridNet and AMOSNet. It may be concluded from Fig. 5 that combinations of NetVLAD appears to have the highest upper bound values for most combinations, while CALC consistently appears to have the smallest upper and lower bound values for almost all combinations that have been tested. Table 2 presents the maximum achievable VPR performance values for 28 different combinations of state-of-the-art VPR methods utilizing the proposed framework. It is evident that each combination has varying \textit{MAPE} values over each dataset. The highest \textit{MAPE} by a VPR combination for each dataset has been highlighted. It can be observed that for the 17Places dataset many combinations show promising \textit{MAPE} values but there isn’t a significant difference between them, although the highest \textit{MAPE} value belongs to AlexNet + NetVLAD. For the 24-7 dataset the MAPE for almost all combinations are somewhat consistent but the highest value of 98.4\% which is by NetVLAD + RegionVLAD is significantly higher. The Corridor dataset has some varying \textit{MAPE} values ranging from 40\%-77\% while the highest value is obtained by CoHoG + HybridNet. Moving on to the CrossSeasons dataset that has lower \textit{MAPE} values overall compared to other datasets with the highest value of 36.1\% obtained by not one but three different combinations that are; AlexNet + NetVLAD, HybridNet + NetVLAD and HybridNet + RegionVLAD. The next dataset, Essex3in1, has two highest \textit{MAPE} values of 88.5\% attained by CoHoG + NetVLAD and HoG + NetVLAD. For GardenPoint dataset the \textit{MAPE} values remain between 34\% to 77\% being the highest which belongs to NetVLAD + RegionVLAD. Some of the highest \textit{MAPE} values by all combinations can be observed for the Livingroom dataset which the highest value of 100\% is obtained by AMOSNet + CoHoG and CoHoG + HybridNet both. The Nordland dataset has very diverse \textit{MAPE} values with lowest being 22.3\% by HoG + NetVLAD and the highest \textit{MAPE} value of 91.4\% by HoG + HybridNet. The SPED and SYNTHIA dataset have quite the opposite results, on one hand SPED has very high \textit{MAPE} values with the greatest value of 86.1 by AMOSNet + NetVLAD while SYNTHIA has significantly lower values for all combinations and the largest among them is 34.2 by AlexNet + NetVLAD. Overall results suggest that best options to consider after the selection of a primary VPR technique are NetVLAD, RegionVLAD and HybridNet as they appear to perform the best for most combinations they form. \section{Conclusions and Future Work} This paper has proposed a well-defined framework for determining the viability of combining different VPR methods for a multi-process fusion system. The complementarity information computed through the proposed framework helps to select the best possible combination of VPR techniques to ensure performance improvement in fused systems. The results obtained utilising the presented framework for eight state-of-the-art VPR methods over ten widely-used VPR datasets provide new insights regarding complementarity of various VPR methods and estimate their maximum performance. This paper has considered only pairs of VPR techniques. A promising future direction is to investigate extension to a combination of three or more VPR techniques. \addtolength{\textheight}{-12cm}
\subsection*{\chem{NO} in the mesosphere and lower thermosphere}\label{ssec:MLTNO} \chem{NO} in the mesosphere and lower thermosphere is produced by \chem{N_2} dissociation, \begin{reaction}\label{reac:N2to2N} \chem{N_2} + h\nu \rightarrow \chem{N(^2D)} + \chem{N(^4S)} \quad (\lambda < 102\,\text{nm}) \;, \end{reaction} followed by the reaction of the excited nitrogen atom \chem{N(^2D)} with molecular oxygen~\citep{Solomon1982, Barth1992, Barth1995}: \begin{reaction}\label{reac:NpO2toNOpO} \chem{N(^2D)} + \chem{O_2} \rightarrow \chem{NO} + \chem{O} \;. \end{reaction} The dissociation energy of \chem{N_2} into ground state atoms \chem{N(^4S)} is about 9.8\,eV ($\lambda\approx127$\,nm)~\citep{Hendrie1954, Frost1956, Heays2017}. This energy together with the excitation energy to \chem{N(^2D)} is denoted by $h\nu$ in Reaction~\eqref{reac:N2to2N} and can be provided by a number of sources, most notably by auroral or photoelectrons as well as by soft solar X-rays. The \chem{NO} content is reduced by photodissociation, \begin{reaction}\label{reac:NOtoNpO} \chem{NO} + h\nu \rightarrow \chem{N} + \chem{O} \quad (\lambda < 191\,\text{nm}) \;, \end{reaction} by photoionization \begin{reaction}\label{reac:NOtoNOppe} \chem{NO} + h\nu \rightarrow \chem{NO}^+ + \chem{e}^- \quad (\lambda < 134\,\text{nm}) \;, \end{reaction} and by reacting with atomic nitrogen: \begin{reaction}\label{reac:NOpNtoN2pO} \chem{NO} + \chem{N} \rightarrow \chem{N_2} + \chem{O} \;. \end{reaction} \chem{N_2O} has been retrieved in the mesosphere and thermosphere from MIPAS (see, e.g.~\citealp{Funke2008, Funke2008a}) and from Scisat-1/ACE-FTS~\citep{Sheese2016a}. Model--measurement studies by~\citet{Semeniuk2008} attributed the source of this \chem{N_2O} to being most likely the reaction between \chem{NO_2} and \chem{N} atoms produced by particle precipitation: \begin{reaction}\label{reac:NpNO2toN2OpO} \chem{N} + \chem{NO_2} \rightarrow \chem{N_2O} + \chem{O} \;. \end{reaction} We note that photo-excitation and photolysis at 185\,nm (vacuum UV) of \chem{NO} or \chem{NO_2} mixtures in nitrogen, \chem{N_2}, or helium mixtures at 1\,atm leads to \chem{N_2O} formation~\citep{Maric1992}. Both mechanisms explaining the production of \chem{N_2O} involve excited states of \chem{NO}. Hence these pathways contribute to the loss of \chem{NO} and potentially an additional daytime source of \chem{N_2O} in the upper atmosphere. \chem{N_2O} acts as an intermediate reservoir at high altitudes ($\gtrapprox 90$\,km; see~\citealp{Sheese2016a}), reacting with \chem{O}($^1$D) in two well-known channels to \chem{N_2} and \chem{O_2} as well as to 2\chem{NO}. However, the largest \chem{N_2O} abundances are located below 60\,km and originate primarily from the transport of tropospheric \chem{N_2O} into the stratosphere through the Brewer--Dobson circulation~\citep{Funke2008a, Funke2008, Sheese2016a} but can reach up to 70\,km in geomagnetic storm conditions~\citep{Funke2008a, Sheese2016a}. Both source and sink reactions indicate that \chem{NO} behaves differently in sunlit conditions than in dark conditions. \chem{NO} is produced by particle precipitation at auroral latitudes, but in dark conditions (without photolysis) it is only depleted by reacting with atomic nitrogen (Reaction~\eqref{reac:NOpNtoN2pO}). This asymmetry between production and depletion in dark conditions results in different lifetimes of \chem{NO}. Early work to parametrize \chem{NO} in the lower thermosphere (100--150\,km) used SNOE measurements from March~1998 to September~2000~\citep{Marsh2004}. With these 2.5 years of data and using empirical orthogonal functions, the so-called NOEM (Nitric Oxide Empirical Model) estimates \chem{NO} in the lower thermosphere as a function of the solar f$_{10.7\,\text{cm}}$ radio flux, the solar declination angle, and the planetary Kp index. NOEM is still used as prior input for \chem{NO} retrieval, for example from MIPAS~\citep{Bermejo-Pantaleon2011, Funke2012a} and SCIAMACHY~\citep{Bender2017} spectra. However, 2.5 years is relatively short compared to the 11-year solar cycle, and the years 1998 to 2000 encompass a period of elevated solar activity. To address this, a longer time series from AIM/SOFIE was used to determine the important drivers of \chem{NO} in the lower thermosphere (90--140\,km) by~\citet{Hendrickx2017}. Other recent work uses 10 years of \chem{NO} data from Odin/SMR from 85 to 115\,km~\citep{Kiviranta2018}. \citet{Funke2016} derived a semi-empirical model of \chem{NO_y} in the stratosphere and mesosphere from MIPAS data. Here we use Envisat/SCIAMACHY \chem{NO} data from the nominal limb mode~\citep{Bender2017, Bender2017c}. Apart from providing a similarly long time series of \chem{NO} data, the nominal Envisat/SCIAMACHY \chem{NO} data cover the mesosphere from 60 to 90\,km~\citep{Bender2017}, bridging the gap between the stratosphere and lower thermosphere models. The paper is organized as follows: we present the data used in this work in Sect.~\ref{sec:data}. The two model variants, linear and non-linear, are described in Sect.~\ref{sec:regression}. Details about the parameter and uncertainty estimation are explained in Sect.~\ref{sec:fit}, and we present the results in Sect.~\ref{sec:results}. Finally we conclude our findings in Sect.~\ref{sec:conclusions}. \section{Data}\label{sec:data} \subsection{SCIAMACHY \chem{NO}}\label{ssec:scia.no} We use the SCIAMACHY nitric oxide data set version~6.2.1~\citep{Bender2017c} retrieved from the nominal limb scan mode ($\approx 0$--93\,km). For a detailed instrument description, see~\citet{Burrows1995} and~\citet{Bovensmann1999}, and for details of the retrieval algorithm, see~\citet{Bender2013, Bender2017}. The data were retrieved for the whole Envisat period (August~2002--April~2012). This satellite was orbiting in a sun-synchronous orbit at around 800\,km altitude, with Equator crossing times of 10:00 and 22:00 local time. The \chem{NO} number densities from the SCIAMACHY nominal mode were retrieved from the \chem{NO} gamma band emissions. Since those emissions are fluorescent emissions excited by solar UV, SCIAMACHY \chem{NO} data are only available for the 10:00 dayside (downleg) part of the orbit. Furthermore, the retrieval was carried out for altitudes from 60 to 160\,km, but above approximately 90\,km, the data reflect the scaled a priori densities from NOEM~\citep{Bender2017}. We therefore restrict the modelling to the mesosphere below 90\,km. We averaged the individual orbital data longitudinally on a daily basis according to their geomagnetic latitude within 10{\degree} bins. The geomagnetic latitude was determined according to the eccentric dipole approximation of the 12th generation of the International Geomagnetic Reference Field (IGRF12)~\citep{Thebault2015}. In the vertical direction the original retrieval grid altitudes (2\,km bins) were used. Note that mesospheric \chem{NO} concentrations are related to geomagnetically as well as geographically based processes, but disentangling them is beyond the scope of the paper. Follow-up studies can build on the method presented here and study, for example, longitudinally resolved timeseries. The measurement sensitivity is taken into account via the averaging kernel diagonal elements, and days where its binned average was below 0.002 were excluded from the timeseries. Considering this criterion, each bin (geomagnetic latitude and altitude) contains about 3400~data points. \subsection{Proxies}\label{ssec:proxies} We use two proxies to model the \chem{NO} number densities, one accounting for the solar irradiance variations and one accounting for the geomagnetic activity. Various proxies have been used or proposed to account for the solar-irradiance-induced variations in mesospheric--thermospheric \chem{NO}, which are in particular related to the 11-year solar cycle. The NOEM (Nitric Oxide Empirical Model;~\citealp{Marsh2004}) uses the natural logarithm of the solar 10.7\,cm radio flux $f_{10.7}$. More recent work on AIM/SOFIE \chem{NO}~\citep{Hendrickx2017} uses the solar Lyman-$\alpha$ index because some of the main production and loss processes are driven by UV photons. Besides accounting for the long-term variation of \chem{NO} with solar activity, the Lyman-$\alpha$ index also includes short-term UV variations and the associated \chem{NO} production, for example caused by solar flares. \citet{Barth1988} have shown that the Lyman-$\alpha$ index directly relates to the observed \chem{NO} at low latitudes (30\degree S--30\degree N). Thus we use it in this work as a proxy for \chem{NO}. In the same manner as for the irradiance variations, the ``right'' geomagnetic index to model particle-induced variations of \chem{NO} is a matter of opinion. Kp is the oldest and most commonly used geomagnetic index; it was, for example, used in earlier work by~\citet{Marsh2004} for modelling \chem{NO} in the mesosphere and lower thermosphere. Kp is derived from magnetometer stations distributed at different latitudes and mostly in the Northern Hemisphere (NH). However, \citet{Hendrickx2015} found that the auroral electrojet index (AE)~\citep{Davis1966} correlated better with SOFIE-derived \chem{NO} concentrations~\citep{Hendrickx2015, Hendrickx2017};~\cite[see also][]{Sinnhuber2016}. The AE index is derived from stations distributed almost evenly within the auroral latitude band. This distribution enables the AE index to be more closely related to the energy input into the atmosphere at these latitudes. Therefore, we use the auroral electrojet index (AE) as a proxy for geomagnetically induced \chem{NO}. To account for the 10:00 satellite sampling, we average the hourly AE index from noon the day before to noon on the measurement day. It should be noted that tests using Kp (or its linear equivalent Ap) instead of AE and using $f_{10.7}$ instead of Lyman-$\alpha$ suggested that the particular choice of index did not lead to significantly different results. Our choice of AE rather than Kp and Lyman-$\alpha$ over $f_{10.7}$ is physically based and motivated as described above. \section{Regression model}\label{sec:regression} We denote the number density by $x_{\text{NO}}$ as a function of the (geomagnetic; see Sect.~\ref{ssec:scia.no}) latitude $\phi$, the altitude $z$, and the time (measurement day) $t$: $x_{\text{NO}}(\phi, z, t)$. In the following we often drop the subscript \chem{NO} and combine the time direction into a vector $\vec{x}$ with the $i$th entry denoting the density at time $t_i$, such that $x_i(\phi, z) = x(\phi, z, t_i)$. \subsection{Linear model}\label{ssec:mod.lin} In the (multi-)linear case, we relate the nitric oxide number densities $x_{\text{NO}}(\phi, z, t)$ to the two proxies, the solar Lyman-$\alpha$ index (Ly$\alpha$($t$)) and the geomagnetic AE index (AE($t$)). Harmonic terms with $\omega = 2\pi\,\text{a}^{-1} = 2\pi(365.25\,\text{d})^{-1}$ account for annual and semi-annual variations. The linear model, including a constant offset for the background density, describes the \chem{NO} density according to Eq.~\eqref{eq:mod.lin}: \begin{equation}\label{eq:mod.lin} \begin{aligned} x_{\text{NO}}(\phi, z, t) &= a(\phi, z) + b(\phi, z)\cdot\text{Ly}\alpha(t) + c(\phi, z)\cdot\text{AE}(t) \\ & \quad {} + \sum_{n=1}^{2} \left[d_n(\phi, z)\cos(n\omega t) \right. \\ & \qquad\qquad \left. + e_n(\phi, z)\sin(n\omega t)\right] \;. \end{aligned} \end{equation} The linear model can be written in matrix form for the $n$ measurement times $t_1, \ldots, t_n$ as Eq.~\eqref{eq:mod.linmat}, with the parameter vector $\vec{\beta}$ given by $\vec{\beta}_{\text{lin}} = (a, b, c, d_1, e_1, d_2, e_2)^{\top} \in \mathbb{R}^7$ and the model matrix $\mathbf{X} \in \mathbb{R}^{n\times 7}$. \begin{equation}\label{eq:mod.linmat} \begin{aligned} \vec{x}_{\text{NO}}(\phi, z) &= \left( \begin{matrix} 1 & \text{Ly}\alpha(t_1) & \text{AE}(t_1) & \cos(\omega t_1) & \sin(\omega t_1) \\ \vdots & & & \\ 1 & \text{Ly}\alpha(t_{n}) & \text{AE}(t_{n}) & \cos(\omega t_{n}) & \sin(\omega t_{n}) \end{matrix} \right. \\ &\qquad \left. \begin{matrix} \cos(2\omega t_1) & \sin(2\omega t_1) \\ & \vdots \\ \cos(2\omega t_{n}) & \sin(2\omega t_{n}) \end{matrix} \right) \cdot \left( \begin{matrix} a \\ b \\ c \\ d_1 \\ e_1 \\ d_2 \\ e_2 \end{matrix} \right) \\ &= \mathbf{X} \cdot \vec{\beta} \end{aligned} \end{equation} We determine the coefficients via least squares, minimizing the squared differences of the modelled number densities to the measured ones. \subsection{Non-linear model}\label{ssec:mod.nonlin} In contrast to the linear model above, we modify the AE index by a finite lifetime $\tau$ which varies according to season, we denote this modified version by $\widetilde{\text{AE}}$. We then omit the harmonic parts in the model, and the non-linear model is given by Eq.~\eqref{eq:mod.nlin}: \begin{equation} \label{eq:mod.nlin} x_{\text{NO}}(\phi, z, t) = a(\phi, z) + b(\phi, z)\cdot\text{Ly}\alpha(t) + c(\phi, z)\cdot\widetilde{\text{AE}}(t) \;. \end{equation} Although this approach shifts all seasonal variations to the AE index and thus attributes them to particle-induced effects, we found that the residual traces of particle-unrelated seasonal effects were minor compared to the overall improvement of the fit. Additional harmonic terms only increase the number of free parameters without substantially improving the fit further. The lifetime-corrected $\widetilde{\text{AE}}$ is given by the sum of the previous 60~days' AE values, each multiplied by an exponential decay factor: \begin{equation} \label{eq:mod.nlin.AEtilde} \widetilde{\text{AE}}(t) = \sum_{t_i = 0}^{60\,\text{d}} \text{AE}(t - t_i)\cdot\exp\left\{ -\frac{t_i}{\tau} \right\} \;. \end{equation} The total lifetime $\tau$ is given by a constant part $\tau_0$ plus the non-negative fraction of a seasonally varying part $\tau_t$: \begin{align} \tau &= \tau_0 + \begin{cases} \tau_t\;, & \tau_t \geq 0 \\ 0\;, & \tau_t < 0 \end{cases}\;, \label{eq:mod.tau} \\ \tau_t &= d\cos(\omega t) + e\sin(\omega t) \;, \label{eq:mod.tau.t} \end{align} where $\tau_t$ accounts for the different lifetime during winter and summer. The parameter vector for this model is given by $\vec{\beta}_{\text{nonlin}} = (a, b, c, \tau_0, d, e)^{\top} \in \mathbb{R}^6$, and we describe how we determine these coefficients and their uncertainties in the next section. \section{Parameter and uncertainty estimation}\label{sec:fit} The parameters are usually estimated by maximizing the likelihood, or, in the case of additional prior constraints, by maximizing the posterior probability. In the linear case and in the case of independently identically distributed Gaussian measurement uncertainties, the maximum likelihood solutions are given by the usual linear least squares solutions. Estimating the parameters in the non-linear case is more involved. Various methods exist, for example conjugate gradient, random (Monte Carlo) sampling or exhaustive search methods. The assessment and selection of the method to estimate the parameters in the non-linear case are given below. \subsection{Maximum posterior probability}\label{ssec:maxpost} Because of the complicated structure of the model function in Eq.~\eqref{eq:mod.nlin}, in particular the lifetime parts in Eqs.~\eqref{eq:mod.tau} and~\eqref{eq:mod.tau.t}, the usual gradient methods converge slowly, if at all. Therefore, we fit the parameters and assess their uncertainty ranges using Markov chain Monte Carlo (MCMC) sampling~\citep{emcee}. This method samples probability distributions, and we apply it to sample the parameter space putting emphasis on parameter values with a high posterior probability. The posterior distribution is given in the Bayesian sense as the product of the likelihood and the prior distribution: \begin{equation}\label{eq:posterior} p(\vec{x}_\text{mod} | \vec{y}) \propto p(\vec{x}_\text{mod} | \vec{y}, \vec{\beta}) p(\vec{\beta}) \;. \end{equation} We denote the vector of the measured densities by $\vec{y}$ and the modelled densities by $\vec{x}_{\text{mod}}$ similar to Eqs.~\eqref{eq:mod.lin} and~\eqref{eq:mod.nlin}. To find the best parameters $\vec{\beta}$ for the model, we maximize $\log p(\vec{x}_\text{mod} | \vec{y})$ The likelihood $p(\vec{x}_\text{mod} | \vec{y}, \vec{\beta})$ is in our case given by a Gaussian distribution of the residuals, the difference of the model to the data, given in Eq.~\eqref{eq:likelihood}: \begin{equation}\label{eq:likelihood} \begin{aligned} p(\vec{x}_\text{mod} | \vec{y}, \vec{\beta}) &= \mathcal{N} \left(\vec{y}, \mathbf{S}_{y}\right) \\ &= C \exp\left\{ -\frac{1}{2} \left(\vec{y} - \vec{x}_\text{mod}(\vec{\beta})\right)^\top \right. \\ & \qquad \qquad \qquad \left. \vphantom{\frac{1}{2}} \mathbf{S}_{y}^{-1} \left(\vec{y} - \vec{x}_\text{mod}(\vec{\beta})\right) \right\} \;. \end{aligned} \end{equation} Note that the normalization constant $C$ in Eq.~\eqref{eq:likelihood} does not influence the value of the maximal likelihood. The covariance matrix $\mathbf{S}_{y}$ contains the squared standard errors of the daily zonal means on the diagonal, $\mathbf{S}_{y} = \text{diag}(\sigma_y^2)$. The prior distribution $p(\vec{\beta})$ restricts the parameters to lie within certain ranges, and the bounds we used for the sampling are listed in Table~\ref{tab:paramspace}. Within those bounds we assume uniform (flat) prior distributions for the offset, the geomagnetic and solar amplitudes, and in the linear case also for the annual and semi-annual harmonics. We penalize large lifetimes using an exponential distribution $p(\tau) \propto \exp\{- \tau / \sigma_\tau\}$ for each lifetime parameter, i.e.\ for $\tau_0$, $d$, and $e$ in Eqs.~\eqref{eq:mod.tau} and~\eqref{eq:mod.tau.t}. The scale width $\sigma_\tau$ of this exponential distribution is fixed to 1 day. This choice of prior distributions for the lifetime parameters prevents sampling of the edges of the parameter space at places with small geomagnetic coefficients. In those regions the lifetime may be ambiguous and less meaningful. \begin{table} \caption{Parameter search space for the non-linear model and uncertainty estimation.}\label{tab:paramspace} \begin{tabular}{lrrc} \tophline Parameter & Lower bound & Upper bound & Prior \\ & & & form \\ \middlehline Offset ($a$) & $-10^{10}\,$cm$^{-3}$ & $10^{10}\,$cm$^{-3}$ & flat \\ Lyman-$\alpha$ amplitude ($b$) & $-10^{10}\,$cm$^{-3}$ & $10^{10}\,$cm$^{-3}$ & flat \\ AE amplitude ($c$) & $0\,$cm$^{-3}$ & $10^{10}\,$cm$^{-3}$ & flat \\ $\tau_0$ & $0\,$d & $100\,$d & exp \\ $\tau$ cosine amplitude ($d$) & $-100\,$d & $100\,$d & exp \\ $\tau$ sine amplitude ($e$) & $-100\,$d & $100\,$d & exp \\ \bottomhline \end{tabular} \end{table} \subsection{Correlations}\label{ssec:corr} In the simple case, the measurement covariance matrix $\mathbf{S}_{y}$ contains the measurement uncertainties on the diagonal, in our case the (squared) standard error of the zonal means denoted by $\sigma_y$, $\mathbf{S}_{y} = \text{diag}(\sigma_y^2)$. However, the standard error of the mean might underestimate the true uncertainties. In addition, possible correlations may occur which are not accounted for using a diagonal $\mathbf{S}_{y}$. Both problems can be addressed by adding a covariance kernel $\mathbf{K}$ to $\mathbf{S}_y$. Various forms of covariance kernels can be used~\citep{Rasmussen2006}, depending on the underlying process leading to the measurement or residual uncertainties. Since we have no prior knowledge about the true correlations, we use a commonly chosen kernel of the Mat\'{e}rn-3/2 type~\citep{Matern1960, MacKay2003, Rasmussen2006}. This kernel only depends on the (time) distance between the measurements $t_{ij} = \lvert t_i - t_j \rvert$ and has two parameters, the ``strength'' $\sigma$ and correlation length $\rho$: \begin{equation}\label{eq:corr.mat32} K_{ij} = \sigma^2 \left( 1 + \frac{\sqrt{3}\,t_{ij}}{\rho} \right) \exp\left\{- \frac{\sqrt{3}\,t_{ij}}{\rho} \right\} \;. \end{equation} Both parameters are estimated together with the model parameter vector $\vec{\beta}$. We found that using the kernel~\eqref{eq:corr.mat32} in a covariance matrix $\mathbf{S}_y$ with the entries \begin{equation}\label{eq:covariance} {S_y}_{ij} = K_{ij} + \delta_{ij} {\sigma_y}_i^2 \;, \end{equation} worked best and led to stable and reliable parameter sampling. Note that an additional ``white noise'' term $\sigma^2 \mathbbold{1}$ could be added to the covariance matrix to account for still underestimated data uncertainties. However, this additional white noise term did not improve the convergence, nor did it influence the fitted parameters significantly. The approximately $3000\times3000$ covariance matrix of the Gaussian process model for the residuals was evaluated using the~\citet{celerite} approximation and the provided Python code~\citep{celeritev030}. For one-dimensional data sets, this approach is computationally faster than the full Cholesky decomposition, which is usually used to invert the covariance matrix $\mathbf{S}_y$. With this approximation, we achieved sensible Monte Carlo sampling times to facilitate evaluating all $18\times16$ latitude\,$\times$\,altitude bins on a small cluster in about 1 day. We used the \texttt{emcee} package~\citep{emcee} for the Monte Carlo sampling, set up to use 112~walkers and 800~samples for the initial fit of the parameters, followed by another 800~so-called burn-in samples and 1400~production samples. The full code can be found at \texttt{https://github.com/st-bender/sciapy}~\citep{Bender2018a}. \section{Results}\label{sec:results} We demonstrate the parameter estimates using example time series $\vec{x}_{\text{NO}}$ at 70\,km at 65\degree S, 5\degree N, and 65\degree N. \chem{NO} shows different behaviour in these regions, showing the most variation with respect to the solar cycle and geomagnetic activity at high latitudes. In contrast, at low latitudes the geomagnetic influence should be reduced~\citep{Barth1988, Hendrickx2017, Kiviranta2018}. We briefly only show the results for the linear model and point out some of its shortcomings. Thereafter we show the results from the non-linear model and continue to use that for further analysis of the coefficients. \subsection{Time series fits}\label{ssec:res.fit} The fitted densities of the linear model Eq.~\eqref{eq:mod.lin} compared to the data are shown in the upper panels of Fig~\ref{fig:lin.fit} for the three example latitude bins (65\degree S, 5\degree N, 65\degree N) at 70\,km. The linear model works well at high southern and low latitudes. At high northern latitudes and to a lesser extent at high southern latitudes, the linear model captures the summer \chem{NO} variations well. However, the model underestimates the high values in the polar winter at active times (2004--2007) and overestimates the low winter values at quiet times (2009--2011). \begin{figure*}[t] \centering \includegraphics[width=5.5cm]{figures/data_model_residuals_-65_70_lin_median} \includegraphics[width=5.5cm]{figures/data_model_residuals_5_70_lin_median} \includegraphics[width=5.5cm]{figures/data_model_residuals_65_70_lin_median} \caption{Time series data and linear model values and residuals at 70\,km for 65\degree S~\textbf{(a, d)}, 5\degree N~\textbf{(b, e)}, and 65\degree N~\textbf{(c, f)}. Panels \textbf{(a)}--\textbf{(c)}~show the data (black dots with $2\sigma$ error bars) and the model values (blue line). Panels \textbf{(d)}--\textbf{(f)}~show the residuals as black dots with $2\sigma$ error bars. }\label{fig:lin.fit} \end{figure*} For the sample timeseries (65\degree S, 5\degree N, 65\degree N at 70\,km), the fits using the non-linear model Eq.~\eqref{eq:mod.nlin} are shown in the upper panels of Fig~\ref{fig:nonlin.fit}. The non-linear model better captures both the summer \chem{NO} variations as well as the high values in the winter, especially at high northern latitudes. However, at times of high solar activity (2003--2006) and in particular at times of a strongly disturbed mesosphere (2004, 2006, 2012), the residuals are still significant. At high southern and low latitudes, the improvement over the linear model is less evident. At low latitudes, the \chem{NO} content is apparently mostly related to the eleven-year solar cycle and the particle influence is suppressed. Since this cycle is covered by the Lyman-$\alpha$ index, both models perform similarly, but the non-linear version has one less parameter. In both regions the residuals show traces of seasonal variations that are not related to particle effects. The linear model appears to capture these variations better than the non-linear model. However, by objective measures including the number of model parameters% \footnote{Past and recent research in model selection provides a number of choices on how to compare models objectively. The results are so-called information criteria which aim to provide a consistent way of how to compare models, most notably the ``Akaike information criterion'' (AIC;~\citealp{Akaike1974}), the ``Bayesian information criterion'' or ``Schwarz criterion'' (BIC or SIC;~\citealp{Schwarz1978}), the ``deviance information criterion'' (DIC;~\citealp{Spiegelhalter2002, Ando2011}), or the ``widely applicable information criterion'' (WAIC;~\citealp{Watanabe2010, Vehtari2016}). Alternatively, the ``standardized mean squared error'' (SMSE) or the ``mean standardized log loss'' (MSLL)~\citep[chap.~2]{Rasmussen2006} give an impression of the quality of regression models with respect to each other. }, the non-linear version fits the data better in all bins (not shown here). At high southern latitudes, the SCIAMACHY data are less densely sampled compared to high northern latitudes (see~\citealp{Bender2017}). In addition to the sampling differences, geomagnetic latitudes encompass a wider geographic range in the Southern Hemisphere (SH) than in the Northern Hemisphere (NH), and the AE index is derived from stations in the NH. Both effects can lower the \chem{NO} concentrations that SCIAMACHY observes in the SH, particularly at the winter maxima. The lifetime variation that improves the fit in the NH is thus less effective in the SH. \begin{figure*}[t] \centering \includegraphics[width=5.5cm]{figures/data_model_residuals_-65_70_nl_median} \includegraphics[width=5.5cm]{figures/data_model_residuals_5_70_nl_median} \includegraphics[width=5.5cm]{figures/data_model_residuals_65_70_nl_median} \caption{Same as Fig.~\ref{fig:lin.fit} for the non-linear model. }\label{fig:nonlin.fit} \end{figure*} \subsection{Parameter morphologies}\label{ssec:res.morph} Using the non-linear model, we show the latitude--altitude distributions of the medians of the sampled Lyman-$\alpha$ and geomagnetic index coefficients in Fig.~\ref{fig:nonlin.params}. The white regions indicate values outside of the 95\% confidence region or whose sampled distribution has a skewness larger than 0.33. The MCMC method samples the parameter probability distributions. Since we require the geomagnetic index and constant lifetime parameters to be larger than zero (see Table~\ref{tab:paramspace}), these sampled distributions are sometimes skewed towards zero even though the 95\% credible region is still larger than zero. Excluding heavily skewed distributions avoids those cases because the ``true'' parameter is apparently zero. \begin{figure*}[t] \centering \includegraphics[width=16.6cm]{figures/NO_nom_gmag10deg_SolGMamp_cel_kM32_pAEltcs_exp1d_scan60d} \caption{Latitude--altitude distributions of the fitted solar index parameter (Lyman-$\alpha$, \textbf{a}) and the geomagnetic index parameter (AE, \textbf{b}) from the non-linear model. }\label{fig:nonlin.params} \end{figure*} The Lyman-$\alpha$ parameter distribution shows that its largest influence is at middle and low latitudes between 65 and 80\,km. Another increase of the Lyman-$\alpha$ coefficient is indicated at higher altitudes above 90\,km. The penetration of Lyman-$\alpha$ radiation decreases with decreasing altitude as a result of scattering and absorption by air molecules. On the other hand, the concentration of air decreases with altitude. At this stage we do not have an unambiguous explanation of this behaviour, but it may be related to reaction pathways as laid out by~\citet{Pendleton1983}, which would relate the \chem{NO} concentrations to the \chem{CO_2} and \chem{H_2O} (or \chem{OH}, respectively) profiles. The Lyman-$\alpha$ coefficients are all negative below 65\,km. We also observe negative values at high northern latitude at all altitudes and at high southern latitudes above 85\,km. These negative coefficients indicate that \chem{NO} photodissociation or conversion to other species outweighs its production via UV radiation in those places. The north--south asymmetry may be related to sampling and the difference in illumination with respect to geomagnetic latitudes; see Sect.~\ref{ssec:res.fit}. The geomagnetic influence is largest at high latitudes between 50 and 75\degree\ above about 65\,km. The AE coefficients peak at around 72\,km and indicate a further increase above 90\,km. This pattern of the geomagnetic influence matches the one found in~\citet{Sinnhuber2016}. Unfortunately both increased influences above 90\,km in Lyman-$\alpha$ and AE cannot be studied at higher latitudes due to a large a priori contribution to the data. The latitude--altitude distributions of the lifetime parameters are shown in Fig.~\ref{fig:nonlin.tauparams}. All values shown are within the 95\% confidence region. As for the coefficients above, we also exclude regions where the skewness was larger than 0.33. \begin{figure*}[t] \centering \includegraphics[width=16.6cm]{figures/NO_nom_gmag10deg_GMtau0+amp_cel_kM32_pAEltcs_exp1d_scan60d} \caption{Latitude--altitude distributions of the fitted base lifetime $\tau_0$ \textbf{(a)} and the amplitude of the annual variation $\lvert\tau_t\rvert$ \textbf{(b)} from the non-linear model. }\label{fig:nonlin.tauparams} \end{figure*} The constant part of the lifetime, $\tau_0$, is below 2 days in most bins, except for exceptionally large values ($> 10$~days) at low latitudes (0--20\degree N) between 68 and 74\,km. Although we constrained the lifetime with an exponential prior distribution, these large values apparently resulted in a better fit to the data. One explanation could be that because of the small geomagnetic influence (the AE coefficient is small in this region), the lifetime is more or less irrelevant. The amplitude of the annual variation ($\lvert\tau_{\text{t}}\rvert = \sqrt{\tau_{\text{cos}}^2 + \tau_{\text{sin}}^2} = \sqrt{d^2 + e^2}$; see Eq.~\eqref{eq:mod.tau.t}) is largest at high latitudes in the Northern Hemisphere and at middle latitudes in the Southern Hemisphere. This difference could be linked to the geomagnetic latitudes which include a wider range of geographic latitudes in the Southern Hemisphere compared to the Northern Hemisphere. Therefore, the annual variation is less apparent in the Southern Hemisphere. The amplitude also increases with decreasing altitude below 75\,km at middle and high latitudes and with increasing altitude above that. The increasing annual variation at low altitudes can be the result of transport processes that are not explicitly treated in our approach. Note that the term \emph{lifetime} is not a pure (photo)chemical lifetime; rather it indicates how long the AE signal persists in the \chem{NO} densities. In that sense it combines the (photo)chemical lifetime with transport effects as discussed in~\citet{Sinnhuber2016}. \subsection{Parameter profiles}\label{ssec:res.prof} For three selected latitude bins in the Northern Hemisphere (5, 35, and 65\degree N) we present profiles of the fitted parameters in Fig.~\ref{fig:prof.NH}. The solid line indicates the median, and the error bars indicate the 95\% confidence region. As indicated in Fig.~\ref{fig:nonlin.params}, the solar radiation influence is largest between 65 and 80\,km. Its influence is also up to a factor of 2 larger at low and middle latitudes compared to high latitudes, where the coefficient only differs significantly from zero below 65 and above 82\,km. Similarly, the geomagnetic impact decreases with decreasing latitude by 1 order of magnitude from high to middle latitudes and at least a further factor of 5 to lower latitudes. The largest impact is around 70--72\,km and possibly above 90\,km at high latitudes and is approximately constant between 66 and 76\,km at middle and low latitudes. Note that the scale in Fig.~\ref{fig:prof.NH}b is logarithmic. The lifetime variation shows that at high latitudes, geomagnetically affected \chem{NO} persists longer during winter (the phase is close to zero for all altitudes at 65\degree N, not shown here). It persists up to 10 days longer between 85 and 70\,km and increasingly longer below, reaching 28 days at 60\,km. \begin{figure*}[t] \centering \includegraphics[width=13cm]{figures/profiles_panels_nom_NH_cel_kM32_pAEltcs_exp1d_scan60d} \caption{Coefficient profiles of the solar index parameter (Lyman-$\alpha$, left, \textbf{a}), the geomagnetic index parameter (AE, middle, \textbf{b}), and the amplitude of the annual variation of the \chem{NO} lifetime (right, \textbf{c}) at 5\degree N (green), 35\degree N (orange), and 65\degree N (blue). The solid line indicates the median, and the error bars indicate the 95\% confidence region.}\label{fig:prof.NH} \end{figure*} For the same latitude bins in the Southern Hemisphere (5\degree S, 35\degree S, and 65\degree S) we present profiles of the fitted parameters in Fig.~\ref{fig:prof.SH}. Similar to the coefficients in the Northern Hemisphere (see Fig.~\ref{fig:prof.NH}), the solar radiation influence is largest between 65\,km and 80\,km and also up to a factor of two larger at low and middle latitudes compared to high latitudes. However, the Lyman-$\alpha$ coefficients at 65\degree S are significant below 82\,km. Also the geomagnetic AE coefficients show a similar pattern in the Southern Hemisphere compared to the Northern Hemisphere, decreasing by orders of magnitude from high to low latitudes. Note that the AE coefficients at high latitudes are slightly lower than in the Northern Hemisphere, whereas the coefficients at middle and low latitudes are slightly larger. This slight asymmetry was also found in the study by~\cite{Sinnhuber2016} and may be related to AE being derived solely from stations in the Northern Hemisphere~\citep{Mandea2011}. With respect to latitude, the annual variation of the lifetime seems to be reversed compared to the Northern Hemisphere, with almost no variation at high latitudes and longer persisting \chem{NO} at low latitudes. A faster descent in the southern polar vortex may be responsible for the short lifetime at high southern latitudes. Another reason may be the mixture of air from inside and outside of the polar vertex when averaging along geomagnetic latitudes since the 65\degree S geomagnetic latitude band includes geographic locations from about 45\degree S to 85\degree S. A third possibility may be the exclusion of the Southern Atlantic Anomaly from the retrieval~\citep{Bender2013, Bender2017} where presumably the particle-induced impact on \chem{NO} is largest. \begin{figure*}[t] \centering \includegraphics[width=13cm]{figures/profiles_panels_nom_SH_cel_kM32_pAEltcs_exp1d_scan60d} \caption{Coefficient profiles of the solar index parameter (Lyman-$\alpha$, left, \textbf{a}), the geomagnetic index parameter (AE, middle, \textbf{b}), and the amplitude of the annual variation of the \chem{NO} lifetime (right, \textbf{c}) at 5\degree S (green), 35\degree S (orange), and 65\degree S (blue). The solid line indicates the median, and the error bars indicate the 95\% confidence region.}\label{fig:prof.SH} \end{figure*} \subsection{Discussion}\label{ssec:res.discuss} The distribution of the parameters confirms our understanding of the processes producing \chem{NO} in the mesosphere to a large extent. The Lyman-$\alpha$ coefficients are related to radiative processes such as production by UV or soft X-rays, either directly or via intermediary of photoelectrons. The photons are not influenced by Earth's magnetic field, and the influence of these processes is largest at low latitudes and decreases towards higher latitudes. We observe negative Lyman-$\alpha$ coefficients below 65\,km at all latitudes and at high northern latitudes above 80\,km. These negative Lyman-$\alpha$ coefficients indicate that at high solar activity, photodissociation by $\lambda < 191\,$nm photons, photoionization by $\lambda < 134\,$nm photons, or collisional loss and conversion to other species outweigh the production from higher energy photons ($<40$\,nm). At high southern latitudes these negative Lyman-$\alpha$ coefficients are not as pronounced as at high northern latitudes. As mentioned in Sect.~\ref{ssec:res.morph}, this north--south asymmetry may be related to sampling and the difference in illumination with respect to geomagnetic latitudes, see also Sect.~\ref{ssec:res.fit}. The AE coefficients are largest at auroral latitudes as expected for the particle nature of the associated \chem{NO} production. The AE coefficient can be considered an effective production rate modulated by all short-term ($\ll 1$\,day) processes. To roughly estimate this production rate, we divided the coefficient of the (daily) AE by 86400\,s which follows the approach in~\citet{Sinnhuber2016}. We find a maximum production rate of about 1\,cm$^{-3}$\,nT$^{-1}$\,s$^{-1}$ around 70--72\,km. This production rate also agrees with the one estimated by~\citet{Sinnhuber2016} by a superposed epoch analysis of summertime \chem{NO}. Comparing the \chem{NO} production to the ionization rates from~\citet{Verronen2013} from 1 to 3~January~2005 (assuming approximately 1 \chem{NO} molecule per ion pair), our model overestimates the ionization derived from AE on these days. The AE values of 105, 355, and 435\,nT translate to 105, 355, and 435\,\chem{NO} molecules\,cm$^{-3}$\,s$^{-1}$, about 4 times larger than would be estimated from the ionization rates in~\citet{Verronen2013} but agreeing with~\citet{Sinnhuber2016}. The factor of 4 may be related to the slightly different locations, around 60\degree N~\citep{Verronen2013} compared to around 65\degree N here and in~\citet{Sinnhuber2016}, in which the ionization rates may be higher. The associated constant part $\tau_0$ of the lifetime ranges from around 1 to around 4 days, except for large $\tau_0$ at low latitudes around 70\,km. As already discussed in Sect.~\ref{ssec:res.morph}, these large lifetimes may be a side effect of the small geomagnetic coefficients and more or less arbitrary. The magnitude is similar to what was found in the study by~\citet{Sinnhuber2016} using only the summer data. The annual variation of the lifetime is largest at high northern latitudes with a nearly constant amplitude of 10~days between 70 and 85\,km. An empirical lifetime of 10~days in winter was used by~\citet{Sinnhuber2016} to extend the \chem{NO} predicted by the summer analysis to the larger values in winter. Here we could confirm that 10~days is a good approximation of the \chem{NO} lifetime in winter, but it varies with altitude. The altitude distribution agrees with the increasing photochemical lifetime at large solar zenith angles~\citep[Fig.~7b]{Sinnhuber2016}. The larger values in our study are similarly related to transport and mixing effects which alter the observed lifetime. The small variation of the lifetime at high southern latitudes could be a sampling issue because SCIAMACHY only observes small variations there in winter (see Figs.~\ref{fig:lin.fit} and~\ref{fig:nonlin.fit}). Note that the results (in particular the large annual variation) in the northernmost latitude bin should be taken with caution because this bin is sparsely sampled by SCIAMACHY, and the large winter \chem{NO} concentrations are actually absent from the data. \conclusions\label{sec:conclusions} We propose an empirical model to estimate the \chem{NO} density in the mesosphere (60--90\,km) derived from measurements from SCIAMACHY nominal-mode limb scans. Our model calculates \chem{NO} number densities for geomagnetic latitudes using the solar Lyman-$\alpha$ index and the geomagnetic AE index. Two approaches were tested, a linear approach containing annual and semi-annual harmonics and a non-linear version using a finite and variable lifetime for the geomagnetically induced variations. From our proposed models, the linear variant only describes part of the \chem{NO} variations. It can describe the summer variations but underestimates the large number densities during winter. The non-linear version derived from the SCIAMACHY \chem{NO} data describes both variations using an annually varying finite lifetime for the particle-induced \chem{NO}. However, in cases of dynamic disturbances of the mesosphere, for example in early 2004 or in early 2006, the indirectly enhanced \chem{NO}~\citep[see, for example,][]{Randall2007} is not captured by the model. These remaining variations are treated as statistical noise. \citet{Sinnhuber2016} use a superposed epoch analysis limited to the polar summer to model the \chem{NO} data. Here we extend that analysis to use all available SCIAMACHY nominal-mode \chem{NO} data for all seasons. However, during summer the present results show comparable \chem{NO} production per AE unit and similar lifetimes to the~\citet{Sinnhuber2016} study. The parameter distributions indicate in which regions the different processes are significant. We find that these distributions match our current understanding of the processes producing and depleting \chem{NO} in the mesosphere~\citep{Funke2014a, Funke2014, Funke2016, Sinnhuber2016, Hendrickx2017, Kiviranta2018}. In particular, the influence of Lyman-$\alpha$ (or solar UV radiation in general) is largest at low and middle latitudes, which is explained by the direct production of \chem{NO} via solar UV or soft X-ray radiation~\citep{Barth1988, Barth2003}. The geomagnetic influence is largest at high latitudes and is best explained by the production from charged particles that enter the atmosphere in the polar regions along the magnetic field. A potential improvement would be to use actual measurements of precipitating particles instead of the AE index. Using measured fluxes could help to confirm our current understanding of how those fluxes relate to ionization~\citep{Turunen2009, Verronen2013} and subsequent \chem{NO} production~\citep{Sinnhuber2016}. Furthermore, including dynamical transport, as for example in~\citet{Funke2016}, could improve our knowledge of the combined direct and indirect \chem{NO} production in the mesosphere. \authorcontribution{SB developed the model, prepared and performed the data analysis and set up the manuscript, MS provided input on the model and the idea of a variable \chem{NO} lifetime. JPB and PJE contributed to the discussion and use of language. All authors contributed to the interpretation and discussion of the method and the results as well as to the writing of the paper.} \codedataavailability{The SCIAMACHY \chem{NO} data set used in this study is available at \path{https://zenodo.org/record/1009078} \citep{Bender2017c}. The python code to prepare the data (daily zonal averaging) and to perform the analysis is available at \path{https://zenodo.org/record/1401370} \citep{Bender2018a} or at \path{https://github.com/st-bender/sciapy}. The daily zonal mean \chem{NO} data and the sampled parameter distributions are available at \path{https://zenodo.org/record/1342701} \citep{Bender2018b}. The solar Lyman-$\alpha$ index data were downloaded from \path{http://lasp.colorado.edu/lisird/data/composite_lyman_alpha/}, the AE index data were downloaded from \path{http://wdc.kugi.kyoto-u.ac.jp/aedir/}, and the daily mean values used in this study are available within the aforementioned data set. } \begin{acknowledgements} S.B.\ and M.S.\ thank the Helmholtz-society for funding part of this project under the grant number VH-NG-624. S.B.\ and P.J.E.\ acknowledge support from the Birkeland Center for Space Sciences (BCSS), supported by the Research Council of Norway under the grant number 223252/F50. The SCIAMACHY project was a national contribution to the ESA Envisat, funded by German Aerospace (DLR), the Dutch Space Agency, SNO, and the Belgium ministry. The University of Bremen as Principal Investigator has led the scientific support and development of the SCIAMACHY instrument as well as the scientific exploitation of its data products. This work was performed on the Abel Cluster, owned by the University of Oslo and Uninett/Sigma2, and operated by the Department for Research Computing at USIT, the University of Oslo IT-department. http://www.hpc.uio.no/ \end{acknowledgements}
\section{Introduction}\label{s1:Intro} In recent years, deep reinforcement learning has been successfully used to improve object manipulation with robotic hands \cite{Rajeswaran2017, Andrychowicz2020}. However, one of the primary limitations of these works is that in most robotic hands, the robot joint poses are explicitly controlled through position control and forces are implicitly decided. Lack of explicit control over the forces leads to limited safety and inability to handle uncertainties \cite{Li2014}. These might be critical factors when a robot is operating in unstructured environments and during the exploratory phase of the learning process~\cite{Haarnoja2018_3, Samuel2010}. Modulation of stiffness in concert with position control has been shown to address robustness, safety, and performance under uncertainties~\cite{Niehues2015, Kim2021, Mir2020}, and has gained much attention in the learning community as well \cite{abu2020variable}. However, stiffness control imposes additional action dimensions, which affects sample-efficiency of policy learning. This hindrance can be partially mitigated through guidance via imitation learning \cite{Schaal1999}. Expert demonstrations have been successfully collected and used in policy learning for position control-based robotic hands \cite{Rajeswaran2017, Nair2018, VanHoof2015}. However, in the case of stiffness control, such expert demonstrations are expensive and difficult to acquire. Typical demonstrations can directly be recorded via various sensors, but stiffness is not a measurable quantity, but rather a relationship. In prior literature, admittance control has been used to capture equilibrium position trajectories \cite{flash1987control, burdet2000method}. Subtle and quick impact perturbations are used to measure the compensatory forces and torques employed by the demonstrator while performing the trajectory, which are then used to implicitly calculate the stiffness at certain positions. These stiffness estimates are then used to further estimate and model the stiffness profiles, thereby compounding potential errors. This estimation process is more ambiguous for object manipulation due to the required precision and accuracy, and therefore poses a major challenge to learning stiffness control from demonstrations. In this paper, we present a novel learning strategy---Stiffness Control from Augmented Position control Experiences (SCAPE)---for learning state-dependent stiffness control policies in high-dimensional problems such as dexterous manipulation. Imitation learning is used in conjunction with reinforcement learning to provide policy guidance, and we propose a way to bypass the need for stiffness demonstrations through an augmentation process. This process leverages the knowledge of the robot model such that we do not require expert stiffness control demonstrations. Instead, position control demonstrations are augmented to infer approximate, suboptimal stiffness control demonstrations. To address this suboptimality, we use a Q-filter \cite{Nair2018} to prevent the agent from mimicking dangerous choices that may appear in the inferred stiffness demonstrations. We also introduce the concept of an imitation regulator that controls the mode of imitation depending on the assessment of the current policy. Ablation studies show that these techniques play meaningful roles in both safety and stability of learning. Through simulation and experiments, we show that SCAPE produces a successful policy that is robust to different types of realistic uncertainties, and safe in terms of force interaction. \section{Background and Related Works}\label{s2:pastworks} Some of the notable past works in learning stiffness control rely on a reference trajectory, which we refer to as trajectory-dependent approaches. However, the lack of robustness to uncertainties and variability in the task dynamics renders these approaches inapplicable to dexterous manipulation. Other recent research aims to learn a stiffness controller that dynamically adapts to the environment, which we refer to as state-dependent approaches. In this section, we briefly explain some of the notable attempts to learn stiffness control, and discuss possible shortcomings. \subsection{Trajectory-dependent Stiffness Controllers}\label{c2s1:traj-dependent} One possible approach is to learn time-indexed gain scheduling through PI$^{2}$ \cite{Theodorou2010}, which is a stochastic optimization method that results in a time-indexed reference trajectory that can be tracked by the robot without modeling the inverse kinematics or dynamics. This approach adds additional parameters to control compliance so that the resulting controller takes environment dynamics into account and modulates the gains accordingly \cite{Buchli2011, Rombokas2013, rey2018learning}. However, a solution from PI$^{2}$ can only optimize about a pre-defined cost function and cannot be used for object-centered manipulation, which requires highly divergent position and stiffness trajectories depending on the goal and observations. Another approach uses an Incremental Gaussian Mixture Model (IGMM) and Gaussian Mixture Regression (GMR) to predict the interaction force for the next time-step, and feed-forward appropriate control effort \cite{Mathew2019, Sidhik2020}. The goal of this approach is to learn a feed-forward model such that the feedback stiffness control effort can be minimized. However, this approach makes a critical assumption that expert demonstrations with force trajectories are available, which renders it inapplicable without such demonstrations. Trajectory planners combined with reinforcement learning can also be used. Once the trajectory is defined, a residual control policy can be learned to adjust the gains according to the current observation. This method is mostly used in simple tasks where a trajectory planner is readily available, such as in peg-in-hole assembly tasks \cite{Beltran-Hernandez2020, Beltran-Hernandez2020_2, zhang2021learning}. While this is a suitable approach for closed environments, it is less effective for dexterous manipulation where desired trajectories can change based on dynamic observations such as dropping the object or unexpected interaction forces. In addition, due to the lack of policy guidance, the learning process requires a complex reward function as well as an extensive amount of training time even with a trajectory planner aiding the policy search. \subsection{State-dependent Stiffness Controllers}\label{c2s2:state-dependent} Due to the specificity of the solution, relying on a fixed reference trajectory or scheduled gain is bound to result in catastrophic failure in dynamically changing environments. To account for a large degree of variability in the environment, state-dependent stiffness control policies have recently been proposed. In this paper, we compare our work with these state-dependent methods, as the existing trajectory-dependent approaches are inapplicable in dynamic settings. In one related approach, during hopping and wiping motions \cite{Bogdanovic2020}, the robots successfully produce stiffness control policies that outperform direct torque control and position control policies. However, this approach is strictly limited to simple and repetitive low-dimensional movements. For instance, the robot is allowed to move only in one direction in the hopping task, or along a pre-defined circular path in the wiping task. A similar work demonstrates the performance difference based on the form of the control policy \cite{Martin2019}, where variable impedance control outperforms all other controller types in simple tasks. Despite the effort to simplify the problem into a lower-dimensional manifold by keeping the gripper closed in the door opening task, the variable impedance control (VIC) fails to outperform the fixed impedance control. A possible culprit can be the high dimensionality induced by VIC. A similar work \cite{khader2020stability} observes stability-guaranteed learning for VIC during peg-in-hole tasks. Other work depicts a task-space impedance controller's performance in quadruped locomotion \cite{Zhang2020}. Variable impedance control policies outperform the direct torque control policy in terms of cumulative rewards and robustness to disturbances. Interestingly, impedance controllers resulted in more energy-efficient policies although the reward function did not consider energy. It is worth noting that an extensively tuned gait planner was provided to the agent to learn a successful policy. While these state-dependent approaches show promising results in terms of robustness to uncertainties, these existing approaches focus on simple single-stage, repetitive tasks and require extensive reward shaping due to the lack of policy guidance. In the next section, we explain how SCAPE addresses this issue and produces successful state-dependent stiffness control policies, which can be used in multi-stage tasks such as grasping and manipulation. \section{Methods} \label{s3:ProposedApproach} In this section, we present our approach, SCAPE, to learn state-dependent stiffness control without requiring stiffness control demonstrations. Use of imitation learning within reinforcement learning improves policy guidance, thereby enabling high-dimensional dexterous manipulation. For SCAPE and all the baselines, we employ Deep Deterministic Policy Gradient with Hindsight Experience Replay (DDPG + HER, \cite{Nair2018}). The overall learning scheme is depicted in Fig. \ref{fig:LearningScheme}, where the stiffness control policy takes in observed states $s$ and the goal $g$, and produces an action $\pi(s,g)$ which contains the desired stiffness in addition to the desired pose. The controller block is the high-level controller, which employs task-space stiffness control. SR refers to the overall success rate of the current policy (i.e., how often does the object reach the goal states while staying intact?). \begin{figure*}[t]% \centering \subfloat[][\label{fig:LearningScheme}]{\includegraphics[width=0.5\columnwidth]{Figures/Figure01.pdf}}% \hfill \subfloat[][\label{fig:augprocess}]{\includegraphics[width=0.5\columnwidth]{Figures/Figure02.pdf}}% \hfill \caption{(a) Proposed learning scheme for SCAPE. (b) Proposed augmentation process of position control demonstrations.}% \label{fig:figure01}% \vspace{-0mm} \end{figure*} A commonly used action representation in dexterous manipulation describes only the desired position of the actuator in the inner control loop, hence the name position control. On the other hand, a stiffness control policy outputs actions that describe the desired position of the actuators as well as the desired stiffness in the corresponding joint, as shown in Fig. \ref{fig:LearningScheme}. However, as explained earlier, it is difficult to obtain expert stiffness control demonstrations for imitation learning. Therefore, we use augmented position control demonstrations as shown in Fig. \ref{fig:augprocess}. These demonstrations are typically generated from teleoperation or kinesthetic teaching, and contain desired position trajectories. In our study, we use 25 demonstrations that accomplish task-related kinematic goals without consideration for the object fragility (e.g., commanded to fully close the grippers). We leverage the fact that the stiffness of the robot is known either from the simulation model or the hardware specifications, and that position control works by moving to the desired position with the inherent stiffness or position gain of the actuator. In this paper, we refer to this inherent stiffness as $\mathbf{k}_{passive}$. Therefore, state-action pairs, $(s,a)$, in common position control demonstrations can be augmented to that of stiffness control demonstrations, $(s',a')$, where the desired stiffness is $\mathbf{k}_{passive}$. Consequently, these augmented demonstrations become suboptimal stiffness control demonstrations since the commanded stiffness of the robot is fixed to $\mathbf{k}_{passive}$. We can then infer the reward function of the task from the augmented demonstrations without manual reward shaping, and at the same time use it to learn improved stiffness control. Note that $\mathbf{k}_{passive}$ is n-dimensional stiffness, from which we can choose any dimension of interest and modulate the stiffness. In this paper, we modulate the stiffness in the grasping dimension (i.e., $\mathbf{k}_{passive} \in \mathds{R}$). \subsection{Outperforming the Demonstration}\label{c3s2:Outperforming} Simple imitation learning in the form of behavioral cloning does not allow the agent to improve beyond the performance of the demonstrations due to the cloning loss \cite{Nair2018}. The weight of the cloning loss can be decreased iteratively, assuming that the agent is able to learn a policy equivalent to the demonstrator early in the iteration \cite{Rajeswaran2017}. But it is unclear how to determine the amount of dependency on the demonstrations with respect to the iteration. Also, simply reducing the dependency does not prevent the agent from cloning the undesirable behaviors seen in the suboptimal demonstrations we use. Therefore, we adopt additional techniques to encourage the policy to outperform the augmented demonstrations and address its suboptimality. \subsubsection{Q-Filter}\label{c3s2ss1:QFilter} We use a Q-filter \cite{Nair2018} to choose which replay transitions to clone from. The fundamental motivation behind learning from demonstrations is the assumption that the demonstrations provide a near-optimal action. However, this is not true for the augmented demonstrations. A Q-filter allows the agent to compare the Q values produced by the transitions from demonstrations, $(s_i,a_i,g)$, and the current policy, $(s_i,\pi_\theta(s_i,g),g)$. By comparing their values, the agent does not clone the behavior if its current policy provides a better action for the given demonstration state. More formally, the cloning loss $L_{bc}$ can be defined as: \begin{equation}\label{eq:stf11} L_{bc} = ||a_i - \pi_\theta(s_i,g_i)||\mathds{1}_{Q(s_i,a_i,g_i)>Q(s_i,\pi_\theta(s_i,g_i),g_i)} \end{equation} However, it is often difficult to infer the subtle difference in the qualities of the policies solely from examining the resulting Q estimates due to the overestimation issue of Q values \cite{Hasselt2015}. Although the usage of the Q-filter improves the safety of learning, it tends to produce oscillatory gradients that prevent convergence of the policy due to its Boolean property \cite{Nair2018}. \subsubsection{Imitation Regulator}\label{c3s2ss2:ImitationRegulator} To improve convergence of our method, we introduce an imitation regulator that observes the overall success rates of the current policy and determines the appropriate source of imitation from: 1) the augmented demonstrations and 2) the agent's own past experience. The latter is sometimes referred to as self-imitation learning \cite{Oh2018}. The regulator controls the replay buffer $\mathcal D_{IR}$ used for sampling transition batches to imitate as follows: \begin{equation} \mathcal D_{IR} = \begin{cases} \mathcal D_{demo}, & \text{if}\ SR < SR_{ref} \\ \mathcal D_{SIL}, & \text{otherwise} \end{cases} \end{equation}\label{eq:stf12} % where $\mathcal D_{SIL}$ and $D_{demo}$ refer to the buffers that store the actual experience replay and the augmented demonstrations, respectively. $SR \in [0,1]$ is the overall success rate of the current policy. It is considered an overall success if the object reaches the goal states and also stays intact throughout the episode. $SR_{ref}$ is the reference success rate that is empirically found. Put simply, the regulator actively switches the source of demonstrations from $\mathcal D_{demo}$ to $\mathcal D_{SIL}$ once the success rate reaches $SR_{ref}$. This brings three primary benefits. First, the agent no longer references the suboptimal demonstrations which contain undesirable behaviors. Second, the policy converges faster from the minimized oscillation of gradients. Third, by cloning the previously generated actions, the agent leverages exploration, thereby improving upon its current policy. \section{Environments}\label{c3s3:Environments} We use three robotic manipulation environments shown in Fig. \ref{fig:envs} for simulation and experiments. Details for each environment can be found in Appendix A. For simulation, we use robots provided by OpenAI Gym \cite{Brockman2016}. In all environments, we do not use the ground-truth force measurements during training. Instead, we use quasi-static force measurements from the series elasticity of the robot, which do not require force sensors (i.e., $\mathbf{F} \approx \mathbf{k}_{passive}(\mathbf{x}_{desired} - \mathbf{x}_{current})$). Note that $\mathbf{x}$ is defined in the same coordinate frame as $\mathbf{k}_{passive}$. For safety evaluation however, unless stated otherwise, we use ground-truth force measurements. A successful policy must meet both task-related (e.g., did the object reach the goal states?) and safety-related (e.g., is the object intact?) goals. For instance, even if the object reaches the goal states, the task is considered a failure if the applied force exceeds the breaking force. The task-related kinematic reward is $r_{task}(s): s\rightarrow \{-1,0\}$, and the safety-related reward is $r_{safety}(s):s\rightarrow (-\infty,0]$. Combining these reward functions naturally leads the agent to accomplish the kinematic goal while minimizing the estimated interaction force. For all environments, the immediate reward $R$ for the observation $s$ is defined as: \begin{equation}\begin{split}\label{eq:stf13} R(s) &= r_{task}(s) + r_{safety}(s)\\ r_{task}(s) &= \begin{cases} 0, & \text{if kinematic goal is met}\\ -1, & \text{otherwise} \end{cases}\\ r_{safety}(s) &= -\alpha||\mathbf{F}|| -\beta||\mathbf{\dot{q}}|| \end{split}\end{equation} where $\mathbf{F}$ is the estimated force, $\mathbf{\dot{q}}$ is the joint velocity, and $\alpha$ and $\beta$ are normalization coefficients that depend on the environment. Furthermore, we implement a low-pass filter with a time constant of $0.05s$ for all force measurements in the simulation. To validate the robustness under realistic conditions, we include three types of uncertainties during training: 1) random perturbation to the object within grasp, 2) measurement noise in the object's position, and 3) random control failure, that repeats the previous action. \begin{figure}[]% \vspace{-0mm} \centering \subfloat[][\label{fig:blockenv_obs}]{\includegraphics[width=0.141\columnwidth]{Figures/Figure03a.pdf}}% \subfloat[][\label{fig:blockenv_act}]{\includegraphics[width=0.141\columnwidth]{Figures/Figure03b.pdf}} \subfloat[][\label{fig:chipenv_obs}]{\includegraphics[width=0.131\columnwidth]{Figures/Figure04a.pdf}}% \subfloat[][\label{fig:chipenv_act}]{\includegraphics[width=0.131\columnwidth]{Figures/Figure04b.pdf}} \subfloat[][\label{fig:nufingersenv_obs}]{\includegraphics[width=0.22\columnwidth]{Figures/Figure05a.pdf}}% \subfloat[][\label{fig:nufingersenv_act}]{\includegraphics[width=0.21\columnwidth]{Figures/Figure05b.pdf}} \caption{Initial and final scenes of the (a, b) Block, (c, d) Chip, and (e, f) NuFingers environments.}% \label{fig:envs}% \vspace{-0mm} \end{figure} \subsection{Quasi-static Pick-and-place Environment (Block)}\label{c3s3ss1:BlockDefinition} The Block environment entails a pick-and-place task and is used to verify whether SCAPE is capable of learning a safe and robust manipulation policy under quasi-static assumptions. In this environment we assume that the ground-truth force matches the estimated force, which is reasonable to assume when the object is in grasp and the involved masses are small enough. The observation includes relative positions between the object, gripper, and the goal, as well as the gripper configurations, estimated force, and stiffness. The action includes Cartesian movement of the gripper, change in the gripper configurations, the changes in stiffness and its limit. \subsection{Dynamic Pick-and-place Environment (Chip)}\label{c3s3ss2:ChipDefinition} Chip environment is a dynamic version of the pick-and-place environment, designed to demonstrate that SCAPE produces a successful manipulation policy even in dynamic situations where the agent does not have access to ground-truth force measurements. The robot is required to slide the object up the wall using friction. Thus, the ground-truth force comes from not only the finger, but also from friction, which depends on velocity and normal force. The observation and action spaces are similar to the Block environment, but the observation also includes the fingertip velocity in Cartesian space, which is part of the kinematic goal in this case. If only position is considered for the kinematic goal, we have found that the agent constantly moves the object around the goal location. We postulate that this phenomenon arises from kinetic friction being smaller than static friction. \subsection{In-hand Manipulation Environment (NuFingers)}\label{c3s3ss3:NuFingersDefinition} To demonstrate the applicability for in-hand manipulation, we use the NuFingers testbed \cite{Kim2021}. We first train the agent with domain randomization \cite{Andrychowicz2020} in a representative environment on Gym, and directly transfer the policy to the robot without any fine-tuning to validate its transferability and robustness under uncertainties. The ground-truth force measurements are only used for validation. The observation includes polar coordinates and relative orientation from the object of each finger, forces, joint velocities, and stiffness. The action includes define radial and tangential movements of the fingers. Stiffness modulation is applied in the radial direction, which dominates the grasping force. The task-related kinematic goal is to rotate the object to the desired orientation. \section{Results}\label{s4:Validation} \begin{figure*}[b!]% \vspace{-2mm} \centering \subfloat[][\label{fig:block_results}Block environment]{\includegraphics[width=0.35\columnwidth]{Figures/Figure06a.pdf}}% \hfill \subfloat[][\label{fig:chip_results}Chip environment]{\includegraphics[width=0.327\columnwidth]{Figures/Figure06b.pdf}}% \hfill \subfloat[][\label{fig:nufingers_results}NuFingers environment]{\includegraphics[width=0.31\columnwidth]{Figures/Figure06c.pdf}} \caption{Resulting success rates of SCAPE (solid) compared to position control (dashed). Success rates for task-related goals (e.g., did the object reach the target states?) and safety-related goals (e.g., how often did the object stay intact?) are separately plotted. Overall goals entail both goals.}% \label{fig:results}% \vspace{-0mm} \end{figure*} In this section, we demonstrate the performance of SCAPE in various environments. Without the proposed augmentation process, baseline algorithms must learn a stiffness control policy from scratch \cite{Bogdanovic2020, Martin2019, Zhang2020}, since expert demonstrations are not available. We compare SCAPE with these approaches for the ablation study in Sec. \ref{c4s3:AblationStudies}, as learning from scratch fails catastrophically. For the main experiments in Sec. \ref{c4s2:Results}, we compare our results with position control (existing approach), so that the difference only lies in the policy parametrization. This comparison demonstrates the importance of using state-dependent stiffness controllers when force-sensitive tasks are involved, as opposed to existing position counterparts that are widely used in dexterous manipulation \cite{Rajeswaran2017, Andrychowicz2020}. \subsection{Experimental Results}\label{c4s2:Results} \begin{figure*}[t!]% \centering% \subfloat[][\label{fig:block_data}Block environment]{\includegraphics[width=0.33\columnwidth]{Figures/Figure07a.pdf}}% \hfill \subfloat[][\label{fig:chip_data}Chip environment]{\includegraphics[width=0.33\columnwidth]{Figures/Figure07b.pdf}}% \hfill \subfloat[][\label{fig:nufingers_data}NuFingers environment]{\includegraphics[width=0.33\columnwidth]{Figures/Figure07c.pdf}}% \caption{For each of the environments, force experienced by the objects and kinematic error of the resulting policies are shown on the left. The mean Q values, forces, and stiffnesses evaluated after each epoch are shown on the right.}% \label{fig:data}% \vspace{-0mm} \end{figure*} Figure \ref{fig:results} depicts the success rates over epochs for the Block, Chip, and NuFingers environments. For in-depth assessment, we break down the plots to also show success rates for the safety and kinematic goals. Safety-related success rates refer to the fraction of the time when the experienced force is smaller than the breaking threshold. Note that exceeding it at any time results in an overall failure in the corresponding episode. Kinematic pick-and-place tasks without uncertainties have been easily solved by the position control policies in previous works \cite{Andrychowicz2017}. However, Fig. \ref{fig:block_results} shows that for position control policies, the heavy force penalty from large forces discourages exploration and prevents the agent from learning to even grasp the object. SCAPE on the other hand, uses stiffness control policies to successfully minimize the interaction force and reaches a 100\% overall success rate. For the Chip environment where the action space is smaller, the position-controlled agent learns to complete the kinematic task entailed in the demonstrations to some degree as shown in Fig. \ref{fig:chip_results}. However, it fails to address the safety issues, thereby breaking the object in almost all of the evaluation episodes. Note that unlike in the Block environment, the ground-truth force measurements are used for evaluation. It is notable that SCAPE still produced a successful policy by referencing only the quasi-static force measurements from the series elasticity, which do not include friction. For the NuFingers environment in Fig. \ref{fig:nufingers_results}, we find a similar trend as in the Block environment. The position control approach fails to learn a policy that completes the kinematic task. SCAPE however, reaps the benefits of stiffness control and finds a successful policy. Most importantly, in spite of the model discrepancies between the simulation and the actual robot, the resulting policy proves to be successful after the sim-to-real transfer without additional training. To summarize, it is evident that a state-dependent stiffness control policy outperforms the position control policy in terms of safety and robustness under uncertainties and that the SCAPE is capable of producing successful policies. Figure \ref{fig:data} depicts various data during and after training. It is evident that the proposed approach quickly learns the necessary stiffness for the completion of the kinematic task. The stiffness and interaction force of the system are strongly related to one another as can be seen from the similar trends of the two curves. The existing approach which uses position control on the other hand, does not adjust the stiffness and therefore fails to reduce the interaction force. Also, notice that the objects in the Chip and NuFingers environments experience much more force than what the robot can exert. This is because for evaluation, we use the ground-truth forces which come from various sources, such as the friction that depends on the normal force and the velocity of the object. The proposed approach successfully minimizes the ground-truth force without the actual measurement. While actual measurements will improve the stability, we expect the improvement to be marginal in the tested environments since large masses or explosive movements are not involved. \subsection{Ablation Study}\label{c4s3:AblationStudies} To examine the effects of each technique used in this paper, we examine the Block environment under five different conditions: \begin{itemize} \item Condition 1: Reinforcement learning from scratch \cite{Bogdanovic2020, Martin2019, Zhang2020}, without a Q-filter, without an imitation regulator \item Condition 2: Reinforcement learning + imitation learning from augmented demonstrations, without a Q-filter, without an imitation regulator \item Condition 3: Reinforcement learning + imitation learning from augmented demonstrations, without a Q-filter, with an imitation regulator \item Condition 4: Reinforcement learning + imitation learning from augmented demonstrations, with a Q-filter, without an imitation regulator \item Condition 5: Reinforcement learning + imitation learning from augmented demonstrations, with a Q-filter, with an imitation regulator (SCAPE) \end{itemize} Condition 1 represents the approach taken by the researchers in the past \cite{Bogdanovic2020, Martin2019, Zhang2020}, where imitation learning was not used due to the absence of demonstration data. Conditions 2-5 use the augmented demonstrations introduced in this paper, with different combinations of complementary techniques. Note that condition 5 is used to produce the results in Fig. \ref{fig:results}. Overall success rates generated under the different conditions are shown in Fig. \ref{fig:ablation1}. From these results, we confirm that existing approaches \cite{Bogdanovic2020, Martin2019, Zhang2020} do not produce any meaningful results for multi-stage tasks (e.g., approaching an object, grabbing the object, and relocating the object). For such tasks, the augmented demonstrations play a crucial role in providing guidance to the policy through imitation learning. Moreover, in conditions 2 and 3, the agent is unable to filter out undesirable behaviors, thereby consistently breaking the object during exploration as shown in Fig. \ref{fig:ablation2}. Therefore, we confirm that the Q-filter allows the agent to make safe decisions. Also, applying the imitation regulator without the Q-filter fails from satisfying safety goals. Lastly, without the imitation regulator, the agent keeps referencing the suboptimal demonstrations, which causes oscillations and delays convergence. Switching to self-imitation learning using the imitation regulator helps reinforce some of the past good behaviors preventing the policy from diverging, which is shown by the higher mean and smaller variance of the condition 5 compared to those of condition 4. \begin{figure}[t] \centering \vspace{-0mm} \subfloat[][\label{fig:ablation1}]{\includegraphics[width=0.515\columnwidth]{Figures/Figure09.pdf}}% \subfloat[][\label{fig:ablation2}]{\includegraphics[width=0.48\columnwidth]{Figures/Figure10.pdf}}% \caption{(a) Overall success rates during evaluation and (b) Safety-related success rates during exploration for different conditions in the Block environment.} \label{fig:ablation} \vspace{-0mm} \end{figure} \section{Conclusions} \label{s5:Conclusions} We conclude that our approach, SCAPE, is capable of producing a successful state-dependent stiffness control policy, which plays a crucial role in ensuring safety and performance in dexterous manipulation. SCAPE produces competent manipulation skills by improving sample complexity with augmented position control experiences. The suboptimality of the augmented demonstrations is alleviated by a combination of the Q-filter and the imitation regulator, which results in faster and more stable convergence to a successful policy. These techniques prevent the agent from blindly imitating the suboptimal demonstrations, and help focus on the past desirable experience. Through various manipulation experiments, we validate that SCAPE outperforms the existing position control and stiffness control approaches. Therefore, SCAPE provides both safety and performance such that robust dexterous manipulation can be conveniently learned without stiffness control demonstrations. Future work may include extension of our work to seek the feasibility of passive stiffness modulation, which is a capability of human hands. Passive stiffness not only determines the safety under robot malfunction but also the dynamic behavior of the robot under sudden impacts. \clearpage \acknowledgments{This work has taken place in the ReNeu Robotics Lab and Personal Autonomous Robotics Lab (PeARL) at The University of Texas at Austin. Effort in the ReNeu Robotics Lab is supported, in part, by NSF (1941260, 2019704), Facebook and Dept of VA. PeARL research is supported in part by the NSF (IIS-1724157, IIS-1638107, IIS-1749204, IIS-1925082), ONR (N00014-18-2243), AFOSR (FA9550-20-1-0077), and ARO (78372-CS). This research was also sponsored by the Army Research Office under Cooperative Agreement Number W911NF-19-2-0333. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the Army Research Office or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation herein.}
\section{Research Methods} \end{document} \endinput \section{Introduction} ACM's consolidated article template, introduced in 2017, provides a consistent \LaTeX\ style for use across ACM publications, and incorporates accessibility and metadata-extraction functionality necessary for future Digital Library endeavors. Numerous ACM and SIG-specific \LaTeX\ templates have been examined, and their unique features incorporated into this single new template. This document provides an example of use for a \LaTeX\ class adapted to EDBT/ICDT that conforms, somewhat loosely, to the formatting guidelines for ACM SIG Proceedings. \section{Title Information} The title of your work should use capital letters appropriately - \url{https://capitalizemytitle.com/} has useful rules for capitalization. Use the {\verb|title|} command to define the title of your work. If your work has a subtitle, define it with the {\verb|subtitle|} command. Do not insert line breaks in your title. \section{Authors and Affiliations} Each author must be defined separately for accurate metadata identification. Multiple authors may share one affiliation. Authors' names should not be abbreviated; use full first names wherever possible. Include authors' e-mail addresses whenever possible. Grouping authors' names or e-mail addresses, or providing an ``e-mail alias,'' as shown below, is not acceptable: \begin{verbatim} \author{Brooke Aster, David Mehldau} \email{dave,judy,<EMAIL>} \email{<EMAIL>} \end{verbatim} The \verb|authornote| and \verb|authornotemark| commands allow a note to apply to multiple authors --- for example, if the first two authors of an article contributed equally to the work. The article template's documentation, available at \url{https://www.acm.org/publications/proceedings-template}, has a complete explanation of these commands and tips for their effective use. \section{Sectioning Commands} Your work should use standard \LaTeX\ sectioning commands: \verb|section|, \verb|subsection|, \verb|subsubsection|, and \verb|paragraph|. They should be numbered; do not remove the numbering from the commands. \section{Tables} The ``\verb|acmart|'' document class includes the ``\verb|booktabs|'' package --- \url{https://ctan.org/pkg/booktabs} --- for preparing high-quality tables. Table captions are placed {\itshape above} the table. Because tables cannot be split across pages, the best placement for them is typically the top of the page nearest their initial cite. To ensure this proper ``floating'' placement of tables, use the environment \textbf{table} to enclose the table's contents and the table caption. The contents of the table itself must go in the \textbf{tabular} environment, to be aligned properly in rows and columns, with the desired horizontal and vertical rules. Again, detailed instructions on \textbf{tabular} material are found in the \textit{\LaTeX\ User's Guide}. Immediately following this sentence is the point at which Table~\ref{tab:freq} is included in the input file; compare the placement of the table here with the table in the printed output of this document. \begin{table} \caption{Frequency of Special Characters} \label{tab:freq} \begin{tabular}{ccl} \toprule Non-English or Math&Frequency&Comments\\ \midrule \O & 1 in 1,000& For Swedish names\\ $\pi$ & 1 in 5& Common in math\\ \$ & 4 in 5 & Used in business\\ $\Psi^2_1$ & 1 in 40,000& Unexplained usage\\ \bottomrule \end{tabular} \end{table} To set a wider table, which takes up the whole width of the page's live area, use the environment \textbf{table*} to enclose the table's contents and the table caption. As with a single-column table, this wide table will ``float'' to a location deemed more desirable. Immediately following this sentence is the point at which Table~\ref{tab:commands} is included in the input file; again, it is instructive to compare the placement of the table here with the table in the printed output of this document. \begin{table*} \caption{Some Typical Commands} \label{tab:commands} \begin{tabular}{ccl} \toprule Command &A Number & Comments\\ \midrule \texttt{{\char'134}author} & 100& Author \\ \texttt{{\char'134}table}& 300 & For tables\\ \texttt{{\char'134}table*}& 400& For wider tables\\ \bottomrule \end{tabular} \end{table*} \section{Math Equations} You may want to display math equations in three distinct styles: inline, numbered or non-numbered display. Each of the three are discussed in the next sections. \subsection{Inline (In-text) Equations} A formula that appears in the running text is called an inline or in-text formula. It is produced by the \textbf{math} environment, which can be invoked with the usual \texttt{{\char'134}begin\,\ldots{\char'134}end} construction or with the short form \texttt{\$\,\ldots\$}. You can use any of the symbols and structures, from $\alpha$ to $\omega$, available in \LaTeX~\cite{Lamport:LaTeX}; this section will simply show a few examples of in-text equations in context. Notice how this equation: \begin{math} \lim_{n\rightarrow \infty}x=0 \end{math}, set here in in-line math style, looks slightly different when set in display style. (See next section). \subsection{Display Equations} A numbered display equation---one set off by vertical space from the text and centered horizontally---is produced by the \textbf{equation} environment. An unnumbered display equation is produced by the \textbf{displaymath} environment. Again, in either environment, you can use any of the symbols and structures available in \LaTeX\@; this section will just give a couple of examples of display equations in context. First, consider the equation, shown as an inline equation above: \begin{equation} \lim_{n\rightarrow \infty}x=0 \end{equation} Notice how it is formatted somewhat differently in the \textbf{displaymath} environment. Now, we'll enter an unnumbered equation: \begin{displaymath} \sum_{i=0}^{\infty} x + 1 \end{displaymath} and follow it with another numbered equation: \begin{equation} \sum_{i=0}^{\infty}x_i=\int_{0}^{\pi+2} f \end{equation} just to demonstrate \LaTeX's able handling of numbering. \section{Figures} The ``\verb|figure|'' environment should be used for figures. One or more images can be placed within a figure. If your figure contains third-party material, you must clearly identify it as such, as shown in the example below. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{sample-franklin} \caption{1907 Franklin Model D roadster. Photograph by Harris \& Ewing, Inc. [Public domain], via Wikimedia Commons. (\url{https://goo.gl/VLCRBB}).} \end{figure} Your figures should contain a caption which describes the figure to the reader. Figure captions go below the figure. Your figures should {\bfseries also} include a description suitable for screen readers, to assist the visually-challenged to better understand your work. Figure captions are placed {\itshape below} the figure. \subsection{The ``Teaser Figure''} A ``teaser figure'' is an image, or set of images in one figure, that are placed after all author and affiliation information, and before the body of the article, spanning the page. If you wish to have such a figure in your article, place the command immediately before the \verb|\maketitle| command: \begin{verbatim} \begin{teaserfigure} \includegraphics[width=\textwidth]{sampleteaser} \caption{figure caption} \Description{figure description} \end{teaserfigure} \end{verbatim} \section{Citations and Bibliographies} The use of \BibTeX\ for the preparation and formatting of one's references is strongly recommended. Authors' names should be complete --- use full first names (``Donald E. Knuth'') not initials (``D. E. Knuth'') --- and the salient identifying features of a reference should be included: title, year, volume, number, pages, article DOI, etc. The bibliography is included in your source document with these two commands, placed just before the \verb|\end{document}| command: \begin{verbatim} \bibliographystyle{ACM-Reference-Format} \section{CONCLUSION}\label{section:conclusion} This paper has studied the problem of answering distance queries on large dynamic networks. Our proposed algorithm exploits properties of a recent labelling technique called highway cover labelling \cite{farhan2018highly} to efficiently process incremental graph updates, and can preserve the minimality property of labelling after each update operation. We have empirically evaluated the efficiency and scalability of the proposed algorithm. The results show that our proposed algorithm outperforms the state-of-the-art methods. In future, we plan to further investigate the effects of decremental updates on graphs since they are also commonly used in practice. \section{EXPERIMENTS}\label{section:experiments} We have evaluated our method to answer the following questions: (Q1) How efficiently can our method perform against state-of-the-art methods? (Q2) How does the number of landmarks affect the performance of our method? (Q3) How does our method scale to perform updates occurring rapidly in large dynamic networks? \smallskip \noindent\textbf{Datasets.}~We used 12 large real-world networks as detailed in Table \ref{table:datasets}. These networks are accessible at Stanford Network Analysis Project \cite{leskovec2015snap}, Laboratory for web Algorithmics \cite{BoVWFI}, Koblenz Network Collection \cite{kunegis2013konect}, and Network Repository \cite{rossi2015network}. We treated these networks as undirected and unweighted graphs. \begin{comment} \begin{figure}[h] \centering \includegraphics[width=0.5\textwidth]{dist_dist.pdf} \vspace{-0.7cm} \caption{Distance distributions of random updates: (a)-(b) distance distribution of 1000 updates for edge insertion in $E_I$; (c)-(d) distance distribution of 1000 updates for edge deletion in $E_D$.}\vspace{-0cm} \label{fig:distance-distribution} \end{figure} \end{comment} \smallskip \noindent\textbf{Updates and queries.}~For each network, we randomly sampled 1,000 pairs of vertices as edge insertions, denoted as $E_I$, where $E_I \cap E = \emptyset$ to evaluate the average update time. Further, we evaluate the average query time with 100,000 randomly sampled pairs of vertices from each network and report the labelling size after reflecting all the updates. \smallskip \noindent\textbf{Baseline methods.}~We compared our method ($\textsc{IncHL}^{+}$) with the state-of-the-art methods: (1) \textsc{IncPLL}: an online incremental algorithm proposed in \cite{akiba2014dynamic} which is based on the 2-hop cover labelling to answer distance queries; (2) \textsc{IncFD}: an online incremental algorithm proposed in \cite{hayashi2016fully} which combines a 2-hop cover labelling with a graph traversal algorithm to answer distance queries. The codes of these methods were provided by their authors and implemented in C++. We used the same parameter settings for these methods as suggested by their authors unless otherwise stated. For a fair comparison, following \cite{hayashi2016fully} we set $|R|=20$ for \textsc{IncFD} and our methods, except for Clueweb09 which has $|R|=150$ due to its billion-scale vertices. Our methods were implemented in C++11 and compiled using gcc 5.5.0 with the -O3 option. We performed all the experiments using a single thread on Linux server (Intel Xeon W-2175 with 2.50GHz and 512GB of main memory). \subsection{Performance Comparison} \begin{figure*}[t!] \centering \includegraphics[width=0.9\textwidth]{update-time-addition.pdf}\vspace{-0.6cm} \caption{Average update time of our method $\textsc{IncHL}^{+}$ (in colored bars) and the baseline method \textsc{IncFD} (in colored plus grey bars) under 10-50 landmarks. There are no results of \textsc{IncFD} for Clueweb09 due to the scalability issue.} \label{fig:varying-landmarks}\vspace{-0.3cm} \end{figure*} \begin{figure*}[t!] \includegraphics[width=0.9\textwidth]{inc_scalability.pdf}\vspace{-0.45cm} \caption{Update time of $\textsc{IncHL}^{+}$ for performing up to 10,000 updates against construction time of labelling from scratch.} \label{fig:aut_batchsize_inc}\vspace{-0.35cm} \end{figure*} \subsubsection{Update Time} Table \ref{table:performance} shows that the average update time of our method $\textsc{IncHL}^{+}$ outperforms the state-of-the-art methods \textsc{IncFD} and \textsc{IncPLL} on all datasets. This is due to a novel repair strategy utilized by $\textsc{IncHL}^{+}$. Further, only $\textsc{IncHL}^{+}$ can scale to very large networks with billions of vertices and edges. \textsc{IncFD} fails to scale to Clueweb09, and \textsc{IncPLL} fails for 7 out of 12 datasets due to very high preprocessing time and memory requirements. \subsubsection{Labelling Size} \label{subsection:ls} From Table \ref{table:performance}, we see that $\textsc{IncHL}^{+}$ has significantly smaller labelling sizes than \textsc{IncFD} and \textsc{IncPLL}. When updates occur on a graph, the labelling sizes of \textsc{IncFD} and $\textsc{IncHL}^{+}$ remain stable because their average label sizes are bounded by the size of landmarks set (i.e. $|R|$). Moreover, \textsc{IncFD} stores complete shortest path trees w.r.t. landmarks; while $\textsc{IncHL}^{+}$ stores pruned shortest-path trees which lead to labelling of much smaller sizes than IncFD. For \textsc{IncPLL}, the labelling sizes may increase because \textsc{IncPLL} does not remove outdated and redundant entries. \subsubsection{Query Time} In Table \ref{table:performance} the query times of $\textsc{IncHL}^{+}$ are comparable with \textsc{IncFD} and \textsc{IncPLL}. It has been shown in \cite{d2019fully} that query time depends on labelling size. As discussed in Section \ref{subsection:ls}, the update operations do not considerably affect the labelling sizes of \textsc{IncFD} and $\textsc{IncHL}^{+}$, and thus their query times remain stable. However, the query times for \textsc{IncPLL} may increase over time because of the presence of outdated and redundant entries, which result in labelling of increasing size. \subsection{Performance with Varying Landmarks} Figure \ref{fig:varying-landmarks} shows the average update time of our method $\textsc{IncHL}^{+}$ against the baseline method \textsc{IncFD} under varying landmarks, i.e., $|R| \in [10, 20, 30, $ $40, 50]$. As we can see, $\textsc{IncHL}^{+}$ outperforms \textsc{IncFD} on all the datasets against almost every selection of landmarks. We can also see the performance gap remains stable for most of the datasets when increasing the number of landmarks. This empirically verifies the efficiency of our repair strategy. \subsection{Scalability Test} We conducted a scalability test on the update time of our method $\textsc{IncHL}^{+}$, by starting with 500 updates and then iteratively adding 500 updates each time until 10,000 updates. Figure \ref{fig:aut_batchsize_inc} shows the results. We observe that the update time of $\textsc{IncHL}^{+}$ on almost all the datasets is considerably below the construction time of labelling. On Indochina and IT, $\textsc{IncHL}^{+}$ performs relatively worse because these networks have large average distances as depicted in Table \ref{table:datasets}, which lead to high percentages of affected vertices as shown in Figure \ref{fig:percentage_av}. In contrast, $\textsc{IncHL}^{+}$ performs well on graphs with small average distances such as Twitter. Overall, $\textsc{IncHL}^{+}$ can scale to perform a large number of updates efficiently. \section{Fully Dynamic Framework} In this section, we propose a fully dynamic framework for distance queries on large-scale graphs. Within this framework, we develop a dynamic \emph{decremental algorithm}, which can efficiently update a highway cover labelling after an edge deletion, respectively. \subsection{Jumped-and-Pruned Searches} To efficiently reflect changes on graphs, we develop a jumped-and-pruned search strategy for updating distance labelling. This requires us to identify two special types of vertices in a fully dynamic graph: \emph{affected vertices} and \emph{anchor vertices}. \subsubsection{Affected Vertices}\label{subsubsection:affected-vertices} When an update operation occurs on a graph $G=(V,E)$, no matter whether it is an edge insertion or an edge deletion, there always exists a subset of ``affected'' vertices in $V$ whose labels need to be updated as a consequence of this update operation on the graph. \begin{definition}[affected vertex]\label{def:affected_vertex} A vertex $v\in V$ is \emph{affected} by $G \hookrightarrow G'$ if $P_{G}(v, r)\not=P_{G'}(v,r)$ holds for at least one $r\in R$, and \emph{unaffected} otherwise. \end{definition} For simplicity, we use $\Lambda_r=\{v\in V|P_{G}(v, r)\not=P_{G'}(v,r)\}$ to denote the set of all affected vertices w.r.t. a landmark $r$ and $\Lambda=\bigcup_{r\in R}\Lambda_r$ refers to the set of all affected vertices. \begin{example} Consider Figure~\ref{fig:affected_vertices_example}(a) in which $0$ and $10$ are two landmarks. After inserting an edge $(2,5)$ in Figure~\ref{fig:affected_vertices_example}(b)-(c), we have the set of affected vertices $ \Lambda=\{0, 1, 2, 3, 5, 8, 9, 10, 13, 14\}$ because the edge $(2,5)$ lies in one of their shortest paths to $\{0, 10\}$, i.e., $\Lambda_0=\{5, 8, 9, 10, 13, 14\}$ and $\Lambda_{10}=\{0, 1, 2, 3\}$ are the set of affected vertices w.r.t $0$ and $10$, respectively. \begin{figure}[ht!] \centering \includegraphics[scale=0.5]{aff_vs_exmp.pdf} \caption{An illustration of affected vertices by an edge insertion (2,5): (a) two landmarks $0$ and $10$ are highlighted in red; (b)-(c) affected vertices w.r.t. the landmarks $0$ and $10$ are highlighted in green, respectively.} \label{fig:affected_vertices_example} \end{figure} \end{example} The following lemma states how affected vertices relate to an edge being inserted or deleted. \begin{lemma}\label{lemma:aff_vs_insertion} When $G \hookrightarrow G'$ for an edge insertion, a vertex $v\in \Lambda_r$ iff there exists a shortest path between $v$ and $r$ in $G'$ that passes through the inserted edge $(a, b)$. Similarly, when $G\hookrightarrow G'$ for an edge deletion, a vertex $v\in \Lambda_r$ iff there exists a shortest path between $v$ and $r$ in $G$ that passes through the deleted edge $(a, b)$. \end{lemma} Following Lemma \ref{lemma:aff_vs_insertion}, we have the following corollary. \begin{corollary}\label{same_distance} Let $r\in R$ be a landmark. When $G \hookrightarrow G'$, if $d_{G}(r,a) = d_{G}(r,b)$ holds, then we have $\Lambda_r=\emptyset$ \end{corollary} This corollary allows us to reduce the search space for identifying affected vertices by considering only landmarks whose distances to $a$ and $b$ are different in an original graph. Without loss of generality, we assume that $d_G(r, b) > d_G(r, a)$ w.r.t. a landmark $r$ in the rest of this section. By Fact \ref{fact-deletion} and Lemma \ref{lemma:aff_vs_insertion}, we also have the following lemma. \begin{lemma}\label{traverse-identifying-affected} When $G \hookrightarrow G'$ with an inserted or deleted edge $(a,b)$, $d_G(v,r) \geq d_G(a,r)+1$ hold for any affected vertex $v\in \Lambda_r$. \end{lemma} \begin{proof} By Lemma \ref{lemma:aff_vs_insertion}, there exists a shortest path from any affected vertex $v$ to $r$ going through the affected edge $(a, b)$ and thus through $a$. Since $a$ is unaffected and the distance from $a$ to $v$ is equal to or greater than 1, $d_G(v, r) \geq d_G(a, r) + 1$ thus holds. \end{proof} Based on Lemmata \ref{lemma:aff_vs_insertion} and \ref{traverse-identifying-affected}, we can further reduce the search space of identifying affected vertices (will be further discussed in Section \ref{subsubsection:js-bfs}). \subsubsection{Anchor Vertices}\label{subsubsection:anchor-vertices} While efficiently identifying affected vertices is critical for dynamic algorithms, it is equally important to efficiently update the labels of affected vertices against changes on a graph, without incurring unnecessary searches. A natural thought is to naively run a full BFS from each landmark $r$ on the changed graph in order to decide the new distances of affected vertices w.r.t. $r$. However, this naive solution is inefficient, particularly when only a very small portion of vertices in a graph is affected by an update operation. Can we pinpoint the differences between the old labels of affected vertices in an original graph and their new labels in the changed graph, so as to change a distance labelling in an efficient way? To answer this question, we need to identify a special kind of affected vertices that have the smallest distance to a landmark $r$ on the changed graph among all affected vertices, which we call \emph{anchor vertices}. \begin{definition}[anchor vertex]\label{def:anchor_vertex} When $G \hookrightarrow G'$, a vertex $v\in V$ is an \emph{anchor vertex} w.r.t. a landmark $r$ in $G'$ if $v\in \Lambda_r$ and $d_{G'}(r, v)\leq d_{G'}(r, u)$ for any vertex $u\in \Lambda_r$. \end{definition} The following lemma states that the exact distances of anchor vertices can be inferred from their unaffected neighbours. Note that this does not generally hold for any affected vertices. Let $d^{*}_{G'}(r,v)$ refer to a \emph{contingent distance} between a landmark $r$ and a vertex $v\in \Lambda_r$ in $G'$, which is the minimum length of paths between $v$ and $r$ that go through only unaffected vertices in $G'$. \begin{lemma}\label{lemma-inferred-vertices} When $G \hookrightarrow G'$, if a vertex $v\in \Lambda_r$ has the smallest contingent distance to a landmark $r$ among all vertices in $ \Lambda_r$, then $v$ is an anchor vertex w.r.t. $r$ and $d_{G'}(r,v)=d^{*}_{G'}(r,v)$ holds. \end{lemma} \begin{proof} We prove this by contradiction. Assume that $d_{G'}(r,v)\neq d^{*}_{G'}(r,v)$. Since $d^{*}_G(v,r)$ is the minimum length of all paths between $v$ and $r$ that go through only unaffected vertices, it means that $d_G(r,v)< d^{*}_G(r,v)$ and one shortest path between $v$ and $r$ must go through at least one affected vertex $v'\in\Lambda_r$. Then $d^{*}_{G'}(v,r)>d^{*}_{G'}(v',r)$ must hold. This contradicts with the assumption that $v$ has the minimum contingent distance to $r$ in $\Lambda_r$ and thus $d_{G'}(r,v)=d^{*}_{G'}(r,v)$. Accordingly, $v$ must be an anchor vertex w.r.t. $r$. \end{proof} Our observation is that, once anchor vertices are identified, we can locally infer their new distances from their unaffected neighbours. Then, new distances of other affected vertices can be inferred inductively by a level-by-level propagation in a BFS tree through unaffected neighbours and affected vertices whose new distances have already been inferred. \subsubsection{Jumped-and-Pruned BFS}\label{subsubsection:js-bfs} Our decremental algorithm uses a \emph{jumped-and-pruned} search strategy to efficiently update a distance labelling. The key idea is that, instead of conducting a full BFS from a landmark to all vertices, we conduct a partial BFS (named as JP-BFS) that jumps from the root of a BFS directly to affected vertices, while unaffected vertices are skipped. Further, it prunes affected vertices after the jump. \begin{definition} When $G \hookrightarrow G'$, a vertex $v$ is \emph{prunable} w.r.t. a landmark $r$ iff there exists a landmark $r'\in R-\{r\}$ such that all of the following conditions hold: \begin{itemize} \item[(1)] $d_G(r, v)=d_G(r,r')+d_G(r',v)$; \item[(2)] $d_{G'}(r, v)=d_{G'}(r,r')+d_{G'}(r',v)$; \item[(3)] $d_{G}(r',v)=d_{G'}(r',v)$. \end{itemize} \end{definition} Intuitively, the conditions in the above definition state that we can prune a vertex $v$ only if there is another landmark $r'$ lying in the shortest path between this vertex and the landmark $r$ in both $G$ and $G'$, i.e. (1) and (2), and the distance from this vertex to $r'$ also remains the same in both $G$ and $G'$, i.e. (3). Since the labels of $v$ w.r.t. $r$ remain the same in $G$ and $G'$, a JP-BFS can thus prune $v$ and its child vertices from search. We will discuss these further in \ref{subsection:deletion}. In a nutshell, a JP-BFS has the following two features: \begin{itemize} \item \textbf{Jumping} from the root to affected vertices to traverse through their neighbours in a localized fashion. \item \textbf{Pruning} affected vertices that are prunable whenever possible. \end{itemize} In the most general case, two kinds of JP-BFS may be needed. One kind of JP-BFS is to \emph{identify affected vertices w.r.t. a landmark $r$}. By Lemmata \ref{lemma:aff_vs_insertion} and \ref{traverse-identifying-affected}, such a JP-BFS jumps from the root $r$ to the vertex $b$, and starts to identify affected vertices iteratively through checking neighbours and their old distances. The other kind of JP-BFS is to \emph{update affected vertices w.r.t. a landmark $r$}. By Lemma \ref{lemma-inferred-vertices}, such a JP-BFS jumps from the root $r$ to anchor vertices, and starts to update the labels of affected vertices through a level-by-level propagation to infer their new distances. In the following, we will discuss how these two kinds of JP-BFS are conducted and how prunable vertices are handled in our \emph{decremental algorithm}. \section{Online Incremental Algorithm}\label{subsection:addition} In this section, we propose an algorithm $\textsc{IncHL}^{+}$ to incrementally update labelling to reflect graph changes. Algorithm \ref{algo:inc-algo} describes the main steps of $\textsc{IncHL}^{+}$. Below, we discuss them in detail. \subsection{Finding Affected Vertices} When an update operation occurs on a graph $G=(V,E)$, there exists a subset of ``affected'' vertices in $V$ whose labels need to be updated as a consequence of this update operation on the graph. \begin{definition}\label{def:affected_vertex} A vertex $v\in V$ is \emph{affected} by $G \hookrightarrow G'$ iff $P_{G}(v, r)\not=P_{G'}(v,r)$ for at least one $r\in R$; \emph{unaffected} otherwise. \end{definition} We use $\Lambda_r$ to denote the set of all affected vertices w.r.t. a landmark $r$ and $\Lambda=\bigcup_{r\in R}\Lambda_r$ the set of all affected vertices. \begin{example} Consider Figure~\ref{fig:incremental-algorithm}(a) in which $0$ and $10$ are two landmarks. After inserting an edge $(2,5)$, $\Lambda_0=\{5, 8, 9, 10, 13, 14\}$ in Figure~\ref{fig:incremental-algorithm}(b) and $\Lambda_{10}=\{0, 1, 2\}$ in Figure~\ref{fig:incremental-algorithm}(d). \end{example} The following lemma states how affected vertices relate to an edge being inserted. \begin{lemma}\label{lemma:aff_vs_insertion} When $G \hookrightarrow G'$ for an edge insertion $(a,b)$, a vertex $v\in \Lambda_r$ iff there exists a shortest path between $v$ and $r$ in $G'$ passing through $(a, b)$. \end{lemma} Following Lemma \ref{lemma:aff_vs_insertion}, we can reduce the search space of affected vertices by eliminating landmarks $r$ with $d_{G}(r,a) = d_{G}(r,b)$ since $\Lambda_r=\emptyset$ in such a case. Thus, we assume that $d_G(r, b) > d_G(r, a)$ w.r.t. a landmark $r$ in the rest of this section w.l.o.g. Further, by the lemma below, we can also reduce the search space by ``jumping'' from the root of a BFS to vertex $b$. \begin{lemma}\label{traverse-identifying-affected} When $G \hookrightarrow G'$ with an inserted edge $(a,b)$, we have $d_G(v,r) \geq d_G(a,r)+1$ for any affected vertex $v\in \Lambda_r$. \end{lemma} \begin{proof} By Lemma \ref{lemma:aff_vs_insertion}, there exists a shortest path from any affected vertex $v$ to $r$ going through the edge $(a, b)$ and thus through $a$. Since $a$ is unaffected and the distance from $a$ to $v$ is equal to or greater than 1, $d_G(v, r) \geq d_G(a, r) + 1$ thus holds. \end{proof} Algorithm \ref{algo:algo-affected} describes our algorithm for finding affected vertices. Given a graph $G$ with an inserted edge $(a, b)$ and a highway cover labelling $\Gamma=(H,L)$ over $G$, we conduct a \emph{jumped} BFS w.r.t. a landmark $r$ starting from the vertex $b$ with its new depth $\pi = Q(r, a, \Gamma) + 1$ (Lines 3-4). For every $(v, \pi) \in \mathcal{Q}$, we enqueue all the neighbors of $v$ that are affected into $\mathcal{Q}$ with new distances $\pi + 1$ (Lines 7-8) and add $v$ to $\Lambda_r$ as affected vertex (Line 9). This process continues until $\mathcal{Q}$ is empty. \begin{example} Figure~\ref{fig:incremental-algorithm} illustrates how our algorithm finds affected vertices as a result of inserting an edge $(2,5)$. The BFS rooted at landmark $0$ is depicted in Figure \ref{fig:incremental-algorithm}(b), which jumps to vertex $5$ and finds six affected vertices $\{5, 8, 9, 10, 13, 14\}$. Similarly, the BFS rooted at landmark $10$ is depicted in Figure \ref{fig:incremental-algorithm}(d), which jumps to vertex $2$ and finds three affected vertices $\{0, 1, 2\}$. \end{example} \begin{algorithm}[!t] \caption{Incremental algorithm ($\textsc{IncHL}^{+}$).} \label{algo:inc-algo} \KwIn{$G$, $G'$, $(a, b)$, $\Gamma=(H,L)$} \KwOut{$\Gamma'=(H',L')$} \ForEach{$r \in R$}{ $\Lambda_{r} \gets \textsc{FindAffected}(G, (a, b), r, \Gamma)$ \\ $\textsc{RepairAffected}(G', (a, b), \Lambda_{r}, r, \Gamma)$ } \end{algorithm} \begin{algorithm}[!t] \caption{Finding affected vertices.} \label{algo:algo-affected} \SetKwFunction{FMain}{\textsc{FindAffected}} \SetKwProg{Fn}{Function}{}{end} \Fn{\FMain{$G$, $(a, b)$, $r$, $\Gamma$}}{ $\mathcal{Q} \gets \emptyset$, $\Lambda_{r} \gets \emptyset$ \\ $\pi \gets Q(r, a, \Gamma)+1$ \\ Enqueue $(b, \pi)$ to $\mathcal{Q}$ \\ \While{$\mathcal{Q}$ is not empty}{ Dequeue $(v, \pi)$ from $\mathcal{Q}$ \\ \ForEach{$w \in N(v)$ s.t. $Q(r, w, \Gamma) \geq \pi+1$}{ Enqueue $(w, \pi+1)$ to $\mathcal{Q}$ } $\Lambda_{r} = \Lambda_{r} \cup \{v\}$ } \textbf{return} $\Lambda_{r}$ } \end{algorithm} \subsection{Repairing Affected Vertices} Now we propose a repair strategy to efficiently update the labels of affected vertices in order to reflect graph changes. The key idea is that, instead of conducting a full BFS on all vertices, we conduct a partial BFS from $b$ only on affected vertices. Further, to avoid unnecessary computations, we distinguish two kinds of affected vertices: (1) affected vertices that are \emph{covered} by other landmarks and can thus be easily repaired by removing an entry from their labels; (2) affected vertices whose labels need to be repaired with accurately calculated distances on a changed graph. The following lemma characterizes the first kind according to the definition of highway cover labelling. \begin{lemma}\label{lem:prunable-vertex} An affected vertex $v\in \Lambda_r$ is \emph{covered} by a landmark $r'\in R\backslash\{r\}$ iff $r'$ exists in $P_{G'}(v,r)$. If an affected vertex $v\in \Lambda_r$ is covered by $r'$, then any affected vertex $v'\in \Lambda_r$ satisfying $d_{G'}(r,v')=d_{G'}(r,v)+d_{G'}(v,v')$ must also be covered by $r'$. \end{lemma} By Lemma \ref{lem:prunable-vertex}, we can efficiently repair affected vertices $v \in \Lambda_r$ as follows. If $v$ is covered by a landmark $r'\in R\backslash\{r\}$ (i.e., one of the unaffected parents of $v$ does not contain $r$ in its label) and is also a landmark, we only update the highway; otherwise, we remove the entry of $r$ from $L(v)$. If $v$ is not covered by any $r'\in R\backslash\{r\}$, we add/modify the entry of $r$ in $L(v)$. If $v$ is a descendant of covered vertices, we simply remove the entry of $r$ from $L(v)$ (if exists). \begin{algorithm}[t] \caption{Repairing affected vertices.} \label{algo:algo-repair} \SetKwFunction{FMain}{\textsc{RepairAffected}} \SetKwProg{Fn}{Function}{}{end} \Fn{\FMain{$G'$, $(a, b)$, $\Lambda_r$, $r$, $\Gamma$}}{ $\mathcal{Q}_{uncovered} \gets \emptyset$, $\mathcal{Q}_{covered} \gets \emptyset$ \\ $\pi \gets d_{G}(r, a)+1$ \\ Enqueue $(b, \pi)$ to $\mathcal{Q}_{covered}$ if covered; otherwise to $\mathcal{Q}_{uncovered}$ \\ \While{$\mathcal{Q}_{uncovered}$ is not empty}{ \While{$(v, \pi) \in \mathcal{Q}_{uncovered}$ \text{at depth} $\pi$}{ \ForAll{$w \in N(v)$ s.t. $w \in \Lambda_r$ at depth $\pi + 1$}{ \uIf{$covered(w, \pi + 1)$}{ \uIf{$w$ is a landmark}{ $\delta_H(r, w) \gets \pi + 1$ }\Else{ Remove $r$ from $L(w)$ } Enqueue $(w, \pi + 1)$ to $\mathcal{Q}_{covered}$ }\Else{ Add/Modify $\{(r,\pi + 1)\}$ in $L(w)$ \\ Enqueue $(w, \pi + 1)$ to $\mathcal{Q}_{uncovered}$ } Remove $w$ from $\Lambda_r$ } Dequeue $(v, \pi)$ from $\mathcal{Q}_{uncovered}$ } \While{$(v, \pi) \in \mathcal{Q}_{covered}$ at depth $\pi$}{ \ForAll{$w \in N(v)$ s.t. $w \in \Lambda_r$ at depth $\pi + 1$}{ Remove $r$ from $L(w)$ \\ Remove $w$ from $\Lambda_r$ \\ Enqueue $(w, \pi + 1)$ to $\mathcal{Q}_{covered}$ } Dequeue $(v, \pi)$ from $\mathcal{Q}_{covered}$ } } Remove entry $r$ from remaining vertices in $\mathcal{Q}_{covered}$ } \end{algorithm} Algorithm \ref{algo:algo-repair} describes our algorithm for repairing affected vertices. Given a graph $G$ with an inserted edge $(a, b)$ and a set of affected vertices $\Lambda_r$, we conduct a BFS w.r.t. a landmark $r$ starting from the vertex $b$ with its new distance $\pi = d_G(r, a)+ 1$ (Lines 3-4). We use two queues $\mathcal{Q}_{uncovered}$ and $\mathcal{Q}_{covered}$ to process uncovered and covered vertices, respectively. If $b$ is covered, we enqueue $(b, \pi)$ to $\mathcal{Q}_{covered}$ and remove the entry of $r$ from the labels of affected vertices (Line 25). Otherwise, we enqueue $(b, \pi)$ to $\mathcal{Q}_{uncovered}$ and start processing vertices in $\mathcal{Q}_{uncovered}$ (Line 5). For each vertex $v \in \mathcal{Q}_{uncovered}$ at depth $\pi$, we examine its affected neighbors $w$ at depth $\pi + 1$. If $w$ is covered, then if $w$ is a landmark, we update the highway (Line 10); otherwise we remove the entry of $r$ from $L(w)$ (Line 12) because there must exist another landmark in the shortest path from $w$ to $r$ and add $(w, \pi + 1)$ to $\mathcal{Q}_{covered}$ (Line 13). Otherwise, we add/modify the entry of $r$ with the new distance $\pi + 1$ in $L(w)$ and enqueue $w$ to $\mathcal{Q}_{uncovered}$ (Lines 15-16). After that, we remove $w$ from $\Lambda_r$ (line 17). Then, for each $(v, \pi) \in \mathcal{Q}_{covered}$, we remove $r$ from the labels of affected neighbors of $v$, remove these affected vertices from $\Lambda_r$ and enqueue them to $\mathcal{Q}_{covered}$ (Lines 19-24). We process these two queues, one after the other, until $\mathcal{Q}_{uncovered}$ is empty. Finally, we remove the entry of $r$ from the labels of the remaining vertices in $\mathcal{Q}_{covered}$ (Line 25). \begin{example} Figure~\ref{fig:incremental-algorithm} illustrates how our algorithm repairs labels as a result of inserting an edge $(2,5)$. The BFS for landmark $0$ is depicted in Figure \ref{fig:incremental-algorithm}(c), which jumps to vertex $5$ and repairs three affected vertices $\{5, 9, 10\}$. The vertices $\{8, 13, 14\}$ are covered by landmarks $4$ and $10$. Similarly, the BFS for landmark $10$ is depicted in Figure \ref{fig:incremental-algorithm}(e), in which vertices $\{0, 2\}$ are repaired and vertex $1$ is covered by landmarks $0$ and $4$. \end{example} \section{INTRODUCTION}\label{section:intro} Given a very large graph with billions of vertices and edges, how efficiently can we find the shortest path distance between any two vertices? If such a graph is dynamically changing over time (e.g. inserting edges or vertices), how can we not only efficiently but also accurately find the shortest path distance between any two vertices? These questions are intimately related to distance queries on dynamic graphs. As one of the most fundamental operations on graphs, distance queries have a wide range of real-world applications that operate on increasingly large dynamic graphs, such as context-aware search in web graphs \cite{ukkonen2008searching}, social network analysis in social networks \cite{vieira2007efficient,backstrom2006group}, management of resources in computer networks \cite{boccaletti2006complex}, and so on. Many of these applications use distance queries as a building block to realise more complicated tasks, and require distance queries to be answered instantly, e.g. in the order of milliseconds. \begin{figure}[t!] \centering \includegraphics[width=0.4\textwidth]{percentageAV.pdf}\vspace{-0.2cm} \caption{Distribution of affected vertices by a single graph change in various networks, where the results for 1000 graph changes are sorted in the descending order.} \label{fig:percentage_av}\vspace{-0.3cm} \end{figure} Previous studies have primarily focused on distance queries on static graphs \cite{akiba2013fast,fu2013label,jin2012highway,abraham2011hub,abraham2012hierarchical,wei2010tedi,farhan2018highly}, with little attention being paid to dynamics on graphs. To speed up query response time, a key technique is to precompute a data structure called \emph{distance labelling} that satisfies certain properties such as 2-hop cover \cite{cohen2003reachability}, and then use this data structure to answer distance queries efficiently. However, when a graph dynamically changes, its distance labelling needs to be changed accordingly; otherwise, distance queries may yield overestimated distances. Although it is possible to recompute a distance labelling from scratch, this leads to inefficiency. As shown in Figure \ref{fig:percentage_av}, the percentage of affected vertices by a single change often ranges from $10^{-5}\%$ to $10\%$ in various real-world networks, recomputing distance labelling from scratch for each single change not only wastes computing resources, but also may generate inaccurate query results during recomputing process. The question arising is thus how to efficiently and accurately change distance labelling on dynamic graphs in order to support distance queries? In this paper, we aim to develop an \emph{online incremental} method that can dynamically maintain distance labelling on graphs being changed by edge and vertex insertions. Typically, real-world dynamic networks are more vulnerable to insertions than removals and a plethora of such real-world networks are large and frequently updated, primarily accommodating insertions \cite{leskovec2007graph,viswanath2009evolution}. Thus, an online incremental method for dynamic graphs should possess the following desirable characteristics: (1) \emph{time efficiency} - It can answer distance queries and update distance labelling efficiently (in the order of milliseconds); 2) \emph{space efficiency} - It guarantees the minimum size of distance labelling to reduce storage costs; (3) \emph{scalability} - It can scale to very large networks with billions of vertices and edges. \vspace{0.2cm} \noindent{\textbf{Challenges.~}}Designing online incremental methods for distance queries on dynamic graphs is known to be challenging \cite{akiba2014dynamic}. When an edge or a vertex is inserted into a graph, outdated and redundant entries of distance labelling may occur. It was reported that removing such entries is a complicated task \cite{akiba2014dynamic} because affected vertices need to be precisely identified so as to update their labels without violating the original properties of a distance labelling such as minimality. Further, although query time and update time are both critical for answering distance queries on dynamic graphs, it is not easy (if not impossible) to design a solution that is efficient in both. This requires us to find new insights into dynamic properties of a distance labelling, as well as a good trade-off between query time and update time. Last but not least, scaling distance queries to dynamic graphs with billions of nodes and edges is hard. Previous work \cite{akiba2014dynamic,hayashi2016fully} mostly considered 2-hop labelling, which has very high space requirements and index construction time; as a result, their query and update performance are dramatically degraded on large-scale dynamic graphs. Ideally, the labelling size of a graph should be much smaller than its original size. However, the state-of-the-art distance labelling technique, i.e. pruned landmark labeling method (PLL) \cite{akiba2014dynamic}, still yields a distance labelling whose size is 20-30 times larger than the original size of a dataset. \vspace{0.2cm} \noindent{\textbf{Contributions.}} Our contributions are summarised as follows: \vspace{-0cm} \begin{itemize} \item Our method overcomes the challenge of eliminating outdated and redundant distance entries. None of the previous studies have addressed this challenge because detecting those entries is too costly \cite{akiba2014dynamic,d2019fully}. When an edge or a vertex is inserted, previous studies only add new distance entries or modify existing distance entries. This would however lead to an ever increasing size of labelling, particularly when a graph is frequently updated by newly added edges or vertices. Accordingly, both query performance and space efficiency would deteriorate over time. \item We prove the correctness of our proposed method and show that it preserves the desirable property of minimality on our distance labelling. Due to a property called highway cover \cite{farhan2018highly}, the minimal size of a distance labelling in this work is much smaller than the size of a 2-hop labelling in previous work \cite{akiba2014dynamic,hayashi2016fully}. Preserving minimality on a distance labelling thus improves space efficiency and query performance, as well as update performance. We also provide a complexity analysis of our proposed method. \item We conducted experiments using 12 real-world large networks across different domains to show the efficiency, scalability and robustness of our method. Particularly, our method can perform updates under one second, on average, even on billion-scale networks, while still answering queries efficiently in the order of milliseconds and guaranteeing the labelling size of a graph to be much smaller. \end{itemize} \section{Preliminaries} \section{Problem Formulation} Let $G = (V, E)$ be an undirected graph where $V$ is a set of vertices and $E$ is a set of edges. We denote by $N(v)$ the set of neighbors of a vertex $v \in V$, i.e. $N(v) = \{u \in V | (u, v) \in E \}$. Given two vertices $u$ and $v$ in $G$, the \emph{distance} between $u$ and $v$, denoted as $d_G(u, v)$, is the length of the shortest path from $u$ to $v$. If there does not exist a path from $u$ to $v$, then $d_G(u, v) = \infty$. We use $P_{G}(u,v)$ to denote the set of all shortest paths between $u$ and $v$ in $G$. Given a graph $G = (V, E)$, an \emph{edge insertion} is to add an edge $(a, b)$ into $G$ where $\{a,b\}\subseteq V$ and $(a, b)\notin E$. Accordingly, a \emph{node insertion} is to add a new node into $G$ together with a set of edge insertions that connect $v$ to existing vertices in $G$. The following fact is critical for designing algorithms for an edge insertion. \begin{fact}\label{fact-insertion} Let $G'=(V,E\cup\{(u,v)\})$ be the graph after inserting an edge $(u, v)$ into $G=(V,E)$. Then for any two vertices $s,t\in V$, $d_G(s, t) \geq d_{G'}(s, t)$. \end{fact} That is, the distance between any two vertices never increases after inserting edges or vertices in a graph. \vspace{0.15cm} \noindent\textbf{Highway cover labelling.~}Unlike the previous work \cite{akiba2014dynamic,hayashi2016fully, d2019fully} that uses 2-hop cover labelling \cite{cohen2003reachability}, we develop our method using a highly scalable labelling approach, called \emph{highway cover labelling} \cite{farhan2018highly}. Let $R\subseteq V$ be a small set of \emph{landmarks} in a graph $G=(V,E)$. For each vertex $v \in V$, the \emph{label} of $v$ is a set of \emph{distance entries} $L(v)= \{(r_1, \delta_L(r_1, v)), \dots, (r_n, \delta_L(r_n,v))\}$, where $r_i \in R$ and $\delta_L(r_i, v) = d_G(r_i, v)$. We call $L = \{L(v)\}_{v \in V}$ a \emph{distance labelling} over $G$ whose \emph{size} is defined as: $size(L)=\sum_{v\in V}|L(v)|$. A \emph{highway} $H=(R, \delta_H)$ consists of a set $R$ of landmarks and a distance decoding function $\delta_H : R \times R \rightarrow \mathbb{N}^+$ such that, for any two landmarks $r_1, r_2\ \in R$, $\delta_H(r_1, r_2) = d_G(r_1, r_2)$ holds. \begin{definition}\label{def:highway-cover} A \emph{highway cover labelling} is a pair $\Gamma=(H, L)$ where $H$ is a highway and $L$ is a distance labelling s.t. for any vertex $v \in V\backslash R$ and $r\in R$, we have: \begin{align} d_G(r, v) = \texttt{min}\{\delta_L(r_i, v) + \delta_H(r, r_i) | (r_i, \delta_L(r_i, v)) \in L(v)\}. \end{align} \end{definition} Highway cover labelling enjoys several nice theoretical properties, such as minimality and order independence. A minimal highway cover labelling can be efficiently constructed, independently of the order of applying landmarks \cite{farhan2018highly}. Given a highway cover labeling $\Gamma=(H, L)$, an upper bound on the distance between any two vertices $u, v \in V \backslash R$ is computed: \begin{align}\label{eq:upper-distance-bound} d^{\top}_{uv} = \texttt{min}\{\delta_L(r_i, u) + \delta_H(r_i, r_j) + \delta_L(r_j, v) |\notag\hspace{1.3cm}\\(r_i, \delta_L(r_i, u)) \in L(u), (r_j, \delta_L(r_j, v)) \in L(v)\} \end{align} An exact distance query $Q(u,v,\Gamma)$ can be answered by conducting a distance-bounded shortest-path search over a sparsified graph $G[V \backslash R]$ (i.e., removing all landmarks in $R$ from $G$) under the upper bound $d^{\top}_{uv}$ such that: \[ Q(u,v,\Gamma)= \begin{cases} d_{G[V \backslash R]}(u,v)& \text{if } d_{G[V \backslash R]}(u,v)\leq d^{\top}_{uv},\\ d^{\top}_{uv} & \text{otherwise}. \end{cases} \] \vspace{0.15cm} \noindent\textbf{Problem definition.~}In this work, we study the problem of answering distance queries over a graph that is dynamically changed by edge and vertex insertions over time. Since a vertex insertion can be treated as a set of edge insertions, without loss of generality, below we define the problem based on edge insertions. \begin{definition}\label{prob:realtime} Let $G\hookrightarrow G'$ denote that a graph $G$ is changed to a graph $G'$ by an edge insertion. The \emph{dynamic distance querying} problem is, given any two vertices $u$ and $v$ in the changed graph $G'$, to efficiently compute the distance $d_{G'}(u,v)$. \end{definition} \section{RELATED WORK}\label{section:background} Answering shortest-path distance queries in graphs has been an active research topic for many years. Traditionally, a distance query can be answered using Dijkstra's algorithm \cite{tarjan1983data} on positively weighted graphs or Breadth-First Search (BFS) algorithm on unweighted graphs. However, these traditional algorithms fail to achieve desired response time for distance queries on large graphs. Later, labelling-based methods have emerged as an attractive way of accelerating response time to distance queries \cite{cohen2003reachability,akiba2013fast,jin2012highway,fu2013label,abraham2012hierarchical,abraham2011hub,farhan2018highly}, among which Akiba et al. \cite{akiba2013fast} proposed a pruned landmark labeling (PLL) to precompute a 2-hop cover distance labelling \cite{cohen2003reachability}. This method serves as the state-of-the-art for labelling-based distance queries and can handle graphs with hundreds of millions of edges. So far, only a few attempts have been made to study distance queries over dynamic graphs \cite{akiba2014dynamic,hayashi2016fully}, which are all based on the idea of 2-hop distance labelling or its variants. Akiba et al. \cite{akiba2014dynamic} studied the problem of updating a pruned landmark labelling for incremental updates (i.e. vertex additions and edge additions). This work however does not remove redundant entries in distance labels because the authors considered that detecting such outdated entries is too costly. This inevitably breaks the minimality of pruned landmark labelling, leading to an ever increase of labelling size and deteriorated query performance over time. To accelerate shortest-path distance queries on large networks, another line of research is to combine a partial distance labelling with online shortest-path searches. Hayashi et al. \cite{hayashi2016fully} proposed a fully dynamic approach that selects a small set of landmarks $R$ and precompute a shortest-path tree (SPT) rooted at each $r \in R$. Then, an online search is conducted on a sparsified graph under an upper distance bound being computed via the SPTs. Nevertheless, this method still fails to construct labelling on networks with billions of vertices. Following the same line, a recent work by Farhan et al. \cite{farhan2018highly} introduced a highway-cover labelling method (HL), which can provide fast response time (milliseconds) for distance queries even on billion-scale graphs. However, this approach only works for static graphs. \section{Theoretical Results}\label{sec:theory} \begin{table*}[ht!] \centering \caption{Comparing the update time, query time and labelling size of our method with the baseline methods.} \label{table:performance}\vspace{-0.2cm} \begin{tabular}{| l || r r r | r r r | r r r || r | r |} \hline \multirow{2}{*}{Dataset}&\multicolumn{3}{c|}{{Update Time} (ms)}&\multicolumn{3}{c|}{Query Time (ms)}&\multicolumn{3}{c||}{Labelling Size}&\multirow{2}{*}{\makecell{Frac. of \\ $\Lambda$}}&\multirow{2}{*}{\makecell{Frac. of \\ \emph{covered}}} \\\cline{2-10} & \textsc{IncHL} & \textsc{IncFD} & \textsc{IncPLL} & \textsc{IncHL} & \textsc{IncFD} & \textsc{IncPLL} & \textsc{IncHL} & \textsc{IncFD} & \textsc{IncPLL} & & \\ \hline\hline Skitter & 0.194 & 0.444 & 2.05 & 0.027 & 0.019 & 0.047 & 42 MB & 153 MB & 2.44 GB & 4.259 & 0.093 \\ Flickr & 0.006 & 0.074 & 1.73 & 0.007 & 0.012 & 0.064 & 34 MB & 152 MB & 3.69 GB & 0.049 & 0.353 \\ Hollywood & 0.031 & 0.101 & 48 & 0.027 & 0.037 & 0.109 & 27 MB & 263 MB & 12.58 GB & 1.012 & 0.020 \\ Orkut & 2.026 & 2.049 & - & 0.101 & 0.103 & - & 70 MB & 711 MB & - & 11.78 & 0.014 \\ Enwiki & 0.134 & 0.163 & 5.91 & 0.054 & 0.035 & 0.071 & 82 MB & 608 MB & 12.57 GB & 0.562 & 0.010 \\ Livejournal & 0.245 & 0.268 & - & 0.044 & 0.046 & - & 122 MB & 663 MB & - & 0.554 & 0.060 \\ \hline Indochina & 5.443 & 158 & 2018 & 0.737 & 0.839 & 0.063 & 81 MB & 838 MB & 18.64 GB & 36.81 & 0.087 \\ IT & 95.92 & 224 & - & 1.069 & 1.013 & - & 854 MB & 4.74 GB & - & 86.78 & 0.071 \\ Twitter & 0.027 & 0.134 & - & 0.863 & 0.177 & - & 1.14 GB & 3.83 GB & - & 0.005 & 0.036 \\ Friendster & 0.159 & 0.419 & - & 0.814 & 0.904 & - & 2.43 GB & 9.14 GB & - & 0.019 & 0.006 \\ UK & 11.49 & 384 & - & 3.443 & 5.858 & - & 1.78 GB & 11.8 GB & - & 8.149 & 0.031 \\ Clueweb09 & 10.53 & - & - & 16.93 & - & - & 163 GB & - & - & 0.125 & 0.400 \\ \hline \end{tabular}\vspace{-0.2cm} \end{table*} \end{comment} \section{Theoretical Results}\label{sec:theory} \begin{table*}[ht!] \centering \caption{Comparing the update time, query time and labelling size of our method with the baseline methods.} \label{table:performance}\vspace{-0.4cm} \begin{tabular}{| l || r r r | r r r | r r r |} \hline \multirow{2}{*}{Dataset \hspace*{1cm}}&\multicolumn{3}{c|}{{Update Time} (ms)}&\multicolumn{3}{c|}{Query Time (ms)}&\multicolumn{3}{c|}{Labelling Size} \\\cline{2-10} & \hspace{0.2cm}$\textsc{IncHL}^{+}$ & \hspace{0.2cm}\textsc{IncFD} & \hspace{0.2cm}\textsc{IncPLL} & \hspace{0.2cm}$\textsc{IncHL}^{+}$ & \hspace{0.2cm}\textsc{IncFD} & \hspace{0.2cm}\textsc{IncPLL} & \hspace{0.3cm}$\textsc{IncHL}^{+}$ & \hspace{0.3cm}\textsc{IncFD} & \hspace{0.3cm}\textsc{IncPLL} \\ \hline\hline Skitter & 0.194 & 0.444 & 2.05 & 0.027 & 0.019 & 0.047 & 42 MB & 153 MB & 2.44 GB \\ Flickr & 0.006 & 0.074 & 1.73 & 0.007 & 0.012 & 0.064 & 34 MB & 152 MB & 3.69 GB \\ Hollywood & 0.031 & 0.101 & 48 & 0.027 & 0.037 & 0.109 & 27 MB & 263 MB & 12.58 GB \\ Orkut & 2.026 & 2.049 & - & 0.101 & 0.103 & - & 70 MB & 711 MB & - \\ Enwiki & 0.134 & 0.163 & 5.91 & 0.054 & 0.035 & 0.071 & 82 MB & 608 MB & 12.57 GB \\ Livejournal & 0.245 & 0.268 & - & 0.044 & 0.046 & - & 122 MB & 663 MB & - \\ \hline Indochina & 5.443 & 158 & 2018 & 0.737 & 0.839 & 0.063 & 81 MB & 838 MB & 18.64 GB \\ IT & 95.92 & 224 & - & 1.069 & 1.013 & - & 854 MB & 4.74 GB & - \\ Twitter & 0.027 & 0.134 & - & 0.863 & 0.177 & - & 1.14 GB & 3.83 GB & - \\ Friendster & 0.159 & 0.419 & - & 0.814 & 0.904 & - & 2.43 GB & 9.14 GB & - \\ UK & 11.49 & 384 & - & 3.443 & 5.858 & - & 1.78 GB & 11.8 GB & - \\ Clueweb09 & 40.68 & - & - & 16.93 & - & - & 163 GB & - & - \\ \hline \end{tabular}\vspace{-0.2cm} \end{table*} \begin{table}[h!] \centering \caption{Summary of datasets.} \label{table:datasets}\vspace{-0.4cm} \begin{tabular}{| l l | r r r r|} \hline Dataset & Network & $|V|$ & $|E|$ & avg. deg & avg. dist \\ \hline\hline Skitter & comp (u) & 1.7M & 11M & 13.081 & 5.1 \\ Flickr & social (u) & 1.7M & 16M & 18.133 & 5.3 \\ Hollywood & social (u) & 1.1M & 114M & 98.913 & 3.9 \\ Orkut & social (u) & 3.1M & 117M & 76.281 & 4.2 \\ Enwiki & social (d) & 4.2M & 101M & 43.746 & 3.4 \\ Livejournal & social (d)& 4.8M & 69M & 17.679 & 5.6 \\ \hline Indochina & web (d)& 7.4M & 194M & 40.725 & 7.7 \\ IT & web (d) & 41M & 1.2B & 49.768 & 7.0 \\ Twitter & social (d) & 42M & 1.5B & 57.741 & 3.6 \\ Friendster & social (u) & 66M & 1.8B & 55.056 & 5.0 \\ UK & web (d) & 106M & 3.7B & 62.772 & 6.9 \\ Clueweb09 & web (d) & 1.7B & 7.8B & 9.27 & 7.4 \\ \hline \end{tabular}\vspace{-0.2cm} \end{table} \textbf{Proof of correctness.~}For $G\hookrightarrow G'$ where our method $\textsc{IncHL}^{+}$ updates a highway cover labelling $\Gamma$ over $G$ into a highway cover labelling $\Gamma'$ over $G'$, we consider $\textsc{IncHL}^{+}$ to be \emph{correct} iff, whenever $Q(u,v, \Gamma)=d_{G}(u,v)$ holds for any two vertices $u$ and $v$ in $G$, then $Q(u',v', \Gamma')=d_{G'}(u',v')$ also holds for any two vertices $u'$ and $v'$ in $G'$. We prove the theorem below for $\textsc{IncHL}^{+}$. \begin{theorem}\label{the:correctness} $\textsc{IncHL}^{+}$ is correct. \end{theorem}\vspace*{-0.2cm} \begin{proof} First, we prove that \texttt{FindAffected} returns the set of all affected vertices $\Lambda_r$ as a result of an edge insertion. $\textsc{IncHL}^{+}$ (Lines 7-8 of Algorithm \ref{algo:algo-affected}) guarantees that any vertex being added to $\mathcal{Q}$ has one shortest path to a landmark $r$ which goes through the inserted edge $(a,b)$. By Lemma \ref{lemma:aff_vs_insertion}, such vertices are affected vertices, and thus a vertex $v$ is added to $\mathcal{Q}$ in Algorithm \ref{algo:algo-affected} iff $v\in \Lambda_r$. Then, we prove that \texttt{RepairAffected} repairs $\Gamma=(H,L)$ s.t. (1) $(r, d_{G'}(r, v)) \in L(v)$ for $v \in \Lambda_r$, iff $P_{G'}(r,v)$ contains only one landmark $r$; (2) $\delta_H(r,r')=d_{G'}(r,r')$ for any $r'\in R \backslash\{r\}$. Starting from $b$ with new distance $\pi$, the distances of affected vertices in $\Lambda_r$ are iteratively inferred on $G'$ and reflected into their labels via $\mathcal{Q}_{uncovered}$ if these affected vertices are not covered (Lines 15-16 of Algorithm \ref{algo:algo-repair}). If an affected vertex $v$ is covered, it is kept in $\mathcal{Q}_{covered}$; if $v$ is also a landmark, $\delta_H(r,v)$ in $H$ is updated (Lines 9-10). Thus, the distance entry of $r$ is removed from the labels of affected vertices appearing in $\mathcal{Q}_{covered}$, whereas any vertex $v$ appearing in $\mathcal{Q}_{uncovered}$ must have $(r, d_{G'}(r,v))\in L(v)$. \end{proof} \noindent\textbf{Preservation of minimality.~} It has been reported in \cite{farhan2018highly} that, given a graph $G$, a minimal highway cover labelling $\Gamma=(H,L)$ of $G$ can be constructed using an algorithm proposed in their work, i.e., $size(L')\geq size(L)$ holds for any $\Gamma'=(H,L')$ of $G$. For $G\hookrightarrow G'$ where $\textsc{IncHL}^{+}$ updates $\Gamma$ over $G$ into $\Gamma'$ over $G'$, we prove that $\textsc{IncHL}^{+}$ preserves the minimality of labelling. \begin{theorem} If $\Gamma$ is minimal on $G$, then $\Gamma'$ is minimal on $G'$. \end{theorem}\vspace*{-0.2cm} \begin{proof} By Lemma \ref{lem:prunable-vertex}, $(r, d_{G'}(r, v)) \in L(v)$ for $v\in\Lambda_r$ iff $P_{G'}(r,v)$ does not contain any other landmark $R\backslash\{r\}$; otherwise we remove the entry of $r$ from the label of $v$ (Line 12, 21 and 25 of Algorithm \ref{algo:algo-repair}). Thus, the labels of all affected vertices must be minimal after applying $\textsc{IncHL}^{+}$. For unaffected vertices, their labels should remain unchanged. Hence, $\Gamma'$ must be minimal. \end{proof} \noindent\textbf{Complexity analysis.~}Let $m$ be the total number of affected vertices, $l$ be the average size of labels (i.e. $l=size(L)/|V|$), and $d$ be the average degree of vertices. For a landmark, Algorithm \ref{algo:algo-affected} takes $O(mdl)$ time to find all affected vertices and Algorithm \ref{algo:algo-repair} takes $O(md)$ to repair the labels of all affected vertices. We omit $l$ from $O(md)$ for Algorithm \ref{algo:algo-repair} because distances for all unaffected neighbors of affected vertices are stored in Algorithm \ref{algo:algo-affected}. Therefore, $\textsc{IncHL}^{+}$ has time complexity $O(|R| \times mdl)$. In our experiments, we notice that $m$ is usually orders of magnitudes smaller than $|V|$ and $l$ is also significantly smaller than $|R|$. \medskip \noindent\textbf{Directed and weighted graphs.~} For directed graphs, we can store sets of forward and backward labels, namely $L_f(v)$ and $L_b(v)$, for each vertex $v$ which contain pairs $(r_i, \delta_{r_iv})$ from forward and backward BFSs w.r.t. each landmark. Accordingly, we can store forward and backward highways $H_f$ and $H_b$. Then, we conduct two BFSs to update these labels and highways: one in the forward direction and the other in the backward direction. Our method can also be easily extended to handling weighted graphs by using Dijkstra’s algorithm instead of BFSs.
\section{Introduction} \label{intro} The study of geodesics and particle motion within a spacetime is an important tool to understand the properties of a gravitational system. For instance, the stability of circular orbits is, in specific cases, linked to quasinormal modes of the spacetime \cite{Cardoso:2008bp}.\footnote{However, see Ref.~\cite{Konoplya:2017wot} about the subtleties regarding the precise relation between the two.} From an astrophysical standpoint, the size of innermost stable circular orbits of charged particles around a black hole may reveal features of magnetic fields in its vicinity \cite{Frolov:2014zia}. In fact, as the direct imaging of a black hole is now a reality \cite{Akiyama:2019cqa}, one can seriously consider the optical appearance of the black hole, which can be calculated by considering null geodesics around it \cite{Luminet:1979nyg,Johannsen:2015hib,Luminet:2018wau,Wei:2019pjf}. Through this way, models of gravity can be tested or constrained. For instance, this has been done for braneworld gravity \cite{Vagnozzi:2019apd} and gravity coupled to non-linear electrodynamics \cite{Allahyari:2019jqz}. In recent decades, theories of gravity with extra dimensions have received attention due to developments in theoretical physics such as string theory, holographic correspondences, and braneworld scenarios, among many others. A simple and natural candidate of a gravitating source in higher dimensional gravity would be a black hole with a compact fifth dimension. However, these black holes, including electrically charged ones, are known to suffer from Gregory--Laflamme instability \cite{Gregory:1993vy,Gregory:1994bj}. (See, e.g., Refs.~\cite{Kol:2004ww,Harmark:2005pp,Gregory:2011kh} for reviews.) The possibility of stable black holes with compact extra dimensions comes through a topological argument by Stotyn and Mann in \cite{Stotyn:2011tv}, where they argued that the presence of a magnetic charge may stabilise the spacetime.\footnote{On the other hand, one can also have stable black strings or more generally black $p$-branes, by considering Anti-de Sitter black strings or $p$-branes supported by scalar fields \cite{Cisterna:2017qrb}. These configurations were recently shown to be perturbatively stable \cite{Cisterna:2019scr}.} They introduced a solution to the five-dimensional Einstein--Maxwell equations characterised by two parameters, which are denoted $(\alpha,\beta)$ in the notation of the present paper. If $\alpha>\beta$, the spacetime carries a horizon and hence describes the black hole with the compact extra dimension stabilised by the magnetic charge. On the other hand, if $\alpha<\beta$, it describes a type of soliton star \cite{Stotyn:2011tv}. In this case, if a certain minimum radial distance is approached the spacetime caps off in a `cigar-like' geometry. Conical singularities may be present, unless the periodicity of the compact fifth dimension is appropriately fixed. In Refs.~\cite{Bah:2020ogh,Bah:2020pdz}, Bah and Heidmann allow the presence of orbifold fixed points. This introduces topological cycles in the compact fifth direction, and these solutions were called \emph{topological stars} by the authors. In this case, the magnetic field determines the minimum radial distance where the spacetime caps off. When the magnetic field is zero, this does not happen as the spacetime is simply a direct product between a Schwarzschild/Minkowski spacetime and a circle. In this paper, we study the motion of charged particles in this family of solutions described in the preceding paragraphs. We shall use the terminology \emph{magnetic Kaluza--Klein black hole} (KKBH) to refer to the case $\alpha>\beta$, and \emph{magnetic topological star} (TS) to refer to the case $\alpha<\beta$. Since we always consider a non-zero magnetic field throughout the paper, we will often drop the term `magnetic' since it will be understood that it will be present at all times. A guiding intuition in understanding the physics of this problem is the fact that the particle is under the influence of two forces. First is the spherically symmetric gravitational attraction towards the KKBH/TS, and second is the Lorentz force due to a spherically symmetric magnetic field. A similar situation occurs for a charged particle around a magnetically charged Reissner--Nordstr\"{o}m black hole, which was studied by Grunau and Kagramanova in \cite{Grunau:2010gd}. There, the authors obtained exact analytical solutions in terms of Weierstra\ss{} functions. Further studies of particles in the Reissner--Nordstr\"{o}m spacetime were subsequently done by other authors in \cite{Gad:2010,Pugliese:2011py,Sharif2017}. A non-relativistic analogue of this problem is the dyon-dyon interaction studied by Schwinger et al. in \cite{Schwinger:1976fr}. (See also \cite{Sivardiere2000,Balian:2005joa}.) In these similar/analogue problems, the motion of the electric charge is known to move on the surface of a Poincar\'{e} cone \cite{Poincare1896}. It will be shown in this paper that the same is true for charged particles in the non-compact part of the KKBH/TS spacetime. The main reason for this similarity across all the aforementioned problems is that the equations of motion in the angular coordinates are the same. They depend only on the electromagnetic properties of the system which are spherically symmetric, and independent of the other parameters that distinguishes the different systems. Relative to a choice of coordinate axes, the opening angle and orientation of the Poincar\'{e} cone depend on the product between the particle charge and the magnetic field strength, as well as its angular momentum. The radial motion of the particle can be classified into categories depending on whether it has access to the horizon, may escape to infinity, or bound in a finite domain. These depend on the particle's energy, momenta, and whether a horizon is present in the solution. If a horizon is present (the KKBH case) there is at most one bound domain where the particle orbits the black hole indefinitely. When a particle's energy exceeds a certain threshold, no bound orbits exist; it could either fall into the horizon or escape to infinity. In this sense, the situation is similar to particles around most spherically symmetric \cite{Hackmann:2008tu,Grunau:2010gd} as well as rotating black holes \cite{Wilkins:1972rs}. On the other hand, if no horizon is present (the TS case) the particle may have two disconnected bound domains. Furthermore, a bound domain may still exist when the energy exceeds the aforementioned threshold. The rest of the paper is organised as follows. In Sec.~\ref{sec_EOM} we describe the spacetime given by \cite{Bah:2020ogh,Bah:2020pdz} and derive the equations of motion for a charged particle in it. The parameter space of conserved quantities of the particle, as well as its domains of motion are studied in Sec.~\ref{sec_ParamSpace}. In particular, we obtain the Poincar\'{e} cone in Sec.~\ref{subsec_angular} and study the domains of radial motion in Sec.~\ref{subsec_r}. Conclusions and closing remarks are given in Sec.~\ref{sec_conclusion}. In this paper, we use geometrical units where the speed of light equals unity and the convention for Lorentzian metric signature is $(-,+,+,+,+)$. \section{Equations of motion} \label{sec_EOM} The five-dimensional KKBH/TS spacetime is described by the metric \cite{Stotyn:2011tv,Bah:2020ogh,Bah:2020pdz} \begin{subequations} \label{metric} \begin{align} \mathrm{d} s^2&=-U\mathrm{d} t^2+V\mathrm{d} w^2+\frac{\mathrm{d} r^2}{UV}+r^2\mathrm{d}\theta^2+r^2\sin^2\theta\mathrm{d}\phi^2,\\ U&=1-\frac{\alpha}{r},\quad V=1-\frac{\beta}{r}, \end{align} \end{subequations} where $\alpha$ and $\beta$ are constants and $w$ is the coordinate representing the compact fifth dimension. If $\alpha>\beta$, the solution describes a KKBH and has a horizon at $r=\alpha$. On the other hand, if $\alpha<\beta$, the solution describes the TS spacetime where the spacetime caps off at $r=\beta$. In this latter case, the periodicity of $w$ can be appropriately fixed to remove conical singularities, as was done in \cite{Stotyn:2011tv}, or such that certain orbifold singularities are allowed, as was done in \cite{Bah:2020ogh,Bah:2020pdz}. Here, we need not choose a particular periodicity for $w$ and mainly focus on the motion of particles in the non-compact directions, namely $(r,\theta,\phi)$. The gauge potential of this solution is given by \begin{align} A=-g\cos\theta\mathrm{d}\phi. \label{gauge} \end{align} The Maxwell tensor is then obtained by taking the exterior derivative, $F=\mathrm{d} A$. For the potential \Eqref{gauge}, the Maxwell tensor describes a spherically symmetric inverse-square magnetic field, whose strength is parametrised by $g$. The metric \Eqref{metric} with the gauge potential \Eqref{gauge} satisfies the Einstein--Maxwell equations in five dimensions provided that $g^2=\frac{3}{2}\alpha\beta$.\footnote{We normalise our gauge field such that the Einstein--Maxwell action appears as $I\propto\int\mathrm{d}^5x\sqrt{-g}\brac{R-F_{\mu\nu}F^{\mu\nu}}$.} The motion of a test particle of charge per unit mass $e$ is described by a spacetime curve $x^\mu(\tau)$, where $\tau$ is an appropriate affine parameter. Here we shall take our choice of parametrisation for $\tau$ such that \begin{align} g_{\mu\nu}\dot{x}^\mu\dot{x}^\nu=-1, \label{normalisation} \end{align} where over-dots denote derivatives with respect to $\tau$. The motion is governed by the Lagrangian $\mathcal{L}(x,\dot{x})=\frac{1}{2} g_{\mu\nu}\dot{x}^\mu\dot{x}^\nu+eA_\mu\dot{x}^\mu$. For the spacetime described by \Eqref{metric} and \Eqref{gauge}, the Lagrangian is explicitly \begin{align} \mathcal{L}(x,\dot{x})&=\frac{1}{2}\brac{-U\dot{t}^2+V\dot{w}^2+\frac{\dot{r}^2}{UV}+r^2\dot{\theta}^2+r^2\sin^2\theta\dot{\phi}^2}-eg\cos\theta\dot{\phi}. \end{align} Since the magnetic field strength and the particle charge always appear together in the equations of motion, it will be convenient to define $q=eg$. The conjugate momenta are obtained by $p_\mu=\frac{\partial\mathcal{L}}{\partial\dot{x}^\mu}$. Explicitly, they appear as follows: \begin{subequations} \begin{align} p_t&=\frac{\partial\mathcal{L}}{\partial\dot{t}}=-U\dot{t},\\ p_w&=\frac{\partial\mathcal{L}}{\partial\dot{w}}=V\dot{w},\\ p_\phi&=\frac{\partial\mathcal{L}}{\partial\dot{\phi}}=r^2\sin^2\theta\dot{\phi}-q\cos\theta,\\ p_r&=\frac{\partial\mathcal{L}}{\partial\dot{r}}=\frac{\dot{r}}{UV},\\ p_\theta&=\frac{\partial\mathcal{L}}{\partial\dot{\theta}}=r^2\dot{\theta}. \end{align} \end{subequations} Since our spacetime has three Killing vectors $\partial_t$, $\partial_w$, and $\partial_\phi$, the momenta along these directions are constants of motion. We shall denote the constants by \begin{align} p_t=-E,\quad p_w=P,\quad p_\phi=L, \end{align} representing the energy, linear momenta along the $w$-direction, and the angular momentum of the particle, respectively. The evolution of $t$, $w$, and $\phi$ are determined by the first integrals \begin{align} \dot{t}=\frac{E}{U},\quad \dot{w}=\frac{P}{V},\quad\dot{\phi}=\frac{L+q\cos\theta}{r^2\sin^2\theta}.\label{firstint1} \end{align} The equations of motion for $r$ and $\theta$ can be obtained from the Euler--Lagrange equations, giving \begin{align} \ddot{\theta}&=-\frac{2\dot{r}\dot{\theta}}{r}+\frac{\cos\theta\brac{L+q\cos\theta}^2}{r^4\sin^3\theta}+\frac{q\brac{L+q\cos\theta}}{r^4\sin\theta}, \label{thetaddot}\\ \ddot{r}&=\frac{1}{2}\brac{\frac{U'}{U}+\frac{V'}{V}}\dot{r}^2+rUV\dot{\theta}^2-\frac{VU'E^2}{2U}+\frac{UV'P^2}{2V}+\frac{UV\brac{L+q\cos\theta}^2}{r^3\sin^2\theta}, \label{rddot} \end{align} where primes denote derivatives with respect to $r$. We also note that Eq.~\Eqref{normalisation} can be regarded as another equation of first integrals. Using Eq.~\Eqref{firstint1} to express $\dot{t}$, $\dot{w}$, and $\dot{\phi}$ in terms of the constants of motion, we have \begin{align} \frac{\dot{r}^2}{UV}+r^2\dot{\theta}^2-\frac{E^2}{U}+\frac{P^2}{V}+\frac{\brac{L+q\cos\theta}^2}{r^2\sin^2\theta}=-1. \label{firstint2} \end{align} Equations.~\Eqref{thetaddot} and \Eqref{rddot} can be solved numerically while using Eq.~\Eqref{firstint2} as a consistency check. In this work, this is performed by implementing the fourth-order Runge--Kutta algorithm in C. A deeper analytical insight can be found by considering the Hamilton--Jacobi equation $\mathcal{H}\brac{\frac{\partial S}{\partial x},x}+\frac{\partial S}{\partial\tau}=0$, where $\mathcal{H}(p,x)=\frac{1}{2} g^{\mu\nu}\brac{p_\mu-eA_\mu}\brac{p_\nu-eA_\nu}$ is the Hamiltonian obtained from the Legendre transform of the Lagrangian. Explicitly, the Hamilton--Jacobi equation for our present context reads \begin{align} \frac{1}{2}\Bigg[-\frac{1}{U}\brac{\frac{\partial S}{\partial t}}^2&+\frac{1}{V}\brac{\frac{\partial S}{\partial w}}^2+UV\brac{\frac{\partial S}{\partial r}}^2+\frac{1}{r^2}\brac{\frac{\partial S}{\partial\theta}}^2\nonumber\\ &+\frac{1}{r^2\sin^2\theta}\brac{\frac{\partial S}{\partial\phi}+q\cos\theta}^2\Bigg]+\frac{\partial S}{\partial\tau}=0. \end{align} For this system, the Hamilton--Jacobi equation is completely separable, giving the first integrals \begin{subequations}\label{EOMdot} \begin{align} \dot{t}&=\frac{E}{U},\quad \dot{w}=\frac{P}{V},\quad \dot{\phi}=\frac{L+q\cos\theta}{r^2\sin^2\theta},\label{twphidot}\\ r^2\dot{\theta}&=\pm\sqrt{Q+L^2-\frac{\brac{L+q\cos\theta}^2}{\sin^2\theta}},\label{thetadot}\\ r^2\dot{r}&=\pm\sqrt{r^4\brac{VE^2-UP^2}-r^2UV\brac{r^2+L^2+Q}}, \label{rdot} \end{align} \end{subequations} where $Q$ is the Carter-like \cite{Carter:1968rr} separation constant. We further simplify the equations by introducing a Mino-type parameter \cite{Mino:2003yg} defined by $\frac{\mathrm{d}\tau}{\mathrm{d}\lambda}=r^2$, and changing variables to $x=\cos\theta$. Then the equations of motion now become \begin{subequations}\label{HJE} \begin{align} \frac{\mathrm{d} t}{\mathrm{d}\lambda}&=\frac{r^2E}{U}, \label{dt}\\ \frac{\mathrm{d} w}{\mathrm{d}\lambda}&=\frac{r^2P}{V}, \label{dw}\\ \frac{\mathrm{d}\phi}{\mathrm{d}\lambda}&=\frac{L+qx}{1-x^2},\label{dphi}\\ \frac{\mathrm{d} x}{\mathrm{d}\lambda}&=\mp\sqrt{X(x)}, \label{dx}\\ \frac{\mathrm{d} r}{\mathrm{d}\lambda}&=\pm\sqrt{R(r)}, \label{dr} \end{align} \end{subequations} where \begin{subequations} \begin{align} X(x)&=Q^2(1-x^2)-\brac{L+qx}^2,\label{Xdef}\\ R(r)&=r^4\brac{VE^2-UP^2}-r^2UV\brac{Q+L^2+ r^2}.\label{Rdef} \end{align} \end{subequations} \section{Parameter and coordinate ranges} \label{sec_ParamSpace} \subsection{Angular motion} \label{subsec_angular} The polar motion with $x=\cos\theta$ is governed by $X(x)$ in Eq.~\Eqref{Xdef}. Since $\frac{\mathrm{d} x}{\mathrm{d}\lambda}$ must be real in Eq.~\Eqref{dx}, the particle is allowed to move in the domain where $X(x)\geq 0$. Clearly, we see that no such domain exist if $Q+L^2\leq 0$. Therefore the Carter-like constant $Q$ is restricted to $Q>-L^2$. When this is satisfied, $X(x)$ is non-negative in the domain $x_-\leq x\leq x_+$, \begin{align} x_-\leq x\leq x_+, \label{domain_x} \end{align} where \begin{align} x_\pm&=\frac{-qL\pm\sqrt{(Q+q^2)(Q+L^2)}}{Q+L^2+q^2}. \end{align} The domain \Eqref{domain_x} is non-empty if $(Q+q^2)(Q+L^2)\leq 0$. Since we already argued above that $Q>-L^2$, we then have $Q+q^2\geq 0$. \begin{align} (Q,L)\in\left\{Q+L^2>0\quad\mbox{ and }\quad Q+q^2\geq0 \right\}. \label{domain_QL} \end{align} Equation.~\Eqref{dx} can be integrated explicitly upon a choice of branch and initial conditions. Here, let us consider two specific choices, $x(0)=x_+$ and $x(0)=x_-$. In the former, we take the upper (negative) sign of Eq.~\Eqref{dx}, whereas in the latter we take the lower (positive) sign. These choices will give an increasing $\lambda$ as the particle evolves away from their respective initial conditions. The integration is then\footnote{Note that in the argument of the cosine function, $\lambda$ lies outside the square root.} \begin{align} \int_{x_\pm}^x\frac{\mathrm{d} x'}{\sqrt{X(x')}}&=\mp\int_0^\lambda\mathrm{d}\lambda'\nonumber\\ x(\lambda)&=\frac{x_++x_-}{2}\pm\frac{x_+-x_-}{2}\cos\brac{\sqrt{Q+L^2+q^2}\lambda} \nonumber\\ x(\lambda)&=\frac{1}{Q+L^2+q^2}\sbrac{-qL\pm\sqrt{(Q+q^2)(Q+L^2)}\cos\brac{\sqrt{Q+L^2+q^2}\lambda}}. \label{soln_x} \end{align} We can also obtain an analytical solution for $\phi$ expressed as a function of $x$ by eliminating $\lambda$ from Eq.~\Eqref{dphi} and \Eqref{dx}, giving \begin{align} \frac{\mathrm{d}\phi}{\mathrm{d} x}&=\mp\frac{L+qx}{(1-x^2)\sqrt{X(x)}}. \end{align} The integral can be performed with the aid of partial fraction decomposition on the factor $1/(1-x^2)$. The result is \begin{align} \phi(x)&=\brac{\mathrm{sgn}(L-q)+\mathrm{sgn}(L+q)}\frac{\pi}{4}\nonumber\\ &\quad\pm\frac{1}{2}\Bigg\{\mathrm{sgn}(L-q)\arcsin\sbrac{\frac{(L-q)^2}{\sqrt{(Q+q^2)(Q+L^2)}}\brac{\frac{1}{1+x}-\frac{Q+L^2+q^2-qL}{(L-q)^2}}}\nonumber\\ &\quad\quad-\mathrm{sgn}(L+q)\arcsin\sbrac{\frac{(L+q)^2}{\sqrt{(Q+q^2)(Q+L^2)}} \brac{\frac{1}{1-x}-\frac{Q+L^2+q^2+qL}{(L+q)^2}}}\Bigg\}, \label{soln_phi} \end{align} where the `$\pm$' signs are in accordance to the choice of initial conditions of $x(\lambda)$ in Eq.~\Eqref{soln_x}. We have also defined the sign function as $\mathrm{sgn}(x)$ which returns $\pm1$ if $x\gtrless 0$ and returns $0$ if $x=0$. It is worth noting that the angular equations of motion are independent of $\alpha$ and $\beta$, and are purely due to the Lorentz interaction between the charge and the spherically symmetric magnetic field. As alluded to in the Introduction, the equations of motion for $x=\cos\theta$ and $\phi$ are in fact identical to the equations of motion for a charged particle around a magnetically charged Reissner--Nordstr\"{o}m black hole \cite{Hackmann:2008tu,Grunau:2010gd,Pugliese:2011py,Sharif2017}, as well as the non-relativistic dyon-dyon interaction \cite{Schwinger:1976fr,Sivardiere2000} where the motion is confined to the Poincar\'{e} cone. We will show that the Poincar\'{e} cone also exists in our context of the KKBH/TS spacetime as well. If we take our coordinates $(r,\theta,\phi)$ to define a naive Euclildean three-space with $\{\hat{e}_r,\hat{e}_\theta,\hat{e}_\phi\}$ as the ortho-normal basis in spherical coordinates, the vector \begin{align} \vec{J}=-q\,\hat{e}_r - r^2\sin\theta\,\dot{\phi}\,\hat{e}_\theta+r^2\dot{\theta}\,\hat{e}_\phi \end{align} is conserved throughout the motion, i.e., $\frac{\mathrm{d}}{\mathrm{d}\tau}\vec{J}=\vec{0}$. In the non-relativistic case, this quantity is the total angular momentum of the system \cite{Schwinger:1976fr,Sivardiere2000,Balian:2005joa}. This implies that the particle moves on the surface of a cone which subtends an angle $\chi$ such that \begin{align} \cos\frac{\chi}{2}=-\frac{\vec{J}}{\big|\vec{J}\big|}\cdot\hat{e}_r=\frac{q}{\sqrt{q^2+Q+L^2}}. \label{cone_chi} \end{align} If we further define a Cartesian coordinate system in this naive Euclidean space by \begin{align} x_1=r\sin\theta\cos\phi,\quad x_2=r\sin\theta\sin\phi,\quad x_3=r\cos\theta, \end{align} the angle $\psi$ of the cone's axis with the $x_3$-direction (the axis passing through the north and south poles) is given by \begin{align} \cos\psi=\frac{\vec{J}}{\big|\vec{J}\big|}\cdot\hat{e}_3=\frac{L}{\sqrt{q^2+Q+L^2}}, \label{cone_psi} \end{align} where Eq.~\Eqref{EOMdot} was used and $\hat{e}_3$ is the unit vector along $x_3$. \subsection{Radial motion} \label{subsec_r} The motion in the $r$-direction is governed by the function $R(r)$ defined in Eq.~\Eqref{Rdef}, which we will rewrite here as \begin{align} R(r)=c_4r^4+c_3 r^3+c_2r^2+c_1r+c_0, \label{R_polynomial} \end{align} where \begin{subequations} \begin{align} c_4&=-\brac{1+P^2-E^2},\\ c_3&=\alpha+\beta-\beta E^2+\alpha P^2,\\ c_2&=-\brac{\alpha\beta+Q+L^2},\\ c_1&=(\alpha+\beta)\brac{Q+L^2},\\ c_0&=-\alpha\beta\brac{Q+L^2}. \end{align} \end{subequations} From Eq.~\Eqref{dr}, the requirement that $\frac{\mathrm{d} r}{\mathrm{d}\lambda}$ be real means the particle can only access the domains of $r$ where $R(r)\geq0$. We identify these domains by studying the root structure of $R(r)$, which serves as possible boundaries of the domains. It will be convenient to define $K=L^2+Q$, as $L$ and $Q$ always appear in this combination in $R(r)$. To aid our discussion below, we introduce the following terminology for the possible domains of $r$ such that $R(r)\geq0$: \begin{itemize} \item \emph{Plunging orbits}. A finite domain of $r$ which contains the horizon $r=\alpha$. Particles in this domain may fall into the horizon. \item \emph{Escaping orbits}. A (semi-)infinite domain of $r$, where $R(r)$ remains positive as $r\rightarrow\infty$. Particles in this domain can escape to infinity. \item \emph{Bound orbits}. A finite domain bounded by two roots of $R(r)$. Particles in this domain are in stable bound orbits, neither falling into the black hole or escaping to infinity. \end{itemize} Suppose we start with a case where $R(r)$ has four real roots. Varying $E$, $P$, and $K$ will generally vary the positions of each root. A pair of roots will coalesce into a degenerate root when $R(r)=R'(r)=0$. A particle located at this point will will solve the equations of motion for constant $r$, which we will call a \emph{circular orbit}.\footnote{The term `circular' used here has an interesting roundabout connotation. Usually, constant-$r$ solutions of spherically symmetric equations of motion reduces to a circle because the symmetry confines the motion to a plane containing the origin. When spherical symmetry is not present, constant-$r$ trajectories may lie on a sphere, and are typically called \emph{spherical orbits} \cite{Teo:2020sey}. At the same time we have shown in the previous subsection that the trajectories lie on a Poincar\'{e} cone. The intersection between a cone and a sphere whose apex and centres coincide is, again, a circle.} This condition is satisfied when the energy and angular momentum satisfies \begin{subequations}\label{EL_sph} \begin{align} E^2=E^2_{0}&=\frac{(r-\alpha)^2\sbrac{2(r-\beta)^2+r^2(2r-3\beta)P^2}}{r(r-\beta)^2(2r-3\alpha)},\label{E_sph}\\ L^2+Q=K_{0}&=\frac{r^2\sbrac{\alpha(r-\beta)^2+r^2(\alpha-\beta)P^2}}{(r-\beta)^2(2r-3\alpha)}. \label{L_sph} \end{align} \end{subequations} For a given $\alpha$, $\beta$, and $P$, plotting Eq.~\Eqref{EL_sph} as a parametric curve in $r$ on the $E^2$-$K$ plane will serve as a boundary separating domains for which $R(r)$ has various numbers of real or complex roots. We can identify which pair among the four roots are degenerate by evaluating the second derivative \begin{align} R''(r)\Big|_{\substack{E=E_0,\\L=L_0}}&=-\frac{2\sbrac{\alpha(r-\beta)^3(r-3\alpha)+r^2(\alpha-\beta)\brac{r^2-3(\alpha+\beta)r+6\alpha\beta}P^2}}{(r-\beta)^2(2r-3\alpha)}. \end{align} If the double root of $R(r)$ is a local minimum, this corresponds to an unstable circular orbit. On the other hand, if this double root is a local maximum, the circular orbit is stable as a small perturbation puts it in small oscillations about its original radius. The \emph{critical circular orbit} (CCO) is $r_{\mathrm{CCO}}$ such that $R''(r_{\mathrm{CCO}})=0$. This is the critical radius where a circular orbit changes from being unstable to stable, or vice versa. Indeed, if $P=\beta=0$, and letting $\alpha=2m$, we recover the innermost stable circular orbit (ISCO) of the Schwarzschild black hole, $r_{\mathrm{ISCO}}=6m$.\footnote{As we shall see in the following, the reason we use the terminiology `critical circular orbit' rather than `innermost' is there may be multiple points satisfying $R''(r)=0$, and hence `innermost' is no longer accurate.} Looking at large $r$, we find that, asymptotically, \begin{subequations}\label{asymptoticEK} \begin{align} E_0^2&\sim 1+P^2-\frac{1}{2}\brac{\alpha+(\alpha-\beta)P^2}\frac{1}{r}+\mathcal{O}\brac{\textstyle{\frac{1}{r^2}}},\\ K_0&\sim\frac{1}{2}\brac{\alpha+(\alpha-\beta)P^2}r+\frac{1}{4}(3\alpha+4\beta)(\alpha-\beta)P^2+\frac{3}{4}\alpha^2+\mathcal{O}\brac{\textstyle{\frac{1}{r}}}. \end{align} \end{subequations} Next we will explore the $E^2$-$K$ space as $\alpha$ varies, starting from $\alpha>\beta$ (the KKBH case), and then for $\alpha<\beta$ (the TS case). \subsubsection{\texorpdfstring{$\alpha>\beta$}{alpha>beta} (KKBH)} We begin with $\alpha>\beta$, which correspond to spacetimes with an event horizon. The $E^2$-$K$ space can be organised into domains separated by curves $E^2=E_0^2$ and $K=K_0$, as defined in Eq.~\Eqref{EL_sph}. Fig.~\ref{fig_BH_domain_LE} demonstrates the domains for the concrete example $\alpha=2$, $\beta=1$, and $P=0.2$. For $\alpha>\beta$, we find that there are two branches of circular orbits. The unstable branch has $R''(r)>0$ and occurs for $\frac{3}{2}\alpha<r<r_{\mathrm{CCO}}$ and is the upper branch depicted in Fig.~\ref{fig_BH_domain_LE}. This branch tends to infinity as $r\rightarrow\frac{3}{2}\alpha$. On the other hand, the stable branch is the one with $R''<0$ and corresponds to $r_{\mathrm{CCO}}<r<\infty$. This branch asymptotically approaches $E^2=1+P^2$ as $r\rightarrow\infty$, in accordance to Eq.~\Eqref{asymptoticEK}. The horizontal red line is $E^2=1+P^2$. Values of $E^2$ below this line makes the leading coefficient $c_4$ of $R(r)$ negative. We shall call this case `A'. Conversely, values of $E$ above this line shall be called case `B' for which $c_4$ is positive. \begin{figure} \begin{center} \includegraphics{fig_BH_ELspace.eps} \caption{Parameter space described by angular momentum $L$ and energy $E$, plotted here for $\alpha=2$, $\beta=1$, and $P=0.2$. The blue curves corresponds to the circular orbits, where the second derivatives of $R(r)$ on these orbits are indicated. The segment with $R''(r)<0$ give stable circular orbits while and the other segment with $R''(r)>0$ give unstable circular orbits. The two segments meet at $r=r_{\mathrm{CCO}}$. The four domains marked A1, A2, B1, and B2 have functions $R(r)$ sketched in Figs.~\ref{fig_BH_domainA1}, \ref{fig_BH_domainA2}, \ref{fig_BH_domainB1}, and \ref{fig_BH_domainB2}, respectively.} \label{fig_BH_domain_LE} \end{center} \end{figure} First we look at Case A. As the leading coefficient $c_4$ is negative, we have $R(r)<0$ for values of $r$ beyond its largest root. This implies that the particle is unable to escape to infinity. The parameters giving four real roots of $R(r)$ lie in domain A1 in Fig.~\ref{fig_BH_domain_LE}. The structure of these four roots can be understood with the aid of the Descartes rule of signs. For $K=L^2+Q$ satisfying \Eqref{domain_QL}, along with $\alpha,\,\beta\geq0$, we see that $c_2<0$, $c_1>0$, and $c_0\leq 0$. The remaining coefficient $c_3$ can be rearranged as \begin{align*} c_3&=\beta\sbrac{\frac{\alpha}{\beta}\brac{1+P^2}-E^2}. \end{align*} Since $E^2<1+P^2$ and $\alpha>\beta$, this term is positive. By the Descartes rule of signs, $R(r)$ in this case has four positive roots. Since $R(\alpha)=E^2\alpha^3\brac{\alpha-\beta}>0$, the number of roots located outside the horizon is either 3 or 1. From these considerations, we conclude that, for $E^2<1+P^2$, there is always a plunging orbit and at most one bound orbit. A sketch of such a situation is shown in Fig.~\ref{fig_BH_domainA1}, which occurs when $E$ and $K$ takes values in the subdomain A1 of Fig.~\ref{fig_BH_domain_LE}. For $r>r_{\mathrm{CCO}}$, the two largest roots will coalesce, shrinking the domain of bound orbit to a point, giving a stable circular orbit. On the other hand, if $r<r_{\mathrm{CCO}}$, the second and third largest roots coalesce such that the plunging and bound domains are only separated by a point, which is the unstable circular orbit. For this case ($\alpha>\beta$), we see that it is indeed appropriate to call $r_{\mathrm{CCO}}$ the \emph{innermost} stable circular orbit. \begin{figure} \begin{center} \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_BH_domainA1.eps} \caption{Case A1} \label{fig_BH_domainA1} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_BH_domainA2.eps} \caption{Case A2} \label{fig_BH_domainA2} \end{subfigure} \par \vspace{24pt} \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_BH_domainB1.eps} \caption{Case B1} \label{fig_BH_domainB1} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_BH_domainB2.eps} \caption{Case B2} \label{fig_BH_domainB2} \end{subfigure} \caption{Sketches of $y=R(r)$ for various cases of energy and angular momentum, corresponding to domains (a)--(d) of the $L$-$E$ plane of Fig.~\ref{fig_BH_domain_LE}. The vertical red lines indicate the horizon $r=\alpha$. The allowed domains of $r$ corresponding to $R(r)\geq0$ are marked as thick blue lines. For each allowed domain, the labels \emph{plunging}, \emph{escaping}, and \emph{bound} are as defined in the main text.} \label{fig_BH_domain} \end{center} \end{figure} Varying $E^2$ and $K$ further until the pair of roots become complex, the function $R(r)$ will appear as sketched in Fig.~\ref{fig_BH_domainA2}, where only a plunging orbit can exist. This occurs when $E^2$ and $K$ takes values in subdomain A2 of Fig.~\ref{fig_BH_domain_LE}. We now turn to Case B, where $E^2>1+P^2$. Now $c_4$ is positive. Whether $c_3$ is positive or negative, the Descartes rule of signs tells us that $R(r)$ has either three positive roots or one positive root. Since $R(r)$ is positive at the horizon, we conclude that there are no bound orbits in this case. The possible types of motion are either plunging and/or escaping orbits. More specifically, there are two subdomains B1 and B2, where domain B1 corresponds to functions $R(r)$ appearing in the form sketched in Fig.~\ref{fig_BH_domainB1}, and domain B2 have functions appearing as sketched in Fig.~\ref{fig_BH_domainB2}. Finally we look specifically at the circular orbits, which lie on the boundary curves separating the domains discussed above, as shown in Fig.~\ref{fig_BH_domain_LE}. In particular, the curve \Eqref{EL_sph} for $\frac{3}{2}\alpha<r<r_{\mathrm{CCO}}$ is the upper curve. Particles whose energy and angular momentum taking values along this upper curve are unstable spherical orbits. The lower curve gives stable circular orbits with radii in the range $r_{\mathrm{CCO}}<r<\infty$. \subsubsection{\texorpdfstring{$\frac{2}{3}\beta<\alpha<\beta$}{2beta/3<alpha<beta} (TS)} When $\beta>\alpha$, the spacetime describes a TS without the presence of a horizon. The structure of the parameter space in this case is richer, as there can be up to \emph{three} branches of circular orbits, depending on the value of $P$. Figure.~\ref{fig_top_ELspace_seq} shows the sequence of the curves \Eqref{EL_sph} for the concrete example $\alpha=1.5$, $\beta=2$, and increasing values of $P$. \begin{figure} \begin{center} \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=1]{fig_top_ELspace_seq1.eps} \caption{$P=0.1$.} \label{fig_top_ELspace_seq1} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=1]{fig_top_ELspace_seq2.eps} \caption{$P=0.25$.} \label{fig_top_ELspace_seq2} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=1]{fig_top_ELspace_seq3.eps} \caption{$P=0.3$.} \label{fig_top_ELspace_seq3} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=1]{fig_top_ELspace_seq4.eps} \caption{$P=0.36$.} \label{fig_top_ELspace_seq4} \end{subfigure} % % \caption{Parameter space for the TS spacetime with $\alpha=1.5$, $\beta=2$, and various $P$. The horizontal direction represents $L^2+Q$ and the vertical direction represents $E^2$. The horizontal red lines correspond to $E^2=1+P^2$.} \label{fig_top_ELspace_seq} \end{center} \end{figure} We shall attempt to understand these structures by looking closely at the circular orbit conditions. The various root configurations shall be given labels similar to the black-hole case, with the main difference being that, instead of a horizon, we have the tip of the spacetime $r=\beta$. We note that \begin{align} R(\beta)=-P^2\beta^3(\beta-\alpha)\leq0. \end{align} In other words, as long as $P$ is non-zero, the spacetime tip is not accessible to the particle. We modify our sketch of $R(r)$ for the various cases accordingly to obtain Fig.~\ref{fig_top_domain}. The vertical lines, now in green, represent the end-of-spacetime position $r=\beta$. \begin{figure} \begin{center} \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_top_domainA1.eps} \caption{Case A1} \label{fig_top_domainA1} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_top_domainA2.eps} \caption{Case A2} \label{fig_top_domainA2} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_top_domainA3.eps} \caption{Case A3} \label{fig_top_domainA3} \end{subfigure} % \\\vspace{12pt} \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_top_domainB1.eps} \caption{Case B1} \label{fig_top_domainB1} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=0.9]{fig_top_domainB2.eps} \caption{Case B2} \label{fig_top_domainB2} \end{subfigure} % % \caption{Sketches of $y=R(r)$ for various cases of energy and angular momentum, corresponding to cases A1--A3, B1--B2 of the $K$-$E^2$ plane of Fig.~\ref{fig_top_ELspace_seq}. The vertical green lines indicate $r=\beta$. The allowed domains of $r$ corresponding to $R(r)\geq0$ are marked as thick blue lines. For each allowed domain, the labels \emph{escaping} and \emph{bound} are as defined in the main text. Since there are no horizons in this case, there are no plunging orbits.} \label{fig_top_domain} \end{center} \end{figure} Looking Eq.~\Eqref{L_sph}, we should keep in mind that this quantity must be positive due to Eq.~\Eqref{domain_QL}. Since now $\beta>\alpha$, this quantity changes sign at \begin{align} \frac{\beta\sqrt{\alpha}}{\sqrt{\alpha}\mp P\sqrt{\beta-\alpha}}\quad\mbox{ and }\quad \frac{3}{2}\alpha. \end{align} The root $r=\frac{\beta\sqrt{\alpha}}{\sqrt{\alpha}+P\sqrt{\beta-\alpha}}$ is beyond $r<\beta$, so we need not consider this unphysical location. For the next root, we introduce the notation \begin{align} r_*=\frac{\beta\sqrt{\alpha}}{\sqrt{\alpha} - P\sqrt{\beta-\alpha}}>\beta. \end{align} At fixed $\alpha$ and $\beta$, either $r_*$ is larger or smaller than $3\alpha/2$, depending on the value of $P$. We consider each case in turn: If $0<P<\frac{3\alpha-2\beta}{3\sqrt{\alpha}\sqrt{\beta-\alpha}}$, then $r_*<\frac{3}{2}\alpha$. In this case $K_0$ is positive for $\beta<r<r_*$ and $\frac{3}{2}\alpha<r<\infty$. An example of this situation is shown in Fig.~\ref{fig_top_ELspace_seq1}. The branch $\beta<r<r_*$ corresponds to the middle branch of Fig.~\ref{fig_top_ELspace_seq1}, starting from large positive infinity at $r\rightarrow\beta$, and going to $K=0$ as $r\rightarrow r_*$. For this branch, we find $R''(r)<0$ which correspond to stable circular orbits. The domain $r_*<r<\frac{3}{2}\alpha$ gives negative $K$ so we do not consider it here. Next, increasing $r$ continuously from $\frac{3}{2}\alpha$, we have a stable branch until $r$ reaches the critical point $r_{\mathrm{CCO}}$. This point correspond to the sharp cusp in Fig.~\ref{fig_top_ELspace_seq1}. After this critical point, the remaining branch $r_{\mathrm{CCO}}<r<\infty$ is a branch of stable circular orbits. In summary, for the TS case we have two branches of stable circular orbits, $\beta<r<r_*$ and $r_{\mathrm{CCO}}<r<\infty$. If $\frac{3\alpha-2\beta}{3\sqrt{\alpha}\sqrt{\beta-\alpha}}<P<P_{\mathrm{crit}}$ for some $P_{\mathrm{crit}}$, then $r_*>\frac{3}{2}\alpha$. Here we have a stable branch from $r_*$, increasing until a critical point, which we shall denote by $r_{\mathrm{CCO}1}$. The point $\brac{K(r_{\mathrm{CCO}1}),E^2_0(r_{\mathrm{CCO1}})}$ is the upper-right sharp cusp of Fig.~\ref{fig_top_ELspace_seq2}. As $r$ increases further, we get the unstable branch which ends at another critical point $r_{\mathrm{CCO2}}$, where its corresponding point is the lower-left cusp in Fig.~\ref{fig_top_ELspace_seq2}. After which we reach a stable branch $r_{\mathrm{CCO2}}<r<\infty$. As $P$ increases toward $P_{\mathrm{crit}}$, the two critical points $r_{\mathrm{CCO1}}$ and $r_{\mathrm{CCO2}}$ approach each other, as can be seen in going from Fig.~\ref{fig_top_ELspace_seq2} to Fig.~\ref{fig_top_ELspace_seq3}. As $P\rightarrow P_{\mathrm{crit}}$, the two critical points coalesce. For the example of $\alpha=1.5$ and $\beta=2$, the value is about $P_{\mathrm{crit}}\approx0.354$. Increasing $P$ further beyond that results in a smooth curve separating domains A2 and A3 (see Fig.~\ref{fig_top_ELspace_seq4}), and this single branch is stable. This is highly reminiscent to the swallow-tail graphs of thermodynamics depicting phase transitions. Finally, as $P$ increases further toward $\frac{\alpha}{\beta-\alpha}$, the single circular orbit branch approaches the line $E^2=1+P^2$, thus shrinking the domain A2. If $P$ continues to increase beyond that, $K$ in Eq.~\Eqref{L_sph} becomes negative for any $r$ and no circular orbits can occur. \subsubsection{\texorpdfstring{$\alpha<\frac{2}{3}\beta$}{alpha<2beta/3} (TS)} For $\beta>\frac{3}{2}\alpha$, the position $r=\frac{3}{2}\alpha$ is beyond the physical range. Then $K_0$ only changes sign at $r_*>\beta$. In this case, the situation depicted in Fig.~\ref{fig_top_ELspace_seq1} does not exist here. The remaining sequence of structure as $P>0$ is gradually increases is similar to the previous case, and is shown in Fig.~\ref{fig_top2_ELspace_seq}, in that there are two stable branches and one unstable branch. As $P$ reaches $P_{\mathrm{crit}}$, the unstable branch disappears and the two stable branch merges into one, shown in Fig.~\ref{fig_top2_ELspace_seq4}. For the example $\alpha=1$, $\beta=2$, the value of the critical momentum is about $P_{\mathrm{crit}}\approx0.53$. \begin{figure} \begin{center} \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=1]{fig_top2_ELspace_seq1.eps} \caption{$P=0$.} \label{fig_top2_ELspace_seq1} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=1]{fig_top2_ELspace_seq2.eps} \caption{$P=0.002$.} \label{fig_top2_ELspace_seq2} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=1]{fig_top2_ELspace_seq3.eps} \caption{$P=0.05$.} \label{fig_top2_ELspace_seq3} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[scale=1]{fig_top2_ELspace_seq4.eps} \caption{$P=0.1$.} \label{fig_top2_ELspace_seq4} \end{subfigure} % % \caption{Parameter space for the soliton/topological star with $\alpha=1$, $\beta=2$, and various $P$. The horizontal direction represents $K=L^2+Q$ and the vertical direction represents $E^2$. The horizontal red lines correspond to $E^2=1+P^2$.} \label{fig_top2_ELspace_seq} \end{center} \end{figure} \section{Examples of orbits and special cases} \subsection{The \texorpdfstring{Poincar\'{e}}{Poincare} cone} In Sec.~\ref{subsec_angular}, it was shown that the trajectory of the orbits lie on a Poincar\'{e} cone whose orientation $\psi$ and opening angle $\chi$ is given by Eq.~\Eqref{cone_psi} and \Eqref{cone_chi}, respectively. In this section, we shall explore some concrete examples and plot the orbits, thus demonstrating the geometrical significance of the cone. From Eqs.~\Eqref{cone_psi} and \Eqref{cone_chi}, we see that the angles $\psi$ and $\chi$ are determined by $L$, $Q$, and $q$. We first construct some examples of circular orbits whose cones lie parallel to the $x_3$-axis. For this we require $\psi=0$ or $\psi=\pi$. This is achieved when $Q=-q^2$. For constant $r$, the requisite values of $E$ and $K$ are determined by Eq.~\Eqref{E_sph} and \Eqref{L_sph}. Then the appropriate value of $L$ is chosen to satisfy the equation $L^2=K-Q$. \begin{figure} \begin{center} \includegraphics{fig_ConePlayCircular1.eps} \caption{Three spherical orbits of radius $r=15$ and momentum $P=0.2$ around a black hole spacetime of parameters $\alpha=2$, $\beta=1$. From top to bottom, the values of $q$ are $0$, $3$, and $9$. The values of $E$ and $K$ are as calculated from Eq.~\Eqref{E_sph} and \Eqref{L_sph}. In each case, $Q=-q^2$, ensuring the cone is vertical and the orbits are all parallel to the $x_1$-$x_2$ plane. The $q=0$ orbit lies on a `cone' of opening angle $\pi$, which is simply the $x_3=0$ plane. For $q=3$ and $q=9$, their opening angles are $\chi=1.9404\;\mathrm{rad}$ and $\chi=0.90577\;\mathrm{rad}$ respectively, as determined from \Eqref{cone_chi}.} \label{fig_ConePlayCircular1} \end{center} \end{figure} Starting with $q=0$, we have a `cone' with opening angle $\chi=\pi$, which is simply the flat $x_1$-$x_2$ plane. When $q$ is increased, the opening angles change in accordance to Eq.~\Eqref{cone_chi}. Some examples are shown in Fig.~\ref{fig_ConePlayCircular1}. Next if we wish to consider fixed opening angles, Eq.~\Eqref{cone_chi} tells us that $\chi$ can be fixed if $q$ and $K=Q+L^2$ are fixed. So varying $L$ will now change the angle of the cone with respect to the $x_3$-axis. Some examples of this, with constant and non-constant $r$ are shown in Fig.~\ref{fig_AzConf}. \begin{figure} \begin{center} \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[width=\textwidth]{fig_AzConf1.eps} \caption{Constant $r=15$.} \label{fig_AzConf1} \end{subfigure} % % \begin{subfigure}[b]{0.49\textwidth} \centering \includegraphics[width=\textwidth]{fig_AzConf2.eps} \caption{$E=\sqrt{0.985}$, $K=16$.} \label{fig_AzConf2} \end{subfigure} % % \caption{Orbits around a black hole spacetime of $\alpha=2$ and $\beta=1$ of a particle of charge $q=3$ and momentum $P=0.25$. From highest to lowest, the angular momenta are $L=2$ (blue), $L=3$ (green), and $L=4$ (orange). For Fig.~\ref{fig_AzConf1}, the values of $E$ and $K$ are determined from Eq.~\Eqref{EL_sph}. This time their underlying cones are not plotted to avoid cluttering the figure.} \label{fig_AzConf} \end{center} \end{figure} \subsection{Bound orbits around a TS} When $\alpha<\beta$ we have seen in the previous section that there exist two distinct domains of bound orbits, which is denoted as Case A1 and sketched in Fig.~\ref{fig_top_domainA1}. Changing the energy and angular momentum may cause two of the roots to coalesce and become complex, leaving a single connected domain of bound orbits, denoted Case A2 and sketched in Fig.~\ref{fig_top_domainA2}. \subsubsection{`Low energy' bound orbits (\texorpdfstring{$E<\sqrt{1+P^2}$}{E<sqrt{1+P2}})} Let us first consider Case A1 in further detail. In this case, $R(r)$ has four real roots, which we denote to have the following order: \begin{align} r_1\leq r_2\leq r_-\leq r_+. \end{align} In Case A1, we have bound orbits where the particle can exist either in the interval $[r_1,r_2]$ or $[r_-,r_+]$. If we place our particle with initial conditions $r(0)=r_1$ and $\frac{\mathrm{d} r}{\mathrm{d}\lambda}(0)=0$, the trajectory of the particle is given by the analytical solution \begin{align} r(\lambda)&=\frac{(r_+-r_2)r_1+(r_2-r_1)r_+\mathrm{sn}\brac{\eta\lambda,p}^2}{r_+-r_2+(r_2-r_1)\mathrm{sn}\brac{\eta\lambda,p}^2}, \end{align} where $\mathrm{sn}\brac{\psi,k}$ is the Jacobi elliptic function of the first kind, and \begin{align} \eta=\frac{1}{2}\sqrt{(1+P^2-E^2)(r_+-r_2)(r_--r_1)},\quad p=\sqrt{\frac{(r_+-r_-)(r_2-r_1)}{(r_+-r_2)(r_--r_1)}}. \label{eta_p_def} \end{align} To describe bound orbits in the outer domain, let us choose the initial conditions $r(0)=r_-$ and $\frac{\mathrm{d} r}{\mathrm{d}\lambda}(0)=0$. Then its trajectory will be described by the solution \begin{align} r(\lambda)&=\frac{(r_+-r_2)r_--(r_+-r_-)r_2\mathrm{sn}\brac{\eta\lambda,p}^2}{r_+-r_2+(r_--r_+)\mathrm{sn}\brac{\eta\lambda,p}^2}. \end{align} An example of orbits in these two domains are shown in Fig.~\ref{fig_orbit_plotting_top_A1}. \begin{figure} \begin{center} \includegraphics[scale=0.8]{fig_Orbit-A1.eps} \caption{Orbits around a topological star spacetime with $\alpha=1.5$, $\beta=2$, for a particle with $q=3$, $P=0.25$, $E=\sqrt{0.97}$, $K=6.8$, $Q=1$, and $L=\sqrt{K-Q}$. The particle in the inner domain $r_1<r<r_2$ is depicted with a blue curve, where $r_1=2.24334$ and $r_2=2.87916$. The particle with the outer domain $r_-\leq r\leq r_+$ is shown by the blue curve, where $r_-=3.82194$ and $r_+=8.89339$. The solid sphere represents the surface $r=\beta=2$.} \label{fig_orbit_plotting_top_A1} \end{center} \end{figure} In case A2, the function $R(r)$ has two real roots, which we denote by $r_1\leq r_2$. We further denote the other pair of complex conjugate roots as $m\pm\mathrm{i} n$. Then the function $R(r)$ is written as \begin{align} R(r)=(1+P^2-E^2)(r_2-r)(r-r_1)\sbrac{(r-m)^2+n^2}. \end{align} The particle can exist in the domain $r_1\leq r\leq r_2$ where $R(r)\geq0$. Choosing initial conditions $r(0)=r_1$ and the upper sign for Eq.~\Eqref{dr}, the analytical solution is \begin{align} r(\lambda)&=\frac{Br_2+Ar_1\cot\left\{\frac{1}{2}\arcsin\sbrac{\mathrm{sn}\brac{\delta\lambda,\rho}} \right\}}{B+A\cot\left\{\frac{1}{2}\arcsin\sbrac{\mathrm{sn}\brac{\delta\lambda,\rho}} \right\}}, \end{align} where \begin{align} A&=(m-r_2)^2+n^2,\quad B=(m-r_1)^2+n^2,\nonumber\\ \delta&=\sqrt{AB\brac{1+P^2-E^2}},\quad\rho=\frac{1}{2}\sqrt{\frac{-(A-B)^2+(r_2-r_1)^2}{AB}}. \end{align} An example of such an orbit is shown in Fig.~\ref{fig_orbit_plotting_top_A2} \begin{figure} \begin{center} \includegraphics[scale=0.8]{fig_Orbit-A2.eps} \caption{Orbits around a topological star spacetime with $\alpha=1.5$, $\beta=2$, for a particle with $q=3$, $P=0.25$, $E=\sqrt{0.98}$, $K=7.2$, $Q=-1$, and $L=-\sqrt{K-Q}$. The particle moves in the domain $r_1<r<r_2$ where $r_1=4.3744$ and $r_2=10.7069$. The other two roots of $R(r)$ are complex and are given by $m\pm\mathrm{i} n$, where $m=2.3609$ and $n=0.1279$. The solid sphere represents the surface $r=\beta=2$.} \label{fig_orbit_plotting_top_A2} \end{center} \end{figure} \subsubsection{`High energy' bound orbits (\texorpdfstring{$E>\sqrt{1+P^2}$}{E>sqrt{1+P2}})} For particles of `high' energy $E>\sqrt{1+P^2}$, bound orbits may still exist for sufficiently small $P$ where case B1 exists. In this case, the function $R(r)$ has four real roots $r_1\leq r_2\leq r_-\leq r_+$ and is non-negative in the domain $r_2\leq r\leq r_-$. The leading coefficient of $R(r)$ is positive. So the function can be written as \begin{align} R(r)=\brac{E^2-1-P^2}(r-r_1)(r-r_2)(r_--r)(r_+-r). \end{align} Choosing initial conditions $r(0)=r_2$ and the upper sign in Eq.~\Eqref{dr}, the analytical solution is \begin{align} r(\lambda)&=\frac{(r_--r_1)r_2-(r_--r_2)r_1\mathrm{sn}\brac{\zeta\lambda,b}^2}{r_--r_1-(r_--r_2)\mathrm{sn}\brac{\zeta\lambda,b}^2}, \end{align} where \begin{align} \zeta=\frac{1}{2}\sqrt{(E^2-P^2-1)(r_+-r_2)(r_--r_1)} =\mathrm{i}\eta,\quad b=\sqrt{\frac{(r_--r_2)(r_+-r_1)}{(r_+-r_2)(r_--r_1))}}. \end{align} An example of such an orbit is shown in Fig.~\ref{fig_Orbit-B1}. \begin{figure}[h] \begin{center} \includegraphics[scale=0.7]{fig_Orbit-B1.eps} \caption{Orbits around a topological star spacetime with $\alpha=1.5$, $\beta=2$, for a particle with $q=3$, $P=0.25$, $E=\sqrt{1.066}$, $K=8.44$, $Q=1$, and $L=\sqrt{K-Q}$. The particle moves in the domain $r_2<r<r_-$ where $r_2=2.3576$ and $r_-=2.6231$. The solid sphere represents the surface $r=\beta=2$.} \label{fig_Orbit-B1} \end{center} \end{figure} \section{Conclusion} \label{sec_conclusion} In this paper we have derived and analysed the equations of motion for a charged particle in the magnetic black hole/topological star solution. The angular motion was found to be similar to analogous systems involving interacting electric and magnetic monopoles. In particular, the electric charge moves along the surface of a Poincar\'{e} cone. The angle and orientation of the cone depends on the charge and the angular momentum, as is well-known since Poincar\'{e}'s original non-relativistic analysis. On the other hand, the radial motion shows a richer structure of possibilities in the topological star case. In particular, up to two distinct domains of bound orbits may exist for fixed energy and total angular momentum. On the $E^2$-$K$ space, the points representing circular orbits exhibit a swallow-tail structure where each branch correspond to stable/unstable circular orbits. When the $w$-momentum is varied, the swallow-tail kink disappears, leaving just a single stable branch. This is highly reminiscent of phase transitions behaviour in thermodynamics, where swallow-tail structures appear in the graphs of intrinsic parameters. Investigating this similarity and the possibility of carrying over thermodynamic concepts into particle mechanics of this spacetime might be a candidate of future study. \bibliographystyle{topstar}
\section*{\Large Appendices} \section{Related Work} \label{appendix:RW} Recently, several novel deep learning-based techniques to estimate uncertainty with a single model have been proposed. For example, Deep Evidential Regression \cite{amini2019deep} is a method for estimating epistemic uncertainty that is based on a parametric estimate of model variance. This is in line with previous work using evidential uncertainty estimation \cite{malinin2018predictive, sensoy18neural}. Orthonormal Certificates, a set of learned features with a suitable loss function, are used in \cite{tagasovska2018single}. These certificates capture the distance to the training set to learn an estimate of the epistemic uncertainty. This is further studied in \cite{Liu2020SimpleAP} who formalize \emph{distance awareness}, which captures the model's ability to quantify the distance of a test sample from the training data manifold, as a necessary condition for uncertainty estimation. This distance awareness can be captured with a weight normalization step in training, in addition to using a GP as the output layer. DUE \cite{DBLP:journals/corr/abs-2102-11409} is an instance of Deep Kernel Learning \cite{pmlr-v51-wilson16}, which is defined as a GP with a deep feature extractor inside the kernel. DUE improves upon SNGP by using an inducing point GP, and bi-lipschitz constraints on the feature extractor, giving better test set accuracies as well as improved training efficiency. DDU \cite{mukhoti2021deep} further extends this line of work by fitting Gaussian Discrminant Analysis (GDA) on the feature space of a regularized neural network. DUN \cite{Antoran2020DepthUI} uses the disagreement between the outputs from intermediate layers as a measure of uncertainty. DUQ \cite{Amersfoort2020SimpleAS} on the other hand uses two-sided Jacobian regularization on RBF networks \cite{lecun1998gradient} for reliable uncertainty estimates. \cite{Wen2020BatchEnsembleAA} present an efficient way of implementing ensembles of neural networks, by using one shared matrix and a rank-1 matrix per member. The weights for each member are then computed as the Hadamard product of the shared matrix and the rank-1 matrix of the member. There has also been extensive work in scaling up Bayesian Neural Networks for high-dimensional data to capture epistemic uncertainty. SWAG \cite{maddoxfast} fits a Gaussian distribution capturing the SWA \cite{Izmailov2018AveragingWL} mean and a covariance matrix representing the first two moments of SGD iterated. This distribution is then used as a posterior over the neural network weights. \cite{Dusenberry2020EfficientAS} parametrize the BNN with a distribution on a rank-1 subspace for each weight matrix, inspired by BatchEnsembles \cite{Wen2020BatchEnsembleAA}. \cite{Vadera2020GeneralizedBP, Malinin2020Ensemble} propose approaches to improve the efficiency of ensembles by distilling the distribution of predictions rather than the average, thus preserving the information about the uncertainty captured by the ensemble. There is also a large body of work on methods for approximating samples from the Bayesian posterior on large datasets with efficient MCMC based approaches. \cite{welling2011bayesian,Zhang2020CyclicalSG,Vadera2020URSABenchCB}. The variance of this posterior distribution can then be computed and used as an uncertainty estimate. However, as we have discussed in the sections above, this does not account for model misspecification and thus is not an accurate estimate for the lack of knowledge of the predictor. \cite{Appice2015NovelDO} present several decompositions of the total expected loss, including the decomposition into the epistemic and irreducible (aleatoric) loss. They present additive adjustments that reduce the scoring rules like the log-loss and Brier score, but do not tackle the general problem of uncertainty estimation. There are also interesting connections between the problem of out-of-distribution generalization arising in sequential model optimization and Bayesian optimization, discussed here, and the possibility of reweighing examples, see~\cite{farquhar2021statistical}. \section{Epistemic Uncertainty in a general loss function setting} \label{appendix:theorygeneral} We consider the setting presented in section \ref{sec:theoryL2}, but with a general loss function $l$. We use the same notations as in section \ref{sec:theoryL2}. \begin{definition} The {\bf total uncertainty} of $f$ at $x$ is defined as: \begin{align} {\cal U}(f,x) = \int l(f(x),y) dP(y|x). \end{align} \end{definition} \begin{definition} \label{def:varianceL2-2} For a learning algorithm $\cal L$ which produces a distribution $P_{\cal L}(f(x)|{\cal D}_n)$ over possible solutions $f(x)$ at $x$, the {\bf model variance} at $x$ is defined as \begin{align}\label{eq:variancegeneralloss} V({\cal L},{\cal D}_n,x)& = \int l(f(x),\hat{f}(x)) dP_{\cal L}(f(x)|{\cal D}_n)) \end{align} with $\hat{f}(x)=\arg\min_{\bar{f}(x)} \int l(f(x),\bar{f}(x)) dP_{\cal L}(f(x)|{\cal D}_n)).$ Note that for a loss function that is different from the square loss, the semantics of variance (such as its non-negativity) might be lost. \end{definition} Let us consider the special cases of the negative log-likelihood loss in general (for outputs which may be discrete or continuous) and that of the squared error loss (which ends up being a special case of the former for normally distributed outputs). Below we see $Q(Y|x)$ as a probability mass or density function (over $y$), which is also a function of $x$. \begin{definition} The negative log-likelihood (NLL) loss takes as first argument $Q(Y|x)$ a probability mass or density function and returns \begin{align} l_{NLL}(Q(Y|x),y) = - \log Q(Y=y|x). \end{align} \end{definition} \begin{proposition} \label{nll_total} For the NLL loss with ground truth $P(Y|x)$ and predictor $Q(Y|x)$, the total uncertainty ${\cal U}(Q(Y|x),x)$ is a cross-entropy, i.e., \begin{align} {\cal U}(Q(Y|\ . \ ),x) &= CE(P(Y|x)||Q(Y|x)) \nonumber \\ &= - \int dP(y|x) \log Q(y|x) \end{align} \end{proposition} The proposition is shown by applying the definitions. \begin{proposition} For the NLL loss with ground truth $P(Y|x)$, the aleatoric uncertainty ${\cal A}(x)$ in this setting is the entropy $H[P(Y|x)]$ of the ground truth conditional: \begin{align} {\cal A}(x) = - \int dP(y|x) \log P(y|x) = H[P(Y|x)], \end{align} \end{proposition} The proposition is shown from the cross-entropy $CE(P(Y|x)||Q(Y|x))$ being minimized when $Q=P$. \begin{proposition} For the NLL loss with ground truth $P(Y|x)$ and predictor $Q(Y|x)$, the epistemic uncertainty ${\cal E}(Q(Y|x),x)$ is the Kullback-Liebler divergence between $P$ and $Q$ (with $P$ as the reference): \begin{align} {\cal E}(Q(Y|\ . \ ),x) &= KL(P(Y|x)||Q(Y|x)) \nonumber \\ &= \int dP(y|x) \log \frac{P(y|x)}{Q(y|x)} \label{eq:KL} \end{align} \end{proposition} The proposition is shown by combining the above two propositions and the definition of epistemic uncertainty. To move towards the MSE loss, consider the special case of NLL with a conditionally Normal output density for both $P$ and $Q$. \begin{proposition} \label{nll_epistemic} For the NLL loss with a conditionally Normal output density for both $P$ and $Q$, with respective means $f^*(x)$ and $\hat{f}(x)$ and respective variances $\sigma^2_P(x)$ and $\sigma^2_Q(x)$, the epistemic uncertainty is \begin{align} {\cal E}(Q(Y|\ . \ ),x) = \frac{1}{2 \sigma^2_Q(x)} l_{MSE}(\hat{f}(x),f^*(x)) + KL(P(Y|x)||\tilde{Q}(Y|x)), \end{align} where $\tilde{Q}(\ . \ |x)$ is obtained by shifting $Q(\ . \ |x)$ towards $P(\ . \ |x)$ (i.e., $\tilde{Q}(\ . \ |x)$ is Gaussian with mean $f^*(x)$ and variance $\sigma^2_Q(x)$ ), and the Bayes-optimal mean predictor is \mbox{$f^*(x)=E_P[Y|x]$}. Note that if $\sigma_P=\sigma_Q$, then the KL term is zero. \end{proposition} The proof is presented in Appendix~\ref{appendix:proofs}. We can compare with the MSE loss (which assumes a constant variance $\sigma=\sigma_P=\sigma_Q$) and obtain the same result up to variance scaling. \section{Proofs} \label{appendix:proofs} \subsection{Proposition \ref{epistemic_mse}} It is a well known result that, because $f^*(x)$ is the mean of $P(.|x)$, it is also the minimizer of $\hat{y} \mapsto \int (\hat{y} - y)^2 dP(y|x)$. $f^*$ is thus a Bayes Optimal predictor. By definition of the total uncertainty: \begin{align*} {\cal U}(f, x) = \int (f(x) - y) ^ 2 dP(y | x) = E[(f(x) - Y)^2]. \end{align*} Hence, by definition of aleatoric uncertainty: \begin{align*} {\cal A}(x) = {\cal U}(f^*, x) = E[(f^*(x) - Y)^2]. \end{align*} and by definition of epistemic uncertainty \begin{align*} {\cal E}(f, x) &= E\left[(f(x) - y) ^ 2 - (f^*(x) - y) ^ 2\right] \\ &= f(x) ^ 2 - f^*(x)^2 - 2 (f(x) - f^*(x))f^*(x) \\ &= (f(x) - f^*(x))^2. \end{align*} Which concludes the proof. \subsection{Proposition \ref{nll_epistemic}} From Equation \ref{eq:KL}, we get: \begin{align*} {\cal E}(Q(Y|\ . \ ),x) &= KL(P(Y|x)||Q(Y|x)) \\ &= \log \frac{\sigma_Q(x)}{\sigma_P(x)} + \frac{\sigma_P^2(x) + (f(x) - f^*(x)) ^ 2}{2 \sigma^2_Q(x)} - \frac{1}{2} \\ &= \frac{1}{2 \sigma^2_Q(x)} l_{MSE}(f(x),f^*(x)) + \log \frac{\sigma_Q(x)}{\sigma_P(x)} + \frac{\sigma_P^2(x) + (f^*(x) - f^*(x)) ^ 2}{2 \sigma^2_Q(x)} - \frac{1}{2} \\ &= \frac{1}{2 \sigma^2_Q(x)} l_{MSE}(f(x),f^*(x)) + KL(P(Y|x)|\tilde{Q}(Y|x)) \end{align*} Which concludes the proof \section{Pseudo Code for the fixed training set setting} \label{appendix:pseudocodes} Algorithm \ref{pseudocode:deupfixed} illustrates the training procedure when a held-out validation set is available. We focus on $y \in \mathbb{R}$ in this paper because it makes sense for active learning applied to black-box optimization (where we want to maximize it) but the algorithms can trivially be applied to the case where $y \in \mathbb{R}^d$ for any $d$. Similarly, the algorithms can be generalized to other losses besides the square loss, following the generalized theory presented above in Appendix~\ref{appendix:theorygeneral}. \begin{algorithm}[ht] \textbf{Data: }$\mathcal{D}$ the training dataset with pairs $(x, y)$ with $x \in \cal X$, $y \in \mathbb{R}$; $\mathcal{D}_{out}$ the out-of-sample dataset with pairs $(x, y)$, to train the uncertainty estimator \\ $\mathcal{X}$, the input/search space\\ $a: {\cal X}\mapsto \mathbb{R}$, trained estimator of aleatoric uncertainty (\\ $f: {\cal X}\mapsto \mathbb{R}$, main predictor, trained on $\mathcal{D}$ \\ $u: {\cal X}\mapsto \mathbb{R}$, total uncertainty estimator (estimates error of $f$) \kwTraining{\\ Initialize empty dataset of errors $\mathcal{D}_u$ \\ \textbf{Optional: }Pre-fill $\mathcal{D}_u$ using Algorithm \ref{pseudocode:crossval} and fit $u$ on $\mathcal{D}_u$\\ $x_{acq} \leftarrow \emptyset, y_{acq} \leftarrow \emptyset$ \For{every pair $(x, y)$ in $\mathcal{D} \cup \mathcal{D}_{out}$} {$\mathcal{D}_u \leftarrow \mathcal{D}_u \cup \{(x, (y - f(x))^2)\}$} Fit $u$ on $\mathcal{D}_u$\\ } \textbf{Evaluation: }For every input $x$, return $u(x) - a(x)$ as an estimator of epistemic uncertainty at $x$ \caption{DEUP with a fixed training set: Training procedure to obtain estimates of epistemic uncertainty} \label{pseudocode:deupfixed} \end{algorithm} \section{Estimating Aleatoric Uncertainty with access to an oracle} \label{estimatealeatoric} In scenarios like active learning, one has access to an oracle from which we can obtain samples of $Y \sim P(Y|x)$ at any given point $x$. In that case, one can train an estimator $a(x)$ of aleatoric uncertainty by obtaining $K > 1$ samples $y_1, \dots y_K$ at the same $x$, for a set of representative $x$'s. More formally, if we have multiple independent outcomes $y_1, \dots, y_K \sim P(Y|x)$ for each input point $x$, then training a predictor $a$ with the squared loss on (input, target) examples $\left(x,\frac{K}{K - 1}\overline{Var}(y_1, \dots, y_K)\right)$, where $\overline{Var}$ denotes the empirical variance, yields an estimator of the aleatoric uncertainty. Naturally, this estimator is asymptotically unbiased, if the learning algorithm ensures asymptotic convergence to a Bayes-Optimal predictor. This is due to the fact that $E_{y_1, \dots, y_K} \left[\frac{K}{K - 1}\overline{Var}(y_1, \dots, y_K) \right] = Var_{P(y|x)} [y|x] $, which according to Proposition \ref{epistemic_mse} is equal to $\mathcal{A}(x)$. \section{Sequential Model Optimization Experiments}\label{appendix:SMO} We use BoTorch\footnote{\href{https://botorch.org/}{https://botorch.org/}}~\cite{balandat2020botorch} as the base framework for our experiments. For all our Sequential Optimization algorithms, we use Algorithm \ref{pseudocode:deupactive} to train DEUP uncertainty estimators. We found that the optional step of pre-filling the uncertainty estimator dataset $\mathcal{D}_e$ was important given the low number of available training points. We used half the initial training set (randomly chosen) as in-sample examples (used to train the main predictor and an extra-feature generator) and the other half as out-of-sample examples to provide instances of high epistemic uncertainty to train an uncertainty predictor; we repeated the procedure by alternating the roles of the two halves of the dataset. We repeated the whole procedure twice using a new random split of the dataset, thus ending up with $4$ training points in $\mathcal{D}_e$ for every initial training point in $\mathcal{D}_{init}$. The error predictor is trained with the $\log$ targets (i.e. log MSE between predicted and observed error). This helps since the scale of the errors varies over multiple orders of magnitude. Computationally, the training time of DEUP-EI depends on various choices (e.g. the features used to train the epistemic uncertainty predictor, the dimension of the input, the learning algorithms, etc..). Additionally, the training time for the uncertainty predictor varies at each step of the optimization. In total, the sequential optimization experiments took about 1 CPU day. \subsection{One-dimensional function toy example} \label{appendix:SMO1} In Figure \ref{multioptima_appendix}, we show the results of DEUP-EI, compared to GP-EI, MCDropout-EI and Ensembles-EI, in the task of optimizing a synthetic one-dimensional function. Because MCDropout and Ensembles are trained on in-sample data only, they are unable to generalize their uncertainty estimates, which makes them bad candidates for Sequential Model Optimization, because they are easily stuck in local minima, and require many iterations before the acquisition function gives more weight to the predicted uncertainties than the current maximum. For Random acquisition, we sampled for different seeds $56$ points, and used the (average across the seeds of the) maximum of the first $6$ values as the first value in the plots (Figures \ref{ackley} and \ref{multioptima_appendix}). Note that because the function is specifically designed to have multiple local maxima, GP-EI also required more optimization steps, and actually performed worse than random acquistion As a stationarizing input feature, we used the variance of a GP fit on the available data at every step. We found that the binary (in-sample/out-of-sample) feature and density estimates were redundant with the variance feature and didn't improve the performance as captured by the number of additional function calls. We used a GP for the DEUP uncertainty estimator. Using a neural net provided similar results, but was computationally more expensive in this 1-D case with few datapoints. We used a 3-hidden layer neural network, with 128 neurons per layer and a ReLU activation function, with Adam \cite{kingma2014adam} and a learning rate of $10^{-3}$ (and default values for the other hyperparameters) to train the main predictor for DEUP-EI (in order to fit the available data). The same network architecture and learning rate were used for the Dropout and Ensemble baselines. We used 3 networks for the Ensemble baseline, and a dropout probability of 0.3 for the Dropout baseline, with 100 test-time forward passes to compute uncertainty estimates. \begin{figure}[H] \begin{center} \vspace*{-5mm} \centerline{\includegraphics[width=1.2\columnwidth]{figs/multioptima_results_appendix.pdf}} \caption{{\em Left.} Synthetic function to optimize. {\em Right.} Maximum value reached by the different methods on the synthetic function. The shaded areas represent the standard error across 5 different runs, with different initial sets of 6 pairs. For clarity, the shaded areas are omitted for the two worst performing methods. In each run, all the methods start with the same initial set of 6 points. GP-EI tends to get stuck in local optima and requires more than 50 steps, on average, to reach the global maximum. } \vspace*{-5mm} \label{multioptima_appendix} \end{center} \end{figure} \subsection{Two-dimensional function} To showcase DEUP's usefulness for Sequential Model Optimization in with a number of dimensions greater than 1, we consider the optimization of the Levi N.13 function, a known benchmark for optimization. The function $f$ takes a point $(x, y)$ in 2D space and returns: \begin{align*} f(x, y) = - \left( \sin^2(3\pi x) + (x - 1)^2 (1 + \sin^2(3\pi y)) + (y-1)^2(1 + \sin^2(2\pi y))\right) \end{align*} We use the box $[-10, 10]^2$ as the optimization domain. In this domain, the maximum of the function is $0$, and it is reached at $(1, 1)$. The function has multiple local maxima, as shown in Figure \ref{fig:levi3d}\footnote{Plot of the function copied from \href{https://www.sfu.ca/~ssurjano/levy13.html}{https://www.sfu.ca/~ssurjano/levy13.html}}. Similar to the previous one-dimensional function, MCDropout and Ensemble provided bad performances and are omitted from the plot in \ref{fig:levi_results}. We used the same setting and hyperparameters for DEUP as for the previous function. DEUP-EI is again the only method that reaches the global maximum consistently in under $56$ function evaluations. \begin{figure}[H] \centering \subfigure[Visualization of $(x, y) \mapsto - f(x, y)$] {\includegraphics[width=0.42\textwidth]{figs/levifigure.png}\label{fig:levi3d}} \subfigure[Comparisons with GP-EI and Random acquisition] {\includegraphics[width=0.49\textwidth]{figs/levi_n13_results_appendix.pdf}\label{fig:levi_results} } \caption{Sequential Model Optimization on the Levi N.13 function} \end{figure} \subsection{Additional details for the Ackley function experiment, for synthetic data in higher dimensions} \label{appendix:SMO3} The Ackley function of dimension $d$ is defined as: \begin{align*} Ackley_d: {\mathcal{B}} & \rightarrow {\mathbb{R}} \\ x & \mapsto A \exp\left(-B \sqrt{\frac{1}{d} \sum_{i=1}^d x_i^2}\right) + \exp\left(\frac{1}{d} \sum_{i=1}^d cos(c x_i)\right) - A - \exp(1) \end{align*} where ${\mathcal{B}}$ is a hyperrectangle of ${\mathbb{R}}^d$. $(0, \dots, 0)$ is the only global optimizer of $Ackley_d$, at which the function is equal to $0$. We use BoTorch's default values for $A, B, c$, which are $20, 0.2, 2 \pi$ respectively. In our experiments, we used ${\mathcal{B}} = [-10, 15]^d$ for all dimensions $d$. For the TurBO baseline, we use BoTorch's default implementation, with Expected Improvement as an acquisition function, and a batch size of $1$ (i.e. acquiring one point per step). For fair comparisons, for DEUP, we use a Gaussian Process as the main model, and use its variance as the only input of the epistemic uncertainty predictor. This means that we calibrate the GP variance to match the out-of-sample squared error, using another GP to perform the regression. TurBO-DEUP is a combination of both, in which we perform the variance calibration task for the local GP models of TurBO. The uncertainty predictor, i.e. the GP regressor, is trained with $\log$ targets, as in Appendix~\ref{appendix:SMO1}, but also with $\log$ variances as inputs. Note that only the stationarizing feature is used as input for the uncertainty predictor. When we used the input $x$ as well, we found that the GP error predictor overfits on the $x$ part of the input $(x, v)$, and it was detrimental to the final performances. For all experiments, we used $20$ initial points. \section{Reinforcement Learning Experiments}\label{appendix:RL} For RL experiments, we used \textit{bsuite} \cite{osband2020bsuite}, a collection of carefully designed RL environments. \textit{bsuite} also comes with a list of metrics which aim to evaluate RL agents from different aspects. We compare the agents based on the \textit{basic} metric and average regret as they capture both sample complexity and final performance. The default DQN agent is used as the base of our experiments with a 3 layer fully-connected (FC) neural network as its Q-network. For the Bootstrapped DQN baseline, we used the default implementation provided by \textit{bsuite}. To implement DQN + MC-Dropout, following the implementation from \cite{gal2016dropout}, two dropout layers with dropout probability of 0.1 are used before the second and the third FC layers. In order take an action, the agent performs a single stochastic forward pass through the Q-network, which is equivalent to taking a sample from the posterior over the Q-values, as done in Thompson sampling, an alternative to $\epsilon-$greedy exploration. As a density estimator, we used a Kernel Density Estimator (KDE) with a Gaussian kernel and bandwidth of 1 to map states to densities. This KDE is fit after each 10000 steps (actions) with a batch of samples from the replay buffer (which is of size 10000). The uncertainty estimator network (E-network) has the same number of layers as the Q-network, with an additional Softplus layer at the end. All other hyperparameters are the same as the default implementation by \cite{osband2020bsuite}. One complete training run for the DEUP-DQN with 5 seeds experiments takes about 0.04-0.05 GPU days on a V100 GPU. In total RL experiments took about 0.15 GPU days on a Nvidia V100 GPU. \begin{algorithm}[H] Initialize replay buffer $\mathcal{D}$ with capacity $\mathcal{N}$ \\ $Q_\theta(s, a)$: state-action value predictor \\ $E_\phi(\log d)$: uncertainty estimator network, which takes the log-density of the states as the input \\ $d(s)$: Kernel density estimator (KDE)\\ K: KDE fitting frequency \\ W: Number of warm-up episodes \\ \For{episode=1 to $M$} { set $s_0$ as the initial state \\ \For{t=1 to \textit{max-steps-per-episode}} { \textbf{with probability $\epsilon$: } take a random action, \textbf{otherwise:} \\ \textbf{if} $episode \leq$ W: $a = max_{a} Q_\theta(s_t, a)$, \textbf{else:} $a = max_{a} \big[Q_\theta(s_t, a) + \kappa \times E_\phi(\log d(s_t))(a)\big]$ \\ store $(s_t, a_t, r_t, s_{t+1})$ in $\mathcal{D}$ \\ Sample random minibatch B of transitions $(s_j , a_j , r_j , s_{j+1})$ from $\mathcal{D}$ \\ \textbf{if} $s_j$ is a final state: $y_j = r_j$, \textbf{else: }$y_j = r_j + \gamma max_{a} Q(s_t, a)$ \\ \textbf{Update Q-network:} \\ $\theta \leftarrow \theta + \alpha_Q.\nabla_\theta \mathop{\mathbb{E}_{(s, a) \sim {B}}} \Big [\big(y_j - Q_\theta(s, a) \big)^2 \Big]$ \\ \textbf{Update E-network:} \\ $\phi \leftarrow \phi + \alpha_E.\nabla_\phi \mathop{\mathbb{E}_{(s, a) \sim {B}}} \Bigg[ \Big [\big(y_j - Q_\theta(s, a) \big)^2 - E_\phi(\log d(s_t))(a)\Big]^2 \Bigg]$ \\ \textbf{if} mod(\textit{total-steps}, K) = 0: fit the KDE $d$ on the states of $\mathcal{D}$ } } \caption{DEUP-DQN} \label{pseudocode:DEUP-DQN} \end{algorithm} \section{Rejecting Difficult Examples} \label{appendix:fixed_training_set} We adapt the standard OOD rejection task~\cite{Amersfoort2020SimpleAS, Liu2020SimpleAP} to measure the Spearman Rank Correlation of the predicted uncertainty with the true generalization error, in addition to the OOD Detection AUROC. We use MC-Dropout~\cite{gal2016dropout}, Deep Ensemble~\cite{lakshminarayanan2016simple}, DUE\cite{DBLP:journals/corr/abs-2102-11409} and DUQ~\cite{Amersfoort2020SimpleAS} as the baselines~\footnote{MC-Dropout and Deep Ensemble baselines are based on \href{https://github.com/google/uncertainty-baselines}{https://github.com/google/uncertainty-baselines}, DUQ based on \href{https://github.com/y0ast/deterministic-uncertainty-quantification}{https://github.com/y0ast/deterministic-uncertainty-quantification} and DUE based on \href{https://github.com/y0ast/DUE}{https://github.com/y0ast/DUE}}. We use these baselines as representatives for the major approaches for uncertainty estimation in recent literature. For all the methods, including DEUP we consider two architectures for the main predictor, ResNet-18 and ResNet-50~\cite{he2016deep} (Table~\ref{app:Resnet50}) to study the effect of model capacity. Note that for the ResNet50 DEUP model we continue using the ResNet-18 based DUE as variance source. \begin{table}[ht] \caption{Spearman Rank Correlation between predicted uncertainty and the true generalization error on OOD data (SVHN) with ResNet-50 models (3 seeds) trained on CIFAR-10.} \label{app:Resnet50} \begin{center} \begin{tabular}{ll} \hline \textbf{Model} & \textbf{ResNet-50} \\ \hline MC-Dropout & $0.312 \pm 0.003$ \\ Deep Ensemble & $0.401 \pm 0.004$ \\ DUQ & $0.399 \pm 0.003$ \\ DEUP (D+V) & $\bm{0.465 \pm 0.002}$ \\ \hline \end{tabular} \end{center} \end{table} \paragraph{Training} The baselines were trained with the CIFAR-10 training set with $10\%$ set aside as a validation set for hyperparameter tuning. The hyperparameters are presented in Table~\ref{dropouthyperparam} and Table~\ref{deuphyperparam}. The hyperparameters not specified are set to the default values. For DEUP, we consider the log-density, model-variance estimate and the seen-unseen bit as the features for the error predictor. The density estimator we use is Masked-Autoregressive Flows~\cite{papamakarios2017masked} and the variance estimator used is DUE~\cite{DBLP:journals/corr/abs-2102-11409}. Note that as indicated earlier $x$, the input image, is not used as a feature for the error predictor. We present those ablations in the next sub-section. For training DEUP, the CIFAR-10 training set is divided into 5 folds, with each fold containing 8 unique classes. For each fold, we train an instance of the main predictor, density estimator and model variance estimator on only the corresponding 8 classes. The remaining 2 classes act as the out-of-distribution examples for training the error predictor. Using these folds we construct a dataset for training the error predictor, a simple feed forward network. The error predictor is trained with the $\log$ targets (i.e. log MSE between predicted and observed error). This helps since the scale of the errors varies over multiple orders of magnitude. We then train the main predictor, density estimator and the variance estimator on the entire CIFAR-10 dataset, for evaluation. The hyperparameters are presented in Table~\ref{deuphyperparam}. For all models, we train the main predictor for $75$ and $125$ epochs for ResNet-18 and ResNet-50 respectively. We use SGD with Momentum (set to $0.9$), with a multi-step learning schedule with a decay of $0.2$ at epochs $[25, 50]$ and $[45, 90]$ for ResNet-18 and ResNet-50 respectively. One complete training run for DEUP takes about 1.5-2 GPU days on a V100 GPU. In total these set of experiments took about 31 GPU days on a Nvidia V100 GPU. \begin{table}[ht] \caption{\textbf{Left}: Hyperparameters for training Deep Ensemble~\cite{lakshminarayanan2016simple}. \textbf{Right}: Hyperparameters for training MC-Dropout~\cite{gal2016dropout}.} \label{dropouthyperparam} \begin{center} \resizebox{0.4\linewidth}{!}{ \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Parameters}} & \multicolumn{2}{c}{\textbf{Model}} \\ \cline{2-3} & \textbf{ResNet-18} & \textbf{ResNet-50} \\ \hline Number of members & 5 & 5 \\ Learning Rate & 0.05 & 0.01 \\\hline \end{tabular} } \quad \resizebox{0.4\linewidth}{!}{ \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Parameters}} & \multicolumn{2}{c}{\textbf{Model}} \\ \cline{2-3} & \textbf{ResNet-18} & \textbf{ResNet-50} \\ \hline Number of samples & 50 & 50 \\ Dropout Rate & 0.15 & 0.1 \\ L2 Regularization Coefficient & 6e-5 & 8e-4 \\ Learning Rate & 0.05 & 0.01 \\\hline \end{tabular} } \end{center} \end{table} \begin{table}[ht] \caption{\textbf{Left}: Hyperparameters for training DUQ~\cite{Amersfoort2020SimpleAS}. \textbf{Right}: Hyperparameters for training DUE~\cite{DBLP:journals/corr/abs-2102-11409}.} \label{deuphyperparam} \begin{center} \resizebox{0.4\linewidth}{!}{ \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Parameters}} & \multicolumn{2}{c}{\textbf{Model}} \\ \cline{2-3} & \textbf{ResNet-18} & \textbf{ResNet-50} \\ \hline Gradient Penalty & 0.5 & 0.65 \\ Centroid Size & 512 & 512 \\ Length scale & 0.1 & 0.2 \\ Learning Rate & 0.05 & 0.025 \\\hline \end{tabular} } \quad \resizebox{0.3\linewidth}{!}{ \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Parameters}} & \multicolumn{2}{c}{\textbf{Model}} \\ \cline{2-3} & \textbf{ResNet-18} \\ \hline Inducing Points & 50 \\ Kernel & RBF \\ Lipschitz Coefficient & 2 \\ BatchNorm Momentum & 0.99\\ Learning Rate & 0.05\\ Weight Decay & 0.0005\\\hline \end{tabular} } \end{center} \end{table} \begin{table} \caption{Hyperparameters for training DEUP.} \begin{center} \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Parameters}} & \multicolumn{2}{c}{\textbf{Model}} \\ \cline{2-3} & \textbf{ResNet-18} & \textbf{ResNet-50} \\ \hline Uncertainty Predictor Architecture & {[}1024{]} x 5 & {[}1024{]} x 5 \\ Uncertainty Predictor Epochs & 100 & 100 \\ Uncertainty Predictor LR & 0.01 & 0.01 \\ Main Predictor Learning Rate & 0.05 & 0.01 \\ \hline \end{tabular} \end{center} \end{table} \paragraph{Ablations} We also perform some ablation experiments to study the effect of each feature for the error predictor. The Spearman rank correlation coefficient between the generalization error and the variance feature, $V$, from DUE~\cite{DBLP:journals/corr/abs-2102-11409} alone is 37.84 $\pm$ 0.04, and the log-density, $D$, from MAF~\cite{papamakarios2017masked} alone is 30.52 $\pm$ 0.03. With only the image ($x$) the SRCC is $36.58 \pm 0.16$ Table~\ref{cifarablation} presents the results for these experiments. We observe that combining all the features performs the best. Also note that using the log-density and variance as features to the error predictor we observe better performance than using them directly, indicating that the error predictor perhaps captures a better target for the epistemic uncertainty. The boolean feature ($B$) indicating seen examples, discussed in Section~\ref{sec:interactive}, also leads to noticeable improvments. \begin{table}[ht] \caption{Spearman Rank Correlation between predicted uncertainty and the true generalization error on OOD data (SVHN) with variants of DEUP with different features as input for the uncertainty predictor. $D$ indicates the log-density from MAF~\cite{papamakarios2017masked}, $V$ indicates variance from DUQ~\cite{Amersfoort2020SimpleAS} and $B$ indicates a bit indicating if the data is seen. } \label{cifarablation} \begin{center} \begin{tabular}{lcc} \hline \multirow{2}{*}{\textbf{Features}} & \multicolumn{2}{c}{\textbf{Model}} \\ \cline{2-3} & \textbf{ResNet-18} & \textbf{ResNet-50} \\ \hline $D$+$V$+$B$ & \textbf{0.426 $\pm$ 0.009} & \textbf{0.465 $\pm$ 0.002} \\ $D$+$V$ & 0.419 $\pm$ 0.003 & 0.447 $\pm$ 0.003 \\ $V$+$B$ & 0.401 $\pm$ 0.004 & 0.419 $\pm$ 0.004 \\ $D$+$B$ & 0.403 $\pm$ 0.003 & 0.421 $\pm$ 0.002 \\ \hline \end{tabular} \end{center} \end{table} \subsection{Predicting Uncertainty under Distribution Shift} We also consider the task of uncertainty estimation in the setting of shifted distributions \cite{ovadia2019can, hendrycks2019robustness}. We evaluate the uncertainty predictions of models trained with CIFAR-10, on CIFAR-10-C \cite{hendrycks2019robustness} which consists of images from CIFAR-10 distorted using 16 corruptions like gassian blur, impulse noise, among others. Figure~\ref{fig:shifted} shows that even in the shifted distribution setting, the uncertainty estimates of DEUP correlate much better with the error made by the predictor, compared to the baselines. \begin{figure}[h] \begin{center} \centerline{\includegraphics[width=0.6\columnwidth]{figs/cifar10c_eval.pdf}} \caption{Spearman Rank Correlation Coefficient between the predicted uncertainty and true error for models trained with CIFAR-10, and evaluated on CIFAR-10-C. DEUP outperforms the baselines on all types of corruptions.} \label{fig:shifted} \end{center} \end{figure} \section{Drug Combination Experiments}\label{appendix:dgc} To validate DEUP's uncertainty estimates in a real-world setting, we measured its performance on a regression task predicting the synergy of drug combinations. While much effort in drug discovery is spent on finding novel small molecules, a potentially cheaper method is identifying combinations of pre-existing drugs which are synergistic (i.e., work well together). Indeed, drug combinations are the current standard-of-care for a number of diseases including HIV, tuberculosis, and some cancers~\cite{cihlar2016current, world2010treatment, mokhtari2017combination}. However, due to the combinatorial nature of drug combinations, identifying pairs exhibiting synergism is challenging. Compounding this problem is the high monetary cost of running experiments on promising drug combinations, as well as the length of time the experiments take to complete. Uncertainty models could be used by practitioners downstream to help accelerate drug combination treatment discoveries and reduce involved development costs. To test DEUP's performance on this task we used the DrugComb and LINCS L1000 datasets~\cite{zagidullin2019drugcomb, subramanian2017next}. DrugComb is a dataset consisting of pairwise combinations of anti-cancer compounds tested on various cancer cell lines. For each combination, the dataset provides access to several synergy scores, each indicating whether the two drugs have a synergistic or antagonistic effect on cancerous cell death. LINCS L1000 contains differential gene expression profiles for various cell lines and drugs. Differential gene expressions measure the difference in the amount of mRNA related to a set of influential genes before and after the application of a drug. Because of this, gene expressions are a powerful indicator of the effect of a single drug at the cellular level. In our experiments, each drug is represented by its Morgan fingerprint~\cite{morgan1965generation}\footnote{The Morgan fingerprint represents a molecule by associating with it a boolean vector specifying its chemical structure. Morgan fingerprints have been used as a signal of various molecular characteristics to great success~\cite{ballester2010machine, zhang2006novel}.} (with 1,024 bits and a radius of 3) as well as two differential gene expression profiles (each of dimension 978) from two cell lines (PC-3 and MCF-7). In order to use gene expression features for every drug, we only used drug pairs in DrugComb where both drugs had differential gene expression data for cell lines PC-3 and MCF-7. We first compared the quality of DEUP's uncertainty estimations to other uncertainty estimation methods on the task of predicting the combination sensitivity score~\cite{malyutina2019drug} for drug pairs tested on the cell line PC-3 (1,385 examples). We evaluated the uncertainty methods using a train, validation, test split of $40\%$, $30\%$, and $30\%$, respectively. The underlying model used by each uncertainty estimation method consisted of a \textit{single drug} fully connected neural network (2 layers with 2048 hidden units and output of dimension 1024) and a \textit{combined drug} fully connected neural network (2 layers, with 128 hidden units). The embeddings of an input drug pair's drugs produced by the \textit{single drug} network are summed and passed to the \textit{combined drug} network, which then predicts final synergy. By summing the embeddings produced by the \textit{single drug} network, we ensure that the model is invariant to permutations in order of the two drugs in the pair. The models were trained with Adam~\cite{kingma2014adam}, using a learning rate of $1\text{e-}4$ and weight decay of $1\text{e-}5$. For MC-Dropout we used a dropout probability of $0.1$ on the two layers of the \textit{combined drug} network and 3 test-time forward passes to compute uncertainty estimates. The ensemble used 3 constituent models for its uncertainty estimates. Both Ensemble and MC-Dropout models were trained with the \textit{MSE} loss. We also compared against DUE \cite{DBLP:journals/corr/abs-2102-11409} which combines a neural network feature extractor with an approximate Gaussian process. Spectral normalization was added to all the layers of the \textit{combined drug} network and of the \textit{single drug} network. Let $d_{\text{emb}}$ denote the dimension of the output of the \textit{combined drug} network, which is also the input dimension of the approximate Gaussian process. We conducted a grid-search over different values of $d_{\text{emb}}$ (from 2 to 100), the number of \textit{inducing points} (from 3 to 200), the learning rate, and the kernel used by the Gaussian process. The highest correlation of uncertainty estimates with residuals was attained with $d_{\text{emb}} = 10$, 100 \textit{inducing points}, a learning rate of $1\text{e-}2$, and the \textit{Matern12} kernel. \begin{algorithm}[H] \KwData{$\mathcal{D}$ dataset of pairwise drug combinations, along with synergy scores $((d_1, d_2), y)$} \kwInit{ \\ Split training set into two halves, \textit{in-sample} $\mathcal{D}_{in}$ and \textit{out-of-sample} $\mathcal{D}_{out}$ \\ $f_{\mu}(d_1, d_2)$: $\hat{\mu}$ predictor which takes a pair of drugs as input \\ $f_{\sigma}^{in}(d_1, d_2)$: In-sample $\hat{\sigma}_{in}$ error predictor\\ $f_{\sigma}^{out}(d_1, d_2)$: Out-of-sample $\hat{\sigma}_{out}$ error predictor} \kwTraining{\\ \While{training not finished}{ \textit{In-sample update} \\ Get an \textit{in-sample} batch $(d_{1, in}, d_{2, in}, y_{in}) \sim \mathcal{D}_{in}$ \\ Predict $\hat{\mu}= f_{\mu}(d_{1, in}, d_{2, in})$ and \textit{in-sample} error $\hat{\sigma}_{in}= f_{\sigma}^{in}(d_{1, in}, d_{2, in})$ \\ Compute \textit{NLL}: $\frac{\log(\hat{\sigma}_{in}^2)}{2} + \frac{(\hat{\mu} - y_{in})^2}{2\hat{\sigma}_{in}^2}$ \\ Backpropagate through $f_{\mu}$ and $f_{\sigma}^{in}$ and update.\\ \textit{Out-of-sample update} \\ Get an \textit{out-of-sample} batch $(d_{1, out}, d_{2, out}, y_{out}) \sim \mathcal{D}_{out}$ \\ Estimate $\hat{\mu}= f_{\mu}(d_{1, out}, d_{2, out})$ and \textit{out-of-sample} error $\hat{\sigma}_{out}= f_{\sigma}^{out}(d_{1, out}, d_{2, out})$ \\ Compute \textit{NLL}: $\frac{\log(\hat{\sigma}_{out}^2)}{2} + \frac{(\hat{\mu} - y_{out})^2}{2\hat{\sigma}_{out}^2}$ \\ Backpropagate through $f_{\sigma}^{out}$ and update. }} \caption{DEUP for Drug Combinations} \label{pseudocode:DrugComb} \end{algorithm} The DEUP model we used outputs two heads $\bigl[\begin{smallmatrix} \hat{\mu} \\ \hat{\sigma} \end{smallmatrix}\bigr]$ and is trained with the \textit{NLL} $\frac{\log(\hat{\sigma}^2)}{2} + \frac{(\hat{\mu} - y)^2}{2\hat{\sigma}^2}$ in a similar fashion as in~\cite{lakshminarayanan2016simple}. To obtain a predictor of the out-of-sample error, we altered our optimization procedure so that the $\mu$ and $\sigma$ heads were not backpropagated through at all times. Specifically, we first split the training set into two halves, terming the former the in-sample set $\mathcal{D}_{in}$ and the latter the out-of-sample set $\mathcal{D}_{out}$. We denote as $f_{\sigma}^{in}$ the in-sample error predictor and $f_{\sigma}^{out}$ the out-of-sample error predictor. $f_{\sigma}^{out}$ is used to estimate total uncertainty. Note that in this setting, $f_{\sigma}^{out}$ predicts the square root of the epistemic uncertainty ($\hat{\sigma}_{out}$) rather than the epistemic uncertainty itself ($\hat{\sigma}_{out}^2$). In our experiments, an extra bit is added as input to the model in order to indicate whether a given batch is from $\mathcal{D}_{in}$ or $\mathcal{D}_{out}$. Through this, the same model is used to estimate $f_{\sigma}^{in}$ and $f_{\sigma}^{out}$ with the model estimating $f_{\sigma}^{in}$ when the bit indicates an example is drawn from $\mathcal{D}_{in}$ and $f_{\sigma}^{out}$ otherwise. When the batch is drawn from $\mathcal{D}_{in}$, both heads are trained using NLL using a single forward pass. However, when the data is drawn from $\mathcal{D}_{out}$ only the $\hat{\sigma}$ head is trained. To do this, we must still predict $\hat{\mu}$ in order to compute the NLL. But the $\hat{\mu}$ predictor $f_\mu$ must be agnostic to the difference between $\mathcal{D}_{in}$ and $\mathcal{D}_{out}$. To solve this, we perform two separate forward passes. The first pass computes $\hat{\mu}$ and sets the indicator bit to 0 so $f_\mu$ has no notion of $\mathcal{D}_{out}$, while the second pass computes $\hat{\sigma}$, setting the bit to 1 to indicate the true source of the batch. Finally, we backpropagate through the $\hat{\sigma}$ head only. The training procedure is described in Algorithm \ref{pseudocode:DrugComb} We report several measures for the quality of uncertainty predictions on a separate test set in Table \ref{fig:drugcomb_1_app}. \begin{table}[ht] \centering \vcenteredhbox{\resizebox{\textwidth}{!}{ \begin{tabular}{lllllll} \hline \textbf{Model} & \textbf{Corr. w. res.} & \textbf{U. Bound} & \textbf{Ratio} & \textbf{Log Likelihood} & \textbf{Coverage Probability} & \textbf{CI width}\\ \hline MC-Dropout & $0.14 \pm 0.07$ & $0.56 \pm 0.05$ & $0.25 \pm 0.12$ & $ -20.1 \pm 6.8 $ & $11.4\pm 0.2$ & $3.1\pm0.1$ \\ Deep Ensemble & $0.30 \pm 0.09$ & $0.59 \pm 0.04$ & $0.50 \pm 0.13$ & $ -14.3 \pm 4.7 $ & $10.8\pm 1.4$ & $3.4\pm 0.6$ \\ DUE & $0.12 \pm 0.12$ & $0.15 \pm 0.03$ & $\bm{0.80 \pm 0.79}$ & $-13.0 \pm 0.52$ & $15.2\pm 1.0$ & $3.5\pm 0.1$ \\ DEUP & $\bm{0.47 \pm 0.03}$ & $0.63 \pm 0.05$ & $\bm{0.75 \pm 0.07}$ & $\bm{-3.5 \pm 0.25}$ & $\bm{36.1\pm 2.5}$ & $\bm{13.1\pm 0.9}$\\\hline \end{tabular} \label{tab:table_drugcomb_uncertainty_analysis} } } \caption{Drug combinations: quality of uncertainty estimates from different methods. \textit{Corr. w. res.} shows correlation between model residuals and predicted uncertainties $\hat{\sigma}$. A best-case \textit{Upper Bound} on \textit{Corr. w. res.} is obtained from the correlation between $\hat{\sigma}$ and true samples from $\mathcal{N}(0, \hat{\sigma})$. \textit{Ratio} is the ratio between col. 1 and 2 (larger is better). \textit{Log-likelihood}: average over 3 seeds of per sample predictive log-likelihood. \textit{Coverage Probability}: Percentage of test samples which are covered by the 68\% confidence interval. \textit{CI width}: width of the 86\% confidence interval.} \label{fig:drugcomb_1_app} \end{table} For each model, we report the per sample predictive log-likelihood, coverage probability and confidence interval width, averaged over 3 seeds. We also computed the correlation between the residuals of the model $|\hat{\mu}(x_i) - y_i|$ and the predicted uncertainties $\hat{\sigma}(x_i)$. We noted that the different uncertainty estimation methods lead to different distributions $p(\hat{\sigma}(x))$. For example, predicted uncertainties obtained with DUE always have a similar magnitude. By contrast, DEUP yields a wide range of different predicted uncertainties. These differences between the distributions $p(\hat{\sigma}(x))$ obtained with the different methods may have an impact on the correlation metric, possibly biasing the comparison of the different methods. In order to account for differences in the distribution $p(\hat{\sigma}(x))$ across methods, we report another metric which is the ratio between the observed correlation $Corr(|\hat{\mu}(x) - y|, \hat{\sigma}(x))$ and the maximum achievable correlation given a specific distribution $p(\hat{\sigma}(x))$. This maximum achievable correlation (refered to as the \textit{upper bound}) is not \textit{per se} a comparison metric, and is estimated (given a specific $p(\hat{\sigma}(x))$) as follows: we assume that, for each example $(x_i, y_i)$, the predictive distribution of the model $\mathcal{N}(\hat{\mu}(x_i), \hat{\sigma}(x_i))$ corresponds exactly to the distribution of the target, \textit{i.e.} $y_i \sim \mathcal{N}(\hat{\mu}(x_i), \hat{\sigma}(x_i))$. Under this assumption, the residual of the mean predictor follows a distribution $\mathcal{N}(0, \hat{\sigma}(x_i))$. We can then estimate the upper bound by computing the correlation between the predicted uncertainties $\hat{\sigma}(x_i)$ and samples from the corresponding Gaussians $\mathcal{N}(0, \hat{\sigma}(x_i))$. 5 samples were drawn from each Gaussian for our evaluation. This upper bound is reported in the Table. Finally, we reported our comparison metric: the ratio between the correlation $Corr(|\hat{\mu}(x) - y|, \hat{\sigma}(x))$ and the upper bound. The higher the ratio is, the closer the observed correlation is to the estimated upper bound and the better the method is doing. It is interesting to note that the upper bound is much lower for DUE compared to other methods, as its predicted uncertainties lie within a short range of values. Predicted $\hat{\mu}$ and uncertainty estimates can be visualized in Figure \ref{fig:drugcomb_1} for different models. MC-dropout, Ensemble and DUE consistently underestimate uncertainty, while the out-of-sample uncertainties predicted by DEUP are much more consistent with the order of magnitude of the residuals. Moreover, we observed that DUE predicted very similar uncertainties for all samples, resulting in a lower upper-bound for the correlation between residuals and predicted uncertainties compared to other methods. We observed a similar pattern when experimenting with the other kernels available in the DUE package, including the standard Gaussian kernel. Finally, we note that in the context of drug combination experiments, aleatoric uncertainty could be estimated by having access to replicates of a given experiment (\textit{c.f.} Section \ref{estimatealeatoric}), allowing us to subtract the aleatoric part from the out-of-sample uncertainty, leaving us with the epistemic uncertainty only. \begin{figure}[H] \centering \subfigure[MC-dropout] {\includegraphics[width=0.24\textwidth]{figs/DrugComb_Mcdrop_seed_1.png}}\label{fig:drugcomb_1a} \subfigure[Ensemble]{\includegraphics[width=0.24\textwidth]{figs/DrugComb_Ens_seed_1.png}}\label{fig:drugcomb_1b_appendix} \subfigure[DUE] {\includegraphics[width=0.24\textwidth]{figs/DrugComb_DUE_seed_1.png}}\label{fig:drugcomb_1_due_appendix} \subfigure[DEUP] {\includegraphics[width=0.24\textwidth]{figs/DrugComb_DEUP_seed_1.png}}\label{fig:drugcomb_1c_appendix} \caption{Predicted mean and uncertainty for different models on a separate test set. 50 examples from the test set are ordered by increasing value of true synergy score (orange). Model predictions and uncertainties are visualized in blue. MC-Dropout, Ensemble and DUE consistently underestimate the uncertainty while DEUP seems to capture the right order of magnitude. Figures made using The Uncertainty Toolbox \cite{chung2020beyond}.} \label{fig:drugcomb_1} \end{figure} One complete training run for the drug combination experiments takes about 0.01 GPU days on a V100 GPU. In total these set of experiments took about 0.2 GPU days on a Nvidia V100 GPU. \section{Aleatoric and Epistemic Uncertainty} \label{sec:theoryL2} Consider a supervised learning algorithm (or learner) $\cal L$ mapping a dataset ${\cal D}$ to a predictive function $\hat{f}={\cal L}({\cal D})$. $\cal L$ tries to minimize the expected value of a supervised learning loss $l(\hat{f}(x),y) \in \mathbb{R}$ under unknown probability measure $P(Y|x)$. In this section, we focus on regression tasks with the squared loss $l(\hat{y}, y) = (\hat{y} - y)^2$, with $y \in {\mathbb{R}}$. In Appendix~\ref{appendix:theorygeneral}, we provide the corresponding results for a general loss function, with discrete or continuous outputs. \begin{definition} The {\bf expected loss} of a predictor $\hat{f}$ at $x$ is defined as: \begin{align}\label{eq:totaluncertainty} {\cal U}(\hat{f},x) = \int (\hat{f}(x) - y)^2 dP(y|x). \end{align} \vspace*{-5.5mm} \label{def:u} \end{definition} The expected loss is an unknown scalar, as we generally do not have access to the true data distribution $P(Y|x)$. The errors made by any predictor $\hat{f}$ at $x$ are due to both the inherent randomness of $P(Y|x)$ (aleatoric uncertainty) and the lack of knowledge of the predictor that can be tackled by acquiring more information around $x$ (epistemic uncertainty). Because of this natural decomposition of the expected loss, we will also refer to it as {\bf total uncertainty}, and we will use the two terms interchangeably. Bayes-optimal predictors $f^*$ satisfy the following equation at every $x$: \begin{align*} \forall \Tilde{y} \in {\mathbb{R}} \quad \int (f^*(x) - y)^2 dP(y|x) \leq \int (\Tilde{y} - y)^2 dP(y|x). \end{align*} They depend on the underlying data distribution only and not on learner $\cal L$ or trained predictor $\hat{f}$. Additionally, for any $x$, all Bayes-optimal predictors have the same total uncertainty at that $x$. The error made by a Bayes-optimal predictor is irreducible and we define it as the aleatoric uncertainty: \begin{definition} \label{def:a} The {\bf aleatoric uncertainty} at $x$ is the total uncertainty of any Bayes-optimal predictor $f^*$ at $x$: \begin{align} {\cal A}(x) = {\cal U}(f^*,x). \end{align} and we note that by definition ${\cal A}(x) \leq {\cal U}(f,x),\; \forall f \; \forall x$. \end{definition} $ \ $ \\ We now define the epistemic uncertainty of a predictor $\hat{f}$ as the gap between the error of $\hat{f}$ at $x$ and the lowest possible error at $x$, i.e., the reducible part of the loss, given more knowledge. \begin{definition} \label{def:e} The {\bf epistemic uncertainty} ${\cal E}(\hat{f},x)$ of a predictor $\hat{f}$ at $x$ is given by \begin{align} \label{eq:epistemic} {\cal E}(\hat{f},x) = {\cal U}(\hat{f},x) - {\cal A}(x) = {\cal U}(\hat{f},x) - {\cal U}(f^*,x). \end{align} \end{definition} Using these definitions, we can present our main result for the regression setting. \begin{proposition} \label{epistemic_mse} In a regression task with Gaussian ground truth $P(y|x) = {\mathcal{N}}(y; \ f^*(x), \ \sigma^2(x))$, \begin{align*} &{\cal E}(\hat{f},x) = (\hat{f}(x) - f^*(x))^2 \\ &{\cal U}(\hat{f},x) = \mathbb{E}_{P(y|x)}[(\hat{f}(x) - y)^2] = (\hat{f}(x) - f^*(x))^2 + \sigma^2(x) \\ &{\cal A}(x) = \mathbb{E}_{P(y|x)}[(f^*(x) - y)^2] = \sigma^2(x) \end{align*} \end{proposition} The proof is provided in Appendix~\ref{appendix:proofs}. \begin{wrapfigure}{l}{0.5\textwidth} \vspace*{-4mm} \begin{center} \centerline{\resizebox{4.5cm}{!}{\input{figs/bias_variance_bis}}} \caption{\sl Illustrating noise and bias. Observed $y$ is independent noise plus true $\mathbb{E}[Y|x]=f^*(x)$, itself best approximated by unknown $\tilde{f}(x)$ in parametric set $S$ (orange), e.g., using Bayesian posterior distribution $p(f|\mathcal{D})$ (grey) over parameters. $\tilde{f}$ is the closest function in $S$ to $f^*$, leading to a bias $b(x) = f^*(x) - \tilde{f}(x)$. $\varepsilon(\hat{f})(x)=f^*(x)-\hat{f}(x)$ is the reducible error of the main predictor $\hat{f}$ (e.g. posterior mean), whose square corresponds to EU or lack of knowledge, that DEUP aims at estimating. With $\tilde{f}$ the unknown ideal predictor and $\hat{f}$ the actual (e.g. mean) predictor, the square of $\Delta f(x) = \tilde{f}(x) - \hat{f}(x)$ induces variance in the posterior. $\varepsilon(\hat{f})(x) = b(x) + \Delta f(x)$ indicates that using the variance as a proxy for EU misses out a non-negligible quantity: the bias $b(x)$. } \label{fig:bias-variance-error} \end{center} \vspace*{-6mm} \end{wrapfigure} \textbf{Relation to existing notions of EU:} Consider a parametric model $p(Y|x, \theta)$ and a learner maintaining a distribution over parameters $\theta \in \Theta$, each corresponding to a predictor $f$ in a parametric set of functions $S$, possibly starting from a prior $p(\theta)$ that would lead to a posterior distribution $p(\theta| \mathcal{D})$. Clearly, the fact that multiple $\theta$'s and corresponding values of $f$ are compatible with the data and the prior indicates lack of knowledge. Because the lack of knowledge indicates where an interactive learner should acquire more information, this justifies the usage of dispersion measures, such as the variance or the entropy of the posterior predictive, as proxies for EU. However, the limited capacity of $S$ or the prior $p(\theta)$ may keep the optimal $\tilde{f}$ in $S$ at a distance from the Bayes-optimal predictor $f^*$. We can refer to these self-imposed constraints as a form of bias, in the sense that the learner is usually biased towards the prior preferences, e.g., towards smoother predictors (typically more so when the dataset is smaller). This arises when training neural networks with limited data, where the network may not use all of its capacity due to implicit (and not fully understood) regularization properties of SGD~\cite{Kale2021SGDTR}, explicit regularization, early stopping or a combination of these, which can induce a preference on the functions it learns. In Fig.~\ref{fig:bias-variance-error}, we illustrate this gap with the bias function $b(x) = f^*(x) - \tilde{f}(x)$. Because of this bias, model variance cannot be an accurate measure of EU $\mathcal{E}(\hat{f}, x)$ in the general case. In Deep Ensembles \cite{lakshminarayanan2016simple}, for example, if all the networks in the ensemble tend to fail in systematic (i.e. potentially reducible) ways, this aspect of prediction failure will not be captured by variance. Whereas Deep Ensembles variance provides us uncertainty regarding which of the networks we could draw is best, this does not tell us how poor that network is even in a noise-free setting. On the other hand, with flexible models like neural networks, adding examples around $x$ where $b(x)^2$ is large may allow to increase capacity around $x$ and reduce $b(x)^2$. \section{Direct Epistemic Uncertainty Prediction} \label{sec:DEUPcore} DEUP (Direct Epistemic Uncertainty Prediction) {\bf uses observed out-of-sample errors in order to train an error predictor which can be used to estimate epistemic uncertainty} elsewhere, as suggested directly by Def.~\ref{def:u}-\ref{def:e}. These may be in-distribution or out-of-distribution errors, depending on what we care about and the kind of data that is available. In Algo.~\ref{pseudocode:deupactive}, we provide the pseudo-code for DEUP in interactive settings. The pseudo-code for the simpler version with a fixed training set is given in Appendix~\ref{appendix:pseudocodes}. We consider three separate cases for the aleatoric uncertainty: \vspace{-2mm} \begin{enumerate}[leftmargin=*,topsep=0pt,parsep=0pt,itemsep=1mm] \item If we know that ${\cal A}(x)=0$ then $u(x)$ is an estimate of ${\cal E}(\hat{f},x)$ as well as of ${\cal U}(\hat{f},x)$. In this case, we choose $a$ to be the zero function in Algo.~\ref{pseudocode:deupactive}.Example: Sec.~\ref{smosection}. Also, in cases where it is not possible to estimate the aleatoric uncertainty, we can rely on the total uncertainty estimates as a proxy for EU. Example: Sec.~\ref{exp:ue}. \item If an estimator $x\rightarrow a(x)$ of aleatoric uncertainty is available, then $u(x)-a(x)$ becomes an estimate of the epistemic uncertainty of $\hat{f}$ at $x$. As an example for this scenario, consider an active learning setting, where the evaluation of a new candidate requires wet lab experiments, where we know the margins of errors of the instruments used. \item When we have access to an oracle that samples $Y$ given query $x$ from the environment $P(Y|x)$ (e.g., in active learning or SMO), then ${\cal A}(x)$ can be estimated using the empirical variance of different outcomes of the oracle at the same input $x$; see Appendix~\ref{estimatealeatoric}. It is common practice to perform replicate experiments in biological assays~\cite{lee2000importance, schurch2016many}. Variation across replicates, for a given input x, provides information about the amount of noise associated with x, i.e. the magnitude of the aleatoric uncertainty ${\cal A}(x)$. \end{enumerate} \subsection{Fixed Training Set} \label{fixedtrainingset} Consider the scenario with a fixed training set $\mathcal{D}=\{(x_i, y_i)\}_{i=1}^{N_{train}}$, where $x_i \sim P(X)$ and $y_i \sim P(Y|X=x_i) = \mathcal{N}(Y; f^*(x), \sigma^2(x))$. The goal is to obtain an estimator of the total uncertainty $\mathcal{U}(\hat{f}, .)$ for $\hat{f} = \mathcal{L}(\mathcal{D})$, that can be readily applied for input points $x$ sampled from the same distribution $P(X)$. According to Prop.\ref{epistemic_mse}, we can train a secondary predictor $u$ on (input, target) pairs $(x, e)$, where $e=(y - \hat{f}(x))^2$ in order to obtain such an estimator. To see this, note that at the limit of infinite data, if the learning algorithm ensures asymptotic convergence to a Bayes-optimal predictor (such as $k-$nearest neighbors with $k$ increasing at a proper rate, or neural networks whose size and regularization are hyperparameters optimized on a growing validation set), the resulting estimates $u(x)$ converge to $\mathbb{E}_{y \sim P(y | x)} [ (\hat{f}(x) - y)^2] = \mathcal{U}(\hat{f}, x)$. These (input, target) pairs can be obtained from a hold-out dataset $\mathcal{D}^{OOS}=\{(x_i, y_i)\}_{i=N_{train}+1}^{N_{train} + N_{OOS}}$, sampled from the same distribution as $\mathcal{D}$. \vspace*{-2mm} \subsection{Interactive Settings} \label{sec:interactive} \vspace*{-2.5mm} \begin{wrapfigure}{r}{0.55\textwidth} \vspace*{-13mm} \begin{center} \begin{minipage}{0.55\textwidth} \begin{algorithm}[H] \textbf{Data: }$\mathcal{D}_{init}$ initial dataset with pairs $(x, y) \in {\cal X} \times \mathbb{R}$\\ $a: {\cal X}\mapsto \mathbb{R}$, estimator of aleatoric uncertainty \\ $\hat{f}: {\cal X}\mapsto \mathbb{R}$, main predictor (of $y$ given $x$) \\ $u: {\cal X}\mapsto \mathbb{R}$, total uncertainty estimator \\ $\phi: {\cal X}\mapsto \mathbb{R}^k$, chosen stationarizing features \\ $\pi$: acquisition machinery that proposes new input points from $\cal X$, using the current $\hat{f}$ and EU estimates. $\mathcal{D}_u \leftarrow \emptyset$, training dataset for $u$ \\ $\mathcal{D} \leftarrow \mathcal{D}_{init}$, dataset of training points for $\hat{f}$ seen so far \\ $x_{acq} \leftarrow \emptyset, y_{acq} \leftarrow \emptyset$ \\ \textbf{Optional: }Pre-fill $\mathcal{D}_u$ using Algo.~\ref{pseudocode:crossval} and fit $u$ on $\mathcal{D}_u$\\ \While{stopping criterion not reached}{ \textbf{Optional: }Fit $a$ on $\mathcal{D}$ if necessary (e.g. see Appendix~\ref{estimatealeatoric})\\ Fit predictor $\hat{f}$ and features $\phi$ on $\mathcal{D}$\\ $\mathcal{D}_u \leftarrow \mathcal{D}_u \cup \{ ( \phi(x_{acq}), (y_{acq} - \hat{f}(x_{acq}))^2) \}$ \\ Fit $u$ on $\mathcal{D}_u$ \\%(which contains stationarizing features $\phi$, and the error of $\hat{f}$) \\ $x_{acq} \sim \pi(. | \hat{f}, u - a)$ (can be either a single point, or a batch of points)\\ Sample outcomes from the ground truth distribution: $y_{acq} \sim P(\ . \ |x_{acq})$\\ $\mathcal{D}_u \leftarrow \mathcal{D}_u \cup \{ ( \phi(x_{acq}), (y_{acq} - \hat{f}(x_{acq}))^2 ) \}$\\ $\mathcal{D} \leftarrow \mathcal{D} \cup \{ (x_{acq}, y_{acq}) \}$ } \vspace*{-1mm} \caption{Training procedure for DEUP in an Active Learning setting} \label{pseudocode:deupactive} \end{algorithm} \end{minipage} \end{center} \vspace*{-7mm} \end{wrapfigure} Interactive settings, in which EU estimates are used to guide the acquisition of new examples, provide a more interesting use case for DEUP. They introduce however their own challenges, as the main predictor is retrained multiple times with the newly acquired points, which we address below. We consider an initial training dataset $\mathcal{D}^0 = \{(x^0_i, y^0_i)\}_{i=1}^{N_{0}}$. At each round $t>0$, we have access to a trained predictor $\hat{f}^{t-1}$, estimating the unknown ground-truth $f^*$, and an estimator $\hat{e}^{t-1}$ of its EU. Suppose there is an acquisition function, that given any predictor $\hat{f}$ and an estimator $\hat{e}$ of its EU, defines a distribution on the input space $\mathcal{X}$: $\pi(X | \hat{f}, \hat{e})$, from which we can sample points to add to the training set. Assume that at round $t > 0$, $N_t$ points $\{(x^t_i, y^t_i)\}_{i=1}^{N_t}$ are acquired, where $x^t_i \sim \pi( X | \hat{f}^{t-1}, \hat{e}^{t-1})$, and $y^t_i \sim P(Y | X=x^t_i) = \mathcal{N}(Y; f^*(x), \sigma^2(x))$ added to the training dataset: $\mathcal{D}^t = \mathcal{D}^{t-1} \cup \{(x^t_i, y^t_i)\}_{i=1}^{N_t}$. From $\mathcal{D}^t$, a predictor $\hat{f}^t = \mathcal{L}(\mathcal{D}^t)$ is obtained, which in turn will be used to decide which $N_{t+1}$ points are going to be acquired next, through the acquisition policy $\pi$ and an estimator $\hat{e}^t$ of its EU. How can we train such an EU estimator, without wasting $N_{OOS}$ (input, target) pairs that could be used to obtain a better estimator of $f^*$? \textbf{The problem with the trivial dataset: } Inspired by the fixed training set setting, it might be tempting to train an error predictor $\hat{e}^t$ on $\mathcal{D}^t_{u, 1} = \cup_{\tau=0}^t \{(x^\tau_i, (y^\tau_i - \hat{f}^t(x^\tau _i))^2) \}_{i=1}^{N_\tau}$. However, $x^\tau_i$ was used to train $\hat{f}^t$ and so we have an in-sample rather than OOS error. There would thus be no reason for $\hat{e}^t$ to provide accurate estimates in unexplored regions of the search space $\mathcal{X}$. An alternative is to learn from the errors made by previous versions of the predictor, i.e. $\{f^\tau, \ \tau \in \{0, \dots, t\}\}$, on points that were not used to train each of them, which we can simply choose to be the subsequent acquired points. More formally, consider the dataset $\mathcal{D}^t_{u, 2} = \cup_{\tau=0}^t \cup_{\tau'=\tau}^t \{(x^{\tau'}_i, (y^{\tau'}_i - \hat{f}^\tau(x^ {\tau'} _i))^2) \}_{i=1}^{N_{\tau'}}$. A learning algorithm with good generalization properties (such as modern neural networks), would in principle be able to extrapolate from this dataset, and estimate the errors (or total uncertainty) made by $\hat{f}^t$ on points $x \in \mathcal{X}$ not seen so far, i.e. belonging to what we call the \textit{frontier of knowledge}. However, as each $x_i^{\tau'}$ appears $t - \tau' + 1$ times in $\mathcal{D}^t_{u, 2}$, with different targets at each time (each corresponding to error made by $\hat{f}^\tau$ on $x_i^{\tau'}$, for $\tau \in \{\tau', \dots, t\}$), there is no reason to assume that the resulting predictor would estimate the errors of $\hat{f}^t$. The reason is that the targets are actually functions of not only the input $x$, but also of the dataset used to train the different predictors $\hat{f}^\tau$, i.e. $\mathcal{D}^\tau$. This is actually obvious when we write $(y^{\tau'}_i - \hat{f}^\tau(x^{\tau'} _i))^2 = \mathcal{U}(\mathcal{L}(\mathcal{D}^\tau), x^{\tau'}_i)$. This means that in order to obtain an estimator $\hat{e}^t$, we should train a general error estimator $\hat{e}$, with inputs of the form $(\mathcal{D}, x)$ and targets of the form $(y - \mathcal{L}(\mathcal{D})(x))^2$, using the historical dataset $\mathcal{D}^t_{u, 2} = \cup_{\tau=0}^t \cup_{\tau'=\tau}^t \{((\mathcal{D}^\tau, x^{\tau'}_i), (y^{\tau'}_i - \hat{f}^\tau(x^ {\tau'} _i))^2) \}_{i=1}^{N_{\tau'}}$, and then define $\hat{e}^t(x)$ to be $\hat{e}(\mathcal{D}^t, x)$ for any $x\in \mathcal{X}$. In summary, it is the acquired points, before they are added to the training set, that play the role of out-of-sample (they are actually OOD) points to train the EU estimator. However, $\mathcal{D}$ being a very high-dimensional object, with size growing with the number of acquired points, we may face severe overfitting issues when using $(\mathcal{D}, x)$ as inputs. We thus propose using \textbf{stationarizing features} of the dataset $\mathcal{D}$ at $x$, that we denote by $\phi_\mathcal{D}(x)$, as inputs to the error predictor instead of $(\mathcal{D}, x)$ (we typically include $x$ in $\phi_\mathcal{D}(x)$). These stationarizing features also address concerns with directly estimating uncertainty using a second order predictor trained simply using L2 error, raised in~\cite{bengs2022difficulty}. In this paper, we explored $\phi_\mathcal{D}(x) = \left(x, s, \hat{q}(x | \mathcal{D}), \hat{V}(\tilde{\cal L}, \mathcal{D}, x)\right)$, where $\hat{q}(x | \mathcal{D})$ is a density estimate from data $\mathcal{D}$ at $x$, $s = 1$ if $x \in \mathcal{D}$ otherwise $0$, $\tilde{\cal L}$ a learner that produces a distribution over predictors, e.g. a GP or a Deep Ensemble~\cite{lakshminarayanan2016simple}), and $\hat{V}(\tilde{\cal L}, \mathcal{D}, x)$ is an estimate of the model variance of $\tilde{\cal L}$ at $x$. Note that $\tilde{\mathcal{L}}$ can be chosen to be the same as $\mathcal{L}$ For numerical reasons, we found it preferable to use $\log \hat{q}$ and $\log \hat{V}$ instead of $\hat{q}$ or $\hat{V}$ as input features. $\hat{q}$ can be obtained by training a density estimator (such as a Kernel Density Estimator or a flow-based deep network \cite{rezende2015variational}, in our case). Like the other predictors, the density estimator also needs to be fine-tuned when new data is added to the training set. While these features are not required per se to train DEUP, they provide clues to help training the uncertainty estimator, and one can play with the trade-off of computational cost versus usefulness of each clue. They sometimes come at no greater cost, if our main predictor is the mean prediction of the learner's output distribution, and if we use the corresponding variance as the only extra feature, as is the case in the experiments of Sec.~\ref{smosection} with GPs. In our experiments, we found that using inputs $\phi_{\cal D}(x)$, or even a subset of the $4$ possible features, is sufficient to train an uncertainty estimator with targets $(\hat{f}(x) - y)^2$. For computational reasons, it is unfeasible to store all previous datasets and all previous predictors $\hat{f}^\tau$, and we propose a subset of $\mathcal{D}^t_{u, 2}$, that makes it possible to have an online algorithm, without memorization: \begin{equation*} \mathcal{D}^t_u = \cup_{\tau=0}^t \cup_{\tau'=\tau}^{\tau + 1} \{(\phi_{\mathcal{D}^\tau}( x^{\tau'}_i)), (y^{\tau'}_i - \hat{f}^\tau(x^ {\tau'} _i))^2) \}_{i=1}^{N_{\tau'}}. \end{equation*} The corresponding pseudo-code is provided in Algo.~\ref{pseudocode:deupactive}. Note that ${\cal D}_u$ is incremented twice with $x_{acq}$ but $\phi_{\cal D}(x_{acq})$ is different each time because $x_{acq}$ first is and then is not yet in ${\cal D}$. \vspace{-1mm} \subsubsection{\textbf{Pretraining the error predictor}} \label{sec:kickstarting} \vspace{-1mm} Consider an interactive setting, and suppose that the oracle is so costly that we cannot afford to wait for a few rounds of acquisition in order to build a training dataset large enough for the uncertainty estimator to provide reasonable EU estimates. To this end, we propose a cross-validation strategy to pretrain the secondary learner before any acquisition step, using pairs $(\phi_{\tilde{D}}(x), (f_{\tilde{D}}(x) - y)^2)$, \begin{wrapfigure}{r}{0.51\textwidth} \vspace*{-6mm} \begin{center} \begin{minipage}{0.51\textwidth} \begin{algorithm}[H] \textbf{Input: }$\mathcal{D}_u$ \\ \While{$|\mathcal{D}_u| < N_{pretrain}$}{ Split $\mathcal{D}_{init}$ into $K$ random subsets $\mathcal{D}_1, \dots, \mathcal{D}_K$ of equal size. Define $\tilde{\cal D} = \bigcup_{k=1}^{K-1} \mathcal{D}_k$\\ Fit a new predictor $\hat{f}$ on $\tilde{\mathcal{D}}$, and fit the features $\phi$ on $\tilde{\mathcal{D}}$\\ $\mathcal{D}_u \leftarrow \mathcal{D}_u \cup \bigcup_{(x, y) \in \mathcal{D}} \{( \phi(x), (y - \hat{f}(x))^2)\} } \caption{Pre-filling the uncertainy estimator training dataset $\mathcal{D}_u$} \label{pseudocode:crossval} \end{algorithm} \end{minipage} \end{center} \vspace*{-5mm} \end{wrapfigure}where $\tilde{D}$ is any subset of the initially available data, that we use to train a predictor $f_{\tilde{D}} = \mathcal{L}(\tilde{D})$, and $(x, y)$ any pair in $D$, whether in $\tilde{D}$ or not. With this pretraining phase, we obtain better uncertainty estimates as soon as the first batch of acquired points come in. There are several ways to build the pretraining dataset. We present one of them in Alg.~\ref{pseudocode:crossval}. The procedure stops when the training dataset for the secondary learner, $\mathcal{D}_u$, contains at least $N_{pretrain}$ elements. In our experiments, we choose $N_{pretrain}$ to be a small multiple of the number of initial training points. \vspace{-3mm} \section{Related Work} In \cite{KIUREGHIAN2009105}, the authors characterize the sources of uncertainty as aleatoric (inherent noise) and epistemic (incomplete knowledge). Using Gaussian Processes \cite{Williams1995GaussianPF} or GP is a popular EU estimation because the variance among the functions in the posterior (given the data) can be computed analytically. In a deep learning context, \cite{blundell2015weight, kendall2017uncertainties, depeweg2018decomposition} use the posterior distribution of network weights \cite{mackay1992practical} in Bayesian Neural Networks (BNNs) to capture EU. Other techniques that rely on measuring the discrepancy between different predictors as a proxy for EU include MC-Dropout \cite{gal2016dropout}, that interprets Dropout \cite{hinton2012improving} as a variational inference technique in BNNs. These approaches, because they rely on sampling multiple sets of weights or dropout masks at inference time, share some similarities with ensemble-based methods, that include bagging \cite{breiman1996bagging} and boosting \cite{efron1994introduction}, in which multiple predictors are trained and their outputs are averaged to make a prediction, although the latter measure variability due to the training set instead of the spread of functions compatible with the given training set, as in Bayesian approaches. For example, \cite{shaker2020aleatoric} use Random Forests \cite{breiman2001random} to estimate EU. Deep Ensembles \cite{lakshminarayanan2016simple} are closer to the Bayesian approach, using an ensemble of neural networks that differ because of randomness in initialization and training (as you would have with MCMC, albeit in a more heuristic way). In addition to this, several other variants of this central idea of measuring discrepancy between different predictors have been proposed recently \cite{malinin2018predictive, tagasovska2018single, amini2019deep,Liu2020SimpleAP, Amersfoort2020SimpleAS, Wen2020BatchEnsembleAA, Antoran2020DepthUI, kirichenko2020normalizing, malinin2020regression, DBLP:journals/corr/abs-2102-11409,mukhoti2021deep}. We discuss some of these methods in more detail in Appendix~\ref{appendix:RW}. More closely related to DEUP, \cite{Yoo2019LearningLF} propose a loss prediction module for learning to predict the value of the loss function. \cite{Hu2020ANP} also propose using a separate network that learns to predict the variance of an ensemble. These methods, however, are trained only to capture the in-sample error, and do not capture the out-of-sample error which is more relevant for scenarios like active learning where we want to pick $x$ where the reducible {\em generalization error} (see Def.~\ref{def:e}) is large. EpiOut \cite{Umlauft2020RealtimeUD, hafner2019noise} propose learning a binary output that simply distinguishes between low or high EU. \vspace{-3mm} \section{Experiments} \vspace{-1.5mm} \label{sec:experiments} In our experiments, we focus on interactive settings, where having good uncertainty estimates is essential for efficient acquisition. As explained in Sec.~\ref{sec:interactive}, it is the acquired points, before they are used to retrain the main predictor, that act as the {\em out-of-sample} examples to train DEUP. In RL, because the targets (e.g. of Q-Learning) are themselves estimates and moving, data seen at any particular point is normally out-of-sample and can inform the uncertainty estimator, when the inputs are used with the stationarizing features. We emphasize that in order to make fair comparisons, \textbf{DEUP does not have access to any additional OOD data during training}, in any of the experiments that follow. Instead, we use Algo.~\ref{pseudocode:crossval} to generate the OOD data used for training the error predictor. Finally, note that in terms of computational cost, training DEUP with density and model variance as stationarizing features is on-par with training a ensemble of $5$ networks. \vspace*{-3mm} \subsection{Sequential Model Optimization} \label{smosection} \vspace*{-1mm} Sequential model optimization is a form of active learning, where at each stage, the learner chooses query examples to label, looking for examples with a high value of the unknown oracle function. Such examples are selected so they have a high predicted value (to maximize the unknown oracle function) and a large predicted uncertainty (offering the opportunity of discovering yet higher values). Acquisition functions, such as Upper Confidence Bound (UCB, \cite{srinivas2009gaussian}) and Expected Improvement (EI, \cite{movckus1975bayesian}) trade-off exploration and exploitation, and one can select the next candidate by looking for $x$'s maximizing the acquisition function. We combine UCB and EI with DEUP (DEUP-UCB and DEUP-EI) to perform active learning, treating the main predictor and DEUP EU predictions at $x$ respectively as mean and variance of a Gaussian distribution for the learner's guess of the value of the oracle at $x$. We showcase how using DEUP to calibrate GP variances (used as the only extra input for DEUP) allows for better performances in higher-dimensional optimization tasks. Specifically, we compare DEUP-EI to TuRBO-EI \cite{eriksson2019scalable}, a state-of-the-art method for sequential optimization, that fits a collection of local GP models instead of a global one in order to perform efficient high-dimensional optimization, on the Ackley function \cite{ackley2012connectionist} as oracle, a common benchmark for optimization algorithms. The oracle function can be defined for arbitrary dimensions, and has many local minima. In Fig.~\ref{ackley}, we compare different methods on the Ackley-10 function, in addition to the optimum reached in budget-constrained optimization problems for different oracle input dimensions, and we find that adapting DEUP to TuRBO consistently outperforms regular TuRBO, especially in higher dimensions. See also Appendix~\ref{appendix:SMO} for 1D and 2D SMO tasks where DEUP-EI outperforms GP-EI \cite{bull2011convergence}, as well as neural networks with MC-Dropout or Ensembles. We find GP-EI getting stuck in local optima whereas DEUP-EI was able to reach the global maximum consistently. Experimental details are provided in Appendix~\ref{appendix:SMO3}. \begin{figure}[h!] \vspace*{-5mm} \begin{center} \centerline{\includegraphics[width=0.9\linewidth]{figs/multioptima_results_new_full.pdf}} \caption{{\em Left.} Max. value reached by the different optimization methods, for the 10 dimensional Ackley function. In each run, all the methods start with the same initial 20 points. Shaded areas represent the standard error across 3 runs. {\em Right.} Max. value reached in the budget-constrained setting, on the Ackley functions of different dimensions. Error bars represent the standard error across 3 different runs, with different initial sets of 20 pairs. The budget is $120$ function calls in total. Higher is better and TuRBO-DEUP-EI is less hurt by dimensionality.} \label{ackley} \end{center} \vspace{-8mm} \end{figure} \vspace{-2mm} \subsection{Reinforcement Learning} \vspace{-1mm} \begin{wrapfigure}{l}{0.4\textwidth} \vspace*{-6mm} \begin{center} \centerline{\includegraphics[width=0.4\textwidth]{figs/RL_regret}} \caption{Average regret on CartPole task. Error bars represent standard error across 5 runs.} \label{RL_regret} \end{center} \vspace*{-9mm} \end{wrapfigure} Similar to SMO, a key challenge in RL is efficient exploration of the input state space. To investigate the effectiveness of DEUP's uncertainty estimates in the context of RL, we incorporate epistemic uncertainties predicted by DEUP to DQN \cite{mnih2013playing}, which we refer to as DEUP-DQN. Specifically, we train the uncertainty predictor with the objective to predict the TD-error, using log-density estimates as a stationarizing feature. The predicted uncertainties are then used as an exploration bonus in the Q-values. Details of the experimental setup are in Appendix~\ref{appendix:RL}. We evaluate DEUP-DQN on CartPole, a classic RL task from \textit{bsuite} \cite{osband2020bsuite}, against DQN + $\epsilon$-greedy, DQN + MC-Dropout \cite{gal2016dropout} and Bootstrapped DQN \cite{osband2016deep}. Fig.~\ref{RL_regret} shows that DEUP achieves lower regret faster, compared to all the baselines, which demonstrates the advantage of DEUP's uncertainty estimates for efficient exploration. Future work should investigate ways to scale this method to more complex environments. \vspace*{-2mm} \subsection{Uncertainty Estimation} \label{exp:ue} \vspace*{-1.5mm} \subsubsection{Epistemic Uncertainty Predictions for Rejecting Difficult Examples} Epistemic uncertainty estimates can be used to reject difficult examples where the predictor might fail, such as OOD inputs\footnote{e.g. rare but challenging inputs can be directed to a human, avoiding a costly mistake}. We thus consider a standard OOD Detection task \cite{Amersfoort2020SimpleAS, DBLP:journals/corr/abs-2102-11409}, where we train a ResNet-18 \cite{he2016deep} for CIFAR-10 classification~\cite{Krizhevsky09learningmultiple} and reject OOD examples using estimated uncertainty in the prediction. To facilitate rejection of classes other than those in the training set, \begin{wraptable}{r}{0.59\textwidth} \vspace*{-2mm} \begin{center} {\smaller \begin{tabular}{lll} \hline \textbf{Model} & \textbf{SRCC} & \textbf{AUROC} \\ \hline MC-Dropout & $0.287 \pm 0.002$ & $0.894 \pm 0.008$ \\ Deep Ensemble & $0.381 \pm 0.004$ & $\bm{0.933 \pm 0.008}$ \\ DUQ & $0.376 \pm 0.003$ & $0.927 \pm 0.013$ \\ DUE & $0.378 \pm 0.004$ & $0.929 \pm 0.005$ \\ DEUP (D+V) & $\bm{0.426 \pm 0.009}$ & $\bm{0.933 \pm 0.010}$ \\ \hline \end{tabular} } \end{center} \caption{Spearman Rank Correlation Coefficient (SRCC) between predicted uncertainty and OOD generalization error (SVHN); Area under ROC Curve (AUROC) for OOD Detection (SVHN) with CIFAR-10 ResNet-18 models (3 seeds). DEUP significantly outperforms baselines in terms of SRCC and is equivalent to Deep Ensembles but scoring better than the other methods in terms of the coarser AUROC metric.} \label{CIFAREstimation} \vspace*{-4mm} \end{wraptable} we use a Bernoulli Cross-Entropy Loss for each class~\cite{Amersfoort2020SimpleAS}: $l(\hat{f}(x),y) = - \sum_i y_i \log \hat{f}_i(x) + (1-y_i) \log (1-\hat{f}_i(x))$, where $y$ is a one-hot vector ($y_i=1$ if $i$ is the correct class, and $0$ otherwise), and $\hat{f}_i(x)=$ predicted probability for class $i$, so the target for out-of-distribution data (from other classes) is $y = \{0, \dots, 0\}$. To ascertain how well an epistemic error estimate sorts non-training examples by the above NLL loss, we consider the rank correlation between the predicted uncertainty and the observed OOD generalization error on SVHN examples \cite{Netzer2011}. This metric focuses on the quality of the uncertainty estimates rather than just their ability to simply classify in- vs out-of-distribution. We also report the AUC for the OOD detection task; more details in Appendix~\ref{appendix:fixed_training_set}. Table~\ref{CIFAREstimation} shows that with the variance from DUE \cite{DBLP:journals/corr/abs-2102-11409} and the density from MAF \cite{papamakarios2017masked} as stationarizing features, we obtain uncertainty estimates that have high rank correlation with the underlying generalization errors and competitive AUROC, compared with the baselines. In addition, since the error predictor is trained separately from the main predictor, there is no explicit trade-off between the accuracy of the main predictor and the quality of uncertainty estimates. We achieve competitive accuracy of $93.89\%$ for the main predictor. We ignore the effect of aleatoric uncertainty (due to inconsistent human labelling), which would require a human study to ascertain. We note that we choose the DUE baseline as it is representative of related methods such as SNGP~\cite{Liu2020SimpleAP} and DDU~\cite{mukhoti2021deep}, and performs best in our experiments. We present additional results in a distribution shift setting in Appendix~\ref{appendix:fixed_training_set}. Note that in the pretraining phase of the uncertainty estimator (Alg.~\ref{pseudocode:crossval}), we obtain the subsets by splitting the data based on classes, with each split containing $\floor{n/K}$ classes. So when we train on $K-1$ subsets, the $\floor{n/K}$ classes from the remaining subset become \emph{out-of-distribution}. \subsubsection{Epistemic Uncertainty Estimation for Drug Combinations} \begin{figure}[h!] \centering \subfigure[Ensemble]{\vcenteredhbox{\includegraphics[width=0.20\columnwidth]{figs/DrugComb_Ens_seed_1.png}}\label{fig:drugcomb_1b}} \subfigure[DEUP] { \vcenteredhbox{\includegraphics[width=0.20\columnwidth]{figs/DrugComb_DEUP_seed_1.png}}\label{fig:drugcomb_1c}} \subtable[Quality of uncertainty estimates from different methods.] { \label{tb:table_drugcomb_uncertainty_analysis} \resizebox{0.5\columnwidth}{!}{ \vcenteredhbox{ \begin{tabular}{lllll} \hline \textbf{Model} & \textbf{Corr. w. res.} & \textbf{U. Bound} & \textbf{Ratio} & \textbf{Log Likelihood}\\ \hline MC-Dropout & $0.14 \pm 0.07$ & $0.56 \pm 0.05$ & $0.25 \pm 0.12$ & $ -20.1 \pm 6.8 $ \\ Deep Ensemble & $0.30 \pm 0.09$ & $0.59 \pm 0.04$ & $0.50 \pm 0.13$ & $ -14.3 \pm 4.7 $ \\ DUE & $0.12 \pm 0.12$ & $0.15 \pm 0.03$ & $\bm{0.80 \pm 0.79}$ & $-13.0 \pm 0.52$ \\ DEUP & $\bm{0.47 \pm 0.03}$ & $0.63 \pm 0.05$ & $\bm{0.75 \pm 0.07}$ & $\bm{-3.5 \pm 0.25}$\\\hline \end{tabular} }} } \caption{Drug Combinations. Predicted mean and uncertainty (error bars) on 50 test examples ordered by increasing value of true synergy score (orange). Model predictions and uncertainties in blue. Ensemble \textbf{(a)} (and MC-dropout, not shown) consistently underestimate uncertainty while DEUP \textbf{(b)} captures the right order of magnitude. \textbf{(c)} \textit{Corr. w. res.} shows correlation between model residuals and predicted uncertainties $\hat{\sigma}$. A best-case \textit{Upper Bound} on \textit{Corr. w. res.} is obtained from the correlation between $\hat{\sigma}$ and true samples from $\mathcal{N}(0, \hat{\sigma})$. \textit{Ratio} is the ratio between col. 1 and 2 (larger is better). \textit{Log-likelihood}: average over 3 seeds of per sample predictive log-likelihood.} \label{fig:drugcomb_1_main} \vspace{-4mm} \end{figure} We validate DEUP in a real-world regression task predicting the synergy of drug combinations. While much effort in drug discovery is spent on finding novel small molecules, a potentially cheaper method is identifying combinations of pre-existing drugs which are synergistic (i.e., work well together). However, every possible combination cannot be tested due to the high monetary cost and time required to run experiments. Therefore, developing good estimates of EU can help practitioners select experiments that are both informative and promising. As shown in Table~\ref{tb:table_drugcomb_uncertainty_analysis}, the out-of-sample error predicted by DEUP correlates better with residuals of the model on the test set in comparison to several other uncertainty estimation methods. Moreover, DEUP better captured the order of magnitude of the residuals as shown in Fig.~\ref{fig:drugcomb_1_main}. Details on experiments and metrics are in Appendix~\ref{appendix:dgc}. \section{Conclusion and Future Work} \vspace{-2mm} Whereas standard measures of epistemic uncertainty focus on variance, we argue that bias (misspecification) can also be reduced with predictors like neural networks. In a regression setup, the expected out-of-sample squared error minus aleatoric uncertainty thus captures all the uncertainty about the ground-truth function $\mathbb{E}[Y|x]$, that more data can reduce. This motivates the DEUP framework, where we train a second network to predict the errors of the first. In interactive settings, this nonetheless raises non-stationarity challenges for this estimator, and we propose extra input features to tackle this issue, and show experimentally their advantages. Future work should investigate ways to improve the computational efficiency of DEUP, and ways to estimate aleatoric uncertainty when no estimator thereof is readily available and when one cannot simply query an oracle several times on the same input $x$. \section*{Acknowledgements} The authors would like to thank Tristan Deleu, Anirudh Goyal, Tom Bosc, Léna Néhale Ezzine, Doina Precup, Pierre Luc-Bacon, John Bradshaw, Jos\'e Miguel Hern\'andez-Lobato as well as anonymous reviewers for useful comments and feedback. This research was enabled in part by support provided by \href{www.computecanada.ca}{Compute Canada}, the Bill \& Melinda Gates Foundation, IVADO and a CIFAR AI Chair. The authors also acknowledge funding from Samsung, IBM, Microsoft.
\section{Introduction} \label{sec:intro} Estimating a machine learning~(ML) model's difference in accuracy for different demographic groups is a challenging task in many applications, in large part due to imperfect or missing demographic data~\cite{holstein2019improving}. Demographic information might be unavailable for many reasons: users may choose to withhold this information (for privacy or other personal preferences), or the dataset may have been constructed for use in a setting where collecting the demographic information of the dataset's subjects was unnecessary, undesirable, or even illegal \cite{zhang2018assessing, weissman2011advancing, fremont2016race}. Responsible ML practitioners and auditors may want to evaluate model performance across different demographic groups even if demographic information was not collected explicitly, and as researchers of fairness we want to enable this. For example, a microlender who builds a model to prescreen applicants for a loan may explicitly avoid maintaining demographic records on applicants, but may also want to ensure that the rate at which their model approves a candidate is nearly independent of the applicant's gender. Can one assess this bias of the model, even when training and validation data do not contain explicit gender information? This presents a common problem: how can one audit the performance of a model for predicting $Y$, \emph{conditioned on demographic information $A$}, when $A$ and $Y$ are observed jointly on little or no data? More formally, consider two datasets $D_1, D_2$, where $D_1$ has features in $X$ and labels in $Y$, and $D_2$ has features in $X$ and demographic information in $A$. How should we use these datasets to evaluate a model $f$'s performance predicting $Y$ conditioned on $A$, for the distribution that generated $D_1$? With no further assumptions, this is impossible: if the two datasets are generated from distributions bearing no resemblance to each other, correlations existing between $X$ and $Y$ (and between $X$ and $A$) may be arbitrarily different for the two distributions. Modelers may still wish to understand if their separate datasets can help them with this estimation problem, and what properties their two datasets might need to have to result in good estimations. One approach, particularly natural for enabling many different teams participating in the development of models without demographic information, is to use proxy attributes as a replacement for the true sensitive attribute. The use of such proxy attributes has been widely used in domains such as health care \cite{brown2016using, fremont2005use} and finance \cite{bureau2014using}. One can view a particular proxy attribute as a coarse {\em attribute classifier} that predicts the sensitive attribute information for a given example. For popular fairness metrics such as equalized odds or demographic parity \cite{calders2009building, zliobaite2015relation,hardt2016equality,zafar2017www}, the sensitive attribute information obtained from the classifier can then be used in conjunction with the predicted label information to get an estimate of the bias of a given model. The advantage of this approach is that it decouples the data requirement, and in particular, the attribute classifier can be trained on a separate dataset without any label information present. On the other hand, such an approach may produce very poor estimates, depending upon how the sources of data relate to one another. Nonetheless, it is interesting to ask what principles should guide the choice of a proxy attribute, or more generally the design of a sensitive attribute classifier, and similarly, what principles should be followed when using such classifiers for bias estimation. In this work, we aim to understand this question. If one wishes to produce the most accurate estimate of the bias term, is the optimal approach to train the attribute classifier to have the highest possible $0/1$ accuracy, or to have similar error rates for each demographic group? It turns out that neither of these criteria alone captures the structure of the {\em optimal} attribute classifier. To demonstrate this, we consider the measurement of violation of {\em equal opportunity}, or true positive rates for different groups \cite{hardt2016equality}, and show that the error in the bias estimates, as a result of using a proxy attribute/attribute classifier depends not only on the error rate of the classifiers but also on how these errors (and the data more generally) are distributed. Our analysis has surprising and counter-intuitive implications -- in certain regimes the optimal attribute classifier is the one that has the most unequal distribution of errors across the two subgroups! Our main contributions are summarized below. \begin{itemize} \item \textbf{Problem formulation:} We formalize and study the problem of estimating the bias of a given machine learning model using data with only label information and model output, and using a separate attribute classifier to predict the sensitive attributes. We call this the {\em demographically scarce} regime. In particular, our setting captures the common practice of using proxy attributes as a replacement for the true sensitive attribute. We experimentally demonstrate that the accuracy of the attribute classifier does not solely capture its effectiveness in bias estimation. \item \textbf{Theoretical analysis:} For the case of the {\em equal opportunity} metric \cite{hardt2016equality}, we present a theoretical analysis under a simplified model. Our analysis completely characterizes the structure of the optimal attribute classifier and shows that the error in the bias estimates depends on the error rate of the classifier as well as the {\em base error rate}, a property of the data distribution. As a result, we show that in certain regimes of the base error rate, the optimal attribute classifier, surprisingly, is the one that has the most unequal distribution of errors among the two subgroups. \item \textbf{Empirical validation:} Our theory predicts natural interventions, aimed at better bias estimation, that can be performed either at the stage of designing the attribute classifier or at the stage of using a given attribute classifier. We study their effectiveness in scenarios where our modeling assumptions hold and their sensitivity to violations of the assumptions. \item \textbf{An active sampling algorithm:} Finally, we propose an active sampling based algorithm for accurately estimating the bias of a model given access to an attribute classifier for predicting the sensitive attribute. Our approach makes no assumption about the structure of the attribute classifier or the data distribution. We demonstrate via experiments on real data that our sampling scheme performs accurate bias estimation using significantly fewer samples in the demographically scarce regime, as compared to other approaches. \end{itemize} While highlighting the need for careful considerations when designing such attribute classifiers, our analysis provides concrete recommendations and algorithms that can be used by ML practitioners. \begin{remark} Inferring demographic information should be done with care, even when used only for auditing a model's disparate treatment. Any estimation of demographics will invariably have inaccuracies. This can be particularly problematic when considering, for example, gender, as misgendering an individual can cause them substantial harm. Furthermore, building a model to infer demographic information purely for internal evaluation leaves open the possibility that the model may ultimately be used more broadly, with possibly unintended consequences. That said, preliminary evidence of bias may be invaluable in arguing for resources to do a more careful evaluation of a machine learning system. For this reason, we believe that methods to estimate the difference in predictive performance across demographic groups can serve as a useful first step in understanding and improving the system's treatment of underserved populations. \end{remark} \section{Related Work} Various fairness metrics of interest have been proposed for classification~\cite{hardt2016equality, dwork2012fairness, pleiss2017fairness, kleinberg2017}, ranking~\cite{celis_fair_ranking, beutel2019fairness}, unsupervised learning~\cite{chierichetti2017fair,samadi2018price, fair_k_center_2019}, and online learning~\cite{joseph2016fairness,jabbari2017fairness,gillen2018online, blum2018preserving}. These notions of fairness are usually categorized as either {\em group fairness} or {\em individual fairness}. In the case of group fairness, training a model to satisfy such fairness metrics and evaluating the metrics on a pre-trained model typically requires access to both the sensitive attribute and the label information on the same dataset. Only recently, ML research has explored the implications of using proxy attributes and the sensitivity of fair machine learning algorithms to this noisy demographic data \cite{gupta2018,lamy2019, awasthi2019equalized, coston2019, schumann2019transfer}. The most related work to ours \cite{chen2019fairness,kallus2020} also study the problem of estimating the bias of predictor $f$ of $Y$ from $X$ as a function of $A$ with few or no samples from the joint distribution over $(X, Y, A)$. In \cite{chen2019fairness} the authors aim to estimate the disparity of a model $f$ predicting $Y$ from $X$, along $A$ by considering predicting $A$ from $X$ via a threshold $q$, and then assuming $A=a$ whenever $P[A = a | X = x] > q$. This can work well with unlimited data from the joint distribution over $A, X$, but can both overestimate and underestimate the bias because of the misclassification of $A$ using said thresholding rules. % The work of \cite{kallus2020} investigates how to perfectly or partially identify the same bias parameter, making few or no assumptions about independence between $A, Y, f$ and $X$. Given that exact identification is usually impossible, the authors describe how to find feasible regions of various disparity measures making very few assumptions about independence between $f, Y, X, A$. Similar to our work, the authors in \cite{kallus2020} study the setting where one has access to a dataset involving $(y,x)$ and another dataset involving $(a,x)$. Given that exact identification is usually impossible, they construct an uncertainty set (confidence interval) for bias estimates assuming access to the Bayes optimal classifier, i.e., the classifier that predicts sensitive attribute according to $P(a|x)$. An important contribution of our paper is to show that the Bayes optimal attribute classifier is not the right classifier in the first place. We demonstrate this via experiments in Table~\ref{tab:model_selection}, Theorem~\ref{thm:bayes-opt-example}, and in fact we go deeper and characterize the structure of the optimal attribute classifier in Theorem~\ref{thm:opt-classifier}~(under assumptions). Our work also explains why the confidence intervals in the experiments of~\cite{kallus2020} are large. In particular, the work of~\cite{kallus2020} focuses only on the setting where there is no common data, hence their confidence regions will never shrink with dataset size due to inherent uncertainty. We however believe that it is practically more relevant to study how we can use a little amount of common data and produce accurate estimates. This motivates our active sampling approach as proposed in Section~\ref{sec:active_sampling}. \section{Setup and Notation} We consider the classification setting where $\mathcal{X}$ denotes the feature space, $\mathcal{Y}$ the label space and $\mathcal{A}$ the sensitive attribute space. For simplicity, we assume $\mathcal{Y} = \{-1,+1\}$ and $\mathcal{A} = \{0,1\}$. Consider two datasets $D_1$ and $D_2$. $D_1$ is drawn from the marginal over $(\mathcal{X}, \mathcal{A})$, of a distribution $P$ over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$. Similarly, $D_2$ is drawn from the marginal over $(\mathcal{X}, \mathcal{Y})$, of a distribution $Q$ over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$. Thus, both datasets contain the same collection of features, $D_1$ contains attribute information, and $D_2$ contains label information. In this setting, given a classifier $f: \mathcal{X} \rightarrow \mathcal{Y}$, we aim to estimate the {\em bias} of $f$: the difference in the performance of $f$ on $Q$ over $A$. In this work we define the bias to be the {\em equal opportunity} metric \cite{hardt2016equality} defined as \begin{align} \label{eq:equal-opportunity} bias_Q(f) &= |\alpha - \beta|, \end{align} where \begin{align}\label{eq:def_true_alpha} \alpha = \mathbb{P}_{(x,a,y) \sim Q} \big(f(x)=1 | y=1, a=1 \big),\\ \beta = \mathbb{P}_{(x,a,y) \sim Q} \big(f(x)=1 | y=1, a=0 \big). \end{align} We consider the {\em demographically scarce} regime where the designer of an attribute classifier has access to $D_1$ and the user of the label classifier has access to $D_2$ and additionally has access to the attribute classifier $h: \mathcal{X} \rightarrow \mathcal{A}$ trained on $D_1$. Here, no party has access to both datasets. We aim to understand how the classifiers $(h,f)$ can be used in combination for accurate bias estimation. From the perspective of the user of an attribute classifier, it is easy to see that no matter what the attribute classifier is, one cannot get any non-trivial estimate of the bias of $f$ without access to some common data drawn from $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$. Here we provide a simple proof of this fact. In particular, we will construct a scenario where there is a fixed attribute classifier $h: \mathcal{X} \to \mathcal{A}$. We will construct two distributions $Q_1, Q_2$ such that the output distribution of the attribute classifier is the same in both the cases. Furthermore, any label classifier trained on just $(x,y)$ pairs will have the same output distribution in both the cases. However, the estimates of the bias when using the attribute classifier will differ wildly. Formally, we have the following proposition. \begin{proposition} \label{prop:lower-bound-stronger} Consider a fixed attribute classifier $h: \mathcal{X} \to \mathcal{A}$ and a fixed learning algorithm ALG for computing a label classifier from a distribution over $\mathcal{X} \times \mathcal{Y}$. Then, there exists two distribution $Q_1, Q_2$ over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$ such that: a) $Q_1, Q_2$ have the same marginals over $\mathcal{X} \times \mathcal{A}$, b) ALG produces the same label classifier $f$ given access to $Q_1$ or $Q_2$, and c) either the label classifier $f$ is the Bayes optimal classifier, or the ratio of the estimated bias~(using $h$) to the true bias of $f$ on either $Q_1$ or $Q_2$ is $0$ or $\infty$. \end{proposition} \begin{proof} Given the learning algorithm ALG for the labels and an attribute classifier $h$, we will construct two distributions $Q_1$ and $Q_2$ over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$ such that the following holds: \begin{itemize} \item $Q_1(\mathcal{X})$ is the same as ${Q_2}(\mathcal{X})$, thereby ensuring that the distribution of $h(x)$ over $Q_1, Q_2$ is the same. \item ${Q_1}(\mathcal{X} \times \mathcal{Y})$ is the same as ${Q_2}(\mathcal{X} \times \mathcal{Y})$, thereby ensuring that ALG produces the same classifier $f$. \item On $Q_1$ the true bias of $f$ is zero and on $Q_2$ the true bias of $f$ is one, thereby ensuring that the ratio of the estimated will be distorted by either zero or $\infty$. \end{itemize} To construct the two distributions fix any marginal distribution over $\mathcal{X} \times \mathcal{Y}$ and let $f$ be any classifier for predicting $y$ given $x$ that is not Bayes optimal. Since $f$ is not Bayes optimal, we can consider two non-empty regions $A=\{f=1, Y=1\}$ and $B=\{f=0, Y=1\}$. Construct $Q_1$ by setting the conditional distribution (conditioned on $A$) of $\mathcal{A}$ to be uniformly distributed and similarly the distribution of $\mathcal{A}$ conditioned on $B$ to be uniformly distributed. Construct $Q_2$ to be such that the conditional distribution of $\mathcal{A}$ on $A$ is entirely supported on $a=1$ and the conditional distribution of $\mathcal{A}$ on $B$ is entirely supported on $a=0$. Now it is easy to see that $f$ has zero bias on $Q_1$ and a bias value of one on $Q_2$. Since the estimated bias using $h$ will result in the same value for $Q_1$ and $Q_2$, in at least one of the cases the distortion must be $0$ or $\infty$. \end{proof} In the next two sections we study the following questions: a) how should one design an attribute classifier?, and b) how can one use an attribute classifier along with minimal common data and perform accurate bias estimation? We will focus on the case of $P=Q$, i.e., both the designer and the user of an attribute classifier have marginals from the same joint distribution. \section{Perspective of the Attribute Classifier Modeler} What properties of the attribute classifier are desirable for bias estimation? At first thought, training the most accurate classifier seems to be a reasonable strategy. However, it is easy to construct instances where using the Bayes optimal attribute classifier does not lead to the most accurate bias estimation. This is formalized in the Theorem below. See Appendix for the proof. \begin{theorem} \label{thm:bayes-opt-example} Let $x_1, x_2$ be binary attributes, $a$ be a binary sensitive attribute and $y$ be a binary class label. Furthermore, let $f$ be a label classifier given by $x_2$, i.e., $f(x_1, x_2, a) = x_2$. Then there exists a joint distribution $Q$ over $(x_1, x_2, a, y)$ tuples such that the bias of $f$ is zero, i.e., $bias_Q(f) = 0$. On the other hand, using the Bayes optimal predictor for the attribute $a$, leads to an estimated bias of one for $f$. \end{theorem} Next, we show that even in practical settings, there is little correlation between the accuracy of the attribute classifier and its effectiveness for bias estimation. Table~\ref{tab:model_selection} contains the result of various attribute classifiers trained on the UCI Adult dataset \cite{Dua:2019}. As can be seen, the accuracy of an attribute classifier is not necessarily correlated with its ability to estimate the true bias of a model. \begin{table}[t] \centering \begin{tabular}{|c|c|c|c|} \hline Attribute Classifier & Test Accuracy & $\hat{\alpha}-\hat{\beta}$ & $\alpha-\beta$\\ \hline \hline Random Forest & 84.46\% & -0.1243 & -0.1149 \\ \hline \hline Logistic Regression (LR) & 84.29\% & -0.1450 & -0.1149\\ \hline LR (M+O+R) & 82.68\% & -0.1200 & -0.1149\\ \hline LR (W+M+O+R) & 83.43\% & -0.1454 & -0.1149\\ \hline LR (W+E+M+O+R) & 83.43\% & -0.1352 & -0.1149\\ \hline \hline SVM & 83.80\% & -0.2045 & -0.1149\\ \hline \hline 1-hidden-layer NN & 83.35\% & -0.1025 & -0.1149\\ \hline \end{tabular} \vspace{0.05in} \caption{Distribution of test accuracies of different attribute (Gender) classifiers, and the resulting estimated biases, over the UCI Adult dataset. $\hat{\alpha}-\hat{\beta}$ is the estimated bias using the attribute classifier and $\alpha - \beta$ is the true bias~(without the absolute value). The label classifier is a fixed Random Forest Classifier to predict income, with $85.79\%$ test accuracy. By default all models are trained with all features except Gender and Income. For the Logistic Regression (LR) model, the names within the bracket indicate which features are used: R: ``Relationship'', E: ``Education", M: ``MaritalStatus", O: ``Occupation", W: ``WorkClass".} \label{tab:model_selection} \vspace{-0.2in} \end{table} In order to gain further understanding, we consider a simplified model where we aim to theoretically characterize the structure of the optimal attribute classifier. In particular, we will consider the setting where the two datasets $D_1$ and $D_2$ are drawn from distributions which are marginals of the same distribution. For an attribute classifier $h: \mathcal{X} \rightarrow \mathcal{A}$, define the conditional errors of $h$ with respect to $a$ as \begin{align}\label{eq:cond-error-def} g_1 &= \mathbb{P}(h(x) \neq a | a=0, y=1),\\ g_2 &= \mathbb{P}(h(x) \neq a | a=1, y=1). \end{align} Here $(x,a)$ is drawn from the marginal of joint distribution over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$ from which both $D_1$ and $D_2$ are drawn. Suppose we use $h$ to predict the noisy attributes $\hat{a}$ on $D_2$, and then use these estimates to measure the bias of a label classifier $f$. To simplify our analysis we make the following key assumption. Below we denote $\hat{y}$ to represent the prediction of the label classifier $f$. \noindent \textbf{Assumption I:} Given $y$ and $a$, $\hat{y}$ and $\hat{a}$ are conditionally independent, that is for all $y_1,y_2\in\{-1,+1\}$ and $a_1,a_2\in\{0,1\}$, we have \begin{align} \label{eq:cond_ind_assumption} &\mathbb{P}(\hat{y} = y_1,\hat{a}=a_1| y=y_2, a=a_2) \nonumber\\ &=\mathbb{P}(\hat{y} = y_1| y=y_2, a=a_2)\cdot \mathbb{P}(\hat{a}=a_1| y=y_2, a=a_2). \end{align} Notice that while the above assumption is restrictive, there are practical scenarios where one can expect it to hold. Furthermore, the assumption has been studied in prior works to understand noise sensitivity of post-processing and in-processing methods for building fair classifiers \cite{lamy2019,awasthi2019equalized}. Two settings where such an assumption would hold are as follows. First, this would hold if the attribute classifier uses a set of features that are conditionally independent of the features used by the label classifier. The assumption will also hold if the attribute classifier makes independent errors with a certain probability. This, for instance, might be the case for certain classifiers based upon crowdsourcing. As we will soon see, even under the above simplified setting, the structure of the optimal attribute classifier can defy convention wisdom. Using the attribute classifier $h$, we get estimates $\hat{\alpha}, \hat{\beta}$ of the true values $\alpha, \beta$~(see Eq.~\eqref{eq:def_true_alpha}), where \begin{align*} \hat{\alpha} &= \mathbb{P} (f(x)=1 | y=1, \hat{a}=1),\\ \hat{\beta} &= \mathbb{P} (f(x)=1 | y=1, \hat{a}=0). \end{align*} Under Assumption I, we have the following relationship between the true and the estimated values \begin{align} \label{eq:noisy-estimates} \begin{split} \hat{\alpha} &= \frac{\alpha \mathbb{P}(y=1,a=1)(1-g_2) + \beta \mathbb{P}(y=1,a=0)g_1}{\mathbb{P}(y=1,a=1)(1-g_2) + \mathbb{P}(y=1,a=0)g_1}, \\ % \hat{\beta} &= \frac{\alpha \mathbb{P}(y=1,a=1)g_2 + \beta \mathbb{P}(y=1,a=0)(1-g_1)}{\mathbb{P}(y=1,a=1)g_2 + \mathbb{P}(y=1,a=0)(1-g_1)}. \end{split} \end{align} To see the above we have \begin{align*} \mathbb{P} (f(x)=1 | y=1, \hat{a}=1) &= \frac{A+B}{C+D}, \end{align*} where \begin{align*} A &= \mathbb{P}(f(x)=1 | y=1, a=1,\hat{a}=1) \mathbb{P}(\hat{a}=1|y=1,a=1)\mathbb{P}(y=1,a=1),\\ B &= \mathbb{P}(f(x)=1 | y=1, a=0,\hat{a}=1) \mathbb{P}(\hat{a}=1|y=1,a=0)\mathbb{P}(y=1,a=0),\\ C &= \mathbb{P}(\hat{a}=1|y=1,a=1)\mathbb{P}(y=1,a=1),\\ D &= \mathbb{P}(\hat{a}=1|y=1,a=0)\mathbb{P}(y=1,a=0). \end{align*} The above can be rewritten as \begin{align*} \mathbb{P} (f(x)=1 | y=1, \hat{a}=1) &= \frac{(1-g_2)\mathbb{P}(f(x)=1 | y=1, a=1,\hat{a}=1) \mathbb{P}(y=1,a=1)}{(1-g_2)\mathbb{P}(y=1,a=1)+ g_1\mathbb{P}(y=1,a=0)}\\ &+\;\;\;\; \frac{g_1\mathbb{P}(f(x)=1 | y=1, a=0,\hat{a}=1)\mathbb{P}(y=1,a=0)}{(1-g_2)\mathbb{P}(y=1,a=1) + g_1\mathbb{P}(y=1,a=0)}, \end{align*} with $g_1,g_2$ defined as in \eqref{eq:cond-error-def}. Under Assumption I we have \[\mathbb{P}(f(x)=1 | y=1, a=1,\hat{a}=1)=\alpha \] and \[ \mathbb{P}(f(x)=1 | y=1, a=0,\hat{a}=1)=\beta, \] and hence \begin{align*} \mathbb{P} (f(x)=1 | y=1, \hat{a}=1) &=\frac{(1-g_2)\alpha \mathbb{P}(y=1,a=1)+g_1\beta\mathbb{P}(y=1,a=0)}{(1-g_2)\mathbb{P}(y=1,a=1) + g_1\mathbb{P}(y=1,a=0)}. \end{align*} Similarly, we obtain \begin{align*} \mathbb{P} (f(x)=1 | y=1, \hat{a}=0) &=\frac{g_2 \alpha \mathbb{P}(y=1,a=1) + (1-g_1)\beta\mathbb{P}(y=1,a=0)}{g_2\mathbb{P}(y=1,a=1)+ (1-g_1)\mathbb{P}(y=1,a=0)}. \end{align*} It follows that \begin{align*} |\hat{\alpha} - \hat{\beta}| &= |\mathbb{P}(f(x)=1 | y=1, \hat{a}=1) -\mathbb{P} (f(x)=1 | y=1, \hat{a}=0)|\\ &=\frac{|1-g_1-g_2|}{\big(\frac s r (1-g_1) + g_2\big)\big(\frac r s (1-g_2) + g_1 \big)} \cdot |\alpha - \beta|, \end{align*} where \begin{align*} r = \mathbb{P}(y=1,a=1), \qquad s = \mathbb{P}(y=1,a=0). \end{align*} A simple calculation then shows that the true bias and the estimated bias satisfy \begin{align} \label{eq:bias_correction_formula} |\hat{\alpha} - \hat{\beta}| &= \gamma |\alpha - \beta|, \end{align} where the {\em distortion factor} $\gamma$ is defined as \begin{align}\label{eq:def_E} \gamma = \frac{|1-g_1-g_2|}{\big(\frac s r (1-g_1) + g_2\big)\big(\frac r s (1-g_2) + g_1 \big)} \end{align} with larger values of $\gamma$ corresponding to higher accuracy estimates of bias, and the quantities $r,s$ are defined as \begin{align*} r = \mathbb{P}(y=1,a=1), \qquad s = \mathbb{P}(y=1,a=0). \end{align*} We refer to $r/s$ as the {\em ratio of base rates} and assume that it is bounded in $(0,G)$ for some finite $G$, else there will be no good way to estimate the bias from a finite sample. Notice that if $g_1+g_2$ equals one, then $\gamma$ is zero. In every other case it is not hard to see that $\gamma \in [0,1]$. \begin{remark} Under Assumption I, $|\hat{\alpha} - \hat{\beta}|$ is an \emph{underestimate} of the bias of $f$, and is therefore not an unbiased estimator. This is evident from our derivation, but may not be obvious for someone using empirical value as a stand-in for the true value of bias. \end{remark} Hence, even in the simplified setting of Assumption I, the distortion in the estimated bias depends on the conditional errors of $h$, as well as the ratio of base rates $r/s$. Therefore, to accurately estimate the true bias one not only needs the conditional errors of $h$ but also an estimate of the ratio of base rates. \iffalse Notice that this requires access to some amount of common data from the joint distribution of $(y,a)$. Our first main result is that this is unavoidable unless the label classifier $\hat{y}$ is perfect, or in other words the true bias is $0$. This is formalized in the lower bound below. The above lower bound raises another question, namely, how should one train an optimal attribute classifier in the absence of common information on $(y,a)$. \fi Under Assumption I an optimal attribute classifier should aim to maximize $\gamma$ as defined in \eqref{eq:def_E} (since $\gamma \in [0,1]$). Our next theorem quantifies the structure of the optimal attribute~classifier. \begin{theorem} \label{thm:opt-classifier} Assume that the distribution $P$ is such that the ratio of base rates equals one, i.e., $r=s$. Furthermore, denote an attribute classifier $h$ as a tuple $(g_1, g_2)$ where $g_1$ and $g_2$ denote the conditional errors as defined in \eqref{eq:cond-error-def}. Then, under a given error budget $U$, i.e., $\mathbb{P}(h(x)\neq a, y=1)=U$, the only global maximizers of $\gamma$ as defined in \eqref{eq:def_E} are the attribute classifiers $(0,{U}/{r})$ and $(U/r,0)$ (if $U\leq r$) or $({U}/{r}-1,1)$ and $(1,{U}/{r}-1)$ (if $U\geq r$). \end{theorem} \begin{proof} In case of $r=s$, $\gamma$ as defined in \eqref{eq:def_E} simplifies to \begin{align*} \gamma = \frac{|1-g_1-g_2|}{1-(g_1-g_2)^2}, \end{align*} and the constraint $\mathbb{P}(h(x)\neq a, y=1)=\mathbb{P}(a=0, y=1)g_1 + \mathbb{P}(a=1, y=1)g_2=U$ is equivalent to $g_1 + g_2= \frac{U}{r}$. \vspace{5mm} Our goal is to show that $\argmax_{(g_1,g_2)\in[0,1]^2:\, g_1 + g_2= \frac{U}{r}} \Big( \gamma \Big)$ equals \begin{align*} \{(\max\{{U}/{r}-1,0\},\min\{{U}/{r},1\}),(\min\{{U}/{r},1\},\max\{{U}/{r}-1,0\})\}. \end{align*} \vspace{2mm} Writing $g_2$ in terms of $g_1$, we get that $$ g_2 = \frac{U}{r}-g_1 $$ and $$ \gamma(g_1) = \frac{|1- \frac{U}{r}|}{1-(2g_1 - \frac{U}{r})^2}. $$ The constraint $(g_1,g_2)\in[0,1]^2$ is equivalent to \[g_1\in[\max\{\frac{U}{r}-1,0\},\min\{\frac{U}{r},1\}]. \] We assume that $\frac{U}{r}\leq 2$. Maximizing $\gamma(g_1)$ is equivalent to maximizing $(2g_1-\frac{U}{r})^2$, and the maximum of the latter function is attained both at $g_1=\max\{\frac{U}{r}-1,0\}$ and $g_1=\min\{\frac{U}{r},1\}$, which correspond to $g_2=\min\{\frac{U}{r},1\}$ and $g_2=\max\{\frac{U}{r}-1,0\}$, respectively. \end{proof} \begin{figure*}[t] \centering \includegraphics[width=2in]{fig/gamma_plot_r_s_1.pdf} \includegraphics[width=2in]{fig/gamma_plot_r_s_2.pdf} \includegraphics[width=2.65in]{fig/gamma_plot_r_s_0_5.pdf} \vspace{-0.15in} \caption{The distortion factor~$\gamma$ as a function of $g_1$ for different $r/s$ and under different error budgets $U=sg_1+rg_2$ for the attribute classifier. Apparently, $\gamma$ always attains its maximum either at the smallest or the largest possible value of $g_1$.} \label{fig:gamma_plot_w_base_rate} \end{figure*} \begin{figure*}[t] \centering \includegraphics[width=4.7in]{fig/NewFifa20_boxplots_Version1.pdf} \caption{Experiment on the FIFA 20 player dataset---independence assumption~\eqref{eq:cond_ind_assumption} holds. Absolute difference between the true bias and the estimated bias for direct (Dir) and corrected~(Cor) estimation, when 100 to 250 points of common data over $(y,a)$ are available, and for naive (Naive) estimation. } \label{fig:exp_fifa_dataset} \end{figure*} The above theorem implies that even under simplifying assumptions, the structure of the optimal attribute classifier is counter-intuitive: to estimate bias as accurately as possible, one may want to distribute the errors of the given attribute classifier as unevenly as possible! Hence, great care must be taken when designing the attribute classifier for the purpose of bias estimation. Furthermore, while we only consider the case $r=s$, Figure~\ref{fig:gamma_plot_w_base_rate} shows the distortion factor~$\gamma$ as a function of $g_1$ for a fixed error budget $U$ also when $r\neq s$ (middle and right plot). As we can see, also then $\gamma$ attains its maximum either at the smallest or the largest possible value of $g_1$, which corresponds to distributing the error among the two groups as unevenly as possible. \input{experiment_arxiv.tex} \section{Discussion and Conclusion} We formalized and studied a commonly occurring scenario in fairness evaluation and auditing namely, the lack of common data involving both the class labels and sensitive attributes. Our experiments and theoretical analysis reveal that great care must be taken in designing attribute classifiers for the purpose of bias estimation. Furthermore, in certain scenarios, the structure of the optimal attribute classifier can be contradictory to natural criteria such as accuracy and fairness. From the perspective of the designer of the attribute classifier, maximizing the distortion factor as in \eqref{eq:def_E} is a challenging optimization problem. It would be interesting to explore efficient algorithms for solving this. Throughout our analysis we assume that the datasets $D_1, D_2$ are sampled from the same distribution. It would be interesting to extend our theory to the more realistic case of when the dataset distributions are different. Finally, it would also be interesting to provide theoretical guarantees for the active sampling scheme in Algorithm~\ref{alg:active-sampling}. \section{Perspective of the User of an Attribute Classifier} \label{sec:experiments} If the user of the attribute classifier expects Assumption~I as defined in Eq.~\eqref{eq:cond_ind_assumption} to (approximately) hold and she has some common data over $(y, a)$ from which she will estimate the conditional errors~$g_1,g_2$ and the ratio of base rates~$r/s$, exploiting \eqref{eq:bias_correction_formula}, she can try to improve the naive bias estimate $|\hat{\alpha}-\hat{\beta}|$ by dividing it by an estimate of the distortion factor~$\gamma$. In this section, we present an experiment that illustrates that such an approach indeed yields a better estimate of the true bias~$|\alpha-\beta|$. In a data scarce regime, this approach also compares favorably to using the available data for directly estimating $|\alpha-\beta|$. \vspace{1mm} \textbf{Dataset.~~} We use the FIFA~20 player dataset\footnote{\url{https://www.kaggle.com/stefanoleone992/fifa-20-complete-player-dataset}}. We predict whether a soccer player's wage is above ($y=+1$) or below ($y=-1$) the median wage based on the player's age and their \emph{Overall} attribute. For doing so we train a one-hidden-layer NN. We restrict the dataset to contain only players of English or German nationality (leaving us with 2883 players) and consider nationality as sensitive attribute. We train an LSTM \cite{lstm} to predict this attribute from a player's name. In this case we can expect the conditional independence assumption~\eqref{eq:cond_ind_assumption} to hold since given a player's wage and nationality, their name should be conditionally independent of age and \emph{Overall} attribute. Indeed, the measure proposed in \cite{awasthi2019equalized} is small enough (see below) as to confirm that our expectation holds and the independence assumption is satisfied. \begin{figure*}[t] \centering \includegraphics[width=5in]{fig/boxplot_adult.pdf} \caption{Experiment on the UCI Adult dataset---independence assumption~\eqref{eq:cond_ind_assumption} is violated. Absolute difference between the true bias and the estimated bias for direct (Dir) and corrected~(Cor) estimation, when 100 to 1000 points of common data over $(y,a)$ are available, and for naive (Naive)~estimation.} \label{fig:adult_bias_est} \end{figure*} \vspace{1mm} \textbf{Experimental setup.~~} We randomly split the dataset into three batches of sizes 1500, 1133 and 250, respectively. We use the first batch to train the label and the attribute classifier. On the second batch, we compute both the true bias~$|\alpha-\beta|$ and the \emph{naive estimate}~$|\hat{\alpha}-\hat{\beta}|$. Finally, we use $n\in\{100,150,200,250\}$ points from the third batch to estimate $g_1,g_2,r,s$, and thus $\gamma$, and also to directly estimate $|\alpha-\beta|$. We refer to the latter estimate as \emph{direct estimate}. Exploiting~\eqref{eq:bias_correction_formula}, we use the estimate of $\gamma$ to correct the naive estimate~$|\hat{\alpha}-\hat{\beta}|$ by dividing it by the estimate of $\gamma$. We refer to the result as \emph{corrected estimate}. Figure~\ref{fig:exp_fifa_dataset} shows the absolute difference between the true bias and the various estimates, where for the direct estimate and the corrected estimate we show the results depending on $n$, the amount of data for which we have both $y$ and $a$. The boxplots are obtained from running the experiment 100 times. We can see that the corrected estimate significantly improves over the naive estimate (e.g., the mean absolute difference, averaged over the 100 runs, is 0.0831 for the naive estimate and 0.0461 for the corrected estimate with $n=250$). Furthermore, the corrected estimate consistently outperforms the direct estimate. When only $n=100$ points of common data over $(y,a)$ are used, the mean absolute difference for the corrected estimate is 0.054 while for the direct estimate it is 0.0837. In this experiment, the mean true bias is 0.14, the mean error of the label and the attribute classifier is 0.18 and 0.25, respectively, and the mean violation of the independence assumption according to the measure proposed in \cite{awasthi2019equalized} is $0.017$. \subsection{An Active Sampling based Algorithm for Bias Estimation in General Settings} \label{sec:active_sampling} In some real-world scenarios the conditional independence assumption might be violated, and we would like to ask, in those cases, does the correction as specified in Eq.~\eqref{eq:bias_correction_formula} still give a good estimate of the true bias? We show in the following that the correction might not always lead to a better bias estimate when Assumption I does not hold. Therefore, in order to obtain a good bias estimate in general, we explore active-sampling strategies that aim to use as little common data over $(y,a)$ as possible, ideally comparable to the setting when the independence assumption holds. \vspace{1mm} \textbf{Dataset.~~} We use the UCI Adult dataset\footnote{\url{https://archive.ics.uci.edu/ml/datasets/Adult}}, which comes divided into a training and a test set. On the training set, we train Random Forest classifiers for both predicting the label (income: $>50K$ or not, using all features present in the dataset except gender) and the attribute (gender: ``Male'' or ``Female'' as categorized in the dataset, using all features except income). We used the measure proposed in \cite{awasthi2019equalized} to evaluate whether the independence assumption~\eqref{eq:cond_ind_assumption} (approximately) holds and found that the independence assumption clearly fails to hold. \paragraph{Inaccurate bias estimation when the conditional independence assumption is violated.} We use the UCI Adult training set for training our label classifier and attribute classifier. For the Adult test set (around 16,000 examples), we hold out a set with $2,000$ examples for estimating $g_1, g_2, r, s$ since it requires some common data over $(y, a)$, and use the rest for estimating the true bias ($|\alpha-\beta|$). In Figure~\ref{fig:adult_bias_est}, we show the absolute difference between the estimated bias and the true bias. For the estimated bias, we use the same setting as the previous experiment, with direct estimate, corrected estimate, and naive estimate. We can see the the correction gives a more accurate estimate than direct estimation, however, the naive estimate remains to be the one with the most accurate estimate. \paragraph{Active sampling algorithm.} \label{sec:active} We next address the limitations of the approaches explored above. In particular, we propose a \emph{general active-sampling} based strategy that the label classifier can use to accurately estimate the bias, using as little common data over $(y,a)$ as possible, given the attribute classifier. Furthermore, we will make \emph{no assumption} about the conditional independence or the structure of the attribute classifier. In the general setting the estimated bias and the true bias are related as follows: \begin{theorem} \label{thm:opt-classifier-general} The true bias $\alpha-\beta$ can be derived from $\hat{\alpha}, \hat{\beta}$ as: \begin{align} \alpha-\beta &=\frac{\hat{\alpha}(\frac{s}{r}g_1+1-g_2)(1-\delta_1+\frac{r}{s}\delta_2)}{1-\delta_1-\delta_2} \nonumber \\ &- \frac{\hat{\beta}(1-g_1+\frac{r}{s}g_2)(1+\frac{s}{r}\delta_1-\delta_2)}{1-\delta_1-\delta_2}, \label{eq:true-bias-updates} \end{align} where \begin{align} \label{eq:delta-def} \delta_1 &= \mathbb{P}(\hat{a}=1 | f(x)=1, a=0, y=1), \nonumber \\ \delta_2 &= \mathbb{P}(\hat{a}=0 | f(x)=1, a=1, y=1), \end{align} and $g_1, g_2$ are as defined in Eq.~\eqref{eq:cond-error-def}. \end{theorem} \begin{figure*}[t] \centering \includegraphics[width=2.7in]{fig/al_est.pdf} \hspace{1.2cm} \includegraphics[width=2.65in]{fig/al_direct_est.pdf} \caption{The absolute difference between estimated bias and the true bias, based on different \textbf{active sampling} strategies (left), and based on \textbf{direct estimation} over selected samples using uniform/positive sampling (right). Both are results averaged over $10$ runs with random initialization.} \label{fig:active_learning_bias_est} \end{figure*} \begin{algorithm} \caption{Active Sampling} \begin{algorithmic}[1] \item[] \textbf{Input:} $D_2 = \{(x_1, y_1), \dots, (x_m, y_m)\}$, attribute classifier $h$, parameters $b, w$. \item [] \textbf{Output:} Estimated bias $|\hat{\alpha} - \hat{\beta}|$, tolerance $\epsilon$. \STATE Sample a set of $b$ examples uniformly at random from $D_2$ conditioned on $y=1$ and get their true attributes. Get estimates $\hat{r}$ and $\hat{s}$ using the sampled examples. \STATE Initialize $t=0$ and $g^{(0)}_1, g^{(0)}_2, \delta^{(0)}_1, \delta^{(0)}_2$ to be zero. \FOR{$t=1, \dots$} \STATE Sample a batch of $b$ unlabeled~(i.e. no sensitive attribute information) examples uniformly at random from $D_2$ conditioned on $y=1$. \STATE Sort the examples in ascending order according to the uncertainty of $h$, i.e., $|h(x)-0.5|$. \STATE Obtain true attribute information the first $w$ examples and append to the labeled set of data. Compute $g^{(t+1)}_1, g^{(t+1)}_2, \delta^{(t+1)}_1, \delta^{(t+1)}_2$ on the labeled set using \eqref{eq:cond-error-def} and \eqref{eq:delta-def}. \STATE If $|g_1^{(t+1)} - g_1^{(t)}|, |g_2^{(t+1)} - g_2^{(t)}|, |\delta_1^{(t+1)} - \delta_1^{(t)}|, |g\delta_2^{(t+1)} - \delta_2^{(t)}|$ are all bounded by $\epsilon$ then \textbf{break}. \ENDFOR \STATE Output estimated bias obtained by using \eqref{eq:true-bias-updates} and the above estimates. \end{algorithmic} \label{alg:active-sampling} \end{algorithm} While $r,s$ can be estimated from a small amount of data, we explore sampling strategies for estimating the attribute classifier dependent quantities, namely, $g_1, g_2$ and $\delta_1, \delta_2$. Two natural sampling schemes are: (i) {\em Uniform sampling} where we uniformly sample a set of examples and get their true sensitive attribute information, and (ii) {\em Positive sampling}: where we perform uniform sampling on the subset of examples with $y=1$. We expect positive sampling to perform better than uniform sampling, since the quantities that we are estimating are conditioned on $y=1$. We compare the above two approaches with (iii) an {\em active sampling} approach that involves querying for true sensitive attributes~(conditioned on $y=1$) of examples on which the attribute classifier is the most uncertain (as described in Algorithm~\ref{alg:active-sampling}). For each of the methods, in each iteration, we compute the estimated bias on the UCI Adult test set by using true values of $a$ over the selected samples, and the predicted values $\hat{a}$ from the attribute classifier for the unselected samples, using a sampling batch size of $100$. The results are shown in Figure~\ref{fig:active_learning_bias_est} (left), where we see that the uncertainty based active sampling approach requires significantly less common data to accurately estimate the~bias. Furthermore, we also compare our approach with (iv) {\em Direct estimation}: where we directly estimate the bias~($|\alpha-\beta|$) based on the currently sampled set $S$, i.e., the small amount of common $(y, a)$ on the same test set, using a uniform sampling strategy and a positive sampling strategy. The result is shown in Figure~\ref{fig:active_learning_bias_est} (right). Note that the magnitude in the y-axis is much larger compared to the left figure, indicating that direct estimation using few samples tends to give less reliable estimation of the bias. \section{Perspective of the User of an Attribute Classifier} \label{sec:experiments} If the user of the attribute classifier expects Assumption~I as defined in Eq.~\eqref{eq:cond_ind_assumption} to (approximately) hold and she has some common data over $(y, a)$ from which she will estimate the conditional errors~$g_1,g_2$ and the ratio of base rates~$r/s$, exploiting \eqref{eq:bias_correction_formula}, she can try to improve the naive bias estimate $|\hat{\alpha}-\hat{\beta}|$ by dividing it by an estimate of the distortion factor~$\gamma$. In this section, we present an experiment that illustrates that such an approach indeed yields a better estimate of the true bias~$|\alpha-\beta|$. In a data scarce regime, this approach also compares favorably to using the available data for directly estimating $|\alpha-\beta|$. \vspace{1mm} \textbf{Dataset.~~} We use the FIFA~20 player dataset\footnote{\url{https://www.kaggle.com/stefanoleone992/fifa-20-complete-player-dataset}}. We predict whether a soccer player's wage is above ($y=+1$) or below ($y=-1$) the median wage based on the player's age and their \emph{Overall} attribute. For doing so we train a one-hidden-layer NN. We restrict the dataset to contain only players of English or German nationality (leaving us with 2883 players) and consider nationality as sensitive attribute. We train an LSTM \cite{lstm} to predict this attribute from a player's name. In this case we can expect the conditional independence assumption~\eqref{eq:cond_ind_assumption} to hold since given a player's wage and nationality, their name should be conditionally independent of age and \emph{Overall} attribute. Indeed, the measure proposed in \cite{awasthi2019equalized} is small enough (see below) as to confirm that our expectation holds and the independence assumption is satisfied. \begin{figure*}[t] \centering \includegraphics[width=5in]{fig/boxplot_adult.pdf} \caption{Experiment on the UCI Adult dataset---independence assumption~\eqref{eq:cond_ind_assumption} is violated. Absolute difference between the true bias and the estimated bias for direct (Dir) and corrected~(Cor) estimation, when 100 to 1000 points of common data over $(y,a)$ are available, and for naive (Naive)~estimation.} \label{fig:adult_bias_est} \end{figure*} \vspace{1mm} \textbf{Experimental setup.~~} We randomly split the dataset into three batches of sizes 1500, 1133 and 250, respectively. We use the first batch to train the label and the attribute classifier. On the second batch, we compute both the true bias~$|\alpha-\beta|$ and the \emph{naive estimate}~$|\hat{\alpha}-\hat{\beta}|$. Finally, we use $n\in\{100,150,200,250\}$ points from the third batch to estimate $g_1,g_2,r,s$, and thus $\gamma$, and also to directly estimate $|\alpha-\beta|$. We refer to the latter estimate as \emph{direct estimate}. Exploiting~\eqref{eq:bias_correction_formula}, we use the estimate of $\gamma$ to correct the naive estimate~$|\hat{\alpha}-\hat{\beta}|$ by dividing it by the estimate of $\gamma$. We refer to the result as \emph{corrected estimate}. Figure~\ref{fig:exp_fifa_dataset} shows the absolute difference between the true bias and the various estimates, where for the direct estimate and the corrected estimate we show the results depending on $n$, the amount of data for which we have both $y$ and $a$. The boxplots are obtained from running the experiment 100 times. We can see that the corrected estimate significantly improves over the naive estimate (e.g., the mean absolute difference, averaged over the 100 runs, is 0.0831 for the naive estimate and 0.0461 for the corrected estimate with $n=250$). Furthermore, the corrected estimate consistently outperforms the direct estimate. When only $n=100$ points of common data over $(y,a)$ are used, the mean absolute difference for the corrected estimate is 0.054 while for the direct estimate it is 0.0837. In this experiment, the mean true bias is 0.14, the mean error of the label and the attribute classifier is 0.18 and 0.25, respectively, and the mean violation of the independence assumption according to the measure proposed in \cite{awasthi2019equalized} is $0.017$. \subsection{An Active Sampling based Algorithm for Bias Estimation in General Settings} \label{sec:active_sampling} In some real-world scenarios the conditional independence assumption might be violated, and we would like to ask, in those cases, does the correction as specified in Eq.~\eqref{eq:bias_correction_formula} still give a good estimate of the true bias? We show in the following that the correction might not always lead to a better bias estimate when Assumption I does not hold. Therefore, in order to obtain a good bias estimate in general, we explore active-sampling strategies that aim to use as little common data over $(y,a)$ as possible, ideally comparable to the setting when the independence assumption holds. \vspace{1mm} \textbf{Dataset.~~} We use the UCI Adult dataset\footnote{\url{https://archive.ics.uci.edu/ml/datasets/Adult}}, which comes divided into a training and a test set. On the training set, we train Random Forest classifiers for both predicting the label (income: $>50K$ or not, using all features present in the dataset except gender) and the attribute (gender: ``Male'' or ``Female'' as categorized in the dataset, using all features except income). We used the measure proposed in \cite{awasthi2019equalized} to evaluate whether the independence assumption~\eqref{eq:cond_ind_assumption} (approximately) holds and found that the independence assumption clearly fails to hold. \paragraph{Inaccurate bias estimation when the conditional independence assumption is violated.} We use the UCI Adult training set for training our label classifier and attribute classifier. For the Adult test set (around 16,000 examples), we hold out a set with $2,000$ examples for estimating $g_1, g_2, r, s$ since it requires some common data over $(y, a)$, and use the rest for estimating the true bias ($|\alpha-\beta|$). In Figure~\ref{fig:adult_bias_est}, we show the absolute difference between the estimated bias and the true bias. For the estimated bias, we use the same setting as the previous experiment, with direct estimate, corrected estimate, and naive estimate. We can see the the correction gives a more accurate estimate than direct estimation, however, the naive estimate remains to be the one with the most accurate estimate. \paragraph{Active sampling algorithm.} \label{sec:active} We next address the limitations of the approaches explored above. In particular, we propose a \emph{general active-sampling} based strategy that the label classifier can use to accurately estimate the bias, using as little common data over $(y,a)$ as possible, given the attribute classifier. Furthermore, we will make \emph{no assumption} about the conditional independence or the structure of the attribute classifier. In the general setting the estimated bias and the true bias are related as follows: \begin{theorem} \label{thm:opt-classifier-general} The true bias $\alpha-\beta$ can be derived from $\hat{\alpha}, \hat{\beta}$ as: \begin{align} \alpha-\beta &=\frac{\hat{\alpha}(\frac{s}{r}g_1+1-g_2)(1-\delta_1+\frac{r}{s}\delta_2)}{1-\delta_1-\delta_2} \nonumber \\ &- \frac{\hat{\beta}(1-g_1+\frac{r}{s}g_2)(1+\frac{s}{r}\delta_1-\delta_2)}{1-\delta_1-\delta_2}, \label{eq:true-bias-updates} \end{align} where \begin{align} \label{eq:delta-def} \delta_1 &= \mathbb{P}(\hat{a}=1 | f(x)=1, a=0, y=1), \nonumber \\ \delta_2 &= \mathbb{P}(\hat{a}=0 | f(x)=1, a=1, y=1), \end{align} and $g_1, g_2$ are as defined in Eq.~\eqref{eq:cond-error-def}. \end{theorem} \begin{figure*}[t] \centering \includegraphics[width=2.7in]{fig/al_est.pdf} \hspace{1.2cm} \includegraphics[width=2.65in]{fig/al_direct_est.pdf} \caption{The absolute difference between estimated bias and the true bias, based on different \textbf{active sampling} strategies (left), and based on \textbf{direct estimation} over selected samples using uniform/positive sampling (right). Both are results averaged over $10$ runs with random initialization.} \label{fig:active_learning_bias_est} \end{figure*} \begin{algorithm} \caption{Active Sampling} \begin{algorithmic}[1] \item[] \textbf{Input:} $D_2 = \{(x_1, y_1), \dots, (x_m, y_m)\}$, attribute classifier $h$, parameters $b, w$. \item [] \textbf{Output:} Estimated bias $|\hat{\alpha} - \hat{\beta}|$, tolerance $\epsilon$. \STATE Sample a set of $b$ examples uniformly at random from $D_2$ conditioned on $y=1$ and get their true attributes. Get estimates $\hat{r}$ and $\hat{s}$ using the sampled examples. \STATE Initialize $t=0$ and $g^{(0)}_1, g^{(0)}_2, \delta^{(0)}_1, \delta^{(0)}_2$ to be zero. \FOR{$t=1, \dots$} \STATE Sample a batch of $b$ unlabeled~(i.e. no sensitive attribute information) examples uniformly at random from $D_2$ conditioned on $y=1$. \STATE Sort the examples in ascending order according to the uncertainty of $h$, i.e., $|h(x)-0.5|$. \STATE Obtain true attribute information the first $w$ examples and append to the labeled set of data. Compute $g^{(t+1)}_1, g^{(t+1)}_2, \delta^{(t+1)}_1, \delta^{(t+1)}_2$ on the labeled set using \eqref{eq:cond-error-def} and \eqref{eq:delta-def}. \STATE If $|g_1^{(t+1)} - g_1^{(t)}|, |g_2^{(t+1)} - g_2^{(t)}|, |\delta_1^{(t+1)} - \delta_1^{(t)}|, |g\delta_2^{(t+1)} - \delta_2^{(t)}|$ are all bounded by $\epsilon$ then \textbf{break}. \ENDFOR \STATE Output estimated bias obtained by using \eqref{eq:true-bias-updates} and the above estimates. \end{algorithmic} \label{alg:active-sampling} \end{algorithm} While $r,s$ can be estimated from a small amount of data, we explore sampling strategies for estimating the attribute classifier dependent quantities, namely, $g_1, g_2$ and $\delta_1, \delta_2$. Two natural sampling schemes are: (i) {\em Uniform sampling} where we uniformly sample a set of examples and get their true sensitive attribute information, and (ii) {\em Positive sampling}: where we perform uniform sampling on the subset of examples with $y=1$. We expect positive sampling to perform better than uniform sampling, since the quantities that we are estimating are conditioned on $y=1$. We compare the above two approaches with (iii) an {\em active sampling} approach that involves querying for true sensitive attributes~(conditioned on $y=1$) of examples on which the attribute classifier is the most uncertain (as described in Algorithm~\ref{alg:active-sampling}). For each of the methods, in each iteration, we compute the estimated bias on the UCI Adult test set by using true values of $a$ over the selected samples, and the predicted values $\hat{a}$ from the attribute classifier for the unselected samples, using a sampling batch size of $100$. The results are shown in Figure~\ref{fig:active_learning_bias_est} (left), where we see that the uncertainty based active sampling approach requires significantly less common data to accurately estimate the~bias. Furthermore, we also compare our approach with (iv) {\em Direct estimation}: where we directly estimate the bias~($|\alpha-\beta|$) based on the currently sampled set $S$, i.e., the small amount of common $(y, a)$ on the same test set, using a uniform sampling strategy and a positive sampling strategy. The result is shown in Figure~\ref{fig:active_learning_bias_est} (right). Note that the magnitude in the y-axis is much larger compared to the left figure, indicating that direct estimation using few samples tends to give less reliable estimation of the bias. \section{Introduction} \label{sec:intro} Estimating a machine learning~(ML) model's difference in accuracy for different demographic groups is a challenging task in many applications, in large part due to imperfect or missing demographic data~\cite{holstein2019improving}. Demographic information might be unavailable for many reasons: users may choose to withhold this information (for privacy or other personal preferences), or the dataset may have been constructed for use in a setting where collecting the demographic information of the dataset's subjects was unnecessary, undesirable, or even illegal \cite{zhang2018assessing, weissman2011advancing, fremont2016race}. Responsible ML practitioners and auditors may want to evaluate model performance across different demographic groups even if demographic information was not collected explicitly, and as researchers of fairness we want to enable this. For example, a microlender who builds a model to prescreen applicants for a loan may explicitly avoid maintaining demographic records on applicants, but may also want to ensure that the rate at which their model approves a candidate is nearly independent of the applicant's gender. Can one assess this bias of the model, even when training and validation data do not contain explicit gender information? This presents a common problem: how can one audit the performance of a model for predicting $Y$, \emph{conditioned on demographic information $A$}, when $A$ and $Y$ are observed jointly on little or no data? More formally, consider two datasets $D_1, D_2$, where $D_1$ has features in $X$ and labels in $Y$, and $D_2$ has features in $X$ and demographic information in $A$. How should we use these datasets to evaluate a model $f$'s performance predicting $Y$ conditioned on $A$, for the distribution that generated $D_1$? With no further assumptions, this is impossible: if the two datasets are generated from distributions bearing no resemblance to each other, correlations existing between $X$ and $Y$ (and between $X$ and $A$) may be arbitrarily different for the two distributions. Modelers may still wish to understand if their separate datasets can help them with this estimation problem, and what properties their two datasets might need to have to result in good estimations. One approach, particularly natural for enabling many different teams participating in the development of models without demographic information, is to use proxy attributes as a replacement for the true sensitive attribute. The use of such proxy attributes has been widely used in domains such as health care \cite{brown2016using, fremont2005use} and finance \cite{bureau2014using}. One can view a particular proxy attribute as a coarse {\em attribute classifier} that predicts the sensitive attribute information for a given example. For popular fairness metrics such as equalized odds or demographic parity \cite{calders2009building, zliobaite2015relation,hardt2016equality,zafar2017www}, the sensitive attribute information obtained from the classifier can then be used in conjunction with the predicted label information to get an estimate of the bias of a given model. The advantage of this approach is that it decouples the data requirement, and in particular, the attribute classifier can be trained on a separate dataset without any label information present. On the other hand, such an approach may produce very poor estimates, depending upon how the sources of data relate to one another. Nonetheless, it is interesting to ask what principles should guide the choice of a proxy attribute, or more generally the design of a sensitive attribute classifier, and similarly, what principles should be followed when using such classifiers for bias estimation. In this work, we aim to understand this question. If one wishes to produce the most accurate estimate of the bias term, is the optimal approach to train the attribute classifier to have the highest possible $0/1$ accuracy, or to have similar error rates for each demographic group? It turns out that neither of these criteria alone captures the structure of the {\em optimal} attribute classifier. To demonstrate this, we consider the measurement of violation of {\em equal opportunity}, or true positive rates for different groups \cite{hardt2016equality}, and show that the error in the bias estimates, as a result of using a proxy attribute/attribute classifier depends not only on the error rate of the classifiers but also on how these errors (and the data more generally) are distributed. Our analysis has surprising and counter-intuitive implications -- in certain regimes the optimal attribute classifier is the one that has the most unequal distribution of errors across the two subgroups! Our main contributions are summarized below. \begin{itemize} \item \textbf{Problem formulation:} We formalize and study the problem of estimating the bias of a given machine learning model using data with only label information and model output, and using a separate attribute classifier to predict the sensitive attributes. We call this the {\em demographically scarce} regime. In particular, our setting captures the common practice of using proxy attributes as a replacement for the true sensitive attribute. We experimentally demonstrate that the accuracy of the attribute classifier does not solely capture its effectiveness in bias estimation. \item \textbf{Theoretical analysis:} For the case of the {\em equal opportunity} metric \cite{hardt2016equality}, we present a theoretical analysis under a simplified model. Our analysis completely characterizes the structure of the optimal attribute classifier and shows that the error in the bias estimates depends on the error rate of the classifier as well as the {\em base error rate}, a property of the data distribution. As a result, we show that in certain regimes of the base error rate, the optimal attribute classifier, surprisingly, is the one that has the most unequal distribution of errors among the two subgroups. \item \textbf{Empirical validation:} Our theory predicts natural interventions, aimed at better bias estimation, that can be performed either at the stage of designing the attribute classifier or at the stage of using a given attribute classifier. We study their effectiveness in scenarios where our modeling assumptions hold and their sensitivity to violations of the assumptions. \item \textbf{An active sampling algorithm:} Finally, we propose an active sampling based algorithm for accurately estimating the bias of a model given access to an attribute classifier for predicting the sensitive attribute. Our approach makes no assumption about the structure of the attribute classifier or the data distribution. We demonstrate via experiments on real data that our sampling scheme performs accurate bias estimation using significantly fewer samples in the demographically scarce regime, as compared to other approaches. \end{itemize} While highlighting the need for careful considerations when designing such attribute classifiers, our analysis provides concrete recommendations and algorithms that can be used by ML practitioners. \begin{remark} Inferring demographic information should be done with care, even when used only for auditing a model's disparate treatment. Any estimation of demographics will invariably have inaccuracies. This can be particularly problematic when considering, for example, gender, as misgendering an individual can cause them substantial harm. Furthermore, building a model to infer demographic information purely for internal evaluation leaves open the possibility that the model may ultimately be used more broadly, with possibly unintended consequences. That said, preliminary evidence of bias may be invaluable in arguing for resources to do a more careful evaluation of a machine learning system. For this reason, we believe that methods to estimate the difference in predictive performance across demographic groups can serve as a useful first step in understanding and improving the system's treatment of underserved populations. \end{remark} \section{Related Work} Various fairness metrics of interest have been proposed for classification~\cite{hardt2016equality, dwork2012fairness, pleiss2017fairness, kleinberg2017}, ranking~\cite{celis_fair_ranking, beutel2019fairness}, unsupervised learning~\cite{chierichetti2017fair,samadi2018price, fair_k_center_2019}, and online learning~\cite{joseph2016fairness,jabbari2017fairness,gillen2018online, blum2018preserving}. These notions of fairness are usually categorized as either {\em group fairness} or {\em individual fairness}. In the case of group fairness, training a model to satisfy such fairness metrics and evaluating the metrics on a pre-trained model typically requires access to both the sensitive attribute and the label information on the same dataset. Only recently, ML research has explored the implications of using proxy attributes and the sensitivity of fair machine learning algorithms to this noisy demographic data \cite{gupta2018,lamy2019, awasthi2019equalized, coston2019, schumann2019transfer}. The most related work to ours \cite{chen2019fairness,kallus2020} also study the problem of estimating the bias of predictor $f$ of $Y$ from $X$ as a function of $A$ with few or no samples from the joint distribution over $(X, Y, A)$. In \cite{chen2019fairness} the authors aim to estimate the disparity of a model $f$ predicting $Y$ from $X$, along $A$ by considering predicting $A$ from $X$ via a threshold $q$, and then assuming $A=a$ whenever $P[A = a | X = x] > q$. This can work well with unlimited data from the joint distribution over $A, X$, but can both overestimate and underestimate the bias because of the misclassification of $A$ using said thresholding rules. % The work of \cite{kallus2020} investigates how to perfectly or partially identify the same bias parameter, making few or no assumptions about independence between $A, Y, f$ and $X$. Given that exact identification is usually impossible, the authors describe how to find feasible regions of various disparity measures making very few assumptions about independence between $f, Y, X, A$. Similar to our work, the authors in \cite{kallus2020} study the setting where one has access to a dataset involving $(y,x)$ and another dataset involving $(a,x)$. Given that exact identification is usually impossible, they construct an uncertainty set (confidence interval) for bias estimates assuming access to the Bayes optimal classifier, i.e., the classifier that predicts sensitive attribute according to $P(a|x)$. An important contribution of our paper is to show that the Bayes optimal attribute classifier is not the right classifier in the first place. We demonstrate this via experiments in Table~\ref{tab:model_selection}, Theorem~\ref{thm:bayes-opt-example}, and in fact we go deeper and characterize the structure of the optimal attribute classifier in Theorem~\ref{thm:opt-classifier}~(under assumptions). Our work also explains why the confidence intervals in the experiments of~\cite{kallus2020} are large. In particular, the work of~\cite{kallus2020} focuses only on the setting where there is no common data, hence their confidence regions will never shrink with dataset size due to inherent uncertainty. We however believe that it is practically more relevant to study how we can use a little amount of common data and produce accurate estimates. This motivates our active sampling approach as proposed in Section~\ref{sec:active_sampling}. \section{Setup and Notation} We consider the classification setting where $\mathcal{X}$ denotes the feature space, $\mathcal{Y}$ the label space and $\mathcal{A}$ the sensitive attribute space. For simplicity, we assume $\mathcal{Y} = \{-1,+1\}$ and $\mathcal{A} = \{0,1\}$. Consider two datasets $D_1$ and $D_2$. $D_1$ is drawn from the marginal over $(\mathcal{X}, \mathcal{A})$, of a distribution $P$ over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$. Similarly, $D_2$ is drawn from the marginal over $(\mathcal{X}, \mathcal{Y})$, of a distribution $Q$ over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$. Thus, both datasets contain the same collection of features, $D_1$ contains attribute information, and $D_2$ contains label information. In this setting, given a classifier $f: \mathcal{X} \rightarrow \mathcal{Y}$, we aim to estimate the {\em bias} of $f$: the difference in the performance of $f$ on $Q$ over $A$. In this work we define the bias to be the {\em equal opportunity} metric \cite{hardt2016equality} defined as \begin{align} \label{eq:equal-opportunity} bias_Q(f) &= |\alpha - \beta|, \end{align} where \begin{align}\label{eq:def_true_alpha} \alpha = \mathbb{P}_{(x,a,y) \sim Q} \big(f(x)=1 | y=1, a=1 \big),\\ \beta = \mathbb{P}_{(x,a,y) \sim Q} \big(f(x)=1 | y=1, a=0 \big). \end{align} We consider the {\em demographically scarce} regime where the designer of an attribute classifier has access to $D_1$ and the user of the label classifier has access to $D_2$ and additionally has access to the attribute classifier $h: \mathcal{X} \rightarrow \mathcal{A}$ trained on $D_1$. Here, no party has access to both datasets. We aim to understand how the classifiers $(h,f)$ can be used in combination for accurate bias estimation. From the perspective of the user of an attribute classifier, it is easy to see that no matter what the attribute classifier is, one cannot get any non-trivial estimate of the bias of $f$ without access to some common data drawn from $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$. Here we provide a simple proof of this fact. In particular, we will construct a scenario where there is a fixed attribute classifier $h: \mathcal{X} \to \mathcal{A}$. We will construct two distributions $Q_1, Q_2$ such that the output distribution of the attribute classifier is the same in both the cases. Furthermore, any label classifier trained on just $(x,y)$ pairs will have the same output distribution in both the cases. However, the estimates of the bias when using the attribute classifier will differ wildly. Formally, we have the following proposition. \begin{proposition} \label{prop:lower-bound-stronger} Consider a fixed attribute classifier $h: \mathcal{X} \to \mathcal{A}$ and a fixed learning algorithm ALG for computing a label classifier from a distribution over $\mathcal{X} \times \mathcal{Y}$. Then, there exists two distribution $Q_1, Q_2$ over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$ such that: a) $Q_1, Q_2$ have the same marginals over $\mathcal{X} \times \mathcal{A}$, b) ALG produces the same label classifier $f$ given access to $Q_1$ or $Q_2$, and c) either the label classifier $f$ is the Bayes optimal classifier, or the ratio of the estimated bias~(using $h$) to the true bias of $f$ on either $Q_1$ or $Q_2$ is $0$ or $\infty$. \end{proposition} \begin{proof} Given the learning algorithm ALG for the labels and an attribute classifier $h$, we will construct two distributions $Q_1$ and $Q_2$ over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$ such that the following holds: \begin{itemize} \item $Q_1(\mathcal{X})$ is the same as ${Q_2}(\mathcal{X})$, thereby ensuring that the distribution of $h(x)$ over $Q_1, Q_2$ is the same. \item ${Q_1}(\mathcal{X} \times \mathcal{Y})$ is the same as ${Q_2}(\mathcal{X} \times \mathcal{Y})$, thereby ensuring that ALG produces the same classifier $f$. \item On $Q_1$ the true bias of $f$ is zero and on $Q_2$ the true bias of $f$ is one, thereby ensuring that the ratio of the estimated will be distorted by either zero or $\infty$. \end{itemize} To construct the two distributions fix any marginal distribution over $\mathcal{X} \times \mathcal{Y}$ and let $f$ be any classifier for predicting $y$ given $x$ that is not Bayes optimal. Since $f$ is not Bayes optimal, we can consider two non-empty regions $A=\{f=1, Y=1\}$ and $B=\{f=0, Y=1\}$. Construct $Q_1$ by setting the conditional distribution (conditioned on $A$) of $\mathcal{A}$ to be uniformly distributed and similarly the distribution of $\mathcal{A}$ conditioned on $B$ to be uniformly distributed. Construct $Q_2$ to be such that the conditional distribution of $\mathcal{A}$ on $A$ is entirely supported on $a=1$ and the conditional distribution of $\mathcal{A}$ on $B$ is entirely supported on $a=0$. Now it is easy to see that $f$ has zero bias on $Q_1$ and a bias value of one on $Q_2$. Since the estimated bias using $h$ will result in the same value for $Q_1$ and $Q_2$, in at least one of the cases the distortion must be $0$ or $\infty$. \end{proof} In the next two sections we study the following questions: a) how should one design an attribute classifier?, and b) how can one use an attribute classifier along with minimal common data and perform accurate bias estimation? We will focus on the case of $P=Q$, i.e., both the designer and the user of an attribute classifier have marginals from the same joint distribution. \section{Perspective of the Attribute Classifier Modeler} What properties of the attribute classifier are desirable for bias estimation? At first thought, training the most accurate classifier seems to be a reasonable strategy. However, it is easy to construct instances where using the Bayes optimal attribute classifier does not lead to the most accurate bias estimation. This is formalized in the Theorem below. See Appendix for the proof. \begin{theorem} \label{thm:bayes-opt-example} Let $x_1, x_2$ be binary attributes, $a$ be a binary sensitive attribute and $y$ be a binary class label. Furthermore, let $f$ be a label classifier given by $x_2$, i.e., $f(x_1, x_2, a) = x_2$. Then there exists a joint distribution $Q$ over $(x_1, x_2, a, y)$ tuples such that the bias of $f$ is zero, i.e., $bias_Q(f) = 0$. On the other hand, using the Bayes optimal predictor for the attribute $a$, leads to an estimated bias of one for $f$. \end{theorem} Next, we show that even in practical settings, there is little correlation between the accuracy of the attribute classifier and its effectiveness for bias estimation. Table~\ref{tab:model_selection} contains the result of various attribute classifiers trained on the UCI Adult dataset \cite{Dua:2019}. As can be seen, the accuracy of an attribute classifier is not necessarily correlated with its ability to estimate the true bias of a model. \begin{table}[t] \centering \begin{tabular}{|c|c|c|c|} \hline Attribute Classifier & Test Accuracy & $\hat{\alpha}-\hat{\beta}$ & $\alpha-\beta$\\ \hline \hline Random Forest & 84.46\% & -0.1243 & -0.1149 \\ \hline \hline Logistic Regression (LR) & 84.29\% & -0.1450 & -0.1149\\ \hline LR (M+O+R) & 82.68\% & -0.1200 & -0.1149\\ \hline LR (W+M+O+R) & 83.43\% & -0.1454 & -0.1149\\ \hline LR (W+E+M+O+R) & 83.43\% & -0.1352 & -0.1149\\ \hline \hline SVM & 83.80\% & -0.2045 & -0.1149\\ \hline \hline 1-hidden-layer NN & 83.35\% & -0.1025 & -0.1149\\ \hline \end{tabular} \vspace{0.05in} \caption{Distribution of test accuracies of different attribute (Gender) classifiers, and the resulting estimated biases, over the UCI Adult dataset. $\hat{\alpha}-\hat{\beta}$ is the estimated bias using the attribute classifier and $\alpha - \beta$ is the true bias~(without the absolute value). The label classifier is a fixed Random Forest Classifier to predict income, with $85.79\%$ test accuracy. By default all models are trained with all features except Gender and Income. For the Logistic Regression (LR) model, the names within the bracket indicate which features are used: R: ``Relationship'', E: ``Education", M: ``MaritalStatus", O: ``Occupation", W: ``WorkClass".} \label{tab:model_selection} \vspace{-0.2in} \end{table} In order to gain further understanding, we consider a simplified model where we aim to theoretically characterize the structure of the optimal attribute classifier. In particular, we will consider the setting where the two datasets $D_1$ and $D_2$ are drawn from distributions which are marginals of the same distribution. For an attribute classifier $h: \mathcal{X} \rightarrow \mathcal{A}$, define the conditional errors of $h$ with respect to $a$ as \begin{align}\label{eq:cond-error-def} g_1 &= \mathbb{P}(h(x) \neq a | a=0, y=1),\\ g_2 &= \mathbb{P}(h(x) \neq a | a=1, y=1). \end{align} Here $(x,a)$ is drawn from the marginal of joint distribution over $\mathcal{X} \times \mathcal{Y} \times \mathcal{A}$ from which both $D_1$ and $D_2$ are drawn. Suppose we use $h$ to predict the noisy attributes $\hat{a}$ on $D_2$, and then use these estimates to measure the bias of a label classifier $f$. To simplify our analysis we make the following key assumption. Below we denote $\hat{y}$ to represent the prediction of the label classifier $f$. \noindent \textbf{Assumption I:} Given $y$ and $a$, $\hat{y}$ and $\hat{a}$ are conditionally independent, that is for all $y_1,y_2\in\{-1,+1\}$ and $a_1,a_2\in\{0,1\}$, we have \begin{align} \label{eq:cond_ind_assumption} &\mathbb{P}(\hat{y} = y_1,\hat{a}=a_1| y=y_2, a=a_2) \nonumber\\ &=\mathbb{P}(\hat{y} = y_1| y=y_2, a=a_2)\cdot \mathbb{P}(\hat{a}=a_1| y=y_2, a=a_2). \end{align} Notice that while the above assumption is restrictive, there are practical scenarios where one can expect it to hold. Furthermore, the assumption has been studied in prior works to understand noise sensitivity of post-processing and in-processing methods for building fair classifiers \cite{lamy2019,awasthi2019equalized}. Two settings where such an assumption would hold are as follows. First, this would hold if the attribute classifier uses a set of features that are conditionally independent of the features used by the label classifier. The assumption will also hold if the attribute classifier makes independent errors with a certain probability. This, for instance, might be the case for certain classifiers based upon crowdsourcing. As we will soon see, even under the above simplified setting, the structure of the optimal attribute classifier can defy convention wisdom. Using the attribute classifier $h$, we get estimates $\hat{\alpha}, \hat{\beta}$ of the true values $\alpha, \beta$~(see Eq.~\eqref{eq:def_true_alpha}), where \begin{align*} \hat{\alpha} &= \mathbb{P} (f(x)=1 | y=1, \hat{a}=1),\\ \hat{\beta} &= \mathbb{P} (f(x)=1 | y=1, \hat{a}=0). \end{align*} Under Assumption I, we have the following relationship between the true and the estimated values \begin{align} \label{eq:noisy-estimates} \begin{split} \hat{\alpha} &= \frac{\alpha \mathbb{P}(y=1,a=1)(1-g_2) + \beta \mathbb{P}(y=1,a=0)g_1}{\mathbb{P}(y=1,a=1)(1-g_2) + \mathbb{P}(y=1,a=0)g_1}, \\ % \hat{\beta} &= \frac{\alpha \mathbb{P}(y=1,a=1)g_2 + \beta \mathbb{P}(y=1,a=0)(1-g_1)}{\mathbb{P}(y=1,a=1)g_2 + \mathbb{P}(y=1,a=0)(1-g_1)}. \end{split} \end{align} To see the above we have \begin{align*} \mathbb{P} (f(x)=1 | y=1, \hat{a}=1) &= \frac{A+B}{C+D}, \end{align*} where \begin{align*} A &= \mathbb{P}(f(x)=1 | y=1, a=1,\hat{a}=1) \mathbb{P}(\hat{a}=1|y=1,a=1)\mathbb{P}(y=1,a=1),\\ B &= \mathbb{P}(f(x)=1 | y=1, a=0,\hat{a}=1) \mathbb{P}(\hat{a}=1|y=1,a=0)\mathbb{P}(y=1,a=0),\\ C &= \mathbb{P}(\hat{a}=1|y=1,a=1)\mathbb{P}(y=1,a=1),\\ D &= \mathbb{P}(\hat{a}=1|y=1,a=0)\mathbb{P}(y=1,a=0). \end{align*} The above can be rewritten as \begin{align*} \mathbb{P} (f(x)=1 | y=1, \hat{a}=1) &= \frac{(1-g_2)\mathbb{P}(f(x)=1 | y=1, a=1,\hat{a}=1) \mathbb{P}(y=1,a=1)}{(1-g_2)\mathbb{P}(y=1,a=1)+ g_1\mathbb{P}(y=1,a=0)}\\ &+\;\;\;\; \frac{g_1\mathbb{P}(f(x)=1 | y=1, a=0,\hat{a}=1)\mathbb{P}(y=1,a=0)}{(1-g_2)\mathbb{P}(y=1,a=1) + g_1\mathbb{P}(y=1,a=0)}, \end{align*} with $g_1,g_2$ defined as in \eqref{eq:cond-error-def}. Under Assumption I we have \[\mathbb{P}(f(x)=1 | y=1, a=1,\hat{a}=1)=\alpha \] and \[ \mathbb{P}(f(x)=1 | y=1, a=0,\hat{a}=1)=\beta, \] and hence \begin{align*} \mathbb{P} (f(x)=1 | y=1, \hat{a}=1) &=\frac{(1-g_2)\alpha \mathbb{P}(y=1,a=1)+g_1\beta\mathbb{P}(y=1,a=0)}{(1-g_2)\mathbb{P}(y=1,a=1) + g_1\mathbb{P}(y=1,a=0)}. \end{align*} Similarly, we obtain \begin{align*} \mathbb{P} (f(x)=1 | y=1, \hat{a}=0) &=\frac{g_2 \alpha \mathbb{P}(y=1,a=1) + (1-g_1)\beta\mathbb{P}(y=1,a=0)}{g_2\mathbb{P}(y=1,a=1)+ (1-g_1)\mathbb{P}(y=1,a=0)}. \end{align*} It follows that \begin{align*} |\hat{\alpha} - \hat{\beta}| &= |\mathbb{P}(f(x)=1 | y=1, \hat{a}=1) -\mathbb{P} (f(x)=1 | y=1, \hat{a}=0)|\\ &=\frac{|1-g_1-g_2|}{\big(\frac s r (1-g_1) + g_2\big)\big(\frac r s (1-g_2) + g_1 \big)} \cdot |\alpha - \beta|, \end{align*} where \begin{align*} r = \mathbb{P}(y=1,a=1), \qquad s = \mathbb{P}(y=1,a=0). \end{align*} A simple calculation then shows that the true bias and the estimated bias satisfy \begin{align} \label{eq:bias_correction_formula} |\hat{\alpha} - \hat{\beta}| &= \gamma |\alpha - \beta|, \end{align} where the {\em distortion factor} $\gamma$ is defined as \begin{align}\label{eq:def_E} \gamma = \frac{|1-g_1-g_2|}{\big(\frac s r (1-g_1) + g_2\big)\big(\frac r s (1-g_2) + g_1 \big)} \end{align} with larger values of $\gamma$ corresponding to higher accuracy estimates of bias, and the quantities $r,s$ are defined as \begin{align*} r = \mathbb{P}(y=1,a=1), \qquad s = \mathbb{P}(y=1,a=0). \end{align*} We refer to $r/s$ as the {\em ratio of base rates} and assume that it is bounded in $(0,G)$ for some finite $G$, else there will be no good way to estimate the bias from a finite sample. Notice that if $g_1+g_2$ equals one, then $\gamma$ is zero. In every other case it is not hard to see that $\gamma \in [0,1]$. \begin{remark} Under Assumption I, $|\hat{\alpha} - \hat{\beta}|$ is an \emph{underestimate} of the bias of $f$, and is therefore not an unbiased estimator. This is evident from our derivation, but may not be obvious for someone using empirical value as a stand-in for the true value of bias. \end{remark} Hence, even in the simplified setting of Assumption I, the distortion in the estimated bias depends on the conditional errors of $h$, as well as the ratio of base rates $r/s$. Therefore, to accurately estimate the true bias one not only needs the conditional errors of $h$ but also an estimate of the ratio of base rates. \iffalse Notice that this requires access to some amount of common data from the joint distribution of $(y,a)$. Our first main result is that this is unavoidable unless the label classifier $\hat{y}$ is perfect, or in other words the true bias is $0$. This is formalized in the lower bound below. The above lower bound raises another question, namely, how should one train an optimal attribute classifier in the absence of common information on $(y,a)$. \fi Under Assumption I an optimal attribute classifier should aim to maximize $\gamma$ as defined in \eqref{eq:def_E} (since $\gamma \in [0,1]$). Our next theorem quantifies the structure of the optimal attribute~classifier. \begin{theorem} \label{thm:opt-classifier} Assume that the distribution $P$ is such that the ratio of base rates equals one, i.e., $r=s$. Furthermore, denote an attribute classifier $h$ as a tuple $(g_1, g_2)$ where $g_1$ and $g_2$ denote the conditional errors as defined in \eqref{eq:cond-error-def}. Then, under a given error budget $U$, i.e., $\mathbb{P}(h(x)\neq a, y=1)=U$, the only global maximizers of $\gamma$ as defined in \eqref{eq:def_E} are the attribute classifiers $(0,{U}/{r})$ and $(U/r,0)$ (if $U\leq r$) or $({U}/{r}-1,1)$ and $(1,{U}/{r}-1)$ (if $U\geq r$). \end{theorem} \begin{proof} In case of $r=s$, $\gamma$ as defined in \eqref{eq:def_E} simplifies to \begin{align*} \gamma = \frac{|1-g_1-g_2|}{1-(g_1-g_2)^2}, \end{align*} and the constraint $\mathbb{P}(h(x)\neq a, y=1)=\mathbb{P}(a=0, y=1)g_1 + \mathbb{P}(a=1, y=1)g_2=U$ is equivalent to $g_1 + g_2= \frac{U}{r}$. \vspace{5mm} Our goal is to show that $\argmax_{(g_1,g_2)\in[0,1]^2:\, g_1 + g_2= \frac{U}{r}} \Big( \gamma \Big)$ equals \begin{align*} \{(\max\{{U}/{r}-1,0\},\min\{{U}/{r},1\}),(\min\{{U}/{r},1\},\max\{{U}/{r}-1,0\})\}. \end{align*} \vspace{2mm} Writing $g_2$ in terms of $g_1$, we get that $$ g_2 = \frac{U}{r}-g_1 $$ and $$ \gamma(g_1) = \frac{|1- \frac{U}{r}|}{1-(2g_1 - \frac{U}{r})^2}. $$ The constraint $(g_1,g_2)\in[0,1]^2$ is equivalent to \[g_1\in[\max\{\frac{U}{r}-1,0\},\min\{\frac{U}{r},1\}]. \] We assume that $\frac{U}{r}\leq 2$. Maximizing $\gamma(g_1)$ is equivalent to maximizing $(2g_1-\frac{U}{r})^2$, and the maximum of the latter function is attained both at $g_1=\max\{\frac{U}{r}-1,0\}$ and $g_1=\min\{\frac{U}{r},1\}$, which correspond to $g_2=\min\{\frac{U}{r},1\}$ and $g_2=\max\{\frac{U}{r}-1,0\}$, respectively. \end{proof} \begin{figure*}[t] \centering \includegraphics[width=2in]{fig/gamma_plot_r_s_1.pdf} \includegraphics[width=2in]{fig/gamma_plot_r_s_2.pdf} \includegraphics[width=2.65in]{fig/gamma_plot_r_s_0_5.pdf} \vspace{-0.15in} \caption{The distortion factor~$\gamma$ as a function of $g_1$ for different $r/s$ and under different error budgets $U=sg_1+rg_2$ for the attribute classifier. Apparently, $\gamma$ always attains its maximum either at the smallest or the largest possible value of $g_1$.} \label{fig:gamma_plot_w_base_rate} \end{figure*} \begin{figure*}[t] \centering \includegraphics[width=4.7in]{fig/NewFifa20_boxplots_Version1.pdf} \caption{Experiment on the FIFA 20 player dataset---independence assumption~\eqref{eq:cond_ind_assumption} holds. Absolute difference between the true bias and the estimated bias for direct (Dir) and corrected~(Cor) estimation, when 100 to 250 points of common data over $(y,a)$ are available, and for naive (Naive) estimation. } \label{fig:exp_fifa_dataset} \end{figure*} The above theorem implies that even under simplifying assumptions, the structure of the optimal attribute classifier is counter-intuitive: to estimate bias as accurately as possible, one may want to distribute the errors of the given attribute classifier as unevenly as possible! Hence, great care must be taken when designing the attribute classifier for the purpose of bias estimation. Furthermore, while we only consider the case $r=s$, Figure~\ref{fig:gamma_plot_w_base_rate} shows the distortion factor~$\gamma$ as a function of $g_1$ for a fixed error budget $U$ also when $r\neq s$ (middle and right plot). As we can see, also then $\gamma$ attains its maximum either at the smallest or the largest possible value of $g_1$, which corresponds to distributing the error among the two groups as unevenly as possible. \input{experiment_arxiv.tex} \section{Discussion and Conclusion} We formalized and studied a commonly occurring scenario in fairness evaluation and auditing namely, the lack of common data involving both the class labels and sensitive attributes. Our experiments and theoretical analysis reveal that great care must be taken in designing attribute classifiers for the purpose of bias estimation. Furthermore, in certain scenarios, the structure of the optimal attribute classifier can be contradictory to natural criteria such as accuracy and fairness. From the perspective of the designer of the attribute classifier, maximizing the distortion factor as in \eqref{eq:def_E} is a challenging optimization problem. It would be interesting to explore efficient algorithms for solving this. Throughout our analysis we assume that the datasets $D_1, D_2$ are sampled from the same distribution. It would be interesting to extend our theory to the more realistic case of when the dataset distributions are different. Finally, it would also be interesting to provide theoretical guarantees for the active sampling scheme in Algorithm~\ref{alg:active-sampling}.
\section{\label{sec:AppA} UBOS Applied to Popular Gates} Here we demonstrate how to extend UBOS to commonly used gates, which are particular cases of the generic two-qubit unitary treated in the main text. \subsection{$U3$ Gate} The one-qubit $U3$ gate \begin{equation} U3 (\theta, \lambda, \phi) = \begin{bmatrix} cos(\theta/2) & -e^{i\lambda}sin(\theta/2) \\ e^{i\phi}sin(\theta/2) & e^{i(\lambda+\phi)}cos(\theta/2) \end{bmatrix} \label{U3eq} \end{equation} is, up to a phase, able to represent any single-qubit unitary operation and requires all four single-qubit Pauli matrices in our representation. \begin{equation} U_3=\sum_{\alpha=0}^{3}t^{\alpha}\sigma^{\alpha} \text{,} \end{equation} where $\sigma^0 = I$, $\sigma^1 = X$, $\sigma^2 = Y$, and $\sigma^3 = Z$. The resulting subspace problem analogous to Eq. \eqref{EtHt} requires a 4x4 Hermitian matrix with 10 unique matrix elements. \subsection{$CU3$} Not all gates require all Pauli strings in order to construct them. Here we demonstrate that for a controlled one-qubit gate. The $CU3$ gate \begin{equation} CU3 (\theta, \lambda, \phi) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & cos(\theta/2) & -e^{i\lambda}sin(\theta/2) \\ 0 & 0 & e^{i\phi}sin(\theta/2) & e^{i(\lambda+\phi)}cos(\theta/2) \end{bmatrix} \end{equation} can be constructed from the 8 Pauli strings that share non-zero matrix elements with $CU3$: \begin{equation} \begin{split} P_{00}= \begin{bmatrix} 1\phantom{-} & 0\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 1\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 1\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 0\phantom{-} & 1\phantom{-} \end{bmatrix} P_{01}= \begin{bmatrix} 0\phantom{-} & 1\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 1\phantom{-} & 0\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 0\phantom{-} & 1\phantom{-} \\ 0 \phantom{-}& 0\phantom{-} & 1\phantom{-} & 0\phantom{-} \end{bmatrix} \\ P_{02}= \begin{bmatrix} 0\phantom{-} & -i & 0\phantom{-} & 0\phantom{-} \\ i\phantom{-} & 0\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 0\phantom{-} & -i \\ 0\phantom{-} & 0\phantom{-} & i\phantom{-} & 0\phantom{-} \end{bmatrix} P_{03}= \begin{bmatrix} 1\phantom{-} & 0\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & -1 & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 1\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 0\phantom{-} & -1 \end{bmatrix} \\ P_{30}= \begin{bmatrix} 1\phantom{-} & 0\phantom{-} & 0\phantom{-} & 0\phantom{-}\\ 0\phantom{-} & 1\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & -1 & 0\phantom{-}\\ 0\phantom{-} & 0\phantom{-} & 0\phantom{-} & -1 \end{bmatrix} P_{31}= \begin{bmatrix} 0\phantom{-} & 1\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 1\phantom{-} & 0\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 0\phantom{-} & -1 \\ 0\phantom{-} & 0\phantom{-} & -1 & 0\phantom{-} \end{bmatrix} \\ P_{32}= \begin{bmatrix} 0\phantom{-} & -i & 0\phantom{-} & 0\phantom{-} \\ i\phantom{-} & 0\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 0\phantom{-} & i\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & -i & 0\phantom{-} \end{bmatrix} P_{33}= \begin{bmatrix} 1\phantom{-} & 0\phantom{-} & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & -1 & 0\phantom{-} & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & -1 & 0\phantom{-} \\ 0\phantom{-} & 0\phantom{-} & 0\phantom{-} & 1\phantom{-} \end{bmatrix} \end{split} \end{equation} The resulting subspace problem analogous to Eq. \ref{EtHt} requires an 8x8 Hermitian matrix and the measurement of 40 unique matrix elements. We could further constrain the subspace where $CU3$ gate is contained. In particular, it is contained in the subspace of operators spanned by the following basis of operators: \begin{align} R^0 &= CU3(0, 0, 0)= \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \\ R^1 &= CU3(0, \pi / 2, \pi / 2)= \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix} \\ R^2 &= CU3(2 \pi, \pi, 0)= \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & 1 \\ 0 & 0 & 1 & 0 \end{bmatrix} \\ R^3 &= CU3(2 \pi, 0, 0) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 0 & -1 \\ 0 & 0 & 1 & 0 \end{bmatrix} \\ R^4 &= CU3(2 \pi, 0, 0) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix} \text{,} \end{align} which would generate a $\tilde{H}$ matrix of size $5 \cross 5$, which requires 15 unique matrix elements, compared to 136 for a generic two qubit gate. \subsection{U3 $\otimes$ U3} A common, hardware-efficient gate set is a CNOT gate followed by a U3 gate on the control qubit and on the target qubit. In order to optimize this gate, we optimize U3 $\otimes$ U3 acting on the control and target qubit. For this gate, one must measure the full 16x16 Hermitian matrix $\hat{H}$. In addition to the unitarity constraint, one must also further constrain $\mathbf{t}$ so that the sum of the pauli strings remains equal to a U3 $\otimes$ U3 gate. \subsection{fSim($\theta$, $\phi$)} Another important gate in modern quantum computers is the fSim gate. \begin{equation} \label{fsim} {\rm fSim}(\theta,\phi) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos{\theta} & -i\sin{\theta} & 0 \\ 0 & i\sin{\theta} & \cos{\theta} & 0 \\ 0 & 0 & 0 & e^{-i\phi} \end{bmatrix} \end{equation} Just like in the CU3 gate case, we notice that not all the two qubit Pauli strings have overlap with the fSim($\theta$,$\phi$) gate. Here we only need $P^{00},P^{03},P^{11},P^{12},P^{21},P^{22},P^{30}$ and $P^{33}$ to represent the gate in our sum of Pauli strings. Again, in order to optimize the gate, we need an 8x8 Hermitan matrix and 40 unique matrix elements. We could further constrain the subspace where the fSim($\theta$, $\phi$) is contained. In particular, it is contained in the subspace of operators spanned by the following basis of operators: \begin{align} R^0 &= {\rm fSim}(0, 0)= \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \\ R^1 &= {\rm fSim}(0, \pi)= \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 1 & 0 & 0 \\ 0 & 0 & 1 & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix} \\ R^2 &= {\rm fSim}(\pi, 0)= \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & -1 & 0 & 0 \\ 0 & 0 & -1 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \\ R^3 &= {\rm fSim}(\pi / 2, 0) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & 0 & -i & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \text{,} \end{align} which would generate a $\tilde{H}$ matrix of size $4 \cross 4$, which requires 10 unique matrix elements, compared to 136 for a generic two qubit gate. We note that many gates may be able to be represented with fewer linearly independent unitary matrices than the naive use of Pauli matrices as we have demonstrated for $CU3$ and fSim. \section{\label{sec:AppB} Quantum Circuits Used in Simulations} Here we demonstrate the approach and quantum circuits for measuring the ansatz gradients, $\frac{dE}{d\boldsymbol{\theta}}=\frac{\bra{\Psi(\boldsymbol{\theta})}\hat{H}\ket{\Psi(\boldsymbol{\theta})}}{d\boldsymbol{\theta}}$, and the matrix elements $\tilde{H}^{\alpha\beta\alpha'\beta'}=\bra{\Psi(\boldsymbol{\theta})_{j}^{\alpha'\beta'}}\hat{H}\ket{\Psi(\boldsymbol{\theta})_{j}^{\alpha\beta}}$ where $\ket{\Psi(\boldsymbol{\theta})_{j}^{\alpha\beta}}$ is the ansatz $\ket{\Psi(\boldsymbol{\theta})}$ with the jth gate replaced by $P_{j}^{\alpha\beta}$. We have included the implicit reference to the circuit parameters, $\boldsymbol{\theta}$, in our discussion for this section. We note that while we show how to use a Hadamard test circuit to measure expectation values of local operators there are other measurement schemes in the literature \cite{mitarai_methodology_2019,guerreschi_practical_2017}. \subsection{Analytic Gradients for Generic Unitary Circuit Ansatz} Using the Cartan (KAK) decomposition for $U \in SU(4)$ \cite{tucci_introduction_2005}, we can write our two qubit, 15 real parameter unitary operator as: \begin{equation} U=(A_0 \otimes A_1)(e^{-i\vec{k} \cdot\vec{\Sigma}})(B_0 \otimes B_1) \end{equation} where $A_0$, $A_1$, $B_0$ and $B_1$ $\in SU(2)$ (in our case parameterized as Eq. \eqref{U3eq}), $\vec{k} \in \mathbb{R}^{3}$ and $\vec{\Sigma} = (P^{00},P^{11},P^{22})$. Using the KAK decomposition, we find an analytical expression for Eq.~\ref{paulidecomp} where the summation coefficients, $t_j^{\alpha\beta}(\boldsymbol{\theta}_j)$, are functions of the 15 circuit parameters specifying the jth gate. We use Python's SymPy package to find analytical expressions for the derivative of $U_j$ with respect to $\boldsymbol{\theta}_j$ as: \begin{equation} \frac{dU}{d\boldsymbol{\theta}_j}=\sum_{\alpha,\beta=0}^{3}{\frac{dt_j^{\alpha\beta}(\boldsymbol{\theta}_j)}{d\boldsymbol{\theta}_j}P^{\alpha\beta}} \end{equation} The expression for the gradients of the jth gate then becomes \begin{equation} \begin{split} \frac{dE}{d\boldsymbol{\theta}_j}&=\frac{\bra{\Psi(\boldsymbol{\theta})}\hat{H}\ket{\Psi(\boldsymbol{\theta})}}{d\boldsymbol{\theta}} \\ &=2\Re\left(\mel{\Psi(\boldsymbol{\theta})}{\hat{H}}{\frac{\Psi(\boldsymbol{\theta})}{d\boldsymbol{\theta}_j}} \right) \\ &=2\Re\left(\sum_{\alpha,\beta=0}^{3}\frac{dt_j^{\alpha\beta}(\boldsymbol{\theta}_j)}{d\boldsymbol{\theta}_j}\mel{\Psi(\boldsymbol{\theta})}{\hat{H}}{\Psi(\boldsymbol{\theta})_{j}^{\alpha\beta}} \right) \end{split} \label{gradequation} \end{equation} By measuring the 16 expectation values in Eq. \eqref{gradequation}, one can compute the gradients jth gate. In Fig.~\ref{fig:gradmeasurecircuit} we show how to measure the expectation values with an example Hadamard test circuit. \begin{figure}[htp] \begin{tabular}{c} \Qcircuit @C=1.4em @R=1.4em { \lstick{\ket{0}} & \multigate{1}{U_0} & \qw & \multigate{1}{U_5} & \qw & \qw & \qw & \multigate{1}{U_5^\dag} & \qw & \qw \\ \lstick{\ket{0}} & \ghost{U_0} & \multigate{1}{U_3} & \ghost{U_5} & \multigate{1}{U_8} & \qw & \multigate{1}{U_8^\dag} & \ghost{U_5^\dag} & \qw & \qw \\ \lstick{\ket{0}} & \multigate{1}{U_1} & \ghost{U_3} & \multigate{1}{U_6} & \ghost{U_8} & \multigate{1}{\hat{O}} & \ghost{U_8^\dag} & \multigate{1}{U_6^\dag} &\qw & \qw \\ \lstick{\ket{0}} & \ghost{U_1} & \multigate{1}{P_4^{\alpha\beta}} & \ghost{U_5} & \multigate{1}{U_{9}} & \ghost{\hat{O}} & \multigate{1}{U_9^\dag} & \ghost{U_6^\dag} & \multigate{1}{U_4^\dag/P_4^{\alpha'\beta'}} & \qw\\ \lstick{\ket{0}} & \multigate{1}{U_2} & \ghost{P_4^{\alpha\beta}} & \multigate{1}{U_7} & \ghost{U_{9}} & \qw & \ghost{U_9^\dag} & \multigate{1}{U_7^\dag} & \ghost{U_4^\dag/P_4^{\alpha'\beta'}} & \qw \\ \lstick{\ket{0}} & \ghost{U_2} & \qw & \ghost{U_7} & \qw & \qw & \qw & \ghost{U_7^\dag} & \qw & \qw \\ \lstick{\ket{0}} & \gate{H} & \ctrl{-2} & \qw & \qw & \ctrl{-3} & \qw & \qw & \ctrl{-2} & \gate{S^b} & \gate{H} & \qw & \expval{Z} } \end{tabular} \caption{Quantum circuit for the measurement of an operator gradient, $\mel{\Psi(\boldsymbol{\theta})}{\hat{O}}{\frac{\Psi(\boldsymbol{\theta})^{\alpha\beta}}{d\boldsymbol{\theta}_j}}$, and an operator subspace matrix element $\mel{\Psi(\boldsymbol{\theta})_{j}^{\alpha'\beta'}}{\hat{O}}{\Psi(\boldsymbol{\theta})_{j}^{\alpha\beta}}$. The controlled $U_4$ gate is used when measuring the gradient while the controlled $P^{\alpha'\beta'}$ is used for the matrix elements. The measurement circuit shown is an example for j = 4 and a 6 qubit, 4 layer ansatz. When b = 0 (b=1), the real (imaginary) part of the expectation values are estimated by $-\expval{Z}$.} \label{fig:gradmeasurecircuit} \end{figure} \subsection{Matrix Elements and Quantum Circuits for UBOS} For UBOS, we must compute the matrix elements of $\tilde{H}$ (Eq. \eqref{Htilde}). For an arbitrary unitary $U \in SU(4)$, we measure the 136 unique elements, $\Tilde{H}^{\alpha'\beta'\alpha\beta} = \mel{\Psi(\boldsymbol{\theta})_{j}^{\alpha'\beta'}}{\hat{H}}{\Psi(\boldsymbol{\theta})_{j}^{\alpha\beta}}$. In Fig. \ref{fig:gradmeasurecircuit} we show to to measure these expectation values with an example Hadamard test circuit. \section{\label{sec:AppC} Counting Expectation Values Needed} \begin{figure} \centering \includegraphics[width=0.8\linewidth]{figs/class_opt.pdf} \caption{Single gate optimization comparison. After 100 UBOS gate optimizations on a 12 site 7 layer ansatz for the 1D XXZ model. We show the results for the lowest energy found by 4 different optimizers (conjugate gradient descent (CGD), Nelder-Mead (NM), Powell and SGD) acting on a single gate using UBOS. We note that SGD can either be implemented using quantum measurements of the gradients or using UBOS with $\hat{H}$. For our UBOS numerical experiments, we use NM as our classical optimizer because it regularly performed better than CGD and Powell. One could also choose to do SGD using $\hat{H}$. As in the figure, this occasionally outperforms NM but usually at a higher classical computational cost.} \label{fig:class_opt} \end{figure} We calculated the number of measurement circuit expectation values needed, $N_{evn}$, for an optimization run as \begin{equation} N_{evn}=N_{epochs} \times N_{\hat{H}_{meas}} \times N_{operators} \end{equation} where $N_{epochs}$ is the number of training epochs, $N_{\hat{H}_{meas}}$ is the number of matrix elements/gradients with the Hamiltonian and $N_{operators}$ is the number of unique local operators in the Hamiltonian. We note that different strategies for grouping Hamiltonian operators can reduce the number of distinct circuits needed to calculate Hamiltonain expectation values \cite{kokail_self-verifying_2019,fizmaylov_revising_2019,gokhale_on3_2020}. \section{\label{sec:AppD} Single Gate Optimizer Comparison} In order to better understand the potential advantage offered by UBOS, we used UBOS to optimize a 12 site 7 layer ansatz for our 1D XXZ model. In the midst of the optimization, we then performed SGD on a single gate and compared with a single UBOS step using different classical optimizers to solve Eq. \ref{EtHt} (Fig. \ref{fig:class_opt}). We find in this example (and others not shown) that classically optimizing with both SGD and Nelder-Mead outperforms other classical optimization techniques. In practice, we find SGD reaches lower in energy at significant classical computation cost. It is an interesting open question to further explore classical optimization methods to determine better approaches to optimizing for UBOS. Notice that despite the fact that SGD was best classically, it is still superior to do it classically in this UBOS context instead of doing quantum SGD since it requires significantly fewer measurements. When comparing against doing SGD with all the gates, we find only two orders of magnitude difference between the number of steps required to converge to similar energy (see Fig. \ref{fig:14n7layers}) compared to the three orders of magnitude we see for a single gate. Doing SGD with all the gates is more efficient than a single gate at a time because there are marginal returns toward the end of a single-gate optimization. Because of the unitary constraints imposed on our variational ansatz, finding the parameters that minimize Eq.~\ref{EtHt} is a nonlinear problem. We find that the choice of classical optimizer can affect the minima found (Fig.~\ref{fig:class_opt}). We also find that our classical optimizers often have trouble finding the exact minima and that adding a small amount of Gaussian noise to the matrix elements of $\tilde{H}$ can sometimes result in our optimizer finding a lower energy solution (Fig.~\ref{fig:onestep}), especially at the beginning of optimization. In Fig~\ref{fig:param_opt}, we examine the distribution of an optimized gate parameter when noise has been added to the matrix elements of $\tilde{H}$. The distribution of this single parameter is multimodal in the presence of a small amount of noise indicating that the optimization problem is nonlinear. Following this set of non-linear steps appears to eventually reach a local minimum in this space. \begin{figure} \centering \includegraphics[width=0.8\linewidth]{figs/parameter_opt0.pdf} \caption{Plot for an optimized parameter of a gate after an UBOS optimization step. We randomly initialize a 12 site 7 layer ansatz and perform a single UBOS step for the XXZ 1D model. For the same randomly initialized ansatz, we optimize 1000 instances of $\tilde{H}$ with added Gaussian noise, $\sigma$, added to the matrix elements.} \label{fig:param_opt} \end{figure} \section{Generalization of UBOS: Partially Optimizing Many Gates at Once} \label{sec:large_unitaries} In this work, we have applied UBOS to the subspace spanned by linearly independent matrices that fully contains the manifold defining a particular parameterized gate (such as $U4$, fSim, or $CU3$ gates). In this section we show how UBOS can be generalized to \emph{partially} optimize large unitaries which can include a large number of gates and a large number of qubits, at a much lower cost than the naive $4^{\# {\rm qubits}}$ scaling. While we have not explored this method in the present work, it would be interesting to study it in future works, since it could have potential advantages avoiding local minima and other difficult optimization landscapes. \subsection{Algorithm} Let us have a parameterized unitary operator defined over a Hilbert space of dimension $2^n$, $U(\theta_1, \ldots, \theta_p)$, where $\{ \theta_i\}$ are real parameters. Similar to Eq.~\eqref{paulidecomp}, $U$ can be decomposed as: \begin{align} \label{large_U_decomp} U(\theta_1, \ldots, \theta_p) = \sum_{\vec{\alpha}} r^{\alpha}(\theta_1, \ldots, \theta_p) R^{\alpha} \end{align} where $R^{\alpha}$ is a basis of operators. In most of the present work, the elements in this basis are Pauli strings, but this is not a necessary condition for UBOS to work. While applying UBOS directly to this unitary requires building a $\tilde{H}$ matrix of size $4^n \cross 4^n$, we can instead focus on a subspace $V$ spanned by a small subset of Pauli strings, $S$: $V = {\rm span}\{ R^{\alpha} : R^{\alpha} \in S \}$. In general, subspace $V$ may only contain a sub-manifold of $U(\theta_1, \ldots, \theta_p)$, $\tilde{U}(\phi_1, \ldots, \phi_q)$, with $q \leq p$. We can then optimize all parameters $\{ \phi_i \}$ at once after building a matrix $\tilde{H}$ of size $|S| \times |S|$. In practice, unitary $U$ can be comprised of a large set of gates in our parameterized quantum circuit. These gates can act on many qubits or could even be applied repeatedly over a set of qubits at different stages of the circuit. The manifold defined by $U(\theta_1, \ldots, \theta_p)$ is therefore the tensor product of the manifolds defined by each parameterized gate. One should be careful when choosing the optimization subspace, $V$, for two reasons. First, it is not guaranteed that the intersection of manifold $U$ with $V$ is not empty. In general, it is advantageous to choose a small dimensional space $V$ that contains a manifold with as many independent parameters as possible. Second, one should keep in mind if it is desired to have $V$ contain the starting point of the optimization, \emph{i.e.}, $U(\bar{\theta_1}, \ldots, \bar{\theta_p})$, where $\{\bar{\theta_1}, \ldots, \bar{\theta_p}\}$ is the set of parameters found in the previous iteration. If that is the case, it is easy to solve this problem by just including $U(\bar{\theta_1}, \ldots, \bar{\theta_p})$ as one of the vectors in the basis. Note that this does not guarantee that the intersection of this manifold with $V$ is a sub-manifold with dimension larger than zero. \subsection{Example} For illustration purposes, let us work out a concrete example of this general procedure. Let $U(\theta_1, \theta_2, \phi_1, \phi_2)$ be the tensor product of two fSim gates of Eq.~\eqref{fsim} over four qubits: one over qubits labelled 1 and 2, and the other over qubits labelled 3 and 4. In general, the optimization of a four qubit unitary would imply the construction of a $\tilde{H}$ of size $4^8 \times 4^8$. However, if we focus on a dimension 4 subspace $V$ spanned by the 4 tensor products of operators $A$ and $B$: \begin{align} A_j &= {\rm fSim}(\bar{\theta_j},\bar{\phi_j}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos{\bar{\theta_j}} & -i\sin{\bar{\theta_j}} & 0 \\ 0 & i\sin{\bar{\theta_j}} & \cos{\bar{\theta_j}} & 0 \\ 0 & 0 & 0 & 1 \end{bmatrix} \\ B_j &= {\rm fSim}(\bar{\theta_j},\bar{\phi_j}) = \begin{bmatrix} 1 & 0 & 0 & 0 \\ 0 & \cos{\bar{\theta_j}} & -i\sin{\bar{\theta_j}} & 0 \\ 0 & i\sin{\bar{\theta_j}} & \cos{\bar{\theta_j}} & 0 \\ 0 & 0 & 0 & -1 \end{bmatrix} \text{,} \end{align} \emph{i.e.}, if we have a basis of operators $S = \{ R^0 \equiv A_{1, 2} \otimes A_{3, 4}, R^1 \equiv A_{1, 2} \otimes B_{3, 4}, R^2 \equiv B_{3, 4} \otimes A_{1, 2}, R^3 \equiv B_{1, 2} \otimes B_{3, 4} \}$, where each operator $A$ or $B$ is applied to either the tuple of qubits $\{ 1, 2 \}$ or $\{ 3, 4 \}$, then we can optimize angles $\phi_{1, 2}$ and $\phi_{3, 4}$ simultaneously by building a matrix of size $4 \cross 4$, with only 10 independent entries. An optimization in this subspace allows us to optimize $\phi_{1, 2}$ and $\phi_{3, 4}$ while keeping $\theta_{1, 2}$ and $\theta_{3, 4}$ fixed. In this example, the coefficients $\{r^i\}$ are given by: \begin{align} \label{solution_example} r^0 &= \left(\frac{1 + e^{-i\phi_{1, 2}}}{2}\right) \left( \frac{1 + e^{-i \phi_{3, 4}}}{2}\right) \\ r^1 &= \left(\frac{1 + e^{-i\phi_{1, 2}}}{2}\right) \left( \frac{1 - e^{-i \phi_{3, 4}}}{2}\right) \\ r^2 &= \left(\frac{1 - e^{-i\phi_{1, 2}}}{2}\right) \left( \frac{1 + e^{-i \phi_{3, 4}}}{2}\right) \\ r^3 &= \left(\frac{1 - e^{-i\phi_{1, 2}}}{2}\right) \left( \frac{1 - e^{-i \phi_{3, 4}}}{2}\right) \end{align} and the subspace $V$ includes the starting point $(\bar{\theta}_{1, 2}, \bar{\theta}_{3, 4}, \bar{\phi}_{1, 2}, \bar{\phi}_{3, 4})$, which is given by evaluating Eqs.~\eqref{solution_example} at $(\bar{\phi}_{1, 2}, \bar{\phi}_{3, 4})$. \subsection{When is this procedure advantageous?} While applying this procedure to the optimization of a parametrized circuit is more complicated than the UBOS procedure explored in this paper, its application could provide some benefits. In the case that the simpler version of UBOS gets stuck in a local minimum, switching momentarily to this procedure, in order to optimize different sets of parameters at once, possibly comprising a set of gates defined over a larger number of qubits, could help get out of this minimum. Furthermore, the flexibility in choosing subspace $V$ lets us try to find sub-manifolds of $U$ that, while have many free parameters, are contained in as low dimensional a subspace as possible. This can give rise to more frugal optimization procedures than the naive parameterization of gates imposes. \section{UBOS on a Manifold of Arbitrary Parameters} Here we describe another viewpoint for using an UBOS-like algorithm to optimize an arbitrary subset of parameters ${\Phi} \equiv \{\phi_1,...\phi_r\}$ which specify the wave-function generated by a quantum circuit $\ket{\Psi({\Phi)}}$. We use as a basis for this manifold $k$ randomly selected wave-functions $\ket{\Psi({\Phi_1)}},\ket{\Psi({\Phi_2)}},...,\ket{\Psi({\Phi_k)}}$ where $k$ is chosen to be sufficiently large that the basis spans the full manifold. Generic points from this manifold are likely to be linearly independent and so will form a (non-orthogonal) basis. To determine $k$ we simply keep adding states to our basis until their rank saturates. This rank can be determined in various ways: (1) evaluating it classically by expanding each $\ket{\Psi({\Phi_i)}}$ into a Pauli basis over the gates which are spanned by the parameters $\Phi_i$; (2) compute the rank of the overlap matrix $S$ whose matrix elements $S_{ij}=\braket{\Psi({\Phi_i)}}{\Psi({\Phi_j)}}$ can be evaluated by quantum circuits. Given the basis, as in UBOS, we generate the effective Hamiltonian $\tilde{H}$ in that basis evaluating each matrix element $\tilde{H_{ij}} = \bra{\Psi({\Phi_i)}}\hat{H}\ket{\Psi({\Phi_j)}}$ with a quantum circuit. Alternatively, we can compute (enough of) $\tilde{H}$ by using the least-squares approach described in \ref{sec:HfromEs} on random states in our manifold. In this latter case, one can just choose random states until $\tilde{H}$ stabilizes and not separately generate a basis of full rank. Given the effective Hamiltonian $\tilde{H}$ in our basis, one can optimize as in standard UBOS by classically searching over random states in the $\Phi$ manifold and computing and optimizing their energy using $\tilde{H}$. The only subtlety is one needs to evaluate the overlap between the basis elements and arbitrary states in the manifold $\braket{\Psi({\Phi_i)}}{\Psi({\Phi)}}$ for arbitrary $\Phi$ to accomplish this. This can be done but might (in specific scenarios) involve large classical cost. (While this could be done at reasonable quantum cost, since it needs to be done at each step of the optimization this would result in a process that's much closer to SGD where the full energy landscape of a subset of parameters couldn't be evaluated classically without constant re-evaluation on the quantum computer). \section{\label{sec:HfromEs} Finding $\tilde{H}$ from a System of Equations} Previously we demonstrated how to find the effective Hamiltonian, $\tilde{H}$ by measuring each matrix element of $\tilde{H}$ with a quantum circuit of depth at most $2d$. Here we describe an alternative approach which uses only circuits of depth $d$, but whose resilience to stochastic noise is to be explored in future work. The high level ideas of this approach is as follows. In Eq.~\ref{EtHt} of the main text, the matrix elements in $\tilde{H}$ are linear unknowns. Therefore, one can measure the energy, $E(\theta_1, \ldots, \theta_p)$, for different, randomly chosen $(\theta_1, \ldots, \theta_p)$ and construct a linear system of equations that one can use to solve for the matrix elements in $\tilde{H}$. In the rest of the section we more explicitly describe this approach. Note that, similar to Eq.~\ref{EtHt} of the main text, the energy functional can always be written as a quadratic form in the entries of the vector $\mathbf{t_j}(\theta_1, \ldots, \theta_p)$. In particular: \begin{align} \label{quadratic_E} E(\theta_1, \ldots, \theta_p) = &\sum_{\alpha, \alpha^\prime} t_j^\alpha(\theta_1, \ldots, \theta_p) \tilde{H}^{\alpha \alpha^\prime} t_j^{\alpha^\prime}(\theta_1, \ldots, \theta_p) \nonumber \\ = &\sum_\alpha t_j^\alpha(\theta_1, \ldots, \theta_p) t_j^\alpha(\theta_1, \ldots, \theta_p)^* \tilde{H}^{\alpha \alpha} \nonumber \\ &+ \sum_{\alpha < \alpha^\prime} \left\{ {\rm Re}[t_j^\alpha(\theta_1, \ldots, \theta_p) t_j^{\alpha^\prime}(\theta_1, \ldots, \theta_p)^*] {\rm Re}[\tilde{H}^{\alpha \alpha^\prime}] \right. \nonumber \\ &\left.- {\rm Im}[t_j^\alpha(\theta_1, \ldots, \theta_p) t_j^{\alpha^\prime}(\theta_1, \ldots, \theta_p)^*] {\rm Im}[\tilde{H}^{\alpha \alpha^\prime}] \right\} \text{,} \end{align} where, due to the hermiticity of $\tilde{H}$, $\tilde{H}^{\alpha \alpha}$ is a real number . We now define $t_{j, R}^{\alpha \alpha^\prime}(\theta_1, \ldots, \theta_p) \equiv {\rm Re}[t_j^\alpha(\theta_1, \ldots, \theta_p)t_j^{\alpha^\prime}(\theta_1, \ldots, \theta_p)^*]$ and $t_{j, I}^{\alpha \alpha^\prime}(\theta_1, \ldots, \theta_p) \equiv {\rm Im}[t_j^\alpha(\theta_1, \ldots, \theta_p)t_j^{\alpha^\prime}(\theta_1, \ldots, \theta_p)^*]$. Eq.~\eqref{quadratic_E} can be rewritten as: \begin{align} \label{E_functional} E(\theta_1, \ldots, \theta_p) = \sum_{\alpha \leq \alpha^\prime} \left\{t_{j, R}^{\alpha \alpha^\prime}(\theta_1, \ldots, \theta_p) {\rm Re}[\tilde{H}^{\alpha \alpha^\prime}] + t_{j, I}^{\alpha \alpha^\prime}(\theta_1, \ldots, \theta_p) {\rm Im}[\tilde{H}^{\alpha \alpha^\prime}] \right\} \text{,} \end{align} where $t_{j, I}^{\alpha \alpha} = 0$ and $\tilde{H}^{\alpha \alpha} = 0$. Every set of parameters $(\theta_1, \ldots, \theta_p)$ defines a circuit whose energy can be measured with circuits of depth $d$, $E(\theta_1, \ldots, \theta_p)$, and lets us write a linear equation in the unknowns ${\rm Re}[\tilde{H}^{\alpha \alpha^\prime}]$ and ${\rm Im}[\tilde{H}^{\alpha \alpha^\prime}]$. Given $D$ pairs $((\theta_1, \ldots, \theta_p), E(\theta_1, \ldots, \theta_p))$, one generates a set of $D$ linear equations. The maximum number of linearly independent equations one can generate is equal to the number of linearly independent functions in the set $T_{j} \equiv \left\{ t^{\alpha \alpha^\prime}_{j, R}(\theta_1, \ldots, \theta_p) \right\} \cup \left\{ t^{\alpha \alpha^\prime}_{j, I}(\theta_1, \ldots, \theta_p) \right\}$; we denote this as the \emph{rank} of $T_j$. This rank can be easily computed by evaluating the functions in $T_j$ over generic and randomly chosen points $(\theta_1, \ldots, \theta_p)$ and computing the rank of the set of vectors whose entries are the evaluated functions. In principle, one should be able to reconstruct $\tilde{H}$ by solving a system with enough equations. In practice, if the rank of $T_j$ is smaller than the number of entries in $\tilde{H}$ (note that this is equal to the number of independent, real parameters in $\tilde{H}$), then we cannot fully reconstruct $\tilde{H}$, since we have a non-unique solution to our system of equations. However, any $\tilde{H}$ compatible with these equations yields the correct energy function $E(\theta_1, \ldots, \theta_p)$. As an example, a single $U(4)$ two-qubit gate could in principle require of 256 equations to fully characterize the energy function $E$, given that $\tilde{H}$ is a $16 \times 16$ Hermitian matrix. However, the rank of $T_j$ is 226, and so only 226 equations are needed to obtain $E(\theta_1, \ldots, \theta_p)$. As a second example, in the case of a rotation one-qubit gate over a fixed plane in the Bloch sphere, one only needs 3 equations in order to determine $E$, and our method reproduces the 3-parameter quadrature method of Refs.~\cite{nakanishi_sequential_2020,parrish_jacobi_2019}. Considerations about the rank of $T_j$ are important in order to determine the $\emph{minimum}$ number of equations needed. In practice, by increasing the number of equations to determine $E(\theta_1, \ldots, \theta_p)$ and partially determine $\tilde{H}$ by linear least squares over an over-constrained system of equations, we can add additional robustness into our calculation. \section{\label{sec:intro}Introduction} In the near term, quantum computers remain limited in qubits and state coherence. These early noisy intermediate-scale quantum (NISQ) computers cannot perform error correction, making many promising quantum algorithms unusable \cite{preskill_quantum_2018}. To avoid these issues, hybrid classical-quantum algorithms like the Quantum Approximate Optimization Algorithm (QAOA) and the Variational Quantum Eigensolver (VQE) leverage the resources of a quantum computer to simulate and sample from a classically intractable state while using classical resources to limit the qubit and coherence requirements of a problem \cite{farhi_quantum_2014,peruzzo_variational_2014}. VQE takes as input a problem Hamiltonian, $\hat{H}$, and a variational family of parameterized quantum circuits, $\ket{\Psi(\boldsymbol{\theta})}$, and attempts to find the set of parameters $\boldsymbol{\theta}=\arg\!\min_{\boldsymbol{\theta}} E(\boldsymbol{\theta})$ which minimizes the energy $E(\boldsymbol{\theta})=\bra{\Psi(\boldsymbol{\theta})}\hat{H}\ket{\Psi(\boldsymbol{\theta})}$. VQE accomplishes this by iteratively computing operator expectation values (e.g. energy gradients) of $|\Psi(\boldsymbol{\theta})\rangle$ on the quantum computer and then classically updating the control parameters $\boldsymbol{\theta}$ until a convergence criterion is met. The VQE algorithm must run many copies of a circuit with limited depth. The standard approach to VQE has been improved in various ways including better initialization, error mitigation techniques, and measurement minimizing protocols \cite{cerezo_cost-function-dependent_2020,grimsley_adaptive_2019,lee_generalized_2019,barkoutsos_improving_2020,grant_initialization_2019,omalley_scalable_2016,kokail_self-verifying_2019,zhu_training_2019,liu_differentiable_2018,huggins_towards_2019,hempel_quantum_2018,gard_efficient_2020,lee_generalized_2019,zhou_quantum_2020,shen_quantum_2017,benedetti_parameterized_2019,li_efficient_2017,sagastizabal_experimental_2019,kandala_error_2019,mcardle_error-mitigated_2019,verteletskyi_measurement_2020,izmaylov_unitary_2020,gokhale_on3_2020,huggins_efficient_2021,izmaylov_unitary_2020,rubin_application_2018,kandala_hardware-efficient_2017,jena_pauli_2019,yen_measuring_2020,gokhale_minimizing_2019,rubin_application_2018}. In this work, our focus will be on improving the approach to circuit optimization. Early VQE optimization used costly gradient free classical optimization methods including particle-swarm optimization (PSO) and the Nelder-Mead (NM) method \cite{peruzzo_variational_2014,shen_quantum_2017,wecker_progress_2015,zhu_training_2019,benedetti_parameterized_2019}. Since then, most VQE optimization proposals rely either on some form of gradient descent in order to optimize the variational parameters \cite{grimsley_adaptive_2019,kubler_adaptive_2020,mitarai_quantum_2018,kandala_hardware-efficient_2017,nannicini_performance_2019,grimsley_adaptive_2019,wang_accelerated_2019,parrish_quantum_2019,foss-feig_holographic_2020,hempel_quantum_2018,nakanishi_subspace-search_2019,liu_differentiable_2018,huggins_non-orthogonal_2020,sagastizabal_experimental_2019,ryabinkin_constrained_2019} or a sampling of quadrature points for finding parameter updates \cite{nakanishi_sequential_2020,parrish_jacobi_2019}. Gradients can be computed either from finite differences or analytically using quantum circuits. Although formally a hybrid quantum-classical algorithm, VQE with gradient descent involves minimal classical computation beyond averaging observables and adding the gradient onto the current set of parameters. In the context of VQE, gradient descent has several known challenges including local minima, significant hyperparameter tuning, slow convergence, and exponentially vanishing gradients (i.e. the barren plateau problem) \cite{mcclean_barren_2018,cerezo_cost-function-dependent_2020,zhou_quantum_2020, zhu_training_2019}. In this paper, we overcome many of these challenges by providing and benchmarking a flexible, hyper-parameter free optimization algorithm for VQE optimization, the unitary block optimization scheme (UBOS). We also describe TUBOS, the application of UBOS to the problem of time evolution. UBOS sweeps over gates optimally minimizing the energy of one gate at a time in the environment of the other temporarily fixed gates. Our approach has a number of advantages including requiring significantly fewer operator expectation values to converge, an ability to tunnel through some local minima and a robustness to barren plateaus which comes from avoiding the direct use of the exponentially small gradients over the circuit parameters. In addition, it off-loads a non-trivial amount of computational work to classical machines more equally balancing the classical aspect of quantum-classical hybrids. We demonstrate UBOS using as a variational ansatz, \begin{equation} \left |\psi \right \rangle = \prod_{j=1}^{K} U_j \ket{0} \label{ansatz_eq} \end{equation} obtained by applying K generic two qubit unitaries $U_j \in SU(4)$ (i.e. quantum gates) acting on adjacent qubits. We will assume these gates are laid out in a brick pattern (see Figure \ref{fig:ansatz}) with a gate-depth $d$ although non-local two-qubit gates can be straightforwardly used as well. The rest of the paper is organized as follows. In Section~\ref{sec:methods}, we describe how to implement the UBOS for VQE. Next, in Section~\ref{sec:implementation}, we demonstrate the method on the 1D XXZ Heisenberg model comparing against stochastic gradient descent. We explore the method's performance both with exact expectation values from the circuits as well as values which are correct on average but stochastically noisy as would result from a finite number of measurements. We also analyze UBOS' ability to avoid certain barren plateaus. Finally, in Section~\ref{sec:VITE} we describe TUBOS and demonstrate its efficacy for variational imaginary time evolution. We conclude the paper in Section~\ref{sec:discussion} with a discussion of our main results. \section{\label{sec:methods}Unitary Block Optimization} \begin{figure}[b] \begin{tabular}{c} \Qcircuit @C=1em @R=1em { \lstick{\ket{0}} & \multigate{1}{U_0} & \qw & \multigate{1}{U_5} & \qw & \qw \\ \lstick{\ket{0}} & \ghost{U_0} & \multigate{1}{U_3} & \ghost{U_5} & \multigate{1}{U_8} & \qw \\ \lstick{\ket{0}} & \multigate{1}{U_1} & \ghost{U_3} & \multigate{1}{U_6} & \ghost{U_8} & \qw \\ \lstick{\ket{0}} & \ghost{U_1} & \multigate{1}{U_4} & \ghost{U_5} & \multigate{1}{U_{9}} & \qw \\ \lstick{\ket{0}} & \multigate{1}{U_2} & \ghost{U_4} & \multigate{1}{U_7} & \ghost{U_{9}} & \qw \\ \lstick{\ket{0}} & \ghost{U_2} & \qw & \ghost{U_7} & \qw & \qw } \end{tabular} \caption{ Structure of our generic unitary circuit ansatz for 6 qubits and 4 layers. } \label{fig:ansatz} \end{figure} In this section, we describe UBOS using generic two-qubit unitaries. The generalization to any k-qubit unitary is straightforward. One can also apply UBOS to common hardware gates, including the two-parameter fSim gate, (see Appendix \ref{sec:AppA}) and to restricted manifolds of larger unitaries (see Appendix \ref{sec:large_unitaries}) with significantly fewer quantum measurements. A generic (local or non-local) two qubit unitary, $U_j$, can be represented as a linear combination of 16 two qubit Pauli strings, \begin{equation} U_j = \sum_{\alpha,\beta=0}^{3} t_j^{\alpha\beta} P^{\alpha\beta} \label{paulidecomp} \end{equation} where $P^{\alpha\beta} = \sigma^{\alpha} \sigma^{\beta}$ and the $t_j^{\alpha \beta}$ are constrained to preserve the unitarity of $U_j$. Consider a depth-d unitary circuit with $K$ unitary two qubit gates, $\ket{\psi} = \Pi_{j=0}^{K}U_{j}\ket{0}$. The derivative of $|\psi\rangle$ with respect to $t_j^{\alpha\beta}$, $\ket{\psi_{j}^{\alpha\beta}} \equiv |\partial \psi/\partial t_j^{\alpha\beta}\rangle $, is given by \begin{equation} \ket{\psi_{j}^{\alpha\beta}}= \left(\prod_{k=1}^{j-1} U_k \right) P^{\alpha\beta} \left( \prod_{k=j+1}^{K} U_k \right) \ket{0} \end{equation} which is the result of substituting gate $U_j$ by the Pauli operator $P^{\alpha \beta}$, and so is also a circuit of depth $d$. The energy $E(\bf{t})$ is a function of the parameters $\bf{t} \equiv \{\bf{t_1},\bf{t_2}...\bf{t_K} \}$ where $\mathbf{t_j} = (t_j^{00},t_j^{01},\dots\,t_j^{33})$. If we fix the parameters for all but the $j$'th gate, the energy can be written as \begin{equation} \begin{aligned} E(\bf{t_j}) & = \sum_{\alpha,\beta,\alpha,\beta'}^{3} t_j^{*\alpha'\beta'}t_j^{\alpha\beta} \Tilde{H}^{\alpha\beta;\alpha'\beta'}\\ & = \mathbf{t_j}^{\dagger} \Tilde{H} \mathbf{t_j} \label{EtHt} \end{aligned} \end{equation} with $\Tilde{H}$ having the matrix elements \begin{equation} \label{Htilde} \begin{aligned} \Tilde{H}^{\alpha\beta;\alpha'\beta'} = \bra{\psi^{\alpha\beta}_j} H \ket{\psi^{\alpha'\beta'}_j} \end{aligned} \end{equation} By expanding $H$ into the sum of unitary operators, we can compute each of the 136 unique matrix elements of $\tilde{H}$ (16 real and 120 complex) by a set of circuits of depth at most $2d$ (see Fig. \ref{fig:gradmeasurecircuit}). An alternative approach for computing $\tilde{H}$ using circuits of only depth $d$ via solving for the unknown $\tilde{H}_{ij}$ in Eq.~\ref{EtHt} is given in Appendix \ref{sec:HfromEs}. Given $\Tilde{H}$ the computation of the lowest energy state for gate $j$ (with all other gates fixed) can now be computed classically by minimizing Eq. \ref{EtHt} with respect to $\bf{t_j}$ under the unitary constraints. This is a 16 parameter optimization problem that can be solved using any classical technique including gradient descent, parallel tempering, Nelder-Mead, etc. This approach can take a much larger step in parameter space than gradient descent as well as tunnel through local minima to find the global minimum for this gate. In fact, without considering stochastic noise, an UBOS step (per gate) down in energy is always at least as large as an SGD step. After finding the optimal $\bf{t_j}$ for $U_j$, UBOS updates its parameters and proceeds similarly with all other unitaries in a predetermined order; we have chosen to randomly shuffle the updating order every sweep. An interesting open question is to determine if there are better sweeping orders. A full sweep of UBOS happens after each gate has been updated once. UBOS can be run in a highly parallel fashion with every circuit needed to evaluate $\tilde{H}$ able to be simultaneously computed. In parallel, one can evaluate each matrix element of $\tilde{H}$, each Hamiltonian Pauli-term for each matrix element, and each repetition to accumulate statistics for each Pauli-term. Each circuit of UBOS can be further accelerated compared to the naive circuit construction using various acceleration approaches which have been introduced for optimizing VQE circuits by SGD. One can analytically cancel out some gates with their inverse further in the circuit. For example, for a nearest neighbor brick-pattern ansatz (i.e. see Fig. \ref{fig:ansatz}), the total number of gates used by any one UBOS circuit scales as $O(d^2)$ and is independent of the system size $L$ when $L \gg d$. Note that this cancelling allows UBOS to optimize any system size $L$ VQE circuit with a quantum computer which only has $2d$ qubits even if $L\gg d$. Finally, UBOS can be improved by using the many proposed methods for reducing the amount of measurements needed by grouping operators into commuting groups \cite{verteletskyi_measurement_2020,fizmaylov_revising_2019,gokhale_on3_2020}. The cost (in expectation values) of running an entire sweep of UBOS is comparable to performing 8.5 (all-gate) gradient descent steps. This follows as gradient descent requires computing (per gate $j$) the 16 expectation values $\bra{\psi} \hat{H} \ket{\psi_{j}^{\alpha\beta}}$ via a depth $2d$ circuit (see Appendix \ref{sec:AppB}). UBOS will therefore be more efficient in cases where it reaches the same energy as SGD with, at least, an order of magnitude less sweeps. UBOS is also similar to other proposed gradient-free gate optimizers that optimize subsets of parameters \cite{nakanishi_subspace-search_2019,parrish_jacobi_2019}. These methods instead require a number of measurements which scale exponentially with the number of independent parameters and whose classical optimization is both analytical (as opposed to the classical optimization of UBOS) and require exponential (with parameters) classical resources. For example, optimizing a $U(4)$ gate requires $O(16^2)$ expectation values in UBOS compared to $3^{15}$ expectation values (and classical resources) in these other approaches. UBOS bears resemblance to a number of classical variational approaches including DMRG \cite{white_density_1992} and the linear-method in variational Monte Carlo \cite{umrigar_optimized_1988}. In both cases, one evaluates an effective Hamiltonian $\Tilde{H}$ in the tangent space of derivatives. This (sometimes generalized) eigenvalue problem on the effective Hamiltonian is then solved and used to find a new set of parameters. In UBOS, if we relax the unitary constraints on $\bf{t_j}$, minimizing the energy becomes an eigenvalue problem $\Tilde{H} {\bf{t_j} }= E \Tilde{S} \bf{t_j}$ where $\Tilde{S}^{\alpha,\beta;\alpha'\beta'}=\braket{\psi^{\alpha\beta}}{\psi^{\alpha'\beta'}}$. $\Tilde{S}$ is not necessary for UBOS but can be computed if desired with 16 additional expectation values. In UBOS, the solution to the eigenvalue problem gives a lower bound on the constrained optimization problem and these unconstrained parameters could be used to initialize the classical optimization. The unitary constraint is necessary because, while the solution to the unconstrained problem gives a valid wave-function, it cannot be represented by a single unitary circuit. \section{\label{sec:implementation}Application to 1D XXZ Heisenberg Model} We benchmark UBOS using a classical simulation of a quantum computer on the 1D XXZ Heisenberg Hamiltonian: \begin{equation} \hat{H}=\sum_{j}\sigma_{j}^{z}+\sum_{j}\sigma_{j}^{z}\sigma_{j+1}^{z}+\sum_{j}(\sigma_{j}^{x}\sigma_{j+1}^{x}+\sigma_{j}^{y}\sigma_{j+1}^{y}) \label{xxz_1d} \end{equation} and compare it with an analytical stochastic gradient descent method. See Appendix \ref{sec:AppB} for details on expectation value measurements for both methods. \subsection{Noiseless Simulations} We first benchmark UBOS assuming the expectation values computed by the quantum computer are exact and noiseless. We emulate this classically by contracting a tensor network version of the relevant circuits using the TensorNetwork library \cite{roberts_tensornetwork_2019}. The ansatz's two qubit unitary blocks are parameterized with the KAK decomposition \cite{tucci_introduction_2005}. Each gate in our initial circuit is generated randomly by selecting the KAK parameters uniformly at random from $[0,\pi)$. While given enough classical resources, one can always find the global minimum of a 16 parameter optimization, in practice we devote enough resources in our classical optimization to find values close but not always equal to this true global minimum at each step. For the comparison with SGD, we compute the gradient of all gates and take a step downhill of $5\%$ of the gradient, which we experimentally found to work well. We performed numerical experiments at different system sizes and ansatz depths. Under UBOS optimization, increasing layers to the VQE ansatz gives exponential improvement in the infidelity $1-\mathcal{F}$, where $\mathcal{F} = |\langle \Psi_\textrm{exact}| \Psi_\textrm{VQE}\rangle|^2$ and $|\Psi_\textrm{exact}\rangle$ and $|\Psi_\textrm{VQE}\rangle$ are the exact ground state and the VQE approximation respectively (see Figure \ref{fig:FvsLayers}). For all scenarios studied, both optimization methods reached similar final fidelities, although we were unable to fully plateau many of the optimization runs. In Figure \ref{fig:14n7layers}, we show representative optimization runs for a 14 site, 7 layer ansatz. Throughout the optimization, UBOS reaches a given energy or fidelity with approximately an order of magnitude less expectation values measured (see Appendix \ref{sec:AppC} for details). We proceed to look at the expectation values needed to reach an energy difference per site of $10^{-2}$ for a seven layer ansatz as we change the number of sites from 8 to 16 (see Figure \ref{fig:evn_vs_sites}). Here we also consistently find UBOS requires an order of magnitude fewer expectation values. We also considered doing both UBOS and SGD on one gate at a time, finding it was significantly more efficient to do UBOS (see Appendix~\ref{sec:AppD}). \begin{figure} \includegraphics[width=\linewidth]{./figs/FvsLayers.pdf} \caption{Infidelity of ground state vs ansatz depth for a 12 site XXZ 1-D Heisenberg model (Eq. \ref{xxz_1d}). Each point represents a UBOS run from a randomly initialized ansatz. For each of the 12 site ansatz we ran until plateaued.} \label{fig:FvsLayers} \end{figure} \begin{figure*}[htb]% \onecolumngrid \centering \subfigure[][]{% \label{fig:14n7layers-a}% \includegraphics[width=0.48\linewidth]{./figs/14qubits7LayersE.pdf}}% \hspace{8pt}% \subfigure[][]{% \label{fig:14n7layers-b}% \includegraphics[width=0.48\linewidth]{./figs/14qubits7LayersF.pdf}}% \caption[]{Prototypical noiseless runs for a 14-qubit 7-layer ansatz for UBOS and SGD showing \subref{fig:14n7layers-a} Ground state energy difference and \subref{fig:14n7layers-b} Ground state fidelity vs number of expectation values. Each UBOS line is a different initial starting circuit but the SGD and UBOS are both (pairwise) initialized to the same starting circuits. }% \label{fig:14n7layers}% \end{figure*} \begin{figure} \centering \includegraphics[width=\linewidth]{./figs/ExpNeedvsSites.pdf} \caption{Number of expectation values needed to reach an energy error per site of $10^{-2}$ for a 7 layer ansatze with varying number of sites. Each point represents a different single optimization run (with pairwise matching starting conditions between UBOS and SGD).} \label{fig:evn_vs_sites} \end{figure} \subsection{Simulations with Gaussian Noise} In order to better understand the performance of UBOS with noisy expectation values, as would happen with limited samples of the circuit, we perform two tests. In our first test, we directly evaluate the effect of noise coming from a finite number of measurements by implementing the relevant circuits for UBOS in Qiskit and performing simulations (without gate noise) on a 6 site 3 layer ansatz for the 1D XXZ Heisenberg model \cite{Qiskit}. We find that very noisy estimates of $\tilde{H}$ cause the UBOS algorithm to plateau at higher energies than the exact, noiseless UBOS simulation (see Fig.~\ref{fig:runswvariance}(a)). SGD seems less sensitive to this stochastic noise, where we find even taking 100 samples per gradient achieves a similar plateau as the exact case (although the case of 10 samples per gradient is unclear). Interestingly, though, the exact case gets stuck in a local minima plateauing significantly above the exact UBOS simulation. We further validated this behavior on larger systems (8 and 16 site, 7 layers) by computing the exact expectation values and explicitly adding Gaussian noise with width $\sigma$ to each matrix element of $\tilde{H}$ (while keeping it Hermitian) finding similarly that UBOS saturates at a noise dependent energy (see Figs.~\ref{fig:runswvariance}\subref{fig:runswvariance-b}\subref{fig:runswvariance-c}) which is lower for lower noise. While the optimization eventually plateaus, it tracks the noiseless optimization until it approaches the plateaued energy. This sensitivity to noise can be attributed to the non-linearity of the optimization. We explicitly measure this non-linearity by looking at the distribution of one parameter after a noisy UBOS optimization (see Fig.~\ref{fig:param_opt}), finding that it is not centered at its true value; this is to be contrasted with gradient descent, where the expectation value of the gradient over noisy estimates is correct. In practice, this means that there may be a tradeoff between UBOS and SGD when expectation values are sufficiently noisy. To further probe this, we look at the decrease in energy during different parts of the optimization (see Fig.~\ref{fig:onestep}). At the beginning of the optimization, UBOS performs well even for the largest noise level studied, with energies similar to those found when optimizing with exact expectation values (which itself sometimes is slightly above the true global minimum due to imperfect classical optimization). As the optimizations progresses, UBOS requires more precise estimates of matrix elements in order to continue to lower the energy. Toward the end of the optimization, even low noise optimization often end up above the starting energies. Finally, it is worth noting in practice that sometimes a small amount of noise in the estimates is actually beneficial in improving the energy reached by optimization (or reaching it faster). For example, in the 8-site system, the smallest $\sigma$ runs reach lower energy than the exact run; introducing slight noise to optimization has been shown to help in the related case of DMRG \cite{white_density_1992}. \begin{figure*}[htb]% \centering \subfigure[][]{% \label{fig:runswvariance-a}% \includegraphics[height=142pt]{./figs/6site_qiskit.pdf}}% \hspace{2pt}% \subfigure[][]{% \label{fig:runswvariance-b}% \includegraphics[height=142pt]{./figs/8site_variance.pdf}}% \hspace{2pt}% \subfigure[][]{% \label{fig:runswvariance-c}% \includegraphics[height=142pt]{./figs/16site_variance.pdf}}% \caption[]{Comparing the behavior of the optimization methods with statistical noise. Energy difference from the ground state vs number of expectation values computed. \subref{fig:runswvariance-a} Simulations using IBM's Qiskit (on classical emulators) for a 6 site, 3 layer ansatz with varying number of samples $s$ per operator measurment. \subref{fig:runswvariance-b} Simulations for different gaussian noise $\sigma$ for 8 site, 7 layer ansatz optimizations and \subref{fig:runswvariance-c} 16 site, 7 layer ansatz optimizations. When $\sigma = 10^{-3}$, the noisy SGD optimization is not visible as it overlaps with the corresponding exact optimizations.}% \label{fig:runswvariance}% \end{figure*} \begin{figure*}[htb]% \centering \subfigure[][]{% \label{fig:onestep-a}% \includegraphics[width=0.33\linewidth]{./figs/onestep0.pdf}}% \hspace{2pt}% \subfigure[][]{% \label{fig:onestep-b}% \includegraphics[width=0.33\linewidth]{./figs/onestep100.pdf}}% \hspace{2pt}% \subfigure[][]{% \label{fig:onestep-c}% \includegraphics[width=0.33\linewidth]{./figs/onestep1000.pdf}}% \caption[]{Energy difference $\Delta E$ from the lowest energy seen during optimization of a single UBOS step performed on a gate in the middle of a 16 site, 7 layer ansatz showing the energy before optimization (black dotted line), the energy after noiseless optimization (red dotted line) and the distribution of energies for optimization with added Gaussian noise with standard deviation $\sigma$ per matrix element, for 1000 realizations. The noiseless optimization doesn't always have $\Delta E=0$ because of imperfect classical optimization using Nelder-Mead. UBOS step shown \subref{fig:onestep-a} at the beginning of optimization \subref{fig:onestep-b} after 100 optimizations. \subref{fig:onestep-c} after 1,000 optimizations. \label{fig:onestep}% \end{figure*} \subsection{UBOS and the Barren Plateau} For a large class of random quantum circuits, the gradient of the objective function with respect to any parameter is expected to decrease exponentially with system size and number of gates \cite{mcclean_barren_2018}. Gradient descent performed on these circuits is difficult as even moderately noisy gradients make even the gradient direction unclear. This is called the barren plateau problem. Here we give numerical evidence that UBOS is significantly less sensitive to barren plateaus. Starting from a randomly initialized circuit and picking a gate from the middle of the ansatz we compare the performance of UBOS and gradient descent. As expected from barren plateaus we see that the variance of the gradients decays exponentially with system size (out to a depth-dependent cutoff) decreasing by an order of magnitude as we go from a 7 layer ansatz with 2 qubits to one with 18 qubits (see Fig.~\ref{fig:bpl-a}). The average gradient in our test for the 18 qubit ansatz has a magnitude of 0.026 to 0.046, depending on the parameter. Over the same system sizes, the change in energy, $\Delta E$, due to a single (noiseless) UBOS step varies by at most ~50\%, with a typical change in energy of approximately $\Delta E \approx -0.6$. UBOS is still able to significantly lower the energy even when the gradients approach 0. Even more dramatically, for the gradients in this gate, only a modest amount of Gaussian noise is necessary to obscure the sign of the gradient. In contrast, the effect of Gaussian noise on UBOS performance remains only weakly influenced by system size despite $|\Delta E|$ depending heavily on the amount of noise (see Fig.~\ref{fig:bpl-b}). This suggests that UBOS may be a useful tool for optimizing circuits in the barren plateau. \begin{figure*}[htb]% \centering \subfigure[][]{% \label{fig:bpl-a}% \includegraphics[height=140pt]{./figs/GVariance.pdf}}% \hspace{2pt}% \subfigure[][]{% \label{fig:bpl-b}% \includegraphics[height=140pt]{./figs/deltaEvN.pdf}}% \hspace{2pt}% \subfigure[][]{% \label{fig:bpl-c}% \includegraphics[height=140pt]{./figs/histogramofgradients.pdf}}% \caption[]{Comparison between the average performance of SGD and UBOS for a gate in the middle of a 7 layer ansatz \subref{fig:bpl-a} Average initial variance of the gradient. Each color represents one of the 15 parameters per gate. Error bars are smaller than the symbol size. \subref{fig:bpl-b} Symmetric log plot of the average change in energy for a single SGD and UBOS step with and without Gaussian noise. \subref{fig:bpl-c} Normalized histograms of the gradients of randomly initialized ansatze with system sizes N = 6,12 and 18. For both \subref{fig:bpl-a} and the SGD data in \subref{fig:bpl-b} averages are over 1000 randomly initialized ansatze. The UBOS data in \subref{fig:bpl-b} and the gradient histograms in \subref{fig:bpl-c} are averaged over 50 ansatze. \label{fig:bpl}% \end{figure*} \section{\label{sec:VITE} UBOS and Variational Imaginary Time Evolution} In the previous sections, we have shown how UBOS is used in VQE to minimize the energy of variational ansatze. We now describe a time-evolution version of UBOS (TUBOS) with a focus here on variational imaginary time evolution (VITE); the generalization to real-time evolution is straightforward \cite{kochkov_variational_2018,mclachlan_time-dependent_1964,paeckel_time-evolution_2019,sorella_green_1998,schiro_time-dependent_2010}. In fact, this discussion applies to any application where we wish to maximize an objective function $|\bra{\Phi(\boldsymbol{\theta})}\hat{O}\ket{\Psi(\boldsymbol{\theta}')}|$ with the variational parameters in one of the wavefunctions fixed. In the literature, there are several methods for performing VITE \cite{endo_variational_2020,mcardle_error-mitigated_2019,motta_determining_2020,yuan_theory_2019,barison_efficient_2021,benedetti_hardware-efficient_2020,lin_real-_2020}. For illustrative purposes we approximate the imaginary time evolution operator, $e^{-\beta \hat{H}}$, as $(1-\frac{\beta}{n} \hat{H})^n$. In order to approximate the action of $e^{-\beta \hat{H}}$ on a wavefunction, we then perform n steps where we variationally maximize $|\bra{\Psi(\boldsymbol{\theta}^{i+1})}1-\frac{\beta}{n}\hat{H}\ket{\Psi(\boldsymbol{\theta}^{i})}|$ in each step. During each step, the variational parameters for the wavefunction found in the previous step, $\boldsymbol{\theta}^{i}$, are kept fixed while $\boldsymbol{\theta}^{i+1}$ are not. Following the argument in Section \ref{sec:methods}, we can write \begin{equation} \begin{split} &\bra{\Psi(\boldsymbol{\theta}^{i+1})}1-\frac{\beta}{n}\hat{H}\ket{\Psi(\boldsymbol{\theta}^{i})} \\ & = \sum_{\alpha\beta}t^{*\alpha\beta}_{j}\bra{\Psi(\boldsymbol{\theta}^{i+1})^{\alpha\beta}_{j}}1-\frac{\beta}{n}\hat{H}\ket{\Psi(\boldsymbol{\theta}^{i})} \end{split} \label{imag_time} \end{equation} where we have replaced the jth gate in the target wavefunction with a sum of two qubit Pauli matrices. To maximize the overlap we must measure each of the 16 summands, $\bra{\Psi(\boldsymbol{\theta}^{i+1})^{\alpha\beta}_{j}}1-\frac{\beta}{n}\hat{H}\ket{\Psi(\boldsymbol{\theta}^{i})}$. A quantum circuit to measure $\bra{\Psi(\boldsymbol{\theta}^{i+1})^{\alpha\beta}_{j}}\hat{O}\ket{\Psi(\boldsymbol{\theta}^{i})}$, for any unitary operator $\hat{O}$, can be constructed similarly to Fig. \ref{fig:gradmeasurecircuit} where each gate that is different between the initial and target state must be a controlled gate. We can then classically find the $\boldsymbol{t_j}$ that maximizes the overlap and perform an update to $\boldsymbol{\theta}^{i+1}$. We sweep over gates until a convergence criterion is met before moving to the i+1 step. If instead we wish to optimize Eq. \ref{imag_time} using SGD (TSGD), we would need to measure the same 16 elements. In Fig. \ref{fig:tubos}, we perform numerical experiments for TUBOS. TUBOS drastically out performs TSGD. \begin{figure*}[htb]% \centering \subfigure[][]{% \label{fig:tubos-a}% \includegraphics[height=140pt]{./figs/itimeEtau01.pdf}}% \hspace{2pt}% \subfigure[][]{% \label{fig:tubos-b}% \includegraphics[height=140pt]{./figs/itimeFtau01.pdf}}% \hspace{2pt}% \subfigure[][]{% \label{fig:tubos-c}% \includegraphics[height=140pt]{./figs/itimeEtaucomp.pdf}}% \caption[]{We perform numerical experiments using TUBOS and its SGD counterpart (TSGD) on an 8 qubit 7 layer ansatz. Following the discussion in \ref{sec:VITE}, we simulate the action of $e^{-\beta \hat{H}}$ on our wavefunction. In \subref{fig:tubos-a} and \subref{fig:tubos-b}, we show noiseless simulations optimizing our wavefunction using TUBOS and TSGD with $\beta/n=0.1$. We sweep over each gate in the ansatz r times before we make a time step. The dashed lines represent the exact trajectories from applying $1-\frac{\beta}{n} \hat{H}$ to our ansatz. For fixed $\beta/n$ and r, TUBOS and TSGD require the same amount of expectation value measurements to perform but TUBOS drastically outperforms TSGD. In \subref{fig:tubos-c}, we compare results for TUBOS using $\beta/n=0.1$ and 0.01. Both TUBOS optimizations require the same amount of expectation values to perform but the smaller $\beta/n$ reaches lower energy. \label{fig:tubos}% \end{figure*} TUBOS differs from VQE UBOS in two ways. First, the number of `matrix elements' needed is only 16 per two qubit gate. Secondly, each matrix element is somewhat more complicated to compute. One needs a controlled gate for ever gate that is different between $\ket{\Psi(\boldsymbol{\theta}^{i})}$ and the current $\ket{\Psi(\boldsymbol{\theta}^{i+1})}$; this is to be contrasted with the two control gates needed for UBOS. TUBOS has significant similarity to the Refs.~\onlinecite{lin_real-_2020} and \onlinecite{benedetti_hardware-efficient_2020} as well as the recently posted Ref. \onlinecite{barison_efficient_2021} which all perform either real or imaginary time evolution by iteratively maximizing the fidelity with a time-evolved state. Such iterative fidelity maximization is also the key step in the imaginary time supervised wavefunction optimization (IT-SWO) approach to variational optimization \cite{kochkov_variational_2018}. These four methods and TUBOS all are linear in the total number of ansatz parameters avoiding the quadratic cost in total parameters that plagues standard time dependent variational approaches such as stochastic reconfiguration. It is interesting to note that the number of expectation values required to reach a $E - E_g$ of $10^{-1}$ on the 8 qubit, 7 layer ansatz is similar for TUBOS with $\beta/n=0.1$, r=10 and UBOS. These approaches to time evolution mainly differ in whether they optimize the maximum fidelity by SGD simultaneously on all parameters (Refs.~\onlinecite{kochkov_variational_2018} and \onlinecite{barison_efficient_2021}) versus subsets of the parameters at a time (TUBOS and Refs.~\onlinecite{lin_real-_2020},\onlinecite{benedetti_hardware-efficient_2020}) and whether each optimization step requires solving a non-trivial optimization problem (as in TUBOS) or taking a step which is either analytically solvable or proportional to the gradient. It is also worth contrasting TUBOS and QITE \cite{motta_determining_2020}. Both TUBOS and QITE generate an optimization problem over some gate. TUBOS sweeps over fixed-size gates while QITE introduces, at each time step, a new gate at the `top' of the circuit whose size is proportional to the time-step resulting in a cost which grows exponentially with depth, and reaching depths that might not be realizable on a NISQ device. \section{\label{sec:discussion} Discussion and Outlook} In this paper, we introduced UBOS (and a time-evolved version TUBOS), a gradient-free and hyperparameter-free optimization method for the optimization of quantum circuits on hybrid variational algorithms such as VQE. UBOS works by iteratively sweeping over gates and generating an effective Hamiltonian $\tilde{H}$ (whose matrix elements are computed on a quantum computer). UBOS then classically finds the gate parameters that minimize the energy with respect to this effective Hamiltonian. We compared UBOS with standard stochastic gradient descent finding that, for the system sizes studied, UBOS consistently reached the same energy as stochastic gradient descent with an order of magnitude less expectation values. UBOS is also able to tunnel through some local minima (i.e. those that exist for a single quantum gate). We observe, in situations where the gradient with respect to the parameters is extremely small, UBOS is still able to make non-trivial steps decreasing the energy; this is true even in the face of significant noise suggesting UBOS could also be a useful tool at the beginning of an optimization for escaping the barren plateau. The effect on UBOS of stochastic noise on the matrix elements is more complicated than stochastic gradient descent which is unbiased in expectation. In practice, the effect of this non-linearity results in a noise-dependent plateau of the UBOS energy above the minimum energy representable by the quantum circuit. This suggests an adaptive protocol where one uses progressively more measurements per expectation value as the optimization progresses. Alternatively, it may be advantageous to switch between UBOS and stochastic gradient descent as one gets closer to the minima. One may also be able to correct this non-linearity with penalty method techniques \cite{ceperley_penalty_1999}. We have applied UBOS to a generic two-qubit unitary. For devices which are not using this particular ansatz, it is straightforward to transfer such a pattern of gates to and from the specific architecture used in a machine \cite{tucci_introduction_2005} giving an optimization algorithm for the same quantum cost as standard UBOS. This also applies to other general ansatz such as unitary coupled cluster, which can be decomposed as the application of (potentially non-local) gates. For certain types of gates (such as fSim, U(3) or CU(3) gates) even less Pauli terms need to be measured than in the generic case (see Appendix \ref{sec:AppA}). At cost exponential in gate size, one can also use gates which span more than two qubits potentially reaching the ground state in less steps. While preliminary tests on the 1D XXZ Heisenberg model suggest this is not a advantageous in this case, it may be useful for other Hamiltonians. The UBOS framework also gives an alternative to the various forms of variational real/imaginary time evolution and seems more efficient in expectation values and scaling with parameters then many alternative approaches. In summary, UBOS further improves our ability to use VQE to optimize quantum circuits. Given that the primary difficult in successfully using VQE is optimizing a quantum circuit, UBOS gives an approach which is efficient and overcomes many of the technical issues with standard stochastic gradient descent. \begin{acknowledgements} BKC acknowledges useful discussions with Aram Harrow and Edgar Solomonik. We acknowledge support from the Department of Energy grant DOE de-sc0020165. This project is part of the Blue Waters sustained-petascale computing project, which is supported by the National Science Foundation (awards OCI-0725070 and ACI-1238993) and the State of Illinois. Blue Waters is a joint effort of the University of Illinois at Urbana-Champaign and its National Center for Supercomputing Applications. This work also made use of the Illinois Campus Cluster, a computing resource that is operated by the Illinois Campus Cluster Program (ICCP) in conjunction with the National Center for Supercomputing Applications (NCSA) and which is supported by funds from the University of Illinois at Urbana-Champaign. \end{acknowledgements} \bibliographystyle{apsrev4-1}
\subsection{Tensors and Notations}\label{sec:prelim:notation} Table~\ref{tab:symbols} lists the symbols frequently used in this paper. \noindent{\textbf{Symbols and indexing}}: We denote scalars by lowercase letters, e.g., $u$, vectors by boldface lowercase letters, e.g., $\mathbf{u}$, matrices by boldface capital letters, e.g., $\mathbf{U}$, and tensors by boldface calligraphic letters, e.g., $\tensor{X}$. The order of a tensor is the number of modes, also known as ways or dimensions. Consider an $N$-way tensor $\tensor{X}\in\mathbb{R}^{I_{1}\times\dots\times I_{N}}$, where $I_{n}$ is the length of mode $n$. Given the integer $1\leq i_{n}\leq I_{n}$ for each mode $n=1,\dots,N$, the $(i_{1},\dots,i_{N})$-th entry of the tensor $\tensor{X}$ is denoted by $x_{i_{1}\dots i_{N}}$. For each matrix $\mathbf{U}$, we denote its $(i,j)$-th element by $u_{ij}$, its $i$-th row vector by $\mathbf{u}_{i}$, and its $j$-th column vector by $\tilde{\uvec}_{j}$. For each vector $\mathbf{u}$, we denote its $i$-th element by $u_{i}$. The inverse, Moore-Penrose pseudoinverse, transpose, and Frobenius norm of $\mathbf{U}$ are denoted by $\mathbf{U}^{-1}$, $\mathbf{U}^{\dagger}$, $\mathbf{U}^{\top}$, and $\norm{\mathbf{U}}_{F}$, respectively. \noindent{\textbf{Matricization}}: Matricization, also called unfolding, is the process of reordering the elements of a given $N$-way tensor $\tensor{X}\in\mathbb{R}^{I_{1}\times\dots\times I_{N}}$ into a matrix. The mode-$n$ unfolding matrix of $\tensor{X}$, which is denoted by $\mathbf{X}_{(n)}\in\mathbb{R}^{I_{n}\times(\prod_{i\neq n}^{N}I_{i})}$, is obtained by considering the $n$-th mode as the rows of the matrix and collapsing the other modes into the columns of the matrix. \noindent{\textbf{Hadamard product}}: The Hadamard product of two matrices $\mathbf{U}$ and $\mathbf{W}$ of the same size, which is denoted by $\mathbf{U}\circledast\mathbf{W}$, is their element-wise product. The sequence of the Hadamard products $\mathbf{U}^{(N)}\circledast\cdots\circledast\mathbf{U}^{(1)}$ is denoted by $\mathop{\scalebox{1.4}{\raisebox{-0.2ex}{$\circledast$}}}_{n=1}^{N}\mathbf{U}^{(n)}$. The Hadamard product is naturally extended to tensors. \noindent{\textbf{Khatri-Rao product}}: Given matrices $\mathbf{U}\in\mathbb{R}^{I\times R}$ and $\mathbf{W}\in\mathbb{R}^{J\times R}$, their Khatri-Rao product is denoted by $\mathbf{U}\odot\mathbf{W}$. The result matrix, which is of size $IJ\times R$, is defined as: {\small \begin{equation} \mathbf{U}\odot\mathbf{W}=\begin{bmatrix} u_{11}\tilde{\wvec}_{1} & u_{12}\tilde{\wvec}_{2} & \cdots & u_{1R}\tilde{\wvec}_{R} \\ u_{21}\tilde{\wvec}_{1} & u_{22}\tilde{\wvec}_{2} & \cdots & u_{2R}\tilde{\wvec}_{R} \\ \vdots & \vdots & \ddots & \vdots \\ u_{I1}\tilde{\wvec}_{1} & u_{I2}\tilde{\wvec}_{2} & \cdots & u_{IR}\tilde{\wvec}_{R} \end{bmatrix}. \end{equation} }\normalsize The sequence of the Khatri-Rao products $\mathbf{U}^{(N)}\odot\cdots\odot\mathbf{U}^{(1)}$ is denoted by $\mathop{\scalebox{1.4}{\raisebox{-0.2ex}{$\odot$}}}_{n=1}^{N}\mathbf{U}^{(n)}$. \subsection{CANDECOMP/PARAFAC\xspace (CP) Factorization}\label{sec:prelim:factorization} Among tensor factorization models, CP factorization, which is based on CP decomposition \cite{kolda2009tensor}, is most widely used due to its simplicity and effectiveness. \begin{definition}[Rank-$1$ Tensor] A tensor $\tensor{X}\in\mathbb{R}^{I_{1}\times\dots\times I_{N}}$ is a rank-$1$ tensor if it can be expressed as the outer product of $N$ vectors (i.e., $\tensor{X}=\mathbf{u}^{(1)}\circ\mathbf{u}^{(2)}\circ\cdots\circ\mathbf{u}^{(N)}$, where $\mathbf{u}^{(n)}\in\mathbb{R}^{I_{n}}$). The outer product is defined as $(\mathbf{u}^{(1)}\circ\mathbf{u}^{(2)}\circ\cdots\circ\mathbf{u}^{(N)})_{i_{1}\dots i_{N}}=u_{i_{1}}^{(1)}\cdots u_{i_{N}}^{(N)}$ for all $1\leq n \leq N$ and $1\leq i_{n}\leq I_{n}$. \end{definition} \begin{definition}[CP Decomposition~\cite{carroll1970analysis,harshman1970foundations}] Given an $N$-way tensor $\tensor{X}\in\mathbb{R}^{I_{1}\times\dots\times I_{N}}$ and a positive integer $R$, CP decomposition of rank $R$ approximates $\tensor{X}$ as the sum of $R$ rank-$1$ tensors, as formulated in Eq.~\eqref{eq:cpd}. {\small \begin{equation} \tensor{X}\approx\sum_{r=1}^{R} \tilde{\uvec}_{r}^{(1)}\circ\tilde{\uvec}_{r}^{(2)}\circ\cdots\circ\tilde{\uvec}_{r}^{(N)}=\llbracket\Uone,\dots,\UN\rrbracket, \label{eq:cpd} \end{equation} }\normalsize where $\Umat^{(n)}=[\tilde{\uvec}_{1}^{(n)},\dots,\tilde{\uvec}_{R}^{(n)}]\in\mathbb{R}^{I_{n}\times R}$ is called the mode-$n$ factor matrix, which can also be represented by row vectors as $\Umat^{(n)}=[\mathbf{u}_{1}^{(n)},\dots,\mathbf{u}_{I_{n}}^{(n)}]^{\top}$. \end{definition} \begin{definition}[CP Factorization of Incomplete Tensors~\cite{acar2011scalable,tomasi2005parafac,shin2016fully}] Consider an $N$-way incomplete tensor $\tensor{X}\in\mathbb{R}^{I_{1}\times\dots\times I_{N}}$ and a rank $R$. Let $\boldsymbol{\Omega}$ be the binary tensor of the same size as $\tensor{X}$ each of whose entry indicates whether the corresponding entry in $\tensor{X}$ is observed, i.e., for all $1\leq n \leq N$ and $1\leq i_{n}\leq I_{n}$, {\small \begin{equation} \omega_{i_{1}\dots i_{N}}=\begin{cases} 1 & \textnormal{if}\ x_{i_{1}\dots i_{N}} \ \textnormal{is known}, \\ 0 & \textnormal{if}\ x_{i_{1}\dots i_{N}} \ \textnormal{is missing}, \end{cases} \end{equation} }\normalsize CP factorization is to find the factor matrices $\Umat^{(1)},\dots,\Umat^{(N)}$ that minimize (\ref{eq:prelim:cp}), where only the observed entries are taken into consideration. {\small \begin{equation} \label{eq:prelim:cp} \min_{\Uone,\dots,\UN} \frac{1}{2}\norm{\boldsymbol{\Omega}\circledast(\tensor{X}-\llbracket\Uone,\dots,\UN\rrbracket)}_{F}^{2}. \end{equation} }\normalsize \end{definition} For more details, \cite{kolda2009tensor,sidiropoulos2017tensor} provide comprehensive reviews of tensor factorization. \subsection{Holt-Winters Method} \label{sec:prelim:hw} The Holt-Winters (HW) method~\cite{holt2004forecasting,winters1960forecasting} is an effective forecasting method for time series with trend and seasonality. There are two variations of it~\cite{hyndman2018forecasting}: the additive method, which is suitable when the seasonal variations are roughly constant, and the multiplicative method, which is preferred when the seasonal variations change proportional to the level of time series. We focus on the additive model in this paper. The additive HW method consists of one forecast equation and three smoothing equations that are for the \textit{level} (e.g., $l_{t}$), the \textit{trend} (e.g., $b_{t}$), and the \textit{seasonal component} (e.g., $s_{t}$), respectively, with corresponding smoothing parameters $0\leq\alpha\leq 1$, $0\leq\beta\leq 1$, and $0\leq\gamma\leq 1$. The smoothing equations are defined as: {\small \begin{subequations} \label{eq:hw_smoothing} \begin{align} l_{t} & = \alpha(y_{t}-s_{t-m}) + (1-\alpha)(l_{t-1}+b_{t-1}), \label{eq:hw_level} \\ b_{t} & = \beta(l_{t}-l_{t-1}) + (1-\beta)b_{t-1}, \label{eq:hw_trend} \\ s_{t} & = \gamma(y_{t}-l_{t-1}-b_{t-1}) + (1-\gamma)s_{t-m}. \label{eq:hw_season} \end{align} \end{subequations} }\normalsize The forecast equation is defined as: {\small \begin{equation} \label{eq:hw_forecast} \hat{y}_{t+h|t} = l_{t} + hb_{t} + s_{t+h-m(\lfloor \frac{h-1}{m}\rfloor+1)}, \end{equation} }\normalsize where $\hat{y}_{t+h|t}$ is the $h$-step-ahead forecast of time series $\mathbf{y}$ at time $t$, and $m$ is the seasonal period. Note that $\lfloor \frac{h-1}{m}\rfloor+1$ ensures that the estimates of the seasonal components used for forecasts are obtained in the last season of the time series. Forecasts produced by the HW method are weighted averages of past observations, with the weights decreasing exponentially as the observations get older. To use the HW method, the smoothing parameters and initial values of level, trend, and seasonal component need to be estimated. We define the residuals of the one-step-ahead forecasts as $e_{t}=y_{t}-\hat{y}_{t|t-1}$ for $t=1,\dots,T$, where $T$ is the last time of the time-series. Then, we can find the unknown parameters by minimizing the sum of squared errors (SSE) defined as $\sum_{t=1}^{T} e_{t}^{2}$~\cite{hyndman2018forecasting}. \subsection{Robust Holt-Winters Forecasting} \label{sec:prelim:robust} The HW model is vulnerable to unusual events or outliers since the smoothing equations (\ref{eq:hw_smoothing}) involve current and past values of the time series including the outliers. Thus, Gelper el al.~\cite{gelper2010robust} proposed a robust HW method based on a pre-cleaning mechanism that identifies and downweights outliers before updating the model. The currupted observation $y_{t}$ is replaced with a `cleaned' version $y_{t}^{*}$ by the follwing rule: {\small \begin{equation}\label{eq:prelim:pre_cleaning} y_{t}^{*}=\Psi\Big(\frac{y_{t}-\hat{y}_{t|t-1}}{\sigma_{t}}\Big)\sigma_{t} + \hat{y}_{t|t-1}, \end{equation} }\normalsize where \small$\Psi(x)=\begin{cases} x & \textnormal{if}\ |x|<k, \\ sign(x)k & \textnormal{otherwise}, \end{cases}$\normalsize \ and $\hat{\sigma}_{t}$ is an estimated scale of one-step-ahead forecast error at time $t$. Note that, in the Huber $\Psi$-function~\cite{maronna2019robust}, the magnitude of $x$ is upper bounded by $k$. The equation (\ref{eq:prelim:pre_cleaning}) can be interpreted as identifying unexpected high or low observations as outliers and replacing them by more likely values. The time varying error scale $\sigma_{t}$ in (\ref{eq:prelim:pre_cleaning}) is updated by the following equation: {\small \begin{equation} \sigma^{2}_{t}=\phi\rho\Big(\frac{y_{t}-\hat{y}_{t|t-1}}{\sigma_{t-1}}\Big)\sigma^{2}_{t-1} + (1-\phi)\sigma^{2}_{t-1}, \end{equation} }\normalsize where $\phi$ is the smoothing parameter and $\rho(x)$ is the biweight $\rho$-function~\cite{maronna2019robust}, which is defined as: {\small \begin{equation} \label{eq:biweight_rho} \rho(x)=\begin{cases} c_{k}(1-(1-(x/k)^{2})^{3}) & \textnormal{if}\ |x|\leq k, \\ c_{k} & \textnormal{otherwise}. \end{cases} \end{equation} }\normalsize It is common to set $k$ to $2$ and $c_{k}$ to $2.52$ in the Huber $\Psi$-function and the biweight $\rho$-function \cite{gelper2010robust}. \subsection{Proposed Factorization Model for Static Tensors} First, we consider a case where the input tensor is static. Without loss of generality, we assume an $N$-way partially observed tensor $\tensor{Y}\in\mathbb{R}^{I_{1}\times\dots\times I_{N}}$ where the $N$-th mode is temporal, and the others are non-temporal. Since the entries of $\tensor{Y}$ might be contaminated by erroneous values, we assume that $\tensor{Y}$ is a mixture of $\tensor{X}$, a clean low-rank tensor, and $\tensor{O}$, a sparse outlier tensor. This is formulated as $\tensor{Y}=\tensor{X}+\tensor{O}$, where both $\tensor{X}$ and $\tensor{O}$ are the same size as $\tensor{Y}$. In addition to $\tensor{O}$, we seek factor matrices $\{\Un\}_{n=1}^{N}$ that minimize (\ref{eq:batch:smoothObj}). {\small \begin{multline} \label{eq:batch:smoothObj} C(\{\Un\}_{n=1}^{N},\tensor{O}) = \norm{\boldsymbol{\Omega}\circledast(\tensor{Y}-\tensor{O}-\tensor{X})}_{F}^{2} \\ + \lambda_{1}\norm{\ML_{1}\Umat^{(N)}}_{F}^{2} + \lambda_{2}\norm{\ML_{m}\Umat^{(N)}}_{F}^{2} + \lambda_{3}\norm{\tensor{O}}_{1},\\ \textnormal{subject to} \ \tensor{X}=\llbracket\Uone,\dots,\UN\rrbracket, \norm{\tilde{\uvec}_{r}^{(n)}}_{2}=1, \\ \forall{r}\in\{1,\cdots,R\}, \forall{n}\in\{1,\cdots,N-1\}, \end{multline} }\normalsize where $\lambda_{1}$ and $\lambda_{2}$ are the smoothness control parameters, $\lambda_{3}$ is the sparsity control parameter, $m$ is the seasonal period, and each matrix $\mathbf{L}_{i}\in\mathbb{R}^{(I_{N}-i)\times I_{N}}$ is a smoothness constraint matrix. As in \cite{yokota2016smooth}, in $\mathbf{L}_{i}$, $l_{nn}=1$, and $l_{n(n+i)}=-1 \ \textnormal{for all}\ 0\leq n\leq I_{N}-i$, and the other entries are $0$. Note that the columns of the non-temporal factor matrices $\{\Un\}_{n=1}^{N-1}$ are normalized to one, while those of the temporal factor matrix $\Umat^{(N)}$ remain unnormalized. The first and second penalty terms in (\ref{eq:batch:smoothObj}) encourage the temporal and seasonal smoothness in $\Umat^{(N)}$, respectively. Specifically, minimizing $\norm{\ML_{1}\Umat^{(N)}}_{F}^{2}=\sum_{i=1}^{I_{N}-1}\norm{\mathbf{u}_{i}^{(N)}-\mathbf{u}_{i+1}^{(N)}}^{2}$ enforces that the values of consecutive temporal vectors do not change dramatically. Similarly, minimizing $\norm{\ML_{m}\Umat^{(N)}}_{F}^{2}=\sum_{i=1}^{I_{N}-m}\norm{\mathbf{u}_{i}^{(N)}-\mathbf{u}_{i+m}^{(N)}}^{2}$ imposes that the values of temporal vectors of successive seasons do not change abruptly. The last penalty term in (\ref{eq:batch:smoothObj}) enforces sparsity of $\tensor{O}$. \textcolor{black}{After solving the optimization problem, the missing entries can be recovered with the values of the low-rank approximation $\tensor{\hat{X}}=\llbracket\Uone,\dots,\UN\rrbracket$ in the same position.} \subsection{Proposed Factorization Model for Dynamic Tensors} Now, we consider a case where the input tensor is dynamic. Specifically, we assume that $(N-1)$-way incomplete subtensor $\tensor{Y}_{t}\in\mathbb{R}^{I_{1}\times\dots\times I_{N-1}}$, where $t=1,2,\cdots$, are concatenated sequentially over time. Then, at each time $t$, we aim to minimize (\ref{eq:streaming:smoothObj}). Note that if $t=I_{N}$, then (\ref{eq:streaming:smoothObj}) is equivalent to (\ref{eq:batch:smoothObj}), which is the batch optimization problem. {\small \begin{multline} \label{eq:streaming:smoothObj} \hspace{-3mm} C_{t}(\{\Un\}_{n=1}^{N-1},\{\uvec^{(N)}_{\tau},\tensor{O}_{\tau}\}_{\tau=1}^{t}) = \\ \sum_{\tau=1}^{t}\bigg[\norm{\boldsymbol{\Omega}_{\tau}\circledast(\tensor{Y}_{\tau}-\tensor{O}_{\tau}-\tensor{X}_{\tau})}_{F}^{2} + \lambda_{1}\norm{\pvec_{\tau}}_{F}^{2} + \lambda_{2}\norm{\qvec_{\tau}}_{F}^{2} + \lambda_{3}\norm{\tensor{O}_{\tau}}_{1}\bigg],\\ \textnormal{subject to} \ \tensor{X}_{\tau}=\llbracket\ntU,\uvec_{\tau}^{(N)}\rrbracket, \norm{\tilde{\uvec}_{r}^{(n)}}_{2}=1, \\ \forall{r}\in\{1,\cdots,R\}, \forall{n}\in\{1,\cdots,N-1\}, \end{multline} }\normalsize where {\small$\pvec_{\tau}=\mathbf{u}_{\tau-1}^{(N)}-\mathbf{u}_{\tau}^{(N)}$} if $\tau>1$ and $\mathbf{0}$ otherwise, and {\small$\qvec_{\tau}=\mathbf{u}_{\tau-m}^{(N)}-\mathbf{u}_{\tau}^{(N)}$} if $\tau>m$ and $\mathbf{0}$ otherwise. The temporal vector $\mathbf{u}_{\tau}^{(N)}$ is the $\tau$-th row vector of the temporal factor matrix and the temporal component of the subtensor $\tensor{Y}_{\tau}$. \subsection{Initialization} \label{sec:method:init} \begin{algorithm}[t] \small \caption{Initialization}\label{alg:init} \DontPrintSemicolon \SetNoFillComment \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \SetKwProg{Procedure}{Procedure}{}{} \Input{$\{\tensor{Y}_{t},\boldsymbol{\Omega}_{t}\}_{t=1}^{t_{i}}$, $R$, $m$, $\lambda_{1}$, $\lambda_{2}$, $\lambda_{3}$} \Output{(1) completed tensor $\tensor{\hat{X}}_{init}=\{\tensor{\hat{X}}_{t}\}_{t=1}^{t_{i}}$, \newline (2) factor matrices $\{\FMn\}_{n=1}^{N}$} $\tensor{Y}_{init}\leftarrow[\tensor{Y}_{1},\tensor{Y}_{2},\cdots,\tensor{Y}_{t_{i}}]$\\ $\boldsymbol{\Omega}_{init}\leftarrow[\boldsymbol{\Omega}_{1},\boldsymbol{\Omega}_{2},\cdots,\boldsymbol{\Omega}_{t_{i}}]$\\ $\tensor{O}_{init}\leftarrow\boldsymbol{\emptyset}_{I_{1}\times\dots\times I_{N-1}\timest_{i}}$\\ randomly initialize $\{\FMn\}_{n=1}^{N}$\\ $\lambda_{3,init}\leftarrow\lambda_{3}$\\ \Repeat{$\frac{\norm{\tensor{\hat{X}}_{pre}-\tensor{\hat{X}}_{init}}_{F}}{\norm{\tensor{\hat{X}}_{pre}}_{F}}<tol$}{ \label{alg:init:start} $\tensor{\hat{X}}_{init},\{\FMn\}_{n=1}^{N}\leftarrow\textnormal{\textsc{SOFIA\textsubscript{ALS}}\xspace}(\tensor{O}_{init}, ..., \{\FMn\}_{n=1}^{N})$ \\ $\tensor{O}_{init}\leftarrow \textnormal{SoftThresholding}(\boldsymbol{\Omega}_{init}\circledast(\tensor{Y}_{init}-\tensor{\hat{X}}_{init}), \lambda_{3})$\\ $\lambda_{3}\leftarrow d\cdot\lambda_{3}$\\ \If{$\lambda_{3}<\lambda_{3,init}/100$}{ $\lambda_{3}\leftarrow\lambda_{3,init}/100$\\ } } \label{alg:init:end} \normalsize \end{algorithm} \begin{algorithm}[t] \small \caption{\textsc{SOFIA\textsubscript{ALS}}\xspace: Batch Update in \textsc{SOFIA}\xspace}\label{alg:als} \DontPrintSemicolon \SetNoFillComment \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \SetKwProg{Procedure}{Procedure}{}{} \Input{(1) $\tensor{O}$, $\tensor{Y}$, $\boldsymbol{\Omega}$, $R$, $m$, $\lambda_{1}$, $\lambda_{2}$, \newline (2) initial factor matrices $\{\FMn\}_{n=1}^{N}$} \Output{(1) completed tensor $\tensor{\hat{X}}$, \newline (2) updated factor matrices $\{\FMn\}_{n=1}^{N}$} $\tensor{Y}^{*}=\tensor{Y}-\tensor{O}$\\ \Repeat{$\Delta fitness<tol$}{ \For{$n=1,\cdots,N-1$}{ \For{$i_{n}=1,\cdots,I_{n}$}{ Calculate $\mathbf{B}^{(n)}_{i_{n}}$ and $\mathbf{c}^{(n)}_{i_{n}}$ using (\ref{eq:als:Binn}) and (\ref{eq:als:cinn})\\ Update $\uvec_{i_{n}}^{(n)}$ using (\ref{eq:als:nontemporal}) } \For{$r=1,\cdots,R$}{ $\tilde{\uvec}_{r}^{(N)}\leftarrow\tilde{\uvec}_{r}^{(N)}\cdot\norm{\tilde{\uvec}_{r}^{(n)}}_{2}$\\ $\tilde{\uvec}_{r}^{(n)}\leftarrow\tilde{\uvec}_{r}^{(n)}/\norm{\tilde{\uvec}_{r}^{(n)}}_{2}$ } } \For{$i_{N}=1,\cdots,I_{N}$}{ Calculate $\mathbf{B}^{(N)}_{i_{N}}$ and $\mathbf{c}^{(N)}_{i_{N}}$ using (\ref{eq:als:Binn}) and (\ref{eq:als:cinn})\\ Update $\uvec_{i_{N}}^{(N)}$ using (\ref{eq:als:temporal}) } $\tensor{\hat{X}}\leftarrow\llbracket\Uone,\dots,\UN\rrbracket$\\ $fitness\leftarrow 1-\frac{\norm{\boldsymbol{\Omega}\circledast(\tensor{Y}^{*}-\tensor{\hat{X}})}_{F}}{\norm{\boldsymbol{\Omega}\circledast\tensor{Y}^{*}}_{F}}$ } \normalsize \end{algorithm} We first initialize all the factor matrices $\{\FMn\}_{n=1}^{N}$ by solving the batch optimization problem in (\ref{eq:batch:smoothObj}) using a subset of the corrupted tensor data over a short period of time. Let $t_{i}$ denotes the start-up period. We use the first $3$ seasons for initialization (i.e. $t_{i}=3m$), following the general convention for initializing the Holt-Winters method~\cite{hyndman2018forecasting}. Algorithm~\ref{alg:init} describes the overall procedure of the initialization step. First, we make a batch tensor $\tensor{Y}_{init}\in\mathbb{R}^{I_{1}\times\dots\times I_{N-1}\timest_{i}}$ by concatenating $t_{i}$ subtensors $\tensor{Y}_{t}$. Next, we factorize the outlier-removed tensor $\tensor{Y}^{*}=\tensor{Y}_{init}-\tensor{O}_{init}$ to get factor matrices, including a temporally and seasonally smooth temporal factor matrix, using \textsc{SOFIA\textsubscript{ALS}}\xspace (Algorithm~\ref{alg:als}), which we describe below. After that, we update the outlier tensor $\tensor{O}_{init}$ by applying the element-wise soft-thresholding with the threshold $\lambda_{3}$, defined as (\ref{eq:softthresholding}), to $\boldsymbol{\Omega}_{init}\circledast(\tensor{Y}_{init}-\tensor{\hat{X}}_{init})$. \begin{equation} \label{eq:softthresholding} \textnormal{SoftThresholding}(x,\lambda_{3})=\textnormal{sign}(x)\cdot\max(|x|-\lambda_{3},0). \end{equation} These two tasks, \textsc{SOFIA\textsubscript{ALS}}\xspace and SoftThresholding, are repeated until the relative change of the recovered tensor $\tensor{\hat{X}}_{init}$ in two successive iterations is less than the tolerance. Note that, we update $\lambda_{3}$ to $d\cdot\lambda_{3}$ after each soft-thresholding. This helps $\tensor{\hat{X}}_{init}$ converge quickly. Conceptually, it can be thought of as filtering out large outliers in the first few iterations and small outliers in the later iterations. We set $d=0.85$. In \textsc{SOFIA\textsubscript{ALS}}\xspace, we use the alternating least squares (ALS) method to minimize the objective function in (\ref{eq:batch:smoothObj}) as its name implies. The ALS approach updates the factor matrices alternately in such a way that one matrix is updated while fixing the others. We update the non-temporal factor matrices one by one and row by row, as formulated in Theorem~\ref{theorem:als:nontemporal}. \begin{theorem}[Update rule for $\uvec_{i_{n}}^{(n)}$] \label{theorem:als:nontemporal} For each row $\uvec_{i_{n}}^{(n)}$ of each non-temporal matrix $\Umat^{(n)}$, (\ref{eq:als:nontemporal}) holds. {\small \begin{equation} \label{eq:als:nontemporal} \argmin\nolimits_{\uvec_{i_{n}}^{(n)}}C(\{\Un\}_{n=1}^{N},\tensor{O})={\mathbf{B}^{(n)}_{i_{n}}}^{-1}\mathbf{c}^{(n)}_{i_{n}}, \end{equation} }\normalsize where {\small \begin{align} \label{eq:als:Binn} \mathbf{B}^{(n)}_{i_{n}} & = \ \sum_{\mathclap{(i_{1},\dots,i_{N})\in\Omegainn}}\ \ \ \ \ \ \bigHadamard_{l\neq n} \uvec^{(l)}_{i_{l}}(\bigHadamard_{l\neq n} \uvec^{(l)}_{i_{l}})^{\top}, \\ \label{eq:als:cinn} \mathbf{c}^{(n)}_{i_{n}} & = \ \sum_{\mathclap{(i_{1},\dots,i_{N})\in\Omegainn}}\ \ y^{*}_{i_{1},\dots,i_{N}}\bigHadamard_{l\neq n} \uvec^{(l)}_{i_{l}}, \vspace{-3mm} \end{align} }\normalsize \hspace{-1mm}$y^{*}_{i_{1},\dots,i_{N}}=y_{i_{1},\dots,i_{N}}-o_{i_{1},\dots,i_{N}}$, and $\Omega^{(n)}_{i_{n}}$ is the set of indices of the observed entries whose $n$-th mode's index is $i_{n}$. \end{theorem} \begin{proof} For all $1\leq i_{n}\leq I_{n}$ and $1\leq j \leq R$, {\small \begin{equation*} \frac{\partial C}{\partial u^{(n)}_{i_{n}j}} = \ \ \ \sum_{\mathclap{(i_{1},\dots,i_{N})\in\Omegainn}}\ \ \ 2\Big(\big(\sum_{r=1}^{R}\prod_{l=1}^{N}u^{(l)}_{i_{l}r}-y^{*}_{i_{1},\dots,i_{N}}\big)\prod_{l\neq n}u^{(l)}_{i_{l}j}\Big)=0. \end{equation*} }\normalsize It is equivalent to {\footnotesize \begin{multline*} \sum_{\mathclap{\substack{(i_{1},\dots,i_{N})\\\in\Omegainn}}}\ \ \Big(\sum_{r=1}^{R}\big(u^{(n)}_{i_{n}r}\prod_{l\neq n}u^{(l)}_{i_{l}r}\big)\prod_{l\neq n}u^{(l)}_{i_{l}j}\Big)= \sum_{\mathclap{\substack{(i_{1},\dots,i_{N})\\\in\Omegainn}}}\ \ \Big(y^{*}_{i_{1},\dots,i_{N}}\prod_{l\neq n}u^{(l)}_{i_{l}j}\Big), \forall j. \end{multline*} }\normalsize Then, vectorize the equation as: {\small \begin{equation*} \mathbf{B}^{(n)}_{i_{n}}\uvec_{i_{n}}^{(n)}=\mathbf{c}^{(n)}_{i_{n}} \Leftrightarrow \uvec_{i_{n}}^{(n)}={\mathbf{B}^{(n)}_{i_{n}}}^{-1}\mathbf{c}^{(n)}_{i_{n}}.\qedhere \end{equation*} }\normalsize \end{proof} We next update the temporal factor matrix $\Umat^{(N)}$ row by row as formulated in Theorem~\ref{theorem:als:temporal}. \begin{theorem}[Update Rule for $\uvec_{i_{N}}^{(N)}$] \label{theorem:als:temporal} For each row $\uvec_{i_{N}}^{(N)}$ of the temporal matrix $\Umat^{(N)}$, (\ref{eq:als:temporal}) holds. \end{theorem} \begin{proof} For all $1\leq i_{N}\leq I_{N}$ and $1\leq j \leq R$, {\small \begin{multline} \label{eq:als:temporal:derivative} \frac{\partial C}{\partial u^{(N)}_{i_{N}j}} = \ \ \ \sum_{\mathclap{(i_{1},\dots,i_{N})\in\OmegaiNN}}\ \ \ 2\Big(\big(\sum_{r=1}^{R}\prod_{l=1}^{N}u^{(l)}_{i_{l}r}-y^{*}_{i_{1},\dots,i_{N}}\big)\prod_{l\neq N}u^{(l)}_{i_{l}j}\Big) \\ + 2K_{i_{N}j} + 2H_{i_{N}j} = 0, \end{multline} }\normalsize where $K_{i_{N}j}$ and $H_{i_{N}j}$ are defined as (\ref{eq:kappa_eta}). We vectorize the solution of (\ref{eq:als:temporal:derivative}) as (\ref{eq:als:temporal}). See the supplementary document~\cite{sofia2020supple} for a full proof. \end{proof} The iterations are repeated until the fitness change in two consecutive iterations is less than the tolerance. \begin{figure*}[!t] \vspace{-4mm} \hrulefill \small \begin{align} & \uvec_{i_{N}}^{(N)}= \begin{cases} \big(\mathbf{B}^{(N)}_{i_{N}}+(\lambda_{1}+\lambda_{2})\mathbf{I}_{R}\big)^{-1}\big(\mathbf{c}^{(N)}_{i_{N}}+\lambda_{1}\mathbf{u}_{i_{N}+1}^{(N)}+\lambda_{2}\mathbf{u}_{i_{N}+m}^{(N)}\big) & \textnormal{if}\ i_{N}=1, \\ \big(\mathbf{B}^{(N)}_{i_{N}}+(2\lambda_{1}+\lambda_{2})\mathbf{I}_{R}\big)^{-1}\big(\mathbf{c}^{(N)}_{i_{N}}+\lambda_{1}(\mathbf{u}_{i_{N}-1}^{(N)}+\mathbf{u}_{i_{N}+1}^{(N)})+\lambda_{2}\mathbf{u}_{i_{N}+m}^{(N)}\big) & \textnormal{else if}\ 1<i_{N}\leq m, \\ \big(\mathbf{B}^{(N)}_{i_{N}}+2(\lambda_{1}+\lambda_{2})\mathbf{I}_{R}\big)^{-1}\big(\mathbf{c}^{(N)}_{i_{N}}+\lambda_{1}(\mathbf{u}_{i_{N}-1}^{(N)}+\mathbf{u}_{i_{N}+1}^{(N)})+\lambda_{2}(\mathbf{u}_{i_{N}-m}^{(N)}+\mathbf{u}_{i_{N}+m}^{(N)})\big) & \textnormal{else if}\ m<i_{N}\leq I_{N}-m, \\ \big(\mathbf{B}^{(N)}_{i_{N}}+(2\lambda_{1}+\lambda_{2})\mathbf{I}_{R}\big)^{-1}\big(\mathbf{c}^{(N)}_{i_{N}}+\lambda_{1}(\mathbf{u}_{i_{N}-1}^{(N)}+\mathbf{u}_{i_{N}+1}^{(N)})+\lambda_{2}\mathbf{u}_{i_{N}-m}^{(N)}\big) & \textnormal{else if}\ I_{N}-m<i_{N}\leq I_{N}-1, \\ \big(\mathbf{B}^{(N)}_{i_{N}}+(\lambda_{1}+\lambda_{2})\mathbf{I}_{R}\big)^{-1}\big(\mathbf{c}^{(N)}_{i_{N}}+\lambda_{1}\mathbf{u}_{i_{N}-1}^{(N)}+\lambda_{2}\mathbf{u}_{i_{N}-m}^{(N)}\big) & \textnormal{otherwise}. \\ \end{cases} \label{eq:als:temporal} \\ & K_{i_{N}j} =\begin{cases} \lambda_{1}(u^{(N)}_{i_{N}j}-u^{(N)}_{(i_{N}+1)j}) & \textnormal{if}\ i_{N}=1, \\ -\lambda_{1}(u^{(N)}_{(i_{N}-1)j}-u^{(N)}_{i_{N}j}) & \textnormal{if}\ i_{N}=I_{N}, \\ 2\lambda_{1}u^{(N)}_{i_{N}j}-\lambda_{1}(u^{(N)}_{(i_{N}-1)j}+u^{(N)}_{(i_{N}+1)j}) & \textnormal{otherwise}, \\ \end{cases} \text{~} H_{i_{N}j}=\begin{cases} \lambda_{2}(u^{(N)}_{i_{N}j}-u^{(N)}_{(i_{N}+m)j}) & \textnormal{if}\ 1\leq i_{N}\leq m, \\ -\lambda_{2}(u^{(N)}_{(i_{N}-m)j}-u^{(N)}_{i_{N}j}) & \textnormal{if}\ i_{N} > I_{N}-m, \\ 2\lambda_{2}u^{(N)}_{i_{N}j}-\lambda_{2}(u^{(N)}_{(i_{N}-m)j}+u^{(N)}_{(i_{N}+m)j}) & \textnormal{otherwise}. \\ \end{cases} \label{eq:kappa_eta} \end{align} \normalsize \hrulefill \end{figure*} \subsection{Fitting the Holt-Winters model} \label{sec:method:hw} Through initialization, we can get a temporally and seasonally smooth temporal factor matrix $\Umat^{(N)}$. Each of the column vectors of $\Umat^{(N)}$ (i.e., $\tilde{\uvec}^{(N)}_{1},\tilde{\uvec}^{(N)}_{2},\cdots,\tilde{\uvec}^{(N)}_{R}$) can be thought of as seasonal time series of length $t_{i}$ with seasonal period $m$. In this step, we capture seasonal patterns and trend from each of $\tilde{\uvec}^{(N)}_{1},\tilde{\uvec}^{(N)}_{2},\cdots,\tilde{\uvec}^{(N)}_{R}$ by fitting the additive Holt-Winters model (see Section~\ref{sec:prelim:hw} for details). We optimize the HW model by BFGS-B~\cite{byrd1995limited}, which belongs to quasi-Newton methods for solving non-linear optimization problem with box constraints on variables. For each $\tilde{\uvec}^{(N)}_{r}$, we can get the level $\tilde{\textbf{\textit{l}}}_{r}$, trend $\tilde{\textbf{\textit{b}}}_{r}$, and seasonal component $\tilde{\textbf{\textit{s}}}_{r}$, and the corresponding smoothing parameters (i.e., $\alpha_{r}$, $\beta_{r}$, and $\gamma_{r}$, which are $r$-th entry of vectors $\boldsymbol{\alpha},\boldsymbol{\beta},\boldsymbol{\gamma}\in\mathbb{R}^{R}$, respectively). As seen in (\ref{eq:hw_smoothing}) and (\ref{eq:hw_forecast}), the HW model requires only the last values of the level and trend component, and the last one season of the seasonal component. Thus, only the last time of level $\textbf{\textit{l}}_{t_{i}}$ and trend $\textbf{\textit{b}}_{t_{i}}$, and the last $m$ values of the seasonal component (i.e., $\textbf{\textit{s}}_{t_{i}-m+1},\dots,\textbf{\textit{s}}_{t_{i}}$) are needed. \subsection{Dynamic Update} \label{sec:method:update} \DecMargin{0.5em} \begin{algorithm}[t] \small \caption{Dynamic Updates in \textsc{SOFIA}\xspace}\label{alg:dynamic} \DontPrintSemicolon \SetNoFillComment \SetKwInOut{Input}{Input} \SetKwInOut{Output}{Output} \SetKwProg{Function}{Function}{}{} \SetKwFunction{Preclean}{PRE_CLEANING} \SetKwFunction{Delete}{DELETE} \Input{(1) $\{\tensor{Y}_{t},\boldsymbol{\Omega}_{t}\}_{t=t_{i}+1}^{\infty}$, $R$, $m$, $\lambda_{1}$, $\lambda_{2}$, $\lambda_{3}$, $\mu$, $\phi$, \newline (2) $\{\Un_{t_{i}}\}_{n=1}^{N-1}$, $\{\uvec^{(N)}_{t}\}_{t=t_{i}-m+1}^{t_{i}}$, \newline (3) HW factors $\textbf{\textit{l}}_{t_{i}}$, $\textbf{\textit{b}}_{t_{i}}$, $\{\textbf{\textit{s}}_{t}\}_{t=t_{i}-m+1}^{t_{i}}$, $\boldsymbol{\alpha}$, $\boldsymbol{\beta}$, $\boldsymbol{\gamma}$} ${\bm\Sigma}_{t_{i}}\leftarrow\lambda_{3}/100\times\boldsymbol{1}_{I_{1}\times\dots\times I_{N-1}}$\\ \For{$t=t_{i}+1,t_{i}+2,\cdots$}{ $\hat{\uvec}^{(N)}_{t|t-1}\leftarrow\textbf{\textit{l}}_{t-1}+\textbf{\textit{b}}_{t-1}+\textbf{\textit{s}}_{t-m}$\\ $\hat{\TY}_{t|t-1}\leftarrow\llbracket\{\Un_{t-1}\}_{n=1}^{N-1};\hat{\uvec}^{(N)}_{t|t-1}\rrbracket$\\ Estimate $\tensor{O}_{t}$ with (\ref{eq:dynamic:outliers})\\ Update ${\bm\Sigma}_{t}$ with (\ref{eq:update:bSigma})\\ \For{$n=1,\cdots,N-1$}{ Update $\Umat^{(n)}_{t}$ using (\ref{eq:gradient:nontemp}) } Update $\uvec^{(N)}_{t}$ using (\ref{eq:gradient:temp})\\ Update $\textbf{\textit{l}}_{t}$, $\textbf{\textit{b}}_{t}$, $\textbf{\textit{s}}_{t}$ using (\ref{eq:update:hwfactors})\\ $\hat{\tensor{X}}_{t}\leftarrow\llbracket\ntUnt,\uvec^{(N)}_{t}\rrbracket$\\ } \normalsize \end{algorithm} We let $\{\Un_{t}\}_{n=1}^{N-1}$ be the non-temporal factor matrices after processing the $t$-th subtensor $\tensor{Y}_{t}$. At time $t$, we receive $\tensor{Y}_{t}$ and have the previous estimates of the non-temporal factor matrices $\{\Un_{t-1}\}_{n=1}^{N-1}$ and the previous $m$ estimates of the temporal vectors $\uvec^{(N)}_{t-m},\cdots,\uvec^{(N)}_{t-1}$. We also have the previous level and trend components $\textbf{\textit{l}}_{t-1}$ and $\textbf{\textit{b}}_{t-1}$, and the previous $m$ seasonal components $\textbf{\textit{s}}_{t-m},\cdots,\textbf{\textit{s}}_{t-1}$. Through the following steps, we can update our factorization model and impute the missing values incrementally. Algorithm~\ref{alg:dynamic} describes the procedure of the dynamic update step. \subsubsection{Estimate $\tensor{O}_{t}$} We first estimate the outlier subtensor $\tensor{O}_{t}$. We predict the temporal vector by one-step-ahead Holt-Winters' forecast (see Section~\ref{sec:prelim:hw} for details) as follows: {\small \begin{equation} \label{eq:forecast:uNhat} \hat{\uvec}^{(N)}_{t|t-1}=\textbf{\textit{l}}_{t-1}+\textbf{\textit{b}}_{t-1}+\textbf{\textit{s}}_{t-m}. \end{equation} }\normalsize We then predict the next subtensor $\hat{\TY}_{t|t-1}$ as follows: {\small \begin{equation} \label{eq:forecast:Ythat} \hat{\TY}_{t|t-1}=\llbracket\{\Un_{t-1}\}_{n=1}^{N-1},\hat{\uvec}^{(N)}_{t|t-1}\rrbracket. \end{equation} }\normalsize We regard the observations that deviate significantly from the prediction $\hat{\TY}_{t|t-1}$ as outliers. Specifically, we identify the outliers by checking whether the difference between observation and prediction is greater than twice of the scale of error. By extending the Gelper's pre-cleaning approach (see Section~\ref{sec:prelim:robust}) to a tensor, we can estimate $\tensor{O}_{t}$ as follows: {\small \begin{align} \TYt^{*} & =\Psi\Big(\frac{\tensor{Y}_{t}-\hat{\TY}_{t|t-1}}{{\bm\Sigma}_{t-1}}\Big){\bm\Sigma}_{t-1}+\hat{\TY}_{t|t-1} = \tensor{Y}_{t}-\tensor{O}_{t}, \nonumber \\ \Leftrightarrow \tensor{O}_{t} & = \tensor{Y}_{t}-\hat{\TY}_{t|t-1}-\Psi\Big(\frac{\tensor{Y}_{t}-\hat{\TY}_{t|t-1}}{{\bm\Sigma}_{t-1}}\Big){\bm\Sigma}_{t-1}, \label{eq:dynamic:outliers} \end{align} }\normalsize where $\Psi(\cdot)$ is the element-wise Huber $\Psi$-function (we set $k=2$), and ${\bm\Sigma}_{t-1}\in\mathbb{R}^{I_{1}\times\dots\times I_{N-1}}$ is an error scale tensor each of whose entries is the scale of one-step-ahead forecast error in the corresponding entry. In order to enable our model to adapt, we update the error scale tensor as follows: {\small \begin{equation} \label{eq:update:bSigma} {\bm\Sigma}^{2}_{t}=\phi\rho\Big(\frac{\tensor{Y}_{t}-\hat{\TY}_{t|t-1}}{{\bm\Sigma}_{t-1}}\Big){\bm\Sigma}^{2}_{t-1}+(1-\phi){\bm\Sigma}^{2}_{t-1}, \end{equation} }\normalsize where $0\leq\phi\leq 1$ is a smoothing parameter and $\rho(x)$ is the element-wise biweight $\rho$-function, defined as (\ref{eq:biweight_rho}). We set $k=2$ and $c_{k}=2.52$ for the biweight $\rho$-function. Note that, the main difference between Gelper's approach and our method is that our method rejects outliers first and updates the error scale tensor, while Gelper's approach updates the error scale first. The reason is that the error scale tensor can be contaminated by extremely large outliers if the error scale updates first. We calculate the error scale for each entry because the variation may differ in different entries. The initial value of all entries in ${\bm\Sigma}_{t_{i}}$ are set to $\lambda_{3}/100$. \subsubsection{Update $\{\Un_{t}\}_{n=1}^{N-1}$} Ideally, we need to update the non-temporal factor matrices considering all the historical data as seen in (\ref{eq:streaming:smoothObj}). However, this is not feasible since we are dealing with a tensor stream whose length could be infinite. We therefore focus only on the current input subtensor $\tensor{Y}_{t}$ and update each of the factor matrices using gradient descent (GD). To this end, we define a new cost function $f_{t}$ considering only the $t$-th summand of (\ref{eq:streaming:smoothObj}) as follows: {\small \begin{multline} \label{eq:ft} f_{t}(\{\Un\}_{n=1}^{N-1},\uvec^{(N)}) = \norm{\boldsymbol{\Omega}_{t}\circledast(\tensor{Y}_{t}-\tensor{O}_{t}-\llbracket\ntU,\uvec^{(N)}\rrbracket)}_{F}^{2} \\ + \lambda_{1}\norm{\uvec^{(N)}_{t-1}-\uvec^{(N)}}_{F}^{2} + \lambda_{2}\norm{\uvec^{(N)}_{t-m}-\uvec^{(N)}}_{F}^{2} + \lambda_{3}\norm{\tensor{O}_{t}}_{1}. \end{multline} }\normalsize Let $\tensor{R}_{t}$ be a residual subtensor defined as $\boldsymbol{\Omega}_{t}\circledast(\tensor{Y}_{t}-\tensor{O}_{t}-\hat{\TY}_{t|t-1})$. The non-temporal factor matrices are updated by taking a step of size $\mu$ in the direction of minimizing the cost function in (\ref{eq:ft}) as follows: {\small \begin{align} \label{eq:gradient:nontemp} \Umat^{(n)}_{t} & = \Umat^{(n)}_{t-1}-\mu\frac{\partialf_{t}(\{\Un_{t-1}\}_{n=1}^{N-1},\hat{\uvec}^{(N)}_{t|t-1})}{\partial\Umat^{(n)}} \nonumber \\ & = \Umat^{(n)}_{t-1}+2\mu\mathbf{R}_{(n)} \mathop{\scalebox{1.4}{\raisebox{-0.2ex}{$\odot$}}}_{l=1,l\neq n}^{N-1}\mathbf{U}^{(l)}_{t-1}\cdot\textnormal{diag}(\hat{\uvec}^{(N)}_{t|t-1}), \end{align} }\normalsize where $\mathbf{R}_{(n)}$ is the mode-$n$ matricization of $\tensor{R}_{t}$. \subsubsection{Update $\uvec^{(N)}_{t}$} Next, we update the temporal vector $\uvec^{(N)}_{t}$ by a gradient descent step of size $\mu$ as follows: {\small \begin{align} \label{eq:gradient:temp} \uvec^{(N)}_{t} & = \hat{\uvec}^{(N)}_{t|t-1}-\mu\frac{\partialf_{t}(\{\Un_{t-1}\}_{n=1}^{N-1},\hat{\uvec}^{(N)}_{t|t-1})}{\partial\uvec^{(N)}} \nonumber \\ & \begin{aligned} {}=\hat{\uvec}^{(N)}_{t|t-1}+2\mu\Big[(\mathop{\scalebox{1.4}{\raisebox{-0.2ex}{$\odot$}}}_{n=1}^{N-1}\mathbf{U}^{(n)}_{t-1})^{\top}\cdot\textnormal{vec}(\tensor{R}_{t})+ \lambda_{1}\uvec^{(N)}_{t-1} \\ +\lambda_{2}\uvec^{(N)}_{t-m}-(\lambda_{1}+\lambda_{2})\hat{\uvec}^{(N)}_{t|t-1})\Big], \end{aligned} \end{align} }\normalsize where $\textnormal{vec}(\cdot)$ is the vectorization operator. \subsubsection{Update $\textbf{\textit{l}}_{t},\textbf{\textit{b}}_{t},\textbf{\textit{s}}_{t}$} We update the level, trend, and seasonal components of the Holt-Winters model with the updated temporal vector by (\ref{eq:update:hwfactors}), which extends (\ref{eq:hw_smoothing}) to vectors: {\small \begin{subequations} \label{eq:update:hwfactors} \begin{equation} \label{eq:update:level} \textbf{\textit{l}}_{t} = \textnormal{diag}(\boldsymbol{\alpha})(\uvec^{(N)}_{t}-\textbf{\textit{s}}_{t-m})+(\mathbf{I}_{R}-\textnormal{diag}(\boldsymbol{\alpha}))(\textbf{\textit{l}}_{t-1}+\textbf{\textit{b}}_{t-1}), \end{equation} \begin{equation} \label{eq:update:trend} \textbf{\textit{b}}_{t} = \textnormal{diag}(\boldsymbol{\beta})(\textbf{\textit{l}}_{t}-\textbf{\textit{l}}_{t-1})+(\mathbf{I}_{R}-\textnormal{diag}(\boldsymbol{\beta}))\textbf{\textit{b}}_{t-1}, \end{equation} \begin{equation} \label{eq:update:seasonal} \textbf{\textit{s}}_{t} = \textnormal{diag}(\boldsymbol{\gamma})(\uvec^{(N)}_{t}-\textbf{\textit{l}}_{t-1}-\textbf{\textit{b}}_{t-1})+(\mathbf{I}_{R}-\textnormal{diag}(\boldsymbol{\gamma}))\textbf{\textit{s}}_{t-m}, \end{equation} \end{subequations} }\normalsize where diag($\cdot$) is an operator that creates a matrix with the elements of input vector on the main diagonal and $\mathbf{I}_{R}$ is an $R$-by-$R$ identity matrix. \subsubsection{Compute $\hat{\tensor{X}}_{t}$} Lastly, we can get $\hat{\tensor{X}}_{t}$ by: {\small \begin{equation} \hat{\tensor{X}}_{t}=\llbracket\ntUnt,\uvec^{(N)}_{t}\rrbracket. \end{equation} }\normalsize Using the reconstructed subtensor $\hat{\tensor{X}}_{t}$, we can estimate the missing values on $\tensor{Y}_{t}$. \subsection{Forecast} \label{sec:method:forecasting} Let $t_{end}$ be the last timestamp of the stream. Given any $t=t_{end}+h$, where $h$ is a positive integer, we can forecast a future temporal vector $\hat{\uvec}^{(N)}_{t|t_{end}}$ using the level, trend, and seasonal components by applying (\ref{eq:hw_forecast}) to each of its elements. We also can forecast a future subtensor $\hat{\tensor{Y}}_{t|t_{end}}$ using the most recent non-temporal factor matrices $\{\Umat^{(n)}_{t_{end}}\}_{n=1}^{N-1}$ and the predicted temporal vector $\hat{\uvec}^{(N)}_{t|t_{end}}$ by: {\small \begin{equation} \hat{\tensor{Y}}_{t|t_{end}}=\llbracket\{\Umat^{(n)}_{t_{end}}\}_{n=1}^{N-1},\hat{\uvec}^{(N)}_{t|t_{end}}\rrbracket. \end{equation} }\normalsize \begin{figure*}[!t] \vspace{-4mm} \centering \subfigure[Ground Truth]{\label{fig:als:ground} \includegraphics[width=0.18\linewidth]{FIG/temporal/temporal_true.pdf} } \subfigure[Initialization with the vanilla ALS~\cite{zhou2008large}]{\label{fig:als:vanilla} \includegraphics[width=0.668\linewidth]{FIG/temporal/temporal_vanilla_final.pdf} }\\ \subfigure[Initialization with \textsc{SOFIA\textsubscript{ALS}}\xspace (Proposed)]{\label{fig:als:sofia} \includegraphics[width=0.668\linewidth]{FIG/temporal/temporal_sofia_final.pdf} } \subfigure[Normalized Residual Error]{\label{fig:als:nre} \includegraphics[width=0.18\linewidth]{FIG/temporal/temporal_sofia_vanilla_nre_final.pdf} } \caption[]{\label{fig:exp:sofia_als} \textbf{\textsc{SOFIA\textsubscript{ALS}}\xspace accurately captured temporal patterns} from an incomplete and noisy tensor in the initialization step. We used a synthetic tensor with the temporal factor matrix shown in (a) and performed experiments under the $(90,20,7)$ environment. (b) and (c) show the evolution of the temporal factor matrix as the outer iteration (lines~\ref{alg:init:start}-\ref{alg:init:end} in Algorithm~\ref{alg:init}) proceeded, when the vanilla ALS and \textsc{SOFIA\textsubscript{ALS}}\xspace were used in the initialization step, respectively. (d) shows the normalized residual error between the ground truth and the temporal factor matrix obtained by each of the algorithms as the outer iteration proceeded. \textbf{Using temporal and seasonal smoothness was greatly helpful} for \textsc{SOFIA\textsubscript{ALS}}\xspace to find the underlying temporal patterns. } \end{figure*} \subsection{Time Complexity} \label{sec:method:complexity} The time complexity of \textsc{SOFIA}\xspace is the sum of the complexity of each step (i.e., initialization, HW fitting, and dynamic updates). Since the time cost of fitting the HW model depends only on the length of the series (i.e., $O(t_{i})$), it is not a dominant part of the overall complexity. The time complexities of Algorithms~\ref{alg:init} and~\ref{alg:dynamic} are formulated in Lemmas~\ref{lemma:complexity:init} and \ref{lemma:complexity:dynamic}, respectively. \begin{lemma}[Time Complexity of Initialization in \textsc{SOFIA}\xspace] \label{lemma:complexity:init} The time complexity of Algorithm~\ref{alg:init} is $O\big(|\boldsymbol{\Omega}_{init}|NR(N+R)+R^{3}(\sum_{n=1}^{N-1}I_{n}+t_{i})\big)$ per iteration. \end{lemma} \begin{proof} In Algorithm~\ref{alg:als}, updating each row $\uvec_{i_{n}}^{(n)}$ of the factor matrices by (\ref{eq:als:nontemporal}) and (\ref{eq:als:temporal}) takes $O(|\Omega^{(n)}_{i_{n}}|R(N+R)+R^{3})$ time. It is composed of $O(|\Omega^{(n)}_{i_{n}}|RN)$ time to compute $\bigHadamard_{l\neq n} \uvec^{(l)}_{i_{l}}$ for all the entries in $\Omega^{(n)}_{i_{n}}$, $O(|\Omega^{(n)}_{i_{n}}|R^{2})$ time to compute $\mathbf{B}^{(n)}_{i_{n}}$, $O(|\Omega^{(n)}_{i_{n}}|R)$ time to compute $\mathbf{c}^{(n)}_{i_{n}}$, and $O(R^{3})$ time to invert $\mathbf{B}^{(n)}_{i_{n}}$. We update all factor matrices one by one and row by row, and thus the overall complexity of Algorithm~\ref{alg:als}, which is the dominant part in each iteration of Algorithm~\ref{alg:init}, is $O\big(|\boldsymbol{\Omega}_{init}|NR(N+R)+R^{3}(\sum_{n=1}^{N-1}I_{n}+t_{i})\big)$. \end{proof} \begin{lemma}[Time Complexity of Dynamic Updates in \textsc{SOFIA}\xspace] \label{lemma:complexity:dynamic} The time complexity of the iteration of Algorithm~\ref{alg:dynamic} at time $t$ is $O\big(|\boldsymbol{\Omega}_{t}|NR\big)$. \end{lemma} \begin{proof} For the iteration at time $t$, predicting $\hat{\TY}_{t|t-1}$ and updating ${\bm\Sigma}_{t}$ and $\tensor{O}_{t}$ only for the observed entries at time $t$ takes $O(|\boldsymbol{\Omega}_{t}|NR)$ time. Updating $\{\Un_{t}\}_{n=1}^{N-1}$ takes $O(|\boldsymbol{\Omega}_{t}|NR)$ time if we compute only the entries of $\mathop{\scalebox{1.4}{\raisebox{-0.2ex}{$\odot$}}}_{l=1,l\neq n}^{N-1}\mathbf{U}^{(l)}_{t-1}$ multiplied with the non-zeros in $\mathbf{R}_{(n)}$, whose number is $|\boldsymbol{\Omega}_{t}|$, when computing $\mathbf{R}_{(n)}\mathop{\scalebox{1.4}{\raisebox{-0.2ex}{$\odot$}}}_{l=1,l\neq n}^{N-1}\mathbf{U}^{(l)}_{t-1}$. Updating $\uvec^{(N)}_{t}$ also takes $O\big(|\boldsymbol{\Omega}_{t}|NR\big)$ time if we compute only the entries of $\mathop{\scalebox{1.4}{\raisebox{-0.2ex}{$\odot$}}}_{n=1}^{N-1}\mathbf{U}^{(n)}_{t-1}$ multiplied with the non-zeros in $\textnormal{vec}(\tensor{R}_{t})$, whose number is $|\boldsymbol{\Omega}_{t}|$, when computing $(\mathop{\scalebox{1.4}{\raisebox{-0.2ex}{$\odot$}}}_{n=1}^{N-1}\mathbf{U}^{(n)}_{t-1})^{\top}\cdot \textnormal{vec}(\tensor{R}_{t})$. Thus, the overall time complexity is $O\big(|\boldsymbol{\Omega}_{t}|NR\big)$. \end{proof} Since the initialization step is executed only once at the start, after initialization, \textsc{SOFIA}\xspace takes time proportional to the number of observed entries in the received subtensor (i.e., $|\boldsymbol{\Omega}_{t}|$), as shown in Lemma~\ref{lemma:complexity:dynamic}. \subsection{Experiment Specifications}\label{sec:exp:spec} \noindent\underline{\textbf{\smash{Machine and Implementation}}}: We implemented our algorithm and all competitors in Matlab; all the experiments were conducted on a PC with a 3.70GHz Intel i5-9600K CPU and 64GB memory. \begin{table}[t!] \centering \caption{Summary of datasets.} \label{tab:datasets} \scalebox{0.95}{ \begin{tabular}{llll} \toprule {\bf Dataset} & {\bf Dimension} & {\bf Period} & {\bf Granularity in Time} \\ \midrule {\bf Intel Lab Sensor} & $54\times4\times1152^{*}$ & $144$ & every $10$ minutes \\ {\bf Network Traffic} & $23\times23\times2000^{*}$ & $168$ & hourly \\ {\bf Chicago Taxi} & $77\times77\times2016^{*}$ & $168$ & hourly \\ {\bf NYC Taxi} & $265\times265\times904^{*}$ & $7$ & daily \\ \bottomrule \multicolumn{4}{l}{The time mode is marked with an asterisk (*).} \end{tabular} } \end{table} \noindent\underline{\textbf{\smash{Datasets}}}: We conducted experiments on 4 real-world datasets that are summarized in Table~\ref{tab:datasets}. \begin{itemize}[leftmargin=*] \item \textbf{Intel Lab Sensor}~\cite{madden2003intel}: The 4 indoor environmental sensor data collected from 54 positions in the Intel Berkeley Research Lab. We made a tensor with \textit{(position, sensor, time)} triples with a 10-minute interval and standardized the observations from each sensor. \item \textbf{Network Traffic}~\cite{uhlig2006providing}: The network traffic records between 23 routers. We made a tensor with \textit{(source, destination, time)} triples with an 1-hour interval and used $\log_{2}(x+1)$ for each entry $x$ to adjust for scaling bias in the amount of traffic. \item \textbf{Chicago Taxi}\footnote{\url{https://data.cityofchicago.org/Transportation/Taxi-Trips/wrvz-psew}}: The taxi trip data in Chicago. We created a tensor with \textit{(source, destination, pick-up time)} triples with an 1-hour interval and used $\log_{2}(x+1)$ for each entry $x$. \item \textbf{NYC Taxi}\footnote{\url{https://www1.nyc.gov/site/tlc/about/tlc-trip-record-data.page}}: The yellow taxi trip records in New York City. We created a tensor with \textit{(source, destination, pick-up date)} triples and used $\log_{2}(x+1)$ for each entry $x$. \end{itemize} \noindent\underline{\textbf{\smash{Competitors}}}: To evaluate our method, we compare our method with the following seven competitors: (1) \textbf{OnlineSGD\xspace}~\cite{mardani2015subspace}, a streaming CP factorization method optimized by SGD, (2) \textbf{\textsc{OLSTEC}\xspace}~\cite{kasai2016online}, a streaming CP factorization method optimized by recursive least square (RLS), (3) \textbf{\textsc{MAST}\xspace}~\cite{song2017multi}, a multi-aspect streaming tensor completion method, (4) \textbf{\textsc{BRST}\xspace}~\cite{zhang2018variational}, an outlier-robust streaming tensor factorization approach based on bayesian inference, (5) \textbf{\textsc{OR-MSTC}\xspace}~\cite{najafi2019outlier}, a robust multi-aspect streaming tensor completion algorithm, (6) \textbf{\textsc{SMF}\xspace}~\cite{hooi2019smf}, a streaming matrix factorization method that is able to forecast future values using seasonal patterns, and (7) \textbf{\textsc{CPHW}\xspace}~\cite{dunlavy2011temporal}, which can predict future values based on a static tensor factorization and the HW method. The first 5 approaches are used to compare the imputation performance and the last 2 algorithms are used to compare the forecasting performance. \noindent\underline{\textbf{Evaluation Metrics}}: We use the following four metrics to measure the accuracy and efficiency of each algorithm: \begin{itemize} \setlength{\itemindent}{-.15in} \footnotesize \item {\small\textbf{Normalized Residual Error (NRE)}}: $\dfrac{\norm{\hat{\tensor{X}}_{t}-\tensor{X}_{t}}_{F}}{\norm{\tensor{X}_{t}}_{F}}$ \item {\small\textbf{Running Average Error (ARE)}}: $\dfrac{1}{T}\sum_{t=1}^{T}\dfrac{\norm{\hat{\tensor{X}}_{t}-\tensor{X}_{t}}_{F}}{\norm{\tensor{X}_{t}}_{F}}$ \item {\small\textbf{Average Forecasting Error (AFE)}}: $\dfrac{1}{t_{f}}\sum_{h=1}^{t_{f}}\dfrac{\norm{\tensor{\hat{X}}_{t+h|t}-\tensor{X}_{t+h}}_{F}}{\norm{\tensor{X}_{t+h}}_{F}}$ \item {\small\textbf{Average Running Time (ART)}}: $\dfrac{1}{T-t_{i}-1}\sum_{t=t_{i}+1}^{T}RT(t)$ \normalsize \end{itemize} where $T$ is the length of the entire stream, $t_{f}$ is the forecasting time steps, and $RT(t)$ is the running time to process a subtensor at time step $t$. Since the initialization is executed only once, ART is calculated except for the time spent on initialization. Algorithms without initialization are set to $t_{i}=0$. In the following experiments, we computed each evaluation metric $5$ times for each algorithm, and the mean is reported. \begin{figure*}[!t] \centering \vspace{-4mm} \includegraphics[width=0.60\linewidth]{FIG/rae/rae_label.pdf} \vspace{-2mm} \end{figure*} \begin{figure}[!t] \centering \subfigure[Intel Lab Sensor]{\label{fig:art:traffic} \includegraphics[width=0.9\linewidth]{FIG/rae/rae_intel.pdf} }\\ \vspace{-3mm} \subfigure[Network Traffic]{\label{fig:art:traffic} \includegraphics[width=0.9\linewidth]{FIG/rae/rae_network.pdf} }\\ \vspace{-3mm} \subfigure[Chicago Taxi]{\label{fig:art:traffic} \includegraphics[width=0.9\linewidth]{FIG/rae/rae_chicago.pdf} }\\ \vspace{-3mm} \subfigure[NYC Taxi]{\label{fig:art:traffic} \includegraphics[width=0.9\linewidth]{FIG/rae/rae_nyc.pdf} }\\ \vspace{-2mm} \caption[]{\label{fig:exp:imputation:rae} The running average error under 4 experimental settings from the mildest (leftmost) to the harshest (rightmost). \textbf{\textsc{SOFIA}\xspace was the most accurate} in all the tensor streams and all the experimental settings. } \end{figure} \begin{figure}[!t] \centering \subfigure[Intel Lab Sensor]{\label{fig:art:intel} \includegraphics[width=0.9\linewidth]{FIG/art/art_intel.pdf} }\\ \vspace{-3mm} \subfigure[Network Traffic]{\label{fig:art:network} \includegraphics[width=0.9\linewidth]{FIG/art/art_network.pdf} }\\ \vspace{-3mm} \subfigure[Chicago Taxi]{\label{fig:art:chicago} \includegraphics[width=0.9\linewidth]{FIG/art/art_chicago.pdf} }\\ \vspace{-3mm} \subfigure[NYC Taxi]{\label{fig:art:nyc} \includegraphics[width=0.9\linewidth]{FIG/art/art_nyc.pdf} }\\ \vspace{-2mm} \caption[]{\label{fig:exp:art} The average running time to process one subtensor under 4 experimental settings from the mildest (leftmost) to the harshest (rightmost). \textbf{\textsc{SOFIA}\xspace was up to $935\times$ faster} than the second-most accurate algorithm. } \end{figure} \noindent\underline{\smash{\textbf{Parameter Setting}}}: Unless otherwise stated, we used $\lambda_{1}=\lambda_{2}=10^{-3}$, $\lambda_{3}=10$, $\mu=0.1$, and $\phi=0.01$ as default parameters. For baseline methods, we tuned their hyperparameters using grid search or following their authors' suggestions. We set the maximum number of iterations and the tolerance rate to $300$ and $10^{-4}$ for all the methods. The rank is adjusted using 10 ranks varying from 4 to 20 based on running average error. \noindent\underline{\smash{\textbf{Missing and Outlier}}}: A $Y\%$ of randomly selected entries are corrupted by outliers and $X\%$ of randomly selected entries are ignored and treated as missings. The magnitude of each outlier is $-Z\cdot \max(\tensor{X})$ or $Z\cdot\max(\tensor{X})$ with equal probability, where $\max(\tensor{X})$ is the maximum entry value of the entire ground truth tensor. We use a tuple of $(X,Y,Z)$ to denote the experimental setting. For example, $(70,20,5)$ represents that $70\%$ of entries are missing and $20\%$ of entries are contaminated by outliers whose magnitude is $-5\cdot\max(\tensor{X})$ or $5\cdot\max(\tensor{X})$. \subsection{Q1. Initialization Accuracy}\label{sec:exp:sofia_als} We evaluated how precisely the initialization step using \textsc{SOFIA\textsubscript{ALS}}\xspace discovers temporal patterns in an incomplete and noisy tensor as the number of outer iterations (i.e., lines~\ref{alg:init:start}-\ref{alg:init:end} in Algorithm~\ref{alg:init}) increases. We used a low-rank synthetic tensor of size $30\times 30\times 90$ generated by rank-3 factor matrices, i.e., $\mathbf{U}^{(1)},\mathbf{U}^{(2)}\in\mathbb{R}^{30\times 3}$, and $\mathbf{U}^{(3)}\in\mathbb{R}^{90\times 3}$. To model a tensor that has temporal patterns, the $r$-th column of the temporal factor matrix was formulated as $\tilde{\mathbf{u}_{r}}^{(3)}=[a_{r}\sin((2\pi/m)i+b_{r})+c_{r}]$, where $i=1,\dots,90$ and $m=30$, for $r=1,2,3$. The coeffieicnts $a_{r}$, $b_{r}$, and $c_{r}$ were set to values selected uniformly at random from $[-2,2]$, $[0,2\pi]$, and $[-2,2]$, respectively. Figure~\ref{fig:als:ground} shows the ground-truth temporal factor matrix. After that, we set the experimental environment to $(90,20,7)$, which is extremely harsh. We extracted the temporal patterns from the contaminated tensor using two methods: 1) initialization with the vanilla ALS~\cite{zhou2008large} and 2) initialization with \textsc{SOFIA\textsubscript{ALS}}\xspace. As shown in Figures~\ref{fig:als:vanilla}-\ref{fig:als:nre}, the method using \textsc{SOFIA\textsubscript{ALS}}\xspace was able to restore the temporal factor matrix accurately as outer iteration proceeded, while the method using the vanilla ALS did not. This is because temporal and seasonal smoothness considered in \textsc{SOFIA\textsubscript{ALS}}\xspace are greatly helpful to find the underlying patterns even in a situation where $90\%$ of data were lost and many extreme outliers existed. \begin{figure*}[!t] \centering \vspace{-4mm} \includegraphics[width=0.75\linewidth]{FIG/forecast_label.pdf}\\ \vspace{-2mm} \subfigure[Intel Lab Sensor]{\label{fig:forecast:intel} \includegraphics[width=0.20\linewidth]{FIG/forecast_intel.pdf} } \hspace{-3mm} \subfigure[Network Traffic]{\label{fig:forecast:traffic} \includegraphics[width=0.20\linewidth]{FIG/forecast_network.pdf} } \hspace{-3mm} \subfigure[Chicago Taxi]{\label{fig:forecast:chicago} \includegraphics[width=0.20\linewidth]{FIG/forecast_chicago.pdf} } \hspace{-3mm} \subfigure[NYC Taxi]{\label{fig:forecast:nyc} \includegraphics[width=0.20\linewidth]{FIG/forecast_nyc.pdf} }\\ \vspace{-1mm} \caption[]{\label{fig:forecast} The average forecasting error under 4 experimental settings. We evaluated \textsc{SOFIA}\xspace on various fractions of missing entries, while the competitors were evaluated assuming all entries are observed. \textbf{\textsc{SOFIA}\xspace was the most accurate}, despite the presence of missing values. } \end{figure*} \subsection{Q2. Imputation Accuracy}\label{sec:exp:imputation} We measured how accurately \textsc{SOFIA}\xspace estimates missing entries. Figure~\ref{fig:exp:imputation:nre} shows the accuracy of the considered approaches at each time $t$ in four different levels of missing ratio, outlier ratio, and outlier magnitude. The mildest setting was $(20,10,2)$, and the most extreme one was $(70,20,5)$. In all the tensor streams, \textsc{SOFIA}\xspace was the most accurate in terms of normalized residual error (NRE) regardless of the degree of missing data and outliers. This is because \textsc{SOFIA}\xspace discovers seasonal patterns behind the noisy and incomplete data and accurately predicts the entries in the next time step using the HW method. Based on the predictions, \textsc{SOFIA}\xspace filters out extremely high or low values regarded as outliers, and thus \textsc{SOFIA}\xspace is robust to outliers. Since OnlineSGD\xspace, \textsc{OLSTEC}\xspace, and \textsc{MAST}\xspace do not distinguish outliers from normal values, their models are susceptible to outliers. Since \textsc{OR-MSTC}\xspace is designed to deal with outliers that are distributed over a specific mode of the tensor (e.g., 2-nd mode outliers), it is not effective to handle element-wise outliers used in this experiment. We did not report the results of \textsc{BRST}\xspace, which wrongly estimated that the rank is $0$ in all the tensor streams. Figure~\ref{fig:exp:imputation:rae} shows the overall accuarcy over the entire stream. \textsc{SOFIA}\xspace gave up to $76\%$ smaller running average error (RAE) than the second-most accurate approach. \subsection{Q3. Speed}\label{sec:exp:speed} We measured the average running time of the dynamic update steps of different approaches. Note that since the initialization and HW fitting steps in \textsc{SOFIA}\xspace are executed only once at the beginning, the time spent for them becomes negligible as the stream evolves continuously. Similarly, time spent for initialization in \textsc{MAST}\xspace and \textsc{OR-MSTC}\xspace were excluded. Figure~\ref{fig:exp:art} shows the average running time to process a single subtensor. \textsc{SOFIA}\xspace was the fastest in the NYC Taxi, Chicago Taxi, and Intel Lab Sensor datasets, while \textsc{SOFIA}\xspace was comparable to the fastest competitor in the Network Traffic dataset. Notably, \textsc{SOFIA}\xspace was $2.2-935\times$ faster than the second-most accurate algorithm, demonstrating that \textsc{SOFIA}\xspace is suitable for real-time data processing. \subsection{Q4. Forecasting Accuracy}\label{sec:exp:forecasting} We evaluated the forecasting accuracy of \textsc{SOFIA}\xspace compared to two competitors. Each algorithm consumes $(T-t_{f})$ subtensors and forecasts the following $t_{f}$ subtensors. We set $t_{f}$ to $200$ for the Chicago Taxi, Network Traffic, and Intel Lab Sensor datasets and set it to $100$ for the NYC Taxi dataset. We injected $20\%$ outliers whose magnitudes are $\pm 5 \cdot \max(\tensor{X})$. Since the competitors do not take missing values into account, we evaluated them assuming all entries are observed, while \textsc{SOFIA}\xspace is evaluated on various fractions of missing entries. We used the average forecasting error (AFE) for the future subtensors to measure the accuracy. As seen in Figure~\ref{fig:forecast}, in all the tensor streams, \textsc{SOFIA}\xspace was the most accurate despite the presence of missing entries. Especially, in the Intel Lab Sensor dataset, \textsc{SOFIA}\xspace gave up to $71\%$ smaller average forecasting error than the second-best method. Note that, since \textsc{SMF}\xspace and \textsc{CPHW}\xspace do not filter out outliers, these models are heavily affected by outliers, while \textsc{SOFIA}\xspace is robust to outliers. Notably, the average forecasting error was almost the same in the Network Traffic dataset regardless of the missing percentage. That is, the discovered seasonal pattern was nearly identical under all settings. On the other hand, in the Intel Lab Sensor dataset, as the fraction of missing entries increased, it became hard to find the correct seasonal pattern, and thus the forecasting error increased. We also compared the speed of \textsc{SOFIA}\xspace and \textsc{SMF}\xspace. \textsc{SMF}\xspace was faster than \textsc{SOFIA}\xspace (i.e., $1.32$, $2.1$, $2.98$, and $5.06$ times faster in the Intel Lab Sensor, Network Traffic, Chicago Taxi, and NYC Taxi datasets, respectively). However, \textsc{SOFIA}\xspace was significantly more accurate than \textsc{SMF}\xspace, as seen in Figure~\ref{fig:forecast}. Moreover, \textsc{SOFIA}\xspace is applicable to incomplete tensors with missing entries, while \textsc{SMF}\xspace is not. Since \textsc{CPHW}\xspace is a batch algorithm, it needs to be rerun from scratch at each time step. \begin{figure} \vspace{-2mm} \centering \subfigure[w.r.t. the Number of Entries]{\label{fig:scale:element} \includegraphics[width=0.45\linewidth]{FIG/scalability_entry.pdf} } \subfigure[w.r.t. the Number of Time Steps]{\label{fig:scale:time} \includegraphics[width=0.45\linewidth]{FIG/scalability_time.pdf} } \vspace{-1mm} \caption[]{\label{fig:exp:scalability} \textbf{\textsc{SOFIA}\xspace scaled linearly} with the number of entries in each subtensor and the number of time steps. That is, time taken by \textsc{SOFIA}\xspace per time step was almost constant regardless of the number of subtensors processed so far. } \end{figure} \subsection{Q5. Scalability}\label{sec:exp:scalability} We measured how the running time of \textsc{SOFIA}\xspace scales with (1) the number of entries in each subtensor and (2) the number of time steps. We created a synthetic tensor stream consisting of $500\times 500$ subtensors (i.e., matrix) for $5000$ time steps and set the seasonal period to $10$. For simplicity, we set all entries are observed and there are no outliers. We sampled $\{50, 100, \dots, 500\}$ indices of the first mode and made tensor streams with different numbers of entries per subtensor. Then, we measured the time taken to process the entire tensor stream excluding initialization and HW fitting, as discussed in Section~\ref{sec:exp:speed}. Figure~\ref{fig:exp:scalability} shows that \textsc{SOFIA}\xspace scaled linearly with the number of entries and the number of time steps. That is, time taken by \textsc{SOFIA}\xspace per time step was almost constant regardless of the number of subtensors processed so far. \section{Introduction} \label{sec:intro} \input{010introduction} \section{Related Work} \label{sec:related} \input{020relatedWork} \section{Preliminaries and Notations} \label{sec:prelim} \input{030preliminary} \section{Proposed Factorization Model} \label{sec:model} \input{040model} \section{Proposed Method} \label{sec:method} \input{050method} \section{Experiments} \label{sec:exp} \input{060experiments} \section{Conclusion} \label{sec:conclusion} \input{070conclusion} \section*{Acknowledgement} \textls[-15]{\small This work was supported by Samsung Electronics Co., Ltd. and Institute of Information \& Communications Technology Planning \& Evaluation (IITP) grant funded by the Korea government (MSIT) (No. 2019-0-00075, Artificial Intelligence Graduate School Program (KAIST)).} \bibliographystyle{IEEEtran}
\section{Introduction} Many F to B type main-sequence stars show light variations attributed to many simultaneously excited nonradial low-degree g mode oscillations with periods ranging from $\sim0.5$ to $\sim2$~days. These variables are called $\gamma$~Doradus ($\gamma$~Dor) stars and Slowly Pulsating B (SPB) stars. It is known that g modes in the SPB stars are excited by the Fe-Ni opacity bump \citep{gau93,Dzi93}, while the excitation mechanism for g modes in the $\gamma$~Dor stars is not settled yet \citep[see, e.g.,][]{kah20}. The densely and regularly distributed periods of g modes, whose propagation zone is located in the deep interior including chemically inhomogeneous layers surrounding the convective core, are ideal for asteroseismology to probe the deep interior structure of a star. The long pulsation periods, which are often comparable to rotation periods, are significantly affected by the Coriolis force. This property, in turn, can be used to probe the rotation in the deep interior, although ground-based photometric observations are not suitable for such long and multiple periodic pulsations. The obstacle has been resolved by the recent advents of space photometry from satellites. In particular, up to four-year long ultra-accurate space photometry by the Kepler satellite \citep{kepler} brought revolutionary developments in asteroseismology for $\gamma$~Dor and SPB stars \citep[e.g.,][]{kur14,kee15,tri15,mur16,sch16,vanr16,LiG20,pap17}. Period spacings ($\Delta P$) of intermediate to high order g modes in a slowly rotating chemically homogeneous (ZAMS) star are roughly constant (in the co-rotating frame) with respect to period or frequency. In evolved main-sequence stars, however, period spacings show modulations caused by a steep gradient of the hydrogen abundance exterior to the convective core \citep{mig08}. The modulation amplitude is sensitive to diffusive mixing of chemical composition in radiative layers \citep{bou13}. In addition, the mean value of the period spacing (in the co-rotating frame) decreases with evolution (due to an increase in the Brunt-V\"ais\"al\"a frequency in the g-mode cavity). These properties are useful to infer the strength of diffusion in the deep interior and the evolutionary stages of $\gamma$ Dor stars, although dependences on initial chemical composition, core-overshooting, stellar mass, and etc. should be taken into account \citep{mom19}. We will discuss, in this paper, another type of $\Delta P$ modulations (dips) that occur in rapidly rotating stars due to the resonant coupling between g modes in the near-core region and an {\it inertial} mode in the convective core. If the rotation period is comparable to the pulsation periods in the co-rotating frame, g-mode period spacings in the inertial frame vary as a function of period \citep{bou13,vanr15,oua17,chr18,LiG19a}. The property has been used to estimate rotation frequencies in the g mode cavity of $\gamma$ Dor stars and SPB (slowly pulsating B) stars \citep[e.g.,][]{vanr16,oua17,zwi17,pap17,chr18,LiG19,LiG20,tak20}. To calculate g-mode frequencies of a rotating stars, traditional approximation of rotation \citep[e.g.,][TAR]{lee97}, where the horizontal component of angular velocity of rotation, $\Omega\sin\theta$ is neglected, has been employed in many investigations. It is known that the approximation gives sufficiently accurate frequencies and hence accurate period spacings ($\Delta P$) of g modes and their modulations due to a steep chemical-composition gradient. Recently, however, \citet{sai18b} found that $P$\,-\,$\Delta P$ relation of dipole prograde g modes calculated without using the TAR has a narrow deviation from that obtained by using the TAR. \citet{oua20} found the cause of the deviation (or dip) to be resonance couplings with an {\it inertial} mode in the convective core. In this paper, we further investigate the property of the dips in the $P$\,-\,$\Delta P$ relation of g modes caused by the resonance with an inertial mode in the convective core. We first discuss the theoretical property of the period spacing of g-modes and couplings with an inertial mode in \S2 and \S3. Then, we fit theoretical $P$\,-\,$\Delta P$ relations and resonance dips with observational data of some $\gamma$ Dor stars to estimate rotation rates of convective cores. In \S\ref{sec:rmodes} we show no resonance coupling to occur between an inertial mode and r modes. In Appendix\ref{sec:bigdip} we show an example (KIC~1431379) of large dips caused by chemical composition gradient. \section{Period spacings of g modes in a rotating star} \label{sec:pspace} The traditional approximation of rotation (TAR) is useful for studying the property of low-frequency nonradial pulsations in rotating stars. The TAR neglects the horizontal component of the angular velocity of rotation $\Omega\sin\theta$ (uniform rotation is assumed), centrifugal force of rotation, and the Eulerian perturbations of gravitational potential (i.e., Cowling approximation). Then, the governing equations for low-frequency nonradial adiabatic pulsations of a rotating star are reduced to those for a non-rotating star except that $\ell(\ell+1)$ is replaced with $\lambda$, the eigenvalue of the Laplace's tidal equation \citep[e.g.,][]{lee97}, where $\ell$ means the latitudinal degree of a nonradial pulsation in a non-rotating star. While $\ell(\ell+1)$ is constant, $\lambda$ varies as a function of spin parameter,~$s$, defined as \begin{equation} s \equiv {2\Omega\over\omega} = {2f_{\rm rot}\over \nu_{\rm co-rot}}, \label{eq:spin} \end{equation} where $\omega$ and $\nu_{\rm co-rot}$ are, respectively, angular and cyclic frequency of pulsation in the co-rotating frame, while $f_{\rm rot}$ is cyclic frequency of rotation. The eigenvalue $\lambda$ varies significantly if $s > 1$ \citep[see e.g.][]{lee97,tow03a,sai18b}. Because of the variation of $\lambda$, low-frequency oscillations in moderately to rapidly rotating stars (i.e., $s>1$) have properties significantly different from those in a non-rotating star. According to the recent analyses of Kepler light curves for low-frequency pulsations in $\gamma$ Dor stars \citep{vanr16,oua17,LiG19,LiG20} and SPB stars \citep{pap15,pap17}, the majority of pulsations in moderately to rapidly rotating stars are prograde sectoral g modes \citep[sometimes called Kelvin modes; see e.g.,][]{tow03a,tak20} and r modes \citep[normal modes of Rossby waves; e.g.][]{sai18}.\footnote{However, no r modes have been found in SPB stars despite that the excitation by the $\kappa$ mechanism is predicted \citep[e.g.,][]{tow05,sav05,lee06}. } In this paper, we discuss prograde sectoral g modes in rapidly rotating stars. We adopt, as in \citet{oua20,sai18b} and in \citet{unno}, the convention that negative azimuthal order $m < 0$ corresponds to prograde modes. We also note that all the theoretical pulsation frequencies (or periods) in this paper have been obtained using the adiabatic approximation. Under the TAR, frequency of a prograde sectoral g mode in the co-rotating frame is given as \begin{equation} \nu_{\rm co-rot} \approx {|m|\over n_{\rm g}}\nu_0 \quad \mbox{for} \quad s > 1 ~\mbox{and}~ n_{\rm g} \gg 1, \label{eq:nuco} \end{equation} where \begin{equation} \nu_0 \equiv {1\over 2\upi^2}\int_{r_1}^{r_2}{N\over r}dr \label{eq:nu0} \end{equation} with Brunt-V\"ais\"al\"a frequency $N$ and $n_{\rm g} (> 0)$ being the number of radial nodes \citep{sai18b}. In equation~(\ref{eq:nuco}), the property of $\lambda \approx m^2$ (if $s > 1$) for prograde sectoral modes \citep[e.g.][]{lee97,tow03a} is used. Since the range of g-mode cavity $r_1 < r < r_2$ is not very sensitive to g-mode frequencies, $\nu_0$ is nearly constant for a star, so that the period spacing in the co-rotating frame, \begin{equation} \Delta P_{\rm co-rot} \approx {1\over |m|\nu_0} \label{eq:dP} \end{equation} is nearly constant. Open circles in Fig.~\ref{fig:dPco_m1m2} show period-spacing versus frequency in the co-rotating frame obtained with the TAR for prograde sectoral g modes of $m = -1$ (blue) and $-2$ (red) assuming a rotation frequency of $2.20$~d$^{-1}$ in a $1.5$-$M_\odot$ main sequence model. (An initial composition of $(X,Z)=(0.72,0.014)$ \citep{Geneva2012} is adopted unless stated otherwise in the stellar evolution models in this paper.)\footnote{Stellar structure models were obtained by the MESA code \citep[v.7184;][]{pax11,pax13,pax15}, in which convective core boundary was determined by the Schwarzschild criterion, elemental diffusion was activated to have smooth Brunt-V\"ais\"al\"a frequency, and radiation turbulence was also activated to prevent too much helium settling. Rotational deformation was neglected.} As predicted by the approximate relations in equations~(\ref{eq:nuco}),(\ref{eq:dP}), the effect of different $m$ is nearly compensated by taking horizontal and vertical axes as $\Delta P_{\rm co-rot}|m|$ and $\nu_{\rm co-rot}/|m|$, respectively. Period spacings modulate due to the presence of a steep hydrogen abundance gradient around the convective core \citep{mig08,bou13}. In the inertial frame, period spacing decreases with period for prograde sectoral g modes, which is employed to measure the rotation speed in the g-mode cavity in the envelope \citep{vanr15,oua17,chr18,LiG19a}. \begin{figure} \includegraphics[width=\columnwidth]{fig_01.pdf} \caption{Period spacing in the co-rotating frame, $\Delta P_{\rm co-rot}$, versus frequency in the co-rotating frame, $\nu_{\rm co-rot}$ for prograde sectoral g modes of $m=-1$ (blue symbols) and $-2$ (red symbols) in a main-sequence model of $1.5~M_\odot$. To compensate for the effect of different azimuthal order $m$, vertical and horizontal axes are multiplied and divided by $|m|$, respectively [see equations~(\ref{eq:nuco}),(\ref{eq:dP})]. Open symbols show results obtained using the traditional approximation of rotation (TAR). Numbers shown at minima in $\Delta P_{\rm co-rot}$ indicate the number of radial nodes in the eigenfunction for the mode at each minimum. The minima occur at spin parameters of $9.3$ and $24$ for $m=-1$ modes, and at $7.2$ and $16$ for $m=-2$ modes. } \label{fig:dPco_m1m2} \end{figure} Filled circles in Fig.~\ref{fig:dPco_m1m2} show results obtained without the TAR, by using the expansion method of \citet{lee95}, in which the eigenfunction of a pulsation mode is expressed by a sum of a truncated series of terms proportional to different degrees of spherical harmonics $Y_\ell^m$. We include four to eight spherical harmonics depending on the degree of amplitude spreading among the terms. Thus obtained results (filled circles in Fig.~\ref{fig:dPco_m1m2}) generally agree with those obtained using the TAR (open circles) except for notable deviations at dips of filled circles. Such a deviation around a spin parameter of $9.3$ was first recognized by \citet{sai18b} for the $m=-1$ sequence in the study on the $\gamma$ Dor star KIC 5608334. (Other dips are out of the observed frequency range.) Although \citet{sai18b} guessed wrongly that the deviation might be caused by a coupling with a tesseral g mode, \citet{oua20} found from two-dimensional calculations that the dip should be caused by a resonance coupling between g modes in the radiative region and an {\it inertial} mode in the convective core, where waves are propagative due to the effect of the Coriolis force. In the next section, we discuss the resonance couplings between prograde dipole g modes with inertial modes. \section{Coupling between g modes and inertial modes in the convective core} \begin{figure} \includegraphics[width=\columnwidth]{fig_02.pdf} \caption{Radial displacements of g modes as a function of fractional radius in the central part of the $1.5$-$M_\odot$ model. Plotted are for g modes around period-spacing minima at spin parameters of about $9.3$ (upper panel) and about $24$ (lower panel). The radial displacement is normalized to unity at the stellar surface. The blue dashed line shows the horizontal displacement of the $n_{\rm g}=49$ mode for comparison. The convective core boundary is located at $r/R=0.071$.} \label{fig:eigf} \end{figure} In order to confirm that the dips of $\Delta P_{\rm co-rot}$ seen in Fig.~\ref{fig:dPco_m1m2} are caused by resonance couplings with inertial modes in the convective core, we plot eigenfunctions of dipole ($m=-1$) g modes around these dips in Fig.~\ref{fig:eigf}. Solid lines are radial displacements $\xi_r$ (the first component of expansion; i.e., with $\ell=1$)\footnote{The other components with $\ell=3,5,\ldots$ are very small compared to the $\ell=1$ component within the convective core except close to the core boundary.} as a function of fractional radius ($0 < r/R \le 0.15$) for some prograde dipole modes around $s=9.3$ ($n_{\rm g}=49$; upper panel) and at $s=24$ ($n_{\rm g}=125$; lower panel). For all cases, $\xi_r$ is normalized to unity at the stellar surface ($r=R$). Clearly, the amplitude in the convective core is maximum for the mode at the center of each dip of $\Delta P_{\rm co-rot}$, indicating the resonance coupling between an inertial mode in the convective core and g modes in the surrounding radiative g-mode cavity. The dashed blue line in Fig.~\ref{fig:eigf} shows the horizontal displacement $\xi_{\rm h}$ (multiplied by $0.1$) of the $n_{\rm g}=49$ mode for comparison with the radial displacement (blue solid line). As is well known, the horizontal displacement of a high-order g mode is much larger than the radial displacement in the g-mode cavity. However, the horizontal and radial displacements are comparable with each other for the inertial mode in the convective core. Therefore, for a g mode coupled with an inertial mode, the contrast between the amplitude in the convective core and in the radiative region is much larger for the radial displacement. The mode with $n_{\rm g} = 49$ (upper panel) has no node in the convective core, while the mode with $n_{\rm g} = 125$ (lower panel) has one node in the convective core. This indicates that the 'fundamental' inertial mode in the convective core couples with g modes in the upper panel, while the 'first-overtone' inertial mode couples with g modes in the lower panel. When the frequency of an inertial mode in the convective core becomes very close to the frequency of a g mode in the radiative region, the amplitude in the core becomes comparable to or larger than the surface value of the g mode by coupling, then the period spacing attains a minimum. The frequency of the mode with $n_{\rm g}=49$ (no node in the convective core) is larger (by a factor of $2.6$) than the frequency of the mode with $n_{\rm g} = 125$ (one node in the convective core). This indicates that a larger radial-wavelength in the convective core corresponds to a higher frequency of the inertial mode; the character is the same as that of g modes. In a rotating convective core, where the Brunt-V\"ais\"al\"a frequency is almost zero ($N^2\approx 0$),\footnote{In this paper we have assumed $N^2=0$ in the convective core, while overstable convective modes in the core possibly couple with g modes in the envelope if we assume a non-zero super-adiabatic temperature gradient (i.e. $N^2<0$) in the convective core as discussed in \citet{lee20}. } low frequency inertial waves approximately obey the local dispersion relation given (in the co-rotating frame) as \begin{equation} \omega^2 = {(2\mathbf{\Omega}\cdot\mathbf{k})^2\over k^2} \quad {\rm or} \quad \left({\omega\over 2\Omega}\right)^2 = {k_z^2\over k^2} \label{eq:disp} \end{equation} \citep[e.g.,][]{unno,lee97}, where $\mathbf{k}$ means wave number. This indicates that the property of the inertial modes in the convective core is governed by the spin parameter, $s=2\Omega/\omega$. \begin{figure} \includegraphics[width=\columnwidth]{fig_03.pdf} \caption{G-mode frequencies in the co-rotating frame versus rotation frequency of a $1.5\,M_\odot$ main-sequence model. A sequence of avoided crossings passes diagonally; i.e., with a constant spin parameter, $s\,(=2f_{\rm rot}/\nu_{\rm co-rot})$, of about 9.3. (Dashed line indicates the locus of $s=9.3$.) The feature is caused by the interaction with an inertial mode in the convective core.} \label{fig:cross} \end{figure} Fig.~\ref{fig:cross} shows frequencies (in the co-rotating frame) of prograde dipole g modes as a function of rotation frequency for the same $1.5$-$M_\odot$ model used in Fig.~\ref{fig:dPco_m1m2}, but with different rotation frequencies. The diagonal feature is a sequence of avoided crossings between g modes in the radiative g-mode cavity and the fundamental inertial mode in the convective core that occur at a spin parameter of $\approx9.3$ (dashed line in Fig.\,\ref{fig:cross}). This is consistent with the dispersion relation [equation~(\ref{eq:disp})] indicating the spin parameter governs the property of the inertial mode irrespective of the rotation frequency. The intrusion of the inertial mode frequency into the g-mode frequency spectrum causes a slight decrease in the spacings of g mode frequencies around the avoided crossing at a fixed rotation frequency. The maximum mode density corresponds to a dip of $\Delta P_{\rm co-rot}$ at $\nu_{\rm co-rot}= 0.47$\,d$^{-1}$ seen in Fig.~\ref{fig:dPco_m1m2}. This phenomenon is similar to the period-spacing dips of mixed modes in the red giants, in which coupling occurs between g modes in the core and p modes in the envelope \citep[e.g.,][]{mos12,chr12}. \begin{figure} \includegraphics[width=\columnwidth]{fig_04.pdf} \caption{Period spacings of dipole prograde g modes (in the co-rotating frame) at various evolutionary stages of a $1.50$-$M_\odot$ model with a rotation frequency of $2.20$~d$^{-1}$. Each evolutionary stage is designated by the central hydrogen abundance $X_{\rm c}$ and color coded as indicated. Open circles are results obtained using the TAR. The gradual increase in period spacings toward low-frequency limit (in evolved models in particular) is probably due to a poor resolution in our numerical calculations. } \label{fig:evol} \end{figure} Fig.~\ref{fig:evol} shows period spacings of dipole prograde g modes in the co-rotating frame for a rotation frequency of $2.20$~d$^{-1}$ at selected evolutionary stages of models, where evolutionary stages are designated by the hydrogen mass fraction at the center, $X_{\rm c}$. As in the non-rotating case, the mean value of $\Delta P_{\rm co-rot}$ decreases with evolution, and the modulation due to the steep gradient in hydrogen abundance is largest when $X_{\rm c}\sim0.6$.\footnote{The convective core mass grows until $X_{\rm c}$ decreases to $\sim0.5$. Although determining the physical convective core boundary is not very simple \citep{Gabriel14}, the numerical model stability and precision suffice for our qualitative evaluation of $\Delta P$ modulations during the stellar evolution. } The modulation gets weaker in later evolutionary stages, because diffusion rounds off a sharp edge of chemical composition distributions \citep{mig08,bou13}. Comparing variations in $\Delta P_{\rm co-rot}$ with the results obtained with TAR (open circles) makes the resonance dips obvious even for the $X_{\rm c}=0.6$ case with strong modulations due to the chemical composition gradient. The frequency at a resonance dip is smaller (i.e., the spin parameter is larger) in the ZAMS model than those in evolved models. This is consistent with the result of \citet{oua20}, who obtained that the spin parameter of the dipole prograde inertial mode in a homogeneous density core is considerably higher than for a ZAMS model and evolved models. They argued that a density gradient in the convective core makes the frequency of the inertial mode larger. In evolved models the resonance frequencies only slightly increase as the evolution proceeds (i.e., as $X_{\rm c}$ decreases). In the ZAMS model, the resonance dip is broader and shallower compared with evolved models. To understand the cause of the difference, we plot, in Fig.~\ref{fig:eig_zams}, $\xi_r$ as a function of $r/R$ for some modes in and around the dip at $\nu_{\rm co-rot}= 0.33$~d$^{-1}$. An apparent difference from the functions plotted in Fig~\ref{fig:eigf} is the longer wavelength of a g mode in the radiative zone surrounding the convective core in the ZAMS model. The long wavelength is caused by the smaller Brunt V\"ais\"al\"a frequency without a gradient in hydrogen abundance. A smaller phase difference at the core boundary between adjacent g modes due to the longer wavelength might be the reason for the broad dip in the ZAMS model. \begin{figure} \includegraphics[width=\columnwidth]{fig_05.pdf} \caption{Eigengunction $\xi_r$ versus fractional radius, $r/R$ in the ZAMS model of $1.5~M_\odot$ around a minimum of $\Delta P_{\rm co-rot}$, which corresponds to $n_{\rm g}=59$. Different line color indicates the number of radial nodes ($n_{\rm g}$) for each mode. The convective core boundary is located at $r/R=0.077$.} \label{fig:eig_zams} \end{figure} \begin{figure} \includegraphics[width=\columnwidth]{fig_06.pdf} \caption{Spin parameter at resonance with a 'fundamental' prograde dipole inertial mode in the convective core versus central helium mass fraction. Stellar masses are color coded as indicated. Filled and open circles are for models with rotation frequencies of $1.5$~d$^{-1}$ and $2.2$~d$^{-1}$, respectively. Crosses show the results obtained by \citet{oua20} for prograde dipole modes in main-sequence models. } \label{fig:spinYc} \end{figure} Fig.~\ref{fig:spinYc} shows the spin parameter ($2f_{\rm rot}/\nu_{\rm co-rot}$) at the center of the dip caused by the resonance with the fundamental inertial mode of the convective core for various model masses at various stages of main-sequence evolution (denoted by the central helium abundance $Y_{\rm c}$). For each case, the spin parameter at the resonance is highest (i.e.,$\nu_{\rm co-rot}$ is smallest) in the ZAMS model. It rapidly decreases with evolution and attains to nearly a constant value ($\sim\!\!8.8$) in the late stage of main-sequence evolution. (Some wiggles at $Y_{\rm c}\sim 0.4$ are related to large modulations of $\Delta P_{\rm co-rot}$ due to chemical composition gradient; cf. Fig.~\ref{fig:evol}.) Gray crosses in Fig.~\ref{fig:spinYc} show results of \citet{oua20}, who obtained, for dipole prograde modes, the spin parameters $s=10.9, 8.9$, and 8.6 for $X_{\rm c}=0.68$ (1.40\,$M_\odot$), 0.35 ($1.60~M_\odot$), and 0.06 ($1.86~M_\odot$), respectively, which are perfectly consistent with our results. Generally, the spin parameter at the resonance is insensitive to the assumed rotation frequency in the late stage of evolution (see filled and open circles in Fig.\ref{fig:spinYc}), which was also found by \citet{oua20}. The spin parameter at the resonance tends to be smaller for more massive models. This can be understood as follows; a larger mass model has a larger convective core so that the radial wavelength of the 'fundamental' inertial mode and hence its oscillation frequency should be larger;\,i.e., the spin parameter at the resonance is lower for a higher mass. \section{Effects of core overshooting} Asteroseismic analyses for $\gamma$ Dor stars often favour models with convection overshooting \citep[e.g.,][]{mur16,sch16}. To see the effects of overshooting in g-mode period spacings, we have included, in some models, diffusive overshooting from the convective core boundary, whose mixing at distance $z$ from the boundary is proportional to \begin{equation} \exp[-2z/(h_{\rm os}H_{\rm p})] \label{eq:h_os} \end{equation} \citep{her00} as implemented in MESA, adopting $h_{\rm os} = 0.01$ (OS01) and $0.02$ (OS02). The overshooting produces a radiative zone around the core boundary with little gradient of chemical composition, in which the Brunt-V\"ais\"al\"a frequency is much lower than in the surrounding layers with a steep gradient of chemical composition. The presence of such a zone affects the propagation of g modes which couple with an inertial mode in the convective core. Fig.~\ref{fig:pdp_overshoot} shows period-spacing versus frequency or period of dipole prograde modes in $1.5~M_\odot$ models with and without overshooting at selected evolution stages (color coded) at a rotation frequency of 1.5\,d$^{-1}$. Upper panels show $\Delta P_{\rm co-rot}$ versus $\nu_{\rm co-rot}$ in the co-rotating frame, while lower panels show $\Delta P_{\rm inert}$ versus $P_{\rm inert}$ in the inertial reference frame. Open circles denote results obtained using the TAR. Because of the outstanding general trend of $\Delta P_{\rm inert}$ versus period $P_{\rm inert}$ in the inertial frame, dips are less prominent in the inertial frame (lower panels) compared with the appearances in the co-rotating frame (upper panels). \begin{figure*} \centering \includegraphics[width=0.33\textwidth]{fig_07a.pdf} \includegraphics[width=0.33\textwidth]{fig_07b.pdf} \includegraphics[width=0.33\textwidth]{fig_07c.pdf} \includegraphics[width=0.33\textwidth]{fig_07d.pdf} \includegraphics[width=0.33\textwidth]{fig_07e.pdf} \includegraphics[width=0.33\textwidth]{fig_07f.pdf} \caption{Upper panels show period-spacing ($\Delta P_{\rm co-rot}$) of dipole prograde g modes versus frequency in the co-rotating frame ($\nu_{\rm co-rot}$), while lower panels show the same information as above but in the relation between period-spacing ($\Delta P_{\rm inert}$) and period ($P_{\rm inert}$) in the inertial frame. Plotted are prograde dipole g modes in $1.5~M_\odot$ models for a rotation frequency of 1.5~d$^{-1}$ at selected evolutionary stages (designated with central hydrogen mass fraction $X_{\rm c}$). The leftmost panels are for the models without overshooting, while the middle and rightmost panels are for models including overshooting of $h_{\rm os}=0.01$ (OS01) and $0.02$ (OS02), respectively. Open circles show results obtained using the TAR. For models with overshooting, evolution stages at $X_{\rm c}\approx 0.37$ are not shown for better visibility. } \label{fig:pdp_overshoot} \end{figure*} The upper-left panel for models without overshooting is very similar to Fig.~\ref{fig:evol} for a faster rotation frequency of 2.20~d$^{-1}$. Since a resonance coupling with an inertial mode of the convective core occurs at a spin parameter ($2f_{\rm rot}/\nu_{\rm co-rot}$), dips of $\Delta P_{\rm co-rot}$ occur at larger $\nu_{\rm co-rot}$ by about 50\% in Fig.~\ref{fig:evol}. (Frequencies of dips associated with the first-overtone inertial mode are too small in the models with $f_{\rm rot}=1.50$~d$^{-1}$ in Fig.~\ref{fig:pdp_overshoot}.) The $\nu_{\rm co-rot}$\,-\,$\Delta P_{\rm co-rot}$ relations for models with overshooting (middle and right panels of Fig.~\ref{fig:pdp_overshoot}) are more complex; additional dips tend to appear, while most dips are broader but sometimes sharp dips appear (e.g., $X_c = 0.60$ model with OS01; middle panels of Fig.~\ref{fig:pdp_overshoot}). In addition, period spacings calculated using the TAR often do not agree with the results obtained by the expansion method even outside dips. Furthermore, for some models with overshooting, dips appear even in the period spacings obtained with the TAR (open circles), which never happens in models without overshooting. \begin{figure*} \centering \includegraphics[width=0.33\textwidth]{fig_08a.pdf} \includegraphics[width=0.33\textwidth]{fig_08b.pdf} \includegraphics[width=0.33\textwidth]{fig_08c.pdf} \caption{{\bf Upper panels:} Radial displacements of selected prograde dipole modes as a function of fractional radius in $1.50$-$M_\odot$ main-sequence models without overshooting (left), with overshooting of OS01 (middle) and OS02 (right) at $X_{\rm c}=0.60$. The color of each line refers to the frequency $\nu_{\rm co-rot}$ and the number of radial nodes $n_{\rm g}$ written in the same color in the upper-right corner of each panel. Dashed lines show radial displacements obtained using the TAR for the modes corresponding to colors. The TAR is not a good approximation near the center, which causes $|\xi_r|$ to steeply increase towards the center. Green dashed line shows the radial displacement of the same TAR mode shown by the blue dashed line but the former is obtained by imposing the inner boundary condition at the convective core boundary;i.e., removing the effect of the convective core. {\bf Lower panels:} Hydrogen mass fraction (blue lines denoted as XH) and normalized Brunt-V\"ais\"al\"a frequency $-rA= N^2r/g$ with local gravity $g$. We note that $(-rA)^{1/2}/2 < 0.005$ for the frequencies of the modes shown in the upper panels.} \label{fig:eigf_1p50cd_xc60} \end{figure*} \begin{figure*} \centering \includegraphics[width=0.33\textwidth]{fig_09a.pdf} \includegraphics[width=0.33\textwidth]{fig_09b.pdf} \includegraphics[width=0.33\textwidth]{fig_09c.pdf} \caption{Same as Fig.~\ref{fig:eigf_1p50cd_xc60} but for models at $X_{\rm c}\approx 0.05$.} \label{fig:eigf_1p50cd_xc05} \end{figure*} In order to understand the cause of these effects of overshooting, we plot in Fig.~\ref{fig:eigf_1p50cd_xc60} (models at $X_{\rm c}\approx 0.60$) and in Fig.~\ref{fig:eigf_1p50cd_xc05} (models at $X_{\rm c}\approx 0.05$) the radial displacements of modes at dips in the $\nu_{\rm co-rot}$\,-\,$\Delta P_{\rm co-rot}$ relation as a function of fractional radius (upper panels). The lower panels show the normalized Brunt-V\"ais\"al\"a frequency and mass-fraction of hydrogen profile. The left upper panel of Fig.~\ref{fig:eigf_1p50cd_xc60} shows $\xi_r$ as a function of fractional radius for the two modes at $\nu_{\rm co-rot}= 0.304$, and 0.358~d$^{-1}$ in the model at $X_{\rm c}\approx 0.60$ without overshooting. While these modes are located at dips of $\Delta P_{\rm co-rot}$ (see blue dots in Fig.~\ref{fig:pdp_overshoot} upper left panel), only the 0.304~d$^{-1}$ (spin parameter $s= 9.87$) mode is in resonance with an inertial mode having large amplitude in the convective core. The dip around the other mode, which have small amplitude in the convective core, should be caused by the steep gradient of the Brunt-V\"ais\"al\"a frequency \citep{mig08}. A similar phenomenon occurs also in the OS02 model at $X_{\rm c}=0.60$ (right upper panel of Fig.~\ref{fig:eigf_1p50cd_xc60}); i.e., among the two dips of $\Delta P_{\rm co-rot}$ at $\nu_{\rm co-rot}=0.288$ and $0.477$~d$^{-1}$, only the $0.288~{\rm d}^{-1}$ ($s=10.4$) mode resonantly couples with an inertial mode. The resonance dip in the OS02 model, however, is broader than the resonance dip in the OS00 model (cf. left and right panels of Fig.~\ref{fig:pdp_overshoot}). The broader resonance dip is related with the presence of a chemically homogeneous radiative zone produced by overshooting (OS02). The Brunt-V\"ais\"al\"a frequency is small there so that radial wavelength of a g mode is much larger than that in the surrounding layers with inhomogeneous chemical composition ($\mu$-gradient zone with $\mu$ being the mean molecular weight). The center of a resonance dip of $\Delta P_{\rm co-rot}$ corresponds to a maximum coupling with an inertial mode, which occurs at an optimal spatial wave phase at the convective core boundary. If the wavelength in the radiative zone surrounding the convective core is much longer than the wavelength in the $\mu$-gradient zone, increasing or decreasing the number of nodes by one in the latter zone would cause only a slight change in the wave phase at the core boundary so that the coupling strength would change only slightly. For this reason, the large wavelength in the overshooting zone would cause a broader resonance dip than in the models without overshooting. The effect of overshooting is more complex in the OS01 model at $X_{\rm}= 0.60$ (blue symbols in the upper middle panel of Fig.~\ref{fig:pdp_overshoot}), in which two deep dips of $\Delta P_{\rm co-rot}$ appear at $\nu_{\rm co-rot}= 0.362$ and 0.259~d$^{-1}$, and a dip appears at 0.212~d$^{-1}$ even in the period spacing calculated using the TAR, which never occurs in OS00 models. Radial displacements of these modes are shown in the middle panel of Fig.~\ref{fig:eigf_1p50cd_xc60}. The inertial mode bounded by the steep increase of the Brunt-V\"ais\"al\"a frequency at $r/R=0.095$ (black solid line) is responsible for the 0.362-d$^{-1}$ dip of $\Delta P_{\rm co-rot}$, while the inertial mode bounded by the convective core boundary at $r/R=0.090$ (red solid line) is responsible for the dip at 0.259\,d$^{-1}$. The frequency of the former mode is slightly larger because the wavelength of the inertial mode is slightly larger than the latter mode for which the thickness of the narrow overshooting zone coincides with the half of the radial wavelength. Dashed lines stand for $\xi_r$ of the modes obtained using the TAR. Under the TAR, no wave propagation in the convective core should occur, so that the amplitude should be constant there (except near the center where the amplitude increases steeply toward the center, indicating the TAR to be inappropriate there). For this reason, the radial displacement should be anti-node at the convective core boundary. Since the wavelength of a g mode is generally very small in the near-core region, the amplitude at an anti-node and hence the amplitude in the convective core tend to be very small as illustrated by the black dashed line in the middle panel of Fig.~\ref{fig:eigf_1p50cd_xc60}. However, the wavelength of a g mode in the zone produced by overshooting, is large and hence the amplitude at the anti-node can be appreciably large as in the case of $\nu_{\rm co-rot}= 0.212$~d$^{-1}$ (blue dashed line). The frequency is at the center of the dip in the $\Delta P_{\rm co-rot}$-$\nu_{\rm co-rot}$ relation obtained with the TAR (blue open circles in the upper middle panel of Fig.~\ref{fig:pdp_overshoot}). Thus, even the period spacing calculated using the TAR can have a dip if the stellar interior has a chemically homogeneous radiative zone surrounding the convective core, although the dip is nothing to do with the inertial mode. As we mentioned above, the steep increase of the displacement under the TAR (dashed lines) near the center is caused by the breakdown of the TAR. However, the amplitude in the convective core does not affect at all the frequency of a mode under the TAR, which we have confirmed by re-calculating the 0.212-d$^{-1}$ mode, imposing the inner (regularity) boundary condition at the convective-core boundary; i.e., removing the effect of the convective core. The result is shown by the green dashed line and the frequency written in green in the middle panel of Fig.\,\ref{fig:eigf_1p50cd_xc60}. This indicates that the dip under the TAR at 0.212~d$^{-1}$ should be caused by the peculiar behaviour of the eigenfunction in the narrow overshooting zone. Fig.~\ref{fig:eigf_1p50cd_xc05} shows the same information as Fig.~\ref{fig:eigf_1p50cd_xc60} but for models at $X_{\rm c}\approx 0.05$ in the late stage of main-sequence evolution. In these models the convective core is geometrically more compact and surrounded by a thicker $\mu$-gradient region, compared to the models with $X_{\rm c} = 0.60$. In spite of the considerable differences between models at $X_{\rm c} \approx 0.05$ and 0.60, prograde dipole pulsations show similar phenomena associated with the chemically homogeneous zone produced by overshooting. Eigenfunctions at two dips at $\nu_{\rm co-rot}= 0.414$ and 0.274\,d$^{-1}$ in the OS01 model at $X_{\rm c}=0.05$ (Fig.~\ref{fig:eigf_1p50cd_xc05}) are similar to those for $\nu_{\rm co-rot}= 0.362$ and 0.259~d$^{-1}$ modes, respectively, at $X_{\rm c}=0.60$ (Fig.\,\ref{fig:eigf_1p50cd_xc60}). We have found above that the core overshooting affects significantly (and complicatedly) the $\nu_{\rm co-rot}$\,-\,$\Delta P_{\rm co-rot}$ and $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relations. This comes from the fact that the core overshooting produces a chemically (nearly) homogeneous radiative zone where g modes propagate with a wavelength much longer than in the surrounding $\mu$-gradient zone. While we assume in this paper that convective overshoot at the core boundary leaves a radiative zone, such a zone may be convective (at least partially) if the thermal time there is sufficiently long, as reviewed by \citet{zahn02}, who called it `convective penetration'. Although matter mixing and hence stellar evolution would be little affected by whether such a narrow zone is convective or radiative, it affects significantly the period spacings of g modes and resonance couplings with inertial modes. If the convective-core overshoot occurs only as {\it penetration}, it would slightly increase the size of convective core without significantly affecting the structure of g-mode cavity surrounding the adiabatic region. In this case, period spacings of g modes might increase slightly, caused by a slight increase in the buoyancy radius, $P_0$ ($=1/\nu_0$ in eq.\ref{eq:nu0}). Probably, we should consider layers surrounding a convective core to consist of a inner 'convective penetration' zone and a radiative zone of overshooting, although the fraction of each zone is not known. In this paper we specify the extent of overshooting by $h_{\rm os}$ (eq.~\ref{eq:h_os}), which should be regarded to specify the radiative overshooting zone above the possible penetration zone. For this reason, even if a comparison of $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relation with observations happen to prefer a very small $h_{\rm os}$, it does not necessarily mean that overshooting is negligible, because a substantial penetration zone may be present below the thin radiative zone. \section{Comparison with observation} In agreement with the results of \citet{oua20}, our calculations using the expansion method predict a dip in period spacings of prograde dipole g modes at a period corresponding to a spin parameter $(2f_{\rm rot}/\nu_{\rm co-rot})\sim\!\!9$ (Fig.~\ref{fig:spinYc}). The dip is caused by the resonance coupling with the fundamental inertial mode of the convective core. The exact spin parameter at a dip depends on the stellar parameters, the evolution stage, and the assumption of overshooting. If we identify such a dip in observed g mode period spacings, we can determine the rotation frequency of the convective core by finding a model which reproduces the period and depth of the dip. However, no clear resonance dips in g-mode pulsators (i.e., $\gamma$ Dor, SPB stars) had been found previously, except for an indication in the $\gamma$ Dor star KIC~5608334 \citep{sai18b}. A spin parameter of about 9 corresponds to a period of $0.82P_{\rm rot}$ in the inertial frame, at which we expect to find a resonance dip if the observed g-mode period range extends beyond the period. $\gamma$ Dor stars in the sample analysed by \citet{LiG20} indicate that the observed maximum spin parameters of (prograde dipole) g modes can be larger than 9 if the rotation periods are shorter than one day. In other words, it is possible to find a resonance dip in some of the stars rotating faster than $\sim 1$~d$^{-1}$. We have searched $P$\,-\,$\Delta P$ (period versus period-spacing) relations obtained from Kepler data by \citet{vanr16,LiG19,LiG20} for possible resonance dips, and found many $\gamma$~Dor stars having possible resonance dips. From these $\gamma$ Dor stars, we have selected 16 stars (Table~\ref{tab:sum}) which have relatively clean $\Delta P$ dips likely caused by the resonance without much $\Delta P$ modulations due to chemical composition gradients.\footnote{We have also searched $P$\,-\,$\Delta P$ relations of SPB stars obtained by \citet{pap17}. However, we found no convincing cases.} For each of the selected 16 $\gamma$ Dor stars, we try to find a model (with an assumed extent of overshooting) consistent with the $P$\,-\,$\Delta P$ sequence with a resonance dip. We adopt the rotation frequency, $f_{\rm rot}$, obtained by \citet{vanr16,LiG19,LiG20} from the observational $P$\,-\,$\Delta P$ relations, as the rotation frequency throughout the layers exterior to the boundary of the convective core. In other words, we assume that no strong differential rotations are present in the radiative g-mode cavity. This may be justified by the previous studies on $\gamma$ Dor stars which found the differential rotation from the near-core to the surface to be weak \citep{kur14,sai15,sch15,mur16,vanr18,LiG20}. The theoretical $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relation for a given value of $f_{\rm rot}$ shifts downward (i.e., $\Delta P_{\rm inert}$ decreases) with decreasing mass and/or advancing evolution stage. For each $\gamma$ Dor star, we guess the mass of the star from the global parameters ($T_{\rm eff}$,$L/L_\odot$) given in \citet{mur19} (or in \citet{vanr15apjs}), and calculate $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relations of prograde dipole g modes for the $f_{\rm rot}$ obtained by \citet{LiG19,LiG20}, using the TAR at various evolutionary stages, to find the relation closest to the observed one by eye. Then, using the expansion method, we calculate the $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relation of the model with the same value of $f_{\rm rot}$. Thus obtained $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relation has a resonance dip, but its position does not necessarily agree with the observational position (i.e., period). Then, we assume a differential rotation between the convective core and the surrounding g-mode cavity. To calculate g-mode periods by the expansion method for a differentially rotating star, we have adopted the method of \citet{lee88}, in which the rotation profile is expressed as a function of fractional radius $x$, \begin{equation} \Omega(x) = \Omega(1)\left(1+ {b-1 \over 1+\exp[200(x-x_{\rm cc})]}\right), \label{eq:difrot} \end{equation} where $x_{\rm cc}$ is the fractional radius at the boundary of the convective core, and $b$ is the parameter which determines the rotation rate in the convective core relative to the surface. The factor $200$ in the denominator is arbitrarily chosen to have a rapid transition around the core boundary. The rotation rate changes steeply at the boundary of the convective core from $\approx b\Omega(1) = 2\pi f_{\rm rot}({\rm cc})$ to $\approx\Omega(1)= 2\pi f_{\rm rot}$, where $f_{\rm rot}{\rm (cc)}$ and $f_{\rm rot}$ are cyclic rotation frequencies in the convective core and in the radiative envelope including g-mode cavity, respectively. The value of parameter $b$ is chosen to fit the resonance $\Delta P_{\rm inert}$ dip with the observed one. For each star, adopting a standard initial chemical composition of $(X,Z)=(0.72,0.014)$, we tried to fit models with three assumptions of core overshooting; i.e., $h_{\rm os} = 0.0$\,(OS00), 0.01\,(OS01), and 0.02\,(OS02). In addition, in order to see the effects of different initial chemical composition, we have also performed the same analysis employing OS00 models with $(X,Z)=(0.724,0.010)$. The results of the fittings for the 16 $\gamma$ Dor stars are summarized in Table\,\ref{tab:sum}. For some stars lines for models with $h_{\rm os} >0$ are missing, for which we could not find good models. \subsection{Examples of model fittings}\label{sec:fit} In this subsection we discuss four examples of fitting theoretical predictions (for the standard initial composition) with observational $P$\,-\,$\Delta P$ relations and dips. Fittings with other 12 $\gamma$ Dor stars are shown in Appendix\,\ref{sec:otherfits}. \subsubsection{KIC 5294571 (Fig.\,\ref{fig:k529})} \begin{figure*} \includegraphics[width=0.33\textwidth]{fig_10a.pdf} \includegraphics[width=0.33\textwidth]{fig_10b.pdf} \includegraphics[width=0.33\textwidth]{fig_10c.pdf} \caption{Period-spacing ($\Delta P$) versus period ($P$) of KIC~5294571 in the inertial frame \citep[crosses][]{LiG19} compared with models with no overshooting ($h_{\rm os}=0$; left panel), with $h_{\rm os}=0.01$ (OS01; middle panel), and 0.02 (OS02; right panel). Circles and squares are theoretical $(P,\Delta P)$ obtained for the model whose parameters are shown in the upper part of each panel. Red symbols are results obtained assuming uniform rotation with a rotation frequency of 1.642\,d$^{-1}$ derived by \citet{LiG19}. Open circles are $(P,\Delta P)$ obtained using the TAR, while filled ones are those calculated by the expansion method. Blue squares show $(P,\Delta P)$ calculated by the expansion method for the same models but with a convective core rotating at a different rate of $f_{\rm rot}{\rm (cc)} = 1.675$ (left panel), 1.605 (middle panel) and 1.54~d$^{-1}$ (right panel). } \label{fig:k529} \end{figure*} The dipole prograde g-mode $P$\,-\,$\Delta P$ relation of KIC~5294571 obtained by \citet{LiG19} from the Kepler light curve is shown by crosses in Fig.~\ref{fig:k529}. \citet{LiG19} obtained a rotation frequency of $1.6421\pm0.0009$\,d$^{-1}$ from the g- and r-mode $P-\Delta P$ relations. The three panels show theoretical $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relations of dipole prograde g modes for models with $h_{\rm os}=0.0$ (no overshooting;left panel), $h_{\rm os}=0.01$ (OS01;middle panel) and $=0.02$ (OS02; right panel). KIC~5294571 has a clear dip of $\Delta P$ at a period (in the inertial frame) of 0.495~days. The dip is likely caused by the resonance coupling with an inertial mode in the convective core. However, model predictions for the uniform rotation at 1.642~d$^{-1}$ (red filled circles) disagree with the dip of KIC~5294571; the degree of the discrepancies depends on the assumptions of overshooting. In order to fit the period at the resonance dip of KIC~5294571 with the theoretical prediction of each model with $h_{\rm os}$, we have searched for a best value of $f_{\rm rot}{\rm (cc)}$ (rotation frequency in the convective core), which is different from the $f_{\rm rot}$ of KIC~5294571 attributed to the g-mode cavity. The best fit result is shown by blue squares in each panel and the adopted $f_{\rm rot}{\rm (cc)}$ is written in blue in Fig.~\ref{fig:k529}. By changing $f_{\rm rot}{\rm (cc)}$ the period at the dip shifts, while $\Delta P$s in other period range change little because they are mostly determined in the g mode cavity. The best fit $f_{\rm rot}{\rm (cc)}$s are 1.675, 1.605, and 1.54~d$^{-1}$ for models with $h_{\rm os} = 0.0$ (left panel), 0.01 (middle panel) and 0.02 (right panel), respectively. The depth of the dip observed in KIC~5294571 agrees better with the models including overshooting, while the convective core rotates slightly slower than the radiative layers. \subsubsection{KIC 5985441 (Fig.\,\ref{fig:k5985})} \begin{figure*} \includegraphics[width=0.33\textwidth]{fig_11a.pdf} \includegraphics[width=0.33\textwidth]{fig_11b.pdf} \includegraphics[width=0.33\textwidth]{fig_11c.pdf} \caption{The same as Fig.~\ref{fig:k529} but for KIC~5985441. Models with uniform rotation at 1.473\,d$^{-1}$ (filled red circles) predict resonance dips at periods of 0.56--0.57\,days, which are longer than the observed dip at about 0.5\,days. To fit the dip, the convective core has to rotate about 20\,\% faster (exact values depend on the assumed extent of overshooting) as shown by filled blue squares. The additional dip at $\sim0.55$ predicted by the differential rotation corresponds to the resonance with the first-overtone inertial mode of the convective core, although observed periods do not extend there.} \label{fig:k5985} \end{figure*} From the $P$\,-\,$\Delta P$ relations (for prograde dipole and quadrupole g modes) of KIC~5985441, \citet{LiG20} obtained $f_{\rm rot}=1.473\pm0.008$\,d$^{-1}$, which corresponds to the rotation rate of the g-mode cavity in this star. The $P$\,-\,$\Delta P$ relation for the prograde dipole g modes has a large dip at a period of about 0.5\,days (crosses connected by dotted line; Fig.\,\ref{fig:k5985}), which is attributable to the resonance with an inertial mode in the convective core. To fit the pronounced dip with a model it is necessary to assume a differential rotation of $\sim20$\% between the convective core and the radiative g-mode cavity as shown by blue squares in Fig.\,\ref{fig:k5985}. While models with or without overshooting can fit reasonably well the $P$\,-\,$\Delta P$ sequence of KIC~5985441, the model of $1.45\,M_\odot$ without overshooting (left panel) reproduces best the $P$\,-\,$\Delta P$ pattern as well as the resonance dip at $\sim0.502$\,days. The differential rotation required in KIC~5985441 is largest among the selected $\gamma$~Dor stars in this paper (see \S\ref{sec:sum} below), while the star is least studied probably due to its faintness with a Kepler magnitude of 15.8 mag. \subsubsection{KIC 8330056 (Fig.\,\ref{fig:k833})}\label{sec:k833} \begin{figure*} \includegraphics[width=0.33\textwidth]{fig_12a.pdf} \includegraphics[width=0.33\textwidth]{fig_12b.pdf} \includegraphics[width=0.33\textwidth]{fig_12c.pdf} \caption{The same as Fig.~\ref{fig:k529} but for KIC~8330056, for which \citet{LiG19} obtained a rotation frequency of 1.913~d$^{-1}$. Crosses connected by dotted line show the observational $P$\,-\,$\Delta P$ relation of prograde dipole g modes, which has a dip at a period of 0.43~days attributable to the resonance coupling with the fundamental inertial mode of the convective core. The dip can be fitted well with a 1.85-$M_\odot$ model having a convective core (with no overshooting) rotating at 1.89~d$^{-1}$ (blue squares in the left panel). The resonance dips predicted by the models with core overshooting are too broad and shallow compared with the dip of KIC~8330056. } \label{fig:k833} \end{figure*} \citet{LiG19} obtained $f_{\rm rot}=1.913\pm0.001$\,d$^{-1}$ for KIC~8330056 from the $P$\,-\,$\Delta P$ relations of g and r modes. Crosses plotted in Fig.~\ref{fig:k833} present the g-mode relation from \citet{LiG19}, where a resonance dip appears at a period of 0.43~days. Model fittings for KIC~8330056 are shown in Fig.~\ref{fig:k833} in the same format as in the previous cases. The 1.85~$M_\odot$ model without overshooting (left panel) reasonably fit the period and the depth of the resonance dip if $f_{\rm rot}{\rm (cc)}=1.89\,{\rm d}^{-1}$ is assumed, which is very close to $f_{\rm rot}=1.913\,{\rm d}^{-1}$ for the g-mode cavity, indicating KIC~8330056 to rotate nearly uniformly. The central hydrogen mass fraction of this model, $X_{\rm c}= 0.167$, indicates a late stage of main-sequence evolution. We note that the rotation rate of this model corresponds to about 83\,\% of the critical Roche model, while we expect little effects of rotational deformation on the g modes and inertial modes which reside in the deep interior. Models with core-overshooting are less successful for KIC~8330056 (middle and right panels of Fig.~\ref{fig:k833}). The position of the $\Delta P$ dip can be approximately fitted assuming a convective-core rotation rate of 1.85~d$^{-1}$ for the OS01 model and uniform rotation for the OS02 model. However, the predicted dips of these models are too shallow and broad compared with the observed one. (We have already seen such broad and shallow dips for evolved models with overshooting in Fig.\,\ref{fig:pdp_overshoot}.) For this reason, parameters of OS01 and OS02 models are not listed in Table~\ref{tab:sum}. \subsubsection{KIC 12066947 (Fig.\,\ref{fig:k120})} \begin{figure*} \includegraphics[width=0.33\textwidth]{fig_13a.pdf} \includegraphics[width=0.33\textwidth]{fig_13b.pdf} \includegraphics[width=0.33\textwidth]{fig_13c.pdf} \caption{The same as Fig.~\ref{fig:k529} but for KIC~12066947. Crosses connected with dotted lines are observational $P-\Delta P$ relation having a resonance dip at 0.38~days \citep{vanr16}. Rotation rate in the g-mode cavity of KIC~12066947 is 2.159~d$^{-1}$. The resonance dip is best reproduced by the 1.55-$M_\odot$ model with $h_{\rm os}=0.01$ (middle panel) with a convective-core rotation of $f_{\rm rot}{\rm (cc)}=2.115$~d$^{-1}$, which is slightly slower than the rate in the g-mode cavity. } \label{fig:k120} \end{figure*} KIC 12066947 is a rapidly rotating $\gamma$ Dor star \citep[$V\sin i= 133.3\pm 5.6$~km\,s$^{-1}$][]{vanr15apjs}. The g-mode $P$\,-\,$\Delta P$ relation of KIC~12066947 has been studied by many authors. \citet{vanr16} obtained a rotation frequency of $2.160 \pm 0.008$~d$^{-1}$, while \citet{chr18} obtained $2.156\pm0.004$~d$^{-1}$, \citet{LiG19} obtained $2.159\pm 0.002$~d$^{-1}$, and \citet{tak20} obtained $2.15 \pm 0.09$~d$^{-1}$. These results are all consistent with each other. We have adopted 2.159~d$^{-1}$ as the rotation frequency in the g-mode cavity of KIC~12066947. The $P$\,-\,$\Delta P$ relation of prograde dipole g modes (crosses connected with dotted line in Fig.~\ref{fig:k120}) has a dip at a period of $0.38$~days \citep{vanr16} which is attributable to the resonance coupling with an inertial mode in the convective core.\footnote{Since period data around the dip are missing in the analysis by \citet{LiG19}, we have adopted the data set obtained by \citet{vanr16} for KIC~12066947.} The observed $P$\,-\,$\Delta P$ relation and the position of the resonance dip of KIC~12066947 can be fitted with prograde dipole g modes of a 1.55-$M_\odot$ model with no overshooting (left panel) if we adopt a rotation rate of $f_{\rm rot}{({\rm cc})}=2.17~{\rm d}^{-1}$ in the convective core, and $f_{\rm rot}=2.159~{\rm d}^{-1}$ exterior to it (blue squares in Fig.~\ref{fig:k120}). Similarly good fits are obtained for models with overshooting, if we assume slightly different rotation rates in the convective core. The depth of the dip agrees best with the OS01 model, while $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relation of the OS02 model deviates in a period range of $0.33 - 0.34$~days. We note that although $f_{\rm rot}= 2.159$\,d$^{-1}$ of KIC~12066947 is larger than the case of KIC~8330056 discussed in \S\ref{sec:k833}, the rotation corresponds to about 55--60\,\% of the critical rotation, less influential than the case of KIC~8330056. \subsubsection{Summary of model fittings} \label{sec:sum} \begin{table*} \centering \caption{Summary of observed parameters and models} \begin{tabular}{lcccclllll} \hline & \multicolumn{2}{c}{\citet{mur19}} &\citet{LiG19} & \multicolumn{6}{c}{Models$^{\rm a)}$}\\ &&&\citet{LiG20} & \multicolumn{6}{c}{\hrulefill}\\ KIC & $\log T_{\rm eff}$(K) & $\log L/L_\odot$ & $f_{\rm rot}$(obs)~(d$^{-1}$) & $h_{\rm os}$ & $f_{\rm rot}$(cc)~(d$^{-1}$) & $M/M_\odot$ & $\log T_{\rm eff}$(K) & $\log L/L_\odot$ & $X_{\rm c}$ \\ \hline 03341457 & $3.841\pm 0.008$ & $0.707\pm 0.03$ & $1.859\pm 0.001$ &~~0.00& 1.87\,(1.88) & 1.45\,(1.45) & 3.846\,(3.872) & 0.696\,(0.740) & 0.56\,(0.62) \\ \,(Fig.\,\ref{fig:k334}) &&& &~~0.01& 1.83 & 1.40 & 3.834 & 0.645 & 0.54 \\ &&& &~~0.02& 1.84 & 1.40 & 3.814 & 0.730 & 0.34 \\ \hline 04390625 & $3.845\pm 0.016$ & $1.149\pm 0.046$ & $1.12 \pm 0.01$ &~~0.00& 1.22\,(1.225) & 1.80\,(1.70) & 3.843\,(3.865) & 1.159\,(1.124) & 0.16\,(0.16) \\ \,(Fig.\,\ref{fig:k439}) &&& &~~0.02& 1.24 & 1.70 & 3.801 & 1.121 & 0.08 \\ \hline 04774208 & $3.847\pm 0.014$ & $0.801\pm 0.033$ & $1.834\pm 0.001$ &~~0.00& 1.915\,(1.98) & 1.55\,(1.50) & 3.872\,(3.887) & 0.803\,(0.769) & 0.61\,(0.71) \\ \,(Fig.\,\ref{fig:k477}) &&& &~~0.01& 1.90 & 1.53 & 3.863 & 0.804 & 0.56 \\ &&& &~~0.02& 1.95 & 1.50 & 3.843 & 0.821 & 0.45 \\ \hline 05294571 & $3.837\pm 0.013$ & $0.768\pm 0.032$ & $1.6421\pm 0.0009$ &~~0.00& 1.675\,(1.70) & 1.50\,(1.50) & 3.858\,(3.886) & 0.753\,(0.785) & 0.57\,(0.67) \\ \,(Fig.\,\ref{fig:k529}) &&& &~~0.01& 1.605 & 1.50 & 3.851 & 0.787 & 0.50 \\ &&& &~~0.02& 1.54 & 1.45 & 3.837 & 0.749 & 0.48 \\ \hline 05391059 & $3.831\pm 0.013$ & $0.767\pm 0.026$ & $1.796\pm 0.001$ &~~0.00& 1.825\,(1.90) & 1.50\,(1.45) & 3.858\,(3.873) & 0.753\,(0.704) & 0.57\,(0.71) \\ \,(Fig.\,\ref{fig:k539}) &&& &~~0.01& 1.785 & 1.50 & 3.856 & 0.768 & 0.56 \\ \hline 05985441 & $3.848\pm 0.016$ & $0.741\pm 0.10$ & $1.473\pm 0.008$ &~~0.00& 1.74\,(1.78) & 1.45\,(1.40) & 3.850\,(3.859) & 0.650\,(0.636) & 0.69\,(0.72) \\ \,(Fig.\,\ref{fig:k5985})&&& &~~0.01& 1.73 & 1.50 & 3.861 & 0.738 & 0.64 \\ &&& &~~0.02& 1.78 & 1.50 & 3.862 & 0.736 & 0.65 \\ \hline 07968803 & $3.867\pm 0.015$ & $0.823\pm 0.023$ & $1.94\pm 0.01$ &~~0.00& 1.98\,(2.02) & 1.55\,(1.50) & 3.864\,(3.884) & 0.831\,(0.804) & 0.52\,(0.61) \\ \,(Fig.\,\ref{fig:k796})&&& &~~0.01& 1.93 & 1.50 & 3.842 & 0.811 & 0.42 \\ &&& &~~0.02& 2.00 & 1.50 & 3.827 & 0.855 & 0.34 \\ \hline 08326356 & $3.861\pm 0.015$ & $0.991\pm 0.047$ & $2.38\pm 0.02$ &~~0.00& 2.40\,(2.40) & 1.65\,(1.65) & 3.878\,(3.915) & 0.957\,(0.986) & 0.46\,(0.58) \\ \,(Fig.\,\ref{fig:k832})&&& &~~0.01& 2.33 & 1.65 & 3.864 & 0.991 & 0.38 \\&&& &~~0.02& 2.48 & 1.65 & 3.869 & 1.001 & 0.43 \\ \hline 08330056 & $3.873 \pm 0.015$ & $1.245\pm 0.035$ & $1.913 \pm 0.001$ &~~0.00& 1.89\,(1.90) & 1.85\,(1.80) & 3.867\,(3.893) & 1.203\,(1.217) & 0.18\,(0.22) \\ \,(Fig.\,\ref{fig:k833})&&& \\ \hline 09962653 & $3.861\pm 0.014$ & $0.786\pm 0.021$ & $1.763\pm 0.001$ &~~0.00& 1.795\,(1.815) & 1.53\,(1.50) & 3.867\,(3.886) & 0.781\,(0.790) & 0.60\,(0.65) \\ \,(Fig.\,\ref{fig:k996})&&& &~~0.01& 1.75 & 1.50 & 3.852 & 0.782 & 0.51 \\ \hline 11017637 & $3.863\pm 0.014$ & $0.771\pm 0.019$ & $1.6153\pm 0.0008$ &~~0.00& 1.70\,(1.70) & 1.53\,(1.50) & 3.871\,(3.887) & 0.753\,(0.779) & 0.69\,(0.68) \\ \,(Fig.\,\ref{fig:k110})&&& &~~0.01& 1.67 & 1.53 & 3.869 & 0.773 & 0.64 \\ &&& &~~0.02& 1.725 & 1.53 & 3.869 & 0.771 & 0.66 \\ \hline 11550154 & $3.874\pm 0.015$ & $0.774\pm 0.019$ & $2.017\pm 0.001$ &~~0.00& 2.075\,(2.12) & 1.53\,(1.50) & 3.867\,(3.886) & 0.781\,(0.790) & 0.60\,(0.65) \\ \,(Fig.\,\ref{fig:k1155})&&& &~~0.01& 2.04 & 1.50 & 3.858 & 0.758 & 0.64 \\ \hline 11649699 & $3.856\pm 0.012$ & $0.742\pm 0.018$ & $1.729\pm 0.002$ &~~0.00& 1.855\,(1.89) & 1.50\,(1.45) & 3.861\,(3.873) & 0.737\,(0.716) & 0.63\,(0.68) \\ \,(Fig.\,\ref{fig:k116})&&& &~~0.01& 1.82 & 1.50 & 3.858 & 0.758 & 0.58 \\ \hline 11907454 & $3.857\pm 0.013$ & $0.732\pm 0.018$ & $1.3387\pm 0.0006$ &~~0.00& 1.435\,(1.48) & 1.50\,(1.45) & 3.860\,(3.872) & 0.746\,(0.731) & 0.60\,(0.64) \\ \,(Fig.\,\ref{fig:k119})&&& &~~0.01& 1.435 & 1.50 & 3.860 & 0.743 & 0.62 \\ &&& &~~0.02& 1.48 & 1.50 & 3.859 & 0.757 & 0.61\\ \hline 12066947 & $3.865\pm 0.004$ & $0.851\pm 0.025$ & $2.159\pm 0.002$ &~~0.00& 2.17\,(2.185) & 1.55\,(1.55) & 3.866\,(3.894) & 0.828\,(0.875) & 0.53\,(0.58) \\ \,(Fig.\,\ref{fig:k120})&&& &~~0.01& 2.115 & 1.55 & 3.853 & 0.867 & 0.43 \\ \hline 12303838 & $3.864 \pm 0.015$ & $0.868 \pm 0.03$ & $1.3301 \pm 0.0007$ &~~0.00& 1.415\,(1.42) & 1.60\,(1.55) & 3.871\,(3.895) & 0.898\,(0.872) & 0.48\,(0.59) \\ \,(Fig.\,\ref{fig:k123})&&& &~~0.01& 1.36 & 1.60 & 3.875 & 0.895 & 0.53 \\ \hline \end{tabular} $^{\rm a)}$ The initial chemical composition $(X,Z)=(0.72,0.014)$ is adopted for standard models, while numbers in parentheses are from models with $(X,Z)=(0.724,0.01)$ \label{tab:sum} \end{table*} Table~\ref{tab:sum} summarizes results of model fittings shown in this section and in Appendix B. The table lists observational parameters \citep{mur19}, rotation frequency in the g-mode cavity for each star obtained by \citet{LiG19,LiG20}, and model parameters and the rotation frequency in the convective core to fit observed $\Delta P$ dip for each model. Results of metal-poor models with $Z=0.010$, are shown as parenthesised numbers in the first row (OS00) of each star in Table~\ref{tab:sum}. For some stars models with core-overshooting of $h_{\rm os}=0.02$ and/or $0.01$ are not listed, because these models have resonance dips too broad and shallow, while in many cases dips tend to be reproduced well by models with $h_{\rm os}\le 0.01$. This could indicate the overshooting from the convective core to be largely 'penetrative' type \citep{zahn02} producing mostly adiabatic layers with little radiative zone even if matter in a substantial range is mixed. We note, however, that the preference of a smaller $h_{\rm os}$ could be due to a bias in the selection of stars, because we have selected, in this paper, stars having a strong dip. Further detailed studies would be needed. \begin{figure} \includegraphics[width=\columnwidth]{fig_14.pdf} \caption{The ratios of the rotation frequency in the convective core $f_{\rm rot}$(cc) to that of radiative g-mode cavity $f_{\rm rot}$ are plotted with respect to the hydrogen mass fraction in the convective core $(X_{\rm c})$ (upper panel) and $f_{\rm rot}$ obtained from $P-\Delta P$ patterns by \citet{LiG19,LiG20}. Filled (black) and open (blue) circles and open squares (red) correspond the values obtained by fitting to models without overshoot and with small overshoots; i.e., $h_{\rm os}=0.00$, $0.01$, and $0.02$ respectively. The same stars are connected with dashed lines. These results are based on models with an initial composition of $(X,Z)=(0.72,0.014)$, while black open circles denote results based on the models with $(X,Z)=(0.724,0.010)$ without overshooting. The names of two outliers, KIC~5985441 and KIC~4390625, are indicated in the upper panel.} \label{fig:ratio} \end{figure} Fig.~\ref{fig:ratio} shows the ratio of the best fit rotation frequency in the convective core, $f_{\rm rot}{\rm (cc)}$, to the rotation frequency in the g-mode cavity $f_{\rm rot}$ with respect to $f_{\rm rot}$ (lower panel) and to the hydrogen mass fraction at the center, $X_{\rm c}$ (upper panel). Filled (black) and open (blue) circles, and squares (red) are for models without overshooting, with overshooting of $h_{\rm os}=0.01$, and with $h_{\rm os}=0.02$, respectively. Points belonging to the same stars are connected by dashed lines to show the effects of the core overshooting assumptions. In addition, results from metal-poor models with $Z=0.010$ (OS00) are shown by black open circles, while no connecting lines are drawn to avoid too much busyness. Models with $h_{\rm os}=0.01$ tend to yield slightly slower convective-core rotation rates compared to the models without overshooting, although the effects are not so large to disturb the general trend. The metal poor models tend to give slightly larger $f_{\rm rot}$(cc). Again, the tendency hardly affects the general trends seen in this figure. The majority of $\gamma$ Dor stars we studied in this paper rotate nearly uniformly, while convective cores tend to rotate slightly faster than the surrounding g-mode cavity. However, there is a notable exception, KIC~5985441, at $f_{\rm rot}({\rm cc})/f_{\rm rot}\approx 1.2$. The $P-\Delta P$ sequence of KIC~5985441 is fitted reasonably well as shown in Fig.\,\ref{fig:k5985} with the moderate differential rotation irrespective of the assumed extent of overshooting or a metal-poor ($Z=0.010$) composition. Since the star is relatively faint ($K_p=15.8$~mag), no spectroscopic information is available. The upper panel of Fig.\,\ref{fig:ratio} shows a subtle tendency of less evolved stars (i.e., with larger $X_{\rm c}$) having larger differential rotation $f_{\rm rot}({\rm cc})/f_{\rm rot}$, while the lower panel seems to indicate that the differential rotations tend to be larger in stars having smaller $f_{\rm rot}$. These tendencies, if real, may be understood as that the convective core of a star rotates slightly faster than the surrounding g-mode cavity at the beginning of the main-sequence evolution, while a part of the g-mode cavity surrounding the convective core boundary has spun up to synchronize with the convective core as evolution proceeds. Although it is an interesting tendency, further studies are definitely needed. \section{$P$\,-\,$\Delta P$ relations of r modes}\label{sec:rmodes} \begin{figure} \includegraphics[width=\columnwidth]{fig_15.pdf} \caption{Period spacing versus period for r modes of $(m,k)=(1,-2)$ in the inertial frame (whose temperature variations are symmetric with respect to the equator) in the 1.5-$M_\odot$ models at selected evolutionary stages (i.e., at selected central hydrogen abundance $X_{\rm c}$). A rotation frequency of 1.5~d$^{-1}$ is adopted as a typical rate, while no overshooting is included in these models. Open and filled circles are results obtained using the TAR and the expansion method, respectively. } \label{fig:rmodes} \end{figure} R mode oscillations are normal modes of global Rossby waves influenced by buoyancy. Pure Rossby waves generated by the Coriolis force which propagate only horizontally, while r modes, because of the buoyancy effect, propagate also radially. For this reason, the periods of high radial-order r modes in the co-rotating frame are approximately proportional to the radial order $|n|$, as for g modes. R modes are retrograde in the co-rotating frame, while they are observed as prograde modes in the inertial frame because the frequencies of r modes in the co-rotating frame are less than the rotation frequency. The observational frequencies are located between $(|m|-1)f_{\rm rot}$ and $|m|f_{\rm rot}$ \citep[see][for details]{sai18}. The period spacing of r modes in the inertial frame increases with period, which is opposite to the pattern of prograde g modes. From this property \citet{vanr16} discovered r modes in $\gamma$ Dor stars. \citet{LiG19,LiG20} found r modes (mostly $m=1$ even $k=-2$ modes) in many $\gamma$ Dor stars and, in some cases \citep[e.g., KIC~11775251][]{LiG20}, r-mode $P-\Delta P$ relations to show modulations similar to dipole g modes. In order to see whether or not a resonance coupling occurs between r modes and inertial modes in the convective core, we have calculated r mode periods with the TAR and with the expansion method for 1.5-$M_\odot$ models at some main-sequence evolution stages assuming a uniform rotation of 1.50~d$^{-1}$. Obtained $P_{\rm inert}$\,-\,$\Delta P_{\rm inert}$ relations are shown in Fig.\,\ref{fig:rmodes}, where results with the TAR and with the expansion method are shown by open and filled circles, respectively. Although there are some modulations in the $P$\,-\,$\Delta P$ relations, filled and open circles always stay close to each other, indicating that the TAR works well for r modes as well as g modes, and that those modulations should be due to chemical composition gradients rather than the resonance with inertial modes. Although the models shown in this figure have no core overshooting, we have obtained similar results for models with core overshooting. In the co-rotating frame, frequencies of r modes of $(m,k)=(1,-2)$ are limited as $\nu_{\rm co-rot} < f_{\rm rot}/3$ \citep{sai18} so that the spin parameter should be $s > 6$, while \citep{oua20} has shown that the retrograde inertial mode of $m=1$ in the convective core has a spin parameter of $1.34-1.37$, much smaller than the spin parameters of the r modes. This explains why no resonance couplings occur between inertial modes in the convective core and r modes. Therefore, we should regard modulations in period spacing patterns of r modes to be caused by chemical composition gradients. \section{Concluding remarks} We discussed the dip in g mode period spacings which is produced by the resonance with an inertial mode in the convective core as \citet{oua20} found for the first time. The resonance between prograde dipole g modes and an (fundamental or first-overtone) inertial mode in the core occurs at certain spin parameters of $2f_{\rm rot}/\nu_{\rm co-rot} \sim8-11$ (fundamental) and $22-25$ (first-overtone). These values depend on evolutionary stages, on the assumptions of overshooting, and, to a lesser extent, on stellar masses. These properties are consistent with the result of \citet{oua20}. We have found no resonance couplings between r modes (propagative in radiative layers) and retrograde inertial modes in the convective core, while \citet{oua20} found resonance couplings between a retrograde inertial mode and retrograde ($m=1$) g modes (as well as couplings between axisymmetric $m=0$ g and inertial modes). From a resonance dip in the g-mode period-spacing pattern of a star, we can measure the rotation frequency of the convective core by fitting a model prediction obtained by the expansion method \citep{lee95,lee88}. We can distinguish the true resonance dip from the modulation due to a steep change of hydrogen abundance, by comparing period spacings calculated by the expansion method and those based on the TAR, because the resonance coupling does not occur in the latter. Thus, the resonance dip and $P$\,-\,$\Delta P$ patterns of moderately or rapidly rotating stars, are very useful to probe the rotation frequencies in the central convective core and the surrounding near-core region. We have selected 16 $\gamma$ Dor stars having relatively clear resonance dips, and fitted them with dipole prograde g modes of models having parameters consistent with those given in \citet{mur19}. Adopting the rotation frequency obtained by \citet{vanr16,LiG19} from the global pattern of $P$\,-\,$\Delta P$ for each star, we found a model which nicely fit the overall feature of the $P$\,-\,$\Delta P$ pattern, while the period at the resonance dip is, in most cases, slightly different from observation. Then, we calculated g-mode periods in differentially rotating models, in which the radiative layers rotates at the same rate as before, while convective core rotates at a different rate, $f_{\rm rot}$(cc). By changing the value of $f_{\rm rot}$(cc), we have found a model which reproduces the position of the dip as well as the global pattern of the observational $P$\,-\,$\Delta P$ relation. Seismically inferred differential rotations between stellar envelope and core of main-sequence stars have been discussed many times in the literature \citep[see e.g.][]{aer17}. In most cases the core meant so far the radiative g-mode cavity surrounding the convective core rather than the convective core itself. Because g modes do not propagate in the convective core, g modes themselves do not provide us with information on the rotation in the convective core. Thanks to the resonance coupling with an inertial mode which is propagative in the convective core \citep{oua20}, we could obtain, in this paper, rotation frequencies of convective cores from the resonance dips in $P$\,-\,$\Delta P$ relations of prograde dipole g modes. We found rotation frequencies in the convective core to be very close to (in many cases slightly faster than) those in the surrounding g-mode cavities. This is a unique new knowledge we could extract from nonradial pulsations of $\gamma$ Dor variables. \section*{Acknowledgements} We are grateful Rhita-Maria Ouazzani for helpful conversations. We also thank Professor Conny Aerts for her persistent interest in the dip of period spacings, for useful comments on a draft of this paper, and for her encouragements. We thank the anonymous referee for helpful comments. TVR gratefully acknowledges receiving support from the Research Foundation Flanders (FWO) under grant agreement N$^\circ$ 12ZB620N. \section*{Data availability} The data underlying this article will be shared on reasonable request to the corresponding author. \bibliographystyle{mnras}
\section{\textsc{LCC-UCB}\ Algorithm} We design our algorithm \textsc{LCC-UCB}\ on the basis of the fact that the regret of UCB algorithms \cite{auer2002using,bubeck2011pure,lattimore2020bandit} scales as $\Tilde{O}(\sqrt{KT})$. We reduce the per step regret by distributing the $K$ arms among the $N$ agents in growing in length epochs. An agent $n$ chooses to interact with a potentially smaller set of arms $\mathcal{S}_n$ where $\mathcal{S}_n = \{\left((n-1)\lceil\frac{K}{N}\rceil \mod K\right) + 1, \cdots, \left((n\lceil\frac{K}{N}\rceil -1) \mod K\right) + 1\}$. For the first epoch, i.e., $j=0$, each agent starts with possibly sub-optimal arms, even the worst possible arms. As the algorithm proceeds, in epoch $j\geq 1$, agents broadcast the most played arm by UCB algorithm during epoch $j$ to all the other agents. Each agent $n\in[N]$ receives $\mathcal{R}_{n,j}$, a set of arm recommendations from other $N-1$ agents. The agent now runs the UCB algorithm \cite{bubeck2011pure} over the arms in the augmented set $\mathcal{A}_{n,j} = \mathcal{S}_{n}\cup \mathcal{R}_{n,j}$. At the end of any epoch, the agent purges any old recommendations it has and starts again with the new recommendations received after an epoch. This ensures that the number of arms with any agent does not exceed $K'\coloneqq \lceil K/N\rceil + N-1$. This approach helps to bound the regret of any agent $n\in[N]$ by $\Tilde{O}\left(\sqrt{\left(\lceil{K/N}\rceil + N-1\right)T}\right)$. The \textsc{LCC-UCB}\ algorithm running at an agent $n\in[{N}]$ is described in Algorithm \ref{alg:collab}. The algorithm at agent $n$ receives the set of initial arms $\mathcal{S}_n$, the indices of other agents, and the total horizon $T$. The agent $n$ maintains a set $\mathcal{R}_n$ of the arms received from the remaining $[N]\setminus\{n\}$ agents. For the first epoch $\mathcal{R}_n = \emptyset$ as the agent has not heard anything from the remaining agents and the augmented set is same as the initial set of arms, $\mathcal{A}_{n,0} = \mathcal{S}_n$. As the algorithm proceeds, it runs the UCB algorithm \citep{auer2002finite,bubeck2011pure}, described in Algorithm \ref{alg:UCB}, on the arms in the augmented set $\mathcal{A}_{n,j}$ for epoch duration $K'(K'+1)2^j$. If at time $t$, remaining time is not sufficient to run a complete epoch of duration $T_j$, it just runs the UCB algorithm for the remaining horizon $T-t$. \input{algorithm} \if 0 For \textsc{LCC-UCB}\ algorithm to work correctly, the agent which obtains the best arm in the initial set \footnote{Agent $1$ as per our notation} $\mathcal{S}_n$ has to identify the best arm with high probability. Since, the agent runs UCB algorithm (Algorithm \ref{alg:UCB}) which returns the most played arm for each epoch. We now state and prove the lemma that the most played arms by the UCB algorithm is ``good'', or $\mu_{i^*}\geq \mu_1 - \Tilde{\Delta_j}$, with high probability for some $\Tilde{\Delta_j}$. \input{max_arm_good_proof} After showing that the agent $1$ returns a good arm after each epoch, we now show that the regret of all the other agents is bounded in the next Section. \fi \section{Conclusion} We considered the problem of reducing communications between $N$ agents and minimizing the regret of agents interacting with an instance of a Multi Armed Bandit problem with $K$ arms for time horizon $T$. We proposed two algorithm \textsc{LCC-UCB}\ for fully connected networks and \textsc{LCC-UCB}-GRAPH for sparse networks with maximum degree $K_G$ and diameter $D$. We analyzed the algorithms and obtain regret bound of $\Tilde{O}(\sqrt{T(N+K/N)})$ and $\Tilde{O}(D\sqrt{D(K/N + K_G)T})$ for \textsc{LCC-UCB}\ and \textsc{LCC-UCB}-GRAPH algorithms respectively. We found that the algorithms perform well empirically with the \textsc{LCC-UCB}-GRAPH algorithm outperforming every time communication strategy in which an agent shares knowledge only with its neighbors. Further, both the \textsc{LCC-UCB}\ and the \textsc{LCC-UCB}-GRAPH algorithm beat the existing state of the art results. Additionally, the low bit complexity for communication in both the algorithms makes them a suitable choice for power constrained devices. \section{Evaluations} We consider various problem setups to evaluate our algorithms. We compare with the setting where agents can communicate with their neighbors every time and with the setting where agents do not communicate with anyone for the entire time horizon. We also compare with the DEMAB algorithm, proposed by \cite{wang2020optimal}, which requires only $O(M\log (MK)$ communication rounds for known time horizons. We first present the comparison results for Algorithm \ref{alg:collab}. We consider a horizon of $T = 10^5$ steps. We study the behaviour of the algorithm by varying the number of agents $N$ and the number of arms $K$. We choose three pairs $(N, K)$, which are $(10, 100)$, $(20, 100)$, $(10, 200)$. We present the result in Fig. \ref{fig:per_step_regret_plot_with_DEMAB} for $30$ independent runs for expected rewards drawn from uniform $\mathbb{U}(0,1)$ distribution. We plot the median of the cumulative regret incurred by a single angle at each time step and the $95\%$ confidence intervals. We first note that the regret of the DEMAB algorithm is even larger than the no-communication strategy. The high regret in the DEMAB algorithm is expected because the algorithm purges the observations collected after each epoch. Further, the agents do not share the knowledge of the best arm and continue to redivide the remaining arms to quickly eliminate the bad arms, and hence not all agents are able to exploit the best arm. This results in the high regret of the algorithm. To show the scale between the remaining communication strategies, we plot the regret curves with the DEMAB algorithm in Figure \ref{fig:per_step_regret_plot}. The start of an epoch $j$ can be observed as the jumps in the cumulative regret. We observe that the initial epochs incur the largest regret despite the duration $T_j$ being small. This is because the agents are not aware of the best arm yet and are exploring from possibly worst arms. Also, the regret grows very slowly in the later phase because most agents send the same arm index (the optimal arm) and the effective regret in the later rounds increase only as $\Tilde{O}\left(\sqrt{\left(1 + \lceil N/K \rceil\right)T_j}\right)$, instead of the upper bound of $\Tilde{O}\left(\sqrt{\left(N-1 + \lceil N/K \rceil\right)T_j}\right)$. We note that for small number of agents $N$ compared to the number of arms $K$, $(N, K) = (10, 100)$ and $(N, K)=(10, 200)$, the algorithm performs closer to the optimal case where the agents could communicate with each other as observed from Fig. \ref{fig:fc_10_100} and Fig. \ref{fig:fc_10_200}. This is because of the reduced overhead of re-sampling new arms obtained from all the agents. We now evaluate the proposed \textsc{LCC-UCB}-GRAPH algorithm on sparse graphs. We specifically consider Erd\H{o}s-R\'{e}nyi graphs $G(N, p)$ where $N \geq 100$ vertices are a swarm of $N$ agent. Also, $p = 10/N\geq \ln{N}/N$ is the edge selection probability. This gives an expected number of total edges in the graph to be $5N$. We consider only connected graphs (If the resulting graph is not connected, we sample another graph.). Once initiated, the graph does not changes structure over the subsequent time steps. This setup is typically used in placement of IoT devices communicating with only neighbors \cite{avner2016multi,sankararaman2019social}. We again consider $3$ cases of $(N, K)$ that are $(100, 250)$, $(150, 250)$, and $(100, 500)$. We present the result in Fig. \ref{fig:per_step_regret_plot_graph} for $30$ independent runs. Along with the expected rewards of the arms, graph structure is also different for each run. We plot the median of the cumulative regret incurred by a single angle at each time step and the $95\%$ confidence intervals. We note that for $K=250$, the performance is similar for $N=100$ (Fig. \ref{fig:sc_150_250}) and $N=150$ (Fig. \ref{fig:sc_150_250}). This is expected for no-communication strategy as the number of arms are same. For \textsc{LCC-UCB}-GRAPH algorithm, this makes sense as the degree of the graph $K_G$ is higher than the the number of arms allocated to every agent $\lceil K/N\rceil$. For full communication strategy, this happens because the expected degree of each agent is same for both graphs. Each agent can access data from only neighbors, and that remains same. On doubling $K$ from $250$ to $500$, we observe that the regret increases at lower rate for \textsc{LCC-UCB}-GRAPH than for the other two strategies. This is again attributed to the fact that $K_G$ dominates $\lceil K/N\rceil$ term in regret. We note that the performance of the DEMAB algorithm is still sub-par to the all the other three strategies. Note that the \textsc{LCC-UCB}-GRAPH algorithm accumulates extremely low regret because of the reduced arms per agent $(\leq 5)$ and the degree of any node is also very low as we considered sparse $G(N, p)$ graphs with $p = 10/N$. As expected, we note that the proposed strategy performs better than the no communication strategy. Further, we note that the proposed strategy even outperforms the strategy where communication happens after every time step and lags behind in initial time steps only. This is because an agent only shares what it knows with its neighbors and thus is not able to fully utilize the graph with $N$ agents. For the initial time steps, the \textsc{LCC-UCB}-GRAPH algorithm performs pure exploration, hence incurs regret. We also compare the performance of the \textsc{LCC-UCB}-GRAPH algorithm against a modified \textsc{LCC-UCB}\ algorithm which relays messages from other nodes. This modification allows every agent to receive recommendations from all the other agents after every epoch. However, the performance of the \textsc{LCC-UCB}-GRAPH algorithm is significantly better than the relay based \textsc{LCC-UCB}\ algorithm which justifies the sub-epoch based modification used in \textsc{LCC-UCB}-GRAPH. \textsc{LCC-UCB}\ algorithm wastes a significant portion of the time to generate good recommendations and hence incur a large regret. The better performance of the \textsc{LCC-UCB}-GRAPH algorithm is because after each epoch, an agent only receives arm updates from its neighbors, and hence, the $\sqrt{K/N + K_G}$ term in regret is very small. \section{Problem Formulation} We consider a network of $N$ agents, indexed as $n\in [N] = \{1, 2, \cdots, N\}$. Each agent $n\in[N]$ interacts with the same instance of stochastic $K$ armed bandit over $T$ time steps. An agent $n$, at time $t$, plays an arm $i_n(t)$. The expected reward of arm $i$ is $\mu_i$ for all $i\in[K]$. On playing an arm $i_n(t)\in[K]$ at time $t$, the $n$'th agent receives a reward of $r_{n,t} = \mu_{i_n(t)} + \eta_{n,t}$. We assume that $\eta_{n,t}$ is $1$-sub Gaussian at every time step $t$, i.e., for any $\lambda\in\mathbb{R}$, we have $\mathbb{E}[\exp{(\lambda\eta_{n,t})}]\leq \exp{(\lambda^2/2)},~\forall (n,t)\in[N]\times[T]$. For our analysis, we assume that $\mu_1 \geq \mu_2 \geq \cdots \geq \mu_K$. However, the ordering is unknown to the agents. We also define the gap between two arms as $\Delta_{i} \coloneqq \mu_1 - \mu_i$. For our analysis we assume $0 \leq \mu_i \leq 1\ \forall\ i\in[K]$. For our system model, we assume that $N \ll K$ as observed in many practical setups. For example, an e-commerce website will have many more products listed than the number of servers deployed. We assume that all the agents can communicate with each other (we later relax this assumption in Section \ref{sec:general_graph}). This implies, whenever an agent broadcasts a message, all the other $N-1$ agents receive the message. Further, we assume that each agent only communicates the index of the best arm it knows. This requires $\lceil\log(K)\rceil$ bits for every message and since there are $N-1$ other agents to send the message, the total bits required by any agent is $(N-1)\lceil\log(K)\rceil$ bits in every communication round. An agent $n$ aims to minimize its cumulative regret over time $T$, $R_n(T)$, defined as: \begin{align} R_n(T) &= T\mu_1 - \mathbb{E}\left[\sum_{t=1}^T\sum_{i=1}^K\mu_{i}\bm{1}\{i_n(t) = i\}\right] \end{align} Note that minimizing regret $R_n(T)$ for all agents $n\in[N]$ also minimizes the total cumulative regret over the agents as well. \section{Extension to general network structures}\label{sec:general_graph} So far we assumed that all the nodes are connected to each and every other node. However, this might not always be true. We now assume a general structure where a graph $G = (V, E)$ that has the different agents as vertices and the connections as edges represents the network structure. We assume that the graph representing the network is sparsely connected with a small diameter and degree for example Erd\H{o}s-R\'{e}nyi graphs \cite{chung2001diameter}. We assume that the maximum degree of $G$ is $K_G$ and the diameter of $G$ is $D$. For this setup, we assume that an agent or node can communicate with only its neighbors. Under this assumption, it may take multiple epochs for the knowledge of the best arm to reach an agent that may not have the best arm to begin with. Further, the number of epochs where an agent does not hear from the agent that has the best arm is bounded by the diameter $D$. Also, the maximum size of $\mathcal{G}_n$ is now upper bounded by $\lceil\frac{K}{N}\rceil + K_G$ instead of $\lceil\frac{K}{N}\rceil + N-1$. We first start with a direct extension of the result in Theorem \ref{thm:main_threorem}, and by understanding the issues in the direct extension, will propose an algorithm to improve the results for general networks. The following result gives a corollary for Theorem \ref{thm:main_threorem} for general graphs. \begin{corollary}\label{col:exp_regret_LCC_UCB} For graph $G = (V, E)$ with agents as nodes $V$, \textsc{LCC-UCB}\ algorithm results in a regret bound of: \begin{align} &R_n(T) \leq \Tilde{\mathcal{O}}\left(2^{D}K'^2 +\sqrt{D(2^{D})K'T}\right) \end{align} where $D$ is the diameter of the graph $G$, $K' = \left(\Big\lceil \frac{K}{N}\Big\rceil + K_G\right)$ and $K_G$ is the maximum degree of any node in the graph $G$. \end{corollary} \begin{proof}An agent $n\neq 1$ receives arm recommendations only from its neighboring nodes which results in reduction of $K'$ from $\lceil K/N\rceil + N$ to $\lceil K/N\rceil + K_G$. However, this also implies that the $n\neq 1$ does not obtains information about a good arm from the agent $1$ directly. Note that applying Lemma \ref{lem:UCB_max_play_arm} on UCB algorithm ran by agent $n\neq 1$ suggests that the agent recommends an arm $i_n^*$ such that $\mu_{i_n^*} \geq \mu_{i^*}-\Tilde{\Delta}_j$ where $i^* = \arg\max_{i\in\mathcal{A}_{n,j}}\mu_i$. This implies that the agent (or node) located farthest from the agent $1$ receives knowledge about a good arm, \textbf{(1)} only after $D$ epochs for the very first time, and \textbf{(2)} the best arm in the received $i^*=\arg\max_{i\in\mathcal{R}_{n,j}}\mu_{i}$ set $i^*$ satisfies $\mu_i^* \geq \mu_1 - \sum_{j=1}^{D}\Tilde{\Delta}_{j-1}$. This results in an additional constant regret during the first $D$ epochs as: \begin{align} \sum_{j=0}^{D-1}T_j = \sum_{j=0}^{D-1}(K'+1)K'2^j = (K'+1)K'(2^D - 1) \end{align} Further, the gap incurred from receiving a bad recommendation in each epoch scales as: \begin{align} (\mu_1 - \mu_{i^*})T_j &\leq \sum_{j'=1}^{D}\Tilde{\Delta}_{j'-1}T_j = \sum_{j'=1}^D4\sqrt{\frac{K'\log T}{T_{j'-1}}}T_j\\ &= \sum_{j'=1}^D4\sqrt{K'2^{j'}T_j\log T}\\ &= 4\sqrt{D\sum_{j'=1}^DK'2^{j'}T_j\log T}\\ &= 4\sqrt{DK'2(2^{D}-1)T_j\log T} \end{align} \end{proof} \begin{remark} Note that for $D=1$ and $K_G = N-1$, or the case for a completely connected graph, the result of Theorem \ref{thm:main_threorem} is obtained. \end{remark} To avoid the exponential blow-up of $2^D$ in the regret, we first consider a strategy where an agent forwards the messages from one neighbor to all the other neighbor. However, this increases the message size from $O(K_G\log_2 K)$ bits to $O(N\log_2 K)$ bits. Further, additional complexity is added to reduce repeated propagation of messages. In order to avoid the potential exponential increase in regret or increase in the message size and the communication complexity, we propose a modification of the \textsc{LCC-UCB}\ algorithm as \textsc{LCC-UCB}-GRAPH algorithm. The proposed \textsc{LCC-UCB}-GRAPH algorithm is described in Algorithm \ref{alg:graph_collab}. \input{graph_algorithm} The \textsc{LCC-UCB}-GRAPH algorithm further divides an epoch $j$ into $D$ sub-epochs indexed as $d$. The duration of each sub-epoch in epoch $j$ is $T_j = K'(K'+1)2^j$. Now, the \textsc{LCC-UCB}-GRAPH algorithm restarts UCB algorithm for sub epochs (Line 6-12). Additionally, the agents now communicate after every sub-epoch, but, only with their neighbors. This gives the $K' \leq \lceil\frac{K}{N}\rceil + K_G$. Note that results from sub-epoch $d$ of epoch $j$ are propagated throughout the graph by the time sub-epoch $d$ starts in epoch $j+1$. Hence, for $\Tilde{\Delta}_j\coloneqq \sqrt{\frac{16K'\log(T)}{T_j}}$, this approach allows to propagate arms with $\Delta_i \leq D\Tilde{\Delta}_{j-1}$ instead of $\sum_{j'=j-D}^j\Tilde{\Delta}_{j'}$. Based on this modification, we can bound the regret of \textsc{LCC-UCB}-GRAPH algorithm and the number of bits required for communications by \textsc{LCC-UCB}-GRAPH algorithm. \begin{theorem}\label{thm:graph_regret_theorem} Let $G = (V, E)$ be the graph representing the network structure of agents $n\in [N]$, and let $D$ be the diameter of the graph $G$ and let $K_G$ be the maximum degree of the vertices of the graph $G$. Then, the regret of any agent $n$ following \textsc{LCC-UCB}-GRAPH algorithm is bounded by \begin{align} R_n(T) \leq \Tilde{O}\left(D\sqrt{DK'T}\right), \end{align} where $K' = \lceil\frac{K}{N}\rceil + K_G$. \end{theorem} \begin{proof} Note that at the beginning of the phase of a sub-epoch $d$ in epoch $j$, the information from the farthest node $D$ edges away is also received for epoch $j-1$ sub-epoch $d$. This is because exactly $D$ communications happens between sub-epoch, epoch pair $d, j-1$ and $d, j$. Further, each intermediate $D$ nodes drifts from the optimal arm found in sub-epoch, epoch $d, j-1$ by at most $\Tilde{\Delta}_{j-1}$. This suggest that instead of receiving an arm with $\Delta_i \leq \Tilde{\Delta}_{j-1}$, the node actually receives an arm $i^* = \arg\max_{i\in\mathcal{A}_{n,d,j}}\mu_i$ with $\Delta_{i^*} \leq D\Tilde{\Delta}_{j-1}$. Hence, extending Lemma \ref{lem:UCB_regret_bound} with $D$ hops, the regret $R(d,j)$ in each sub-epoch $d$ and epoch $j$ is now upper bounded as \begin{align} R(d,j) &\leq 2(2D+1)\sqrt{2K'T_j\log T} + \frac{16DK'^3}{T_j} + 2K'\label{eq:sub_epoch_regret_bound} \end{align} In Equation \eqref{eq:sub_epoch_regret_bound}, the extra factors of $D$ comes from the fact that now each of the agents in $D$ hops recommends an arm $i$ such that $\mu_{i_d^*} \geq \mu_{i_{d-1}^*}-\Tilde{\Delta}_j$ for all $d\geq 1$ and $i_0^* = 1$, the true best arm. Note that the duration of any sub-epoch $d$ is $K'(K'+1)2^j$ and it depends only on the epoch $j$. Hence, the regret $R(d, j)$ is only a function of epoch count $j$. The total regret of the agent $n$, which is the sum of regrets over all sub-epochs in every epoch, can now be bounded as: \begin{align} R_n(T) &= \sum_{j=0}^{J-1}\sum_{d=1}^DR(d,j)\nonumber\\ &= \sum_{j=1}^{J-1}\sum_{d=1}^DR(d,j) + \sum_{d=1}^DR(d,0)\nonumber\\ &= \sum_{j=1}^{J-1}\sum_{d=1}^D\Big(2(2D+1)\sqrt{2K'T_j\log T}\nonumber\\ &~~~ + \frac{16DK'^3}{T_j} + 2K'\Big) + \sum_{d=1}^DK'(K'+1)\\ &= 2(2D+1)\sqrt{DJ\sum_{d=1}^D\sum_{j=0}^{J-1}2K'T_j\log T}\nonumber\\ &~~~+ DJ\frac{16DK'^3}{T_j} + 2DJK'+ DK'(K'+1) \nonumber\\ &= 4(2D+1)\sqrt{K'DT(\log_2(2T+1))\log T}\nonumber\\ &~~~ + 16D^2K' + 2K'D\log_2(2T+1) + DK'(K'+1)\nonumber \end{align} \end{proof} The key novelty of \textsc{LCC-UCB}-GRAPH algorithm is to let sub-epochs $0\leq d< D$ collect the messages from the entire graph. The equal length of each sub-epoch avoids the exponential blow-up in the regret. Further, the exponential length of each epoch $j$ still keeps the total messages in logarithmic order of $T$. \begin{theorem}\label{thm:graph_comm_theorem} For \textsc{LCC-UCB}\-GRAPH algorithm, total number of bits exchanged by an agent is bounded by $O\left(K_GD\log(K)\log(T)\right)$. \end{theorem} \begin{proof} An agent sends or receives only arm index, which requires $\log_2(K)$ bits. The agent communicates at the end of every sub-epoch of every epoch. In each communications, the agents talks to at most $K_G$ neighbors and sends and receives $2K_G\log_2(K)$ bits. Finally, there are $D$ sub-epochs in every $\log_2(T)$ epochs. This bounds the total number of bits as $O\left(DK_G\log(K)\log(T)\right)$. \end{proof} Results from Theorem \ref{thm:graph_regret_theorem} and Theorem \ref{thm:graph_comm_theorem} suggest that it is possible to reduce the regret from an exponential order of the diameter $D$ of the graph $G$ at the expense of $D$ times more communication rounds. Further, since each communication involves only exchange of arm indices, the cost of communications is not high ($O(K_G\log_2 K)$ bits) for power constrained devices such as sensor networks. \section{Introduction} We consider a setup where $N$ agents connected over a network, interact with a multi armed bandit (MAB) environment \cite{lattimore2020bandit}. The agents aim to collaborate with other agents in the network to minimize their regret. The agents also aim to reduce the number of messages and the size of messages communicated with others. Consider a case of an e-commerce company serving its users by recommending its vast number of items through multiple servers for quick response times. It attempts to learn the user preferences using a MAB algorithm. If each of the multiple servers run their own algorithm, they waste the large amount of data which other servers collect. Or, if they communicate after every recommendation, the communication complexity becomes high within the servers themselves. As observed from the example above, communicating after each time step is not favorable because of the increased communication cost. If $N$ agents communicate after every round to reduce the regret for $T$ time steps, their total regret is lower bounded by the regret of a super agent solving the MAB problem with $NT$ time steps. This bounds the total regret as at least $\Tilde{O}(\sqrt{NKT})$ or a per agent regret of $\Tilde{O}(\sqrt{KT/N})$. Whereas, if the $N$ agents interact with the MAB problem independently, without any information exchange with other agents, the individual regret bound is upper bounded by $\Tilde{O}(\sqrt{KT})$. We aim to find an algorithm which can obtain the regret bound of the super agent setup, $i.e.$, $\Tilde{O}(\sqrt{KT/N})$, though with limited communication between the agents. We provide an algorithm, Limited Communication Collaboration - UCB, (\textsc{LCC-UCB}), to minimize the regret. \textsc{LCC-UCB}\ divides the arms among multiple agents, such that each agent only interacts with the MAB instance but plays arms only from a subset of all the arms. The algorithm proceeds in epochs which double in duration, where the agents use UCB algorithm to find the best arm in their smaller MAB problem and communicate at the end of each epoch. On receiving the messages from other agents, each agent updates its set of arms and restarts its algorithm. We prove the regret of \textsc{LCC-UCB}\ is upper bounded by $\Tilde{O}\left(\sqrt{\left(K/N+N -1 \right)T}\right)$. For $N=1$, the regret of the \textsc{LCC-UCB}\ algorithm reduces to the standard regret bounds of $\Tilde{O}(\sqrt{KT})$. We also consider a general setup where the network of agents may not be completely connected and the agents may not be able to broadcast knowledge to all the other agents at once. Under such case, we propose \textsc{LCC-UCB}-GRAPH algorithm that sub divides epochs into sub-epochs of equal length. The agents restart their UCB algorithm in each sub phases with the new information available from their neighbors. We show that the regret bound of this modified algorithm with divided phases changes to $\Tilde{O}\left(D\sqrt{\left(K/N+K_G\right)DT}\right)$, where $K_G$ is the maximum degree of the nodes in the graph. Also, the increased communication complexity of this algorithm is bounded by $O\left(K_G D\log T\right)$ message exchanges per node. The key novelty in both the algorithms is that the gap between the recommended arms and the optimal arm reduces with epochs. Finally, we simulate and compare our algorithms with other communication protocols. We show that the algorithm behaves close to the communication strategy where the agents share the knowledge at each time step. For the \textsc{LCC-UCB}-GRAPH algorithm we consider sparse graphs with more than $100$ nodes. We observe that the \textsc{LCC-UCB}-GRPAH algorithm performs better than the communication strategy where the agents share local data with all their neighbors at every time step. Further, the \textsc{LCC-UCB}\ and the \textsc{LCC-UCB}-GRAPH algorithms also outperforms the DEMAB algorithm \cite{wang2020optimal} where agents communicate for only $O(N\log(NK))$ rounds. \subsubsection*{\bibname}} \usepackage{xcolor} \newcommand{\kamyar}[1]{\textcolor{blue}{{\bf Kamyar:} #1}} \begin{document} \newcommand{\textsc{LCC-UCB}}{\textsc{LCC-UCB}} \renewcommand{\cite}[1]{\citep{#1}} \title{Multi-Agent Multi-Armed Bandits with Limited Communication \author{Mridul Agarwal, Vaneet Aggarwal, Kamyar Azizzadenesheli \thanks{The authors are with Purdue University, West Lafayette IN 47907, USA, email:\{agarw180,vaneet,kamyar\}@purdue.edu.}} \maketitle \begin{abstract} \input{abstract} \end{abstract} \input{introduction} \input{related_works} \input{formulation} \input{algorithm_design} \input{result} \input{general_graphs} \input{evaluations} \input{conclusion} \bibliographystyle{apalike} \section{Related Works} Optimal action selection problem dates back to \citep{thompson1933likelihood}, and since then many algorithm have been proposed and studied to solve the MAB problem ranging from index based policies \citep{gittins1979bandit}, Optimism in the Face of Uncertainty based UCB algorithm \citep{auer2002using,auer2010ucb,audibert2009minimax}, to Thompson Sampling algorithm \citep{agrawal2013further}. All the algorithms achieve a bound on regret $\Tilde{O}(\sqrt{KT})$ and match the lower bound of $\Omega(\sqrt{KT})$ upto logarithmic factors. Since then, various generalization and extensions have been proposed to solve various online learning problems using a bandit framework \citep{abbasi2011improved,li2010contextual,lattimore2018toprank,lale2019stochastic}. However, all these problems consider a single agent interacting with the environment Since the last decade, there has been a thrust in studying distributed agents solving an instance of MAB problems. \citet{kanade2012distributed} consider a model where $N$ agents talk to a central controller at every round. However, they considered the problem of reducing the communication cost for each agents connected in a star topology with a controller as the central node which is unlike our setup where we allow any topology, including central node/agent. \citet{hillel2013distributed} consider the problem of reducing communication cost for stochastic bandits in a setup where every agent can communicate with each other. Their work also bound the total communication rounds by $O(\log_2 T)$ using an action elimination based algorithm. However, their agents communicate the estimates of arm rewards for all the $K$ arms in each message, whereas, we bound the number of bits required in each message by $O(\log_2K)$. \citet{shahrampour2017multi} consider a setup where multiple agents collectively select an arm at a time step and observe different rewards sampled from different distribution for each agent. Other works consider a setup where the agents talk to only one of the other nodes in a network at any given time step (gossiping style algorithm)~\citep{landgren2016distributed,martinez2019decentralized,wang2020optimal}. However, they allow their agents to communicate at every time step which is a different setup, and do not optimize a regret-communication trade-off. Further, they also send estimates of arm rewards in each message. \citet{sankararaman2019social,chawla20Gossiping} also consider a gossip style algorithms. Similar to us, these works divide the time horizon into epochs of variable length. Their strategies also divide the arms among the agents and the agents unicast the knowledge of the best arm they have using $O(\log K)$ bits in each epoch. However, because of gossip style communication protocols, an agent becomes aware of the best arm after it has already incurred $O(\frac{1}{\Delta^2})$ regret which translates to a problem independent bound of $\Tilde{O}(T^{2/3})$. We note that we use the same number of communication as these papers, while achieve better regret bound of $\Tilde{O}(T^{1/2})$. Further, we can convert the proposed broadcast based communication of our work to a unicast based strategy by sending a message to each neighbor at one timestep for $N$ timesteps. \citet{wang2019distributed,dubey2020kernel,dubey2020differentially} consider the problem of distributed linear bandits. They considered a fully connected network for reducing the communication messages and reduce the average regret for $N$ agents. In contrast, we aim to find bounds on the regret of each of the $N$ agents for $K$-armed stochastic bandits. \citet{wang2019distributed} propose DEMAB algorithm for a distributed bandit setup where all the nodes communicates with a central node. The setup assumes knowledge of the time horizon to cleverly obtain a bound on number of communications messages that is independent of time. The DEMAB algorithm is based on action elimination that also proceeds in epochs with duration growing exponentially after an initial period of length $T/(NK)$ where every agent eliminates arms independently. In each epoch, the algorithm generates new estimates of arm rewards discarding the old samples. This results in high constants $O(\sqrt{2^{14}})$ in the regret term. The regret bounds of the proposed \textsc{LCC-UCB}\ algorithm only exceeds the regret of DEMAB for $\log_2 T > 2^{14}/144$. Additionally, the DEMAB algorithm requires a central coordinating node, which may not always be the case. Lastly, for an unknown time horizon the number of messages increases back to $O(\log T)$ which is the same as ours. The proposed algorithm, \textsc{LCC-UCB}, obtains $\Tilde{O}(\sqrt{(N/K)T})$ for each agent with messages of size $O(\log K)$ with a total of $O(\log T)$ messages, thus achieving the regret of $\Tilde{O}(\sqrt{T})$ Additionally, the proposed \textsc{LCC-UCB}-GRAPH algorithm works well on sparse graphs with large number of agents with communication complexity of $O(D\log_2 T)$. \section{Main Result} We now state the main result for bounding the regret and number of communications for the proposed \textsc{LCC-UCB}\ algorithm. \begin{theorem}\label{thm:main_threorem} The regret of any agent $n$ following \textsc{LCC-UCB}\ algorithm is bounded by \begin{align} R_n(T) \leq O\left(\sqrt{K'T}\log(T)\right), \end{align} where $K' = \lceil K/N\rceil + N-1$. \end{theorem} To prove Theorem \ref{thm:main_threorem}, we first state the necessary lemmas required for the construction of the proof. Note that, the \textsc{LCC-UCB}\ algorithm bounds regret when agent $1$ recommends an arm $i^*$ which is ``close'' to the best arm ($i=1$) from its augmented set $\mathcal{A}_{1,j}$ at every epoch, and then, in the following epoch, every other agent $n$ minimizes the regret with respect to the their augmented sets $\mathcal{A}_{n,j+1}$ which now contain the arm $i^*$. Since, the agent runs UCB algorithm (Algorithm \ref{alg:UCB}) which returns the most played arm for each epoch. We now state and prove the lemma that the most played arms by the UCB algorithm is ``good'', or $\mu_{i^*}\geq \mu_1 - \Tilde{\Delta_j}$, with high probability for some $\Tilde{\Delta_j}$. \input{max_arm_good_proof} After showing that the agent $1$ returns a good arm after each epoch, we now show that the regret of all the other agents is bounded in the following epoch $j+1$. Lemma \ref{lem:UCB_regret_bound} bounds the regret of an agent $n$ running UCB Algorithm \ref{alg:UCB} during an epoch $j$. We then sum over all the epochs to obtain the total regret of the algorithm. We focus our analysis on an agent $n$. The analysis of the remaining agents follows identically. \begin{lemma}[UCB regret bound]\label{lem:UCB_regret_bound} The regret of any agent $n$ running UCB algorithm described in Algorithm \ref{alg:UCB} for an epoch $j\geq 2$ with $T_j$ time steps is upper bounded by \begin{align} R(T_j) &\leq 6\sqrt{2K'T_j\log T} + \frac{16K'^3}{T_j} + 2K'\label{eq:epoch_regret} \end{align} \end{lemma} \begin{proof} We first consider the case of an agent $n\neq 1$. The agent receives recommendations from all the other $N-1$ agents including the agent $1$ and hence contains the arm $i^*$ recommended by the agent $1$. To analyze the regret, we first create some events that will help in analysis. The first event denotes the case where the agent $1$, after the end of epoch $j-1$, recommends arm $i^*$ such that $\mu_{i^*} \geq \mu_1-\Tilde{\Delta}_{j-1}$. We denote this event as $\Tilde{\cal G}_1$. Further note that $N_{i}(T_j)$ is the number of times agent plays arm $i\in \mathcal{A}_{n,j}$ in epoch $j$. We note that when the event $\Tilde{\mathcal{G}}_1$ occurs $\Delta_{i^*}\leq \Tilde{\Delta}_{j-1}$. We assume that $i^*$ satisfies $\mu_{i^*} = \max_{i\in\mathcal{A}_{n,j}}\mu_i$. In case the assumption is not valid, we redefine $i^*$ as $i^* = \arg\max_{i\in\mathcal{A}_{n,j}}\mu_i$, and we still have $\mu_1-\mu_{i^*}\leq \Tilde{\Delta}_j$. Also, for the simplicity of notation, we define $\Delta_{i^*,i} = \mu_{i^*} - \mu_i$. Then, using the regret decomposition lemma (Lemma 4.5) from \cite{lattimore2020bandit}, the regret of the UCB algorithm for epoch $j$ is upper bounded as: \begin{align} R(T_j) &= \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[\Delta_iN_i(T_j)\right]\\ &= \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[(\mu_1 - \mu_i)N_i(T_j)\right]\\ &= \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[(\mu_1 -\mu_{i^*} + \mu_{i^*} - \mu_i)N_i(T_j)\right]\\ &= \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[(\Delta_{i^*} + \Delta_{i^*,i})N_i(T_j)\right]\\ &= \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[\Delta_{i^*}N_i(T_j)\right] +\sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[ (\Delta_{i^*,i})N_i(T_j)\right]\\ &= \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[\Delta_{i^*}N_i(T_j)|\Tilde{\mathcal{G}}_1\right]Pr(\Tilde{\mathcal{G}}_1) + \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[\Delta_{i^*}N_i(T_j)|\Tilde{\mathcal{G}}_1^c\right]Pr(\Tilde{\mathcal{G}}_1^c)+\sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[ (\Delta_{i^*,i})N_i(T_j)\right]\\ &\leq \sum_{i\in\mathcal{A}_{n,j}}\Tilde{\Delta}_{j-1}\mathbb{E}\left[N_i(T_j)|\Tilde{\mathcal{G}}_1\right]Pr(\Tilde{\mathcal{G}}_1) + \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[N_i(T_j)|\Tilde{\mathcal{G}}_1^c\right]Pr(\Tilde{\mathcal{G}}_1^c)+\sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[ (\Delta_{i^*,i})N_i(T_j)\right]\\ &\leq \Tilde{\Delta}_{j-1}\mathbb{E}\left[\sum_{i\in\mathcal{A}_{n,j}}N_i(T_j)|\Tilde{\mathcal{G}}_1\right] + Pr(\Tilde{\mathcal{G}}_1^c)\mathbb{E}\left[\sum_{i\in\mathcal{A}_{n,j}}N_i(T_j)|\Tilde{\mathcal{G}}_1^c\right]+\sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[ (\Delta_{i^*,i})N_i(T_j)\right]\\ &\leq \Tilde{\Delta}_{j-1}T_j + K'\left(\frac{K'}{T_{j-1}-K'}\right)^2T_j+\sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[ (\Delta_{i^*,i})N_i(T_j)\right]\\ &\leq 4\sqrt{\frac{K'\log T}{T_{j-1}}}T_j + K'\left(\frac{2K'}{T_{j-1}}\right)^2T_j+\sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[ (\Delta_{i^*,i})N_i(T_j)\right]\\ &\leq 4\sqrt{2K'T_j\log T} + \frac{16K'^3}{T_{j}}+\sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[ (\Delta_{i*,i})N_i(T_j)\right]\label{eq:regret_bound_1} \end{align} We now focus on the last term. We define event where the UCB algorithm plays arm $i$ after the number of plays of an arm $i$ is has crossed $l_i$, or \begin{align} {\cal G}_{n,i}(t_j) = \left\{\{i_t = i\}\cap\{N_i(t_j - 1) \geq l_i\}\right\}\text{, where } l_i = \frac{1}{\Delta_{i^*,i}}, \end{align} Again, similar to Lemma \ref{lem:UCB_max_play_arm}, we use the Theorem 1 of \cite{auer2002finite} to upper bound the probability of the event ${\cal G}_{t_j}(i)$ by $2t_j^{-3}$. Then we can bound the last term in Equation \ref{eq:regret_bound_1} as: \begin{align} \sum_{i\in\mathcal{A}_{n,j}}\mathbb{E}\left[ (\Delta_{i*,i})N_i(T_j)\right] &\leq \sum_{i\in\mathcal{A}_{n,j}}\Delta_{i*,i}l_i + \sum_{i\in\mathcal{A}_{n,j}}\sum_{t_j=l_i}^{T_j}Pr\left({\cal G}_{n,i}(t_j)\right)\\ &\leq \sum_{i\in\mathcal{A}_{n.j}}\Delta_{i^*,i}\left(1+\frac{8\log T}{\Delta_{i^*,i}^2}\right) + \sum_{i\in\mathcal{A}_{n.j}}\sum_{t_j = 1}^{T_j}t_j^{-2}\\ &\leq \sum_{i\in\mathcal{A}_{n.j}}\frac{8\log T}{\Delta_{i^*,i}} + K' + \frac{K'\pi}{6}\\ &\leq \sqrt{8K'T_j\log T}+ K' + \frac{K'\pi}{6} \end{align} Replacing the value in Equation \ref{eq:regret_bound_1}, we get the required result for $n\neq 1$. Further, note that for $n=1$, the true optimal arm $1$ is always present in $\mathcal{A}_{1,j}$ for all $j\geq 1$. \end{proof} We are now ready to prove Theorem \ref{thm:main_threorem}. We first note that for epoch $j = 0$, not agents have yet communicated, and hence the regret of any agent is trivially bounded by $T_0 = K'(K'+1)$. For the later epochs, we sum over the regret incurred in each epoch using Lemma \ref{lem:UCB_regret_bound}. To do so, we first bound the total number of epochs. Let the total number of epochs be $J$, then noting that the total number of time steps is $T$, we get: \begin{align*} &T \leq \sum_{j=0}^{J-1}K'(K'+1)2^j < 2T\label{eq:num_epochs_lower_bound}\\ \implies &2^{J} -1 < \frac{2T}{K'(K'+1)}\\ \implies &J < \log_2\left(\frac{T}{K'(K'+1)} + 1\right)\\ \implies &J = \lfloor \log_2\left(\frac{T}{K'(K'+1)}+1\right)\rfloor \end{align*} \input{regret_bound} \input{bit_bound} We note that the algorithm proposed by \cite{sankararaman2019social} also divides the time horizon into epochs with $K$ arms divided among $N$ agents. However, they consider the first few epochs to be of fixed length where agents only explore to find the best arm within themselves. Our algorithm runs UCB from the very first epoch. Also, the length of the first epoch is $o(1)$ in \textsc{LCC-UCB}\ algorithm which limits the regret. These novel changes allow for a significantly improved regret bound as compared to the state of the art with limited communications.
\section{Introduction} Task-oriented dialogue systems usually consist of three main components, including natural language understanding, dialogue management, and natural language generation. The Dialogue Manager (DM) keeps tracking the current dialogue state and determines the next action to be taken. Rule-based DMs are widely used in industrial task-oriented dialogue systems, such as Google’s Dialog Flow and Microsoft’s Bot Framework. However, due to manual rules and rigid structure of dialogue flow, it's hard for developers to maintain a rule-based DM, especially when the scenario is complex. In recent years, data-driven approaches for task-oriented dialogue, usually with end-to-end architectures, have been an active area in the research community. \citet{wu2020tod} propose a task-oriented dialogue BERT (ToD-BERT), which is trained on 9 English task-oriented datasets across over 60 domains and achieves good performance on 4 dialogue subtasks. We are motivated to leverage both advantages of the methods from industrial production and academic research. We hope to effectively reduce the cost in manually developing DM rules while ensuring the performance. Based on CDS, we maintain its basic structure and incorporate the data-driven methods into the DM module. Specifically, we maintain the core architecture (i.e. Event-Trigger-Action mechanism) of the rule-based solution of the original DM to inherit its controllability, and take ``model-trigger'' design to replace original expression triggers. Furthermore, we integrate a task-oriented dialogue pre-trained model to make full use of the rich external linguistic knowledge learned from pre-training. The contributions of our work are as follows. 1) We introduce an advanced dialogue management scheme of the industry-scale Carina Dialog System. 2) We introduce the ``model-trigger'' design in rule-based DM to achieve data-driven capability. 3) We propose an approach to integrating pre-trained model to DM. 4) We define dialogue actions in CDS based on CamRest676 dataset and re-annotate the dataset to evaluate our method. 5) We design experiments to prove the feasibility and strong few-shot capability of our method. 6) We build a demonstration system to visualize the process of our model-trigger DM \footnote{Link to our video: \url{https://youtu.be/suQTJ-L_3j4}}. \begin{figure}[t] \centering \includegraphics[scale=0.3]{Carina_dialog_framework.eps \caption{The architecture of Carina Dialog System \vspace{-1em} \label{carina dialog system figure} \end{figure} \begin{figure*}[t] \centering \includegraphics[scale=0.52]{model_trigger.eps \caption{The architecture of Model-Trigger DM \vspace{-1em} \label{model trigger figure} \end{figure*} \section{Method} \textbf{Carina Dialog System (CDS)}. It is an industrial task-oriented dialogue system, which has been applied to many real-world scenarios. The overall architecture of CDS is shown in Figure \ref{carina dialog system figure}. It consists of four main components: 1) a User Simulator module; 2) a Natural Language Understanding (NLU) module; 3) a Dialogue Manager (DM); and 4) a Database \& APIs module. In our work, we focus on the DM which decides next actions according to dialogue state. \textbf{Event-Trigger-Action}. This is the core mechanism of the DM. The system receives an external event (e.g. $Start$, $Query$ or $End$) when each turn starts. All triggers will be evaluated when new events come. If the triggering condition is satisfied for a certain trigger, it will be activated and its corresponding action will execute. Then dialogue state will be updated accordingly and system will generate new internal events. The ``event-trigger-action'' process is running as a loop until no trigger is activated any more. A winner action sequence (containing one or more actions) is selected out when a turn ends. We refer to the process of predicting each action as mini-turn. The original trigger module of CDS is implemented through the expression trigger, where firing conditions are formed with manually written expressions composed of dialogue state variables, which can ``listen to'' various customized events. Developers can build flexible and interpretable dialogue logics with expressions. However, it is hard for them to maintain these logic rules when the scenario becomes complex. So we propose the ``model-trigger'' design to achieve data-driven capability and reduce developers' efforts to write expressions. \textbf{Model-Trigger DM}. We are motivated to leverage a neural model to predict the winner action of each mini-turn according to not only the dialogue state used in expression triggers, but also the dialogue context. Thus, we hope the model trigger can cover most of the manually defined expressions. The architecture of our model-trigger DM is shown in Figure \ref{model trigger figure}. In each mini-turn, the model takes two parts of features to predict a winner action, including context feature and state feature. 1) \textbf{Context Feature:} All utterances in dialogue context are concatenated into a flat sequence as the input. We use ToD-BERT to encode the context sequence and take the embedding of the ``[CLS]'' token as the context feature. 2) \textbf{State Feature:} We treat the binarization of pre-defined dialogue state variables during the process, which updates in each mini-turn, as the state feature. We formulate the action prediction as a multi-class classification problem. The two parts of features are combined through a feature fusion layer and used to predict the winner action of each mini-turn over all possible actions through a prediction layer. Both the feature fusion layer and the prediction layer are implemented with deep neural networks. To evaluate our method, we create a new version of CamRest676 dataset \cite{wen2016conditional,wen2016network} and conduct experiments on it. We define executable dialogue actions and annotate each turn of all dialogues with dialogue action labels. Each turn may contain a sequence of action labels, which means the system response in this turn is generated during the execution of those actions in order. Then we feed the dialogue sessions with labels into CDS and run in a ``data-collection mode''. In this mode, DM will execute the labeled actions in order to update the internal dialogue state features, while dialogue context features are fixed for each turn. Each turn may produce more than one training data records, corresponding to the number of action labels. Experiments show that it can achieve 95.73\% of mini-turn accuracy to predict dialogue action, which is a great performance. Furthermore, few-shot experiments show a satisfactory performance using only small-scale training data. \begin{figure*}[t] \centering \includegraphics[scale=0.63]{demo-1130.eps \caption{Demo showing the process of Model-Trigger DM. \vspace{-1em} \label{demo} \end{figure*} \section{Demonstration} As shown in Figure \ref{demo}, we build a demonstration system based on our model-trigger DM. The main function of our system is to show the process of predicting dialogue actions according to the dialogue context and the current state. On the left side of the interface are the dialogue context display area and input area. On the right side, the results of natural language understanding in each turn are shown in the form of semantic frame at the top part. We visualize the 768-dimensional dialogue context feature and the 64-dimensional dialogue state feature in each mini-turn. The probability distribution of predicting dialogue actions in each mini-turn is shown at the bottom part. Through the demonstration system, we can clearly and intuitively observe the whole process of predicting dialogue actions by our model-trigger DM. \section{Conclusion and Future Work} In this paper, we introduce Carina Dialog System and propose ``model-trigger'' to reduce human efforts. We further integrate a pre-trained model for few-shot capability. Experiments show the good performance of our method. We build a demonstration system to visualize the process of the model-trigger DM. In our future work, we will further improve the model-trigger DM and apply it to the real-world products to reduce the manual efforts of traditional solution. \section{Acknowledgments} This work is supported by Microsoft STCA NLP Group. We would also like to thank the anonymous reviewers for their insightful comments.
\section{Introduction} The two-parameter Poisson--Dirichlet diffusion, introduced by \cite{P2009}, is generated by the closure of the infinitesimal operator (sometimes called pre-generator) \begin{equation} {\cal L}_{\alpha,\theta} = \frac{1}{2}\sum_{i,j=1}^\infty x_i(\delta_{ij}-x_j) \frac{\partial^2}{\partial x_i\partial x_j}-\frac{1}{2}\sum_{i=1}^\infty (\theta x_i+\alpha)\frac{\partial}{\partial x_i}, \label{gen:0} \end{equation} for values $\alpha \in [0,1)$, $\theta >-\alpha$ of the parameters and where $x$ takes values in the closure of the infinite ordered simplex ${\overline\nabla}_\infty := \{x_1\geq x_2\geq \cdots \geq 0\mid\ \sum_1^\infty x_i \leq 1\}$ in the product topology of $[0,1]^\infty$. The domain of ${\cal L}_{\alpha,\theta}$ is the algebra ${\cal C}$ generated by functions $\{1,\varphi_k=\sum_{i=1}^\infty x_i^k, k\geq2\}$, which is dense in the set $C(\overline\nabla_{\infty})$ and thus forms a core for the closure of ${\cal L}_{\alpha,\theta}$. The generated diffusion is reversible with a two-parameter Poisson--Dirichlet stationary distribution, denoted here ${\cal PD}(\alpha,\theta)$, with $(\alpha,\theta)$ as above. A construction of this model through finitely-many alleles Wright--Fisher models was provided in \cite{CDRS17}, and a Moran construction in \cite{RW09}, while a measure-valued version has recently been proposed by \cite{FRSW2020}. The two-parameter Poisson--Dirichlet diffusion is an extension of the so-called infinitely-many-alleles model derived by \cite{EK1981}, which corresponds to \eqref{gen:0} when $\alpha=0$. \cite{EG1993} studied a measure-valued (labelled) version of this case where the transition function has a mixture expansion which arises from a lines-of-descent dual process (cf.~\cite{EG1993}, Theorem 1.1). This process, which first appeared in \cite{G1980}, is a pure death process with entrance boundary at infinity and death rates $ \lambda_{m}=m(m+\theta-1)/2,\>m\geq 1,\theta>0. $ From \cite{G1980, T1984}, its transition probabilities are, for $1\le l\le n$, \begin{equation}\nonumber d_{nl}^\theta(t) = \sum_{k=l}^ne^{-\frac{1}{2}k(k+\theta-1)t} (-1)^{k-l} \frac{(2k+\theta-1)(l+\theta)_{(k-1)}}{l!(k-l)!} \frac{ n_{[k]} }{ (\theta+n)_{(k)} }, \end{equation} where for any $a>0$, $a_{(k)}=a(a+1)\cdots(a+k-1)$, $a_{[k]}=a(a-1)\cdots(a-k+1)$ for $k\in\mathbb N$, $a_{(0)}=a_{[0]}=1$, $d_{n0}^\theta(t)=1-\sum_{l\ge1}d_{nl}^\theta(t)$. In the limit when $n$ is infinity, the last factor on the right is replaced by 1 (see e.g. \cite{G2006}) and the notation becomes $d_l^\theta(t)$. The process counts the number of non-mutant edges back in time from the leaves towards the root in a Kingman's coalescent tree where the mutation rate is $\theta/2\ge0$ along edges of the tree, also called the block-counting process of Kingman's coalescent with mutation. Note that $\lambda_{l}>0$ for $l\ge2$ even if $-1<\theta\le 0$, and so $d_{nl}^\theta(t)>0$ for $2\le l\le n$. This also holds for $d_{l}^\theta(t)$. An expansion of the transition density of the \emph{unlabeled} one-parameter model, i.e., \eqref{gen:0} with $\alpha=0$, was obtained in \cite{E1992} (cf.~Eq.~(1.3)); while \cite{FSWX2011}, Theorem 3.3, extended this result to the case $0<\alpha<1, \theta>-\alpha$. There are two forms of transition distribution expansion: (i) a spectral expansion in terms of reproducing kernel orthogonal polynomials on ${\cal PD}(\alpha,\theta)$; and (ii) an expansion as mixture of two-parameter Poisson--Dirichlet distributions ${\cal PD}(\alpha,\theta)$. The equivalence of the two forms has been explained in \cite{GS2010,GS2013} for the one parameter case and in \cite{Z2015} (cf.~Theorem 2.1), for the two-parameter case. While \cite{FSWX2011} dealt with the spectral expansion, in this paper we concentrate on the latter type and derive an expansion through a dual process approach. Specifically, an appropriate rearrangement of the spectral expansion of the transition distribution suggests a duality relation which we fully describe, identifying the dual to be a partition-valued jump process whose embedded chain is the so-called \emph{down chain} discussed in \cite{P2009} (see also references therein). It is interesting to note that this dual process is an extension of Kingman's typed coalescent, but whose block-counting process is the same as in the case $\alpha=0$. This is remarkable \emph{per se}, considering the complexity of the two parameter model, and explains why the two models have similar transition distribution expansions. Analogous transition structures also appear in a family of diffusions defined through the Jack graph (see \cite{Z2021} and references therein). Presumably the dual process method in this paper could also shed light on the extent of such similarities. We also provide a direct connection with a generalized Blackwell and MacQueen P{\'o}lya urn scheme. The connection between the sampling distribution of a ${\cal PD}(\alpha,\theta)$-sample and P\'olya urn schemes are in general well known \cite{P1996,P2006}. From the urn scheme and the dual expansion in Corollary \ref{Corr24} a new expansion is derived in Theorem \ref{theorem33}. We exploit a split version of the P{\'o}lya urn scheme, i.e., two infinite random sequences conditional on the same finite-dimensional vector of initial observations, to provide a derivation of a random variable $X(t)$ which has the transition distribution expansion for a fixed time $t$. Our methods of proof heavily rely on the use of the sampling distribution associated to $n$ samples from the diffusion, which does not automatically belong to ${\cal C}$ so it has to be handled with care. \subsection{Notation}\label{sec:notation} For $n,d\in\mathbb{Z}_+$, $\eta=(\eta_1,\cdots,\eta_d) \in \mathbb{N}^d$ is called an \emph{integer partition} of $n$ if $\eta_1\geq\cdots\geq\eta_d>0$ and $|\eta|:=\sum_{i=1}^{d}\eta_i=n$. The \emph{length} of $\eta$ is $ l (\eta)=d$. We will use the notation $\Gamma=\cup_{n\geq0}\Gamma_n$, where $\Gamma_n$ is the set of all integer partitions of $n$. In particular, $\Gamma_0$ contains only an empty partition $\emptyset$. We say $\omega\subset \eta$ if and only if $\omega_i\leq \eta_i$ for all $i\geq1$. $(\Gamma,\subset)$ becomes a partially ordered set. Throughout $n=|\eta|,w=|\omega|$. Consider a generalization of Bernstein polynomials as follows $$ \vec{P}_\eta(x)=\binom{n}{\eta}\sum_{(v_{(1)},v_{(2)},\cdots,v_{(i)},\cdots)=\eta}\prod_{i=1}^{\infty}x_i^{v_i},~x\in\nabla_{\infty}, $$ where $(v_{(1)},v_{(2)},\cdots,v_{(i)},\cdots)$ is the descending arrangement of the vector $(v_1,v_2,\cdots,v_i,\cdots)$, $\nabla_{\infty}=\{x\in\overline{\nabla}_{\infty}\mid \sum_{i=1}^{\infty}x_i=1\}$ and $\binom{n}{\eta}=\frac{n!}{\eta_1!\cdots \eta_d!}$. Here $x\in \nabla_{\infty}$ may be regarded as the color frequency of balls in an urn. If we sample $n$ balls with replacement from the urn, then $\vec{P}_\eta(x)$ will be the sampling probability of having color configuration $\eta$ in the sample. Define $P_{\eta}(x)=\sum_{(v_{(1)},v_{(2)},\cdots,v_{(i)},\cdots)=\eta}\prod_{i=1}^{\infty}x_i^{v_i}$, then $P_{\eta}(x)$ is the monomial symmetric function in group representation theory. Moreover, $ \tilde{P}_\eta(x) = \sum_{i_1\ne \cdots \ne i_d; i_{j}\in\mathbb{N}}x_{i_1}^{\eta_1}\cdots x_{i_d}^{\eta_d}, $ is called the augmented monomial symmetric function and $i_1\ne \cdots \ne i_d$ means that all the indices are pairwise distinct. It is not difficult to see that $$ \tilde{P}_\eta(x) =\alpha_1(\eta)!\cdots \alpha_n(\eta)!P_{\eta}(x), $$ where $a_k(\eta) = \#\{1\leq i\leq d\mid \eta_i=k\}$, $k=1,\ldots ,n$, so $\sum_{k=1}^na_k(\eta) = d$ and $\sum_{k=1}^nka_k(\eta) = n$. ~Each integer partition may also be represented geometrically by the Young diagram; cf.~ Figure \ref{yd}. \begin{figure}[htbp] \vspace{-5mm} \begin{center} \includegraphics[scale=.8]{figure1a.pdf} \end{center} \caption{Young diagram $\eta=(4,2,1)$} \label{yd} \end{figure} We can extend both $P_{\eta}(x)$ and $\tilde{P}_\eta(x)$ continuously to the Kingman simplex $\overline{\nabla}_{\infty}$ because $\nabla_{\infty}$ is dense in $\overline{\nabla}_{\infty}$. With a slight abuse of notation, we still use $P_{\eta}(x)$ and $\tilde{P}_\eta(x)$ to denote their continuous extensions respectively. Then $$ \vec{P}_\eta(x)=\binom{n}{\eta}P_{\eta}(x)=\binom{n}{\eta}\frac{1}{\alpha_1(\eta)!\cdots \alpha_n(\eta)!}\tilde{P}_\eta(x) $$ also denotes its continuous extension in $\overline{\nabla}_{\infty}$. The Ewens--Pitman sampling formula $$ M_n(\eta)=\binom{n}{\eta}\frac{1}{\alpha_1(\eta)!\cdots \alpha_n(\eta)!}\frac{\prod_{l=0}^{d-1}(\theta+ l\alpha)}{(\theta)_{(n)}}\prod_{i=1}^d(1-\alpha)_{(\eta_i-1)} $$ is the sampling probability of a partition $\eta$ obtained via the two-parameter Chinese restaurant process, which is a generalized P\'olya urn model for sampling partitions. A P\'olya urn scheme typically describes exchangeable sampling with reinforcement, and the joint probability of a sample has an integral representation, as mixture of independent, identically distributed laws, due to de Finetti's theorem. Such a relation is still true for the Ewens--Pitman sampling formula, which reads $$ M_n(\eta)=\int_{\overline{\nabla}_{\infty}}\vec{P}_\eta(x) \mathcal{PD}(\alpha,\theta)(dx). $$ In fact, Kingman \cite{K78} established a general representation theorem valid for all exchangeable partition structures, i.e. for all families of distributions $\{M_n(\eta)\mid \eta\in\Gamma_n\},~n\geq1$ satisfying the consistency condition $$ M_{n-1}(\eta)=\sum_{\omega\subset\eta, |\omega|+1=|\eta|}\frac{\binom{n-1}{\omega}\chi(\omega,\eta)}{\binom{n}{\eta}}M_{n}(\omega) $$ where $\chi(\omega,\eta)=\alpha_{\eta_i}(\eta)$ if $\eta_i-\omega_i=1$ and $\eta_j-\omega_j=0$ for $i\neq j$. In particular, $\{\vec{P}_\eta(x),n\geq1\}$ is also an exchangeable partition structure because there is a natural consistency relation, i.e. we first take a sample of size $n+1$ then sub-sample $n$ balls from the sample, so that $$ \vec{P}_{\omega}(x)=\sum_{\omega_i=\eta_i-1, \omega_j=\eta_j,j\neq i}\frac{\alpha_{\eta_i}(\eta)\eta_i}{n}\vec{P}_\eta(x). $$ By Kolmogorov's consistency condition, we can establish a probability measure $\mathcal{M}(\cdot)$ on integer partitions $\Gamma$. We say a $\Gamma$-valued stochastic process $D_n,~n\geq 1,$ has distribution $\mathcal{M}$, if $D_n\in \Gamma_n$ and has marginal distribution $M_n(\eta)$. \begin{thm}[Kingman's Representation Theorem] Any exchangeable partition structure $\{M_n(\eta),n\geq1\}$ can be represented as $$ M_n(\eta)=\int_{\overline{\nabla}_{\infty}}\vec{P}_\eta(x) \mu(dx), $$ where $\mu$ is a probability measure on $\overline{\nabla}_{\infty}$. Moreover, if $D_n, n\geq 1,$ is a family of random partitions with distributions $\{M_n,n\geq1\}$, then $Z=\lim_{n\to\infty}\frac{D_n}{n}$ exists almost surely and has distribution $\mu$. \end{thm} The representing measure of the Ewens--Pitman partition structure is the two-parameter Poisson--Dirichlet distribution $\mathcal{PD}(\alpha,\theta)$. \section{The two-parameter Poisson--Dirichlet diffusion} The two-parameter Poisson--Dirichlet diffusion is constructed by Petrov in \cite{P2009}. Petrov's construction relies on an up-down chain in the Kingman branching diagram, a weighted graph as in Figure \ref{bd}. \begin{figure}[htbp] \begin{center} \includegraphics[scale=0.5]{figure2a.pdf} \vspace{-5mm}\caption{Branching Diagram} \end{center} \label{bd} \end{figure} The edge weights are $\chi(\omega,\eta)=\alpha_{\eta_i}(\eta)$ if $\omega_i=\eta_i-1$, $\omega_j=\eta_j, ~i\neq j$. The weight of a path joining $\omega$ and $\eta$ is defined as the multiplication of all edge weights in the path. Then the total weight between $\omega$ and $\eta$, denoted as $\dim(\omega,\eta)$, is the sum of all path weights between $\omega$ and $\eta$. In particular, when $\omega=\emptyset$ we denote $\dim(\emptyset,\eta)$ as $\dim(\eta)$ and $\dim(\eta)=\binom{n}{\eta}$. Naturally, $\dim(\eta)=\sum_{\omega\subset\eta,|\omega|+1=|\eta|}\chi(\omega,\eta)\dim(\omega)$. Then $$ p^{\downarrow}(\eta,\omega)=\frac{\dim(\omega)\chi(\omega,\eta)}{\dim(\eta)}=\alpha_{\eta_i}(\eta)\frac{\eta_i}{n},~\eta_j-\omega_j=0,j\neq i, \eta_i-\omega_i=1, $$ are transition probabilities of the down Markov chain $\{D_n,n\geq1\}$. The down Markov chain $\{D_n,n\geq1\}$ may be realized through sampling without replacement. Indeed, suppose that there are $n$ balls of color counts $\eta=(\eta_1,\cdots,\eta_d)$ in the urn, then $p^{\downarrow}(\eta,\omega)$ is the sampling probability of obtaining color counts $\omega=(\omega_1,\cdots,\omega_k)$ by deleting one ball with uniform probability. Therefore, for $|\omega|=m<n=|\eta|$, we have \begin{align*} &\mathbb{P}(D_{n-m}=\omega\mid D_0=\eta)\\ =&\sum_{\omega=\omega_{n-m}\subset\omega_{n-m-1}\subset\cdots\subset \omega_{1}\subset\omega_0=\eta}\mathbb{P}(D_{1}=\omega_{1}\mid D_0=\eta)\cdots\mathbb{P}(D_{n-m}=\omega\mid D_{n-m-1}=\omega_{n-m-1})\\ =&\frac{\dim(\omega)}{\dim(\eta)}\sum_{\omega=\omega_{n-m}\subset\omega_{n-m-1}\subset\cdots\subset \omega_{1}\subset\omega_0=\eta}\chi(\omega,\eta) =\frac{\dim(\omega)\dim(\omega,\eta)}{\dim(\eta)}. \end{align*} On the other hand, this is just a sum of hypergeometric probabilities \begin{align*} \mathcal{H}(\omega\mid\eta) =&\sum_{1\leq i_1<\cdots<i_k\leq d}\sum_{(v_{(1)},\cdots,v_{(k)})=\omega}\frac{\binom{\eta_{i_1}}{v_1}\cdots\binom{\eta_{i_k}}{v_k}}{\binom{n}{m}}\\ =&\frac{\binom{m}{\omega}}{n_{[m]}}\sum_{1\leq i_1<\cdots<i_k\leq d}\sum_{(v_{(1)},\cdots,v_{(k)})=\omega}(\eta_{i_1})_{[v_1]}\cdots(\eta_{i_k})_{[v_k]}. \end{align*} Thus, $$ \frac{\dim(\omega,\eta)}{\dim(\eta)}=\sum_{1\leq i_1<\cdots<i_k\leq d}\sum_{(v_{(1)},\cdots,v_{(k)})=\omega}\frac{(\eta_{i_1})_{[v_1]}\cdots(\eta_{i_k})_{[v_k]}}{n_{[m]}}. $$ Unlike the down chain, the transition probabilities $p^{\uparrow}(\eta,\lambda)$ of the up chain depend on the Ewens--Pitman partition structures, $$ p^{\uparrow}(\eta,\lambda)=\frac{M_{n+1}(\lambda)}{M_{n}(\eta)}p^{\downarrow}(\lambda,\eta). $$ Then the up-down chain is defined by the following transition kernel $$ T(\eta,\widetilde{\eta})=\sum_{\eta,\widetilde{\eta}\subset \lambda}p^{\uparrow}(\eta,\lambda)p^{\downarrow}(\lambda,\widetilde{\eta}). $$ The scaling limit of this up-down chain yields the two-parameter Poisson--Dirichlet diffusion, whose generator is \eqref{gen:0}. Note that there is an embedded \emph{down-up} chain in the Moran construction in \cite{RW09}, where the down chain transition is obtained by uniformly removing an individual from the current state, and the up chain transition is obtained by sampling conditional on the remaining individuals. Thus, the down-up chain and up-down chain have the same scaling limit. The two-parameter Poisson--Dirichlet diffusion is reversible and its stationary distribution is $\mathcal{PD}(\alpha,\theta)$. Moreover, its transition probability $P(t,x,dy)$ is absolutely continuous with respect to $\mathcal{PD}(\alpha,\theta)$ and we denote its transition density as $p(t,x,y)$. Using a spectral expansion, an explicit expression of $p(t,x,y)$ was obtained in \cite{FSWX2011}, where it is shown that \begin{equation} p(t,x,y) = 1 + \sum_{m=2}^\infty \rho_m^\theta(t)q_m(x,y). \label{RN:00} \end{equation} The notation in (\ref{RN:00}) is that $ \rho_m^\theta(t) = \exp\{-\frac{1}{2}m(m+\theta -1)t\} $ and \begin{equation}\nonumber q_m(x,y) = \frac{2m-1+\theta}{m!}\sum_{n=0}^m(-1)^{m-n}{m\choose n}(n+\theta)_{(m-1)}p_n(x,y), \end{equation} for $m=2,3\ldots$ where \begin{equation*}\label{pnkernel} p_n(x,y) = \sum_{|\eta|=n} \frac{\vec{P}_\eta(x)\vec{P}_\eta(y)} {\mathbb{E}_{\alpha,\theta}\big [\vec{P}_\eta\big ]},\ \ \ \ n\geq 1, \end{equation*} with $p_0(x,y) = 1.$ The proof of (\ref{RN:00}) in \cite{FSWX2011} expands on a proof by \cite{E1992} for the infinitely-many-alleles model where $\alpha = 0$, whereas \cite{G1979} obtains (\ref{RN:00}) for the one-parameter model as a limit from a model with finitely-many types (cf.~also Proposition 4.3 in \cite{GS2012}). Due to the rearrangement in \cite{Z2015}, Theorem 2.1, (\ref{RN:00}) is the same as the following mixture form \begin{equation} p(t,x,y) ={\tilde d_1^{\theta}}(t)+\sum_{n=2}^\infty d_{n}^{\theta}(t)p_n(x,y),\quad \theta>-1\label{density_lod:01}, \end{equation} where ${\tilde d_1^{\theta}}(t)=1-\sum_{n=2}^{\infty}d_{n}^{\theta}(t)=d_0^{\theta}(t)+d_1^{\theta}(t)>0$. Algebraically ${\tilde d_1^{\theta}}(t)=d_0^{\theta}(t)+d_1^{\theta}(t)$ with both $d_0^{\theta}(t),d_1^{\theta}(t)$ non-negative when $\theta \geq 0$, but for $-1 < \theta < 0$ these may not be individually non-negative. \section{Duality} Two processes $X_t$ and $\mathcal{D}_t$ are said to satisfy a duality relation with respect to a bivariate function $H(\eta,x)$ if \begin{equation}\label{duality identity} \mathbb{E}_{\eta}^* \Big [H(\mathcal{D}_t,x)\Big ]=\mathbb{E}_{x}\Big[H(\eta,X_t)\Big], \end{equation} where $\mathbb{E}_{x}$ denotes the conditional expectation of $X_t$ conditioned on $X_{0}=x$ and $\mathbb{E}^*_\eta$ that of $\mathcal{D}_t$ conditioned on $\mathcal{D}_{0}=\eta$. See \cite{JK2014} for a review. In this section, we will establish a duality relation between the two-parameter Poisson--Dirichlet diffusion $X_t$ and a pure-death Markov chain $\mathcal{D}_t$ on $\Gamma$. Here the duality function $H(\eta,x)$ is defined through the normalized test function $$ H(\eta,x)=g_{\eta}(x)=\frac{\tilde{P}_{\eta}(x)}{\mathbb{E}_{\alpha,\theta}[\tilde{P}_{\eta}]}. $$ The duality identity (\ref{duality identity}) is usually verified through operations of the two generators on test functions. Note that the core of $\mathcal{L}_{\alpha,\theta}$ is the algebra spanned by the continuous extensions of $\{\tilde{P}_{\eta}(x),\eta\in\Gamma\}$. Therefore, $\tilde{P}_{(1)}(x)=1$ and $\tilde{P}_{(1,1)}(x)=1-\tilde{P}_{(2)}(x)$. More generally, if $d>1$ and $\eta_i=1$, with $\eta$ unranked, we have \begin{equation} \tilde{P}_{\eta} = \tilde{P}_{\eta-e_i} - \sum_{j\neq i, 1\leq j\leq d}\tilde{P}_{\eta-e_i+e_j}, \label{P_recursion:00a} \end{equation} which can be derived by noting that $\big (\sum_{k=1}^\infty x_k \big )\times \tilde{P}_{\eta-e_i}=\tilde{P}_{\eta-e_i}$, when $\sum_{k=1}^\infty x_k = 1$. In this paper $e_i$ denotes a vector with 1 in position $i$ and zeros elsewhere. Continuous extensions will keep equation (\ref{P_recursion:00a}) valid. Here the notation $\eta - e_i$ when $\eta_i=1$ indicates $(\eta_1,\ldots, \eta_{i-1},\eta_{i+1},\ldots,\eta_d)$. Since $\tilde{P}_{\eta}$ is symmetric in $\eta$, $\tilde{P}_{\eta-e_i}$ and $\tilde{P}_{\eta-e_i+e_j}$ are well defined. The next Lemma makes use of \eqref{P_recursion:00a} to show how the operator $\mathcal{L}_{\alpha,\theta}$ acts on all functions $\tilde{P}_\eta$, and is key in identifying the dual process. \begin{lemma}\label{generator_lemma} ${\cal L}_{\alpha,\theta}$ is well defined on all $\tilde{P}_\eta$ defined by the system of equations (\ref{P_recursion:00a}), where $\eta$ is unranked, recursive on $a_1(\eta)$, with ${\cal L}_{\alpha,\theta}1=0$. In particular, if $n=|\eta|$ and $d=l(\eta)$, \begin{equation} {\cal L}_{\alpha,\theta}\tilde{P}_\eta = -\frac{1}{2}n(n+\theta-1)\tilde{P}_\eta + \frac{1}{2}\sum_{i:\eta_i>1}\eta_i(\eta_i-1-\alpha)\tilde{P}_{\eta-e_i}+\frac{1}{2}(\theta + (d-1)\alpha)\sum_{i:\eta_i=1}\tilde{P}_{\eta-e_i}. \label{recursion:0} \end{equation} \end{lemma} This result was first proved by \cite{P2009}, Proposition 3.1. In Section \ref{sec:proof} we provide an independent proof based on \eqref{P_recursion:00a}. Since $g_{\eta}(x)=\frac{\tilde{P}_{\eta}(x)}{\mathbb{E}_{\alpha,\theta}[\tilde{P}_{\eta}]}$ and $g_{\eta}(x)$ is symmetric with respect to $\eta$, then \begin{align*} \mathcal{L}_{\alpha,\theta}g_\eta (x)=&-\frac{1}{2}n(n+\theta-1)g_{\eta}(x) + \frac{1}{2}\sum_{i:\eta_i>1}\eta_i(\eta_i-1-\alpha)\frac{\mathbb{E}_{\alpha,\theta}[\tilde{P}_{\eta-e_i}]}{\mathbb{E}_{\alpha,\theta}[\tilde{P}_{\eta}]}g_{\eta-e_i}(x)\\ &+\frac{1}{2}(\theta + (d-1)\alpha)\sum_{i:\eta_i=1}\frac{\mathbb{E}_{\alpha,\theta}[\tilde{P}_{\eta-e_i}]}{\mathbb{E}_{\alpha,\theta}[\tilde{P}_{\eta}]}g_{\eta-e_i}\\ =&-\frac{1}{2}n(n+\theta-1)g_{\eta}(x) + \frac{1}{2}\sum_{i:\eta_i>1}\eta_i(\eta_i-1-\alpha)\frac{\theta_{(n)}(1-\alpha)_{(\eta_i-2)}}{\theta_{(n-1)}(1-\alpha)_{(\eta_i-1)}}g_{\eta-e_i}(x)\\ &+\frac{1}{2}(\theta + (d-1)\alpha)\sum_{i:\eta_i=1}\frac{\theta_{(n)}}{\theta_{(n-1)}[\theta+(d-1)\alpha]}g_{\eta-e_i}\\ =&-\frac{1}{2}n(n+\theta-1)g_{\eta}(x) + \frac{1}{2}n(n+\theta-1)\sum_{i:\eta_i>1}\frac{\eta_i}{n}g_{\eta-e_i}(x)\\ &+\frac{1}{2}n(n+\theta-1)\sum_{i:\eta_i=1}\frac{1}{n}g_{\eta-e_i}\\ =&-\frac{1}{2}n(n+\theta-1)g_{\eta}(x) + \frac{1}{2}n(n+\theta-1)\sum_{\omega\subset\eta,|\omega|+1=|\eta|}\frac{\eta_i\chi(\omega,\eta)}{n}g_{\omega}(x) \end{align*} Therefore, \begin{equation}\label{duality on g_eta} {\cal L}_{\alpha,\theta}g_\eta (x)=\frac{1}{2}n(n+\theta-1)\sum_{\omega\in\Gamma_{|\eta|-1}:\ \omega\subset\eta}[g_{\omega}(x)-g_{\eta}(x)]p^{\downarrow}(\eta,\omega)=\mathcal{A}_{\theta}g_{\eta}(x), \end{equation} where \begin{equation}\nonumbe p^{\downarrow}(\eta,\omega)=\frac{\binom{|\omega|}{\omega}}{\binom{|\eta|}{\eta}}\chi(\omega,\eta)=\frac{\eta_i\chi(\omega,\eta)}{n}, \quad \quad \chi(\omega,\eta)={a}_{\eta_i}(\eta),\ i=1,\ldots,l(\eta), \end{equation} when $\omega$ is the descending arrangement of $\eta-e_i$ and is equal to zero otherwise. Here $p^{\downarrow}(\eta,\omega)$ is the transition probability of the down chain in \cite{P2009}. The operator $\mathcal{A}_{\theta}$ on the right hand side of \eqref{duality on g_eta} acts on $H(\eta,x)$ as a function of $\eta$, while ${\cal L}_{\alpha,\theta}$ acts on $H(\eta,x)$ as a function of $x$. The operator $\mathcal{A}_{\theta}$ defines a pure-death process $\mathcal{D}_t$ and the down chain in \cite{P2009} is just the embedded chain of $\mathcal{D}_t$. In fact, $\mathcal{D}_t$ is the process describing the cluster sizes of Kingman's coalescent at time $t$. The duality identity (\ref{duality identity}) between $\mathcal{D}_t$ and $X_t$ follows from Proposition 1.2 in \cite{JK2014} and the Feller property of both $X_t$ and ${\cal D}_t$. \begin{thm}\label{main prop} Let $\{X(t)\}_{t\geq 0}$ be a diffusion process in ${\overline\nabla}_\infty $ with pre-generator $\mathcal{L}_{\alpha,\theta}$ and $\{{\cal D}_t\}_{t\geq 0}$ a death process in $\Gamma$, with rates $\frac{|\eta|(|\eta|-1+\theta)}{2}p^{\downarrow}(\eta,\omega)$. Then, for every $\eta\in \Gamma, x\in\overline\nabla_\infty,$ \begin{equation} \mathbb{E}^*_\eta\big [g_{{\cal D}_t}(x)]=\mathbb{E}_x\big [g_\eta\big (X(t)\big )]. \label{dual:200} \end{equation} The transition functions of ${\cal D}_t$ are, for $\omega \subset \eta$, \begin{equation} q^\theta_{\eta\omega}(t) = {\cal H}(\omega\mid \eta) d^\theta_{|\omega| |\eta|}(t), \label{multiple:0} \end{equation} where \begin{equation}\nonumber {\cal H}(\omega\mid \eta)= \frac{ \binom{|\omega|}{\omega}\dim(\omega,\eta) } { \binom{|\eta|}{\eta} }, ~ \dim(\omega,\eta)=\sum_{\omega=\omega^0\subset\cdots\subset\omega^{n-w}=\eta}\prod_{i=0}^{|\eta|-|\omega|-1}\chi(\omega^i,\omega^{i+1}) \end{equation} and $d^\theta_{nm}(t)$ $n\geq m\geq 1$ are the transition probabilities of $\{|{\cal D}_t|\}$, a Markov pure-jump process, with respect to its natural filtration, with rates from $n$ to $n-1$ of $\lambda_n= n(n+\theta-1)/2,\ n\geq 2$, with $1$ as absorbing state. \end{thm} \begin{proof} The statement follows from the above discussion together with the fact that \begin{equation}\nonumber \begin{aligned} d_{\eta\omega}^{\theta}(t) =&\,\mathbb{P}_{\eta}(\mathcal{D}_t=\omega)=\mathbb{P}_{\eta}(\mathcal{D}_t=\omega| D_t=|\omega|)\mathbb{P}_{\eta}(D_{t}=|\omega|)\\ =&\,d_{|\eta||\omega|}^{\theta}(t)\mathbb{P}_{\eta}(\mathcal{D}_t=\omega| D_t=|\omega|)={\cal H}(\omega\mid \eta) d_{|\eta||\omega|}(t), \end{aligned} \end{equation} where $D_t=|\mathcal{D}_t|$. \end{proof} Surprisingly, the dual process does not depend on $\alpha$, despite the important role $\alpha$ has in the two parameter model (cf., e.g., \cite{CDRS17}) and the fact that $g_{\eta}(x)$ does depend on $\alpha$. In fact, the rates of this dual process are the same as of the dual to the neutral Wright--Fisher diffusion, cf.~\cite{GS2010,PR14}. There is, however, an important difference. The dual process of the labelled Wright-Fisher model, when it hits $\{1\}$, holds for an exponential time with rate of $\lambda_1=\theta/2>0,$ before getting absorbed at $\{0\}$; in the unlabelled model, for any values of $\alpha,\theta,$ the dual is absorbed at $\{1\}$. The unlabelled dual can be obtained from the labelled one by collapsing the states $1$ and $0$ into a unique absorbing state, which we label as $\{1\}$. The probabilities $\mathbb{P}(|{\cal D}_t|=n\ {\big |} \ |{\cal D}_0|=\infty)$ for $n\geq2$ are still equal to $d_{n}^{\theta}(t)$ as they do not depend on the rate in state 1 and are thus well-defined even for the admissible case $\theta<0$. The absorbing probability of $|{\cal D}_t|$ is then defined as ${\tilde d_1^{\theta}}(t)=1-\sum_{n=2}^{\infty}d_{n}^{\theta}(t)$. \begin{cor}\label{Corr24} For $\eta \in \Gamma_n$, \begin{equation} \mathbb{E}_x\big [\tilde{P}_\eta\big (X(t)\big )\big ] =\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_\eta\big ]\Bigg ( \tilde d^\theta_{n 1}(t) + \sum_{w=2}^nd^\theta_{nw}(t) \sum_{|\omega|=w,\omega\subset\eta}\mathcal{H}(\omega\mid\eta) \frac{\tilde{P}_\omega(x)}{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_\omega\big ]}\Bigg ), \label{expansion:0} \end{equation} \end{cor} \begin{proof} The proof is immediate by expanding the left side of (\ref{dual:200}) and using (\ref{multiple:0}). \end{proof} \section{Deriving the transition density through duality} In this section, we will derive the transition density \eqref{density_lod:01} through Corollary \ref{Corr24}. Essentially we need to take limit on both sides of equation (\ref{expansion:0}). It heavily relies on the following lemma. \begin{lemma}\label{weak_convergence} Let $\{M_n,~n\geq1\}$ be a partition structure with representing measure $\mu$. Then as $n\to\infty$ $$ \mu_n(dx)=\sum_{\eta\in\Gamma_n}M_n(\eta)\delta_{\eta/n}(dx) $$ will converge to $\mu$ weakly. \end{lemma} \begin{proof} Let $D_n$ be a family of $\Gamma$-valued random variables with distribution $M_n$. Then by Kingman's representation theorem, we know $\frac{D_n}{n}$ converges to $Z$ almost surely and the distribution of $Z$ is $\mu$. Therefore, for any bounded continuous function $f$ on the Kingman simplex $\overline{\nabla}_{\infty}$, we have $$ \lim_{n\to\infty}\int_{\overline{\nabla}_{\infty}}f(x)\mu_n(dx)=\lim_{n\to\infty}\mathbb{E} f\left(\frac{D_n}{n}\right)=\mathbb{E} f(Z)=\int_{\overline{\nabla}_{\infty}}f(x)\mu(dx). $$ So $\mu_n$ converges to $\mu$ weakly. \end{proof} Before we take limits, we can see that there are three types of sampling probabilities in the equation (\ref{expansion:0}). They are \begin{align} M_{n,t}(\eta)=\mathbb{E}_x[\vec{P}_{\eta}(X(t))], \quad M_n(\eta)=\mathbb{E}_{\alpha,\theta}[\vec{P}_{\eta}],\quad M_{n,\omega}(\eta)=\mathcal{H}(\omega\mid \eta)\frac{\mathbb{E}_{\alpha,\theta}[\vec{P}_{\eta}]}{\mathbb{E}_{\alpha,\theta}[\vec{P}_{\omega}]}. \label{3 partition structures} \end{align} Hence, upon defining \begin{align}\nonumber \mu_{n,t,x}(dy)=&\,\sum_{|\eta|=n}\mathbb{E}_{x}[\vec{P}_{\eta}(X_t)]\delta_{\frac{\eta}{n}}(dy), \quad \mu_{n}(dy)=\sum_{|\eta|=n}M_{n}(\eta)\delta_{\frac{\eta}{n}}(dy),\\ \quad \nu_{\omega,n}(dy)=&\,\sum_{\omega\subset\eta}M_{n,\omega}(\eta)\delta_{\eta/n}(dy)\nonumber \end{align} we have the equation \begin{align} \mu_{n,t,x}(dy)=&\tilde{d}_{n,1}^{\theta}(t)\mu_{n}(dy)+\sum_{w=2}^{n}d^{\theta}_{nw}(t)\sum_{|\omega|=w}\vec{P}_{\omega}(x)\nu_{\omega,n}(dy).\label{expansion:000} \end{align} \subsection{A generalized P\'olya urn} We can easily see that both {$M_{n,t}(\eta)$ and $M_n(\eta)$ in \eqref{3 partition structures} are partition structures, but the same may not be obvious about $M_{n,\omega}(\eta)$. To see this in the case of Ewens--Pitman partitions, we provide an interpretation of $M_{n,\omega}(\eta)$ as related to a generalized P\'olya urn, whose associated sampling sequence corresponds in fact the up chain in \cite{P2009}. Suppose an urn contains a single white ball and $w$ non-white balls, whose colours are denoted by $Y^w=(Y_1,\cdots,Y_w)$. Let $\sim$ be an equivalence relation on colours such that $Y_1\sim Y_2$ if $Y_1=Y_2$. Define $\pi:Y^w\to \omega$ to be a map projecting a sample $Y^w$ to an integer partition $\omega\in\Gamma_{w}$ through the equivalence relation $\sim$. If there are $r$ distinct colours in the sample $Y^w$ and $\omega=(\omega_1,\cdots,\omega_r)$, then there are $w$ balls of $r$ different colors in the urn with counts of $\omega$. Suppose that there are $\omega_j-1$ balls of mass $1$ and one ball of mass $1-\alpha$ for the $j$-th colour when $j=1,\ldots, r$; and there is one white ball of mass $\theta+r\alpha$. Balls are then drawn sequentially as follows. If the white ball is drawn a new colour ball of mass $1-\alpha$ is added, and the mass of the white ball is increased by $\alpha$. If an existing coloured ball is drawn then it is replaced with an additional ball of mass $1$ of the same colour. Denote the colour of $n-w$ new balls drawn by $X^{n-w}=(X_1,\ldots,X_{n-w})$. The urn model is a generalization of urn models in \cite{BM1973,H1984,P1996}. Now consider the colour configurations $\pi(X^{n-w})$ of the new sample and $\pi(X^{n-w},Y^w)$ of the combined sample. We derive their distribution conditional on $Y^w$. Denote by ${\cal D}$ a Dirichlet distribution. \begin{pro}\label{Bayes:250} For every $\omega \in \Gamma_w, \eta \in \Gamma_n, \gamma \in \Gamma_{n-w},$ \begin{align} \mathbb{P}(\pi(X^{n-w})=\gamma\mid Y^w=\omega)=&\,\mathbb{E}_{{\cal PD}(\alpha,\theta;\omega)}\big [\vec{P}_{\gamma}\big ],\label{deFinetti}\\ \mathbb{P}(\pi(X^{n-w},Y^w)=\eta\mid Y^w=\omega)=&\,{\cal H}(\omega\mid\eta)\frac{\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\eta}\big ]}{\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\omega}\big ]},\label{deFinetti:100} \end{align} where $${\cal PD}(\alpha,\theta;\omega) := Z_{w,r}{\cal D}(\omega_1-\alpha,\ldots, \omega_r-\alpha) \oplus (1-Z_{w,r}){\cal PD}(\alpha,\theta+r\alpha),$$ where $Z_{w,r}$ has Beta distribution ${\cal B}(w-r\alpha,\theta+r\alpha)$, independent of everything else, and the direct sum notation $\oplus$ indicates an accumulation of the points from the two point processes. \end{pro} \begin{proof} Due to exchangeability of the draws in this urn model and Corollary 20 in \cite{P1996}, we recognize that equation (\ref{deFinetti}) is true. To prove (\ref{deFinetti:100}) consider a path from $\omega$ to $\eta$. Let $\omega^{i}=\pi(X^{i},Y^w), 1\leq i\leq n-w$, $w^i=|\omega^i|$ and $r^i$ be the number of colours in $\omega^i$. Set $\omega^{0}=\omega$. When $\pi(X^{n-w},Y^w)=\eta$, there is a path $\omega=\omega^0\subset\cdots\subset\omega^{n-w}=\eta$. Let $\chi_B(\omega^i,\omega^{i+1})=\alpha_{\omega^{i}_k}(\omega^{i})$ if $\omega^{i+1}$ is obtained from $\omega^{i}$ by adding $1$ to an existing $k$-th component or $\chi_B(\omega^i,\omega^{i+1})=1$ if a new component is added to $\omega^{i+1}$. Then \begin{equation*} \mathbb{P}(\omega^{i+1}\mid\omega^i)=\chi_B(\omega^i,\omega^{i+1})\frac{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\omega^{i+1}}\big ]}{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\omega^i}\big ]} = \begin{cases} {\small a_{\omega_k^i}(\omega^{i})}\frac{\omega_k^i - \alpha}{\theta + w^i}&\text{if a non-white ball is drawn,}\\ \frac{\theta+\alpha r^i}{\theta+w^i}&\text{if the white ball is drawn,} \end{cases} \label{identity:65} \end{equation*} Note that $\chi_B(\omega,\eta)$ and $\chi(\omega,\eta)$ are conjugate, i.e. $$ \chi_B(\omega,\eta)=\frac{\alpha_1(\omega)!\cdots\alpha_{|\omega|}(\omega)!}{\alpha_1(\eta)!\cdots\alpha_{|\eta|}(\eta)!}\chi(\omega,\eta). $$ Evaluating the probability of a path from $\omega$ to $\eta$, leads to \begin{align*} \mathbb{P}(\eta \mid \omega)=&\sum_{\omega=\omega^0\subset\cdots\subset\omega^{n-w}=\eta}\prod_{i=0}^{n-w-1}\chi_{B}(\omega^{i},\omega^{i+1})\frac{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\omega^{i+1}}\big ]}{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\omega^{i}}\big ]}\\ =&\left(\sum_{\omega=\omega^0\subset\cdots\subset\omega^{n-w}=\eta}\prod_{i=0}^{n-w-1}\chi_B(\omega^{i},\omega^{i+1})\right)\frac{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\eta}\big ]}{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\omega}\big ]}\\ =&\frac{a_1(\omega)!\cdots a_w(\omega)!\dim(\omega,\eta)}{a_1(\eta)!\cdots a_n(\eta)!}\frac{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\eta}\big ]}{\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\omega}\big ]} =\frac{\binom{w}{\omega}\dim(\omega,\eta)}{\binom{n}{\eta}}\frac{\binom{n}{\eta}\frac{1}{a_1(\eta)!\cdots a_n(\eta)!}\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\eta}\big ]}{\binom{w}{\omega}\frac{1}{a_1(\omega)!\cdots a_w(\omega)!}\mathbb{E}_{\alpha,\theta}\big [\tilde{P}_{\omega}\big ]}\\ =&{\cal H}(\omega\mid\eta)\frac{\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\eta}\big ]}{\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\omega}\big ]}. \end{align*} \end{proof} Note that $ \mathbb{P}(\pi(X^{n-w})=\gamma\mid Y^w)=\mathbb{P}(\pi(X^{n-w},Y^w)=\eta\mid Y^w) $ when $\gamma$ is the counts of the new samples and $\eta$ is the counts of the combined sample. Thus, $$ M_{n,\omega}(\eta)=\mathcal{H}(\omega\mid \eta)\frac{\mathbb{E}_{\alpha,\theta}[\vec{P}_{\eta}]}{\mathbb{E}_{\alpha,\theta}[\vec{P}_{\omega}]}=\mathbb{E}_{{\cal PD}(\alpha,\theta;\omega)}\big [\vec{P}_{\gamma}\big ] $$ then $M_{n,\omega}(\eta)$ is also a partition structure with the representing measure $\mathcal{PD}(\alpha,\theta;\omega)$. By Kingman's representation theorem, $\pi(X^{n-w},Y^w)\big /n$ will converge almost surely to a random variable $Z$ with values in $\overline{\nabla}_{\infty}$. Because the conditional distribution of $\pi(X^{n-w},Y^w)\big /n$ is $$ \nu_{n,\omega}(dy)=\sum_{|\eta|=n,\ \omega\subset \eta} {\cal H}(\omega\mid\eta)\Big (\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\eta}\big ]\big /\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\omega}\big ]\Big )\delta_{\eta/n}(dy), $$ then we know that $\nu_{n,\omega}(dy)$ will converge weakly to the conditional distribution $\mathbb{P}(Z\in dy\mid Y^w)$. Conditioning on $Y^w$, we know $\pi(X^{n-w})\big / n$ and $\pi(X^{n-w},Y^w)\big /n$ will both converge to $Z$ almost surely. Then $Z$ has distribution ${\cal PD}(\alpha,\theta;\omega)$ due to Lemma \ref{weak_convergence} and equation (\ref{deFinetti}). \begin{lemma}\label{weak_Con} ${\cal PD}(\alpha,\theta;\omega)$ in Proposition \ref{Bayes:250} can be written \begin{equation} {\cal PD}(\alpha,\theta;\omega)(dy)=\frac{\vec{P}_{\omega}(y)}{\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\omega}\big ]}{\cal PD}(\alpha,\theta)(dy). \label{Bayes:00} \end{equation} \end{lemma} \begin{proof} Let $V$ have distribution ${\cal PD}(\alpha,\theta)$ and $Y^w$ be a sample from the urn. By Lemma \ref{weak_convergence}, $ \mathbb{P}(\pi(Y^w)=\omega,V\in dy)=\vec{P}_{\omega}(y)\mathcal{PD}(\alpha,\theta)(dy). $ Since the marginal distribution $\mathbb{P}(\pi(Y^w)=\omega)=\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\omega}\big ]$, then by Bayes theorem $\mathbb{P}(V\in dy\mid\pi(Y^w)=\omega) =\Big (\vec{P}_\omega(y)\big /\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\omega}\big ] \Big ) \mathcal{PD}(\alpha,\theta)(dy)$. From (\ref{deFinetti}) in Proposition \ref{Bayes:250}, $\mathbb{P}(V\in dy\mid\pi(Y^w)=\omega)=\mathcal{PD}(\alpha,\theta;\omega)(dy)$. Then (\ref{Bayes:00}) follows. \end{proof} Taking the limit as $n\to\infty$ on both sides of \eqref{expansion:000} yields the following result. \begin{thm}\label{theorem33} Given $X(0)=x$, $X(t)$ has a distribution given by the mixture \begin{equation} P(t,x,dy)=\widetilde d_1^\theta(t){\cal PD}(\alpha,\theta)(dy) +\sum_{w=2}^\infty d^\theta_{w}(t)\sum_{\omega:|\omega| =w} {\cal PD}(\alpha,\theta;\omega)(dy)\vec{P}_\omega(x) . \label{PDalphathetaomega} \end{equation} \end{thm} \begin{proof} For any bounded continuous function $f$ on the Kingman simplex, we have \begin{align*} &\int_{\overline{\nabla}_{\infty}}f(y)\mu_{n,t,x}(dy)\\ =&\tilde{d}_{n,1}^{\theta}(t)\int_{\overline{\nabla}_{\infty}}f(y)\mu_{n}(dy)+\sum_{w=2}^{n}d^{\theta}_{nw}(t)\sum_{|\omega|=w}\vec{P}_{\omega}(x)\int_{\overline{\nabla}_{\infty}}f(y)\nu_{\omega,n}(dy) \end{align*} due to equation (\ref{expansion:000}) which is derived from Corollary \ref{Corr24}. By Lemma \ref{weak_convergence}, we know $\mu_{n}\to\mathcal{PD}(\alpha,\theta)$ and $\nu_{\omega,n}\to \mathcal{PD}(\alpha,\theta;\omega)$. Then by the bounded convergence theorem we know \begin{align*} &\lim_{n\to\infty}\int_{\overline{\nabla}_{\infty}}f(y)\mu_{n,t,x}(dy)\\ =&\tilde{d}_{1}^{\theta}(t)\int_{\overline{\nabla}_{\infty}}f(y)\mathcal{PD}(\alpha,\theta)(dy)+\sum_{w=2}^{\infty}d^{\theta}_{w}(t)\sum_{|\omega|=w}\vec{P}_{\omega}(x)\int_{\overline{\nabla}_{\infty}}f(y)\mathcal{PD}(\alpha,\theta;\omega)(dy). \end{align*} But Lemma \ref{weak_convergence} also shows that $\mu_{n,t,x}(dy)$ converges to $P(t,x,dy)$ weakly, so $$ P(t,x,dy)=\tilde{d}_{1}^{\theta}(t)\mathcal{PD}(\alpha,\theta)(dy)+\sum_{w=2}^{\infty}d^{\theta}_{w}(t)\sum_{|\omega|=w}\vec{P}_{\omega}(x)\mathcal{PD}(\alpha,\theta;\omega)(dy). $$ \end{proof} \subsection{Split Urn} The P\'olya urn representation discussed above leads to a new probabilistic construction of a random variable $X(t)$ with the same distribution as in (\ref{PDalphathetaomega}), obtained by splitting urns. The construction holds at each fixed time point $t\geq 0$. Let $U_n,\ n\geq 1$ be the configuration of balls in the P\'olya urn model above after $n$ draws beginning with a single white ball when $n=0$. Run the urn for a random number of draws $D_t$ to obtain a partition $U_{D_t}$ where $ \mathbb{P}(D_t=w)=d_{w}^{\theta}(t), ~w\geq1. $ Split the urn by running two urns independently both beginning from $U_{D_t}$ for $n-D_t$ draws. Then we have two random partitions $\eta$ and $\tilde{\eta}$ in the urns. Given the partition at time $D_t$, these two random partitions are independent and have the same distribution $$ \mathbb{P}(U_n=\eta\mid U_{D_t}=\omega)={\cal H}(\omega\mid\eta)\frac{\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\eta}\big ]}{\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\omega}\big ]}. $$ Therefore we have two coupled urns $\{(U_n,U^{\prime}_n),n\geq1\}$. Their joint distribution is $$ \mathbb{P}(U_n=\eta,U^{\prime}_n=\eta^\prime)=\sum_{w=1}^{\infty}d_{w}^{\theta}(t)\sum_{|\omega|=w}\mathbb{E}_{\alpha,\theta}\big [\vec{P}_{\omega}\big ]\mathbb{P}(\eta\mid\omega)\mathbb{P}(\eta^{\prime}\mid\omega). $$ A convention is used that if $|\omega| > |\eta|$ then $\mathbb{P}(\eta\mid\omega)=0$ and similarly for $\eta^\prime$. Consider a measure on $\overline{\nabla}_{\infty}\times\overline{\nabla}_{\infty}$ $$ \nu_n(dx,dy)=\sum_{|\eta|=n}\sum_{|\eta^{\prime}|=n}\mathbb{P}(U_n=\eta,U^{\prime}_n=\eta^{\prime})\delta_{\frac{\eta}{n}}(dx)\delta_{\frac{\eta^{\prime}}{n}}(dy). $$ By Lemma \ref{weak_convergence} we can show weak convergence $$ \nu_{n}(dx,dy)\to \left[\sum_{w=1}^{\infty}d_{w}^{\theta}(t)p_w(x,y)\right]{\cal PD}(\alpha,\theta)(dx){\cal PD}(\alpha,\theta)(dy). $$ \begin{remark} Importantly, this is a probabilistic construction which shows that the conditional distribution of $Y\mid X$ is the same as the transition distribution in the diffusion (\ref{density_lod:01}) for a fixed time $t$. The split urns approach is motivated by a similar construction when $\alpha=0$ in \cite{GS2012} and for Wright-Fisher diffusion bridges in \cite{GJS2018} for $\alpha=0,\ \theta\geq 0$. \end{remark} \section{Proof of Lemma \ref{generator_lemma}}\label{sec:proof} In this proof $\eta$ and the modifications made to it are not ranked, however it is assumed that singletons are arranged to be at the right end of $\eta$. Let $d=l(\eta)$. The proof that (\ref{recursion:0}) holds is by induction on $l(\eta)$. If $a_1(\eta) = 0$ then $P_\eta \in {\cal C}$ and \begin{equation*} {\cal L}_{\alpha,\theta}P_\eta = -\frac{1}{2}n(n+\theta-1)P_\eta + \frac{1}{2}\sum_{i:\eta_i>1}\eta_i(\eta_i-1-\alpha)P_{\eta-e_i} \end{equation*} by simply applying ${\cal L}_{\alpha,\theta}$. If $a_1(\eta)>0$ $P_\eta$ can be recursively expressed as linear combinations of functions in ${\cal C}$ which can then be acted on by the differential form (\ref{gen:0}). Recall that $P_\eta$ is exchangeable in the elements of $\eta$ so it is possible to rearrange the elements so that the $a_1(\eta)$ singletons are the last entries of $\eta$. Suppose that $\eta_d=1$. Then we use the notation that $\eta^-= \eta-e_d = (\eta_1,\ldots,\eta_{d-1})$, where the final component of $\eta$ is removed. Consider (\ref{P_recursion:00a}) with $i=d$, then \begin{equation} P_\eta = P_{\eta^-} - \sum_{j=1}^{d-1}P_{\eta^-+e_j}. \label{P_recursion:0} \end{equation} Suppose that (\ref{recursion:0}) holds for $l(\eta) \leq d-1$. First use the induction hypothesis on the second term on the right of (\ref{P_recursion:0}). Denote $d^\circ = d - a_1(\eta)$. For $1\leq j\leq d^\circ$, \begin{align*} {\cal L}_{\alpha,\theta}P_{\eta^-+e_j} =&\,-\frac{1}{2}n(n+\theta-1)P_{\eta^-+e_j}\\ &\, + \frac{1}{2}\sum_{i=1}^{d^\circ}(\eta_i+\delta_{ij})(\eta_i+\delta_{ij}-1-\alpha)P_{\eta^--e_i+e_j} +\frac{1}{2}(\theta + (d-2)\alpha)(a_1(\eta)-1)P_{\eta^{--}+e_j}\\ =&\,-\frac{1}{2}n(n+\theta-1)P_{\eta^-+e_j + \frac{1}{2}\sum_{i=1}^{d^\circ}\eta_i(\eta_i-1-\alpha)P_{\eta^--e_i+e_j} + \frac{1}{2}(2\eta_j-\alpha)P_{\eta^-}\\ &\,+\frac{1}{2}(\theta + (d-2)\alpha)(a_1(\eta)-1)P_{\eta^{--}+e_j} \end{align*} If $a_1(\eta) = 1$ the last term in the equation above with a factor $(a_1(\eta)-1)$ is taken to be zero, and similarly in equations that follow. Denote $\eta^* = (\eta_1,\ldots,\eta_{d^\circ},2,1,\ldots,1)$ with $a_1(\eta^*)=a_1(\eta)-2$. For $d^\circ < j \leq d-1$, $P_{\eta^-+e_j}=P_{\eta^*}$ and \begin{align*} {\cal L}_{\alpha,\theta}P_{\eta^-+e_j} =&\,{\cal L}_{\alpha,\theta}P_{\eta^*} \\ =&\,-\frac{1}{2}n(n+\theta-1)P_{\eta^*} + \frac{1}{2}\sum_{i=1}^{d^\circ}\eta_i(\eta_i-1-\alpha)P_{\eta^*-e_i + \frac{1}{2}2(1-\alpha)P_{\eta^-} \\ &\, +\frac{1}{2}(\theta + (d-2)\alpha)(a_1(\eta)-2)P_{\eta^{*-}}, \end{align*} A term on the right comes from $\eta_{i}=2$, when $i=d^\circ+1$. Then $\eta_i(\eta_i-1-\alpha)P_{\eta^-}= 2(1-\alpha)P_{\eta^-}$. Summing, recalling that $\eta^*=\eta^-+e_j$, and using (\ref{P_recursion:0}) for identities, where $1 \leq i \leq d^\circ$, \[ \sum_{j=1}^{d-1}P_{\eta^-+e_j} = P_{\eta^-} - P_\eta,\> \sum_{j=1}^{d-1}P_{\eta^--e_i+e_j} = P_{\eta^--e_i} - P_{\eta-e_i},\> \sum_{j=1}^{d-2}P_{\eta^{--}+e_j} = P_{\eta^{--}} - P_{\eta^-}, \] gives \begin{equation} \begin{aligned} \sum_{j=1}^{d-1}{\cal L}_{\alpha,\theta}P_{\eta^-+e_j} =&\, -\frac{1}{2}n(n+\theta-1)(P_{\eta^-}-P_{\eta})\\ &\,+ \frac{1}{2}\sum_{i=1}^{d^\circ}\eta_i(\eta_i-1-\alpha)(P_{\eta^--e_i}-P_{\eta-e_i})\\ &\,+ \frac{1}{2}(2(n-a_1(\eta)) - (d-a_1(\eta)))\alpha P_{\eta^-} + \frac{1}{2}2(1-\alpha)(a_1(\eta)-1)P_{\eta^-} \\ &\,+\frac{1}{2}(a_1(\eta)-1)(\theta + (d-2)\alpha)(P_{\eta^{--}} - P_{\eta^-}), \end{aligned} \label{proof:011} \end{equation} Now use the induction hypothesis on the first term on the right of (\ref{P_recursion:0}). \begin{equation} \begin{aligned} {\cal L}_{\alpha,\theta}P_{\eta-} =&\,-\frac{1}{2}(n-1)(n+\theta-2)P_{\eta^-}\\ &+ \frac{1}{2}\sum_{i=1}^{d^\circ}\eta_i(\eta_i-1-\alpha)P_{\eta^--e_i} +\frac{1}{2}(\theta + (d-2)\alpha)(a_1(\eta)-1)P_{\eta^{--}}\\ &=-\frac{1}{2}n(n+\theta-1)P_{\eta^-}+ \frac{1}{2}(2n-2+\theta)P_{\eta^-}\\ &+ \frac{1}{2}\sum_{i=1}^{d^\circ}\eta_i(\eta_i-1-\alpha)P_{\eta^--e_i} +\frac{1}{2}(\theta + (d-2)\alpha)(a_1(\eta)-1)P_{\eta^{--}} \end{aligned} \label{proof:00} \end{equation} Subtracting (\ref{proof:011}) from (\ref{proof:00}) \begin{equation*} \begin{aligned} {\cal L}_{\alpha,\theta}P_{\eta} =&\,{\cal L}_{\alpha,\theta}P_{\eta-} - \sum_{j=1}^{d-1}{\cal L}_{\alpha,\theta}P_{\eta^-+e_j}\\ &= -\frac{1}{2}n(n+\theta-1)P_{\eta} + \frac{1}{2}\sum_{i=1}^{d^\circ}\eta_i(\eta_i-1-\alpha)P_{\eta-e_i} + R(\eta), \end{aligned} \end{equation*} where \begin{equation} \begin{aligned} R(\eta) =&\, \frac{1}{2}(2(n-1) +\theta)P_{\eta^-} -\frac{1}{2}(2(n-a_1(\eta)) - (d-a_1(\eta)))\alpha P_{\eta^-}\\ & - \frac{1}{2}2(1-\alpha)(a_1(\eta)-1)P_{\eta^-} +\frac{1}{2}(a_1(\eta)-1)(\theta + (d-2)\alpha)P_{\eta^-} \end{aligned} \label{rcalc:0} \end{equation} The coefficient of $\frac{1}{2}a_1(\eta)P_{\eta^-}$ in (\ref{rcalc:0}) is \[ 2-\alpha - 2(1-\alpha) + \theta + (d-2)\alpha = \theta+(d-1)\alpha \] and the terms not involving $a_1(\eta)$ are one-half times \[ 2(n-1) + \theta -2n + d\alpha + 2(1-\alpha) - (\theta+(d-2)\alpha) = 0. \] Therefore, correctly, $R(\eta) = \frac{1}{2}( \theta+(d-1)\alpha)P_{\eta^-}$ and the induction is completed. \begin{funding} The fourth author is supported by grant NSFC117015170. \end{funding}
\section{Introduction} For the last decade, many researchers from academia and industry have focused on non-orthogonal multiple access (NOMA) in order to overcome challenges caused by smart devices with massive connectivity and fulfill requirements of forthcoming generations wireless networks since the existing orthogonal multiple access (OMA) techniques are limited in terms of spectral efficiency and massive connectivity \cite{QCLi,LiuY,Aldababsa}. The most important key feature of NOMA is to serve multiple users in the same resources (time/frequency/code) by allocating different power coefficients, thus fairness among users can be ensured. On the other hand, successive interference cancellation (SIC) technique is applied by users to separate the superposed signals and obtain the desired information related to user \cite{Saito1}. So far, NOMA, especially power-domain NOMA, has been widely investigated in the literature. In \cite{DingZ}, a downlink NOMA network based on cell-clustering, where distances between the base station (BS) and users are subjected to uniform distribution, is investigated. In \cite{Timotheou}, the authors have focused on optimization of power coefficients in order to ensure maximizing the fairness among user. In \cite{Gui}, a new definition to measure the fairness, which evaluates rate of each user by accounting for the fraction of total power allocated to it, for NOMA networks is proposed. On the other hand, in order to exploit benefits of spatial diversity, multiple-input multiple-output (MIMO) techniques are also considered in NOMA networks \cite{DingZ1}. Accordingly, in \cite{QiSun}, ergodic capacity maximization problem, where cost function is subjected to total transmit power constraint and minimum rate constraint related to weak user, is investigated for a two-user MIMO-NOMA network. In \cite{MZeng}, the authors have analyzed sum and ergodic capacity of MIMO-NOMA system, in which multiple users are grouped into a cluster according to certain algorithms, and demonstrated that the sum capacity is inversely proportional to the number of users within cluster. In addition, several beamforming techniques have been investigated for multiple-input single-output (MISO) and/or MIMO NOMA networks in order to either maximize capacity and fairness or minimize transmit power \cite{QZhang,DingZ2,XChen,FAlavi}. In \cite{MtokaCL}, the authors have analyzed the outage probability (OP) of Alamouti space-time block coding (STBC) \cite{Tarokh} in MISO multi-user NOMA network over independent and identically distributed (i.i.d.) Nakagami-$m$ fading channels. In \cite{Mtoka}, the same network considered in \cite{MtokaCL} has been generalized to all orthogonal STBC (OSTBC) codes. The authors have analyzed the OP and ergodic capacity over i.i.d. Nakagami-$m$ fading channels by also considering the effects of channel estimation errors (CEEs), feedback delay (FBD) and imperfect SIC (ipSIC). Although using multiple antennas at the transmitter and receiver ends provides improved transmission reliability and spatial diversity, wireless systems suffer from hardware complexity and high power consumption. Therefore, the authors of \cite{YYu1} proposed several computationally efficient antenna selection algorithms for two-user MIMO-NOMA scenarios based on fixed power and cognitive radio-inspired power allocations in order to maximize the system sum-rate. In \cite{AldababsaMajTAS}, a novel antenna selection scheme for single-hop MIMO-NOMA based on decision of majority of users differing from \cite{YYu1} has been proposed and OP performance has been investigated over Nakagami-$m$ fading by also considering effects of CEEs and FBD. Moreover, since relaying techniques offer extending coverage area and establish reliable communication under heavy channel environments and huge obstacles, recently, NOMA has been extended to cooperative transmission \cite{DingZ3,JBKim}. In \cite{JJmen}, the OP analysis of a dual-hop amplify-and-forward (AF) relaying NOMA network, where the BS and users are equipped with single antenna, has been conducted over Nakagami-$m$ fading under effect of CEEs. In \cite{ZhangY}, the authors have investigated transmit antenna selection (TAS) at the BS and maximal-ratio combining (MRC) at users in a dual-hop AF relaying NOMA system over Nakagami-$m$ fading by considering CEEs. In \cite{XYan}, OP and ergodic capacity of cooperative two-user NOMA networks with direct link, where single relay among multiple relays and single antenna at users are selected, has been analyzed in the presence of CEEs and ipSIC. The authors of \cite{HLi} have analyzed joint relay and antenna selection problem in cooperative two-user NOMA network based on coordinated direct and relay transmission structure in terms of OP over Rayleigh fading channels. In \cite{AldababsaMRTRAS}, the authors have analyzed OP of a dual-hop MIMO-NOMA network, where maximal-ratio transmission (MRT)/receive antenna selection (RAS) are adopted in both hops, over Nakagami-$m$ fading channels in the presence of CEEs. Although reliability and performance of NOMA networks have been increased by aforementioned cooperative studies, however they are all based on half-duplex (HD) relaying which has limited spectral efficiency because of allocation of two orthogonal channels for transmission. On the other hand, full-duplex (FD) relaying technique has been regarded as a promising solution since the reception and transmission can be realized at the same time/frequency yielding double capacity \cite{Duarte}. However, FD relay has a major drawback named as loop-interference (LI) caused by signal leakage between the transmitter and receiver antennas. Fortunately, thanks to the advances on antenna technologies and signal processing approaches, effect of LI can be reduced to a sufficient level in order for FD relaying be feasible in a practical manner \cite{Duarte,Rodriguez}. Therefore, the authors of \cite{ZhongC} and \cite{TMCC} have considered using FD relay in NOMA systems in order to overcome spectral efficiency loss caused by HD relays. Also, in \cite{YAlsaba}, a cooperative two-user NOMA network, where the BS adopts zero-forcing (ZF) beamforming and the strong user acts as a decode-and-forward (DF) FD relay to assist weak user, has been proposed. The authors have analyzed OP of the network over Rayleigh fading channels by also taking into account of energy harvesting at the relay. In \cite{Mohammadi}, a cooperative two-user NOMA network based on cognitive radio has been considered and joint beamforming optimization problem for transmit/receive ends at DF FD relay has been evaluated. The authors have also investigated MRT/ZF, ZF/MRC and ZF/ZF schemes at the relay in a comparative manner. In practice, radio-frequency hardware components at the transmitter and receiver suffer from different impairments caused by high power amplifier non-linearity, in-phase/quadrature (I/Q) imbalance and phase noise, which seriously deteriorate the system performance due to mismatch between the desired and actual signal \cite{Schenk}. In order to compensate the influence of these hardware impairments (HIs), a lot of efforts in developing appropriate approaches have been made in the literature, however, there still exist residual HIs (RHIs) which can not be overlooked in real-life deployments \cite{Bjornson,Bjornson2}. Although some of the aforementioned studies on NOMA networks consider only CEEs, FBD and ipSIC without RHIs in a practical manner, nevertheless, there are some works paying attention to effects of RHIs in NOMA networks. Particularly, in \cite{XLi3}, the impact of I/Q imbalance impairment in a secure single-input multiple-output (SIMO)-NOMA network consisting of one BS, multiple legitimate users and an eavesdropper has been investigated over Rayleigh fading channels. In order to exploit receive diversity, RAS scheme has been applied at receivers of all users and eavesdropper. In \cite{MtokaMRTRAS}, outage performance of hybrid MRT/RAS scheme is investigated in single-hop multi-user NOMA system in the presence of RHIs together with CEEs and ipSIC. In \cite{FDing}, impact of RHIs on dual-hop multi-user NOMA network with AF relay has been investigated over Nakagami-$m$ fading channels in terms of OP and ergodic rate. In \cite{XLi}, the authors analyzed OP and ergodic capacity of single-hop and dual-hop NOMA AF relay networks over $\alpha-\mu$ fading channels in the presence of CEEs, ipSIC and RHIs. In \cite{XLi2}, effects of RHIs together with CEEs and ipSIC have been analyzed in a dual-hop NOMA AF relaying network, where multiple users are separated into multiple clusters and the BS communicates all clusters according to OMA while adopts NOMA scheme to serve users in a cluster, over Nakagami-$m$ fading channels. The authors have also considered energy harvesting at the relay, and obtained exact OP and ergodic capacity expressions for two users in a cluster. In \cite{CBLe}, a cooperative two-user NOMA network, where all nodes are equipped with single antenna and a DF hybrid HD/FD relay assists the communication between the BS and far user, has been investigated over Rayleigh fading channels in the presence of RHIs. In order to demonstrate the level of system performance, OP and ergodic capacity expressions have been obtained. In \cite{CDeng}, the authors have considered the same system of \cite{CBLe} without direct link between the relay and near user, and analyzed OP and ergodic rate over Rician fading channels. As mentioned above, there are many studies investigate effects of RHIs on single-hop and/or dual-hop NOMA networks with or without CEEs/ipSIC in the literature. However, the majority of them consider systems as consisting of HD relays and nodes equipped with single antenna except studies of \cite{XLi3,CBLe,CDeng}. In \cite{XLi3}, users and an eavesdropper are equipped with multiple antennas to adopt RAS scheme while FD relaying is considered in \cite{CBLe} and \cite{CDeng}. Therefore, investigations on the impact of RHIs on both MIMO-NOMA and FD relaying based cooperative NOMA, to the best of our knowledge, are still limited. Motivated by \cite{XLi3,CBLe,CDeng}, in this paper, we investigate a dual-hop multi-user AF FD relaying based MIMO-NOMA system, where MRT and MRC schemes are exploited at the BS and users, respectively, over i.i.d. Nakagami-$m$ fading channels in the presence of RHIs. The key contributions of the paper are summarized as follows: \begin{itemize} \item Unlike the existing studies on cooperative NOMA with RHIs, we consider using multiple antennas at the BS and users while the relay operates in FD mode. Furthermore, our analyses have been conducted for a generic channel model, Nakagami-$m$ fading, and LI link at the relay is also assumed to exposed to fading variations. \item In order to provide a realistic analysis, CEEs and ipSIC have been taken into account. To characterize the system performance, exact OP expression for any user has been derived. Moreover, a tight lower bound and simple asymptotic expressions have been obtained to provide further insights, such as diversity behavior of the system. The investigated network has been compared to HD-NOMA and FD-OMA counterparts. \item We have demonstrated that the quality of LI cancellation process is quite crucial for the investigated system to outperform HD-NOMA counterpart, even error floors may exist under the worst case of cancellation process. In terms of users with lower power allocations, MRT performs better than MRC without CEEs, while there is a trade-off between both schemes in the presence of CEEs. In addition, RHIs have much more effect on the performance of users with lower power allocations while do not change the diversity order of all users. Moreover, imperfections which have the most and least deterioration effects on the performance are RHIs and CEEs, respectively. \end{itemize} \subsection{Organization and Notations} The rest of the paper is given as follows. In Section II, we introduce the system model and channel statistics including practical imperfections in detail. In Section III, we derive the exact OP expression for any user together with lower bound and asymptotic approximations. Numerical results including comparisons are illustrated in Section IV. Finally, conclusions are interpreted in Section V. \textit{Notation:} Bold lowercase letter and $\|\cdot\|$ denote vectors and Euclidean norm while $(\cdot)^H$ indicates Hermitian transpose of a vector. $\mathbb{CN}(0,\sigma^2)$ is used to represent the complex Gaussian distribution with zero mean and variance of $\sigma^2$. While $Pr(\cdot)$ denote the probability of an event, $E\left[\cdot\right]$ represents the expectation operator. $f_X(\cdot)$ and $F_X(\cdot)$ indicate the probability density function (PDF) and cumulative distribution function (CDF) of a random variable $X$, respectively. \section{System Model} We consider a dual-hop power domain downlink NOMA network, where one BS ($S$) communicates with $L$ users ($U_l, l=1,2,\cdots,L$) with assistance of an FD AF relay ($R$). We assume that the direct link is not available due to huge obstacles and heavy environment conditions. The BS equipped with $N_S$ antennas transmits information by applying MRT beamforming technique while users with $N_D$ antennas combine received signals according to MRC scheme. Note that MRT and MRC schemes are the optimum ones among transmit and receive diversity techniques, respectively \cite{LoT,Simon}. On the other hand, the FD relay has two antennas, one for receiving and the other for broadcasting. $\mathbf{h}_{SR}=\left\lbrace h_{SR}^i \right\rbrace_{1\times N_S}$ ($1\leq i\leq N_S$), $\mathbf{h}_{l}=\{h_{l}^j\}_{N_D\times 1} $ ($1\leq j\leq N_D$) and $h_{LI}$ denote channel coefficients corresponding to $S-R$, $R-U_l$ and $R-R$ links. Since channels are assumed to be distributed as i.i.d. Nakagami-$m$, squared of channel gains follow Gamma distribution, thus powers of links can be obtained by $\Omega_{SR}=E\left[ |h^i_{SR}|^2\right] =d_{SR}^{-\alpha}$, $\Omega_{l}=E[ |h^j_{l}|^2] =d_{l}^{-\alpha}$ and $\Omega_{LI}=E[ |h_{LI}|^2] =\lambda P_R^{\mu-1}$, respectively. $d_{SR}$ and $d_{l}$ denote the normalized distances of $S-R$ and $R-U_l$ links, respectively, $\alpha$ is the path loss exponent. $\lambda$ ($\lambda>0$) and $\mu$ ($0\leq\mu\leq1$) represent the quality of LI cancellation process at $R-R$ link\footnote{It is worthwhile noting that the FD relay suffers from a LI effect between transmit and receive antennas due to its inherent simultaneous transmission at the same time/frequency. Although LI effects have been mitigated somehow, there still remain some residual LI effects. Without loss of generality, we consider the residual LI model determined according to active and/or passive interference cancellation as in \cite{Duarte} and \cite{Rodriguez}.}. Since effects of CEEs are also considered to be more practical, by following linear minimum mean square error estimation method, the BS and relay estimates channel coefficients in the training period, thus erroneously estimated channel coefficient vectors of $S-R$ and $R-U_l$ links can be represented by $\mathbf{h}_{SR}=\hat{\mathbf{h}}_{SR}+\boldsymbol{\varepsilon}_{e,SR}$ and $\mathbf{h}_{l}=\hat{\mathbf{h}}_{l}+\boldsymbol{\varepsilon}_{e,l}$, respectively\footnote{Note that the utilized channel estimation model is widely considered in the existing literature \cite{Mtoka,AldababsaMRTRAS,XLi}.}. $\boldsymbol{\varepsilon}_{e,SR}$ and $\boldsymbol{\varepsilon}_{e,l}$ are error vectors resulting from imperfect estimation process and can be modeled as $\boldsymbol{\varepsilon}_{e,SR}\sim\mathbb{CN}(0,\sigma_{e,SR}^2)$ and $\boldsymbol{\varepsilon}_{e,l}\sim\mathbb{CN}(0,\sigma_{e,l}^2)$ with variances of $\sigma_{e,SR}^2=\Omega_{SR}-\hat{\Omega}_{SR}$ and $\sigma_{e,l}^2=\Omega_{l}-\hat{\Omega}_{l}$, respectively \cite{Medard}. Since the investigated system is based on NOMA transmission, the BS transmits superimposed signals represented by $x(n)=\sum_{i=1}^{L}\sqrt{P_Sa_i}s_i(n)$ in the $n$th time interval, where $P_S$ and $a_i$ represent transmit power at the BS and power allocation coefficient intended to $i$th user ($\sum_{i=1}^{L}a_i=1$), respectively. Note that we represented signals according to time index due to the FD relay transmission. Then, the received signal at the relay under RHIs effect can be represented as \begin{equation}\label{eq:1} y_R(n)=\mathbf{h}_{SR}(\mathbf{w}(n)x(n)+\eta_{SR}(n))+h_{LI}s_R(n)+n_R(n), \end{equation} where $n_R(n)\sim\mathbb{CN}(0,\sigma_{R}^2)$ is Gaussian noise at $R$ and $\eta_{SR}(n)\sim\mathbb{CN}(0,\kappa_{SR}^2P_S)$ represents aggregate distortion noise resulting from RHIs at $S-R$ link. $\kappa_{SR}^2=(\kappa_{S}^t)^2+(\kappa_{R}^r)^2$ denotes aggregate power level of RHIs, where $\kappa_{S}^t$ and $\kappa_{R}^r$ are impairment levels \cite{Schenk,Bjornson}. Since FD relay applies LI cancellation methods, we assume that the impact of RHIs distortion noise at link $R-R$ is absorbed by the LI cancellation parameter as in \cite{Nguyen}. $\mathbf{w}(n)=\hat{\mathbf{h}}_{SR}^H/\|\hat{\mathbf{h}}_{SR}\|$ is MRT weight vector at the BS, subjected $\|\mathbf{w}(n)\|^2=1$. Also, $s_R(n)=Gy_R(n-\tau)$ denotes the signal to be transmitted from the relay, where $\tau$ is processing delay of the FD transmission and $G$ is the amplification factor which can be obtained as \begin{equation}\label{eq:2} G=\sqrt{\frac{P_R}{P_S(\|\hat{\mathbf{h}}_{SR}\|^2+\sigma_{e,SR}^2)(1+\kappa_{SR}^2)+P_R|h_{LI}|^2+\sigma_{R}^2}}. \end{equation} Afterwards, the received signal vector at the $l$th user can be written as $\mathbf{y}_{U_l}(n)=\mathbf{h}_{l}(s_R(n)+\eta_{RU}(n))+\mathbf{n}_l(n)$, where $\mathbf{n}_l(n)=\{n_l^j(n)\}_{N_D\times 1}$ is Gaussian noise vector (whose entries are subjected to $\mathbb{CN}(0,\sigma_l^2)$) at $l$th user. Also, $\eta_{RU}(n)\sim\mathbb{CN}(0,\kappa_{RU}^2P_R)$ denotes the aggregate distortion noise of RHIs at $R-U_l$ link, where $\kappa_{RU}^2=(\kappa_{R}^t)^2+(\kappa_{U}^r)^2$ is aggregate power level of RHIs. Without loss of generality, as in \cite{FDing}, we consider that users have the same effect of hardware impairments; such that $\kappa_{U_l}^r\stackrel{\triangle}{=}\kappa_{U}^r$. Then, if we substitute $s_R(n)$ into $\mathbf{y}_{U_l}(n)$, the received signal vector at $l$th user can be rewritten with the help of (\ref{eq:1}) as \begin{equation}\label{eq:3} \begin{split} \mathbf{y}_{U_l}(n)&=\mathbf{h}_{l}G\mathbf{h}_{SR}\bigg[\underbrace{\mathbf{w}(n-\tau)\sqrt{P_Sa_l}s_l(n-\tau)}_{\textit{desired signal}} +\underbrace{\mathbf{w}(n-\tau)\sum\nolimits_{p=1}^{l-1}\sqrt{P_Sa_p}s_p(n-\tau)}_{\textit{ipSIC term}} \\ & +\underbrace{\mathbf{w}(n-\tau)\sum\nolimits_{k=l+1}^{L}\sqrt{P_Sa_k}s_k(n-\tau)}_{\textit{IUI term}}+\underbrace{\eta_{SR}(n-\tau)}_{\textit{RHIs at S-R}}\bigg] \\ &+\mathbf{h}_{l}\bigg[ G\bigg( \underbrace{h_{LI}s_R(n-\tau)}_{\textit{LI term}}+n_R(n-\tau)\bigg) + \underbrace{\eta_{RU}(n)}_{\textit{RHIs at $R-U_l$}}\bigg]+ \mathbf{n}_l(n). \end{split} \end{equation} The received signals by $N_D$ antennas at the $l$th user are combined according to MRC technique as $y_{U_l}^{MRC}=\mathbf{w}_{\text{MRC}}(n)\mathbf{y}_{U_l}(n)$, where $\mathbf{w}_{\text{MRC}}(n)=\hat{\mathbf{h}}_{l}^H/\|\hat{\mathbf{h}}_{l}\|$ is MRC weight vector subject to $\|\mathbf{w}_{\text{MRC}}(n)\|^2=1$. \section{Performance Analyses} In this section, end-to-end ($e2e$) signal-to-interference-distortion plus noise ratio (SIDNR) expression is derived. Then, the exact OP for any user is obtained together with lower bound and asymptotic expressions to provide further insights into the system performance. \subsection{Derivation of $e2e$ SIDNR} According to NOMA transmission, weaker users (with poorer channel qualities) are allocated higher power levels at the BS for ensuring the fairness. Therefore, in the training period, the relay estimates effective channel gains of $R-U_l$ links by using pilot symbols sent from all users such that they are ordered as $\|\hat{\mathbf{h}}_{RU_1}\|^2\leq\|\hat{\mathbf{h}}_{RU_2}\|^2$ $\cdots\leq\|\hat{\mathbf{h}}_{RU_L}\|^2$ without loss of generality, and then transmits the ordering to the BS and users at the same time. Thus, the BS allocates power coefficients to users as $a_1>a_2>\cdots>a_L$ by using the ordering. Also, the BS estimates channel gains of $S-R$ link to apply MRT beamforming. Since SIC is carried out at users, any stronger user $l$ detects and removes signal of the weaker user $j$, where $j<l$. On the other hand, signal of the stronger user $k$ is considered as interference noise by user $l$, where $k>l$ and also named as inter-user interference (IUI). Consequently, by using (\ref{eq:2}) and (\ref{eq:3}), instantaneous SIDNR defined as the $l$th user erroneously decodes the signal of $j$th user ($j\leq l$) is given as \begin{equation}\label{eq:4} \gamma_{U_{j\rightarrow l}}=\dfrac{\psi_1\psi_2\bar{\gamma}^2a_j}{\psi_1\psi_2\bar{\gamma}^2(\xi_j+\tilde{\xi}_j+\vartheta_1)+\psi_1\bar{\gamma}\vartheta_2\vartheta_3+(\psi_2\bar{\gamma}+\vartheta_2)(\psi_3\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3} \end{equation} In (\ref{eq:4}), $\bar{\gamma}=P/\sigma^2$ represents average signal-to-noise ratio (SNR), where $P_S=P_R=P$ is assumed for mathematical simplicity, while $\xi_j=\sum_{k=j+1}^{L}a_k$ and $\tilde{\xi}_j=\sum_{p=1}^{j-1}a_p\sigma_{ipsic}^2$ are IUI and ipSIC terms, respectively. Without loss of generality, we assume that ipSIC is subject to Gaussian distribution with power $\sigma_{ipsic}^2$ ($0\leq\sigma_{ipsic}^2\leq1$) as in \cite{XLi,HasanA,Tweed}. Also, $\psi_1\stackrel{\triangle}{=}\|\hat{\mathbf{h}}_{SR}\|^2$, $\psi_2\stackrel{\triangle}{=}\|\hat{\mathbf{h}}_{l}\|^2$ and $\psi_3\stackrel{\triangle}{=}|h_{LI}|^2$ definitions are made to simplify analyses. In addition, constant variables $\vartheta$ are given below: \begin{equation}\label{eq:5} \begin{split} \vartheta_1&\stackrel{\triangle}{=}\kappa_{SR}^2+\kappa_{RU}^2(1+\kappa_{SR}^2)~,~~\vartheta_2\stackrel{\triangle}{=}\bar{\gamma}\sigma_{e,l}^2+\frac{1}{1+\kappa_{RU}^2} \\ \vartheta_3&\stackrel{\triangle}{=}(1+\kappa_{RU}^2)(1+\kappa_{SR}^2)~~,~~\vartheta_4\stackrel{\triangle}{=}\frac{1}{1+\kappa_{SR}^2} \\ \vartheta_5&\stackrel{\triangle}{=}\bar{\gamma}\sigma_{e,SR}^2+\frac{1}{1+\kappa_{SR}^2}. \end{split} \end{equation} \subsection{Outage Probability Analysis} The outage event for the $l$th user can be defined as the $l$th user can not decode its own signal or the $j$th user's signal ($1\leq j\leq l$). Thus, let us define $E_{l,j}=\{\gamma_{U_{j\rightarrow l}}>\gamma_{th,j}\}$ as the event that the $l$th user can decode $j$th user's signal, where $\gamma_{th,j}=2^{R_0}-1$ ($R_0$: bits per channel in use (BPCU)) is the target threshold SIDNR for FD transmission. With the help of (\ref{eq:4}), the event of $E_{l,j}$ can be expressed as \begin{equation}\label{eq:6} \begin{split} E_{l,j}&=\left\lbrace \left(\psi_2-\vartheta_2\vartheta_3\delta_j \right)\psi_1>\frac{(\psi_2\bar{\gamma}+\vartheta_2)(\psi_3\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3\delta_j}{\bar{\gamma}}\right\rbrace \\ &=\left\lbrace \psi_1>\frac{(\psi_2\bar{\gamma}+\vartheta_2)(\psi_3\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3\delta_j}{\bar{\gamma}(\psi_2-\vartheta_2\vartheta_3\delta_j)},\psi_2>\vartheta_2\vartheta_3\delta_j\right\rbrace, \end{split} \end{equation} where the second equality is obtained subjected to the condition of $a_j-\gamma_{th,j}(\xi_j+\tilde{\xi}_j+\vartheta_1)>0$ and also $\delta_j\stackrel{\triangle}{=}\frac{\gamma_{th,j}}{\bar{\gamma}(a_j-\gamma_{th,j}(\xi_j+\tilde{\xi}_j+\vartheta_1))}$ notation is made for mathematical tractability. Consequently, by using (\ref{eq:6}), the OP for the $l$th user can be written as \begin{equation}\label{eq:7} \begin{split} &P_{out}^l=1-Pr\left(E_{l,1} \cap E_{l,2} \cap \cdots \cap E_{l,l}\right) \\ &=1-Pr\left(\psi_1>\frac{(\psi_2\bar{\gamma}+\vartheta_2)(\psi_3\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3\delta^{\dag}_l}{\bar{\gamma}(\psi_2-\vartheta_2\vartheta_3\delta^{\dag}_l)},\psi_2>\vartheta_2\vartheta_3\delta^{\dag}_l \right), \end{split} \end{equation} where $\delta^{\dag}_l=\underset{1\leq j\leq l}{\max}\left\lbrace \delta_j \right\rbrace$. Note that, (\ref{eq:7}) holds for the condition of $a_j>\gamma_{th,j}(\xi_j+\tilde{\xi}_j+\vartheta_1)$, otherwise the OP results to $1$. Then, (\ref{eq:7}) can be analytically expressed as \begin{equation}\label{eq:8} \begin{split} &P_{out}^l=F_{\psi_2}^{(l)}(\vartheta_2\vartheta_3\delta^{\dag}_l)+ \\ &\int\limits_{y=\vartheta_2\vartheta_3\delta^{\dag}_l}^{\infty}\int\limits_{z=0}^{\infty}F_{\psi_1}\left( \frac{(y\bar{\gamma}+\vartheta_2)(z\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3\delta^{\dag}_l}{\bar{\gamma}(y-\vartheta_2\vartheta_3\delta^{\dag}_l)}\right)f_{\psi_3}(z)f_{\psi_2}^{(l)}(y)dzdy, \end{split} \end{equation} where $F_{X}^{(l)}$ and $f_{X}^{(l)}$ denote the CDF and PDF of user with the $l$th order statistic. Since channels are considered as i.i.d. Nakagami-$m$ fading, it is well-known that the squared gain of any link will be distributed as Gamma. Thus, corresponding CDFs and PDF of random variables $\psi_1$, $\psi_2$ and $\psi_3$ can be represented as $F_{\psi_1}(x)=1-e^{-xm_{SR}/\hat{\Omega}_{SR}}\sum_{n=0}^{m_{SR}N_S-1}\frac{(xm_{SR}/\hat{\Omega}_{SR})^n}{n!}$, $F_{\psi_2}(x)=1-e^{-xm_{l}/\hat{\Omega}_{l}}\sum_{n_1=0}^{m_{l}N_D-1}\frac{(xm_{l}/\hat{\Omega}_{l})^{n_1}}{n_1!}$ and $f_{\psi_3}(x)=\left(m_{LI}/\Omega_{LI} \right)^{m_{LI}}\frac{x^{m_{LI}-1}}{\Gamma(m_{LI})}e^{-xm_{LI}/\Omega_{LI}}$. Here, $m_{SR}$, $m_{l}$ and $m_{LI}$ denote Nakagami-$m$ channel parameters related to $S-R$, $R-U_l$ and $R-R$ links. If $F_{\psi_1}(x)$ is substituted into (\ref{eq:8}) and then the integrals are rearranged, we obtain \begin{equation}\label{eq:9} \begin{split} P_{out}^l&=1-\sum_{n=0}^{m_{SR}N_S-1}\frac{1}{n!}\int_{x=0}^{\infty}e^{-b}f_{\psi_2}^{(l)}(x+\vartheta_2\vartheta_3\delta^{\dag}_l)dx \\ &\times\underbrace{\int_{z=0}^{\infty}e^{-za}(za+b)^nf_{\psi_3}(z)dz}_{I_1}, \end{split} \end{equation} where $a=\frac{(\bar{\gamma}(x+\vartheta_2\vartheta_3\delta^{\dag}_l)+\vartheta_2)\vartheta_3\vartheta_4\delta^{\dag}_lm_{SR}}{x\hat{\Omega}_{SR}}$ and $b=\frac{a\vartheta_5}{\bar{\gamma}\vartheta_4}$. By using binomial expansion \cite[eq.(1.111)]{Gradshteyn}, integral property given by \cite[eq.(3.381.4)]{Gradshteyn} and $f_{\psi_3}(z)$, $I_1$ is obtained as \begin{equation}\label{eq:10} \begin{split} I_1=\sum_{m=0}^{n}\binom{n}{m}\left( \frac{m_{LI}}{\Omega_{LI}}\right) ^{m_{LI}}\frac{\Gamma(m+m_{LI})}{\Gamma(m_{LI})}\frac{b^{n-m}}{a^{-m}}\left(a+\frac{m_{LI}}{\Omega_{LI}} \right)^{-m-m_{LI}}, \end{split} \end{equation} where $\binom{\cdot}{\cdot}$ represents binomial coefficient, and thus (\ref{eq:9}) can be rewritten as \begin{equation}\label{eq:11} \begin{split} P_{out}^l&=1-\sum_{n=0}^{m_{SR}N_S-1}\sum_{m=0}^{n}\binom{n}{m}\frac{(m_{LI}/\Omega_{LI})^{m_{LI}}\Gamma(m+m_{LI})}{\Gamma(m_{LI})\Gamma(n+1)} \\ &\int_{x=0}^{\infty}e^{-b}\frac{b^{n-m}}{a^{-m}}\left(a+\frac{m_{LI}}{\Omega_{LI}} \right)^{-m-m_{LI}}f_{\psi_2}^{(l)}(x+\vartheta_2\vartheta_3\delta^{\dag}_l)dx. \end{split} \end{equation} In order to proceed, $f_{\psi_2}^{(l)}(x)$ should be determined. By using order statistic properties \cite{DavidHA}, PDF of user with the $l$th order can be expressed as $f_{\psi_2}^{(l)}(x)=Q_l\sum\nolimits_{s=0}^{L-l}\binom{L-l}{s}(-1)^{s}f_{\psi_2}(x)\big(F_{\psi_2}(x) \big)^{l+s-l}$, where $Q_l=L!/((L-l)!(l-1)!)$ \cite{DingZ,JJmen}. If previously defined CDF of $F_{\psi_2}(x)$ and its derivative yielding PDF are substituted into $f_{\psi_2}^{(l)}(x)$, we get \begin{equation}\label{eq:12} \begin{split} f_{\psi_2}^{(l)}(x)&=Q_l\sum_{s=0}^{L-l}\sum_{s_1=0}^{l+s-1}\sum_{n_1=0}^{s_1(m_lN_D-1)}\binom{L-l}{s}\binom{l+s-1}{s_1}(-1)^{s+s_1} \\ &\frac{(m_l/\hat{\Omega}_l)^{m_lN_D}}{\Gamma(m_lN_D)}\theta_{n_1}(s_1,m_lN_D)x^{n_1+m_lN_D-1}e^{-\frac{xm_l(s_1+1)}{\hat{\Omega}_l}}. \end{split} \end{equation} In order to obtain the closed-form of $f_{\psi_2}^{(l)}(x)$ in (\ref{eq:12}), binomial expansion \cite[eq.(1.111)]{Gradshteyn} and power series method given by \cite[eq.(0.314)]{Gradshteyn} are applied to $\big(F_{\psi_2}(x) \big)^{l+s-l}$. Here, $\theta_{n_1}(s_1,m_lN_D)$ represents multinomial coefficient consisting of a recursive summation \cite{Mtoka}. Finally, by substituting (\ref{eq:12}) into (\ref{eq:11}) and applying algebraic manipulations, the OP corresponding to the $l$th user can be obtained as \begin{equation}\label{eq:13} \begin{split} P_{out}^l&= 1-Q_l\sum_{n=0}^{m_{SR}N_S-1}\sum_{m=0}^{n}\sum_{s=0}^{L-l}\sum_{s_1=0}^{l+s-1}\sum_{n_1=0}^{s_1(m_lN_D-1)}\sum_{n_2=0}^{n_1+m_lN_D-1}\sum_{n_3=0}^{n}\binom{n}{m}\binom{L-l}{s}\binom{l+s-1}{s_1}\binom{n_1+m_lN_D-1}{n_2} \\ &\binom{n}{n_3}(-1)^{s+s_1}\frac{\Gamma(m+m_{LI})(m_{LI}/\Omega_{LI})^{m_{LI}}(m_l/\hat{\Omega}_l)^{m_lN_D}}{\Gamma(n+1)\Gamma(m_{LI})\Gamma(m_{l}N_D)}\theta_{n_1}(s_1,m_lN_D)(\vartheta_2\vartheta_3\delta^{\dag}_l)^{n_1+m_lN_D-n_2-1} \\ &e^{-\frac{(\vartheta_2\vartheta_3\delta^{\dag}_l)m_l(s_1+1)}{\hat{\Omega}_l}-\frac{\vartheta_3\vartheta_5\delta^{\dag}_lm_{SR}}{\hat{\Omega}_{SR}}}\left(\frac{\bar{\gamma}\vartheta_4}{\vartheta_5} \right)^m\left(\frac{\vartheta_3\vartheta_5\delta^{\dag}_lm_{SR}}{\hat{\Omega}_{SR}} \right)^n\left(\vartheta_2\vartheta_3\delta^{\dag}_l+\frac{\vartheta_2}{\bar{\gamma}} \right)^{n-n_3}\left( \Omega_{LI}\hat{\Omega}_{SR}\right) ^{m+m_{LI}} \\ &\left(\bar{\gamma}\vartheta_3\vartheta_4\delta^{\dag}_lm_{SR}\Omega_{LI}+m_{LI}\hat{\Omega}_{SR} \right)^{-m-m_{LI}}\Theta_l(x). \end{split} \end{equation} In (\ref{eq:13}), $\Theta_l(x)$ can be expressed by \setcounter{equation}{13} \begin{equation}\label{eq:14} \begin{split} \Theta_l(x)&=\int\limits_{x=0}^{\infty}x^{n_2+n_3+m+m_{LI}-n}e^{-\frac{xm_{l}\left( s_1+1\right) }{\hat{\Omega}_l}-\frac{\left( \vartheta_2\vartheta_3\delta^{\dag}_l+\vartheta_2/\bar{\gamma}\right) \vartheta_3\vartheta_5\delta^{\dag}_lm_{SR}}{x\hat{\Omega}_{SR}}} \\ &\left(x+\frac{\vartheta_4(\bar{\gamma}\vartheta_2\vartheta_3\delta^{\dag}_l+\vartheta_2)\vartheta_3\delta^{\dag}_lm_{SR}\Omega_{LI}}{\bar{\gamma}\vartheta_3\vartheta_4\delta^{\dag}_lm_{SR}\Omega_{LI}+m_{LI}\hat{\Omega}_{SR}} \right)^{-m-m_{LI}}dx. \end{split} \end{equation} Unfortunately, the closed-form of the integral in (\ref{eq:14}) does not exist. \subsection{Lower Bound Analysis} In order to find a tight approximation for the exact OP given by (\ref{eq:13}), SIDNR given in (\ref{eq:4}) can be upper-bounded, thus a tight lower-bound for the exact OP can be obtained. Firstly, (\ref{eq:7}) can be rewritten approximately as \begin{equation}\label{eq:15} P_{out}^l\approx1-Pr\left(\frac{W\frac{1}{\vartheta_4}\bar{\gamma}\psi_2\frac{1}{\vartheta_2}}{W\frac{1}{\vartheta_4}+\bar{\gamma}\psi_2\frac{1}{\vartheta_2}}>\bar{\gamma}\vartheta_3\delta^{\dag}_l \right), \end{equation} where $W=\bar{\gamma}\psi_1/(\bar{\gamma}\psi_3+\vartheta_5/\vartheta_4)$ for mathematical simplicity. Then, by using the harmonic mean property of two random variables defined as $xy/(x+y)\leq\min(x,y)$, lower-bound for the exact OP can be analytically expressed as \begin{equation}\label{eq:16} \begin{split} P_{out}^{l,low}&=1- Pr\left(\min\left(W\frac{1}{\vartheta_4},\bar{\gamma}\psi_2\frac{1}{\vartheta_2} \right) >\bar{\gamma}\vartheta_3\delta_l^{\dag}\right) \\ &=1-\overline{F}_{W}\left(\bar{\gamma}\vartheta_3\vartheta_4\delta_l^{\dag} \right)\overline{F}_{\psi_2}^{(l)}\left(\vartheta_2\vartheta_3\delta_l^{\dag} \right). \end{split} \end{equation} In (\ref{eq:16}), the CDF of $F_W(x)$ can be mathematically expressed as \begin{equation}\label{eq:17} \begin{split} F_W(x)&=Pr\bigg(\frac{\bar{\gamma}\psi_1}{\bar{\gamma}\psi_3+(\vartheta_5/\vartheta_4)}\leq\underbrace{\bar{\gamma}\vartheta_3\vartheta_4\delta_l^{\dag}}_{x} \bigg) \\ &=Pr\left(\psi_1\leq x\left(\psi_3+\frac{\vartheta_5}{\bar{\gamma}\vartheta_4} \right) \right) \\ &=1-\int\limits_{y=0}^{\infty}\int\limits_{x=x\left(y+\frac{\vartheta_5}{\bar{\gamma}\vartheta_4} \right) }^{\infty}f_{\psi_1}(x)f_{\psi_3}(y)dxdy. \end{split} \end{equation} Then, by substituting previously defined PDF of $f_{\psi_3}(x)$ and derivative of the CDF $F_{\psi_1}(x)$ into (\ref{eq:17}), we can obtain \begin{equation}\label{eq:18} \begin{split} &F_W(x)=1-\sum_{n=0}^{m_{SR}N_S-1}\frac{1}{n!}\left(\frac{m_{LI}}{\Omega_{LI}} \right)^{m_{LI}}\frac{1}{\Gamma(m_{LI})} \\ &\int\limits_{y=0}^{\infty}y^{m_{LI}-1}\left(x\left( y+\frac{\vartheta_5}{\bar{\gamma}\vartheta_4}\right) \frac{m_{SR}}{\hat{\Omega}_{SR}} \right)^{n}e^{-x\left( y+\frac{\vartheta_5}{\bar{\gamma}\vartheta_4}\right) \frac{m_{SR}}{\hat{\Omega}_{SR}}-y\frac{m_{LI}}{\Omega_{LI}}}dy. \end{split} \end{equation} Finally, with the help of integral property given by \cite[eq.(3.381.4)]{Gradshteyn}, the CDF of $F_W(x)$ can be derived as \begin{equation}\label{eq:19} \begin{split} &F_W(x)=1-\sum_{n=0}^{m_{SR}N_S-1}\sum_{n_2=0}^{n}\binom{n}{n_2}\frac{(m_{LI}/\Omega_{LI})^{m_{LI}}(m_{SR}/\hat{\Omega}_{SR})^n}{\Gamma(n+1)\Gamma(m_{LI})} \\ &\Gamma(n_2+m_{LI})\left(\frac{\vartheta_5}{\bar{\gamma}\vartheta_4} \right)^{n-n_2}x^n\left(\frac{xm_{SR}}{\hat{\Omega}_{SR}}+\frac{m_{LI}}{\Omega_{LI}} \right)^{-n_2-m_{LI}}e^{-\frac{x\vartheta_5m_{SR}}{\bar{\gamma}\vartheta_4\hat{\Omega}_{SR}}}. \end{split} \end{equation} On the other hand, if the PDF of $f_{\psi_2}^{(l)}(x)$ given in (\ref{eq:12}) is integrated with respect to $x$, the CDF of $F_{\psi_2}^{(l)}(x)$ is obtained as \begin{equation}\label{eq:20} \begin{split} F_{\psi_2}^{(l)}(x)&=1-Q_l\sum_{s=0}^{L-l}\sum_{s_1=1}^{l+s}\sum_{n_1=0}^{s_1(m_lN_D-1)}\binom{L-l}{s}\binom{l+s}{s_1} \\ &\frac{(-1)^{s+s_1-1}}{l+s}\theta_{n_1}(s_1,m_lN_D)x^{n_1}e^{-\frac{xm_ls_1}{\hat{\Omega}_l}}. \end{split} \end{equation} Afterwards, complementary versions of CDFs given in (\ref{eq:19}) and (\ref{eq:20}) are substituted into (\ref{eq:16}), a tight lower-bound of the exact OP corresponding to $l$th user can be obtained in closed-form. \subsection{Asymptotic Analyses} In order to reveal further insights for the system performance, asymptotic behavior of OP is considered by applying high SNR approximation in this subsection. Therefore, we have carried out the analyses according to two cases which are presented in the following subsections. \subsubsection{Under Ideal Conditions} \paragraph*{$\bullet$ When the quality of LI cancellation is $\mu\neq 1$} In the presence of ideal conditions (which also means that there are no CEEs in the first and second hops), system exploits benefits of diversity order and array gain at high SNR values (when $\bar{\gamma}\rightarrow\infty$). Thus, (\ref{eq:15}) can be approximated as \begin{equation}\label{eq:21} \begin{split} P_{out}^{l,\infty}&\approx1-Pr\left(\frac{W\vartheta_1^{'}\bar{\gamma}\psi_2\vartheta_2^{'}}{W\vartheta_1^{'}+\bar{\gamma}\psi_2\vartheta_2^{'}}>\bar{\gamma}\vartheta_1^{'}\vartheta_2^{'}\delta^{\dag}_l \right) \\ &=1- Pr\left(\min\left(W\vartheta_1^{'},\bar{\gamma}\psi_2\vartheta_2^{'} \right) >\bar{\gamma}\vartheta_1^{'}\vartheta_2^{'}\delta^{\dag}_l\right) \\ &=F_{W}^{\infty}\left( \bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l\right) +F_{\psi_2}^{(l),\infty}\left(\vartheta_1^{'}\delta^{\dag}_l\right), \end{split} \end{equation} where $W\simeq \psi_1/\psi_3$, $\vartheta_1^{'}=1+\kappa_{SR}^2$ and $\vartheta_2^{'}=1+\kappa_{RU}^2$ are defined. By using high SNR approximation approach \cite{ZWang}, we can express asymptotic OP in (\ref{eq:21}) as in the form $P_{out}^{l,\infty}\approx\left(AG\bar{\gamma} \right)^{-DO}+\textit{O}\left( \bar{\gamma}^{-DO}\right)$, where $AG$ is the array gain, $DO$ is the diversity order and $\textit{O}(\cdot)$ represents high order terms to be neglected. Firstly, the asymptotic CDF of $W$ can be derived by $F_{W}^{\infty}(x)=Pr(\psi_1/\psi_3\leq x)=\int_{y=0}^{\infty}F_{\psi_1}^{\infty}(yx)f_{\psi_3}(y)dy$. Here, the CDF of $\psi_1$ is expressed as $F_{\psi_1}(x)=\frac{\gamma(m_{SR}N_S,xm_{SR}/\Omega_{SR})}{\Gamma(m_{SR}N_S)}$ in terms of lower incomplete Gamma function \cite[eq.(8.350.1)]{Gradshteyn}, then it can be asymptotically obtained as $F_{\psi_1}^{\infty}(x)\approx\frac{(xm_{SR}/\Omega_{SR})^{m_{SR}N_S}}{\Gamma(m_{SR}N_S+1)}$ by using the property of $\gamma(x,y\rightarrow 0)\approx y^x/x$ \cite[eq.(45:9:1)]{Oldham}. If $F_{\psi_1}^{\infty}(x)$ and previously defined $f_{\psi_3}(y)$ are substituted into $F_{W}^{\infty}(x)$ by replacing $x$ with $\bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l$, we obtain $F_{W}^{\infty}(\bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l)=(\chi_1\bar{\gamma})^{-(1-\mu)m_{SR}N_S}$, where $\chi_1$ can be obtained as \begin{equation}\label{eq:22} \chi_1=\left(\frac{\Gamma(m_{SR}N_S+m_{LI})}{\Gamma(m_{SR}N_S+1)\Gamma(m_{LI})}\left(\frac{\vartheta_2^{'}\varLambda_l^{\dag}m_{SR}}{\Omega_{SR}m_{LI}} \right)^{m_{SR}N_S} \right)^{-\frac{1}{(1-\mu)m_{SR}N_S}}. \end{equation} In (\ref{eq:22}), $\varLambda_l^{\dag}=\bar{\gamma}\delta^{\dag}_l$ and independent from $\bar{\gamma}$. Therefore, the exponentially dominant constant on the average SNR ($\bar{\gamma}$) within the expression of $F_{W}^{\infty}(\bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l)$ equals to $(1-\mu)m_{SR}N_S$ for the first hop. Asymptotic expression of $F_{\psi_2}^{(l),\infty}(x)$ can be derived by taking into account of lower order terms related to variable of $x$ in (\ref{eq:20}) as $F_{\psi_2}^{(l),\infty}(x)\approx\binom{L}{l}\left(\frac{(xm_l/\Omega_l)^{m_lN_D}}{\Gamma(m_lN_D+1)} \right)^l$. Afterwards, by replacing $x$ with $\vartheta_1^{'}\delta^{\dag}_l$ and after mathematical manipulations, we obtain $F_{\psi_2}^{(l),\infty}(\vartheta_1^{'}\delta^{\dag}_l)=(\chi_2\bar{\gamma})^{-m_lN_Dl}$, where $\chi_2$ can be found as \begin{equation}\label{eq:23} \chi_2=\left(\binom{L}{l}\frac{1}{(\Gamma(m_lN_D+1))^l} \right)^{-\frac{1}{m_lN_Dl}}\frac{\Omega_l}{\vartheta_1^{'}\varLambda_l^{\dag}m_l}. \end{equation} From (\ref{eq:23}), the exponentially dominant constant on the average SNR ($\bar{\gamma}$) within the expression of $F_{\psi_2}^{(l),\infty}(\vartheta_1^{'}\delta^{\dag}_l)$ equals to $m_lN_Dl$ for the second hop. Consequently, if $F_{W}^{\infty}\left( \bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l\right)$ and $F_{\psi_2}^{(l),\infty}\left(\vartheta_1^{'}\delta^{\dag}_l\right)$ are substituted into (\ref{eq:21}), and with the help of asymptotic form $P_{out}^{l,\infty}\approx\left(AG\bar{\gamma} \right)^{-DO}+\textit{O}\left( \bar{\gamma}^{-DO}\right)$, the asymptotic OP of the $l$th user can be obtained in simple form with diversity order metric $DO=\min\left\lbrace \left(1-\mu\right)m_{SR}N_S,m_{l}N_Dl\right\rbrace$. On the other hand, array gain can be found by using (\ref{eq:22}) and (\ref{eq:23}) as \begin{equation}\label{eq:24} AG=\left\{ \begin{array}{ll} \chi_1 & (1-\mu)m_{SR}N_S<m_{l}N_Dl \\ \chi_2 & (1-\mu)m_{SR}N_S>m_{l}N_Dl \\ \chi_1+\chi_2 & (1-\mu)m_{SR}N_S=m_{l}N_Dl \\ \end{array} \right.. \end{equation} \paragraph*{$\bullet$ When the quality of LI cancellation is $\mu=1$} In this case, $S-R$ link will be extremely dominant in $e2e$ SIDNR due to the high LI effect. Therefore, asymptotic OP for the $l$th user can be expressed as $P_{out}^{l,\infty}\approx F_W(\vartheta_2^{'}\varLambda_l^{\dag})$, where $W\approx\psi_1/\psi_3$, by neglecting the effect of $R-U_l$ link for high SNR values. Since $F_W(\vartheta_2^{'}\varLambda_l^{\dag})$ is independent from average SNR which also yields error floor level at high SNR values (also means zero diversity), we can not carry out high SNR approximation provided in \cite{ZWang}. Therefore, $F_W(x)$ can be obtained as \begin{equation}\label{eq:25} \begin{split} F_W(x)&=Pr\bigg(\frac{\psi_1}{\psi_3}\leq\underbrace{\vartheta_2^{'}\varLambda_l^{\dag}}_{x} \bigg) \\ &=1-\int_{y=0}^{\infty}\int_{x=xy}^{\infty}f_{\psi_1}(x)f_{\psi_2}(y)dxdy. \end{split} \end{equation} Then, by substituting the CDF of $\psi_1$ to get rid of the inner integral and PDF of $\psi_3$ into (\ref{eq:25}), and with the help of integral property provided by \cite[eq.(3.381.4)]{Gradshteyn}, the asymptotic OP of the $l$th user can be derived as \begin{equation}\label{eq:26} \begin{split} P_{out}^{l,\infty}&=1-\sum_{n=0}^{m_{SR}N_S-1}\frac{(m_{LI}/\Omega_{LI})^{m_{LI}}(m_{SR}/\Omega_{SR})^n}{\Gamma(n+1)\Gamma(m_{LI})} \\ &\Gamma(n+m_{LI})(\vartheta_2^{'}\varLambda_l^{\dag})^n\left(\frac{\vartheta_2^{'}\varLambda_l^{\dag}m_{SR}}{\Omega_{SR}}+\frac{m_{LI}}{\Omega_{LI}} \right)^{-n-m_{LI}} \end{split} \end{equation} \subsubsection{Under Practical Conditions} Since CEE parameters $\sigma_{e,l}^2$ and $\sigma_{e,SR}^2$ are dominant on the $e2e$ SIDNR, we can not apply asymptotic property $\gamma(x,y\rightarrow 0)\approx y^x/x$ given in \cite[eq.(45:9:1)]{Oldham}. Thus, by considering the dominance of CEE effects, in case of all quality of LI cancellation values ($\mu$), the predefined constants of $\vartheta_2$ and $\vartheta_5$ given by (\ref{eq:5}) can be approximated as $\vartheta_2\approx\bar{\gamma}\sigma_{e,l}^2$ and $\vartheta_5\approx\bar{\gamma}\sigma_{e,SR}^2$, respectively. By substituting $\vartheta_2$ and $\vartheta_5$ together with other constants given by (\ref{eq:5}) into (\ref{eq:13}), asymptotic OP of $l$th user in the presence of CEEs can be obtained. \section{Numerical Results} In this section, theoretical results for the investigated system verified by Monte Carlo simulations are presented. An exemplary, the scenario with three mobile users ($L=3$) is considered. Unless otherwise stated, markers illustrate simulation results, $SNR=\bar{\gamma}=P/\sigma^2$, $\alpha=3$ (for urban area cellular radio), $\lambda=1$ as in \cite{Duarte,Rodriguez}. While power coefficients to be allocated to users are set as $a_1=1/2$, $a_2=1/3$ and $a_3=1/6$, target SIDNR thresholds related to mobile users for FD transmission are determined as $\gamma_{th,1}=0.9$, $\gamma_{th,2}=1.5$ and $\gamma_{th,3}=2$, respectively. Also, normalized distances of $S-R$ link and $R-U_l$ links are fixed as $d_{SR}=0.5$ and $d_{1}=d_{2}=d_{3}=0.5$, respectively. For simplicity, Nakagami-$m$ channel parameters of $R-U_l$ links are assumed as $m_{1}=m_{2}=m_{3}=m_{RU}$. For easy of reading, lower bound (LB), asymptotic (Asymp) and theoretical (Theo) abbreviations are made. \begin{figure}[!b] \centering \includegraphics[width=0.70\columnwidth]{Fig_1.pdf} \caption{OP of the investigated system in case of $\mu=1$ and ideal conditions.} \label{fig:1} \vspace{-2 mm} \end{figure} Fig. 1 depicts OP curves of the investigated system in case of $\mu=1$ (which means the worst scenario of LI cancellation process), $m_{SR}=m_{LI}=m_{RU}=1$, $\sigma_{ipsic}^2=0$, $\kappa_{SR}=\kappa_{RU}=0$ under ideal channel conditions ($\sigma_{e,SR}^2=0$ and $\sigma_{e,l}^2=0$) for different antenna configurations. We observe from the figure that OP performance of the investigated system is strictly limited by error floor level, which is also known as zero-diversity and validated by asymptotic results, at high SNR values for all users. Also, OPs of all users are exposed to the same level regardless of the number of antennas. On the other hand, given the increased number of antennas (when the configurations $N_S=3$; $N_D=2$ and $N_S=2$; $N_D=1$ are compared), performance of the system can be improved in the low SNR region and with the decrease of error floor level in the high SNR region. In addition, we also observed that the exact results are supported by LB curves which are quite tight and match well in the high SNR region. Fig. 2 illustrates OP performance of the system for different antenna configurations for $\mu=0.2$, $m_{SR}=m_{LI}=m_{RU}=1$, $\sigma_{e,SR}^2=\sigma_{e,l}^2=0$, $\sigma_{ipsic}^2=0$ and $\kappa_{SR}=\kappa_{RU}=0$. As clearly observed from the figure, there is no error floor level when $\mu\neq 1$, and thus all users enjoy benefits of diversity order in the high SNR region. This result is also verified by the asymptotic curves which are obtained by theoretical analyses. Particularly, according to results of the first user, diversity orders are $(1-\mu)m_{SR}N_S$ for $N_S=1$; $N_D=1$ and $N_S=2$; $N_D=2$ configurations, and $m_{RU}N_Dl$ for $N_S=3$; $N_D=2$ configuration, respectively. Also, if $N_S=3$; $N_D=2$ and $N_S=2$; $N_D=2$ configurations are compared for an OP value of $10^{-5}$, $11$ dB more SNR gain can be achieved for the second and third users while $7$ dB for the first user, which implies that MRT beamforming is much more effective on the performance of the second and third users than first user. \begin{figure}[!b] \centering \includegraphics[width=0.70\columnwidth]{Fig_2.pdf} \caption{OP of the investigated system in case of $\mu=0.2$ and different number of transmit/receive antenna configurations under ideal conditions.} \label{fig:2} \vspace{-2 mm} \end{figure} In Fig. 3, OP performance of the system is presented for different RHIs parameters and antenna configurations. All curves are obtained for $\mu=0.2$, $\sigma_{e,SR}^2=\sigma_{e,l}^2=0$, $\sigma_{ipsic}^2=0$ and $m_{SR}=m_{LI}=m_{RU}=1$. From the figure, we observed that RHIs highly deteriorate the performance of users if $\kappa_{SR}=\kappa_{RU}=0$ and $\kappa_{SR}=\kappa_{RU}=0.16$ configurations are compared. Particularly, according to $N_S=3$; $N_D=2$ results, performance gap between $\kappa_{SR}=\kappa_{RU}=0$ and $\kappa_{SR}=\kappa_{RU}=0.16$ in terms of the second and third users is approximately $15$dB for an OP value of $10^{-5}$ while $12.5$ dB in terms of the first user. Similar results are obtained for $N_S=1$; $N_D=1$ configuration. This result reveals that the impact of RHIs is more effective on the performance of the second and third users relative to the first user. On the other hand a significant performance gain can be achieved as the number of antennas is increased, even under the effect of RHIs. Moreover, diversity order of the system is not effected by RHIs and asymptotic analysis also validates this observation. \begin{figure}[!b] \centering \includegraphics[width=0.70\columnwidth]{Fig_3.pdf} \caption{OP of the investigated system in case of $\mu=0.2$ and different number of transmit/receive antenna configurations and RHIs.} \label{fig:3} \vspace{-2 mm} \end{figure} Figs. 4 and 5 depict OP curves of three users in the presence of practical channel conditions ($\sigma_{e,SR}^2=\sigma_{e,l}^2=0.03$) for $\mu=0.2$, $\sigma_{ipsic}^2=0$ and $\kappa_{SR}=\kappa_{RU}=0$. In both figures, antenna configurations are set as $N_1$:$(N_S=1;N_D=2)$, $N_2$:$(N_S=2;N_D=1)$ and $N_3$:$(N_S=2;N_D=2)$ while channel parameters are $m_1$:$(m_{SR}=1;m_{LI}=1;m_{RU}=2)$ and $m_2$:$(m_{SR}=2;m_{LI}=1;m_{RU}=1)$. In both figures, we observe error floor levels in the high SNR region caused by the effects of CEEs, even $\mu\neq 1$. From Fig. 4, if we compare $N_1$ (also means MRC) and $N_2$ (also means MRT) configurations, MRT is better than MRC when the channel condition in the second hop is better ($m_1$ conf.), while MRC is better than MRT when the channel condition in the first hop is better ($m_2$ conf.). Consequently, performance behavior of the first user according to MRT and MRC schemes also depend on the channel conditions. Also, similar observations are obtained for the second and third users from Fig. 5. Furthermore, as clearly seen in both figures, although MRT and MRC schemes improve the performance of the system, hybrid scheme of MRT/MRC significantly increases OP performance of all users. Note also that hybrid scheme performs better in the low SNR region, significantly better in the high SNR region for $m_1$ configuration. \begin{figure}[!t] \centering \includegraphics[width=0.70\columnwidth]{Fig_4_U1.pdf} \caption{OP of the first user $U_1$ in case of $\mu=0.2$, different fading and number of antenna configurations in the presence of CEEs and ipSIC.} \label{fig:4} \vspace{-2 mm} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.70\columnwidth]{Fig_5_U2U3.pdf} \caption{OP of the second $U_2$ and third $U_3$ users in case of $\mu=0.2$, different fading and number of antenna configurations in the presence of CEEs and ipSIC.} \label{fig:5} \vspace{-2 mm} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.68\columnwidth]{Fig_6.pdf} \caption{OP of users in case of $\mu=0.2$ and different parameters of RHIs and ipSIC.} \label{fig:6} \vspace{-3 mm} \end{figure} In Fig. 6, OP curves of all users are individually depicted for different RHIs and ipSIC parameters in case of $\mu=0.2$, $\sigma_{e,SR}^2=\sigma_{e,l}^2=0$, ($N_2=2$; $N_D=2$), ($m_{SR}=2$; $m_{LI}=1$; $m_{RU}=2$) configurations. It is obvious that the first user is not effected by ipSIC since it does not perform SIC cancellation. However, RHIs seriously deteriorate the performance of all users. In addition, ($\kappa_{SR}=0.14$; $\kappa_{RU}=0$) and ($\kappa_{SR}=0$; $\kappa_{RU}=0.14$) configurations exhibit the same OP performance, thus RHIs in the first and second hops have the same effect on the system performance. From results of the second user, for an OP value of $10^{-4}$, difference between $\sigma_{ipsic}^2=0.03$ and $\sigma_{ipsic}^2=0$ is approximately $15$ dB in case of ($\kappa_{SR}=0.14$; $\kappa_{RU}=0.14$), while $3$ dB in case of ($\kappa_{SR}=0.14$; $\kappa_{RU}=0$). Similar results can be obtained for the third user. This observation reveals that RHIs effect the performance more than ipSIC. \begin{figure}[!b] \centering \includegraphics[width=0.70\columnwidth]{Fig_7.pdf} \caption{OP comparisons of the investigated FD-NOMA system with HD-NOMA counterpart versus $\mu$ in case fixed $SNR=15$ dB and different number of antenna and RHIs parameters.} \label{fig:7} \vspace{-2 mm} \end{figure} Fig. 7 represents OP comparisons of FD-NOMA (investigated) and HD-NOMA systems versus the quality of LI cancellation parameter $\mu$ in case fixed $SNR=15$ dB, $\sigma_{e,SR}^2=\sigma_{e,l}^2=0$, $\sigma_{ipsic}^2=0$, $m_{SR}=m_{LI}=m_{RU}=1$ and different RHIs parameters. In the figure, case-1:($N_S=2$;$N_D=2$), case-2:($N_S=3$;$N_D=2$), $\kappa_1$:($\kappa_{SR}=\kappa_{RU}=0$) and $\kappa_2$:($\kappa_{SR}=\kappa_{RU}=0.14$) definitions are made for simplicity. For fair comparison, threshold SIDNRs have the following relationship $\frac{1}{2}\log_2(1+\gamma_{th,l}^{HD})=\log_2(1+\gamma_{th,l}^{FD})$. Also, we set threshold SIDNRs of HD-NOMA as $\gamma_{th,1}^{HD}=0.9$, $\gamma_{th,2}^{HD}=1.5$ and $\gamma_{th,3}^{HD}=2$ to ensure satisfying the condition of $a_j$-$\gamma_{th,j}(\xi_j+\tilde{\xi}_j+\vartheta_1)>0$. As clearly seen from curves of the first user, FD-NOMA is better than HD-NOMA at the most of values $\mu$, however performance gap between them decreases as the quality of LI cancellation gets worse. On the other hand, according to the second and third users, FD-NOMA outperforms HD-NOMA when the value of $\mu$ is below $0.49$ and $0.26$ for the configuration of (case-1,$\kappa_1$), respectively. Moreover, in the presence of RHIs ($\kappa_2$), FD-NOMA is better than HD-NOMA when $\mu\leq0.9$ and $\mu\leq0.65$ for the second and third users. Consequently, the quality of LI cancellation under effect of RHIs can be worse than that of ideal HIs case for which FD-NOMA outperforms HD-NOMA. Fig. 8 illustrates the OP performance of the investigated system versus RHIs parameters ($\kappa_{SR}=\kappa_{RU}$) for different effects of CEEs and ipSIC in case of fixed $SNR=15$ dB, $N_S=N_D=2$, $\mu=0.2$ and $m_{SR}=m_{LI}=m_{RU}=1$. For the figure to be better understandable, configurations are categorized into $5$ cases as following case-1:($\sigma_{e,SR}^2=0.03$; $\sigma_{ipsic}^2=0$; $\sigma_{e,l}^2=0.03$), case-2:($\sigma_{e,SR}^2=0.03$; $\sigma_{ipsic}^2=0$; $\sigma_{e,l}^2=0$), case-3:($\sigma_{e,SR}^2=0$; $\sigma_{ipsic}^2=0$; $\sigma_{e,l}^2=0.03$), case-4:($\sigma_{e,SR}^2=0$; $\sigma_{ipsic}^2=0.03$; $\sigma_{e,l}^2=0$) and case-5:($\sigma_{e,SR}^2=0$; $\sigma_{ipsic}^2=0$; $\sigma_{e,l}^2=0$). As clearly seen from the results of all users, OP performances get worse as the effect of RHIs increase, even OPs equal to $1$ under heavy RHIs effect. According to the first user, CEEs in the second hop worsen the performance more than that of in the first hop. However, in terms of the second and third users, CEEs in the first hop are much more effective than that of in the second hop. Moreover, ipSIC deteriorates the performance much more than CEEs in both hops for the second and third users. \begin{figure}[!t] \centering \includegraphics[width=0.76\columnwidth]{Fig_8.pdf} \caption{OP of users versus RHIs parameter $\kappa_{SR}=\kappa_{RU}$ in case of $\mu=0.2$, fixed $SNR=15$ dB and different CEEs and ipSIC configurations.} \label{fig:8} \vspace{-2 mm} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.68\columnwidth]{Fig_9.pdf} \caption{OP comparisons of the investigated FD-NOMA system with FD-OMA counterpart versus $d_{SR}$ in case of $\mu=0.2$, fixed $SNR=15$ dB, different fading and RHIs parameters, and number of antenna configurations.} \label{fig:9} \vspace{-2 mm} \end{figure} Fig. 9 depicts OP performance of the investigated system versus distances between the BS and relay ($d_{SR}$) in case of fixed $SNR=15$ dB and $\sigma_{e,SR}^2=\sigma_{e,l}^2=\sigma_{ipsic}^2=0$. The normalized distances in $R-U_l$ links are determined by $d_{RU_l}=1-d_{SR}$. In Fig. 9 (a), $\kappa_1$:($\kappa_{SR}=\kappa_{RU}=0.1$), $\kappa_2$:($\kappa_{SR}=\kappa_{RU}=0$), case-1:($N_S=2$;$N_D=1$, $m_{SR}=m_{LI}=m_{RU}=1$), case-2:($N_S=2$;$N_D=2$, $m_{SR}=2$;$m_{LI}=1$;$m_{RU}=1$). Also, Fig. 9 (b) is obtained for $\kappa_{SR}=\kappa_{RU}=0.1$, $m_{SR}=m_{LI}=m_{RU}=1$ and $\log_2(1+\gamma_{th}^{OMA})=\sum_{l=1}^{L}\log_2(1+\gamma_{th,l})$ relation is used to obtain OMA curves. From Fig. 9 (a), RHIs have the same level of effect on the performance at all values of distances for all users. It is observed that minimum OP can be achieved when $d_{SR}< d_{RU_l}$ for the second and third users while $d_{SR}\geq d_{RU_l}$ for the first user since optimum location of the relay has a close relation with diversity order and array gain which are also provided in asymptotic analyses. On the other hand, from Fig. 9 (b), FD-NOMA outperforms FD-OMA when the relay is close to the BS for the second and third users while FD-OMA is better at all values of $d_{SR}$ for the first user. \section{Conclusion} This paper analyzed the performance of MRT/MRC scheme in dual-hop NOMA FD AF relay networks over Nakagami-$m$ fading channels by considering the effects of RHIs. In addition, CEEs and ipSIC were also taken into account in order for the system be more realistic. For performance criterion, exact OP for any user was derived together with tight lower bound and asymptotic expressions. Numerical results demonstrated that performance of the investigated FD-NOMA system is strictly limited by error floor in the high SNR region, even all users are exposed to the same level, if LI cancellation can not be exploited. However, performance can be improved by increasing the number of antennas. On the other hand, all users can enjoy benefits of diversity order and array gain thanks to the quality of LI cancellation. Furthermore, our analysis revealed that the MRT beamforming is better than MRC on the performance improvement of users with lower power allocations than user with the highest power allocation. However, in case of CEEs, performance behavior trade-off between MRT and MRC schemes depends on imperfect channel conditions in both hops. Besides CEEs and imperfect LI cancellation, RHIs seriously deteriorate the performance, such that it is much more effective for the second and third users relative to the first user, while it has no effect on diversity order. On the other hand, under RHIs effect, LI cancellation process does not need to have very high quality when compared to ideal HIs case such that FD-NOMA outperforms HD-NOMA. It was also observed that imperfections which have the most and least deterioration effect on the performance are RHIs and CEEs, respectively. Furthermore, the minimum OP can be achieved with optimum relay location which has a close relation with diversity order and array gain, such that FD-NOMA outperforms FD-OMA when the relay is close to the BS for users with lower power allocations. \section{Introduction} For the last decade, many researchers from academia and industry have focused on non-orthogonal multiple access (NOMA) in order to overcome challenges caused by smart devices with massive connectivity and fulfill requirements of forthcoming generations wireless networks since the existing orthogonal multiple access (OMA) techniques are limited in terms of spectral efficiency and massive connectivity \cite{QCLi,LiuY,Aldababsa}. The most important key feature of NOMA is to serve multiple users in the same resources (time/frequency/code) by allocating different power coefficients, thus fairness among users can be ensured. On the other hand, successive interference cancellation (SIC) technique is applied by users to separate the superposed signals and obtain the desired information related to user \cite{Saito1}. So far, NOMA, especially power-domain NOMA, has been widely investigated in the literature. In \cite{DingZ}, a downlink NOMA network based on cell-clustering, where distances between the base station (BS) and users are subjected to uniform distribution, is investigated. In \cite{Timotheou}, the authors have focused on optimization of power coefficients in order to ensure maximizing the fairness among user. In \cite{Gui}, a new definition to measure the fairness, which evaluates rate of each user by accounting for the fraction of total power allocated to it, for NOMA networks is proposed. On the other hand, in order to exploit benefits of spatial diversity, multiple-input multiple-output (MIMO) techniques are also considered in NOMA networks \cite{DingZ1}. Accordingly, in \cite{QiSun}, ergodic capacity maximization problem, where cost function is subjected to total transmit power constraint and minimum rate constraint related to weak user, is investigated for a two-user MIMO-NOMA network. In \cite{MZeng}, the authors have analyzed sum and ergodic capacity of MIMO-NOMA system, in which multiple users are grouped into a cluster according to certain algorithms, and demonstrated that the sum capacity is inversely proportional to the number of users within cluster. In addition, several beamforming techniques have been investigated for multiple-input single-output (MISO) and/or MIMO NOMA networks in order to either maximize capacity and fairness or minimize transmit power \cite{QZhang,DingZ2,XChen,FAlavi}. In \cite{MtokaCL}, the authors have analyzed the outage probability (OP) of Alamouti space-time block coding (STBC) \cite{Tarokh} in MISO multi-user NOMA network over independent and identically distributed (i.i.d.) Nakagami-$m$ fading channels. In \cite{Mtoka}, the same network considered in \cite{MtokaCL} has been generalized to all orthogonal STBC (OSTBC) codes. The authors have analyzed the OP and ergodic capacity over i.i.d. Nakagami-$m$ fading channels by also considering the effects of channel estimation errors (CEEs), feedback delay (FBD) and imperfect SIC (ipSIC). Although using multiple antennas at the transmitter and receiver ends provides improved transmission reliability and spatial diversity, wireless systems suffer from hardware complexity and high power consumption. Therefore, the authors of \cite{YYu1} proposed several computationally efficient antenna selection algorithms for two-user MIMO-NOMA scenarios based on fixed power and cognitive radio-inspired power allocations in order to maximize the system sum-rate. In \cite{AldababsaMajTAS}, a novel antenna selection scheme for single-hop MIMO-NOMA based on decision of majority of users differing from \cite{YYu1} has been proposed and OP performance has been investigated over Nakagami-$m$ fading by also considering effects of CEEs and FBD. Moreover, since relaying techniques offer extending coverage area and establish reliable communication under heavy channel environments and huge obstacles, recently, NOMA has been extended to cooperative transmission \cite{DingZ3,JBKim}. In \cite{JJmen}, the OP analysis of a dual-hop amplify-and-forward (AF) relaying NOMA network, where the BS and users are equipped with single antenna, has been conducted over Nakagami-$m$ fading under effect of CEEs. In \cite{ZhangY}, the authors have investigated transmit antenna selection (TAS) at the BS and maximal-ratio combining (MRC) at users in a dual-hop AF relaying NOMA system over Nakagami-$m$ fading by considering CEEs. In \cite{XYan}, OP and ergodic capacity of cooperative two-user NOMA networks with direct link, where single relay among multiple relays and single antenna at users are selected, has been analyzed in the presence of CEEs and ipSIC. The authors of \cite{HLi} have analyzed joint relay and antenna selection problem in cooperative two-user NOMA network based on coordinated direct and relay transmission structure in terms of OP over Rayleigh fading channels. In \cite{AldababsaMRTRAS}, the authors have analyzed OP of a dual-hop MIMO-NOMA network, where maximal-ratio transmission (MRT)/receive antenna selection (RAS) are adopted in both hops, over Nakagami-$m$ fading channels in the presence of CEEs. Although reliability and performance of NOMA networks have been increased by aforementioned cooperative studies, however they are all based on half-duplex (HD) relaying which has limited spectral efficiency because of allocation of two orthogonal channels for transmission. On the other hand, full-duplex (FD) relaying technique has been regarded as a promising solution since the reception and transmission can be realized at the same time/frequency yielding double capacity \cite{Duarte}. However, FD relay has a major drawback named as loop-interference (LI) caused by signal leakage between the transmitter and receiver antennas. Fortunately, thanks to the advances on antenna technologies and signal processing approaches, effect of LI can be reduced to a sufficient level in order for FD relaying be feasible in a practical manner \cite{Duarte,Rodriguez}. Therefore, the authors of \cite{ZhongC} and \cite{TMCC} have considered using FD relay in NOMA systems in order to overcome spectral efficiency loss caused by HD relays. Also, in \cite{YAlsaba}, a cooperative two-user NOMA network, where the BS adopts zero-forcing (ZF) beamforming and the strong user acts as a decode-and-forward (DF) FD relay to assist weak user, has been proposed. The authors have analyzed OP of the network over Rayleigh fading channels by also taking into account of energy harvesting at the relay. In \cite{Mohammadi}, a cooperative two-user NOMA network based on cognitive radio has been considered and joint beamforming optimization problem for transmit/receive ends at DF FD relay has been evaluated. The authors have also investigated MRT/ZF, ZF/MRC and ZF/ZF schemes at the relay in a comparative manner. In practice, radio-frequency hardware components at the transmitter and receiver suffer from different impairments caused by high power amplifier non-linearity, in-phase/quadrature (I/Q) imbalance and phase noise, which seriously deteriorate the system performance due to mismatch between the desired and actual signal \cite{Schenk}. In order to compensate the influence of these hardware impairments (HIs), a lot of efforts in developing appropriate approaches have been made in the literature, however, there still exist residual HIs (RHIs) which can not be overlooked in real-life deployments \cite{Bjornson,Bjornson2}. Although some of the aforementioned studies on NOMA networks consider only CEEs, FBD and ipSIC without RHIs in a practical manner, nevertheless, there are some works paying attention to effects of RHIs in NOMA networks. Particularly, in \cite{XLi3}, the impact of I/Q imbalance impairment in a secure single-input multiple-output (SIMO)-NOMA network consisting of one BS, multiple legitimate users and an eavesdropper has been investigated over Rayleigh fading channels. In order to exploit receive diversity, RAS scheme has been applied at receivers of all users and eavesdropper. In \cite{MtokaMRTRAS}, outage performance of hybrid MRT/RAS scheme is investigated in single-hop multi-user NOMA system in the presence of RHIs together with CEEs and ipSIC. In \cite{FDing}, impact of RHIs on dual-hop multi-user NOMA network with AF relay has been investigated over Nakagami-$m$ fading channels in terms of OP and ergodic rate. In \cite{XLi}, the authors analyzed OP and ergodic capacity of single-hop and dual-hop NOMA AF relay networks over $\alpha-\mu$ fading channels in the presence of CEEs, ipSIC and RHIs. In \cite{XLi2}, effects of RHIs together with CEEs and ipSIC have been analyzed in a dual-hop NOMA AF relaying network, where multiple users are separated into multiple clusters and the BS communicates all clusters according to OMA while adopts NOMA scheme to serve users in a cluster, over Nakagami-$m$ fading channels. The authors have also considered energy harvesting at the relay, and obtained exact OP and ergodic capacity expressions for two users in a cluster. In \cite{CBLe}, a cooperative two-user NOMA network, where all nodes are equipped with single antenna and a DF hybrid HD/FD relay assists the communication between the BS and far user, has been investigated over Rayleigh fading channels in the presence of RHIs. In order to demonstrate the level of system performance, OP and ergodic capacity expressions have been obtained. In \cite{CDeng}, the authors have considered the same system of \cite{CBLe} without direct link between the relay and near user, and analyzed OP and ergodic rate over Rician fading channels. As mentioned above, there are many studies investigate effects of RHIs on single-hop and/or dual-hop NOMA networks with or without CEEs/ipSIC in the literature. However, the majority of them consider systems as consisting of HD relays and nodes equipped with single antenna except studies of \cite{XLi3,CBLe,CDeng}. In \cite{XLi3}, users and an eavesdropper are equipped with multiple antennas to adopt RAS scheme while FD relaying is considered in \cite{CBLe} and \cite{CDeng}. Therefore, investigations on the impact of RHIs on both MIMO-NOMA and FD relaying based cooperative NOMA, to the best of our knowledge, are still limited. Motivated by \cite{XLi3,CBLe,CDeng}, in this paper, we investigate a dual-hop multi-user AF FD relaying based MIMO-NOMA system, where MRT and MRC schemes are exploited at the BS and users, respectively, over i.i.d. Nakagami-$m$ fading channels in the presence of RHIs. The key contributions of the paper are summarized as follows: \begin{itemize} \item Unlike the existing studies on cooperative NOMA with RHIs, we consider using multiple antennas at the BS and users while the relay operates in FD mode. Furthermore, our analyses have been conducted for a generic channel model, Nakagami-$m$ fading, and LI link at the relay is also assumed to exposed to fading variations. \item In order to provide a realistic analysis, CEEs and ipSIC have been taken into account. To characterize the system performance, exact OP expression for any user has been derived. Moreover, a tight lower bound and simple asymptotic expressions have been obtained to provide further insights, such as diversity behavior of the system. The investigated network has been compared to HD-NOMA and FD-OMA counterparts. \item We have demonstrated that the quality of LI cancellation process is quite crucial for the investigated system to outperform HD-NOMA counterpart, even error floors may exist under the worst case of cancellation process. In terms of users with lower power allocations, MRT performs better than MRC without CEEs, while there is a trade-off between both schemes in the presence of CEEs. In addition, RHIs have much more effect on the performance of users with lower power allocations while do not change the diversity order of all users. Moreover, imperfections which have the most and least deterioration effects on the performance are RHIs and CEEs, respectively. \end{itemize} \subsection{Organization and Notations} The rest of the paper is given as follows. In Section II, we introduce the system model and channel statistics including practical imperfections in detail. In Section III, we derive the exact OP expression for any user together with lower bound and asymptotic approximations. Numerical results including comparisons are illustrated in Section IV. Finally, conclusions are interpreted in Section V. \textit{Notation:} Bold lowercase letter and $\|\cdot\|$ denote vectors and Euclidean norm while $(\cdot)^H$ indicates Hermitian transpose of a vector. $\mathbb{CN}(0,\sigma^2)$ is used to represent the complex Gaussian distribution with zero mean and variance of $\sigma^2$. While $Pr(\cdot)$ denote the probability of an event, $E\left[\cdot\right]$ represents the expectation operator. $f_X(\cdot)$ and $F_X(\cdot)$ indicate the probability density function (PDF) and cumulative distribution function (CDF) of a random variable $X$, respectively. \section{System Model} We consider a dual-hop power domain downlink NOMA network, where one BS ($S$) communicates with $L$ users ($U_l, l=1,2,\cdots,L$) with assistance of an FD AF relay ($R$). We assume that the direct link is not available due to huge obstacles and heavy environment conditions. The BS equipped with $N_S$ antennas transmits information by applying MRT beamforming technique while users with $N_D$ antennas combine received signals according to MRC scheme. Note that MRT and MRC schemes are the optimum ones among transmit and receive diversity techniques, respectively \cite{LoT,Simon}. On the other hand, the FD relay has two antennas, one for receiving and the other for broadcasting. $\mathbf{h}_{SR}=\left\lbrace h_{SR}^i \right\rbrace_{1\times N_S}$ ($1\leq i\leq N_S$), $\mathbf{h}_{l}=\{h_{l}^j\}_{N_D\times 1} $ ($1\leq j\leq N_D$) and $h_{LI}$ denote channel coefficients corresponding to $S-R$, $R-U_l$ and $R-R$ links. Since channels are assumed to be distributed as i.i.d. Nakagami-$m$, squared of channel gains follow Gamma distribution, thus powers of links can be obtained by $\Omega_{SR}=E\left[ |h^i_{SR}|^2\right] =d_{SR}^{-\alpha}$, $\Omega_{l}=E[ |h^j_{l}|^2] =d_{l}^{-\alpha}$ and $\Omega_{LI}=E[ |h_{LI}|^2] =\lambda P_R^{\mu-1}$, respectively. $d_{SR}$ and $d_{l}$ denote the normalized distances of $S-R$ and $R-U_l$ links, respectively, $\alpha$ is the path loss exponent. $\lambda$ ($\lambda>0$) and $\mu$ ($0\leq\mu\leq1$) represent the quality of LI cancellation process at $R-R$ link\footnote{It is worthwhile noting that the FD relay suffers from a LI effect between transmit and receive antennas due to its inherent simultaneous transmission at the same time/frequency. Although LI effects have been mitigated somehow, there still remain some residual LI effects. Without loss of generality, we consider the residual LI model determined according to active and/or passive interference cancellation as in \cite{Duarte} and \cite{Rodriguez}.}. Since effects of CEEs are also considered to be more practical, by following linear minimum mean square error estimation method, the BS and relay estimates channel coefficients in the training period, thus erroneously estimated channel coefficient vectors of $S-R$ and $R-U_l$ links can be represented by $\mathbf{h}_{SR}=\hat{\mathbf{h}}_{SR}+\boldsymbol{\varepsilon}_{e,SR}$ and $\mathbf{h}_{l}=\hat{\mathbf{h}}_{l}+\boldsymbol{\varepsilon}_{e,l}$, respectively\footnote{Note that the utilized channel estimation model is widely considered in the existing literature \cite{Mtoka,AldababsaMRTRAS,XLi}.}. $\boldsymbol{\varepsilon}_{e,SR}$ and $\boldsymbol{\varepsilon}_{e,l}$ are error vectors resulting from imperfect estimation process and can be modeled as $\boldsymbol{\varepsilon}_{e,SR}\sim\mathbb{CN}(0,\sigma_{e,SR}^2)$ and $\boldsymbol{\varepsilon}_{e,l}\sim\mathbb{CN}(0,\sigma_{e,l}^2)$ with variances of $\sigma_{e,SR}^2=\Omega_{SR}-\hat{\Omega}_{SR}$ and $\sigma_{e,l}^2=\Omega_{l}-\hat{\Omega}_{l}$, respectively \cite{Medard}. Since the investigated system is based on NOMA transmission, the BS transmits superimposed signals represented by $x(n)=\sum_{i=1}^{L}\sqrt{P_Sa_i}s_i(n)$ in the $n$th time interval, where $P_S$ and $a_i$ represent transmit power at the BS and power allocation coefficient intended to $i$th user ($\sum_{i=1}^{L}a_i=1$), respectively. Note that we represented signals according to time index due to the FD relay transmission. Then, the received signal at the relay under RHIs effect can be represented as \begin{equation}\label{eq:1} y_R(n)=\mathbf{h}_{SR}(\mathbf{w}(n)x(n)+\eta_{SR}(n))+h_{LI}s_R(n)+n_R(n), \end{equation} where $n_R(n)\sim\mathbb{CN}(0,\sigma_{R}^2)$ is Gaussian noise at $R$ and $\eta_{SR}(n)\sim\mathbb{CN}(0,\kappa_{SR}^2P_S)$ represents aggregate distortion noise resulting from RHIs at $S-R$ link. $\kappa_{SR}^2=(\kappa_{S}^t)^2+(\kappa_{R}^r)^2$ denotes aggregate power level of RHIs, where $\kappa_{S}^t$ and $\kappa_{R}^r$ are impairment levels \cite{Schenk,Bjornson}. Since FD relay applies LI cancellation methods, we assume that the impact of RHIs distortion noise at link $R-R$ is absorbed by the LI cancellation parameter as in \cite{Nguyen}. $\mathbf{w}(n)=\hat{\mathbf{h}}_{SR}^H/\|\hat{\mathbf{h}}_{SR}\|$ is MRT weight vector at the BS, subjected $\|\mathbf{w}(n)\|^2=1$. Also, $s_R(n)=Gy_R(n-\tau)$ denotes the signal to be transmitted from the relay, where $\tau$ is processing delay of the FD transmission and $G$ is the amplification factor which can be obtained as \begin{equation}\label{eq:2} G=\sqrt{\frac{P_R}{P_S(\|\hat{\mathbf{h}}_{SR}\|^2+\sigma_{e,SR}^2)(1+\kappa_{SR}^2)+P_R|h_{LI}|^2+\sigma_{R}^2}}. \end{equation} Afterwards, the received signal vector at the $l$th user can be written as $\mathbf{y}_{U_l}(n)=\mathbf{h}_{l}(s_R(n)+\eta_{RU}(n))+\mathbf{n}_l(n)$, where $\mathbf{n}_l(n)=\{n_l^j(n)\}_{N_D\times 1}$ is Gaussian noise vector (whose entries are subjected to $\mathbb{CN}(0,\sigma_l^2)$) at $l$th user. Also, $\eta_{RU}(n)\sim\mathbb{CN}(0,\kappa_{RU}^2P_R)$ denotes the aggregate distortion noise of RHIs at $R-U_l$ link, where $\kappa_{RU}^2=(\kappa_{R}^t)^2+(\kappa_{U}^r)^2$ is aggregate power level of RHIs. Without loss of generality, as in \cite{FDing}, we consider that users have the same effect of hardware impairments; such that $\kappa_{U_l}^r\stackrel{\triangle}{=}\kappa_{U}^r$. Then, if we substitute $s_R(n)$ into $\mathbf{y}_{U_l}(n)$, the received signal vector at $l$th user can be rewritten with the help of (\ref{eq:1}) as \begin{equation}\label{eq:3} \begin{split} \mathbf{y}_{U_l}(n)&=\mathbf{h}_{l}G\mathbf{h}_{SR}\bigg[\underbrace{\mathbf{w}(n-\tau)\sqrt{P_Sa_l}s_l(n-\tau)}_{\textit{desired signal}} +\underbrace{\mathbf{w}(n-\tau)\sum\nolimits_{p=1}^{l-1}\sqrt{P_Sa_p}s_p(n-\tau)}_{\textit{ipSIC term}} \\ & +\underbrace{\mathbf{w}(n-\tau)\sum\nolimits_{k=l+1}^{L}\sqrt{P_Sa_k}s_k(n-\tau)}_{\textit{IUI term}}+\underbrace{\eta_{SR}(n-\tau)}_{\textit{RHIs at S-R}}\bigg] \\ &+\mathbf{h}_{l}\bigg[ G\bigg( \underbrace{h_{LI}s_R(n-\tau)}_{\textit{LI term}}+n_R(n-\tau)\bigg) + \underbrace{\eta_{RU}(n)}_{\textit{RHIs at $R-U_l$}}\bigg]+ \mathbf{n}_l(n). \end{split} \end{equation} The received signals by $N_D$ antennas at the $l$th user are combined according to MRC technique as $y_{U_l}^{MRC}=\mathbf{w}_{\text{MRC}}(n)\mathbf{y}_{U_l}(n)$, where $\mathbf{w}_{\text{MRC}}(n)=\hat{\mathbf{h}}_{l}^H/\|\hat{\mathbf{h}}_{l}\|$ is MRC weight vector subject to $\|\mathbf{w}_{\text{MRC}}(n)\|^2=1$. \section{Performance Analyses} In this section, end-to-end ($e2e$) signal-to-interference-distortion plus noise ratio (SIDNR) expression is derived. Then, the exact OP for any user is obtained together with lower bound and asymptotic expressions to provide further insights into the system performance. \subsection{Derivation of $e2e$ SIDNR} According to NOMA transmission, weaker users (with poorer channel qualities) are allocated higher power levels at the BS for ensuring the fairness. Therefore, in the training period, the relay estimates effective channel gains of $R-U_l$ links by using pilot symbols sent from all users such that they are ordered as $\|\hat{\mathbf{h}}_{RU_1}\|^2\leq\|\hat{\mathbf{h}}_{RU_2}\|^2$ $\cdots\leq\|\hat{\mathbf{h}}_{RU_L}\|^2$ without loss of generality, and then transmits the ordering to the BS and users at the same time. Thus, the BS allocates power coefficients to users as $a_1>a_2>\cdots>a_L$ by using the ordering. Also, the BS estimates channel gains of $S-R$ link to apply MRT beamforming. Since SIC is carried out at users, any stronger user $l$ detects and removes signal of the weaker user $j$, where $j<l$. On the other hand, signal of the stronger user $k$ is considered as interference noise by user $l$, where $k>l$ and also named as inter-user interference (IUI). Consequently, by using (\ref{eq:2}) and (\ref{eq:3}), instantaneous SIDNR defined as the $l$th user erroneously decodes the signal of $j$th user ($j\leq l$) is given as \begin{equation}\label{eq:4} \gamma_{U_{j\rightarrow l}}=\dfrac{\psi_1\psi_2\bar{\gamma}^2a_j}{\psi_1\psi_2\bar{\gamma}^2(\xi_j+\tilde{\xi}_j+\vartheta_1)+\psi_1\bar{\gamma}\vartheta_2\vartheta_3+(\psi_2\bar{\gamma}+\vartheta_2)(\psi_3\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3} \end{equation} In (\ref{eq:4}), $\bar{\gamma}=P/\sigma^2$ represents average signal-to-noise ratio (SNR), where $P_S=P_R=P$ is assumed for mathematical simplicity, while $\xi_j=\sum_{k=j+1}^{L}a_k$ and $\tilde{\xi}_j=\sum_{p=1}^{j-1}a_p\sigma_{ipsic}^2$ are IUI and ipSIC terms, respectively. Without loss of generality, we assume that ipSIC is subject to Gaussian distribution with power $\sigma_{ipsic}^2$ ($0\leq\sigma_{ipsic}^2\leq1$) as in \cite{XLi,HasanA,Tweed}. Also, $\psi_1\stackrel{\triangle}{=}\|\hat{\mathbf{h}}_{SR}\|^2$, $\psi_2\stackrel{\triangle}{=}\|\hat{\mathbf{h}}_{l}\|^2$ and $\psi_3\stackrel{\triangle}{=}|h_{LI}|^2$ definitions are made to simplify analyses. In addition, constant variables $\vartheta$ are given below: \begin{equation}\label{eq:5} \begin{split} \vartheta_1&\stackrel{\triangle}{=}\kappa_{SR}^2+\kappa_{RU}^2(1+\kappa_{SR}^2)~,~~\vartheta_2\stackrel{\triangle}{=}\bar{\gamma}\sigma_{e,l}^2+\frac{1}{1+\kappa_{RU}^2} \\ \vartheta_3&\stackrel{\triangle}{=}(1+\kappa_{RU}^2)(1+\kappa_{SR}^2)~~,~~\vartheta_4\stackrel{\triangle}{=}\frac{1}{1+\kappa_{SR}^2} \\ \vartheta_5&\stackrel{\triangle}{=}\bar{\gamma}\sigma_{e,SR}^2+\frac{1}{1+\kappa_{SR}^2}. \end{split} \end{equation} \subsection{Outage Probability Analysis} The outage event for the $l$th user can be defined as the $l$th user can not decode its own signal or the $j$th user's signal ($1\leq j\leq l$). Thus, let us define $E_{l,j}=\{\gamma_{U_{j\rightarrow l}}>\gamma_{th,j}\}$ as the event that the $l$th user can decode $j$th user's signal, where $\gamma_{th,j}=2^{R_0}-1$ ($R_0$: bits per channel in use (BPCU)) is the target threshold SIDNR for FD transmission. With the help of (\ref{eq:4}), the event of $E_{l,j}$ can be expressed as \begin{equation}\label{eq:6} \begin{split} E_{l,j}&=\left\lbrace \left(\psi_2-\vartheta_2\vartheta_3\delta_j \right)\psi_1>\frac{(\psi_2\bar{\gamma}+\vartheta_2)(\psi_3\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3\delta_j}{\bar{\gamma}}\right\rbrace \\ &=\left\lbrace \psi_1>\frac{(\psi_2\bar{\gamma}+\vartheta_2)(\psi_3\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3\delta_j}{\bar{\gamma}(\psi_2-\vartheta_2\vartheta_3\delta_j)},\psi_2>\vartheta_2\vartheta_3\delta_j\right\rbrace, \end{split} \end{equation} where the second equality is obtained subjected to the condition of $a_j-\gamma_{th,j}(\xi_j+\tilde{\xi}_j+\vartheta_1)>0$ and also $\delta_j\stackrel{\triangle}{=}\frac{\gamma_{th,j}}{\bar{\gamma}(a_j-\gamma_{th,j}(\xi_j+\tilde{\xi}_j+\vartheta_1))}$ notation is made for mathematical tractability. Consequently, by using (\ref{eq:6}), the OP for the $l$th user can be written as \begin{equation}\label{eq:7} \begin{split} &P_{out}^l=1-Pr\left(E_{l,1} \cap E_{l,2} \cap \cdots \cap E_{l,l}\right) \\ &=1-Pr\left(\psi_1>\frac{(\psi_2\bar{\gamma}+\vartheta_2)(\psi_3\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3\delta^{\dag}_l}{\bar{\gamma}(\psi_2-\vartheta_2\vartheta_3\delta^{\dag}_l)},\psi_2>\vartheta_2\vartheta_3\delta^{\dag}_l \right), \end{split} \end{equation} where $\delta^{\dag}_l=\underset{1\leq j\leq l}{\max}\left\lbrace \delta_j \right\rbrace$. Note that, (\ref{eq:7}) holds for the condition of $a_j>\gamma_{th,j}(\xi_j+\tilde{\xi}_j+\vartheta_1)$, otherwise the OP results to $1$. Then, (\ref{eq:7}) can be analytically expressed as \begin{equation}\label{eq:8} \begin{split} &P_{out}^l=F_{\psi_2}^{(l)}(\vartheta_2\vartheta_3\delta^{\dag}_l)+ \\ &\int\limits_{y=\vartheta_2\vartheta_3\delta^{\dag}_l}^{\infty}\int\limits_{z=0}^{\infty}F_{\psi_1}\left( \frac{(y\bar{\gamma}+\vartheta_2)(z\bar{\gamma}\vartheta_4+\vartheta_5)\vartheta_3\delta^{\dag}_l}{\bar{\gamma}(y-\vartheta_2\vartheta_3\delta^{\dag}_l)}\right)f_{\psi_3}(z)f_{\psi_2}^{(l)}(y)dzdy, \end{split} \end{equation} where $F_{X}^{(l)}$ and $f_{X}^{(l)}$ denote the CDF and PDF of user with the $l$th order statistic. Since channels are considered as i.i.d. Nakagami-$m$ fading, it is well-known that the squared gain of any link will be distributed as Gamma. Thus, corresponding CDFs and PDF of random variables $\psi_1$, $\psi_2$ and $\psi_3$ can be represented as $F_{\psi_1}(x)=1-e^{-xm_{SR}/\hat{\Omega}_{SR}}\sum_{n=0}^{m_{SR}N_S-1}\frac{(xm_{SR}/\hat{\Omega}_{SR})^n}{n!}$, $F_{\psi_2}(x)=1-e^{-xm_{l}/\hat{\Omega}_{l}}\sum_{n_1=0}^{m_{l}N_D-1}\frac{(xm_{l}/\hat{\Omega}_{l})^{n_1}}{n_1!}$ and $f_{\psi_3}(x)=\left(m_{LI}/\Omega_{LI} \right)^{m_{LI}}\frac{x^{m_{LI}-1}}{\Gamma(m_{LI})}e^{-xm_{LI}/\Omega_{LI}}$. Here, $m_{SR}$, $m_{l}$ and $m_{LI}$ denote Nakagami-$m$ channel parameters related to $S-R$, $R-U_l$ and $R-R$ links. If $F_{\psi_1}(x)$ is substituted into (\ref{eq:8}) and then the integrals are rearranged, we obtain \begin{equation}\label{eq:9} \begin{split} P_{out}^l&=1-\sum_{n=0}^{m_{SR}N_S-1}\frac{1}{n!}\int_{x=0}^{\infty}e^{-b}f_{\psi_2}^{(l)}(x+\vartheta_2\vartheta_3\delta^{\dag}_l)dx \\ &\times\underbrace{\int_{z=0}^{\infty}e^{-za}(za+b)^nf_{\psi_3}(z)dz}_{I_1}, \end{split} \end{equation} where $a=\frac{(\bar{\gamma}(x+\vartheta_2\vartheta_3\delta^{\dag}_l)+\vartheta_2)\vartheta_3\vartheta_4\delta^{\dag}_lm_{SR}}{x\hat{\Omega}_{SR}}$ and $b=\frac{a\vartheta_5}{\bar{\gamma}\vartheta_4}$. By using binomial expansion \cite[eq.(1.111)]{Gradshteyn}, integral property given by \cite[eq.(3.381.4)]{Gradshteyn} and $f_{\psi_3}(z)$, $I_1$ is obtained as \begin{equation}\label{eq:10} \begin{split} I_1=\sum_{m=0}^{n}\binom{n}{m}\left( \frac{m_{LI}}{\Omega_{LI}}\right) ^{m_{LI}}\frac{\Gamma(m+m_{LI})}{\Gamma(m_{LI})}\frac{b^{n-m}}{a^{-m}}\left(a+\frac{m_{LI}}{\Omega_{LI}} \right)^{-m-m_{LI}}, \end{split} \end{equation} where $\binom{\cdot}{\cdot}$ represents binomial coefficient, and thus (\ref{eq:9}) can be rewritten as \begin{equation}\label{eq:11} \begin{split} P_{out}^l&=1-\sum_{n=0}^{m_{SR}N_S-1}\sum_{m=0}^{n}\binom{n}{m}\frac{(m_{LI}/\Omega_{LI})^{m_{LI}}\Gamma(m+m_{LI})}{\Gamma(m_{LI})\Gamma(n+1)} \\ &\int_{x=0}^{\infty}e^{-b}\frac{b^{n-m}}{a^{-m}}\left(a+\frac{m_{LI}}{\Omega_{LI}} \right)^{-m-m_{LI}}f_{\psi_2}^{(l)}(x+\vartheta_2\vartheta_3\delta^{\dag}_l)dx. \end{split} \end{equation} In order to proceed, $f_{\psi_2}^{(l)}(x)$ should be determined. By using order statistic properties \cite{DavidHA}, PDF of user with the $l$th order can be expressed as $f_{\psi_2}^{(l)}(x)=Q_l\sum\nolimits_{s=0}^{L-l}\binom{L-l}{s}(-1)^{s}f_{\psi_2}(x)\big(F_{\psi_2}(x) \big)^{l+s-l}$, where $Q_l=L!/((L-l)!(l-1)!)$ \cite{DingZ,JJmen}. If previously defined CDF of $F_{\psi_2}(x)$ and its derivative yielding PDF are substituted into $f_{\psi_2}^{(l)}(x)$, we get \begin{equation}\label{eq:12} \begin{split} f_{\psi_2}^{(l)}(x)&=Q_l\sum_{s=0}^{L-l}\sum_{s_1=0}^{l+s-1}\sum_{n_1=0}^{s_1(m_lN_D-1)}\binom{L-l}{s}\binom{l+s-1}{s_1}(-1)^{s+s_1} \\ &\frac{(m_l/\hat{\Omega}_l)^{m_lN_D}}{\Gamma(m_lN_D)}\theta_{n_1}(s_1,m_lN_D)x^{n_1+m_lN_D-1}e^{-\frac{xm_l(s_1+1)}{\hat{\Omega}_l}}. \end{split} \end{equation} In order to obtain the closed-form of $f_{\psi_2}^{(l)}(x)$ in (\ref{eq:12}), binomial expansion \cite[eq.(1.111)]{Gradshteyn} and power series method given by \cite[eq.(0.314)]{Gradshteyn} are applied to $\big(F_{\psi_2}(x) \big)^{l+s-l}$. Here, $\theta_{n_1}(s_1,m_lN_D)$ represents multinomial coefficient consisting of a recursive summation \cite{Mtoka}. Finally, by substituting (\ref{eq:12}) into (\ref{eq:11}) and applying algebraic manipulations, the OP corresponding to the $l$th user can be obtained as \begin{equation}\label{eq:13} \begin{split} P_{out}^l&= 1-Q_l\sum_{n=0}^{m_{SR}N_S-1}\sum_{m=0}^{n}\sum_{s=0}^{L-l}\sum_{s_1=0}^{l+s-1}\sum_{n_1=0}^{s_1(m_lN_D-1)}\sum_{n_2=0}^{n_1+m_lN_D-1}\sum_{n_3=0}^{n}\binom{n}{m}\binom{L-l}{s}\binom{l+s-1}{s_1}\binom{n_1+m_lN_D-1}{n_2} \\ &\binom{n}{n_3}(-1)^{s+s_1}\frac{\Gamma(m+m_{LI})(m_{LI}/\Omega_{LI})^{m_{LI}}(m_l/\hat{\Omega}_l)^{m_lN_D}}{\Gamma(n+1)\Gamma(m_{LI})\Gamma(m_{l}N_D)}\theta_{n_1}(s_1,m_lN_D)(\vartheta_2\vartheta_3\delta^{\dag}_l)^{n_1+m_lN_D-n_2-1} \\ &e^{-\frac{(\vartheta_2\vartheta_3\delta^{\dag}_l)m_l(s_1+1)}{\hat{\Omega}_l}-\frac{\vartheta_3\vartheta_5\delta^{\dag}_lm_{SR}}{\hat{\Omega}_{SR}}}\left(\frac{\bar{\gamma}\vartheta_4}{\vartheta_5} \right)^m\left(\frac{\vartheta_3\vartheta_5\delta^{\dag}_lm_{SR}}{\hat{\Omega}_{SR}} \right)^n\left(\vartheta_2\vartheta_3\delta^{\dag}_l+\frac{\vartheta_2}{\bar{\gamma}} \right)^{n-n_3}\left( \Omega_{LI}\hat{\Omega}_{SR}\right) ^{m+m_{LI}} \\ &\left(\bar{\gamma}\vartheta_3\vartheta_4\delta^{\dag}_lm_{SR}\Omega_{LI}+m_{LI}\hat{\Omega}_{SR} \right)^{-m-m_{LI}}\Theta_l(x). \end{split} \end{equation} In (\ref{eq:13}), $\Theta_l(x)$ can be expressed by \setcounter{equation}{13} \begin{equation}\label{eq:14} \begin{split} \Theta_l(x)&=\int\limits_{x=0}^{\infty}x^{n_2+n_3+m+m_{LI}-n}e^{-\frac{xm_{l}\left( s_1+1\right) }{\hat{\Omega}_l}-\frac{\left( \vartheta_2\vartheta_3\delta^{\dag}_l+\vartheta_2/\bar{\gamma}\right) \vartheta_3\vartheta_5\delta^{\dag}_lm_{SR}}{x\hat{\Omega}_{SR}}} \\ &\left(x+\frac{\vartheta_4(\bar{\gamma}\vartheta_2\vartheta_3\delta^{\dag}_l+\vartheta_2)\vartheta_3\delta^{\dag}_lm_{SR}\Omega_{LI}}{\bar{\gamma}\vartheta_3\vartheta_4\delta^{\dag}_lm_{SR}\Omega_{LI}+m_{LI}\hat{\Omega}_{SR}} \right)^{-m-m_{LI}}dx. \end{split} \end{equation} Unfortunately, the closed-form of the integral in (\ref{eq:14}) does not exist. \subsection{Lower Bound Analysis} In order to find a tight approximation for the exact OP given by (\ref{eq:13}), SIDNR given in (\ref{eq:4}) can be upper-bounded, thus a tight lower-bound for the exact OP can be obtained. Firstly, (\ref{eq:7}) can be rewritten approximately as \begin{equation}\label{eq:15} P_{out}^l\approx1-Pr\left(\frac{W\frac{1}{\vartheta_4}\bar{\gamma}\psi_2\frac{1}{\vartheta_2}}{W\frac{1}{\vartheta_4}+\bar{\gamma}\psi_2\frac{1}{\vartheta_2}}>\bar{\gamma}\vartheta_3\delta^{\dag}_l \right), \end{equation} where $W=\bar{\gamma}\psi_1/(\bar{\gamma}\psi_3+\vartheta_5/\vartheta_4)$ for mathematical simplicity. Then, by using the harmonic mean property of two random variables defined as $xy/(x+y)\leq\min(x,y)$, lower-bound for the exact OP can be analytically expressed as \begin{equation}\label{eq:16} \begin{split} P_{out}^{l,low}&=1- Pr\left(\min\left(W\frac{1}{\vartheta_4},\bar{\gamma}\psi_2\frac{1}{\vartheta_2} \right) >\bar{\gamma}\vartheta_3\delta_l^{\dag}\right) \\ &=1-\overline{F}_{W}\left(\bar{\gamma}\vartheta_3\vartheta_4\delta_l^{\dag} \right)\overline{F}_{\psi_2}^{(l)}\left(\vartheta_2\vartheta_3\delta_l^{\dag} \right). \end{split} \end{equation} In (\ref{eq:16}), the CDF of $F_W(x)$ can be mathematically expressed as \begin{equation}\label{eq:17} \begin{split} F_W(x)&=Pr\bigg(\frac{\bar{\gamma}\psi_1}{\bar{\gamma}\psi_3+(\vartheta_5/\vartheta_4)}\leq\underbrace{\bar{\gamma}\vartheta_3\vartheta_4\delta_l^{\dag}}_{x} \bigg) \\ &=Pr\left(\psi_1\leq x\left(\psi_3+\frac{\vartheta_5}{\bar{\gamma}\vartheta_4} \right) \right) \\ &=1-\int\limits_{y=0}^{\infty}\int\limits_{x=x\left(y+\frac{\vartheta_5}{\bar{\gamma}\vartheta_4} \right) }^{\infty}f_{\psi_1}(x)f_{\psi_3}(y)dxdy. \end{split} \end{equation} Then, by substituting previously defined PDF of $f_{\psi_3}(x)$ and derivative of the CDF $F_{\psi_1}(x)$ into (\ref{eq:17}), we can obtain \begin{equation}\label{eq:18} \begin{split} &F_W(x)=1-\sum_{n=0}^{m_{SR}N_S-1}\frac{1}{n!}\left(\frac{m_{LI}}{\Omega_{LI}} \right)^{m_{LI}}\frac{1}{\Gamma(m_{LI})} \\ &\int\limits_{y=0}^{\infty}y^{m_{LI}-1}\left(x\left( y+\frac{\vartheta_5}{\bar{\gamma}\vartheta_4}\right) \frac{m_{SR}}{\hat{\Omega}_{SR}} \right)^{n}e^{-x\left( y+\frac{\vartheta_5}{\bar{\gamma}\vartheta_4}\right) \frac{m_{SR}}{\hat{\Omega}_{SR}}-y\frac{m_{LI}}{\Omega_{LI}}}dy. \end{split} \end{equation} Finally, with the help of integral property given by \cite[eq.(3.381.4)]{Gradshteyn}, the CDF of $F_W(x)$ can be derived as \begin{equation}\label{eq:19} \begin{split} &F_W(x)=1-\sum_{n=0}^{m_{SR}N_S-1}\sum_{n_2=0}^{n}\binom{n}{n_2}\frac{(m_{LI}/\Omega_{LI})^{m_{LI}}(m_{SR}/\hat{\Omega}_{SR})^n}{\Gamma(n+1)\Gamma(m_{LI})} \\ &\Gamma(n_2+m_{LI})\left(\frac{\vartheta_5}{\bar{\gamma}\vartheta_4} \right)^{n-n_2}x^n\left(\frac{xm_{SR}}{\hat{\Omega}_{SR}}+\frac{m_{LI}}{\Omega_{LI}} \right)^{-n_2-m_{LI}}e^{-\frac{x\vartheta_5m_{SR}}{\bar{\gamma}\vartheta_4\hat{\Omega}_{SR}}}. \end{split} \end{equation} On the other hand, if the PDF of $f_{\psi_2}^{(l)}(x)$ given in (\ref{eq:12}) is integrated with respect to $x$, the CDF of $F_{\psi_2}^{(l)}(x)$ is obtained as \begin{equation}\label{eq:20} \begin{split} F_{\psi_2}^{(l)}(x)&=1-Q_l\sum_{s=0}^{L-l}\sum_{s_1=1}^{l+s}\sum_{n_1=0}^{s_1(m_lN_D-1)}\binom{L-l}{s}\binom{l+s}{s_1} \\ &\frac{(-1)^{s+s_1-1}}{l+s}\theta_{n_1}(s_1,m_lN_D)x^{n_1}e^{-\frac{xm_ls_1}{\hat{\Omega}_l}}. \end{split} \end{equation} Afterwards, complementary versions of CDFs given in (\ref{eq:19}) and (\ref{eq:20}) are substituted into (\ref{eq:16}), a tight lower-bound of the exact OP corresponding to $l$th user can be obtained in closed-form. \subsection{Asymptotic Analyses} In order to reveal further insights for the system performance, asymptotic behavior of OP is considered by applying high SNR approximation in this subsection. Therefore, we have carried out the analyses according to two cases which are presented in the following subsections. \subsubsection{Under Ideal Conditions} \paragraph*{$\bullet$ When the quality of LI cancellation is $\mu\neq 1$} In the presence of ideal conditions (which also means that there are no CEEs in the first and second hops), system exploits benefits of diversity order and array gain at high SNR values (when $\bar{\gamma}\rightarrow\infty$). Thus, (\ref{eq:15}) can be approximated as \begin{equation}\label{eq:21} \begin{split} P_{out}^{l,\infty}&\approx1-Pr\left(\frac{W\vartheta_1^{'}\bar{\gamma}\psi_2\vartheta_2^{'}}{W\vartheta_1^{'}+\bar{\gamma}\psi_2\vartheta_2^{'}}>\bar{\gamma}\vartheta_1^{'}\vartheta_2^{'}\delta^{\dag}_l \right) \\ &=1- Pr\left(\min\left(W\vartheta_1^{'},\bar{\gamma}\psi_2\vartheta_2^{'} \right) >\bar{\gamma}\vartheta_1^{'}\vartheta_2^{'}\delta^{\dag}_l\right) \\ &=F_{W}^{\infty}\left( \bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l\right) +F_{\psi_2}^{(l),\infty}\left(\vartheta_1^{'}\delta^{\dag}_l\right), \end{split} \end{equation} where $W\simeq \psi_1/\psi_3$, $\vartheta_1^{'}=1+\kappa_{SR}^2$ and $\vartheta_2^{'}=1+\kappa_{RU}^2$ are defined. By using high SNR approximation approach \cite{ZWang}, we can express asymptotic OP in (\ref{eq:21}) as in the form $P_{out}^{l,\infty}\approx\left(AG\bar{\gamma} \right)^{-DO}+\textit{O}\left( \bar{\gamma}^{-DO}\right)$, where $AG$ is the array gain, $DO$ is the diversity order and $\textit{O}(\cdot)$ represents high order terms to be neglected. Firstly, the asymptotic CDF of $W$ can be derived by $F_{W}^{\infty}(x)=Pr(\psi_1/\psi_3\leq x)=\int_{y=0}^{\infty}F_{\psi_1}^{\infty}(yx)f_{\psi_3}(y)dy$. Here, the CDF of $\psi_1$ is expressed as $F_{\psi_1}(x)=\frac{\gamma(m_{SR}N_S,xm_{SR}/\Omega_{SR})}{\Gamma(m_{SR}N_S)}$ in terms of lower incomplete Gamma function \cite[eq.(8.350.1)]{Gradshteyn}, then it can be asymptotically obtained as $F_{\psi_1}^{\infty}(x)\approx\frac{(xm_{SR}/\Omega_{SR})^{m_{SR}N_S}}{\Gamma(m_{SR}N_S+1)}$ by using the property of $\gamma(x,y\rightarrow 0)\approx y^x/x$ \cite[eq.(45:9:1)]{Oldham}. If $F_{\psi_1}^{\infty}(x)$ and previously defined $f_{\psi_3}(y)$ are substituted into $F_{W}^{\infty}(x)$ by replacing $x$ with $\bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l$, we obtain $F_{W}^{\infty}(\bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l)=(\chi_1\bar{\gamma})^{-(1-\mu)m_{SR}N_S}$, where $\chi_1$ can be obtained as \begin{equation}\label{eq:22} \chi_1=\left(\frac{\Gamma(m_{SR}N_S+m_{LI})}{\Gamma(m_{SR}N_S+1)\Gamma(m_{LI})}\left(\frac{\vartheta_2^{'}\varLambda_l^{\dag}m_{SR}}{\Omega_{SR}m_{LI}} \right)^{m_{SR}N_S} \right)^{-\frac{1}{(1-\mu)m_{SR}N_S}}. \end{equation} In (\ref{eq:22}), $\varLambda_l^{\dag}=\bar{\gamma}\delta^{\dag}_l$ and independent from $\bar{\gamma}$. Therefore, the exponentially dominant constant on the average SNR ($\bar{\gamma}$) within the expression of $F_{W}^{\infty}(\bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l)$ equals to $(1-\mu)m_{SR}N_S$ for the first hop. Asymptotic expression of $F_{\psi_2}^{(l),\infty}(x)$ can be derived by taking into account of lower order terms related to variable of $x$ in (\ref{eq:20}) as $F_{\psi_2}^{(l),\infty}(x)\approx\binom{L}{l}\left(\frac{(xm_l/\Omega_l)^{m_lN_D}}{\Gamma(m_lN_D+1)} \right)^l$. Afterwards, by replacing $x$ with $\vartheta_1^{'}\delta^{\dag}_l$ and after mathematical manipulations, we obtain $F_{\psi_2}^{(l),\infty}(\vartheta_1^{'}\delta^{\dag}_l)=(\chi_2\bar{\gamma})^{-m_lN_Dl}$, where $\chi_2$ can be found as \begin{equation}\label{eq:23} \chi_2=\left(\binom{L}{l}\frac{1}{(\Gamma(m_lN_D+1))^l} \right)^{-\frac{1}{m_lN_Dl}}\frac{\Omega_l}{\vartheta_1^{'}\varLambda_l^{\dag}m_l}. \end{equation} From (\ref{eq:23}), the exponentially dominant constant on the average SNR ($\bar{\gamma}$) within the expression of $F_{\psi_2}^{(l),\infty}(\vartheta_1^{'}\delta^{\dag}_l)$ equals to $m_lN_Dl$ for the second hop. Consequently, if $F_{W}^{\infty}\left( \bar{\gamma}\vartheta_2^{'}\delta^{\dag}_l\right)$ and $F_{\psi_2}^{(l),\infty}\left(\vartheta_1^{'}\delta^{\dag}_l\right)$ are substituted into (\ref{eq:21}), and with the help of asymptotic form $P_{out}^{l,\infty}\approx\left(AG\bar{\gamma} \right)^{-DO}+\textit{O}\left( \bar{\gamma}^{-DO}\right)$, the asymptotic OP of the $l$th user can be obtained in simple form with diversity order metric $DO=\min\left\lbrace \left(1-\mu\right)m_{SR}N_S,m_{l}N_Dl\right\rbrace$. On the other hand, array gain can be found by using (\ref{eq:22}) and (\ref{eq:23}) as \begin{equation}\label{eq:24} AG=\left\{ \begin{array}{ll} \chi_1 & (1-\mu)m_{SR}N_S<m_{l}N_Dl \\ \chi_2 & (1-\mu)m_{SR}N_S>m_{l}N_Dl \\ \chi_1+\chi_2 & (1-\mu)m_{SR}N_S=m_{l}N_Dl \\ \end{array} \right.. \end{equation} \paragraph*{$\bullet$ When the quality of LI cancellation is $\mu=1$} In this case, $S-R$ link will be extremely dominant in $e2e$ SIDNR due to the high LI effect. Therefore, asymptotic OP for the $l$th user can be expressed as $P_{out}^{l,\infty}\approx F_W(\vartheta_2^{'}\varLambda_l^{\dag})$, where $W\approx\psi_1/\psi_3$, by neglecting the effect of $R-U_l$ link for high SNR values. Since $F_W(\vartheta_2^{'}\varLambda_l^{\dag})$ is independent from average SNR which also yields error floor level at high SNR values (also means zero diversity), we can not carry out high SNR approximation provided in \cite{ZWang}. Therefore, $F_W(x)$ can be obtained as \begin{equation}\label{eq:25} \begin{split} F_W(x)&=Pr\bigg(\frac{\psi_1}{\psi_3}\leq\underbrace{\vartheta_2^{'}\varLambda_l^{\dag}}_{x} \bigg) \\ &=1-\int_{y=0}^{\infty}\int_{x=xy}^{\infty}f_{\psi_1}(x)f_{\psi_2}(y)dxdy. \end{split} \end{equation} Then, by substituting the CDF of $\psi_1$ to get rid of the inner integral and PDF of $\psi_3$ into (\ref{eq:25}), and with the help of integral property provided by \cite[eq.(3.381.4)]{Gradshteyn}, the asymptotic OP of the $l$th user can be derived as \begin{equation}\label{eq:26} \begin{split} P_{out}^{l,\infty}&=1-\sum_{n=0}^{m_{SR}N_S-1}\frac{(m_{LI}/\Omega_{LI})^{m_{LI}}(m_{SR}/\Omega_{SR})^n}{\Gamma(n+1)\Gamma(m_{LI})} \\ &\Gamma(n+m_{LI})(\vartheta_2^{'}\varLambda_l^{\dag})^n\left(\frac{\vartheta_2^{'}\varLambda_l^{\dag}m_{SR}}{\Omega_{SR}}+\frac{m_{LI}}{\Omega_{LI}} \right)^{-n-m_{LI}} \end{split} \end{equation} \subsubsection{Under Practical Conditions} Since CEE parameters $\sigma_{e,l}^2$ and $\sigma_{e,SR}^2$ are dominant on the $e2e$ SIDNR, we can not apply asymptotic property $\gamma(x,y\rightarrow 0)\approx y^x/x$ given in \cite[eq.(45:9:1)]{Oldham}. Thus, by considering the dominance of CEE effects, in case of all quality of LI cancellation values ($\mu$), the predefined constants of $\vartheta_2$ and $\vartheta_5$ given by (\ref{eq:5}) can be approximated as $\vartheta_2\approx\bar{\gamma}\sigma_{e,l}^2$ and $\vartheta_5\approx\bar{\gamma}\sigma_{e,SR}^2$, respectively. By substituting $\vartheta_2$ and $\vartheta_5$ together with other constants given by (\ref{eq:5}) into (\ref{eq:13}), asymptotic OP of $l$th user in the presence of CEEs can be obtained. \section{Numerical Results} In this section, theoretical results for the investigated system verified by Monte Carlo simulations are presented. An exemplary, the scenario with three mobile users ($L=3$) is considered. Unless otherwise stated, markers illustrate simulation results, $SNR=\bar{\gamma}=P/\sigma^2$, $\alpha=3$ (for urban area cellular radio), $\lambda=1$ as in \cite{Duarte,Rodriguez}. While power coefficients to be allocated to users are set as $a_1=1/2$, $a_2=1/3$ and $a_3=1/6$, target SIDNR thresholds related to mobile users for FD transmission are determined as $\gamma_{th,1}=0.9$, $\gamma_{th,2}=1.5$ and $\gamma_{th,3}=2$, respectively. Also, normalized distances of $S-R$ link and $R-U_l$ links are fixed as $d_{SR}=0.5$ and $d_{1}=d_{2}=d_{3}=0.5$, respectively. For simplicity, Nakagami-$m$ channel parameters of $R-U_l$ links are assumed as $m_{1}=m_{2}=m_{3}=m_{RU}$. For easy of reading, lower bound (LB), asymptotic (Asymp) and theoretical (Theo) abbreviations are made. \begin{figure}[!b] \centering \includegraphics[width=0.70\columnwidth]{Fig_1.pdf} \caption{OP of the investigated system in case of $\mu=1$ and ideal conditions.} \label{fig:1} \vspace{-2 mm} \end{figure} Fig. 1 depicts OP curves of the investigated system in case of $\mu=1$ (which means the worst scenario of LI cancellation process), $m_{SR}=m_{LI}=m_{RU}=1$, $\sigma_{ipsic}^2=0$, $\kappa_{SR}=\kappa_{RU}=0$ under ideal channel conditions ($\sigma_{e,SR}^2=0$ and $\sigma_{e,l}^2=0$) for different antenna configurations. We observe from the figure that OP performance of the investigated system is strictly limited by error floor level, which is also known as zero-diversity and validated by asymptotic results, at high SNR values for all users. Also, OPs of all users are exposed to the same level regardless of the number of antennas. On the other hand, given the increased number of antennas (when the configurations $N_S=3$; $N_D=2$ and $N_S=2$; $N_D=1$ are compared), performance of the system can be improved in the low SNR region and with the decrease of error floor level in the high SNR region. In addition, we also observed that the exact results are supported by LB curves which are quite tight and match well in the high SNR region. Fig. 2 illustrates OP performance of the system for different antenna configurations for $\mu=0.2$, $m_{SR}=m_{LI}=m_{RU}=1$, $\sigma_{e,SR}^2=\sigma_{e,l}^2=0$, $\sigma_{ipsic}^2=0$ and $\kappa_{SR}=\kappa_{RU}=0$. As clearly observed from the figure, there is no error floor level when $\mu\neq 1$, and thus all users enjoy benefits of diversity order in the high SNR region. This result is also verified by the asymptotic curves which are obtained by theoretical analyses. Particularly, according to results of the first user, diversity orders are $(1-\mu)m_{SR}N_S$ for $N_S=1$; $N_D=1$ and $N_S=2$; $N_D=2$ configurations, and $m_{RU}N_Dl$ for $N_S=3$; $N_D=2$ configuration, respectively. Also, if $N_S=3$; $N_D=2$ and $N_S=2$; $N_D=2$ configurations are compared for an OP value of $10^{-5}$, $11$ dB more SNR gain can be achieved for the second and third users while $7$ dB for the first user, which implies that MRT beamforming is much more effective on the performance of the second and third users than first user. \begin{figure}[!b] \centering \includegraphics[width=0.70\columnwidth]{Fig_2.pdf} \caption{OP of the investigated system in case of $\mu=0.2$ and different number of transmit/receive antenna configurations under ideal conditions.} \label{fig:2} \vspace{-2 mm} \end{figure} In Fig. 3, OP performance of the system is presented for different RHIs parameters and antenna configurations. All curves are obtained for $\mu=0.2$, $\sigma_{e,SR}^2=\sigma_{e,l}^2=0$, $\sigma_{ipsic}^2=0$ and $m_{SR}=m_{LI}=m_{RU}=1$. From the figure, we observed that RHIs highly deteriorate the performance of users if $\kappa_{SR}=\kappa_{RU}=0$ and $\kappa_{SR}=\kappa_{RU}=0.16$ configurations are compared. Particularly, according to $N_S=3$; $N_D=2$ results, performance gap between $\kappa_{SR}=\kappa_{RU}=0$ and $\kappa_{SR}=\kappa_{RU}=0.16$ in terms of the second and third users is approximately $15$dB for an OP value of $10^{-5}$ while $12.5$ dB in terms of the first user. Similar results are obtained for $N_S=1$; $N_D=1$ configuration. This result reveals that the impact of RHIs is more effective on the performance of the second and third users relative to the first user. On the other hand a significant performance gain can be achieved as the number of antennas is increased, even under the effect of RHIs. Moreover, diversity order of the system is not effected by RHIs and asymptotic analysis also validates this observation. \begin{figure}[!b] \centering \includegraphics[width=0.70\columnwidth]{Fig_3.pdf} \caption{OP of the investigated system in case of $\mu=0.2$ and different number of transmit/receive antenna configurations and RHIs.} \label{fig:3} \vspace{-2 mm} \end{figure} Figs. 4 and 5 depict OP curves of three users in the presence of practical channel conditions ($\sigma_{e,SR}^2=\sigma_{e,l}^2=0.03$) for $\mu=0.2$, $\sigma_{ipsic}^2=0$ and $\kappa_{SR}=\kappa_{RU}=0$. In both figures, antenna configurations are set as $N_1$:$(N_S=1;N_D=2)$, $N_2$:$(N_S=2;N_D=1)$ and $N_3$:$(N_S=2;N_D=2)$ while channel parameters are $m_1$:$(m_{SR}=1;m_{LI}=1;m_{RU}=2)$ and $m_2$:$(m_{SR}=2;m_{LI}=1;m_{RU}=1)$. In both figures, we observe error floor levels in the high SNR region caused by the effects of CEEs, even $\mu\neq 1$. From Fig. 4, if we compare $N_1$ (also means MRC) and $N_2$ (also means MRT) configurations, MRT is better than MRC when the channel condition in the second hop is better ($m_1$ conf.), while MRC is better than MRT when the channel condition in the first hop is better ($m_2$ conf.). Consequently, performance behavior of the first user according to MRT and MRC schemes also depend on the channel conditions. Also, similar observations are obtained for the second and third users from Fig. 5. Furthermore, as clearly seen in both figures, although MRT and MRC schemes improve the performance of the system, hybrid scheme of MRT/MRC significantly increases OP performance of all users. Note also that hybrid scheme performs better in the low SNR region, significantly better in the high SNR region for $m_1$ configuration. \begin{figure}[!t] \centering \includegraphics[width=0.70\columnwidth]{Fig_4_U1.pdf} \caption{OP of the first user $U_1$ in case of $\mu=0.2$, different fading and number of antenna configurations in the presence of CEEs and ipSIC.} \label{fig:4} \vspace{-2 mm} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.70\columnwidth]{Fig_5_U2U3.pdf} \caption{OP of the second $U_2$ and third $U_3$ users in case of $\mu=0.2$, different fading and number of antenna configurations in the presence of CEEs and ipSIC.} \label{fig:5} \vspace{-2 mm} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.68\columnwidth]{Fig_6.pdf} \caption{OP of users in case of $\mu=0.2$ and different parameters of RHIs and ipSIC.} \label{fig:6} \vspace{-3 mm} \end{figure} In Fig. 6, OP curves of all users are individually depicted for different RHIs and ipSIC parameters in case of $\mu=0.2$, $\sigma_{e,SR}^2=\sigma_{e,l}^2=0$, ($N_2=2$; $N_D=2$), ($m_{SR}=2$; $m_{LI}=1$; $m_{RU}=2$) configurations. It is obvious that the first user is not effected by ipSIC since it does not perform SIC cancellation. However, RHIs seriously deteriorate the performance of all users. In addition, ($\kappa_{SR}=0.14$; $\kappa_{RU}=0$) and ($\kappa_{SR}=0$; $\kappa_{RU}=0.14$) configurations exhibit the same OP performance, thus RHIs in the first and second hops have the same effect on the system performance. From results of the second user, for an OP value of $10^{-4}$, difference between $\sigma_{ipsic}^2=0.03$ and $\sigma_{ipsic}^2=0$ is approximately $15$ dB in case of ($\kappa_{SR}=0.14$; $\kappa_{RU}=0.14$), while $3$ dB in case of ($\kappa_{SR}=0.14$; $\kappa_{RU}=0$). Similar results can be obtained for the third user. This observation reveals that RHIs effect the performance more than ipSIC. \begin{figure}[!b] \centering \includegraphics[width=0.70\columnwidth]{Fig_7.pdf} \caption{OP comparisons of the investigated FD-NOMA system with HD-NOMA counterpart versus $\mu$ in case fixed $SNR=15$ dB and different number of antenna and RHIs parameters.} \label{fig:7} \vspace{-2 mm} \end{figure} Fig. 7 represents OP comparisons of FD-NOMA (investigated) and HD-NOMA systems versus the quality of LI cancellation parameter $\mu$ in case fixed $SNR=15$ dB, $\sigma_{e,SR}^2=\sigma_{e,l}^2=0$, $\sigma_{ipsic}^2=0$, $m_{SR}=m_{LI}=m_{RU}=1$ and different RHIs parameters. In the figure, case-1:($N_S=2$;$N_D=2$), case-2:($N_S=3$;$N_D=2$), $\kappa_1$:($\kappa_{SR}=\kappa_{RU}=0$) and $\kappa_2$:($\kappa_{SR}=\kappa_{RU}=0.14$) definitions are made for simplicity. For fair comparison, threshold SIDNRs have the following relationship $\frac{1}{2}\log_2(1+\gamma_{th,l}^{HD})=\log_2(1+\gamma_{th,l}^{FD})$. Also, we set threshold SIDNRs of HD-NOMA as $\gamma_{th,1}^{HD}=0.9$, $\gamma_{th,2}^{HD}=1.5$ and $\gamma_{th,3}^{HD}=2$ to ensure satisfying the condition of $a_j$-$\gamma_{th,j}(\xi_j+\tilde{\xi}_j+\vartheta_1)>0$. As clearly seen from curves of the first user, FD-NOMA is better than HD-NOMA at the most of values $\mu$, however performance gap between them decreases as the quality of LI cancellation gets worse. On the other hand, according to the second and third users, FD-NOMA outperforms HD-NOMA when the value of $\mu$ is below $0.49$ and $0.26$ for the configuration of (case-1,$\kappa_1$), respectively. Moreover, in the presence of RHIs ($\kappa_2$), FD-NOMA is better than HD-NOMA when $\mu\leq0.9$ and $\mu\leq0.65$ for the second and third users. Consequently, the quality of LI cancellation under effect of RHIs can be worse than that of ideal HIs case for which FD-NOMA outperforms HD-NOMA. Fig. 8 illustrates the OP performance of the investigated system versus RHIs parameters ($\kappa_{SR}=\kappa_{RU}$) for different effects of CEEs and ipSIC in case of fixed $SNR=15$ dB, $N_S=N_D=2$, $\mu=0.2$ and $m_{SR}=m_{LI}=m_{RU}=1$. For the figure to be better understandable, configurations are categorized into $5$ cases as following case-1:($\sigma_{e,SR}^2=0.03$; $\sigma_{ipsic}^2=0$; $\sigma_{e,l}^2=0.03$), case-2:($\sigma_{e,SR}^2=0.03$; $\sigma_{ipsic}^2=0$; $\sigma_{e,l}^2=0$), case-3:($\sigma_{e,SR}^2=0$; $\sigma_{ipsic}^2=0$; $\sigma_{e,l}^2=0.03$), case-4:($\sigma_{e,SR}^2=0$; $\sigma_{ipsic}^2=0.03$; $\sigma_{e,l}^2=0$) and case-5:($\sigma_{e,SR}^2=0$; $\sigma_{ipsic}^2=0$; $\sigma_{e,l}^2=0$). As clearly seen from the results of all users, OP performances get worse as the effect of RHIs increase, even OPs equal to $1$ under heavy RHIs effect. According to the first user, CEEs in the second hop worsen the performance more than that of in the first hop. However, in terms of the second and third users, CEEs in the first hop are much more effective than that of in the second hop. Moreover, ipSIC deteriorates the performance much more than CEEs in both hops for the second and third users. \begin{figure}[!t] \centering \includegraphics[width=0.76\columnwidth]{Fig_8.pdf} \caption{OP of users versus RHIs parameter $\kappa_{SR}=\kappa_{RU}$ in case of $\mu=0.2$, fixed $SNR=15$ dB and different CEEs and ipSIC configurations.} \label{fig:8} \vspace{-2 mm} \end{figure} \begin{figure}[!t] \centering \includegraphics[width=0.68\columnwidth]{Fig_9.pdf} \caption{OP comparisons of the investigated FD-NOMA system with FD-OMA counterpart versus $d_{SR}$ in case of $\mu=0.2$, fixed $SNR=15$ dB, different fading and RHIs parameters, and number of antenna configurations.} \label{fig:9} \vspace{-2 mm} \end{figure} Fig. 9 depicts OP performance of the investigated system versus distances between the BS and relay ($d_{SR}$) in case of fixed $SNR=15$ dB and $\sigma_{e,SR}^2=\sigma_{e,l}^2=\sigma_{ipsic}^2=0$. The normalized distances in $R-U_l$ links are determined by $d_{RU_l}=1-d_{SR}$. In Fig. 9 (a), $\kappa_1$:($\kappa_{SR}=\kappa_{RU}=0.1$), $\kappa_2$:($\kappa_{SR}=\kappa_{RU}=0$), case-1:($N_S=2$;$N_D=1$, $m_{SR}=m_{LI}=m_{RU}=1$), case-2:($N_S=2$;$N_D=2$, $m_{SR}=2$;$m_{LI}=1$;$m_{RU}=1$). Also, Fig. 9 (b) is obtained for $\kappa_{SR}=\kappa_{RU}=0.1$, $m_{SR}=m_{LI}=m_{RU}=1$ and $\log_2(1+\gamma_{th}^{OMA})=\sum_{l=1}^{L}\log_2(1+\gamma_{th,l})$ relation is used to obtain OMA curves. From Fig. 9 (a), RHIs have the same level of effect on the performance at all values of distances for all users. It is observed that minimum OP can be achieved when $d_{SR}< d_{RU_l}$ for the second and third users while $d_{SR}\geq d_{RU_l}$ for the first user since optimum location of the relay has a close relation with diversity order and array gain which are also provided in asymptotic analyses. On the other hand, from Fig. 9 (b), FD-NOMA outperforms FD-OMA when the relay is close to the BS for the second and third users while FD-OMA is better at all values of $d_{SR}$ for the first user. \section{Conclusion} This paper analyzed the performance of MRT/MRC scheme in dual-hop NOMA FD AF relay networks over Nakagami-$m$ fading channels by considering the effects of RHIs. In addition, CEEs and ipSIC were also taken into account in order for the system be more realistic. For performance criterion, exact OP for any user was derived together with tight lower bound and asymptotic expressions. Numerical results demonstrated that performance of the investigated FD-NOMA system is strictly limited by error floor in the high SNR region, even all users are exposed to the same level, if LI cancellation can not be exploited. However, performance can be improved by increasing the number of antennas. On the other hand, all users can enjoy benefits of diversity order and array gain thanks to the quality of LI cancellation. Furthermore, our analysis revealed that the MRT beamforming is better than MRC on the performance improvement of users with lower power allocations than user with the highest power allocation. However, in case of CEEs, performance behavior trade-off between MRT and MRC schemes depends on imperfect channel conditions in both hops. Besides CEEs and imperfect LI cancellation, RHIs seriously deteriorate the performance, such that it is much more effective for the second and third users relative to the first user, while it has no effect on diversity order. On the other hand, under RHIs effect, LI cancellation process does not need to have very high quality when compared to ideal HIs case such that FD-NOMA outperforms HD-NOMA. It was also observed that imperfections which have the most and least deterioration effect on the performance are RHIs and CEEs, respectively. Furthermore, the minimum OP can be achieved with optimum relay location which has a close relation with diversity order and array gain, such that FD-NOMA outperforms FD-OMA when the relay is close to the BS for users with lower power allocations.
\section{Introduction} In a series of studies Duffin, Kemmer, and Petiau put forward a first order differential equation, hereafter (DKPe), to describe the dynamics mesons \cite{Petiau1936, Kemmer_1938, Kemmer_1939, PhysRev.54.1114}. Although the DKPe presents similarities to the Dirac's equation, its matrices obey a different and more complex commutation rule schemes. Until the 1970s, DKP formalism developed \cite{Kinoshita_1950} with increasing doubts over the DKPe's relationships with the Klein-Gordon (KG) and Proca equations \cite% {Pimentel_2000}. Between 1970 and 1980, interest in the DKPe waned, believing that DKPe was equivalent to the KG and Proca equations \cite% {Boumali_et_al_2013}. After showing that the equivalence is valid only in the special case where symmetry exists \cite{Krajcik_1977}, interest in the solutions of the DKPe has increased in the last decades. The DKPe with different types of couplings is used in a wide area of physics. For example in the modelling of the: meson scattering by nuclei \cite{CLARK1998231}, large and short distance interactions in quantum chromodynamics \cite{Gribov_1999}, boson dynamics in curved space-time \cite% {Castro_2015, Hun2019}, covariant Hamilton dynamics \cite{KANATCHIKOV2000107}% , non-inertial effect of rotating frames \cite{Castro_2016}, Galilei covariance \cite{Montigny_2000}, the Aharanov-Bohm phenomenon \cite% {Houcine_et_al_2019, Boumali_et_al_2020}, dynamics of vector bosons in the expanding universe \cite{Sucu2005}, commutative and noncommutative spaces \cite{Boumali_et_al_2018, Falek_2008}, thermodynamic properties of bosons \cite{ doi.org/10.1140/epjp/i2013-13124-y, Aounallah_et_al_2020}, Bose-Einstein condensation \cite{CASANA200333, ABREU2015612} and etc... It is a well-known fact that the nonminimal vector couplings to the KG and Proca equations produce results that contradict the predictions of the non-relativistic quantum mechanics \cite{PhysRevD.15.1518, Vijayalakshmi_1979, cardoso_estados_2008, DEOLIVEIRA2016320}. With a nonminimal vector coupling, one refers to a sort of charge conjugate invariant coupling which transforms like a vector under a Lorentz transformation. If the nonminimal vector potential is invariant under charge conjugation, then, one can not discriminate the particle from its antiparticle \cite{Castro_et_al_2014}. Since the DKPe, unlike from KG and Proca equations, allows the nonminimal couplings, it is extensively examined by considering several Lorentz structures \cite{PhysRevC.40.2181, PhysRevC.50.2624, AITTAHAR1995307, BARRETT1995311, doi:10.1063/1.3494292, Cardoso_2010}, and potential energies \cite{doi:10.1142/S0217732312502288, hassanabadi_duffinkemmerpetiau_2013, Molaee_2013, hhassanabadi_dkp_2013, BAHAR2014105, doi:10.1142/S0218301314500074}. On the other hand, various researches regarding the quantum gravity \cite% {Veneziano_1986, AMATI198781} and cosmology \cite{Bosso_2020}, string theory \cite{SCARDIGLI199939, Scardigli_2003}, noncommutative geometry \cite% {MAGGIORE199383}, black hole physics \cite{XIANG2018334} and thermodynamics \cite{Saghafi_2017} show that a minimal observable length should exist.This minimal length (ML) may be introduced as an additional uncertainty in position measurements $\Delta x_{\min }$, which leads to a generalization of Heisenberg's uncertainty principle. Kempf with his collaborators \cite% {doi:10.1063/1.530798, PhysRevD.52.1108, doi:10.1063/1.531501, Kempf_1997}, showed that a ML can be obtained out of the generalized Heisenberg algebra with the form% \begin{equation} \left[ X_{i},P_{j}\right] =i\hbar \delta _{ij}\left( 1+\alpha P^{2}\right) ;% \text{ \ }\left[ X_{i},X_{j}\right] =i\hbar \alpha J_{ij}, \end{equation} where $\alpha $ is the parameter of deformation. It is worth mentioning that the deformed algebra leading to quantized space time was introduced for first time by Snyder \cite{Snyder}. It is well known that the curvature of space-time becomes important at great distances. On a general curved space-time, there is no concept of a plane wave. This implies that there is a finite lower bound to the precision with which the corresponding momentum can be described. This can be represented with a nonzero minimal uncertainty in momentum (MUM) measurement. It has been argued in \cite{bolen_anti-sitter_2005} that in the presence of a cosmological constant the Heisenberg uncertainty principle receives a correction term due to the background curvature, which is known as the "extended uncertainty principle" (EUP),% \begin{equation} \left( \Delta X_{i}\right) \left( \Delta P_{j}\right) \geq \frac{\hbar \delta _{ij}}{2}\left( 1+\alpha \left( \Delta X_{i}\right) ^{2}\right) , \label{eup1} \end{equation}% where the deformation parameter is proportional to the cosmological constant. It is obvious that Eq. \eqref{eup1} yields a nonzero minimal uncertainty in momentum as $ \left( \Delta P\right) _{\min }=\frac{\hbar \sqrt{\alpha }}{2}$. Recently, Mignemi showed that one can derive Eq. \eqref{eup1} from the definition of the quantum mechanics on the anti-de Sitter spacetime \cite{Mignemi2010}. Moreover, in that case, he stated that the modified Heisenberg algebra corresponding to the EUP as follows: \begin{equation} \left[ X_{i},P_{j}\right] =i\hbar \left( \delta _{ij}+\alpha X_{i}X_{j}\right) ;\text{ }\left[ X_{i},X_{j}\right] =0;\text{ }\left[ P_{i},P_{j}\right] =i\hbar \alpha L_{ij}. \label{eup2} \end{equation} Here, $L_{ij}$ is the angular momenta while $i,j=1,2,3$. In the position space, one particular explicit representation of the position and momentum operators that obeys Eq.~\eqref{eup2} is given with \begin{subequations} \label{ops} \begin{eqnarray} X_{i} &=&\frac{x_{i}}{\sqrt{1-\alpha r^{2}}}, \label{opx} \\ P_{i} &=&-i\hbar \sqrt{1-\alpha r^{2}}\frac{\partial }{\partial x_{i}}; \label{opp} \end{eqnarray} \end{subequations} It is worth noting that as a consequence of the deformation of the usual algebra the conventional inner product definition is needed to be modified with \cite{Hamil_Merad_Birkandan_2020} \begin{equation} \langle \psi |\phi \rangle =\int \frac{d^{3}r}{\sqrt{1-\alpha r^{2}}}\psi ^{+}\phi . \end{equation} In the last decades by considering modifications to the momentum and position operators the extension of the Heisenberg algebra is being examined extensively \cite{doi:10.1142/S0217732312500800, PhysRevD.85.024016, doi.org/10.1140/epjp/i2013-13025-1, Ikot:2015kla, doi.org/10.1140/epjp/i2017-11353-8, hamil_dirac_2018, doi.org/10.1140/epjc/s10052-019-7463-3, doi.org/10.1140/epjc/s10052-019-6718-3, MagrefId0, Hamil_Merad_Birkandan_2020, BclEPL2020, farahani_dsr-gup_2020}. However, to the best of our knowledge, the rich structure of the DKPe due to non-minimum vector coupling has not been studied with a ML. Our purpose in this study is to consider the spin-one DKPe with a nonminimal vector interaction in the presence of the MUM. The structure of the manuscript is constructed as follows: In section \ref{sec2} we briefly introduce the DKP formalism and discuss the nonminimal coupling vector interaction. In section \ref{sec3} we study the effect of the MUM on the spectrum of spin-one particles in the presence of a nonminimal vector linear potential in $(3 +1)$ dimensional. In the final section, we give our conclusion. \section{The DKP Equation} \label{sec2} In the case of non-interacting scalar and vector bosons the DKPe is defined with the natural units, $(\hbar=c=1)$, as follows: \begin{eqnarray} \left[i\beta^\sigma\partial_\sigma-m\right]\Psi(\vec{r},t)=0, \qquad% \mbox{where}\qquad \sigma=0,1,2,3. \label{freeDKP} \end{eqnarray} Here, $m$ is the mass of the spin-one particle. The DKP matrices, $% \beta^\sigma$, satisfy the following DKP algebra \begin{eqnarray} \beta^{\sigma}\beta^{\kappa}\beta^{\lambda}+\beta^{\lambda}\beta^{\kappa}% \beta^{\sigma}=g^{\sigma\kappa}\beta^{\lambda}+g^{\kappa\lambda}\beta^{% \sigma}. \label{DKPalgebra} \end{eqnarray} where $g^{\sigma\kappa}=diag(1,-1,-1,-1)$ is the metric tensor of the Minkowski space-time while $(g^{\sigma\kappa})^2=1$. In the spin-one sector, the irreducible DKP matrices are given with $10 \times 10 $ matrix sets. In this manuscript, we employ the following DKP matrices: \begin{eqnarray} \label{betamat} \beta^{0}=\left(% \begin{array}{cccc} 0 & \mathbf{\check{0}}_{1\times3} & \mathbf{\check{0}}_{1\times3} & \mathbf{% \check{0}}_{1\times3} \\ \mathbf{\check{0}}^{T}_{3\times1} & \mathbf{\overline{0}}_{3\times3} & \mathbf{I}_{3\times3} & \mathbf{\overline{0}}_{3\times3} \\ \mathbf{\check{0}}^{T}_{3\times1} & \mathbf{I}_{3\times3} & \mathbf{% \overline{0}}_{3\times3} & \mathbf{\overline{0}}_{3\times3} \\ \mathbf{\check{0}}^{T}_{3\times1} & \mathbf{\overline{0}}_{3\times3} & \mathbf{\overline{0}}_{3\times3} & \mathbf{\overline{0}}_{3\times3}% \end{array}% \right), \qquad \beta^{k}=\left(% \begin{array}{cccc} 0 & \mathbf{\check{0}}_{1\times3} & \mathbf{u}^{j}_{1\times3} & \mathbf{% \check{0}}_{1\times3} \\ \mathbf{\check{0}}^{T}_{3\times1} & \mathbf{\overline{0}}_{3\times3} & \mathbf{\overline{0}}_{3\times3} & -i\mathbf{S}^{j}_{3\times3} \\ -\mathbf{u}^{j^{T}}_{3\times1} & \mathbf{\overline{0}}_{3\times3} & \mathbf{% \overline{0}}_{3\times3} & \mathbf{\overline{0}}_{3\times3} \\ \mathbf{\check{0}}^{T}_{3\times1} & -i\mathbf{S}_{3\times3}^{j} & \mathbf{% \overline{0}}_{3\times3} & \mathbf{\overline{0}}_{3\times3}% \end{array}% \right), \end{eqnarray} where $j=1,2,3 $, \begin{equation} \begin{array}{cc} \mathbf{\check{0}}_{1 \times 3}=\left(% \begin{array}{ccc} 0 & 0 & 0% \end{array}% \right), & \mathbf{I}_{3\times3}=% \end{array}% \left(% \begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ 0 & 0 & 1% \end{array}% \right), \end{equation}% \begin{equation} \begin{array}{ccc} \mathbf{u}^{1}_{1 \times 3}=\left(% \begin{array}{ccc} 1 & 0 & 0% \end{array}% \right), & \mathbf{u}^{2}_{1 \times 3}=\left(% \begin{array}{ccc} 0 & 1 & 0% \end{array}% \right), & \mathbf{u}^{3}_{1 \times 3}=\left(% \begin{array}{ccc} 0 & 0 & 1% \end{array}% \right),% \end{array}.% \end{equation}% $\mathbf{S}_{3\times3}^{j}$ are the usual spin-one matrices as given \begin{equation} \begin{array}{ccc} \mathbf{S}^{1}_{3\times3}=i\left(% \begin{array}{ccc} 0 & 0 & 0 \\ 0 & 0 & -1 \\ 0 & 1 & 0% \end{array}% \right), & \mathbf{S}^{2}_{3\times3}=i\left(% \begin{array}{ccc} 0 & 0 & 1 \\ 0 & 0 & 0 \\ -1 & 0 & 0% \end{array}% \right), & \mathbf{S}^{3}_{3\times3}=i\left(% \begin{array}{ccc} 0 & -1 & 0 \\ 1 & 0 & 0 \\ 0 & 0 & 0% \end{array}% \right),% \end{array}% \end{equation}% When the interactions are taken into account the DKPe is defined with \begin{eqnarray} \left[i\beta^\sigma\partial_\sigma-m-U\right]\Psi(\vec{r},t)=0, \qquad% \mbox{where}\qquad \sigma=0,1,2,3. \label{InteractingDKP} \end{eqnarray} with the natural units. Here, $U$ is the general potential energy matrix that can be expressed with $100$ irreducible matrices in the spin-one sector. In this case, the four-current, $J^\mu$, satisfies \begin{eqnarray} \partial_\mu J^\mu+ \frac{i\overline{\Psi}}{2}\left(U-\eta^0 U^\dagger \eta^0\right)\Psi=0, \end{eqnarray} where $\overline{\Psi}=\Psi^\dagger \eta^0 $. Note that, the four-current is conserved when $U$ is Hermitian with respect to $\eta^0$, \cite% {Castro_et_al_2014}. In the spin-one sector the potential energy matrices can be constructed by well-defined Lorentz structures such as two-vector, two-scalar, two pseudo-vector, a pseudo-scalar, and eight tensor terms. However, in applications tensor terms are discarded since they issue non-causal effects \cite{Vijayalakshmi_1979}. In this manuscript we consider a non-minimal vector interaction in the form of \begin{eqnarray} U&=&i \big[P,\beta^\mu \big]A_\mu. \end{eqnarray} Here, $P$ denotes the projection operator, thus, $P^2=P$ and $P^\dagger=P$. It is worth noting that the considered potential energy matrices behaves as a vector under the Lorentz transformation \cite{Castro_et_al_2014}. By choosing the potential energy matrix in this way, it is shown that four currents are conserved \cite{Castro_et_al_2014}. In this manuscript, we consider a time-independent potential energy, therefore we assume the spin-one wave function can be expressed in the form of \begin{equation*} \Psi (\vec{r},t)=\psi (\vec{r})e^{-iEt}. \end{equation*}% Here, $E$ is the energy of the spin-one boson particle. Then, Eq. % \eqref{InteractingDKP} reduces to \begin{equation} \left[ \beta ^{0}E+\overrightarrow{\beta }.\overrightarrow{P}-m-i\left[ P,\beta ^{\mu }\right] A_{\mu }\right] \psi (\vec{r})=0. \label{eqA} \end{equation} \section{DKP equation in the presence of minimum uncertainty in momentum} \label{sec3} In this section, we examine the dynamics of a vector boson by solving the DKPe in the presence of ML by considering a nonminimal vector coupling. We take the wave function in the form of \cite% {Hassanabadi_Molaee_Ghominejad_Zarrinkamar_2012} \begin{equation} \begin{array}{c} \psi (\vec{r})=\left( \begin{array}{c} i\phi \\ \overrightarrow{F} \\ \overrightarrow{G} \\ \overrightarrow{H}% \end{array}% \right) ,% \end{array}% \end{equation}% where $\phi $ is a scalar function, and \begin{equation} \begin{array}{ccc} \overrightarrow{F}=\left( \begin{array}{c} \varphi _{2} \\ \varphi _{3} \\ \varphi _{4}% \end{array}% \right) , & \overrightarrow{G}=\left( \begin{array}{c} \varphi _{5} \\ \varphi _{6} \\ \varphi _{7}% \end{array}% \right) , & \overrightarrow{H}=\left( \begin{array}{c} \varphi _{8} \\ \varphi _{9} \\ \varphi _{10}% \end{array}% \right) .% \end{array}% \end{equation}% We consider the parity operator as $P=\beta ^{\mu }\beta _{\mu }-2$. By using the chosen representation, which is given in Eq. \eqref{betamat}, we obtain the parity operator matrix as \begin{equation} P=diag\left( \begin{array}{cccccccccc} 1 & 1 & 1 & 1 & 0 & 0 & 0 & 0 & 0 & 0% \end{array}% \right) . \end{equation}% We employ the position and momentum operators that are given in Eq. % \eqref{ops} by considering the assumption of the presence of the ML. Then, we derive a compact form of the time-independent DKPe out of Eq. \eqref{eqA} \begin{subequations} \begin{eqnarray} i\sqrt{1-\alpha r^{2}}\left( \overrightarrow{\nabla }-\frac{\overrightarrow{A% }}{\sqrt{1-\alpha r^{2}}}\right) \times \overrightarrow{F} &=&m% \overrightarrow{H}, \label{DKP1a} \\ \sqrt{1-\alpha r^{2}}\left( \overrightarrow{\nabla }+\frac{\overrightarrow{A}% }{\sqrt{1-\alpha r^{2}}}\right) .\overrightarrow{G} &=&m\phi , \label{DKP1b} \\ i\sqrt{1-\alpha r^{2}}\left( \overrightarrow{\nabla }+\frac{\overrightarrow{A% }}{\sqrt{1-\alpha r^{2}}}\right) \times \overrightarrow{H} &=&m% \overrightarrow{F}-\left( E-iA_{0}\right) \overrightarrow{G}, \label{DKP1c} \\ \sqrt{1-\alpha r^{2}}\left( \overrightarrow{\nabla }-\frac{\overrightarrow{A}% }{\sqrt{1-\alpha r^{2}}}\right) \phi &=&m\overrightarrow{G}-\left( E+iA_{0}\right) \overrightarrow{F}. \label{DKP1d} \end{eqnarray}% In order to solve these coupled equations we follow \cite% {doi:10.1063/1.530801}, and assume that wave function components have the form of \end{subequations} \begin{subequations} \begin{eqnarray} \phi &=&\frac{\varphi(r)}{r}Y_{JM}(\theta ,\phi ) \label{wf1a} \\ \overrightarrow{F} &=&\sum_{L}\frac{F_{nJL}(r)}{r}Y_{JL1}^{M}(\theta ,\phi ) \label{wf1b} \\ \overrightarrow{G} &=&\sum_{L}\frac{G_{nJL}(r)}{r}Y_{JL1}^{M}(\theta ,\phi ) \label{wf1c} \\ \overrightarrow{H} &=&\sum_{L}\frac{H_{nJL}(r)}{r}Y_{JL1}^{M}(\theta ,\phi ), \label{wf1d} \end{eqnarray}% where $Y_{JM}(\theta ,\phi )$ is the spherical harmonics of order $J$, $% Y_{JL1}^{M}(\theta ,\phi )$ are the vector spherical harmonics, and $\varPhi% _{nJ}(r)$, $F_{nJL}(r)$, $G_{nJL}(r)$, and $H_{nJL}(r)$ are unnormalized radial wave functions. In this manuscript, we examine a spherical symmetric vector potential in the form of \end{subequations} \begin{equation} \overrightarrow{A}=\frac{A_{r}(r)}{r}\overrightarrow{r}. \end{equation}% Then, by using the properties of vector spherical harmonics \cite% {AITTAHAR1995307, BARRETT1995311, doi:10.1063/1.3494292}, we obtain the following radial differential equations: \begin{eqnarray} \sqrt{1-\alpha r^{2}}\zeta _{J}\left( \frac{d}{dr}-\frac{J+1}{r}-\frac{A_{r}% }{\sqrt{1-\alpha r^{2}}}\right) F_{0} &=&-mH_{+1}, \label{eq01} \\ \sqrt{1-\alpha r^{2}}\xi _{J}\left( \frac{d}{dr}+\frac{J}{r}-\frac{A_{r}}{% \sqrt{1-\alpha r^{2}}}\right) F_{0} &=&-mH_{-1}, \label{eq02} \\ \sqrt{1-\alpha r^{2}}\left[ \zeta _{J}\left( \frac{d}{dr}+\frac{J+1}{r}-% \frac{A_{r}}{\sqrt{1-\alpha r^{2}}}\right) F_{+1}+\xi _{J}\left( \frac{d}{dr}% -\frac{J}{r}-\frac{A_{r}}{\sqrt{1-\alpha r^{2}}}\right) F_{-1}\right] &=&-mH_{0}, \label{eq03} \\ \sqrt{1-\alpha r^{2}}\left[ -\xi _{J}\left( \frac{d}{dr}+\frac{J+1}{r}+\frac{% A_{r}}{\sqrt{1-\alpha r^{2}}}\right) G_{+1}+\zeta _{J}\left( \frac{d}{dr}-% \frac{J}{r}+\frac{A_{r}}{\sqrt{1-\alpha r^{2}}}\right) G_{-1}\right] &=&m\varphi , \label{eq04} \\ -\sqrt{1-\alpha r^{2}}\zeta _{J}\left( \frac{d}{dr}-\frac{J+1}{r}+\frac{A_{r}% }{\sqrt{1-\alpha r^{2}}}\right) H_{0}+\left( E-iA_{0}\right) G_{+1} &=&mF_{+1}, \label{eq05} \\ -\sqrt{1-\alpha r^{2}}\xi _{J}\left( \frac{d}{dr}+\frac{J}{r}+\frac{A_{r}}{% \sqrt{1-\alpha r^{2}}}\right) H_{0}+\left( E-iA_{0}\right) G_{-1} &=&mF_{-1}, \label{eq06} \\ -\sqrt{1-\alpha r^{2}}\left[ \zeta _{J}\left( \frac{d}{dr}+\frac{J+1}{r}+% \frac{A_{r}}{\sqrt{1-\alpha r^{2}}}\right) H_{+1}+\xi _{J}\left( \frac{d}{dr}% -\frac{J}{r}+\frac{A_{r}}{\sqrt{1-\alpha r^{2}}}\right) H_{-1}\right] +\left( E-iA_{0}\right) G_{0} &=&mF_{0}, \label{eq07} \\ \left( E+iA_{0}\right) F_{0} &=&mG_{0}, \label{eq08} \\ -\sqrt{1-\alpha r^{2}}\xi _{J}\left( \frac{d}{dr}-\frac{J-1}{r}-\frac{A_{r}}{% \sqrt{1-\alpha r^{2}}}\right) \varphi +\left( E+iA_{0}\right) F_{+1} &=&mG_{+1}, \label{eq09} \\ \sqrt{1-\alpha r^{2}}\zeta _{J}\left( \frac{d}{dr}+\frac{J}{r}-\frac{A_{r}}{% \sqrt{1-\alpha r^{2}}}\right) \varphi +\left( E+iA_{0}\right) F_{-1} &=&mG_{-1}. \label{eq10} \end{eqnarray}% where \begin{equation*} \xi _{J}=\sqrt{\frac{J+1}{2J+1}},\qquad \zeta _{J}=\sqrt{\frac{J}{2J+1}}. \end{equation*}% Nedjadi \emph{et al.}, in \cite{doi:10.1063/1.530801}, presented a procedure to decouple ten-coupled differential equations into two classes of coupled differential equation sets by taking the parity into account. We follow their procedure and consider Eqs. \eqref{eq01}, \eqref{eq02}, \eqref{eq07}, and \eqref{eq08} for the natural parity states which relates $F_{0}$, $G_{0}$% , $H_{+1}$ and $H_{-1}$ functions. We take $\varphi $, $H_{0}$,$F_{+1}$, $% F_{-1}$, $G_{+1}$, and $G_{-1}$ functions as zero. On the other hand, for the unnatural parity states, we examine Eqs. \eqref{eq03}, \eqref{eq04}, % \eqref{eq05}, \eqref{eq06}, \eqref{eq09}, and \eqref{eq10} that associate $% F_{+1}$, $F_{-1}$, $G_{+1}$, $G_{-1}$, $H_{0}$, and $\varphi $ functions, while we assume $F_{0}$, $G_{0}$, $H_{+1}$ and $H_{-1}$, thus, Eqs. % \eqref{eq01}, \eqref{eq02}, \eqref{eq07}, and \eqref{eq08} are zero. \subsection{$\left(-1\right)^{J}$ parity states} In this subsection we obtain the energy eigenvalue function for the natural parity states. From Eqs. \eqref{eq01}, \eqref{eq02}, and \eqref{eq08} we find $H_{+1}$, $H_{-1}$, $G_{0}$ in terms of $F_{0}$. Then, we employ them in Eq. \eqref{eq07}. After a little algebra we find \begin{equation} \bigg[\left( 1-\alpha r^{2}\right) \left( \frac{d^{2}}{dr^{2}}-\frac{J\left( J+1\right) }{r^{2}}-\frac{d}{dr}\frac{A_{r}}{\sqrt{1-\alpha r^{2}}}-\frac{% A_{r}^{2}}{1-\alpha r^{2}}\right) -\alpha r\left( \frac{d}{dr}-\frac{A_{r}}{% \sqrt{1-\alpha r^{2}}}\right) +\left( E^{2}+A_{0}^{2}-m^{2}\right) \bigg]% F_{0}=0.\,\,\,\, \label{eqf02} \end{equation}% Then, we consider a vector potential energy with the following components: \begin{eqnarray} A_{0} &=&\lambda _{0}\frac{r}{\sqrt{1-\alpha r^{2}}}, \label{A0} \\ A_{r} &=&\lambda _{r}\frac{r}{\sqrt{1-\alpha r^{2}}}, \label{Ar} \end{eqnarray}% where $\lambda _{0}$ and $\lambda _{r}$ are coupling constants that obey $\lambda _{r}\geq \lambda _{0}$ condition. By employing the vector potential components in Eq. \eqref{eqf02}, we arrive at \begin{equation} \bigg[\left( \sqrt{1-\alpha r^{2}}\frac{d}{dr}\right) ^{2}-\left( 1-\alpha r^{2}\right) \frac{J\left( J+1\right) }{r^{2}}-\frac{\lambda _{r}}{1-\alpha r^{2}}-\frac{\left( \lambda _{r}^{2}-\lambda _{0}^{2}\right) r^{2}}{1-\alpha r^{2}}+E^{2}-m^{2}\bigg]F_{0}=0. \end{equation}% Next, we introduce a new variable $\rho $ via the coordinate transformation $% \rho =\alpha r^{2}$. We obtain \begin{equation} \left[ \left( 1-\rho \right) \rho \frac{d^{2}}{d\rho ^{2}}+\left( \frac{1}{2}% -\rho \right) \frac{d}{d\rho }-\frac{J\left( J+1\right) }{4\rho }-\frac{1}{4}% \frac{\left( \frac{\lambda _{r}^{2}}{\alpha ^{2}}+\frac{\lambda _{r}}{\alpha }-\frac{\lambda _{0}^{2}}{\alpha ^{2}}\right) }{1-\rho }+\frac{E^{2}-m^{2}}{% 4\alpha }+\frac{J\left( J+1\right) }{4}+\frac{\lambda _{r}^{2}-\lambda _{0}^{2}}{4\alpha ^{2}}\right] F_{0}=0. \label{eqf055} \end{equation}% For the general solution, we follow an Ansatz as \begin{equation} F_{0}=\rho ^{a}\left( 1-\rho \right) ^{b}\varXi(\rho ). \label{coz} \end{equation}% Then, we reach \begin{equation} \Bigg[\left( 1-\rho \right) \rho \frac{d^{2}}{d\rho ^{2}}+\left( \frac{1}{2}% +2a-\left( 1+2a+2b\right) \rho \right) \frac{d}{d\rho }+\frac{v_{1}}{\rho }+% \frac{v_{2}}{1-\rho }-u\Bigg]\varXi(\rho )=0, \label{eqf05} \end{equation}% where \begin{eqnarray} v_{1} &=&a\left( a-\frac{1}{2}\right) -\frac{J\left( J+1\right) }{4}, \\ v_{2} &=&b\left( b-\frac{1}{2}\right) -\frac{1}{4}\left( \frac{\lambda _{r}^{2}}{\alpha ^{2}}+\frac{\lambda _{r}}{\alpha }-\frac{\lambda _{0}^{2}}{% \alpha ^{2}}\right) , \\ u &=&\left( a+b\right) ^{2}-\frac{E^{2}-m^{2}}{4\alpha }-\frac{J\left( J+1\right) }{4}-\frac{\lambda _{r}^{2}-\lambda _{0}^{2}}{4\alpha ^{2}}. \end{eqnarray}% For the roots \begin{subequations} \begin{eqnarray} a &=&\frac{J+1}{2}, \\ b &=&\frac{1}{4}+\frac{1}{4}\sqrt{1+4\bigg[\frac{\lambda _{r}}{\alpha }% \left( \frac{\lambda _{r}}{\alpha }+1\right) -\frac{\lambda _{0}^{2}}{\alpha ^{2}}\bigg]}, \end{eqnarray}% $v_{1}$ and $v_{2}$ vanish. Therefore, Eq. \eqref{eqf05} reduces to the hypergeometric differential equation \end{subequations} \begin{equation*} \left[ \rho \left( 1-\rho \right) \frac{d^{2}}{d\rho ^{2}}+\Big(C-\left( 1+A+B\right) \rho \Big)\frac{d}{d\rho }-AB\right] \varXi(\rho )=0, \end{equation*}% where \begin{equation*} \varXi=N_{1}\times {}_{2}F_{1}\left( A;B;C;\rho \right). \end{equation*}% Here, $N_{1}$ is the normalization constant, and \begin{subequations} \begin{eqnarray} A &=&a+b+\sqrt{\frac{E^{2}-m^{2}}{4\alpha }+\frac{J\left( J+1\right) }{4}+% \frac{\lambda _{r}^{2}-\lambda _{0}^{2}}{4\alpha ^{2}}}, \\ B &=&a+b-\sqrt{\frac{E^{2}-m^{2}}{4\alpha }+\frac{J\left( J+1\right) }{4}+% \frac{\lambda _{r}^{2}-\lambda _{0}^{2}}{4\alpha ^{2}}}, \\ C &=&\frac{1}{2}+2a. \end{eqnarray}% \end{subequations} We want to emphasize that to obtain a nonsingular solution, we do not consider the second solution of the hypergeometric differential equation by equating its normalization constant to zero. After that for the quantization, we use the well-known condition \begin{equation} B=-n \label{quan} \end{equation}% which yields to \begin{equation} E_{n;J}=\pm \sqrt{m^{2}+4\alpha \left( n+\frac{2J+3}{4}+\frac{1}{4}\sqrt{1+4% \bigg[\frac{\lambda _{r}}{\alpha }\left( \frac{\lambda _{r}}{\alpha }% +1\right) -\frac{\lambda _{0}^{2}}{\alpha ^{2}}\bigg]}\right) ^{2}-\alpha J\left( J+1\right) -\frac{\left( \lambda _{r}^{2}-\lambda _{0}^{2}\right) }{% \alpha }}. \label{En1} \end{equation} We see that the energy eigenvalue expression contains an additional correction term which depends on the deformation $\alpha $. It is worth noting that the presence of a correction term proportional to $n^{2}$ indicates the appearance of hard confinement due to the deformation. This is similar to the energy eigenvalue function of a particle in a square well potential whose boundaries are placed at $\pm \frac{\pi}{2\sqrt{\alpha }}$. The second correction term is proportional to $J\left( J+1\right) $, so, it mimics a kind of rotational energy and removes the degeneracy of the usual spectrum according to $J$ number. In addition, in the limit of $\alpha \rightarrow 0$, the energy level for the spin-one DKPe with a nonminimal vector interaction reduces to \begin{equation} E_{n;J}=\sqrt{m^{2}+\lambda _{r}+\left( 4n+J+3\right) \sqrt{\lambda _{r}^{2}-\lambda _{0}^{2}}}, \label{alpha0limit} \end{equation} which is the same result of ordinary case \cite{Castro_et_al_2014}. We demonstrate these results graphically by assigning some numerical values to the deformation and nonminimal vector coupling parameter $\lambda _{0}$. Note that in all graphs of this manuscript we assume $m=1$ and $\lambda _{r}=1$. In fig.~\ref{fig1}, for $\alpha=J=0$, we present the behavior of the energy eigenvalue function versus $n$ with four different values of $\lambda _{0}$. We see a constant energy value for $\lambda _{0}=\lambda _{r}$ as foreseen in Eq. \eqref{alpha0limit}. On the other hand, we observe that for decreasing values of A, the energy increases faster for small n quantum numbers. We observe that the increments of these increases gradually slow down as the quantum numbers become larger. \begin{figure}[hbtp] \centering \includegraphics[scale=1]{Fig1.eps} \caption{Energy levels versus the quantum number, $n$, for different values of $\lambda_{0}$.} \label{fig1} \end{figure} Next, we assign a fixed value for the vector coupling parameter, $\lambda _{0}=0.5$, with $J=0$ and examine the behaviour of the energy eigenvalue function versus $n$ with four different values of the deformation parameter in fig.~\ref{fig2}. When $\alpha$ is equal to zero, we observe an increase in the energy function as predicted in Eq.~\eqref{alpha0limit}. For non-zero alpha values, we see that the increase in energy function varies linearly in accordance with Eq.~\eqref{En1} with respect to the quantum number $n$. The increase is greater in larger deformation parameters. \begin{figure}[hbtp] \centering \includegraphics[scale=1]{fig2.eps} \caption{Energy levels versus the quantum number $n$ for different values of the deformation parameters $\alpha$} \label{fig2} \end{figure} Another interesting property arises for the energy level spacing which is defined by $\Delta E_{n;J}=E_{n+1;J}-E_{n;J}$. We observe that for large $n$,% \begin{equation} \lim_{n\rightarrow \infty }\left\vert \Delta E_{n;J}\right\vert =2\sqrt{% \alpha}, \label{Ens} \end{equation} It is worth noting that the energy spacing tends to zero in the absence of the MUM. For the graphical illustration, we take $\lambda_0=0.5$ and plot the energy level spacing versus quantum number $n$ for $J=0$ with different values of deformation parameter in fig.~\ref{fig3}. \begin{figure}[hbtp] \centering \includegraphics[scale=1]{fig3.eps} \caption{ Energy levels spacing versus the quantum number $n$ for different values of the deformation parameters $\alpha$.} \label{fig3} \end{figure} We observe that for small $n$, the changes in between the energy levels are not constant. For higher quantum numbers, the energy level spacings become constant and it is proportional to the deformation parameter as predicted in Eq.~\eqref{Ens}. \subsection{ $\left(-1\right)^{J+1}$ parity states} In this subsection we investigate the unnatural parity states and derive the energy eigenvalue function. In the general case, where $A_{0}$ and $A_{r}$ have non zero values as given in Eqs. \eqref{A0} and \eqref{Ar}. Castro \emph{et al.} \cite{Castro_et_al_2014} stated that a decoupling process can not be executed successfully for the Eqs. \eqref{eq03}, \eqref{eq04}, % \eqref{eq05}, \eqref{eq06}, \eqref{eq09}, and \eqref{eq10}. Instead, for $% \lambda _{0}=0$, thus, $A_{0}=0$, Eqs. \eqref{eq05}, \eqref{eq06}, % \eqref{eq09}, and \eqref{eq10} reduce to the following forms, respectively. \begin{eqnarray} -\sqrt{1-\alpha r^{2}}\zeta _{J}\left( \frac{d}{dr}-\frac{J+1}{r}+\frac{A_{r}% }{\sqrt{1-\alpha r^{2}}}\right) H_{0} &=&mF_{+1}-EG_{+1}, \label{eq051} \\ -\sqrt{1-\alpha r^{2}}\xi _{J}\left( \frac{d}{dr}+\frac{J}{r}+\frac{A_{r}}{% \sqrt{1-\alpha r^{2}}}\right) H_{0} &=&mF_{-1}-EG_{-1}, \label{eq061} \\ -\sqrt{1-\alpha r^{2}}\xi _{J}\left( \frac{d}{dr}-\frac{J-1}{r}-\frac{A_{r}}{% \sqrt{1-\alpha r^{2}}}\right) \varphi &=&mG_{+1}-EF_{+1}, \label{eq091} \\ \sqrt{1-\alpha r^{2}}\zeta _{J}\left( \frac{d}{dr}+\frac{J}{r}-\frac{A_{r}}{% \sqrt{1-\alpha r^{2}}}\right) \varphi &=&mg_{-1}-EF_{-1}. \label{eq101} \end{eqnarray}% After a little algebra, we express these four equations in the form of \begin{equation} \left( \begin{array}{c} F_{+1} \\ G_{+1}% \end{array}% \right) =\frac{\sqrt{1-\alpha r^{2}}}{E^{2}-m^{2}}\left( \begin{array}{cc} E\xi _{J}\left( \frac{d}{dr}-\frac{J+1}{r}-\frac{A_{r}}{\sqrt{1-\alpha r^{2}}% }\right) & m\zeta _{J}\left( \frac{d}{dr}-\frac{J+1}{r}+\frac{A_{r}}{\sqrt{% 1-\alpha r^{2}}}\right) \\ m\xi _{J}\left( \frac{d}{dr}-\frac{J+1}{r}-\frac{A_{r}}{\sqrt{1-\alpha r^{2}}% }\right) & E\zeta _{J}\left( \frac{d}{dr}-\frac{J+1}{r}+\frac{A_{r}}{\sqrt{% 1-\alpha r^{2}}}\right)% \end{array}% \right) \left( \begin{array}{c} \varphi \\ H_{0}% \end{array}% \right) \label{bcl1} \end{equation}% and \begin{equation} \left( \begin{array}{c} f_{-1} \\ g_{-1}% \end{array}% \right) =\frac{\sqrt{1-\alpha r^{2}}}{E^{2}-m^{2}}\left( \begin{array}{cc} -E\zeta _{J}\left( \frac{d}{dr}+\frac{J}{r}-\frac{A_{r}}{\sqrt{1-\alpha r^{2}% }}\right) & m\xi _{J}\left( \frac{d}{dr}+\frac{J}{r}+\frac{A_{r}}{\sqrt{% 1-\alpha r^{2}}}\right) \\ -m\zeta _{J}\left( \frac{d}{dr}+\frac{J}{r}-\frac{A_{r}}{\sqrt{1-\alpha r^{2}% }}\right) & E\xi _{J}\left( \frac{d}{dr}+\frac{J}{r}+\frac{A_{r}}{\sqrt{% 1-\alpha r^{2}}}\right)% \end{array}% \right) \left( \begin{array}{c} \varphi \\ h_{0}% \end{array}% \right) \label{bcl2} \end{equation}% We take $g_{+1}$ and $g_{-1}$ from Eqs. \eqref{bcl1}, \eqref{bcl2} and employ in Eq. \eqref{eq04}. We find \begin{equation} \bigg[\left( 1-\alpha r^{2}\right) \frac{d^{2}}{dr^{2}}-\alpha r\frac{d}{dr}-% \frac{J\left( J+1\right) }{r^{2}}-\frac{\alpha \lambda _{r}\left( \frac{% \lambda _{r}}{\alpha }-1\right) r^{2}}{\left( 1-\alpha r^{2}\right) }+\bar{k}% _{1}\bigg]H_{0}+\frac{\alpha E}{m}\sqrt{J\left( J+1\right) }\varphi =0, \label{eqf041} \end{equation}% where $\bar{k}_{1}=E^{2}-m^{2}+\lambda _{r}+\alpha J\left( J+1\right) $. Alike, we draw $f_{+1}$ and $f_{-1}$ from Eqs. \eqref{bcl1}, \eqref{bcl2} and use in Eq. \eqref{eq03}. We get \begin{equation} \bigg[\left( 1-\alpha r^{2}\right) \frac{d^{2}}{dr^{2}}-\alpha r\frac{d}{dr}-% \frac{J\left( J+1\right) }{r^{2}}-\frac{\alpha \lambda _{r}\left( \frac{% \lambda _{r}}{\alpha }-1\right) r^{2}}{\left( 1-\alpha r^{2}\right) }+\bar{k}% _{2}\bigg]\varphi +\frac{\alpha E}{m}\sqrt{J\left( J+1\right) }H_{0}=0, \label{eqf031} \end{equation}% while $\bar{k}_{2}=E^{2}-m^{2}-\left( 3\lambda _{r}-\alpha \right) +\alpha J\left( J+1\right) $. For simplicity, we set $J=0$, and examine a particular solution among the general solution. It is worth noting that under this choice, $H_{0}$ and $\varphi $ decouple from each each others in Eqs. % \eqref{eqf031} and \eqref{eqf041} as \begin{eqnarray} \bigg[\left( 1-\alpha r^{2}\right) \frac{d^{2}}{dr^{2}}-\alpha r\frac{d}{dr}-% \frac{\alpha \lambda _{r}\left( \frac{\lambda _{r}}{\alpha }-1\right) r^{2}}{% \left( 1-\alpha r^{2}\right) }+E^{2}-m^{2}-\left( 3\lambda _{r}-\alpha \right) \bigg]\varphi &=&0, \label{eqf032} \\ \bigg[\left( 1-\alpha r^{2}\right) \frac{d^{2}}{dr^{2}}-\alpha r\frac{d}{dr}-% \frac{\alpha \lambda _{r}\left( \frac{\lambda _{r}}{\alpha }-1\right) r^{2}}{% \left( 1-\alpha r^{2}\right) }+E^{2}-m^{2}+\lambda _{r}\bigg]H_{0} &=&0. \label{eqf042} \end{eqnarray}% At the next step, we introduce a variable change $\rho =\alpha r^{2}$. We obtain \begin{eqnarray} \bigg[(1-\rho )\rho \frac{d^{2}}{d\rho ^{2}}+\left( \frac{1}{2}-\rho \right) \frac{d}{d\rho }+\frac{E^{2}-m^{2}}{4\alpha }+\frac{1}{4}-\frac{\frac{% \lambda _{r}}{\alpha }\left( \frac{\lambda _{r}}{\alpha }+1\right) }{% 4(1-\rho )}+\frac{\lambda _{r}}{4\alpha }\left( \frac{\lambda _{r}}{\alpha }% -2\right) \bigg]\varphi &=&0, \label{eqf033} \\ \bigg[(1-\rho )\rho \frac{d^{2}}{d\rho ^{2}}+\left( \frac{1}{2}-\rho \right) \frac{d}{d\rho }+\frac{E^{2}-m^{2}}{4\alpha }+\frac{\lambda _{r}^{2}}{% 4\alpha ^{2}}-\frac{\frac{\lambda _{r}}{\alpha }\left( \frac{\lambda _{r}}{% \alpha }-1\right) }{4(1-\rho )}\bigg]H_{0} &=&0. \label{eqf043} \end{eqnarray} Since Eqs. \eqref{eqf033} and \eqref{eqf043} are similar to Eq. \eqref{eqf055}, they can be solved exactly in the same manner. We follow the recipe written in between Eqs. \eqref{coz} and \eqref{quan} and obtain the energy spectra as% \begin{eqnarray} E_{\varphi } &=&\pm \sqrt{m^{2}+4\lambda _{r}+4\alpha \left( n+\frac{1}{2}% \right) \left( n+\frac{3}{2}+\frac{\lambda _{r}}{\alpha }\right) }, \\ E_{H_{0}} &=&\pm \sqrt{m^{2}+4\alpha \left( n+\frac{1}{2}\right) \left( n+% \frac{1}{2}+\frac{\lambda _{r}}{\alpha }\right) }. \end{eqnarray} Finally, we take $J=0$ and $\lambda_0=0.5$ and plot the energy functions $E_{\varphi }$ and $E_{H_{0}} $ versus $n$ for two nonzero deformation parameter values in fig.~\ref{fig4}. We observe that for all quantum numbers $E_{\varphi }$ is greater than $E_{H_{0}}$. The change of the deformation parameter in small quantum numbers does not cause much difference in the energy values. As the quantum numbers grow, the change of the deformation parameter has a greater effect on the energy values. For $E_{\varphi }$ and $E_{H_{0}}$, these effects are similar. \begin{figure}[hbtp] \centering \includegraphics[scale=1]{fig4.eps} \caption{Variation of DKP energies with $n$ for different values of the deformation parameters $\alpha$.} \label{fig4} \end{figure} \section{Conclusion} \label{sec4} In this paper, we discussed the various consequences of considering a non-minimal vector interaction in the presence of minimal uncertainty in momentum in the Duffin-Kemmer-Petiau (DKP) formalism. We obtained eigenfunctions in terms of the hypergeometric function, analytically. We exposed an explicit calculation of the energy eigenvalue function for the bound states of the spin-one DKP equation in three-dimension spaces by using the quantization condition. Since the energy eigenfunctions depend on the nonminimal coupling constants and the deformation parameters, we revealed the effects of them on the energy values analytically. We strengthened our findings by presenting these effects in several figures. Moreover, we found that the energy eigenvalues depend on the quantum number $n^{2}$ like square well problem. For large $n$, we found that the energy level spacings become a constant which is proportional to the deformation parameter. Our finding predicted a discontinuity in the energy levels. \section*{Acknowledgment} One of the author, B.C. L\" utf\"uo\u{g}lu, was partially supported by the Turkish Science and Research Council (T\"{U}B\.{I}TAK).
\section{Introduction} Coding theory, one of the most interesting areas of applied mathematics, was born almost simultaneously with the invention of modern computers - the beginning of the error-correcting code came from Claude Shannon's paper ``A mathematical theory of communication'' in 1948, and Richard W. Hamming's paper ``Error detecting and error correcting codes'' in 1950. These days, binary and nonbinary codes such as $q$-ary Hamming codes, the binary and ternary Golay codes, and $q$-ary Reed-Solomon codes are used in internet communication, GPS signals, mobile phones, and computer devices. It is well known that error-correcting codes are closely related to cryptography \cite{calkavur2020},~\cite{Sendrier2017}. Moreover, researchers have recently started investigating the relation between error-correcting codes and deep learning.~\cite {BeEry2019},~\cite{Huang2019}. On the other hand, self-dual codes have been the subject of much interest and are regarded as one of the most important classes of error-correcting codes. This is because of both theoretical reason and connections to various fields of mathematics such as designs \cite{Harada2017}, lattices \cite{Bannai1999}, sphere-packings \cite{Conway1999}, and modular forms \cite{bernhard1996}. Among various research topics of self-dual codes, it has attained an extensive research effort to find a {\it best} code; here, {\it best} refers to having the greatest error correction ability as possible. The error correction capability of a code depends on the minimum distance. Thus, it is crucial to find a method to construct codes having the highest minimum distance. To this end, various techniques are studied involving circulant and bordered circulant matrices \cite{betsumiya2003},~\cite{grassl2009} and quadratic double circulant matrices \cite{Gaborit2002}. Recently, families of codes over rings have been used to construct self-dual codes over finite fields \cite{Doughert2020},~\cite{kim2018}. Despite these efforts, there remain many codes to be found, missed by previous construction methods due to computation complexity. In particular, we hardly know about the optimal minimum distances of self-dual codes over finite fields of order $\ge$ 5 and of lengths $\ge$ 22. In this case, only the possible bounds of highest minimum distances are known so far. For example, in the case of codes over $GF(11)$, the bounds of highest minimum distances of lengths $\le$ 40 are known, as we can see in Table \ref{previous_results_11}. Moreover, there is no information about the lower bound of the self-dual code of length 28 In 1972, Vera Pless introduced {\it Pless symmetry codes}, as a generalization of ternary extended Golay code \cite{VP1},~\cite{VP2}. Using this class of codes, Pless obtained many new optimal self-dual codes over $GF(3)$. Three decades later, Gaborit presented a generalization of Pless symmetry codes to different fields, {\it quadratic double circulant codes}~\cite{Gaborit2002}. He also found many new self-dual codes over $GF(4)$, $GF(5)$, $GF(7)$, and $GF(9)$. We want to remark two things: one is that these two methods used particular symmetric matrices to construct self-dual codes. The other is that these methods have a limitation of lengths; the possible lengths of codes are limited to $n+1$ or $n-1$ where $n$ is a power of an odd prime. Thus, there needs a new method to fill the gap between these lengths. These are the main motivation of this paper. In \cite{choi2020}, we introduced a method of {\it symmetric building-up construction}. If a self-dual code has a symmetric generator matrix, it is called {\it a symmetric self-dual code}. This method was to construct symmetric self-dual codes over $GF(q)$ for $q \equiv 1 \pmod 4$. In \cite{choi2020}, we showed that this method provides an efficient way to construct all symmetric self-dual codes over $GF(q)$, increasing lengths by two. Stimulated by this result, we have struggled to find a method when $q \equiv 3 \pmod 4$. However, it is not easy to generalize the method in \cite{choi2020}. In \cite{choi2020}, the square root of -1 plays the key role, but unfortunately, it is well-known that the square root of -1 does not exist in $GF(q)$ for $q \equiv 3 \pmod 4$. Nevertheless, we find two novel construction methods as follows : \begin{enumerate} {\bf \item[1.] Construction A}\\ Let $(I_n \mid A)$ be a generator matrix of a symmetric self-dual code of length $2n$ over $GF(q)$ and assume that $({\mathbf x}_n , {\mathbf y}_n)$ is a codeword satisfying ${\mathbf x}_n \cdot {\mathbf y}_n = 0$ and ${\mathbf x}_n \cdot {\mathbf x}_n=k$ such that $-1\pm k$ are squares in $GF(q)$. And let $B= \left( \begin{matrix} \alpha {\mathbf x}_n + \beta {\mathbf y}_n \\ \beta {\mathbf x}_n - \alpha {\mathbf y}_n \end{matrix}\right)$ where $\alpha^2+\beta^2 =-1$, $E= \frac{1}{k} ( s {\mathbf x}_n^T {\mathbf x}_n + t {\mathbf y}_n^T {\mathbf y}_n - {\mathbf x}_n^T {\mathbf y}_n - {\mathbf y}_n^T {\mathbf x}_n)$ where $s^2 = -1+k$ and $t^2=-1-k$ and let $D = -\frac{1}{k^2}B(A+E_1)B^T B B^T$. Then $$ \left(\begin{array}{c|c|c|c} I_2 & O& D & B \\ \hline O& I_n&B^T& A+E\\ \end{array}\right)$$ is a generator matrix of symmetric self-dual code of length $2n+4$. {\bf \item[2.] Construction B}\\ Let $(I_n \mid A)$ be a generator matrix of a symmetric self-dual code of length $2n$ over $GF(q)$, let $P=\begin{smatrix} \alpha & \beta \\ \beta & -\alpha \end{smatrix} $ be a $2 \times 2$ matrix such that $P^2=-I_2$, and let a matrix $M = \left( \begin{matrix} {\mathbf x}\\\beta^{-1} {\mathbf x} (A - \alpha I) \end{matrix}\right)$ for a vector ${\mathbf x}$ in $GF(q)^n$. Assume that $H$ is a $2\times 2$ symmetric matrix satisfying $(H+P)(H-P)=-M M^T$ and $H-P$ is non-singular. Then \qquad \qquad \qquad $ \left(\begin{array}{c|c|c|c} I_2 & O& H & M\\ \hline O& I_n&M^T& A+M^T (H-P)^{-1} M\\ \end{array}\right) $ is a generator matrix of symmetric self-dual code of length $2n+4$. \end{enumerate} Using these methods, we obtain many new self-dual codes. Consequently, we improve the bounds on the minimum distances of self-dual codes. We revised these results in Table \ref{our_results1}. In Table \ref{our_results1}, new parameters are written in bold. Throughout this paper, $d_{sym}$ denotes the highest minimum distance of a symmetric self-dual code over $GF(p)$ and $d_{sd}$ denotes the previously best-known minimum distance of self-dual codes over $GF(p)$. More precisely, we give {\it new} self-dual codes with highest minimum weights: they are $[32, 16, 12]$, $[36, 18, 13]$, and $[40, 20,14]$ codes over $GF(11)$, $[36, 18, 14]$ and $[40, 20, 15]$ codes over $GF(19)$, and $[32, 16, 12]$, $[36, 18, 14]$, and $[40, 20, 15]$ codes over $GF(23)$. We also provide numbers of new symmetric self-dual codes, up to equivalence, in Table \ref{numbers}. \begin{table}[h] \begin{center} \begin{small} \begin{tabular}{|c|r|r|r|r|r|r|} \hline $p$ & \multicolumn{2}{c|}{$11$} & \multicolumn{2}{c}{$19$} & \multicolumn{2}{|c|}{$23$} \\ \hline $n$ &\multicolumn{1}{c|}{$d_{sym}$} & \multicolumn{1}{c|}{$d_{sd}$} & \multicolumn{1}{c|}{$d_{sym}$} & \multicolumn{1}{c|}{$d_{sd}$} & \multicolumn{1}{c|}{$d_{sym}$} & \multicolumn{1}{c|}{$d_{sd}$} \\ \hline 4 &{\it 3} & 3 &{\it 3} &3 &{\it 3} &3 \\\hline 8 &{\it 5} & 5 &{\it 5} &5 &{\it 5} &5 \\\hline 12 &{\it 7} & 7 &{\it 7} &7 &{\it 7} &7 \\\hline 16 &{\it 7} &9 &{\it 8} &8 &{\it 8} &9 \\\hline 20 &{\it 8} & 10 &{\it 11} &11 &{\it 9} &10 \\\hline 24 &{\it 9} & 9 &{\it 10} &10 &{\it 10} &13 \\ \hline 28 &{\it 10} & 10 &{\it 11} &11 &{\it 11} &11 \\\hline 32 &\textbf{\textit{12}} &? &{\it 12} &14 &\textbf{\textit{12}} &? \\\hline 36 &\textbf{\textit{13}} &$12$ &\textbf{\textit{14}} &? &\textbf{\textit{14}} &$12$ \\\hline 40 &\textbf{\textit{14}} & $13$ &\textbf{\textit{15}} &? &\textbf{\textit{15}} &$13$ \\\hline \end{tabular} \caption{The highest minimum distance $d_{sym}$ of symmetric self-dual codes vs. previously best known minimum distance $d_{sd}$ of self-dual codes \cite{betsumiya2003, choi2020, deboer1996, Gaborit2002, grassl2008, Gulliver2008, Shi2018}. New parameters are written in bold.} \label{our_results1} \end{small} \end{center} \end{table} \begin{table} \begin{center} \begin{small} \begin{tabular}{|c|c|c|c|c|c|c|} \hline $p$ & \multicolumn{2}{c|}{$11$} & \multicolumn{2}{c}{$19$} & \multicolumn{2}{|c|}{$23$} \\ \hline $n$ & $d_{sym}$ & \# of codes & $d_{sym}$ & \# of codes & $d_{sym}$ & \# of codes \\ \hline 32 &12 &$\ge 44$ &12 & $\ge 801$ &12 &$\ge 52$ \\\hline 36 &13 &$\ge 16$ &14 & $\ge 3$ &14 &$\ge 2$ \\\hline 40 &14 &$\ge 42$ &15 &$\ge 2$ &15 &$\ge 1$ \\\hline \end{tabular} \caption{Numbers of new symmetric self-dual code of length 32, 36 and 40} \label{numbers} \end{small} \end{center} \end{table} The paper is organized as follows. Section 2 gives preliminaries for self-dual codes over finite fields. In Section 3, we present two construction methods for {\it symmetric self-dual codes} over $GF(q)$, where $q$ is an odd prime power. In Section 4, we give the improved bounds of highest minimum distances and the computational results of the best codes obtained using our new methods. All computations in this paper were done with the computer algebra system \textsc{Magma} \cite{Magma}. We use the following notations throughout this paper. \begin{tabular}{ c p{9cm} } \textbf{Notations}& \\ \hline $q$ & a power of an odd prime number \\ $GF(q)$ & finite field of order $q$\\ $d_{sym}$ & the highest minimum distance of symmetric self-dual codes \\ $d_{sd}$ & the previous best known minimum distance of self-dual codes \\ $I_n$ & the identity matrix of degree $n$ \\ $[n,k,d]_q$ code& a linear code of length $n$ and dimension $k$ over $GF(q)$ with minimum distance $d$\\ $A^{-1}$ & the inverse of a matrix $A$ \\ $A^T$ & the transpose of a matrix $A$ \\ \hline \end{tabular} \section{Preliminaries} Let $n$ be a natural number, and $GF(q)$ be the finite field of order $q$ where $q$ is a prime power. A {\it linear code} ${\mathcal C}$ of length $n$ and dimension $k$ over $GF(q)$ is a $k$-dimensional subspace of $GF(q)^n$. An element of ${\mathcal C}$ is called a {\it codeword}. A {\it generator matrix} of ${\mathcal C}$ is a matrix whose rows form a basis of ${\mathcal C}$; therefore, a generator matrix of a linear code ${\mathcal C}$ of length $n$ and dimension $k$ over $GF(q)$ is a $k \times n$ matrix over $GF(q)$. For vectors ${\mathbf x} = (x_i )$ and ${\mathbf y}=(y_i)$ in $GF(q)^n$, we define the inner product ${\mathbf x} \cdot {\mathbf y} = \sum_{i=1}^{n} x_i y_i$. If vectors are identified with row matrices, the inner product can also be written as a matrix multiplication ${\mathbf x} \cdot {\mathbf y} ={\mathbf x} {\mathbf y} ^T$, where ${\mathbf y}^T$ denotes the transpose of ${\mathbf y}$. For a linear code ${\mathcal C}$, {\it dual code ${\mathcal C}^{\perp}$} is defined as a set of orthogonal vectors of ${\mathcal C}$, i.e., $${\mathcal C}^{\perp}=\{{\mathbf x}\in GF(q)^n \mid {\mathbf x} \cdot {\mathbf c} =0 \text{ for all ${\mathbf c}\in C$} \}.$$ A linear code ${\mathcal C}$ is called {\it self-dual} if ${\mathcal C} = {\mathcal C}^{\perp}$ and {\it self-orthogonal} if ${\mathcal C} \subset {\mathcal C}^{\perp}$. The {\it weight} of a codeword ${\mathbf c}$ is the number of non-zero symbols in the codeword and denoted by $wt({\mathbf c})$. The {\it Hamming distance} between two codewords ${\mathbf x}$ and ${\mathbf y}$ is defined by $d({\mathbf x},{\mathbf y})=wt({\mathbf x}-{\mathbf y})$. The {\it minimum distance} of ${\mathcal C}$, denoted by $d({\mathcal C})$, is the smallest Hamming distance between distinct codewords in ${\mathcal C}$. The minimum distance determines the error-capability; thus, the minimum distance is regarded as the most important parameter of a code. If a code has the minimum distance that meets some upper bounds, it is called an {\it optimal code}. It is well-known \cite[chapter 2.4.]{HP3} that a linear code of length $n$ and dimension $k$ satisfy the Singleton bound, $$d({\mathcal C}) \le n - k +1.$$ A code that achieves the equality in the Singleton bound is called a \textit{maximum distance separable(MDS)} code. Obviously, a self-dual code of length $2n$ over $GF(q)$ is MDS if the minimum distance equals $n+1$. Although every MDS code is optimal, the MDS conjecture shows that there exists an MDS self-dual code of length $2n$ over $GF(q)$ only if $2n \le q+1$ \cite{Ball2012}. Therefore, if $2n > q+1$, the minimum distance of self-dual code of length $2n$ over $GF(q)$ is upper bounded by $n$. Let $I_n$ be a identity matrix of order $n$ and let $A^T$ denote the transpose of a matrix $A$. It is well-known that a self-dual code ${\mathcal C}$ of length $2n$ over $GF(q)$ is equivalent to a code with a standard generator matrix \begin{equation}\label{std-form} \left( \begin{array}{c|c} I_{n}& A \end{array} \right), \end{equation} where $A$ is a $n \times n$ matrix satisfying $AA^T=-I_{n}$. A matrix $A$ is called {\it symmetric} if $A^T=A$. If a self-dual code of length $2n$ over $GF(q)$ has a standard generator matrix $G=(I_n \mid A)$ where $A$ is symmetric, it is called {\it a symmetric self-dual code}. Since the class of symmetric self-dual codes is a subclass of general self-dual codes, the bound on minimum distances of symmetric self-dual code may be different from that of self-dual codes. However, if a symmetric self-dual code has the same parameter as an optimal(resp. MDS) self-dual code, it is called a {\it optimal (resp. MDS) symmetric self-dual code}. If the minimum distance of a symmetric self-dual code meets the best known minimum distance of a self-dual code, it is called a {\it best symmetric self-dual code}. In \cite{VP1}, Pless introduced {\it Pless symmetry codes} as a generalization of ternary extended Golay code and their construction method. As a result, Pless obtained optimal self-dual codes of length 24, 36, 48, and 60 over $GF(3)$. Later in \cite{Gaborit2002}, Gaborit presented a generalization of Pless symmetry codes to different fields, {\it quadratic double circulant codes} and their \linebreak construction method. Gaborit obtained many new self-dual codes over $GF(4)$, $GF(5)$, $GF(7)$ and $GF(9)$, and improved the bounds on the highest minimum \linebreak distances. To use as a reference, we additionally obtain quadratic double circulant codes of lengths $\le 40$ over various finite fields, following the same construction method in \cite{Gaborit2002}. We present these codes in Table \ref{qdcodes}, following the same notations in \cite{Gaborit2002}. \begin{table}[h] \begin{center} \begin{small} \begin{tabular}{crrr|crrr} \hline length &$q$ & generator matrix &$d$ & length &$q$ & generator matrix &$d$ \\ \hline 28 & 11 & $\mathscr{S}_{13}(3,0)$ & 10 & 28 & 17 & $\mathscr{S}_{13}(2,0)$ & 10 \\ 28 & 19 & $\mathscr{S}_{13}(5,0)$ & 10 & 28 & 29 & $\mathscr{S}_{13}(4,0)$ & 10 \\ \hline 36 & 11 & $\mathscr{S}_{17}(4,0)$ & 12 & 36 & 13 & $\mathscr{S}_{17}(3,0)$ & 12 \\ 36 & 17 & $\mathscr{S}_{17}(7,0)$ & 12 & 36 & 23 & $\mathscr{S}_{17}(11,0)$ & 12 \\ \hline 40 & 11 & $\mathscr{S}_{19}(3,4)$ & 13 & 40 & 13 & $\mathscr{S}_{19}(2,4)$ & 13 \\ 40 & 17 & $\mathscr{S}_{19}(7,0)$ & 13 & 40 & 23 & $\mathscr{S}_{19}(2,0)$ & 13 \\ 40 & 29 & $\mathscr{S}_{19}(1,3)$ & 13 &&& & \\ \hline \end{tabular} \end{small} \caption{New quadratic double circulant codes over $GF(q)$ obtained using methods in \cite{Gaborit2002}} \label{qdcodes} \end{center} \end{table} We remark that a self-dual code in the class of Pless symmetry codes or quadratic double circulant codes is equivalent to a symmetric self-dual code. In general, a pure double circulant self-dual code is equivalent to a symmetric self-dual code, and a bordered double circulant self-dual code is equivalent to a symmetric self-dual code under a certain condition. We discuss the equivalence between these codes in the next. Let $S_n$ be a symmetric group of order $n$ and ${\mathbb D}^n$ be the set of diagonal matrices over $GF(q)$ of order $n$, $$ {\mathbb D}^n=\{diag({\gamma}_i) \mid {\gamma}_i\in GF(q), {\gamma}_i^2=1\}.$$ The group of all \textit{$\gamma$-monomial transformations of length $n$}, ${\mathcal M}^n$ is defined by $${\mathcal M}^n=\{p_{{\sigma}} \gamma \mid \gamma \in{\mathbb D}^n, {\sigma} \in S_n\} $$ where $p_{\sigma}$ is the permutation matrix corresponding $\sigma \in S_n$. We note that a $\gamma$-monomial transformation preserves the self-orthogonality of a code (see \cite[Thm 1.7.6]{HP3}). Let ${\mathcal C}\tau =\{{\mathbf c}\tau \mid {\mathbf c}\in {\mathcal C}\}$ for an element $\tau$ in ${\mathcal M}^{n}$ and a code ${\mathcal C}$ of length $n$. If there exists an element $\mu \in {\mathcal M}^{n}$ such that ${\mathcal C} \mu={\mathcal C}'$ for two distinct codes ${\mathcal C}$ and ${\mathcal C}'$, then ${\mathcal C}$ and ${\mathcal C}'$ are called \textit{equivalent} and denoted by ${\mathcal C} \simeq {\mathcal C}'$ \begin{proposition}\label{M-equivalent} Let $G=( I_n \mid A )$ and $G'=( I_n \mid B )$ be generator matrices of self-dual codes ${\mathcal C}$ and ${\mathcal C}'$ of length $2n$, respectively. If $A = \mu_1 B \mu_2$ for some $\mu_1, \mu_2 \in {\mathcal M}^n$, then ${\mathcal C}$ and ${\mathcal C}'$ are equivalent. \begin{proof} For $\mu =\left(\begin{array}{c|c} \mu_1^{-1} &O \\ \hline O & \mu_2 \end{array}\right) \in {\mathcal M}^{2n}$, $$( I_n \mid A ) =( I_n \mid \mu_1 B \mu_2)=( \mu_1^{-1} \mid B \mu_2) = ( I_n \mid B ) \mu. $$ Thus, ${\mathcal C}$ and ${\mathcal C}'$ are equivalent. \end{proof} \end{proposition} \begin{corollary}\label{cor2.6}Let $I_n$ be the identity matrix of order $n$, $A$ is an $n\times n$ circulant matrix, $B$ is an $(n-1)\times (n-1)$ circulant matrix. Then, \begin{enumerate} \item a pure double circulant code over $GF(q)$ with a generator matrix of the form $$(I_n \mid A)$$ is equivalent to a code with symmetric generator matrix, and \item a bordered double circulant code over $GF(q)$ with a generator matrix of the form \[ \left( \begin{array}{ccc} & \alpha & \beta \cdots \beta \\ \raisebox{-10pt}{{\large\mbox{{$I_n$}}}} & \gamma \beta& \raisebox{-15pt}{{\large\mbox{{$A$}}}} \\[-4ex] & \vdots & \\[-0.5ex] & \gamma \beta & \end{array} \right), \] where $\alpha$ and $\beta$ are elements in $GF(q)$ and $\gamma^2=1$, is equivalent to a code with symmetric generator matrix. \end{enumerate} \end{corollary} \begin{proof} It is clear that a column reversed matrix of a circulant matrix $A$ is symmetric. Thus, the corollary follows directly from Proposition \ref{M-equivalent}. \end{proof} Let $S_{-1}$ be a set of solutions of the equation $x^2 +y^2 =1$ over $GF(q)$. Then the cardinality of $S_{-1}$ for an odd prime $q$ is obtained in the next proposition \begin{proposition}[\cite{park2011classification}]\label{S_-1} Let $GF(q)$ be a finite field of order $q$ such that $q$ is a power of an odd prime. The cardinality of the set $$S_{-1}=\{(x,y)\in GF(q)^2\mid x^2+y^2+1=0\} $$ is given by $$|S_{-1}|=q-(-1)^{(q-1)/2}=\begin{cases} q-1, &\text{if $q\equiv 1\pmod{4}$},\\ q+1, &\text{if $q\equiv 3\pmod4$}. \end{cases} $$ \end{proposition} Similarly, we define a set $S_{-I_2}$ of $2 \times 2$ symmetric matrices over $GF(q)$ satisfying the matrix equation $X^2 + I_2 = 0$. We also obtain the cardinality of $S_{-I_2}$ in the following corollary. \begin{corollary}\label{S_-I_2} Let $S_{-I_2}$ be a set of $2 \times 2$ symmetric matrices over $GF(q)$ where $q$ is a power of odd prime such that $$S_{-I_2}=\{P\in K \mid P^2=-I_2\}. $$ Then, the cardinality of $S_{-I_2}$ is given by $$|S_{-I_2}|=q-(-1)^{( q-1)/2}=\begin{cases} q-1, &\text{if $q\equiv 1\pmod{4}$},\\ q+1, &\text{if $q\equiv 3\pmod4$}. \end{cases} $$ \end{corollary} \begin{proof} The condition $P^2=-I_2$ implies that $P^{-1}= - P$. Since we assumed that $P$ is symmetric, it is easy to show that matrix $P$ is in the form $\begin{smatrix} \alpha & \beta \\ \beta & - \alpha \end{smatrix} $, where $(\alpha, \beta)$ is a solution of the equation $x^2 +y^2 =1$. Thus, the result follows with Proposition \ref{S_-1}. \end{proof} \section{Construction method of symmetric self-dual codes} It is well-known that a self-dual over $GF(q)$ of length $n$ for $q \equiv 1 {\pmod 4}$ exists if and only if $n \equiv 0 {\pmod 2}$, and a self-dual over $GF(q)$ of length $n$ for $q \equiv 3 {\pmod 4}$ exists if and only if $n \equiv 0 {\pmod 4}$ \cite[Theorem 9.1.3]{HP3}. In \cite{choi2020}, we have introduced a construction method for symmetric self-dual codes over $GF(q)$ for $q \equiv 1 \pmod 4$. In this section, we introduce two new construction methods for symmetric self-dual codes over $GF(q)$ for $q \equiv 3 \pmod 4$. These methods generate symmetric self-dual codes of lengths increased by four. \begin{theorem}[Construction method 1]{\label{SymBuildingup1}} Let $G=(I_n \mid A)$ be a generator matrix of symmetric self-dual code ${\mathcal C}$ of length $2n$ over $GF(q)$ for an odd prime power $q$. Assume that there exists a codeword $({\mathbf x}_n , {\mathbf y}_n)$ in ${\mathcal C}$ satisfying ${\mathbf x}_n \cdot {\mathbf y}_n = 0$, ${\mathbf x}_n \cdot {\mathbf x}_n=k(\ne 0)$, and $-1\pm k$ are squares in $GF(q)$. Then, take an element $(\alpha, \beta)$ in $S_{-1}$ and let $B= \left( \begin{matrix} \alpha {\mathbf x}_n + \beta {\mathbf y}_n \\ \beta {\mathbf x}_n - \alpha {\mathbf y}_n \end{matrix}\right)$, $E= \frac{1}{k} ( s {\mathbf x}_n^T {\mathbf x}_n + t {\mathbf y}_n^T {\mathbf y}_n - {\mathbf x}_n^T {\mathbf y}_n - {\mathbf y}_n^T {\mathbf x}_n)$ where $s^2 = -1+k$ and $t^2=-1-k$, and let $D = -\frac{1}{k^2}B(A+E_1)B^T B B^T$. Then $$ G_1= (I_{n+2} \mid A_1)=\left(\begin{array}{c|c|c|c} I_2 & O& D & B \\ \hline O& I_n&B^T& A+E\\ \end{array}\right)$$ is a generator matrix of a symmetric self-dual code of length $2n+4$. \end{theorem} The proof of Theorem \ref{SymBuildingup1} is given in Appendix for the brevity. We need following two lemmas to introduce the second construction method. \begin{lemma}{\label{GP1}} Let $P=\begin{smatrix} \alpha & \beta \\ \beta & -\alpha \end{smatrix} $ be an element in $S_{-I_2}$ and $A$ be a symmetric matrix satisfying $A^2 = - I_n$. For a vector ${\mathbf x}$ in $GF(q)^n$, if we let the matrix $M = \left( \begin{matrix} {\mathbf x}\\\beta^{-1} {\mathbf x} (A - \alpha I) \end{matrix}\right)$, then $$MA=PM.$$ \end{lemma} \begin{proof} Let ${\mathbf y} =\beta^{-1} {\mathbf x} (A - \alpha I)$. Then $\beta {\mathbf y} ={\mathbf x} A - \alpha {\mathbf x}$ and this implies that ${\mathbf x} A = \alpha {\mathbf x} + \beta {\mathbf y}.$ On the other hand, \begin{align*} {\mathbf y}(A+\alpha I) &=\beta^{-1} {\mathbf x} (A - \alpha I)(A+\alpha I)\\ &=\beta^{-1} {\mathbf x} (A^2 - \alpha^2 I) \\ &=\beta^{-1}{\mathbf x} (-1 - \alpha^2) I \\ &=\beta {\mathbf x}, {\mbox{ since }} \alpha^2 + \beta^2 = -1 \end{align*} and this implied that ${\mathbf y} A=\beta {\mathbf x} - \alpha {\mathbf y} $. Therefore, $$ M A= \left( \begin{matrix} {\mathbf x} A\\ {\mathbf y} A \end{matrix}\right) = \left( \begin{matrix} \alpha {\mathbf x} + \beta {\mathbf y} \\ \beta {\mathbf x} - \alpha {\mathbf y} \end{matrix}\right) =PM.$$ \end{proof} \begin{lemma}{\label{GP2}} Assume that $n \times n$ matrices $H$ and $P$ are symmetric. If $(H+P)(H-P)$ is also symmetric, then $HP=PH$. \end{lemma} \begin{proof} By the assumption, we have \begin{align*} (H-P)(H+P)&=\{(H-P)(H+P)\}^T \\ &= (H+P)^T (H-P)^T \\ &=(H+P)(H-P), \end{align*} and by equating both sides, the result follows.\end{proof} Now, we give the next theorem, which introduces the second construction method. \begin{theorem}[Construction 2]{\label{SymBuildingup2}} Let $G=(I_n \mid A)$ be a generator matrix of a symmetric self-dual code ${\mathcal C}$ of length $2n$ over $GF(p)$ for an odd prime $p$ and let $S_{-I_2}$ be the set defined in proposition \ref{S_-I_2}, and let $P=\begin{smatrix} \alpha & \beta \\ \beta & -\alpha \end{smatrix} $ be an element in $S_{-I_2}$. Let $M = \left( \begin{matrix} {\mathbf x}\\\beta^{-1} {\mathbf x} (A - \alpha I) \end{matrix}\right)$ for a vector ${\mathbf x}$ in $GF(q)^n$. Assume that $H$ is a $2\times 2$ symmetric matrix satisfying the equation \begin{equation}\label{HP=PH}(H+P)(H-P)=-M M^T,\end{equation} and $H-P$ is non-singular. Then $$ G_2= (I_{n+2} \mid A_2)=\left(\begin{array}{c|c|c|c} I_2 & O& H & M\\ \hline O& I_n&M^T& A+M^T (H-P)^{-1} M\\ \end{array}\right)$$ is a generator matrix of a symmetric self-dual code of length $2n+4$. \end{theorem} The proof of Theorem \ref{SymBuildingup2} is also given in Appendix. We illustrate these new construction methods in the following examples. \begin{example}\label{BU1} Let ${\mathcal C}_{3}^{8}$ be a symmetric optimal self-dual [8,4,3] code over $GF(3)$ with generator matrix $$G=\begin{smatrix} 1& 0& 0& 0& 1& 1& 0& 0\\ 0& 1& 0& 0& 1& 2& 0& 0\\ 0& 0& 1& 0& 0& 0& 2& 1\\ 0& 0& 0& 1& 0& 0& 1& 1 \end{smatrix}.$$ To apply construction method in Theorem \ref{SymBuildingup1}, take $(\alpha , \beta) =(1,1)$ and the codeword $({\mathbf x}_n| {\mathbf y}_n) = (2,1,1,1,0,1,0,2)$ in ${\mathcal C}_{3}^{8}$. Then, we compute that \begin{center} $B=\begin{smatrix} 2& 2& 1& 0\\ 2& 0& 1& 2 \end{smatrix}$, $D=\begin{smatrix} 2& 1\\ 1& 2 \end{smatrix}$, and $E=\begin{smatrix} 0& 1& 0& 2\\ 1& 2& 2& 2\\ 0& 2& 0& 1\\ 2& 2& 1& 0 \end{smatrix}$. \end{center} Finally, we find an optimal symmetric self-dual [12,6,6] over $GF(3)$ code with generator matrix $$ G_1= \begin{smatrix} 1& 0& 0& 0& 0& 0& 2& 1& 2& 2& 1& 0\\ 0& 1& 0& 0& 0& 0& 1& 2& 2& 0& 1& 2\\ 0& 0& 1& 0& 0& 0& 2& 2& 1& 2& 0& 2\\ 0& 0& 0& 1& 0& 0& 2& 0& 2& 1& 2& 2\\ 0& 0& 0& 0& 1& 0& 1& 1& 0& 2& 2& 2\\ 0& 0& 0& 0& 0& 1& 0& 2& 2& 2& 2& 1\\ \end{smatrix}.$$ \end{example} \begin{example}\label{ex3.6} Let ${\mathcal C}_{19}^{8}$ be a symmetric self-dual [8,4,3] code over $GF(19)$ with generator matrix $$G=\begin{smatrix} 1& 0& 0& 0& 18& 13& 0& 0\\ 0& 1& 0& 0& 13& 1& 0& 0\\ 0& 0& 1& 0& 0& 0& 1& 6\\ 0& 0& 0& 1& 0& 0& 6& 18 \end{smatrix}.$$ To apply construction method in Theorem \ref{SymBuildingup1}, take $(\alpha , \beta) =(18,6)$ and ${\mathbf x} = (1,6,9,6)$ in $GF(19)^4$. Then, \begin{center} $M=\begin{smatrix} 1& 6& 9& 6\\ 13& 1& 9& 9 \end{smatrix}$ and $H=\begin{smatrix} 9& 12\\ 12& 13 \end{smatrix}$, \end{center} and finally, we obtain a symmetric [12,6,7] self-dual code over $GF(19)$ of length 12 with generator matrix $$ G_2= \begin{smatrix} 1 & 0 &0 & 0 & 0 & 0 & 9 &12 & 1 & 6 & 9 & 6\\ 0 & 1 &0 & 0 & 0 & 0 &12 &13& 13 & 1 & 9 & 9\\ 0 & 0 &1 & 0 & 0 & 0 & 1 &13 & 7 &17 &13& 14\\ 0 & 0 & 0 & 1 & 0 & 0 & 6 & 1 &17 &14 & 7 & 6\\ 0 & 0 & 0 & 0 &1 & 0 & 9 & 9& 13& 7& 12 &11\\ 0 & 0 & 0 & 0 & 0 & 1 & 6 & 9& 14 & 6& 11 & 2\\ \end{smatrix}.$$ \end{example} \section{Computational results} In this section, we discuss computational results of symmetric self-dual codes over $GF(q)$ for $q=11,19,23$. Using construction methods in Theorem \ref{SymBuildingup1} and \ref{SymBuildingup2}, we obtain many new symmetric self-dual codes of lengths $n \le 40$ which meet the best known bounds on minimum distances of self-dual codes. We find best symmetric self-dual codes of length $n$ over $GF(q)$ for $q=11,19,23$ and $n\le 40$ except for the case that $q=11$ with $n=16$ or $20$, for the case that $q=19$ with $n=32$, and for the case that $q=23$ with $n=20$ or $24$. Moreover, we also find more than 151 self-dual codes with new parameters: 90 inequivalent self-dual codes of length 32, 36 and 40 over $GF(11)$, 5 inequivalent self-dual codes of length 36 and 40 over $GF(19)$ and 56 inequivalent self-dual codes of length 32, 26 and 40 over $GF(23)$. Among them, we introduce five symmetric self-dual codes with their generator matrices in this section. At the end of this section, we summarize the known bounds on the highest minimum distances of self-dual codes in Table \ref{summary}. \subsection{Symmetric self-dual codes over $GF(11)$. } \begin{proposition} There exist best symmetric self-dual codes over $GF(11)$ of length $n=4,8,12, 24, 28, 32, 36, 40$. In particular, $[4,2,3]_{11}, [8,4,5]_{11}$ and $[12,6,7]_{11}$ symmetric self-dual codes are MDS. Moreover, $[32,16,12]_{11}$, $[36,18,13]_{11}$ and $[40,20,14]_{11}$ codes are new. \end{proposition} We give the highest minimum distance $d_{sym}$ of symmetric self-dual codes and the previously best known minimum distance $d_{sd}$ of self-dual codes in Table \ref{previous_results_11}. In this table, new parameters are written in bold. We present three symmetric self-dual codes having new parameters: \begin{itemize} \item $[32,16,12]_{11}$ code with a generator matrix $(I_{16} \mid A_{11}^{32})$ where \\ $A_{11}^{32}=\begin{smatrix} 6 & 7 & 7 & 1 & 2 & 8 & 5 & 9 & 9 & 8 & 1 & 6 & 4 & 7 & 10 & 6 \\ 7 & 9 & 7 & 8 & 0 & 8 & 4 & 8 & 6 & 10 & 2 & 6 & 9 & 7 & 8 & 10 \\ 7 & 7 & 6 & 0 & 8 & 2 & 4 & 9 & 1 & 6 & 8 & 7 & 6 & 9 & 0 & 4 \\ 1 & 8 & 0 & 7 & 0 & 7 & 10 & 2 & 1 & 9 & 9 & 3 & 3 & 2 & 8 & 0 \\ 2 & 0 & 8 & 0 & 10 & 10 & 8 & 10 & 3 & 0 & 10 & 8 & 0 & 8 & 10 & 0 \\ 8 & 8 & 2 & 7 & 10 & 7 & 10 & 2 & 9 & 7 & 7 & 0 & 6 & 1 & 0 & 3 \\ 5 & 4 & 4 & 10 & 8 & 10 & 10 & 7 & 8 & 5 & 2 & 5 & 4 & 8 & 3 & 9 \\ 9 & 8 & 9 & 2 & 10 & 2 & 7 & 0 & 3 & 2 & 8 & 10 & 7 & 8 & 4 & 6 \\ 9 & 6 & 1 & 1 & 3 & 9 & 8 & 3 & 0 & 1 & 5 & 10 & 7 & 7 & 8 & 10 \\ 8 & 10 & 6 & 9 & 0 & 7 & 5 & 2 & 1 & 9 & 9 & 1 & 1 & 9 & 4 & 4 \\ 1 & 2 & 8 & 9 & 10 & 7 & 2 & 8 & 5 & 9 & 3 & 7 & 7 & 2 & 9 & 4 \\ 6 & 6 & 7 & 3 & 8 & 0 & 5 & 10 & 10 & 1 & 7 & 7 & 2 & 6 & 8 & 2 \\ 4 & 9 & 6 & 3 & 0 & 6 & 4 & 7 & 7 & 1 & 7 & 2 & 5 & 7 & 7 & 6 \\ 7 & 7 & 9 & 2 & 8 & 1 & 8 & 8 & 7 & 9 & 2 & 6 & 7 & 4 & 1 & 5 \\ 10 & 8 & 0 & 8 & 10 & 0 & 3 & 4 & 8 & 4 & 9 & 8 & 7 & 1 & 7 & 2 \\ 6 & 10 & 4 & 0 & 0 & 3 & 9 & 6 & 10 & 4 & 4 & 2 & 6 & 5 & 2 & 9 \end{smatrix}$ \item $[36,18,13]_{11}$ code with a generator matrix $(I_{18} \mid A_{11}^{36})$ where \\ $A_{11}^{36}=\begin{smatrix} 5 & 10 & 6 & 7 & 5 & 4 & 7 & 1 & 9 & 4 & 4 & 7 & 7 & 8 & 1 & 8 & 8 & 8 \\ 10 & 10 & 8 & 7 & 6 & 4 & 5 & 8 & 9 & 7 & 10 & 1 & 3 & 0 & 5 & 8 & 9 & 9 \\ 6 & 8 & 10 & 6 & 4 & 2 & 4 & 6 & 10 & 0 & 1 & 5 & 6 & 9 & 1 & 9 & 5 & 1 \\ 7 & 7 & 6 & 3 & 4 & 3 & 4 & 2 & 1 & 10 & 4 & 1 & 5 & 3 & 7 & 8 & 4 & 6 \\ 5 & 6 & 4 & 4 & 6 & 3 & 7 & 4 & 8 & 9 & 9 & 9 & 9 & 10 & 0 & 4 & 5 & 9 \\ 4 & 4 & 2 & 3 & 3 & 1 & 7 & 2 & 2 & 0 & 3 & 7 & 6 & 6 & 5 & 1 & 1 & 4 \\ 7 & 5 & 4 & 4 & 7 & 7 & 6 & 4 & 10 & 7 & 1 & 2 & 9 & 1 & 4 & 0 & 6 & 7 \\ 1 & 8 & 6 & 2 & 4 & 2 & 4 & 3 & 7 & 8 & 4 & 1 & 1 & 1 & 2 & 2 & 1 & 4 \\ 9 & 9 & 10 & 1 & 8 & 2 & 10 & 7 & 3 & 8 & 7 & 6 & 9 & 9 & 3 & 3 & 1 & 7 \\ 4 & 7 & 0 & 10 & 9 & 0 & 7 & 8 & 8 & 0 & 5 & 0 & 0 & 8 & 0 & 4 & 8 & 10 \\ 4 & 10 & 1 & 4 & 9 & 3 & 1 & 4 & 7 & 5 & 2 & 10 & 3 & 3 & 2 & 0 & 1 & 3 \\ 7 & 1 & 5 & 1 & 9 & 7 & 2 & 1 & 6 & 0 & 10 & 0 & 0 & 8 & 6 & 5 & 0 & 0 \\ 7 & 3 & 6 & 5 & 9 & 6 & 9 & 1 & 9 & 0 & 3 & 0 & 9 & 7 & 6 & 7 & 5 & 0 \\ 8 & 0 & 9 & 3 & 10 & 6 & 1 & 1 & 9 & 8 & 3 & 8 & 7 & 8 & 8 & 1 & 5 & 10 \\ 1 & 5 & 1 & 7 & 0 & 5 & 4 & 2 & 3 & 0 & 2 & 6 & 6 & 8 & 10 & 0 & 8 & 7 \\ 8 & 8 & 9 & 8 & 4 & 1 & 0 & 2 & 3 & 4 & 0 & 5 & 7 & 1 & 0 & 2 & 9 & 2 \\ 8 & 9 & 5 & 4 & 5 & 1 & 6 & 1 & 1 & 8 & 1 & 0 & 5 & 5 & 8 & 9 & 4 & 10 \\ 8 & 9 & 1 & 6 & 9 & 4 & 7 & 4 & 7 & 10 & 3 & 0 & 0 & 10 & 7 & 2 & 10 & 6 \end{smatrix}$ \item $[40,20,14]_{11}$ code with a generator matrix $(I_{20} \mid A_{11}^{40})$ where \\ $A_{11}^{40}=\begin{smatrix} 5 & 4 & 6 & 1 & 7 & 10 & 5 & 5 & 8 & 8 & 10 & 4 & 9 & 5 & 9 & 5 & 8 & 3 & 9 & 6 \\ 4 & 2 & 6 & 3 & 1 & 2 & 1 & 2 & 5 & 8 & 2 & 4 & 5 & 9 & 1 & 7 & 5 & 7 & 3 & 4 \\ 6 & 6 & 2 & 9 & 4 & 4 & 9 & 5 & 1 & 8 & 6 & 2 & 6 & 9 & 10 & 5 & 6 & 0 & 5 & 0 \\ 1 & 3 & 9 & 5 & 3 & 10 & 2 & 4 & 10 & 3 & 1 & 10 & 9 & 7 & 8 & 9 & 10 & 7 & 0 & 0 \\ 7 & 1 & 4 & 3 & 7 & 3 & 8 & 0 & 1 & 7 & 7 & 6 & 0 & 5 & 7 & 10 & 9 & 6 & 5 & 0 \\ 10 & 2 & 4 & 10 & 3 & 6 & 0 & 9 & 3 & 9 & 4 & 8 & 9 & 0 & 3 & 4 & 6 & 8 & 0 & 5 \\ 5 & 1 & 9 & 2 & 8 & 0 & 4 & 6 & 1 & 2 & 4 & 8 & 6 & 3 & 8 & 5 & 5 & 4 & 3 & 3 \\ 5 & 2 & 5 & 4 & 0 & 9 & 6 & 3 & 4 & 7 & 8 & 8 & 3 & 2 & 10 & 3 & 2 & 3 & 3 & 7 \\ 8 & 5 & 1 & 10 & 1 & 3 & 1 & 4 & 0 & 7 & 9 & 3 & 2 & 9 & 9 & 2 & 9 & 9 & 1 & 6 \\ 8 & 8 & 8 & 3 & 7 & 9 & 2 & 7 & 7 & 5 & 3 & 9 & 3 & 0 & 5 & 8 & 5 & 6 & 8 & 8 \\ 10 & 2 & 6 & 1 & 7 & 4 & 4 & 8 & 9 & 3 & 6 & 6 & 1 & 5 & 7 & 10 & 2 & 3 & 8 & 6 \\ 4 & 4 & 2 & 10 & 6 & 8 & 8 & 8 & 3 & 9 & 6 & 6 & 10 & 5 & 2 & 6 & 7 & 6 & 6 & 1 \\ 9 & 5 & 6 & 9 & 0 & 9 & 6 & 3 & 2 & 3 & 1 & 10 & 4 & 9 & 4 & 7 & 3 & 2 & 8 & 10 \\ 5 & 9 & 9 & 7 & 5 & 0 & 3 & 2 & 9 & 0 & 5 & 5 & 9 & 2 & 6 & 8 & 2 & 10 & 8 & 0 \\ 9 & 1 & 10 & 8 & 7 & 3 & 8 & 10 & 9 & 5 & 7 & 2 & 4 & 6 & 1 & 3 & 6 & 1 & 7 & 4 \\ 5 & 7 & 5 & 9 & 10 & 4 & 5 & 3 & 2 & 8 & 10 & 6 & 7 & 8 & 3 & 4 & 9 & 2 & 5 & 3 \\ 8 & 5 & 6 & 10 & 9 & 6 & 5 & 2 & 9 & 5 & 2 & 7 & 3 & 2 & 6 & 9 & 4 & 9 & 3 & 6 \\ 3 & 7 & 0 & 7 & 6 & 8 & 4 & 3 & 9 & 6 & 3 & 6 & 2 & 10 & 1 & 2 & 9 & 6 & 7 & 1 \\ 9 & 3 & 5 & 0 & 5 & 0 & 3 & 3 & 1 & 8 & 8 & 6 & 8 & 8 & 7 & 5 & 3 & 7 & 3 & 10 \\ 6 & 4 & 0 & 0 & 0 & 5 & 3 & 7 & 6 & 8 & 6 & 1 & 10 & 0 & 4 & 3 & 6 & 1 & 10 & 2 \end{smatrix}$ \end{itemize} \begin{table}[h] \begin{center} \begin{small} \begin{tabular}{ccc|ccc} \hline $[n,k,d]_p$ & $d_{sym.}$ &$d_{sd.}$&$[n,k,d]_p$ & $d_{sym.}$ &$d_{sd.}$ \\ \hline $[4,2,3]_{11}$ & $3$ &$3$&$[24,12,9]_{11}$ & $9$ &$9-12$ \\ $[8,4,5]_{11}$ & $5$ &$5$&$[28,14,10]_{11}$ & $10$ &$10-14$ \\ $[12,6,7]_{11}$ & $7$ &$7$&$\mathbf{[32,16,12]_{11}}$ & $\mathbf{12}$&$?-16$ \\ $[16,7,8]_{11}$ & $8$ &$9$&$\mathbf{[36,18,13]_{11}}$ & $\mathbf{13}$&$12-18$ \\ $[20,10,8]_{11}$ & $8$ &$10$&$\mathbf{[40,20,14]_{11}}$ & $\mathbf{14}$ &$13-20$ \\ \hline \end{tabular} \end{small} \caption{Best known minimum distances of symmetric self-dual codes over $GF(11)$ } \label{previous_results_11} \end{center} \end{table} \subsection{Symmetric self-dual codes over $GF(19)$. } \begin{proposition} There exist best symmetric self-dual codes over $GF(19)$ of length \linebreak $n=4,8,12,16,20,24,28,36,40$. Among them, $[4,2,3]_{19}$, $[8,4,5]_{19}$, $[12,6,7]_{19}$, and $[20,10,11]_{19}$ codes are MDS. Moreover, $[36,18,16]_{19}$ and $[40, 20,15]_{19}$ codes are new. \end{proposition} We give the highest minimum distance $d_{sym}$ of symmetric self-dual codes and the previously best known minimum distance $d_{sd}$ of self-dual codes in Table \ref{previous_results_19}. In this table, new parameters are written in bold. We present two symmetric self-dual codes having new parameters: \begin{itemize} \item $[36,18,14]_{19}$ code with a generator matrix $(I_{18} \mid A_{19}^{36})$ where \\ $A_{19}^{36}=\begin{smatrix} 16 & 14 & 4 & 15 & 10 & 15 & 17 & 7 & 4 & 16 & 16 & 14 & 3 & 7 & 5 & 2 & 5 & 12 \\ 14 & 13 & 18 & 11 & 15 & 17 & 11 & 5 & 5 & 11 & 16 & 16 & 12 & 4 & 17 & 0 & 16 & 4 \\ 4 & 18 & 18 & 12 & 18 & 12 & 2 & 6 & 12 & 18 & 14 & 1 & 10 & 16 & 10 & 6 & 13 & 6 \\ 15 & 11 & 12 & 7 & 1 & 8 & 1 & 3 & 1 & 12 & 11 & 5 & 5 & 7 & 7 & 2 & 10 & 8 \\ 10 & 15 & 18 & 1 & 7 & 9 & 14 & 14 & 7 & 12 & 13 & 16 & 16 & 2 & 16 & 9 & 16 & 4 \\ 15 & 17 & 12 & 8 & 9 & 2 & 7 & 15 & 5 & 12 & 2 & 9 & 2 & 10 & 14 & 18 & 12 & 9 \\ 17 & 11 & 2 & 1 & 14 & 7 & 11 & 13 & 16 & 1 & 16 & 17 & 4 & 11 & 4 & 11 & 9 & 18 \\ 7 & 5 & 6 & 3 & 14 & 15 & 13 & 9 & 0 & 16 & 3 & 3 & 8 & 7 & 10 & 14 & 4 & 7 \\ 4 & 5 & 12 & 1 & 7 & 5 & 16 & 0 & 12 & 17 & 1 & 7 & 4 & 0 & 9 & 0 & 17 & 18 \\ 16 & 11 & 18 & 12 & 12 & 12 & 1 & 16 & 17 & 3 & 1 & 17 & 12 & 12 & 16 & 12 & 9 & 11 \\ 16 & 16 & 14 & 11 & 13 & 2 & 16 & 3 & 1 & 1 & 15 & 17 & 4 & 12 & 10 & 0 & 7 & 4 \\ 14 & 16 & 1 & 5 & 16 & 9 & 17 & 3 & 7 & 17 & 17 & 8 & 7 & 6 & 18 & 1 & 11 & 18 \\ 3 & 12 & 10 & 5 & 16 & 2 & 4 & 8 & 4 & 12 & 4 & 7 & 14 & 0 & 9 & 9 & 6 & 15 \\ 7 & 4 & 16 & 7 & 2 & 10 & 11 & 7 & 0 & 12 & 12 & 6 & 0 & 18 & 5 & 13 & 13 & 4 \\ 5 & 17 & 10 & 7 & 16 & 14 & 4 & 10 & 9 & 16 & 10 & 18 & 9 & 5 & 13 & 7 & 0 & 7 \\ 2 & 0 & 6 & 2 & 9 & 18 & 11 & 14 & 0 & 12 & 0 & 1 & 9 & 13 & 7 & 12 & 17 & 3 \\ 5 & 16 & 13 & 10 & 16 & 12 & 9 & 4 & 17 & 9 & 7 & 11 & 6 & 13 & 0 & 17 & 2 & 17 \\ 12 & 4 & 6 & 8 & 4 & 9 & 18 & 7 & 18 & 11 & 4 & 18 & 15 & 4 & 7 & 3 & 17 & 10 \end{smatrix}$ \item $[40,20,15]_{19}$ code with a generator matrix $(I_{20} \mid A_{19}^{40})$ where \\ $A_{19}^{40}=\begin{smatrix} 8 & 7 & 12 & 5 & 0 & 13 & 15 & 11 & 16 & 6 & 17 & 14 & 6 & 6 & 6 & 4 & 18 & 14 & 13 & 14 \\ 7 & 16 & 13 & 4 & 13 & 3 & 1 & 13 & 4 & 11 & 5 & 12 & 6 & 4 & 13 & 16 & 11 & 6 & 6 & 16 \\ 12 & 13 & 5 & 6 & 13 & 11 & 12 & 12 & 16 & 9 & 3 & 0 & 16 & 17 & 2 & 8 & 6 & 14 & 6 & 9 \\ 5 & 4 & 6 & 1 & 7 & 15 & 0 & 4 & 16 & 14 & 1 & 8 & 0 & 9 & 12 & 9 & 10 & 5 & 16 & 2 \\ 0 & 13 & 13 & 7 & 17 & 17 & 18 & 17 & 16 & 16 & 8 & 0 & 1 & 13 & 14 & 3 & 11 & 6 & 9 & 14 \\ 13 & 3 & 11 & 15 & 17 & 9 & 0 & 0 & 11 & 2 & 11 & 1 & 11 & 13 & 15 & 16 & 16 & 15 & 0 & 0 \\ 15 & 1 & 12 & 0 & 18 & 0 & 0 & 14 & 4 & 15 & 13 & 8 & 14 & 17 & 17 & 9 & 0 & 5 & 15 & 0 \\ 11 & 13 & 12 & 4 & 17 & 0 & 14 & 6 & 12 & 5 & 18 & 18 & 12 & 8 & 3 & 13 & 15 & 10 & 11 & 18 \\ 16 & 4 & 16 & 16 & 16 & 11 & 4 & 12 & 7 & 2 & 10 & 3 & 4 & 16 & 1 & 13 & 16 & 8 & 12 & 17 \\ 6 & 11 & 9 & 14 & 16 & 2 & 15 & 5 & 2 & 12 & 12 & 12 & 8 & 5 & 14 & 3 & 5 & 1 & 17 & 9 \\ 17 & 5 & 3 & 1 & 8 & 11 & 13 & 18 & 10 & 12 & 18 & 0 & 16 & 8 & 11 & 18 & 5 & 17 & 10 & 10 \\ 14 & 12 & 0 & 8 & 0 & 1 & 8 & 18 & 3 & 12 & 0 & 16 & 1 & 11 & 14 & 10 & 14 & 7 & 7 & 17 \\ 6 & 6 & 16 & 0 & 1 & 11 & 14 & 12 & 4 & 8 & 16 & 1 & 6 & 10 & 7 & 13 & 9 & 6 & 4 & 0 \\ 6 & 4 & 17 & 9 & 13 & 13 & 17 & 8 & 16 & 5 & 8 & 11 & 10 & 5 & 5 & 9 & 11 & 7 & 13 & 4 \\ 6 & 13 & 2 & 12 & 14 & 15 & 17 & 3 & 1 & 14 & 11 & 14 & 7 & 5 & 6 & 13 & 10 & 15 & 14 & 8 \\ 4 & 16 & 8 & 9 & 3 & 16 & 9 & 13 & 13 & 3 & 18 & 10 & 13 & 9 & 13 & 13 & 15 & 17 & 0 & 17 \\ 18 & 11 & 6 & 10 & 11 & 16 & 0 & 15 & 16 & 5 & 5 & 14 & 9 & 11 & 10 & 15 & 8 & 6 & 18 & 17 \\ 14 & 6 & 14 & 5 & 6 & 15 & 5 & 10 & 8 & 1 & 17 & 7 & 6 & 7 & 15 & 17 & 6 & 7 & 11 & 17 \\ 13 & 6 & 6 & 16 & 9 & 0 & 15 & 11 & 12 & 17 & 10 & 7 & 4 & 13 & 14 & 0 & 18 & 11 & 13 & 5 \\ 14 & 16 & 9 & 2 & 14 & 0 & 0 & 18 & 17 & 9 & 10 & 17 & 0 & 4 & 8 & 17 & 17 & 17 & 5 & 17 \end{smatrix}$ \end{itemize} \begin{table}[h] \begin{center} \begin{small} \begin{tabular}{ccc|ccc} \hline $[n,k,d]_p$ & $d_{sym}$ &$d_{sd}$&$[n,k,d]_p$ & $d_{sym}$ &$d_{sd}$ \\ \hline $[4,2,3]_{19}$ & $3$ &$3$&$[24,12,10]_{19}$ & $10$ &$10-12$ \\ $[8,4,5]_{19}$ & $5$ &$5$&$[28,14,11]_{19}$ & $11$ &$11-14$ \\ $[12,6,7]_{19}$ & $7$ &$7$&$[32,16,12]_{19}$ & $12$&$14-16$ \\ $[16,8,8]_{19}$ & $8$ &$8-9$&$\mathbf{[36,18,14]_{19}}$ & $\mathbf{14}$&$?-18$ \\ $[20,10,11]_{19}$ & $11$ &$11$&$\mathbf{[40,20,15]_{19}}$ & $\mathbf{15}$ &$?-20$ \\ \hline \end{tabular} \end{small} \caption{Best known minimum distances of self-dual codes over $GF(19)$ } \label{previous_results_19} \end{center} \end{table} \subsection{Symmetric self-dual codes over $GF(23)$. } \begin{proposition} There exist the best symmetric self-dual codes over $GF(23)$ of length $n=4,8,12, 28,32,36,40$. Among them, $[4,2,3]_{23}$, $[8,4,5]_{23}$ and $[12,6,7]_{23}$ codes are MDS. Moreover, $[32,16,12]_{23}$, $[36,18,16]_{19}$ and $[40, 20,15]_{19}$ codes are new. \end{proposition} We give the highest minimum distance $d_{sym}$ of symmetric self-dual codes and the previously best known minimum distance $d_{sd}$ of self-dual codes in Table \ref{previous_results_23}. In this table, new parameters are written in bold. We present three symmetric self-dual codes having new parameters: \begin{itemize} \item $[32,16,12]_{23}$ code with a generator matrix $(I_{16} \mid A_{23}^{32})$ where \\ $A_{23}^{32}=\begin{smatrix} 20 & 4 & 11 & 18 & 21 & 7 & 19 & 7 & 15 & 6 & 18 & 18 & 2 & 10 & 5 & 12 \\ 4 & 1 & 19 & 12 & 11 & 19 & 20 & 8 & 10 & 3 & 11 & 0 & 3 & 6 & 18 & 18 \\ 11 & 19 & 12 & 20 & 9 & 2 & 0 & 22 & 21 & 21 & 9 & 6 & 21 & 16 & 13 & 9 \\ 18 & 12 & 20 & 2 & 13 & 7 & 4 & 7 & 22 & 18 & 5 & 15 & 0 & 5 & 11 & 20 \\ 21 & 11 & 9 & 13 & 9 & 20 & 8 & 19 & 11 & 12 & 11 & 21 & 19 & 14 & 19 & 20 \\ 7 & 19 & 2 & 7 & 20 & 3 & 12 & 19 & 5 & 2 & 22 & 1 & 21 & 21 & 22 & 13 \\ 19 & 20 & 0 & 4 & 8 & 12 & 12 & 4 & 19 & 7 & 17 & 11 & 8 & 4 & 1 & 0 \\ 7 & 8 & 22 & 7 & 19 & 19 & 4 & 1 & 0 & 0 & 16 & 16 & 8 & 15 & 9 & 3 \\ 15 & 10 & 21 & 22 & 11 & 5 & 19 & 0 & 22 & 1 & 2 & 12 & 13 & 12 & 10 & 5 \\ 6 & 3 & 21 & 18 & 12 & 2 & 7 & 0 & 1 & 14 & 5 & 5 & 22 & 18 & 11 & 1 \\ 18 & 11 & 9 & 5 & 11 & 22 & 17 & 16 & 2 & 5 & 10 & 20 & 18 & 12 & 6 & 18 \\ 18 & 0 & 6 & 15 & 21 & 1 & 11 & 16 & 12 & 5 & 20 & 13 & 16 & 17 & 5 & 22 \\ 2 & 3 & 21 & 0 & 19 & 21 & 8 & 8 & 13 & 22 & 18 & 16 & 3 & 5 & 7 & 6 \\ 10 & 6 & 16 & 5 & 14 & 21 & 4 & 15 & 12 & 18 & 12 & 17 & 5 & 7 & 18 & 2 \\ 5 & 18 & 13 & 11 & 19 & 22 & 1 & 9 & 10 & 11 & 6 & 5 & 7 & 18 & 3 & 0 \\ 12 & 18 & 9 & 20 & 20 & 13 & 0 & 3 & 5 & 1 & 18 & 22 & 6 & 2 & 0 & 6 \end{smatrix}$ \item $[36,18,14]_{23}$ code with a generator matrix $(I_{18} \mid A_{23}^{36})$ where \\ $A_{23}^{36}=\begin{smatrix} 14 & 8 & 18 & 22 & 3 & 17 & 6 & 3 & 2 & 7 & 14 & 2 & 22 & 12 & 6 & 8 & 12 & 19 \\ 8 & 18 & 5 & 14 & 21 & 10 & 12 & 16 & 15 & 0 & 18 & 16 & 0 & 20 & 3 & 1 & 2 & 6 \\ 18 & 5 & 3 & 13 & 8 & 0 & 20 & 1 & 13 & 12 & 22 & 19 & 14 & 9 & 14 & 15 & 22 & 18 \\ 22 & 14 & 13 & 9 & 7 & 1 & 1 & 17 & 10 & 9 & 22 & 14 & 1 & 11 & 11 & 15 & 19 & 12 \\ 3 & 21 & 8 & 7 & 20 & 9 & 0 & 2 & 10 & 19 & 7 & 5 & 16 & 0 & 16 & 3 & 15 & 19 \\ 17 & 10 & 0 & 1 & 9 & 22 & 1 & 13 & 4 & 13 & 5 & 10 & 14 & 0 & 14 & 17 & 2 & 8 \\ 6 & 12 & 20 & 1 & 0 & 1 & 3 & 13 & 20 & 13 & 1 & 19 & 2 & 6 & 12 & 12 & 2 & 0 \\ 3 & 16 & 1 & 17 & 2 & 13 & 13 & 21 & 13 & 16 & 17 & 4 & 6 & 6 & 5 & 12 & 9 & 1 \\ 2 & 15 & 13 & 10 & 10 & 4 & 20 & 13 & 22 & 2 & 6 & 5 & 14 & 14 & 13 & 16 & 13 & 8 \\ 7 & 0 & 12 & 9 & 19 & 13 & 13 & 16 & 2 & 17 & 9 & 21 & 17 & 4 & 2 & 7 & 20 & 7 \\ 14 & 18 & 22 & 22 & 7 & 5 & 1 & 17 & 6 & 9 & 20 & 15 & 4 & 22 & 13 & 0 & 17 & 14 \\ 2 & 16 & 19 & 14 & 5 & 10 & 19 & 4 & 5 & 21 & 15 & 13 & 2 & 15 & 20 & 20 & 3 & 18 \\ 22 & 0 & 14 & 1 & 16 & 14 & 2 & 6 & 14 & 17 & 4 & 2 & 0 & 2 & 9 & 0 & 11 & 1 \\ 12 & 20 & 9 & 11 & 0 & 0 & 6 & 6 & 14 & 4 & 22 & 15 & 2 & 1 & 7 & 7 & 5 & 15 \\ 6 & 3 & 14 & 11 & 16 & 14 & 12 & 5 & 13 & 2 & 13 & 20 & 9 & 7 & 13 & 1 & 9 & 20 \\ 8 & 1 & 15 & 15 & 3 & 17 & 12 & 12 & 16 & 7 & 0 & 20 & 0 & 7 & 1 & 1 & 4 & 9 \\ 12 & 2 & 22 & 19 & 15 & 2 & 2 & 9 & 13 & 20 & 17 & 3 & 11 & 5 & 9 & 4 & 18 & 15 \\ 19 & 6 & 18 & 12 & 19 & 8 & 0 & 1 & 8 & 7 & 14 & 18 & 1 & 15 & 20 & 9 & 15 & 15 \end{smatrix}$ \item $[40,20,15]_{23}$ code with a generator matrix $(I_{20} \mid A_{23}^{40})$ where \\ $A_{23}^{40}=\begin{smatrix} 3 & 3 & 17 & 18 & 20 & 7 & 20 & 7 & 8 & 12 & 14 & 0 & 8 & 22 & 18 & 0 & 0 & 8 & 9 & 19 \\ 3 & 8 & 11 & 22 & 1 & 4 & 11 & 4 & 4 & 9 & 8 & 20 & 7 & 21 & 19 & 16 & 13 & 9 & 22 & 10 \\ 17 & 11 & 8 & 10 & 0 & 11 & 3 & 6 & 20 & 11 & 3 & 20 & 15 & 1 & 14 & 4 & 11 & 8 & 19 & 6 \\ 18 & 22 & 10 & 1 & 0 & 6 & 14 & 2 & 1 & 15 & 22 & 19 & 11 & 1 & 2 & 3 & 5 & 12 & 12 & 16 \\ 20 & 1 & 0 & 0 & 12 & 5 & 0 & 15 & 0 & 5 & 20 & 1 & 13 & 16 & 21 & 14 & 8 & 21 & 10 & 3 \\ 7 & 4 & 11 & 6 & 5 & 15 & 2 & 7 & 9 & 0 & 22 & 15 & 1 & 16 & 22 & 2 & 8 & 13 & 16 & 7 \\ 20 & 11 & 3 & 14 & 0 & 2 & 17 & 4 & 17 & 6 & 0 & 6 & 14 & 5 & 19 & 8 & 11 & 11 & 17 & 5 \\ 7 & 4 & 6 & 2 & 15 & 7 & 4 & 5 & 9 & 19 & 16 & 19 & 7 & 12 & 12 & 14 & 11 & 15 & 22 & 3 \\ 8 & 4 & 20 & 1 & 0 & 9 & 17 & 9 & 12 & 10 & 13 & 18 & 5 & 6 & 19 & 10 & 21 & 5 & 5 & 10 \\ 12 & 9 & 11 & 15 & 5 & 0 & 6 & 19 & 10 & 5 & 2 & 16 & 14 & 13 & 5 & 6 & 5 & 9 & 20 & 14 \\ 14 & 8 & 3 & 22 & 20 & 22 & 0 & 16 & 13 & 2 & 0 & 14 & 10 & 9 & 10 & 19 & 7 & 12 & 7 & 21 \\ 0 & 20 & 20 & 19 & 1 & 15 & 6 & 19 & 18 & 16 & 14 & 13 & 18 & 4 & 9 & 10 & 4 & 11 & 2 & 9 \\ 8 & 7 & 15 & 11 & 13 & 1 & 14 & 7 & 5 & 14 & 10 & 18 & 15 & 19 & 6 & 20 & 20 & 12 & 15 & 22 \\ 22 & 21 & 1 & 1 & 16 & 16 & 5 & 12 & 6 & 13 & 9 & 4 & 19 & 9 & 16 & 6 & 17 & 20 & 8 & 12 \\ 18 & 19 & 14 & 2 & 21 & 22 & 19 & 12 & 19 & 5 & 10 & 9 & 6 & 16 & 17 & 14 & 13 & 15 & 3 & 13 \\ 0 & 16 & 4 & 3 & 14 & 2 & 8 & 14 & 10 & 6 & 19 & 10 & 20 & 6 & 14 & 15 & 4 & 1 & 9 & 12 \\ 0 & 13 & 11 & 5 & 8 & 8 & 11 & 11 & 21 & 5 & 7 & 4 & 20 & 17 & 13 & 4 & 12 & 22 & 18 & 19 \\ 8 & 9 & 8 & 12 & 21 & 13 & 11 & 15 & 5 & 9 & 12 & 11 & 12 & 20 & 15 & 1 & 22 & 18 & 14 & 8 \\ 9 & 22 & 19 & 12 & 10 & 16 & 17 & 22 & 5 & 20 & 7 & 2 & 15 & 8 & 3 & 9 & 18 & 14 & 20 & 5 \\ 19 & 10 & 6 & 16 & 3 & 7 & 5 & 3 & 10 & 14 & 21 & 9 & 22 & 12 & 13 & 12 & 19 & 8 & 5 & 2 \end{smatrix}$ \end{itemize} \begin{table}[h] \begin{center} \begin{small} \begin{tabular}{ccc|ccc} \hline $[n,k,d]_p$ & $d_{sym.}$ &$d_{s.d.}$&$[n,k,d]_p$ & $d_{sym.}$ &$d_{s.d.}$ \\ \hline $[4,2,3]_{23}$ & $3$ &$3$&$[24,12,10]_{19}$ & $10$ &$13$ \\ $[8,4,5]_{23}$ & $5$ &$5$&$[28,14,11]_{19}$ & $11$ &$11-14$ \\ $[12,6,7]_{23}$ & $7$ &$7$&$\mathbf{[32,16,12]_{19}}$ & $\mathbf{12}$&$?-16$ \\ $[16,8,8]_{23}$ & $8$ &$9$&$\mathbf{[36,18,14]_{19}}$ & $\mathbf{14}$&$13-18$ \\ $[20,10,9]_{23}$ & $9$ &$10-11$&$\mathbf{[40,20,15]_{19}}$ & $\mathbf{15}$ &$14-20$ \\ \hline \end{tabular} \end{small} \caption{Best known minimum distances of symmetric self-dual codes over $GF(23)$ } \label{previous_results_23} \end{center} \end{table} \begin{table}[h!] \begin{center} \begin{small} \begin{tabular}{|c|r|r|r|r|r|r|r| \hline $n\backslash q$ & \multicolumn{1}{|c}{5} & \multicolumn{1}{|c}{7} & \multicolumn{1}{|c}{11} & \multicolumn{1}{|c}{13} & \multicolumn{1}{|c}{17} & \multicolumn{1}{|c}{19} & \multicolumn{1}{|c|}{23} \\\hline \hline 2 &$2^*$ &- &- &$2^*$ &$2^*$ & - & - \\\hline 4 &$2^o$ &$3^*$ &$3^*$ &$3^*$ &$3^*$ &$3^*$ & $3^*$ \\\hline 6 &$4^*$ &- &- &$4^*$ &$4^*$ & - & - \\\hline 8 &$4^o$ &$5^*$ &$5^*$ &$5^*$ &$5^*$ &$5^*$ & $5^*$ \\\hline 10 &$4^o$ &- &- &$6^*$ &$6^*$ & - & - \\\hline 12 &$6^o$ &$6^o$ &$7^*$ &$6^o$ &$7^*$ &$7^*$ & $7^*$ \\\hline 14 &$6^o$ &- &- &$8^*$ &$7-8$ & - & - \\\hline 16 &$7^o$ & $7^o$ &$8^o$ &$8^o$ &$8-9$ & $8-9$ & $9^*$ \\\hline 18 &$7^o$ &- & - &${8-9}$ &$10^*$ & - & - \\\hline 20 &$8^o$ & $9^o$ &$10^o$ &$10^o$ &$10^o$ &$11^*$ & $10-11$ \\\hline 22 &$8^o$ &- & - &$10-11$ &$10-11$ & - & - \\\hline 24 &$9-10$ & $9-11$ & $9-12$ &$10-12$ &$10-12$ & $10-12$ & $13^*$\\\hline 26 &$9-10$ &- & - & ${10-13}$ &${10-13}$ & - & - \\\hline 28 &$10-11$ & $11-13$ & $10-14$ & ${11-14}$ &${11-14}$ & $11-14$ & $11-14$ \\\hline 30 &$10-12$ &- & - & ${11-15}$ &${12-15}$ & - & - \\\hline 32 &$11-13$ & $13-14$ & $12-16$ & ${12-16}$ &${12-16}$ & ${14-16}$ & $12-16$ \\\hline 34 &$11-14$ &- &- & ${12-17}$ &${13-17}$ &- & - \\\hline 36 &$12-15$ & $13-16$ & $13-18$ & ${13-18}$ &${13-18}$ & $14-18$ & $14-18$ \\\hline 38 &$12-16$ &- &- & ${13-19}$ &${14-19}$ &- & - \\\hline 40 &$13-17$ & $14-18$ & $14-20$ & ${14-20}$ &${14-20}$ & $15-20$ & $15-20$ \\\hline \end{tabular} \end{small} \caption{Bounds on the highest minimum distances of self-dual codes over $GF(p)$ for primes $5 \le p \le 23$ up to lengths 40. In this table, ${}^o$ denotes optimal code and ${}^*$ denotes MDS code.} \label{summary} \end{center} \end{table} \section{Conclusions} In this article, we introduced new construction methods of symmetric self-dual codes over finite fields. Then we have constructed many new symmetric self-dual codes, including 153 self-dual codes with new parameters, up to equivalence. This paper contributes in two ways. One is to provide new \linebreak construction methods of symmetric self-dual codes over $GF(q)$ for the \linebreak challenging case of $q \equiv 3 \pmod 4$. The other is to improve bounds on the highest minimum distance of self-dual codes, which have not been significantly updated for almost two decades because of computational complexity. We believe that our methods can produce more results for self-dual codes over larger finite fields and/or of longer lengths. \section*{Acknowledgment} The author sincerely thanks Dr. Markus Grassl for his helpful comments which was crucial for the implementation.
\section{Discussion and Future Work} In this paper, we present two visual analytics modules to facilitate intuitive assessment of a machine learning model's reliability. Our work is motivated in part by interpretability needs elicited in prior work. For example, studies have found that communicating model limitations and uncertainty is important for building trust~\cite{cai2019hello,tonekaboni2019clinicians}, but that people have difficulty understanding the meaning of predicted probability scores and incorporating them into decision-making~\cite{bussone_role_2015}. Other work has described the importance of users being able to ``sanity check'' a model's decision as a way to build trust~\cite{bhatt_explainable_2020,hong2020human,liao2020questioning}, but there have been few proposed methods or interfaces for doing so. In response, our visual analytics modules are designed to allow users to interactively probe the model and to reason about its behavior through familiar examples grounded in their domain knowledge. Users can explore a given input's nearest neighbors in the training data to better understand if and why the model is uncertain, and what high-level features the model is learning. They can further manipulate the input using domain-specific transformations to test hypotheses about the model's behavior or ensure that it is not overly sensitive to small changes. Through think-aloud studies with 14 medical practitioners, we find that our visual analytics modules successfully achieve our design goals by helping participants reason about and interact with the model's output in ways that align with their existing conceptual models of the domain. Our studies demonstrate how grounding interpretability in real examples, facilitating comparison across them, and visualizing class distributions can help users grasp the model's uncertainty and connect it to relevant challenges of the task. Moreover, looking at and comparing real examples can also help users discover or ask questions about limitations of the data\,---\,and doing so does not damage trust, but can play an important role in building it. We also find that our interactive input editor, which offers semantically-meaningful and domain-specific transformations with which to probe the model, provides an effective way for users to sanity check the model's reasoning. Importantly, we find that participants in our study described the hypotheses they were testing in terms of higher-level features corresponding to their domain knowledge. In contrast, the baseline\,---\,which implemented a commonly-used feature importance method~\cite{ribeiro_why_2016}\,---\,did not facilitate the same sorts of investigation. We found that this baseline interface demanded a large a mental leap from participants in order to understand how highlighted important sections of the waveform contributed to a high/low predicted probability. At the same time, our results also point to limitations with the current design of our visual analytics interfaces and suggest opportunities for future work. We find that when the nearest neighbor waveforms looked significantly different than expected, participants had difficulty reasoning about why the model thought the neighbors were similar. We posit that part of participants' confusion was caused by the uneven distribution of beat classes in the training data, which affects the quality of nearest neighbors. For example, supraventricular ectopic beats comprise only 2.7\% of training examples; thus, the model was neither able to precisely distinguish this beat from others, nor were there sufficient similar examples to fill the list of neighbors. However, this possibility of under-representation in the training data did not occur to participants when seeing low-quality neighbors. Aside from collecting sufficient data to compute better-quality neighbors, this result suggests the need for transparent communication of the model's training data distribution and its implications. If a user is then presented with output where the neighbors do not appear to make sense, they may be better equipped to understand why this might be the case. Indeed, we found that when we described this phenomena to participants after the conclusion of the study, they were able to understand why under-representation would affect the nearest neighbors\,---\,it had just not been on their radar previously. Similarly, Cai et al. \cite{cai2019hello} found the need for an \textit{``AI Primer''} for users to explain, in part, \textit{``AI-specific behavior that may be surprising.''} Our observations suggest specific use cases of and types of information to include in such a primer. In other cases, participants found it difficult to apply transformations using the input editor because the space of possible hypotheses was too open-ended. Here, methods that generate counterfactual examples (i.e., similar example(s) that are classified differently)~\cite{wachter_counterfactual_2018,goyal_counterfactual_2019,mothilal2020explaining} might provide useful inspiration. These methods automatically generate modified inputs by finding small transformations that yield different predictions, but because they do not require any user intervention, they can return unrealistic examples that cannot be probed further. However, such methods could usefully bootstrap our input editor. For example, automatically generated examples could help constrain the space of possible hypotheses to only those transformations that cause the greatest change in the model output. Users could then bring their domain knowledge to bear on selecting semantically-meaningful examples to either visualize directly or as a starting point for further transformation. Finally, while we demonstrate our interface using an ECG case study, there is a significant opportunity for future work to investigate how these interface modules could be instantiated for other applications. Different data modalities will require different techniques to facilitate comparing examples and assessing variance\,---\,for example, while overlaying examples may be appropriate for signals and other image-based data, natural language data might require viewing examples separately and explicitly highlighting differences in wording. The right input modifications will also vary based on the application, and should emerge through working with the intended users. We imagine promising directions (e.g., building on Kim et al.~\cite{kim2018interpretability}) for allowing users to define and interact with meaningful high-level concepts in different types of data. \section{Discussion and Future Work} In this paper, we present two visual analytics modules to facilitate intuitive assessment of a machine learning model's reliability. These modules are designed to allow users to interactively probe the model and to reason about its behavior through familiar examples grounded in their domain knowledge. Users can explore a given input's nearest neighbors in the training data to better understand if and why the model is uncertain, and what high-level features the model is learning. They can further manipulate the input using domain-specific transformations to test hypotheses about the model's behavior or ensure that it is not overly sensitive to small changes. Throughout think-aloud studies with 14 medical practitioners, we found that our visual analytics modules successfully achieved our design goals by helping participants reason about and interact with the model's output in ways that aligned with their domain expertise and thinking. Our designs were motivated in part by prior work in cognitive psychology suggesting that people solve problems by utilizing knowledge about past cases~\cite{renkl_example-based_2009,aamodt_case-based_1994}, and that it is a particularly relevant form of reasoning in medicine~\cite{sayre2017case}. Here, we demonstrate how these ideas could translate to an ML application, and their benefits for understanding model behavior. In particular, viewing nearest neighbor examples helped participants discover higher-level morphologies that the model was learning, more so than seeing important segments highlighted on the input as in our baseline. We also found that our interfaces helped participants approach the model in a more critical way, investigating the nearest neighbor class distribution and waveforms to see why the model was uncertain, and connecting that uncertainty to clinical concepts. Prior interview studies with medical practitioners have reported that \textit{``participants implicitly and explicitly understood that no tool (or person) is perfect,''}~\cite{cai2019hello}, and \textit{``the acknowledgement of this challenge promotes trustworthiness''}~\cite{tonekaboni2019clinicians}. We build upon this idea in our work, identifying and implementing specific design goals to communicate model uncertainty/limitations, and demonstrating multiple ways that participants used the resultant interfaces to understand and build trust with the model. The input editor further allowed participants to engage in back-and-forth questioning to formulate and test their hypotheses about the model's behavior. Several studies or frameworks of interpretability needs have described the need for users to ``sanity check'' a model's decision as a way to build trust~\cite{bhatt_explainable_2020,tonekaboni2019clinicians,hong2020human,cai2019hello,liao2020questioning}, but there have been few proposed methods or interfaces for addressing this need in practice. Here, we found that our interactive input editor, which offers semantically-meaningful and domain-specific transformations, provides an effective way for users to perform such sanity checks. Importantly, we found that participants in our study described the transformations they were applying in terms of higher-level features corresponding to their domain knowledge. In contrast, the baseline\,---\,which implemented a commonly-used feature importance method~\cite{ribeiro_why_2016}\,---\,did not facilitate the same sorts of investigation. We found that this interface demanded too large mental leap from participants in order to to understand how highlighted important sections of the waveform contributed to a high predicted probability. This observation is in line with prior work studying the effect of feature-based explanations on doctors' diagnostic performance~\cite{bussone_role_2015}, in which participants expressed confusion about the clinical meaning of a predicted probability, and how to incorporate the explanation into decision-making. Our study builds on these findings by specifically comparing feature-based explanations to example-based ones, describing the ways in which the latter helped participants better grasp the model's behavior and uncertainty. At the same time, our results also point to limitations with the current design of our visual analytics interfaces and suggest opportunities for future work. We found that when the nearest neighbor waveforms looked significantly different than expected, participants had difficulty reasoning about why the model thought the neighbors were similar. We posit that part of participants' confusion was caused by the uneven distribution of beat classes in the training data, which affects the quality of nearest neighbors. For example, supraventricular ectopic beats comprise only 2.7\% of training examples; thus, the model was neither able to precisely distinguish this beat from others, nor were there sufficient similar examples to fill the list of neighbors. However, this possibility of under-representation in the training data did not occur to participants when seeing low-quality neighbors. Aside from collecting sufficient data to compute high quality neighbors, this suggests the need for transparent communication of the model's training data distribution and its implications. If a user is then presented with output where the neighbors do not appear to make sense, they may be better equipped to understand why this might be the case. Indeed, we found that when we described this phenomena to participants after the conclusion of the study, they were able to understand why under-representation would affect the nearest neighbors\,---\,it had just not been on their radar previously. Similarly, Cai et al. \cite{cai2019hello} found the need for an \textit{``AI Primer''} for users to explain, in part, \textit{``AI-specific behavior that may be surprising.''} Our observations suggest specific use cases of and types of information to include in such a primer. In some cases, participants found it difficult to apply transformations using the input editor because the space of possible hypotheses was too open-ended. Here, methods that generate counterfactual examples (i.e., similar example(s) that are classified differently)~\cite{wachter_counterfactual_2018,goyal_counterfactual_2019,mothilal2020explaining} might provide useful inspiration. These methods automatically generate modified inputs by finding small transformations that yield different predictions, but because they do not require any user intervention, they can return unrealistic examples that cannot be probed further. However, such methods could usefully bootstrap our input editor. For example, automatically generated examples could help constrain the space of possible hypotheses to only those transformations that cause the greatest change in the model output. Users could then bring their domain knowledge to bear on selecting semantically-meaningful examples to either visualize directly or as a starting point for further transformation. Finally, while we demonstrate our interface using an ECG case study, there is a significant opportunity for future work to investigate how these interface modules could be instantiated for other applications. Different data modalities will require different techniques to facilitate comparing examples and assessing variance\,---\,for example, while overlaying examples may be appropriate for signals and other image-based data, natural language data might require viewing examples separately and explicitly highlighting differences in wording. The right input modifications will also vary based on the application, and should emerge through working with the intended users. We imagine promising directions (e.g., building on Kim et al.~\cite{kim2018interpretability}) for allowing users to define and interact with meaningful high-level concepts in different types of data. \section{Related Work} \subsection{Interpretability Methods for Human Understanding} ML interpretability aims to provide information that helps people understand how a model works, either on a global or case-by-case level \cite{gilpin_explaining_2018}. Such efforts can serve a number of different goals, such as aiding in decision-making, helping debug or improve a system, or building confidence in the model \cite{hong_human_2020}. A major area of focus has been on developing methodologies for computing and presenting such explanations \cite{carvalho_machine_2019}. Some methods try to visualize the internals of a particular model to reason about how it is operating \cite{michelini_multigrid_2019, carter_exploring_2019,zeiler2014visualizing}. This can be useful for theoretical ML understanding and model development, but may be too abstract and complicated to help people without knowledge of such models and how they work. Others try to produce explanations more grounded in the features of the data, such as a ranking of features important for the prediction or a decision-tree approximating the model’s logic \cite{du_techniques_2019, ribeiro_why_2016, lundberg_unified_2017}. However, a growing body of work that has tried to empirically measure the efficacy of many of these methods has shown that they often do not actually affect or improve human decision-making \cite{poursabzi-sangdeh_manipulating_2019, lai_human_2019, adhikari_leafage_2019, bussone_role_2015,jesus2021can}, and in practice are primarily used for internal model debugging \cite{bhatt_explainable_2020}. To understand the discord between proposed interpretability methods and their suitability for real-world users, we can draw from well-established theories in cognitive psychology that describe how people think about problems and organize information using different “cognitive chunks” \cite{miller1956magical}. For example, a physician might think about diagnostic decisions in terms of concepts that are higher-level than individual features, or relate features to each other in more complex ways than independently ranking them by importance. This idea manifests in theories of HCI stating that effective and engaging interfaces should allow users to view and interact with them in a way that feels \textit{direct}\,---\,i.e., the visualizations and interactive mechanisms available to users should align with their cognitive chunks. Specifically, Hutchins et al. \cite{hutchins1985direct} describe “the gulf of execution,” arising from a gap between the available mechanisms of an interface and the user’s thoughts and goals, and “the gulf of evaluation,” arising from a gap between the visual display of an interface and the user’s conceptual model of the domain. Our aim is to narrow both of these gaps. To this end, example-based (also referred to as instance-based) interpretability methods, which produce explanations in terms of other input examples, are of particular interest. Research in cognitive psychology and education supports the idea that people often use past cases to reason about new ones when solving problems \cite{aamodt_case-based_1994} and that utilizing examples can help people understand complex concepts, build intuition, and form better mental models \cite{renkl_example-based_2009,renkl_toward_2014}. Different types of example-based explanations for ML models have been proposed. Many of these are computed \textit{post hoc}, i.e., they are generated after a prediction is made to try and explain that prediction. For example, counterfactual examples \cite{wachter_counterfactual_2018, goyal_counterfactual_2019} use gradient-based methods to generate the closest example(s) to the input that are predicted to be a different class (defining appropriate measures of “closeness” is an open question). Influence functions \cite{koh_understanding_2017} try to trace a model’s predictions back to the data it was trained on, identifying the examples that were most influential to the prediction. Normative explanations \cite{cai_effects_2019} present users with a set of training examples from the predicted class. There are limitations of these approaches as well; for example, technical constraints make quickly generating influential examples quite difficult in practice \cite{basu_influence_2020, bhatt_explainable_2020}, and hidden assumptions about actionability in counterfactual explanations can be misleading \cite{barocas_hidden_2020}. Others compute example-based explanations by modifying the inference process of a trained model to produce predictions based directly on similar training examples. For example, both Caruana et al. \cite{caruana1999case} and Shin and Park \cite{shin1999memory} use a trained neural network model to improve a KNN classifier, either through using the model to create a weighted similarity function or through computing similarity in the embedding space of the model, respectively. The class label making up the majority of nearest neighbors can be interpreted as the prediction, and the nearest neighbor examples used as an explanation. Of particular relevance to our case study, Caruana et al. \cite{caruana1999case} is motivated by the potential benefits of example-based explanations in clinical settings: “\textit{because medical training and practice emphasizes case evaluation, most medical practitioners are adept at understanding explanations provided in the form of cases}.” Recently, Papernot and McDaniel \cite{papernot_deep_2018} extended this methodology to compute neighbors using embeddings from multiple layers of a neural network, demonstrating additional uses for improving the model’s robustness and confidence estimates. In our proposed interface, we compute neighbors using the method of \cite{caruana1999case}; this could be easily extended to calculate neighbors in a weighted input space as in \cite{shin1999memory}, or to use embeddings from multiple layers of the neural network as in \cite{papernot_deep_2018}. Prior work has focused on developing optimal ways for the trained neural network to inform the KNN algorithm, implying that the nearest neighbors would then serve as an explanation. Here, we focus on a relatively unexplored part of this claim, investigating how the resultant output should be presented to the user in an interactive interface to narrow the gulfs of execution and evaluation. We explore a specific case study to more clearly define the ways in which this type of example-based explanation can improve trust and understanding for real users. \subsection{Interactivity and Visualization for Interpretability} For interpretability to be useful in practice, effectively communicating information to the user is a critical step. In a literature review of interpretability systems and techniques, Nunes and Jannach \cite{nunes2017review} found that the vast majority of papers presented explanations in a natural-language-based format (e.g., a list of feature weights). Other types of visualizations include simple charts (e.g., bar plots indicating feature importances) \cite{ribeiro_why_2016} or highlighting/denoting sections of the input (e.g., displaying important pixels of an image in a different color or opacity) \cite{sturmfels_visualizing_2020, lai_human_2019}. With respect to example-based explanations, the visualizations used are often a table of features if the data is tabular \cite{wachter_counterfactual_2018,mothilal_explaining_2020,wexler2019if} or a list of images if the data is image-based \cite{koh_understanding_2017, kim_examples_2016,cai_effects_2019}. Here, we explore visual encodings that convey more information and allow for more interaction than listing examples. Other work specifically focuses on visualizations of latent embeddings within a neural network model. Many of these utilize 2 or 3D plots to visualize distance between different examples in the embedding space \cite{liu2019latent,boggust2019embedding,heimerl2018interactive}. Liu et al. \cite{liu2019latent} additionally visualize examples along 1D vectors corresponding to user-defined concepts, and Boggust et al. \cite{boggust2019embedding} provide the ability to compare embeddings of two different models by viewing and interacting with the two plots side-by-side. Particularly relevant to our work, some of the visualizations of text embeddings proposed in \cite{heimerl2018interactive} aim to display a given word’s nearest neighbors in an embedding space. They plot the nearest neighbors as points along a 1D axis that encodes distance, and provide the ability to compare the nearest neighbors across different embeddings. With respect to interactivity in the interface, prior work has primarily studied using human feedback to modify or filter the information that is shown \cite{kim_interactive_2015, kulesza_principles_2015,sokol2020one,cai2019human}. Here, our goal is instead to provide users with a way to probe the model and test hypotheses about its behavior. The tool described in \cite{wexler2019if} similarly allows modifying the input to observe how a model’s output changes, though in their case, it is intended primarily for users familiar with ML. Like these prior works, our interface aims to facilitate understanding by allowing users to visualize and interact with examples from the data. However, while they are primarily intended for general exploration of what a model has learnt, or for uncovering underlying structure in data, the goal of our interface is to help users assess the reliability of predictions on a case-by-case basis. \section{Visual Analytics for Intuitive Model Assessment} We introduce two visual analytics modules for intuitively assessing the reliability of ML models. In Sec. \ref{sec:design_goals}, we outline the goals that guide our designs. The proposed modules utilize general ideas that can be customized to different domains, and we illustrate them with a concrete instantiation of the ECG beat classification task introduced in Sec. \ref{sec:case_study}. We then describe the visual components of each module: a display of the model’s output in terms of an aggregate and an individual-level view of nearest neighbors (Sec. \ref{sec:knn}), and an editor with which users can interactively modify model input and observe how the output changes in response (Sec. \ref{sec:editor}). Finally, in Sec. \ref{sec:use_cases} we walk through specific ways that users can interact with the visual analytics modules to more intuitively assess the model and its predictions. \subsection{Design Goals}\label{sec:design_goals} To facilitate intuitive assessment of model behavior, our overarching goal is to narrow the \textit{gulf of evaluation} and \textit{gulf of execution} for the users of our visual analysis interfaces~\cite{hutchins1985direct}. We identify several sub-goals to this end, which motivate the design of our interfaces: \begin{itemize} \item [\textbf{G1.}] \textbf{Ground visualizations in examples.} To narrow the gulf of evaluation, the visual components of our interface should facilitate reasoning that aligns with users' existing conceptual models. We draw from research suggesting that reasoning through prior examples can aid in problem-solving \cite{aamodt_case-based_1994}, understanding, and mental model-building over time \cite{renkl_example-based_2009,renkl_toward_2014}. Particularly for users who are more familiar with the application domain than the mechanisms of ML models, using examples is likely to facilitate more intuitive reasoning than approaches based on model components or individual features (consider reasoning about anatomical structures in an x-ray versus individual pixels). Therefore, we aim to use real examples as the building blocks of our visualization. \item [\textbf{G2.}] \textbf{Facilitate comparisons across examples.} To further facilitate interaction more aligned with users' existing modes of thinking, we are motivated by literature suggesting that \textit{contrastive} reasoning (i.e., reasoning based on what makes a particular case different than similar cases) is a particularly important way that people understand and explain things \cite{miller2019explanation,lipton1990contrastive}. Building on this, we aim to make it straightforward for users to compare specific examples in terms of meaningful high-level concepts in the data, enabling them to build understanding with contrastive reasoning. \item [\textbf{G3.}] \textbf{Visualize distributions over predicted classes.} Often, the output of ML-based systems is just a single predicted class, which may convey a false sense of certainty and prompt over-reliance, as some studies have found \cite{gaube2021ai,lee2004trust}. On the other hand, conveying model uncertainty can help users align model behavior with their understanding of inherent challenges or ambiguities in the task \cite{cai2019hello,tonekaboni2019clinicians}. Indeed, research on human trust suggests that in addition to conveying assurances of certainty, acknowledging when systems are \textit{un}certain is also an important factor in building effective trust \cite{jacovi2021formalizing}. Providing a probability score along with the prediction is one way to convey uncertainty, though understanding how to interpret abstract probability values is itself challenging for people. Instead, we aim to visualize the output from the model as a distribution over classes at multiple levels of granularity. For example, visualizing an overall probability distribution alongside the specific examples belonging to each class may help users better grasp the sources of the model’s (un)certainty and reconcile it with their own understanding of the task. \item [\textbf{G4.}] \textbf{Enable interactive probing of the model in terms of domain-relevant concepts.} Prior work interviewing ML stakeholders has found that one way to build trust is to provide users with ways to confirm that the model is using sensible logic that aligns with their expectations \cite{bhatt_explainable_2020, hong_human_2020,liao2020questioning,tonekaboni2019clinicians,cai2019hello}. To facilitate this process, we are motivated by the call to design for ``contenstibility,'' i.e., to make questioning and probing the model an integrated part of the system, rather than ``out-of-band activities'' \cite{mulligan2019shaping,hirsch2017designing}. Interactive capabilities for exploring and querying the model can encourage this kind of engagement\,---\,prompting a back-and-forth process where users develop hypotheses and test them, confirming that the model’s behavior aligns with their domain knowledge or uncovering unexpected issues. To minimize the gulf of execution, it is also important that users can form such queries in terms of domain-relevant and semantically-meaningful concepts. \end{itemize} \subsection{ECG Beat Classification Case Study }\label{sec:case_study} Although our visual analysis interfaces are general-purpose and can be adapted for different domains, we will use a specific case study of classifying electrocardiogram (ECG) beats as a case study to more concretely instantiate and evaluate our ideas. This task allows us to perform an application-grounded evaluation of our system using a realistic task\footnote{Using an overly-simplified or proxy task can be more straightforward, but can also yield less reliable results as it is not something the participants are familiar with or have prior conceptions about doing \cite{bucinca2020proxy}.} that people (i.e., physicians) are familiar with \cite{doshi-velez_towards_2017}. ECG beat classification, in particular, is an area where machine learning has been widely applied and yielded good performance \cite{sannino2018deep, zubair2016automated, kachuee_ecg_2018}. It is also generally applicable in the medical domain since most physicians are familiar with reading ECG beats. The specific task we implement is classifying a single ECG heartbeat into one of four categories: normal, supraventricular ectopic, ventricular ectopic, or fusion. The latter three classes are different types of arrhythmias, or heart rhythm problems. We use a preprocessed version of the MIT-BIH Arrhythmia Dataset \cite{moody2001impact} available on Kaggle \cite{kaggle_dataset}. Each sample in the dataset is an individual heartbeat sampled at a frequency of 125 Hz, and padded to a maximum length of 1.5 seconds. The available dataset contains a fifth class, ``unknown,'' which we exclude here. We replicate the convolutional neural network (CNN) classification model from Kachuee et al.~\cite{kachuee_ecg_2018}. We do not use data augmentation, as we are interested in seeing whether our visualizations can elucidate that certain classes are underrepresented. The model was trained for ten epochs on the training set (\textit{n} = 81,123), resulting in a final overall accuracy of 98.3\% on the test set (\textit{n} = 20,284). The breakdown of classes and performances on each is in Table 1. \begin{table}[h] \centering \begin{tabular}{c|c|c} Class & \% of Examples & Test Set Accuracy\\ \toprule Normal & 89.3\% & 99.6\% \\ \hline Supraventricular Ectopic & 2.7\% & 70.5\% \\ \hline Ventricular Ectopic & 7.1\% & 95.7\% \\\hline Fusion & 0.8\% & 70.4\% \\\hline Overall & -- & 98.3\% \\ \bottomrule \end{tabular} \caption{Classes used in the ECG beat classification task, along with their distribution in the dataset and the model’s test set performance.} \label{tab:my_label} \end{table} \subsection{Grounding Model Output in K-Nearest Neighbors}\label{sec:knn} The KNN module displays the model’s output for a particular example in terms of its nearest neighbors in the data. The nearest neighbors are computed similarly to prior work \cite{papernot_deep_2018,shin1999memory,caruana1999case}: Given a neural network model trained to perform the classification task (the \textit{classification model}), we first define an \textit{embedding model}, whose output is the activations of one of the model’s hidden layers (see Figure \ref{fig:embedding_model}). We use this to embed all the training examples. Then, for a given new input example, we embed it and then use KNN to find the most similar training examples in this learned representation space. \begin{figure} \centering \includegraphics[width=0.86\linewidth]{images/embedding-model.png} \caption{To compute nearest neighbors, we extract an embedding model from the original classification model, where the output is a learned representation (i.e., the activation of a hidden layer). We use it to embed the training data examples and rank them by similarity to the input in this learned embedding space, returning the most similar. } \label{fig:embedding_model} \end{figure} Computing nearest neighbors in the learned embedding space of the classification model provides the advantage of harnessing the classification model’s representational capacity. As this learned space encodes higher level features relevant to the task, these features are taken into account when calculating similar examples. This step is particularly important to our goal of narrowing the \textit{gulf of evaluation} \cite{hutchins1985direct} as it provides a way for users to understand the model’s output in terms of higher-level concepts that align with how they think about the task. The model output can then be visualized in terms of the nearest neighbors. Different visual components display the nearest neighbors at varying levels of granularity, which together address our design goals G1, G2 and G3. They include an aggregate view of the neighbors’ class labels, a unit visualization of individual neighbors that encodes their class and distance from the input, and an overlaid display of the raw input examples associated with each neighbor. \begin{figure}[] \centering \begin{subfigure}[t]{\linewidth} \centering \includegraphics[width=\textwidth]{images/consistency-knn.png} \caption{} \label{fig:consistency} \end{subfigure} \hfill \begin{subfigure}[t]{\linewidth} \centering \includegraphics[width=\textwidth]{images/variance-knn.png} \caption{} \label{fig:variance} \end{subfigure} \caption{Examples of the KNN module. On the left is the input signal, and on the right is a histogram of class labels for the 50 nearest neighbors. In the center, each dot represents an individual nearest neighbor, ordered by similarity to the input. The plot above overlays the signals in the selected region. (a) shows an example where the neighbors are very consistent, and (b) shows an example where they are much noisier.} \label{fig:reliability} \end{figure} \textbf{ECG Case Study.} For the ECG beat classification task, we use the CNN classification model described in Sec. \ref{sec:case_study}, and we define the embedding model to output the activations from the final hidden layer (a 32-dimensional vector). We use Euclidean distance in this space to rank the embeddings of the training examples by their similarity to a particular input. We retrieve the 50 nearest neighbors for visualization. Figure \ref{fig:reliability} shows example ECG beats in the interface. Throughout the interface, color encodes class labels (e.g., orange waveforms, dots, and bars correspond to ventricular ectopic examples). The aggregate view is a histogram of class labels present in the nearest neighbors, ordered by class frequency to identify the majority class and distribution of other classes. The exact count of each class appears on hover for each bar in the histogram. The unit visualization of individual neighbors is a series of dots arrayed horizontally and ordered by similarity to the input. Users can see, for example, within the nearest neighbors if certain classes are more similar to the input. When prototyping this component, we also considered designs that encoded the absolute similarity (e.g., placing two neighbors that were more similar nearer to each other). However, we decided against this, since the absolute similarity (i.e., Euclidean distance in the learned embedding space) is not a value that is meaningful or familiar to the user. Additionally, the distribution of these values is more complicated to visualize, since the distances between neighbors are inconsistent. In our prototypes, for example, there were often clusters of points that densely overlapped and did not facilitate selecting and viewing individual examples. To visualize the raw input examples, users can brush over specific segments of the ordered dots. The brush is initialized to the first five neighbors, since these represent the most similar examples. Because the ECG data is signal-based, we choose to visualize the neighbors by overlapping signals on a single plot that appears above the brush. This allows users to visually assess consistency amongst the neighbors\,---\,for example, if the neighbors are very consistent, the overlaid plot will look very similar to a single signal. If they are more varied, the overlaid plot will appear comparably noisy. Outliers are also visible, since they appear as a distinct waveform that does not follow in the same pattern as the other signals. By moving and adjusting the brush to cover specific segments of the neighbors, users can home in on and compare examples from specific classes or individual outliers. \subsection{Interactively Editing Model Inputs}\label{sec:editor} To address our final design goal (G4), the editor module allows users to apply transformations to the input and re-run the modified input through the model to see how the output changes. For example, users can apply transformations that they expect to be class-preserving and check whether the model’s output changes drastically. The available transformations should help narrow the gulf of execution in the interface by providing transformations that align with users' existing ways of thinking about the data and task. For example, in a dataset of natural images, it does not make sense to invert the colors because that is not something that would occur naturally, and does not reflect thought processes of people analyzing images. We also would not want to provide transformations like editing individual pixels, which operate at a much lower-level than a person looking at an image would consider. To come up with transformations that are data-specific (meaning they reflect how users think about modifying a specific type of data, like images or ECG signals), relevant to the task (meaning they reflect higher-level factors that users consider important to the task at hand), and aligned with the target users’ level of understanding, we emphasize the importance of working with domain experts and other intended end users to design them. \begin{figure}[h] \centering \includegraphics[width=0.85\linewidth]{images/editor-transformations.png} \caption{The editing toolbar allows users to apply specific transformations or combinations of transformations to the input signal. The transformations can be applied to the entire signal, or to a specific user-selected region. This allows users to select and transform clinically-meaningful segments of the signal (e.g., “stretch the QRS complex”).} \label{fig:editor1} \end{figure} \textbf{ECG Case Study.} For the ECG beat classification task, the editor consists of four transformations which we arrived at through discussion with a cardiologist: amplify, dampen, stretch, and compress. These transformations can be applied to the entire input signal, or to specific user-defined regions using the brushing functionality. Together, they allow for a large space of possible adjustments to the input signal. There are other options that could be explored here, such as automatically detecting certain important sections of the signal (e.g., “P wave” or “QRS complex”) to transform instead of having users select them themselves. Once the transformation has been applied, a new row appears below the original output, displaying the new output. The color encoding as well as highlighting on hover enables tracing how the class distribution changes overall, while links between neighbors that are shared across rows enables tracking how individual examples shift in similarity. The editing toolbar is pictured in Figure \ref{fig:editor1}, and an example of the output after several transformations is in Figure \ref{fig:editor2}. \begin{figure} \centering \includegraphics[width=\linewidth]{images/editor-example.png} \caption{As transformations are applied, new rows appear with the transformed input and corresponding output. Links between each row indicate neighbors that are shared. Links originating from a row’s selection are more visible, while the rest are more transparent. Users can get a general sense of how much the nearest neighbors change (by assessing the overall density of links) as well as the specific movements of particular neighbors or sets of neighbors.} \vspace{-3mm} \label{fig:editor2} \end{figure} \subsection{Enabling an Integrated Visual Analysis Workflow}\label{sec:use_cases} Here, using the ECG case study, we expand upon several specific ways that a user can interact the visual analytics modules to assess the model's reliability, understand why it is uncertain, and check whether its reasoning aligns with domain knowledge: \subsubsection{Assessing consistency among nearest neighbors to understand prediction reliability and data limitations} Users can assess the reliability of the prediction in multiple ways. First, the aggregate distribution of class labels can convey the model’s uncertainty in the prediction (i.e., the majority class label). For example, if 45 neighbors are normal, this conveys more certainty about the prediction than if only 25 neighbors are normal, and the rest are spread out across other classes. Second, by viewing the class labels of the unit visualization representing individual neighbors, users can see how similar the neighbors from non-majority classes are to neighbors from the majority class. For example, if there are 40 neighbors labeled normal and 10 neighbors labeled fusion, are those 10 the most similar to the input? Or do they appear closer to the latter end of the nearest neighbors? If the neighbors from the non-majority class are the 10 most similar, this might indicate further unreliability of the ‘normal’ prediction. Third, visualizing the variance or consistency amongst the waveforms themselves can give insight into whether the input example is well-represented in the training data and whether the model is picking up on sensible high-level features common in the neighbors. For example, if the overlaid plot of nearest neighbors shows examples that are very consistent and similar to the input in semantically meaningful ways (see Figure \ref{fig:consistency} for an example), it implies that the input is well-represented in the training data and that the model is picking up on the right concepts for this input. On the other hand, if the plot of nearest neighbor signals shows examples that are non-overlapping or not similar to the input (see Figure \ref{fig:variance} for an example), it implies that either examples like the input are not well-represented in the training data, or that the model is not learning the right features and therefore not finding those similar examples. \subsubsection{Investigating neighbors from non-majority classes to characterize prediction uncertainty} Typically, a classification model outputs a probability score indicating its certainty in its prediction. Probability scores can alert the user to some uncertainty in the model, but they don’t give the user any additional information to understand \textit{why} the model is uncertain. In the KNN module, one way the model’s certainty is conveyed is through the aggregate distribution of class labels. Beyond this, though, the user can further investigate why the model is uncertain by viewing and comparing examples from non-majority classes. Brushing over specific selections of dots representing individual neighbors allows the user to better compare neighbors from different classes. Take the example in Figure \ref{fig:uncertainty}: 30 of the neighbors have the class label supraventricular ectopic, and 20 have the label normal (these counts are visible upon hover in the aggregate histogram). In Figure \ref{fig:uncertainty1}, brushing over the first 15 neighbors reveals that most of them follow the same general pattern, and it looks very similar to the input. The 3 normal neighbors in this selection also seem to follow this pattern\,---\,so some of the model’s uncertainty is arising from the fact that in the training data, there are normal beats that can look very similar to supraventricular beats. In Figure \ref{fig:uncertainty2}, brushing over the last 15 neighbors reveals that most of them follow the same general pattern, but have a more elevated T-wave (the spike at the beginning of the signal) than the supraventricular ectopic neighbors. A user might reason, then, that the model is split between supraventricular and normal, and one of the factors driving the uncertainty is whether or not the input has a significant T-wave. \begin{figure}[h] \centering \begin{subfigure}[b]{\linewidth} \centering \includegraphics[width=\textwidth]{images/uncertainty-1.png} \caption{} \label{fig:uncertainty1} \end{subfigure} \hfill \begin{subfigure}[b]{\linewidth} \centering \includegraphics[width=\textwidth]{images/uncertainty-2.png} \caption{} \label{fig:uncertainty2} \end{subfigure} \caption{The user can home in on different examples to better understand the model's uncertainty. The view of the first 15 neighbors in (a) suggests that some of the model’s uncertainty is arising from the fact that normal beats can look very similar to supraventricular beats. Viewing the normal neighbors in (b) suggests that another reason for uncertainty is ambiguity around whether the input has a significant T-wave (the spike at the beginning of the signal). } \label{fig:uncertainty} \end{figure} They could then use their domain knowledge to reason about how to proceed. In this example, they might examine the input and decide that the T-wave is significantly depressed, making the input more similar to the supraventricular ectopic examples, and more confidently proceed with supraventricular ectopic as the correct class. Or, they might decide that the different classes present in the neighbors reflect legitimate ambiguities about what the correct beat type is, and choose to consult a second option or run additional tests. \subsubsection{Comparing examples and labels against domain expectations to prompt critical questioning around the data} If neighboring examples or their labels do not align with the user’s expectations, it can prompt questions from the user about the details of the data and how it was collected or labeled, areas that are too often not engaged with after a model’s deployment. Crucially, seeing the signals themselves facilitates this type of critical thinking for people who are likely more familiar with the data and what it should look like than more abstract representations like feature weights. In the ECG case study, for example, the data was annotated by physicians who had access to additional information about the beats preceding and following the input. As a result, there are some examples in the dataset that look extremely similar but are labelled differently (presumably because the difference in their label was due to the information available during annotation that the model does not see). In some cases, this leads to nearest neighbors that have different classes but look very similar (see Figure \ref{fig:fusion_example}). Viewing the neighbors for a particular example can prompt questions about how the data was annotated and the subsequent limitations of the model, which would likely not arise if users were not able to view and compare specific similar examples. \begin{figure}[h] \centering \includegraphics[width=\linewidth]{images/fusion-example.png} \caption{An example of neighbors that look similar but have different labels, due to a discrepancy in the additional information available during annotation versus at test-time. Alerting users to such cases through viewing nearest neighbors can help prompt questions about the data, the annotation process, and limitations of the model.} \vspace{-5mm} \label{fig:fusion_example} \end{figure} \subsubsection{Applying input transformations to check if model reasoning aligns with domain knowledge} Checking if the model’s reasoning aligns with prior expectations of domain experts is important for building trust, especially in the clinical domain \cite{tonekaboni2019clinicians,cai2019hello}. The editor module allows users to form hypotheses about how particular transformations should change the model’s output, and build confidence and intuition around the model’s reasoning by seeing if these hypotheses hold. For example, the beat in Figure \ref{fig:domain_knowledge} is initially classified as supraventricular ectopic. The user might hypothesize that since one indicator of supraventricular ectopic beats is narrowness, and this particular beat is narrow, that this is what the model is picking up on. Therefore, stretching the beat should change the model’s output, making it lean more towards normal. The user can apply this transformation in the editor to test their hypothesis. In this case, the model’s output does change to reflect more normal neighbors, confirming both the original hypothesis and that the model's behavior aligns with the user’s expectations from a clinical perspective. \begin{figure}[t] \centering \includegraphics[width=\linewidth]{images/domain-knowledge.png} \caption{An example of using the editor to check if the model's reasoning aligns with domain expectations (i.e., stretching out a supraventricular ectopic beat should shift the prediction towards normal).} \label{fig:domain_knowledge} \end{figure} \subsubsection{Applying transformations to assess the model's sensitivity to small perturbations} Aside from specific hypotheses about how a particular series of transformations should change the output, a user can still gauge the reliability of a particular prediction by performing ad hoc sensitivity analyses. If the output changes drastically when the input is slightly tweaked, this can alert users to the fact that the prediction is precarious and encourage them not to be overly reliant on it. On the other hand, if the output is relatively stable, this can be an additional indicator of model reliability. \section{Evaluative Studies with Medical Professionals} To understand how effectively our visual analytics modules help users build intuition for ML model reliability, we evaluated our ECG beat classification case study with 14 participants recruited through our personal and professional networks: 3 fourth year medical students (P1-P3) and 11 physicians (P4-P14). The studies were certified by our institution as exempt from IRB review under Category 3. \subsection{Study Design} In order to study the effect of each of our modules independently, each participant experienced three conditions. The first two conditions were randomly ordered between our KNN visualization (without the editor) or a baseline feature-importance visualization, to understand the impact of example-based explanations on building intuition about the ML model. To understand the impact of interactively editing inputs, participants experienced a third condition featuring the KNN visualization \textit{with} the input editor. We chose to use feature importance as our baseline as it is a widely researched alternative to example-based explanations~\cite{du_techniques_2019,bhatt_explainable_2020}. The baseline condition, shown in Figure \ref{fig:saliency}, emulates the design of our KNN visualization, and feature importance is calculated via LIME~\cite{ribeiro_why_2016}, a commonly-used open-source method. In particular, LIME results are shown as highlighted regions that overlay the waveform, in line with existing approaches for visualizing ECG feature importance~\cite{mousavi2020han,tison2019automated}. We plot the feature importance values that are both above the 80th percentile and part of a continuous segment of neighboring important features, to better align with physicians’ existing ways of thinking about regions of an ECG signal. \begin{figure}[b] \centering \includegraphics[width=\linewidth]{images/saliency.png} \caption{The baseline visualization consists of the predicted beat class, the probability with which that class was predicted, and highlighted segments of the beat considered most important for the prediction.} \label{fig:saliency} \end{figure} Each condition was pre-populated with 12 input beats chosen from the test set and equally distributed among the four classes. We select beats such that 30\% in each condition have incorrect predictions (for the baseline condition, the prediction is the class with highest probability; for the KNN condition, the prediction is the class that makes up the majority of nearest neighbors). These incorrect predictions were aligned with the model's actual performance (e.g., we did not include incorrect predictions for normal beats since there are very few of those in reality; we included more incorrect predictions for supraventricular ectopic since the model’s performance for that class is worse). All studies were conducted via video conferencing. Participants were informed that their participation was voluntary, that they could decline to continue at any point, and that their identities would remain anonymous in any research output. Audio and video was recorded with their consent, and the average study length was 52 minutes. Participants were compensated with a \$30 gift card. At the start of each study, participants were told which four categories of beats they would be working with including the more granular information about beat types included with the original dataset (e.g., there are multiple pathologies that fall under the umbrella of ``ventricular ectopic''). We described that they would see ECG beats one-by-one, along with output from a machine learning model that had high overall performance. Participants were asked to imagine a scenario where their workplace had adopted such a tool for beat classification, and they were both trying to consider the model’s output to make the best decision about a particular beat, as well as get a general sense of how the model worked. We introduced each interface as using a separate model to mitigate participants carrying over preconceptions from prior conditions. For each condition, participants were given a brief demo and were then sent a link to open the visual analytics interface on their computer and asked to share their screen. We prompted them to click through the beats and, for each one, think out loud about how they were coming to a decision about the beat’s class, how they were incorporating the model’s output, and whether their perceptions about the model changed. At the end of each condition, we debriefed participants with questions about their general impressions of the model's capabilities, the interface, and the strengths and weaknesses of both. \subsection{Quantitative Results} We recorded the percent of cases in which participants agreed with the model (versus when they disagreed or were not sure). For cases in which the prediction was correct, the agreement rate was similar across conditions; however, when the prediction was incorrect, we found that participants were less likely to go with the model's prediction when they were using the KNN interface, with or without the input editor (Table \ref{table:quant}). Often in these cases, they did not explicitly ``disagree'' with the model, but wanted additional information about the signal and/or patient before committing to an answer. We expand on how our interface prompted these additional considerations in the following section. \renewcommand{\arraystretch}{1.5} \begin{table}[ht] \centering \begin{tabular}{p{2cm}|p{1.4cm}p{1.4cm}p{1.75cm}} \textit{Pred. Accuracy} & \textit{Baseline} & \textit{KNN} & \textit{KNN + Editor} \\ \hline Correct & 0.64 (0.2) & 0.7 (0.16) & 0.67 (0.12) \\ \hline Incorrect & 0.73 (0.23) & 0.48 (0.27) & 0.5 (0.24) \\ \hline \end{tabular} \caption{The mean agreement rate for correct predictions (8 per condition) and incorrect predictions (4 per condition). The standard deviation across participants is in parentheses.} \label{table:quant} \end{table} \subsection{Qualitative Observations} When using our tools, visualizations of neighboring signals allowed participants to reason about the model's output in terms of clinically-meaningful concepts, and examining variation in these signals helped participants to build intuition about prediction reliability. By inspecting the class histogram, ordering of neighbors, and neighboring signals, participants were able to relate the model's uncertainty to relevant challenges of the task. Finally, participants used the editor to confirm if the model’s reasoning was sensible and to guide decision-making. \subsubsection{Nearest neighbors enable reasoning with clinically-relevant concepts} Visualizing nearest neighbors enabled participants to reason about the model in terms of clinically-relevant concepts by generalizing and comparing across neighbors. They would often notice a particular morphology present in the neighbors that helped them understand the model’s behavior and whether it was clinically sensible. One participant, pointing to a pattern present in all the neighboring signals, said \textit{``Yeah, ventricular. It’s this elevation and this space that’s making it think ventricular''} [P4]. Another described, \textit{``The model is right\,---\,with ventricular ectopic, the QRS spike should be broad, which is present in all the similar examples''} [P13]. Overall, ten participants [P1, P3, P4-P5, P7-9, P12-14] reasoned about the model using high-level clinically-relevant concepts that they observed in the neighbors, such as \textit{``depression in the signal''} [P13], \textit{``slope right after the P-wave''} [P7], \textit{``presence of a T-wave''} [P8], or \textit{``P-R interval''} [P5]. In some cases, participants were unsure why neighbors were considered similar, or disagreed with their class labels. For example, one participant said, \textit{``these [neighbors] are supposed to be are ventricular ectopic... I think they're normal. I don't know what to make of this [output]''} [P2]. Such cases may be partly due to the fact that annotators had access to additional information about surrounding beats during annotation that is not available in the current dataset. Without this information, it can sometimes be unclear why a beat has the class label that it does. While the model's output was confusing in these cases, visualizing neighbors did prompt additional questions about the data and labeling process. For example, one participant asked, \textit{``Some of these normal ones look like they could be abnormal, so I’d want to know why they were called normal and what that was based on''} [P6]. Another further hypothesized, \textit{``Most likely this data was correctly annotated [...] but it’s not using all that information here''} [P2]. In contrast, with the baseline condition, participants often had difficulty extracting higher-level, clinically-relevant concepts from the feature importance visualization. For example, echoing a sentiment shared by many, one participant said, \textit{``I don’t see how these blue [highlighted] areas are super helpful here... what are they trying to get at?''} [P7]. Another participant, who struggled trying to connect the explanation to the predicted class, said \textit{``I don’t understand how they go from this [pointing at highlighted areas] to saying that there’s some aspect of a ventricular beat in there''} [P12]. Some others had difficulty figuring out what about the highlighted section was important\,---\,for example, one participant asked, \textit{``Why is it highlighted here, is it looking at the height of this, is it looking at width? And why only this part?''} [P1]. In some cases, the highlighted areas \textit{did} align with participants' expectations, connecting these sections back to the prediction was not straightforward. One participant noted, for example, \textit{``Sometimes it was highlighting things I would also consider, but I still thought its prediction was wrong. I don’t have any intuition on that. I guess it’s finding some features. I would want to know what those features are, see whether they’re useful, if they have any intuitive correlation''} [P2]. \subsubsection{Visualizing variation helps assess prediction reliability} All participants said that they did not place as much weight on the model’s prediction when there was a lot of variance in the overlaid signals. Participants felt more confident in their answers when the overlaid signals were very consistent and similar. They were also able to distinguish between variation that was acceptable given the task and domain (e.g., \textit{``This input isn't as picture perfect, so it makes sense that the model shows some variation in the overlaid examples''} [P4]) compared to variation that was an indicator of unreliability (e.g., \textit{``[The model’s output] isn't giving me much information right now. If I was given this result I wouldn't just listen to the machine, I would want additional information''} [P4]). When using the baseline condition, most participants only felt reassured when the predicted probability was very high and the prediction aligned with their own. When this was not the case, we observed that participants had trouble understanding how to incorporate the probability score. As a result, they often rationalized incorrect predictions\,---\,even when it went against their initial instincts. For example, one participant saw an abnormal beat, started to say it was abnormal, but then changed her mind after looking at the predicted class, which (incorrectly) was normal: \textit{``I don’t think this is normal... well actually seeing that the machine thinks normal... I guess it has a small QRS and the T-wave has a normal slope. Okay, I’ll put this in the normal category''} [P7]. Seven participants [P2-4, P7, P9-11] went through similar processes of rationalizing an incorrect prediction after having expressed an inclination towards the correct class. Even when they did not rationalize an incorrect prediction, participants often struggled with building intuition about the probability score or highlighted sections. For instance, one participant thought out loud, \textit{``I don't know, it seems high probability for a weird looking one like this. And I don’t know if it makes sense what it’s looking at here and calling important. I’m not confident about this''} [P1]. Similarly, another said \textit{``I’d say this is definitely supraventricular, but the model's not giving it a high probability. I’m really not sure why that would be''} [P11]. Eight participants [P1-2, P5-7, P11, P13-14] expressed similar difficulties in reasoning about the reliability of the prediction in the baseline interface. \subsubsection{Nearest neighbors help characterize uncertainty and incorporate it into decision-making} In the KNN visualization, a wide distribution of nearest neighbors classes is one sign of model uncertainty. In such situations, participants consistently homed in on differences using the overlaid plot of waveforms and aligned these differences with clinical concepts. For example, one participant viewed a beat where neighbors were split between supraventricular ectopic and normal, noting \textit{``For supraventricular ectopic one thing you look for is whether or not it has a P-wave. It’s unclear in the input. These [brushing over supraventricular ectopic examples] are probably saying it isn’t a P-wave. And these [brushing over normal examples] have the P-wave so they’re probably saying that the input does also and that’s why it should be normal''} [P5]. Similarly, participants often connected the distribution of nearest neighbors to natural ambiguities in the task. For example, one participant noticed some ventricular ectopic beats present in a fusion beat's neighbors\,---\,\textit{``Given that fusion is itself a combination of ventricular ectopic and normal, it makes sense that there’s uncertainty here, and that there are some yellow [ventricular ectopic] ones that look similar''} [P8]. Rather than distrusting the model, the ability to contextualize its uncertainty helped participants rationalize and move forward with its output. For instance, regarding neighbors split across classes, another participant said \textit{``I would be exactly split like the model is between supraventricular and ventricular ectopic. The fact that the model is also split between those two makes me feel better, and I would do further testing [in person] to differentiate which one it is''} [P4]. \begin{figure} \centering \begin{subfigure}[b]{\linewidth} \centering \includegraphics[width=\textwidth]{images/user-study-2.png} \caption{} \label{fig:study1} \end{subfigure} \hfill \begin{subfigure}[b]{\linewidth} \centering \includegraphics[width=\textwidth]{images/user-study-1.png} \caption{} \label{fig:study2} \end{subfigure} \caption{For this beat, one participant looked through some of the normal neighbors (a), comparing them to some of the supraventricular ectopic neighbors (b). They reasoned that the normal examples, though they made up the majority of neighbors, were not more similar in clinically-meaningful ways to the input than the supraventricular ectopic examples. As a result, they were able to arrive at the correct classification (supraventricular ectopic).} \label{fig:user1} \end{figure} Beyond making sense of the presence of multiple classes in the nearest neighbors, participants were also able use this information along with their domain knowledge during decision-making. In many cases, upon viewing neighbors from the different classes, participants would realize that one of the classes was not actually similar to the input and, as a result, feel more confident in disregarding it. For example, for the beat shown in Figure \ref{fig:user1}, one participant said \textit{``This is supraventricular ectopic. [The model] is calling it normal, but the normal ones don’t look so similar. The pink ones [supraventricular ectopic] look more like it because they also don't contain a P-wave''} [P14]. In other words, they were able to relate variation in the neighbors to clinical concepts (normal neighbors with a P-wave, supraventricular ectopic neighbors without), hypothesize why the model is uncertain (it isn’t sure whether the input example contains a P-wave), and use their own domain knowledge to determine how to proceed (the input does not actually have a P-wave, so go with supraventricular ectopic). Eight participants went through thought processes to better understand the model’s uncertainty and reconcile it with their knowledge of the domain knowledge [P4-8, P10, P13-14]. In contrast, when the model appeared less certain to those using the baseline (i.e., a lower probability score), participants had difficulty reasoning about why. Many said they did not know why the probability was relatively low, or provided explanations based on their own knowledge as opposed to information from the feature importance visualization. \subsubsection{Editing inputs helps check model reasoning} Ten participants used the editor to formulate and test hypotheses about what would happen to the output after applying certain transformations [P4-9, P11-14]. They used this functionality as a way to ``sanity check'' the model's reasoning, and were more confident if it aligned with their expectations (and vice versa). For example, one participant described using the editor to feel more confident in the model’s prediction for a beat (shown in Figure \ref{fig:study3}), which had mostly ventricular ectopic neighbors: \textit{``I'm not that confident with ventricular ectopic, and this looks almost normal. It’s a little narrow, which is partly what ventricular means, so I think that’s why this is saying ventricular and if I were to stretch it it would be normal. [Stretches the signal] And that’s exactly what happened. That makes me more confident that this is more ventricular ectopic rather than normal. Just because that’s exactly what my thought was and that’s exactly what happened when I did it''} [P9]. The same participant mentioned later on, \textit{``This is how I think of things. If I can predict what’s going to happen I’m more likely to be confident in the decision.''} Sometimes, however, participants applied a transformation but were not able to understand why the nearest neighbors changed as they did, or how to incorporate the observed change into downstream decision-making [P2, P4-5, P8, P10]. This situation typically occurred when the participant applied a transformation that they expected would shift the neighbors towards one of the non-normal beat classes, but instead skewed the neighbors towards normal\,---\,a behavior that reflects the model having learned less granular representations of beat classes that were under-represented in the data. On one hand, this unexpected behavior prompted participants to rely less on the model's output in these cases\,---\,which, since the model is less accurate for these classes, is appropriate. At the same time, however, these instances were not able to offer participants useful insight into the model's reasoning. \begin{figure} \centering \includegraphics[width=\linewidth]{images/user-study-3.png} \caption{One participant hypothesized that the model was picking up on the narrowness of this beat in giving the prediction of ventricular ectopic, and thus stretching it would cause the neighbors to shift towards normal. After applying the stretching transformation, and seeing that the nearest neighbors did change to be more normal, they felt more confident in the model’s reasoning for this beat and in classifying it as ventricular ectopic.} \label{fig:study3} \end{figure} In other cases, participants applied several transformations separately to try and gauge the sensitivity of the prediction to small changes, as a way of assessing model reliability [P1, P3, P6-7, P10-11]. Sometimes several small transformations provided positive reinforcement\,---\,\textit{``Okay, this makes me more confident. When it’s normal, and then you do all these [transformations], I think it should mostly stay normal, which it is. It’s consistent so this all makes sense and I feel good with the machine''} [P1]. Other times, these transformations helped alert participants to the model's unreliability\,---\,\textit{``Seeing it switch so quickly from supraventricular ectopic to normal does affect my perception of whether it [the model] is good at telling those apart''} [P3]. With respect to the model's behavior more generally, some participants expressed an increased understanding in how the model worked after using the editor and observing what transformations tended to lead to a large change in the output. One participant noted, \textit{``Doing these transformations is making me think about how this program works… I can tell that the narrowness of a beat affects the decision a lot for example''} [P8]. Participants did not typically use the editor when the neighbors were consistent (both in terms of the shape of the signal and their class labels), because they did not feel the need to check the model's reasoning. Other times, they chose not to use the editor because they could not think of a specific hypothesis they wanted to test\,---\,this was particularly true for the participants who were medical students, who often expressed that they ``didn't know enough'' but that someone with more experience might know what to test. \subsection{Study Limitations} Several participants noted that the way the ECG beats were visualized was simplified. For example, in practice, participants described that they would typically view a strip of beats from multiple leads, rather than one beat in isolation, and often with a grid overlaid to better measure distances. In some cases, this difference in display made participants more unsure about the class than they would have been if they had had their more familiar overlays. While the interface and task is simpler than it would be in a real clinical environment, in the current work our focus is more on developing and evaluating the proposed interpretability and visualization techniques, rather than developing a tool that could be deployed in a clinical setting (which would prompt an entirely different set of considerations). \input{discussion-new} \section*{acknowledgements} This research was sponsored by NSF Award \#1900991, and by the United States Air Force Research Laboratory under Cooperative Agreement Number FA8750-19-2-1000. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the United States Air Force or the U.S. Government. The U.S. Government is authorized to reproduce and distribute reprints for Government purposes notwithstanding any copyright notation herein. \bibliographystyle{abbrv-doi}
\section{Introduction and presentation of the results} Our work falls within the framework of graph theory with a special focus on decomposition problems. A {\it graph} $G=(V(G), E(G))$ (or $G=(V, E)$) consists of a finite set $V$ of {\it vertices} together with a set $E$ of pairs of distinct vertices, called {\it edges}. On the one hand, let $G=(V, E)$ be a graph. The \emph{neighborhood} of $x$ in $G$, denoted by $N_{G}(x)$ or simply $N(x)$, is the set $N_{G}(x) = \{y \in V \setminus \{x\}: \{x,y\} \in E\}$. The \emph{degree} of $x$ in $G$, denoted by $d_G(x)$ ( or $d(x)$), is the cardinal of $N_{G}(x)$. A vertex $x$ with degree one is called a \emph{leaf}, its adjacent vertex is called a \emph{support} vertex and it is denoted by $x^+$. If $x$ is a support vertex in $G$ admitting a unique leaf neighbor, this leaf is denoted by $x^-$. The set of leaves and support vertices in a graph $G$ is denoted by $\mathcal{L}(G)$ and $\mathcal{S}(G)$ respectively. An \emph{internal} vertex is a vertex with a degree greater than or equal to 2. The \emph{distance} between two vertices $u$ and $v$ in $G$ is the length (number of edge) of the shortest path connecting them and is denoted by $dist_G(u,v)$ or simply $dist(u,v)$. The notation $x \sim Y$ for each $Y\subseteq V\backslash \{x\}$ means $x$ is adjacent to all or none vertex of $Y$. The negation is denoted by $x \not\sim Y$. On the other hand, given a graph $G=(V, E)$, with each subset $X$ of $V$, the graph $G[X]= (X, \displaystyle E\cap (^X_2))$ is an {\it induced subgraph} of $G$. For $X \subseteq V$ (resp. $x \in V $), the induced subgraph $G[V \setminus X]$ (resp. $G[ V\setminus \{x\}]$) is denoted by $G-X$ (resp. $G-x$). The notions of isomorphism and embedding are defined in the following way. Two graphs $G = (V, E)$ and $G' = (V', E')$ are {\it isomorphic}, which is denoted by $G \simeq G'$, if there is an {\it isomorphism} from $G$ onto $G'$, i.e., a bijection from $V$ onto $V'$ such that for all $x, y \in V$, $\{x, y\} \in E$ if and only if $\{f(x), f(y)\} \in E'$. We say that a graph $G'$ {\it embeds} into a graph $G$ if $G'$ is isomorphic to an induced subgraph of $G$. Otherwise, we say that $G$ {\it omits} $G'$. Given a graph $G$ and a one-to-one function $f$ defined on a set containing $V(G)$, we denote by $f(G)$ the graph $(f(V(G)); f(E(G)))=(f(V(G)); \{\{f(x), f(y)\}: \{x, y\}\in E(G)\})$. A nonempty subset $C$ of $V$ is a \emph {connected component} of $G$ if for $x \in C$ and $y \in V \setminus C, \, \{x,y\} \notin E$ and if for $x \neq y \in C,$ there is a sequence $x=x_{0}, \, \ldots, \, x_{n}=y$ of $C$ elements such that for each $0\leq i \leq n-1$, $\{x_{i},x_{i+1}\} \in E$. A vertex $x$ of $G$ is \emph{isolated} if $\{x\}$ constitutes a connected component of $G$. The set of the connected components of $G$ is a partition of $V$, denoted $\mathcal{C}(G)$. The graph $G$ is \emph{connected} if it has at most one connected component of $G$. Otherwise, it is called \emph{non-connected}. For example, a \emph{tree} is a connected graph in which any two vertices are connected by exactly one path. In addition, let's consider a graph $G=(V, E)$, a subset $M$ of $V$ is a \emph{module} of $G$ if every vertex outside $M$ is adjacent to all or none of $M$. This concept was introduced in \cite{Spinrad1992P4TreesAS} and independently under the name \emph{interval} in \cite{Cournier1998MinimalIG, Frass1984LIntervalleET, Schmerl1993CriticallyIP} and an \emph{autonomous} set in \cite{Ehrenfeucht1990PrimitivityIH}. The empty set, the singleton sets, and the full set of vertices are \emph{trivial modules}. A graph is \emph{indecomposable} (or {\it primitive}) if all its modules are trivial; otherwise, it is decomposable. Therefore, indecomposable graphs with at least four vertices are prime graphs. This concept was developed in several papers e.g (\cite{Ehrenfeucht1990PrimitivityIH, Frass1984LIntervalleET, Kelly1986InvariantsOF, Schmerl1993CriticallyIP, Sumner1973GraphsIW}), and is now elaborated in a book by Ehrenfeucht, Harju and Rozenberg \cite{Ehrenfeucht1997TheTO}. Properties of the prime substructures of a given prime structure were determined by Schmerl and Trotter \cite{Schmerl1993CriticallyIP} in their fundamental paper. Indeed, several papers within the same sphere of reference have then appeared (\cite{belkhechine2010indecomposable, belkhechine2010les, Bouchaala2013FiniteTW, DBLP:journals/arscom/Boudabbous16, Boussari2007LesG2, Ehrenfeucht1997TheTO, Ille1997IndecomposableG, Elayech2015TheD, Pouzet2009OnMP, Sayar2011PartiallyCT}). For instance, the {\it path} defined on $\mathbb{N}_n=\{1,...,n\}$, denoted by $P_n$, is prime for $n \geq 4$. A path with extremities $x$ and $y$ is referred to as $(x,y)$-path. For example, it is easy to verify that each prime graph is connected. The study of the hereditary aspect of the primality in the graphs revolve around the following general question. Given a prime graph $G$, is there always a proper prime subgraph in $G$ ? Addressing this problematic led to the publication of numerous papers. A first result in this direction dates back to D. P. Sumner \cite{Sumner1973GraphsIW} who asserted that for every prime graph $G$, there exists $X \subseteq V (G)$ such that $|X| = 4$ and $G[X]$ is prime. In 1990, A. Ehrenfeucht and G. Rozenberg \cite{Ehrenfeucht1990PrimitivityIH} reported also that the prime graphs have the following ascendant hereditary property. Let $X$ be a subset of a prime graph $G$ such that $G[X]$ is prime. If $|V (G)\backslash X|\geq 2$, then there exist $x \neq y \in V (G) \backslash X$ such that $G[X \cup \{x, y\}]$ is prime. The latter result was improved in 1993 by J. H. Schmerl and W. T. Trotter \cite{Schmerl1993CriticallyIP} as follows: Each prime graph of order $n$, ($n \geq 7$), embeds a prime graph of order $n - 2$. It is then natural to raise the next question. Given a prime graph $G$ of order $n$, is there always a prime subgraph of $G$ of order $n-1$? The answer to this question is negative and the prime graph $G$ such that $G-x$ is decomposable for each $x \in V(G)$, referred to as \emph{critical graph}, is the counterexample. In 1993, J.H. Schmerl and W.T. Trotter \cite{Schmerl1993CriticallyIP} characterized the critical graphs. Consider now a prime graph $G=(V,E)$. A vertex $x$ of $G$ is said to be {\it critical} if $G-x$ is decomposable. Otherwise, $x$ is a {\it non-critical} vertex. The set of the non-critical vertices of $G$ is denoted by $\sigma(G)$. Moreover, if $G$ admits $k$ non-critical vertices, it is then called a \emph{$(-k)$-critical graph}. Recently, Y.Boudabbous and Ille \cite{BOUDABBOUS20092839} asked about the description of the $(-1)$-critical graphs. Their question was answered by H. Belkhechine, I. Boudabbous and M. Baka Elayech \cite{belkhechine2010les} in the case of graph. More recently, I. Boudabbous and W. Marweni described the triangle-free prime graphs having at most two non critical vertices \cite{DBLP:journals/mvl/BoudabbousM20}. Another intrinsic tool in this work is the notion of \emph{minimal} graphs defined as follows. A prime graph $G$ is {\it minimal} for a vertex subset $X$, or {\it $X$-minimal}, if no proper induced subgraph of $G$ containing $X$ is prime. A graph $G$ is {\it $k$-minimal} if it is minimal for some $k$-element set of $k$ elements. A. Cournier and P. Ille \cite{Cournier1998MinimalIG} in 1998 characterized the $1$-minimal and $2$-minimal graphs. Recently, M. Alzohairi and Y. Boudabbous characterized the 3-minimal triangle-free graphs \cite{ALZOHAIRI20143}. In 2015, M. Alzohairi characterized the triangle-free graphs which are minimal for some nonstable 4-vertex subset \cite{ALZOHAIRI2015159}.\\ Motivated by these two fundamental notions, I. Boudabbous proposes to find the $(-k)$-critical graphs and $k$-minimal graphs for some integer $k$ even in a particular case of graphs. This work resolves what is requested by I. Boudabbous. For this reason, we shall describe the prime tree having exactly $k$ non-critical vertices. Recall that $\lfloor x\rfloor$ denotes the greatest integer $\leq x$. Therefore, we obtain: \begin{theorem} \label{TH10} Let $T=(V,E)$ be a tree with at least $5$ vertices and $\{x_1,...,x_k\}$ be a vertex subset of $G$ where $k$ is an integer. \\ $T$ is $(-k)$-critical and $\sigma(T)= \{x_1,...,x_k\}$ (see Figure \ref{FK} (a)), if and only if $T$ satisfies the four assertions. \begin{enumerate} \item For each $x\neq y \in \mathcal{L}(T)$, $dist(x,y)\geq 3$, \item $\{x_1,...,x_k\} \subseteq \mathcal{L}(T)$ and $1 \leq k\leq \lfloor\frac{n}{2}\rfloor$, \item For each $x \in \mathcal{L}(T)\backslash\{x_1,...,x_k\}$, there is a unique $i\in\{1,...,k\}$ such that $dist(x,x_i)=3$ and $d(x^+)=2$, \item If $d(x_{i}^+)=2$ where $i \in \{1,...,k\}$, then for all $x \in \mathcal{L}(T)\backslash\{x_i\}$, $dist(x_i, x)\geq 4$. \end{enumerate} \end{theorem} Moreover, we shall describe the $k$-minimal trees. As a matter of fact, we obtain: \begin{theorem} \label{TH20} Let $T=(V,E)$ be a tree with at least $5$ vertices and let $\{x_1,...,x_k\}$ be a vertex subset of $G$ where $k$ is a strictly positive integer.\\ $T$ is minimal for $\{x_1,...,x_k\}$ (see Figure \ref{FK} (b)) if and only if $T$ satisfies the three assertions. \begin{enumerate} \item For each $x\neq y \in \mathcal{L}(T)$, $dist(x,y)\geq 3$. \item For each $x \in \mathcal{L}(T)$, $\{x, x^+\}\cap\{x_1,...,x_k\}\neq\emptyset$. \item If $x_i\in \mathcal{S}(T)$ and $x_i^-\notin \{x_1,...,x_k\}$ where $i \in \{1,...,k\}$, then $d(x_i)=2$ and there is $j\neq i \in \{1,...,k\}$ such that $x_j \in \mathcal{L}(T)$ and $d(x_i, x_j)=2$. \end{enumerate} \end{theorem} \begin{figure}[!h] \centering \includegraphics[width=11cm]{TT} \caption{~~$(a)$ $T$ is $(-6)$-critical and $\sigma(T)= \{x_1,...,x_6\}$.~~~~ $(b)$ $T'$ is minimal for $\{x_1,...,x_9\}$.} \label{FK} \end{figure} \section{Proof of Theorem 1.1:} We recall the characterization of the prime tree set forward by to M. Alzohairi and Y. Boudabbous. \begin{lemma}{\rm (\cite{ALZOHAIRI20143})}\label{tree} \begin{enumerate} \item If $M$ is a nontrivial module in a decomposable tree $T$, then $M$ is a stable set of $T$. Moreover, the elements of $M$ are leaves of $T$. \item A tree with at least four vertices is prime if and only if any two distinct leaves do not have the same neighbor. \end{enumerate} \end{lemma} As an immediate consequence of Lemma \ref{tree}, we have the following result. \begin{corollary}\label{wtree} Let $T=(V,E)$ be a tree. $T$ is prime if and only if $d(x,y)\geq 3$, for each $x\neq y \in \mathcal{L}(T)$. \end{corollary} The following observation follows immediately from Lemma \ref{tree}. \begin{observation}\label{O1} Let $T=(V,E)$ be a prime tree with $n$ vertices. Then, $|\mathcal{S}(T)|=|\mathcal{L}(T)|\leq \lfloor\frac{n}{2}\rfloor$. \end{observation} Now, we establish the next lemma that will be needed in the sequel. \begin{lemma} \label{LL1} Let $T=(V,E)$ be a prime tree and $x\in \mathcal{L}(T)$. If $T-x$ is decomposable, then there is $y \in \mathcal{L}(T)\backslash\{x\}$ such that $\{y, x^+\}$ is the unique module of $T-x$. \end{lemma} \noindent{\textbf{Proof:}} Consider a prime tree $T=(V,E)$ and $x\in \mathcal{L}(T)$. Assume that $T-x$ is a decomposable tree. Resting upon Lemma \ref{tree}, there exist two distinct leaves of $T-x$, said $y$ and $z$, which have the same neighbor. Hence, $\{y, z\}$ is a module of $T-x$. Since $T$ is a prime tree, $x \not\sim \{y,z\}$. Thus, $x^+\in\{y,z\}$. Without loss of generality, we may assume that $x^+ =z$ and we have $y\in \mathcal{L}(T)$. Since $T$ is prime and $y\in \mathcal{L}(T)$, then $dist(y,u)\geq 3$ for each $u \neq y\in \mathcal{L}(T)$. Therefore, $\{y, x^+\}$ is the unique module of $T-x$.{\hspace*{\fill}$\Box$\medskip}\\ \noindent{\textbf{Proof of Theorem \ref{TH10}.}} Consider a tree $T=(V,E)$ with $n$ vertices where $n\geq 5$ and $\{x_1,...,x_k\}$ is a subset of $V$ where $k$ is a strictly positive integer.\\ Assume that $T$ is $(-k)$-critical and $\sigma(T)= \{x_1,...,x_k\}$. Since $T$ is prime, by Corollary \ref{wtree}, we have for each $x \neq y \in \mathcal{L}(T),~dist(x,y)\geq 3$. Hence, $T$ satisfies the condition (1) of Theorem \ref{TH10}.\\ Moreover, let $x\in V \backslash \mathcal{L}(T)$, $x$ is an internal vertex of $T$ and $T-x$ is a non-connected graph. Then, $T-x$ is decomposable and $x\notin \sigma(T)$. Thus, $\{x_1,...,x_k\} \subseteq \mathcal{L}(T)$. As $T$ is prime, based on Observation \ref{O1}, we have $1\leq k\leq \lfloor\frac{n}{2}\rfloor$. Hence, $T$ satisfies condition (2) of Theorem \ref{TH10}.\\ Now, consider $x \in \mathcal{L}(T)\backslash\{x_1,...,x_k\}$. Then, $T-x$ is a decomposable tree. By Lemma \ref{LL1}, there is $y \in \mathcal{L}(T)\backslash\{x\}$ such that $\{y, x^+\}$ is the only module of $T-x$. Clearly, $dist(x,y)=3$ and $d(x^+)=2$. Now, prove that $y\in \sigma(T)$. To the contrary, suppose that $y\notin \sigma(T)$, implying that $T-y$ is a decomposable tree. Using again Lemma \ref{LL1}, there is $z \in \mathcal{L}(T)\backslash\{y\}$ such that $\{z, y^+\}$ is the unique module of $T-y$. Thus, $d(y^+)=2$ and $dist(y,z)=3$. This implies that $z=x$ and we obtain that $T$ is with 4 vertices; which contradicts the fact that $T$ is a tree having at least 5 vertices. Hence, $y\in \sigma(T)$. Therefore, $T$ satisfies the condition (3) of Theorem \ref{TH10}.\\ Besides, assume that there is $i \in \{1,...,k\}$ such that $d(x_i^+)=2$. Then, $T-x_i$ is a prime tree and $x_i^+ \in \mathcal{L}(T-x_i)$. Referring to Corollary \ref{wtree}, for all $y\in\mathcal{L}(T-x_i)$, $dist(x_i^{+}, y)\geq3$. Since $\mathcal{L}(T-x_i)\backslash \{x_i^+\}=\mathcal{L}(T) \backslash \{x_i\}$, then for each $y\neq x_i\in \mathcal{L}(T)$, $dist(x_i,y)\geq 4$. Hence, $T$ satisfies condition (4) of Theorem \ref{TH10}. Conversely, assume that $T$ satisfies the conditions (1)-(4) of Theorem \ref{TH10}. Proving that, $T$ is $(-k)$-critical and $\sigma(T)= \{x_1,...,x_k\}$. Since for each $x\neq y \in \mathcal{L}(T)$, $dist(x,y)\geq 3$ and by Corollary \ref{wtree}, $T$ is prime. Clearly, if $x\in V \backslash \mathcal{L}(T)$, $T-x$ is a non-connected graph. Thus, $T-x$ is decomposable and hence $x$ is a critical vertex.\\ Furthermore, if $x \in \mathcal{L}(T)\backslash\{x_1,...,x_k\}$, by assertion (3), there is a unique $i\in\{1,...,k\}$ such that $dist(x,x_i)=3$ and $d(x^+)=2$. Then, $\{x^{+}, x_i\}$ is a module of $T-x$. Hence for each $x\in\mathcal{L}(T)\backslash\{x_1,...,x_k\}$, $T-x$ is decomposable and then $x$ is a critical vertex.\\ Now, given $i \in \{1,...,k\}$; if $d(x^+_i)\geq 3$, then $\mathcal{L}(T)\backslash\{x_i\}=\mathcal{L}(T-x_{i})$. According to first hypothesis of Theorem \ref{TH10}, for each $x\neq y \in\mathcal{L}(T-x_{i})$, $dist(x, y)\geq3$. By Corollary \ref{wtree}, $T-x_i$ is a prime tree.\\ Assume now that $d(x_i^+)=2$. Suppose that $T-x_i$ is a decomposable tree. Then, by Lemma \ref{LL1} there is a unique $y \neq x_i \in \mathcal{L}(T)$ such that $\{y, x_i^+\}$ is the unique module of $T-x_i$. As a matter of fact, $dist(y,x_i)=3$; which contradicts the hypothesis 4 of Theorem \ref{TH10}. Hence, $T-x_i$ is prime. Consequently, $T$ is $(-k)$-critical and $\sigma(T)= \{x_1,...,x_k\}$. {\hspace*{\fill}$\Box$\medskip} Our second objective in this section lies in determining the number of nonisomorphic $(-k)$-critical trees with $n\geq5$ vertices where $k \in \{1,2, \lfloor\frac{n}{2}\rfloor\}$. According to the characterization of critical graphs \cite{Schmerl1993CriticallyIP}, $P_4$ is the a unique critical trees. To specify the the number of nonisomorphic $(-k)$-critical trees where $k \in \{1,2,\lfloor\frac{n}{2}\rfloor\}$, we introduce for all $n\in \mathbb{N}$, the one-to-one function: $$\begin{array}{ccccc} T_n & : & \mathbb{N} & \to & \mathbb{N} \\ & & p & \mapsto & p+n \\ \end{array}$$ Now, we introduce also the following trees. \vspace{-0.2cm} \begin{description} \item[$\bullet$] For integers $m\geq 2$, let $A_{2m+1}$ be the tree defined on $\{0,...,2m\}$ and $E(A_{2m+1})=\{\{0,i\}, \{i,i+m\} : 1\leq i \leq m\}$ (see Figure \ref{AA}). \item[$\bullet$] For integers $k\geq 4$, $t\geq 1$, let $P_{k, t}$ be the tree defined on $\{1,...,2t+k\}$ and $E(P_{k,t})=E(T_{2t}(P_k))\cup\{\{2i-1, 2i\}: 1\leq i \leq t\}\cup \{\{2t+2, 2i\}: 1\leq i \leq t\}$ (see Figure \ref{2CR1}). \item[$\bullet$] For integers $m\geq 4$, $n_1\geq 1$, $n_2\geq 1$, for each $p\in \{1,2\}$, $s_p=n_1+...+n_p$. Let $P_{m, n_1,n_2}$ be the tree defined on $\{1,...,2s_2+m\}$ and $E(P_{m,n_1,n_2})=E(T_{2s_2}(P_m))\cup\{\{2i-1, 2i\}: 1\leq i \leq s_2\}\cup \{\{2s_2+2, 2i\}, \{2s_2+m-1, 2j\}: 1\leq i \leq n_1 ~~and ~~n_1< j \leq s_2\}$ (see Figure \ref{2CR}). \end{description} \begin{figure}[h!] \centering \includegraphics[width=5cm]{AA \caption{The tree $A_{2m+1}$} \label{AA} \end{figure} \begin{proposition} \begin{enumerate} \item Up to isomorphisms, the $(-1)$-critical trees with $n$ vertices are the tree $\displaystyle P_{4,\frac{n-4}{2}}$ where $n$ is an even integer $\geq 6$. \item Up to isomorphisms, the $\displaystyle (-\lfloor\frac{n}{2}\rfloor)$-critical trees with $n$ vertices are the tree $A_{n}$ where $n$ is an odd integer $\geq 5$. \end{enumerate} \end{proposition} \begin{figure}[h!] \centering \includegraphics[width=12cm]{2CR1 \caption{The tree $P_{k, t}$} \label{2CR1} \end{figure} \begin{figure}[h!] \centering \includegraphics[width=12cm]{2CR \caption{The tree $P_{m, n_1,n_2}$} \label{2CR} \end{figure} \noindent{\textbf{Proof:}}\begin{enumerate} \item Clearly, departing from Theorem \ref{TH10}, $\displaystyle P_{4,\frac{n-4}{2}}$ is a $(-1)$-critical tree where $n\geq 6$ and $\displaystyle\sigma(P_{4,\frac{n-4}{2}})=\{n-3\}$. Now, we consider a $(-1)$-critical tree $T$ with $n\geq 5$ vertices such that $\sigma(T)=\{x_1\}$. By Theorem \ref{TH10}, $x_1 \in \mathcal{L}(T)$. If $x\neq x_1\in \mathcal{L}(T)$, then by assertion (3) of Theorem \ref{TH10}, $dist(x, x_1)=3$ and $d(x^+)=2$. On the contrary, suppose that $|\mathcal{L}(T)|=2$. Since $T$ is prime, then $T$ is isomorphic to $P_4$; which contradicts the fact that $T$ has at least 5 vertices. Hence, $|\mathcal{L}(T)|\geq 3$. By assertion (3), for each $y\in\mathcal{L}(T)$, $dist(y, x_1)=3$ and $d(y^+)=2$. Thus, $T$ is isomorphic to $\displaystyle P_{4,\frac{n-4}{2}}$ where $n\geq 6$ is an even integer. \item By Theorem \ref{TH10}, $A_{2m+1}$ is $\displaystyle(-\lfloor\frac{2m+1}{2}\rfloor)$-critical and $\sigma(A_{2m+1})=\mathcal{L}(A_{2m+1})$ where $m\geq 2$. Now, we consider a $\displaystyle(-\lfloor\frac{n}{2}\rfloor)$-critical tree $T$ with $n\geq 5$ vertices. Using Theorem \ref{TH10}, $\sigma(T)\subseteq \mathcal{L}(T)$ implies that $\displaystyle|\sigma(T)|=\lfloor\frac{n}{2}\rfloor \leq |\mathcal{L}(T)|$. By Observation \ref{O1}, $\displaystyle|\mathcal{L}(T)| =|\mathcal{S}(T)|\leq \lfloor\frac{n}{2}\rfloor$ and therefore $\displaystyle|\mathcal{L}(T)| =|\mathcal{S}(T)|=\lfloor\frac{n}{2}\rfloor$. Now, we shall prove that $n$ is odd. To the contrary, suppose that $n$ is even. Then, $\displaystyle|\mathcal{L}(T)| =|\mathcal{S}(T)|=\frac{n}{2}$. Hence, $V(T)=\mathcal{L}(T)\cup\mathcal{S}(T)$. Since $T[\mathcal{S}(T)]$ is a tree, there exists a vertex $y\in \mathcal{S}(T)$ with $d_{T[\mathcal{S}(T)]}(y)=1$. Hence, $d_{T}(y)=2$. We may assume that $N(y)=\{y^-,x\}$ where $x\in \mathcal{S}(T)$. Thus, $\{y, x^-\}$ is a module of $T-y^-$; which contradicts the fact that $y^-$ is not a critical vertex. Accordingly, $n$ is odd, $\displaystyle |\mathcal{L}(T)|=|\mathcal{S}(T)|=\frac{n-1}{2}$, and $V(T)=\mathcal{L}(T)\cup\mathcal{S}(T)\cup\{z\}$. We can assume that $\displaystyle\mathcal{L}(T)=\{x_1,...,x_{(\frac{n-1}{2})}\}$ and $\displaystyle\mathcal{S}(T)=\{x^+_1,...,x^+_{(\frac{n-1}{2})}\}$. Since $T[\mathcal{S}(T)\cup\{z\}]$ is a tree, there exists a vertex $x_i^+\in \mathcal{S}(T)$ where $\displaystyle 1\leq i \leq \frac{n-1}{2}$ with $d_{T[\mathcal{S}(T)]}(x_i^+)=1$ and hence $d_{T}(x_i^+)=2$. By Theorem \ref{TH10}, $dist(x_i, x_j)\geq 4$ for each $\displaystyle j\neq i \in \{1,...,\frac{n-1}{2}\}$. Hence, $T$ is isomorphic to $A_{n}$ where $n\geq 5$.{\hspace*{\fill}$\Box$\medskip} \end{enumerate} As a consequence of Theorem \ref{TH10}, we get the following result. \begin{proposition}\label{p1} Up to isomorphisms, the $(-2)$-critical trees with $n\geq 5$ vertices are the trees $P_n$, $P_{k,t}$ where $k\geq 4$, $t\geq 1$ and $n=k+2t$, and $P_{m, n_1, n_2}$ where $m\geq4$, $n_1, n_2\geq 1$ and $n=m+2(n_1+n_2)$. \end{proposition}\label{2CT} \noindent{\textbf{Proof:}} By Theorem \ref{TH10}, $P_n$, $P_{k,t}$ where $k\geq 4$, $t\geq 1$, and $P_{m, n_1, n_2}$ where $m\geq4$, $n_1, n_2\geq 1$ are $(-2)$-critical trees and $\sigma(P_n)=\{1, n\}$, $\sigma(P_{k,t})=\{2t+1,2t+k\}$, and $\sigma(P_{m, n_1, n_2})=\{2s_2 +1, 2s_2+ m\}$. Now, assume that $T$ is a $(-2)$-critical tree with $n\geq 5$ vertices such that $\sigma (T)=\{x_1,x_2\}$. By Theorem \ref{TH10}, $x_1, x_2 \in \mathcal{L}(T)$. As $T$ is a prime tree, then the $(x_1,x_2)$-path is isomorphic to $P_k$ where $k \geq4$. If $|\mathcal{L}(T)|=2$, then $T$ is isomorphic to $P_n$ and $n=k$. Assume that $|\mathcal{L}(T)|\geq 3$, then by Theorem \ref{TH10}, for each $x\in \mathcal{L}(T)\backslash\{x_1, x_2\}$; there is a unique $i\in \{1,2\}$ such that $dist(x, x_i)=3$ and $d(x^+)=2$. Hence, $T$ is isomorphic to $P_{k,t}$ where $k\geq 4$, $t\geq 1$ and $n=k+2t$ or $T$ is isomorphic to $P_{k, n_1, n_2}$ where $k\geq4$, $n_1, n_2\geq 1$ and $n=k+2(n_1+n_2)$.{\hspace*{\fill}$\Box$\medskip} \begin{theorem} \label{TH2} The number of nonisomorphic $(-2)$-critical trees with $n$ vertices equals:\\ $\bullet$ $\displaystyle\left\lfloor\frac{n}{4}\right\rfloor^{2}-1$ if $n\equiv 0~(mod~4)$.\\ $\bullet$ $\displaystyle\left\lfloor\frac{n}{4}\right\rfloor^{2}$ if $n\equiv 1~(mod~4)$.\\ $\bullet$ $\displaystyle\left\lfloor\frac{n}{4}\right\rfloor\left(\left\lfloor\frac{n}{4}\right\rfloor+1\right)-1$ if $n\equiv 2~(mod~4)$.\\ $\bullet$ $\displaystyle\left\lfloor\frac{n}{4}\right\rfloor\left(\left\lfloor\frac{n}{4}\right\rfloor+1\right)$ otherwise. \end{theorem} \noindent{\textbf{Proof:}} At the beginning, it is not difficult to verify that there are not two isomorphic different trees in the union $\{P_m: m\geq 5\}\cup\{P_{k,t}: k\geq5, t\geq 1\}\cup\{P_{m,n_1,n_2}: m\geq4, n_1\geq1 ~~and~~ n_2\geq 1\}$. \\ By Proposition \ref{p1}, $P_5$ is the unique $(-2)$-critical tree with five vertex and $P_6$ is the unique $(-2)$-critical tree with six vertices. As a matter of fact, the result holds.\\ Now, assume that $n\geq 7$. By Proposition \ref{2CT}, the nonisomorphic $(-2)$-critical trees with $n$ vertices are $P_n$, the family of $P_{k,t}$ where $t \geq1$, $k\geq5$, and $n=2t+k$, or the family of $P_{m, n_1, n_2}$ where $1\leq n_1 \leq n_2$, $m\geq4$, and $n=2(n_1+n_2)+m$. Therefore, it is sufficient to determine the number of the family of $P_{k,t}$ and the number of the family of $P_{m, n_1, n_2}$.\\ Let $S_{m}=\{(n_1, n_2)\in \mathbb{N}\times \mathbb{N}: 1\leq n_1\leq n_2, ~~n_1+n_2=\frac{n-m}{2}\}$, where $4\leq m\leq n-4$ and let $C_{t}=\{k\in \mathbb{N}: 5\leq k~~and ~~k=n-2t\}$, where $1\leq t\leq \frac{n-5}{2}$. Since $n-m= 2(n_1+n_2)$, it is obvious that $n$ and $m$ are of the same parity. Hence, we distinguish two cases.\\ $\underline{\textbf{Case 1:}}$ If $n=2p$ where $4 \leq p$ and $m=2q$ where $2 \leq q \leq p-2$. \\ Consider $\displaystyle S=\bigcup_{q=2}^{p-2}S_{2q}$ and $\displaystyle C=\bigcup_{t=1}^{p-3}C_t$. First, it is clear that the number of the family of $P_{k,t}$ is the cardinality of the set $C$. Moreover, it is clear that $|C_t|=1$ where $1\leq t\leq p-3$. Hence, $\displaystyle |C|=\sum_{t=1}^{p-3}|C_t|=p-3$. Second, obviously the number of the family of $P_{m, n_1, n_2}$ is the cardinality of the set $S$. Furthermore, we have $\displaystyle |S|=\sum_{q=2}^{p-2}|S_{2q}|$. It is noticeable that for each $2\leq q \leq p-2$, $|S_{2q}|= P_2(\frac{n-2q}{2})$, where $P_i(j)$ is the number of partitions of $j$ to $i$ parts. Recall that for an integer $k \geq 3$, $P_2(k) =\lfloor\frac{k}{2}\rfloor$ where $\lfloor x \rfloor$ is the greatest integer $\leq x$ \cite{anderson_2006}. We get then $$\begin{aligned} \displaystyle |S| &= \sum_{q=2}^{p-2} P_{2}\left(\frac{n-2q}{2}\right)~~\\ & = \sum_{q=2}^{p-2} \left\lfloor\frac{n-2q}{4}\right\rfloor \\ & =\sum_{q=2}^{p-2} \left\lfloor\frac{\frac{n}{2}-q}{2}\right\rfloor\\ & =\sum_{i=0}^{p-2} \left\lfloor\frac{i}{2}\right\rfloor.\\ & =\displaystyle \left\{ \begin{array}{ll} ~\displaystyle (k-1)^2 & if ~p=2k, \hbox{} \\ ~~\\ ~\displaystyle (k-1)k & if ~p=2k+1. \hbox{} \end{array} \right. \end{aligned}$$ $\underline{\textbf{Case 2:}}$ Let $n=2p+1$ where $4 \leq p$ and $m=2q+1$ where $2 \leq q \leq p-2$. Let $\displaystyle S=\bigcup_{q=2}^{p-2}S_{2q+1}$ and $\displaystyle C=\bigcup_{t=1}^{p-2}C_t$. Clearly, the number of the family of $P_{k,t}$ is the cardinality of the set $C$. Hence, $\displaystyle |C|=\sum_{t=1}^{p-2}|C_t|=p-2$. In addition, the number of the family of $P_{m, n_1, n_2}$ is the cardinality of the set $S$. Therefore, we have $\displaystyle |S|=\sum_{q=2}^{p-2}|S_{2q+1}|$.\\ Since for each $2\leq q \leq p-2$, $|S_{2q+1}|= P_2\left(\frac{(n-1)-2q}{2}\right)$. Proceeding in the same manner as case 1, if $p=2k$ where $k\geq 2$, then $|S|=(k-1)^2$. Otherwise, $|S|=(k-1)k$.\\ Consequently, the number of nonisomorphic $(-2)$-critical trees with $n$ vertices equals: $$\displaystyle \left\{ \begin{array}{ll} ~\displaystyle \left\lfloor\frac{n}{4}\right\rfloor^{2}-1 & if ~n\equiv 0~(mod~4), \hbox{} \\ ~~\\ ~\displaystyle\left\lfloor\frac{n}{4}\right\rfloor^{2} &if ~n\equiv 1~(mod~4), \hbox{} \\ ~~\\ ~\displaystyle \left\lfloor\frac{n}{4}\right\rfloor\left(\left\lfloor\frac{n}{4}\right\rfloor+1\right)-1& if ~n\equiv 2~(mod~4), \hbox{}\\ ~~\\ ~\displaystyle\left\lfloor\frac{n}{4}\right\rfloor\left(\left\lfloor\frac{n}{4}\right\rfloor+1\right) &if ~n\equiv 3~(mod~4). \hbox{} \end{array} \right. $$ {\hspace*{\fill}$\Box$\medskip} \section{Proof of Theorem 1.2:} We set two major objectives throughout this section. First, to characterize the $k$-minimal trees. Second, to determine the number of nonisomorphic $k$-minimal trees with $n$ vertices where $k \in \{1,2,3\}$. \noindent{\textbf{Proof of Theorem 1.2.} Let $T=(V,E)$ be a tree with $n\geq 5$ vertices and let $\{x_1,...,x_k\}$ be a vertex subset of $G$ where $k$ is a strictly positive integer. Assume that $T$ is minimal for $\{x_1,...,x_k\}$. Since $T$ is prime, it satisfies the first condition of Theorem \ref{TH20}. Suppose, on the contrary, that there is $y \in \mathcal{L}(T)$ such that $\{y, y^+\}\cap \{x_1,...,x_k\}=\emptyset$. Since $T-y$ is a decomposable tree, by Lemma \ref{LL1}, there is $x\in \mathcal{L}(T)$ such that $\{x, y^+\}$ is a module of $T-y$. Thus, $d(y^+)=2$ and $d(x, y)=3$. If $x\notin \{x_1,...,x_k\}$, then $T-x$ is a decomposable tree. By using again Lemma \ref{LL1}, $d(x^+)=2$ and so $T$ is isomorphic to $P_4$; which contradicts the fact that $n\geq 5$.\\ Moreover, assume that $x\in \{x_1,...,x_k\}$ and $d(x^+) \geq 3$, then $\mathcal{L}(T)\backslash\{y\}=\mathcal{L}(T-\{y, y^+\})$. By Lemma \ref{tree}, $T-\{y, y^+\}$ is a prime tree containing $\{x_1,...,x_k\}$; which contradicts the fact that $T$ is minimal for $\{x_1,...,x_k\}$. Hence, for each $x\in \mathcal{L}(T)$, $\{x, x^+\}\cap\{x_1,...,x_k\}\neq\emptyset$ and $T$ satisfies the second condition of Theorem \ref{TH20}.\\ Now, assume that there is $x_i\in \mathcal{S}(T)$ and $x_i^-\notin \{x_1,...,x_k\}$ where $1\leq i \leq k$. On the contrary, suppose that $d(x_i) \geq 3$, then $\mathcal{L}(T)\backslash\{x_i^-\}=\mathcal{L}(T-x_i^-)$. By Lemma \ref{tree}, $T-x_i^-$ is a prime tree containing $\{x_1,...,x_k\}$; which is impossible. Hence, $d(x_i)=2$. On the contrary, suppose that for each $j\neq i \in \{1,...,k\}$ such that $x_j \in \mathcal{L}(T)$, $d(x_i, x_j)\geq 3$. Since $T-x_i^-$ is a decomposable tree, then by Lemma \ref{LL1} there is $y\in \mathcal{L}(T)$ such that $d(x_i, y) =2$ and hence $y\notin \{x_1,...,x_k\}$. By Condition 2, $y^+ \in \{x_1,...,x_k\}$ and so $d(y^+)=2$. Thus, $T$ is isomorphic to $P_4$; which is impossible. Therefore, $T$ satisfies the third condition. Conversely, let $T=(V,E)$ be a tree with $n\geq 5$ vertices. Since for each $x\neq y \in \mathcal{L}(T)$, $d(x, y)\geq 3$, $T$ is a prime tree. Let $X$ be a subset of $V$ such that $\{x_1,...,x_k\} \subseteq X$ and $T[X]$ is prime. Consider $x\in \mathcal{L}(T)$. If $x\in \{x_1,...,x_k\}$, then $x\in X$.\\ Now, assume that $x\notin \{x_1,...,x_k\}$. On the contrary, suppose that $x\notin X$. By assertion (2) of Theorem \ref{TH20}, $x^+\in \{x_1,...,x_k\}$. Since $T$ satisfies assertion (3) of Theorem \ref{TH20}, then $d(x^+)=2$ and there is $i \in \{1,...,k\}$ such that $x_i\in \mathcal{L}(T)$ and $d(x_i, x^+)=2$. Thus, $\{x^+, x_i\}$ is a module of $T[X]$; which is impossible. Hence, $x\in X$. We conclude that $\mathcal{L}(T)\subset X$. Since $T[X]$ is a prime, it is connected. Therefore, $T[X]$ is a tree containing $\mathcal{L}(T)$. Hence, $X=V$. Thus, $T$ is minimal for $\{x_1,...,x_k\}$.{\hspace*{\fill}$\Box$\medskip} The following corollary is an immediate consequence of Theorem \ref{TH20}. \begin{corollary} For any distinct vertices $x_1, x_2$,..., and $x_k$ in a prime tree $H$, there is an induced subtree $T$ of $H$ that contains $\{x_1, x_2,...,x_k\}$, and satisfies the assertions of Theorem \ref{TH20}. \end{corollary} Our second objective is to determine the number of nonisomorphic $k$-minimal trees with $n$ vertices where $k \in \{1,2,3\}$. According to the characterization of 1-minimal and 2-minimal graphs, $P_4$ is the unique 1-minimal tree and $P_k$, where $k\geq 4$, is the unique 2-minimal tree \cite{Cournier1998MinimalIG}. To specify the number of nonisomorphic $3$-minimal trees with $n$ vertices, we introduce the following tree. \begin{description} \item[$\bullet$] For positive integers $k$, $m$, $n$ with $k \leq m \leq n$, let $S_{k,m,n}$ be the $(k+m+n+1)$-vertex tree with the union of the paths of lengths $k$, $m$, and $n$ having common endpoint $r$. Let $a_1,...,a_k$, $b_1,...,b_m$, and $c_1,...,c_n$ denote the other vertices on these paths, indexed by their distance from $r$ (see Figure \ref{3MINM}). \end{description} \begin{figure}[h!] \centering \includegraphics[width=10cm]{3min \caption{$S_{k,m,n}$} \label{3MINM} \end{figure} As an immediate consequence of Theorem \ref{TH20}, we get the following result which was already obtained by M. Alzohairi and Y. Boudabbous in \cite{ALZOHAIRI20143}. \begin{corollary}\label{3mw} Let $x$, $y$, and $z$ be distinct vertices in a tree $T$. The tree $T$ is minimal for $\{x,y,z\}$ if and only if $T$ and $\{x,y,z\}$ have one of the following forms: \begin{enumerate} \item $T \simeq P_4$. \item $T \simeq P_k$ with $k\geq5$ such that $\{x,y,z\}$ contains the leaves. \item $T \simeq S_{k,m,n}$ with $m\geq 2$ such that $x$, $y$, and $z$ are the leaves. \item $T \simeq S_{1,2,n}$ such that $\{x,y,z\}=\{a_1, b_1, c_n\}$. \item $T \simeq S_{1,2,2}$ such that $\{x,y,z\} = \{a_1, b_1, c_1\}$. \end{enumerate} \end{corollary} \begin{proposition} The number of nonisomorphic $3$-minimal trees with $n$ vertices equals:\\ $\bullet$ 1 if $n\in \{4,5\}$.\\ $\bullet$ 2 if $n=6$.\\ $\bullet$ $\left[\frac{(n-1)^2}{12}\right]-\left\lfloor\frac{n-4}{2}\right\rfloor + \left\lfloor\frac{n-2}{2}\right\rfloor-1$ if $n\geq 7$, where $[x]$ is the nearest integer from $x$. \end{proposition} \noindent{\textbf{Proof:}} At the beginning, it is not difficult to verify that there are not two isomorphic different graphs in the union $\{P_k: k\geq 4\}\cup \{S_{k,m,n} : m=2\}$. \\ By Corollary \ref{3mw}, $P_4$ is the unique 3-minimal tree with four vertices and $P_5$ is the unique 3-minimal tree with five vertices. In addition, the only $3$-minimal tree with six vertices are $P_6$ and $S_{1,2,2}$. Therefore, the result holds for $n \in \{4,5,6\}$.\\ Now, assume that $n\geq 7$. By Corollary \ref{3mw}, the non isomorphic $3$-minimal $n$-vertex trees are $P_n$ and the family of $S_{k,m,t}$, where $k \leq m\leq t$, $m\geq 2$, and $k+m+t+1=n$. Therefore, it is sufficient to prove that the cardinality of the set $S=\{(k,m,t)\in \mathbb{N}\times\mathbb{N}\times\mathbb{N}:1\leq k \leq m\leq t, m\geq 2, k+m+t=n-1\}$ equals $$\displaystyle \left[\frac{(n-1)^2}{12}\right]-\left\lfloor\frac{n-4}{2}\right\rfloor+\left\lfloor\frac{n-2}{2}\right\rfloor-2.$$ Let $S_2=\{(k,m,t)\in S: k\geq 2\}$. It is easy to infer that $|S-S_2|=P_2(n-2)-1$. Notice that $|S_2|=|\{(p,q,r)\in \mathbb{N}\times\mathbb{N}\times\mathbb{N}: 1\leq p \leq q\leq r, p+q+r=n-4\}|=P_3(n-4)$. Moreover, grounded on \cite{anderson_2006}, the number of partitions of $k$ with at most $3$ parts is equal to $\left[\frac{(k+3)^2}{12}\right]$. It follows that $P_3(k)=\left[\frac{(k+3)^2}{12}\right]-\left\lfloor\frac{k}{2}\right\rfloor-1$ \cite{anderson_2006}. Therefore, $$|S_2|=\left[\frac{(n-1)^2}{12}\right]-\left\lfloor\frac{n-4}{2}\right\rfloor-1$$ and $$|S-S_2|=\left\lfloor\frac{n-2}{2}\right\rfloor-1.$$ Thus, $$|S|=\displaystyle \left[\frac{(n-1)^2}{12}\right]-\left\lfloor\frac{n-4}{2}\right\rfloor+\left\lfloor\frac{n-2}{2}\right\rfloor-2.$$ {\hspace*{\fill}$\Box$\medskip}\\ \section{Conclusion} The problems of finding the $(-k)$-critical graphs and the $k$-minimal graphs seem to be challenging where $k$ is an integer ($k\geq 2$). At least, we solve these problems in the particular case of trees. In addition, we determine the number of nonisomorphic $(-k)$-critical trees with $n\geq5$ vertices where $k \in \{1,2, \lfloor\frac{n}{2}\rfloor\}$. Besides, we specify the number of nonisomorphic $3$-minimal trees with $n$ ($n\geq 4$) vertices. \nocite{*} \bibliographystyle{abbrvnat}
\section{Introduction} \begin{figure*}{H} \centering \includegraphics[width = 19cm, height = 13.5cm,angle=0]{paper_figure_v2.png} \caption{Examples of MYSOs and UCH\,{\sc ii} regions identified in the {\em{Planck}} data at the RMS position. From left to right: a) IRIS 25 $\mu$m; b) IRIS 100 $\mu$m; c) {\em{Planck}} HFI 857 GHz (350 $\mu$m); d) {\em{Planck}} HFI 353 GHz (850 $\mu$m). All the data are convolved to the common {\em{Planck}} HFI 353 GHz angular resolution (4.86$^{\prime}$).} \end{figure*} The initial stages of a massive star can be traced back to a giant molecular cloud (GMC), i.e. a cloud with a mass ranging from 10$^{5}$ M$_{\odot}$ to 10$^{6}$ M$_{\odot}$ (e.g Dame et al. 2001; Miville-Deschenes et al. 2017) and a linear size up to hundreds of pc. Within GMCs, very dense molecular cores (n $>$ 10$^{5}$ cm-3, e.g. Giannetti et al. 2013) collapse, and evolve first into massive young stellar objects (MYSOs), and later, when the OB star begins to ionize the surrounding material, into Ultra-Compact H\,{\sc ii} regions (UCH\,{\sc ii}). In this framework, characterizing clumps hosting massive star formation, an intermediate stage between GMCs and cores, is of primary importance: massive star formation is known to take place in cold (T$_d <$ 25 K), massive (M $>$ 100 M$_{\odot}$), luminous (L $>$ 10$^{3}$ L$_{\odot}$) environments, so constraining dust temperatures, luminosities and masses of the clumps allows one to assess whether the clump under investigation is able to effectively form massive stars. In general, determining accurate masses and luminosities for the clumps is also crucial to assess their evolutionary stage on a mass-luminosity plot (e.g. \cite{molinari}). In this work we are going to use the combined {\em{Planck}} High Frequency Instrument (HFI) (Tauber et al. 2010, Planck Collaboration 2011a, Lamarre et al. 2010; Planck HFI Core Team 2011a) and IRAS (Neugebauer et al. 1984) data to investigate a complete sample of clumps harboring MYSOs and UCH\,{\sc ii} regions. This study has two primary objectives: 1) to derive the properties (dust temperature, luminosity, mass, surface density) of these clumps and therefore fully characterize this evolutionary stage; 2) to make use of the estimated luminosities and masses, to compute an {\em{instantaneous}} Star Formation Efficiency (SFE) for the first 0.1 Myr (the approximate age of UCH\,{\sc ii} regions). For 2), we aim at addressing the question: At this fixed evolutionary stage, is there variation in the amount of gas relative to the star-formation (modulo the spread caused by the variation in age ?) And, what could cause variations in the efficiency that gas is converted to stars: galactic dynamics (sheer, bars), star formation mechanisms (cloud-cloud collisions), or hidden gas (e.g. undetected molecular material) ? The combination of the spectral bands from {\em{Planck}} and IRAS is extremely effective in probing the Spectral Energy Distribution (SED) of sources such as MYSOs and UCH\,{\sc ii}. The coldest dust component present in these objects typically thermalizes at temperatures of the order of 15 - 20 K, and this makes the 850 $\mu$m {\em{Planck}} band a very accurate tool in estimating the total mass. The accuracy of the {\em{Planck}} mass measurements is also due to the fact that this experiment operated from space, which means that no filtering for atmospheric noise is applied at any stage of data processing, hence emission on all angular scales is preserved. This is not the case for ground experiments such as APEX/LABOCA, JCMT/SCUBA and CSO/Bolocam, where considerable flux loss occurs, with effects on mass determination. An attempt to combine {\em{Planck}} and APEX/LABOCA data was carried out for the APEX Telescope Large Area Survey of the Galaxy (ATLASGAL, Schuller et al. 2009), a large and sensitive sub-millimeter survey of the inner Galactic plane. This work (Csengeri et al. 2016) though was limited to the investigation of the large-scale structure of cold dust. Noteworthy, {\em{Planck}} and IRAS both mapped the whole sky, including both the inner and outer Galactic Plane. The outer Galactic disk (R$_G$ $>$ 8.5 kpc) has characteristics that sets it apart from the inner Galaxy. For instance, for R$_G$ $>$ 13 kpc, both the H$_{2}$ surface density (Scoville $\&$ Sanders 1987; Digel et al. 1996; Heyer et al. 1998) and the stellar disk (Robin et al. 1992; Ruphy et al. 1996) appear to exhibit a sharp decline. In addition, the metallicity, at these large Galactocentric distances, is only half solar ($\sim$ 0.5 Z$_{sol}$, Yong et al. 2005). These observational facts suggest a dramatic change in star formation activity with respect to the inner Galaxy. We emphasize that the {\em{Planck}} and IRAS beams (of the order of 5 arcmins) are sensitive to structures of $\sim$ 1.5 pc (at a distance of 1.5 kpc), which is the typical size of Galactic clumps. Although clumps will contain multiple cores, we expect MYSOs or UCH\,{\sc ii} regions to be the dominant component within each individual clump. The paper is organized as follows. Section~2 describes the {\em{Planck}} and the IRAS data sets. Section~3 provides details on the samples selection and on the identification of the sources in the {\em{Planck}} data. Section~4 discusses the photometric measurements, the SEDs, as well as the estimate of the clump dust temperatures, luminosities, masses and surface densities. Section~5 presents the Star Formation Efficiency in terms of clump luminosity-to-mass ratio and its variations across the Galaxy. A summary is provided in the Conclusions (Section~6). Finally the Appendix contains an estimate of the colors that can be used as diagnostics to identify regions of massive star formation. \section{Planck data} {\em{Planck}}{\footnote{{\em{Planck}} (http://www.esa.int/Planck) is a project of the European Space Agency (ESA) with instruments provided by two scientific consortia funded by ESA member states (in particular the lead countries France and Italy), with contributions from NASA (USA) and telescope reflectors provided by a collaboration between ESA and a scientific consortium led and funded by Denmark.} (Tauber et al. 2010; Planck Collaboration 2011a) was the third-generation space mission to measure the anisotropy of the Cosmic Microwave Background (CMB). It observed the sky in nine frequency bands covering 30 - 857 GHz (i.e., 10,000 $\mu$m - 350 $\mu$m), with high sensitivity and angular resolution from 31$^{\prime}$ to 5$^{\prime}$. The Low Frequency Instrument (LFI, Mandolesi et al. 2010) covered the 30, 44 and 70 GHz bands with amplifiers cooled to 20 K. The High Frequency Instrument (HFI, Lamarre et al. 2010; Planck HFI Core Team 2011a) covered the 100, 143, 217, 353, 545 and 857 GHz bands with bolometers cooled to 0.1 K. Polarisation was measured in all but the two highest frequency bands (Leahy et al. 2010; Rosset et al. 2010). {\em{Planck}}'s sensitivity, angular resolution, and frequency coverage made it a powerful instrument for Galactic and extragalactic astrophysics as well as cosmology. In this paper we use the {\em{Planck}} PR2 full channel, full mission temperature maps at nominal frequencies 353 (850 $\mu$m), 535 (560 $\mu$m) and 857 GHz (350 $\mu$m). We downloaded the maps from the IRSA archive{\footnote{https://irsa.ipac.caltech.edu/data/Planck/release$\_$2/}}. The 353 GHz map are in T$_{CMB}$ units, while the 535 and 857 GHz maps are in MJy/sr. To perform the conversion from CMB thermodynamic units to Rayleigh-Jeans brightness temperature units we make use of the conversion factor given in Table~3 of Planck Collaboration.X. (2016). We adopt the effective beam sizes provided in the Explanatory Supplement{\footnote{https://wiki.cosmos.esa.int/planck$-$legacy$-$archive/index.php/Effective$\_$Beams}}. These are: 4.86$^{\prime}$, 4.84$^{\prime}$ and 4.63$^{\prime}$ at, respectively, 353, 545 and 857 GHz. \subsection{Ancillary data} In order to construct SEDs of the clumps, we complement the {\em{Planck}} data with IRAS (Neugebauer et al. 1984) data at 100, 60 and 25$\mu$m. In particular, we use the IRIS (Improved Reprocessing of the IRAS Survey, Miville-Deschenes $\&$ Lagasche 2005) maps, which benefit from the COBE-DIRBE (Hauser et al. 1998) calibration and zero point, as well from a better zodiacal light subtraction and destriping. We do not include the IRIS 12$\mu$m data since this band is significantly contributed to by emission from Polycyclic Aromatic Hydrocarbons (PAHs), whose modeling and characterization is beyond the scope of this paper. The Full-Width-Half-Maximum (FWHM) of the IRIS beams are, respectively, 3.8', 4.0' and 4.3', at 25, 60 and 100 $\mu$m.\\ Both the {\em{Planck}} and IRIS data are reprojected into the HEALPIX (Hierarchical Equal Area isoLatitude Pixelization, Gorski et al., 2005) format with Nside = 2048. All maps are smoothed to the {\em{Planck}} 353 GHz angular resolution (4.86$^{\prime}$). \section{Sample selection} \label{sec:obs} Our reference data base for the source selection is the RMS{\footnote{http://www.ast.leeds.ac.uk/RMS/}} survey (Lumsden et al. 2013), i.e. a campaign of follow-up observations designed to identify possible contaminants (e.g. evolved stars and planetary nebulae, PNe) of a sample of $\sim$ 2000 candidate MYSOs assembled by Lumsden et al. (2002) using MSX color selection criteria. Examples of the follow-up observations which have been undertaken by the RMS team are high-resolution (1'') radio continuum observations (Urquhart et al. 2007a, 2009b) which have allowed the descrimination of UCH\,{\sc ii} regions from PNe, and near-IR spectroscopic measurements which have led to the identification of evolved stars (Clarke et al. 2006). This effort has made it possible to single out some 1500 (1420) MYSOs and UCH\,{\sc ii} regions with uniquely constrained distances (Urquhart et al. 2013) . Radial velocities have been obtained from $^{13}$CO J = 1 - 0 and J = 2 -1 observations (Urquhart et al. 2007b, 2008b), and these have been coupled with the Reid et al. (2009) rotation curve to derive kinematic distances. See Figure~1 for examples of MYSOs and UCH\,{\sc ii} regions from the RMS database in the IRAS/IRIS and {\em{Planck}} data. Mottram et al. (2011) investigate the completeness of the RMS sample. To this end, they compute the volume of the Galaxy probed by the RMS survey at each luminosity $L$ and assume that the RMS MYSOs and HII regions are distributed in a layer with a hole in the center, according to the model by Robin et al. (2003) for the thin disk Galactic stellar population. Following this method, they obtain that the survey is 100$\%$ complete for luminosities greater than $\sim$ 1$\times$10$^{4}$ L$_{\odot}$. This selection leads to 731 sources. The longitude and latitude distributions of the complete sample are shown in Figure~2. From the longitude distribution, it is evident that there is a higher source concentration towards the intersection of the line of sight with the Sagittarius and Scutum-Crux arms (first Galactic quadrant, {\em{l}} $\sim$ 30$^{\circ}$) and with the Norma and Scutum-Crux arms (fourth Galactic quadrant, {\em{l}} $\sim$ 330$^{\circ}$). Out of 731 sources, 209 are MYSOs candidate, 509 are UCH\,{\sc ii} regions, 13 are thought to be transition objects, i.e. sources that are older than MYSOs but not old enought to be classidied as UCH\,{\sc ii} regions. In addition, 151 ($\sim$ 20 $\%$) are located at Galactocentric distances greater than 8.5 kpc, and 108 are part of complexes of multiple sources. \begin{figure*} \centering \includegraphics[width=8cm,height=6cm]{Longitude_distr_L_ge_1e4Lsol.png} \includegraphics[width=8cm,height=6cm]{Latitude_distr_L_ge_1e4Lsol.png}\\ \caption{Longitude (left panel) and latitude (right panel) distributions of the sample of candidate MYSOs and UCH\,{\sc ii} regions above the 10$^{4}$ L$_{\odot}$ completeness limit. The dashed lines on the longitude plot denote, respectively, the Sagittarius and Scutum-Crux arms (at {\em{l}} $\sim$ 30$^{\circ}$) and the Norma and Scutum-Crux arms (at {\em{l}} $\sim$ 330$^{\circ}$).} \end{figure*} For each source in the RMS data, we create a 30$^{\prime}\times$30$^{\prime}$ image centered on the source at each {\em{Planck}} frequency (353, 545, 857 GHz). Each image is visually inspected to assure that the emission in the considered region is not dominated by background emission. From this visual inspection we notice that strong sources of emission centered on the location of the RMS source are, with a few exceptions ($\sim$ 5$\%$), present in the {\em{Planck}} HFI bands. To estimate the angular size of these structures, we follow two complementary approaches. First we assume that all the sources are unresolved with respect to the {\em{Planck}} 353 GHz convolution beam (4.86$^\prime$), second we perform a 2-dimensional gaussian fits and, for each clump, we derive a measure of the major and minor axis at 353 GHz (850 $\mu$m). In this case, not all the sources turn out to be resolved. Out of 731, only for 238 (32.5 $\%$) we can determine the major and minor axis, with an average size of 5.6' $\pm$ 1.5'. In the following sections, we will only show the results for the unresolved case, while we will annotate in parenthesis the results for the fitted size case. \section{SEDs} To compute the flux in each band, we use the HEALpix aperture photometry code developed for Planck Collaboration (2011c). As input aperture radius, we use half the convolution beam FWHM (4.86') if the sources are unresolved, otherwise we use half of the estimated FWHM from the 2-d gaussian fit. In case the sources are quasi-spherically symmetric, i.e. their aspect ratio is $\sim$ 1, the major and minor axis are averaged together and half this average is used as the source aperture, {\em{aper$_{s}$}}. Alternatively, half of the major axis is used as the aperture. After converting the maps in units of Jy/pixel, the pixels within an aperture equal to {\em{aper$_{s}$}} are summed together. An estimate of the background is subtracted using a median estimator of the pixels within radii [{\em{aper$_{s}$}}, 2$\times${\em{aper$_{s}$}}]. Uncertainties are obtained by summing in quadrature the r.m.s of the values in the background annulus to the absolute calibration uncertainties for each map. For the sources in double (90) or triple systems (18), in order to avoid double counting, we have subdivided the total flux in the Planck beam by two or three, depending on the case. Since the pioneering works of Chini et al. (1986a, 1986b, 1986c, 1987), it is known that, in order to explain observations of HII regions above and below $\sim$ 100$\mu$m, one has to invoke the existence of a 2-temperature component dust distribution: a warm, low density population of dust grains situated in the proximity of the central source, and a colder dust population in the periphery of the cloud. The preliminary finding by Chini et al. was subsequently confirmed by data at increasingly higher spatial resolution and larger spectral coverage (e.g. Povich et al. 2007), as well as by sophisticated radiative transfer modeling (e.g. Zhang $\&$ Tan 2011). The SEDs obtained from the combination of the {\em{Planck}} and IRIS data show a behaviour similar to the one just described (Figure~3, blue points), as the IRIS 60$\mu$m and 25$\mu$m data points cannot be represented by the same grey-body as the measurements at longer wavelengths. Taking this fact into account, we fit our SEDs with the functional form: \begin{equation} S_{\lambda} = A_{1} \left(\frac{\lambda}{\lambda_{0}}\right)^{-\beta} B_{\lambda}(T_{c}) + A_{2} \left(\frac{\lambda}{\lambda_{0}}\right)^{-\beta} B_{\lambda}(T_{w}) \end{equation} where T$_{c}$ and T$_{w}$ are, respectively, the temperatures of the cold and warm components, and $\lambda_{0}$ is set to 100 $\mu$m. To estimate the parameters A$_{1}$, A$_{2}$, T$_{c}$ and T$_{w}$, we use a $\chi$$^{2}$ goodness-of-fit method. For the spectral emissivity index, $\beta$, we test three different values: 1.8, 2.0 and 2.2. The best $\chi$$^{2}$ are consistely given by fits performed with $\beta$ = 1.8 (see Table~1), therefore this is the value that we adopt for both grey-bodies in the final runs. Note that we do not perform the photometric SED fitting by using a more sophisticated modeling (e.g. Robitaille et al. 2006, 2007) for several reasons: at the angular resolution we are working, we are not sensitive to the parameters probed by these models (e.g. disk inner/outer radius, cavity opening angle, etc.); moreover we are probing the extent of clumps, while those frameworks were designed for describing the behavior of individual cores; finally UCH\,{\sc ii} represent a far too advanced evolutionary stage not accounted for by those models. \begin{table} \begin{center} \caption{Spectral emissivity index, $\beta$, and corresponding average SED fitting $\chi^{2}$.} \begin{tabular}{cc} \hline \hline $\beta$ & {$\chi^{2}$} \\ 1.8 & 7.3 \\ 2.0 & 15.9 \\ 2.2 & 31.2 \\ \hline \hline \end{tabular} \end{center} \end{table} \begin{figure*} \centering \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G010e3208m00e1570A.png} \includegraphics[width=5cm,height=4.9cm]{SED_beta18_18_G025e6498p01e0491.png} \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G050e721p00e5591.png}\\ \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G054e0954m00e0598.png} \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G070e3164p01e6493.png} \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G133e7150p01e2155.png}\\ \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G189e0323p00e8092.png} \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G240e3156p00e0715.png} \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G291e6272m005364.png}\\ \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G302e4546m00e7401.png} \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G305e2017p00e2072B.png} \includegraphics[width=5cm,height=5cm]{SED_beta18_18_G323e7410m00e2552C.png}\\ \caption{Examples SED fits to the {\em{Planck}} and IRIS clumps fluxes. The best-fit 2-temperature component model is shown (black solid line). Black diamonds denote the {\em{Planck}} 350, 500, 850 $\mu$m and IRIS 100, 60 and 25$\mu$m data points. The cold (blue-dashed line) and warm (red-dashed line) temperature components are also shown.} \end{figure*} An illustration of the result of the fits is provided in Figure~3 (red solid line). Occasionally, in one (or more) HFI frequency band the best-fit model slightly over-/under-predicts the measured data points. This is a consequence of the adopted value for $\beta$. We have tested this hypothesis by making trial fits with the spectral emissivity index as a free parameter. Although in some cases the fit $\chi^{2}$ improves, we prefer to keep $\beta$ fixed and equal to the canonical value of 1.8, as the analysis of variations of $\beta$ and of its degeneracy with respect to dust temperature (e.g. Schnee et al. 2007; Juvela et al. 2013, 2018) is beyond the scope of this paper. \subsection{Dust temperatures distribution} From the fitting procedure, we derive estimates for the cold (T$_{c}$) and warm (T$_{w}$) dust temperatures components, of ${\overline{T_{c}}}$ = 21.2$\pm$2.9 K (21.2$\pm$3.1 K for the fitted size case) and ${\overline{T_{w}}}$ = 54.0$\pm$4.6 K (53.8$\pm$4.4 K for the fitted size case), i.e. comparable to those found for more evolved HII regions (e.g. Povich et al., 2007; Paladini et al. 2012). For the uncertainties, rather than the modeling errors, we adopt the standard deviations of the sample, given that the former underestimate the true errors. K\"onig et al. (2017) investigate a small sample of MYSOs (36 sources) and UCH\,{\sc ii} regions (25 sources), and for these they derive dust temperatures from the modelling of the combined MSX (Egan et al. 2003), WISE (Wright et al. 2010), Hi-GAL and ATLASGAL data. They obtain mean temperatures of 28.1$\pm$3.6 K and 31.7$\pm$4.0 K for MYSOs and UCH\,{\sc ii} regions, respectively, which lie in between our average cold and warm components. This work was extended to the whole ATLASGAL sample by Urquhart et al. (2018) who find, for MYSOs and HII regions, values of dust temperature between $\sim$ 15 and 40 K. We subdivide the sample into 6 Galactocentric bins of equal width (i.e. 2 kpc) and for each bin we compute the average T$_{c}$ and T$_{w}$ (see Table~2). The distributions of T$_{c}$ and T$_{w}$ vs. R$_{G}$ are plotted in Figure~4 (top panel), and indicate a decreasing temperature for the cold component towards the outer Galaxy, in particular for R$_{G}$ $>$ 10 kpc, accompanied by an opposite trend for the warm component. An important caveat to keep in mind is that, by binning according to distance from the Galactic center, we assume that the Galaxy is radially symmetric and, in doing so, we ignore the presence of spiral arms. To take this effect into account and explore even further dust temperature variations across the Galaxy, we split the sample according to longitude. We denote {\em{inner-Galaxy}} sources those located either in the first (0$^{\circ}$ $< l <$ 90$^{\circ}$) or fourth (270$^{\circ}$ $< l <$ 360$^{\circ}$) Galactic quadrants, and {\em{outer-Galaxy}} sources those either in the second or third Galactic quadrants (90$^{\circ}$ $< l <$ 270$^{\circ}$). We have 699 candidate MYSOs/UCH\,{\sc ii} regions in the {\em{inner}} sample and 32 in the {\em{outer}} one. Then, for each dust temperature component (T$_{c}$ or T$_{w}$), we compare the histogram distribution for the {\em{inner/outer Galaxy}} sub-samples (Figure~4, middle panels). In this case the average temperatures are: ${\overline{T_{c,i}}}$ = 21.2$\pm$2.9 K (21.2$\pm$3.1 K for the fitted size case), ${\overline{T_{c,o}}}$ = 20.8$\pm$2.4 K (20.6$\pm$2.7 K); ${\overline{T_{w,i}}}$ = 53.7$\pm$4.4 K (53.5$\pm$4.3 K for the fitted size case), ${\overline{T_{w,o}}}$ = 59.5$\pm$4.6 K (58.8$\pm$4.6 K for the fitted size case), where T$_{c,i}$/T$_{c,o}$ and T$_{w,i}$/T$_{w,o}$ are the cold/warm dust temperatures for the {\em{inner/outer Galaxy}} sub-samples, respectively. The histogram distributions highlight a trend similar to what is found in Figure~4 (upper panels). \begin{figure*} \centering \includegraphics[width=7cm, height=8.5cm, angle=90]{T2_R_L_ge_1e4Lsol_unresolved_beta18_18_all_multiple_average_bin.png} \includegraphics[width=7cm, height=8.5cm, angle=90]{T1_R_L_ge_1e4Lsol_unresolved_beta18_18_all_multiple_average_bin.png}\\ \includegraphics[width=6.5cm, height=8cm, angle=90]{T2_hist_inner_outer_L_ge_1e4Lsol_unresolved_beta18_18_all_multiple.png} \includegraphics[width=6.5cm, height=8cm, angle=90]{T1_hist_inner_outer_L_ge_1e4Lsol_unresolved_beta18_18_multiple_all.png}\\ \includegraphics[width=6.5cm, height=8cm, angle=90]{T2_hist_myso_uchii_L_ge_1e4Lsol_unresolved_multiple.png} \includegraphics[width=6.5cm, height=8cm, angle=90]{T1_hist_myso_uchii_L_ge_1e4Lsol_unresolved_multiple.png}\\ \caption{Top: Average cold (T$_{c}$) and warm (T$_{w}$) dust temperature components as a function of Galactocentric radius. R$_{G}$ values are sampled in 2-kpc bins. Plotted error bars are the standard deviations in each bin. Middle: cold and warm dust temperature distributions for sources in the inner (first and fourth) and outer (second and third) Galactic quadrants. Bottom: cold and warm dust temperature distributions for MYSOs and UCH\,{\sc ii} regions.} \end{figure*} We interpret this result in the context of the large scale properties of the Galactic plane. A dust temperature gradient is known to characterize the diffuse emission along the Galactic Plane, with temperatures ranging from 14 - 15 K in the outer Plane, to $\simeq$ 19 K for the inner one (Planck Collaboration 2011m). The temperature enhancement towards the center of the Galaxy is typically explained as due to the presence of a high concentration of star forming regions, especially in correspondence of the molecular ring (R$_{G}$ $\sim$ 5 kpc). From our analysis, it appears that the small scale behaviour reflects the situation on larger scales, with clumps harboring massive stars at large Galactic radii being at lower temperatures with respect to their counterparts closer to the Galactic center. Since T$_{D}$ $\propto$ $X_{ISRF}^{1/(4+\beta)}$ -- with T$_{D}$ denoting the dust temperature, $X_{ISRF}$ the intensity of the Interstellar Radiation Field (ISRF) and $\beta$ the dust emissivity index --, if we assume a Mathis et al. (1983) radiation field, i.e. scaling with the inverse of $R_{G}$, we obtain that the clumps cold dust component appears to be a local measure of the global radiation field. On the contrary, the clumps warm dust component depends on the stellar radiation field, since this dust is located in proximity of the young massive stars. Remarkably, an O5 star will heat up dust up to 30K out to a radius of 0.75 pc from the star (Whitney et al. 2005). The trend that we find appears to mimic the well-known invertionally proportional increase of electron temperature, T$_{e}$, with galactocentric radius in H$_{II}$ regions (Shaver et al. 1983, Paladini et al. 2004), which is consequence of the metallicity Galactic gradient, and of the fact that metals such as oxygen are coolants. Interestingly, though, we do not see a closer correlation when we split the sample in MYSOs and UCH\,{\sc ii} regions. A dependance of dust temperature on Galactocentric distance is also reported by Urquhart et al. (2018). In their analysis, these authors do not distinguish between cold and warm temperature components, however they find increasing temperatures at larger galactocenctric distances. Finally, we have analyzed potential differences between the warm/cold dust temperatures of candidate MYSOs and UCH\,{\sc ii} regions (Figure~4, bottom panel). We do not find any indication that these two populations are characterized by different temperatures. We find: ${\overline{T_{c,MYSO}}}$ = 20.5$\pm$3.0 K (same for the fitted size case), ${\overline{T_{w,MYSO}}}$ = 54.5$\pm$5.0 K (54.3$\pm$4.9 K for the fitted size case); ${\overline{T_{c,UCH_{II}}}}$ = 21.5$\pm$2.8 K (21.5$\pm$3.0 K for the fitted size case), ${\overline{T_{w,UCH_{II}}}}$ = 53.8$\pm$4.4 K (53.6$\pm$4.2 K for the fitted size case), where T$_{c,MYSO}$/T$_{c,UCH_{II}}$ and T$_{w,MYSO}$/T$_{w,UCH_{II}}$ are the cold/warm dust temperatures for the MYSOs/UCH\,{\sc ii} regions. \begin{table*} \begin{center} \caption{Average cold (T$_{c}$) and warm (T$_{w}$) dust temperatures per Galactocentric bin for the two cases of unresolved sources and fitted diameters.} \begin{tabular}{cccccc} \hline \hline bin center & n. sources & T$_{c}$ (unresolved) & T$_{w}$ (unresolved) & T$_{c}$ (fitted sizes) & T$_{w}$ (fitted sizes) \\ (kpc) & & (K) & (K) & (k) & (K) \\ & & & & & \\ 3 & 57 & 21.3$\pm$1.6 & 51.5$\pm$2.9 & 21.2$\pm$1.5 & 51.5$\pm$2.8 \\ 5 & 274 & 21.5$\pm$2.9 & 53.2$\pm$4.6 & 21.6$\pm$3.2 & 53.1$\pm$4.5 \\ 7 & 224 & 21.3$\pm$2.9 & 53.8$\pm$4.1 & 21.3$\pm$3.0 & 53.7$\pm$3.9 \\ 9 & 126 & 20.8$\pm$3.2 & 55.4$\pm$4.5 & 20.7$\pm$3.3 & 55.1$\pm$4.2 \\ 11 & 39 & 19.9$\pm$2.1 & 56.9$\pm$4.0 & 19.9$\pm$2.4 & 56.5$\pm$4.1 \\ $>$ 13 & 11 & 17.9$\pm$3.2 & 61.3$\pm$6.8 & 18.1$\pm$3.4 & 60.7$\pm$7.3\\ \hline \hline \end{tabular} \end{center} \end{table*} \subsection{Luminosities, masses and surface densities} Having fitted the source SEDs, we can compute their luminosities. To this end, we use the relation: \begin{equation} L_{IR} = 4 \pi D^{2} \int_{\lambda_{min}}^{\lambda_{max}} { S_{\lambda} d\lambda} \end{equation} where $S_{\lambda}$ is the best-fit 2-temperature component model discussed in Section~4, and D is the solar distance from the RMS data base. The integration is performed between 25$\mu$m and 850$\mu$m, i.e. the shortest/longest IRIS/Planck wavelength considered in our analysis. The result is shown in Figure~5. We obtain ${\overline{L_{IR}}}$ = $8.3\times10^{5}\substack{+1.4\times10^{6} \\ -6.5\times10^{4}}$ L$_{\odot}$ (${\overline{L}}$ = $1.1\times10^{6}\substack{+1.7\times10^{6} \\ -6.8\times10^{4}}$ L$_{\odot}$ for the fitted-sizes case). We find that sources in the inner Galaxy are on average more luminous than in the outer Galaxy, with ${\overline{L_{IR, inner}}}$= $8.9\times10^{5}\substack{+1.5\times10^{6} \\ -6.9\times10^{4}}$ L$_{\odot}$ (${\overline{L_{IR, inner}}}$ = $1.2\times10^{6}\substack{+1.8\times10^{6} \\ -7.6\times10^{4}}$ L$_{\odot}$ for the fitted-sizes case) and ${\overline{L_{IR, outer}}}$ = $3.0\times10^{5}\substack{+6\times10^{5} \\ -2.8\times10^{4}}$ L$_{\odot}$ (${\overline{L_{IR, outer}}}$ = $3.6\times10^{5}\substack{+6.2\times10^{5} \\ -3.1\times10^{4}}$ L$_{\odot}$ for the fitted-sizes case). We also look into differences between the average luminosity of clumps associated with MYSOs and UCH\,{\sc ii} regions and the latter turn out to be more luminous, with ${\overline{L_{IR, UCHII}}}$ = $9.6\times10^{5}\substack{+1.6\times10^{6} \\ -7.7\times10^{4}}$ L$_{\odot}$ (${\overline{L_{IR, UCHII}}}$ = $1.3\times10^{6}\substack{+1.9\times10^{6} \\ -8.2\times10^{4}}$ L$_{\odot}$ for the fitted-sizes case) and ${\overline{L_{IR, MYSO}}}$ = $5.3\times10^{5}\substack{+7.8\times10^{5} \\ -4.3\times10^{4}}$ L$_{\odot}$ (${\overline{L_{IR, MYSO}}}$ = $6.7\times10^{5}\substack{+8.7\times10^{5} \\ -4.4\times10^{4}}$ L$_{\odot}$ for the fitted-size case), which is consistent with their more advanced evolutionary stage. This is also similar to what has been reported by Urquhart et al. (2014) who analyzed a sample of $\sim$ 800 ATLASGAL clumps associated with $\sim$ 1,000 RMS sources. These authors compute their luminosities by using the model SED fitter developed by Robitaille et al. (2007) and by combining flux measurements from 2MASS (Skrutskie et al. 2006), UKIDSS (Lucas et al. 2008) or Vista-VVV (Minniti et al. 2010), MSX, WISE, Hi-Gal and ATLASGAL. They obtain that the luminosity distributions of the MYSO and UCH\,{\sc ii} regions subsamples are significantly different, with the two distributions peaking at $\sim$ 1$\times$10$^{4}$ L$_{\odot}$ and $\sim$ 4$\times$10$^{4}$ L$_{\odot}$,respectively. This difference in the luminosity function was first discussed in Mottram et al. (2011b). Note that the lower luminosities reported by Urquhart et al. (2014) with respect to our values, are likely due to the fact that the ATLASGAL clumps are smaller in size, i.e. on average $\sim$ 1.2 pc (see below for a comparison with our average size). \begin{figure*} \centering \includegraphics[width=12cm, height=14cm, angle=90]{lum_multiplot_unresolved_multiple.png} \caption{Top panel: Overall distribution of luminosities for the complete sample. Middle panel: inner and outer Galaxy luminosity distribution. Bottom panel: MYSOs, UCH\,{\sc ii} regions and MYSOs/UCH\,{\sc ii} luminosity distribution.} \end{figure*} For the calculation of clump masses, assuming thermal equilibrium, we have: \begin{equation} M_{IR} = \frac{S{_{850\mu m}} D^2}{\kappa_{850\mu m} B_{\nu}(T_{d})} \end{equation} where the dust opacity, assuming a gas-to-dust ratio of 100, $\kappa_{850\mu m}$ = $\kappa_{353 \hspace*{0.1truecm} GHz}$ = 0.012 cm$^2$ g-1 (Preibisch et al. 1993), and T$_{d}$ = T$_{c}$. Given that we only consider the cold dust component and ignore dust depletion effects in the source proximity, our computed mass will be an overestimate of the true values. Also, we emphasize that changing the value of the adopted dust opacity with affect the mass estimates. For instance, Ossenkopf $\&$ Henning (1994) give $\kappa_{700\mu m}$ = 0.0257 cm$^2$ g-1, causing masses to be a factor of two lower. Finally, the dust-to-gas ratio, rather than being a fixed value across the Galaxy, varies with Galactocentric distance and this will introduce further uncertanties in mass determinations. Figure~6 illustrates the overall mass distribution (top panel), the inner and outer Galaxy mass distribution (middle panel), and the mass distribution for MYSOs, UCH\,{\sc ii} regions and MYSOs/UCH\,{\sc ii}. The resulting average mass is ${\overline{M_{IR}}}$ = $7.7\times10^{4}\substack{+1.3\times10^{4} \\ -0.9\times10^{3}}$ M$_{\odot}$ (${\overline{M_{IR}}}$ = $1.1\times10^{4}\substack{+1.8\times10^{4} \\ -1.0\times10^{3}}$ M$_{\odot}$ for the fitted-sizes case). The sources in the inner Galaxy are not only more luminous but also more massive compared to those in the outer Galaxy, in fact ${\overline{M_{IR, inner}}}$= $8.2\times10^{3}\substack{+1.4\times10^{4} \\ -1.15\times10^{3}}$ M$_{\odot}$ (${\overline{M_{IR, inner}}}$ = $1.2\times10^{4}\substack{+1.8\times10^{4} \\ -1.2\times10^{3}}$ M$_{\odot}$ for the fitted-sizes case) and ${\overline{M_{IR, outer}}}$ = $2.2\times10^{3}\substack{+4.5\times10^{3} \\ -0.4\times10^{3}}$ M$_{\odot}$ (${\overline{M_{IR, outer}}}$ = $3.3\times10^{3}\substack{+5.3\times10^{3} \\ -0.6\times10^{3}}$ M$_{\odot}$ for the fitted-sizes cases). Finally, clumps associated with UCH\,{\sc ii} regions are more massive than clumps associated to MYSOs, with ${\overline{M_{IR, UCHII}}}$ = $8.5\times10^{3}\substack{+1.4\times10^{4} \\ -1.1\times10^{3}}$ M$_{\odot}$ (${\overline{M_{IR, UCHII}}}$ = $1.2\times10^{4}\substack{+1.9\times10^{4} \\ -1.1\times10^{3}}$ M$_{\odot}$ for the fitted-sizes case) and ${\overline{M_{IR, MYSO}}}$ = $5.5\times10^{3}\substack{+9.9\times10^{3} \\ -0.7\times10^{3}}$ M$_{\odot}$ (${\overline{M_{IR, MYSO}}}$ = $6.8\times10^{3}\substack{+1.2\times10^{4} \\ -0.9\times10^{3}}$ M$_{\odot}$ for the fitted-sizes case), again in agreement with the former being older objects, which have undergone completely the accretion process. A similar result is reported in Urquhart et al. (2014) based on the analysis of the sample of ATLASGAL clumps (see above). They find that the MYSO and UCH\,{\sc ii} regions associated clump distributions have a median value of $\sim$ 1000 M$_{\odot}$ and 2800 M$_{\odot}$, respectively. Note, once again, that the lower ATLASGAL values can be ascribed to the smaller clump sizes. In the overall sample, we have identified a sub-sample of 15 very massive objects, i.e. with a mass $>$ 4$\times$10$^{4}$ M$_{\odot}$. These are 3 MYSOs and 12 UCH\,{\sc ii} regions, which are concentrated towards {\em{l}} $\sim$ 43$^{\circ}$ and {\em{l}} $\sim$ 338$^{\circ}$, at a Galactocentric distance of, respectively, 7 kpc and 5 kpc. \begin{figure*} \centering \includegraphics[width=12cm, height=14cm, angle=90]{mass_multiplot_unresolved_multiple.png} \caption{Top panel: Overall distribution of mass for the complete sample. Middle panel: inner and outer Galaxy mass distribution. Bottom panel: MYSOs, UCH\,{\sc ii} regions and MYSOs/UCH\,{\sc ii} mass distribution.} \end{figure*} The derived masses allow us to estimate the sources surface densities, $\Sigma$ = M$_{IR}$ / ($\pi$ r$^{2}$), where $r$ is the linear radius. We obtain a mean surface density equal to $0.25\substack{+0.17 \\ -0.003}$ g cm$^{-2}$ (Figure~7). This mean value is greater than the characteristic surface densities of GMCs, $\Sigma \sim$ 0.035 g cm$^{-2}$ (Solomon et al. 1987), indicating that the clumps in our sample are gravitationally bound (Bertoldi $\&$ McKee 1992; Williams et al. 2000). At the same time this is lower than the average surface density (i.e. $\Sigma >$ = 1 g cm$^{-2}$) found by Plume et al. (1997) for a sample of regions of massive star formation observed in the $J$ = 5 $\rightarrow$ 4 and 2 $\rightarrow$ 1 transitions of CS and C$^{34}$S. Importantly, Plume's sources have a mean linear radius and (virial) mass of 0.5 pc and 3800 M$_{\odot}$, respectively. Our sample is characterized by generally larger and more massive clumps, with a mean linear radius of 4.7$\pm$3.7 pc, and they do not represent the dusty counterparts of the molecular dense clumps studied by Plume et al. (1997): while Plume et al.'s observations trace the densest material directly involved in the production of massive stars, the {\em{Planck}} measurements are sensitive to the total mass involved, including less dense material. More recent studies (Butler $\&$ Tan 2012; Traficante et al. 2018, 2020) have revised down the massive star formation threshold value and today it is generally accepted that this is to be found in the range 0.1 - 0.35 g cm$^{-2}$, in agreement with the fact that our clumps are forming massive stars. \begin{figure}[h] \centering \hspace*{-0.5truecm} \includegraphics[width=9cm, height=7cm, angle=0]{Surface_density_L_ge_1e4Lsol_fwhm_multiple.png} \caption{Surface density distribution for the clumps in the complete sample.} \end{figure} \section{Variation of the Star Formation Efficiency with Galactocentric Radius} It is well established that the outer Galaxy presents a very different environment with respect to the inner Galaxy, being the former characterized by low total gas densities, low metallicities and gas abundances, as well as by higher shear. Because of the Kennicutt (1998) law, the low densities makes the gas gravitationally stable, hence not apt to star formation. Despite these unfavorable environmental conditions, sporadic star formation is observed towards the outer Galaxy, suggesting that other mechanisms, other than gravity, may trigger the star formation process. In particular, Elmegreen $\&$ Hunter (2006) propose that some degree of turbulence persists in the outer disk, allowing the formation of clouds and compensating for the lack of gravitational instabilities. A measure of the global {\em{instantaneous}} SFE can be obtained from the ratio of the IR luminosity, $L_\mathrm{IR}$, to clump mass, $M_\mathrm{IR}$. Both these quantities have the same square dependence on distance (D$^{2}$), therefore their ratio is distance independent. This is very important given that solar distances, especially when derived from kinematic measurements, can be affected by large uncertainties. Using the same binning in Galactocentric radii described in Section~4.1, we then investigate how the luminosity-to-mass ratio, $L_\mathrm{IR}$/$M_\mathrm{IR}$, varies from the inner to the outer Galaxy. For this purpose, we first analyze the $L_\mathrm{IR}$/$M_\mathrm{IR}$ distributions per Galactocentric bin (Figure~8). Then, we average the $L_\mathrm{IR}$/$M_\mathrm{IR}$ values in each bin, and look at the distribution of the mean values as a function of Galactocentric radius (Figure~9 and Table~3). It is apparent from Figure~8 that there is a significant dispersion of the $L_\mathrm{IR}$ to $M_\mathrm{IR}$ ratios in each bin, indicating that star formation does not simply scale with distance from the Galactic center, but instead is a complex process which depends on many parameters. If the determing factors in defining the star formation activity at a given location in the Galaxy were quantities which linearly scale with the Galactocentric radius, such as gas column density and metallicity, we would expect a much tighter correlation. Despite the large scatter in every bin, a global trend emerges from both Figure~8 and Figure~9: the mean luminosity-to-mass ratio decreases towards the outer Galaxy, with a difference between the most three inner bins (2 kpc $<$ R$_G$ $<$ 8 kpc) and the most three outer ones (8 kpc $<$ R$_G$ $<$ 14 kpc) of the order of 53$\%$. \begin{figure*} \centering \includegraphics[width=14cm, height=16cm, angle=90]{Luminosity_mass_R_L_ge_1e4Lsol_unresolved_multiple_multiplot.png} \vspace*{0.3truecm} \caption{IR luminosity to dust mass ratio ($L_\mathrm{IR}$/$M_\mathrm{IR}$) as a function of Galactocentric radius, R$_{G}$.} \end{figure*} Similarly, if one considers the $L_\mathrm{IR}$/$M_\mathrm{IR}$ distributions for the {\em{inner}}/{\em{outer Galaxy}} sources, using the same convention for defining the two sub-samples described in Section~4.1, we obtain: ${\overline{(L_{IR,i}/M_{IR,i})}}$ = $119.1\substack{+177.6 \\ -34.2}$ L$_{\odot}$/M$_{\odot}$ (${\overline{(L_{IR,i}/M_{IR,i})}}$ = $118.9\substack{+169.4 \\ -31.9}$ L$_{\odot}$/M$_{\odot}$ for the fitted-sizes case) and ${\overline{(L_{IR,o}/M_{IR,o})}}$ = $109.8\substack{+1150.8 \\ -43.1}$ L$_{\odot}$/M$_{\odot}$ (${\overline{(L_{IR,o}/M_{IR,o})}}$ = $94.9\substack{+135.3 \\ -33.7}$ L$_{\odot}$/M$_{\odot}$ for the fitted-sizes case), where $L_\mathrm{IR,i}$/$M_\mathrm{IR,i}$ and $L_\mathrm{IR,o}$/$M_\mathrm{IR,o}$ are the IR luminosity to clump mass ratio for the {\em{inner}} and {\em{outer Galaxy}} samples, respectively (Figure~10). \begin{figure*} \centering \epsfig{file=Luminosity_mass_R_L_ge_1e4Lsol_unresolved_multiple_average_bin.png, width=11cm, height=15cm, angle=90} \caption{IR luminosity ($L_\mathrm{IR}$) to dust mass ($M_\mathrm{IR}$) ratio, $L_\mathrm{IR}$/$M_\mathrm{IR}$, as a function of Galactocentric radius, R$_{G}$. The error bars are the 15.9$\%$ and 84.1$\%$ percentiles. The best-fit to the data is shown (red-dashed line). Also shown is the exponential decay from Leroy et al. for the case of an optical radius of 13 kpc (green-dashed line) and 19 kpc (blue-dashed line). The stars represent the individual data points.} \end{figure*} If we look closely at Figure~8 and Figure~9, we notice that the SFE, instead of uniformly decreasing with R$_{G}$, first increases at small radii (R$_G$ $<$ 4 kpc) and then peaks at R$_G$ $\sim$ 5 kpc, after which it linearly decreases. This behavior can overall be explained by considering the molecular fraction radial profile as discussed, for instance, in Koda, Scoville $\&$ Heyer (2016). These authors show that, from a quantitative point of view, the fraction of molecular gas decreases from 100$\%$ near the center of the Galaxy, dropping to 50$\%$ at 6 kpc, and decreasing to 10-20$\%$ at $R \sim$ 8.5 kpc. The prominent bump at $\sim$ 4.5 kpc is due to the bar structure of our Galaxy, with a half-length of 4.4$\pm$0.5 kpc (Benjamin et al. 2005), and this is associated to bright CO at the end of the bar, as observed in many external barred spiral systems (e.g. Sheth et al. 2002). The correlation between SFE and molecular gas is a longstanding problem discussed in the literature, and even more so is the role played by spiral arms. Theoretical models (e.g. Dobbs et al. 2006) predict that spiral arms play a pivotal role in the formation of GMCs and enhance the SFE. However, so far we were lacking evidence of this. Previous efforts carried out by Moore et al. (2012) in the first Galactic quadrant found that the $L_\mathrm{IR}$/$M_\mathrm{IR}$ ratio was relatively flat for the inner 5 kpc. Two significant peaks were detected at $\sim$ 6 kpc and $\sim$ 8 kpc, respectively, but these were attributed to the presence of of the star formation complexes W51 snd W49. The work of Moore et al. (2012) was later extended by Eden et al. (2013; 2015) who reported no significant variation of the SFE between different arms or the inter-arm regions. More recently, Urquhart et al. (2018, 2020), in analyzing the ATLASGAL sample in the first and fourth quadrant, found that the SFE as described by the L$_{bol}$/M$_{clump}$ ratio is relatively flat between 2 and 9 kpc when evaluated over kiloparsec scales, although local enhancements can be detected on smaller scales, in agreement with Moore et al. (2012) and Eden et al. (2013; 2015). This body of work led all these authors to conclude that: "{\em{the spiral arms are principally collecting material together via orbit crowding but there is no evidence that they are playing a role in enhancing the star formation within molecular clouds.}}" We believe that we are detecting correlations of the SFE with Galactocentric distance, and with the overall distribution of molecular material, because, for the first time, we are combining three ingredients: 1) a complete sample of objects; 2) the exploration of the Galactic plane as a whole; 3) the use of data not affected by spatial filtering. Figure~9 also shows that the peak at R$_G$ $\sim$ 5 kpc is not followed by a steady decrease in SFE. Instead, the IR luminosity, $L_\mathrm{IR}$, to clump mass, $M_\mathrm{IR}$, ratio remains almost constant up to $\sim$ 9 kpc. A best-fit to $L_\mathrm{IR}$/$M_\mathrm{IR}$ as a function of Galactocentric radius gives:\\ \[ L_{IR}/M_{IR}=\left\{ \tag{4} \begin{array}{ll} 28.3 + 21.1 \times R_{G} \hfill R_{G} \hspace*{0.1truecm} < \hspace*{0.1truecm} 5 \hspace*{0.1truecm} \mathrm{kpc}\\ 152.8 - 4.2 \times R_{G} \hspace*{0.3truecm} \hfill 5 \hspace*{0.1truecm} \mathrm{kpc} \hspace*{0.1truecm} < \hspace*{0.1truecm} R_{G} \hspace*{0.1truecm} < \hspace*{0.1truecm} 9 \hspace*{0.1truecm} \mathrm{kpc}\\ 232.6 - 13.5 \times R_{G} \hspace*{0.2truecm} \hfill R_{G} \hspace*{0.1truecm} > \hspace*{0.1truecm} 9 \hspace*{0.1truecm} \mathrm{kpc} \end{array} \right. \] \vspace*{0.2truecm} Importantly, the best-fit solution is obtained by folding in the spread in the data points in each bin. We notice that the two last bins contains only few data points, i.e. 39 and 11, respectively. However, since the sample is complete, these bins are significant and their weight in the fit is the same as the other bins. Leroy et al. (2008), based on a study of 23 external spiral and dwarf galaxies, find that in spiral galaxies the SFE appears approximately constant up to the optical radius (r$_{25}$), after which it declines exponentially. Taking into account that for our Galaxy the optical radius is estimated to be at $\sim$ 13 - 19 kpc (Ruffle et al 2007; Sale et al. 2010), the Leroy et al.'s relation for the Milky Way can be re-written as: \[ SFE \propto L_{IR}/M_{IR}=\left\{ \tag{5} \begin{array}{ll} const \hfill R_{G} \hspace*{0.1truecm} < \hspace*{0.1truecm} 5.6 \hspace*{0.1truecm} - \hspace*{0.1truecm} 8.2 \hspace*{0.1truecm} \mathrm{kpc}\\ \sim \hspace*{0.1truecm} e^{-R_{G}/(3.25 \hspace*{0.1truecm} - \hspace*{0.1truecm} 4.75 \hspace*{0.1truecm} \mathrm{kpc})} \hfill R_{G} \hspace*{0.1truecm} > \hspace*{0.1truecm} 5.6 \hspace*{0.1truecm} - \hspace*{0.1truecm}$ 8.2 \hspace*{0.1truecm}$ \mathrm{kpc} \end{array} \right. \] \vspace*{0.2truecm} Figure~9 illustrates the linear fit to the data (equation~4) and the Leroy et al.'s exponential solutions for two values of the optical radius (equation~5). Leroy et al. point out that the ISM is equal parts of HI and H2 at R$_{G}$ = 0.4 $\times$ r$_{25}$ $\pm$ 0.18. Therefore their result can be interpreted as a steady decrease of the SFE beyond the HI-to-H2 transition radius. However, as we see from Figure~9, in the case of our Galaxy the SFE remains fairly constant up to R$_{G}$ $\sim$ 9- 10 kpc, suggesting either the presence of a significant, previously undetected, molecular material at R$_G$ $>$ 8 kpc and/or that the radial dependence of the SFE may not be simply a function of the HI-to-H2 transition radius as previously thought. \begin{figure} \centering \epsfig{file=Luminosity_mass_inner_outer_unresolved_multiple_ge_1e4Lsol.png, width=7cm, height=9cm, angle=90} \caption{Luminosity-to-mass ratio in the inner (first and fourth) and outer (second and third) Galactic quadrants. } \end{figure} From the observational point of view, the former finds at least partial confirmation in the hydrogen recombinations lines (H86$\alpha$ to H93$\alpha$) and radio continuum (9 GHz) survey carried out by Anderson $\&$ Bania (2011) with the Green Bank Telescope (GBT). These observations have allowed the discovery, in the first Galactic quadrant, of a new population of 34 HII regions located in the Outer Arm (Bania et al. 2010), at $R_{G} >$ 8 - 9 kpc. Previously, there were only 7 HII regions known in this area. Finally, we have investigated variations of the SFE as a function of Galactocentric radius for the two populations of MYSOs and UCH\,{\sc ii} regions, separately. A behavior similar to the parent population is found for each of these evolutionary stages (see Table~3). \begin{table*} \begin{center} \caption{Average $L_\mathrm{IR}$/$M_\mathrm{IR}$ per Galactocentric bin.} \begin{tabular}{cccccc} \hline \hline bin center & n. sources & Log($L_\mathrm{IR}$/$M_\mathrm{IR}$) (unresolved) & Log($L_\mathrm{IR}$/$M_\mathrm{IR}$) (fitted sizes) & Log($L_\mathrm{IR}$/$M_\mathrm{IR}$) (UCH\,{\sc ii}) & Log($L_\mathrm{IR}$/$M_\mathrm{IR}$) () \\ (kpc) & & Log(L$_{\odot}$/M$_{\odot}$) & Log(L$_{\odot}$/M$_{\odot}$) & Log(L$_{\odot}$/M$_{\odot}$) & Log(L$_{\odot}$/M$_{\odot}$) \\ & & & & & \\ 3 & 57 & $91.5\substack{+144.5 \\ -43.7}$ & $83.2\substack{+126.2 \\ -44.0}$ & $81.4\substack{+176.8 \\ -39.3}$ & $83.6\substack{+126.2 \\ -44.6}$\\ 5 & 274 & $133.6\substack{+184.2 \\ -33.9}$ & $141.8\substack{+183.5 \\ -33.1}$ & $104.6\substack{+163.2 \\ -28.6}$ & $157.9\substack{+203.5 \\ -33.2}$\\ 7 & 224 & $119.2\substack{+193.8 \\ -35.8}$ & $115.6\substack{+174.1 \\ -31.9}$ & $93.2\substack{+152.7 \\ -28.9}$ & $124.1\substack{+180.9 \\ -34.2}$ \\ 9 & 126 & $116.7\substack{+195.6 \\ -31.3}$ & $107.3\substack{+208.9 \\ -30.7}$ & $88.5\substack{+171.6 \\ -23.2}$ & $113.9\substack{+223.9 \\ -31.9}$\\ 11 & 39 & $73.1\substack{+93.6 \\ -34.2}$ & $65.5\substack{+84.8 \\ -30.7}$ & $52.3\substack{+77.7 \\ -28.3}$ & $72.9\substack{+162.3 \\ -33.7}$\\ $>$13 & 11 & $62.7\substack{+102.9 \\ -23.9}$ & $57.5\substack{+107.2 \\ -23.9}$ & $62.8\substack{+145.8 \\ -16.3}$ & $52.2\substack{+107.2 \\ -23.9}$\\ \hline \hline \end{tabular} \end{center} \end{table*} \section{Conclusions} {\em{Planck}} whole-sky sub-millimeter maps provide an unprecedented opportunity to carry out an unbiased study of the environmental conditions in which massive star formation takes place. Using {\em{Planck}} HFI upper frequency bands (350, 500, 850 $\mu$m) complemented by IRAS/IRIS 100, 60 and 25$\mu$m bands, we have estimated dust temperatures, luminosities, masses and surface densities of clumps associated to a complete sample of candidate MYSOs and UCH\,{\sc ii} regions selected from the RMS survey data base. Exploting the {\em{Planck}} and IRAS/IRIS full-coverage of the Galactic Plane, we have searched for variations of the clump dust temperatures (warm and cold component) with respect to distance from the Galactic center. We find that the distribution of the cold dust temperature component of the clumps generally reflects the large scale variation of dust temperature for the ISM along the Galactic Plane, that is: massive star complexes at smaller Galactocentric radii have higher temperatures than complexes at larger radii. An opposite trend is found for the warm dust component that appears to increase with distance from the center of the Galaxy, suggesting that the more embedded dust is subjet to the local conditions rather than to the ISRF. We have also explored how the luminosity-to-mass ratio (L/M) associated with the clumps varies from the inner to the outer Galaxy. Our results are consistent with a SFE decreasing from the inner to the outer Galaxy. However, the cut-off radius that identifies the transition between a fairly constant and a declining SFE is at a larger radius (R$_G$ $\sim$ 9 kpc) than expected. This may have implications for the amount of molecular gas still undetected at R$_G$ $>$ 8 kpc. Finally, we present in the Appendix color-color and color-magnitude plots of MYSOs and UCH\,{\sc ii} regions compared to cold clumps from the PGCC. These colors will be useful for identification of sites of massive star formation in future large-scale surveys. \begin{acknowledgements} This paper is based and made use of information from the Red MSX Source survey database at www.ast.leeds.ac.uk/RMS which was constructed with support from the Science and Technology Facilities Council of the UK. \end{acknowledgements}
\section{Introduction} The widespread use of noninvasive electrical brain stimulation in clinical applications has sparked ongoing interest in studying the effects of external inputs on brain activity. Stimulation with electric fields in the range of $1-2$ V/m can already modulate oscillatory brain activity \cite{Zaehle2010, Neuling2013}, affect cross-regional synchronization \cite{Polania2012, Strueber2014}, and modulate cognitive performance \cite{Ladenbauer2017}. Clinical studies have successfully demonstrated the efficacy of targeted transcranial stimulation in the treatment of neurological and psychiatric disorders and diseases such as epilepsy \cite{Sun2011, Fregni2006}, schizophrenia \cite{hasan2013transcranial, Cole2015}, Alzheimer's disease~\cite{Fried2016} and depression~\cite{George2012}. Brain network models offer a way to simulate and understand the human brain as a nonlinear dynamical system, in which each brain region is represented by a node, and the node dynamics is defined by a model of the average neural activity in that region \cite{bassett2017network}. Nodes interact with each other according to empirically measured human structural neural connectivity, which quantifies how neural activity in one brain region is coupled to the activity of connected regions. Parcellation of human brains has yielded various brain atlases \cite{Amunts2014}, which provide information on spatial and functional segregation, dividing the brain into distinct areas \cite{rolls2015aal2, Eickhoff2018}. The relative connectivity strength between these areas is defined by the number of axonal fibers, which can be estimated using structural neuroimaging scans of individual subjects. This results in a network model of the human brain where the edges reflect the relative strengths of axonal fiber bundles and the nodes represent individual brain regions. These nodes are then equipped with a dynamical system modeling the average neuronal activity in that region \cite{breakspear2017dynamic}. It has been repeatedly shown that when the parameters of brain network models are fitted to functional brain data, optimal operating points were close to the bifurcation lines of these models. This ensures that the model is in a state in which noise fluctuations can be amplified and produce realistic spatial correlation structures which are similar to empirical functional connectivity measurements \cite{deco2012ongoing, deco2013resting, demirtacs2019hierarchical, cakan2020deep}. Previous theoretical investigations into the impact of external perturbations mostly relied on the assumption of a linear node dynamics, allowing the application of methods from linear control theory \cite{tang2018colloquium}. Thus, one can draw conclusions on the effects of external inputs to the system, based on the network topology and independent of its dynamical state \cite{gu2017optimal, gu2015controllability}. On the other hand, linear node \cgreen{dynamics cannot} reproduce the dynamics of neural processes close to bifurcations \cite{deco2012ongoing, golos2015multistability}. In order to describe the transitions from one dynamical regime to another, Muldoon et al.~\cite{muldoon2016stimulation} consider nonlinear node dynamics. They conclude that the effects of stimulation-based control can be predicted by diagnostics from linear control theory based only on the structural connectivity of the network. In this work we go beyond linear control theory and explore the framework of optimal nonlinear control \cite{berkovitz2012nonlinear} for the assessing the impact of perturbations on networks of coupled nonlinear systems. Optimal control is an optimization method that derives control policies based on the minimization of a cost functional which depends on the state and control variables. Here, we define a cost functional that penalizes the deviation to the desired network dynamics, the control energy, and the spatial sparsity. The latter allows us to find optimal control signals that apply to only a few control sites, as introduced by \cite{herzog2012directional} and further studied by \cite{casas2017analysis}. We used methods presented by Tr{\"o}ltzsch in \cite{troltzsch2010optimal} for their calculation, while the handling of the stochastic term is based on the work of Stannat et al.~\cite{stannat2020deterministic}. The resulting mathematical formulation is analogous to the formulation presented by Casas et al.~\cite{casas2013sparse} for partial differential equations. We evaluate the framework of optimal control for a brain network of FitzHugh-Nagumo (FHN) \cite{FitzHugh1961, Nagumo1962} oscillators with additive coupling and white Gaussian noise, where each oscillator represents a brain region and where the connections between them were chosen according to the human connectome derived from diffusion tensor imaging (DTI) measurements. FHN oscillators are well studied models for neural dynamics and detailed analyses of the dynamical states exist for single oscillators \cite{kostova2004fitzhugh} and various network configurations, like two coupled units \cite{scholl2009time, eydam2019FHN}, lattices \cite{shepelev2019FHN}, rings and hierarchical architectures \cite{plotnikov2016synchronization}, as well as random and small-world topologies \cite{lehnert2011loss, cakan2014heterogeneous} and multiplex networks \cite{nikitin2019complex, omelchenko2019control, ruzzene2020remote}. Similar empirical DTI-measured brain connectivities were used with FHN dynamics to model highly synchronized epileptic-seizure-like states \cite{chouzouris2018chimera, gerster2020fitzhugh}, unihemispheric sleep \cite{ramlow2019partial}, and the functional organization of the resting brain \cite{ghosh2008cortical, vuksanovic2015dynamic, messe2015closer}. We consider two different classes of control problems, targeted attractor switching between multistable network states and increasing network synchronization. The solutions obtained for given energy, precision, and sparseness constraints are well interpretable and result in intuitively sensible optimal control inputs for all network nodes over time. We then correlate the control energies to controllability measures from linear control theory. We confirm the findings of Muldoon et al.~\cite{muldoon2016stimulation} for the investigated state transition (from the low fixed-point state to the oscillatory regime). For other control tasks, however, we show, that diagnostics from linear control theory do not correlate with results from optimal nonlinear control. Conclusions drawn from the structural connectivity alone lead to contradictions, which can only be resolved if the dynamical state of the network and the nonlinear interactions between nodes are taken into account. Applications of nonlinear control theory to whole-brain models enables us to investigate control mechanisms also close to bifurcations. It thus may help in the search for more effective paradigms for realistic transcranial brain stimulation protocols. \section{Nonlinear optimal control} \label{sec:nonlinear_control} \subsection{Network model and control inputs} \begin{comment} We consider networks of $N$ equivalent $d$-dimensional and ``noisy'' nodes with additive and zero-delay internode coupling. Internode coupling strength is described by a $N\times N$ dimensional adjacency matrix $\bm{A}$ which is scaled by a global coupling strength $\sigma$. The equations describing the network dynamics thus read: \cred{WRITE DIRECTLY WITH CONTROL TERM, Eq. 2} \begin{eqnarray} \label{eqn:network_without_control} \frac{d }{d t}\bm{x}(t) =\bm{h}(\bm{x}(t) ) + \sigma (\bm{A} \otimes \bm{G}) \bm{x} (t) + \frac{\eta}{\sqrt{dt}}(\bm{I_N} \otimes \bm{D}) \bm{\xi}(t), \end{eqnarray} where $\otimes$ denotes the Kronecker product. The state of the network is described by a vector $\bm{x}=(\bm{x_1},\ldots,\bm{x_N})$, where $\bm{x_i}=(x_{i1},\dots,x_{id})$ characterize the individual states of the nodes. The local node dynamics is given by $\bm{h}(\bm{x})=(\bm{h}(\bm{x_1}),\ldots,\bm{h}(\bm{x_N}))$ with $\bm{h}(\bm{x_i})=(h_1(\bm{x_i}),\dots,h_d(\bm{x_i}))$. All nodes additionally receive Gaussian white noise of similar intensity $\eta$, which may be correlated within but is uncorrelated across the nodes of the network. The stochastic variables $\bm{\xi}=(\bm{\xi_1},\dots,\bm{\xi_N})$ with $\bm{\xi_i}=(\xi_{i1},\dots,\xi_{id})$ are independently drawn from a Gaussian distribution, $\xi_{ij} \in \mathcal{N}(0,1)$, with zero mean and unit variance. Within node correlations are quantified by the $d\times d$ dimensional local noise scheme $\bm{D}$, while the across-node statistical independence is assured by a N-dimensional identity matrix $\bm{I_N}$. The internode coupling term consists of the Kronecker product of the adjacency matrix $\bm{A}$ and the $d\times d$ dimensional local coupling scheme $\bm{G}$, where the purpose of the former is to describe the relative interaction strength between nodes while the purpose of the latter is to distribute the between-node interactions across the $d$ variables which describe the local node dynamics. Initial conditions are denoted by $\bm{x}(t=0)=\bm{x_0}$. We then consider instantaneous and additive control input to the network, which is driven by $N \times d$ independent control variables $\bm{u}=(\bm{u_1},\ldots,\bm{u_N})$ with $\bm{u_i}=(u_{i1},\dots,u_{id})$. The equations for the dynamics of the controlled network thus read: \begin{eqnarray} \label{eqn:network_system} \begin{aligned} \frac{d }{d t}\bm{x}(t) =\bm{h}(\bm{x}(t) ) + \sigma (\bm{A} \otimes \bm{G}) \bm{x} (t) \\ +(\bm{B} \otimes \bm{K}) \bm{u}(t) + \eta(\bm{I_N} \otimes \bm{D}) \bm{\xi}(t). \end{aligned} \end{eqnarray} The $N\times N$ matrix $\bm{B}$ allows for the control of multiple nodes with different strength, while the $d\times d$ dimensional matrix $\bm{K}$ implements the local control scheme, which is similar for every node in the network. \end{comment} We consider networks of $N$ equivalent $d$-dimensional and ``noisy'' nodes with additive and zero-delay internode coupling. Internode coupling strength is described by a $N\times N$ dimensional adjacency matrix $\bm{A}$ which is scaled by a global coupling strength $\sigma$. \cgreen{We allow for an instantaneous and additive control input to the network, which is described by $N \times d$ independent control variables $\bm{u}=(\bm{u_1},\ldots,\bm{u_N})$ with $\bm{u_i}=(u_{i1},\dots,u_{id})$. } The equations describing the \cgreen{controlled} network dynamics thus read: \begin{eqnarray} \label{eqn:network_system} \begin{aligned} \frac{d }{d t}\bm{x}(t) =\bm{h}(\bm{x}(t) ) + \sigma (\bm{A} \otimes \bm{G}) \bm{x} (t) \\ +(\bm{B} \otimes \bm{K}) \bm{u}(t) + (\bm{I_N} \otimes \bm{D}) \bm{\xi}(t). \end{aligned} \end{eqnarray} where $\otimes$ denotes the Kronecker product. The state of the network is described by a vector $\bm{x}=(\bm{x_1},\ldots,\bm{x_N})$, where $\bm{x_i}=(x_{i1},\dots,x_{id})$ characterize the individual states of the nodes. The local node dynamics is given by $\bm{h}(\bm{x})=(\bm{h}(\bm{x_1}),\ldots,\bm{h}(\bm{x_N}))$ with $\bm{h}(\bm{x_i})=(h_1(\bm{x_i}),\dots,h_d(\bm{x_i}))$. All nodes additionally receive Gaussian white noise of similar intensity $\eta$, which may be correlated within but is uncorrelated across the nodes of the network. The stochastic variables $\bm{\xi}=(\bm{\xi_1},\dots,\bm{\xi_N})$ with $\bm{\xi_i}=(\xi_{i1},\dots,\xi_{id})$ are independently drawn from a Gaussian distribution, $\xi_{ij} \in \mathcal{N}(0,1)$, with zero mean and unit variance. Within node correlations are quantified by the $d\times d$ dimensional local noise scheme $\bm{D}$, while the across-node statistical independence is assured by a N-dimensional identity matrix $\bm{I_N}$. The internode coupling term consists of the Kronecker product of the adjacency matrix $\bm{A}$ and the $d\times d$ dimensional local coupling scheme $\bm{G}$, where the purpose of the former is to describe the relative interaction strength between nodes while the purpose of the latter is to distribute the between-node interactions across the $d$ variables which describe the local node dynamics. The $N\times N$ matrix $\bm{B}$ \cgreen{in the control term} allows for the control of multiple nodes with different strengt \cgreen{. The} $d\times d$ dimensional matrix $\bm{K}$ implements the local control scheme, which is similar for every node in the network. Initial conditions are denoted by $\bm{x}(t=0)=\bm{x_0}$. \subsection{The cost functional and the optimality condition} The control $\bm{u}$ is considered to be optimal ($\bm{u} = \overline{\bm{u}}$), if it minimizes an appropriate cost functional. To this end, we construct a cost functional $F(\bm{x}(\bm{u}),\bm{u})$ for a state switching task, where the control input drives the network model from one stable state to another (see Section \ref{sec:state_switching}), and for a node synchronization task, where the control input increases the degree of synchronization among its nodes (see Section \ref{sec:synchronize}). For finite noise, i.e.\ for finite values of $\eta$ in Eq.~\eqref{eqn:network_system}, the overall cost functional $F$ is defined as a mean over noise realizations~\cite{stannat2020deterministic}, \begin{eqnarray} \label{eqn:cost_functional_general} F(\bm{x}(\bm{u}),\bm{u})=\langle F_n(\bm{x}(\bm{u}),\bm{u}) \rangle = \langle F_n^x(\bm{x}) \rangle + F^u(\bm{u}), \end{eqnarray} where $F_n$ denotes the cost functional for one noise realization $n$ and the angle brackets $\langle \cdot \rangle$ denote the mean. \cgreen{In the noise-free case no averaging is performed.} The state dependent term $F_n^x(\bm{x})$ only implicitly depends on the control and penalizes the deviation from the desired output. It will be different for the switching, $F_{n,\textrm{\cgreen{sw}}}^x$, and synchronization, $F_{n,\textrm{\cgreen{syn}}}^x$, tasks (see below). The control dependent term $F^u(\bm{u})$ accounts for the cost of the control itself. For the state switching task, we consider a noise-free system ($\eta=0$), and the state dependent cost functional $F^x_{n,sw}$ is defined in terms of the deviation of the controlled state to a predefined target state $\bm{x}_T(t)$: \begin{align} \begin{split} \label{eqn:cost_functional_f_x1} F^x_{n,\textrm{\cgreen{sw}}}(\bm{x},t)&= F^x_{\textrm{\cgreen{sw}}}(\bm{x},t)\\ &= \int_{0}^{T}\frac{I_p(t)}{2} \cgreen{\bigl(} \bm{x}(t)-\bm{x}_{T}(t)\cgreen{\bigr)} ^2 dt, \end{split} \end{align} where we consider the control being active within the time period $0\le t\le T$. In order to penalize the precision only towards the end of the controlled time interval rather than during the transition between the initial and target states, the precision-penalizing variable $I_p$ can be time-dependent (see Section \ref{sec:state_switching}). The state dependent cost functional for the synchronization task $F^x_{n,syn}$ is defined in terms of the deviations of the normalized pairwise cross-correlations $R_{ij}$ for all nodes $i$ and $j$ from $R_T$, the desired mean cross-correlation in the synchronized target state: \begin{eqnarray} \label{eqn:cost_functional_f_x2} F^x_{n,\textrm{\cgreen{syn}}}(\bm{x},t) = \frac{I_p}{4N^2} \sum_{i,j=1}^N (R_{ij}-R_T)^2. \end{eqnarray} The cross-correlation in component $m$ is defined as \begin{eqnarray} \label{eqn:cross_correlation} R_{ij}^m=\int_0^T \frac{\big(x_{im}(t)- \langle x_{im}\rangle_t\big) \big(x_{jm}(t)- \langle x_{jm}\rangle_t\big)}{\sigma_{ \langle x_{im}\rangle_t} \sigma_{ \langle x_{jm}\rangle_t} } dt, \end{eqnarray} with $i, j \in [0,\dots ,N]$ and where $\langle .\rangle_t$ and $\sigma_{\langle .\rangle_t}$ denotes the temporal mean and the standard deviation. The mean $R^m$ over all values $R_{ij}^m$ \begin{eqnarray} \label{eqn:nw_cross_correlation} R^m = \frac{1}{N^2} \sum_{i=1}^{N} \sum_{j=1}^N R_{ij}^m, \end{eqnarray} is the component-wise network cross-correlation. Later we specialize to $m=1$ and suppress the index $m$. The input dependent cost functional $F^u(\bm{u})$ penalizes the energy of the control signal and enforces its directional sparsity \cite{herzog2012directional, casas2017analysis}. It is given by \begin{comment} \begin{eqnarray} \begin{split} \label{eqn:cost_functional_f_u} F^u(\bm{u}) = \ &\frac{{I_e}}{2} \int_{0}^{T} \norm{\bm{u}(t)}^2_{L^2(0,N)} dt \\ &+ {I_s} \normm{ \Big( \int_{0}^{T} \cpurple{\bm{u}(t) \circ \bm{u}(t)~}dt \Big)^{\frac{1}{2}} }_{L^1(0,N)}, \end{split} \end{eqnarray} \end{comment} \begin{eqnarray} \begin{split} \label{eqn:cost_functional_f_u} F^u(\bm{u}) = \ &\frac{{I_e}}{2} \int_{0}^{T} \bm{u}^2(t) dt \\ &+ {I_s} \cgreen{\sum_{k=1}^N} \Big( \int_{0}^{T} {u}_k^2(t)dt \Big)^{\frac{1}{2}} , \end{split} \end{eqnarray} where $I_e$ and $I_s$ are the weights for the energy and sparsity terms. \cgreen{The first term corresponds to the L2-regulation and the second term to the L1-regulation of the cost-functional.} Typically, increasing the sparsity $I_s$ reduces the number of controlled nodes, i.e.\ the nodes for which the control input is non-zero for at least part of the time period $0 \leq t \leq T$, while a higher penalty on the energy term typically leads to an overall reduction of control strengths. Our goal is to find the optimal control $\overline{\bm{u}}$ that minimizes the cost functional for chosen $I_p$, $I_e$, and $I_s$, leading to the minimization problem \begin{eqnarray} \label{eqn:minimization_problem} \overline{\bm{u}} = \argmin_{\bm{u}} \langle F_n(\bm{x}(\bm{u}),\bm{u}) \rangle. \end{eqnarray} Similarly to Troeltzsch et al.\ and Casas et al.\ \cite{casas2013sparse, troltzsch2010optimal, buchholz2013optimal}, we analyze the gradient $g=\bm{\nabla_u} F$ of the cost functional, which has to vanish when evaluated at the optimal control $\overline{\bm{u}}$. By applying the method of Lagrange multipliers, we obtain an expression for the optimality condition that depends on the adjoint states $\bm{\phi}(\bm{x},{\bm{u}},t)$ corresponding to the Lagrange multipliers. The control $\overline{\bm{u}}$ is optimal, if \begin{eqnarray} \label{eqn:zerogradient} \resizebox{0.85\hsize}{!}{% $\bm{g}(t)= (\bm{B} \otimes \bm{K})^T \langle \bm{\phi}(\bm{x},\overline{\bm{u}},t) \rangle + I_e \overline{\bm{u}}(t) + I_s \overline{\bm{\lambda}}(t) \overset{!}{=} \bm{0} } \end{eqnarray} for $0\leq t \le T$, where $\overline{\lambda}(t)$ is the derivative of the sparsity term, Eq.~\eqref{eqn:cost_functional_f_u}, with respect to the control inputs $\bm{u}$. The adjoint states are governed by a set of linear differential equations: \begin{eqnarray} \label{eqn:adjoint_state} \resizebox{0.85\hsize}{!}{% $-\cgreen{\frac{d }{d t}}\bm{\phi}(t)= \big[ D_{\bm{x}}(\bm{h}) + \sigma (\bm{A} \otimes \bm{G}) \big]^T \bm{\phi}(t) + \bm{\nabla_x} f^x_n(\bm{x},t), } \end{eqnarray} where $D_{\bm{x}}(\bm{h})$ is the Jacobian matrix of the state equations of the dynamical syste , and $f^x_n(\bm{x})$ is the integrand of the cost functional, $F^x_n(\bm{x})=\int_0^T f^x_n(\bm{x}) dt$. The adjoint state satisfies the boundary condition $\bm{\phi}(T)=\bm{0}$, and the differential equation is solved backwards in time. Following Ref.~\cite{casas2017analysis}, $\overline{\lambda}(t)$ is given by \begin{equation} \label{eqn:lambda} \overline{\lambda_k}(t) = \begin{cases} \frac{\overline{\bm{u}}_k(t)}{\sqrt{E_k}} & \text{if $E_k \neq 0$}, \\ -\frac{1}{I_s} \big[(\bm{B} \otimes \bm{K})^T \langle \bm{\phi}(\bm{x},\overline{\bm{u}},t) \rangle \big]_k & \text{otherwise}. \end{cases} \end{equation} Here, $k \in [1,N]$, and $E_k$ is the nodewise control energy of the resulting optimal control $\overline{\bm{u}}$, which is defined as \begin{eqnarray} \label{eqn:control_energy} E_k=\int_0^T \overline{\bm{u}}_k^2(t) dt, \end{eqnarray} resulting in the total control energy $E = \sum_{k} E_k$. A detailed derivation of Eqs. \eqref{eqn:zerogradient} and \eqref{eqn:adjoint_state} is provided in Appendix~\ref{sec:appendixMath}. \subsection{Numerical solution of the minimization problem} \label{sec:min_problem} The optimization problem is numerically solved using the conjugate gradient method. We integrate the equations for the network state and the adjoint given in Eqs.~\eqref{eqn:network_system} and~\eqref{eqn:adjoint_state} \cgreen{(see Appendix~\ref{sec:appendixNumerics} for details)}. The direction \cgreen{$\bm{d}_l$} for each step of the conjugate gradient algorithm is defined by the Polak-Ribiere method~\cite{polak1969note}, while its step size \cgreen{$s_l$} is derived using simple bisection \cite{nocedal2006numerical}. We apply the Fletcher and Reeves algorithm~\cite{fletcher1964function} as presented in the following. We initialize at iteration \cgreen{$l=0$} by choosing an initial control $\bm{u}_0$ and drawing $20$ noise realizations $\bm{\xi}_n(t)$. The corresponding states $\bm{x}_{0}(t)$, Eq.~\eqref{eqn:network_system}, and adjoint states $\bm{\phi}_{0}(t)$, Eq.~\eqref{eqn:adjoint_state}, are calculated for every noise realization. Then $\bm{g}(t)$ as given in Eq.~\eqref{eqn:zerogradient} is evaluated. The descent direction is initialized with $\bm{d}_0(t) =-\bm{g}(t)$. We then iterate until convergence: \begin{itemize} \item[] while $\norm{\bm{g}(t)}_{\infty} > \epsilon$: \begin{enumerate} \item compute the step size $s_l$ using bisection \item set $\bm{u}_{l+1}(t)= \bm{u}_l(t) + s_l \bm{d}_l(t)$ \item calculate the states $\bm{x}_{l+1}(t)$ and the adjoint states $\bm{\phi}_{l+1}(t)$ for every noise realization and compute the mean $\langle \bm{\phi}_{l+1}(t) \rangle$ \item evaluate the gradient $\bm{g}_{l+1}(t)$ \item compute $\beta_l$ using the Polak-Ribiere method: $\beta_l=\frac{\bm{g}_{l+1}(\bm{g}_{l+1}-\bm{g}_{l})}{\norm{\bm{g}_{l+1}}^2}$ \item set the direction $\bm{d}_{l+1}(t)= - \bm{g}_{l+1} (t)+ \beta_l \bm{d}_l(t)$ \item if $\bm{d}_{l+1}(t)$ is not a descent direction, set $\bm{d}_{l+1}(t)= - \bm{g}_{l+1}(t) $ \item set $l=l+1$\\ \end{enumerate} \end{itemize} \cgreen{Gradient-based optimization is only guaranteed to converge to local optima of the cost function. In general, however, multiple initial conditions $\bm{u}_0$ converged to the same optimum. The only exception occurred for the state-switching task for high values of the sparseness parameter $I_s$, for which a solution with finite values of $\bm{u}$ coexists with the solution $\bm{u}(t)=0$ (see Appendix \ref{sec:appendixNumerics} for details).} \section{The whole-brain network} \label{sec:State_space} \subsection{\cgreen{The local node dynamics}} \label{sec:population_dynamics} \begin{figure} \centering \includegraphics[width=0.45\textwidth]{bifurcation_new.png} \caption{Bifurcation diagram of an uncoupled FitzHugh-Nagumo oscillator, as given in Eq.~\eqref{eqn:FHN}, with the parameters $\alpha=3$, $\beta=4$, $\gamma=1.5$, $\delta=0.5$, and $\tau=20$. The blue line shows the minimal and maximal values of the activity variable $x_1$ (identical in fixed points) for the respective background input $\mu$ to the node. The red line shows the frequency of the oscillation (time and therefore also frequency are measured in arbitrary units).} \label{fig:sgl_bifur_diag} \end{figure} We consider a single FitzHugh-Nagumo (FHN) oscillator, with the activity variable $x_1$ and the linear recovery variable $x_{2}$: \begin{align} \label{eqn:FHN} \bm{h}(\bm{x})= \begin{pmatrix}h_{1}(\bm{x})\\h_{2}(\bm{x})\end{pmatrix} = \begin{pmatrix}\cgreen{\frac{d}{d t}}x_{1}\\\cgreen{\frac{d}{d t}}x_{2}\end{pmatrix}= \begin{pmatrix} R(x_{1}) - x_{2} + \mu \\\frac{1}{\tau} (x_{1} - \delta x_{2})\end{pmatrix}, \end{align} where $\mu$ is a node-independent, constant background input and $R(x)=- \alpha x^3 + \beta x^2 - \gamma x$. The parameters in $R$ are chosen to obtain the bifurcation diagram shown in Fig.~\ref{fig:sgl_bifur_diag}. This bifurcation diagram, depending on the background input $\mu$, shows three distinct states. In the down state, the node is in a stable fixed point and has a low constant value of the activity variable $x_1$ (in blue). In the oscillatory state, the activity variable $x_1$ oscillates at an input-dependent frequency (in red). In the up state, the node is again in a stable fixed point with a high constant value of the activity variable $x_1$. The succession of these states in the single node dynamics -- a supercritical Andronov-Hopf bifurcation from the down state to the oscillatory state and another supercritical Andronov-Hopf bifurcation from the oscillatory state to the up state \cite{kostova2004fitzhugh, izhikevich2007dynamical} -- \cgreen{closely} resembles the states found in large random networks of excitatory and inhibitory spiking neuron models and their corresponding mean-field description \cite{cakan2019}. \cgreen{The mean firing rate of these models changes as a function of background input in a way which is qualitatively similar to the value of the activity variable shown in Fig.~\ref{fig:sgl_bifur_diag}. For this reason one can interpret the value of the activity variable $x_1$ as the difference between the output firing rate of a cortical node to a baseline value.} \subsection{The brain network model} \begin{figure} \centering \includegraphics[width=0.325\textwidth]{SC.png} \caption{Weighted adjacency matrix $\bm{A}$ describing the topology of the whole-brain network. Color denotes the relative connection strength of the structural connectivity for every pair of the $N=94$ nodes.} \label{fig:Adjacency_matrix} \end{figure} The topology of the whole-brain network model is derived from diffusion tensor imaging (DTI) data of 12 human subjects (all male and 26-30 years old) from the Human Connectome Project \cite{van2013hcp} (see \cgreen{Appendix~\ref{sec:appendixDTI}} for subject IDs). The $N=94$ nodes in the network correspond to the cortical and subcortical regions defined by the AAL2 atlas-based segmentation \cite{rolls2015aal2} (cerebellum excluded). We performed probabilistic fiber tracking (using \cgreen{the Functional Magnetic Resonance Imaging of the Brain Software Library (FSL)} \cite{jenkinson2012fsl}, details on the processing pipeline \cgreen{in Appendix~\ref{sec:appendixDTI}}) to determine the relative connection strength (edges) between these brain regions (nodes). The pairwise structural connectivity is summarized in the weighted adjacency matrix~$\bm{A}$ shown in Fig.~\ref{fig:Adjacency_matrix}. \cgreen{Since DTI data carries no directional information, $\bm{A}$ must be symmetric. For the following, we define the weighted degree $d_k$ of a node $k$ as the sum over all afferent connection strengths, i.e.\ $d_k = \sum_{i=1}^{N}\bm{A}_{ik}$.} As motivated in Section \ref{sec:population_dynamics}, the dynamics of each node in the network is described by a FHN oscillator [Eq.~\eqref{eqn:FHN}]. The general network dynamics, Eq.~\eqref{eqn:network_system}, then simplifies to \begin{eqnarray} \label{eqn:network_simple} \begin{aligned} \frac{d }{d t}{x_{k1}}(t) &= {h_1}(\bm{x}_k(t) ) + \sigma \sum_{i=1}^N \bm{A}_{ki} x_{i1} (t) + \xi_k(t) +{u}_k(t), \\ \frac{d }{d t}{x_{k2}}(t) &= {h_2}(\bm{x}_k(t) ), \end{aligned} \end{eqnarray} for all nodes $k\in [1,N]$. This implies setting the control matrix $\bm{B}=\bm{I_N} $, which means that all individual nodes can potentially receive independent control inputs. The local coupling, control, and noise schemes are set to $\bm{G}=\bm{K}=\bm{D}=[[1,0],[0,0]]$\cgreen{, i.e.\ the indvidual FHN nodes receive node-external inputs only through their activity variables $x_{k1}$}. \cgreen{We do not consider finite delays for reasons of simplicity. Finite delays induce additional dynamical states. Although of high interest in terms of whole-brain modeling, these would not add to the conclusions drawn in Sections \ref{sec:applications} and \ref{sec:linear_vs_nonlinear} about the impact of non-linear optimal control and its comparison with diagnostics \cite{gu2015controllability} derived from linear control and based on connectome properties only. Please refer to Section~\ref{sec:summary} for a discussion of the biological plausibility of this assumption.} \subsection{State space exploration} In this section, we describe and characterize the different dynamical states that can emerge in a whole-brain network of coupled FHN oscillators for a large range of parameter configurations. Having such an overview of the dynamical landscape of the system will allow us to formulate well defined control tasks in Section~\ref{sec:applications}. Throughout the state space exploration we do not apply any control input [${u}_k(t) = 0 \,\, \forall \,k, t$]. Initially we consider the noise free case ($\eta = 0$). Here, only two free model parameters remain: the global coupling strength $\sigma$ and the time independent background input $\mu$ which is the same for each FHN oscillator. The state space of the FHN network is explored by simulating the network dynamics for wide ranges of these parameters \cgreen{(see Appendix~\ref{sec:appendixNumerics} for details)}. The initial conditions $\bm{x_0}$ are drawn randomly from a uniform distribution in the interval $\mathopen[0,1\mathclose)$ or taken as the state vector $\bm{x'}(t_{end})$ of the last time step of the previous simulation with same $\sigma$ and slightly smaller $\mu$ (\textit{continuation}). In order to avoid analyzing transient effects, we show and evaluate the network states only after a sufficiently long transient time~$\bar{t}$. If oscillations are present, the dynamical state is characterized by the strength of synchronization quantified by the total cross-correlation, Eq.~\eqref{eqn:nw_cross_correlation}, and by the dominant frequency $f_{dom}$. The latter is given by the frequency of the highest peak of the combined power spectrum of all nodes, \begin{align} \label{eqn:dom_freq} f_{dom} = \argmax_{f} \sum_{i=1}^{N} S_{xx,i1}(f), \end{align} where $S_{xx,i1}=\left| (\mathcal{F}x_{i1})(f)\right|^{2},$ with Fourier transform $\mathcal{F}$, denotes the power spectral density of an individual node. \begin{figure*} \centering \includegraphics[width=\textwidth]{state_space_overview_bifur2.png} \caption{Overview of the state space of the brain network model, Eqs.~\eqref{eqn:FHN} and \eqref{eqn:network_simple}, for the noise free case ($\eta = 0$). Time $t$ measured in arb.\ units and simulations of each parameter configuration are started with initial conditions $\bm{x_0}$ based on continuation and evaluated [except for (c1) and (c8)] after $\bar{t}=5000$ (see text for details). (a) Each pixel corresponds to a network with a particular parameter configuration for $\mu \in [0.35,1.4]$ and $\sigma \in [0,0.3]$. States are classified based on the network oscillations, and oscillatory states are distinguished depending on whether no (laLC, light gray), some (mixLC, dark gray), or all (haLC, white) nodes fulfill the criterion of Eq.~\eqref{eqn:LC_crit}. Parameter configurations for which multiple stable solutions were detected (see text for details) and visually confirmed are marked with red pixels. Red lines enclose regions where we observe bistability between FP and mixLC (around point A1), laLC and mixLC (around points A2, B2), and mixLC and haLC (around point B1), as well as multistability in mixLC (around points A3, B3). Examples for bi- and multistable states are shown in Fig.~\ref{fig:State_space_traces}. Points S1 and S2 indicate states with a low mean network cross-correlation $R$ that are explored in Section~\ref{sec:synchronize}. (b) One dimensional bifurcation diagram for a network as a function of $\mu$ for a fixed coupling strength of $\sigma = 0.08$. The dominant network frequency (red line) is calculated according to Eq.~\eqref{eqn:dom_freq}. Minimal and maximal values of the activity variable $x_{k1}$ are plotted for each node individually, where line color indicates the weighted degree (green to blue indicates high to low values). (c) Example traces of the activity of all nodes in the network for different values of $\mu$ [see (b)] and for $\sigma=0.08$, showing different dynamical states. Line color indicates the weighted degree of the nodes [see (b)]. Traces at the FPs (1, 8) are shown after $\bar{t}=0$ (see text for details) to show the stability of the respective fixed point.} \label{fig:State_space_overview} \end{figure*} Figure \ref{fig:State_space_overview} provides an overview of the state space of the FHN network. Similar to the case of a single FHN oscillator (cf.\ Fig.~\ref{fig:sgl_bifur_diag}), the network shows two regions in parameter space, for which a stable fixed point (FP) exists. For small values of $\mu$ and $\sigma$ the activity variable $x_{k1}$ has a low value for all nodes [\textit{down state}, cf.\ Fig.~\ref{fig:State_space_overview}c(1)]; for large values of $\mu$ and $\sigma$ the activity value is high [\textit{up state}, cf.\ Fig.~\ref{fig:State_space_overview}c(8)]. Figure~\ref{fig:State_space_overview}a shows that the dynamics can transition from an down state to an oscillatory state, as well as from an oscillatory state to an up state by either increasing $\mu$ or $\sigma$. For convenience, we call these transitions \textit{low} and \textit{high bifurcation}, respectively. Within the oscillatory regime, we observe network states that are qualitatively different in their appearance, which we explain in the following by their different underlying mechanisms. A single, uncoupled FHN node oscillates in its limit cycle (LC) if it receives a background input in the range of $\mu \in [0.73,1.33]$ (cf.\ Fig.~\ref{fig:sgl_bifur_diag}). We therefore expect a node in the network to show sustained oscillation (indiv.\ LC) -- and consequently affecting the dynamics of the network -- if its combined input is in this interval. We thus call a node ``to be in its individual LC regime'' if \begin{align} \label{eqn:LC_crit} 0.73 \lesssim \mu + \sigma \sum_{i=1}^N \bm{A}_{ki} x_{i1} (t)\lesssim 1.33, \end{align} for at least one point in time within the considered time interval. This criterion is further motivated by observations of the dynamics (cf.\ Fig.~S1 in \cgreen{\cite{supp}}) which show qualitative changes in behavior depending on whether it is met by all, some, or none of the nodes in the network. If all nodes fulfill Eq.~\eqref{eqn:LC_crit}, we observe the network to be in a synchronous, high amplitude limit cycle [haLC in Fig.~\ref{fig:State_space_overview}a, cf.\ Fig.~\ref{fig:State_space_overview}c(5)]. If, however, no node fulfills Eq.~\eqref{eqn:LC_crit}, the network either inherits the fixed point solution from the individual nodes, or a new state emerges due to network effects. We observe both cases: The first one is true in both down and up state of the network in Fig.~\ref{fig:State_space_overview}a. The second case appears for low and intermediate coupling strength $\sigma$ at the transition from down or up state to oscillatory state. In these states the FP of the network dynamics is unstable due to coupling effects and a self-sustained low amplitude limit cycle [laLC in Fig.~\ref{fig:State_space_overview}a, cf.\ Fig.~\ref{fig:State_space_overview}c(2,7)] emerges. The geometric interpretation of this laLC is a rotation around the FP that would be transient for an isolated node, but is prevented from converging to a fixed-point by the network couplings. It is also possible that only a fraction of the network nodes fulfill the criterion in Eq.~\eqref{eqn:LC_crit}, which can lead -- even in the absence of noise and without network delays -- to asynchronous and apparent aperiodic behavior [mixLC in Fig.~\ref{fig:State_space_overview}a, cf.\ Fig.~\ref{fig:State_space_overview}c(3,6), further indications for aperiodicity are provided in \cgreen{\cite{supp}}]. On the network level, this can be seen as the result of the different frequencies of the two coexisting network limit cycles, laLC and haLC, interacting. Close to the bifurcation the frequency of the individual nodes (cf.\ Fig.~\ref{fig:sgl_bifur_diag}), and their trajectories (cf.\ Fig.~S3 in \cgreen{\cite{supp}}), are particularly sensitive to their respective input. If the additive coupling input between the nodes is not sufficient to entrain a common frequency, this may result in asynchronous and potentially aperiodic network oscillations. States that are classified as mixLC are, however, not necessarily asynchronous. If the driving force of nodes that fulfill the criterion in Eq.~\eqref{eqn:LC_crit} is high enough, it will lead to frequency entrainment. Therefore, the oscillations of the driven nodes [where Eq.~\eqref{eqn:LC_crit} is not fulfilled] are similar to the ones of the driver nodes, resulting in dynamics that are similar to the haLC state [cf.\ Fig.~\ref{fig:State_space_overview}c(4,5)]. \begin{figure*} \centering \includegraphics[width=\textwidth]{state_space_multistab-traces2.png} \caption{Example traces of the activity variable $x_{k1}$ of each node from the regions of bi- and multistability indicated by the labeled points in Fig.~\ref{fig:State_space_overview}a. Plots show the dynamics for random initial conditions after a sufficiently long transient time ($\bar{t}=5000$ arb.\ units). Line color indicates the weighted degree (green to blue indicates high to low values). (a) Traces at low bifurcation, top: bistability between laLC (left) and mixLC (right) in point A2 ($\mu=0.44, \sigma=0.17, \eta=0$); bottom: bistability between states in mixLC in point A3 ($\mu=0.64, \sigma=0.07, \eta=0$). (b) Traces at high bifurcation, top: bistability between mixLC (left) and haLC (right) in point B1 ($\mu=1.2, \sigma=0.29, \eta=0$); bottom: multistability between states in mixLC in point B3 ($\mu=1.28, \sigma=0.17, \eta=0$). The main difference between left and middle panels is the trajectory of the node with the smallest in-degree (highlighted in red). (c) Traces showing noise induced state switching. Locations N1 and N2 are also close to the bifurcations but are not shown in Fig.~\ref{fig:State_space_overview}a since the state space changes under the influence of noise. Top: Example at the low bifurcation in point N1 ($\mu=0.39, \sigma=0.2, \eta=0.024$). Bottom: Example at the high bifurcation in point N2 ($\mu=1.2, \sigma=0.3, \eta=0.024$). } \label{fig:State_space_traces} \end{figure*} The distinction between different dynamical states and types of network oscillations (laLC, mixLC, haLC) is particularly interesting since the transitions between these are the regions in state space, where we find multistable network states. Multistability is detected by simulating the network dynamics for 21 different initial conditions $\bm{x_0}$ and comparing the resulting time series by calculating their node-wise correlation in the activity variable. We ignore the first $\bar{t}=5000$ arb.\ units of each time series to avoid analyzing transient effects and then compare the interval $t\in[5000, 6000]$ (equiv.\ to 10--35 periods) of one initial condition with $t\in[5000, 6200]$ of all other traces (second interval is sufficiently longer to account for all phase shifts). If the auto-correlation of at least one initial condition is close to one, this indicates the existence of a stable (periodic) state, and if the cross-correlation between two (or more) initial conditions is different from one, this indicates bi-(or multi-)stability. Red pixels in Fig.~\ref{fig:State_space_overview}a show states with more than one stable solution, which are observed along both, the low and high bifurcation. Numerically we found regions of bistability between FP and mixLC (A1), laLC and mixLC (A2, B2), and mixLC and haLC (B1), as well as multistability in mixLC with different numbers of nodes fulfilling the criterion in Eq.~\eqref{eqn:LC_crit} (A3, B3) (cf.\ Fig.~\ref{fig:State_space_overview}a). The corresponding time series of the activity variables $x_{k1}$ are shown in Fig.~\ref{fig:State_space_traces}. The automatic detection of multistability might not capture all multistable states, especially because some of the states may be very similar (cf.\ Fig.~\ref{fig:State_space_traces}b, bottom panel). More detailed analyses could thus also uncover bistabilities between up state and mixLC, as well as between mixLC and haLC at the low bifurcation. We inspected the detected multistable states visually to assure that their difference are not due to transient effects and confirm their assignment to the specified multistable regions in Fig.~\ref{fig:State_space_overview}a. \cgreen{We do not observe state switches in this noise-free case even for very long simulation times ($200,000$ arb.\ units simulated for multiple initial conditions in each multistable region, A1--3, B1--3, of Fig.~\ref{fig:State_space_overview}a), meaning that the states are stable and no temporal intermittency is found.} Adding noise to the network most strongly affects the dynamics of the states close to the bifurcations. The influence of noise on synchronous, mono-stable oscillatory states is, as expected, comparably small (cf.\ Figs.~S4d,~e in \cgreen{\cite{supp}}). If the network dynamics is in a FP far away from the bifurcation line, the additional Gaussian white noise results in uncorrelated fluctuations in the activity variable (cf.\ Fig.~S4i in \cgreen{\cite{supp}}). Parametrizations that without noise would lead to a stable FP close to the bifurcation, show oscillations when sufficient noise is introduced (cf.\ Figs.~S4a,~h in \cgreen{\cite{supp}}). The clear distinction between the FP and laLC network states in the noise-free case (cf.\ Fig.~\ref{fig:State_space_overview}a) is therefore blurred for noisy dynamics. For asynchronous mixLC states, the additional noise can have a synchronizing effect (cf.\ Fig.~S4c in \cgreen{\cite{supp}}). This can be explained by more nodes fulfilling the criterion in Eq.~\eqref{eqn:LC_crit}, resulting in a stronger drive for the remaining nodes and therefore more synchronous oscillation. These effects lead to a shift of the bifurcation lines compared to the noise-free case and consequently also affects the location of multistable network states. In the case of multistability, we observe that this stochastic additional input can lead to sufficient perturbations that drive the dynamics from one attractor to the other. This results in noise-induced state switching, as shown in Fig.~\ref{fig:State_space_traces}c, at the bifurcation lines of the noisy state space. Such noise-induced transitions are a known phenomenon in systems of coupled oscillators \cite{horsthemke1984noise} and may be exploited for the control of the neural dynamics in practice \cite{schmidt2013micha}. \section{Optimal control of the brain network dynamics} \label{sec:applications} \subsection{Switching between bistable network states} \label{sec:state_switching} In this section, we present optimal control inputs that induce a switch between previously identified multistable states. All control inputs optimize the cost functional given in Eq.~\eqref{eqn:cost_functional_general} with the state dependent terms given in Eq.~\eqref{eqn:cost_functional_f_x1} and the energy and sparsity terms given in Eq.~\eqref{eqn:cost_functional_f_u}. Energy and sparsity terms are evaluated over the whole time interval during which the control is active. The cost functional itself, however, considers the deviation from the target state only the end of the control period. For this we set $I_p(t)=I_p^*$ for $(T - \tau) \leq t \leq T$ and $I_p=0$ else. The convergence criterion of the numerical solution of the minimization problem, as described in Section \ref{sec:min_problem}, is set to $\epsilon = 10^{-5}$ for all our applications. We ensured for all presented examples that the method actually converges and that results do not change for lower values for $\epsilon$. We computed the optimal control for different phase shifts of the initial and target states with respect to the control onset and present the results for the phase shift which leads to the smallest total control energy $E$. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig5.png} \caption{State switching with optimal control between bistable states at the low bifurcation (point A1 in Fig.~\ref{fig:State_space_overview}a). (a) Switch from down-state to oscillatory state and (b) vice versa. Activities $x_{k1}$ of each node $k$ are shown over time. The colored lines show the controlled activities with \cgreen{green to blue indicating nodes with high to low weighted degree}. The \cgreen{ black} lines correspond to the uncontrolled activities. (c, d) Corresponding optimal control inputs $\overline{u}_{k1}$ to each node. The red \cgreen{bar indicates the time} interval during which the control is active (from $t=0$ to $t=400$). The deviation from the target state is penalized in the last $\tau=25$ time units of the control. Parameters were: $\mu=0.378$, $\sigma=0.21$, $\eta=0.0$, $I_p^*=0.0005$, $I_e=1.0 , $I_s=0$.} \label{fig:state_switching_fig1} \end{figure} Figure~\ref{fig:state_switching_fig1} shows the result of applying optimal control at point A1 in Fig.~\ref{fig:State_space_overview}a, where a low activity fixed point coexists with an oscillatory mixed state. The weight $I_s$ for the sparseness term in Eq.~\eqref{eqn:cost_functional_f_u} was set to zero. Since the target state in this task is always stable, the network remains in this state once it is reached also after the control is turned off. If the initial state is the down state FP, the obtained optimal control input oscillates synchronously for all nodes with increasing amplitude. The frequency of the control input [$f_{dom}(\overline{u}_1)=35.0$] corresponds to the frequency of the fixed point's focus [$f_{dom}(x^{FP}_1)=35.0$, measured by perturbing the FP], inducing resonance effects in the node activity. This strategy can be well observed in Video~1 (in \cgreen{\cite{supp}}), showing the node oscillations and the respective optimal control inputs in state space. When switching from the oscillatory to the down-state, as in Fig.~\ref{fig:state_switching_fig1}d, the optimal control input consists of one short biphasic pulse applied to all of the nodes followed by minor corrections. It is a known result from control theory, that applying a biphasic control pulse around an extreme point is an efficient way to drive an oscillating system to a stop. Interestingly, the optimal control strategy in this example is not to apply the pulse at an extreme point of the activity variables $x_{k1}$, but rather in a way that the gradient of the control is highest when the phase velocity of the limit cycle oscillation is the lowest (best observed in Video~2 in \cgreen{\cite{supp}}). Although the deviation from the target state is only penalized at the end of the control interval, the pulse is applied early in order to give the system enough time to come to rest. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig6.png} \caption{State switching with optimal control between bistable states at the high bifurcation (point B2 in Fig.~\ref{fig:State_space_overview}a). (a) Switch from low-amplitude oscillation to high-amplitude oscillation and (b) vice versa. Activities $x_{k1}$ of each node $k$ are shown over time. The colored lines show the controlled activities with \cgreen{green to blue indicating nodes with high to low weighted degree}. The \cgreen{ black} lines correspond to the uncontrolled activities. (c, d) Corresponding optimal control inputs $\overline{u}_{k1}$ to each node. The red \cgreen{bar indicates the time} interval during which the control is active (from $t=0$ to $t=400$). The deviation from the target state is penalized in the last $\tau=25$ time units of the control. Parameters were $\mu=1.22$, $\sigma=0.26$, $\eta=0.0$, $I_p^*=7\times 10^{-5}$, $I_e=1.0 , $I_s=0$.} \label{fig:state_switching_fig2} \end{figure} Figure~\ref{fig:state_switching_fig2} shows the result of applying optimal control at point B1 in Fig.~\ref{fig:State_space_overview}a, where a low amplitude limit cycle (laLC) around the high activity up-state coexists with an oscillatory mixed state (mixLC, cf.\ Section \ref{sec:State_space}). When switching from the laLC to the mixLC state (Figs.~\ref{fig:state_switching_fig2}a, c), the frequency of the control input [$f_{dom}(\overline{u}_1)=30.0$] is again adapted to the frequency of the initial state [$f_{dom}(x^{laLC}_1)=30.0$], utilizing resonance effects. While the nodes in the laLC state all oscillate with the same frequency ($f_k=f_{dom}=30.0 \ \forall \ k$), their phase speed is not the same at all times [reflected by lower synchrony $R(x^{laLC}_1)=0.861$, best observed in Video~3 in \cgreen{\cite{supp}}]. This results in a less synchronous oscillation of the control signals in Fig.~\ref{fig:state_switching_fig2}c ($R(\overline{u}_1)=0.714$) compared to the control inputs at the low bifurcation [Fig.~\ref{fig:state_switching_fig1}c, $R(\overline{u}_1)=0.999$]. In the other direction (Figs.~\ref{fig:state_switching_fig2}b,~d, Video~4 in \cgreen{\cite{supp}}), the optimal control finds a short, off-phase biphasic pulse analogous to Fig.~\ref{fig:state_switching_fig1}d. As a result, the amplitude of the network oscillation decreases to almost zero (for $t\in [200,250]$ in Fig.~\ref{fig:state_switching_fig2}b). Since there is no stable FP, the oscillation amplitude increases again over time and converges to the laLC target state approx.\ 550 time units after the control pulse (see also Fig.~S5 in \cgreen{\cite{supp}}). \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig7.png} \caption{State switching with sparse optimal control. The nodes are sorted from lowest (bottom) to highest (top) weighted degree. The length of the bars indicate up to which value of the spatial sparsity parameter $I_s$ the node still receives finite control input. Their color denote the corresponding optimal control energies $E_k$ [Eq.~\eqref{eqn:control_energy}] for each node. (a) Switching from the down state (FP) to the oscillatory state (mixLC) with parameters close to the low bifurcation as in Fig.~\ref{fig:state_switching_fig1} and (b) Switching from low-amplitude (laLC) to high-amplitude oscillatory state (mixLC) with parameters close to the high bifurcation as in Fig.~\ref{fig:state_switching_fig2}. (c) Same as (a) but switching from mixLC to FP. (d) Same as (b) but switching from mixLC to laLC. } \label{fig:state_switching_fig3} \end{figure} By increasing the sparsity parameter $I_s$ of the cost functional, we can tune the number of controlled nodes. Figure~\ref{fig:state_switching_fig3} shows the control energy $E_k$ [Eq.~\eqref{eqn:control_energy}] of the optimal control input $\overline{u}_{k1}$ to each node $k$ as a function of the sparsity parameter $I_s$. For low values of $I_s$, all nodes receive a finite control signal. When $I_s$ is increased, less nodes are controlled, until $I_s$ becomes so large, that the target state can no longer be reached. As expected, decreasing the number of controlled nodes needs to be compensated for with a higher control energy. The results also show that at the low bifurcation (Figs.~\ref{fig:state_switching_fig3}a,~c), nodes with a high weighted degree receive, independent of the switching direction, a stronger control signal and remain controlled even for high values of $I_s$. This shows that at the low bifurcation it is most important to control the network hubs since they act as driver nodes for attractor switching. At the high bifurcation (Figs.~\ref{fig:state_switching_fig3}b,~d), on the other hand, nodes with low weighted degree receive the strongest control inputs. This different behavior can be explained based on the additive coupling scheme between the nodes (cf.\ Section~\ref{sec:State_space}), which causes nodes with higher degree to typically receive stronger inputs. When choosing parameters close to the low bifurcation, these high degree nodes therefore have higher oscillation amplitudes (cf.\ Fig.~\ref{fig:sgl_bifur_diag}) and are consequently driving the oscillation of the remaining nodes in the network. Close to the high bifurcation the nodes with lower degree, who receive less inputs, are more likely to remain in the limit cycle regime. Consequently -- and in contrast to the dynamics close to the low bifurcation -- the low degree nodes drive the oscillation of the network hubs. Videos 1 and 3 (in \cgreen{\cite{supp}}) illustrate how the control inputs on the respective driver nodes force the network dynamics to the high-amplitude oscillation target states. The optimal control inputs to the control sites have well interpretable shapes. When the objective is to transition from a low-amplitude state to one with a higher amplitude (mixLC, Figs.~\ref{fig:state_switching_fig1}a and~\ref{fig:state_switching_fig2}a), the optimal control strategy utilizes the characteristics of the flow field in state space and synchronously drives the network with its resonant frequency from one attractor towards the other. Switching in the opposite direction, and therefore leaving this basin of attraction, is achieved most efficiently with one strong, biphasic pulse. This deflects the system from its initial mixLC trajectory and causes it to drop to the attractor with a lower amplitude. \subsection{Synchronizing the network dynamics} \label{sec:synchronize} In this section, we apply the nonlinear control method to find the optimal inputs to synchronize the dynamics of the individual nodes. For this application we use the state dependent cost functionals given in Eq.~\eqref{eqn:cost_functional_f_x2} to penalize the deviation from the target cross correlation ($R_T=1$, fully synchronous state) and in Eq.~\eqref{eqn:cost_functional_f_u} to penalize the energy of the control and enforce its sparsity in space. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig8_inset.png} \caption{ Synchronizing the noise-free network with optimal control inputs. (a) Synchronization task at point S1 (low bifurcation) in Fig.~\ref{fig:State_space_overview}a. Activities $x_{k1}$ of each node $k$ are shown over time. The colored lines show the controlled activities (average cross-correlation $R = 0.995$ [Eq.~\eqref{eqn:nw_cross_correlation}]) with \cgreen{green to blue indicating nodes with high to low weighted degree}. The \cgreen{ black} lines show the uncontrolled activities ($R = 0.289$). (b) Synchronization task at point S2 (high bifurcation) in Fig.~\ref{fig:State_space_overview}a (controlled: $R = 0.996$, uncontrolled: $R = 0.368$). (c, d) Corresponding optimal control input $\overline{u}_{k1}$ to each node. The red \cgreen{bar indicates the time} interval during which the control is active (from $t=0$ to $t=500$). The vertical black dashed line indicates the critical time $t_c$ (see text). Parameters were: Point S1 $\mu=0.7$ and $\sigma=0.025$, point S2 $\mu=1.3$ and $\sigma=0.025$, other parameters: $\eta=0$, $I_p=0.1$, $I_e=1.0 , $I_s=0$. } \label{fig:synchronize_trace} \end{figure} We parameterize the system to be in the two asynchronous regions marked by the labels S1 and S2 in Fig.~\ref{fig:State_space_overview}a, close to the low and high bifurcation lines. The optimal control method is then applied to synchronize the dynamics for the noise-free (Fig.~\ref{fig:synchronize_trace}) and noisy (Fig.~\ref{fig:synchronize_trace-noise}) case. Both figures show the controlled (synchronous) and uncontrolled (asynchronous) time series and the corresponding optimal control inputs. Since the dynamics in points S1 and S2 are monostable, the synchronous state is not a stable solution and the system returns to its original state as soon as the control is switched off. The network dynamics and the optimal control strategies are best seen in Videos 5-8 (in \cgreen{\cite{supp}}). Figure~\ref{fig:synchronize_trace} shows how the optimal control inputs synchronize the oscillation of all nodes in the network. In the uncontrolled state (in gray, Figs.~\ref{fig:synchronize_trace}a, b) the nodes at both bifurcations oscillate with similar frequencies (mean and standard deviation of oscillation frequencies across nodes at S1: $\langle f\rangle_N = 32.2, \, \sigma_{ \langle f\rangle_N}=1.1,$ and at S2: $\langle f\rangle_N = 27.0, \, \sigma_{ \langle f\rangle_N}=0.9$). Close inspection of the control inputs in Figs.~\ref{fig:synchronize_trace}c and d shows that the optimal control acts in two phases. First, the control aligns the phases of all oscillators until all nodes are synchronized for the first time, which we defined as the critical time $t_c$ (\cgreen{please refer to} \cgreen{\cite{supp}} for details about the computation of $t_c$). Second, a periodic input maintains the synchronous oscillation during the period the control is active. For times $t<t_c$, Fig.~\ref{fig:synchronize_energy}a shows that at the low bifurcation the energies $E_k$ of the control inputs to the nodes are positively correlated with the weighted node degrees. Thus, it is beneficial to focus the control input on the network hubs for alignment. A possible interpretation for this strategy is that the optimal control utilizes the influence of the network hubs on the remaining nodes to force them on the synchronous limit cycle trajectory. However, we again observe a different behavior at the high bifurcation, as shown in Fig.~\ref{fig:synchronize_energy}b. Here, $E_k$ is negatively correlated with the weighted node degree for times $t<t_c$. In this case, the network coupling is much smaller compared to the background input~$\mu$ and the node's phase space oscillations are similar to the trajectory of the limit cycle of an uncoupled node (cf.\ Video~6 in \cgreen{\cite{supp}}). The negative correlation in Fig.~\ref{fig:synchronize_energy}b suggests that if the dynamics of the nodes are similar in the first place, it is beneficial to focus the control on more weakly coupled nodes and align their phase space trajectory with the trajectory of the network hubs. Similar to the attractor switching at the high bifurcation (cf.\ Figs.~\ref{fig:state_switching_fig3}b,~d), the control of the low degree nodes drives the network oscillation towards the target state. In the second phase, for $t\geq t_c$, the high degree nodes without control would have a higher (or lower) phase velocity than the nodes with intermediate degree, while the opposite is true for nodes with low degree. The optimal control strategy is thus to act on the low and high degree nodes in opposite directions, which can be observed as antiphase control inputs shown in Figs.~\ref{fig:synchronize_trace}c and~d, where nodes with intermediate degree receive only small control inputs. (Videos 5 and 6 in \cgreen{\cite{supp}} show how the control inputs keep the nodes together in phase space.) This is reflected in the arch-like form of the mean energies $E_k$ of the control inputs at both bifurcations, as seen in Figs.~\ref{fig:synchronize_energy}c and~d, with high control energies for nodes with low or high degree. As a result, the optimal control achieves a mean network cross-correlation of $R = 0.995$ in the time interval $t\in [t_c, T]$, compared to the uncontrolled scenario with $R = 0.289$ at point S1 (Fig.~\ref{fig:synchronize_trace}a), and $R = 0.996$ compared to $R=0.368$ at point S2 (Fig.~\ref{fig:synchronize_trace}b). \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig9.png} \caption{ Mean energies $E_k$ of the control inputs [Eq.~\eqref{eqn:control_energy}] as a function of the weighted node degree $d_k$ for the noise-free synchronization task. The error bars show the standard deviation over 10 different initial conditions of the network dynamics. (a, b) The control signal for time $t \in [0,t_c)$ is considered. Linear regression (red line) coefficients are $r=0.83, p<10^{-24}$ and $r=-0.49, p<10^{-6}$. (c, d) The control signal for time $t \in [t_c, T]$ is considered. (a, c) Point S1 (low bifurcation) in Fig.~\ref{fig:State_space_overview}a. (b, d) Point S2 (high bifurcation) in Fig.~\ref{fig:State_space_overview}a. All parameters are as in Fig. \ref{fig:synchronize_trace}. } \label{fig:synchronize_energy} \end{figure} Figure \ref{fig:synchronize_trace-noise} shows results for the application of optimal control to the synchronization task for the case of finite noise. We obtain a mean network cross-correlation of $R = 0.83$ (analysis of the deviation from $R_T$ in \cgreen{\cite{supp}}, uncontrolled: $R=0.25$) at point S1 (Fig.~\ref{fig:synchronize_trace-noise}a) \cgreen{and $R = 0.85$} (uncontrolled: $R=0.35$) at point S2 (Fig.~\ref{fig:synchronize_trace-noise}b). We conclude that the optimal control input successfully synchronizes the network dynamics, just as in the noise-free case. The control strategy that leads to the respective target state, however, changes substantially when noise is added to the system. The control input in the noise-free case is tailored individually for each node, slowing the phase space velocity of some nodes down and speeding others up at the same time (cf.\ blue inset in Fig.~\ref{fig:synchronize_trace}d, mean cross-correlation of the control inputs during this control period is 0.03). In contrast to that, the control input for the noisy network dynamics has a similar shape for all nodes (cf.\ blue inset in Fig.~\ref{fig:synchronize_trace-noise}d, mean cross-correlation of the control inputs during control period is 0.88) with varying amplitude depending on the weighted node degree $d_k$. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig10_inset.png} \caption{ Synchronizing the noisy network with optimal control inputs. (a) Synchronization task at point S1 (low bifurcation) in Fig.~\ref{fig:State_space_overview}a. Activities $x_{k1}$ of each node $k$ are shown over time with \cgreen{green to blue indicating nodes with high to low weighted degree} (average cross-correlation $R = 0.845$ [Eq.~\eqref{eqn:nw_cross_correlation}], uncontrolled: $R = 0.210$). (b) Synchronization task at point S2 (high bifurcation) in Fig.~\ref{fig:State_space_overview}a (controlled: $R = 0.853$, uncontrolled: $R = 0.321$). (c, d) Corresponding optimal control input $\overline{u}_{k1}$ to each node. The red \cgreen{bar indicates the time} interval during which the control is active (from $t=0$ to $t=500$). Parameters were $\eta=0.024$, $I_p=0.1$, $I_e=1.0 , $I_s=0$, all other parameters are as in Fig.~\ref{fig:synchronize_trace}. } \label{fig:synchronize_trace-noise} \end{figure} This change in control strategy is also reflected in Fig.~\ref{fig:synchronize_energy-noise}, which shows the control energy $E_k$ per node for different noise levels. The control energy increases for all nodes with increasing noise strength, both at the low (Fig.~\ref{fig:synchronize_energy-noise}a) and the high bifurcation (Fig.~\ref{fig:synchronize_energy-noise}b). With increasing noise level $\eta$, we observe a gradual transition of the optimal control strategy. Instead of balancing out the phase velocity differences between nodes towards the phase of nodes with intermediate degree (cf.\ Videos 5 and~7 in \cgreen{\cite{supp}}), the control in the noisy case forces the system on a limit cycle with a slightly higher oscillation amplitude (cf.\ Videos 6 and~8 in \cgreen{\cite{supp}}). This strategy requires a higher control energy but is independent of the specific realization of the noise. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig11.png} \caption{Mean energies $E_k$ of the optimal control inputs [Eq.~\eqref{eqn:control_energy}] as a function of the weighted node degree $d_k$ for different noise levels $\eta$ for the synchronization task. The error bars show the standard deviation over 10 different initial conditions of the network dynamics with 20 independent noise realizations of the optimization each. \cgreen{$E_k$ is, in contrast to Fig.~\ref{fig:synchronize_energy}, calculated over the whole interval during which the control is active.} (a) Point S1 (low bifurcation) in Fig.~\ref{fig:State_space_overview}a. (b) Point S2 (high bifurcation) in Fig.~\ref{fig:State_space_overview}a. Parameters were $I_p=0.1$, $I_e=1.0 , $I_s=0$, all other parameters are as in Fig.~\ref{fig:synchronize_trace}. } \label{fig:synchronize_energy-noise} \end{figure} By imposing sparsity constraints on the system, we can investigate to what extent synchronization can be achieved with fewer control sites. Figure \ref{fig:synchronize_sparsity} shows the relation of the synchrony in the network, measured by the average cross-correlation~$R$ [Eq.~\eqref{eqn:nw_cross_correlation}], to the sparsity parameter~$I_s$. The average cross-correlation $R$ decreases with increasing sparsity parameter $I_s$ at both locations in state space and for all noise levels. This shows that, under the imposed constraints, it is not possible to fully synchronize the network with sparse control. Optimally synchronizing aperiodic states is a collective effort. Unlike state switching it cannot be achieved by controlling only a few sites, because the reduced number of control sites cannot sufficiently be compensated for by a higher control energy. Especially in the case of noisy network dynamics, where the control must drive all nodes, the network's synchrony quickly drops to the value of the uncontrolled network when $I_s$ is increased. For fixed $I_s$ the number of controlled nodes and the control sites optimal for synchronizing the network changes for each initial condition $\bm{x_0}$ (cf.\ Fig. S1 in \cgreen{\cite{supp}}), as it depends on details of the exact network dynamics. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig12.png} \caption{Average network cross-correlation $R$ [Eq.~\eqref{eqn:nw_cross_correlation}] with sparse optimal control as a function of the sparsity parameter $I_s$ [Eq.~\eqref{eqn:cost_functional_f_u}] for different noise levels $\eta$. The mean and standard deviation are shown for 5 different initial conditions of the network dynamics, each with 20 independent noise realizations. Horizontal lines indicate the cross correlation $R$ for the uncontrolled case. (a) Point S1 (low bifurcation) in Fig.~\ref{fig:State_space_overview}a. (b) Point S2 (high bifurcation) in Fig.~\ref{fig:State_space_overview}a. Parameters were $I_p=0.1$, $I_e=1.0 , all other parameters are as in Fig.~\ref{fig:synchronize_trace}.} \label{fig:synchronize_sparsity} \end{figure} \cgreen{\section{Comparison with controllability measures derived from linear control theory}} \label{sec:linear_vs_nonlinear} When relating functional properties of a neural system to properties of the underlying connectome, neural activity is often approximated by linear dynamical systems \cite{honey2009predicting, galan2008network, gu2015controllability}. This has obvious benefits for analyzing the effects of perturbations\cgreen{. C}alculating optimal control inputs for linear systems, as in Refs. \cite{bassett2017network, gu2017optimal}, can be done analytically and with little computational effort\cgreen{, and conclusions about the effects of external inputs can be drawn from controllability measures, which depend on network topology only \cite{tang2018colloquium}}. \cgreen{Two of these measures have previously been applied to quantify the impact of perturbations in a whole-brain network setting \cite{gu2015controllability, muldoon2016stimulation, gu2017optimal}.} \textit{Modal controllability} refers to the ability of a node to control each evolutionary mode of a dynamical network \cite{hamdan1989measures}, and the \textit{average controllability} is given by the average control input energy to the respective node over all possible target states \cite{muldoon2016stimulation, gu2015controllability} (mathematical description in Appendix~\ref{sec:appendixControllability}). Nodes with high average controllability require only low energy input to move a linear system into ``easy-to-reach'' states, while nodes with high modal controllability require a high control energy input to have an effect on the dynamics but are crucial when the target state of the system is ``difficult-to-reach''~\cite{gu2015controllability, tang2020control, tang2018colloquium}. It has also been shown that the average controllability of a node is strongly correlated with its weighted degree~$d_k$ ($r=0.85, p<10^{-26}$ for our structural connectivity matrix) while the modal controllability is known to have a strong inverse correlation ($r=-0.82, p<10^{-23}$, see Fig.~S7 in \cgreen{\cite{supp}}). \cgreen{We now apply the diagnostics from linear control theory to the brain network model, Eq.~\eqref{eqn:network_simple}.} Figure \ref{fig:ln_switch} shows the correlations of the energies $E_k$ of the optimal control inputs with the average and modal controllability for the attractor switching tasks. At the low bifurcation A1 (Figs. \ref{fig:ln_switch}a, c) we find, that the energy of the control input for a node is positively correlated with its average controllability and negatively correlated with its modal controllability, both irrespective of the switching direction. Therefore, the most efficient strategy for switching between the attractors is to control the network hubs with high average controllability which then force the other nodes towards the target state. These results can be considered consistent with predictions from linear control theory \cite{gu2015controllability} and previous results on the global impact of stimulation \cite{muldoon2016stimulation}. At the high bifurcation at location B2 (Figs.~\ref{fig:ln_switch}b, d), however, we observe the opposite trend, with the control energy being negatively correlated with the average and positively correlated with the modal controllability. Predictions based on linear control theory alone are indifferent to the actual dynamics and therefore not able to distinguish between the two cases. Yet, nodes with high modal controllability play a much more important role in affecting the global dynamics at this location in state space. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig13.png} \caption{Mean energies $E_k$ of the optimal control inputs [Eq.~\eqref{eqn:control_energy}] plotted against measures from linear control theory for state switching tasks from down state / low amplitude oscillation towards high amplitude oscillation (black) and the opposite direction (red). (a) $E_k$ vs. average controllability when switching at the low bifurcation (Point A1 in Fig.~\ref{fig:State_space_overview}a). (b) Same as (a) but at the high bifurcation (Point B2 in Fig.~\ref{fig:State_space_overview}a). (c) $E_k$ vs. modal controllability at A1 and (d) at B2. Solid lines denote the results of a linear regression with the following obtained coefficients: (a) $r=0.66, p<10^{-12}$ for the down-to-up switch (black) and $r=0.61, p<10^{-10}$ for the up-to-down switch (red). (b) $r=-0.33, p=0.001$ (black) and $r=-0.24, p=0.02$ (red). (c) $r=-0.62, p<10^{-10}$ (black) and $r=-0.57, p<10^{-8}$ (red). (d) $r=0.31, p=0.003$ (black) and $r=0.21, p=0.04$ (red). Same parameters as in Figs.~\ref{fig:state_switching_fig1} and \ref{fig:state_switching_fig2}, for low and high bifurcation, respectively.} \label{fig:ln_switch} \end{figure} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{fig14.png} \caption{Mean energies $E_k$ of the optimal control inputs [Eq.~\eqref{eqn:control_energy}] plotted against the average controllability for the synchronization task (cf.\ Fig.~\ref{fig:synchronize_energy}). (a)~$E_k$ vs. average controllability, with control signal considered during the initial time interval $t \in [0,t_c)$, at the low bifurcation (Point S1 in Fig.~\ref{fig:State_space_overview}a). (b)~Same as (a) but at the high bifurcation (Point S2 in Fig.~\ref{fig:State_space_overview}a). Solid red lines denote the linear regression results with the following obtained coefficients: (a)~$r=0.87, p<10^{-29}$, (b)~$r=-0.16, p=0.12$ (not significant). (c)~$E_k$ vs. average controllability, with control signal considered for time $t \in [t_c, T]$, at S1. (d)~Same as (c) but at S2. All parameters as in Fig.~\ref{fig:synchronize_energy}.} \label{fig:ln_syn} \end{figure} For the synchronization task, we observe a similar pattern. While there is a clear correlation between the optimal node-wise control energies $E_k$ with the average controllability when aligning the phases (i.e.\ $t<t_c$) at the low bifurcation (Fig.~\ref{fig:ln_syn}a), no correlation is observed at the high bifurcation (Fig.~\ref{fig:ln_syn}b). (The corresponding results involving modal controllability are shown in Fig.~S8 in \cgreen{\cite{supp}}.) In the case of maintaining the synchronous network dynamics ($t\ge t_c$, Figs.~\ref{fig:ln_syn}c,~d), we observe -- at both bifurcations -- a similar but less obvious arclike shape as in Figs.~\ref{fig:synchronize_energy}c,~d. For noisy network dynamics (cf.\ Fig.~S9 in \cgreen{\cite{supp}}), however, $E_k$ is negatively correlated with the average controllability at both bifurcations (cf.\ Fig.~S9 in~\cgreen{\cite{supp}}). This shows that in our nonlinear setting, linear controllability measures do not provide additional insights compared to the weighted node degree, and that intuitions based on these measures can be misleading. \cgreen{Diagnostics from linear control theory have previously been claimed to be predictive for a node's role in driving brain state transitions \cite{gu2015controllability, gu2017optimal} or for the global impact of local brain stimulation \cite{muldoon2016stimulation}. Our results however show, that the optimal control inputs and sites in nonlinear systems not only depend } on the structural network connectivity, but also on the location in state space, the control task, and other factors like the amount of noise.\\ \section{Discussion} \label{sec:summary} In this contribution we apply techniques from the optimal control of nonlinear dynamical systems to the dynamics of brain network models. Nodes were equipped with FitzHugh-Nagumo oscillators, since they are simple and well studied nonlinear models for neural dynamics. Changing the background input for the FHN nodes or the global coupling strength of the network can both lead to transitions between two different stable fixed points and two different limit cycle attractors (laLC and haLC). The interaction between nodes in different oscillation states (mixLC) can lead to an asynchronous network dynamics. At the bifurcations, we also find different coexisting stable states. The general mathematical framework of the optimal control of partial differential equations \cite{troltzsch2010optimal} is adapted for noisy dynamical systems on graphs, where the local network dynamics, the noise level, the network connectivity, and the local coupling schemes [Eq.~\eqref{eqn:network_system}] can be freely chosen. The state dependent part of the cost functional is averaged over multiple noise realizations and penalizes the deviation of the network dynamics from a task dependent control target [Eq.~\eqref{eqn:cost_functional_f_x1} for attractor switching, Eq.~\eqref{eqn:cost_functional_f_x2} for synchronization]. The part of the cost functional which depends on the control input [Eq.~\eqref{eqn:cost_functional_f_u}] penalizes the control energy and non-sparse solutions. The presented method is applicable to any network that can be described in the form of Eq.~\eqref{eqn:network_system}, including models of power grids, social networks, or climate dynamics. A common problem for gradient based methods are potential local optima of the cost functional which may prevent the convergence to a globally optimal solution. To alleviate this problem we performed the minimization as described in Section~\ref{sec:min_problem} with different initial conditions $\bm{u}_0$ for the control time-series and choose the result with minimal cost. The set of initial conditions included $\bm{u}_0=0$ as well as valid control time-series taken from different parametrizations. We use the optimal control method to cause targeted attractor switching between previously identified coexisting stable states. When no sparsity is enforced, we show that it is optimal to resonantly drive all nodes to transition to the high amplitude oscillatory state. When the task is to switch to a state with lower amplitude or no oscillation, the optimal strategy is to apply a precisely timed biphasic pulse. The nodes that receive the largest control energy are the same for both of these switching directions and are also the ones that are still controlled when we enforce sparsity in space. Depending on the location in state space, either nodes with high degree (at the low bifurcation) or low degree (at the high bifurcation) are the ones that most efficiently drive the network dynamics from the initial to the target state. When sparsity is enforced, controlling only a small number of these driving nodes with increased control energies $E_k$ is sufficient to switch from one attractor to another in an optimal way. In the second application, we show that our method can also be used to control global properties of the network dynamics, such as the average cross-correlation between node activities in the oscillating regime. Immediately with control onset, the control signal acts on all nodes to align their phases. As soon as this is achieved, the control maintains the synchronous oscillation with periodic control signals. Which nodes receive larger control input for the initial alignment again depends on the location in the state space. Both at the low and high bifurcation, individually adapted control inputs lead to a successful synchronization of the network dynamics. While the average cross-correlation $R$ is increased also with sparse control, the synchronous target state is only achieved in an optimal way, when all nodes in the network receive a finite control input. This suggests that synchronizing all nodes needs collective intervention, while attractor switching can be caused by controlling a few selected nodes only. The introduction of noise to the system makes the dynamics of each node less predictable, resulting in a loss in specificity and more similar control inputs to the nodes. Consequently, the optimal control of noisy network dynamics requires higher total control energy $E$ (cf.\ Fig.~\ref{fig:synchronize_energy-noise}) while resulting in a lower precision (cf.\ Fig.~\ref{fig:synchronize_sparsity} for $I_s = 0$). The information on the different states and bifurcations, which we show to be a decisive factor for choosing the optimal control sites in our applications, is lost when techniques from linear control theory are applied. While predictions do qualitatively agree for certain dynamical systems, control tasks, and locations in state space (cf.\ \cite{muldoon2016stimulation}), this agreement does not hold in a general setting. It would, however, be worthwhile investigating for what classes of dynamical systems and control tasks ``controllability measures'' can be defined, which only depend on the properties of the connectome. In this contribution, the techniques of nonlinear optimal control were applied to a simplified model of the global brain dynamics. The bifurcations in our FHN model (cf.\ Fig.~\ref{fig:sgl_bifur_diag}) phenomenologically capture the state transitions found in more complex, biophysically motivated network models \cite{cakan2019} as we have adapted the FHN parameters to resemble their dynamics. \cgreen{Consequently, the activity variables of the FHN nodes can be interpreted as relative output firing rates of cortical nodes, and their total input $\mu + \sigma \sum_{i=1}^N \bm{A}_{ki} x_{i1} (t)$ can -- at least qualitatively -- be interpreted as a proxy of the local field potential \cite{mazzoni2015computing}. Given this interpretation, model down-(up-)states are related to down-(up-)states in cortical physiology, while an oscillatory regime of the whole-brain model corresponds to a brain state with oscillations present.} Locations at the lower bifurcation of the network model were implicated as proper ``operating points'' for modeling the brain's resting state activity \cite{deco2012ongoing, deco2013resting, demirtacs2019hierarchical}, while locations at the high bifurcation can be considered a cartoon model for the global brain dynamics \cgreen{during non-Rapid Eye Movement (non-REM) sleep (see \cite{cakan2020deep} for a biophysically more detailed model)}. \cgreen{In this work we consider a network with instantaneous couplings, although coupling delays in human white matter are finite. The interpretation of results regarding the model’s state space should thus be limited to cortical states whose dynamics is slow compared to these delays. Given that delays are of the order of approx.\ 5-15~ms \cite{caminiti2013diameter} brain oscillations with periods of approx.\ 1~s or less would qualify. These include the so-called slow oscillations, which are the prominent brain rhythm during non-REM sleep and which have already been subject to external perturbation experiments in human neuroscience and clinical settings \cite{marshall2004transcranial, Ladenbauer2016}.} \cgreen{In lieue of a biologically more detailed model of the effects of control inputs on whole-brain dynamics, delays must be included as soon as brain oscillations with frequencies above a few Hz are of interest. Relative delays can be computed from DTI-based estimates of the length of white matter fiber tracts and included in the coupling terms of Eqs.~\eqref{eqn:network_system} and \eqref{eqn:network_simple}.} \cgreen{When relative delays are scaled by a global delay constant, the ratio of the coupling delays to the FHN oscillation period can be adapted to match the physiologically observed ratios for any given brain rhythm of interest. The formalism of nonlinear optimal control summarized in Section~\ref{sec:nonlinear_control} must extended, though, to cover finite delays by modifying the coupling term in Eq.~\eqref{eqn:network_system} to, e.g., $\sigma (\bm{A} \otimes \bm{G}) \bm{x}(t-d)$ for the case of constant delays. The adapted coupling term reappears when computing the adjoint state with the differential equation [Eq.~\eqref{eqn:adjoint_state}], and thus the iterative algorithm for the numerical optimization (cf.\ Section~\ref{sec:min_problem}) has to be adapted accordingly in the calculation of step~3. } Here we used a \cgreen{highly} simplified model of the global brain dynamics to showcase the applicability of nonlinear optimal control and its added value beyond \cgreen{connectome-based diagnostics derived} from linear control theory. When applied to biophysically more realistic models of whole-brain activity (cf.\ \cite{cakan2020deep}), nonlinear optimal control may serve as a tool to evaluate the impact of external stimulation and to facilitate the design of new brain stimulation protocols. Non-invasive brain stimulation like transcranial current stimulation \cite{nitsche2011transcranial, antal2008comparatively, terney2008increasing} is a highly promising technique to perturb the global brain dynamics with the goal to improve sensory \cite{behrens2017long}, motor \cite{moisa2016brain}, and cognitive abilities \cite{marshall2004transcranial} of human subjects. Using a cost functional which penalizes spatial sparseness and control energy may -- for example -- help reducing the required current applied to a subject's brain as well as focusing the electrical perturbation on the relevant brain areas only. While exact target trajectories are unlikely to be available in a practical setting, state-dependent cost functionals which refer to global quantities [cf.\ Eq.~\eqref{eqn:cost_functional_f_x2} for the synchronization task] may well be. Particularly, reformulating the control formalism in frequency space will be beneficial here. It would for example allow for computing optimal interventions for changing the power of certain brain rhythms, which can be monitored by electroencephalography and which are common control targets in clinical settings (cf.\ \cite{Ladenbauer2016}). As shown in other computational and physiological studies \cite{cakan2019, alagapan2016modulation} and emphasized again by our results, the timing of the control inputs may also be crucial for successful interventions. Here we see a high potential of nonlinear optimal control in guiding electrical brain stimulation under electro- or magnetoencephalography \cite{thut2017guiding, bergmann2018brain}, a setting which allows for such precisely timed control inputs. \cgreen{For quantitative predictions, an application of non-linear optimal control to biophysically grounded network models (cf.\ \cite{cakan2020deep}) is desirable, where the coupling of neurons to externally applied electric fields is included in a biophysically realistic way. Still, results obtained with simplified brain-network models will strongly facilitate biologically detailed but computationally expensive in-silico experiments and may already} inspire physiological studies on brain-stimulation to explore new control paradigms for clinical stimulation protocols with potentially better control results, reduced energy expenditure, and higher spatial sparseness. \section{Acknowledgments} We thank Dr.\ Michael Scholz, Cristiana Dimulescu, and Lena Salfenmoser for scientific discussions, and Prof.\ Dr.\ Eckehard Schöll for his comments on the manuscript.\\ This work was funded by the German Research Foundation (163436311 -- SFB 910, 327654276 -- SFB 1315, and under Germany's Excellence Strategy -- EXC 2002/1 “Science of Intelligence” -- 390523135). Human connectivity data were provided by the Human Connectome Project, WU-Minn Consortium (Principal Investigators: David Van Essen and Kamil Ugurbil; 1U54MH091657) funded by the 16 NIH Institutes and Centers that support the NIH Blueprint for Neuroscience Research; and by the McDonnell Center for Systems Neuroscience at Washington University \section{Whole-brain network -- state space exploration} \subsection{Limit cycle criterion} Figure \ref{fig:nonoisetraces} shows traces of the activity variables $x_{k1}$ and the respective total inputs for each node over time for different background inputs $\mu$ (see bifurcation diagram shown in Fig.~3b of the main paper). The total input \begin{align} \label{totalinput} \mu + \sigma \sum^N_{i} A_{ki}x_{i1}(t) + \eta \, \xi_k(t) \end{align} to each node consists of the sum of the background input $\mu$, the input $\sigma \sum^N_{i} A_{ki}x_{i1}(t)$ from other nodes in the network, and the input $\eta \, \xi_k(t)$ from the noise process. We expect qualitatively different dynamics if the total input of a node lies inside vs.\ outside the interval given by Eq.~(17) of the main paper (dashed blue lines in Fig.~\ref{fig:nonoisetraces}), because total inputs inside this interval correspond to an individual FHN oscillator being in its limit cycle. For small $\mu$, as shown in Fig.~\ref{fig:nonoisetraces}a, the total input is below the lower threshold, and the network is in a stable fixed point. If $\mu$ is larger with the total input still below but closer to the lower threshold, a low amplitude limit cycle (laLC) emerges (Fig.~\ref{fig:nonoisetraces}b). These oscillations cannot be explained by the dynamics of the individual FHN oscillator but emerge as a result of network effects. If the total inputs of some of the nodes enter the described interval, as it happens for some (Fig.~\ref{fig:nonoisetraces}c) or all (Fig.~\ref{fig:nonoisetraces}d) of the maxima of activity, the network dynamics exhibits high amplitude oscillations. The elevated amplitudes for nodes with total input within the interval increase the coupling inputs to other nodes in the network and this creates oscillations in nodes that are not in their individual LC. We call this regime the mixed limit cycle (mixLC) state. If $\mu$ is high enough so that all nodes satisfy the condition in Eq.~(17), as shown in Fig.~\ref{fig:nonoisetraces}e, the network is in the high amplitude limit cycle (haLC) state. For higher $\mu$, the total input of some nodes is exceeds the upper threshold and we observe mixLC states, as in Fig.~\ref{fig:nonoisetraces}f, that show similar aperiodic behavior as mixLC states at the low bifurcation (cf.\ Fig.~\ref{fig:nonoisetraces}c). We also observe a laLC at the high bifurcation (Fig.~\ref{fig:nonoisetraces}g) and a stable fixed point (Fig.~\ref{fig:nonoisetraces}h) for even higher values for the background input $\mu$. The interval criterion for the node input alone is not sufficient to explain the asynchronous or aperiodic network dynamics observed in Figs.~\ref{fig:nonoisetraces}c and~f, but in these traces we see that the network dynamics change qualitatively, depending on whether some of the node inputs fall into the considered interval. Consequently, small changes in the input to individual nodes can result in large effects on the network dynamics. \begin{figure} \centering \includegraphics[width=\textwidth]{traces_lc_crit.png} \caption{Activity traces over time of all nodes in the network (different colors denote different nodes) for different external input $\mu$, as indicated in the respective title. Parameter values of (a)-(h) correspond to Figs.~3c(1-8) of the main paper with $\sigma=0.08$ and $\eta=0$ (noise-free case). Top panels show the activity variables $x_{k1}$ as a function of time for random initial conditions after a sufficiently long transient ($\bar{t}=10000$). Bottom panels show the respective time series of the total input [Eq.~\eqref{totalinput}] to the network nodes. Blue dashed lines indicate the input values for which a single FHN oscillator transitions into its individual LC [$0.73$ and $1.33$, see Eq.~(17) of the main paper].} \label{fig:nonoisetraces} \end{figure} \subsection{Aperiodic behavior in mixed states} Figure~\ref{fig:chaotic}a shows the activity variables $x_{k1}$ for nodes $k\in \{21,22,23\}$ plotted against each other for the asynchronous mixed state at the low bifurcation in Fig.~\ref{fig:nonoisetraces}c (equivalent to Fig.~3c(3) of the main paper). We observe open trajectories, which differ between different oscillation periods. This is a strong indication that the analyzed network state is not only asynchronous but also aperiodic. Figure~\ref{fig:chaotic}b shows the equivalent phenomenon for the trajectories of the investigated asynchronous states at the low bifurcation S1 (cf.\ Fig.~3a of the main paper). Figure~\ref{fig:lcshape}a shows the phase space oscillations in the ($x_{k1}, x_{k2}$) plane of three other network nodes, $k\in \{71, 33, 72\}$ (lowest, intermediate, and highest weighted degree $d_k$ in the network), for point S1 (cf.\ Fig.~3a of the main paper). The large differences in ranges of the trajectories are caused by total inputs [Eq.~\eqref{totalinput}] of different strength due to their different weighted in-degree. Even small changes in the input to a node can have a large effect on the shape of the limit cycle, especially close to the bifurcations (see also Fig.~\ref{fig:lcshape}b). The starting and end points of these trajectories (all plotted for $t\in[5000,5064]$) show that the oscillations of these nodes are not in phase and that the phase difference between them does not remain constant. \begin{figure} \centering \includegraphics[width=\textwidth]{aperiodic.png} \caption{Trajectories of activity variables $x_{k1}$, for nodes $k\in \{21,22,23\}$ for different node combinations, in the mixLC state without noise ($\eta=0$). Trajectories are shown after $\Bar{t}=10000$ (to aviod transient effects) for a time interval of length 10000 arb.\ units. The open trajectories indicate aperiodic network dynamics. (a) Network parameters are $\sigma = 0.08, \mu=0.61$ (same as Fig.~\ref{fig:nonoisetraces}c or Fig.~3c(3) of the main paper). (b) Parameters are $\sigma = 0.025, \mu=0.7$ (same as point S1, cf.\ Fig.~3a of the main paper).} \label{fig:chaotic} \end{figure} \begin{figure} \centering \includegraphics[width=\textwidth]{lc_shape.png} \caption{(a) Plot of the trajectories in the ($x_{k1}, x_{k2}$) phase plane for 3 of the 94 nodes in the network at location S1 ($\sigma=0.025, \mu=0.7$, cf. Fig.~3a of the main paper). All nodes have the same start and end time and are plotted for 64 time units, which is equivalent to roughly 2 cycles (after transient of $\Bar{t}=5000$). Cyan to pink corresponds to node 71 which has the lowest weighted degree $d_k$ in the network. Black to orange corresponds to node 33 with an intermediate value of $d_k$, and green to yellow corresponds to node 72 which has the highest value of $d_k$ in the network. Color changes along the trajectory in discrete time. (b) Shape of the LC of a single, uncoupled node for different background inputs $\mu = \{0.73,0.75,0.85,1.03,1.21,1.31,1.33\}$ (bottom left to top right).} \label{fig:lcshape} \end{figure} \subsection{Influence of noise on the network dynamics} Figures \ref{fig:noisetraces}a--h show the activity variables $x_{k1}$ and the total inputs [Eq.~\eqref{totalinput}] for each node for the same parametrizations of the network dynamics as Figs.~\ref{fig:nonoisetraces}a--h, with additional Gaussian white noise ($\eta=0.024$). If the network without noise is in the stable down state close the the bifurcation, as in Fig.~\ref{fig:nonoisetraces}a, small fluctuations in the node input can lead to large changes in the activity variable. Such oscillations of individual nodes are then sustained by the coupling and drive the network oscillation. This effect blurs the distinction between FPs and the laLC for increasing noise levels. The oscillation amplitudes of nodes in the laLC fluctuate due to the noise, which makes it even harder to distinguish the states based on the time-series of activity variables. Interestingly, the mean network cross-correlation of the noise-free asynchronous state in Fig.~\ref{fig:nonoisetraces}c is increased from $R=0.47$ ($\eta=0$) to $R=0.58$ ($\eta=0.024$) in Fig.~\ref{fig:noisetraces}c. A potential explanation for the higher synchrony with additional Gaussian noise is the increased number of nodes that fulfill the criterion in Eq.~(17) of the main paper (36 for $\eta=0.024$, compared to 15 for $\eta=0$). If a random fluctuation drives a node into the respective individual LC, this increases the coupling input to the other nodes in the network. With more nodes oscillating in the individual LC, the driving input to the remaining nodes is increased, which can then be sufficient to entrain a synchronous network oscillation. Close to the high bifurcation in Fig.~\ref{fig:noisetraces}f, a similar effect counteracts the aperiodic collapsing of the network oscillation (cf. Fig.~\ref{fig:nonoisetraces}f). The periodic and synchronous states in Figs.~\ref{fig:noisetraces}d,~e are robust against the influence of noise, showing no qualitative change in their dynamics compared to the noise-free case in Figs.~\ref{fig:nonoisetraces}d,~e. Figure~\ref{fig:noisetraces}h shows, similar to Fig.~\ref{fig:noisetraces}a at the low bifurcation, a self-sustained noise induced network oscillation at the high bifurcation. Figure~\ref{fig:noisetraces}i shows that if the network dynamics are in a fixed point far away from a bifurcation, we observe uncorrelated fluctuations in the activity variable and the combined input, instead of the emerging oscillations in Figs.~\ref{fig:noisetraces}a and~h. When evaluating the results of the optimal control method for the synchronization task in the case of finite noise, it is unreasonable to expect that the optimal control algorithm will achieve the target mean network cross-correlation of $R_T=1$. In the synchronization task in Section IV B of the main paper, the optimal control method increases the average network cross-correlation from $R=0.25$ in the uncontrolled case to $R = 0.83$ (parameters $\mu=0.7, \sigma=0.025, \eta=0.024$, location S1, Fig.~10a of the main paper). We compare the deviation of this result from the target $R_T=1$ with the effect of noise on $R$ of a previously synchronous network state. Figure \ref{fig:noisetraces}j shows the effect of noise on an uncontrolled, synchronous state with low global coupling strength as S1 ($\sigma=0.025$, used for synchronization task of the main paper). The mean network cross-correlation of $R = 0.99$ in the noise-free ($\eta=0$) case is substantially reduced to $R=0.75$ when noise is introduced ($\eta=0.024$, same as for the synchronization task of the main paper). \begin{figure} \centering \includegraphics[width=0.9\textwidth]{traces_noise.png} \caption{ (a)-(i) Activity traces over time of all nodes in the network (different colors denote different nodes) for different external input $\mu$, as indicated in the respective title. Parameters for (a)-(h) are the same as in Figs.~\ref{fig:nonoisetraces}a-h, except for added Gaussian white noise with variance $\eta=0.024$. Top panels show the activity variables $x_{k1}$ as a function of time for random initial conditions after a sufficiently long transient ($\bar{t}=10000$). Bottom panels show the respective time series of the total input [Eq.~\eqref{totalinput}] to the network nodes. Blue dashed lines indicate the input values for which a single FHN oscillator transitions into its individual LC ($0.73$ and $1.33$, see Eq.~(17) of the main paper). (j) Activity traces over time of all nodes for $\mu=0.75, \sigma=0.025$ and different noise levels, top: noise-free case ($\eta=0$, resulting in $R=0.99$); bottom: noisy network dynamics with reduced average cross-correlation ($\eta=0.024$, resulting in $R=0.75$).} \label{fig:noisetraces} \thisfloatpagestyle{empty} \end{figure} \section{Optimal control of the brain network dynamics} \subsection{Recovery of laLC target state} The network dynamics as shown in Fig.~6b of the main paper does not achieve the target state (cf. initial state in Fig.~6a of the main paper) within the time interval in which the control is active. The biphasic pulse of the optimal control method occurs around $t=150$, after which the network oscillation almost comes to rest. Since, however, no stable fixed point exists in the absence of control input, the oscillation amplitude grows until it reaches the laLC target state. Figure~\ref{fig:cont6b} shows that the laLC target state is stable and reached about 550 time units after the control pulse. Although the control target is eventually reached, this trajectory results in a nonzero precision cost, which is evaluated in the last $\tau=25$ time units of the control interval. Due to energy constraints, however, this is still the optimal control solution. \begin{figure} \centering \includegraphics[width=\textwidth]{6b_contined.png} \caption{Same as Fig.6b of the main paper but shown for an extended time interval. The purple bar indicates the time interval in which the deviation of the target state is penalized ($\tau=25$) and the red bar indicates the time interval the control is active. The dashed line at $t=675$ indicates the first point in time when the cross-correlation with the laLC target state is larger than $0.99$.} \label{fig:cont6b} \end{figure} \subsection{Computation of critical times $t_c$} The critical time $t_c$ is defined as the first point in time when all nodes are ``in synchrony''. The cross-correlation measure for synchrony [Eq.~(7) of the main paper] is defined for time intervals and does not allow to determine synchrony for a given point in time. We therefore compute the Kuramoto order parameter~$r$, \begin{align} r(t) = \dfrac{1}{N} \left|\sum^N_{k=1} e^{i\theta_k(t)}\right|, \end{align} for $N$ nodes of the network with their respective phases $\theta_k$. We calculate the phases for node $k$ by assigning $\theta_k(\hat{t})=0$ to all times $\hat{t}$ that correspond to its oscillation maxima. We then linearly interpolate the phases $\theta_k \in [0,2\pi)$ between subsequent maxima. The critical time $t_c$ is then defined as the first point in time in the control period, for which $r(t)\ge 0.999$ holds. \subsection{Controlled nodes in case of sparse control} \begin{figure} \centering \includegraphics[width=0.9\textwidth]{sparsity_ratio_sync.png} \caption{Synchronization with sparse optimal control for different noise levels $\eta$, equivalent to Fig.~12 of the main paper. (a) Fraction of nodes in the network that receive finite control input as a function of the sparsity parameter $I_s$ at point S1 (low bifurcation). (b) Same for S2 (high bifurcation). (c) Achieved synchonization measured by the average cross-correlation $R$ as a function of the fraction of controlled nodes at point S1. The mean and standard deviation are shown for 5 different initial conditions of the network dynamics, each with 20 independent realizations of the noise. Horizontal lines denote the average cross-correlations $R$ for the uncontrolled case. (d) Same for S2. Parameters as in Fig.~12 of the main paper.} \label{fig:sparsity} \end{figure} Figure~\ref{fig:sparsity} provides additional information to Fig.~12 of the main paper by showing the fraction of controlled nodes as a function of the sparsity parameter $I_s$ and the resulting average cross-correlation $R$. As expected, the fraction of controlled nodes decreases with increasing penalty on sparsity in space. Plotting the average cross-correlations $R$ against the fraction of controlled nodes intuitively shows how many nodes have to receive a finite control input in order to achieve a certain synchrony for different noise levels. It is not possible to achieve a significantly higher synchrony compared to the uncontrolled dynamics by controlling less than 15\% of the network nodes. \subsection{Videos of the node dynamics in phase space with optimal control} Videos can be viewed at \href{https://github.com/rederoth/nonlinearControlFHN-videos}{https://github.com/rederoth/nonlinearControlFHN-videos}. The states ($x_{k1}, x_{k2}$) for all network nodes $k$ are plotted as dots in the ($x_{k1}, x_{k2}$) phase plane. The color of each node corresponds to its weighted degree (green to blue indicates high to low values). The optimal control inputs $\Bar{u}_k$ are indicated by black arrows whose direction denotes the sign and whose length denote absolute strength (see top right corner for scale). The time $t$ and the duration of the control interval is indicated in the bottom right corner. If applicable, the limit cycle of a single node (no coupling, $\sigma = 0$) is indicated in light gray. \begin{itemize} \item Video 1: \href{https://github.com/rederoth/nonlinearControlFHN-videos/blob/main/video_1_switch_low.avi}{Attractor switching at point A1 (low bifurcation) from down-state to oscillatory state} \item Video 2: \href{https://github.com/rederoth/nonlinearControlFHN-videos/blob/main/video_2_switch_low_tolowamp.avi}{Attractor switching at point A1 (low bifurcation) from oscillatory state to down-state} \item Video 3: \href{https://github.com/rederoth/nonlinearControlFHN-videos/blob/main/video_3_switch_high.avi}{Attractor switching at point B2 (high bifurcation) from low-amplitude oscillation to high-amplitude oscillation} \item Video 4: \href{https://github.com/rederoth/nonlinearControlFHN-videos/blob/main/video_4_switch_high_tolowamp.avi}{Attractor switching at point B2 (high bifurcation) from high-amplitude oscillation to low-amplitude oscillation} \item Video 5: \href{https://github.com/rederoth/nonlinearControlFHN-videos/blob/main/video_5_sync_low.avi}{Synchronization at point S1 (low bifurcation) with $\eta=0$ (noise-free network)} \item Video 6: \href{https://github.com/rederoth/nonlinearControlFHN-videos/blob/main/video_6_sync_high.avi}{Synchronization at point S2 (high bifurcation) with $\eta=0$ (noise-free network)} \item Video 7: \href{https://github.com/rederoth/nonlinearControlFHN-videos/blob/main/video_7_sync_low_noise.avi}{Synchronization at point S1 (low bifurcation) with $\eta=0.024$ (noisy network)} \item Video 8: \href{https://github.com/rederoth/nonlinearControlFHN-videos/blob/main/video_8_sync_high_noise.avi}{Synchronization at point S2 (high bifurcation) with $\eta=0.024$ (noisy network)} \end{itemize} \section{Linear network control theory} \subsection{Correlation of average and modal controllability with weighted degree} \begin{figure} \centering \includegraphics[width=\textwidth]{degree_controllability_correlation.png} \caption{Linear controllability measures plotted against the weighted node degrees $d_k$. Red solid lines denote the linear regression results. Left: Average controllability with ($r=0.85, p<10^{-26}$). Right: Modal controllability with ($r=-0.82, p<10^{-23}$).} \label{fig:degcont} \end{figure} The considered linear controllability measures are known to be closely related to the weighted node degree $d_k$ [23, 25]. Figure~\ref{fig:degcont} shows the average and modal controllability measures as function of $d_k$ for each of the $N=94$ network nodes, where the average controllability shows a positive, and the modal controllability a negative correlation with $d_k$. Nodes with high average controllability tend to have a small modal controllability. \subsection{Modal controllability evaluated for the synchronisazion task (noise-free case)} Figure~\ref{fig:modalsyn} shows the correlation between the optimal node-wise control energies $E_k$ of the control inputs with the modal controllability for the synchronization task discussed in Fig.~14 of the main paper. Since nodes with high average controllability show a low modal controllability, the positive correlation at the low bifurcation for $t<t_c$ (Fig.~14a of the main paper) is reversed, while there is again no significant correlation at the high bifurcation (cf. Fig.~\ref{fig:modalsyn}b). In the second phase of the control, with $t\ge t_c$, we again observe nodes with an intermediate modal controllability receiving smaller control energies $E_k$ (analogous to Figs.~9c,~d and 14c,~d of the main paper). \begin{figure} \centering \includegraphics[width=\textwidth]{sync_modal.png} \caption{Mean of the optimal node-wise control energy $E_k$ plotted against the modal controllability for the synchronization task (equivalent to Fig.~14 of the main paper). (a, b) The control signal from time $t=0$ until time $t=t_c$ is considered. Solid red lines denote the linear regression results with the following obtained coefficients: (a) $r=-0.84, p<10^{-25}$, (b) $r=0.14, p=0.18$ (not significant). (c, d) The control signal from time $t=t_c$ until time $t=T$ is considered. (a, c) Point S1 (low bifurcation). (b, d) Point S2 (high bifurcation). All parameters as in Fig.~14 of the main paper.} \label{fig:modalsyn} \end{figure} \subsection{Controllability measures for the synchronization task (noisy network dynamics)} For the synchronization task under finite noise, we observe a change in the control strategy with increasing noise levels (cf. Section II B of the main paper). Figure~\ref{fig:ln_syn} shows that the influence of noise also affects the correlation of the node-wise control energy $E_k$ with the introduced measures from linear control theory. At the low bifurcation (Fig.~\ref{fig:ln_syn}a), $E_k$ is not correlated with the average controllability over the whole time interval of the control for $\eta=0$ (combination of Figs.~14a and c of the main paper). With increasing noise levels, however, we also observe an increased negative correlation. At the high bifurcation (Fig.~\ref{fig:ln_syn}b) the correlation of $E_k$ with the average controllability is even inverted from positive for $\eta=0$ to increasingly negative for $\eta=0.012$ and $\eta=0.024$. Similar effects are observed for the changes in the changes in the correlation between the node-wise control energy $E_k$ and the modal controllability (Fig.~\ref{fig:ln_syn}c,~d) when noise is increased. \begin{figure} \centering \includegraphics[width=\textwidth]{energy_controllatiliby_noise.png} \caption{Mean of the optimal node-wise control energy $E_k$ plotted against average (a, b) and modal controllability (c, d) for the synchronization task with different noise levels $\eta$. (a, c) Results at the low bifurcation (point S1). (b, d) Results at the high bifurcation (point S2). Solid lines denote the linear regression results, where black corresponds to the noise-free case ( $\eta=0.0$), green to small ($\eta=0.012$), and red to high noise levels ($\eta=0.024$). Regression coefficients are: (a) for $\eta=0.0$ $(r=-0.05, p=0.63)$ not significant, $\eta=0.012$ $(r=-0.66, p<10^{-12})$, $\eta=0.024$ $(r=-0.80, p<10^{-21})$. (b) $(r=0.24, p=0.02)$, $(r=-0.24, p=0.02)$, $(r=-0.54, p<10^{-7})$, (c) $(r=0.07, p=0.49)$ n.s., $(r=0.65, p<10^{-11})$, $(r=0.79, p<10^{-20})$, (d) $(r=-0.2, p=0.04)$, $(r=0.25, p=0.02)$, $(r=0.54, p<10^{-7})$. All parameters as in Fig.~11 of the main paper.} \label{fig:ln_syn} \end{figure} \end{document}
\section{Introduction}\label{sec:intro} Many signal processing applications involve solving a multidimensional harmonic retrieval (MHR) problem. Examples include MIMO radar \cite{nion10}, MIMO wireless channel sounding \cite{liu05}, and nuclear magnetic resonance spectroscopy \cite{li98}. In addition to resolution problems, a new challenge for methods in 2-D is that though the pairs are distinct, there could be harmonics with the same value in one dimension, i.e. $(a,b)$ and $(a,c).$ To address the MHR problem, many techniques have been proposed in the past \cite{hua90, pesavento04, roy89,zoltowski96,haardt98, schmidt86,trees02,gershman10,liu06}, as well as efforts were made to gain a solid theoretical understanding \cite{sorenson17,jiang01}. Subspace based methods for solving the MHR problem include multiple signal classification (MUSIC) \cite{schmidt86,trees02}, estimation of signal parameters via rotational invariance technique (ESPRIT) \cite{roy89,zoltowski96,haardt98}, rank reduction estimator (RARE) \cite{pesavento04}, multi-dimensional folding (MDF) \cite{liu05} and matrix pencil \cite{hua90}. Many of these methods rely on the assumption of uncorrelated sources, and their performance degrades when the assumption does not hold. Also techniques like ESPRIT are applicable to uniform array geometries only. Approaches like \cite{hua93,pesavento04}{\color{red}} extend 1-D techniques to solve higher dimensional estimation problem, such that an additional coupling of parameters in each dimension needs to solved. On the other hand, techniques in \cite{haardt98,liu06} allow a natural pairing of the two sets of parameters. In this work we approach the two-dimensional harmonic retrieval problem using sparse signal recovery (SSR) tools. SSR methods allow one to reconstruct a spectrally sparse signal using highly incomplete temporal or spatial data \cite{candes06,donoho06}. \iffalse More specifically, we consider the sparse Bayesian learning (SBL) algorithm to solve the problem at hand.\fi In particular, in this paper we address the higher computational complexity associated with the sparse Bayesian learning (SBL) algorithm \cite{wipf07,tipping01} when the underlying parameter is multi-dimensional. Contributions in the paper are as follows:\begin{itemize}[leftmargin=*,noitemsep] \item A new Bayesian strategy with reduced complexity based on novel \emph{remodeling} and \emph{reparameterization} of the data model is proposed. \item An approach that induces a natural coupling of the parameter in the two dimensions by introducing \emph{block sparsity}. \item A solution to the two dimensional HR problem using a 1-D grid; learned block structure allows estimating the parameters in other dimension in a \emph{gridless} manner. \item Although we solve the problem with a grid in one dimension, we numerically show that our method does not suffer from poor \emph{identifiability}. \end{itemize}\iffalse We propose a new Bayesian strategy, that alleviates this issue through novel \emph{remodeling} and \emph{reparameterization} of the data model. builds on the notion of \emph{block sparsity}, for solving the 2-D harmonic retrieval problem. The strategy involves solving a 1-D problem and utilizes the \emph{learnt} block structure to estimate the coupled parameters in the other dimension. Thus, the proposed algorithm induces a \emph{natural pairing} of the two sets of parameters, thereby avoiding an additional coupling step.\fi \iffalse By virtue of recognizing the inherent block structure and reparameterizing the problem to reduce constraints, we essentially estimate the parameters in the other dimension in a \emph{gridless} manner. In \cite{jiang01}, the authors provided a stochastic identifiability result for multidimensional harmonic retrieval.\fi In section~\ref{sec:probdef} we introduce the system model and discuss some background on the problem at hand. The proposed method is discussed in section~\ref{sec:propmethod}. Finally in section~\ref{sec:numsim}, we provide numerical results which support the usefulness of the proposed technique. \section{System Model And Background}\label{sec:probdef} \subsection{System Model} \iffalse Two-dimensional data samples are received of the form\begin{equation} y[m,n]=\sum_{k=1}^Ks_k\exp{\left(ju_{x,k}m+ju_{y,k}n\right)}+v_{m,n}\label{eq:2dmodlsclr} \end{equation}where $m\in[M],n\in[N]$, $s_k$ and $(u_{x,k},u_{y,k})$ are the amplitudes and 2-D frequencies respectively for the $k$th sinusoidal\fi Consider a URA with $N_x$ sensors along the $x$ axis and $N_y$ sensors along the $y$ axis. The inter-element spacing used in the array is assumed to be half-wavelength along both the axes, and $L$ measurements or snapshots are collected. The received measurements are composed of $K$ narrowband source signals. We assume that signals impinging on the array come from a finite 2D grid of elevation ($\theta_k\in[0,90]$) and azimuth ($\phi_k\in[0,360)$) angles, where $k\in\{1,\ldots,K\}$, corresponding to the $k$th source. The received measurement at the $(n_x,n_y)$ sensor, at the $l$th instant is given by ($0\leq n_x<N_x,0\leq n_y<N_y;n_x,n_y\in\mathbb{Z}$)\begin{multline} \bar{\mathbf{Y}}_l[n_x,n_y]=\sum_{k=1}^Ks_{k,l}\>\mathrm{exp}\left(j\pi\left(n_{x}u_k+n_{y}v_k\right)\right)\\+\bar{\mathbf{V}}_l[n_x,n_y],\label{eq:2dmodlsclr2} \end{multline}where $u_k=\cos{\phi_k}\sin{\theta_k},v_k=\sin{\phi_k}\sin{\theta_k}$ ($u_k,v_k\in[-1,1],$ $u_k^2+v_k^2\leq 1$). In the above equation, $s_{k,l}$ denotes the transmitted symbol by the $k$th source, and $\bar{\mathbf{V}}_l[n_x,n_y]$ denotes the noise at the $l$th instant modeled as white circular Gaussian. \iffalse\begin{IEEEeqnarray}{rcl} \bar{\mathbf{Y}}_l[n_x,n_y]=\sum_{k=1}^Ks_{k,l}\>&&\mathrm{exp}\left(jn_{x}\pi\cos{\phi_k}\sin{\theta_k}\right.\nonumber\\&&\left.+jn_{y}\pi\sin{\phi_k}\sin{\theta_k}\right)+\bar{\mathbf{V}}_l[n_x,n_y],\IEEEeqnarraynumspace\label{eq:2dmodlsclr} \end{IEEEeqnarray}where $s_{k,l}$ is the symbol transmitted by the $k$th source and $\bar{\mathbf{V}}_l[n_x,n_y]$ is the noise modeled as complex white Gaussian, at $l$th instant. The above model can be equivalently described in the $(u,v)-$space such that $u=\cos{\phi}\sin{\theta},v=\sin{\phi}\sin{\theta}$ ($u,v\in[-1,1],u^2+v^2\leq 1$), giving\begin{IEEEeqnarray}{rcl} \bar{\mathbf{Y}}_l[n_x,n_y]=\sum_{k=1}^Ks_{k,l}\>\mathrm{exp}\left(j\pi\left(n_{x}u_k+n_{y}v_k\right)\right)+\bar{\mathbf{V}}_l[n_x,n_y],\IEEEeqnarraynumspace\label{eq:2dmodlsclr2} \end{IEEEeqnarray}which in matrix form results in ($0\leq l< L$)\fi Eq.~(\ref{eq:2dmodlsclr2}) can be re-written in matrix form as:\begin{IEEEeqnarray}{rcl} \bar{\mathbf{Y}}_l&=&\sum_{k=1}^Ks_{k,l}\>\mathbf{\Phi}_{u,k}\mathbf{\Phi}_{v,k}^T+\bar{\mathbf{V}}_l\quad (0\leq l< L)\IEEEeqnarraynumspace\label{eq:2dmodlmtx1}\\ &=&\mathbf{\Phi}_u\mathbf{S}_l\mathbf{\Phi}_v^T+\bar{\mathbf{V}}_l.\IEEEeqnarraynumspace\label{eq:2dmodlmtx2} \end{IEEEeqnarray}In eq.~(\ref{eq:2dmodlmtx1}), $\mathbf{\Phi}_{u,k}=[1,\mathrm{exp}\left(j\pi u_k\right),\ldots,\mathrm{exp}\left(j\pi(N_x-1)u_k\right)]^T$ and $\mathbf{\Phi}_{v,k}=[1,\mathrm{exp}\left(j\pi v_k\right),\ldots,\mathrm{exp}\left(j\pi (N_y-1)v_k\right)]^T$ represent the array response vectors to the $k$th source along the $x$ and $y$ axes, respectively. Let the grid sizes in the $u$ and $v$-spaces be $M_u$ and $M_v$ respectively. In eq.~(\ref{eq:2dmodlmtx2}) we introduce the corresponding dictionary matrices $\mathbf{\Phi}_u\in\mathbb{C}^{N_x\times M_u}$ and $\mathbf{\Phi}_v\in\mathbb{C}^{N_y\times M_v}$ in the $u$ and $v$ space respectively. The symbol matrix $\mathbf{S}_l$ has at most $K$ non-zero entries corresponding to the $K$ source symbols. In addition to sources located on-grid we also assume the notion of \emph{common-sparsity} along the snapshots, i.e. the source locations $(u_k,v_k)$ although unknown, remain fixed over time. Consequently, the support of the symbol matrix $\mathbf{S}_l$ is constant. We shall use the above model throughout this paper, as (uniform) grid definitions in $(u,v)-$space often lead to less coherent dictionaries than those in $(\theta,\phi)-$space. The entries in $\mathbf{S}_l$ are assumed to be zero mean and uncorrelated, and the matrices are generated as i.i.d. over the snapshots. \subsection{Background} \subsubsection{Using Kronecker Product of Two 1-D Dictionaries} A straightforward way to recover the support i.e., the $K$ source locations is to extend an off-the-shelf sparse signal recovery algorithm to handle 2D-grid points. For example, we can take the transpose of the received snapshot and vectorize the result to get ($0\leq l<L$)\begin{equation} \mathbf{y}_l=\mathrm{vec}(\bar{\mathbf{Y}}_l^T)=(\mathbf{\Phi}_u\otimes\mathbf{\Phi}_v)\mathrm{vec}(\mathbf{S}_l^T)+\mathrm{vec}(\bar{\mathbf{V}}_l^T). \end{equation}We now concatenate the $L$ snapshots together to get\begin{IEEEeqnarray}{rcl} \mathbf{Y}&=&(\mathbf{\Phi}_u\otimes\mathbf{\Phi}_v)\left[\begin{array}{cccc}\mathrm{vec}(\mathbf{S}_0^T)&\mathrm{vec}(\mathbf{S}_1^T)&\ldots\>\mathrm{vec}(\mathbf{S}_{L-1}^T)\end{array}\right]\nonumber\\ && \quad+\left[\begin{array}{cccc}\mathrm{vec}(\bar{\mathbf{V}}_0^T)&\mathrm{vec}(\bar{\mathbf{V}}_1^T)&\ldots&\mathrm{vec}(\bar{\mathbf{V}}_{L-1}^T)\end{array}\right]\nonumber\\ &=&(\mathbf{\Phi}_u\otimes\mathbf{\Phi}_v) \bar{\mathbf{X}}+\mathbf{V}.\label{eq:2DCS} \end{IEEEeqnarray}Thus, the resulting dictionary to be defined is simply the Kronecker product of the 1-D dictionaries. However such an extension quickly increases the computational cost. The complexity per iteration using the MSBL algorithm \cite{wipf07} is $O(N_x^2N_y^2\times M_uM_v)$ i.e. roughly quadratic in the 1-D grid size. The goal of our work is to reduce this complexity significantly while retaining the superior source identifiability characteristics by preserving the dimension of the measurements. The dimension preserving requirement allows us to identify more sources than what is possible by essentially solving two 1-D problems and then coupling the resulting 1-D solutions. \subsubsection{On Coupling the Solutions of Two 1-D Problems:} This method employs one dictionary at a time, and each time considers measurements along one axis and concatenates data along the other axis. For estimating the $u$ components, instead of vectorizing the matrix of measurements obtained at each snapshot, one simply works with the following concatenated matrix $\left[\bar{\mathbf{Y}}_0,\bar{\mathbf{Y}}_1, \hdots, \bar{\mathbf{Y}}_{L-1}\right].$ When estimating the $v$ components, one utilizes $\bar{\mathbf{Y}}^T_l.$ This method although keeps the computational complexity low, but it suffers from poor identifiability i.e. the number of sources that are recovered. This is because the dimension of the vector measurements is either $N_x$ or $N_y$, much smaller than $N_x N_y$ used in the Kronecker product based approach. It also treats the data along the other dimension as independent snapshots which is not true for the columns within a snapshot (matrix measurement) and leads to sub-optimal results. \section{Proposed Bayesian Strategy}\label{sec:propmethod} The goal of this work is to provide a solution with bounded complexity, much lower than using Kronecker product of dictionaries, while exploiting the rich structure in the received measurements. The basic idea in order to lower the computational complexity is to essentially solve for one parameter using a 1-D dictionary, and at the same time exploiting additional \emph{structure} to simultaneously infer the coupled parameter in the second dimension. \subsection{Inducing Parameter Coupling via Block Sparsity} \iffalse In this subsection we revisit the data model in eq.~(\ref{eq:2DCS}) and highlight the inherent \emph{block-sparsity} structure present in the problem.\fi We begin with rewriting eq.~(\ref{eq:2DCS}) and simplifying it further.\begin{IEEEeqnarray}{rcl} \mathbf{Y}&=&(\mathbf{\Phi}_u\otimes\mathbf{\Phi}_v) \bar{\mathbf{X}}+\mathbf{V}\nonumber\\ &=&\left(\mathbf{\Phi}_u\otimes\mathbf{I}_{N_y}\right)\left(\mathbf{I}_{M_u}\otimes\mathbf{\Phi}_v\right)\Bar{\mathbf{X}}+\mathbf{V}\label{eq:krontrick}\\ &=&\left(\mathbf{\Phi}_u\otimes\mathbf{I}_{N_y}\right)\mathbf{X}+\mathbf{V}\>\>(\mathrm{for\>some\>}\mathbf{X}=\left(\mathbf{I}_{M_u}\otimes\mathbf{\Phi}_v\right)\Bar{\mathbf{X}}),\IEEEeqnarraynumspace\label{eq:vecmodel} \end{IEEEeqnarray}where in eq.~(\ref{eq:krontrick}) we use the result on Kronecker product: $\mathbf{AC}\otimes\mathbf{BD}=\left(\mathbf{A}\otimes\mathbf{B}\right)\left(\mathbf{C}\otimes\mathbf{D}\right)$. Equation~(\ref{eq:vecmodel}) defines our new model and an important contribution of this work. Our strategy is to treat $\mathbf{D}_u=\mathbf{\Phi}_u\otimes\mathbf{I}_{N_y}$ as the effective dictionary and to first estimate the $u$'s. Note that the row dimension of $\mathbf{D}_u=\mathbf{\Phi}_u\otimes\mathbf{I}_{N_y}$ is the same as in MSBL and this allows the source identifiability properties to be retained. The number of columns is however much smaller leading to the low complexity aspect of the approach. Another important contribution and unique feature of the method is the estimation of the components in the second dimension. The assumptions made on the symbol matrices $\mathbf{S}_l,0\leq l<L$ translate to the fact that each column of $\bar{\mathbf{X}}$ has uncorrelated components, and the columns themselves are i.i.d.. On the other hand, consider (using MATLAB notations below)\begin{IEEEeqnarray}{rcl} \mathbf{X}^i&=&\mathbf{X}((i-1)N_y+1:iN_y,:),\qquad(i\in\{1,\ldots,M_u\})\nonumber\\ &=&\mathbf{\Phi}_v\bar{\mathbf{X}}((i-1)M_v+1:iM_v,:),\label{eq:blockdef} \end{IEEEeqnarray}which implies that each such block, $\mathbf{X}^i$, has correlated components along each column. Let $\mathbf{x}^i_l\in\mathbb{C}^{N_y}$ denote the $l$th column of the $i$th block, and let $\mathbf{x}_l=\left[(\mathbf{x}^1_l)^T,\ldots,(\mathbf{x}^{M_u}_l)^T\right]^T$ denote the $l$th column of $\mathbf{X}$. Then eq.~(\ref{eq:blockdef}) implies that $\mathbf{x}^i_l$ has correlated components. Hence, we conclude that $\mathbf{X}$ in the new model i.e. in eq.~(\ref{eq:vecmodel}) is \emph{block sparse}. \iffalse This naturally motivates our use of the block sparse Bayesian learning framework. The strategy is therefore to treat $\mathbf{D}_u=\mathbf{\Phi}_u\otimes\mathbf{I}_{N_y}$ as the effective dictionary and to first estimate the $u$'s.\fi Also, the correlation within each block is \emph{structured}, and influenced by the coupled parameters in the other dimension i.e. $v$. We dissolve the parameter $v$ from the original model (eq.~(\ref{eq:2DCS})) completely, and instead track the correlation matrices $\mathbf{R_x}_{,i}=\mathrm{E}\left[\mathbf{x}^i_l(\mathbf{x}^i_l)^H\right]$, where $\mathrm{E}[.]$ denotes expectation operation. This \emph{reparameterization} allows us \iffalse we use the embedded correlation present within the components of $\mathbf{x}^i_l$\fi to estimate the coupled $v_i$'s, in a gridless manner. Our approach follows a maximum-likelihood (ML) principle, although for the sake of simplicity we do not impose the additional (Toeplitz) correlation structure here and show through numerical simulations that this is adequate. \subsection{Model Priors} As per our observation in eq.~(\ref{eq:blockdef}), we introduce a Gaussian \emph{block} prior on $\mathbf{x}^i_l, i\in\{1,\ldots,M_u\}$ as\begin{equation} p(\mathbf{x}^i_l;\gamma_i,\mathbf{B}_i)\sim\mathcal{N}\left(\mathbf{0},\gamma_i\mathbf{B}_i\right),\quad(0\leq l<L) \end{equation}such that there is no inter-block correlation. Thus the prior on $\mathbf{x}_l$ is given by\begin{equation*} p(\mathbf{x}_l;\gamma_i,\mathbf{B}_i,\forall i)\sim \mathcal{N}\left(\mathbf{0},\mathbf{\Sigma}_0\right), \end{equation*}\begin{equation} \mbox{where, }\mathbf{\Sigma}_0=\left[\begin{array}{ccc} \gamma_1\mathbf{B}_1 & & \\ & \ddots &\\ & & \gamma_{M_u}\mathbf{B}_{M_u} \end{array}\right]. \end{equation} Notice that the prior does not depend on $l$ as the columns are i.i.d over the snapshots. Our formulation here induces a targeted block structure, unlike in T-SBL \cite{zhang11} where a temporal correlation structure exists over all the snapshots. Our approach here is valid for 2-D harmonic retrieval problems and also extends more generally to the MHR problem, as long as the snapshots are independent. The model parameters are estimated using a ML approach and the negative of the log-likelihood function is given by\begin{equation} -\log p(\mathbf{Y};\lambda,\gamma_i,\mathbf{B}_i,\forall i)=\log\det\mathbf{\Sigma_y}+\mathrm{tr}\left(\mathbf{\Sigma_y}^{-1}\hat{\mathbf{S}}_{\mathbf{y}}\right),\label{eq:mlcost} \end{equation}where $\mathbf{\Sigma_y}\triangleq\mathbf{D}_u\mathbf{\Sigma}_0\mathbf{D}_u^H+\lambda\mathbf{I}$, $\lambda$ denotes the noise variance parameter to be estimated, and $\hat{\mathbf{S}}_{\mathbf{y}}=\frac{1}{L}\sum_l\mathbf{y}_l\mathbf{y}_l^H$ denotes the sample covariance matrix. \subsection{Algorithm Development} The cost function in eq.~(\ref{eq:mlcost}) is non-convex and any majorization-minimization framework can be used to minimize the cost function. We here employ the Expectation-Maximization (EM) framework to effectively maximize $p(\mathbf{Y};\lambda,\gamma_i,\mathbf{B}_i,\forall i)$. We begin with estimating the posterior density $p(\mathbf{x}_l\mid \mathbf{y}_l;\lambda^{(k)},\gamma_i^{(k)},\mathbf{B}_i^{(k)},\forall i)$ based on the current estimate of parameters $\mathbf{\Theta}=\left[\lambda,\gamma_i,\mathbf{B}_i,\forall i\right]$\iffalse $\mathbf{\Theta}=\left[\lambda,\gamma_1,\mathbf{B}_1,\gamma_2,\mathbf{B}_2,\ldots,\gamma_{M_u},\mathbf{B}_{M_u}\right]$\fi . We drop the superscript $(k)$ denoting current iteration for notational simplicity.\begin{equation} p(\mathbf{x}_l\mid \mathbf{y}_l;\mathbf{\Theta})\sim\mathcal{N}\left(\bm{\mu}_{\mathbf{x},l},\mathbf{\Sigma_x}\right), \end{equation}\begin{IEEEeqnarray}{rll} \mbox{where, }\bm{\mu}_{\mathbf{x},l}&=&\frac{1}{\lambda}\mathbf{\Sigma}_x\mathbf{D}_u^H\mathbf{y}_l\label{eq:meanupdate}\\ \mathbf{\Sigma_x}&=&\mathbf{\Sigma}_0-\mathbf{\Sigma}_0\mathbf{D}_u^H\left(\lambda\mathbf{I}_{N_xN_y}+\mathbf{D}_u\mathbf{\Sigma}_0\mathbf{D}_u^H\right)^{-1}\mathbf{D}_u\mathbf{\Sigma}_0.\label{eq:covupdate}\IEEEeqnarraynumspace \end{IEEEeqnarray}Note that the mean of the posterior depends on the snapshot index, $l$. We concatenate the posterior mean over snapshots to form $\bm{\mu}_{\mathbf{x}}=\left[\bm{\mu}_{\mathbf{x},0},\ldots,\bm{\mu}_{\mathbf{x},L-1}\right]$. We shall now proceed to updating the current estimate of the parameters in $\mathbf{\Theta}$. In contrast to the work in \cite{zhang11} where a single correlation matrix $\mathbf{B}$ was rightfully motivated, here we take a different approach. Since the $\mathbf{B}_i$'s are expected to carry information about the coupled $v_i$'s corresponding to individual $u_i$'s, we do not enforce a single $\mathbf{B}$ matrix. This strategy is crucial when identifying sources with distinct $u_i$'s. Following steps are similar to those followed in \cite{zhang11} and we here simply mention the update equations for $\gamma_i$'s, $\mathbf{B}_i$'s and the noise variance estimate $\lambda$.\begin{IEEEeqnarray}{rcl} \gamma_i&\leftarrow&\frac{1}{N_y}\mathrm{tr}\left(\mathbf{B}_i^{-1}\left(\mathbf{\Sigma_x}^i+\frac{1}{L}\bm{\mu}_{\mathbf{x}}^i\left(\bm{\mu}_{\mathbf{x}}^i\right)^H\right)\right)\label{eq:gammaupdate}\\ \mathbf{B}_i&\leftarrow&\frac{1}{\gamma_i}\left(\mathbf{\Sigma_x}^i+\frac{1}{L}\bm{\mu}_{\mathbf{x}}^i\left(\bm{\mu}_{\mathbf{x}}^i\right)^H\right),\label{eq:Bupdate} \end{IEEEeqnarray}where $\mathbf{\Sigma_x}^i=\mathbf{\Sigma_x}\left((i-1)N_y+1:iN_y, (i-1)N_y+1:iN_y\right)$ and $\bm{\mu}_{\mathbf{x}}^i=\bm{\mu}_{\mathbf{x}}\left((i-1)N_y+1:iN_y, :\right),i\in\{1,\ldots,M_u\}$. For updating $\lambda$ we use the following update equation:\begin{IEEEeqnarray}{rcl} \lambda&\leftarrow&\frac{1}{N_xN_yL}\lVert\mathbf{Y}-\mathbf{D}_u\bm{\mu}_{\mathbf{x}}\rVert_F^2\nonumber\\ &&\>+\frac{\lambda}{N_x}\mathrm{tr}\left(\mathbf{\Phi}_u\bm{\Gamma}\mathbf{\Phi}_u^H\left(\mathbf{\Phi}_u\bm{\Gamma}\mathbf{\Phi}_u^H+\lambda\mathbf{I}\right)^{-1}\right)\label{eq:lambdaupdate}\IEEEeqnarraynumspace \end{IEEEeqnarray}\iffalse Also, for $\lambda$ we get:\begin{IEEEeqnarray}{rcl} \lambda&\leftarrow&\frac{1}{N_xN_yL}\lVert\mathbf{Y}-\mathbf{D}_u\bm{\mu}_{\mathbf{x}}\rVert_F^2\nonumber\\ &&\>+\frac{\lambda}{N_xN_y}\left(M_uN_y-\mathrm{tr}\left(\mathbf{\Sigma_x}\mathbf{\Sigma}_0^{-1}\right)\right)\IEEEeqnarraynumspace \end{IEEEeqnarray}\fi Note that putting $N_y=1$ in the above equations (except for $\lambda$) gives us the update equations for the EM-MSBL algorithm. In the above, we used the notation, $\bm{\Gamma}=\mathrm{diag}\left(\bm{\gamma}\right)=\mathrm{diag}([\gamma_1,\ldots,\gamma_{M_u}])$. We denote the algorithm using the equations~(\ref{eq:meanupdate}),(\ref{eq:covupdate}),(\ref{eq:gammaupdate}),(\ref{eq:Bupdate}) and (\ref{eq:lambdaupdate}) as H-MSBL, emphasizing that our approach is applicable to the Harmonic retrieval problem. A few practical remarks are in order.\vspace{0.1cm}\\{\bf Remark 1:} We normalize the correlation matrices, $\mathbf{B}_i\leftarrow\mathbf{B}_i/\lVert\mathbf{B}_i\rVert_F$ , $\forall i$, so as to separate the role of $\mathbf{B}_i$ and $\gamma_i$. The above update equation for $\lambda$ is different from what is derived using the EM algorithm. The latter was emprirically observed to be unstable. Thus, instead we replaced it with an adaptation of eq. (33) in \cite{zhang11} for high-SNR case \iffalse\begin{IEEEeqnarray}{rcl} \lambda&\leftarrow&\frac{1}{N_xN_yL}\lVert\mathbf{Y}-\mathbf{D}_u\bm{\mu}_{\mathbf{x}}\rVert_F^2\nonumber\\ &&\>+\frac{\lambda}{N_x}\mathrm{tr}\left(\mathbf{\Phi}_u\bm{\Gamma}\mathbf{\Phi}_u^H\left(\mathbf{\Phi}_u\bm{\Gamma}\mathbf{\Phi}_u^H+\lambda\mathbf{I}\right)^{-1}\right)\label{eq:lambdaupdate}\IEEEeqnarraynumspace \end{IEEEeqnarray}\fi and also incorporated suggestions therein for low SNR case which produced stable updates.\\{\bf Remark 2:} Given the number of sources to be identified, the top peaks in the recovered $\bm{\gamma}$ provide information about the $u$ component of the present sources. The corresponding $\mathbf{B}_i$'s provide information about the coupled $v$ component. Thus the need to separately estimate $v$'s and coupling them with $u$'s is prevented. In our simulation, we use root-MUSIC \cite{trees02} to extract the coupled $v$-components.\\{\bf Remark 3:} An interesting challenging scenario in the 2-D HR problem is when the distinct 2-D harmonics have the same value in one dimension. Methods have been designed that assume the harmonics are distinct in both dimensions \cite{rao84} and special care has to be taken in algorithm development to deal with the above mentioned challenging scenario \cite{hua93}. It will be shown numerically that H-MSBL works even in this context when multiple sources share the same $u$ or $v$ grid point. \subsection{Computational Complexity: H-MSBL vs MSBL}\label{sec:analysis} The per iteration complexity of the MSBL algorithm applied to the model in eq.~(\ref{eq:2DCS}) is $O(N_x^2N_y^2\times M_uM_v)$. The same for the proposed H-MSBL algorithm is $O(N_x^2N_y^2\times M_uN_y)$ (or is $O(N_x^2N_y^2\times M_vN_x)$), if the grid is defined on $u$\footnote{this assumes $M_u>N_x$, which is usually the case.} (or on $v$). This is a significant reduction in the computational complexity, as both $N_x$ and $N_y$ are physical array dimensions, and thus are much smaller than the corresponding grid sizes. Like the MSBL algorithm, the complexity of the proposed algorithm does not depend on the number of snapshots. This is because the (ML) cost function depends on the snapshots only through the outer product $\mathbf{YY}^H$. To achieve the proposed complexity, one has to replace $\mathbf{Y}$ with $\tilde{\mathbf{Y}}\in\mathbb{C}^{N_xN_y\times\mathrm{rank}(\mathbf{Y})}$ in the update equations, such that $\mathbf{YY}^H=\tilde{\mathbf{Y}}\tilde{\mathbf{Y}}^H$, and only compute the diagonal blocks of $\mathbf{\Sigma_x}$ of size $N_y\times N_y$. The MSBL algorithm introduces a missing or latent variable, $\bar{\mathbf{X}}\in\mathbb{C}^{M_uM_v\times N_xN_y}$ which is more \emph{complex} than the latent variable $\mathbf{X}\in\mathbb{C}^{M_uN_y\times N_xN_y}$ we have introduced, both in the reduced dimension. On the other hand, the (ML) cost function in MSBL is defined over $\bm{\gamma}\in\mathbb{C}^{M_uM_v}$, whereas here the cost function is defined over $\bm{\Theta}$ involving a total of $M_u(N_y^2+1)$ parameters, ignoring the noise variance parameter. The EM algorithm is known to converge slowly if one chooses an overly informative complete data. In the next section we numerically compare the rate of convergence of the two algorithms. \section{Numerical Simulations}\label{sec:numsim} In this section, we compare the performance of the proposed H-MSBL algorithm to MSBL (using Kronecker product of 1-D dictionaries in eq.~(\ref{eq:2DCS})). The MSBL is chosen because it is found to be comparable, if not better than most algorithms, when applied to direction of arrival estimation. In addition, it is robust to impairments such as source correlation \cite{pote20}. Furthermore, a competing algorithm like MUSIC also has the same complexity issues as MSBL in the search process. The main purpose of the work is to show that the low complexity H-MSBL can compare favorably with state of the art algorithms and so the more complex MSBL is a good reference point for comparison. Unless otherwise specified the source location components, $(u_k,v_k),\forall k$, are distinct. The H-MSBL algorithm proceeds by defining grid on the $u$ component, and estimates $v$ in a gridless manner. The number of EM-iterations performed are mentioned alongside the algorithm. For e.g., a MSBL curve using $500$ EM-iterations is denoted by MSBL-$500$. Note that, during the implementation, the combined $(u,v)$-grid size is less than $M_uM_v$ as points that violate the constraint $u^2+v^2\leq 1$ are discarded from the dictionary, $\mathbf{\Phi}$. All algorithms are initialized with $\bm{\gamma}_{\mathrm{init}}=\frac{\lVert\mathbf{YY}^H/L\rVert_F}{\lVert\mathbf{\Phi\Phi}^H\rVert_F}[1,\ldots,1]^T$. All simulation are carried out in MATLAB 9.4.0.813654 in a Windows 10 system using a 2.7 GHz CPU. \begin{figure} \begin{tabular}{cc} \centering \hspace{-0.8cm}\includegraphics[width=0.6\linewidth]{images/Compare_HMSBL_2DSBL.eps} & \hspace{-0.8cm}\includegraphics[width=0.6\linewidth]{images/Compare_realizations_HMSBL_2DSBL.eps} \\ \hspace{-0.8cm}{\small (a) Computation time vs. $v$-grid size} & \hspace{-0.8cm}{\small (b) Estimated $(u,v)$, $v$-grid size=$100$} \end{tabular}\caption{H-MSBL vs. MSBL: $N_x=N_y=4,K=6,\mathrm{SNR}=20\mathrm{\>dB},L=50$, $u$-grid size$=100$}\label{fig:complexity}\end{figure} \begin{figure}\centering \includegraphics[width=0.9\linewidth]{images/Same_u_v2.eps}\caption{Comparison on source identifiability: $N_x=3,N_y=6,K=10,\mathrm{SNR}=20\mathrm{\>dB},L=50$, $u,v$-grid sizes$=100$ each}\label{fig:sourceident}\end{figure} \noindent{\bf Experiment 1:} In this simulation, we wish to compare the computational complexity of using the H-MSBL and MSBL algorithms. In fig.~(\ref{fig:complexity}) we compare the computation time in seconds (left) and single instance $(u,v)$ localization performance for H-MSBL and MSBL. As observed in the left plot, the computation time for MSBL grows with the size of the grid on the $v$ component, $M_v$. On the other hand, the same for the H-MSBL algorithm does not depend on $M_v$. For applications such as DoA estimation it is desirable to define a fine grid, but the number of EM-iterations required for convergence also grows. This can be seen in the right plot. Here, H-MSBL is able to localize sources with high accuracy and low complexity, with fewer iterations than MSBL. Note that (non-EM) MSBL implementations may lead to faster convergence, but the complexity will still grow with $M_v$, unlike for H-MSBL.\vspace{0.05cm}\\ \noindent{\bf Experiment 2:} In this simulation we compare the performance of the algorithms when multiple sources share the same $u/v$ grid point. In fig.~(\ref{fig:sourceident}), we consider a $3\times 6$ array and let sources arrive from a grid of $2$ $u$-points and $5$ $v$-points. This is a challenging scenario as even with $2000$ EM iterations the MSBL estimates are slightly away from true source locations. For H-MSBL, the $v$ component for the multiple sources sharing the same $u$-grid point are estimated using Root-MUSIC on the recovered $\mathbf{B}_i\in\mathbb{C}^{6\times 6}$ matrices. The number of sources to be identified was provided. As can be seen, the proposed technique incurs no loss of source identifiability in this experiment.\vspace{0.05cm}\\ \begin{figure}\centering \includegraphics[width=0.9\linewidth]{images/rate_of_convergence.eps}\caption{Rate of convergence: $N_x=4,N_y=4,K=6,\mathrm{SNR}=20\mathrm{\>dB},L=50$, $u,v$-grid sizes$=100$ each}\label{fig:roc}\end{figure} \noindent{\bf Experiment 3:} As pointed in section~\ref{sec:analysis}, the proposed H-MSBL algorithm introduces a smaller dimensional latent variable $\mathbf{X}$ than MSBL. In this simulation we compare the rate of convergence of the two algorithms. In fig.~(\ref{fig:roc}) we compare the root mean squared error (RMSE) over the EM iterations for the H-MSBL and MSBL algorithms. The squared error is computed as $\left(u_k-\hat{u}_k\right)^2+\left(v_k-\hat{v}_k\right)^2,\forall k$ and the mean is taken over all sources. As seen from the plot, the proposed algorithm has a faster rate of convergence. Note, the $\gamma_i$'s are pruned if the value falls below $10^{-3}$ for both the algorithms. \section{Conclusion}\label{sec:conc} In this paper, we considered the two dimensional harmonic retrieval (HR) problem and highlighted the increased computational complexity requirements of the MSBL algorithm. We proposed a novel Bayesian strategy by imposing a suitable block sparsity prior. This enables reduction in the effective grid size while maintaining the dimensionality of the measurement space. Thus we are able to identify many more sources than possible by purely 1-D approaches, at the same time achieving reduced complexity. We numerically demonstrated the superior performance of the proposed algorithm. \iffalse\section{Unused text} {\color{red}We find the underlying parameters of interest, namely the tuples $(u_k,v_k)$ for each of the $K$ sources along with the estimate for the noise variance $\lambda$ by maximizing the likelihood of the snapshots $\mathbf{Y}$} over these parameters. In particular, we use the Expectation-Maximization (EM) framework. We identify $\mathbf{X}$ as the latent variable or missing data and $\mathbf{Y}$ as the incomplete data. In agreement with our observation in eq.~(\ref{eq:blockdef}) we introduce a Gaussian \emph{block} prior on $\mathbf{x}^i_l, i\in\{1,\ldots,M_u\}$ as\begin{equation} p(\mathbf{x}^i_l;\gamma_i,\mathbf{B}_i)\sim\mathcal{N}\left(\mathbf{0},\gamma_i\mathbf{B}_i\right),\quad(0\leq l<L) \end{equation}such that there is no inter-block correlation. Thus the prior on $\mathbf{x}_l$ is given by\begin{equation*} p(\mathbf{x}_l;\gamma_i,\mathbf{B}_i,\forall i)\sim \mathcal{N}\left(\mathbf{0},\mathbf{\Sigma}_0\right) \end{equation*}where\begin{equation} \mathbf{\Sigma}_0=\left[\begin{array}{ccc} \gamma_1\mathbf{B}_1 & & \\ & \ddots &\\ & & \gamma_{M_u}\mathbf{B}_{M_u} \end{array}\right]. \end{equation} Notice that the prior does not depend on $l$ as the columns are i.i.d over the snapshots. Our formulation here induces a targeted block structure, unlike in T-SBL \cite{zhang11} where a temporal correlation structure exists over the entirety of the snapshots. Our approach here is valid for 2-D harmonic retrieval problems and also extends more generally to multidimensional harmonic retrieval (MHR), as long as the snapshots are independent. The EM steps we follow here are similar to those in \cite{zhang11}. Therefore, we only mention the important results and steps here. At any iteration $k$, based on initial estimates for $\mathbf{\Theta}=$, we first compute the Gaussian posterior $p(\mathbf{x}^i_l\mid \mathbf{Y};\lambda^{(k)},\gamma_i^{(k)},\mathbf{B}_i^{(k)})$ as\begin{equation} p(\mathbf{x}^i_l\mid \mathbf{Y};\lambda^{(k)},\gamma_i^{(k)},\mathbf{B}_i^{(k)})\sim\mathcal{N}\left(\bm{\mu_x},\mathbf{\sigma_x}\right), \end{equation}where\begin{IEEEeqnarray}{rll} \bm{\mu_x}^{(k+1)}&=&\frac{1}{\lambda^{(k)}}\mathbf{\Sigma}_x^{(k+1)}\mathbf{D}_u^H\mathbf{Y}\\ \mathbf{\Sigma_x}^{(k+1)}&=&\left(\left(\mathbf{\Sigma}_0^{(k)}\right)^{-1}+\frac{1}{\lambda^{(k)}}\mathbf{D}_u^H\mathbf{D}_u\right)^{-1}\nonumber\\ &=&\mathbf{\Sigma}_0^{(k)}-\mathbf{\Sigma}_0^{(k)}\mathbf{D}_u^H\left(\lambda^{(k)}\mathbf{I}_{N_xN_y}+\mathbf{D}_u\mathbf{\Sigma}_0^{(k)}\mathbf{D}_u^H\right)^{-1}\nonumber\\ &&\quad\times\mathbf{D}_u\mathbf{\Sigma}_0^{(k)}\IEEEeqnarraynumspace \end{IEEEeqnarray} We begin with some initial estimates for the parameters involved in the original likelihood function i.e. ($\hat{\gamma}_i,\hat{\mathbf{B}}_i$), $i\in\{1,\ldots,M_u\}$ and $\hat{\lambda}$, and estimate the posterior density $p(\mathbf{x}^i_l\mid \mathbf{Y};\lambda,\gamma_i^{(k)},\mathbf{B}_i^{(k)})$ which is also Gaussian,\begin{equation} p(\mathbf{x}^i_l\mid \mathbf{Y};\lambda,\gamma_i^{(k)},\mathbf{B}_i^{(k)})\sim\mathcal{N}\left(\bm{\mu_x},\mathbf{\sigma_x}\right), \end{equation}where\begin{IEEEeqnarray}{rcl} \bm{\mu_x}&=&\frac{1}{\lambda^{(k)}}\mathbf{\Sigma_x^{(k)}}\mathbf{D}_u^H\mathbf{Y}\nonumber\\ &=&\mathbf{\Sigma}_0\mathbf{D}_u^H\left(\lambda\mathbf{I}_{N_xN_y}+\mathbf{D}_u\mathbf{\Sigma}_0\mathbf{D}_u^H\right)^{-1}\mathbf{Y}\\ \mathbf{\Sigma_x}&=&\mathbf{\Sigma}_0-\mathbf{\Sigma}_0\mathbf{D}_u^H\left(\lambda\mathbf{I}_{N_xN_y}+\mathbf{D}_u\mathbf{\Sigma}_0\mathbf{D}_u^H\right)^{-1}\mathbf{D}_u\mathbf{\Sigma}_0\IEEEeqnarraynumspace \end{IEEEeqnarray} Denote the dictionary $\mathbf{D}=\mathbf{\Phi}_u\otimes\mathbf{I}_{N_y}$.\vspace{0.2cm}\\ {\bf E-Step:}\begin{IEEEeqnarray}{rcl} \mathbf{X}&=&\frac{1}{\lambda}\mathbf{\Sigma_x}\mathbf{D}^H\mathbf{Y}\nonumber\\ &=&\mathbf{\Sigma}_0\mathbf{D}^H\left(\lambda\mathbf{I}_{N_xN_y}+\mathbf{D\Sigma}_0\mathbf{D}^H\right)^{-1}\mathbf{Y}\\ \mathbf{\Sigma_x}&=&\mathbf{\Sigma}_0-\mathbf{\Sigma}_0\mathbf{D}^H\left(\lambda\mathbf{I}_{N_xN_y}+\mathbf{D\Sigma}_0\mathbf{D}^H\right)^{-1}\mathbf{D\Sigma}_0 \end{IEEEeqnarray}{\bf M-Step:}\begin{IEEEeqnarray}{rcl} \gamma_i&=&\frac{1}{N_y}\mathrm{tr}\left(\mathbf{B}_i^{-1}\left(\mathbf{\Sigma_x}^i+\frac{1}{L}\mathbf{X}^i(\mathbf{X}^i)^H\right)\right)\\ \mathbf{B}_i&=&\frac{1}{\gamma_i}\left(\mathbf{\Sigma_x}^i+\frac{1}{L}\mathbf{X}^i(\mathbf{X}^i)^H\right) \end{IEEEeqnarray}where, $\mathbf{\Sigma_x}^i=\mathbf{\Sigma_x}\left((i-1)N_y+1:iN_y, (i-1)N_y+1:iN_y\right)$ and $\mathbf{X}^i=\mathbf{X}\left((i-1)N_y+1:iN_y, :\right)$.\vspace{0.2cm}\\{$\lambda$ estimate:}\begin{IEEEeqnarray}{rcl} \lambda\leftarrow\frac{1}{N_xN_yL}\lVert\mathbf{Y}-\mathbf{DX}\rVert_F^2+\frac{\lambda}{N_xN_y}\left(MN_y-\mathrm{tr\left(\mathbf{\Sigma_x}\mathbf{\Sigma}_0^{-1}\right)}\right) \end{IEEEeqnarray}\fi \bibliographystyle{IEEEbib}
\section{Introduction} \label{sec:Intro} The problem of collective space charge effects is a major topic of research in plasma and accelerator physics. The research of longitudinal space charge effects covers significant portion of these studies. It ranges from longitudinal space charge waves in plasma columns \cite{trappedplasma} and vacuum tubes \cite{LSCklystron}, beam-cloud instability in ion transport \cite{HeavyIon2Strem}, two-stream instability in vacuum electronics \cite{Carlsten2Stream} and relativistic beams \cite{Jamie2Stream}, longitudinal instability in intense beams \cite{Chao}, microbunching instability in high brightness linacs \cite{microbunching}, free electron lasers in Raman regime \cite{RamanFEL}, plasma wakefield accelerator in capillary \cite{PWFAcapillary} and many others. Despite evident similarity between these problems and similar results obtained by different authors, there is no universal approach to addressing longitudinal space charge effect in various beam/plasma systems in cylindrical geometry. Essentially, every new problem is solved from the first principles repeating similar derivations previously reported in literature. To date, there are two main approaches to address longitudinal space charge in cylindrical geometry. The first approach is mainly used in accelerator physics and describes electric fields as a product of impedance and beam current \cite{Chao, JammieZ}. Another approach originated in plasma physics community \cite{trappedplasma, HeavyIon2Strem, modulation2D, PWFAcapillary}. In that approach longitudinal particle dynamics and Poisson's equation are solved simultaneously, which reduces to problem of finding eigenmodes of the second order differential equation, which represents transverse distribution of electric field in space. A drawback of these approaches is inability to include secondary species of particles such as background plasma or additional beams. Moreover, simple analytic expressions suitable for further studies can be obtained only for limited test transverse distributions, typically flattop \cite{trappedplasma, HeavyIon2Strem, modulation2D, PWFAcapillary} or occasionally Gaussian \cite{PWFAcapillary, SCGaussian}. Alternatively, collective effects in the medium can be described in terms of polarization density and the resulting electric displacement field. In this approach each specie of particles results in the polarization density independently from other species, reacting to the imposed electric field. As a result, the displacement field of the overall system can be found through additive contribution of each specie. The overall system of multiple beams and plasma species can be described with a single variable, {\it i.e.} dielectric permittivity, in the linear regime when the external electric field is small enough. \section{Collective longitudinal space charge effects in beams and plasmas} \label{sec:Analysis} We consider a long beam of charged particles traveling along $z$ direction inside a beam pipe of circular cross-section as outlined in Fig.~\ref{fig:geometry}. The beam is considered to be axially symmetric and being matched into the focusing channel. The external longitudinal electric field will cause collective response of particles in the beam, which is proportional to the external field in linear regime. The beam density $n(r)$ does not need to be transversely uniform and it is localized close to the pipe axis. This problem clearly needs to be solved in two dimensions (2D). It is possible to carry out analysis using the formalism developed in Refs.~\cite{HeavyIon2Strem, SC_Geloni}. In that analysis the beam can be viewed as a layered dielectric with dielectric permittivity matching that of local plasma parameters $\epsilon(r)$. Then the Laplace equation $\nabla (\epsilon(r)\nabla\phi)=0$ for the electrostatic potential $\phi$ can be reduced to a problem of finding an eigen-mode. However, this approach can only be done numerically for complicated enough transverse beam profiles. Moreover, inclusion of additional particle species ({\it e.g.} electron cloud, background plasma, second beam of particles with different energy, {\it etc.}) requires solving different eigen-mode problem. \begin{figure}[ht] \center \includegraphics[width=0.45\textwidth]{geometry.pdf} \caption{Schematics of the axisymmetric beam propagating inside a vacuum pipe.} \label{fig:geometry} \end{figure} The external electric field causes density modulation along the beam. That modulation, in turn, results in the induced electric field, which can be viewed as polarization density of the beam. The induced longitudinal electric field has traverse dependence of its amplitude, which reflects the 3D nature of the problem. However, the transverse scale of the field mirrors that of the longitudinal scale of the beam modulation in the beam frame \cite{GreenFunction}. Therefore, long wavelength modulations in the beam, $k\sigma_r/\gamma \ll1$ will result in transversely uniform longitudinal electric field across the beam. Here $\gamma$ is the relativistic mass factor, $k$ is the longitudinal wavenumber of modulation, and $\sigma_r$ is the rms beam size. Under that condition, the uniform external electric field results in uniform polarization density. As a result, one can treat the beam as an effective dielectric medium and describe its properties with longitudinal dielectric permittivity $\epsilon_{||}$ \begin{equation} \label{epsilon_def} D_z=\epsilon_{||} E_z. \end{equation} The longitudinal dielectric permittivity describes collective space charge effects in the beam. \subsection{Longitudinal dynamics of particles} The longitudinal particle dynamics inside the beam can be found using conventional fluid cold plasma equations \begin{eqnarray} \label{fluid1} &&\partial_t n +\partial_z (\beta cn)=0,\\ &&(\partial_t+\beta c\partial_z)\left(\frac{\beta}{\sqrt{1-\beta^2}}mc\right)=eE_z, \label{fluid2} \end{eqnarray} where $n$ is the density of charged particles in the beam, $\beta\equiv v_z/c$ is their normalized longitudinal fluid velocity, $m$ and $e$ are the mass and charge of particles, respectively, $\partial_t$ and $\partial_z$ are the partial derivatives over time $t$ and longitudinal coordinate $z$, $c$ is the speed of light. Equations (\ref{fluid1}) --- (\ref{fluid2}) are derived under the assumption that the longitudinal and transverse particle motion are not relativistic in the beam frame, which allows decoupling transverse and longitudinal dynamics. We solve Eqs.~(\ref{fluid1}) --- (\ref{fluid2}) in a linear limit of density and velocity modulations \begin{equation} n=n_0+\delta n,\;\;\;\;\;\;\;\beta=\beta_0+\delta \beta,\;\;\;\;\;\;\left|\frac{\delta n}{n_0}\right|,\left|\frac{\delta \beta}{\beta_0}\right|\ll \frac{1}{\gamma_0^3}. \end{equation} We solve linearized fluid equations using Fourier transform \begin{equation} \label{harmonic} \delta n, \delta \beta, E\propto e^{i\omega t-ikz}. \end{equation} Then the linearized Eqs.~(\ref{fluid1}) ---(\ref{fluid2}) result in the solution for the perturbation \begin{eqnarray} \label{linear1} &&\delta n=n_0\frac{-ike}{\gamma_0^3m(\omega-k\beta_0c)^2} E_z,\\ &&\delta \beta=\frac{\delta n}{n_0}\frac{\omega-k\beta_0c}{kc}=\frac{-ie}{\gamma_0^3mc(\omega-k\beta_0c)} E_z. \label{linear2} \end{eqnarray} The linearized fluid equations (\ref{linear1}) --- (\ref{linear2}) are correct for arbitrary transverse profiles of the beam density $n_0(r)$ and the applied electric field $E_z(r)$. We consider the case of long wavelength modulations, $k\sigma_r/\gamma_0 \ll1$, which results in a transversely uniform electric field. In this regime the velocity modulation $\delta\beta$ is also transversely uniform (see Eq.~(\ref{linear2})) and the transverse profile of density modulation matches that of the beam profile, $\delta n(r)\propto n_0(r)$ (see Eq.~(\ref{linear1})). This kind of solution ensures that the modulation will not be washed out by transverse particle motion, which mixes particles across the beam. The opposite case of short wavelength modulations, $k\sigma_r/\gamma_0 \gg1$, requires taking transverse motion into account since each individual particle will observe varying electric field during betatron motion. \subsection{Space-charge impedance} The space charge caused by the density modulation described by Eq.~(\ref{linear1}) results in the electric field. Analysis in this section resembles the one presented in Ref.~\cite{CERN_SC} with one major difference. We look for the longitudinal electric field caused by the space charge wave rather than a moving particle. Essentially, the phase velocity of the wave serves as a velocity of the effective particles in the beam. Presence of high density background plasma may significantly reduce velocity of the space charge wave compared to the velocity of charged particles in the beam. This may cause a major difference compared to conventional analysis in the accelerator physics. We start with Maxwell's equations for electric and magnetic fields ($E$ and $B$, respectively) in vacuum and include charge and current sources caused by beams ($\rho$ and $j$, respectively) \begin{eqnarray} \nabla\times{\bf E}&=&-\partial_t{\bf B}/c,\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\nabla\cdot{\bf E} =4\pi \rho({\bf r},t),\\ \nabla\times{\bf B}&=&(4\pi {\bf j}({\bf r},t)+\partial_t{\bf E})/c,\;\nabla\cdot{\bf B}=0,\\ {\bf j}&=&e(\delta n {{\bf \beta}_0}c+n_0\delta{\bf \beta}c)\hat{{\bf z}},\;\;\;\;\;\;\,\;\rho=e\delta n. \end{eqnarray} These equations can be combined to obtain the second order partial differential equation for the electric field \begin{equation} \nabla^2{\bf E}-\frac{1}{c^2}\partial^2_{tt}{\bf E}=4\pi\nabla\rho+\frac{4\pi}{c^2}\partial_t{\bf j}. \end{equation} We Fourier transform this equation assuming that sources are monochromatic according to Eq.~(\ref{harmonic}). We also take into account that the charge and current densities are related as follows from Eq.~(\ref{fluid1}), $j=\omega/k\cdot\rho$ (it is, essentially, the charge conservation law). Then the equation for the longitudinal component of the electric field becomes \begin{flalign} \label{Ez} \left[\frac{1}{r}\partial_r\left(r\partial_r\right)-k^2+\frac{\omega^2}{c^2}\right]E_z=\frac{4\pi i}{k}\left(k^2-\frac{\omega^2}{c^2}\right)e\delta n. \end{flalign} We find the solution of Eq.~(\ref{Ez}) using Green's function approach. We search for the electric field caused by a thin ring of particles with radius $r=r^\prime$, {\it i.e.} $\delta n(r)=\delta(r-r^\prime)$ (Fig.~\ref{fig:Green}). The homogeneous solution of Eq.~(\ref{Ez}) can be represented as linear combination of Bessel functions. These functions are either regular or modified Bessel functions depending on the sign of $k^2-\omega^2/c$. The majority of problems including interaction of beams with plasmas result in a slow space charge wave having phase velocity smaller than the speed of light, $\omega/k<c$ \cite{fast}. In this case the homogeneous solution of Eq.~(\ref{Ez}) can be represented as a linear combination of modified Bessel functions $I_0$ and $K_0$. Then the Green's function $G(r)$ can be found as \begin{eqnarray} \label{Ez1} G(r)&=&A_1I_0(\varkappa r)+B_1K_0(\varkappa r),\;\;\;\;\;r<r^\prime,\\ \label{Ez2} G(r)&=&A_2I_0(\varkappa r)+B_2K_0(\varkappa r),\;\;\;\;\;r>r^\prime,\\ \label{kappa} \varkappa&=&\sqrt{k^2-\omega^2/c^2}. \end{eqnarray} \begin{figure}[ht] \center \includegraphics[width=0.45\textwidth]{Green.pdf} \caption{Charge distribution corresponding to Green's function.} \label{fig:Green} \end{figure} Equations (\ref{Ez1}) --- (\ref{kappa}) should be completed with boundary conditions \begin{eqnarray} &&|G(r=0)|<\infty,\\ &&\left.G\right|_{r^\prime+\epsilon}=\left.G\right|_{r^\prime-\epsilon},\\ &&\left.\partial_rG\right|_{r^\prime+\epsilon}-\left.\partial_rG\right|_{r^\prime-\epsilon}=4\pi ie\frac{\varkappa^2}{k},\\ &&G(r=a)=0, \end{eqnarray} where $a$ is the radius of the vacuum pipe. After some straightforward algebra, we find the amplitude of the electric field on-axis \begin{flalign} \left.G\right|_{r=0}=4\pi ier^\prime\frac{\varkappa^2}{k} \left[\frac{I_0(\varkappa r^\prime)K_0(\varkappa a)}{I_0(\varkappa a)}-K_0(\varkappa r^\prime)\right]. \end{flalign} The on-axis electric field caused by the space charge of all particles in the beam $E_{SC}$ can be found through the convolution of the particle distribution with the Green's function \begin{flalign} \nonumber &E_{SC}(r=0)=4\pi ie\frac{\varkappa^2}{k}\times\\ &\times\int\limits_0\limits^a\left[\frac{I_0(\varkappa r^\prime)K_0(\varkappa a)}{I_0(\varkappa a)}-K_0(\varkappa r^\prime)\right]\delta n(r^\prime)r^\prime d r^\prime. \label{solution:Ez} \end{flalign} Equation (\ref{solution:Ez}) is similar to the description of space charge in beams using impedance \cite{Chao, JammieZ, CERN_SC, Venturini} since the induced electric field is proportional to particle density, {\it i.e.} current. The similarities and differences are described in details in Sec.~\ref{sec:stationary}. \subsection{Dielectric permittivity} The polarization density is proportional to the electric field, $E_{SC}\propto E_z$, as follows from Eq.~(\ref{linear1}) and Eq.~(\ref{solution:Ez}). That allows to introduce the effective dielectric permittivity for the medium \begin{flalign} \label{epsilon} \epsilon_{||}&=\frac{E_z+E_{SC}}{E_z} =1-\frac{\tilde{\omega}_p^2}{(\omega-k\beta_0c)^2},\\ \tilde{\omega}_p^2&=\varkappa^2\int\limits_0\limits^a\left[K_0(\varkappa r)-\frac{I_0(\varkappa r)K_0(\varkappa a)}{I_0(\varkappa a)}\right] \omega_p^2(r) rdr, \label{omegapeff} \end{flalign} where $\omega_p(r)=\sqrt{4\pi e^2n_0(r)/(\gamma_0^3m)}$ is the relativistic plasma frequency of the beam. Equation (\ref{epsilon}) shows that the dielectric permittivity of the beam has the same functional dependence as of a uniform plasma. At the same time, the effective plasma frequency $\tilde{\omega}_p$ depends on the geometry of the problem: beam pipe radius, beam density distribution and the effective transverse wavelength of modulation $\varkappa$. Note that presence of a pipe always results in the reduced value for the effective plasma frequency since the second term in brackets in Eq.~(\ref{omegapeff}) (the term which depends on the pipe radius $a$) is always negative. The effective plasma frequency can be significantly smaller than the characteristic on-axis plasma frequency $\omega_p(0)$ in case of a long wavelength modulation. That reflects the fact that the space charge field is mostly transverse in this case and longitudinal particle interaction is strongly reduced compared to 1D case. The effective plasma frequency can be complex if the resulting system is unstable ({\it e.g.} self-modulation or two-stream instability). \subsection{Applicability limits} As discussed above, the results for the description of collective space charge effects using dielectric permittivity (\ref{epsilon}) are strictly valid only when the the longitudinal electric field is transversely uniform across the beam. That is achieved in the limit $\varkappa r_b\ll1$. In general case, extending findings beyond that limit is not appropriate. For example, consider a short wavelength longitudinal space charge wave excited in such a beam. To first order, the excited space charge wave follows the local dispersion relation $\epsilon_{||}(r)=0$. The frequency of the longitudinal wave parametrically depends on radius. That causes dephasing between waves at different transverse locations. Transverse mixing of particles causes destructive interference of the waves resulting in Landau damping \cite{Chao}. Moreover, longitudinal and transverse dynamics are parametrically coupled, which can result in the parametric instability \cite{parametric}. However, the application of longitudinal permittivity of the beam can be cautiously extended into the regime, where $\varkappa r_b\gtrsim1$. Equation (\ref{epsilon}) can be used as an estimate for the permittivity on axis. This formalism can be used if transverse mixing of particles in the beam is limited. For example, it can be achieved in a laminar flow or when the beta function of the beam is the largest scale for the beam dynamics ({\it e.g.} it is larger than the growth rate of the resulting instability). In addition, plasma or beams can be strongly magnetized so that the gyroradius of particles is much smaller than their transverse sizes. Not that solution for the Maxwell equations described with Eq.~(\ref{solution:Ez}) is obtained without any assumptions for electrostatic limits for the space charge fields. It is valid at any frequencies and wavenumbers, even for superluminal waves having phase velocity larger than the speed of light. In this case the transverse wavevector $\varkappa$ is imaginary and the modified Bessel functions $I_0$ and $K_0$ of imaginary arguments can be rewritten as regular Bessel functions $J_0$ and $Y_0$ of real arguments. \section{Limiting cases} \label{sec:cases} In this section we present several important limiting cases which often serve as baseline models in various studies. The effective plasma frequency can be found explicitly for some beam profiles. The results are presented in Table~\ref{table:free}. In that table $\omega_{p0}\equiv\omega_p(r=0)$ is the on-axis plasma frequency, $I=\int en(r)\beta_0 cd^2r$ is full current of the beam, $I_a=mc^3/e\approx 17\,kA$ is Alfven current, $\Gamma(0,x)$ is the upper incomplete gamma function, and $\gamma_E\approx0.5772$ is Euler–Mascheroni constant. The results for the constant density distribution \cite{VacuumOmegap,microbunching, Venturini} and Gaussian beam profile \cite{SCGaussian, Venturini} reproduce the results reported in the literature. \begin{widetext} \onecolumngrid \begin{table}[h] \begin{ruledtabular} \caption{Effective plasma frequency for beams with different density distributions} \label{table:free} \begin{tabular}{llll} {\bf Density distribution}& ${\bf \tilde{\omega}_p^2/\omega_{p0}^2},\;\;\;\forall\,\varkappa a,\varkappa r_b$& $\displaystyle {\bf\tilde{\omega}_p^2/\left(\frac{I}{I_a}\frac{\varkappa^2c^2}{\beta_0 \gamma_0^3}\right)},\;\;\;1/a\ll\varkappa \ll1/r_b$\\ \hline $\displaystyle n(r)=n_0,\;\;\;r\leq r_b$ & $\displaystyle 1-{\varkappa r_b}\left(K_1\left({\varkappa r_b}\right)+\frac{I_1(\varkappa r_b)K_0(\varkappa a)}{I_0(\varkappa a)}\right)$& $-2\ln\left({\varkappa r_b}/2\right)+1-2\gamma_E$\\ $\displaystyle n(r)=n_0\left(1-\frac{r^2}{r_b^2}\right)$& $\displaystyle 1-4\left({\varkappa r_b}\right)^{-2}+2K_2\left({\varkappa r_b}\right)-\frac{2I_2(\varkappa r_b)K_0(\varkappa a)}{I_0(\varkappa a)}$& $-2\ln\left({\varkappa r_b}/2\right)+1.5-2\gamma_E$\\ $\displaystyle n(r)=n_0\exp\left(-\frac{r^2}{2\sigma_r^2}\right)$ & $\displaystyle \frac{\varkappa^2\sigma_b^2}{2}\exp\left(\frac{\varkappa^2\sigma_b^2}{2}\right)\left[\Gamma\left(0,\frac{\varkappa^2\sigma_b^2}{2}\right)-2\frac{K_0(\varkappa a)}{I_0(\varkappa a)}\right]$& $-2\ln\left({\varkappa\sigma_r}/2\right)-\gamma_E$\\ \end{tabular} \end{ruledtabular} \end{table} \twocolumngrid \end{widetext} \subsection{Quasi-stationary waves in beam frame} \label{sec:stationary} Equation (\ref{solution:Ez}) essentially describes on-axis space charge impedance of the beam, $E_z(\omega,k)=Z(\omega,k)I(\omega,k)$. However, the result seem to be different from what is reported in the literature \cite{CERN_SC, JammieZ, Venturini}. The difference comes from source for the electric field being a space charge wave rather than a moving particle. Moving particles can be viewed as a space charge wave, which is stationary in the beam frame. That wave has the dispersion relation in the lab frame $\omega=\beta c k$. As a result, the transverse wavenumber defined in Eq.~(\ref{kappa}) is equal to $\varkappa=k/\gamma_0$ and conventional results for the space charge impedance in beams are recovered. This approximation can be used if relevant dynamics can be approximated as a quasi-static process in the beam frame ({\it e.g.} \cite{microbunching,Carlsten2Stream,Jamie2Stream,RamanFEL,Tajima}). The exact condition for this approximation is for the phase velocity of the wave in the beam frame to be much slower than the speed of light. The phase velocity of the wave in the beam frame can be found through Lorentz transform of the wave 4-vector \begin{equation} \varkappa\approx\frac{k}{\gamma},\;\;\;\;\;\;\;\;\;\;\; \left|\frac{\omega^\prime}{k^\prime c}\right|=\left|\frac{\omega-\beta k c}{kc-\beta\omega}\right|\ll1, \end{equation} where $\omega^\prime$ and $k^\prime$ are the wave frequency and wavenumber in the beam frame, respectively. \subsection{Beam in free space} In this limit the pipe is considered to be so wide that its effect on the beam is not relevant. This limit can be achieved for small enough wavelengths of the modulation, $\varkappa a\gg 1$. This condition allows us to simplify Eq.~(\ref{omegapeff}) for the effective plasma frequency of the beam since the effect of the vacuum pipe becomes negligible, $K_0(\varkappa a)/I_0(\varkappa a)\ll1$ \begin{equation} \label{free1} \tilde{\omega}_p^2=\varkappa^2 \int\limits_0\limits^\infty \omega_p^2(r)K_0\left({\varkappa r}\right)r\,dr, \end{equation} The beam susceptibility in the long wavelength limit $\varkappa r_b\ll1$ is proportional to the overall beam current (last column in Table~\ref{table:free}). Beams with identical currents but different distribution of current in the cross section have similar scaling of the effective plasma frequency, $\tilde{\omega}_p^2\propto \varkappa^2$. At the same time, the numerical pre-factor in the scaling depends on the beams profile, and may vary for moderate ratios of wavelength and beam size, $\ln(\varkappa r_b)\sim 1$. The beam susceptibility in the short wavelength limit $\varkappa r_b\gg1$ recovers 1D limit of uniform plasma since \begin{equation} \tilde{\omega}_p^2\approx\omega_{p0}^2\varkappa^2\int\limits_0\limits^\infty K_0(\varkappa r)rdr=\omega_{p0}^2. \end{equation} The effective plasma frequency for different beam profiles is presented in Fig.~\ref{fig:free}. The effective plasma frequency matches the 1D solution at small wavelengths, $\tilde{\omega}_p\approx\omega_p$ at $\varkappa r_{rms}\gg1$. The effective plasma frequency reduces while the wavelength of modulation increases. It is a universal scaling that follows from the 2D geometry of the problem. The distributions presented in Fig.~\ref{fig:free} have identical on-axis density and identical root mean square (rms) radii, $r_{rms}^2=\int r^2n(r) rdr/\int n(r) rdr$. Beams with different profiles have the same effective plasma frequency in the 1D limit $\varkappa r_{rms}\gg1$ but have somewhat different effective plasma frequencies at long wavelengths, $\varkappa r_{rms}\ll1$, since their total currents are different from each other. \begin{figure}[ht] \center \includegraphics[width=0.45\textwidth]{free_profiles.pdf} \caption{The effective plasma frequency for the flattop (blue), parabolic (red), and Gaussian (green) beam profiles with identical on-axis density and rms radii.} \label{fig:free} \end{figure} \subsection{Long wavelength limit} In this limit the effective transverse wavelength of the modulation is much larger compared to the pipe radius, $\varkappa a\ll 1$. The size of the beam is smaller that the pipe radius, so $\varkappa r\ll1$ as well. The details in the transverse beam distribution are not important in this regime and one can approximate the beam with any test distribution. We choose the beam to have a flattop distribution of density for the simplicity of following derivations. Then the integrals in Eq.~(\ref{omegapeff}) can be evaluated using asymptotic expansions for the functions in the kernel and we find \begin{eqnarray} \nonumber \tilde{\omega}^2_p&\approx&\int\limits_0\limits^{r_b} \left[K_0(\varkappa r)-K_0(\varkappa a)\right]\omega_{p0}^2 r dr\approx\\ &\approx&\frac{\varkappa^2r_b^2}{2}\left[\ln\left(\frac{a}{r_b}\right)+\frac{1}{2}\right]\omega_p^2(0). \label{longfinal} \end{eqnarray} The result matches precisely the one reported in the literature \cite{Chao}. \section{Generalization of results} \subsection{Kinetic effects} The model can be easily expanded to include finite longitudinal energy spread in the beam. This can be done using the kinetic equation for particle distribution in phase space, $f(r,v_z)=n(r)f_0(v_z)$, same way it is typically done for homogeneous plasma. The fluid equations of motion (\ref{fluid1}) --- (\ref{fluid2}) but do not affect the expression for the resulting electric field Eq.~(\ref{solution:Ez}) which can be viewed as a modification to the Laplace equation to include 2D geometry of the beam. Then the longitudinal dielectric permittivity of the beam including kinetic effects can be described as \begin{equation} \epsilon_{||}=1+\frac{\tilde{\omega}_p^2}{k}\int\limits_L\frac{\partial_{v_z} f_0(v_z)}{\omega-kv_z}dv_z, \end{equation} where $f_0(v)$ is particle distribution in velocity, and $L$ indicates integration over Landau contour. This expression is valid for quasi-mono-energetic beams which only have non-relativistic particles in the beam frame, $\gamma_0^3 |\beta_0\delta\Delta\beta|\ll1$. \subsection{Multiple species of particles} The resulting expression for the beam permittivity can be easily modified to include other beams or the background plasma. Multiple species of particles ({\it e.g.} beams of particles with different masses, charges, or average velocities) can be included as additive terms to the dielectric permittivity. Dielectric susceptibility for each specie describes the polarization of that beam in response to the external electric field $E_z$. The external electric field is identical for each specie, so its polarization does not depend on whether other types of particles are present. At the same time, the dielectric displacement $D_z$ includes polarization from each type of particles present in the system \begin{equation} \epsilon_{||}=1-\sum\limits_\alpha \frac{\tilde{\omega}_{p\alpha}^2}{(\omega-k\beta_\alpha c)^2}, \end{equation} where summation carries over all species $\alpha$ present in the system. Note that the effective plasma frequency for each specie $\tilde{\omega}_{p\alpha}$ should be calculated using the same transverse wavenumber $\varkappa=\sqrt{k^2-\omega^2/c^2}$ regardless of the energy of each specie. As a result, different species of particles may fall into different limiting cases described in Sec.~\ref{sec:cases}. For example, analysis of beam-cloud instability for the beam propagating through background plasma may result in dielectric susceptibility for the beam being well approximated in the ``free space long wavelength'' limit ($\varkappa r_b\ll1$) while dielectric susceptibility for the background plasma being well approximated in the ``1D'' limit ($\varkappa a\gg1$). \section{Sample problem: two stream instability} Several groups have proposed to use two-stream instability for beam bunching in vacuum electronics \cite{Carlsten2Stream, Iran2Stream} or relativistic electron beams \cite{Jamie2Stream,SingleBunch}. That scheme requires presence of electrons with two or more distinct energies co-propagating inside a focusing channel. The kinetic instability similar to the conventional two-stream instability in plasma develops, which results in beam bunching. The analysis of those schemes is typically done in 1D geometry under assumption that the wavelength of modulation in the beam frame is much smaller than the transverse beam size. However, this approximation is not valid in most relativistic cases \cite{Jamie2Stream,SingleBunch}. The transverse beam profile also needs to be accounted for if more complicated geometry of beams is used \cite{{AnnularGun}}. We consider two beams with close velocities $\beta_1$ and $\beta_2$ co-propagating along a focusing channel. Velocities of these beams are close to each other, so that \begin{eqnarray} &&\bar{\beta}=(\beta_1+\beta_2)/2,\\ &&\Delta=c(\beta_1-\beta_2)/2=\frac{E_1-E_2}{mc}\frac{1}{2\bar{\beta}\gamma^3}\ll c\bar{\beta}. \end{eqnarray} We consider two beams to have identical transverse density profiles and currents for simplicity. The 1D analysis of the instability \cite{Carlsten2Stream,Jamie2Stream} suggests rough scaling for the growth rate of the instability $Im(\omega^\prime)=\gamma Im(\omega-k\beta c)\sim\omega_p$ and the wavenumber for the fastest growing mode $k^\prime=\gamma(k-\beta\omega/c)\sim\omega_p/\gamma^2 (E_1+E_2)/(E_1-E_2)$. As a result, the unstable wave can be viewed as quasi-stationary in the beam frame as discussed in Sec.~\ref{sec:stationary}. The effective plasma frequency depends only on wavelength of modulation since $\varkappa\approx k/\gamma$ in this regime. The dielectric permittivity for the system of two beams can be found as the additive contribution of two individual beams \begin{equation} \epsilon_{||}=1-\frac{\tilde{\omega}_p^2}{(\omega-k\bar{\beta}c-k\Delta)^2}-\frac{\tilde{\omega}_p^2}{(\omega-k\bar{\beta}c+k\Delta)^2}. \end{equation} We search for the electrostatic plasma waves, which can be supported by this dielectric medium. The electrostatic modes satisfy the dispertion relation $\epsilon_{||}=0$. We introduce the frequency $\Omega=\omega-k\bar{\beta} c$, which describes time evolution in a frame co-moving with average beam velocity. Then this frequency can be found to be \begin{equation} \label{Omega} \Omega^2=\tilde{\omega}_p^2+k^2\Delta^2\pm\sqrt{\tilde{\omega}_p^4+4\tilde{\omega}_p^2k^2\Delta^2}. \end{equation} In the dispersion relation described with Eq.~(\ref{Omega}), the branch with the minus sign, corresponds to the unstable mode. The instability occurs at large enough wavelengths, $k^2\Delta^2<2\tilde{\omega}_p^2$ . However, the effective plasma frequency scales with the wavenumber. In fact, the vacuum pipe strongly suppresses large wavelength modes. We use the expression (\ref{longfinal}) for the effective plasma frequency to find the condition for the two stream instability to develop \begin{equation} \label{unstablecondition} \frac{E_1-E_2}{mc^2}<\sqrt{16\beta\gamma\frac{I}{I_a} \left[\ln\left(\frac{a}{r_b}\right)+\frac{1}{2}\right] }. \end{equation} If the beams are not intense enough or their energies are not sufficiently close to each other, then the two-stream instability does not develop. The maximum growth rate for the two-stream instability can be found ($\partial_{k^2}\Omega^2=0$) if the beams are intense enough: \begin{eqnarray} \label{kmax} &&\left[\sqrt{1+4\frac{k^2\Delta^2}{\tilde{\omega}_p^2}}-1-2\frac{k^2\Delta^2}{\tilde{\omega}_p^2}\right]\frac{\partial_{k^2}\tilde{\omega}_p^2}{\Delta^2}=\\ &&=2-\sqrt{1+4\frac{k^2\Delta^2}{\tilde{\omega}_p^2}}. \end{eqnarray} In the 1D limit the condition for the fastest growing mode reduces to $k^2\Delta^2=3/4\tilde{\omega}_{p0}^2$ since the effective plasma frequency does not depend on the wavelength as illustrated in Fig.~\ref{fig:free}. This result matches findings of other studies \cite{Jamie2Stream}. The 2D effects need to be accounted for when the wavelength of modulation in the beam frame is comparable or larger than the beam radius, $kr_b/\gamma\sim1$. At the same time, the effect of the pipe wall is small far enough from the threshold condition (\ref{unstablecondition}) and the beam can be approximated as propagating in free space. We approximate he beams to have flattop distribution of density and use expression for the plasma wave presented in Table~\ref{table:free}. Then the fastest growing mode and the growth rate of instability $Im(\Omega)$ can be found as solutions of the following transcendental equation \begin{flalign} \nonumber &\frac{p^2}{2}K_0(p\kappa)\left[\sqrt{1+\frac{4\kappa^2}{1-p\kappa K_1(p\kappa)}}-1-2\kappa^2\right]=\\ &\;\;\;\;\;\;\;2-\sqrt{1+\frac{4\kappa^2}{1-p\kappa K_1(p\kappa)}},\\ \nonumber &\frac{\Omega^2}{\omega_{p0}^2}=1-p\kappa K_1(p\kappa)+\kappa^2-\\ &\;\;\;\;\;\;\;-\sqrt{(1-p\kappa K_1(p\kappa))^2+4\kappa^2(1-p\kappa K_1(p\kappa)}, \end{flalign} where \begin{equation} \kappa=\frac{k\Delta}{\omega_{p0}},\;\;\;\;\;\;\;p=\frac{r_b\omega_{p0}}{\gamma\Delta}=\frac{mc^2}{E_1-E_2}\sqrt{16\beta\gamma\frac{I}{I_a}}. \end{equation} \begin{figure}[ht] \center \includegraphics[width=0.450\textwidth]{kmax.pdf} \includegraphics[width=0.450\textwidth]{growth_rate.pdf} \caption{Wavenumber for the fastest growing mode (upper plot) and its growth rate (bottom plot) for different beam intensities.} \label{fig:2stream} \end{figure} The scaled wavenumber for the fastest growing mode $\kappa$ depends on a single parameter $p$, which describes the intensity of the beam. Note that the scaled intensity of the beam cannot be significantly smaller than unity for realistic beam and pipe radii as described by inequality (\ref{unstablecondition}). The plots for the wavenumber of the fastest growing mode and its growth rate are presented in Fig.~\ref{fig:2stream}. The results show a soft threshold for the instability at $p\approx 0.5$, which is not significantly different than the threshold described with Eq.~(\ref{unstablecondition}) due to presence of the pipe for realistic beam and pipe parameters in accelerators. The wavenumber for the fastest growing mode $\kappa\approx\sqrt{3/4}$ essentially matches the 1D result for intense enough beams, $p>2$. The growth rate of the instability also approaches 1D result $\Omega^2=-\omega_{p0}^2/4$ when the intensity of the beam increases. In general case, the solution for the growth rate in two-stream instability is valid at large wavelengths, $p\kappa\ll1$ so that the electric field caused by the space charge is transversely uniform. However, the analysis in the short wavelength regime is valid if the growth length of the instability is much smaller than the beam beta function (characteristic length for beam defocusing). \section{Summary} \label{sec:conclusion} We have developed a general formalism describing longitudinal space charge effects in beam-plasma systems. The self-consistent dynamics can be described in terms of effective longitudinal dielectric permittivity of the medium, which describes the response of the medium to the external space charge wave. The permittivity has a functional dependence matching the 1D plasma permittivity. The entire effect of the geometry (transverse density profile and presence of the conducting cylindrical wall) results in the effective plasma frequency being different from the 1D plasma frequency. The effective plasma frequency is described with Eq.~(\ref{omegapeff}). The developed formalism provides a universal framework for studying longitudinal dynamics in various beam-plasma systems. Multiple species such as background plasma, beams with different energies, and different types of charged particles can be included in the analysis simultaneously as additive terms to the dielectric permittivity of the medium. Each of these species may have unique transverse profiles. Inclusion of kinetic effects is a straightforward generalization similar to the case of 1D plasma. A particle beam propagating through plasma affects the background density distribution and generates return current. These effects can also be included in the developed framework through introduction of additional particle species, which describe the return current and modified density profile. \section{Acknowledgements} Authors are thankful to Petr Anisimov, Stanislav Baturin, Trevor Burris-Mog, Dima Mozyrsky, Derek Neben, and Vitaly Pavlenko for fruitful discussions. Work supported by the US Department of Energy under contract number DE-AC52-06NA25396.
\section{Introduction} In this paper, we use the Renewal Theorem of Kesseb\"ohmer and Kombrink \cite{kess-kom} to establish counting and equidistribution results for well-behaved potentials on topologically mixing countable Markov shifts with (BIP) in the spirit of Lalley's work \cite{lalley} on finite Markov shifts. Inspired by work of Schapira-Tapie \cite{schapira-tapie,schapira-tapie-counting}, Dal'bo-Otal-Peign\'e \cite{DOP}, Iommi-Riquelme-Velozo \cite{IRV} and Velozo \cite{velozo} in the setting of geodesic flows on negatively curved Riemannian manifolds, we define notions of entropy gap at infinity for our potentials. Our results require that the potentials are non-arithmetic, eventually positive and have an entropy gap at infinity. Our main motivation for this general analysis was provided by cusped Hitchin representations of a geometrically finite Fuchsian group into $\mathsf{SL}(d,\mathbb R)$. Given a linear functional $\phi$ on the Cartan algebra $\mathfrak{a}$ of $\mathsf{SL}(d,\mathbb R)$ which is a positive linear combination of simple roots, we can define the $\phi$-translation length $\ell^\phi(A)=\phi(\ell(A))$ (where $\ell$ is the Jordan projection) for $A\in\mathsf{SL}(d,\mathbb R)$. The first consequence of the general theory we develop is that if $\rho$ is cusped Hitchin, then $$\#\big\{[\gamma]\in [\Gamma]\ |\ 0<\ell^\phi(\rho(\gamma))\le t\big\}\sim\frac{e^{t\delta}}{t\delta}$$ where $\delta=\delta_\phi(\rho)$ is the $\phi$-entropy of $\rho$ (and $[\Gamma]$ is the collection of conjugacy classes of elements of $\Gamma$.) We also obtain a Manhattan curve theorem and equidistribution results in this context. In later work, we plan to use these results to construct pressure metrics on cusped Hitchin components. A longer term goal is the development of a geometric theory of the augmented Hitchin component which parallels the study of the augmented Teichm\"uller space as the metric completion of Teichm\"uller space with the Weil-Petersson metric (see Masur \cite{masur-wp}). \medskip {\bf General Thermodynamical results:} We now give more precise statements of our general results. We assume throughout that $(\Sigma^+,\sigma)$ is a topologically mixing, one-sided, countable Markov shift with alphabet $\mathcal A$ which has the big images and pre-images property (BIP). Moreover, all of our functions will be assumed to be locally H\"older continuous (see Section \ref{countable background} for precise definitions). We now introduce the crucial assumptions we will make in our work. Given a locally H\"older continuous function $f:\Sigma^+\to\mathbb R$ and $a\in\mathcal A$, we let $$I(f,a)=\inf\big\{ f(x)\ |\ x\in\Sigma^+, x_1=a\big\}\qquad\mathrm{and}\qquad S(f,a)=\sup\big\{ f(x)\ |\ x\in\Sigma^+, x_1=a\big\}.$$ Note that $I(f,a)$ and $S(f,a)$ are finite since $f$ is locally H\"older continuous. We say that $f$ has a {\em strong entropy gap at infinity} if the series $$Z_1(f,s)=\sum_{a\in\mathcal A} e^{-sS(f,a)}$$ has a finite critical exponent $d(f)>0$ and diverges when $s=d(f)$. We say that $f$ has a {\em weak entropy gap at infinity} if $Z_1(f,s)$ has a finite critical exponent $d(f)>0$ and there exists $\delta=\delta(f)>d(f) >0$ so that $P(-\delta f)=0$ where $P$ is the Gurevich pressure function associated to $(\Sigma^+,\sigma)$ (defined in Section \ref{countable background}). We will see later (in Section \ref{entropy gaps}), that a strong entropy gap at infinity implies a weak entropy gap at infinity. We say that $f$ is {\em strictly positive} if $c(f)=\inf\{f(x)\ |\ x\in\Sigma^+\}>0$. We say that $f$ is {\em eventually positive} if there exist $N\in\mathbb N$ and $B>0$ so that $$S_nf(x)=f(x)+f(\sigma(x))+\cdots+f(\sigma^{n-1}(x))>B$$ for all $n\ge N$ and $x\in\Sigma^+$. Recall that $f$ is {\em arithmetic} if the subgroup of $\mathbb R$ generated by $\{ S_nf(x)\ | \ x\in \text{Fix}^n,\ n\in\mathbb N\}$ is cyclic, where $x\in\text{Fix}^n$ if $\sigma^n(x)=x$. We begin by stating our general counting results. For all $n\in\mathbb N$, let $$\mathcal M_f(n,t)=\{x\in\Sigma^{+}:\ x\in\mathrm{Fix}^{n}\ \mathrm{and\ }S_{n} f(x)\leq t\}\ \ \mathrm{and\ let}\ \ M_f(t)=\sum_{n=1}^\infty \frac{1}{n} \#\mathcal M_f(n,t).$$ \begin{thmx}[Growth rate of closed orbits]\label{thm:countingN} Suppose that $(\Sigma^+,\sigma)$ is a topologically mixing, one-sided, countable Markov shift which has (BIP). If $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, non-arithmetic, eventually positive and has a weak entropy gap at infinity, and $P(-\delta f)=0$, then $${\displaystyle \lim_{t\to\infty}M_f(t)\frac{t\delta}{e^{t\delta}}}=1.$$ \end{thmx} Similarly, for all $k\in\mathbb N$, let $$\mathcal R_f(k,t)=\{ x\in\mathcal M_f(k,t)\ | \ x\notin \mathcal M_f(n,t)\ \mathrm{if}\ n<k\}\ \ \mathrm{and\ let}\ \ R_f(t)=\sum_{k=1}^\infty\frac{1}{k} \#\mathcal R_f(k,t).$$ If $x\in\mathcal M_f(n,t)-\mathcal R_f(n,t)$, then there exists $j\ge 2$ so that $x\in \mathcal M_f(\frac{n}{j},\frac{t}{j})$, so $$M_f(t)-M_f\left(\frac{t}{2}\right)\leq R_f(t)\leq M_f(t).$$ Therefore, the following result is an immediate corollary of Theorem \ref{thm:countingN}. \begin{cor}[Growth rate of closed prime orbits] \label{cor:counting closed} Suppose that $(\Sigma^+,\sigma)$ is a topologically mixing, one-sided, countable Markov shift which has (BIP). If $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, non-arithmetic, eventually positive and has a weak entropy gap at infinity, and $P(-\delta f)=0$, then \[ \lim_{t\to\infty}R_f(t)\frac{t\delta}{e^{t\delta}}=1. \] \end{cor} If $f$ is strictly positive, let $\Sigma_f$ be the suspension flow of $f$. In this setting, we obtained a generalized form of Bowen's formula for the critical exponent. Let $\mathcal O_f$ be the collection of closed orbits of $\Sigma_f$ and let $$\mathcal O_f(t)=\{\lambda \ |\ \ell_f(\lambda)\le t\}$$ where $\ell_f(\lambda)$ is the period of $\lambda$. Notice that $\#\mathcal O_f(t)=M_f(t)$, since if $\lambda\in\mathcal O_f(t)$, then there exists $x\in\text{Fix}^n$ for some $n$, so that $S_nf(x)=\ell_f(\lambda)$ and $x$ is well-defined up to cyclic permutation. Lemma \ref{eventually to strictly} implies that every eventually positive locally H\"older continuous function (in our setting) is cohomologous to a strictly positive locally H\"older continuous function, so we are always free to interpret our results from this viewpoint. \begin{cor} [Bowen's formula] Suppose that $(\Sigma^+,\sigma)$ is a topologically mixing, one-sided, countable Markov shift which has (BIP). If $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, non-arithmetic, strictly positive, has a weak entropy gap at infinity and $P(-\delta f)=0$, then \[ \delta=\lim_{t\to\infty}\frac{1}{t}\log\#\mathcal O_f(t). \] \end{cor} If $f:\Sigma^+\to\mathbb R$ and $g:\Sigma^+\to\mathbb R$ are two strictly positive locally H\"older continuous functions, then there is a natural identification of the set $\mathcal O_f$ of closed orbits of $\Sigma_f$ and the set $\mathcal O_g$ of closed orbits of $\Sigma_g$. If $f$ is strictly positive and has a weak entropy gap at infinity so that $P(-\delta f)=0$, then the equilibrium state for $-\delta f$ induces a measure of maximal entropy on the suspension flow on $\Sigma_f$. We obtain an equidistribution result for this equilibrium state which roughly says that it behaves like a Patterson-Sullivan measure. In the following theorem, if $\phi$ and $\psi$ are real-valued functions, we say that $$\phi\sim\psi\qquad\mathrm{if}\qquad \lim_{t\to\infty}\frac{\phi(t)}{\psi(t)}=1.$$ \begin{thmx}[Equidistribution] \label{thm:equid_roof} Suppose that $(\Sigma^+,\sigma)$ is a topologically mixing, one-sided, countable Markov shift which has (BIP) and $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, non-arithmetic, eventually positive, has a weak entropy gap at infinity, $P(-\delta f)=0$ and $\mu_{-\delta f}$ is the equilibrium state for $-\delta f$. If $g:\Sigma^+\to\mathbb R$ is locally H\"older continuous, eventually positive, and there exists $C>0$ such that $$|f(x)-g(x)|<C$$ for all $x\in\Sigma^+$, then \[ \sum_{k=1}^{\infty}\frac{1}{k}\sum_{x\in \mathcal M_f(k,t)}\frac{S_k g(x)}{S_k f(x)}\sim\left(\frac{\int g \ d\mu_{-\delta f}}{\int f\ d\mu_{-\delta f}}\right)\cdot\frac{e^{t\delta}}{t\delta} \] as $t\to\infty$. If $f$ and $g$ are strictly positive, then \[ \sum_{\gamma\in\mathcal O_f(t)}\frac{l_{g}(\gamma)}{l_{f}(\gamma)}\sim\left(\frac{\int g\ d\mu_{-\delta f}}{\int f\ d\mu_{-\delta f}}\right)\cdot\frac{e^{t\delta}}{t\delta} \] as $t\to\infty.$ \end{thmx} We can obtain a completely analogous statement if we instead consider the set $\mathcal P_f$ of primitive closed orbits of the suspension flow $\Sigma_f$. Suppose that $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, eventually positive, and has a strong entropy gap at infinity and that $g:\Sigma^+\to\mathbb R$ is also eventually positive and locally H\"older continuous, and that there exists $C>0$ so that $|f(x)-g(x)|<C$ for all $x\in\Sigma^+$. (Notice that this implies that $d(f)=d(g)$.) Inspired by Burger \cite{burger}, we define, the {\em Manhattan curve} $$\mathcal C(f,g)=\{ (a,b)\in \mathbb R^2\ | \ P(-af-bg)=0\ \ a\ge 0, \ b\ge 0,\ a+b> 0\}.$$ The Manhattan curve has the following properties. \begin{thmx}[Manhattan curve] \label{Manhattan curve} Suppose that $(\Sigma^+,\sigma)$ is a topologically mixing, one-sided countable Markov shift with (BIP), $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, eventually positive and has a strong entropy gap at infinity and that $g:\Sigma^+\to\mathbb R$ is also eventually positive and locally H\"older continuous. If there exists $C>0$ so that $|f(x)-g(x)|<C$ for all $x\in\Sigma^+$, then \begin{enumerate} \item $(\delta(f),0),\ (0,\delta(g))\in \mathcal C(f,g)$. \item If $a\ge 0$, $b\ge 0$, and $a+b> 0$, then there exists a unique $t>\frac{d(f)}{a+b}$ so that $(ta,tb)\in\mathcal C(f,g)$. \item $\mathcal C(f,g)$ is a closed subsegment of an analytic curve. \item $\mathcal C(f,g)$ is strictly convex, unless $$S_nf(x)=\frac{\delta(g)}{\delta(f)} S_n g(x)$$ for all $x\in\mathrm{Fix}^n$ and $n\in\mathbb N$. \end{enumerate} Moreover, the tangent line to $\mathcal C(f,g)$ at $(a,b)\in\mathcal C(f,g)$ has slope $$s(a,b)=-\frac{\int_{\Sigma^+}g\ d\mu_{-af-bg}}{\int_{\Sigma^+} f\ d\mu_{-af-bg}}$$ where $\mu_{-af-bg}$ is the equilibrium state of the function $-af-bg$. \end{thmx} \medskip\noindent {\bf Applications to cusped Hitchin representations:} Let $S=\mathbb H^2/\Gamma$ be a geometrically finite, hyperbolic surface, and let $\Lambda(\Gamma)\subset \partial\mathbb H^2$ be the limit set of $\Gamma\subset\mathsf{PSL}(2,\mathbb R)$. Following Fock and Goncharov \cite{fock-goncharov}, a {\em cusped Hitchin representation} is a representation $\rho:\Gamma\to \mathsf{SL}(d,\mathbb R)$ such that if $\gamma\in\Gamma$ is parabolic, then $\rho(\gamma)$ is a unipotent element with a single Jordan block and there exists a $\rho$-equivariant positive map $\xi_\rho:\Lambda(\Gamma)\to\mathcal F_d$. If $S$ is compact, cusped Hitchin representations are just the traditional Hitchin representations introduced by Hitchin \cite{hitchin} and further studied by Labourie \cite{labourie-invent}, while if $\Gamma$ is convex cocompact, they are the Hitchin representations studied by Labourie-McShane \cite{labourie-mcshane}. As these are covered by the traditional theory of Anosov representations, we will focus on the case where $\Gamma$ is not convex cocompact. If $d=3$ and $S$ has finite area, then a cusped Hitchin representation is simply the holonomy map of a finite area strictly convex projective structure on $S$ (see Marquis \cite{marquis-surface}). More generally, if $\rho\colon\Gamma\to\sf{SL}(3,\mathbb R)$ acts geometrically finitely, in the sense of Crampon-Marquis \cite[Def. 5.14]{crampon-marquis}, on a strictly convex domain with $C^1$ boundary, then $\rho$ is cusped Hitchin by \cite[1.3. Thm.]{fock-goncharov}. Let $$\mathfrak{a}=\{ \vec a \in\mathbb R^d\ |\ a_1+\cdots+a_d=0\}$$ be the standard Cartan algebra for the Lie algebra $\mathfrak{sl}(d,\mathbb R)$ of $\mathsf{SL}(d,\mathbb R)$. If $T\in\mathsf{SL}(d,\mathbb R)$, let $$\lambda_1(T)\ge\cdots\ge\lambda_d(T)$$ be the (ordered) moduli of (generalized) eigenvalues of $T$ (with multiplicity). The Jordan (or Lyapunov) projection $$\ell:\mathsf{SL}(d,\mathbb R)\to\mathfrak{a}\ \ \mathrm{is\ given\ by}\ \ell(T)=(\log \lambda_1(T),\cdots,\log\lambda_d(T)).$$ For each $k=1,\ldots,d-1$, let $\alpha_k:\mathfrak{a}\to\mathbb R$ be given by $\alpha_k(\vec a)=a_k-a_{k+1}$ and let $$\Delta=\left\{\sum_{k=1}^{d-1} t_t\alpha_k\ |\ t_k\ge0\ \forall\ k\ \mathrm{and}\ t_k>0\ \mathrm{for\ some}\ k\right\}\subset\mathfrak{a}^*.$$ For example, if $\alpha_H$ is the Hilbert length functional given by $\alpha_H(\vec a)=a_1-a_d$, then $\alpha_H=\sum_{k=1}^{d-1}\alpha_k\in\Delta$. Similarly, if $\omega_1(\vec a)=a_1$, then $\omega_1=\sum_{k=1}^{d-1} \frac{d-k}{d}\alpha_k\in\Delta$. Given non-trivial $\phi\in\Delta$ and $T\in\mathsf{SL}(d,\mathbb R)$, we define the {\em $\phi$-translation length} $$\ell^\phi(T)=\phi(\ell(T)).$$ Let $(\Sigma^+,\sigma)$ be the Stadlbauer-Ledrappier-Sarig coding \cite{ledrappier-sarig,stadlbauer} (if $S$ has finite area) or Dal'bo-Peign\'e coding \cite{dalbo-peigne} (if not) of the recurrent portion of the geodesic flow on $T^1S$. It is topologically mixing and has (BIP). Moreover, it comes equipped with a map $$G:\mathcal A\to \Gamma$$ so that if $\gamma\in \Gamma$ is hyperbolic, then there exists $x=\overline{x_1\cdots x_n}\in\Sigma^+$ so that $G(x_1)\cdots G(x_n)$ is conjugate to $\gamma$. Moreover, $x$ is unique up to powers of $\sigma$. Given a cusped Hitchin representation $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ we will define a vector-valued roof function $\tau_\rho:\Sigma^+\to \mathfrak{a}$ with the property that if $x=\overline{x_1\cdots x_n}$ is a periodic element of $\Sigma^+$, then $$S_n\tau_\rho(x)=\tau_\rho(x)+\tau(\sigma(x))+\cdots+\tau_\rho(\sigma^{n-1}(x))=\ell\big(\rho(G(x_1)\cdots G(x_n))\big)$$ so $\tau_\rho$ encodes all the spectral data of $\rho(\Gamma)$. The following result allows us to use the general thermodynamical machinery we developed to study cusped Hitchin representations. \begin{thmx}[Roof functions] \label{Roof Properties} Suppose that $\Gamma$ is a torsion-free, geometrically finite Fuchsian group which is not convex cocompact, $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is a cusped Hitchin representation and $\phi\in\Delta$. Then there exists a locally H\"older continuous function $\tau_\rho^\phi=\phi\circ\tau_\rho:\Sigma^+\to\mathbb R$ such that \begin{enumerate} \item $\tau_\rho^\phi$ is eventually positive and non-arithmetic. \item If $x=\overline{x_1\cdots x_n}$ is a periodic element of $\Sigma^+$, then $$S_n\tau_\rho^\phi(x)=\ell^\phi\big(\rho(G(x_1)\cdots G(x_n))\big).$$ \item $\tau_\rho^\phi$ has a strong entropy gap at infinity. Moreover, if $\phi=a_1\alpha_1+\cdots+a_{d-1}\alpha_{d-1},$ then $$d(\tau_\rho^\phi)=\frac{1}{2(a_1+\cdots +a_{d-1})}.$$ \item If $\eta:\Gamma\to \mathsf{SL}(d,\mathbb R)$ is another cusped Hitchin representation, then there exists $C>0$ so that $$|\tau_\rho^\phi(x)-\tau_\eta^\phi(x)|\le C$$ for all $x\in\Sigma^+$. \end{enumerate} \end{thmx} We obtain a counting result for cusped Hitchin representations as an immediate consequence of Theorem \ref{thm:countingN}. \begin{cor} \label{cusped counting} If $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is a cusped Hitchin representation and $\phi\in\Delta$, then there exists a unique $\delta=\delta_\phi(\rho)$ so that $P(-\delta \tau_\rho^\phi)=0$, and $$\# \big\{[\gamma]\in[\Gamma]\ \big| \ 0<\ell^\phi(\rho(\gamma))\le t\big\}\sim \frac{e^{t\delta}}{t\delta}$$ as $t\to\infty$. \end{cor} We will refer to $\delta_\phi(\rho)$ as the {\em $\phi$-topological entropy} of $\rho$. If $\rho,\eta:\Gamma\to\mathsf{SL}(d,\mathbb R)$ are cusped Hitchin representations and $\phi\in\Delta$, we define the {\em Manhattan curve} $$\mathcal C^{\phi}(\rho,\eta)=\{ (a,b)\in \mathbb R^2 \ | \ P(-a\tau_\rho^{\phi}-b\tau_\eta^{\phi})=0,\ a\ge 0,\ b\ge 0,\ a+b>0\}.$$ Theorem \ref{Manhattan curve} immediately gives the following information about $\mathcal C^{\phi}(\rho,\eta)$. \begin{cor} \label{CuspedManhattan} If $\rho,\eta:\Gamma\to\mathsf{SL}(d,\mathbb R)$ are cusped Hitchin representations and $\phi\in\Delta$, then \begin{enumerate} \item $\mathcal C^{\phi}(\rho,\eta)$ is a closed subsegment of an analytic curve, \item the points $(\delta_{\phi}(\rho),0)$ and $(0,\delta_{\phi}(\eta))$ lie on $\mathcal C^{\phi}(\rho,\eta)$, \item and $\mathcal C^{\phi}(\rho,\eta)$ is strictly convex, unless $$\ell^{\phi}(\rho(\gamma))=\frac{\delta_\phi(\eta)}{\delta_\phi(\rho)}\ell^{\phi}(\eta(\gamma))$$ for all $\gamma\in\Gamma$. \end{enumerate} Moreover, the tangent line to $\mathcal C^{\phi}(\rho,\eta)$ at $(\delta_{\phi}(\rho),0)$ has slope $$s^{\phi}(\rho,\eta)=-\frac{\int \tau_\eta^{\phi} d{\mu}_{-\delta^{\phi}(\rho)\tau^{\phi}_\rho}}{\int \tau_\rho^{\phi}\ d{\mu}_{-\delta^{\phi}(\rho)\tau^{\phi}_\rho}} $$ \end{cor} We call $I^{\phi}(\rho,\eta)=-s^{\phi}(\rho,\eta)$ the {\em $\phi$-pressure intersection}. We also define the {\em renormalized \hbox{$\phi$-pressure} intersection} by $$J^{\phi}(\rho,\eta)=\frac{\delta_{\phi}(\eta)}{\delta_{\phi}(\rho)}I^{\phi}(\rho,\eta).$$ As a further corollary of Theorem \ref{Manhattan curve} we obtain the following rigidity result for renormalized pressure intersection. This corollary will later play a key role in our forthcoming construction of pressure metrics on the space of cusped Hitchin representations. \begin{cor} \label{intersection rigidity} If $\rho,\eta:\Gamma\to\mathsf{SL}(d,\mathbb R)$ are cusped Hitchin representations and $\phi\in\Delta$, then $$J^{\phi}(\rho,\eta)\ge 1$$ with equality if and only if $$\ell^{\phi}(\rho(\gamma))=\frac{\delta_\phi(\eta)}{\delta_\phi(\rho)}\ell^{\phi}(\eta(\gamma))$$ for all $\gamma\in\Gamma$. \end{cor} As a corollary of Theorem \ref{thm:equid_roof} we obtain the following geometric interpretation of the pressure intersection. Let $$R_T^\phi(\rho)= \big\{[\gamma]\in[\Gamma]\ \big| \ 0< \ell^\phi(\rho(\gamma))\le T\big\}.$$ \begin{cor} \label{geometric intersection} If $\rho,\eta:\Gamma\to\mathsf{SL}(d,\mathbb R)$ are cusped Hitchin representations and $\phi\in\Delta$ then $$I^{\phi}(\rho,\eta)=\lim_{T\to\infty} \frac{1}{\#(R_T^{\phi}(\rho))}\sum_{[\gamma]\in R_T^{\phi}(\rho)} \frac{\ell^{\phi}(\eta(\gamma))}{\ell^{\phi}(\rho(\gamma))}.$$ \end{cor} In a companion paper, Canary, Zhang and Zimmer \cite{CZZ} study the geometry of cusped Hitchin representation showing that they are ``relatively'' Borel Anosov in a sense which generalizes work of Labourie \cite{labourie-invent}. They also show that cusped Hitchin representations are stable with respect to type-preserving deformation in $\mathsf{SL}(d,\mathbb C)$. As a consequence, they see that limit maps are H\"older and vary analytically. In \cite{BCKM2}, we combine the work in this paper and in \cite{CZZ} to construct pressure metrics on cusped Hitchin components. This project is motivated by the hope that there is a geometric theory of the augmented Hitchin component which generalizes the classical theory for augmented Teichm\"uller space. Masur \cite{masur-wp} proved that the augmented Teichm\"uller space is the metric completion of Teichm\"uller space with the Weil-Petersson metric. The strata at infinity of augmented Teichm\"uller space consists of Teichm\"uller spaces of cusped hyperbolic surfaces. These strata naturally inherit a Weil-Petersson metric from the completion. The potential analogy is clearest when $d=3$, where Hitchin components are spaces of convex projective structures on closed surfaces. Work of Loftin \cite{loftin-bord} and Loftin-Zhang \cite{loftin-zhang} explores the analytic structure and topology of this bordification. We hope that our work on pressure metrics will aid in showing that there is an augmented Hitchin component which arises as the metric completion of the Hitchin component with the pressure metric. See the survey paper \cite{canary-survey} for a more detailed discussion of the conjectural picture. \medskip\noindent {\bf Other applications:} These results have immediate generalizations for $P_k$-Anosov representations of geometrically finite Fuchsian groups. We also recover (mild generalizations of) many of Sambarino's results on counting and equidistribution for uncusped Anosov representations in our framework (see \cite{sambarino-quantitative,sambarino-indicator,sambarino-orbital}). \medskip\noindent {\bf Historical remarks:} Counting and equidistribution results have long been a central theme of the Thermodynamical Formalism (see, for example, the seminal work of Bowen, Parry, Pollicott and Ruelle \cite{bowen,bowen-ruelle,parry-pollicott,ruelle}). Lalley's innovation \cite{lalley} was the introduction of renewal theory and the development of a Renewal Theorem which allowed him to obtain precise counting and equidistribution results. Our work harnesses Kesseb\"ohmer and Kombrink's extension \cite{kess-kom} of Lalley's Renewal Theorem to the setting of countable Markov shifts to obtain similar results in our setting. Bishop and Steger \cite{bishop-steger} proved a rigidity theorem in the setting of finite area hyperbolic surfaces which is the precursor to the study of Manhattan curves. Lalley \cite{lalley-manhattan} extended Bishop and Steger's rigidity theorem to the setting of closed negatively curved surfaces. The formulation in terms of a Manhattan curve is due to Burger \cite{burger} who worked in the setting of convex cocompact representations into rank one Lie groups. Kao \cite{kao-manhattan} established a Manhattan curve theorem for geometrically finite Fuchsian groups and Bray-Canary-Kao \cite{BCK} extended his result to the setting of geometrically finite quasifuchsian representations. Dal'bo and Peign\'e \cite{dalbo-peigne} used renewal theorems in their work obtaining counting and mixing results on geometrically finite negatively curved surfaces. They also applied renewal techniques to study counting results for the modular surface \cite{dalbo-peigne-modular}. Thirion \cite{thirion} used related techniques to obtain asymptotic results for orbital counting functions for ping pong groups. Thirion's ping pong groups overlap with the class of (images of) cusped $P_1$-Anosov representations. Corollary \ref{cusped counting} generalizes results of Sambarino \cite{sambarino-quantitative,sambarino-indicator,sambarino-orbital} from the Anosov setting, while Corollaries \ref{intersection rigidity} and \ref{geometric intersection} generalize results of Bridgeman-Canary-Labourie-Sambarino \cite{BCLS}. In the case of cusped Hitchin representations, $d(\tau_\rho^\phi)$ is simply the maximum critical exponent of the $\phi$-length Poincar\'e series associated to any unipotent subgroup of $\rho(\Gamma)$. Thus, having a strong entropy gap at infinity is analogous to the critical exponent gap used in the work of Dal'bo-Peign\'e \cite{dalbo-peigne} and Dal'bo-Otal-Peign\'e \cite{DOP}. Schapira and Tapie \cite[Prop. 7.16]{schapira-tapie} showed that for a geometrically finite negatively curved manifold then there is a critical exponent gap if and only if the geodesic flow has an entropy gap at infinity. Our definition is inspired by their work. In turn, Schapira and Tapie were motivated, in part, by work on strongly positive recurrent potentials for countable Markov shifts due to Gurevich and Savchenko \cite{gur-sav,savchenko}, Sarig \cite{sarig-first,sarig-phase}, Ruette \cite{ruette}, and Boyle-Buzzi-G\'omez \cite{BBG}. Other relevant precursors to our results include the work of Iommi-Riquelme-Velozo \cite{IRV}, Riquelme-Velozo \cite{riquelme-velozo}, and Velozo \cite{velozo}. In recent work, Pollicott and Urbanski \cite{pollicott-urbanski} use related techniques to obtain fine counting results for conformal dynamical systems. Their main technical tools come from the study of complexified Ruelle-Perron-Frobenius operators, generalizing early work of Parry-Pollicott \cite{parry-pollicott} in the setting of finite Markov shifts. (The proof of Kesseb\"ohmer and Kombrink's Renewal Theorem \cite{kess-kom} also relies on the study of complexified Ruelle-Perron-Frobenius operators.) Pollicott and Urbanski give extensive applications to the study of circle packings, rational functions, continued fractions, Fuchsian groups and Schottky groups and other topics. Feng Zhu \cite{feng-hilbert} obtained closely related counting and equidistribution results for the Hilbert length functional on geometrically\ finite strictly convex projective manifolds. When $d=3$, cusped Hitchin representations are holonomy maps of strictly convex projective surfaces, so our results overlap with his in this case. \medskip\noindent {\bf Outline of paper:} In Section 2, we recall the relevant background material from the theory of countable Markov shifts. In Section 3, we use this theory to explore the consequences of entropy gaps at infinity. In Section 4, we recall the Renewal Theorem of Kesseb\"ohmer and Kombrink \cite{kess-kom} and show that we can apply it in our context. Section 5 contains the crucial technical material needed in the proof of Theorems A. Sections 6, 7 and 8 contain the proof of Theorems A, B and C (respectively). In Section 9, we develop the background material needed for our applications. Section 10 contains the proof of (a generalization of) Theorem D and Section 11 derives its consequences. \medskip\noindent {\bf Acknowledgements:} The authors would like to thank Godofredo Iommi, Andres Sambarino, Barbara Schapira, Ralf Spatzier and Dan Thompson for helpful comments and suggestions. We also thank the referee for suggestions which improved the exposition. This material is based upon work supported by the National Science Foundation under Grant No. DMS-1928930 while the second author participated in a program hosted by the Mathematical Sciences Research Institute in Berkeley, California, during the Fall 2020 semester. \section{Background from the Thermodynamic Formalism} \label{countable background} In this section, we recall the background results we will need from the Thermodynamic Formalism for countable Markov shifts as developed by Gurevich-Savchenko \cite{gur-sav}, Mauldin-Urbanksi \cite{MU} and Sarig \cite{sarig-first}. Given a countable alphabet $\mathcal A$ and a transition matrix $\mathbb T=(t_{ab})\in\{0,1\}^{\mathcal A\times\mathcal A}$ a one-sided Markov shift is $$\Sigma^+=\{x=(x_i)\in\mathcal A^{\mathbb N}\ |\ t_{x_ix_{i+1}}=1\ {\rm for}\ {\rm all}\ i\in\mathbb N\}$$ equipped with a shift map $\sigma:\Sigma^+\to\Sigma^+$ which takes $(x_i)_{i\in\mathbb N}$ to $(x_{i+1})_{i\in\mathbb N}$. We will work in the setting of topologically mixing Markov shifts with (BIP), where many of the classical results of Thermodynamic Formalism generalize. The shift $(\Sigma^+,\sigma)$ is {\em topologically mixing} if for all $a,b\in \mathcal A$, there exists $N=N(a,b)$ so that if $n\ge N$, then there exists $x\in\Sigma$ so that $x_1=a$ and $x_n=b$. It has the big images and pre-images property (BIP) if there exists a finite subset $\mathcal B\subset\mathcal A$ so that if $a\in\mathcal A$, then there exist $b_0,b_1\in\mathcal B$ so that $t_{b_0a}=1=t_{ab_1}$. The theory works best for locally H\"older continuous potentials. We say that $g:\Sigma^+\to\mathbb R$ is {\em locally H\"older continuous} if there exist $A>0$ and $\alpha>0$ so that $$|g(x)-g(y)|\le Ae^{-\alpha n}$$ whenever $x_i=y_i$ for all $i\le n$ and $n\in\mathbb N$. When we want to record the constants we will say that $g$ is locally $\alpha$-H\"older continuous with constant $A$. The {\em Gurevich pressure} of $g$ is given by $$P(g)=\lim_{n\to\infty}\frac{1}{n}\log \sum_{\{x\in \mathrm{Fix}^n\ |\ x_1=a\}} e^{S_ng(x)}$$ for some (any) $a\in\mathcal A$ where $$S_ng(x)=\sum_{i=1}^{n} g(\sigma^{i-1}(x))$$ is the {\em ergodic sum} and $\mathrm{Fix}^n=\{x\in\Sigma^+\ |\ \sigma^n(x)=x\}$. We say that two locally H\"older continuous functions $f$ and $g$ are {\em cohomologous} if there exists a locally H\"older continuous function $h$ so that $$f-g=h-h\circ\sigma.$$ The analogue of Livsic's theorem holds in this setting. \begin{thm} {\rm (Sarig \cite[Thm 1.1]{sarig-2009})} \label{livsic} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP). If $f:\Sigma^+\to\mathbb R$ and $g:\Sigma^+\to\mathbb R$ are both locally H\"older continuous, then $f$ is cohomologous to $g$ if and only if $S_nf(x)=S_ng(x)$ for all $n\in\mathbb N$ and $x\in\mathrm{Fix}^n$. In particular, if $f$ and $g$ are cohomologous, then $P(-tf)=P(-tg)$ whenever $P(-tf)$ is finite. \end{thm} A $\sigma$-invariant Borel probability measure $\mu$ on $\Sigma^+$ is an {\em equilibrium state} for a locally H\"older continuous function $g:\Sigma^+\to\mathbb R$ if $$P(g)=h_\sigma(\mu)+\int_{\Sigma^+} g \ d\mu$$ where $h_\sigma(\mu)$ is the measure-theoretic entropy of $\sigma$ with respect to the measure $\mu$. A Borel probability measure $\mu$ on $\Sigma^+$ is a {\em Gibbs state} for a locally H\"older continuous function $g:\Sigma^+\to\mathbb R$ if there exists $B>1$ so that $$\frac{1}{B}\le\frac{\mu([a_1,\ldots,a_n])}{e^{S_ng(x)-nP(g)}}\le B$$ for all $x\in [a_1,\ldots,a_n]$, where $[a_1,\ldots,a_n]$ is the {\em cylinder} consisting of all $x\in\Sigma^+$ so that $x_i=a_i$ for all $1\le i\le n$. \begin{thm} {\rm (Mauldin-Urbanski \cite[Thm 2.2.9]{MU}, Sarig \cite[Thm 4.9]{sarig-2009})} \label{Gibbs is eq} If $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP), $g:\Sigma^+\to\mathbb R$ is locally H\"older continuous, it admits a shift invariant Gibbs state $\mu_g$, and $-\int g\ d\mu_g<+\infty$, then $\mu_g$ is the unique equilibrium state for $g$. \end{thm} Recall from the introduction that for $g\colon\Sigma^+\to \mathbb R$ a locally H\"older continuous function we define $$I(g,a)=\inf\big\{ g(x)\ |\ x\in\Sigma^+, x_1=a\big\}\qquad\mathrm{and}\qquad S(g,a)=\sup\big\{ g(x)\ |\ x\in\Sigma^+, x_1=a\big\}.$$ We will make crucial use of the following criterion for a potential to admit an equilibrium state. \begin{thm} \label{equnique} {\rm (Mauldin-Urbanski \cite[Thm 2.2.4 and 2.2.9, Lemma 2.2.8]{MU}, Sarig \cite[Thm 4.9]{sarig-2009})} If $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP), $g:\Sigma^+\to\mathbb R$ is locally H\"older continuous, and $$\sum_{a\in\mathcal A} I(g,a) e^{-S(g,a)}$$ converges, then $-g$ admits a unique equilibrium state $\mu_{-g}$. Moreover, $$\int_{\Sigma^+} g\ d\mu_{-g}<+\infty.$$ \end{thm} We will need to be able to take the derivatives of the pressure function and to be able to apply the Implicit Function Theorem. We say that $\{g_u:\Sigma^+\to \mathbb R\}_{u\in M}$ is a {\em real analytic family} if $M$ is a real analytic manifold and for all $x\in \Sigma^+$, $u\to g_u(x)$ is a real analytic function on $M$. Mauldin and Urbanski \cite[Thm. 2.6.12,\ Prop. 2.6.13]{MU} (see also Sarig \cite[Cor. 4]{sarig-2003}), prove real analyticity properties of the pressure function and evaluate its derivative. \begin{thm}{\rm (Mauldin-Urbanski, Sarig)} \label{pressure analytic} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP). If $\{g_u:\Sigma^+\to \mathbb R\}_{u\in M}$ is a real analytic family of locally H\"older continuous functions such that $P(g_u)<\infty$ for all $u$, then $u\to P(g_u)$ is real analytic. Moreover, if $v\in T_{u_0}M$ and there exists a neighborhood $U$ of $u_0$ in $M$ so that if $u\in U$ and $-\int_{\Sigma^+} g_u d\mu _{g_{u_0}}<\infty$, then $$D_vP(g_u)=\int_{\Sigma^+} D_v(g_u(x))\ d\mu_{g_{u_0}}.$$ \end{thm} Recall that if $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous the {\em transfer operator} is defined by \[ \mathcal{L}_{f}\phi(x):=\sum_{y\in\sigma^{-1}(x)}e^{f(y)}\phi(y) \] where $\phi:\Sigma^+\to\mathbb R$ is a \textit{bounded} locally H\"older continuous function. The transfer operator, in particular, gives us crucial information about equilibrium states. \begin{thm} {\rm (Mauldin-Urbanski \cite[Cor. 2.7.5]{MU}, Sarig \cite[Thm. 4.9]{sarig-2009})} \label{transfer fact} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP). If $g :\Sigma^+\to\mathbb R$ is locally H\"older continuous, \hbox{$P(g)<+\infty$}, and $\sup g<+\infty$ then there exist unique probability measures $\mu_g$ and $\nu_g$ on $\Sigma^+$ and a positive function $h_g:\Sigma^+\to\mathbb R$ so that $$\mu_g=h_g\nu_g,\qquad \mathcal L_gh_g=e^{P(g)}h_g,\qquad\mathrm{and}\qquad \mathcal L_g^*\nu_g=e^{P(g)}\nu_g.$$ Moreover, $h_g$ is bounded away from both $0$ and $+\infty$ and $\mu_g$ is an equilibrium state for $g$. \end{thm} We will also use the following estimate on the behavior of powers of the transfer operator. \begin{thm}{\rm (Mauldin-Urbanski \cite[Theorem 2.4.6]{MU})} \label{bounds on transfer} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP). If $g:\Sigma^+\to\mathbb R$ is locally H\"older continuous, \hbox{$P(g)<+\infty$}, and $\sup g<+\infty$, then there exist $R>0$ and $\eta\in(0,1)$ so that if $n\in\mathbb N$ and $\phi:\Sigma^+\to\mathbb R$ is bounded and locally $\eta$-H\"older continuous with constant $A$, then \begin{equation} \Big\| e^{-nP(g)}\mathcal L_g^n\phi-h_{g}(x)\int \phi\ d\nu_{g}\Big\| \le R\eta^n\Big(\sup_{x\in\Sigma^+}|\phi(x)|+A\Big). \end{equation} \end{thm} \section{Entropy gaps at infinity} \label{entropy gaps} In this section, we show that a strong entropy gap at infinity implies a weak entropy gap at infinity and explore the thermodynamical consequences of entropy gaps at infinity. Recall that $d(f)$ is the critical exponent of the series $$Z_1(f,s)=\sum_{a\in\mathcal A} e^{-sS(f,a)}.$$ Notice that if $f$ is locally H\"older continuous, there exists $C>0$ so that $S(f,a)- I(f,a)\le C$ for all $a\in\mathcal A$. So the series $$\sum_{a\in\mathcal A} e^{-sI(f,a)}$$ has critical exponent $d(f)$ and diverges at $d(f)$ if and only if $f$ has a strong entropy gap at infinity. We first observe a bound on the number of letters with $I(f,a)\le t$. \begin{lem} \label{growth of alphabet} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP). If $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, $d(f)$ is finite and $b>d(f)$, then there exists $D=D(f,b)>0$ so that $$B_1(f,t)=\#\big\{a\in\mathcal A\ |\ I(f,a) \le t\big\}\le De^{bt}$$ for all $t>0$, and $$\sum_{y\in\sigma^{-1}(x)}{\bf 1}_{\{f(y)\leq t\}}(y)\le De^{bt}$$ for all $x\in\Sigma^+$ and $t>0$. \end{lem} \begin{proof} Fix $b>d(f)$. If there does not exist $D$ so that $B_1(f,t)\le De^{bt}$ for all $t>0$, then there exists a sequence $t_n\to\infty$ so that $$B_1(f,t_n)\ge ne^{bt_n}.$$ But then $$\sum_{a\in\mathcal A} e^{-bI(f,a)}\ge \sum_{\{a\ |\ I(f,a)\le t_n \}} e^{-bI(f,a)}\ge n e^{bt_n}e^{-bt_n}=n$$ for all $n\in\mathbb N$, which contradicts our assumption that $b>d(f)$. Finally, notice that if $x\in\Sigma^+$, then $$\sum_{y\in\sigma^{-1}(x)}{\bf 1}_{\{f(y)\leq t\}}(y)\le B_1(f,t)\le De^{bt}$$ for all $t>0$. \end{proof} It will often be convenient to work with a strictly positive potential. We observe that an eventually positive potential is always cohomologous to a strictly positive potential with the same entropy gaps. \begin{lem} \label{eventually to strictly} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP) and that $f:\Sigma^+\to\mathbb R$ is eventually positive, locally H\"older continuous and $d(f)$ is finite. Then $f$ is cohomologous to a strictly positive, locally H\"older continuous function $g$ so that \begin{enumerate} \item there exists $C$ so that $|f(x)-g(x)|\le C$ for all $x\in\Sigma^+$, \item $d(f)=d(g)$, \item $f$ has a weak entropy gap at infinity if and only if $g$ has a weak entropy gap at infinity, and \item $f$ has a strong entropy gap at infinity if and only if $g$ has a strong entropy gap at infinity. \end{enumerate} \end{lem} \begin{proof} Notice that (1) implies that $|S(f,a)-S(g,a)|\le C$. Moreover, if $f$ is cohomologous to $g$, and both are locally H\"older continuous, then $P(-tf)=P(-tg)$ for all $t>d(f)$, see Theorem \ref{livsic}. Therefore, (2)--(4) follow immediately once we construct a strictly positive, locally H\"older continuous function $g$ that is cohomologous to $f$ so that (1) holds. Let \[ R=\left|\inf_{x\in\Sigma^+} f(x)\right|. \] Note that $R=|\inf_{a\in\mathcal A} I(f,a)|$ is finite since there exists $s>d(f)>0$ so that $\sum_{a\in\mathcal A} e^{-s I(f,a)}$ is finite. Since $f$ is eventually positive, there exists $N\in\mathbb N$ and $B>0$ so that if $n\ge N$ and $x\in\Sigma^+$, then $$S_nf(x)\ge B.$$ Let $$\mathcal F=\{a\in\mathcal A\ |\ I(f,a)\le RN+B\}.$$ Since $d(f)$ is finite, $\mathcal F$ must be finite. To see this, observe that for $s>d(f)>0$ \[ \infty>\sum_{a\in\mathcal A}e^{-s I(f,a)}\geq \sum_{a\in\mathcal F}e^{-sI(f,a)}\geq \sum_{a\in\mathcal F} e^{-s(RN+B)}. \] For all $n\in\mathbb N$, define \begin{align*}C_nf(x)&=\sum_{i=1}^{n} \Big(f(\sigma^{i-1}(x)) {\bf 1}_{\{x_i\in\mathcal F\}}(x)+(RN+B){\bf 1}_{\{x_i\notin\mathcal F\}}(x)\Big)\\ &=S_nf(x)-\sum_{i=1}^n\Big(f(\sigma^{i-1}(x))-(RN+B)\Big)\mathbf{1}_{\{x_i\not\in\mathcal F\}}(x). \end{align*} By construction, $$RN^2+NB+TN\ge C_Nf(x)\ge B$$ for all $x\in\Sigma^+$, where $$T=\sup\{f(x)\ |\ x_1\in\mathcal F\}.$$ (The lower bound holds, since $C_Nf(x)=S_Nf(x)\ge B$ if $x_i\in\mathcal F$ for all $i\le N$, and otherwise one of the summands of $C_Nf(x)$ is $RN+B$ and each of the remaining terms are bounded below by $-R$.) We then define $g:\Sigma^+\to\mathbb R$ by $$g(x)=\frac{1}{N}C_Nf(x)+\big(f(x)-(RN+B)\big)\mathbf{1}_{\{x_1\not\in\mathcal F\}}(x). $$ By construction, $g$ is continuous and $$g(x)\ge \frac{B}{N}>0$$ for all $x\in\Sigma^+$, so $g$ is strictly positive. Moreover, if $x_1\in\mathcal F$, then $|g(x)-f(x)|\leq RN+B+2T$, and if $x_1\notin\mathcal F$, then $$|g(x)-f(x)|\leq RN+B+\frac{1}{N} C_Nf(x)\leq 2(RN+B).$$ It follows that $$|g(x)-f(x)|\le 2(RN+B+T)=:C $$ for all $x\in\Sigma^+$. To show $g$ is locally H\"older continuous, consider $x,y\in\Sigma^+$ for which $x_i=y_i$ for all $i=1,\ldots, n$, and note that it suffices to consider $n\geq N$. Then \begin{align*} |g(x)-g(y)| = \left|\frac1N \left( \sum_{i=1}^N (f(\sigma^{i-1}(x))-f(\sigma^{i-1}(y)))\mathbf 1_{\{x_i\in\mathcal F\} }(x) \right) + (f(x)-f(y))\mathbf 1_{\{ x_1\not\in\mathcal F\} }(x)\right|. \end{align*} Since $n\geq N,$ applying local H\"older continuity of $f$ gives the desired conclusion. Finally, if $x=\overline{x_1\ldots x_r}\in\mathrm{Fix}^r$, then one may check that $S_rf(x)=S_rg(x)$. To see this, observe that \begin{align*} S_rg(x)&=S_r\left(\frac{1}{N}C_Nf(x)\right)+S_r\Big(\left(f(x)-(RN+B)\right)\textbf1_{\{x_1\not\in\mathcal F\}}(x)\Big)\\ &=\frac{1}{N}S_rC_N f(x)+\sum_{j=1}^r\left(f(\sigma^{j-1}(x))-(RN+B)\right)\textbf1_{\{x_j\not\in\mathcal F\}}(x) \end{align*} and since $\sigma^r(x)=x$, \begin{align*} S_rC_Nf(x)&=S_rS_Nf(x)-\sum_{j=1}^r\sum_{i=1}^N\left(f(\sigma^{i-1}(x))-(RN+B)\right)\textbf1_{\{x_i\not\in\mathcal F\}}(x)\\ &=NS_rf(x)-N\sum_{j=1}^r\left(f(\sigma^{j-1}(x))-(RN+B)\right)\textbf1_{\{ x_j\not\in\mathcal F\}}(x). \end{align*} Theorem \ref{livsic} then implies that $f$ and $g$ are cohomologous. \end{proof} We next study the behavior of $P(-tf)$ for $t>d(f)$, showing among other things that a strong entropy gap at infinity implies a weak entropy gap at infinity. \begin{lem} \label{gap and pressure} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP) and $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous and eventually positive. \begin{enumerate} \item If $d(f)$ is finite, then $P(-tf)$ is finite if $t>d(f)$ and infinite if $t<d(f)$, and the function $t\to P(-tf)$ is monotone decreasing and analytic on $(d(f),\infty)$. \item There exists at most one $\delta\in (d(f),\infty)$ so that $P(-\delta f)=0$. \item If $f$ has a strong entropy gap at infinity, then $t\to P(-tf)$ is proper on $(d(f),\infty)$. In particular, $f$ has a weak entropy gap at infinity. \end{enumerate} \end{lem} \begin{proof} Mauldin and Urbanski \cite[Theorem 2.1.9]{MU} proved that if $\Sigma^+$ is topologically mixing and has (BIP), then $P(-sf)$ is finite if and only if $$ Z_1(-f,s)=\sum_{a\in\mathcal A}e^{\sup\{-sf(x)\ \mid\ x_1=a\}} $$ converges. Therefore, $P(-tf)$ is finite if $t>d(f)$ and infinite if $t<d(f)$. Notice that $t\to P(-tf)$ is monotone decreasing by definition and analytic by Theorem \ref{pressure analytic}, so (1) follows. (2) is an immediate consequence of (1). It remains to show (3). The fact that $\lim_{t\to d(f)} P(-tf)=+\infty$ is essentially contained in Mauldin and Urbanski's proof of \cite[Theorem 2.1.9]{MU}, but we elaborate here for completeness. They show that there exist constants \hbox{$q,s,M,m>0$} so that for any locally {H\"older} continuous function $g$, $$ \sum_{i=n}^{n+s(n-1)}Z_{i}(g,1)\geq \frac{e^{-M+(M-m)n}}{q^{n-1}}Z_{1}(g,1)^{n}. $$ where $$Z_n(g,1)=\sum_{p\in\Lambda_k}e^{\sup_{x\in p}S_ng(x)},$$ and $\Lambda_k$ is the set of $k$-cylinders of $\Sigma^+$. They observe \cite[Equation (2.1)]{MU} that \hbox{$\lim\frac{1}{n}\log Z_n(g,1)=P(g)$.} Thus there exists $A>0$ such that for all $n$, there exists $\hat n\in [n,n+s(n-1)]$ so that $Z_{\hat n}(g,1)\ge A^nZ_1(g,1)^n$, so $P(g)\ge \frac{1}{1+s}\log AZ_1(g,1)$. Therefore, if $f$ has a strong entropy gap at infinity, then $\lim_{t\to d(f)} Z_1(-tf,1)=+\infty$ and hence $$\lim_{t\to d(f)} P(-tf)\ge\lim_{t\to d(f)} \frac{1}{1+s}\log AZ_1(-tf,1)=+\infty. $$ We now show that ${\displaystyle \lim_{t\to\infty}P(-tf)=-\infty}$. Notice that since there exists $N>0$ such that \hbox{$S_{n}f(x)>B>0$} for all $n\ge N$ and $x\in\Sigma^+$, we have $S_{kN}f(x)>kB$ for every $k\geq 1$. Then, \[ \sum_{\{x\in\mathrm{Fix}^{kN}|\ x_{1}=a\}}e^{-2td(f)S_{kN}f(x)}\leq\sum_{\{x\in\mathrm{Fix}^{kN}|\ x_{1}=a\}}e^{-2(t-1)d(f)kB-2d(f)S_{kN}f(x)} \] which implies \begin{align*}P(-2td(f)f) &\leq \lim_{k\to \infty}\frac{1}{kN}\log\sum_{\{x\in\mathrm{Fix}^{kN}|\ x_{1}=a\}}e^{-2(t-1)d(f)kB-2d(f)S_{kN}f(x)}\\ &= \frac{-2(t-1)d(f)B}{N}+P(-2d(f)f) \end{align*} and so ${\displaystyle \lim_{t\to\infty}P(-tf)=-\infty}$. Since $t\to P(-tf)$ is proper and monotone decreasing on $(d(f),\infty)$, it follows that there exists $\delta>d(f)$ so that $P(-\delta f)=0$. Therefore, $f$ has a weak entropy gap at infinity and we have established (3). \end{proof} We next observe that $-tf$ admits an equilibrium state if $t>d(f)$. \begin{lem} \label{equilibrium state exists} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP). If $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous and eventually positive and $t>d(f)$, then there exists a unique equilibrium state $\mu_{-t f}$ for $-t f$. Moreover, $$0<\int_{\Sigma^+} f \ d\mu_{-t f}<+\infty.$$ \end{lem} \begin{proof} Theorem \ref{equnique} implies that there exists a unique equilibrium state for $-t f$ if and only if $$\sum_{a\in\mathcal A} t I(f,a)e^{-tS(f,a)}<+\infty.$$ Indeed, this series converges since $$\sum_{a\in\mathcal A}e^{-s S(f,a)}<+\infty$$ for all $s>d(f)$. Theorem \ref{equnique} also ensures that $\int_{\Sigma^+} f d\mu_{-tf}<+\infty$. Since $f$ is eventually positive, it is cohomologous to a strictly positive function $g$. Then $-tf$ and $-tg$ are cohomologous and hence have the same integral with respect to any shift-invariant measure, and also share the same shift-invariant equilibrium state, i.e. $\mu_{-tf}=\mu_{-tg}$ (see \cite[Theorem 2.2.7]{MU} and Theorem \ref{equnique}). Hence, $$\int_{\Sigma^+} f \ d\mu_{-t f}=\int_{\Sigma^+} g \ d\mu_{-t g}>0.$$ \end{proof} Theorem \ref{transfer fact} and Lemma \ref{gap and pressure} have the following corollary which we will use repeatedly. \begin{cor} \label{equilibrium and transfer} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP). If $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, eventually positive, and has a weak entropy gap at infinity and $t>d(f)$, then there exist unique probability measures $\mu_{-tf}$ and $\nu_{-tf}$ on $\Sigma^+$ and a positive function $h_{-tf}:\Sigma^+\to\mathbb R$ so that $$\mu_{-tf}=h_{-tf}\nu_{-tf},\qquad \mathcal L_{-tf}h_{-tf}=e^{P(-tf)}h_{-tf},\qquad\mathrm{and}\qquad \mathcal L_{-tf}^*\nu_{-tf}=e^{P(-tf)}\nu_{-tf}$$ and $h_{-tf}$ is bounded away from both $0$ and $+\infty$. Moreover, $\mu_{-tf}$ is the equilibrium state of $-tf$. \end{cor} We will need analogues of these results for functions of the form $-zg-\delta f$ where $g$ is comparable to $f$ and $z$ is close to 0. \begin{prop} \label{adding g in} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP), $f:\Sigma^+\to\mathbb R$ is locally H\"older continuous, eventually positive and has a weak entropy gap at infinity and $P(-\delta f)=0$ for $\delta=\delta(f)>d(f)>0$. If $g:\Sigma^+\to\mathbb R$ is locally H\"older continuous, eventually positive, and there exists $C$ so that $|f(x)-g(x)|\le C$ for all $x\in\Sigma^+$, then \begin{enumerate} \item if $z>d(f)-\delta$, then $P(-zg-\delta f)$ is finite, $z\to P(-zg-\delta f)$ is monotone decreasing and analytic on $(d(f)-\delta,\infty)$ and $\sup_{x\in\Sigma^+}( -zg-\delta f)<+\infty$. \item if $z>d(f)-\delta$, then there exist unique probability measures $\mu_{-zg-\delta f}$ and $\nu_{-zg-\delta f}$ on $\Sigma^+$ and a positive function $h_{-zg-\delta f}:\Sigma^+\to\mathbb R$ so that \begin{gather*}\mu_{-zg-\delta f}=h_{-zg-\delta g}\nu_{-zg-\delta f}, \quad \mathcal L_{-zg-\delta f}h_{-zg-\delta f}=e^{P(-zg-\delta f)}h_{-zg-\delta ff},\\ \mathrm{and}\ \mathcal L_{-zg-\delta f}^*\nu_{-zg-\delta f}=e^{P(-zg-\delta f)}\nu_{-zg-\delta f}. \end{gather*} Moreover, $h_{-zg-\delta f}$ is bounded away from both $0$ and $+\infty$ and $\mu_{-zg-\delta f}$ is the unique equilibrium state of $-zg-\delta f$. \end{enumerate} \end{prop} \begin{proof} Notice that $$\sum_{\{x\in \mathrm{Fix}^n\ |\ x_1=a\} } e^{S_n(-zg-\delta f)}\le \sum_{\{x\in \mathrm{Fix}^n\ |\ x_1=a\} } e^{nzC} e^{S_n\big( (-z-\delta)f\big)}$$ so $P(-zg-\delta f)$ is finite if $z+\delta>d(f)$, i.e. if $z>d(f)-\delta$. Similarly, if $x\in\Sigma^+$, then $$(-zg-\delta f)(x)\le -(z+\delta)f(x)+Cz\le\sup(-(z+\delta)f)+Cz <+\infty$$ if $z+\delta>0$. The function $z\to P(-zg-\delta f)$ is monotone decreasing by definition and analytic by Theorem \ref{pressure analytic}. We have established (1). (2) is then an immediate consequence of (1) and Theorem \ref{transfer fact}. \end{proof} \section{Renewal Theorems} Our main tool will be the Renewal Theorem of Kesseb\"ohmer and Kombrink \cite{kess-kom}. Their result generalized a result of Lalley \cite{lalley} for finite Markov shifts. Consider a locally H\"older continuous potential $f\colon \Sigma^+\to\mathbb R$. If $\phi:\Sigma^+\to\mathbb R$ is a non-negative, bounded, locally H\"older continuous function, we define the {\em renewal function} \[ N_f(\phi,x,t):=\sum_{n=0}^{\infty}\sum_{y\in\sigma^{-n}(x)}\phi(y){\bf 1}_{\{S_{n}f(y)\leq t\}}(y). \] We recall that $N_{f}(\phi,x,t)$ satisfies the {\em renewal equation} \begin{equation} N_{f}(\phi,x,t)=\left(\sum_{y\in\sigma^{-1}(x)}N_{f}(\phi,y,t-f(y))\right)+\phi(x){\bf 1}_{\{t\geq0\}}(t) \label{eq:RN eq} \end{equation} \begin{thm} {\rm (Renewal theorem; Kesseb\"ohmer-Kombrink \cite[Theorem 3.1]{kess-kom})}\label{thm:Renewal} Suppose that $\Sigma^+$ is a topologically mixing, one-sided, countable Markov shift with (BIP) and $f:\Sigma^+\to\mathbb R$ is a strictly positive, non-arithmetic, locally H\"older continuous function so that there exists a unique $\delta>0$ so that $P(-\delta f)=0$ and $\int_{\Sigma^+} t f\ d\mu_{-\delta f}<+\infty$ for all $t$ in some neighborhood of $\delta$, where $\mu_{-\delta f}$ is an equilibrium state for $-\delta f$. If $\phi:\Sigma^+\to\mathbb R$ is non-negative, bounded, not identically zero, and locally H\"older continuous and there exists $c>0$ such that \[ N_f(\phi,x,t)\leq ce^{t\delta}, \] then \[ N_f(\phi,x,t)\sim\frac{e^{t\delta}}{\delta}h_{-\delta f}(x)\frac{\int_{\Sigma^{+}}\phi\ d\nu_{-\delta f}}{\int_{\Sigma^{+}}f\ d\mu_{-\delta f}} \] as $t\to\infty$, uniformly for $x\in\Sigma^{+}$, where $h_{-\delta f}:\Sigma^+\to\mathbb R$ is a bounded strictly positive function so that $\mathcal L_{-\delta f} h_{-\delta f}=h_{-\delta f}$, $\nu_{-\delta f}$ is a probability measure on $\Sigma^+$ so that $\mathcal L^*_{-\delta f} \nu_{-\delta f}=\nu_{-\delta f}$ and \hbox{$\mu_{-\delta f}=h_{-\delta f}\nu_{-\delta f}$}. \end{thm} \begin{rem} \label{rem:apply_kess_komb} The Renewal Theorem we state above is a special case of \cite[Theorem 3.1 (i)]{kess-kom}. Following the notations in \cite{kess-kom}, in our case $\eta=0$ and $f_{y}(t)=\begin{cases} 1 & t\geq0\\ 0 & \mathrm{otherwise} \end{cases}$. Kesseb\"ohmer and Kombrink \cite{kess-kom} in place of our assumption of non-arithmeticity only require the weaker assumption that $f$ is not a lattice, i.e. that $f$ is not cohomologous to a function so that $\{S_nf(x)\ |\ x\in\Sigma^+\}$ does not lie in a discrete subgroup of $\mathbb R$. Moreover, since $f_{y}(t)\geq0$, $\int_{-\infty}^{\infty}e^{-T\delta}f_{y}(T)\ dT=\frac{1}{\delta}$, and $N_f(\phi,x,t)=0$ for $t<0$ when $f$ is strictly positive, their conditions (B) and (D) are satisfied. So, it only remains to check that their condition (C) is satisfied, which translates to the existence of $c>0$ such that \[ N_{f}(\phi,x,t)\leq ce^{t\delta}. \] \end{rem} \medskip We first check that a weak entropy gap at infinity implies such a bound on $N_f({\bf 1}, x,t)$. \begin{lem} \label{lem:est_for_RT} Suppose that $\Sigma^+$ is a topologically mixing, one-sided, countable Markov shift with (BIP) and $f:\Sigma^+\to\mathbb R$ is a strictly positive, locally H\"older continuous function with a weak entropy gap at infinity. Let $\delta>d(f)$ be the unique constant such that $P(-\delta f)=0$. Then there exists $C>0$ such that \[ N_f({\bf 1}, x,t)=\sum_{n=0}^{\infty}\sum_{y\in\sigma^{-n}(x)}\mathbf 1_{\{S_{n}f(y)\leq t\}}(y)\leq Ce^{t\delta } \] for all $x\in\Sigma^{+}$ and $t>0$. \end{lem} We adopt the strategy of Lalley \cite[Lemma 8.1]{lalley}. \begin{proof} Define for all $x\in\Sigma^+$ and $t>0$ $$G(x,t)=e^{-t\delta} \frac{N_f({\bf 1},x,t)}{h_{-\delta f}(x)}$$ where $h_{-\delta f}$ is the eigenfunction for the transfer operator given by Theorem \ref{transfer fact}. Let $$\widehat G(t)=\sup\{ G(x,s)\ | \ x\in\Sigma^+,\ s\le t\}.$$ Notice that $\widehat G(t)$ is finite for all $t>0$, since $h_{-\delta f}$ is bounded away from 0, and for any fixed $t>0$ there exists only finitely many $a\in\mathcal A$ so that $I(f,a)\le t$ (which implies that there are only finitely many $n$ and only finitely many $y\in\sigma^{-n}(x)$, for each $n$, so that $S_nf(y)\le t$). Since $h_{-\delta f}$ is bounded away from $0$ and $\infty$, it remains to show that there exists $\hat C$ so that \[ \widehat G(t)\leq\hat C \] for all $t>0$. The renewal equation (\ref{eq:RN eq}) implies that \begin{align*} G(x,t)= & \sum_{y:\ \sigma(y)=x}G(y,t-f(y))e^{-\delta f(y)}\frac{h_{-\delta f}(y)}{h_{-\delta f}(x)}+\frac{e^{-t\delta}}{h_{-\delta f}(x)}. \end{align*} for all $t>0$. Notice that since $h_{-\delta f}(x)$ is the eigenfunction of $\mathcal{L}_{-\delta f}$ with eigenvalue $1=e^{P(-\delta f)}$, \[ \sum_{y:\sigma(y)=x}e^{-\delta f(y)}\frac{h_{-\delta f}(y)}{h_{-\delta f}(x)}=\frac{\left(\mathcal{L}_{-\delta f}h_{-\delta f}\right)(x)}{h_{-\delta f}(x)}=1. \] If $c=c(f)=\inf_{x\in\Sigma^{+}}f(x)>0$, then \begin{equation} G(x,t)\leq\widehat{G}(t-c)+\frac{e^{-t\delta}}{h_{-\delta f}(x)} \end{equation} for all $x\in\Sigma^+$ and $t\ge c$. Therefore, \[ \widehat{G}(mc)\leq\widehat{G}(c)+\hat{H}\sum_{n=1}^{m}e^{-cn\delta} \] for all $m\in\mathbb N$, where $$\hat H=\sup\Big\{\frac{1}{h_{-\delta f}(x)}\ |\ x\in\Sigma^+\Big\}.$$ Since $\widehat G$ is increasing, \[ \widehat{G}(t)\leq\hat{C}=\widehat{G}(c)+\hat{H}\sum_{n=1}^{\infty}e^{-cn\delta} \] for all $t>0$, which completes the proof. \end{proof} If $\phi:\Sigma^+\to\mathbb R$ is bounded, non-negative and locally H\"older continuous, then $$N_f(\phi,x,t)\le \Big( \sup_{x\in\Sigma^+} \phi(x)\Big) N_f({\bf 1}, x,t),$$ so Lemmas \ref{gap and pressure}, \ref{equilibrium state exists} and \ref{lem:est_for_RT} together imply that we can apply the Renewal Theorem to $\phi$ when $f$ is strictly positive and has a weak entropy gap at infinity. \begin{cor} \label{can apply renewal} Suppose that $\Sigma^+$ is a topologically mixing, one-sided, countable Markov shift with (BIP) and $f:\Sigma^+\to\mathbb R$ is a strictly positive, non-arithmetic, locally H\"older continuous function with a weak entropy gap at infinity, $P(-\delta f)=0$. If $\phi:\Sigma^+\to\mathbb R$ is bounded, non-negative, not identically zero and locally H\"older continuous, then \[ N_f(\phi, x,t)\sim\frac{e^{t\delta}}{\delta}h_{-\delta f}(x)\frac{\int_{\Sigma^{+}}\phi\ d\nu_{-\delta f}}{\int_{\Sigma^{+}}f\ d\mu_{-\delta f}} \] as $t\to\infty$, uniformly for $x\in\Sigma^{+}$, where $h_{-\delta f}:\Sigma^+\to\mathbb R$ is a bounded strictly positive function so that $\mathcal L_{-\delta f} h_{-\delta f}=h_{-\delta f}$, $\nu_{-\delta f}$ is a probability measure on $\Sigma^+$ so that $\mathcal L^*_{-\delta f} \nu_{-\delta f}=\nu_{-\delta f}$ and \hbox{$\mu_{-\delta f}=h_{-\delta f}\nu_{-\delta f}$} is the equilibrium state for $-\delta f$. \end{cor} \section{Preparing to count} In this section we develop the technical tools needed in the proofs of our counting result. The majority of these results bound the size of various subsets of the shift space. Most importantly, we show that if $y\in\sigma^{-n}(x)$ and $S_nf(y)$ is ``large,'' then ``typically'' $S_nf(y)$ is close to $n\int_{\Sigma^+}f\ d\mu_{-\delta f}$. These results and their proofs generalize Lalley \cite[Theorem 6]{lalley}. The fact that our Markov shift is countable requires more delicate control of error estimates. For each cylinder $p$, we choose a sample point $z_p\in p$ which is not periodic. We then define $$W(n,p,t)=\sum_{y\in\sigma^{-n}(z_p)} {\bf 1}_p(y) {\bf 1}_{\{ x\ |\ S_nf(x)\le t\}}(y) = \#\Big(p\cap\sigma^{-n}(z_p)\cap \{ x\ |\ S_nf(x)\le t\} \Big).$$ We show that the $W(n,p,t)$ may be used to approximate the size of $\mathcal M_f(n,t)$. This allows us to replace the counting of fixed points with counting of pre-images of our sample points. If $k\in\mathbb N$, let $\Lambda_k$ be the countable partition of $\Sigma^+$ into $k$-cylinders. \begin{lem} \label{lem:key} Suppose that $\Sigma^+$ is a topologically mixing, one-sided countable Markov shift with (BIP), $f\colon\Sigma^+\to\mathbb R$ is locally H\"older continuous strictly positive and has a weak entropy gap at infinity. If $P(-\delta f)=0$ and $\mu_{-\delta f}$ is the equilibrium state for $-\delta f$, then \begin{itemize} \item[(i)] If $v_k=\inf\{\mu_{-\delta f}(p) \ |\ p\in\Lambda_k\}$, then $\lim_{k\to\infty} v_k=0$. \item[(ii)] For any $p\in\Lambda_k$ and $n\ge k$ there exists a bijection $$\Psi_p^n:\mathrm{Fix}^n\cap p\to \sigma^{-n}(z_p)\cap p.$$ \item[(iii)] There exists a sequence $\{\epsilon_k\}$ such that $\lim\epsilon_k=0$ and if $y\in\mathrm{Fix}^n\cap p$ and $n\ge k$, then $$|S_nf(y)-S_nf(\Psi_p^n(y))|\le\epsilon_k.$$ \item[(iv)] If $n\ge k$, then \begin{equation} \sum_{p\in\Lambda_k} W(n,p,t-\epsilon_{k})\leq\#\mathcal M_f(n,t)\leq \sum_{p\in\Lambda_k}W(n,p,t+\epsilon_{k}).\label{eq:keylemma2} \end{equation} Moreover, for all $k\in\mathbb N$ and $s\in(d(f),\delta)$, there exists $C(k,s)>0$ such that for any $n <k$ and $t>0$, \[ \sum_{p\in\Lambda_{k}}W(n,p,t)\leq C(k,s)e^{st}\qquad\mathrm{and}\qquad \#\mathcal M_f(k,t)\le C(k,s)e^{st}. \] \end{itemize} \end{lem} \begin{proof} Recall that since $\mu_{-\delta f}$ is a Gibbs state for $-\delta f$ (see Theorem \ref{Gibbs is eq}) and $P(-\delta f)=0$, there exists $B>1$ such that for every $p\in\Lambda_k$, and $x\in p$ \[ \mu_{-\delta f}(p)\leq B e^{-\delta S_kf(x)}. \] Since $f$ is strictly positive, $\lim_{k\to\infty}\inf\{ S_k(x)\ |\ x\in\Sigma^+\}=+\infty$, so (i) holds. \medskip Given $p\in\Lambda_k$, we define an explicit bijection \[ \Psi_p^n:\mathrm{Fix}^{n}\cap p\to\sigma^{-n}(z_p)\cap p \] If $y=\overline{y_{1}y_{2}...y_{n}}\in\mathrm{Fix}^{n}\cap p$, then let $$\Psi^n_p(y)=y_1\cdots y_n z_1\cdots z_m\cdots.$$ Notice that since $y_1=z_1$ and $\overline{y_1\cdots y_n}\in\Sigma^+$, we must have $t_{y_n y_1}=t_{y_n z_1}=1$, so $\Psi^n_p(y)\in\Sigma^+$. The map $\Psi^n_p$ is injective by definition. If $x\in\sigma^{-n}(z_p)\cap p$, then, since $n\ge k$, $x_{n+1}=z_1=x_1$, which implies that $\overline{x_1\cdots x_n}\in \mathrm{Fix}^n\cap p$, so $\Psi^n_p$ is also surjective. Thus, we have established (ii). \medskip Since $f$ is locally H\"older continuous, there exists $B>0$ and $r\in(0,1)$ so that \[ |f(x)-f(y)|\leq Br^{l} \] if $x_{i}=y_{i}$ for all $i\le l$. Therefore, if $y\in \text{Fix}^n\cap p$, then, since $z_p\in p$, $y_i=\Psi^n_p(y)_i$ for all $i\le n+k$, so \[ |S_{n}f(y)-S_{n}f(\Psi^n_p(y))|\leq\epsilon_{k}=B\sum_{l=k}^{\infty}r^{l}. \] The first statement in (iv) follows immediately from (ii) and (iii). Choose $b\in (d(f),z)$. Lemma \ref{growth of alphabet} implies that there exists $D$ so that $$B_1(f,t)=\#\big\{a\in\mathcal A\ |\ I(f,a) \le t\big\}\le De^{bt}.$$ If $$c=c(f)=\inf_{x\in\Sigma^+} f(x)=\inf_{a\in\mathcal A} I(f,a)>0$$ and $r\in\mathbb N$, then \begin{align*} B_2(f,rc)&= \#\big\{(a_1,a_2)\in \mathcal A\times\mathcal A\ |\ I(f,a_1)+I(f,a_2)\le rc\big\}\\ &\le\sum_{s=1}^r B_1(f,rc-sc)B_1(f,sc) \le \sum_{s=1}^r D^2 e^{brc}= rD^2e^{brc}. \end{align*} We may use the argument above to inductively show that $$B_k(f,rc) = \#\Big\{(a_i)\in \mathcal A^k\ \Big|\ \sum_{i=1}^k I(f,a_i) \le rc\Big\} \le r^{k-1} D^ke^{brc}.$$ Notice that $$\sum_{p\in\Lambda_{k}}W(n,p,rc)\leq B_n(f,rc) \qquad\mathrm{and}\qquad \#\mathcal M_f(k,rc)\le B_k(f,rc)$$ so (iv) follows. \end{proof} We set up some convenient notation. If $x\in\Sigma^+$, let $$\mathcal W(x,t)=\left\{y\in\Sigma^{+}\ \Big|\ \sigma^{n}(y)=x,\ S_{n}f(y)\leq t \ \mathrm{for\ some}\ n\geq1\right\}$$ Observe that if $x$ is not periodic and $y\in \mathcal W(x,t)$, then there is a unique $n(y)$ so that $\sigma^{n(y)}(y)=x$. If $x$ is not periodic and $\epsilon>0$, we let $$\mathcal W(x,t,\le\epsilon)=\Big\{y\in\mathcal W(x,t)\ \big| \ \Big|\frac{t}{n(y)}-\bar f\Big|\le\epsilon\Big\}, \qquad\mathrm{and}$$ $$\mathcal W(x,t,>\epsilon)=\Big\{y\in\mathcal W(x,t)\ \big| \ \Big|\frac{t}{n(y)}-\bar f\Big|>\epsilon\Big\}=\mathcal W(x,t)-\mathcal W(x,t,\le\epsilon)$$ where $\bar f=\int_{\Sigma^+}f\ d\mu_{-\delta f}$. Moreover, let $$W(x,t)=\#\mathcal W(x,t),\ \ W(x,t,<\epsilon)=\#\mathcal W(x,t,\le\epsilon)\ \ \mathrm{and}\ \ W(x,t,>\epsilon)=\#\mathcal W(x,t,>\epsilon)=W(x,t)-W(x,t,\le\epsilon).$$ The crucial technical result we need for the proof of our counting result is a uniform bound on the growth of $W(x,t,>\epsilon)$. \begin{prop} \label{growth of bad set} Suppose that $\Sigma^+$ is a topologically mixing, one-sided, countable Markov shift with (BIP) and $f:\Sigma^+\to\mathbb R$ is a strictly positive, locally H\"older continuous function with a weak entropy gap at infinity. Let $\delta>d(f)$ be the unique constant such that $P(-\delta f)=0$. Given $\epsilon>0$, there exist $D>0$ and $b<\delta$ so that $$ W(x,t,>\epsilon) \le De^{bt}$$ for any non-periodic $x\in\Sigma^+$. \end{prop} \begin{proof} Fix, for the entire proof, $\epsilon\in(0,\bar f/2)$. Theorem \ref{bounds on transfer} implies that if $s>d(f)$, then there exist $R_s>0$ and $\eta_s\in (0,1)$ so that \begin{equation} \Big\| e^{-nP(-sf)}\mathcal{L}_{-sf}^{n}\mathbf{1}(x)-h_{-sf}(x)\int \mathbf{1} d\nu_{-zf}\Big\|\le R_{s}\eta_{s}^{n}.\label{MUbounds} \end{equation} If $s>\delta$, then $P(-sf)<0$, since $P(-\delta f)=0$ and $s\to P(-sf)$ is monotone decreasing and continuous on $(d(f),\infty)$ (by Lemma \ref{gap and pressure}). Then, for any $m\in\mathbb N$ and $t>0$ \begin{eqnarray*} \sum_{n\ge m}\ \ \sum_{y\in\sigma^{-n}(x)} {\bf 1}_{\{S_{n}f(y)\le t\} }(y) & \leq & \sum_{n\ge m}\ \sum_{y\in\sigma^{-n}(x)} e^{-s\left(S_{n}f(y) -t\right)} \\ & = & e^{st} \sum_{n\geq m}\left(\mathcal{L}_{-sf}^{n}\mathbf{1}\right)(x)\\ & \leq & e^{st} \sum_{n\ge m}e^{nP(-sf)}\left(h_{-sf}(x)+R_{s}\eta_{s}^{n}\right)\\ & \leq & e^{st}\Big(\frac{e^{mP(-sf)}}{1-e^{P(-sf)}}\big(H_{s}+R_{s}\big)\Big). \end{eqnarray*} where $H_{s}=\sup \{ h_{-sf}(x)\ |\ x\in\Sigma^+\}$. If $ \frac{t}{n(y)}-\bar f<-\epsilon$, then $n(y)\bar f>t+n(y)\epsilon$ and $n(y)>\frac{t}{\bar f-\epsilon}$, so $n(y)\bar f>t(1+\epsilon_1)$ where $\epsilon_1=\frac{\epsilon}{\bar f-\epsilon}$. Given $t>0$, let $m_t=\left\lfloor \frac{t(1+\epsilon_1)}{\bar f}\right\rfloor$. Then \begin{eqnarray*} \#\big\{y\in\mathcal W(x,t)\ |\ \frac{t}{n(y)}-\bar f<-\epsilon\big\} &\le & \sum_{n\ge m_t}\ \ \sum_{y\in\sigma^{-n}(x)} {\bf 1}_{\{S_{n}f(y)\le t\} }(y)\\ &\le & e^{st}\Big(\frac{e^{m_tP(-sf)}}{1-e^{P(-sf)}}\big(H_{s}+R_{s}\big)\Big).\\ & \le & D_0e^{st+m_tP(-sf)} \end{eqnarray*} where $D_0=D_0(s,f,\epsilon)=\frac{H_s+R_{s}}{1-e^{P(-sf)}}$. Since $\left.\frac{d}{ds}\right|_{s=\delta}P(-sf)=-\overline{f}<0$ (by Theorem \ref{pressure analytic}), we may also choose $s>\delta$ so that \[b_0:=s+\frac{1+\epsilon_1}{\bar f} P(-sf)<\delta.\] Notice that $b_0$ does depend on $\epsilon$. With this choice of $s$, $$\#\big\{y\in \mathcal W(x,t)\ |\ \frac{t}{n(y)}-\bar f<-\epsilon\big\} \le D_0e^{b_0t}.$$ One can similarly show that there exist $D_1>0$ and $b_1\in (d(f),\delta)$ so that $$\#\big\{y\in \mathcal W(x,t)\ |\ \frac{t}{n(y)}-\bar f>\epsilon\big\} \le D_1e^{b_1t}.$$ (In this case, we choose $r\in (d(f),\delta)$ so that \[b_1:=r+\frac{1-\epsilon_2}{\bar f} P(-rf)<\delta\] where $\epsilon_2=\frac{\epsilon}{\overline{f}+\epsilon}>0$. We then use Equation (\ref{MUbounds}) and an analysis similar to the one above to show that $$\#\big\{y\in \mathcal W(x,t)\ |\ \frac{t}{n(y)}-\bar f>\epsilon\big\} \le D_1e^{t\big(r+ \frac{1-\epsilon_2}{\bar f} P(-rf)\big)}$$ where $D_1=D_1(r,f,\epsilon)=e^{P(-rf)}(H_r+R_{r})$.) So, $$W(x,t,>\epsilon)\le D_0e^{b_0t}+D_1e^{b_1t}\le D e^{bt}$$ where $D=D_0+D_1$ and $b=\max\{b_1,b_2\}<\delta$. \end{proof} \begin{cor} \label{probs} Suppose that $\Sigma^+$ is a topologically mixing, one-sided, countable Markov shift with (BIP) and $f:\Sigma^+\to\mathbb R$ is a strictly positive, locally H\"older continuous function with a weak entropy gap at infinity. Let $\delta>d(f)$ be the unique constant such that $P(-\delta f)=0$. Then, given any $\epsilon>0$, there exists $a>0$ so that \begin{enumerate} \item There exists $\hat D>0$ so that $$\frac{W(x,t,>\epsilon)}{W(x,t)}\le \hat D e^{-at}$$ for any non-periodic $x\in\Sigma^+$. \item Given any cylinder $p$, there exists $D_p$ so that $$\frac{\#(\mathcal W(x,t,>\epsilon)\cap p)}{\#(\mathcal W(x,t)\cap p)}\le D_pe^{-at}$$ for any non-periodic $x\in\Sigma^+$. \end{enumerate} \end{cor} \begin{proof} By Corollary \ref{can apply renewal} we can apply the Renewal Theorem with $\phi={\bf 1}$ to see that \begin{equation} N_{f}(\mathbf{1},x,t)=W(x,t)+1=\sum_{n\geq0}\sum_{\sigma^{n}(y)=x} {\bf 1}_{\{S_{n}f(y)\leq t \}}(y)\sim\frac{h_{-\delta f}(x)}{\delta\bar f} e^{t\delta} \end{equation} uniformly in $x\in\Sigma^+$, where $\sim$ indicates that the ratio goes to 1 as $t\to\infty$. Since there exist $b<\delta$ and $D>0$ so that $W(x,t,>\epsilon)\le De^{bt}$, (1) holds with $a=\delta-b$ and some $\hat D>0$. We can similarly apply the Renewal Theorem with $\phi={\bf 1}_p$ to conclude that $$N_{f}(\mathbf{1}_p,x,t)=\#(\mathcal W(x,t)\cap p)+1=\sum_{n\geq0}\sum_{\sigma^{n}(y)=x} {\bf 1}_p {\bf 1}_{\{S_{n}f(y)\leq t \}}(y)\sim\frac{\nu(p)h_{-\delta f}(x)}{\delta\bar f} e^{t\delta}$$ uniformly in $x\in\Sigma^+$. Since $\nu(p)>0$ and $$\#(\mathcal W(x,t,>\epsilon)\cap p)\le W(x,t,>\epsilon)\le De^{bt},$$ (2) holds for some $D_p$ depending on the cylinder $p$. \end{proof} The following result will allow us to bound the error terms in our approximations. Given $T>0$, let $$P^k_T=\{p\in\Lambda_k \ |\ S_kf(z_p)\le T\}\qquad\mathrm{and}\qquad Q_T^k=\Lambda_k-P_T^k.$$ Notice that $P_T^k$ is finite for all $k$ and $T$. \begin{cor} \label{coarse estimate} Suppose that $\Sigma^+$ is a topologically mixing, one-sided, countable Markov shift with (BIP) and $f:\Sigma^+\to\mathbb R$ is a strictly positive, locally H\"older continuous function with a weak entropy gap at infinity. Let $\delta>d(f)$ be the unique constant such that $P(-\delta f)=0$. \begin{enumerate} \item There exists $G>0$ so that $$\sum_{n\ge 1}\sum_{\{y\in \sigma^{-n}(x)\}} \frac{1}{n} {\bf 1}_{ \{S_nf(y)\le t\}}(y)\le G\frac{e^{t\delta}}{t}$$ for any $x\in\Sigma^+$ and all $t>0$. \item If $k\in\mathbb N$ and $t>T>0$, then $$\sum_{n>k}\sum_{\{y\in\sigma^{-n}(x)\}} \frac{1}{n}{\bf 1}_{Q_T^k}(y) {\bf 1}_{\{S_nf(y)\le t\}} (y)\le Ge^{-T\delta}\frac{e^{t\delta}}{t-T}.$$ \end{enumerate} \end{cor} \begin{proof} Fix some $\epsilon>0$. Recall from Lemma \ref{lem:est_for_RT} that $W(x,t)\le Ce^{t\delta}$ for all $x\in\Sigma^+$. Then \begin{eqnarray*} \sum_{n\ge 1}\sum_{y\in\sigma^{-n}(x)} \frac{1}{n} {\bf 1}_{\{S_nf(y)\le t\} } (y) & = &\sum_{y\in \mathcal W(x,t,\le\epsilon)}\frac{1}{n(y)} + \sum_{y\in \mathcal W(x,t,>\epsilon)}\frac{1}{n(y)}\\ & \leq &\sum_{y\in \mathcal W(x,t,\leq\epsilon)}\left(\frac{\bar f+\epsilon}{t}\right){\bf 1}(y)+ \sum_{y\in \mathcal W(x,t,>\epsilon)}{\bf 1}(y).\\ & \le & Ce^{t\delta} \left(\frac{\bar f+\epsilon}{t}\right) +\Big(\hat D e^{-at} \Big) Ce^{t\delta}. \end{eqnarray*} So, (1) holds for some $G>0$. \medskip Now notice that \begin{eqnarray*} \sum_{n>k}\sum_{y\in\sigma^{-n}(x)} \frac{1}{n} {\bf 1}_{Q_T^k}(y){\bf 1}_{\{S_nf(y) \le t\}}(y) & \le & \sum_{n > k}\frac{1}{n} \sum_{y\in\sigma^{k-n}(x)} {\bf 1}_{\{S_{n-k}f(y)\le t -T\}}(y)\\ &= & \sum_{m\ge 1} \sum_{w\in\sigma^{-m}(x) }\frac{1}{m+k}{\bf 1}_{\{S_mf(w)\le t -T\} }(w)\\ &\le & \sum_{m\ge 1} \sum_{w\in\sigma^{-m}(x) }\frac{1}{m}{\bf 1}_{\{S_mf(w)\le t -T\} }(w)\\ & \le & Ge^{-\delta T}\frac{e^{t\delta}}{ t-T} \end{eqnarray*} which completes the proof of (2). \end{proof} \section{Counting} \begin{proof}[Proof of Theorem \ref{thm:countingN}] First notice that Lemma \ref{eventually to strictly} implies that we may assume that $f$ is strictly positive and has a weak entropy gap at infinity. We simplify notation by setting $\mu=\mu_{-\delta f}$, $\nu=\nu_{-\delta f}$, $h=h_{-\delta f}$, and $\bar f=\int f\ d\mu$, where $h_{-\delta f}:\Sigma^+\to\mathbb R$ is a bounded strictly positive function so that $\mathcal L_{-\delta f} h_{-\delta f}=h_{-\delta f}$, $\nu_{-\delta f}$ is a probability measure on $\Sigma^+$ so that $\mathcal L^*_{-\delta f} \nu_{-\delta f}=\nu_{-\delta f}$ and \hbox{$\mu_{-\delta f}=h_{-\delta f}\nu_{-\delta f}$} is the equilibrium state for $-\delta f$. Suppose that $p\in\Lambda_k$. Corollary \ref{can apply renewal} implies that we can apply the Renewal Theorem (Theorem \ref{thm:Renewal}) with $\phi={\bf 1}_p$. Therefore, \begin{alignat*}{1} L(p,t):=\#(\mathcal W(z_p,t)\cap p) & =\sum_{n\geq 1}\sum_{y\in\sigma^{-n}(z_p)}{\bf 1}_{p}(y) {\bf 1}_{\{S_{n}f(y)\leq t\}}(y) \sim C(p)e^{t\delta} \end{alignat*} where \[ C(p)=\frac{h(z_p)\nu(p)}{\delta\bar f}. \] Fix, for the moment, $p\in\Lambda_k$. We define \[ \widehat L(p,t):= \sum_{n\geq 1}\frac{1}{n} W(n,p,t)=\sum_{y\in \mathcal W(z_p,t)}\frac{1}{n(y)} {\bf 1}_p(y). \] Then \begin{alignat*}{1} \widehat {L}(p,t) & =\sum_{y\in \mathcal W(z_p,t,\le\epsilon)}\frac{1}{n(y)} {\bf 1}_p(y)+ \sum_{y\in \mathcal W(z_p,t,>\epsilon)}\frac{1}{n(y)}{\bf 1}_p(y)\\ & \leq\sum_{y\in \mathcal W(z_p,t,\leq\epsilon)}\left(\frac{\bar f+\epsilon}{t}\right){\bf 1}_p(y)+ \sum_{y\in \mathcal {W} (z_p,t,>\epsilon)}{\bf 1}_p(y). \end{alignat*} Since, by Corollary \ref{probs}, $$\#\Big( \mathcal W(z_p,t,>\epsilon)\cap p\Big)\le D_pe^{-at}\# \Big(\mathcal W(z_p,t)\cap p\Big)$$ for some $D_p,a>0$, it follows that $$\limsup_{t\to \infty} \frac{t\widehat L(p,t) }{L(p,t)}\le \bar f+\epsilon.$$ Similarly, $$ \widehat L(p,t)=\sum_{n\geq 1}\frac{1}{n}W(n,p,t) \geq\sum_{y\in \mathcal W(z_p,t,\leq\epsilon)}\left(\frac{\bar f-\epsilon}{t}\right){\bf 1}_p(y)$$ so $$\liminf_{t\to \infty} \frac{t\widehat L(p,t)}{L(p,t)}\ge \bar f-\epsilon.$$ By letting $\epsilon\to0,$ we see that $$\widehat L(p,t)\sim \frac{\bar f L(p,t)}{t}\sim \frac{C(p)\bar f}{t} e^{t\delta}.$$ Now suppose that $P$ is a subset of $\Lambda_k$ and define $$L(P,t)=\sum_{p\in P} L(p,t)\qquad\mathrm{and}\qquad\widehat L(P,t)=\sum_{p\in P} \widehat L(p,t).$$ The above analysis implies that if $P$ is {\bf finite}, then $$L(P,t)\sim \sum_{p\in P} C(p) e^{t\delta}\qquad\mathrm{and}\qquad \widehat L(P,t)\sim \sum_{p\in P} \frac{C(p)\bar f}{t} e^{t\delta}.$$ Notice that if $T>0$ and $t>T$, then Corollary \ref{coarse estimate} and Lemma \ref{lem:key} imply that there exists $C_k>0$ so that $$\frac{t\widehat L(P^k_T,t)}{e^{t\delta}}\le\frac{t \widehat L(\Lambda_k,t)}{e^{t\delta}}\le \frac{t \widehat L(P^k_T,t)}{e^{t\delta}} + tC_k e^{(s-\delta)t}+ Ge^{-\delta T}\frac{t}{ t-T}$$ for some $s\in (d(f),\delta)$, so $$\bar f\sum_{p\in P^k_T} C(p)\le \liminf_{t\to \infty} \frac{t\widehat L(\Lambda_k,t)}{e^{t\delta}}\le\limsup _{t\to \infty} \frac{t\widehat L(\Lambda_k,t)}{e^{t\delta}}\le\bar f\sum_{p\in P_T^k} C(p) + Ge^{-\delta T}$$ Applying the above inequality to the sequence $\{P_T^k\}_{T\in\mathbb N}$, we conclude that $$ \widehat L(\Lambda_k,t)\sim \sum_{p\in \Lambda_k} \frac{C(p)\bar f}{t} e^{t\delta}.$$ Lemma \ref{lem:key} implies that, given $k\in\mathbb N$ there exists $s<\delta$ and $C_k>0$, so that $$\sum_{p\in\Lambda_k}\sum_{n=1}^k\frac{1}{n}W(n,p,t)\le C_k e^{st} \qquad\mathrm{and}\qquad \sum_{n=1}^k\frac{1}{n}\#\big(\mathcal M_f(n,t)\big) \le C_ke^{st}$$ and $$\sum_{p\in\Lambda_k}\sum_{n=k}^\infty\frac{1}{n}W(n,p,t-\epsilon_k)\le\sum_{n=k}^\infty \frac{1}{n}\#\big(\mathcal M_f(n,t)\big)\le \sum_{p\in\Lambda_k}\sum_{n=k}^\infty\frac{1}{n}W(n,p,t+\epsilon_k).$$ Therefore, recalling that $M_f(t)=\sum_{n\ge 1} \frac{1}{n}\#\big(\mathcal M_f(n,t)\big)$, we see that $$\widehat L(\Lambda_k,t-\epsilon_k)-C_k e^{st}\le M_f(t)\le \widehat L(\Lambda_k,t+\epsilon_k)+C_k e^{st},$$ so $$e^{-\delta\epsilon_k}\bar f\sum_{p\in\Lambda_k} C(p)\le \liminf _{t\to \infty} \frac{t M_f(t)}{e^{t\delta}}\le\limsup_{t\to \infty} \frac{t M_f(t)}{e^{t\delta}}\le e^{\delta\epsilon_k}\bar f\sum_{p\in\Lambda_k} C(p)$$ Since $h$ is bounded and continuous and $v_k=\sup\{ \mu(p)\ |\ p\in\Lambda_k\}\to 0$ as $k\to\infty$, by Lemma \ref{lem:key} (i), \[ \sum_{p\in\Lambda_k}C(p)=\frac{1}{\delta\bar f}\sum_{p\in\Lambda_k}h(z_p)\nu(p)\to\frac{\int h\ d\nu}{\delta\bar f}=\frac{1}{\delta\bar f}. \] as $k\to\infty$. Moreover, $\lim \epsilon_k=0$. So, finally, we may conclude that $$M_f(t)\sim \frac{e^{t\delta}}{t\delta}$$ as desired. \end{proof} \section{Equidistribution} We are almost ready to prove our equidistribution result, but first we must develop one more bound in the spirit of \cite[Theorem 6]{lalley}. \subsection{Preparing to equidistribute} Suppose that $f:\Sigma^+\to\mathbb R$ and $g:\Sigma^+\to\mathbb R$ are both strictly positive, $f$ has a weak entropy gap at infinity and $P(-\delta f)=0$. We simplify notation, throughout the section, by letting $\mu=\mu_{-\delta f}$ denote the equilibrium state of $-\delta f$ and setting $\overline{f}:=\int f\ d\mu$ and $\overline{g}:=\int g\ d\mu$. Since $f$ and $g$ are strictly positive, $$c(f)=\inf\{f(x)\ |\ x\in\Sigma^{+}\}>0\qquad\mathrm{and} \qquad c(g)=\inf\{g(x)\ |\ x\in\Sigma^{+}\}>0.$$ \begin{prop} \label{count for g} Suppose that $\Sigma^+$ is a topologically mixing, one-sided, countable Markov shift with (BIP) and $f:\Sigma^+\to\mathbb R$ is a strictly positive, locally H\"older continuous function with a weak entropy gap at infinity. Let $\delta>d(f)$ be the unique constant such that $P(-\delta f)=0$. Further suppose that $g:\Sigma^+\to\mathbb R$ is strictly positive and that there exists $C>0$ so that $|f(x)-g(x)|\le C$ for all $x\in\Sigma^+$. Given $\epsilon>0$, there exist $A>0$ and $a<\delta$ so that $$\#\Big\{ y\in \mathcal W(x,t)\ :\ \Big|\frac{S_{n}g(y)}{n(y)}-\bar g\Big|>\epsilon, \Big|\frac{t}{n(y)}-\overline{f}\Big|\le\epsilon \ \Big\}\le Ae^{at}$$ for any non-periodic $x\in\Sigma^+$. \end{prop} \begin{proof} Fix $\epsilon>0$. We may assume that $\epsilon <\min\{ c(f), c(g)\}$. If $\frac{S_{n(y)}g(y)}{n(y)}-\overline{g}<-\epsilon$, then $S_{n(y)}g(y)<n(y)\overline{g}-n(y)\epsilon.$ If, in addition, $\big|\frac{t}{n(y)}-\overline{f}\big|\le\epsilon$, then \hbox{$t\le n(y)(\overline{f}+\epsilon)$}, so $$S_{n(y)}g(y)<n(y)\overline{g}-n(y)\epsilon\le n(y)\overline{g}-n(y)\frac{\epsilon}{2}-\frac{t\epsilon}{2(\overline{f}+\epsilon)}\le n(y)(\overline{g}-\epsilon_{3})-t\epsilon_{3}$$ where $\epsilon_{3}=\max\{\frac{\epsilon}{2},\frac{\epsilon}{2(\overline{f}+\epsilon)}\}>0$. Proposition \ref{adding g in} implies that $s\to P(-sg-\delta f)$ is monotone decreasing and well-defined on $(d(f)-\delta,\infty)$. So, if $s>0$, then $P(-sg-\delta f)<0$. Moreover, there exist an equilibrium state $\mu_{-sg-\delta f}$ for $-sg-\delta f$ and an eigenfunction $h_{-sg-\delta f}$ for $\mathcal{L}_{-sg-\delta f}$ with eigenvalue $e^{P(-sg-\delta f)}<1$. Furthermore, since $\left.\frac{d}{ds}\right|_{s=0}P(-sg-\delta f)=-\overline{g}<0$ (by Theorem \ref{pressure analytic}) we may choose $s>0$ so that $$-d_0:=s(\overline{g}-\epsilon_3)+P(-sg-\delta f)<0.$$ Theorem \ref{bounds on transfer} implies that there exist $\bar{R}_s>0$ and $\bar{\eta}_{s}\in(0,1)$ so that \begin{equation} \Big\| e^{-nP(-sg-\delta f)}\mathcal{L}_{-sg-\delta f}\mathbf{1}-h_{-sg-\delta f}(x)\int\mathbf{1}d\nu_{-sg-\delta f}\Big\|\le R_{s}\bar{\eta}_{s}^{n}\label{MUbounds2} \end{equation} for all $n\in\mathbb{N}$. Therefore, {\footnotesize{ \begin{eqnarray*} \#\Big\{ y\in \mathcal W(x,t) : \frac{S_{n}g(y)}{n(y)}-\bar g<-\epsilon, \big|\frac{t}{n(y)}-\overline{f}\big|\le\epsilon \Big\}&\le& \sum_{n\geq0}\sum_{\sigma^{n}(y)=x} \mathbf{1}_{\{y\ |\ S_{n}g(y)\leq n\cdot(\overline{g}-\epsilon_3)-t\epsilon_3,\ S_{n}f(y)\leq t\}}(y)\\ &\leq & \sum_{n\geq0}\sum_{\sigma^{n}(y)=x} e^{-s\big(S_{n}g(y)-n(\overline{g}-\epsilon_3)+t\epsilon_3\big)-\delta\big(S_{n}f(y)-t\big)}\\ &= & e^{t\delta-st\epsilon_3}\sum_{n\geq0}e^{n(s(\bar g-\epsilon_3)+P(-sg-\delta f))}\left(e^{-nP(-sg-\delta f)}\mathcal{L}_{-sg-\delta f}^{n}{\bf 1}\right)\\ &\leq & e^{t\delta-st\epsilon_3}\sum_{n\geq0}\left(h_{-sg-\delta f}(x)+\bar{R}_{s}\bar{\eta}_{s}^{n}\right)e^{-nd_0}\\ &\leq & D_0e^{t\delta-st\epsilon_3} \end{eqnarray*} }} for all $x\in\Sigma^{+}$, and some $D_0>0$ (which depends on $\epsilon$, $s$, $g$ and $f$). One may similarly show that there exist $\epsilon_4>0$, $r<0$ and $D_1>0$ so that $$\#\Big\{ y\in \mathcal W(x,t) :\ \frac{S_{n}g(y)}{n(y)}-\bar g >\epsilon, \big|\frac{t}{n(y)}-\overline{f}\big|\le\epsilon \ \Big\}\le D_1e^{t\delta+rt\epsilon_4}.$$ Therefore, our result holds with $A=D_0+D_1$ and $a=\max\{\delta-s\epsilon_3,\delta+r\epsilon_4\}$. \end{proof} \subsection{Proof of Theorem \ref{thm:equid_roof}} Lemma \ref{eventually to strictly} again implies that we may assume that $f$ and $g$ are strictly positive and $f$ has a weak entropy gap at infinity. Recall, from Lemma \ref{lem:key}, that there exists a sequence $\{\epsilon_{k}\}$ so that $\lim\epsilon_{k}=0$, and, for any $p\in\Lambda_{k}$ and $n\ge k$, there exists a bijection \[ \Psi_{p}^{n}:\mathrm{Fix}^{n}\cap p\to\sigma^{-n}(z_{p})\cap p \] so that \[ |S_{n}f(x)-S_{n}f(\Psi_{p}^{n}(x))|\le\epsilon_{k}\qquad\mathrm{and}\quad|S_{n}g(x)-S_{n}g(\Psi_{p}^{n}(x))|\le\epsilon_{k} \] for all $x\in\mathrm{Fix}^{n}\cap p$. Since $\lim\epsilon_{k}=0$, there exists $k_{0}$ so that if $n\ge k\ge k_{0}$, then $$c=\min\{c(f),c(g)\}>2\epsilon_{k}.$$ We assume from now on that $k\ge k_{0}$. Then, if $p\in\Lambda_k$ \begin{equation} \sum_{n\ge k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}\cap p}{}}\frac{S_{n}g(x)}{S_{n}f(x)}\leq\sum_{y\in\mathcal W(z_p,t+\epsilon_k)\cap p} \frac{1}{n(y)}\left(\frac{S_{n}g(y)+\epsilon_{k}}{S_{n}f(y)-\epsilon_{k}}\right){\bf 1}_{\{n(y)\geq k\}}(y)\label{eq:upperbound} \end{equation} and \begin{equation} \sum_{n\geq k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}\cap p}{}}\frac{S_{n}g(x)}{S_{n}f(x)}\geq\sum_{y\in\mathcal W(z_p,t-\epsilon_k)\cap p}\frac{1}{n(y)} \left(\frac{S_{n}g(y)-\epsilon_{k}}{S_{n}f(y)+\epsilon_{k}}\right){\bf 1}_{\{n(y)\geq k\}}(y).\label{eq:lowerbound} \end{equation} Since there exists $C>0$ so that $|f(x)-g(x)|\le C$ for all $x\in\Sigma^{+}$, $S_{n(y)}f(y)\ge cn(y)$ for all $y\in \Sigma^+$ and $c>2\epsilon_k$, we see that \[ \frac{S_{n}g(y)}{S_{n}f(y)}\le\frac{nC+S_{n}f(y)}{S_{n}f(y)}\le\hat{C}=\frac{C}{c}+1\ \ \ \mathrm{and}\ \ \ \frac{S_{n(y)}g(y)+\epsilon_{k}}{S_{n(y)}f(y)-\epsilon_{k}}\le 3\hat C. \] Let $$\mathcal V(x,t,\le\epsilon)=\Big\{ y\in \mathcal W(x,t)\ :\ \Big|\frac{S_{n}f(y)}{n(y)}-\bar f\Big|\le\epsilon, \Big|\frac{S_{n}g(y)}{n(y)}-\bar g\Big|\le\epsilon \ \Big\}.$$ Given $\epsilon>0$ so that $2\epsilon+2\epsilon_k < \bar f$. Proposition \ref{growth of bad set} together with Proposition \ref{count for g}, applied to both $f$ and $g$, imply that there exist $\hat A>0$ and $\hat a<\delta$ so that $$\#\big(\mathcal W(x,t)\setminus \mathcal V(x,t,\le\epsilon)\big)\le \hat Ae^{\hat a t}$$ for all $t>0$. Further recall that we saw in the proof of Theorem \ref{thm:countingN} that $$\widehat L(p,t)=\sum_{y\in \mathcal W(z_p,t+\epsilon_{k})\cap p}\frac{1}{n(y)} \sim C(p)\bar f\frac{e^{t\delta}}{t}.$$ Notice that \begin{eqnarray*} U(p,t+\epsilon_k) &:=&\sum_{y\in \mathcal W(z_p,t+\epsilon_{k})\cap p}\frac{1}{n(y)} \left(\frac{S_{n(y)}g(y)+\epsilon_{k}}{S_{n(y)}f(y)-\epsilon_{k}}\right)\\ &\leq& \left(\sum_{y\in \mathcal V(z_p,t+\epsilon_{k},\le\epsilon)\cap p}\frac{1}{n(y)}\left(\frac{\overline{g}+\epsilon+\frac{\epsilon_{k}}{n(y)}}{\overline{f}-\epsilon-\frac{\epsilon_{k}}{n(y)}}\right)\right) \ +3\hat C\#\Big( \mathcal W(z_p,t+\epsilon_{k})\setminus \mathcal V(z_p,t+\epsilon_k,\le\epsilon)\Big)\\ & &\ \ \ \ \ +3\hat C\sum_{n=1}^{k-1} W(n,p,t) \end{eqnarray*} and recall, from Lemma \ref{lem:key}, that given $s\in (d(f),\delta)$, there exists $C(k,s)$ so that $$W(n,p,t)\le C(k,s)e^{st}\qquad \mathrm{and}\qquad \#\mathcal M_f(t)\le C(k,s)e^{st}$$ for all $n<k$. Therefore, $$\limsup_{t\to\infty} \frac{U(p,t+\epsilon_k)}{\hat L(p,t+\epsilon_k)} \le\frac{\overline{g}+\epsilon+\epsilon_{k}}{\overline{f}-\epsilon-\epsilon_k}.$$ Letting $\epsilon\to 0$, we see that $$\limsup_{t\to\infty} \frac{U(p,t+\epsilon_k)}{\hat L(p,t+\epsilon_k)}\le \frac{\overline{g}+\epsilon_{k}}{\overline{f}-\epsilon_k}.$$ We can similarly show that if $$Z(p,t-\epsilon_k)=\sum_{y\in\mathcal W(z_p,t-\epsilon_k)}\frac{1}{n(y)} {\bf 1}_{p}(y)\left(\frac{S_{n}g(y)-\epsilon_{k}}{S_{n}f(y)+\epsilon_{k}}\right),$$ then $$\liminf_{t\to\infty} \frac{Z(p,t-\epsilon_k)}{\hat L(p,t-\epsilon_k)}\ge \frac{\overline{g}-\epsilon_{k}}{\overline{f}+\epsilon_k}.$$ Therefore, $$ \frac{\overline{g}-\epsilon_{k}}{\overline{f}+\epsilon_k}\le \liminf_{t\to\infty}\frac{1}{\widehat L(p,t-\epsilon_k)} \sum_{n\ge k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}\cap p}{}}\frac{S_{n}g(x)}{S_{n}f(x)} \le \limsup_{t\to\infty}\frac{1}{\widehat L(p,t+\epsilon_k)} \sum_{n\ge k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}\cap p}{}}\frac{S_{n}g(x)}{S_{n}f(x)}\leq \frac{\overline{g}+\epsilon_{k}}{\overline{f}-\epsilon_k}.$$ Since $P_T^k$ is a finite set of cylinders, for any $T$ and $k$, we see that $$ \frac{\overline{g}-\epsilon_{k}}{\overline{f}+\epsilon_k}\le \liminf_{t\to\infty}\frac{1}{\widehat L(P_T,t-\epsilon_k)} \sum_{n\ge k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}\cap P_T^k}{}}\frac{S_{n}g(x)}{S_{n}f(x)} \le \limsup_{t\to\infty}\frac{1}{\widehat L(P^k_T,t+\epsilon_k)} \sum_{n\ge k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}\cap P_T^k}{}}\frac{S_{n}g(x)}{S_{n}f(x)}\leq \frac{\overline{g}+\epsilon_{k}}{\overline{f}-\epsilon_k}.$$ Now notice that if $t>T>0$, Corollary \ref{coarse estimate} implies that \begin{equation} \sum_{n\ge k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}\cap Q_T^k}{}}\frac{S_{n}g(x)}{S_{n}f(x)}\leq3\hat C\widehat L(Q_T^k,t) \le 3\hat C Ge^{-\delta T}\frac{e^{t\delta}}{t-T} \end{equation} Therefore, as in the proof of Theorem \ref{thm:countingN}, we conclude that $$ \frac{\overline{g}-\epsilon_{k}}{\overline{f}+\epsilon_k}\le \liminf_{t\to\infty}\frac{1}{\widehat L(\Lambda_k,t-\epsilon_k)} \sum_{n\ge k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}}{}}\frac{S_{n}g(x)}{S_{n}f(x)} \le \limsup_{t\to\infty}\frac{1}{\widehat L(\Lambda_k,t+\epsilon_k)} \sum_{n\ge k}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}}{}}\frac{S_{n}g(x)}{S_{n}f(x)}\leq \frac{\overline{g}+\epsilon_{k}}{\overline{f}-\epsilon_k}.$$ Recall that $\lim\epsilon_k=0$, $$\widehat L(\Lambda_k,t-\epsilon_k)-C_k e^{st}\le M_f(t)\le \widehat L(\Lambda_k,t+\epsilon_k)+C_k e^{st},$$ for all $t>0$, and that \[ \lim_{t\to\infty}M_f(t)\frac{t\delta}{e^{\delta t}}=1, \] so we see that \[ \sum_{n=1}^{\infty}\frac{1}{n}\sum_{\stackrel[S_{n}f(x)\leq t]{x\in\mathrm{Fix}^{n}}{}}\frac{S_{n}g(x)}{S_{n}f(x)}\sim\frac{\bar{g}}{\bar{f}}\frac{e^{t\delta}}{t\delta} \] as desired. This completes the proof of Theorem \ref{thm:equid_roof}. \section{The Manhattan curve} Suppose that $f:\Sigma^{+}\to\mathbb{R}$ is locally H\"older continuous, strictly positive and has a strong entropy gap at infinity and that $g:\Sigma^{+}\to\mathbb{R}$ is also strictly positive and locally H\"older continuous and there exists $C>0$ so that $|f(x)-g(x)|<C$ for all $x\in\Sigma^{+}$. In this case, $c(f)=\inf\{f(x)\ |\ x\in\Sigma^+\}>0$ and $c(g)=\inf\{g(x)\ |\ x\in\Sigma^+\}>0$. In this case we define, the enlarged {\em Manhattan curve} \[ \mathcal{C}_0(f,g)=\{(a,b)\in\mathcal{D}(f,g)\ |\ P(-af-bg)=0\} \] where \[ \mathcal{D}(f,g)=\big\{(a,b)\in\mathbb{R}^{2}\ |\ ac(f)+bc(g)>0\ \ \mathrm{and}\ \ a+b>0\big\}. \] Notice that if $f:\Sigma^+\to\mathbb R$ and $g:\Sigma^+\to\mathbb R$ are both eventually positive and locally H\"older continuous, $f$ has a strong entropy gap at infinity and there exists $C$ so that $|f(x)-g(x)|\le C$ for all $x\in\Sigma^+$, Lemma \ref{eventually to strictly} implies that $f$ and $g$ are cohomologous to $\hat f:\Sigma^+\to \mathbb R$ and $\hat g:\Sigma^+\to\mathbb R$ (respectively) which are both strictly positive and locally H\"older continuous, $\hat f$ has a strong entropy gap at infinity and there exists $\hat C$ so that $|\hat f(x)-\hat g(x)|\le \hat C$ for all $x\in\Sigma^+$. Since $\mathcal C(f,g)=\mathcal C(\hat f,\hat g)$, Theorem \ref{Manhattan curve} follows from the following stronger statement for strictly positive functions. \medskip\noindent {\bf Theorem \ref{Manhattan curve}*:} {\em Suppose that $(\Sigma^{+},\sigma)$ is a topologically mixing, one-sided countable Markov shift with (BIP), $f:\Sigma^{+}\to\mathbb{R}$ is locally H\"older continuous, strictly positive and has a strong entropy gap at infinity and $g:\Sigma^{+}\to\mathbb{R}$ is also strictly positive and locally H\"older continuous. If there exists $C>0$ so that $|f(x)-g(x)|<C$ for all $x\in\Sigma^{+}$, then \begin{enumerate} \item $(\delta(f),0),\ (0,\delta(g))\in\mathcal{C}_0(f,g)$. \item If $(a,b)\in\mathcal{D}(f,g)$, there exists a unique $t>\frac{d(f)}{a+b}$ so that $(ta,tb)\in\mathcal{C}_0(f,g)$. \item $\mathcal{C}_0(f,g)$ is an analytic curve. \item $\mathcal{C}_0(f,g)$ is strictly convex, unless \begin{equation}\label{eq:sameperiods} S_{n}f(x)=\frac{\delta(g)}{\delta(f)}S_{n}g(x) \end{equation} for all $x\in\mathrm{Fix}^{n}$ and $n\in\mathbb{N}$. \end{enumerate} Moreover, the tangent line to $\mathcal{C}_0(f,g)$ at $(a,b)$ has slope \[ s(a,b)=-\frac{\int_{\Sigma^{+}}g\ d\mu_{-af-bg}}{\int_{\Sigma^{+}}f\ d\mu_{-af-bg}}. \] } \begin{proof} By definition, $(\delta(f),0)$ and $(0,\delta(g))$ lie on $\mathcal{C}_0(f,g)$ so (1) holds. Notice that, since $\big| S(f,a)-S(g,a)\big|\le C$ for all $a\in\mathcal A$, $d(f)=d(g)$ and $g$ also has a strong entropy gap at infinity. Moreover, if $(a,b)\in\mathcal D(f,g)$, then $af+bg$ is strictly positive, has a strong entropy gap at infinity and \[ d(af+bg)=\frac{d(f)}{a+b}. \] Lemma \ref{gap and pressure} then implies that if $(a,b)\in \mathcal D(f,g)$, then $t\to P(-t(af+bg))$ is proper and strictly decreasing on $(\frac{d(f)}{a+b},\infty)$, so there exists a unique $t>\frac{d(f)}{a+b}$ so that $P(-t(af+bg))=0$. Thus, (2) holds. Lemma \ref{equilibrium state exists} implies that there is an equilibrium state $\mu_{-af-bg}$ for $-af-bg$ and that \hbox{$\int_{\Sigma^+} (-af-bg)\ d\mu_{-af-bg}$} is finite. Notice that if $(c,d)\in\mathcal{D}(f,g)$, then the ratio $\frac{cf+dg}{af+bg}$ is bounded, this implies that $\int_{\Sigma^{+}}(cf+dg)\ d\mu_{-af-bg}$ is also finite. Theorem \ref{pressure analytic} then implies that if $(a,b)\in\mathcal{D}(f,g)$, then \[ \frac{\partial}{\partial a}P(-af-bg)=\int_{\Sigma^{+}}-f\ d\mu_{-af-bg} \] and \[ \frac{\partial}{\partial b}P(-af-bg)=\int_{\Sigma^{+}}-g\ d\mu_{-af-bg}. \] Since $f$ is strictly positive, \hbox{$\int_{\Sigma^{+}}-f\ d\mu_{-af-bg}$} is non-zero, so $P$ is a submersion on $\mathcal{D}(f,g)$. The implicit function theorem then implies that \[ \mathcal{C}_0(f,g)=\{(a,b)\in\mathcal{D}(f,g)\ |\ P(-af-bg)=0\} \] is an analytic curve and that if $(a,b)\in\mathcal{C}_0(f,g)$ then the slope of the tangent line to $\mathcal{C}_0(f,g)$ at $(a,b)$ is given by \[ s(a,b)=-\frac{\int_{\Sigma^{+}}g\ d\mu_{-af-bg}}{\int_{\Sigma^{+}}f\ d\mu_{-af-bg}}. \] Since $P$ is convex, see Sarig \cite[Proposition 4.4]{sarig-2009}, $\mathcal{C}_0(f,g)$ is convex. A convex analytic curve is strictly convex if and only if it is not a line. So it remains to show that $f$ and $g$ satisfy equation (\ref{eq:sameperiods}) if and only if $\mathcal{C}_0(f,g)$ is a straight line. If $\mathcal{C}_0(f,g)$ is a straight line, then by (1) it has slope $-\frac{\delta(f)}{\delta(g)}$. In particular, \begin{equation} -s(\delta(f),0)=\frac{\delta(f)}{\delta(g)}=\frac{\int_{\Sigma^{+}}g\ d\mu_{-\delta(f)f}}{\int_{\Sigma^{+}}f\ d\mu_{-\delta(f)f}}=\frac{\int_{\Sigma^{+}}g\ d\mu_{-\delta(g)g}}{\int_{\Sigma^{+}}f\ d\mu_{-\delta(g)g}}.\label{slope value} \end{equation} By definition, \[ h_{\sigma}(\mu_{-\delta(g)g})-\delta(g)\int_{\Sigma^{+}}g\ d\mu_{-\delta(g)g}=0 \] so, applying equation (\ref{slope value}), we see that \[ h_{\sigma}(\mu_{-\delta(g)g})-\delta(f)\int_{\Sigma^{+}}f\ d\mu_{-\delta(g)g}=\delta(g)\int_{\Sigma^{+}}g\ d\mu_{-\delta(g)g}-\delta(f)\int_{\Sigma^{+}}f\ d\mu_{-\delta(g)g}=0 \] Since $P(-\delta(f)f)=0$, this implies that $\mu_{-\delta(g)g}$ is an equilibrium state for $-\delta(f)f$. Therefore, by uniqueness of equilibrium states we see that $\mu_{-\delta(f)f}=\mu_{-\delta(g)g}$. Sarig \cite[Thm. 4.8]{sarig-2009} showed that this only happens when $-\delta(f)f$ and $-\delta(g)g$ are cohomologous, so the Livsic Theorem (Theorem \ref{livsic}) implies that this occurs if and only if \[ S_{n}f(x)=\frac{\delta(g)}{\delta(f)}S_{n}g(x) \] for all $x\in\mathrm{Fix}^{n}$ and $n\in\mathbb{N}$. We have completed the proof. \end{proof} \section{Background for applications} In this section, we recall the background material that we will need to construct the roof functions described in Theorem \ref{Roof Properties}. We will also recall the more general definition of cusped Anosov representations of geometrically finite Fuchsian groups into $\mathsf{SL}(d,\mathbb R)$. In the next section, we will see that Theorem D also extends to this setting. \subsection{Linear algebra} It will be useful to first recall some standard Lie-theoretic notation. Let $$\mathfrak{a}=\{ (a_1,\ldots,a_d)\in\mathbb R^d\ |\ a_1+\ldots+a_d=0\}$$ be the standard Cartan algebra for $\mathsf{SL}(d,\mathbb R)$ and let $$\mathfrak{a}^+=\{ (a_1,\ldots,a_d)\in\mathfrak{a}\ |\ a_1\ge\cdots\ge a_d\}$$ be the standard choice of positive Weyl chamber. Let $\mathfrak{a}^*$ be the space of linear functionals on $\mathfrak{a}$. For all $k\in\{1,\ldots, d-1\}$, let $\alpha_k:\mathfrak a\to\mathbb R$ be given by $\alpha_k(\vec a)=a_k-a_{k+1}$. Then $\{\alpha_1,\ldots,\alpha_{d-1}\}$ span $\mathfrak{a}^*$ and are the simple roots determining the Weyl chamber $\mathfrak{a}^+$. It is also natural to consider the fundamental weights $\omega_k\in\mathfrak{a}^*$ given by $\omega_k(\vec a)=a_1+\cdots+a_k$. Notice that $\{\omega_1,\ldots,\omega_{d-1}\}$ is also a basis for $\mathfrak{a}^*$. If $A\in\mathsf{SL}(d,\mathbb R)$, let $$\lambda_1(A)\ge \lambda_2(A)\ge\cdots\ge\lambda_d(A)$$ denote the moduli of the generalized eigenvalues of $A$ and let $$\sigma_1(A)\ge \sigma_2(A)\ge\cdots\ge\sigma_d(A)$$ be the singular values of $A$. The {\em Jordan projection} $$\ell:\mathsf{SL}(d,\mathbb R)\to\mathfrak a^+\ \mathrm{is\ given\ by}\ \ell(A)=(\log \lambda_1(A), \ldots,\log \lambda_d(A))$$ and the {\em Cartan projection} $$\kappa:\mathsf{SL}(d,\mathbb R)\to\mathfrak a^+\ \mathrm{is\ given\ by}\ \kappa(A)=(\log \sigma_1(A),\ldots,\log\sigma_d(A)).$$ If $\alpha_k(\ell(A))>0$, then there is a well-defined {\em attracting $k$-plane} which is the plane spanned by the generalized eigenspaces with eigenvalues of modulus at least $\lambda_k(A)$. Recall that the Cartan decomposition of \hbox{$A\in\mathsf{SL}(d,\mathbb R)$} has the form $A=KDL$ where $K,L\in\mathsf{SO}(d)$ and $D$ is the diagonal matrix with diagonal entries $d_{ii}=\sigma_i(A)$. If $\alpha_k(A)>0$, then the $k$-flag $U_k(A)=K\big(\langle e_1,\ldots, e_k\rangle\big)$ is well-defined, and is the $k$-plane spanned by the $k$ longest axes of the ellipsoid $A(S^{d-1})$. (Notice that $U_k(A)$ is not typically the attracting $k$-plane even when $\alpha_k(\ell(A))>0$.) \subsection{Cusped Anosov representations of geometrically finite Fuchsian groups} Suppose that $\Gamma\subset\mathsf{PSL}(2,\mathbb R)$ is a torsion-free geometrically finite Fuchsian group, which is not convex cocompact, and let $\Lambda(\Gamma)$ be its limit set in $\partial\mathbb H^2$. We say that a representation $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is {\em cusped $P_k$-Anosov}, for some $1\le k\le d-1$, if there exist continuous $\rho$-equivariant maps $\xi_\rho^k:\Lambda(\Gamma)\to \mathrm{Gr}_k(\mathbb R^d)$ and $\xi^{d-k}_\rho:\Lambda(\Gamma)\to \mathrm{Gr}_{d-k}(\mathbb R^d)$ so that \begin{enumerate} \item $\xi_\rho^k$ and $\xi_\rho^{d-k}$ are {\em transverse}, i.e. if $x\ne y\in\Lambda(\Gamma)$, then $$\xi_\rho^k(x)\oplus\xi_\rho^{d-k}(y)=\mathbb R^d.$$ \item $\xi_\rho^k$ and $\xi_\rho^{d-k}$ are {\em strongly dynamics preserving}, i.e. if $j$ is $k$ or $d-k$ and $\{\gamma_n\}$ is a sequence in $\Gamma$ so that $\gamma_n(0)\to x\in\Lambda(\Gamma)$ and $\gamma_n^{-1}(0)\to y\in\Lambda(\Gamma)$, then if $V\in\mathrm{Gr}_j(\mathbb R^d)$ and $V$ is transverse to $\xi_\rho^{d-j}(y)$, then $\rho(\gamma_n)(V)\to\xi_\rho^j(x)$. \end{enumerate} The original definition of a cusped $P_k$-Anosov representation in \cite{CZZ} is given in terms of a flow space, as in Labourie's original definition \cite{labourie-invent}. The characterization we give here is a natural generalization of characterizations of Gu\'eritaud-Guichard-Kassel-Wienhard \cite{GGKW}, Kapovich-Leeb-Porti \cite{KLP} and Tsouvalas \cite{kostas} in the traditional setting. Our cusped $P_k$-Anosov representations are examples of the relatively Anosov representations considered by Kapovich-Leeb \cite{KL} and the relatively dominated representations considered by Zhu \cite{feng}. The following crucial properties of cusped $P_k$-Anosov representations are established in Canary-Zhang-Zimmer \cite{CZZ}. (Several of these properties also follow from work of Kapovich-Leeb \cite{KL} and Zhu \cite{feng} once one establishes that our representations fit into their framework.) If $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is cusped $P_k$-Anosov, we define the space of type-preserving deformations $$\mathrm{Hom}_{tp}(\rho)\subset\mathrm{Hom}(\Gamma,\mathsf{SL}(d,\mathbb R))$$ to be the space of representations $\sigma$ such that if $\alpha\in\Gamma$ is parabolic, then $\sigma(\alpha)$ is conjugate to $\rho(\alpha)$. \begin{thm} {\rm (Canary-Zhang-Zimmer \cite{CZZ})} \label{PkAnosov properties} If $\Gamma$ is a geometrically finite Fuchsian group and \hbox{$\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$} is a cusped $P_k$-Anosov representation, then \begin{enumerate} \item There exist $A,a>0$ so that if $\gamma\in\Gamma$, then $$Ae^{ad(b_0,\gamma(b_0))}\ge e^{\alpha_k(\kappa(\rho(\gamma)))}\ge \frac{1}{A}e^{\frac{d(b_0,\gamma(b_0))}{a}}$$ where $b_0$ is a basepoint for $\mathbb H^2$. \item There exist $B,b>0$ so that if $\gamma\in\Gamma$, then $$Be^{b t(\gamma)}\ge e^{\alpha_k(\ell(\rho(\gamma)))}\ge \frac{1}{B}e^{\frac{t(\gamma)}{b}}$$ where $t(\gamma)$ is the translation length of $\gamma$ on $\mathbb H^2$. \item The limit maps $\xi_\rho^k$ and $\xi_\rho^{d-k}$ are H\"older continuous. \item There exists an open neighborhood $U$ of $\rho$ in $\mathrm{Hom}_{tp}(\rho)$, so that if $\sigma\in U$, then $\sigma$ is cusped \hbox{$P_k$-Anosov.} \item If $\upsilon\in\Gamma$ is parabolic and $j\in\{1,\ldots,d-1\}$, then there exists $c_j(\rho,\upsilon)\in\mathbb Z$ and $C_j(\rho,\upsilon)>0$ so that $$\big|\alpha_j(\kappa(\rho(\upsilon^n)))-c_j(\rho,\upsilon)\log n\big|<C_j(\rho,\upsilon)$$ for all $n\in\mathbb N$. Moreover, if $\eta\in\mathrm{Hom}_{tp}(\rho)$, then $c_j(\rho,\upsilon)=c_j(\eta,\upsilon)$. \item $\rho$ has the \emph{$P_k$-Cartan property}, i.e. whenever $\{\gamma_n\}$ is a sequence of distinct elements of $\Gamma$ such that $\gamma_n(b_0)$ converges to $z\in\Lambda(\Gamma)$, then $\xi_\rho^k(z)=\lim U_k(\rho(\gamma_n))$. \item $\rho$ is $P_{d-k}$-Anosov. \end{enumerate} \end{thm} \subsection{Cusped Hitchin representations} Canary, Zhang and Zimmer \cite{CZZ} also prove that cusped Hitchin representations are cusped $P_k$-Anosov for all $k$, i.e they are cusped Borel Anosov, in analogy with work of Labourie \cite{labourie-invent} in the uncusped case. We say that $A\in\mathsf{SL}(d,\mathbb R)$ is {\em unipotent and totally positive} with respect to a basis $b=(b_1,\ldots,b_d)$ for $\mathbb R^d$, if its matrix representative with respect to this basis is unipotent, upper triangular, and all the minors which could be positive are positive. Let $U_{>0}(b)$ denote the set of all such maps. One crucial property here is that $U_{>0}(b)$ is a semi-group (see Lusztig \cite{lusztig}). We say that a basis $b=(b_1,\ldots,b_d)$ is {\em consistent} with a pair $(F,G)$ of transverse flags if $\langle b_i\rangle=F^i\cap G^{d-i+1}$ for all $i$. A $k$-tuple $(F_1,\ldots,F_k)$ in $\mathcal F_d$ is {\em positive} if there exists a basis $b$ consistent with $(F_1,F_k)$ and there exists $\{u_2,\ldots,u_k\}\in U(b)_{>0}$ so that $F_i=u_i\cdots u_2F_1$ for all $i=2,\ldots, d$. If $X$ is a subset of $S^1$, we say that a map $\xi:X\to\mathcal F_d$ is {\em positive} if whenever $(x_1,\ldots,x_k)$ is a consistently ordered $k$-tuple in $X$ (ordered either clockwise or counter-clockwise), then $(\xi(x_1),\ldots,\xi(x_k))$ is a positive $k$-tuple of flags. A {\em cusped Hitchin representation} is a representation $\rho:\Gamma\to \mathsf{SL}(d,\mathbb R)$ such that if $\gamma\in\Gamma$ is parabolic, then $\rho(\gamma)$ is a unipotent element with a single Jordan block and there exists a $\rho$-equivariant positive map $\xi_\rho:\Lambda(\Gamma)\to\mathcal F_d$. (In fact, it suffices to define $\xi_\rho$ on the subset $\Lambda_{per}(\Gamma)$ consisting of fixed points of peripheral elements of $\Gamma$.) \begin{thm} {\rm (Canary-Zhang-Zimmer \cite{CZZ})} \label{cusped Hitchin properties} If $\Gamma$ is a geometrically finite Fuchsian group and \hbox{$\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$} is a cusped Hitchin representation, then \begin{enumerate} \item $\rho$ is $P_k$-Anosov for all $1\le k\le d-1$. \item $\rho$ is irreducible. \item If $\alpha\in\Gamma$ is parabolic and $1\le k\le d-1$, then $c_k(\rho,\alpha)=2$. \end{enumerate} \end{thm} We remark that Sambarino \cite{sambarino-closures} has independently established that $\rho$ is irreducible and that Kapovich-Leeb indicate in \cite{KL} that they can prove $\rho$ is Borel Anosov. \subsection{Codings for geometrically finite Fuchsian groups} A torsion-free convex cocompact Fuchsian group admits a finite Markov shift which codes the recurrent portion of its geodesic flow. The most basic such coding is the Bowen-Series coding \cite{bowen-series}. However, if the group is geometrically finite, but not convex cocompact, this coding is not well-behaved. In this case one must instead consider the countable Markov shifts constructed by Dal'bo-Peign\'e \cite{dalbo-peigne}, if the quotient has infinite area, and Stadlbauer \cite{stadlbauer} and Ledrappier-Sarig \cite{ledrappier-sarig}, if the quotient has finite area. We summarize the crucial properties of these Markov shifts in the following theorem and will give a brief description of each coding. \begin{thm} {\rm (Dal'bo-Peign\'e \cite{dalbo-peigne}, Ledrappier-Sarig \cite{ledrappier-sarig}, Stadlbauer \cite{stadlbauer})} \label{coding properties} Suppose that $\Gamma$ is a torsion-free geometrically finite, but not cocompact, Fuchsian group. There exists a topologically mixing Markov shift $(\Sigma^+,\mathcal A)$ with countable alphabet $\mathcal A$ with (BIP) which codes the recurrent portion of the geodesic flow on $T^1(\mathbb H^2/\Gamma)$. There exist maps $$G:\mathcal A\to\Gamma,\ \ \omega:\Sigma^+\to\Lambda(\Gamma),\ \ r:\mathcal A\to \mathbb N,\ \ \mathrm{and} \ \ s:\mathcal A\to\Gamma$$ with the following properties. \begin{enumerate} \item $\omega$ is locally H\"older continuous and finite-to-one, and $\omega(\Sigma^+)=\Lambda_c(\Gamma)$, i.e. the complement in $\Lambda(\Gamma)$ of the set of fixed points of parabolic elements of $\Gamma$. Moreover, $\omega(x)=G(x_1)\omega(\sigma(x))$ for every $x\in\Sigma^+$. \item If $x\in \mathrm{Fix}^n$, then $\omega(x)$ is the attracting fixed point of $G(x_1)\cdots G(x_n)$. Moreover, if $\gamma\in\Gamma$ is hyperbolic, then there exists $x\in\mathrm{Fix}^n$ (for some $n$) so that $\gamma$ is conjugate to $G(x_1)\cdots G(x_n)$ and $x$ is unique up to shift. \item There exists $Q\in\mathbb N$ such that $1\le \#(r^{-1}(n))\le Q$ for all $n\in\mathbb N$. \item There exists a finite collection $\mathcal P$ of parabolic elements of $\Gamma$, a finite collection $\mathcal R$ of elements of $\Gamma$ such that if $a\in\mathcal A$, then $s(a)\in\mathcal P\cup\{id\}$ and $G(a)=s(a)^{r(a)-2}g_a$ where $g_a\in\mathcal R$. \item Given a basepoint $b_0\in\mathbb H^2$, there exists $L>0$ so that if $x\in\Sigma^+$ and $n\in\mathbb N$, then $$d\big(G(x_1)\cdots G(x_n)(b_0),\overrightarrow{b_0\omega(x)}\big)\le L.$$ \end{enumerate} \end{thm} If $\Gamma$ is convex cocompact, then one may use the Bowen-Series \cite{bowen-series} coding $(\Sigma^+,\sigma)$ which we briefly recall to set the scene for the more complicated codings we will need in the non-convex cocompact setting. One begins with a fundamental domain $D_0$ for $\Gamma$, containing the basepoint $b_0$, all of whose vertices lie in $\partial\mathbb H^2$, so that the set of face pairings $\mathcal A$ of $D_0$ is a minimal symmetric generating set for $\Gamma$. The classical Bowen-Series coding on the alphabet $\mathcal A$ can be constructed from a ``cutting sequence'' which records the intersections $(t_k)$ of a geodesic ray $\overleftrightarrow{b_0z}$ which intersects $D_0$, where $z\in\Lambda(\Gamma)$, with edges of translates of $D_0$ so that the geodesic is entering $\gamma_k(D_0)$ as it passes through $t_k$. The classical Bowen-Series coding for $\overleftrightarrow{b_0z}$ is given by $(x_k)=(\gamma_k\gamma_{k-1}^{-1})$. Each $\gamma_k\gamma_{k+1}^{-1}$ is a face-pairing, hence this alphabet $\mathcal A$ is a finite generating set for $\Gamma$. Thus one obtains a map $G:\mathcal A\to\Gamma$, the map $\omega$ simply takes the word encoding the geodesic ray $\overrightarrow{b_0z}$ to $z$. Moreover, $r(a)=1$ and $s(a)=id$ for all $a\in\mathcal A$. A word $x$ in $\mathcal A$ is allowable in this coding if and only if $G(x_{i+1})\neq G(x_{i})^{-1}$ for any $i$. If $\Gamma$ is geometrically finite and has infinite area quotient, then we may use the Dal'bo-Peign\'e coding \cite{dalbo-peigne}. Roughly, the Dal'bo-Peign\'e coding coalesces all powers of a parabolic generator in the Bowen-Series coding. This alteration allows $\omega$ to be locally H\"older continuous. Here we may begin with fundamental domain $D_0$ for $\Gamma$, containing the origin $0$ in the Poincar\'e disk model, all of whose vertices lie in $\partial\mathbb H^2$, so that the set of face pairings $\mathcal A_0$ of $D_0$ is a minimal symmetric generating set for $\Gamma$ and such that every parabolic element of $\Gamma$ is conjugate to an element of $\mathcal A_0$. Let $\mathcal P$ denote the parabolic elements of $\mathcal A_0$. We let $$\mathcal A=\mathcal A_0\cup\{p^n\\ |\ n\ge 2,\ \ p\in\mathcal P\}.$$ In all cases, $G(a)=a$. If $a=p^n$ for some $p\in\mathcal P$, then $r(a)=n+1$, $s(a)=p$ and $g_a=p$, while if not we set $r(a)=1$, $s(a)=id$ and $g_a=a$. A word $x$ in $\mathcal A$ is allowable in this coding if and only if for any $i$, $G(x_{i+1})\neq G(x_{i})^{-1}$ and if $s(x_i)\in\mathcal P$, then $s(x_{i+1})\notin\{s(x_i),s(x_i)^{-1}\}$. For a discussion of this coding in our language, see Kao \cite{kao-manhattan}. If $\Gamma$ is geometrically finite and has a finite area quotient then one cannot use the Dal'bo-Peign\'e coding, since there is not a minimal symmetric generating set which contains elements conjugate to every primitive parabolic element of $\Gamma$. Stadlbauer \cite{stadlbauer} and Ledrappier-Sarig \cite{ledrappier-sarig} construct a (more complicated) coding in this setting which has the same flavor and coarse behavior as the Dal'bo-Peign\'e coding. One begins with a Bowen-Series coding of $\Gamma$ with alphabet $\mathcal A_0$. Let $\mathcal C$ denote a set of minimal length conjugates of primitive parabolic elements. They then choose a sufficiently large even number $2N$ so that the length of every element of $\mathcal C$ divides $2N$ and let $\mathcal P$ be the collection of powers of elements of $\mathcal C$ of length exactly $2N$. Let $\mathcal A_1$ be the set of all strings $(b_0,b_1,\ldots,b_{2N})$ in $\mathcal A_0$ so that $b_0b_1\cdots b_{2N}$ is freely reduced in $\mathcal A_0$ and so that neither $b_1b_2\cdots b_{2N}$ or $b_0b_1\cdots b_{2N-1}$ lies in $\mathcal P$. Let $\mathcal A_2$ be the set of all freely reduced strings of the form $(b,\upsilon^t,\upsilon_1,\cdots, \upsilon_{k-1}, c)$ where $b\in\mathcal A_0-\{\upsilon_{2N}\}$, $\upsilon=\upsilon_1\cdots \upsilon_{2N}\in\mathcal P$, $\upsilon_i\in\mathcal A_0$ for all $i$, $t\in\mathbb N$ and $c\in\mathcal A_0-\{\upsilon_{k}\}$. Let $\mathcal A=\mathcal A_1\cup\mathcal A_2$. If \hbox{$a=(b_0,b_1,\ldots,b_{2N})\in\mathcal A_1$}, then $G(a)=b_1$, $r(a)=1$, $s(a)=id$ and $g_a=b_1$, while if \hbox{$a=(b,\upsilon^t,\upsilon_1\cdots \upsilon_{k-1}, c)$}, then let $G(a)=\upsilon^{t-1}\upsilon_1\cdots \upsilon_{k-1}$, \color{black} $r(a)=t+1$, $s(a)=\upsilon$ and $g_a=\upsilon_{1}\cdots \upsilon_{k-1}$. The set of allowable words is defined so that if $x\in \mathrm{Fix}^n$, then $G(x_1)\cdots G(x_n)$ cannot be a parabolic element of $\Gamma$. (For a more detailed description see Stadlbauer \cite{stadlbauer}, Ledrappier-Sarig \cite{ledrappier-sarig} or Bray-Canary-Kao \cite{BCK}.) \subsection{Busemann and Iwasawa cocycles} \label{iwasawa} We will use the Busemann cocycle to define our roof functions. We first develop the theory we will need in the simpler case where $\rho$ is cusped $P_k$-Anosov for all $k$. This theory will suffice for all our application to cusped Hitchin representations, so one may ignore the discussion of partial flag varieties and partial Iwasawa cocycles on a first reading. Quint \cite{quint-ps} introduced a vector valued smooth cocycle, called the {\em Iwasawa cocycle}, $$B:\mathsf{SL}(d,\mathbb R)\times\mathcal F_d\to \mathfrak{a}$$ where $\mathcal F_d$ is the space of (complete) flags in $\mathbb R^d$. Let $F_0$ denote the standard flag $$F_0=\left(\langle e_1\rangle, \langle e_1,e_2\rangle,\ldots, \langle e_1,\ldots,e_{d-1}\rangle\right).$$ We can write any $F\in\mathcal F_d$ as $F=K(F_0)$ where $K\in\mathsf{SO}(d)$. If $A\in\mathsf{SL}(d,\mathbb R)$ and $F\in\mathcal F_d$, the Iwasawa decomposition of $AK$ has the form $QZU$ where $Q\in\mathsf{SO}(d)$, $Z$ is a diagonal matrix with non-negative entries, and $U$ is unipotent and upper triangular. Then $B(A,F)=(\log z_{11},\ldots,\log z_{dd})$. One may check that it satisfies the following cocycle property (see Quint \cite[Lemma 6.2]{quint-ps}): $$B(ST,F)=B(S,TF)+B(T,F).$$ If $A$ is loxodromic (i.e. $\alpha_k(\ell(A))>0$ for all $k$), then the set of attracting $k$-planes forms a flag $F_A$, called the attracting flag of $A$. In this case, \begin{equation} \label{loxfact} B(A,F_A)=\ell(A) \end{equation} since if $F_A=K_A(F_0)$, then $AK_A$ is upper triangular and the diagonal entries are the eigenvalues with their moduli in descending order. (See Lemma 7.5 in Sambarino \cite{sambarino-quantitative}.) The Iwasawa cocycle is also closely related to the singular value decomposition, also known as the Cartan decomposition. If $A$ is Cartan loxodromic (i.e. $\alpha_k(\kappa(A))>0$ for all $k$), then the flag $U(A)=\{U_k(A)\}$ is well-defined. If $W$ is the involution taking $e_i$ to $e_{d-i+1}$ and $A$ has Cartan decomposition $A=KDL$, then $A^{-1}$ has Cartan decomposition $$A^{-1}=\big( L^{-1}W\big)\ \big(W D^{-1}W\big)\ \big(WK^{-1}\big).$$ So if $S(A)=U(A^{-1})$, one may check that $B(A,S(A))=\kappa(A)$. Moreover, the Cartan decomposition bounds the Iwasawa cocycle, specifically $$||B(A,F)||\le ||\kappa(A)||$$ (see Benoist-Quint \cite[Corollary 8.20]{benoist-quint-book}). We will make use of the following close relationship between the Iwasawa cocycle and the Cartan projection. \begin{lem} {\rm (Quint \cite[Lemma 6.5]{quint-ps})} \label{quintlemma} For any $\epsilon\in (0,1)$, there exists $C>0$ so that if $A\in\mathsf{SL}(d,\mathbb R)$, $F\in\mathcal F_d$, $\sigma_k(A)>\sigma_{k+1}(A)$ and $\angle\Big(F^k,U_{d-k}(A^{-1})\Big)\ge\epsilon$, then $$\big|\omega_k(B(A,F))-\omega_k(\kappa(A))\big|\le C.$$ \end{lem} Given a representation $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ of a geometrically finite Fuchsian group $\Gamma$ and a $\rho$-equivariant map $\xi_\rho:\Lambda(\Gamma)\to \mathcal F_d$ we define its associated {\em Busemann cocycle} $$\beta_\rho:\Gamma\times\Lambda(\Gamma)\to\mathfrak{a}$$ by letting $$\beta_\rho(\gamma,x)=B\left(\rho(\gamma),\rho(\gamma^{-1})(\xi_\rho(x))\right).$$ The Busemann cocycle was first defined by Quint \cite{quint-ps} and was previously used to powerful effect in the setting of uncusped Hitchin representations by Sambarino \cite{sambarino-indicator}, Martone-Zhang \cite{martone-zhang} and Potrie-Sambarino \cite{potrie-sambarino}. \begin{lem} \label{busemannfacts} If $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is a representation of a geometrically finite Fuchsian group $\Gamma$ and $\xi_\rho:\Lambda(\Gamma)\to\mathcal F_d$ is a $\rho$-equivariant map, then $\beta_\rho$ satisfies the cocycle property $$\beta_\rho(\alpha\gamma,z)=\beta_\rho(\alpha,z)+\beta_\rho(\gamma,\alpha^{-1}(z))$$ for all $\alpha,\gamma\in\Gamma$ and $z\in \Lambda(\Gamma)$. Moreover, if $\rho(\gamma)$ is loxodromic and $\xi_\rho(\gamma^+)$ is the attracting flag of $\rho(\gamma)$, then $$\beta_\rho(\gamma,\gamma^+)=\ell(\rho(\gamma)).$$ \end{lem} \begin{proof} First notice that \begin{eqnarray*} \beta_\rho(\alpha\gamma,z) & = & B\left(\rho(\alpha)\rho(\gamma),\rho(\gamma^{-1})\rho(\alpha^{-1})(\xi_\rho(z))\right)\\ & = & B\left(\rho(\alpha),\rho(\alpha)^{-1}(\xi_\rho(z))\right)+ B\left(\rho(\gamma),\rho(\gamma^{-1})\rho(\alpha^{-1})(\xi_\rho(z))\right)\\ & = & \beta_\rho(\alpha,z)+\beta_\rho(\gamma,\alpha^{-1}(z)). \end{eqnarray*} Then observe that $$\beta_\rho(\gamma,\gamma^+)=B\left(\rho(\gamma),\rho(\gamma^{-1})(\xi_\rho(\gamma^+))\right)=B(\rho(\gamma),\xi_\rho(\gamma^+)).$$ Since we have assumed that $\xi_\rho(\gamma^+)$ is the attracting flag of $\rho(\gamma)$, we may apply Equation (\ref{loxfact}). \end{proof} We now generalize the theory developed above to the setting of partial flag varieties. If \newline \hbox{$\theta=\{i_1< \cdots <i_r\}\subset \{1,\ldots, d\}$}, then a {\em $\theta$-flag }is a nested collection of vector subspaces of dimension $i_j$ of the form $$F=\{0\subset F^{i_1}\subset\cdots\subset F^{i_r}\subset\mathbb R^d\}.$$ The {\em $\theta$-flag variety} $\mathcal F_\theta$ is the set of all $\theta$-flags. Let $$\mathfrak{a}_\theta=\big\{\vec a\in\mathfrak{a}\ |\ \alpha_k(\vec a)=0\ \mathrm{if}\ k\notin\theta\big\}.$$ There is a unique projection $$p_\theta:\mathfrak{a}\to\mathfrak{a}_\theta$$ invariant by $\{w\in W\colon w(\frak a_\theta)=\frak a_\theta\}$ where $W$ is the Weyl group acting on $\frak a$ by coordinate permutations. Benoist and Quint \cite[Section 8.6]{benoist-quint-book} describe a partial Iwasawa cocycle $$B_\theta:\mathsf{SL}(d,\mathbb R)\times\mathcal F_\theta\to \mathfrak{a}_\theta$$ such that $p_\theta\circ B$ factors through $B_\theta$. We say that $A\in\mathsf{SL}(d,\mathbb R)$ is $\theta$-proximal if $\alpha_k(\ell(A))>0$ for all $k\in\theta$. In this case, $A$ has a well-defined attracting $\theta$-flag $F^\theta_A$, and $$B_\theta(A,F^\theta_A)=p_\theta(\ell(A))$$ In particular, \begin{equation} \label{thetafact} \omega_k(B_\theta(A,F_A^\theta))=\omega_k(\ell(A)) \end{equation} for all $k\in\theta$. Given a representation $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ of a geometrically finite Fuchsian group $\Gamma$ and a \hbox{$\rho$-equivariant} map $\xi_\rho:\Lambda(\Gamma)\to \mathcal F_\theta$ we define its associated {\em $\theta$-Busemann cocycle} $$\beta_\rho^\theta :\Gamma\times\Lambda(\Gamma)\to\mathfrak{a}_\theta$$ by letting $$\beta^\theta_\rho(\gamma,z)=B_\theta\left(\rho(\gamma),\rho(\gamma^{-1})(\xi_\rho(z))\right).$$ Since $p_\theta$ is linear, Lemma \ref{busemannfacts} immediately generalizes to give \begin{lem} \label{busemannfacts general} If $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is a representation of a geometrically finite Fuchsian group $\Gamma$ and $\xi:\Lambda(\Gamma)\to\mathcal F_\theta$ is a $\rho$-equivariant map, then $\beta_\rho^\theta$ satisfies the cocycle property $$\beta_\rho^\theta(\alpha\gamma,z)=\beta_\rho^\theta(\alpha,z)+\beta_\rho^\theta(\gamma,\alpha^{-1}(z))$$ for all $\alpha,\gamma\in \Gamma$ and $z\in\Lambda(\Gamma)$. Moreover, if $\rho(\gamma)$ is $\theta$-proximal and $\xi_\rho(\gamma^+)$ is the attracting $\theta$-flag of $\rho(\gamma)$, then $$\beta^\theta_\rho(\gamma,\gamma^+)=p_\theta(\ell(\rho(\gamma))).$$ In particular, $$\omega_k(\beta^\theta_\rho(\gamma,\gamma^+))=\omega_k(\ell(\rho(\gamma)))$$ if $k\in\theta$. \end{lem} \section{Roof functions for Anosov representations} If $\theta\subset \{1,\ldots, d-1\}$ is non-empty, we will say that $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is cusped $\theta$-Anosov if it is cusped $P_k$-Anosov for all $k\in\theta$. We say that $\theta$ is {\em symmetric} if $k\in\theta$ if and only if $d-k\in\theta$. It will be natural to always assume that $\theta$ is symmetric, since $\rho$ is cusped $P_k$-Anosov if and only if it is cusped $P_{d-k}$-Anosov. If $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is a cusped $\theta$-Anosov representation of a geometrically finite Fuchsian group, we define a vector valued roof function $$\tau_\rho:\Sigma^+\to\mathfrak{a}_\theta$$ by setting $$\tau_\rho(x)=\beta^\theta_\rho\big(G(x_1),\omega(x)\big)=B_\theta\Big(\rho(G(x_1)),\rho(G(x_1))^{-1}\big(\xi_\rho(\omega(x))\big)\Big).$$ If $\phi$ is a linear functional on $\mathfrak{a}_\theta$ we define the {\em $\phi$-roof function} $\tau_\rho^\phi=\phi\circ\tau_\rho$. If $\rho$ is cusped Borel Anosov, i.e. if $\theta=\{1,\ldots,d-1\}$, then $\mathfrak{a}_\theta=\mathfrak{a}$ and $B_\theta=B$ so we are in the simpler setting described in the first part of Section \ref{iwasawa}. Recall that the {\em Benoist limit cone} of a representation $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is given by $$\mathcal{B}(\rho)=\overline{\bigcap_{n\ge 0}\bigcup_{||\kappa(\rho(\gamma))||\ge n} \mathbb R_+\kappa(\rho(\gamma))}\subset\mathfrak{a}^+.$$ Benoist \cite{benoist-asymptotic} showed that if $\Gamma$ is Zariski dense, then $\mathcal{B}(\rho)$ is convex and has non-empty interior. It is natural to consider linear functionals which are positive on the Benoist limit cone $$\mathcal{B}(\rho)^+=\Big\{\phi\in\mathfrak{a}^*\ | \ \phi\Big(\mathcal{B}(\rho)-\{\vec 0\}\Big)\subset (0,\infty)\Big\}.$$ Note that if $\phi\in\mathcal B(\rho)^+$, then there is a constant $c$ such that $\phi(v)>c\|v\|$ for all $v\in\mathcal B(\rho)$. We will in general consider roof functions associated to linear functionals in $\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+$. Recall that $\mathfrak{a}_{\theta}^*$ is spanned by $\{\omega_k\ |\ k\in\theta\}$. So if $\{1,d-1\}\subset\theta$ and $\rho$ is cusped $\theta$-Anosov (i.e. if $\rho$ is cusped $P_1$-Anosov), then $\omega_1$ and the Hilbert length functional $\alpha_H=\omega_1+\omega_{d-1}$ both lie in $\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+$. If $\{1,2\}\subset\theta$, then $\alpha_1=\omega_2-2\omega_1\in \mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+$, and, more generally, if $\{k-1,k,k+1\}\subset\theta$ , then $\alpha_k=-\omega_{k+1}+2\omega_k-\omega_{k-1}\in \mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+$, if $\rho$ is cusped $\theta$-Anosov. Finally, if $\theta=\{1,\ldots,d-1\}$ (i.e. $\rho$ is cusped Borel Anosov), then $$\Delta=\big\{ a_1\alpha_1+\ldots+a_{d-1}\alpha_{d-1}\ |\ \ a_i\ge0\ \ \forall i,\ \sum_{i=1}^{d-1} a_i>0\big\}\subset\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+=\mathcal B(\rho)^+.$$ \medskip\noindent {\bf Theorem \ref{Roof Properties}*:} {\em Suppose that $\Gamma$ is a torsion-free geometrically finite, but not convex cocompact, Fuchsian group, $\theta\subset \{1,\ldots,d-1\}$ is non-empty and symmetric, and $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is cusped $\theta$-Anosov. If $\phi\in\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+$, then $\tau_\rho^\phi:\Sigma^+\to\mathbb R$ is a locally H\"older continuous function such that \begin{enumerate} \item If $x=\overline{x_1\cdots x_n}$ is a periodic element of $\Sigma^+$, then $$S_n\tau_\rho^\phi(x)=\phi\Big(\ell\big(\rho(G(x_1)\cdots G(x_n))\big)\Big).$$ \item $\tau_\rho^\phi$ is eventually positive. \item There exists $C_\rho>0$ such that if $j\in\theta$, then $$\Big| \tau_\rho^{\omega_j}(x)-c_j(\rho,s(x_1))\log r(x_1)\Big|\le C_\rho$$ (with the convention that $c_j(\rho,\gamma)=0$ if $\gamma$ is not parabolic). \item $\tau_\rho^\phi$ has a strong entropy gap at infinity. Moreover, if $\phi=\sum_{k\in\theta} a_k\omega_k$, then $$d(\tau_\rho^\phi)=\frac{1}{c(\rho, \phi)}$$ where $$c(\rho,\phi)=\inf\Big\{\sum_{k\in\theta}a_kc_k(\rho,\upsilon)\ |\ \upsilon\in\Gamma\ \ \mathrm{parabolic}\Big\}.$$ \item If $\eta\in\mathrm{Hom}_{tp}(\rho)$ is also $P_k$-Anosov and $\phi\in\mathcal B(\eta)^+$, then there exists $C>0$ so that $$|\tau_\rho^\phi(x)-\tau_\eta^\phi(x)|\le C$$ for all $x\in\Sigma^+$. \item $\tau_\rho^\phi$ is non-arithmetic. \end{enumerate} } \medskip\noindent {\em Proof of Theorem \ref{Roof Properties}*.} It follows immediately from Lemma \ref{busemannfacts general} and Theorem \ref{coding properties} (1) that if $x\in\Sigma^+$, then \begin{equation} \label{roof formula} S_n\tau_\rho(x)=\sum_{j=0}^{n-1}\tau_\rho(\sigma^j(x))= \beta^\theta_\rho\big(G(x_1)\cdots G(x_m),\omega(x)\big). \end{equation} In particular, if $x=\overline{x_1\cdots x_n}\in\Sigma^+$ is periodic, then, by Lemma \ref{busemannfacts general} and Theorem \ref{coding properties} (2), \begin{equation} \label{periodic roof formula} \omega_k\big(S_n\tau_\rho(x)\big)=\omega_k\Big(\ell\big(\rho(G(x_1)\cdots G(x_n))\big)\Big), \end{equation} for all $k\in\theta$, since $\xi_\rho(\omega(x))$ is the attracting $\theta$-flag of $\rho(G(x_1)\cdots G(x_n))$. Thus, (1) holds since $\{\omega_k\ |\ k\in\theta\}$ is a basis for $\mathfrak a_\theta^\ast$ and the map $\phi\to \tau_\phi$ is linear. If $\phi\circ\tau_\rho$ is not eventually positive, then there exist sequences $\{x_n\}$ in $\Sigma^+$ and $\{ m_n\}$ in $\mathbb N$ so that $m_n\to\infty$ and $\phi\big(S_{m_n}\tau_\rho(x_n)\big)<1$ for all $n$. Let $\gamma_n=G((x_n)_1)\cdots G((x_n)_{m_n})$ and $z_n=\omega(x_n)$. Then $$\phi\big(\beta^\theta_\rho(\gamma_n,z_n)\big)<1\qquad \mathrm{for}\ \mathrm{all}\ n\in\mathbb N.$$ We may assume that $\{z_n\}$ converges to $z\in\Lambda(\Gamma)$. Theorem \ref{coding properties} (5) implies that there exists $L$ so that $d(\gamma_n(b_0),\overrightarrow{b_0z_n})\le L$ for all $n$. After passing to another subsequence, we may assume that $\{\gamma_n^{-1}(b_0)\}$ converges to some $w\in\Lambda(\Gamma)$. We pass to another subsequence, so that $\{\gamma_n^{-1}(z_n)\}$ converges to some $x\in\Lambda(\Gamma)$. Notice that $x\ne w$, since $\overrightarrow{\gamma_n^{-1}(b_0)\gamma_n^{-1}(z_n)}$ converges to a bi-infinite geodesic joining $w$ to $x$ which lies within $L$ of the basepoint $b_0$. Since $\lim \gamma_n^{-1}(b_0)=w$ and $\rho$ has the $P_k$-Cartan property for all $k\in\theta$ by Theorem \ref{cusped Hitchin properties}(6), \[ \lim U_k( \rho( \gamma_n^{-1}))=\xi^k_\rho(w). \] Since $\xi_\rho^{d-k}(x)$ and $\xi_\rho^{d-k}(w)$ are transverse, there exist $N\in\mathbb N$ and $\epsilon>0$ so that if $n>N$, then $$\angle\big(\xi_\rho^k(\gamma_n^{-1} z_n),U_{d-k}(\rho(\gamma_n)^{-1})\big)\ge\epsilon.$$ Lemma \ref{quintlemma} and the $\rho$-equivariance of the limit map $\xi_\rho$ then imply that there exists $C$ so that $$|\omega_k(\beta_\rho^\theta(\gamma_n,\xi_\rho(z_n)))-\omega_k(\kappa(\rho(\gamma_n)))|= |\omega_k(B_\theta(\rho(\gamma_n),\rho(\gamma_n^{-1})(\xi_\rho(z_n))))-\omega_k(\kappa(\rho(\gamma_n)))|\le C$$ for all $k\in\theta$ and all $n\ge N$. Since $\phi\in\mathfrak{a}_\theta^*$ this implies that there exists $\hat C>0$ such that $$|\phi(\beta^\theta_\rho(\gamma_n,\xi_\rho(z_n)))-\phi(\kappa(\rho(\gamma_n)))|\le \hat C$$ for all $n\ge N$. By Theorem \ref{PkAnosov properties}(1), $\phi(\kappa(\rho(\gamma_n)))\to\infty$, so we have achieved a contradiction. Therefore, $\tau_\rho^\phi$ is eventually positive, so (2) holds. \medskip In order to establish (3), we first notice that, since $||B_\theta(A,F)||\le ||\kappa(A)||$ for all $F\in\mathcal F_\theta$, $$|\tau_\rho^{\omega_j}(x)|\le C_{x_1}=j||\kappa(\rho(G(x_1)))||$$ for all $x\in\Sigma^+$ and $j\in\theta$. Since our alphabet is infinite and $C_{x_1}\to\infty$ as $r(x_1)\to\infty$, there is more work to be done. If $x\in\Sigma^+$ and $r(x_1)\ge 2$, then $G(x_1)=\upsilon^{n}g_a$ for some $\upsilon\in\mathcal P$ and $g_a\in \mathcal R$, where $n=r(x_1)-2$, then \begin{eqnarray*} \tau_\rho(x) & = & \beta^\theta_\rho\big(\upsilon^ng_a,\omega(x)\big)=B_\theta\big(\rho(\upsilon^ng_a),\rho(\upsilon^n g_a)^{-1}(\xi_\rho(\omega(x)))\big)\\ &= & B_\theta\big(\rho(\upsilon^n) ,\rho(\upsilon^{-n})(\xi_\rho(\omega(x)))\big)+ B_\theta\big(\rho(g_a),\rho(\upsilon^ng_a)^{-1}(\xi_\rho(\omega(x)))\big). \end{eqnarray*} Notice that $$\Big|\omega_j\Big(B_\theta\big(\rho(g_a),\rho(\upsilon^n g_a)^{-1}(\xi_\rho(\omega(x)))\big)\Big)\Big|\le R=\max\big\{ d\|\kappa(\rho(g_a)) \|\ \big|\ g_a\in \mathcal R\big\}$$ for all $j\in\theta$. Let $p$ be the fixed point of $\upsilon$ in $\Lambda(\Gamma)$. Notice that, by construction, there exists $\hat a\in\mathcal A$ so that $G(\hat a)=\upsilon g_a$. Then $X=\omega([\hat a])$ is a compact subset of $\Lambda(\Gamma)-\{p\}$. Therefore, if $G(x_1)=\upsilon^ng_a$, $\omega(x)\in \upsilon^{n-1}(X)$, so $\upsilon^{-n}(\omega(x))\in \upsilon^{-1}(X)$. It follows that there exists $\epsilon=\epsilon(\upsilon)>0$ so that if $G(x_1)=\upsilon^ng_a$ and $n\in\mathbb N$, then $$\angle\big(\rho(\upsilon^{-n})(\xi_\rho^j(\omega(x))),\xi_\rho^{d-j}(p)\big)\ge \epsilon$$ for all $j\in\theta$. Lemma \ref{quintlemma} then implies that there exists $D=D(\upsilon,g_a)>0$ so that $$\Big|\omega_j\big(B_\theta\big(\rho(\upsilon^n),\rho(\upsilon^{-n})(\xi_\rho(\omega(x)))\big)-\omega_j(\kappa(\rho(\upsilon^n)))\Big|\le D.$$ for all $n\in\mathbb N$ and $j\in\theta$. Theorem \ref{PkAnosov properties} implies that there exists $C=C(\upsilon,g_a)>0$ so that $$\big|\omega_j(\kappa(\rho(\upsilon^n)))-c_j(\rho,\upsilon)\log n\big|<C$$ for all $n\in\mathbb N$. By combining, we see that $$\Big|\omega_j\Big(B_\theta\big(\rho(\upsilon^n),\rho(\upsilon^{-n})(\xi_\rho(\omega(x)))\big)\Big)- c_j(\rho,\upsilon)\log n\Big|\le C+D$$ and hence that $$\Big| \tau_\rho^{\omega_j}(x)-c_j(\rho,\upsilon)\log \big(r(x_1)-2\big)\Big|\le C+D+R$$ for all $n\in\mathbb N$ and $j\in\theta$. Since there are only finitely many $\upsilon$ in $\mathcal P$, and only finitely many elements of $\mathcal A$ so that $r(a)\le 2$ we have completed the proof of (3). \medskip We next check that $\tau_\rho^\phi$ is locally H\"older continuous. Since $\omega:\Sigma^+\to \Lambda(\Gamma)$ is locally H\"older continuous, there exist $Z>0$ and $\zeta>0$ so that if $x_j=y_j$ for all $j\le n$, then $$d(\omega(x),\omega(y))\le Ze^{-\zeta n}.$$ Since $\xi_\rho:\Lambda(\Gamma)\to\mathcal F_d$ is H\"older, there exist $D>0$ and $\iota>0$, so that if $z,w\in\Lambda(\Gamma)$, then $$d(\xi_\rho(z),\xi_\rho(w))\le Dd(z,w)^\iota$$ Therefore, $\xi_\rho\circ\omega$ is locally H\"older continuous, i.e. there exists $C$ and $\beta>0$ so that $$d(\xi_\rho(\omega(x)),\xi_\rho(\omega(y)))\le Ce^{-\beta n}$$ if $x_j=y_j$ for all $j\le n$. If $a\in\mathcal A$, let $$D_a=\sup\left\{||D_FB_\theta(\rho(G(a)),\cdot)||\ \Big|\ F\in\mathcal F_\theta\right\}$$ where $D_FB_\theta(\rho(G(a)),\cdot)$ is the derivative at $F$ of $B_\theta(\rho(G(a)),\cdot):\mathcal F_\theta\to\mathfrak{a}_\theta$. It follows that if $x_j=y_j$ for all $j\le n$ and $x_1=y_1=a$, then $$|\tau^{\phi}_\rho(x)-\tau_\rho^{\phi}(y)|\le ||\phi||D_aCe^{-\beta n}$$ Recall that if $x\in\Sigma^+$ and $G(x_1)=\upsilon^mg_a$, then $$\tau_\rho(x) = B_\theta\big(\rho(\upsilon^m),\rho(\upsilon^{-m})(\xi_\rho(\omega(x)))\big)+ B_\theta\big(\rho(g_a),\rho(\upsilon^mg_a)^{-1}(\xi_\rho(\omega(x)))\big)$$ and that $\upsilon^{-m}(\omega(x))$ lies in a compact subset $\upsilon^{-1}(X)$ of $\Lambda(\Gamma)-\{p\}$ (where $p$ is the fixed point of $\upsilon$). There exists $c>0$ so that if $x,y\in \upsilon^{-1}(X)$ and $r\in\mathbb N$, then $$d(\upsilon^r(x),\upsilon^r(y))\le \frac{c}{r^2} d(x,y).$$ Notice that, by the cocycle property for $B_\theta$, $$B_\theta\big(\rho(\upsilon^m),F\big)=\sum_{j=1}^m B_\theta(\rho(\upsilon),\upsilon^{j-1}(F)).$$ Thus, if $$\hat D=\hat D(\upsilon)=\sup\left\{||D_FB_\theta(\rho(\upsilon),\cdot)||\ \Big|\ F\in\mathcal F_\theta\right\}$$ then $$||B_\theta\big(\rho(\upsilon^m),x\big)-B_\theta\big(\rho(\upsilon^m),y\big)||\le \sum_{s=1}^m \hat D\frac{c}{s^2}d(x,y)$$ if $x,y\in \upsilon^{-1}(X)$. Notice that there exists $T=T(\upsilon)>0$ so that this series can be bounded above by $T d(x,y)$. Therefore, if $x_j=y_j$ for all $j=1,\ldots, n$ and $G(x_1)=\upsilon^sg_a$ where $s\ge 1$, then $$|(\phi\circ\tau_\rho)(x)-(\phi\circ\tau_\rho)(y)|\le (T+R)C||\phi||e^{-\beta n}$$ where $$R=\sup\left\{||D_FB_\theta(\rho(g_a),\cdot)||\ \Big|\ F\in\mathcal F_d, \ \ g_a\in\mathcal R\ \right\}.$$ Since there are only finitely many $\upsilon$ in $\mathcal P$ and only finitely many elements of $\mathcal A$ so that $r(a)\le 2$, $\tau_\rho^\phi$ is locally H\"older continuous. \medskip If $\phi=\sum_{k\in\theta}a_k\omega_k$ and $\upsilon\in\mathcal P$, let $$c(\rho,\phi,\upsilon)=\sum_{k\in\theta} a_k c_k(\rho,\upsilon)\qquad\mathrm{and}\qquad c(\rho,\phi)=\inf\{ c(\rho,\phi,\upsilon)\ |\ \upsilon\in\mathcal P\}.$$ Notice that $c(\rho,\phi)$ must be positive, since $\phi\in\mathcal B(\rho)^+$. Property (3) then implies that $$\big|\tau_\rho^\phi(x) -c(\rho,\phi,s(x_1))\log (r(x_1))\big| \le C_\rho ||\phi||$$ for all $x\in\Sigma^+$. Therefore, $$\sum_{n=1}^\infty e^{-sC_\rho||\phi||}\frac{1}{n^{s c(\rho,\phi)}}=\sum_{n=1}^\infty e^{-s\big(c(\rho,\phi)\log n+C_\rho ||\phi||\big)}\le Z_1(\tau_\rho^\phi,s)$$ and $$Z_1(\tau_\rho^\phi,s)\le \sum_{n=1}^\infty Qe^{-s\big(c(\rho,\phi)\log n-C_\rho ||\phi||\big)}\le \sum_{n=1}^\infty Qe^{sC_\rho||\phi||}\frac{1}{n^{s c(\rho,\phi)}}$$ if $s>0$. (Recall that if $n\in\mathbb N$, then $1\le\#\{ a\in\mathcal A\ |\ r(a)=n\}\le Q$.) Therefore, $Z_1(\tau_\rho^\phi,s)$ converges if and only if $s>\frac{1}{c(\rho,\phi)}$, which establishes (4). \medskip If $\eta\in\mathrm{Hom}_{tp}(\rho)$ is cusped $\theta$-Anosov and $\phi\in \mathcal B(\eta^+)$, then $c_j(\rho,\upsilon)=c_j(\eta,\upsilon)$ for all $j\in\theta$ and $\upsilon\in\mathcal P$. Property (5) then follows from applying (3) to both $\tau_\rho$ and $\tau_\eta$ and the fact that both $\tau_\rho^\phi$ and $\tau_\eta^\phi$ are locally H\"older continuous. \medskip We may assume that the Zariski closure $\mathsf{G}$ of $\rho(\Gamma)$ is reductive. (If it is not reductive, then Gu\'eritaud-Guichard-Kassel-Wienhard \cite[Section 2.5.4]{GGKW} exhibit a representation $\rho^{ss}:\Gamma\to \sf{SL}(d, \mathbb R)$ so that the Zariski closure of $\rho^{ss}(\Gamma)$ is reductive and $\ell(\rho(\gamma))=\ell(\rho^{ss}(\gamma))$ for all $\gamma\in \Gamma$.) A result of Benoist-Quint \cite[Proposition 9.8]{benoist-quint-book} then implies that the subgroup $\frak h$ of the Cartan algebra $\mathfrak{a}_{\mathfrak{g}}$ of $\mathsf{G}$ generated by $\lambda_{\mathsf{G}}(\rho(\Gamma))$ is dense in $\mathfrak{a}_{\mathfrak{g}}$ (where $\lambda_{\mathsf{G}}:\mathsf{G}\to \mathfrak{a}_{\mathfrak{g}}$ is the Jordan projection of $\mathsf{G}$). Up to conjugation, we may assume that $\mathfrak{a}_{\mathfrak{g}}$ is a sub-algebra of $\mathfrak{a}$ (since $\mathfrak a_{\mathfrak g}$ is an abelian algebra and thus is contained in a translate of $\mathfrak a$, which is a maximal abelian sub-algebra of $\mathfrak{sl}(d,\mathbb R)$). Therefore, the subgroup of $\mathbb R$ generated by $\{\phi\circ\tau_\rho(x)\ |\ x\in\mathrm{Fix}^n\}$, which is just $\phi(\mathfrak h)$, is dense in $\mathbb R$. Thus, we have established (6). \qed \medskip \section{Applications}\label{sec:applications} \subsection{Anosov representations of geometrically finite Fuchsian groups} Given Theorem \ref{Roof Properties}*, we can apply our main results to the roof functions of Anosov representations. The following counting result is a strict generalization of Corollary \ref{cusped counting}. It follows immediately from Theorems \ref{Roof Properties}* and \ref{thm:countingN}. \begin{cor} Suppose that $\Gamma$ is a torsion-free, geometrically finite, but not convex cocompact, Fuchsian group, $\theta\subset\{ 1,\ldots,d-1\}$ is non-empty and symmetric, and $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is cusped $\theta$-Anosov. If $\phi\in\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+$, then there exists a unique $\delta_\phi(\rho)>\frac{1}{c(\rho,\phi)}$ so that $P(-\delta_\phi(\rho) \tau_\rho^\phi)=0$ and $${\displaystyle \lim_{t\to\infty}M_{\phi}(t)\frac{t\delta_\phi(\rho)}{e^{t\delta_\phi(\rho)}}}=1$$ where $$M_{\phi}(t)=\#\Big\{[\gamma]\in[\Gamma]\ \big|\ 0< \phi(\ell(\rho(\gamma)))\le t\Big\}.$$ \end{cor} Similarly, one may combine Theorems \ref{Manhattan curve} and \ref{Roof Properties}* to obtain a generalization of Corollary \ref{CuspedManhattan}. \begin{cor}\label{cor:manhattan_applications} Suppose that $\Gamma$ is a torsion-free, geometrically finite, but not convex cocompact Fuchsian group, $\theta\subset\{ 1,\ldots,d-1\}$ is non-empty and symmetric, and $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is cusped $\theta$-Anosov. If $\eta\in\mathrm{Hom}_{tp}(\rho)$ is also cusped $\theta$-Anosov, $\phi\in\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+\cap\mathcal B(\eta)^+$, and $$\mathcal C^{\phi}(\rho,\eta)=\big\{ (a,b)\in \mathcal D(\rho,\eta) \ | \ P(-a\tau_\rho^{\phi}-b\tau_\eta^{\phi})=0\big\}$$ where $$\mathcal D(\rho,\eta)=\big\{(a,b)\in\mathbb R^2\ |\ a+b>c(\rho,\phi)\big\},$$ then \begin{enumerate} \item $\mathcal C^\phi(\rho,\eta)$ is an analytic curve, \item $(\delta_{\phi}(\rho),0)$ and $(0,\delta_{\phi}(\eta))$ lie on $\mathcal C^\phi(\rho,\eta)$, \item $\mathcal C^\phi(\rho,\eta)$ is strictly convex, unless $$\ell^{\phi}(\rho(\gamma))=\frac{\delta_\phi(\eta)}{\delta_\phi(\rho)}\ell^{\phi}(\eta(\gamma))$$ for all $\gamma\in\Gamma$, \item and the tangent line to $\mathcal C^{\phi}(\rho,\eta)$ at $(\delta_{\phi}(\rho),0)$ has slope $$s^\phi(\rho,\eta)=-\frac{\int \tau_\eta^{\phi} dm_{-\delta_{\phi}(\rho)\tau^{\phi}_\rho}}{\int \tau_\rho^{\phi}\ dm_{-\delta_{\phi}(\rho)\tau^{\phi}_\rho}}. $$ \end{enumerate} \end{cor} In the setting of the previous corollary, we may define the {\em pressure intersection} \hbox{$I^{\phi}(\rho,\eta)=-s^\phi(\rho,\eta)$} and the {\em renormalized pressure intersection} $$J^{\phi}(\rho,\eta)=\frac{\delta^{\phi}(\eta)}{\delta^{\phi}(\rho)}I^{\phi}(\rho,\eta).$$ We obtain the following intersection rigidity result which will be used crucially in the construction of pressure metrics. The proof follows at once from statements (3) and (4) in Corollary \ref{cor:manhattan_applications}. \begin{cor} Suppose that $\Gamma$ is a torsion-free, geometrically finite, but not convex cocompact, Fuchsian group, $\theta\subset\{ 1,\ldots,d-1\}$ is non-empty and symmetric, and $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is cusped $\theta$-Anosov. If $\eta\in\mathrm{Hom}_{tp}(\rho)$ is also cusped $\theta$-Anosov and $\phi\in\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+\cap\mathcal B(\eta)^+$, then $$J^{\phi}(\rho,\eta)\ge 1$$ with equality if and only if $$\ell^{\phi}(\rho(\gamma))=\frac{\delta_\phi(\eta)}{\delta_\phi(\rho)}\ell^{\phi}(\eta(\gamma))$$ for all $\gamma\in\Gamma$. \end{cor} Finally, we derive our equidistribution result, which generalizes Corollary \ref{geometric intersection}. It follows immediately from Theorems \ref{thm:equid_roof} and \ref{Roof Properties}*. \begin{cor} Suppose that $\Gamma$ is a torsion-free, geometrically finite, but not convex cocompact, Fuchsian group, $\theta\subset\{ 1,\ldots,d-1\}$ is non-empty and symmetric, and $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is cusped $\theta$-Anosov. If $\eta\in\mathrm{Hom}_{tp}(\rho)$ is also cusped $\theta$-Anosov and $\phi\in\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+\cap\mathcal B(\eta)^+$, then $$I^{\phi}(\rho,\eta)=\lim_{T\to\infty} \frac{1}{\#(R_T^{\phi}(\rho))}\sum_{[\gamma]\in R_T^{\phi}(\rho)} \frac{\ell^{\phi}(\eta(\gamma))}{\ell^{\phi}(\rho(\gamma))}$$ where $R_T(\rho)=\{ [\gamma]\in\Gamma\ |\ 0<\ell^\phi(\rho(\gamma))\le T\}$. \end{cor} \subsection{Traditional Anosov representations} Andres Sambarino \cite{sambarino-quantitative,sambarino-indicator,sambarino-orbital} established analogues of our counting and equidistribution results in the setting of traditional ``uncusped'' Anosov representations. In this section, we will sketch how to establish (mild generalizations of) his results in our framework. We start by recalling a characterization of Anosov representations of word hyperbolic groups established by Kapovich-Leeb-Porti \cite{KLP2} and Bochi-Potrie-Sambarino \cite{BPS}. If $\Gamma$ is a word hyperbolic group, then a representation $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is $P_k$-Anosov if there exist $A,a>0$ so that $$\frac{\sigma_k(\rho(\gamma))}{\sigma_{k+1}(\rho(\gamma))}\ge Ae^{a|\gamma|}$$ for all $\gamma\in\Gamma$, where $|\gamma|$ is the word length of $\gamma$ with respect to some fixed generating set on $\Gamma$. In this case, it is known (see \cite{BCLS} or \cite{CLT}) that there is a finite Markov shift $(\Sigma_\Gamma^+,\sigma)$ for the geodesic flow of $\Gamma$ and a surjective map $$G:\bigcup_{n\in\mathbb N} \mathrm{Fix}^n\to[\Gamma].$$ Moreover, if $\theta\subset\{1,\ldots,d-1\}$ is non-empty and symmetric, $\rho$ is $\theta$-Anosov, and $\phi\in\mathfrak{a}_\theta\cap\mathcal B(\rho)^+$, then there exists a H\"older continuous function $\tau_\rho^\phi:\Sigma_\Gamma^+\to\mathbb R$ so that if $x\in\mathrm{Fix}^n\subset\Sigma_\Gamma^+$, then $$ S_n\tau_\rho^\phi(x)=\phi(\ell(\rho(G(x)))).$$ Lalley \cite[Theorems\ 5\ and\ 7]{lalley} established analogues of our counting and equidistribution results for finite Markov shifts. Moreover, our proofs generalize his techniques so they go through in the setting of finite Markov shifts without any assumptions on entropy gap. \begin{cor} Suppose that $\Gamma$ is a word hyperbolic group, $\theta\subset\{1,\ldots,d-1\}$ is non-empty and symmetric, and $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ is $\theta$-Anosov. If $\phi\in\mathfrak{a}_\theta^*\cap\mathcal B(\rho)^+$, then there exists a unique $\delta_\phi(\rho)>0$ so that $P(-\delta_\phi(\rho) \tau_\rho^\phi)=0$ and $${\displaystyle \lim_{t\to\infty}M_{\phi}(t)\frac{t\delta_\phi(\rho)}{e^{t\delta_\phi(\rho)}}}=1$$ where $$M_{\phi}(t)=\#\Big\{[\gamma]\in[\Gamma]\ \big|\ \phi(\ell(\rho(\gamma)))\le t\Big\}.$$ \end{cor} \begin{proof} Our proof of property (6) in Theorem \ref{Roof Properties}* gives immediately that $\tau_\rho^\phi$ is non-arithmetic, which is the only assumption needed to apply our Theorem \ref{thm:countingN} or Theorem 7 in \cite{lalley} in the setting of a finite Markov shift. \end{proof} We also obtain a Manhattan Curve theorem, which does not seem to have appeared in print before in this generality, but was certainly well-known to experts. In particular, Sambarino \cite[Proposition 4.7]{sambarino-indicator} describes a closely related phenomenon for Borel Anosov representations. \begin{cor} Suppose that $\Gamma$ is a word hyperbolic group, $\theta\subset\{1,\ldots,d-1\}$ is non-empty and symmetric, and that $\rho:\Gamma\to\mathsf{SL}(d,\mathbb R)$ and $\eta:\Gamma\to\mathsf{SL}(d,\mathbb R)$ are $\theta$-Anosov. If $\phi\in\mathfrak{a}_\theta^*\cap\mathcal{B}(\rho)^+\cap\mathcal{B}(\eta)^+$ and $$\mathcal C^{\phi}(\rho,\eta)=\big\{ (a,b)\in \mathbb R^2 | \ a+b>0\ \mathrm{and}\ P(-a\tau_\rho^{\phi}-b\tau_\eta^{\phi})=0\big\},$$ then \begin{enumerate} \item $\mathcal C^\phi(\rho,\eta)$ is an analytic curve, \item $(\delta_{\phi}(\rho),0)$ and $(0,\delta_{\phi}(\eta))$ lie on $\mathcal C^\phi(\rho,\eta)$, \item and $\mathcal C^\phi(\rho,\eta)$ is strictly convex, unless $$\ell^{\phi}(\rho(\gamma))=\frac{\delta_\phi(\eta)}{\delta_\phi(\rho)}\ell^{\phi}(\eta(\gamma))$$ for all $\gamma\in\Gamma$. \end{enumerate} Moreover, the tangent line to $\mathcal C^{\phi}(\rho,\eta)$ at $(\delta_{\phi}(\rho),0)$ has slope $$-I^{\phi}(\rho,\eta)=-\frac{\int \tau_\eta^{\phi} dm_{-\delta_{\phi}(\rho)\tau^{\phi}_\rho}}{\int \tau_\rho^{\phi}\ dm_{-\delta_{\phi}(\rho)\tau^{\phi}_\rho}} $$ \end{cor} The analogues of Corollaries \ref{intersection rigidity} and \ref{geometric intersection} appear in \cite[Section 8]{BCLS} as consequences of classical Thermodynamical results of Bowen, Pollicott and Ruelle \cite{bowen, bowen-ruelle,pollicott,ruelle}. \medskip\noindent {\bf Historical Remarks:} In the counting estimates and equistribution results in his papers, Sambarino assumes that $\rho$ is irreducible if $\theta=\{1,d-1\}$ (see \cite{sambarino-quantitative}) or Zariski dense if $\rho$ is Borel Anosov (see \cite{sambarino-indicator,sambarino-orbital}) and that $\Gamma=\pi_1(M)$ where $M$ is a negatively curved manifold. However, after \cite{BCLS} the generalizations stated here would certainly have been well-known to him. Carvajales \cite[Appendix A]{carvajales-quadratic} uses results from \cite{BCLS} to explain how one can remove the assumption that $\Gamma=\pi_1(M)$ in Sambarino's work. The removal of the irreducibility assumption follows from the construction of the semi-simplification in \cite{GGKW}. Pollicott and Sharp \cite{PS-Hitchin} independently derived related counting results for Hitchin representations.
\section{Introduction} \label{intro} Deep learning algorithms, commonly referred as Deep Neural Networks~\cite{Goodfellow-et-al-2016,10.1162/neco.2006.18.7.1527,DBLP:journals/nature/LeCunBH15}, are inspired by deep hierarchical structures of human perception as well as production systems~\cite{galvan2020neuroevolution}. These algorithms have achieved expert human-level performance in multiple areas including computer vision problems~\cite{DBLP:conf/cvpr/SzegedyLJSRAEVR15}, games~\cite{Silver_2016}, to mention a few examples. The design of deep neural networks (DNNs) architectures (along with the optimisation of their hyperparameters) as well as their training plays a crucial part for their success or failure~\cite{LIU201711}. Neural architecture search is a reality: a great variety of methods have been proposed over recent years including Monte Carlo-based simulations~\cite{negrinho2017deeparchitect}, random search~\cite{journals/jmlr/BergstraB12} and random search with weight prediction~\cite{DBLP:journals/corr/abs-1708-05344}, hill-climbing~\cite{elsken2017simple}, grid search~\cite{DBLP:conf/bmvc/ZagoruykoK16}, Bayesian optimisation~\cite{10.5555/3042817.3042832,DBLP:conf/nips/KandasamyNSPX18}, gradient-based~\cite{liu2018darts,xie2018snas}, and mutual information~\cite{Tapia_2020,DBLP:journals/corr/TishbyZ15,yu2019understanding}. However, two methods started gaining momentum thanks to their impressive results: reinforcement learning (RL) methods~\cite{10.5555/3312046} and evolution-based methods~\cite{Back:1996:EAT:229867,EibenBook2003}, sometimes referred to as neuroevolution in the context of neural architecture search~\cite{galvan2020neuroevolution}, whereas the latter method started dominated the area due to better performance in e.g., terms of accuracy, as well as being reported to require less computational time to find competitive solutions~\cite{DBLP:conf/aaai/RealAHL19,8712430} compared to reinforcement learning methods. \section{State-of-the-art in Neuroevolution in Deep Neural Networks} \label{sec:state} There has been an increased interest in the correct design (and to a lesser degree training) of deep neural networks by means of Evolutionary Algorithms, as extensively discussed in our recent work, summarising over 100 recent papers in the area or neuroevolution in deep neural networks~\cite{galvan2020neuroevolution}. Figure~\ref{fig:birdsView} shows a visual representation of the research trends followed in neuroevolution in deep neural networks. This is the result of using keywords used in titles and abstract of around 100 published in the last 5 years. We computed a similarity metric between these keywords and each paper. These similarities induce corresponding graph structures on the paper and key term `spaces’. Each paper/term corresponds to a node and edges arise naturally whenever there is a similarity between nodes. Details on how to generate this graph are given in~\cite{Poli:2008:APA:1362102.1384933}. \begin{figure}[tbh!] \centering \includegraphics[width=0.95\textwidth]{figures/temporal_13} \caption{Bird’s-eye view analysis of the research conducted in the area of neuroevolution in DNNS. The rest-length for repulsive forces between nodes was set to 13.} \label{fig:birdsView} \end{figure} \subsection{Evolving Deep Neural Networks' Architectures with Evolutionary Algorithms} The use of evolution-based methods in designing DNN is already a reality as discussed in~\cite{galvan2020neuroevolution}. Different Evolutionary Algorithms with different representations have been used, ranging from landmark evolutionary methods including Genetic Algorithms~\cite{10.5555/531075}, Genetic Programming~\cite{Koza:1992:GPP:138936} and Evolution Strategies~\cite{10.1023/A:1015059928466,10.1007/978-3-642-81283-5_8} up to using hybrids combining, for example, the use of Genetic Algorithms and Grammatical Evolution~\cite{10.1007/BFb0055930}. In a short period of time, we have observed both ingenious representations and interesting approaches achieving extraordinary results against human-expert configured networks~\cite{DBLP:conf/aaai/RealAHL19}. We have also seen state-of-the-art approaches in some cases employing hundreds of computers~\cite{10.5555/3305890.3305981} to using just a few GPUs~\cite{8712430}. Most neuroevolution studies have focused their attention in designing deep Convolutional Neural Networks. Other networks have also been considered including Autoencoders, Restricted Boltzmann Machines, Recurrent Neural Networks and Long Short Term Memory, although there are just a few neuroevolution works considering the use of these types of networks. Our recent article~\cite{galvan2020neuroevolution} summaries, in a series of informative tables, the EA representation used, the representation of individuals, genetic operators used, and the EA parameters. They also outline the computational resources used in the corresponding study by attempting to outline the number of GPUs used. A calculation of the GPU days per run is approximated as in Sun et al.~\cite{8742788}. We indicate benchmark datasets used in the experimental analysis. Finally, the table indicates if the neural network architecture has been evolved automatically or by using a semi-automated approach whilst also indicating the target DNN architecture. Every selected paper does not report the same information. Some papers omit details about computational resources while others omit information about the number of runs. A very interesting output from this summary is that there are numerous differences between the approaches used by all of the papers listed. Crossover is omitted from several studies mostly due to encoding adopted by various researchers. Population size and selection strategies for the EAs change between studies. While our recent article~\cite{galvan2020neuroevolution} clearly demonstrates that MNIST and CIFAR are the most popular benchmark datasets we can see many examples of studies using benchmark datasets from specific application domains. \subsection{Training Deep Neural Networks Through Evolutionary Algorithms} In the early years of neuroevolution, it was thought that evolution-based methods might exceed the capabilities of backpropagation~\cite{784219}. As Artificial Neural Networks, in general, and as Deep Neural Networks (DNNs), in particular, increasingly adopted the use of stochastic gradient descent and backpropagation, the idea of using Evolutionary Algorithms (EAs) for training DNNs instead has been almost abandoned by the DNN research community. EAs are a ``genuinely different paradigm for specifying a search problem''~\cite{10.1145/2908812.2908916} and provide exciting opportunities for learning in DNNs. When comparing neuroevolutionary approaches to other approaches such as gradient descent, authors such as Khadka et al.~\cite{DBLP:journals/ec/KhadkaCT19} urge caution. A generation in neuroevolution is not readily comparable to a gradient descent epoch. Despite the fact that it has been argued that EAs can compete with gradient-based search in small problems as well as using NN with a non-differentiable activation function~\cite{MANDISCHER200287}, the encouraging results achieved in the 1990s~\cite{Goerick_evolutionstrategies:,10.5555/1623755.1623876,10.1109/64.393138} have inspired some researchers to carry out research in training DNNs. This includes the work conducted by David and Greental~\cite{10.1145/2598394.2602287} and Fernando et al.~\cite{10.1145/2908812.2908890} both of which using deep autoeconders and Pawelczyk et al.~\cite{10.1145/3205651.3208763} and Such et al.~\cite{Such2017DeepNG} who use deep Convolutional Neural Networks. An informative summary of the works carried out on the training of DNNs using Evolutionary Algorithms can be seen in the our recent article~\cite{galvan2020neuroevolution}. \section{Mutations and Neutral Theory} \label{sec:mutations} Kimura's neutral theory of molecular evolution~\cite{Kimura,kimura_1983} states that the majority of evolutionary changes at molecular level are the result of random fixation of \textit{selectively neutral mutations}. A mutation from one gene to another is neutral if it does not affect the phenotype. Thus, most mutations that take place in natural evolution are neither advantageous nor disadvantageous for the survival of individuals. It is then reasonable to extrapolate that, if this is how evolution has managed to produce the amazing complexity and adaptations seen in nature, then neutrality should aid also EAs. However, whether neutrality helps or hinders the search in EAs is ill-posed and cannot be answered in general. One can only answer this question within the context of a specific class of problems, (neutral) representations and set of operators~\cite{DBLP:phd/ethos/GalvanLopez09,DBLP:conf/eurogp/LopezDP08,DBLP:conf/gecco/LopezP06,DBLP:conf/ppsn/LopezP06_2,DBLP:conf/micai/LopezP09,DBLP:journals/evs/LopezPKOB11,10.1007/978-3-540-73482-6_9,DBLP:journals/tec/PoliL12}. We are not aware of any works in neuroevolution in DNNs on neutrality. In our recent in-depth review article on neuroevolution in deep neural networks~\cite{galvan2020neuroevolution}, we have seen that numerous studies used selection and mutation only to drive evolution in automatically finding a suitable deep neural network architecture or to train a neural network. Interestingly, many researchers have reported highly encouraging results when using these two genetic operators, including the works conducted by Real et al.~\cite{DBLP:conf/aaai/RealAHL19,10.5555/3305890.3305981} using GAs and hundreds of GPUs as well as the work carried out by Suganuma et al.~\cite{10.1145/3071178.3071229} employing Cartesian Genetic Programming and using only a few GPUs. If neutrality is beneficial, taking into consideration specific classes of problems, representations and genetic operators, this can also have an immediately positive impact in the time needed to test the configuration of DNNs because the evaluation of potential EA candidate solutions will not be necessary. There are some interesting encodings adopted by researchers including Suganuma's work~\cite{10.1145/3071178.3071229} (see Fig.~\ref{fig:cartesianCNN}) that allow the measurement of the level of neutrality present in evolutionary search and can potentially indicate whether its presence is beneficial or not in certain problems and DNNs. Fig.~\ref{fig:cartesianCNN} helps to illustrate how neutrality can be explicitly be promoted (or impeded) in evolutionary algorithms. The genotypic representation of a cartesian genetic programming~\cite{Miller2011} individual encoding a CNN architectures is shown in Fig~\ref{fig:cartesianCNN} (a). This is then decoded to a phenotypic representation Fig.~\ref{fig:cartesianCNN} (b), worth noting is how gene number 5 in the genotype is not expressed in the phenotype. Thus, any mutation taking place in gene 5 will not affect the phenotype which defines the CNN architecture depicted in Fig.~\ref{fig:cartesianCNN} (c). \begin{figure}[tbh!] \centering \includegraphics[width=0.95\textwidth]{figures/cartesianCNN.eps} \caption{\textbf{(a)} Genetic representation of a cartesian GP individual encoding a CNN architecture. \textbf{(b)} The phenotypic representation. \textbf{(c)} CNN architecture defined by (a). Gene No. 5, coloured with a black background in the genotype (a) is not expressed in the phenotype. The summation node in (c), with light yellow background, performs max pooling to the LHS of the input (Node no. 3) to get the same input tensor sizes. Redrawn from Suganuma et al.~\cite{10.1145/3071178.3071229}.} \label{fig:cartesianCNN} \end{figure} \subsection{Does neutrality help or hinder the search of an Evolutionary Algorithm?} This question has been debated at considerable length in the literature without really reaching any form of consensus on its answer. The reasons for this situation include the lack of a single definition of neutrality, the multiple ways in which one can add neutrality to a representation, the focus on pure performance when evaluating the effects of neutrality without attention to the changes in the behaviour of the search operators and in the features of the fitness landscape, and, finally, the variability in the choice of problems, algorithms and representations for benchmarking purposes. Also, very often studies consider problems and representations that are quite complex and results represent the composition of multiple effects. \section{First Research Steps in Neutrality in Neuroevolution in Deep Neural Networks} \label{sec:first} We believe that one of the first step to see whether neutrality helps or hinders evolution in the configuration (or training) of a deep neural network is to adopt a very simple representation such as binary representation, using mutation and selection as genetic operators to guide evolution. The type of problem is a more difficult endevour when trying to carry out this research. The reason is because much of the empirical scientific works conducted in the area of neuroevolution in deep neural networks are incredible different, as summarised in our recent article~\cite{galvan2020neuroevolution}, where CNNs and computer vision datasets have been the attention of the research community and no general conclusions have been drawn in the area. However, these two can also represent good areas to be studied given the numerous results reported in a variety of studies, helping us to use them as basis for our research. \bibliographystyle{abbrv}
\section{Introduction}\label{sec:intro} Biased and inaccurate news shared online are major concerns that have risen to the forefront of public discourse regarding social media in recent years. Two thirds of Americans get at least some of their news content from social media, but less than half expect this content to be accurate~\cite{shearer_2018}. Globally, only 22\% of survey respondents trust the news in social media ``most of the time'' \cite{reuters_news_report_2020}. Internet platforms such as Twitter, Facebook, and reddit\xspace account for an ever-increasing share of the dissemination and discussion of news \cite{geiger_2019_online_news}. % Harms caused by biased and false news have substantial impact across our society. Polarized content on Twitter and Facebook has been shown to play a role in the outcome of elections \cite{Recuero2020HyperpartisanshipDA, Kharratzadeh2017USPE}; and misinformation related to COVID-19 has been found to have a negative impact on public health responses to the pandemic~\cite{Tasnim2020ImpactOR, Kouzy2020CoronavirusGV}. Developing methods for reducing these harms requires a broad understanding of the political bias and factualness of news content shared online, but studying news sharing is challenging for three reasons: (1) the scale is immense, with billions of news links shared annually, (2) it is difficult to automatically quantify bias and factualness at scales where human labeling is often infeasible \cite{Rajadesingan2020QuickCL}, and (3) the distribution of links is complex, with these links shared by many millions of users and thousands of communities. While previous research has led to important insights on specific aspects of news sharing, such as user engagement \cite{Risch2020TopCO}, fact checking \cite{vosoughi2018spread,choi2020rumor}, specific communities \cite{Rajadesingan2020QuickCL}, and specific rumors \cite{vosoughi2017rumor,qazvinian2011rumor}, large scale studies of news sharing are critical to understanding polarization and misinformation more broadly, and can inform community design, governance, and moderation interventions. In this work, we present the largest study to date of news sharing behavior on reddit\xspace, one of the most popular social media websites. We analyze all 559 million links submitted to reddit\xspace from 2015-2019\footnote{August 2019 was the most recent month of data available at the time of this study.}, including 35 million news links submitted by 1.3 million users to 135 thousand communities. We rate the bias and factualness of linked-to news sources using Media Bias/Fact Check (MBFC),\footnote{While bias and factualness may vary from story to story, news source-level ratings maximize the number of links that can be rated, and are commonly used in research \cite{bozarth2020higher}.} which considers how news sources favor different sides of the left-right political spectrum (bias), and the veracity of claims made in specific news stories (factualness) (\S\ref{sec:method}). In our analyses, we examine: the \textit{diversity of news within communities} (\S\ref{sec:communities_not_equal}), and how this diversity is composed of both the differences between community members and individual members' diversity of submissions; the \textit{impact of current curation and amplification behaviors} on news' visibility and spread (\S\ref{sec:curation_amplification}); and the \textit{concentration of extremely biased and low factual content} (\S\ref{sec:communities_not_users}), examining the distribution of links from the perspectives of who submitted them and what community they were submitted to. We show that communities on reddit\xspace exist across the left-right political spectrum, as measured by MBFC, but 74\% are ideologically center left. We find that the diversity of left-leaning communities' membership is similar to that of equivalently right-leaning communities, but right-leaning communities have 105\% more politically varied news sources, as their members individually post more varied links. This variance comes from the presence of links that are different from the community average, and in right-leaning communities, 74\% of such links are to relatively-more biased news sources, 35\% more than in left-leaning communities (\S\ref{sec:communities_not_equal}). We demonstrate that, regardless of the political leaning of the community, community members' voting and crossposting (re-sharing) behavior reduces the impact of extremely biased and low factual news sources. Links to these news sources receive 20\% fewer upvotes (\S\ref{sec:score}) and 30\% fewer exposures from crossposts compared to more neutral and higher factual content (\S\ref{sec:crossposts}). Furthermore, we find that users who submit such content leave reddit\xspace 68\% more quickly than others (\S\ref{sec:lifespan}). These findings suggest that low factual content spreads more slowly and is amplified less on reddit\xspace than has been reported for Twitter \cite{vosoughi2018spread, Bovet2019InfluenceOF}, \new{although we do not directly compare behavior across the two platforms. Differences between reddit\xspace and Twitter} may stem from reddit\xspace's explicit division into communities, or users' ability to downvote content, both of which help control content exposure. Extremely biased and low factual content can be challenging to manage, as it is spread through many users, news sources, and communities. We find that extremely biased and low factual content is spread by an even broader set of users and communities relative to news content as a whole, exacerbating this challenge (\S\ref{sec:communities_not_users}). However, we find that 99\% of extremely biased or low factual content is still concentrated in 0.5\% of communities, lending credence to recent interventions at the community level~\cite{chandrasekharan2017cant_stay_here, chandrasekharan2020quarantined, saleem2018aftermath, ribiero2020migration}. Our work demonstrates that additional research on news sharing online is especially needed on the topics of why users depart platforms and where they go, why false news appears to spread more quickly on Twitter than on reddit\xspace, and how curation and amplification practices can manage influxes of extremely biased and low factual content. Finally, we make all of our data and analyses publicly available\footnote{\scriptsize{\texttt{https://behavioral-data.github.io/news\_labeling\_reddit/}}} to encourage future work on this important topic. \section{Related Work}\label{sec:related} \xhdr{Misinformation and Deceptive News} Social news platforms have seen a continued increase in use and a simultaneous increase in concern regarding biased news and misinformation \cite{mitchell19pew,marwick2017media}. % Recent studies have used network spread \cite{vosoughi2018spread, ferrara2017contagion, Bovet2019InfluenceOF}, content consumer \cite{allen2020evaluating}, and content producer \cite{linvill2020troll} approaches to assess the spread of misinformation. In this work, we examine news sharing behavior from news sources who publish content with varied degrees of bias or factualness, building on related work that has analyzed social news based on the characteristics of a new source's audience~\cite{samory2020characterizing} or the type of content posted~\cite{glenski2018propagation}. \xhdr{Polarization and Political Bias} Many papers have recently been published on detecting political bias of online content either automatically \cite{baly2020detect, Demszky2019AnalyzingPI} or manually \cite{Ganguly2020EmpiricalEO, bozarth2020higher}. Others have examined bias in moderation of content, as opposed to biased content or news sources themselves \cite{Jiang2019BiasMT, Jiang2020ReasoningAP}. Echo chambers are a major consideration in understanding polarization, with papers focusing on their development \cite{Allison2020CommunalQA} and the role of news sources in echo chambers \cite{Horne2019DifferentSO}. Others have examined who shares what content with what political bias, but did so using implicit community structure~\cite{Samory2020CharacterizingTS}. In this work, we examine thousands of explicit communities on reddit\xspace, characterizing their polarization by examining the political diversity of news sources shared within, and the diversity of the community members who contribute. \xhdr{Moderation and Governance} A large body of work has examined the role of moderation interventions such explanations \cite{Jhaver2019DoesTI}, content removal \cite{Chandrasekharan2018TheIH}, community bans \cite{chandrasekharan2017cant_stay_here, chandrasekharan2020quarantined, saleem2018aftermath} on outcomes such as migration \cite{ribiero2020migration}, harassment \cite{Matias2019PreventingHA} and harmful language use~\cite{Wadden2021Moderation}. Others have focused on moderators themselves \cite{matias2019civic_labor, Dosono2019ModerationPA}, and technological tools to assist them \cite{Jhaver2019HumanMachineCF, Zhang2020PolicyKitBG, Chandrasekharan2019CrossmodAC}, as well as self-moderation through voting \cite{glenski2017consumers, Risch2020TopCO} and community norms \cite{Fiesler2018RedditRC}. In contrast, our work informs the viability of different moderation strategies, specifically by examining the sharing and visibility of news content across thousands of communities. \section{Dataset \& Validation}\label{sec:method} We analyze all reddit\xspace submissions to extract links, and annotate links to news sources with their political bias and factualness using ratings from Media Bias/Fact Check. \subsection{Reddit Content}\label{sec:reddit_data} reddit\xspace is the sixth most visited website in the world, and is widely studied due to its size, diversity of communities, and the public availability of its content~\cite{Medvedev2018TheAO}. Users can submit links or text (known as ``selfposts'') to specific communities, known as ``subreddits.'' Users may view submissions for a single community, or create a ``front page'' which aggregates submissions from all communities the user ``subscribes'' to. Here, we focus on submissions over comments, as submissions are the primary mechanism for sharing content on reddit\xspace, and users spend most of their time engaging with submissions \cite{glenski2017consumers}. To create our dataset, we downloaded all public reddit\xspace submissions from Pushshift \cite{baumgartner2020pushshift} posted between January 2015 and August 2019\footnote{August 2019 was the most recent month available at the time of this study.}, inclusive, for a total of 56 months of content (580 million submissions, 35 million unique authors, 3.4 million unique subreddits). For each submission, we extract the URLs of each linked-to website, which resulted in 559 million links\footnote{While link submissions by definition contain exactly one link, text submissions (selfposts) can include 0 or more links.}. Additional summary statistics are included in Appendix~\ref{app:summary} \xhdr{Ethical Considerations} We value and respect the privacy and agency of all people potentially impacted by this work. All reddit\xspace content analyzed in this study is publicly accessible, and Pushshift, from which we source our reddit\xspace content, permits any user to request removal of their submissions at any time. We take specific steps to protect the privacy of people included in our study \cite{Fiesler2018ParticipantPO}: we do not identify specific users, and we exclusively analyze data and report our results in aggregate. All analysis of data in this study was conducted in accordance with the Institutional Review Board at \new{ the University of Washington under ID \texttt{STUDY00011457}}. \begin{figure}[t] \centering \includegraphics[width=1\columnwidth]{coverage} \vspace{-1em} \caption{The percentage of links that can be annotated using the MBFC labels is very consistent ($\pm$ 3.3\%) over time, suggesting that comparisons over time are not significantly impacted by changes in annotation coverage.} \label{fig:coverage} \end{figure} \subsection{Annotation of Links' News Sources}\label{sec:mbfc_labeling} To identify and annotate links to news sources, we make use of Media Bias/Fact Check (hereafter MBFC), an independently run news source rating service. \citet{bozarth2020higher} find that ``the choice of traditional news lists [for fact checking] seems to not matter,'' when comparing 5 different news lists including MBFC. Therefore, we selected MBFC as it offers the largest set of labels of any news source rating service \cite{bozarth2020higher}. MBFC provides ratings of the political bias (left to right) and factualness (low to high) of news outlets around the world, along with additional details and justifications for ratings, using a rigorous public methodology\footnote{\texttt{mediabiasfactcheck.com/methodology/}}. MBFC is widely used for labelling bias and factualness of news sources for downstream analysis \cite{heydari2019youtube, main2018alt_right, Starbird2017ExaminingTA, Darwish2017TrumpVH, nelimarkka2018social_media} and as ground truth for prediction tasks \cite{dinkov2019predicting, stefanov2020predicting}. From MBFC's public reports on each news source, we extract the name of the news source, its website, and the political bias and factualness ratings. Bias is measured on a 7-point scale of `extreme left,' `left,' `center left,' `center,' `center right,' `right,' and `extreme right,' and is reported for 2,440 news sources. Factualness is measured on a 6-point scale of `very low factual,' `low factual,' `mixed factual,' `mostly factual,' `high factual,' and `very high factual,' and is reported for 2,676 news sources (as of April 2020). For brevity, in the following analyses, we occasionally use the term `left leaning' to indicate a news source with a bias rating of `extreme left,' `left,' or `center left,' and the term `right leaning' to indicate a news source with a bias rating of `center right,' `right,' or `extreme right.' We then annotate the links extracted from reddit\xspace submissions with the MBFC ratings using regular expressions to match the URL of the link with the domain of the corresponding news source. For example, a link to \texttt{www.rt.com/news/covid/} would be matched with the \texttt{rt.com} domain of RT, the Russian-funded television network, and annotated with a bias of `center right' and a factualness of `very low.' \new{Links to URL shorteners such as \texttt{bit.ly} were excluded from labeling.} We find that links to center left and high factual news sources are most common, accounting for 53\% and 64\% of all news links, respectively. Extreme left news source links are much less common, with 22.2 extreme right links for every 1 extreme left link (Fig.\xspace~\ref{fig:distrib_of_means}). \input{04_validation} \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{distrib_of_means} \vspace{-2em} \caption{Distributions of mean bias and factualness are quite similar for both the user and community units of analysis. Grey bars show the normalized total counts of links of each type across all of reddit\xspace.} \label{fig:distrib_of_means} \end{figure} \xhdr{Computing Mean Bias/Factualness} As described above, MBFC labels for bias and factualness are ordinal, yet for many analyses, it is useful to have numeric labels (\textit{e.g.}\xspace computing the variance of links in a community). To convert from MBFC's categorical labels to a numeric scale, we use a mapping of (-3, -2, -1, 0, 1, 2, 3) to assign `extreme left' links a numeric bias value of -3, `left' links a value of -2, `center left' links a value of -1, `center' links a value of 0, and positive values to map to the equivalent categories on the right. While this choice is somewhat arbitrary, it is consistent with the linear spacing between bias levels given by MBFC. Furthermore, we explored different mappings, including nonlinear ones, and found that our results are robust to different mappings. As such, we use the mapping given above as it is easiest to interpret. We use a similar mapping of (0, 1, 2, 3, 4, 5) to assign `very low factual' links a numeric value of 0, `low factual' links a value of 1, \textit{etc.}\xspace, with `very high factualness' links assigned a value of 5. These numeric values are used to compute users' and communities' \textit{mean bias} and \textit{mean factualness}, central constructs in our analyses. To do so, we simply take the average of the numeric bias and factualness values of the links by each user or in each community. For many of our analyses, we group users by rounding their mean bias/factualness to the nearest integer. Thus, when we describe a user as having a `left center bias,' we are indicating that the mean bias of the links they submitted is between -1.5 and -0.5. The distributions of means are very similar for users and communities, with both closely following the overall distribution of news links on reddit\xspace, shown with grey bars (Fig.\xspace\ref{fig:distrib_of_means}). 74\% of communities and 73\% of users have a mean bias of approximately center left, and 65\% of communities and 62\% of users have a mean factualness of `high factual' (among users/communities with more than 10 links). Similarly, we define \textit{user variance of bias} as the variance of the bias values of the links submitted by a user, and similarly \textit{community variance of bias} is defined as the variance of of the bias values of links submitted to a community. As with mean bias, we find that the distributions of user and community variance of bias are very similar to one another. The median user has a variance of 0.85, approximately the variance of a user with center bias who submits 62\% center links, 22\% center-left or center-right links, and 16\% left or right links. The median community has a variance of 0.91, approximately that of a community where 62\% of the content submitted has center bias, 20\% of the content has center-left or center-right bias, and 18\% of the content has left or right bias. Of course, a substantial amount of a community's variance comes from the variance of its userbase. We explore sources of this variance in \S\ref{sec:communities_not_equal}. \subsection{Estimating Potential Exposures to Content} Links on reddit\xspace do not have equal impact; some links are viewed by far more people than others. To understand the impact of certain types of content, we would like to understand how broadly that content is viewed. As view counts are not publicly available, we use the number of subscribers to the community that a link was posted to as an estimate for the number of \textit{potential exposures} to community members that this content may have had. While some users, \new{especially those without accounts}, view content from communities they are not subscribed to, subscription counts capture both active contributors and passive consumers within the community, which motivated our use of this proxy over other alternatives, \new{such as the number of votes}. As communities are constantly growing, we define the number of potential exposures to a link as the number of subscribers to the community the link was posted to \textit{at the time it was posted}. To estimate historic subscriber counts, we make use of archived Wayback machine snapshots of subreddit about pages, which provide the number of subscribers at the time of the snapshot. These snapshots are available for the $\sim$3,500 largest subreddits. In addition, we collected the current (as of Dec. 29, 2020) subscriber count for the 25,000 largest subreddits, as well as the date the subreddit was created (at which point it had 0 subscribers). We use the present subscriber count, archived subscriber counts (if available), and the creation date, and linearly interpolate between these data points to create a historical estimate of the subscriber counts over time for each of the 25,000 largest (by number of posts) subreddits in our dataset. The resulting set of subscriber count data, when joined with our set of reddit\xspace content, provides potential exposure estimates for 93.8\% of submissions. For the remaining 6.2\% of submissions, we intentionally, conservatively \emph{overestimate} the potential exposures by using the first percentile value (4 subscribers) from our subscriber count data. The effect of this imputation on our results is very minor as these only occur in communities with extremely little activity. \section{Summary of Dataset}\label{sec:dataset_summary} \galen{move and rename} \galen{TODOS: merge descriptions of both community and user distributions, below, and shorten} \galen{unless stated otherwise, we filter to subreddits that are active, \textit{i.e.}\xspace have at least one post per month.} \xhdr{Diversity of Users} \galen{could roll this into the overview of users, above, then break `ideological consistency' into its own xhdr?} How diverse are reddit\xspace users, in terms of the political bias and factualness of their submissions to the communities they are members of? How ideologically consistent are users? In this analysis, we examine only users who submitted more than 10 links with a labeled bias/factualness value. We find that there is substantial variability across the mean bias and factualness of users' submitted links, but that both distributions of mean bias and mean factualness (Fig.\xspace\ref{fig:distrib_of_means}) are far from uniform. 76\% of users have a mean bias between `center left' and `center', inclusive. Only 0.23\% of reddit\xspace users (with more than 10 labeled links) have a mean bias more extreme than `left' or `right'. \galen{confusing wording, not sure how better to describe.} The distribution of mean factualness values is fairly similar to the mean bias distribution (Fig.\xspace\ref{fig:distrib_of_means}). \tim{not sure what this means -- apples and oranges?} The vast majority (87\%) of users have a mean factualness between `mostly factual` and `high factual'. We measure a user's \textit{ideological consistency} \tim{this is a key construct and currently hidden in a summary section and subxhdr. Is there a good way to define key constructs and how they are measured first and do so clearly?} by computing the standard deviation of the political bias of their posts. We find that almost all users have some variance across their submissions, with only 1.3\% of users submitting only posts of a single bias category. The median user's standard deviation of political bias is 0.92. To give this some context, a user who mostly posts `center left' links, but posts one `center right' link for every 2.25 `center left' links would have a standard deviation of approximately 0.92. Alternately, a user who posts 100 `center left' links, 100 `center right' links, and 36 `center' links would have a standard deviation of .92. Alternately, a user who posts the same number of `left' links and `center' links would have a standard deviation of 1.0, a bit larger than our median user. \galen{pick which examples to keep, if any.} \tim{it's great to put this in perspective. It may be easiest to just say: whatever the majority category of news for a user may be (eg., center left), on average they will post X\% in that majority category, Y\% in adjacent categories (e.g., left and center) and Y\% in the remaining categories (e.g., extreme left, center right, right, extreme right). (this might be simpler than the number games above.)} \xhdr{Diversity of Communities} How do communities vary in their political leaning? Their degree of factualness? How ideologically diverse are communities? As for users, we can operationalize communities' bias and factualness by computing the means thereof across all submissions to the community, and we can operationalize their (political) ideological diversity by computing the standard deviation of the the biases of all submissions to the community. \tim{Let's discuss listing and defining all key constructs in a prior section, possibly with mathematical notation.} Again, we limit our analysis to communities with at least 10 labeled links. We find that the distribution of communities' mean bias and factualness values are very similar to those of users (Fig.\xspace\ref{fig:distrib_of_means}), with 81\% of communities having a mean bias between `left center` and `center'. 87\% of communities have a mean factualness between `mostly factual' and `high factual', inclusive.\tim{I like this characterization much better than the 0.9x standard deviation since the latter depends on the -3...3 scale (which we have to define somewhere). Maybe we can define in that section what we mean by "adjacent" categories and then use this language throughout?} The median community has a standard deviation of political bias of 0.95, very slightly \textit{greater} than that of the the median user. \tim{I wouldn't call attention to greater. It seems like a tiny difference.} Communities' content is of course submitted by community members who have their own ideological diversity; we explore the the ideological diversity of community members specifically below. \galen{segway.... diversity is similar to users, but given that community has multiple users, could come from blah.} \tim{let me know when you reworked the section glue here.} \section{Diversity of News within Communities}\label{sec:communities_not_equal} In this section, we examine the factors that contribute to a community's variance of bias. This variance can come from a combination of two sources: (1) community members who are individually ideologically diverse (\textit{user diversity}), and (2) a diverse group of users with different mean biases (\textit{group diversity}). High user diversity corresponds to a community whose members have high user variance (\textit{e.g.}\xspace users who are ideologically diverse individually), and high group diversity corresponds to a community with high variance of its members' mean bias (\textit{e.g.}\xspace a diverse group of users who may be ideologically consistent individually). Of course, these sources of variance are not mutually exclusive; \textit{overall community variance} is maximized when both user diversity \textit{and} group diversity are large. \xhdr{Method} This intuition can be formalized using the Law of Total Variance, which states that total community variance is exactly the sum of User Diversity (within-user variance) and Group Diversity (between-user variance): \begin{align*} \mathrm{Var}(\mathcal{B}_c) = \mathrm{E}[\mathrm{Var}(\mathcal{B}_c|\mathcal{U})] + \mathrm{Var}(\mathrm{E}[\mathcal{B}_c|\mathcal{U}]) \end{align*} \noindent where $\mathcal{B}_c$ is a random variable representing the bias of a link submitted to community $c$, and $\mathcal{U}$ is a random variable representing the user who submitted the link. We compute user diversity and group diversity for each community. User diversity is given by taking the mean of each user's variance of bias, weighted by the number of labeled bias links that user submitted. Group diversity is given by taking the variance of each community members' mean user bias, again weighted by their number of labeled links. We then sum the user and group diversity values to compute the overall community variance of political bias. To understand \textit{how} communities vary relative to their mean, we compute the balance of links in the adjacent relatively more- and less- biased categories. For example, a community with `left' mean bias has two adjacent categories: `extreme left' and `center left,' with `extreme left' being the relatively-more biased category, and `center left' being the relatively-less biased category. \xhdr{Results} Across all of reddit\xspace, we find most (82\%) communities' group diversity constitutes a majority of their overall variance of bias. When binned by their mean bias, we find that communities with extreme bias have, on average, lower total variance than communities closer to the middle of the spectrum (Fig.\xspace\ref{fig:variance}). A community with mean bias of `extreme left' would be expected to have a lower total variance as there are no links with bias further left than `extreme left.' To control for this dynamic, we only compare symmetric labels: `extreme left' to `extreme right,' `left' to `right,' and `center left' to `center right.' We find that right- and left-leaning communities have similar group diversity (Fig.\xspace\ref{fig:variance}, right), but right-leaning communities (red) have 341\% more user diversity than equivalently left-leaning communities, on average (Fig.\xspace\ref{fig:variance}, left). As a result, the average overall variance is 105\% greater for right-leaning communities than left-leaning communities. Interestingly, we find that a larger share of right-leaning communities' variance is in more biased categories, relative to the community mean. 74\% of right-leaning communities' adjacent links are relatively-more biased, compared to 55\% for left-leaning communities, in other words, an increase of 35\% $\left(\frac{74\%}{55\%}\right)$. \begin{figure}[t] \centering \includegraphics[trim={.1cm 0 .1cm 0cm},clip,width=\columnwidth]{total_variance} \vspace{-2em} \caption{While group diversity is similar between left- and right-leaning communities with a similar degree of bias (right panel), right-leaning communities have higher user diversity than equivalently biased communities on the left (left panel). As a result, right-leaning communities have higher overall variance around their community mean. Right-leaning communities also favor relatively-more biased links, when compared to left-leaning communities.} \label{fig:variance} \end{figure} \xhdr{Implications} These results suggest that members of communities on the left and right have comparable group diversity, indicating the range of users are equally similar to one another. However, right-leaning communities have higher user diversity, indicating that the individual users themselves tend to submit links to news sources with a larger variety of political leaning. This creates higher overall variance of political bias in right-leaning communities, however these right-leaning communities also contain more links with higher bias, relative to the community mean, as opposed to more relatively-neutral news sources. \section{Impact of Current Curation and Amplification Behaviors}\label{sec:curation_amplification} The impact of content on reddit\xspace is affected by users' behavior: how long they stay on the platform, how they vote, and how they amplify. In this section, we examine user longevity and turnover, community acceptance of biased and low factual content, and amplification through crossposting. \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{engagement} \vspace{-2em} \caption{ Users with extreme mean bias stay on reddit\xspace less than half as long as users with center mean bias. Users with low and very low mean factualness also leave more quickly, but expected lifespan decreases as users' mean factualness increases past `mixed factual'. Across all figures, error bars correspond to bootstrapped 95\% confidence intervals (and may be too small to be visible). } \label{fig:lifespan} \end{figure} \subsection{User Lifespan}\label{sec:lifespan} Do users who post extremely biased or low factual content stay on reddit\xspace as long as other users? \xhdr{Method} We compute each user's lifespan on the platform by measuring how long they stay active on the platform after their first submission. We define ``active'' as posting at least once every 30 days, as in \citet{waller2019generalists}. We group users by their mean bias and factualness, and for each group, compute the expected lifespan of the group members. \xhdr{Results} We find that expected lifespan is longer for users who typically submit less politically biased content, with users whose mean bias is near center remaining on reddit\xspace for approximately twice as long as users with extreme or moderate mean bias, on average (Fig.\xspace\ref{fig:lifespan}, top). This result holds regardless of whether users are left- or right-leaning. Users with a mean factualness close to `mixed factual' or lower leave reddit\xspace 68\% faster than users whose mean factualness is near `mostly factual' (Fig.\xspace\ref{fig:lifespan}, bottom). However, we also find that users' expected lifespan decreases dramatically as their mean factualness increases to `high' or `very high' levels of factualness. \xhdr{Implications} These results suggest that users who mostly post links to extremely biased or low factual news sources leave reddit\xspace more quickly than other users. We can only speculate as to the causes of this faster turnover, but we note that users who stay on reddit\xspace the longest tend to post links to the types of news sources that are most prevalent (grey bars in Fig.\xspace\ref{fig:distrib_of_means} show overall prevalence of each type of link). The faster turnover suggests that users sharing this type of content leave relatively early, limiting their impact on their communities. However, faster turnover also may make user-level interventions such as bans less effective, as these sanctions have shorter-lived impact when the users they are made against leave the site more quickly. Future research could examine why users leave, whether they rejoin with new accounts in violation of reddit\xspace policy, and the efficacy of restrictions of new accounts. \begin{figure*}[t] \centering \includegraphics[width=\textwidth]{score} \vspace{-2em} \caption{Regardless of the political leaning of the community, extremely biased content is less accepted by communities than content closer to center. Similarly, low and very low factual content is less accepted than higher factual content. Points perturbed on the x-axis to aid readability.} \label{fig:score} \end{figure*} \subsection{Acceptance of Biased or Low Factual Content}\label{sec:score} How do communities respond to politically biased or low factual content? \xhdr{Method} On reddit\xspace, community members curate content in their communities by voting submissions up or down, which affects its position on the community feed~\cite{glenski2017consumers}. A submission's `score' is defined by reddit\xspace as approximately the number of upvotes minus the number of downvotes that post receives. The score has been used in previous work as a proxy for a link's reception by a community \cite{waller2019generalists, Datta2019ExtractingIC}. Links submitted to larger communities are seen by more users and therefore receive more votes. Therefore, we normalize each link's score by dividing by the mean score of all submissions in that community; links with a normalized score over $1$ are more accepted than average, and links with a score under $1$ are less accepted than average. In accordance with reddit\xspace's ranking algorithm, submissions with higher normalized score appear higher in the feed viewed by community members, and stay in this position for longer \cite{Medvedev2018TheAO}. To compute the \textit{community acceptance} of links of a given bias or factualness, we average the normalized score of all links of that type in that community. We then take the median community acceptance across all left-leaning, right-leaning, and neutral communities. Here we use the median as it is more resilient to outliers than the mean. \xhdr{Results} We find that, regardless of the community's political leaning, median expected community acceptance is 18\% lower for extremely biased content than other content (Fig.\xspace~\ref{fig:score}). For left-leaning and neutral communities, community acceptance decreases monotonically as factualness drops below `high.' However, we observe that right leaning communities are 167\% ($p=0.0002$) more accepting of extreme right biased and 85\% ($p=0.004$) more accepting of very low factual content than left-leaning and neutral communities (Mann--Whitney $U$ significance tests). \xhdr{Implications} This suggests that across reddit\xspace, communities are sensitive to extremely biased and low factual content, and users' voting behavior is fairly effective at reducing the acceptance of this content. However, curation does not seem to result in better-than-average acceptance for any content---no median acceptance values are significantly ($p<0.05$) above 1, as non-news content tends to receive higher community acceptance than news content. Previous research has found that on Twitter, news that failed fact-checking spread more quickly and was seen more widely than news that passed a fact-check \cite{vosoughi2018spread}. Interestingly, we find evidence that behavior on reddit\xspace is somewhat different, with median left-leaning, right-leaning, and neutral communities all being less accepting of low and very low factual content. \new{Importantly, our methodology differs from \citet{vosoughi2018spread} in that we use bias and factualness evaluations that were applied to entire news sources, as opposed to the fact checking of specific news articles, limiting direct comparisons. Furthermore, we do not analyze the time between an initial post and its subsequent amplification, and so cannot directly comment on the `speed' of amplification. We do find evidence, however, that highly biased content on reddit\xspace is less upvoted than more neutral content.} \new{These difference may in part be explained by differences between reddit's and Twitter's mechanisms for impacting the visibility of content.} Whereas Twitter users are only able to \new{increase visibility by retweeting, liking, replying to, or quoting} content, on reddit\xspace, users may downvote to decrease visibility of content they object to. We speculate that this may partially explain the differences in acceptance that we find between reddit\xspace and Twitter. \subsection{Selective Amplification of News Content }\label{sec:crossposts} How does % amplification of content affect exposure to biased and low factual content? On reddit\xspace, users are not only able to submit links to \textit{external} content (such as news sites), but users are also able to submit links to \textit{internal} content elsewhere on reddit\xspace, effectively re-sharing and therefore \emph{amplifying} content by increasing its visibility on the site. % This is commonly known as `crossposting,' and often occurs when a user submits a post from one subreddit to another subreddit, although such re-sharing of internal content can happen within a single community as well. Here, we seek to understand the role that amplification through crossposts has on reddit\xspace user's exposure to various kinds of content. \xhdr{Method} To identify the political bias and factualness of crossposted content, we identify all crossposted links to news sources, and propagate the label of the crossposted link. Then, we compute the fraction of total potential exposures from crossposts for each bias/factualness category. \xhdr{Results} We find that amplification via crossposting has an overall small effect on the potential exposures of news content. While 10\% of all news links are crossposts, only 1\% of potential exposures to news links are due to crossposts. This suggests that the majority of crossposts are content posted in relatively larger communities re-shared to relatively smaller communities with relatively fewer subscribers, diminishing the impact of amplification via crossposting. As such, \textit{direct} links to news sites have a far greater bearing on reddit\xspace users' exposure to news content than crossposts. However, the role of crossposts in exposing users to new content is still important, as crossposts account for more than 750 billion potential exposures. We find that extremely biased and low factual content is amplified less than other content, as shown in Fig.\xspace\ref{fig:amplification}, which illustrates the percentage of total potential exposures that come from crossposts for each bias/factualness category. reddit\xspace users exposed to center left biased, center biased, or center right biased content are 53\% more likely to be exposed to this content via amplification than reddit\xspace users exposed to extremely biased content. Similarly, reddit\xspace users exposed to `mostly factual' or higher factualness content are 217\% more likely to be exposed to such content via amplification than reddit\xspace users exposed to very low factual content. \xhdr{Implications} Given that only 1\% of potential exposures are from amplifications, understanding the way that \textit{direct} links to external content are shared is critical to understanding the sharing of news content on reddit\xspace more broadly. The relative lower amplification of extremely biased and very low factual content suggests users' sensitivity to the bias and factualness of the content they are re-sharing. As in \S\ref{sec:score}, this suggests differences between reddit\xspace and Twitter, where content that failed a fact-check has been found to spread more quickly than fact-checked content~\cite{vosoughi2018spread}. We speculate that this may be due to structural differences between the two platforms. On reddit\xspace, users primarily consume content through subscriptions to communities, not other users. This may explain the diminished impact of re-sharing on reddit\xspace compared to Twitter. \begin{figure}[t] \centering \includegraphics[width=\columnwidth]{amplification} \vspace{-2em} \caption{ Extremely biased and low factual content is amplified by crossposts relatively less than other content. Regardless of the bias or factualness of the content, while crossposts are responsible for more than 750 billion potential exposures, they make up only 1\% of total potential exposures, suggesting that direct links to news sources play an especially important role in content distribution. } \label{fig:amplification} \end{figure} \section{Concentrations of Extremely Biased or Low Factual News Content}\label{sec:communities_not_users} It is critical to understand where different news content is concentrated in order to best inform strategies for monitoring and managing its spread online. In this section, we examine how extremely biased and low factual content is distributed across users, communities, and news sources. We also compare the concentration of extremely biased and low factual content to all content. \xhdr{Method} We consider three types of content: (1) news content with extreme bias or low factualness, (2) all news content, and (3) all content (including non-news). We group each of these types of content by three perspectives: the user who posted the content, the community it was posted to, and the news source (or domain, in the case of all content) linked to. We then take the cumulative sum of potential exposures across the users, communities, and news sources, to compute the fraction of potential exposures contributed by the top $n$\% of users, communities, and news sources. We repeat this process, replacing the number of potential exposures with the total number of links, to consider the concentration of links being submitted, regardless of visibility. \xhdr{Results} We find that overall, extremely biased and low factual content is highly concentrated across all three perspectives, but is especially concentrated in a small number of communities, where 99\% of potential exposures stem from a mere 109 (0.5\%) communities (Gini coefficient=0.997) (Fig.\xspace\ref{fig:lorenz}a). No matter the perspective, exposures to extremely biased or low factual content (solid line) are less concentrated than all content (dotted line) (Fig.\xspace\ref{fig:lorenz}abc). Under the community and news source perspectives, exposures (Fig.\xspace\ref{fig:lorenz}ac) are more concentrated than links (Fig.\xspace\ref{fig:lorenz}df). While links are already concentrated in a small share of communities, some communities are especially large, and therefore content from these communities receives a disproportionate share of potential exposures. This is not the case for users, as the distributions of exposures (Fig.\xspace\ref{fig:lorenz}b) are less concentrated than the distributions of links (Fig.\xspace\ref{fig:lorenz}e). This indicates that while some users submit a disproportionate share of links, these are not the users whose links receive the largest potential exposure, as potential exposure is primarily a function of submitting links to large communities. \xhdr{Implications} The extreme concentration of extremely biased or low factual content amongst a tiny fraction of communities supports reddit\xspace's recent and high profile decision to take sanctions against entire communities, not just specific users \cite{nyt2021reddit_ban}. These decisions have been extensively studied~\cite{chandrasekharan2017cant_stay_here, chandrasekharan2020quarantined, thomas2021behavior, saleem2018aftermath, ribiero2020migration}. While this content is relatively less concentrated amongst users, in absolute terms, this content is still fairly concentrated, with 10\% of users contributing 84\% of potential exposures. As such, moderation sanctions against users can still be effective \cite{matias2019civic_labor}. \new{We note that the concentration of extremely biased or low factual content amongst a small fraction of users is similar to what has been found on Twitter \cite{Grinberg2019FakeNO}, although methodological differences preclude a direct comparison.} \begin{figure}[t] \centering \includegraphics[trim={.1cm 0 .1cm 0cm},clip,width=\columnwidth]{lorenz} \vspace{-1em} \caption{ When compared to all content on reddit\xspace (dotted line), extremely biased or low factual content (solid line) is more broadly distributed, making it harder to detect, regardless of the community, user, or news source perspective. However, 99\% of potential exposures to extremely biased or low factual content are restricted to only 0.5\% of communities. Here, a curve closer to the lower-right corner indicates a more extreme concentration. Note that axis limits do not extend from 0 to 100\%.} \label{fig:lorenz} \end{figure} \section{Discussion}\label{sec:discussion} \xhdr{Summary \& Implications} In this work, we analyze all 580 million submissions to reddit\xspace from 2015-2019, and annotate 35 million links to news sources with their political bias and factualness using Media Bias/Fact Check. We find: \begin{itemize}[leftmargin=*] \item Right-leaning communities' links to news sources have 105\% greater variance in their political bias than left-leaning communities. When right-leaning communities link to news sources that are different than the community average, they link to relatively-more biased sources 35\% more often than left-leaning communities (\S\ref{sec:communities_not_equal}). \item Existing curation and amplification behaviors moderately reduce the impact of highly biased and low factual content. This suggests that reddit\xspace \new{differs somewhat from Twitter}, perhaps due to its explicit community structure, or the ability for users to downvote content (\S\ref{sec:curation_amplification}). \item Highly biased and low factual content tends to be shared by a broader set of users and in a broader set of communities than news content as a whole. Furthermore, the distribution of this content is more concentrated in a small number of communities than a small number of users, as 99\% of exposures to extremely biased or low factual content stem from only 0.5\% or 109 communities (\S\ref{sec:communities_not_users}). This lends credence to recent reddit\xspace interventions at the community level, including bans and quarantines. \end{itemize} \xhdr{Limitations} One limitation of our analyses is the use of a single news source rating service, MBFC. However, the selection of news source rating annotation sets has been found to have a minimal impact on research results \cite{bozarth2020higher}. MBFC is the largest (that we know of) dataset of news sources' bias and factualness, and is widely used~\cite{dinkov2019predicting, stefanov2020predicting, heydari2019youtube, Starbird2017ExaminingTA, Darwish2017TrumpVH}. More robust approaches could combine annotations from multiple sources, and we find that MBFC annotations agree with the \citet{volkova2017separating} dataset with a Pearson Correlation of 0.96 on an example downstream task (\S\ref{sec:mbfc_labeling}). Our focus is on the bias and factualness of news sources shared online. We do not consider factors such as the content of links (\textit{e.g.}\xspace shared images, specific details of news stories), or the context in which links are shared (\textit{e.g.}\xspace sentiment of a submission's comments). These factors are important areas for future work, and are outside the scope of this paper. While MBFC (and by extension, our annotations) includes news sources from around the world, our analyses, especially the left-right political spectrum and associated colors, takes a US-centric approach. Polarization and misinformation are challenges across the globe \cite{reuters_news_report_2020}, and more work is needed on other cultural contexts. Our paper explores the impact of curation and amplification practices, but not the impact of community moderators who are a critical component of reddit\xspace's moderation pipeline \cite{matias2019civic_labor}. Future work could examine news content removed by moderators. \new{ Finally, we are limited by the unavailability of data on which users view what content. While we use subreddits' subscriber counts to estimate exposures to content, more granular data would enable us to better understand the impact of shared news articles, for example, the percentage of users who are exposed to extremely biased or low factual content \cite{Grinberg2019FakeNO}. } \section{Conclusion}\label{sec:conclusion} Biased and inaccurate news shared online are significant problems, with real harms across our society. Large-scale studies of news sharing online are critical for understanding the scale and dynamics of these problems. We presented the largest study to date of news sharing behavior on reddit\xspace, and found that right-leaning communities have more politically varied and relatively-more biased links than left-leaning communities, current voting and re-sharing behaviors are moderately effective at reducing the impact of extremely biased and low factual content, and that such content is extremely concentrated in a small number of communities. We make our dataset of news sharing on reddit\xspace public, \new{in order to support further research}\footnote{\scriptsize{\texttt{https://behavioral-data.github.io/news\_labeling\_reddit/}}}. \section{Dataset Summary}\label{app:summary} \new{ Our dataset was created from all public reddit\xspace submissions posted between January 2016 and August 2019, the most recent data available at the time of this study. These submissions were downloaded using the Pushshift archives~\cite{baumgartner2020pushshift}, and consist of 580 million submissions, 35 million unique authors, and 3.4 million unique subreddits. As each submission may consist of 0 or more links, the dataset includes a total of 559 million links. These links are to 5.1 million unique domains, of which we are able to label 2,801 unique domains with annotations from MBFC. } \new{ The following table shows the number of links in the dataset, as well as the number of unique news sources, for each bias category. } \vspace{1em} \begin{tabular}{l|r|r} \textbf{Bias} & \textbf{\# of Links} & \textbf{\# of News Sources} \\ \hline Extreme Left & 15,157 & 51 \\ Left & 3,023,382 & 364 \\ Center Left & 17,648,711 & 544 \\ Center & 4,494,687 & 442 \\ Center Right & 4,254,705 & 263 \\ Right & 3,226,828 & 352 \\ Extreme Right & 997,703 & 423 \\ \textit{Unlabeled} & \textit{525,443,378} & \textit{} \\ \end{tabular} \vspace{1em} \new{ \noindent The following table shows the number of links in the dataset, as well as the number of unique news sources, for each factualness category. } \vspace{1em} \begin{tabular}{l|r|r} \textbf{Factualness} & \textbf{\# of Links} & \textbf{\# of News Sources} \\ \hline Very Low & 609,229 & 72 \\ Low & 749,202 & 369 \\ Mixed & 7,116,130 & 677 \\ Mostly & 2,217,719 & 110 \\ High & 22,055,943 & 1,313 \\ Very High & 2,263,604 & 134 \\ \textit{Unlabeled} & \textit{524,092,724} & \textit{} \\ \end{tabular} \vspace{1em} \noindent The dataset may be downloaded from our website at \scriptsize{\texttt{https://behavioral-data.github.io/news\_labeling\_reddit/}} \section*{Acknowledgements} This research was supported by the Laboratory Directed Research and Development Program at Pacific Northwest National Laboratory, a multiprogram national laboratory operated by Battelle for the U.S. Department of Energy. This research was supported by the Office for Naval Research, NSF grant IIS-1901386, the Bill \& Melinda Gates Foundation (INV-004841), and a Microsoft AI for Accessibility grant.
\section{Introduction}\label{sec_Intro} Backward stochastic differential equations (BSDEs) and backward stochastic Volterra integral equations (BSVIEs) have been studied extensively and applied to many areas including stochastic control, PDE theory, mathematical finance and economics. Linear BSDEs were first introduced by Bismut \cite{Bi78} as adjoint equations by means of the Pontryagin maximum principle for stochastic control problems of stochastic differential equations (SDEs). Later, Pardoux and Peng \cite{PaPe90} developed systematic treatments of general nonlinear BSDEs of the following form: \begin{equation}\label{BSDE} Y(t) = \Psi + \int_{t}^{T} G ( s, Y(s), Z(s) ) \,\mathrm{d} s - \int_{t}^{T} Z(s) \,\mathrm{d} W(s), ~t\in[0,T]. \end{equation} Here, $W(\cdot)$ is a standard Brownian motion on a complete probability space $(\Omega,\mathcal{F},\mathbb{P})$ with the filtlation $\mathbb{F}=(\mathcal{F}_t)_{t\geq0}$ generated by $W(\cdot)$, $\Psi$ is an $\mathcal{F}_T$-measurable random variable called the terminal condition, and $G$ is a progressively measurable function called the driver. The adapted solution of BSDE~\eqref{BSDE} is the pair $(Y(\cdot),Z(\cdot))$ of adapted processes satisfying \eqref{BSDE}. Specifically, the second component $Z(\cdot)$ of the adapted solution is called the martingale integrand. Such an equation has been found useful in applications to, for example, recursive utilities, dynamic risk measures, nonlinear Feynman--Kac formula and path-dependent PDEs. We refer the readers to the textbook of Zhang \cite{Zh17} and the survey paper of El Karoui, Peng and Quenez \cite{ElKaPeQu97} for the detailed account of theory and applications of BSDEs. As a natural extension of BSDEs, BSVIEs of the form \begin{equation}\label{Type-1} Y(t) = \Psi(t) + \int_{t}^{T} G(t,s,Y(s),Z(t,s)) \,\mathrm{d} s - \int_{t}^{T} Z(t,s) \,\mathrm{d} W(s), ~t\in[0,T], \end{equation} were introduced by Lin \cite{Li02} and Yong \cite{Yo06} and further studied in \cite{Yo07,Yo08,WaT12,ShWa12,ShWaYo13,WaTYo19,Po20} among others. The stochastic process $\Psi(\cdot)$, which is called the free term in the literature of BSVIEs, is a family of $\mathcal{F}_T$-measurable random variables $\Psi(t)$, $t\in[0,T]$ (not necessarily $\mathbb{F}$-adapted), and the driver $G$ is progressively measurable with respect to the time parameter $s$ for each fixed $t$. The unknown we are looking for is the pair $(Y(\cdot),Z(\cdot,\cdot))$, where $Y(\cdot)$ and $Z(t,\cdot)$ are adapted for each $t\in[0,T]$. Yong \cite{Yo06,Yo08} also considered the following form of BSVIEs: \begin{equation}\label{BSVIE_II_1} Y(t) = \Psi(t) + \int_{t}^{T} G(t,s,Y(s),Z(t,s),Z(s,t)) \,\mathrm{d} s - \int_{t}^{T} Z(t,s) \,\mathrm{d} W(s), ~t\in[0,T]. \end{equation} In the literature, \eqref{Type-1} and \eqref{BSVIE_II_1} are referred as Type-\Rnum{1} and Type-\Rnum{2} BSVIEs, respectively. Unlike Type-\Rnum{1} BSVIE~\eqref{Type-1}, the solution of Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} needs an additional constraint on the term $Z(t,s)$, $0\leq s\leq t\leq T$, for the well-posedness of the equation. Inspired by the duality principle appearing in stochastic control problems of (forward) stochastic Volterra integral equations (SVIEs), the so-called \emph{adapted M-solution} was introduced and studied in \cite{Yo08} (see Definition \ref{Def_M_sol} of the present paper). Both Type-\Rnum{1} and Type-\Rnum{2} BSVIEs have become important tools to study some problems in stochastic control and mathematical finance. For example, Yong \cite{Yo07}, Wang, Sun and Yong \cite{WaSuYo19} and Agram \cite{Ag19} applied BSVIEs to dynamic risk measures for the so-called position processes. Kromer and Overbeck \cite{KrOv17} investigated dynamic capital allocations via BSVIEs. Beissner and Rosazza Gianin \cite{BeRG21} applied BSVIEs to arbitrage-free asset pricing via a path of EMMs, called an EMM-string. Stochastic control problems for systems of SVIEs and BSVIEs were studied by Shi, Wang and Yong~\cite{ShWaYo15} and Wang and Zhang \cite{WaTZh17}. Also, it is worth to mention that BSVIEs have a strong connection to time-inconsistent stochastic control problems. For example, time-inconsistent recursive utility processes of general discounting can be modelled by the solutions of BSVIEs (see \cite{WaSuYo19}). Wang and Yong \cite{WaYo21} and Hamaguchi \cite{Ha21} studied time-inconsistent problems where the cost functionals were defined by the solutions of Type-\Rnum{1} BSVIEs. In \cite{WaYo21}, generalizing the earlier study of Yong \cite{Yo12}, they derived the so-called equilibrium HJB equation which characterizes the closed-loop equilibrium strategy. In \cite{Ha21}, the author characterized the open-loop equilibrium controls by variational methods, where the adjoint equations turned out to be Type-\Rnum{1} BSVIEs of an extended form. For relationships between BSVIEs and PDEs, we note that Wang and Yong \cite{WaTYo19} derived the representation PDEs for both Type-\Rnum{1} and Type-\Rnum{2} BSVIEs. Further studies on this topic were developed by Wang \cite{Wa20} and Wang, Yong and Zhang \cite{WaYoZh20}. It is remarkable that the representation PDEs of BSVIEs have the same structure as the equilibrium HJB equations appearing in time-inconsistent stochastic control problems obtained by \cite{Yo12,WaYo21}. Here let us briefly recall the results of \cite{WaTYo19}. They considered Type-\Rnum{1} and Type-\Rnum{2} BSVIEs of the following forms: \begin{equation}\label{Type-1 Markov} \begin{split} Y(t) = \psi(t,X(t),X(T)) + \int_{t}^{T} g(t,s,X(t),X(s),Y(s),Z(t,s)) \,\mathrm{d} s - \int_{t}^{T} Z(t,s) \,\mathrm{d} W(s), ~t\in[0,T], \end{split} \end{equation} and \begin{equation}\label{Type-2 Markov} \begin{split} Y(t) = \psi(t,X(t),X(T)) + \int_{t}^{T} g(t,s,X(t),X(s),Y(s),Z(t,s),Z(s,t)) \,\mathrm{d} s - \int_{t}^{T} Z(t,s) \,\mathrm{d} W(s), ~t\in[0,T], \end{split} \end{equation} respectively, where $\psi$ and $g$ are given deterministic functions, and $X(\cdot)$ is the solution of the SDE \begin{equation}\label{SDE} X(t) = x + \int_{0}^{t} b(s,X(s)) \,\mathrm{d} s + \int_{0}^{t} \sigma(s,X(s)) \,\mathrm{d} W(s), ~t \in[0,T], \end{equation} with given deterministic functions $b,\,\sigma$ and a given initial condition $x$. First, they showed that Type-\Rnum{1} BSVIE~\eqref{Type-1 Markov} can be approximated by finite systems of BSDEs. Then, based on this approximation result and the well-known representation PDEs for BSDEs, they derived the representation PDE of Type-\Rnum{1} BSVIE~\eqref{Type-1 Markov}. Finally, they obtained the representation PDE of Type-\Rnum{2} BSVIE~\eqref{Type-2 Markov} by connecting that of a Type-\Rnum{1} BSVIE and the usual linear PDE induced by the martingale representation theorem. We remark that, unlike the case of Type-\Rnum{1} BSVIE~\eqref{Type-1 Markov}, the well-posedness of the representation PDE of Type-\Rnum{2} BSVIE~\eqref{Type-2 Markov} was proved only in the framework of the mild solution, not the classical (smooth) solution. We also remark that, unlike Type-\Rnum{1} BSVIE~\eqref{Type-1 Markov}, there have not been any approximation results for Type-\Rnum{2} BSVIE~\eqref{Type-2 Markov} by systems of BSDEs. We guess that this is an important problem since the BSDE approximation of BSVIEs would give some probabilistic interpretations to the corresponding (non-standard) PDE systems. In general, it is difficult to obtain the explicit forms of the solutions of nonlinear BSDEs and nonlinear BSVIEs. To make matter worse, even in the linear case, the explicit solutions of Type-\Rnum{2} BSVIEs have not been obtained yet to the best of our knowledge. Hence, in order to calculate the solutions, it is important to consider numerical approximations of BSDEs and BSVIEs. For BSDEs, there have been many attempts to provide numerical approximations, see for example \cite{DoMaPr96,Na02,BaPa03,BoTo04,Zh04,GoLeWa05,DeMe06,LeGoWa06,BeDe07,GoLa07,GoMa10,BrDeMe11,PeXu11,GoLe17,LiDRSz18} among others. However, for BSVIEs, the numerical method is quit limited. Here we mention \cite{BePo13,WaY18}. On one hand, Bender and Pokalyuk \cite{BePo13} studied a numerical method for the following Type-\Rnum{1} BSVIE: \begin{equation*} Y(t) = \psi(t,W) + \int_{t}^{T} g(s,Y(s)) \,\mathrm{d} s - \int_{t}^{T} Z(t,s) \,\mathrm{d} W(s), ~t\in[0,T], \end{equation*} which is weakly approximated by a sequence of discrete BSVIEs driven by a binary random walk. On the other hand, Wang \cite{WaY18} constructed a kind of backward Euler--Maruyama schemes for Type-\Rnum{1} BSVIEs of the form \begin{equation}\label{Type-1 numeric} Y(t) = \psi(t,X(T)) + \int_{t}^{T} g(t,s,X(s),Y(s),Z(t,s)) \,\mathrm{d} s - \int_{t}^{T} Z(t,s) \,\mathrm{d} W(s), ~t\in[0,T], \end{equation} with $X(\cdot)$ being the solution of an SVIE. He showed that, in the cases of $g(t,s,x,y,z)=g(t,s,x,y)$ or $g(t,s,x,y,z)=g(t,s,x,z)$, the scheme converges in the strong $L^2$-sense to the solution of \eqref{Type-1 numeric} with the convergence speed of order $1/2$. We note that in \cite{WaY18} the coefficients were assumed to be smooth. Also, to the best of our knowledge, the numerical method for Type-\Rnum{1} BSVIE~\eqref{Type-1 numeric} (or more generally \eqref{Type-1 Markov}) of the general form of $g$ was not obtained in the literature. Moreover, the problem of numerical approximations for Type-\Rnum{2} BSVIEs has been completely open. The purpose of this paper is to show two approximation results for Type-\Rnum{2} BSVIEs, that is, a \emph{BSDE approximation} and a \emph{numerical approximation}. The BSDE approximation means that the solution of a finite system of standard BSDEs converges to the adapted M-solution of the original Type-\Rnum{2} BSVIE. For the numerical approximation, we provide a backward Euler--Maruyama scheme, and show that the scheme converges in the strong $L^2$-sense with the convergence speed of order $1/2$. Our main results are the following: \begin{itemize} \item For the general Type-\Rnum{2} BSVIE \eqref{BSVIE_II_1} with stochastic coefficients $\Psi$ and $G$, the term \begin{equation}\label{error 1} \sum^{N-1}_{k=0} \int^{t_{k+1}}_{t_k} \mathbb{E} \Bigl[ \big|Y(t)-\mathscr{Y}^\pi(t_k,t)\big|^2 + \int^T_0 \big|Z(t,s)-\mathscr{Z}^\pi(t_k,s)\big|^2 \,\mathrm{d} s \Bigr]\,\mathrm{d} t, \end{equation} which is defined for each time mesh $\pi=\{t_{0},t_{1},\dots,t_{N}\}$ of $[0,T]$, tends to zero as the mesh size $|\pi|$ of $\pi$ tends to zero, where $(\mathscr{Y}^{\pi},\mathscr{Z}^{\pi})$ is the solution of a BSDE system corresponding to $\pi$ (see Theorem \ref{Theo_BSDE_0}). \item For Type-\Rnum{2} BSVIE \eqref{Type-2 Markov} with $X(\cdot)$ being the solution of SDE \eqref{SDE}, the term \begin{equation}\label{error 2} \sum_{k=0}^{N-1} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| Y(t) - Y^{\pi}(t_k,t_k) \big|^2 \,\mathrm{d} t \Big] + \sum_{k=0}^{N-1} \sum_{\ell=0}^{N-1} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \int_{t_\ell}^{t_{\ell+1}} \big| Z(t,s) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big], \end{equation} which is defined for each time mesh $\pi=\{t_{0},t_{1},\dots,t_{N}\}$ of $[0,T]$, is estimated by a constant times $|\pi|$, where $(Y^{\pi},Z^{\pi})$ is a backward Euler--Maruyama scheme corresponding to $\pi$ (see Theorem \ref{Thm_2}). \end{itemize} We emphasize that the above approximation results hold true without any differentiability or structural conditions of the coefficients as assumed in \cite{WaY18}. For BSDE \eqref{BSDE}, it is well-known that the so-called \emph{$L^2$-time regularity} of the martingale integrand $Z(\cdot)$ plays a central role in the study of numerical approximations (see the textbook \cite{Zh17}). In this paper, we first consider the general Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} with stochastic coefficients $\Psi$ and $G$, and estimate the error \eqref{error 2} in terms of the modulus of the $L^2$-time regularity of the martingale integrand $\mathscr{Z}^{\pi}$ of the approximation BSDE system (see Proposition \ref{Prop_EM_1}). This result is important on its own right since we can apply it to equation~\eqref{Type-2 Markov} under more general settings where, for example, $X(\cdot)$ is the solution of an SVIE, as well as where the coefficients $\psi$ and $g$ are ``irregular'' (in the sense of \cite{GoMa10}) in terms of $X(\cdot)$. Such generalizations are, however, beyond the scope of this paper. In order to investigate the $L^2$-time regularity of $\mathscr{Z}^{\pi}$, we consider Type-\Rnum{2} BSVIE~\eqref{Type-2 Markov} with $X(\cdot)$ being the solution of SDE~\eqref{SDE}. Under this setting, by using the Malliavin calculus technique, we first represent $\mathscr{Z}^{\pi}$ in terms of the solution of a \emph{variational BSDE system} (see \eqref{Prop_L2_2}), which is new even in the case of Type-\Rnum{1} BSVIEs. Then we provide some key $L^p$-estimates ($p\geq 2$) for the variational BSDE system. Finally, we provide an estimate for the modulus of the $L^2$-time regularity of $\mathscr{Z}^{\pi}$, which concludes our second main result mentioned above. Compared with Type-\Rnum{1} BSVIEs, the treatment of the time regularity of Type-\Rnum{2} BSVIEs is difficult due to the dependency on $Z(s,t)$ of the driver. On one hand, in \cite{Yo08} the continuity (in the strong $L^2$-sense) of the adapted M-solution of the general Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} was proved under technical differentiability assumptions for the coefficients. On the other hand, in this paper, as a corollary of the BSDE approximation we obtain a quantitative estimate for the modulus of the $L^2$-time regularity of the adapted M-solution of Type-\Rnum{2} BSVIE \eqref{Type-2 Markov} with $X(\cdot)$ being the solution of SDE \eqref{SDE}, without smoothness of the coefficients (see Theorem \ref{Thm_1}). This kind of regularity estimate for adapted M-solutions appears for the first time in the literature of BSVIEs. Also, we provide $L^p$-a priori estimate ($p\geq2$) for adapted M-solutions of the general Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} with stochastic coefficients $\Psi$ and $G$ (see Theorem~\ref{Lem_Lp} which is proved in \hyperref[sec_Appendix]{Appendix}). This $L^p$-estimate is also new, and it is found useful for the analysis of the $L^2$-time regularity of $\mathscr{Z}^\pi$. The paper is organized as follows: In Section \ref{sec_Preli}, we introduce some notation and prove fundamental inequalities which we use throughout this paper. In Section \ref{sec_BSDE}, we construct BSDE systems with stochastic coefficients $\Psi$ and $G$, and prove the BSDE approximation. In Section \ref{sec_Disc_TypeII}, we construct the backward Euler--Maruyama scheme for the general Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} with stochastic coefficients $\Psi$ and $G$. Under this general setting, we estimate the error \eqref{error 2} in terms of the modulus of the $L^2$-time regularity of the martingale integrand $\mathscr{Z}^{\pi}$ of the approximation BSDE system. In order to estimate the modulus of the $L^{2}$-time regularity of $\mathscr{Z}^{\pi}$, in Section \ref{sec_L2_reg}, we consider the case of Type-\Rnum{2} BSVIE~\eqref{Type-2 Markov} with $X(\cdot)$ being the solution of SDE~\eqref{SDE}. We give precise statements of our main theorems. In \hyperref[sec_Appendix]{Appendix}, we provide a proof of $L^p$-a priori estimate for Type-\Rnum{2} BSVIEs. \section{Preliminaries}\label{sec_Preli} \subsection{Notation}\label{sec_func} Let $W(\cdot)$ be a $d$-dimensional standard Brownian motion on a complete probability space $(\Omega,\mathcal{F},\mathbb{P})$. $\mathbb{F}=(\mathcal{F}_{t})_{t \geq 0}$ denotes the augmentation of the filtration generated by $W(\cdot)$. $\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_A$ denotes the indicator function for a given set $A$, $\mathbb{E}[\cdot]$ denotes the expectation, and $\mathbb{E}_t[\cdot]:=\mathbb{E}[\cdot|\mathcal{F}_t]$ denotes the conditional expectation with respect to $\mathcal{F}_t$ for each $t\geq0$. For each $d_{1},d_{2} \in \mathbb{N}$, we denote the space of $(d_{1} \times d_{2})$-matrices by $\mathbb{R}^{d_{1} \times d_{2}}$, which is endowed with the Frobenius norm denoted by $|\cdot|$. We define $\mathbb{R}^{d_{1}}:=\mathbb{R}^{d_{1} \times 1}$, that is, each element of $\mathbb{R}^{d_{1}}$ is understood as a column vector. For each matrix $A$, $A^{\top}$ denotes the transpose of $A$. Throughout this paper, we fix $T \in (0,\infty)$. We define $\Delta [0,T]:=\{(t,s) \in [0,T]^{2}~|~0 \leq t \leq s \leq T\}$ and $\Delta^{\mathrm{c}} [0,T]:=\{(t,s) \in [0,T]^{2}~|~0 \leq s < t \leq T\}$. $\Pi[0,T]$ denotes the set of all time meshes $\pi=\{t_{0},t_{1},\ldots,t_{N}\}$ of $[0,T]$ with $N \geq 2$ and $0=t_{0}<t_{1}<\cdots<t_{N}=T$. For each $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, we define $\Delta t_{k}:=t_{k+1}-t_{k}$, $|\pi|:=\max_{k=0,\ldots, N-1} \Delta t_{k}$ and $\Delta W_{k}:=W(t_{k+1})-W(t_{k})$. We define $\tau:[0,T) \to \{t_{0},\ldots,t_{N-1}\}$ and $\tau^{*}:[0,T) \to \{t_{1},\ldots,t_{N}\}$ by $\tau(t):=t_{k}$ and $\tau^{*}(t):=t_{k+1}$, respectively, for each $t \in [t_{k},t_{k+1})$ with $k=0,\ldots,N-1$. Also, we define $\Delta \tau(t):=\tau^{*}(t)-\tau(t)$ for $t \in [0,T)$. Throughout this paper, $C>0$ denotes a generic constant depending only on $L$ and $T$, where $L$ is the constant appearing in the assumptions $(\mathrm{H}_{\Psi,G})$, $(\mathrm{H}_{\Psi,G})'$, $(\mathrm{H}_{\psi,g})$, $(\mathrm{H}_{\psi,g})'$, $(\mathrm{H}_{b,\sigma})$ or $(\mathrm{H}_{b,\sigma})'$ which will be introduced later. For a given parameter $\mu$, $C_{\mu}>0$ denotes a generic constant depending only on $\mu$, $L$ and $T$. $C$ and $C_{\mu}$ may change from line to line. Fix $0\leq T_{0}<T_{1}<\infty$ and $\mathcal{G} \subset \mathcal{F}$, and let $\mathbb{H}$ be a Euclidean space. We define the following spaces: \begin{align*} &L^{2}_{\mathcal{G}}(\Omega;\mathbb{H}) := \{ \varphi:\Omega \to \mathbb{H} \,|\, \varphi\ \text{is}\ \mathcal{G}\text{-measurable and } \mathbb{E}[|\varphi|^{2}] <\infty \}, \\ &L^{2}_{\mathcal{G}}(T_{0},T_{1};\mathbb{H}) := \left\{ \varphi:\Omega \times [T_{0},T_{1}] \to \mathbb{H} \relmiddle| \varphi(\cdot)\ \text{is}\ \mathcal{G} \otimes \mathcal{B}([T_{0},T_{1}])\text{-measurable and } \mathbb{E}\Big[\int_{T_{0}}^{T_{1}}\big|\varphi(t)\big|^{2} \,\mathrm{d} t\Big] <\infty \right\},\\ &L^{2}_{\mathbb{F}}(T_{0},T_{1};\mathbb{H}) := \left\{ \varphi:\Omega\times[T_{0},T_{1}]\to\mathbb{H} \relmiddle| \varphi(\cdot)\ \text{is progressively measurable and } \mathbb{E} \Bigl[ \int^{T_{1}}_{T_{0}} \big|\varphi(s)\big|^{2} \,\mathrm{d} s \Bigr] <\infty \right\},\\ &L^2_\mathbb{F}(\Omega;C([T_{0},T_{1}];\mathbb{H})) := \left\{ \varphi:\Omega\times[T_{0},T_{1}]\to\mathbb{H} \relmiddle| \begin{aligned} &\varphi(\cdot)\ \text{is progressively measurable, has continuous paths}\\ &\text{and satisfies } \mathbb{E} \Bigl[ \sup_{s\in[T_{0},T_{1}]}\big|\varphi(s)\big|^2 \Bigr] <\infty \end{aligned} \right\}. \end{align*} Also, we define the spaces of stochastic processes with two time parameters: \begin{align*} L^{2}(T_{0},T_{1};L_{\mathbb{F}}^{2}(\Omega;C([T_{0},T_{1}];\mathbb{H}))) \mathalpha{:=} \left\{ \varphi: \Omega \mathalpha{\times} [T_{0},T_{1}]^{2} \mathalpha{\to} \mathbb{H} \relmiddle| \begin{aligned} &\varphi(\cdot,\cdot)\ \text{is measurable,}\\ &\varphi(t,\cdot) \in L_{\mathbb{F}}^{2}(\Omega;C([T_{0},T_{1}];\mathbb{H}))~\text{for a.e.\ }t \in [T_{0},T_{1}]\\ &\text{and satisfies } \mathbb{E} \Bigl[ \int_{T_{0}}^{T_{1}} \sup_{s\in[T_{0},T_{1}]} \big| \varphi(t,s) \big|^{2} \,\mathrm{d} t \Bigr] <\infty \end{aligned} \right\} \end{align*} and \begin{align*} L^{2}(T_{0},T_{1};L_{\mathbb{F}}^{2}(T_{0},T_{1};\mathbb{H})) := \left\{ \varphi: \Omega \times [T_{0},T_{1}]^{2} \to \mathbb{H} \relmiddle| \begin{aligned} &\varphi(\cdot,\cdot)\ \text{is measurable,}\\ &\varphi(t,\cdot) \in L_{\mathbb{F}}^{2}(T_{0},T_{1};\mathbb{H})~\text{for a.e.\ }t \in [T_{0},T_{1}]\\ &\text{and satisfies } \mathbb{E} \Bigl[ \int_{T_{0}}^{T_{1}} \int_{T_{0}}^{T_{1}} \big| \varphi(t,s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Bigr] <\infty \end{aligned} \right\}. \end{align*} \subsection{A priori estimate for BSDEs}\label{sec_apriori} For each $0\leq T_{0}<T_{1} \leq T$, consider the following BSDE on $[T_{0},T_{1}]$: \begin{equation}\label{BSDE_0} Y(t) = \Psi + \int_{t}^{T_{1}} G(s,Y(s),Z(s)) \,\mathrm{d} s - \int_{t}^{T_{1}} Z(s) \,\mathrm{d} W(s), ~t\in[T_{0},T_{1}]. \end{equation} We say that a pair $(Y(\cdot),Z(\cdot))$ is an adapted solution of BSDE \eqref{BSDE_0} if $(Y(\cdot),Z(\cdot))\in L^{2}_{\mathbb{F}}(\Omega, C([T_{0},T_{1}];\mathbb{R}^{m})) \times L^{2}_{\mathbb{F}}(T_{0},T_{1};\mathbb{R}^{m \times d})$ and the equality \eqref{BSDE_0} holds a.s.\ for any $t\in[T_{0},T_{1}]$. The following fact is well-known, see for example \cite{Zh17}. \begin{lemm}\label{apriori_0} Fix $p\geq2$. Let $\Psi:\Omega \to \mathbb{R}^{m}$ and $G:\Omega\times[T_{0},T_{1}] \times \mathbb{R}^{m}\times \mathbb{R}^{m\times d}\to\mathbb{R}^{m}$ be measurable maps such that \begin{itemize} \item $\Psi$ is $\mathcal{F}_{T_{1}}$-measurable, and the process $(G(s,y,z))_{s\in[T_{0},T_{1}]}$ is progressively measurable for each $y\in\mathbb{R}^{m}$ and $z\in\mathbb{R}^{m\times d}$; \item $\mathbb{E}[|\Psi|^{p}+(\int_{T_{0}}^{T_{1}}|G(s,0,0)| \,\mathrm{d} s)^{p}]<\infty$; \item There exists a constant $L>0$ such that, for a.e.\,$s \in [T_{0},T_{1}]$, a.s., it holds that \begin{equation*} |G(s,y_{1},z_{1})-G(s,y_{2},z_{2})| \leq L\big\{|y_{1}-y_{2}|+|z_{1}-z_{2}|\big\} \end{equation*} for any $y_{1},y_{2}\in\mathbb{R}^{m}$ and $z_{1},z_{2}\in\mathbb{R}^{m\times d}$. \end{itemize} Then there exists a unique adapted solution $(Y(\cdot),Z(\cdot))$ of BSDE \eqref{BSDE_0}, and the following estimate holds: \begin{equation*} \mathbb{E} \Big[ \sup_{s\in[T_{0},T_{1}]} \big|Y(s)\big|^{p} + \Big( \int_{T_{0}}^{T_{1}} \big|Z(s)\big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big] \leq C_{p} \mathbb{E} \Big[ \big|\Psi\big|^{p} + \Big( \int_{T_{0}}^{T_{1}} \big|G(s,0,0)\big| \,\mathrm{d} s \Big)^{p} \Big]. \end{equation*} For $i=1,2$, let $(\Psi_{i},G_{i})$ satisfy the above conditions and let $(Y_{i}(\cdot),Z_{i}(\cdot))$ be the unique adapted solution of BSDE \eqref{BSDE_0} corresponding to $(\Psi_{i},G_{i})$. Then it holds that \begin{equation*} \begin{split} &\mathbb{E} \Big[ \sup_{s\in[T_{0},T_{1}]} \big| Y_{1}(s) - Y_{2}(s) \big|^{p} + \Big( \int_{T_{0}}^{T_{1}} \big| Z_{1}(s) - Z_{2}(s) \big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big]\\ &\leq C_{p}\mathbb{E} \Big[ \big| \Psi_{1} - \Psi_{2} \big|^{p} + \Big( \int_{T_{0}}^{T_{1}} \big| G_{1}(s,Y_{1}(s),Z_{1}(s)) - G_{2}(s,Y_{1}(s),Z_{1}(s)) \big| \,\mathrm{d} s \Big)^{p} \Big]. \end{split} \end{equation*} \end{lemm} \subsection{Gronwall-like inequalities}\label{Sec_Gron} In this subsection, we provide Gronwall-like inequalities which are frequently used in this paper. The idea of the proof is inspired by \cite{ShWaYo15}, where the authors treated a weighted norm of the adapted M-solution of a BSVIE. Let $(S,\Sigma, \mu)$ be a measure space. We first provide a continuous version of the inequality. \begin{lemm}\label{Lem_Gron_cont} Let $a,b,c:[0,T] \to \mathbb{R}$ be nonnegative integrable functions and let $\zeta:\Delta^{\mathrm{c}}[0,T] \times S \to \mathbb{R}$ be a nonnegative jointly measurable function. Assume that there exists a constant $K>0$ such that \begin{align} \label{Gron_0} \displaystyle &a(t) \leq K \Big\{ b(t) + \int_{t}^{T} a(s) \,\mathrm{d} s + \int_{S} \Big( \int_{t}^{T} \zeta(s,t,x) \,\mathrm{d} s \Big)^{2} \,\mathrm{d} \mu(x) \Big\},~\text{a.e.}~t \in [0,T], \\ & \displaystyle \label{Gron_00} \int_{S} \int_{0}^{t} \zeta(t,s,x)^{2} \,\mathrm{d} s \,\mathrm{d} \mu(x) \leq K \bigl\{ a(t) + c(t) \bigr\},~ \text{a.e.}~t \in [0,T]. \end{align} Then for any $\gamma \geq 2K(1+K)$, it holds that \begin{align*} \int_{0}^{T} e^{\gamma t} a(t) \,\mathrm{d} t \leq 2K \int_{0}^{T} e^{\gamma t} b(t) \,\mathrm{d} t + \int_{0}^{T} e^{\gamma t} c(t) \,\mathrm{d} t. \end{align*} In particular, we have \begin{align*} \int_{0}^{T} a(t) \,\mathrm{d} t \leq (2K+1)e^{2K(1+K)T} \int_{0}^{T} \big\{ b(t) + c(t) \big\} \,\mathrm{d} t. \end{align*} \end{lemm} \begin{proof} Let $\gamma >0$ be fixed. By the inequality \eqref{Gron_0}, we have \begin{align* \int_{0}^{T} e^{\gamma t} a(t) \,\mathrm{d} t \leq K \int_{0}^{T} e^{\gamma t} b(t) \,\mathrm{d} t + K \int_{0}^{T} e^{\gamma t} \int_{t}^{T} a(s) \,\mathrm{d} s \,\mathrm{d} t + K \int_{0}^{T} e^{\gamma t} \int_{S} \Big( \int_{t}^{T} \zeta(s,t,x) \,\mathrm{d} s \Big)^{2} \,\mathrm{d} \mu(x) \,\mathrm{d} t. \end{align*} By Fubini's theorem, we have \begin{align*} \int_{0}^{T} e^{\gamma t} \int_{t}^{T} a(s) \,\mathrm{d} s \,\mathrm{d} t = \int_{0}^{T} a(t) \int_{0}^{t} e^{\gamma s} \,\mathrm{d} s \,\mathrm{d} t \leq \frac{1}{\gamma} \int_{0}^{T} e^{\gamma t} a(t) \,\mathrm{d} t. \end{align*} Furthermore, by using Fubini's theorem, H\"older's inequality and the inequality \eqref{Gron_00}, we have \begin{align*} \int_{0}^{T} e^{\gamma t} \int_{S} \Big( \int_{t}^{T} \zeta(s,t,x) \,\mathrm{d} s \Big)^{2} \,\mathrm{d} \mu(x) \,\mathrm{d} t &= \int_{S} \int_{0}^{T} e^{\gamma t} \Big( \int_{t}^{T} e^{-\frac{\gamma}{2}s} e^{\frac{\gamma}{2}s} \zeta(s,t,x) \,\mathrm{d} s \Big)^{2} \,\mathrm{d} t \,\mathrm{d} \mu(x) \\&\leq \int_{S} \int_{0}^{T} e^{\gamma t} \Big( \int_{t}^{T} e^{-\gamma s} \,\mathrm{d} s \Big) \Big( \int_{t}^{T} e^{\gamma s} \zeta(s,t,x)^{2} \,\mathrm{d} s \Big) \,\mathrm{d} t \,\mathrm{d} \mu(x) \\&\leq \frac{1}{\gamma} \int_{S} \int_{0}^{T} \int_{t}^{T} e^{\gamma s} \zeta(s,t,x)^{2} \,\mathrm{d} s \,\mathrm{d} t \,\mathrm{d} \mu(x) \\&= \frac{1}{\gamma} \int_{0}^{T} e^{\gamma t} \int_{S} \int_{0}^{t} \zeta(t,s,x)^{2} \,\mathrm{d} s \,\mathrm{d} \mu(x) \,\mathrm{d} t \\&\leq \frac{K}{\gamma} \int_{0}^{T} e^{\gamma t} \big\{ a(t) + c(t) \big\} \,\mathrm{d} t. \end{align*} Hence we obtain \begin{align*} \int_{0}^{T} e^{\gamma t} a(t) \,\mathrm{d} t \leq \frac{K(1+K)}{\gamma} \int_{0}^{T} e^{\gamma t} a(t) \,\mathrm{d} t + K \int_{0}^{T} e^{\gamma t} b(t) \,\mathrm{d} t + \frac{K^{2}}{\gamma} \int_{0}^{T} e^{\gamma t} c(t) \,\mathrm{d} t. \end{align*} Therefore, by choosing $\gamma \geq 2K(1+K)$, we get the assertion. \end{proof} The following is the discrete version of the above inequality. The proof is similar to that of the above lemma, but we prove it for the sake of self-containedness. \begin{lemm}\label{Lem_Gron_disc} Let $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ be fixed. Let $\{a_{k}\}_{k=0}^{N-1}$, $\{b_{k}\}_{k=0}^{N-1}$, $\{c_{k}\}_{k=0}^{N-1}$ be nonnegative real-valued sequences, and for each $k=1,\ldots,N-1$ and $\ell=0,\ldots,k-1$, let $\zeta_{k,\ell}:S \to \mathbb{R}$ be a nonnegative measurable function. Assume that there exists a constant $K>0$ such that \begin{align} \label{Gron_000} &\displaystyle a_{k} \leq K \Big\{ b_{k} + \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} a_{\ell} + \int_{S} \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \zeta_{\ell,k}(x) \Big)^{2} \,\mathrm{d} \mu(x) \Big\},~k=0,\ldots,N-1, \\ & \displaystyle \label{Gron_0000} \int_{S} \sum_{\ell=0}^{k-1} \Delta t_{\ell} \zeta_{k,\ell}(x)^{2} \,\mathrm{d} \mu(x) \leq K \big\{ a_{k} + c_{k} \big\},~ k=1,\ldots,N-1. \end{align} Then for any $\gamma \geq 2K(1+K)$, it holds that \begin{align*} \sum_{k=0}^{N-1} \Gamma_{k} a_{k} \leq 2K \sum_{k=0}^{N-1} \Gamma_{k} b_{k} + \sum_{k=0}^{N-1} \Gamma_{k} c_{k}, \end{align*} where $\Gamma_{k}:=\int_{t_{k}}^{t_{k+1}} e^{\gamma t} \,\mathrm{d} t$, $k=0,\ldots,N-1$. In particular, we have \begin{align*} \sum_{k=0}^{N-1} \Delta t_{k} a_{k} \leq (2K+1)e^{2K(1+K)T} \sum_{k=0}^{N-1} \Delta t_{k} \big\{ b_{k} + c_{k} \big\}. \end{align*} \end{lemm} \begin{proof} Let $\gamma >0$ be fixed. By the inequality \eqref{Gron_000}, we have \begin{align* \sum_{k=0}^{N-1} \Gamma_{k} a_{k} \leq K \sum_{k=0}^{N-1} \Gamma_{k} b_{k} + K \sum_{k=0}^{N-2} \Gamma_{k} \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} a_{\ell} + K \sum_{k=0}^{N-2} \Gamma_{k} \int_{S} \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \zeta_{\ell,k}(x) \Big)^{2} \,\mathrm{d} \mu(x). \end{align*} Noting that $\Delta t_{k} e^{\gamma t_{k}} \leq \Gamma_{k} \leq \Delta t_{k} e^{\gamma t_{k+1}}$ for each $k=0,\ldots,N-1$, we have \begin{align*} \sum_{k=0}^{N-2} \Gamma_{k} \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} a_{\ell} = \sum_{k=1}^{N-1} \Delta t_{k} a_{k} \int_{0}^{t_{k}} e^{\gamma s} \,\mathrm{d} s \leq \frac{1}{\gamma} \sum_{k=1}^{N-1} \Delta t_{k} e^{\gamma t_{k}} a_{k} \leq \frac{1}{\gamma} \sum_{k=0}^{N-1} \Gamma_{k} a_{k}. \end{align*} Furthermore, by using H\"older's inequality and the inequality \eqref{Gron_0000}, we have \begin{align*} \sum_{k=0}^{N-2} \Gamma_{k} \int_{S} \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \zeta_{\ell,k}(x) \Big)^{2} \,\mathrm{d} \mu(x) &= \int_{S} \sum_{k=0}^{N-2} \Gamma_{k} \Big( \sum_{\ell=k+1}^{N-1} \zeta_{\ell,k}(x) \int_{t_{\ell}}^{t_{\ell+1}} e^{-\frac{\gamma}{2}s} e^{\frac{\gamma}{2}s} \,\mathrm{d} s \Big)^{2} \,\mathrm{d} \mu(x) \\&\leq \int_{S} \sum_{k=0}^{N-2} \Gamma_{k} \Big( \sum_{\ell=k+1}^{N-1} \int_{t_{\ell}}^{t_{\ell+1}} e^{-\gamma s} \,\mathrm{d} s \Big) \Big( \sum_{\ell=k+1}^{N-1} \zeta_{\ell,k}(x)^{2} \int_{t_{\ell}}^{t_{\ell+1}} e^{\gamma s} \,\mathrm{d} s \Big) \,\mathrm{d} \mu(x) \\&\leq \frac{1}{\gamma} \int_{S} \sum_{k=0}^{N-2} \Gamma_{k} e^{-\gamma t_{k+1}} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} \zeta_{\ell,k}(x)^{2} \,\mathrm{d} \mu(x) \\&\leq \frac{1}{\gamma} \int_{S} \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} \zeta_{\ell,k}(x)^{2} \,\mathrm{d} \mu(x) \\&= \frac{1}{\gamma} \sum_{k=1}^{N-1} \Gamma_{k} \int_{S} \sum_{\ell=0}^{k-1} \Delta t_{\ell} \zeta_{k,\ell}(x)^{2} \,\mathrm{d} \mu(x) \\&\leq \frac{K}{\gamma} \sum_{k=1}^{N-1} \Gamma_{k} \big\{ a_{k} + c_{k} \big\}. \end{align*} Hence we obtain \begin{align*} \sum_{k=0}^{N-1} \Gamma_{k} a_{k} \leq \frac{K(1+K)}{\gamma} \sum_{k=0}^{N-1} \Gamma_{k} a_{k} + K \sum_{k=0}^{N-1} \Gamma_{k} b_{k} + \frac{K^{2}}{\gamma} \sum_{k=0}^{N-1} \Gamma_{k} c_{k}. \end{align*} Therefore, by choosing $\gamma \geq 2K(1+K)$, we get the assertion. \end{proof} \section{BSDE approximations for general Type-\Rnum{2} BSVIEs}\label{sec_BSDE} In this and the next sections, we consider the general Type-\Rnum{2} BSVIE \eqref{BSVIE_II_1} with the stochastic coefficients $(\Psi,G)$. We first give basic assumptions for the free term $\Psi$ and the driver $G$. \begin{itemize} \item[$(\mathrm{H}_{\Psi,G})$] \begin{itemize} \item[(i)] $\Psi:\Omega \times [0,T] \to \mathbb{R}^{m}$ is measurable, and $\Psi(t)$ is $\mathcal{F}_{T}$-measurable for any $t \in [0,T]$; \item[(ii)] $G: \Omega \times \Delta[0,T] \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d} \to \mathbb{R}^{m}$ is measurable, and the process $(G(t,s,y,z_{1},z_{2}))_{s \in [t,T]}$ is progressively measurable for any $(t,y,z_{1},z_{2}) \in [0,T] \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}$; \item[(iii)] There exists a constant $L>0$ such that, for any $(t,s) \in \Delta [0,T]$ and $(y,z_{1},z_{2}), (y',z_{1}',z_{2}') \in \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}$, \begin{align*} |G(t,s,y,z_{1},z_{2})-G(t,s,y',z_{1}',z_{2}')| \leq L \big\{ |y-y'| + |z_{1}-z_{1}'| + |z_{2}-z_{2}'| \big\}; \end{align*} \item[(iv)] There exists a constant $M \geq 1$ such that \begin{align*} & \mathbb{E}\Big[ \int_{0}^{T} \big|\Psi(t)\big|^{2} \,\mathrm{d} t + \int_{0}^{T} \int_{t}^{T} \big|G(t,s,0,0,0)\big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big]^{1/2} \leq M; \end{align*} \item[(v)] There exists an increasing and continuous function $\rho_{\Psi,G}:[0,\infty) \to [0,\infty)$ with $\rho_{\Psi,G}(0)=0$ such that, for any $0 \leq t,t' \leq s \leq T$ and $(Y,Z_{1},Z_{2}) \in L^{2}_{\mathcal{F}}(\Omega;\mathbb{R}^{m}) \times (L^{2}_{\mathcal{F}}(\Omega;\mathbb{R}^{m \times d}))^{2}$, \begin{align*} &\mathbb{E} \Big[ \big|\Psi(t)-\Psi(t')\big|^{2} + \big|G(t,s,Y,Z_{1},Z_{2})-G(t',s,Y,Z_{1},Z_{2})\big|^{2} \Big]^{1/2} \\& \leq \rho_{\Psi,G}(|t-t'|) \Big\{ M + \mathbb{E}\big[ \big|Y\big|^{2} \big]^{1/2} + \mathbb{E}\big[ \big|Z_{1}\big|^{2} \big]^{1/2} + \mathbb{E}\big[ \big|Z_{2}\big|^{2} \big]^{1/2} \Big\}. \end{align*} \end{itemize} \end{itemize} \begin{defi}\label{Def_M_sol} A pair $(Y(\cdot),Z(\cdot,\cdot))$ is called an adapted M-solution of BSVIE \eqref{BSVIE_II_1} if it satisfies the following conditions: \begin{itemize} \item[(i)] $Y(\cdot) \in L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m})$ and $Z(\cdot,\cdot) \in L^{2}(0,T;L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d}))$; \item[(ii)] It holds that \begin{align*} Y(t) = \mathbb{E}[Y(t)] + \int_{0}^{t} Z(t,s) \,\mathrm{d} W(s),~\text{a.e.}~t \in [0,T],~\text{a.s.}; \end{align*} \item[(iii)] $(Y(\cdot),Z(\cdot,\cdot))$ satisfies \eqref{BSVIE_II_1} for a.e.\ $t \in [0,T]$, a.s. \end{itemize} Here, the M-solution is named after the martingale representation theorem which determines the values of $Z(t,s)$ for $(t,s) \in \Delta^{\mathrm{c}}[0,T]$ by (ii) (see \cite{Yo08}). \end{defi} The following lemma shows the well-posedness of Type-\Rnum{2} BSVIE \eqref{BSVIE_II_1} (cf.\ Theorem 3.7 in \cite{Yo08}). \begin{lemm}\label{Prop_BSVIE_0} Under the conditions (i), (ii), (iii) and (iv) in $(\mathrm{H}_{\Psi,G})$, BSVIE \eqref{BSVIE_II_1} has a unique adapted M-solution. Furthermore, it holds that \begin{align} \label{Prop_BSVIE_0_1} \mathbb{E}\Big[ \int_{0}^{T} \big| Y(t) \big|^{2} \,\mathrm{d} t + \int_{0}^{T} \int_{0}^{T} \big| Z(t,s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \leq CM^{2}. \end{align} \end{lemm} Fix $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ and let $\mathbb{H}$ be a Euclidean space. For each $\theta \in [0,T]$ and $\zeta(\cdot) \in L^{2}_{\mathbb{F}}(0,T;\mathbb{H})$, define \begin{align*} \mathcal{I}^{\pi,\theta}[\zeta(\cdot)](t_{k}) := \frac{1}{\Delta t_{k}} \int_{t_{k} \vee \theta}^{t_{k+1} \vee \theta} \zeta(s) \,\mathrm{d} s,~ k=0,\ldots, N-1. \end{align*} Note that $\mathcal{I}^{\pi,\theta}[\zeta(\cdot)](t_{k})$ is $\mathcal{F}_{t_{k+1}}$-measurable. Denote $\mathcal{I}^{\pi,0}[\zeta(\cdot)](t_{k})$ by $\mathcal{I}^{\pi}[\zeta(\cdot)](t_{k})$, that is, \begin{align*} \mathcal{I}^{\pi}[\zeta(\cdot)](t_{k}) = \frac{1}{\Delta t_{k}} \int_{t_{k}}^{t_{k+1}} \zeta(s) \,\mathrm{d} s,~ k=0,\ldots, N-1. \end{align*} We introduce the following BSDE system with parameter $\theta \in [0,T]$: \begin{align}\label{BSDE_sys_0} \begin{cases} \mathscr{Y}^{\pi,\theta}(t_{k},s) = \displaystyle \mathscr{Y}^{\pi,\theta}(t_{k},t_{\ell+1}) + \int_{s}^{t_{\ell+1}} G ( t_{k}, r, \mathscr{Y}^{\pi,\theta}(t_{\ell},r), \mathscr{Z}^{\pi,\theta}(t_{k},r), \mathcal{I}^{\pi,\theta}[\mathscr{Z}^{\pi,\theta}(t_{\ell},\cdot)](t_{k}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}} \,\mathrm{d} r \\\displaystyle \quad\quad\quad\quad\quad\quad - \int_{s}^{t_{\ell+1}} \mathscr{Z}^{\pi,\theta}(t_{k},r) \,\mathrm{d} W(r),~ s \in [t_{\ell},t_{\ell+1}],~k,\ell=0,\ldots, N-1, \\ \mathscr{Y}^{\pi,\theta}(t_{k},t_{N}) = \Psi(t_{k}),~ k=0,\ldots,N-1. \end{cases} \end{align} The above BSDE system is equivalent to the following: \begin{align}\label{BSDE_sys_1} \begin{split} \mathscr{Y}^{\pi,\theta}(t_{k},s) &= \Psi(t_{k}) + \int_{s}^{T} G ( t_{k}, r, \mathscr{Y}^{\pi,\theta}(\tau(r),r), \mathscr{Z}^{\pi,\theta}(t_{k},r), \mathcal{I}^{\pi,\theta}[\mathscr{Z}^{\pi,\theta}(\tau(r),\cdot)](t_{k}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k+1},T)}(r) \,\mathrm{d} r \\&\quad - \int_{s}^{T} \mathscr{Z}^{\pi,\theta}(t_{k},r) \,\mathrm{d} W(r),~s \in [0,T],~k=0,\ldots,N-1. \end{split} \end{align} We note that, under $(\mathrm{H}_{\Psi,G})$, $\Psi(t_{k})$ and $G(t_{k},s,y,z_{1},z_{2})$ are well-defined for each $k=0,\ldots,N-1$ and $(s,y,z_{1},z_{2}) \in [t_{k},T] \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d} $, since $\Psi$ and $G$ are continuous with respect to $t \in [0,T]$ in the sense of (v). Furthermore, it holds that \begin{align*} &\sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \big|\Psi(t_{k})\big|^{2} + \int_{t_{k+1}}^{T} \big|G(t_{k},s,0,0,0)\big|^{2} \,\mathrm{d} s \Big] \leq CM^{2}(1+\rho_{\Psi,G}(|\pi|)^{2}). \end{align*} First, we show fundamental properties of BSDE system \eqref{BSDE_sys_0}. \begin{lemm}\label{Lem_BSDE_sys_0} Under $(\mathrm{H}_{\Psi,G})$, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ and $\theta \in [0,T]$, there exists a unique solution $ \{ (\mathscr{Y}^{\pi,\theta}(t_{k},\cdot), \mathscr{Z}^{\pi,\theta}(t_{k},\cdot)) \}_{k=0}^{N-1} \in ( L^{2}_{\mathbb{F}}(\Omega, C([0,T];\mathbb{R}^{m})) \times L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d}) )^{N} $ of BSDE system \eqref{BSDE_sys_0}. Furthermore, the following estimate holds: \begin{align}\label{Lem_3_1_2} \begin{split} &\sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \mathscr{Y}^{\pi,\theta}(t_{k},s) \big|^{2} + \int_{0}^{T} \big| \mathscr{Z}^{\pi,\theta}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \\&\leq C\sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \big|\Psi(t_{k})\big|^{2} + \Big( \int_{t_{k+1}}^{T} \big|G(t_{k},s,0,0,0)\big| \,\mathrm{d} s \Big)^{2} \Big]. \end{split} \end{align} For $i=1,2$, let $(\Psi_{i},G_{i})$ satisfy $(\mathrm{H}_{\Psi,G})$ for $(\Psi,G)=(\Psi_{i},G_{i})$ with the same constants $L$ and $M$, and let $ \{ (\mathscr{Y}_{i}^{\pi,\theta}(t_{k},\cdot), \mathscr{Z}_{i}^{\pi,\theta}(t_{k},\cdot)) \}_{k=0}^{N-1} \in ( L^{2}_{\mathbb{F}}(\Omega, C([0,T];\mathbb{R}^{m})) \times L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d}) )^{N} $ be the unique solution of BSDE system \eqref{BSDE_sys_0} corresponding to $(\Psi_{i},G_{i})$. Then it holds that \begin{align}\label{Lem_3_1_1} \begin{split} &\sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \mathscr{Y}_{1}^{\pi,\theta}(t_{k},s) - \mathscr{Y}_{2}^{\pi,\theta}(t_{k},s) \big|^{2} + \int_{0}^{T} \big| \mathscr{Z}_{1}^{\pi,\theta}(t_{k},s) - \mathscr{Z}_{2}^{\pi,\theta}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \\& \leq C \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \big| \Psi_{1}(t_{k}) - \Psi_{2}(t_{k}) \big|^{2} \\&\quad\quad\quad\quad\quad\quad\quad + \Big( \int_{t_{k+1}}^{T} \big| G_{1} ( t_{k}, s, \mathscr{Y}_{1}^{\pi,\theta}(\tau(s),s), \mathscr{Z}_{1}^{\pi,\theta}(t_{k},s), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(\tau(s),\cdot)](t_{k}) ) \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad - G_{2} ( t_{k}, s, \mathscr{Y}_{1}^{\pi,\theta}(\tau(s),s), \mathscr{Z}_{1}^{\pi,\theta}(t_{k},s), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(\tau(s),\cdot)](t_{k}) ) \big| \,\mathrm{d} s \Big)^{2} \Big]. \end{split} \end{align} \end{lemm} \begin{proof} Fix $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ and $\theta \in [0,T]$. We show that there exists a unique solution $ \{ (\mathscr{Y}^{\pi,\theta}(t_{k},\cdot), \mathscr{Z}^{\pi,\theta}(t_{k},\cdot)) \}_{k=0}^{N-1} \in ( L^{2}_{\mathbb{F}}(\Omega, C([0,T];\mathbb{R}^{m})) \times L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d}) )^{N} $ of BSDE system \eqref{BSDE_sys_0} by a backward induction with respect to $k=0,\ldots,N-1$. For $k=N-1$, the equation \eqref{BSDE_sys_1} for $(\mathscr{Y}^{\pi,\theta}(t_{N-1},\cdot),\mathscr{Z}^{\pi,\theta}(t_{N-1},\cdot))$ becomes \begin{align*} \mathscr{Y}^{\pi,\theta}(t_{N-1},s) = \Psi(t_{N-1}) - \int_{s}^{T} \mathscr{Z}^{\pi,\theta}(t_{N-1},r) \,\mathrm{d} W(r),~s \in [0,T], \end{align*} which admits a unique adapted solution in $L^{2}_{\mathbb{F}}(\Omega, C([0,T];\mathbb{R}^{m})) \times L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d})$. Let $k' \in \{0,\ldots, N-2\}$ be fixed and assume that, for each $k=k'+1,\ldots,N-1$, the equation \eqref{BSDE_sys_1} admits a unique solution \begin{align*} ( \mathscr{Y}^{\pi,\theta}(t_{k},\cdot), \mathscr{Z}^{\pi,\theta}(t_{k},\cdot) ) \in L^{2}_{\mathbb{F}}(\Omega, C([0,T];\mathbb{R}^{m})) \times L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d}). \end{align*} Then we know that \begin{align*} &(\mathscr{Y}^{\pi,\theta}(\tau(r),r))_{r \in [t_{k'+1},T)} \in L^{2}_{\mathbb{F}}(t_{k'+1},T;\mathbb{R}^{m}) \shortintertext{and} &(\mathcal{I}^{\pi,\theta}[\mathscr{Z}^{\pi,\theta}(\tau(r),\cdot)](t_{k'}))_{r \in [t_{k'+1},T)} \in L^{2}_{\mathcal{F}_{t_{k'+1}}}(t_{k'+1},T;\mathbb{R}^{m \times d}). \end{align*} Hence the BSDE \begin{align*} \mathscr{Y}^{\pi,\theta}(t_{k'},s) &= \Psi(t_{k'}) + \int_{s}^{T} G ( t_{k'}, r, \mathscr{Y}^{\pi,\theta}(\tau(r),r), \mathscr{Z}^{\pi,\theta}(t_{k'},r), \mathcal{I}^{\pi,\theta}[\mathscr{Z}^{\pi,\theta}(\tau(r),\cdot)](t_{k'}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k'+1},T)}(r) \,\mathrm{d} r \\&\quad - \int_{s}^{T} \mathscr{Z}^{\pi,\theta}(t_{k'},r) \,\mathrm{d} W(r), ~s \in [0,T], \end{align*} admits a unique adapted solution $(\mathscr{Y}^{\pi,\theta}(t_{k'},\cdot),\mathscr{Z}^{\pi,\theta}(t_{k'},\cdot)) \in L^{2}_{\mathbb{F}}(\Omega, C([0,T];\mathbb{R}^{m})) \times L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d})$. Thus we complete the proof of the first assertion by the backward induction. The estimate \eqref{Lem_3_1_2} follows from \eqref{Lem_3_1_1} by choosing $(\Psi_{1},G_{1})=(0,0)$ and $(\Psi_{2},G_{2})=(\Psi,G)$. We prove \eqref{Lem_3_1_1}. For each fixed $k=0,\ldots,N-1$ and $i=1,2$, $(\mathscr{Y}_{i}^{\pi,\theta}(t_{k},\cdot),\mathscr{Z}_{i}^{\pi,\theta}(t_{k},\cdot))$ solves the BSDE \begin{align*} \begin{split} \mathscr{Y}_{i}^{\pi,\theta}(t_{k},s) &= \Psi_{i}(t_{k}) + \int_{s}^{T} G_{i} ( t_{k}, r, \mathscr{Y}_{i}^{\pi,\theta}(\tau(r),r), \mathscr{Z}_{i}^{\pi,\theta}(t_{k},r), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{i}^{\pi,\theta}(\tau(r),\cdot)](t_{k}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k+1},T)}(r) \,\mathrm{d} r \\&\quad - \int_{s}^{T} \mathscr{Z}_{i}^{\pi,\theta}(t_{k},r) \,\mathrm{d} W(r),~s \in [0,T]. \end{split} \end{align*} By the stability estimate for BSDEs (see Lemma \ref{apriori_0}), we have \begin{align*} & \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \mathscr{Y}_{1}^{\pi,\theta}(t_{k},s) - \mathscr{Y}_{2}^{\pi,\theta}(t_{k},s) \big|^{2} + \int_{0}^{T} \big| \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s) - \mathscr{Z}_{2}^{\pi, \theta}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \\*&\leq C \mathbb{E}\Big[ \big| \Psi_{1}(t_{k}) - \Psi_{2}(t_{k}) \big|^{2} \\*&\quad\quad\quad + \Big( \int_{t_{k+1}}^{T} \big| G_{1} ( t_{k}, s, \mathscr{Y}_{1}^{\pi, \theta}(\tau(s),s), \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(\tau(s),\cdot)](t_{k}) ) \\*&\quad\quad\quad\quad\quad\quad\quad\quad - G_{2} ( t_{k}, s, \mathscr{Y}_{2}^{\pi, \theta}(\tau(s),s), \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{2}^{\pi,\theta}(\tau(s),\cdot)](t_{k}) ) \big| \,\mathrm{d} s \Big)^{2} \Big] \\&\leq C \mathbb{E}\Big[ \big| \Psi_{1}(t_{k}) - \Psi_{2}(t_{k}) \big|^{2} \\&\quad\quad\quad + \Big( \int_{t_{k+1}}^{T} \big| G_{1} ( t_{k}, s, \mathscr{Y}_{1}^{\pi, \theta}(\tau(s),s), \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(\tau(s),\cdot)](t_{k}) ) \\&\quad\quad\quad\quad\quad\quad\quad\quad - G_{2} ( t_{k}, s, \mathscr{Y}_{1}^{\pi, \theta}(\tau(s),s), \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(\tau(s),\cdot)](t_{k}) ) \big| \,\mathrm{d} s \Big)^{2} \Big] \\&\quad + C \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \mathscr{Y}_{1}^{\pi, \theta}(t_{\ell},s) - \mathscr{Y}_{2}^{\pi, \theta}(t_{\ell},s) \big|^{2} \Big] \\&\quad + C\mathbb{E}\Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(t_{\ell},\cdot)](t_{k}) - \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{2}^{\pi,\theta}(t_{\ell},\cdot)](t_{k}) \big| \Big)^{2} \Big]. \end{align*} Moreover, we have for each $k=1,\ldots,N-1$, \begin{align*} \mathscr{Y}_{i}^{\pi, \theta}(t_{k},t_{k}) = \mathbb{E} \Big[ \mathscr{Y}_{i}^{\pi, \theta}(t_{k},t_{k}) \Big] + \int_{0}^{t_{k}} \mathscr{Z}_{i}^{\pi, \theta}(t_{k},s) \,\mathrm{d} W(s), ~\text{a.s.}, ~i=1,2, \end{align*} and thus \begin{align* & \sum_{\ell=0}^{k-1} \Delta t_{\ell} \mathbb{E}\Big[ \big| \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(t_{k},\cdot)](t_{\ell}) - \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{2}^{\pi,\theta}(t_{k},\cdot)](t_{\ell}) \big|^{2} \Big] \\&= \sum_{\ell=0}^{k-1} \Delta t_{\ell} \mathbb{E}\Big[ \Big| \frac{1}{\Delta t_{\ell}} \int_{t_{\ell}\vee \theta}^{t_{\ell+1} \vee \theta} \big\{ \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s) - \mathscr{Z}_{2}^{\pi, \theta}(t_{k},s) \big\} \,\mathrm{d} s \Big|^{2} \Big] \\& \leq \sum_{\ell=0}^{k-1} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} | \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s) - \mathscr{Z}_{2}^{\pi, \theta}(t_{k},s) |^{2} \,\mathrm{d} s \Big] = \mathbb{E}\Big[ \int_{0}^{t_{k}} | \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s) - \mathscr{Z}_{2}^{\pi, \theta}(t_{k},s) |^{2} \,\mathrm{d} s \Big] \\&= \mathbb{E}\Big[ \Big| \int_{0}^{t_{k}} \big\{ \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s) - \mathscr{Z}_{2}^{\pi, \theta}(t_{k},s) \big\} \,\mathrm{d} W(s) \Big|^{2} \Big] \\&= \mathbb{E}\Big[ \Big| \mathscr{Y}_{1}^{\pi, \theta}(t_{k},t_{k}) - \mathscr{Y}_{2}^{\pi, \theta}(t_{k},t_{k}) - \mathbb{E} \Big[ \mathscr{Y}_{1}^{\pi, \theta}(t_{k},t_{k}) - \mathscr{Y}_{2}^{\pi, \theta}(t_{k},t_{k}) \Big] \Big|^{2} \Big] \\&\leq \mathbb{E}\Big[ \big| \mathscr{Y}_{1}^{\pi, \theta}(t_{k},t_{k}) - \mathscr{Y}_{2}^{\pi, \theta}(t_{k},t_{k}) \big|^{2} \Big]. \end{align*} Hence, by using the discrete Gronwall-like inequality (see Lemma \ref{Lem_Gron_disc}) with \begin{align*} a_{k} &= \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \mathscr{Y}_{1}^{\pi, \theta}(t_{k},s) - \mathscr{Y}_{2}^{\pi, \theta}(t_{k},s) \big|^{2} + \int_{0}^{T} \big| \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s) - \mathscr{Z}_{2}^{\pi, \theta}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big], \\ b_{k} &= \mathbb{E}\Big[ \big| \Psi_{1}(t_{k}) - \Psi_{2}(t_{k}) \big|^{2} \\&\quad\quad\quad + \Big( \int_{t_{k+1}}^{T} \big| G_{1} ( t_{k}, s, \mathscr{Y}_{1}^{\pi, \theta}(\tau(s),s), \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(\tau(s),\cdot)](t_{k}) ) \\*&\quad\quad\quad\quad\quad\quad\quad\quad - G_{2} ( t_{k}, s, \mathscr{Y}_{1}^{\pi, \theta}(\tau(s),s), \mathscr{Z}_{1}^{\pi, \theta}(t_{k},s), \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(\tau(s),\cdot)](t_{k}) ) \big| \,\mathrm{d} s \Big)^{2} \Big],~ \\ c_{k} &= 0, ~ \zeta_{k,\ell}(\omega) = \big| \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{1}^{\pi,\theta}(t_{k},\cdot)](t_{\ell}) - \mathcal{I}^{\pi,\theta}[\mathscr{Z}_{2}^{\pi,\theta}(t_{k},\cdot)](t_{\ell}) \big| ~\text{and}~ (S,\Sigma,\mu) = (\Omega,\mathcal{F},\mathbb{P}), \end{align*} we get the estimate \eqref{Lem_3_1_1}. \end{proof} Next, we provide $L^p$-a priori estimates for solutions of Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} and BSDE system~\eqref{BSDE_sys_0} for $p\geq2$. The $L^p$-estimates for $p>2$ are needed for the analysis in Section~\ref{sec_L2_reg}. \begin{theo}\phantomsection\label{Lem_Lp} \begin{itemize} \item[(i)] Suppose that $(\Psi,G)$ satisfies the conditions (i), (ii) and (iii) in $(\mathrm{H}_{\Psi,G})$, and \begin{align*} \mathbb{E}\Big[ \Big( \int_{0}^{T} \big| \Psi(t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} + \Big( \int_{0}^{T} \int_{t}^{T} \big| G(t,s,0,0,0) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{p/2} \Big] <\infty, \end{align*} for some $p \geq 2$. Let $(Y(\cdot), Z(\cdot,\cdot)) \in L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m}) \times L^{2}(0,T;L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d}))$ be the adapted M-solution of BSVIE \eqref{BSVIE_II_1}. For a.e.\ $t \in [0,T]$, define \begin{align*} Y(t,s) := \mathbb{E}_{s} \Big[ \Psi(t) + \int_{s}^{T} G(t,r,Y(r),Z(t,r),Z(r,t)) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(r) \,\mathrm{d} r \Big],~ s \in [0,T]. \end{align*} Then it holds that \begin{align* &\mathbb{E}\Big[ \sup_{s \in [0,T]} \Big( \int_{0}^{T} \big| Y(t,s) \big|^{2} \,\mathrm{d} t \Big)^{p/2} + \Big( \int_{0}^{T} \big| Y(t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} + \Big( \int_{0}^{T} \int_{0}^{T} \big| Z(t,s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{p/2} \Big] \\ &\leq C_{p} \mathbb{E}\Big[ \Big( \int_{0}^{T} \big| \Psi(t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} + \Big( \int_{0}^{T} \int_{t}^{T} \big| G(t,s,0,0,0) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{p/2} \Big]. \end{align*} \item[(ii)] Let $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ and $\theta \in [0,T]$ be fixed. Suppose that $(\Psi,G)$ satisfies $(\mathrm{H}_{\Psi,G})$ and \begin{align*} \mathbb{E}\Big[ \Big( \sum_{k=0}^{N-1} \Delta t_{k} \big| \Psi(t_{k}) \big|^{2} \Big)^{p/2} + \Big( \sum_{k=0}^{N-1} \Delta t_{k} \int_{t_{k+1}}^{T} \big| G(t_{k},s,0,0,0) \big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big] <\infty, \end{align*} for some $p \geq 2$. Let $ \{ (\mathscr{Y}^{\pi,\theta}(t_{k},\cdot), \mathscr{Z}^{\pi,\theta}(t_{k},\cdot)) \}_{k=0}^{N-1} \in ( L^{2}_{\mathbb{F}}(\Omega, C([0,T];\mathbb{R}^{m})) \times L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d}) )^{N} $ be the solution of BSDE system \eqref{BSDE_sys_0}. Then it holds that \begin{align* &\mathbb{E}\Big[ \sup_{s \in [0,T]} \Big( \sum_{k=0}^{N-1} \Delta t_{k} \big| \mathscr{Y}^{\pi,\theta}(t_{k},s) \big|^{2} \Big)^{p/2} + \Big( \sum_{k=0}^{N-1} \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Y}^{\pi,\theta}(t_{k},t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} \\&\quad\quad\quad + \Big( \sum_{k=0}^{N-1} \Delta t_{k} \int_{0}^{T} \big| \mathscr{Z}^{\pi,\theta}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big] \\ &\leq C_{p} \mathbb{E}\Big[ \Big( \sum_{k=0}^{N-1} \Delta t_{k} \big| \Psi(t_{k}) \big|^{2} \Big)^{p/2} + \Big( \sum_{k=0}^{N-1} \Delta t_{k} \int_{t_{k+1}}^{T} \big| G(t_{k},s,0,0,0) \big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big]. \end{align*} \end{itemize} \end{theo} \begin{proof} See \hyperref[sec_Appendix]{Appendix}. \end{proof} \begin{rem} \begin{itemize} \item[(\rnum{1})] We remark that $L^p$-estimates for the solution of Type-\Rnum{1} BSVIE~\eqref{Type-1} for $p>1$ have been investigated in many papers (see for example \cite{Yo08,WaT12,Wa20,Ha21,Po20}). Also, for Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1}, Yong~\cite{Yo08} showed the well-posedness and a priori estimate for the adapted M-solution in the $L^2$-space, and Wang~\cite{WaT12} showed the well-posedness in the $L^p$-space with $p\in(1,2)$. However, $L^p$-estimates for the adapted M-solution of Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} for $p>2$ have not been studied in the literature. Indeed, Popier \cite{Po20} mentioned that the $L^{p}$-estimates for Type-\Rnum{2} BSVIEs has been an open problem. Theorem~\ref{Lem_Lp} gives an answer to the open problem mentioned in the literature, and thus we guess that this theorem itself is an important theoretical result. The main idea of the proof is to consider the dynamics of the ``integrated process'' $s \mapsto \int_{0}^{T}|Y(t,s)|^{2} \,\mathrm{d} t$, which turns out to be an It\^o process. For more detailed discussions, see \hyperref[sec_Appendix]{Appendix}. \item[(\rnum{2})] Theorem~\ref{Lem_Lp} does not give any estimates for the term $\mathbb{E}[\int^T_0|Y(t)|^p\,\mathrm{d} t]$ with $p>2$, which is finite in the case of Type-\Rnum{1} BSVIE~\eqref{Type-1} under appropriate assumptions for $\Psi$ and $G$ (see \cite{Ha21,Po20}). We note that the martingale integrand $Z(\cdot,\cdot)$, which stems from the martingale representation theorem, is just locally square integrable with respect to the second time parameter, and the integral $\int^T_0|\int^T_tZ(s,t)\,\mathrm{d} s|^p\,\mathrm{d} t$ is not finite in general. For this reason, for Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} whose driver $G$ depends on $Z(s,t)$, the term $\mathbb{E}[\int^T_0|Y(t)|^p\,\mathrm{d} t]$ is difficult to estimate, and we can guess that it is not finite in general. \end{itemize} \end{rem} Denote the solution $(\mathscr{Y}^{\pi,0}, \mathscr{Z}^{\pi,0})$ of BSDE system \eqref{BSDE_sys_0} with $\theta =0 $ by $(\mathscr{Y}^{\pi}, \mathscr{Z}^{\pi})$. The following theorem is the main result of this section, which we call a {\it BSDE approximation}. \begin{theo}\label{Theo_BSDE_0} Suppose $(\mathrm{H}_{\Psi,G})$ holds. Then it holds that \begin{align* & \lim_{|\pi| \to 0} \mathbb{E} \Big[ \int_{0}^{T} \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t + \int_{0}^{T} \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] = 0. \end{align*} \end{theo} \begin{proof} For a.e.\ $t\in[0,T]$, define $Y(t,\cdot)=(Y(t,s))_{s\in[0,T]}$ by \begin{equation*} Y(t,s):=\mathbb{E}_s\Bigl[\Psi(t)+\int^T_sG(t,r,Y(r),Z(t,r),Z(r,t))\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(r)\,\mathrm{d} r\Bigr],\ s\in[0,T]. \end{equation*} Then $(Y(t,\cdot),Z(t,\cdot))\in L^2_\mathbb{F}(\Omega;C([0,T];\mathbb{R}^m))\times L^2_\mathbb{F}(0,T;\mathbb{R}^{m\times d})$ solves the following BSDE parametrized by $t$: \begin{equation*} Y(t,s)=\Psi(t)+\int^T_sG(t,r,Y(r),Z(t,r),Z(r,t))\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(r)\,\mathrm{d} r-\int^T_sZ(t,r)\,\mathrm{d} W(r),\ s\in[0,T]. \end{equation*} Indeed, for each $s\in[t,T]$, by taking the conditional expectation $\mathbb{E}_s[\cdot]$ on both sides of \eqref{BSVIE_II_1}, we have \begin{align*} Y(t)&=\mathbb{E}_s\Bigl[\Psi(t)+\int^T_tG(t,r,Y(r),Z(t,r),Z(r,t))\,\mathrm{d} r\Bigr]-\int^s_tZ(t,r)\,\mathrm{d} W(r)\\ &=Y(t,s)+\int^s_tG(t,r,Y(r),Z(t,r),Z(r,t))\,\mathrm{d} r-\int^s_tZ(t,r)\,\mathrm{d} W(r), \end{align*} and hence \begin{equation*} Y(t,s)=\Psi(t)+\int^T_sG(t,r,Y(r),Z(t,r),Z(r,t))\,\mathrm{d} r-\int^T_sZ(t,r)\,\mathrm{d} W(r). \end{equation*} Furthermore, for each $s\in[0,t]$, by the definition of the adapted M-solution, it holds that \begin{align*} Y(t,s)&=\mathbb{E}_s\Bigl[\Psi(t)+\int^T_tG(t,r,Y(r),Z(t,r),Z(r,t))\,\mathrm{d} r\Bigr]=\mathbb{E}_s\bigl[Y(t)\bigr]=Y(t)-\int^t_sZ(t,r)\,\mathrm{d} W(r)\\ &=\Psi(t)+\int^T_tG(t,r,Y(r),Z(t,r),Z(r,t))\,\mathrm{d} r-\int^T_sZ(t,r)\,\mathrm{d} W(r). \end{align*} We also note that $Y(t,t)=Y(t)$, a.e.\ $t\in[0,T]$, a.s. On the other hand, for each fixed $t \in [0,T)$, $(\mathscr{Y}^{\pi}(\tau(t),\cdot), \mathscr{Z}^{\pi}(\tau(t),\cdot))$ solves the BSDE \begin{align*} \mathscr{Y}^{\pi}(\tau(t),s) &= \Psi(\tau(t)) + \int_{s}^{T} G ( \tau(t), r, \mathscr{Y}^{\pi}(\tau(r),r), \mathscr{Z}^{\pi}(\tau(t),r), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(r),\cdot)](\tau(t)) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(t),T)}(r) \,\mathrm{d} r \\*&\quad - \int_{s}^{T} \mathscr{Z}^{\pi}(\tau(t),r) \,\mathrm{d} W(r),~s \in [0,T]. \end{align*} Thus by the stability estimate for BSDEs (see Lemma \ref{apriori_0}), we have, for a.e.\ $t \in [0,T]$, \begin{align*} & \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} + \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big] \\*&\leq \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| Y(t,s) - \mathscr{Y}^{\pi}(\tau(t),s) \big|^{2} + \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big] \\&\leq C \mathbb{E} \Big[ \big| \Psi(t) - \Psi(\tau(t)) \big|^{2} + \Big( \int_{0}^{T} \big| G ( t, s, Y(s), Z(t,s), Z(s,t) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T)}(s) \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad - G ( \tau(t), s, \mathscr{Y}^{\pi}(\tau(s),s), Z(t,s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(t),T)}(s) \big| \,\mathrm{d} s \Big)^{2} \Big] \\&\leq C \Big\{ \rho_{\Psi,G}(|\pi|)^{2} \Big( M^{2} + \mathbb{E}\Big[ \int_{\tau^{*}(t)}^{T} \big| Y(s) \big|^{2} + \big| Z(t,s) \big|^{2} + \big| Z(s,t) \big|^{2} \,\mathrm{d} s \Big] \Big) \\&\quad\quad\quad + |\pi| \mathbb{E}\Big[ \int_{t}^{\tau^{*}(t)} \Big\{ \big| G ( t, s, 0, 0, 0 ) \big|^{2} + \big| Y(s) \big|^{2} + \big| Z(t,s) \big|^{2} + \big| Z(s,t) \big|^{2} \Big\} \,\mathrm{d} s \Big] \\&\quad\quad\quad + \int_{\tau^{*}(t)}^{T} \mathbb{E} \Big[ \big| Y(s) - \mathscr{Y}^{\pi}(\tau(s),s) \big|^{2} \Big] \,\mathrm{d} s + \mathbb{E} \Big[ \Big( \int_{\tau^{*}(t)}^{T} \big| Z(s,t) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)) \big| \,\mathrm{d} s \Big)^{2} \Big] \Big\}, \end{align*} and thus, \begin{align}\label{eq_3.6_0} \begin{split} & \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} + \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big] \\&\leq C \Big\{ \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) \Big( M^{2} + \mathbb{E}\Big[ \int_{t}^{T} \big\{ \big|G(t,s,0,0,0)\big|^{2} + \big|Y(s)\big|^{2} + \big|Z(t,s)\big|^{2} + \big|Z(s,t)\big|^{2} \big\} \,\mathrm{d} s \Big] \Big) \\&\quad\quad\quad + \int_{t}^{T} \mathbb{E} \Big[ \big| Y(s) - \mathscr{Y}^{\pi}(\tau(s),s) \big|^{2} \Big] \,\mathrm{d} s + \mathbb{E} \Big[ \Big( \int_{t}^{T} \big| Z(s,t) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)) \big| \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(t),T)}(s) \,\mathrm{d} s \Big)^{2} \Big] \Big\}. \end{split} \end{align} Observe that, for a.e.\ $t \in [0,T)$, \begin{align*} &\mathbb{E} \Big[ \int_{0}^{t} \big| Z(t,s) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big|^{2} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(s),T)}(t) \,\mathrm{d} s \Big] = \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| Z(t,s) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \\&\leq 2 \Big\{ \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| Z(t,s) - \mathcal{I}^{\pi}[Z(t,\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} s \Big] + \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathcal{I}^{\pi}[Z(t,\cdot)-\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \Big\}. \end{align*} The second term in the right-hand side can be estimated as follows: \begin{align*} \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathcal{I}^{\pi}[Z(t,\cdot)-\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} s \Big] &\leq \mathbb{E} \Big[ \int_{0}^{t} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big] \\&= \mathbb{E} \Big[ \Big| \int_{0}^{t} \big\{ Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big\} \,\mathrm{d} W(s) \Big|^{2} \Big] \\&\leq \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \Big]. \end{align*} Thus we obtain \begin{align*} &\mathbb{E} \Big[ \int_{0}^{t} \big| Z(t,s) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big|^{2} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(s),T)}(t) \,\mathrm{d} s \Big] \\&\leq 2 \Big\{ \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| Z(t,s) - \mathcal{I}^{\pi}[Z(t,\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} s \Big] + \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \Big] \Big\}. \end{align*} From this inequality and \eqref{eq_3.6_0}, by using the Gronwall-like inequality (see Lemma \ref{Lem_Gron_cont}) with \begin{align*} a(t) &= \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} + \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big], \\ b(t) &= \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) \Big( M^{2} + \mathbb{E}\Big[ \int_{t}^{T} \big\{ \big|G(t,s,0,0,0)\big|^{2} + \big|Y(s)\big|^{2} + \big|Z(t,s)\big|^{2} + \big|Z(s,t)\big|^{2} \big\} \,\mathrm{d} s \Big] \Big), \\ c(t) &= \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| Z(t,s) - \mathcal{I}^{\pi}[Z(t,\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} s \Big], \\ \zeta(t,s,\omega) &= \big| Z(t,s) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big| \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(s),T)}(t) ~\text{and}~ (S,\Sigma,\mu) = (\Omega,\mathcal{F},\mathbb{P}), \end{align*} we see that \begin{align*} &\int_{0}^{T} \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} + \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big] \,\mathrm{d} t \\&\leq C \Big\{ \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) \Big( M^{2} + \int_{0}^{T} \mathbb{E}\Big[ \int_{t}^{T} \big\{ \big|G(t,s,0,0,0)\big|^{2} + \big|Y(s)\big|^{2} + \big|Z(t,s)\big|^{2} + \big|Z(s,t)\big|^{2} \big\} \,\mathrm{d} s \Big] \,\mathrm{d} t \Big) \\&\quad\quad\quad+ \int_{0}^{T} \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| Z(t,s) - \mathcal{I}^{\pi}[Z(t,\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \,\mathrm{d} t \Big\} \\&\leq C \Big\{ M^{2} \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) + \int_{0}^{T} \mathbb{E}\Big[ \int_{0}^{T} \big| Z(t,s) - \mathcal{I}^{\pi}[Z(t,\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} t \Big] \,\mathrm{d} s \Big\}, \end{align*} where in the last inequality, we used the assumption (iv) in $(\mathrm{H}_{\Psi,G})$ and the estimate \eqref{Prop_BSVIE_0_1}. Since $s \mapsto Z(\cdot,\cdot,s)$ is a square-integrable function with values in the Hilbert space $L^{2}(\Omega \times [0,T];\mathbb{R}^{m \times d})$, we see that the second term in the right-hand side above converges to zero as $|\pi| \downarrow 0$. This completes the proof. \end{proof} \begin{rem} In the case of Type-\Rnum{1} BSVIEs, a similar convergence result was shown by Wang \cite{WaY18} and Wang and Yong \cite{WaTYo19}. Theorem \ref{Theo_BSDE_0} extends their result to Type-\Rnum{2} BSVIEs. We emphasize that our result holds true for general (stochastic) coefficients $\Psi$ and $G$. \end{rem} For further analysis, we need a quantitative estimate for the $L^{2}$-error between the solution $(\mathscr{Y}^{\pi}, \mathscr{Z}^{\pi})$ of BSDE system \eqref{BSDE_sys_0} with $\theta =0$ and the adapted M-solution $(Y(\cdot),Z(\cdot,\cdot))$ of BSVIE \eqref{BSVIE_II_1}. For this purpose, we define \begin{align*} \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) := \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \mathscr{Z}^{\pi}(t_{k},s) \,\mathrm{d} s \Big] = \mathbb{E}_{t_{\ell}} \Big[ \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{k},\cdot)](t_{\ell}) \Big],~ k,\ell=0,\ldots,N-1. \end{align*} \begin{prop}\label{Prop_BSDE_0} Suppose $(\mathrm{H}_{\Psi,G})$ holds. Then for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, it holds that \begin{align* & \mathbb{E} \Big[ \int_{0}^{T} \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t + \int_{0}^{T} \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \\&\leq C \Big\{ M^{2} \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) + \sum_{k=1}^{N-1} \Delta t_{k} \sum_{\ell=0}^{k-1} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \Big\}. \end{align*} \end{prop} \begin{proof} As before, we see that the estimate \eqref{eq_3.6_0} holds. Noting that \begin{align*} &\mathbb{E} \Big[ \int_{0}^{t} \big| Z(t,s) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big|^{2} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(s),T)}(t) \,\mathrm{d} s \Big] = \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| Z(t,s) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \\&\leq 3 \Big\{ \mathbb{E} \Big[ \int_{0}^{t} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big] + \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathscr{Z}^{\pi}(\tau(t),s) - \overline{\mathscr{Z}}^{\pi}(\tau(t),\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \\&\quad\quad\quad + \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) - \overline{\mathscr{Z}}^{\pi}(\tau(t),\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \Big\} \\&\leq 3 \Big\{ \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \Big] + \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathscr{Z}^{\pi}(\tau(t),s) - \overline{\mathscr{Z}}^{\pi}(\tau(t),\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \\&\quad\quad\quad + \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) - \overline{\mathscr{Z}}^{\pi}(\tau(t),\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \Big\} \\&\leq 3 \Big\{ \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \Big] + 2 \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathscr{Z}^{\pi}(\tau(t),s) - \overline{\mathscr{Z}}^{\pi}(\tau(t),\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \Big\}, \end{align*} for a.e.\ $t \in [0,T)$, by the Gronwall-like inequality (see Lemma \ref{Lem_Gron_cont}) with \begin{align*} a(t) &= \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} + \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big], \\ b(t) &= \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) \Big( M^{2} + \mathbb{E}\Big[ \int_{t}^{T} \big\{ \big|G(t,s,0,0,0)\big|^{2} + \big|Y(s)\big|^{2} + \big|Z(t,s)\big|^{2} + \big|Z(s,t)\big|^{2} \big\} \,\mathrm{d} s \Big] \Big), \\ c(t) &= \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathscr{Z}^{\pi}(\tau(t),s) - \overline{\mathscr{Z}}^{\pi}(\tau(t),\tau(s)) \big|^{2} \,\mathrm{d} s \Big], \\ \zeta(t,s,\omega) &= \big| Z(t,s) - \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(t),\cdot)](\tau(s)) \big| \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(s),T)}(t) ~\text{and}~ (S,\Sigma,\mu) = (\Omega,\mathcal{F},\mathbb{P}), \end{align*} we see that \begin{align*} &\int_{0}^{T} \mathbb{E} \Big[ \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} + \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \Big] \,\mathrm{d} t \\&\leq C \Big\{ \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) \Big( M^{2} + \int_{0}^{T} \mathbb{E}\Big[ \int_{t}^{T} \big\{ \big|G(t,s,0,0,0)\big|^{2} + \big|Y(s)\big|^{2} + \big|Z(t,s)\big|^{2} + \big|Z(s,t)\big|^{2} \big\} \,\mathrm{d} s \Big] \,\mathrm{d} t \Big) \\&\quad\quad\quad+ \int_{0}^{T} \mathbb{E} \Big[ \int_{0}^{\tau(t)} \big| \mathscr{Z}^{\pi}(\tau(t),s) - \overline{\mathscr{Z}}^{\pi}(\tau(t),\tau(s)) \big|^{2} \,\mathrm{d} s \Big] \,\mathrm{d} t \Big\} \\&\leq C \Big\{ M^{2} \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) + \sum_{k=1}^{N-1} \Delta t_{k} \sum_{\ell=0}^{k-1} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \Big\}, \end{align*} where in the last inequality, we used the assumption (iv) in $(\mathrm{H}_{\Psi,G})$ and the estimate \eqref{Prop_BSVIE_0_1}. This completes the proof. \end{proof} As a corollary of the above proposition, we provide an estimate for the $L^{2}$-time regularity of $(Y(\cdot),Z(\cdot,\cdot))$. For this purpose, for each $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, we introduce \begin{align}\label{Reg_YZ} \begin{split} & \mathcal{E}(Y;\pi) := \sum^{N-1}_{k=0} \mathbb{E} \Big[ \int^{t_{k+1}}_{t_k} \big| Y(t) - \overline{Y}^{\pi}(t_k) \big|^{2} \,\mathrm{d} t \Big], \\ & \mathcal{E}(Z;\pi) := \sum^{N-1}_{k=0} \sum^{N-1}_{\ell=0} \mathbb{E}\Big[ \int^{t_{k+1}}_{t_k} \int^{t_{\ell+1}}_{t_\ell} \big| Z(t,s) - \overline{Z}^{\pi}(t_k,t_\ell) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big], \end{split} \end{align} where \begin{align*} \begin{split} &\overline{Y}^{\pi}(t_k) := \frac{1}{\Delta t_{k}} \mathbb{E}_{t_{k}} \Big[ \int^{t_{k+1}}_{t_k} Y(t) \,\mathrm{d} t \Big],~ k=0,\dots,N-1,\\ &\overline{Z}^{\pi}(t_k,t_\ell) := \frac{1}{\Delta t_{k}} \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ \int^{t_{k+1}}_{t_k} \int^{t_{\ell+1}}_{t_\ell} Z(t,s) \,\mathrm{d} s \,\mathrm{d} t \Big],~ k,\ell=0,\dots,N-1. \end{split} \end{align*} Although depending on $\pi$, $\overline{Y}^{\pi}(t_k)$ and $\overline{Z}^{\pi}(t_k,t_{\ell})$ are defined through the true solution $(Y(\cdot),Z(\cdot,\cdot))$, not through some approximations. Therefore, $\mathcal{E}(Y;\pi)$ and $\mathcal{E}(Z;\pi)$ measure a kind of time regularity. We call $\mathcal{E}(Y;\pi)$ and $\mathcal{E}(Z;\pi)$ the {\emph{modulus of the $L^{2}$-time regularity} of $Y(\cdot)$ and $Z(\cdot,\cdot)$, respectively. \begin{cor}\label{Cor_0} Under $(\mathrm{H}_{\Psi,G})$, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, it holds that \begin{align* \mathcal{E}(Y;\pi) + \mathcal{E}(Z;\pi) &\leq C \Big\{ M^{2} \big( |\pi| + \rho_{\Psi,G}(|\pi|)^{2} \big) + \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \\&\quad+ \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \Big\}. \end{align*} \end{cor} \begin{proof} Note that $\overline{Y}^{\pi}(t_{k})$ is the best approximation of $Y(\cdot)$ on $[t_{k},t_{k+1}]$ in the following sense: \begin{align*} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big| Y(t) - \overline{Y}^{\pi}(t_{k}) \big|^{2} \,\mathrm{d} t \Big] \leq \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big| Y(t) - \eta \big|^{2} \,\mathrm{d} t \Big] \end{align*} for any $\eta \in L^{2}_{\mathcal{F}_{t_{k}}}(\Omega;\mathbb{R}^{m})$ (see Remark 5.2.5 in \cite{Zh17}). Similarly, it holds that \begin{align*} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \int_{t_{\ell}}^{t_{\ell+1}} \big| Z(t,s) - \overline{Z}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \leq \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \int_{t_{\ell}}^{t_{\ell+1}} \big| Z(t,s) - \zeta \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \end{align*} for any $\zeta \in L^{2}_{\mathcal{F}_{t_{\ell}}}(\Omega;\mathbb{R}^{m \times d})$. Therefore, we have \begin{align*} & \mathcal{E}(Y;\pi) + \mathcal{E}(Z;\pi) \\&\leq \sum_{k=0}^{N-1} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big| Y(t) - \mathscr{Y}^{\pi}(t_{k},t_{k}) \big|^{2} \,\mathrm{d} t \Big] + \sum_{k=0}^{N-1} \sum_{\ell=0}^{N-1} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \int_{t_{\ell}}^{t_{\ell+1}} \big| Z(t,s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \\&\leq 2\Big\{ \mathbb{E} \Big[ \int_{0}^{T} \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t + \int_{0}^{T} \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \\&\quad\quad\quad + \sum_{k=0}^{N-1} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Y}^{\pi}(t_{k},t) - \mathscr{Y}^{\pi}(t_{k},t_{k}) \big|^{2} \,\mathrm{d} t \Big] + \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \Big\}. \end{align*} Noting that \begin{align*} \sup_{t \in [t_{k}, t_{k+1}]} \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t) - \mathscr{Y}^{\pi}(t_{k},t_{k}) \big|^{2} \Big] = \sup_{t \in [t_{k}, t_{k+1}]} \mathbb{E} \Big[ \Big| \int_{t_{k}}^{t} \mathscr{Z}^{\pi}(t_{k},s) \,\mathrm{d} W(s) \Big|^{2} \Big] = \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big], \end{align*} by Proposition \ref{Prop_BSDE_0}, we get the assertion. \end{proof} \begin{rem} The terms \begin{align*} \sum_{k=0}^{N-1}\Delta t_{k} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big|\mathscr{Z}^{\pi}(t_{k},s)\big|^{2} \,\mathrm{d} s \Big] ~\text{and}~ \sum_{k=0}^{N-1}\Delta t_{k} \sum_{\ell=0}^{N-1} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big|\mathscr{Z}^{\pi}(t_{k},s)-\overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell})\big|^{2} \,\mathrm{d} s \Big] \end{align*} measure the $L^{2}$-time regularity of the martingale integrand $\mathscr{Z}^{\pi}$ of BSDE system \ref{BSDE_sys_0} with $\theta =0$. Proposition \ref{Prop_BSDE_0} and Corollary \ref{Cor_0} show that, for the general Type-\Rnum{2} BSVIE \eqref{BSVIE_II_1} with the stochastic coefficients $(\Psi,G)$, the corresponding error terms can be estimated in terms of the $L^{2}$-time regularity of $\mathscr{Z}^{\pi}$. In Section \ref{sec_L2_reg}, we investigate the $L^{2}$-time regularity of $\mathscr{Z}^{\pi}$ in the case of Type-\Rnum{2} BSVIE \eqref{Type-2 Markov} with $X(\cdot)$ begin the solution of SDE \eqref{SDE}. \end{rem} \section{Numerical approximations for general Type-\Rnum{2} BSVIEs}\label{sec_Disc_TypeII} In this section, we construct a backward Euler--Maruyama scheme for the adapted M-solution of the general Type-\Rnum{2} BSVIE \eqref{BSVIE_II_1}, and estimate its $L^{2}$-error in terms of the $L^{2}$-time regularity of $\mathscr{Z}^{\pi}$. We impose the following assumption on $(\Psi,G)$, which is slightly stronger than the one in the previous section. \begin{itemize} \item[$(\mathrm{H}_{\Psi,G})'$] We suppose that $(\Psi,G)$ satisfies the conditions (i), (ii), (iii) and (iv) in $(\mathrm{H}_{\Psi,G})$ with the constants $L$ and $M$. Furthermore, we assume that, for any $(t,s), (t',s') \in \Delta [0,T]$ and $(Y,Z_{1},Z_{2}) \in L^{2}_{\mathcal{F}}(\Omega;\mathbb{R}^{m}) \times (L^{2}_{\mathcal{F}}(\Omega;\mathbb{R}^{m \times d}))^{2}$, \begin{align*} & \mathbb{E} \Big[ \big| \Psi(t) - \Psi(t') \big|^{2} + \big| G ( t, s, Y, Z_{1}, Z_{2} ) - G ( t' ,s', Y, Z_{1}, Z_{2} ) \big|^{2} \Big]^{1/2} \\& \leq L \Big\{ |t-t'|^{1/2} + |s-s'|^{1/2} \Big\} \Big\{ M + \mathbb{E}\big[ \big|Y\big|^{2} \big]^{1/2} + \mathbb{E}\big[ \big|Z_{1}\big|^{2} \big]^{1/2} + \mathbb{E}\big[ \big|Z_{2}\big|^{2} \big]^{1/2} \Big\}. \end{align*} In addition, suppose that, for each $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, we are given $(\Psi^{\pi},G^{\pi})$ such that \begin{itemize} \item $\Psi^{\pi}(t_{k}) : \Omega \to \mathbb{R}^{m}$ is $\mathcal{F}_{T}$-measurable for each $k=0,\ldots, N-1$; \item $G^{\pi}(t_{k},t_{\ell},\cdot,\cdot,\cdot): \Omega \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}\to \mathbb{R}^{m}$ is $\mathcal{F}_{t_{\ell}} \otimes \mathcal{B}(\mathbb{R}^{m}) \otimes \mathcal{B}(\mathbb{R}^{m \times d}) \otimes \mathcal{B}(\mathbb{R}^{m \times d})$-measurable for each $k=0,\ldots,N-1$ and $\ell=k,\ldots,N-1$; \item For each $k=0,\ldots,N-1$, $\ell=k,\ldots,N-1$ and $(y,z_{1},z_{2}), (y',z_{1}',z_{2}') \in \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}$, \begin{align*} |G^{\pi}(t_{k},t_{\ell},y,z_{1},z_{2})-G^{\pi}(t_{k},t_{\ell},y',z_{1}',z_{2}')| \leq L \big\{ |y-y'| + |z_{1}-z_{1}'| + |z_{2}-z_{2}'| \big\}; \end{align*} \item For each $k=0,\ldots,N-1$ and $\ell=k,\ldots,N-1$, \begin{align*} \mathbb{E}\Big[ \big| \Psi^{\pi}(t_{k}) \big|^{2} + \big| G^{\pi} ( t_{k}, t_{\ell}, 0, 0, 0 ) \big|^{2} \Big] <\infty; \end{align*} \item For each $k=0,\ldots,N-1$, $\ell=k,\ldots,N-1$ and $(Y,Z_{1},Z_{2}) \in L^{2}_{\mathcal{F}}(\Omega;\mathbb{R}^{m}) \times (L^{2}_{\mathcal{F}}(\Omega;\mathbb{R}^{m \times d}))^{2}$, \begin{align*} &\mathbb{E} \Big[ \big| \Psi(t_{k}) - \Psi^{\pi}(t_{k}) \big|^{2} + \big| G ( t_{k}, t_{\ell}, Y, Z_{1}, Z_{2} ) - G^{\pi} ( t_{k}, t_{\ell}, Y, Z_{1}, Z_{2} ) \big|^{2} \Big]^{1/2} \\&\leq L |\pi|^{1/2} \Big\{ M + \mathbb{E}\big[ \big|Y\big|^{2} \big]^{1/2} + \mathbb{E}\big[ \big|Z_{1}\big|^{2} \big]^{1/2} + \mathbb{E}\big[ \big|Z_{2}\big|^{2} \big]^{1/2} \Big\}. \end{align*} \end{itemize} \end{itemize} \begin{rem}\label{Rem_EM_0} Compared to $(\mathrm{H}_{\Psi,G})$, the above assumption imposes the continuity with respect to the time parameter $s$ on $G$. Under $(\mathrm{H}_{\Psi,G})'$, Proposition \ref{Prop_BSDE_0} and Corollary \ref{Cor_0} hold for $\rho_{\Psi,G}(|\pi|)$ replaced by $L|\pi|^{1/2}$. In Section \ref{sec_L2_reg}, we will choose \begin{align*} \Psi^{\pi}(t_{k}) = \psi(t_{k},X^{\pi}(t_{k}),X^{\pi}(t_{N})) ~\text{and}~ G^{\pi}(t_{k},t_{\ell},y,z_{1},z_{2}) = g(t_{k},t_{\ell},X^{\pi}(t_{k}),X^{\pi}(t_{\ell}), y, z_{1}, z_{2}) \end{align*} with suitable deterministic functions $\psi$ and $g$, where $\{X^{\pi}(t_{k})\}_{k=0}^{N}$ is the Euler--Maruyama scheme for an SDE. \end{rem} Now we define an approximation scheme for Type-\Rnum{2} BSVIE \eqref{BSVIE_II_1} based on a backward Euler--Maruyama scheme. For each $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, define $\{(Y^{\pi}(t_{k},t_{\ell}),Z^{\pi}(t_{k},t_{\ell}))\}_{k,\ell=0}^{N-1}$ by \begin{align}\label{EM_0} \begin{cases} Y^{\pi}(t_{k},t_{\ell}) \displaystyle = \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k},t_{\ell+1}) \Big] \\\displaystyle \quad\quad\quad\quad\quad\quad + \Delta t_{\ell} G^{\pi} ( t_{k}, t_{\ell}, Y^{\pi}(t_{\ell},t_{\ell}), Z^{\pi}(t_{k},t_{\ell}), Z^{\pi}(t_{\ell},t_{k}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}}, ~k,\ell=0,\ldots,N-1, \\ Z^{\pi}(t_{k},t_{\ell}) \displaystyle = \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k},t_{\ell+1}) \Delta W_{\ell}^{\top} \Big], ~k,\ell=0,\ldots,N-1, \end{cases} \end{align} with $Y^{\pi}(t_{k},t_{N}):=\Psi^{\pi}(t_{k})$, $k=0,\ldots,N-1$. The above system is an explicit scheme. More precisely, $\{(Y^{\pi}(t_{k},t_{\ell}),Z^{\pi}(t_{k},t_{\ell}))\}_{k,\ell=0}^{N-1}$ can be constructed backward inductively as follows. For $k=N-1$, $ (Y^{\pi}(t_{N-1},t_{\ell}),Z^{\pi}(t_{N-1},t_{\ell})) \in L^{2}_{\mathcal{F}_{t_{\ell}}}(\Omega;\mathbb{R}^{m}) \times L^{2}_{\mathcal{F}_{t_{\ell}}}(\Omega;\mathbb{R}^{m \times d}) $, $\ell=0,\ldots,N-1$, are defined by the backward induction with respect to $\ell$; \begin{align*} \begin{cases} Y^{\pi}(t_{N-1},t_{\ell}) = \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{N-1},t_{\ell+1}) \Big], \\ Z^{\pi}(t_{N-1},t_{\ell}) = \displaystyle \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{N-1},t_{\ell+1}) \Delta W_{\ell}^{\top} \Big], \end{cases} \end{align*} for $\ell=0,\ldots,N-1$, with the terminal condition $Y^{\pi}(t_{N-1},t_{N})=\Psi^{\pi}(t_{N-1})$. Next, fix $k' \in \{0,\ldots,N-2\}$ and assume that we have already constructed \begin{align*} (Y^{\pi}(t_{k},t_{\ell}),Z^{\pi}(t_{k},t_{\ell})) \in L^{2}_{\mathcal{F}_{t_{\ell}}}(\Omega;\mathbb{R}^{m}) \times L^{2}_{\mathcal{F}_{t_{\ell}}}(\Omega;\mathbb{R}^{m \times d}), ~\ell=0,\ldots,N-1, \end{align*} for $k=k'+1,\ldots,N-1$. Specifically, we are given $Y^{\pi}(t_{\ell},t_{\ell})$ and $Z^{\pi}(t_{\ell},t_{k'})$ for $\ell=k'+1,\ldots,N-1$. Then $(Y^{\pi}(t_{k'},t_{\ell}),Z^{\pi}(t_{k'},t_{\ell})) \in L^{2}_{\mathcal{F}_{t_{\ell}}}(\Omega;\mathbb{R}^{m}) \times L^{2}_{\mathcal{F}_{t_{\ell}}}(\Omega;\mathbb{R}^{m \times d})$, $\ell=0,\ldots,N-1$, are defined by the backward induction with respect to $\ell$; \begin{align*} \begin{cases} Y^{\pi}(t_{k'},t_{\ell}) \displaystyle = \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k'},t_{\ell+1}) \Big] + \Delta t_{\ell} G^{\pi} ( t_{k'}, t_{\ell}, Y^{\pi}(t_{\ell},t_{\ell}), Z^{\pi}(t_{k'},t_{\ell}), Z^{\pi}(t_{\ell},t_{k'}) ), \\ Z^{\pi}(t_{k'},t_{\ell}) \displaystyle = \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k'},t_{\ell+1}) \Delta W_{\ell}^{\top} \Big], \end{cases} \end{align*} for $\ell=k'+1,\ldots,N-1$, and \begin{align*} \begin{cases} Y^{\pi}(t_{k'},t_{\ell}) \displaystyle = \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k'},t_{\ell+1}) \Big], \\Z^{\pi}(t_{k'},t_{\ell}) \displaystyle = \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k'},t_{\ell+1}) \Delta W_{\ell}^{\top} \Big], \end{cases} \end{align*} for $\ell=0,\ldots,k'$, with the terminal condition $Y^{\pi}(t_{k'},t_{N})=\Psi^{\pi}(t_{k'})$. By the backward induction for $k$, we can construct the backward Euler--Maruyama scheme $\{(Y^{\pi}(t_{k},t_{\ell}),Z^{\pi}(t_{k},t_{\ell}))\}_{k,\ell=0}^{N-1}$. \begin{rem} Even in the case of Type-\Rnum{1} BSVIEs (where $G$ and $G^{\pi}$ do not depend on $z_{2}$), the construction of the backward Euler--Maruyama scheme \eqref{EM_0} is slightly different from that of Wang \cite{WaY18}. He considered a scheme for Type-\Rnum{1} BSVIEs of the following form: \begin{align}\label{EM_Wang} \begin{cases} \displaystyle Y^{\pi}(t_{k},t_{\ell}) = \mathbb{E}_{t_{\ell}}\Big[ Y^{\pi}(t_{k},t_{\ell+1}) + \Delta t_{\ell} G^{\pi}(t_{k},t_{\ell},Y^{\pi}(t_{\ell},t_{\ell+1}),Z^{\pi}(t_{k},t_{\ell})) \Big], \\ \displaystyle Z^{\pi}(t_{k},t_{\ell}) = \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ \big\{ Y^{\pi}(t_{k},t_{\ell+1}) + \Delta t_{\ell} G^{\pi}(t_{k},t_{\ell},Y^{\pi}(t_{\ell},t_{\ell+1}),Z^{\pi}(t_{k},t_{\ell})) \big\} \Delta W_{\ell}^{\top} \Big], \end{cases} 0\leq k\leq \ell \leq N-1, \end{align} with $Y^{\pi}(t_{k},t_{N})=\Psi^{\pi}(t_{k})$, $k=0,\ldots,N-1$. Compared with this scheme, in our definition of the backward Euler--Maruyama scheme \eqref{EM_0}, $Y^{\pi}(t_{\ell},t_{\ell+1})$ in $G^{\pi}$ is replaced by $Y^{\pi}(t_{\ell},t_{\ell})$, and $G^{\pi}$ vanishes on the ``diagonal region'' $k=\ell$. Furthermore, his construction of $Z^{\pi}(t_{k},t_{\ell})$ is indeed an implicit form, and thus, in order to calculate \eqref{EM_Wang}, we have to solve the implicit equations for $Z^{\pi}(t_{k},t_{\ell})$. On the other hand, our construction is an explicit scheme. For the convergence of the scheme \eqref{EM_Wang}, as mentioned in \cite{WaY18}, a kind of uniformity condition for the partition $\pi \in \Pi[0,T]$ is needed. However, it turns out that our scheme \eqref{EM_0} converges without any structural conditions for $\pi$. For this reason, we guess that our construction of the backward Euler--Maruyama scheme \eqref{EM_0} is more natural than that of \cite{WaY18}. \end{rem} Consider the scheme \eqref{EM_0}. By using the martingale representation theorem, for each $k=0,\ldots,N-1$, we define a stochastic process $\widehat{Z}^{\pi}(t_{k},\cdot) \in L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{m \times d})$ by \begin{align*} Y^{\pi}(t_{k},t_{\ell+1}) = \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k},t_{\ell+1}) \Big] + \int_{t_{\ell}}^{t_{\ell+1}} \widehat{Z}^{\pi}(t_{k},s) \,\mathrm{d} W(s), ~\ell=0,\ldots,N-1. \end{align*} Then we have \begin{align*} Z^{\pi}(t_{k},t_{\ell}) = \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \widehat{Z}^{\pi}(t_{k},s) \,\mathrm{d} s \Big], ~k,\ell=0,\ldots,N-1, \end{align*} and \begin{align* Y^{\pi}(t_{k},t_{k}) = \mathbb{E} \Big[ Y^{\pi}(t_{k},t_{k}) \Big] + \int_{0}^{t_{k}} \widehat{Z}^{\pi}(t_{k},s) \,\mathrm{d} W(s), ~k=0,\ldots,N-1. \end{align*} Now we provide an estimate of the term \begin{align*} \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{k}) - Y^{\pi}(t_{k},t_{k}) \big|^{2} \Big] + \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \Delta t_{\ell} \mathbb{E} \Big[ \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big]. \end{align*} For this purpose, let us introduce the following notations: \begin{align*} y_{k,\ell} &:= \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{\ell}) - Y^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big],~ z_{k,\ell} := \Delta t_{\ell} \mathbb{E} \Big[ \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big], \\ I_{k,\ell} &:= \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big\{ \big| \mathscr{Y}^{\pi}(t_{\ell},s) \big|^{2} + \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} + \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) \big|^{2} \big\} \,\mathrm{d} s \Big], \\ \varepsilon_{k,\ell} &:= \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big\{ \big| \mathscr{Y}^{\pi}(t_{\ell},s) \mathalpha{-} \mathscr{Y}^{\pi}(t_{\ell},t_{\ell}) \big|^{2} + \big| \mathscr{Z}^{\pi}(t_{k},s) \mathalpha{-} \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} + \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) \mathalpha{-} \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) \big|^{2} \big\} \,\mathrm{d} s \Big], \end{align*} for $k,\ell = 0,\ldots,N-1$, and \begin{align*} \Delta G_{k,\ell}(s) &:= G ( t_{k}, s, \mathscr{Y}^{\pi}(t_{\ell},s), \mathscr{Z}^{\pi}(t_{k},s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) - G^{\pi} ( t_{k}, t_{\ell}, Y^{\pi}(t_{\ell},t_{\ell}), Z^{\pi}(t_{k},t_{\ell}), Z^{\pi}(t_{\ell},t_{k}) ), \end{align*} for $s \in [t_{\ell},t_{\ell+1})$, $\ell=k+1,\ldots,N-1$ and $k=0,\ldots,N-2$. \begin{lemm}\label{Lem_EM_0} Suppose that $(\mathrm{H}_{\Psi,G})'$ holds and let $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ be fixed. \begin{itemize} \item[(i)] It holds that \begin{align}\label{Lem_EM_0_0} \sum_{\ell=0}^{k-1} z_{k,\ell} \leq y_{k,k}, ~k=1,\ldots,N-1. \end{align} \item[(ii)] There exists a constant $\delta>0$ depending only on $L$ such that, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ with $|\pi| \leq \delta$, \begin{align}\label{Lem_EM_0_1} \begin{split} y_{k,\ell} + \frac{1}{2} z_{k,\ell} &\leq (1+C \Delta t_{\ell}) y_{k,\ell+1} + \frac{1}{2} \Big\{ \Delta t_{\ell} y_{\ell,\ell} + \frac{\Delta t_{\ell}}{\Delta t_{k}} z_{\ell,k} + |\pi| \Big( \Delta t_{\ell} M^{2} + I_{k,\ell} \Big) + \varepsilon_{k,\ell} \Big\}, \\&\quad\quad \ell=k+1,\ldots,N-1,~k=0,\ldots,N-2. \end{split} \end{align} \end{itemize} \end{lemm} \begin{proof} \emph{Proof of (i).} For each $k=1,\ldots,N-1$, we have \begin{align*} \sum_{\ell=0}^{k-1} z_{k,\ell} &= \sum_{\ell=0}^{k-1} \Delta t_{\ell} \mathbb{E} \Big[ \Big| \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big\{ \mathscr{Z}^{\pi}(t_{k},s) - \widehat{Z}^{\pi}(t_{k},s) \big\} \,\mathrm{d} s \Big] \Big|^{2} \Big] \\&\leq \mathbb{E}\Big[ \int_{0}^{t_{k}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \widehat{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \\&= \mathbb{E} \Big[ \Big| \int_{0}^{t_{k}} \big\{ \mathscr{Z}^{\pi}(t_{k},s) - \widehat{Z}^{\pi}(t_{k},s) \big\} \,\mathrm{d} W(s) \Big|^{2} \Big] \\&= \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{k}) - Y^{\pi}(t_{k},t_{k}) - \mathbb{E} \big[ \mathscr{Y}^{\pi}(t_{k},t_{k}) - Y^{\pi}(t_{k},t_{k}) \big] \big|^{2} \Big] \\&\leq \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{k}) - Y^{\pi}(t_{k},t_{k}) \big|^{2} \Big] = y_{k,k}. \end{align*} This proves \eqref{Lem_EM_0_0}. \emph{Proof of (ii).} Let $\gamma>0$ be an arbitrary constant. By using Young's inequality, for each $k=0,\ldots,N-2$ and $\ell=k+1,\ldots,N-1$, we have \begin{align* &y_{k,\ell} + z_{k,\ell} \\& \leq \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{\ell}) - Y^{\pi}(t_{k},t_{\ell}) \big|^{2} + \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \widehat{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \\&= \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{\ell}) - Y^{\pi}(t_{k},t_{\ell}) + \int_{t_{\ell}}^{t_{\ell+1}} \big\{ \mathscr{Z}^{\pi}(t_{k},s) - \widehat{Z}^{\pi}(t_{k},s) \big\} \,\mathrm{d} W(s) \Big|^{2} \Big] \\&= \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{\ell+1}) - Y^{\pi}(t_{k},t_{\ell+1}) + \int_{t_{\ell}}^{t_{\ell+1}} \Delta G_{k,\ell}(s) \,\mathrm{d} s \big|^{2} \Big] \\&\leq (1+\gamma \Delta t_{\ell}) y_{k,\ell+1} + \Big( 1 + \frac{1}{\gamma \Delta t_{\ell}} \Big) \mathbb{E} \Big[ \Big| \int_{t_{\ell}}^{t_{\ell+1}} \Delta G_{k,\ell}(s) \,\mathrm{d} s \Big|^{2} \Big] \\&\leq (1+\gamma \Delta t_{\ell}) y_{k,\ell+1} + \Big( |\pi| + \frac{1}{\gamma} \Big) \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \Delta G_{k,\ell}(s) \big|^{2} \,\mathrm{d} s \Big] \\&\leq (1+\gamma \Delta t_{\ell}) y_{k,\ell+1} \\*&\quad+ 2\Big( |\pi| + \frac{1}{\gamma} \Big) \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| G ( t_{k}, s, \mathscr{Y}^{\pi}(t_{\ell},s), \mathscr{Z}^{\pi}(t_{k},s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) \\*&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad - G^{\pi} ( t_{k}, t_{\ell}, \mathscr{Y}^{\pi}(t_{\ell},s), \mathscr{Z}^{\pi}(t_{k},s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) \big|^{2} \,\mathrm{d} s \Big] \\&\quad+ 2\Big( |\pi| + \frac{1}{\gamma} \Big) \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| G^{\pi} ( t_{k}, t_{\ell}, \mathscr{Y}^{\pi}(t_{\ell},s), \mathscr{Z}^{\pi}(t_{k},s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad - G^{\pi} ( t_{k}, t_{\ell}, Y^{\pi}(t_{\ell},t_{\ell}), Z^{\pi}(t_{k},t_{\ell}), Z^{\pi}(t_{\ell},t_{k}) ) \big|^{2} \,\mathrm{d} s \Big] \\&\leq (1+\gamma \Delta t_{\ell}) y_{k,\ell+1} + C \Big( |\pi| + \frac{1}{\gamma} \Big) |\pi| \Big( \Delta t_{\ell}M^{2} + I_{k,\ell} \Big) \\&\quad + C \Big( |\pi| + \frac{1}{\gamma} \Big) \int_{t_{\ell}}^{t_{\ell+1}} \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{\ell},s) - \mathscr{Y}^{\pi}(t_{\ell},t_{\ell}) \big|^{2} + \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad + \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) - \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) \big|^{2} + \big| \mathscr{Y}^{\pi}(t_{\ell},t_{\ell}) - Y^{\pi}(t_{\ell},t_{\ell}) \big|^{2} \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad + \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} + \big| \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) - Z^{\pi}(t_{\ell},t_{k}) \big|^{2} \Big] \,\mathrm{d} s \\&\leq (1+\gamma \Delta t_{\ell}) y_{k,\ell+1} + C \Big( |\pi| + \frac{1}{\gamma} \Big) \Big\{ |\pi| \Big( \Delta t_{\ell}M^{2} + I_{k,\ell} \Big) + \varepsilon_{k,\ell} + \Delta t_{\ell} y_{\ell,\ell} + z_{k,\ell} + \frac{\Delta t_{\ell}}{\Delta t_{k}} z_{\ell,k} \Big\}. \end{align*} In the last line of the above inequalities, the constant $C>0$ depends only on $L$. By letting $\gamma=4C$ and $\delta=\frac{1}{4C}$, for $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ with $|\pi| \leq \delta$, we have $C(|\pi|+\frac{1}{\gamma}) \leq \frac{1}{2}$, and thus \eqref{Lem_EM_0_1} holds. \end{proof} In the following, $\delta>0$ denotes the constant appearing in Lemma \ref{Lem_EM_0}. \begin{lemm}\label{Prop_EM_0} Under $(\mathrm{H}_{\Psi,G})'$, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ with $|\pi| \leq \delta$, it holds that \begin{align*} & \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{k}) - Y^{\pi}(t_{k},t_{k}) \big|^{2} \Big] + \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \Delta t_{\ell} \mathbb{E} \Big[ \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big] \\&\leq C \Big\{ M^{2}|\pi| + \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] + \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \Big\}. \end{align*} \end{lemm} \begin{proof} First, we show that, for each $k=0,\ldots,N-1$, \begin{align}\label{Lem_EM_0_2} \begin{split} y_{k,k} + \sum_{\ell=0}^{N-1} z_{k,\ell} &\leq C \Big\{ |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} + \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big] \\&\quad\quad\quad + \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} y_{\ell,\ell} + \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) - Z^{\pi}(t_{\ell},t_{k}) \big| \Big)^{2} \Big] \Big\}. \end{split} \end{align} Indeed, we have \begin{align*} &y_{k,k} + \sum_{\ell=k}^{N-1} z_{k,\ell} \\& \leq \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{k}) - Y^{\pi}(t_{k},t_{k}) \big|^{2} + \int_{t_{k}}^{t_{N}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \widehat{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \\&= \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{k}) - Y^{\pi}(t_{k},t_{k}) + \int_{t_{k}}^{t_{N}} \big\{ \mathscr{Z}^{\pi}(t_{k},s) - \widehat{Z}^{\pi}(t_{k},s) \big\} \,\mathrm{d} W(s) \big|^{2} \Big] \\&= \mathbb{E} \Big[ \Big| \Psi(t_{k}) - \Psi^{\pi}(t_{k}) + \sum_{\ell=k+1}^{N-1} \int_{t_{\ell}}^{t_{\ell+1}} \Delta G_{k,\ell}(s) \,\mathrm{d} s \Big|^{2} \Big] \\& \leq C\mathbb{E}\Big[ \big|\Psi(t_{k})-\Psi^{\pi}(t_{k})\big|^{2} \\&\quad\quad\quad + \sum_{\ell=k+1}^{N-1} \int_{t_{\ell}}^{t_{\ell+1}} \big| G ( t_{k}, s, \mathscr{Y}^{\pi}(t_{\ell},s), \mathscr{Z}^{\pi}(t_{k},s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) \\*&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad - G^{\pi} ( t_{k}, t_{\ell}, \mathscr{Y}^{\pi}(t_{\ell},s), \mathscr{Z}^{\pi}(t_{k},s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) \big|^{2} \,\mathrm{d} s \Big] \\&\quad + C\mathbb{E}\Big[ \Big( \sum_{\ell=k+1}^{N-1} \int_{t_{\ell}}^{t_{\ell+1}} \big| G^{\pi} ( t_{k}, t_{\ell}, \mathscr{Y}^{\pi}(t_{\ell},s), \mathscr{Z}^{\pi}(t_{k},s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad - G^{\pi} ( t_{k}, t_{\ell}, Y^{\pi}(t_{\ell},t_{\ell}), Z^{\pi}(t_{k},t_{\ell}), Z^{\pi}(t_{\ell},t_{k}) ) \big| \,\mathrm{d} s \Big)^{2} \Big] \\& \leq C |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) \\&\quad + C \mathbb{E}\Big[ \Big( \sum_{\ell=k+1}^{N-1} \int_{t_{\ell}}^{t_{\ell+1}} \big\{ \big| \mathscr{Y}^{\pi}(t_{\ell},s) - \mathscr{Y}^{\pi}(t_{\ell},t_{\ell}) \big| + \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big| \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad + \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) - \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) \big| \big\} \,\mathrm{d} s \Big)^{2} \Big] \\&\quad + C \mathbb{E}\Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big\{ \big| \mathscr{Y}^{\pi}(t_{\ell},t_{\ell}) - Y^{\pi}(t_{\ell},t_{\ell}) \big| + \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| + \big| \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) - Z^{\pi}(t_{\ell},t_{k}) \big| \big\} \Big)^{2} \Big] \\&\leq C \Big\{ |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} + \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} y_{\ell,\ell} + \mathbb{E}\Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big] \\&\quad\quad\quad + \mathbb{E}\Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) - Z^{\pi}(t_{\ell},t_{k}) \big| \Big)^{2} \Big] \Big\}. \end{align*} This estimate, together with \eqref{Lem_EM_0_0}, prove \eqref{Lem_EM_0_2}. From \eqref{Lem_EM_0_2} and \eqref{Lem_EM_0_0}, by using the discrete Gronwall-like inequality (see Lemma \ref{Lem_Gron_disc}) with \begin{align*} a_{k} &= y_{k,k} + \sum_{\ell=0}^{N-1} z_{k,\ell}, ~ b_{k} = |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} + \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big], \\ c_{k} &=0,~ \zeta_{k,\ell}(\omega) := \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| ~\text{and}~ (S,\Sigma,\mu) = (\Omega,\mathcal{F},\mathbb{P}), \end{align*} we have, for any sufficiently large $\gamma>0$ depending only on $L$ and $T$, \begin{align*} &\sum_{k=0}^{N-1} \Gamma_{k} \Big\{ y_{k,k} + \sum_{\ell=0}^{N-1} z_{k,\ell} \Big\} \\&\leq C \sum_{k=0}^{N-1} \Gamma_{k} \Big\{ |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} + \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big] \Big\}, \end{align*} and hence \begin{align}\label{Prop_EM_0_1} \begin{split} \sum_{k=0}^{N-1} \Gamma_{k} \Big\{ y_{k,k} + \sum_{\ell=0}^{N-1} z_{k,\ell} \Big\} &\leq C_{\gamma} \Big\{ |\pi| \Big( M^{2} + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\} \\&\quad + C \sum_{k=0}^{N-2} \Gamma_{k} \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big], \end{split} \end{align} where $\Gamma_{k}:=\int_{t_{k}}^{t_{k+1}} e^{\gamma t} \,\mathrm{d} t$, $k=0,\ldots,N-1$. Let $\gamma>0$ be fixed. We show that the last term in the right-hand side of \eqref{Prop_EM_0_1} is estimated as follows: \begin{align}\label{Lem_EM_1_1} \begin{split} & \sum_{k=0}^{N-2} \Gamma_{k} \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big] \\&\leq \frac{C}{\gamma} \sum_{k=0}^{N-1} \Gamma_{k} y_{k,k} + C_{\gamma} \Big\{ |\pi| \Big( M^{2} + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\}. \end{split} \end{align} Note that $\Delta t_{k} e^{\gamma t_{k}} \leq \Gamma_{k} \leq \Delta t_{k} e^{\gamma t_{k+1}}$ for $k=0,\ldots,N-1$. Also, by defining $\Gamma_{N}:=\Gamma_{N-1}$ and $\Delta t_{N}:=\Delta t_{N-1}$, we have $\frac{\Gamma_{k}}{\Delta t_{k}} \leq \frac{\Gamma_{k+1}}{\Delta t_{k+1}}$ for $k=0,\ldots,N-1$. We observe that \begin{align*} &\sum_{k=0}^{N-2} \Gamma_{k} \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big] \notag\\& = \sum_{k=0}^{N-2} \Gamma_{k} \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Big( \int_{t_{\ell}}^{t_{\ell+1}} e^{-\frac{\gamma}{2}t} e^{\frac{\gamma}{2}t} \,\mathrm{d} t \Big) \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big] \notag\\& \leq \sum_{k=0}^{N-2} \Gamma_{k} \Big( \int_{t_{k+1}}^{t_{N}} e^{-\gamma t} \,\mathrm{d} t \Big) \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} \mathbb{E} \Big[ \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big] \notag\\& \leq \frac{1}{\gamma} \sum_{k=0}^{N-2} \Gamma_{k} e^{-\gamma t_{k+1}} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} \mathbb{E} \Big[ \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big] \notag\\&\leq \frac{1}{\gamma} \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} \mathbb{E} \Big[ \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big], \end{align*} and hence \begin{align}\label{Lem_EM_1_2} \begin{split} \sum_{k=0}^{N-2} \Gamma_{k} \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big] \leq \frac{1}{\gamma} \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} z_{k,\ell}. \end{split} \end{align} Let $k=0,\ldots,N-2$ be fixed. We estimate $\sum_{\ell=k+1}^{N-1}\frac{\Gamma_{\ell}}{\Delta t_{\ell}}z_{k,\ell}$. By \eqref{Lem_EM_0_1}, we have, for each $\ell=k+1,\ldots,N-1$, \begin{align} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell} + \frac{1}{2} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} z_{k,\ell} &\leq (1+C \Delta t_{\ell}) \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell+1} + \frac{1}{2} \Big\{ \Gamma_{\ell} y_{\ell,\ell} + \frac{\Gamma_{\ell}}{\Delta t_{k}} z_{\ell,k} + |\pi| \Big( \Gamma_{\ell} M^{2} + \frac{\Gamma_{\ell}}{\Delta t_{\ell}} I_{k,\ell} \Big) + \frac{\Gamma_{\ell}}{\Delta t_{\ell}} \varepsilon_{k,\ell} \Big\} \notag\\& \leq (1+C \Delta t_{\ell}) \frac{\Gamma_{\ell+1}}{\Delta t_{\ell+1}} y_{k,\ell+1} + \frac{1}{2} \Big\{ \Gamma_{\ell} y_{\ell,\ell} + \frac{\Gamma_{\ell}}{\Delta t_{k}} z_{\ell,k} + |\pi| \Big( \Gamma_{\ell} M^{2} + \frac{\Gamma_{\ell}}{\Delta t_{\ell}} I_{k,\ell} \Big) + \frac{\Gamma_{\ell}}{\Delta t_{\ell}} \varepsilon_{k,\ell} \Big\}. \label{Lem_EM_1_3} \end{align} Hence we have \begin{align*} & \sum_{\ell=k+1}^{N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell} + \frac{1}{2} \sum_{\ell=k+1}^{N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} z_{k,\ell} \notag\\& \leq (1+C \Delta t_{N-1}) \frac{\Gamma_{N}}{\Delta t_{N}} y_{k,N} + \sum_{\ell=k+2}^{N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell} + C \sum_{\ell=k+2}^{N-1} \Delta t_{\ell-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell} \notag\\&\quad+ \frac{1}{2} \Big\{ \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} y_{\ell,\ell} + \frac{1}{\Delta t_{k}} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} z_{\ell,k} + \sum_{\ell=k+1}^{N-1} |\pi| \Big( \Gamma_{\ell} M^{2} + \frac{\Gamma_{\ell}}{\Delta t_{\ell}} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} \varepsilon_{k,\ell} \Big\} \\& \leq \sum_{\ell=k+1}^{N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell} + C \max_{\ell=k+1,\ldots, N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell} + C_{\gamma} \Big\{ |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\} \\&\quad + \frac{1}{2} \Big\{ \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} y_{\ell,\ell} + \frac{1}{\Delta t_{k}} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} z_{\ell,k} \Big\}. \end{align*} This implies that \begin{align* \begin{split} \sum_{\ell=k+1}^{N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} z_{k,\ell} &\leq C \max_{\ell=k+1,\ldots, N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell} + C_{\gamma} \Big\{ |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\} \\&\quad + \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} y_{\ell,\ell} + \frac{1}{\Delta t_{k}} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} z_{\ell,k}. \end{split} \end{align*} Furthermore, by \eqref{Lem_EM_1_3} and the discrete Gronwall inequality (cf.\ Lemma 5.4 in \cite{Zh04}), we have \begin{align*} &\max_{\ell=k+1,\ldots, N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} y_{k,\ell} \notag\\&\leq C\frac{\Gamma_{N}}{\Delta t_{N}} y_{k,N} + C \sum_{\ell=k+1}^{N-1} \Big\{ \Gamma_{\ell} y_{\ell,\ell} + \frac{\Gamma_{\ell}}{\Delta t_{k}} z_{\ell,k} + |\pi| \Big( \Gamma_{\ell} M^{2} + \frac{\Gamma_{\ell}}{\Delta t_{\ell}} I_{k,\ell} \Big) + \frac{\Gamma_{\ell}}{\Delta t_{\ell}} \varepsilon_{k,\ell} \Big\} \notag\\& \leq C_{\gamma} \Big\{ |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\} + C \Big\{ \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} y_{\ell,\ell} + \frac{1}{\Delta t_{k}} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} z_{\ell,k} \Big\}. \end{align*} Therefore, we get \begin{align} \label{Lem_EM_1_6} \sum_{\ell=k+1}^{N-1} \frac{\Gamma_{\ell}}{\Delta t_{\ell}} z_{k,\ell} \leq C_{\gamma} \Big\{ |\pi| \Big( M^{2} + \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\} + C \Big\{ \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} y_{\ell,\ell} + \frac{1}{\Delta t_{k}} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} z_{\ell,k} \Big\} \end{align} for $k=0,\ldots,N-2$. Thus, by \eqref{Lem_EM_1_2} and \eqref{Lem_EM_1_6}, we have \begin{align*} & \sum_{k=0}^{N-2} \Gamma_{k} \mathbb{E} \Big[ \Big( \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big| \Big)^{2} \Big] \\&\leq C_{\gamma} \Big\{ |\pi| \Big( M^{2} + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\} + \frac{C}{\gamma} \Big\{ \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} y_{\ell,\ell} + \sum_{k=0}^{N-2} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} z_{\ell,k} \Big\}. \end{align*} Noting that \begin{align*} \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} y_{\ell,\ell} \leq T \sum_{k=0}^{N-1} \Gamma_{k} y_{k,k} \end{align*} and \begin{align*} \sum_{k=0}^{N-2} \sum_{\ell=k+1}^{N-1} \Gamma_{\ell} z_{\ell,k} = \sum_{k=1}^{N-1} \Gamma_{k} \sum_{\ell=0}^{k-1} z_{k,\ell} \leq \sum_{k=0}^{N-1} \Gamma_{k} y_{k,k}, \end{align*} we obtain the desired estimate \eqref{Lem_EM_1_1}. By \eqref{Prop_EM_0_1} and \eqref{Lem_EM_1_1}, we have \begin{align*} \sum_{k=0}^{N-1} \Gamma_{k} \Big\{ y_{k,k} + \sum_{\ell=0}^{N-1} z_{k,\ell} \Big\} &\leq C_{\gamma} \Big\{ |\pi| \Big( M^{2} + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\} + \frac{C}{\gamma} \sum_{k=0}^{N-1} \Gamma_{k} y_{k,k}. \end{align*} Therefore, by choosing $\gamma>0$ large enough (depending only on $L$ and $T$), we obtain \begin{align*} &\sum_{k=0}^{N-1} \Delta t_{k} \Big\{ y_{k,k} + \sum_{\ell=0}^{N-1} z_{k,\ell} \Big\} \leq C \Big\{ |\pi| \Big( M^{2} + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} I_{k,\ell} \Big) + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \Big\}. \end{align*} By using the estimate \eqref{Lem_3_1_2}, we have \begin{align*} &\sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} I_{k,\ell} \\&= \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big\{ \big| \mathscr{Y}^{\pi}(t_{\ell},s) \big|^{2} + \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} + \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) \big|^{2} \big\} \,\mathrm{d} s \Big] \\&\leq T \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \Big] + \sum_{k=0}^{N-2} \Delta t_{k} \mathbb{E}\Big[ \int_{t_{k+1}}^{T} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] + \sum_{k=1}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \int_{0}^{t_{k}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \\&\leq C \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \big|\Psi(t_{k})\big|^{2} + \int_{t_{k+1}}^{T} \big|G(t_{k},s,0,0,0)\big|^{2} \,\mathrm{d} s \Big] \leq CM^{2}. \end{align*} Furthermore, noting that \begin{align* \sup_{s \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{\ell},s) - \mathscr{Y}^{\pi}(t_{\ell},t_{\ell}) \big|^{2} \Big] = \sup_{s \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \Big| \int_{t_{\ell}}^{s} \mathscr{Z}^{\pi}(t_{\ell},r) \,\mathrm{d} W(r) \Big|^{2} \Big] = \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{\ell},s) \big|^{2} \,\mathrm{d} s \Big] \end{align*} and \begin{align*} \mathbb{E} \Big[ \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) - \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) \big|^{2} \Big] &= \mathbb{E} \Big[ \Big| \frac{1}{\Delta t_{k}} \int_{t_{k}}^{t_{k+1}} \big\{ \mathscr{Z}^{\pi}(t_{\ell},s) - \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) \big\} \,\mathrm{d} s \Big|^{2} \Big] \\*&\leq \frac{1}{\Delta t_{k}} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{\ell},s) - \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) \big|^{2} \,\mathrm{d} s \Big], \end{align*} it holds that \begin{align*} &\sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \varepsilon_{k,\ell} \\&= \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big\{ \big| \mathscr{Y}^{\pi}(t_{\ell},s) - \mathscr{Y}^{\pi}(t_{\ell},t_{\ell}) \big|^{2} + \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad + \big| \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) - \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) \big|^{2} \big\} \,\mathrm{d} s \Big] \\&\leq C \Big\{ \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] + \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \\&\quad\quad\quad + \sum_{k=0}^{N-2} \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{\ell},s) - \overline{\mathscr{Z}}^{\pi}(t_{\ell},t_{k}) \big|^{2} \,\mathrm{d} s \Big] \Big\} \\&\leq C \Big\{ \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] + \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \Big\}. \end{align*} Therefore, we get the assertion. \end{proof} Combining Proposition \ref{Prop_BSDE_0} and Lemma \ref{Prop_EM_0}, we obtain an estimate for the $L^{2}$-error between the backward Euler--Maruyama scheme $\{(Y^{\pi}(t_{k},t_{\ell}),Z^{\pi}(t_{k},t_{\ell}))\}_{k,\ell=0}^{N-1}$ and the adapted M-solution $(Y(\cdot),Z(\cdot,\cdot))$ of BSVIE \eqref{BSVIE_II_1} in terms of the $L^{2}$-time regularity of $\mathscr{Z}^{\pi}$. \begin{prop}\label{Prop_EM_1} Under $(\mathrm{H}_{\Psi,G})'$, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ with $|\pi| \leq \delta$, it holds that \begin{align*} & \sum_{k=0}^{N-1} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big| Y(t) - Y^{\pi}(t_{k},t_{k}) \big|^{2} \,\mathrm{d} t \Big] + \sum_{k=0}^{N-1} \sum_{\ell=0}^{N-1} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \int_{t_{\ell}}^{t_{\ell+1}} \big| Z(t,s) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \\&\leq C \Big\{ M^{2} |\pi| + \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] + \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \Big\}. \end{align*} \end{prop} \begin{proof} We observe that \begin{align*} & \sum_{k=0}^{N-1} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big| Y(t) - Y^{\pi}(t_{k},t_{k}) \big|^{2} \,\mathrm{d} t \Big] + \sum_{k=0}^{N-1} \sum_{\ell=0}^{N-1} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \int_{t_{\ell}}^{t_{\ell+1}} \big| Z(t,s) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \\&\leq 3\Big\{ \mathbb{E} \Big[ \int_{0}^{T} \big| Y(t) - \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t + \int_{0}^{T} \int_{0}^{T} \big| Z(t,s) - \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \\&\quad\quad\quad + \sum_{k=0}^{N-1} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Y}^{\pi}(t_{k},t) - \mathscr{Y}^{\pi}(t_{k},t_{k}) \big|^{2} \,\mathrm{d} t \Big] + \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \\&\quad\quad\quad + \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t_{k}) - Y^{\pi}(t_{k},t_{k}) \big|^{2} \Big] + \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \Delta t_{\ell} \mathbb{E} \Big[ \big| \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big] \Big\}. \end{align*} Noting that \begin{align*} \sup_{t \in [t_{k}, t_{k+1}]} \mathbb{E} \Big[ \big| \mathscr{Y}^{\pi}(t_{k},t) - \mathscr{Y}^{\pi}(t_{k},t_{k}) \big|^{2} \Big] = \sup_{t \in [t_{k}, t_{k+1}]} \mathbb{E} \Big[ \Big| \int_{t_{k}}^{t} \mathscr{Z}^{\pi}(t_{k},s) \,\mathrm{d} W(s) \Big|^{2} \Big] = \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big], \end{align*} by Proposition \ref{Prop_BSDE_0} (see also Remark \ref{Rem_EM_0}) and Lemma \ref{Prop_EM_0}, we get the assertion. \end{proof} \section{Main results}\label{sec_L2_reg} \subsection{Statements of our main results} In this section, we consider the system of Type-\Rnum{2} BSVIE \eqref{Type-2 Markov} and SDE \eqref{SDE} which we rewrite for readers' convenience: \begin{align}\label{BSVIE_II_0} \begin{split} Y(t) = \psi(t,X(t),X(T)) + \int^{T}_{t} g ( t, s, X(t), X(s), Y(s), Z(t,s), Z(s,t) ) \,\mathrm{d} s - \int^{T}_{t} Z(t,s) \,\mathrm{d} W(s), ~t\in [0,T], \end{split} \end{align} and \begin{align}\label{SDE_0} X(t) &= x + \int_{0}^{t} b(s,X(s)) \,\mathrm{d} s + \int_{0}^{t} \sigma(s,X(s)) \,\mathrm{d} W(s), ~t \in [0,T]. \end{align} We impose the following assumptions on the coefficients $(\psi,g)$ and $(b,\sigma)$. \begin{itemize} \item[$(\mathrm{H}_{\psi,g})$] The maps $\psi:[0,T] \times \mathbb{R}^{n} \times \mathbb{R}^{n} \to \mathbb{R}^{m}$ and $g:\Delta[0,T] \times \mathbb{R}^{n} \times \mathbb{R}^{n} \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d} \to \mathbb{R}^{m}$ are measurable, and there exists a constant $L>0$ such that \begin{align*} \int_{0}^{T} \bigl|\psi(t,0,0)\bigr|^{2} \,\mathrm{d} t + \int_{0}^{T} \int_{t}^{T} \bigl| g(t,s,0,0,0,0,0) \bigr|^{2} \,\mathrm{d} s \,\mathrm{d} t \leq L \end{align*} and \begin{align*} & \big| \psi(t,x_{1},x_{2}) - \psi(t,x_{1}',x_{2}') \big| + \big| g(t,s,x_{1},x_{2},y,z_{1},z_{2}) - g(t,s,x_{1}',x_{2}',y',z_{1}',z_{2}') \big| \\&\leq L \big\{ |x_{1}-x_{1}'| + |x_{2}-x_{2}'| + |y-y'| + |z_{1}-z_{1}'| + |z_{2}-z_{2}'| \big\}, \end{align*} for any $(t,s) \in \Delta [0,T]$ and $(x_{1},x_{2},y,z_{1},z_{2}),(x_{1}',x_{2}',y',z_{1}',z_{2}') \in \mathbb{R}^{n} \times\mathbb{R}^{n} \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}$. Furthermore, there exists a continuous and increasing function $\rho_{\psi,g}:[0,\infty) \to [0,\infty)$ with $\rho_{\psi,g}(0)=0$ such that, for any $0 \leq t,t' \leq s\leq T$ and $(x_{1},x_{2},y,z_{1},z_{2}) \in \mathbb{R}^{n} \times\mathbb{R}^{n} \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}$, \begin{align*} &\big| \psi(t,x_{1},x_{2}) - \psi(t',x_{1},x_{2}) \big| + \big| g(t,s,x_{1},x_{2},y,z_{1},z_{2}) - g(t',s,x_{1},x_{2},y,z_{1},z_{2}) \big| \\&\leq \rho_{\psi,g}(|t-t'|) \big\{ 1 + |x_{1}| + |x_{2}| + |y| + |z_{1}| + |z_{2}| \big\}. \end{align*} \end{itemize} \begin{itemize} \item[$(\mathrm{H}_{b,\sigma})$] The maps $b:[0,T] \times \mathbb{R}^{n} \to \mathbb{R}^{n}$ and $\sigma:[0,T] \times \mathbb{R}^{n} \to \mathbb{R}^{n \times d}$ are measurable, and there exists a constant $L>0$ such that, for any $s \in [0,T]$ and $x,x' \in \mathbb{R}^{n}$, \begin{align*} \big| b(s,0) \big| + \big| \sigma(s,0) \big| &\leq L,~ \big| b(s,x) - b(s,x') \big| + \big| \sigma(s,x) - \sigma(s,x') \big| \leq L|x-x'|. \end{align*} Furthermore, there exists a continuous and increasing function $\rho_{\sigma}:[0,\infty) \to [0,\infty)$ with $\rho_{\sigma}(0)=0$ such that, for any $s,s' \in [0,T]$ and $x \in \mathbb{R}^{n}$, \begin{align*} \big| \sigma(s,x) - \sigma(s',x) \big| &\leq \rho_{\sigma}(|s-s'|) (1+|x|). \end{align*} \end{itemize} We also consider the following assumptions of $(\psi,g)$ and $(b,\sigma)$ which are slightly stronger than the above ones. \begin{itemize} \item[$(\mathrm{H}_{\psi,g})'$] $(\psi,g)$ satisfies $(\mathrm{H}_{\psi,g})$ with the constant $L$. Furthermore, \begin{align*} &\big| \psi(t,x_{1},x_{2}) - \psi(t',x_{1},x_{2}) \big| + \big| g(t,s,x_{1},x_{2},y,z_{1},z_{2}) - g(t',s',x_{1},x_{2},y,z_{1},z_{2}) \big| \\& \leq L \big\{ |t-t'|^{1/2} + |s-s'|^{1/2} \big\} \big\{ 1 + |x_{1}| + |x_{2}| + |y| + |z_{1}| + |z_{2}| \big\} \end{align*} for any $(t,s), (t',s') \in \Delta[0,T]$ and $(x_{1},x_{2},y,z_{1},z_{2}) \in \mathbb{R}^{n} \times\mathbb{R}^{n} \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}$. \end{itemize} \begin{itemize} \item[$(\mathrm{H}_{b,\sigma})'$] $(b,\sigma)$ satisfies $(\mathrm{H}_{b,\sigma})$ with the constant $L$. Furthermore, \begin{align*} \big| b(s,x) - b(s',x) \big| + \big| \sigma(s,x) - \sigma(s',x) \big| \leq L|s-s'|^{1/2} (1+|x|) \end{align*} for any $s,s'\in [0,T]$ and $x \in \mathbb{R}^{n}$. \end{itemize} For a numerical approximation of SDE \eqref{SDE_0}, we consider the Euler--Maruyama scheme $\{X^{\pi}(t_{k})\}_{k=0}^{N}$, which is defined for each $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in\Pi[0,T]$ by \begin{align*} X^{\pi}(t_{k+1}) = X^{\pi}(t_{k}) + b(t_{k},X^{\pi}(t_{k})) \Delta t_{k} + \sigma(t_{k},X^{\pi}(t_{k})) \Delta W_{k},~ k=0,\ldots,N-1, \end{align*} with the initial condition $X^{\pi}(0)=x$. The following lemma is well-known, see for example \cite{KP95,Zh17}. \begin{lemm}\phantomsection\label{Lem_SDE_1} \begin{itemize} \item[(i)] Under $(\mathrm{H}_{b,\sigma})$, there exists a unique strong solution $X(\cdot) \in L^{2}_{\mathbb{F}}(\Omega;C([0,T];\mathbb{R}^{n}))$ of SDE \eqref{SDE_0}. Furthermore, for any $p \geq 2$, it holds that \begin{align} \label{Lem_SDE_1_0} \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| X(s) \big|^{p} \Big] &\leq C_{p} (1+|x|^{p}), \\ \label{Lem_SDE_1_1} \mathbb{E} \Big[ \sup_{s'\in [s,t]} \big| X(s') - X(s) \big|^{p} \Big] &\leq C_{p} (1+|x|^{p}) |t-s|^{p/2},~\text{for any}~0 \leq s \leq t \leq T. \end{align} \item[(ii)] Under $(\mathrm{H}_{b,\sigma})'$, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in\Pi[0,T]$ and $p \geq 2$, it holds that \begin{align* \max_{k=0,\ldots, N} \mathbb{E} \Big[ \big| X(t_{k}) - X^{\pi}(t_{k}) \big|^{p} \Big] \leq C_{p}(1+|x|^{p}) |\pi|^{p/2}. \end{align*} \end{itemize} \end{lemm} \begin{rem} \begin{itemize} \item[(i)] We remark that, in $(\mathrm{H}_{\psi,g})$ and $(\mathrm{H}_{b,\sigma})$, the map $s \mapsto \sigma(s,x)$ is assumed to be continuous, while the maps $s \mapsto g(t,s,x,y,z_{1},z_{2})$ and $s \mapsto b(s,x)$ are not. The continuity condition of $\sigma(s,x)$ with respect to $s$ will be used in the proof of Theorem \ref{Thm_L2_0} below. Alternatively, in $(\mathrm{H}_{\psi,g})'$ and $(\mathrm{H}_{b,\sigma})'$, we impose the $1/2$-H\"older continuity with respect to both $t$ and $s$ on $\psi$, $g$, $b$ and $\sigma$, which is used to estimate the error for the Euler--Maruyama scheme. \item[(ii)] In $(\mathrm{H}_{b,\sigma})'$, the H\"older continuity with respect to the time parameter $s$ of $b$ and $\sigma$ is not uniform in $x$ unlike previous studies. However, for $\varphi=b,\sigma$, noting that \begin{align*} &\mathbb{E}\Big[ \sup_{s'\in [s,t]} \big| \varphi(s',X(s')) - \varphi(s,X(s)) \big|^{p} \Big ] \\&\leq C_{p}\Big\{ |t-s|^{p/2} \mathbb{E}\Big[ 1 + \sup_{s \in [0,T]} \big| X(s) \big|^{p} \Big] + \mathbb{E}\Big[ \sup_{s'\in [s,t]} \big| X(s') - X(s) \big|^{p} \Big] \Big\} \\& \leq C_{p}(1+|x|^{p})|t-s|^{p/2}, \end{align*} we can show Lemma \ref{Lem_SDE_1} (ii) by the same way as in the proof of Theorem 5.3.1 in \cite{Zh17}. \end{itemize} \end{rem} Under $(\mathrm{H}_{\psi,g})$ and $(\mathrm{H}_{b,\sigma})$, the coefficients \begin{align*} & \Psi(t) = \psi(t,X(t),X(T)),~t \in [0,T],\\ & G (t,s,y,z_{1},z_{2}) = g ( t, s, X(t), X(s), y, z_{1}, z_{2} ),~ (t,s,y,z_{1},z_{2}) \in \Delta[0,T] \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}, \end{align*} satisfy $(\mathrm{H}_{\Psi,G})$ with the constant $M$ replaced by $C\sqrt{1+|x|^{2}}$ and $\rho_{\Psi,G}(t)$ replaced by $\sqrt{t}+\rho_{\psi,g}(t)$. In this case, BSDE system \eqref{BSDE_sys_0} with $\theta=0$ becomes \begin{align}\label{BSDE_sys_2} \begin{cases} \mathscr{Y}^{\pi}(t_{k},s) = \displaystyle \mathscr{Y}^{\pi}(t_{k},t_{\ell+1}) + \int_{s}^{t_{\ell+1}} g ( t_{k}, r, X(t_{k}), X(r), \mathscr{Y}^{\pi}(t_{\ell},r), \mathscr{Z}^{\pi}(t_{k},r), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}} \,\mathrm{d} r \\ \displaystyle \quad\quad\quad\quad\quad\quad - \int_{s}^{t_{\ell+1}} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r),~ s \in [t_{\ell},t_{\ell+1}],~k,\ell=0,\ldots, N-1, \\ \mathscr{Y}^{\pi}(t_{k},t_{N}) = \psi(t_{k},X(t_{k}),X(t_{N})),~ k=0,\ldots,N-1. \end{cases} \end{align} Furthermore, under $(\mathrm{H}_{\psi,g})'$ and $(\mathrm{H}_{b,\sigma})'$, by defining \begin{align*} &\Psi^{\pi}(t_{k}) = \psi(t_{k},X^{\pi}(t_{k}),X^{\pi}(t_{N})),~ k=0,\ldots,N-1, \\ &G^{\pi}(t_{k},t_{\ell},y,z_{1},z_{2}) = g(t_{k},t_{\ell},X^{\pi}(t_{k}),X^{\pi}(t_{\ell}), y, z_{1}, z_{2}),\\ & \hspace{2cm} (y,z_{1},z_{2}) \in \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d},~ k=0,\ldots,N-1,~\ell=k,\ldots,N-1, \end{align*} for each $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, we see that $(\mathrm{H}_{\Psi,G})'$ holds with $M$ replaced by $C\sqrt{1+|x|^{2}}$. In this case, the backward Euler--Maruyama scheme \eqref{EM_0} becomes \begin{align}\label{EM_2} \begin{cases} Y^{\pi}(t_{k},t_{\ell}) \displaystyle = \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k},t_{\ell+1}) \Big] \\ \displaystyle \quad\quad\quad\quad\quad\quad + \Delta t_{\ell} g ( t_{k}, t_{\ell}, X^{\pi}(t_{k}), X^{\pi}(t_{\ell}), Y^{\pi}(t_{\ell},t_{\ell}), Z^{\pi}(t_{k},t_{\ell}), Z^{\pi}(t_{\ell},t_{k}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}}, ~k,\ell=0,\ldots,N-1, \\ Z^{\pi}(t_{k},t_{\ell}) \displaystyle = \frac{1}{\Delta t_{\ell}} \mathbb{E}_{t_{\ell}} \Big[ Y^{\pi}(t_{k},t_{\ell+1}) \Delta W_{\ell}^{\top} \Big], ~k,\ell=0,\ldots,N-1, \end{cases} \end{align} with $Y^{\pi}(t_{k},t_{N}):=\psi(t_{k},X^{\pi}(t_{k}),X^{\pi}(t_{N}))$, $k=0,\ldots,N-1$. Now we state our main results. The first main result is in regard to the estimate of the modulus of the $L^{2}$-time regularity of $(Y(\cdot),Z(\cdot,\cdot))$ (see \eqref{Reg_YZ}). \begin{theo}\label{Thm_1} Under $(\mathrm{H}_{\psi,g})$ and $(\mathrm{H}_{b,\sigma})$, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, it holds that \begin{align}\label{Reg_Y_0} \mathcal{E}(Y;\pi) + \mathcal{E}(Z;\pi) &\leq C(1+|x|^{2}) \big\{ |\pi| + \rho_{\psi,g}(|\pi|)^{2} + \rho_{\sigma}(|\pi|)^{2} \big\}. \end{align} \end{theo} \begin{rem} Unlike the case of Type-\Rnum{1} BSVIEs, the time regularity of adapted M-solutions of Type-\Rnum{2} BSVIEs is a difficult problem due to the appearance of the term $Z(s,t)$ in the driver. On one hand, Yong~\cite{Yo08} showed the continuity (in the strong $L^2$-sense) for general Type-\Rnum{2} BSVIE~\eqref{BSVIE_II_1} under technical differentiability assumptions for the coefficients. On the other hand, \eqref{Reg_Y_0} provides a quantitative estimate for the modulus of the $L^2$-time regularity of the adapted M-solution of Type-\Rnum{2} BSVIE \eqref{BSVIE_II_0} with $X(\cdot)$ being the solution of SDE \eqref{SDE_0}, without smoothness of the coefficients. This kind of regularity estimate for adapted M-solutions appears for the first time in the literature of BSVIEs. \end{rem} The second is in regard to the numerical approximation based on the backward Euler--Maruyama scheme. \begin{theo}\label{Thm_2} Under $(\mathrm{H}_{\psi,g})'$ and $(\mathrm{H}_{b,\sigma})'$, there exists a constant $\delta >0$ depending only on $L$ such that, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$ with $|\pi| \leq\delta$, it holds that \begin{align}\label{eq_thm2} \begin{split} & \sum_{k=0}^{N-1} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \big| Y(t) - Y^{\pi}(t_{k},t_{k}) \big|^{2} \,\mathrm{d} t \Big] + \sum_{k=0}^{N-1} \sum_{\ell=0}^{N-1} \mathbb{E}\Big[ \int_{t_{k}}^{t_{k+1}} \int_{t_{\ell}}^{t_{\ell+1}} \big| Z(t,s) - Z^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big] \\&\leq C(1+|x|^{2})|\pi|. \end{split} \end{align} \end{theo} \begin{rem} \begin{itemize} \item[(i)] We note that, in \cite{Zh04,WaY18}, a kind of uniformity condition named as the $K$-uniform condition was imposed on the partition $\pi \in \Pi[0,T]$. On the other hand, Gobet and Makhlouf \cite{GoMa10} considered a numerical scheme for BSDEs with irregular terminal function in terms of a special form of partitions which does not satisfy the $K$-uniform condition. Compared with the above papers, our results hold true for general partitions. \item[(ii)] In the literature of numerical approximations for BSDEs based on the backward Euler--Maruyama scheme, the $L^2$-error for the first component $Y(\cdot)$ of the adapted solution is often considered in the forms $\max_{k=0,\ldots,N-1}\mathbb{E}[|Y(t_k)-y^\pi(t_k)|^2]$ or $\max_{k=0,\ldots,N-1}\mathbb{E}[\sup_{t\in[t_k,t_{k+1}]}|Y(t)-y^\pi(t_k)|^2]$, where $y^\pi$ is the corresponding scheme (see \cite{Zh04,Zh17}). Also, Wang~\cite{WaY18} considered the same kind of error terms for a Type-\Rnum{1} BSVIE. These are the cases because of the time regularity of $Y(\cdot)$ in the strong $L^2$-sense (see \cite{Ha21} for the time regularity in the strong $L^2$-sense of $Y(\cdot)$ for Type-\Rnum{1} BSVIEs). However, in the case of Type-\Rnum{2} BSVIEs, the time regularity of the first component $Y(\cdot)$ of the adapted M-solution is a delicate problem, and $Y(t)$ is defined only for a.e.\ $t\in[0,T]$ in general. For this reason, we guess that the error term of the ``integral form'' as in \eqref{eq_thm2} is reasonable in the case of Type-\Rnum{2} BSVIEs. \end{itemize} \end{rem} In order to prove the above results, we have to estimate the modulus of the $L^{2}$-time regularity of $\mathscr{Z}^{\pi}$, which we study in the next subsection. \subsection{$L^{2}$-time regularity of $\mathscr{Z}^{\pi}$}\label{sec_L2} We investigate the $L^2$-time regularity of the martingale integrand $\mathscr{Z}^\pi$ of BSDE system~\eqref{BSDE_sys_2}. For this purpose, we introduce additional notations which we use throughout this subsection. For each $d_1\in\mathbb{N}$, $I_{d_1}$ denotes the identity matrix in $\mathbb{R}^{d_1\times d_1}$. For each $\xi\in\mathbb{R}^{d_1\times d_2}$ with $d_1,d_2\in\mathbb{N}$, $\xi^{(\alpha)}\in\mathbb{R}^{d_1}$ denotes the $\alpha$-th column vector of $\xi$ for each $\alpha=1,\ldots,d_2$, that is, $\xi=(\xi^{(1)},\ldots,\xi^{(d_2)})$. For each $d_1,d_2,d_3\in\mathbb{N}$, we denote by $\mathbb{R}^{(d_1\times d_2)\times d_3}$ the space of all elements $\xi=(\xi^{(1)},\ldots,\xi^{(d_3)})$ where $\xi^{(\alpha)}\in\mathbb{R}^{d_1\times d_2}$ for each $\alpha=1,\ldots,d_3$, which is endowed with the norm $|\xi|:=(\sum^{d_3}_{\alpha=1}|\xi^{(\alpha)}|^2)^{1/2}$. For each $C^1$ function $\varphi:\mathbb{R}^{d_1}\to\mathbb{R}^{d_2}$ with $d_1,d_2\in\mathbb{N}$, $\partial_\xi\varphi$ denotes the derivative of $\varphi$ with respect to $\xi\in\mathbb{R}^{d_1}$, which takes values in $\mathbb{R}^{d_2\times d_1}$. In the following, we use the Malliavin calculus technique for SDEs and BSDEs. For notations and fundamental results, we refer the readers to \cite{Nu06,PaPe92}. Specifically, the operator $D$ denotes the Malliavin derivative, and $\mathbb{D}^{1,2}$ denotes the domain of $D$ in $L^2_{\mathcal{F}_T}(\Omega;\mathbb{R})$. For each $\xi\in\mathbb{D}^{1,2}$, $D\xi=(D_\theta\xi)_{\theta\in[0,T]}$ can be seen as an element of $L^2_{\mathcal{F}_T}(0,T;\mathbb{R}^d)$. Also, for each $\xi\in\mathbb{D}^{1,2}$ and $j=1,\ldots,d$, $D^j\xi=(D^j_\theta\xi)_{\theta\in[0,T]}\in L^2_{\mathcal{F}_T}(0,T;\mathbb{R})$ denotes the $j$-th component of $D\xi$. For each $d_1,d_2\in\mathbb{N}$, we denote by $\mathbb{D}^{1,2}(\mathbb{R}^{d_1\times d_2})$ the space of all $\xi\in L^2_{\mathcal{F}_T}(\Omega;\mathbb{R}^{d_1\times d_2})$ such that each component of $\xi$ is in $\mathbb{D}^{1,2}$, and $D\xi$ and $D^j\xi$, $j=1,\ldots,d$, are understood by the component-wise manner. Since the following lemma is standard and can be found in \cite{Nu06,PaPe92}, we omit the proof. \begin{lemm}\label{Lem_SDE_0} Suppose that $(\mathrm{H}_{b,\sigma})$ holds, and assume that $b$ and $\sigma$ are $C^{1}$ in $x \in \mathbb{R}^{n}$. Then $X(s)$ is in $\mathbb{D}^{1,2}(\mathbb{R}^{n})$ for any $s \in [0,T]$. Furthermore, for each $j=1,\ldots,d$, there exists a version of $\{D_{\theta}^{j}X(s)\,|\,(\theta,s) \in [0,T]^{2}\}$ such that \begin{align}\label{Lem_SDE_0_1} D_{\theta}^{j}X(s) = \nabla X(s) (\nabla X(\theta))^{-1} \sigma^{(j)}(\theta,X(\theta)) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\theta,T]}(s),~ (\theta,s) \in [0,T]^{2}, \end{align} where $\nabla X(\cdot) \in L^{2}_{\mathbb{F}}(\Omega;C([0,T];\mathbb{R}^{n \times n}))$ is the solution of the following variational equation: \begin{align* \nabla X(t) = I_{n} + \int^{t}_{0} \partial_{x}b(s,X(s)) \nabla X(s) \,\mathrm{d} s + \sum_{\alpha=1}^{d} \int^{t}_{0} \partial_{x}\sigma^{(\alpha)}(s,X(s)) \nabla X(s) \,\mathrm{d} W^{\alpha}(s), ~t\in[0,T]. \end{align*} Moreover, for any $p \geq 2$, the following estimates hold: \begin{align} \label{Lem_SDE_0_3} & \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \nabla X(s) \big|^{p} \Big] + \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{p} \Big] \leq C_{p},\\ \label{Lem_SDE_0_4} & \mathbb{E}\Big[ \sup_{s'\in [s,t]} \big| (\nabla X(s'))^{-1} - (\nabla X(s))^{-1} \big|^{p} \Big] \leq C_{p} |t-s|^{p/2},~\text{for any}~0 \leq s \leq t \leq T. \end{align} \end{lemm} Fix $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$. When $\psi$ and $g$ in $(\mathrm{H}_{\psi,g})$ are $C^{1}$ in $(x_{1},x_{2},y,z_{1},z_{2}) \in \mathbb{R}^{n} \times\mathbb{R}^{n} \times \mathbb{R}^{m} \times \mathbb{R}^{m\times d} \times \mathbb{R}^{m\times d}$, we define \begin{align*} \psi_{\xi}(t_{k}) &:= \partial_{\xi} \psi(t_{k},X(t_{k}),X(T)), \\g_{\xi}(t_{k},s) &:= \partial_{\xi} g ( t_{k}, s, X(t_{k}), X(s), \mathscr{Y}^{\pi}(\tau(s),s), \mathscr{Z}^{\pi}(t_{k},s), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(s),\cdot)](t_{k}) ), \end{align*} for $\xi=x_{1},x_{2},y,z_{1}^{(\alpha)},z_{2}^{(\alpha)}$, $ \alpha=1,\ldots,d$. By the Lipschitz continuity of $\psi$ and $g$, the above processes are bounded by $L$. We introduce the following \emph{variational BSDE system} with parameter $\theta \in [0,T]$: \begin{align}\label{Prop_L2_2} \begin{cases} \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},s) \displaystyle = \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},t_{\ell+1}) \\\displaystyle\quad\quad\quad\quad\quad\quad\quad + \int_{s}^{t_{\ell+1}} \Big\{ g_{x_{1}}(t_{k},r) \nabla X(t_{k}) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{\theta \leq t_{k}\}} + g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{\theta} \mathscr{Y}^{\pi}(t_{\ell},r) \\ \displaystyle \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad + \sum_{\alpha=1}^{d} g_{z_{1}^{(\alpha)}}(t_{k},r) \nabla_{\theta} \mathscr{Z}^{\pi,(\alpha)}(t_{k},r) \\ \displaystyle \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad + \sum_{\alpha=1}^{d} g_{z_{2}^{(\alpha)}}(t_{k},r) \mathcal{I}^{\pi,\theta}[\nabla_{\theta} \mathscr{Z}^{\pi,(\alpha)}(t_{\ell},\cdot)](t_{k}) \Big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}} \,\mathrm{d} r \\ \displaystyle \quad\quad\quad\quad\quad\quad\quad - \int_{s}^{t_{\ell+1}} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r), ~s \in [t_{\ell}, t_{\ell+1}], ~k,\ell=0,\ldots,N-1, \\ \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},t_{N}) \displaystyle = \psi_{x_{1}}(t_{k}) \nabla X(t_{k}) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{\theta \leq t_{k}\}} + \psi_{x_{2}}(t_{k}) \nabla X(t_{N}), ~k=0,\ldots,N-1, \end{cases} \end{align} where $\nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},s)=(\nabla_{\theta} \mathscr{Z}^{\pi,(1)}(t_{k},s),\ldots,\nabla_{\theta} \mathscr{Z}^{\pi,(d)}(t_{k},s))$ which takes values in $\mathbb{R}^{(m \times n) \times d}$. By Lemma \ref{Lem_BSDE_sys_0}, for each $\theta \in [0,T]$, there exists a unique solution \begin{align*} \{ (\nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},\cdot), \nabla_{\theta}\mathscr{Z}^{\pi}(t_{k},\cdot)) \}_{k=0}^{N-1} \in \big( L^{2}_{\mathbb{F}}(\Omega, C([0,T];\mathbb{R}^{m \times n})) \times L^{2}_{\mathbb{F}}(0,T;\mathbb{R}^{(m \times n) \times d}) \big)^{N} \end{align*} of variational BSDE system \eqref{Prop_L2_2}. Now we provide an expression of $\mathscr{Z}^{\pi}$ in terms of the solution of variational BSDE system \eqref{Prop_L2_2}. \begin{prop}\label{Prop_L2_0} Suppose that $(\mathrm{H}_{\psi,g})$ and $(\mathrm{H}_{b,\sigma})$ hold. Assume that $b$, $\sigma$ are $C^{1}$ in $x \in \mathbb{R}^{n}$ and $\psi, g$ are $C^{1}$ in $(x_{1},x_{2},y,z_{1},z_{2}) \in \mathbb{R}^{n} \times\mathbb{R}^{n} \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}$. Then for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, $k=0,\ldots,N-1$ and $s \in [0,T]$, $\mathscr{Y}^{\pi}(t_{k},s)$ is in $\mathbb{D}^{1,2}(\mathbb{R}^{m})$ and $\mathscr{Z}^{\pi}(t_{k},s)$ is in $\mathbb{D}^{1,2}(\mathbb{R}^{m \times d})$. Furthermore, for each $j=1,\ldots,d$, there exists a version of $\{(D_{\theta}^{j}\mathscr{Y}^{\pi}(t_{k},s),D_{\theta}^{j}\mathscr{Z}^{\pi}(t_{k},s))\,|\,0 \leq \theta \leq s \leq T,~k=0,\ldots,N-1\}$ such that \begin{align}\label{Prop_L2_1} \begin{cases} D_{\theta}^{j}\mathscr{Y}^{\pi}(t_{k},s) \displaystyle = \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},s) (\nabla X(\theta))^{-1} \sigma^{(j)}(\theta,X(\theta)), \\ D_{\theta}^{j}\mathscr{Z}^{\pi,(\alpha)}(t_{k},s) \displaystyle = \nabla_{\theta}\mathscr{Z}^{\pi,(\alpha)}(t_{k},s) (\nabla X(\theta))^{-1} \sigma^{(j)}(\theta,X(\theta)),~ \alpha=1,\ldots,d, \end{cases} \end{align} for $0\leq \theta \leq s \leq T$ and $k=0,\ldots,N-1$. Moreover, it holds that \begin{align}\label{Prop_L2_3} \mathscr{Z}^{\pi}(t_{k},s) = \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) (\nabla X(s))^{-1} \sigma(s,X(s)), ~\text{a.e.}~s \in [0,T], ~k=0,\ldots,N-1. \end{align} \end{prop} \begin{proof} For simplicity of notation, we suppose $d=1$, that is, $W(\cdot)$ is a one-dimensional Brownian motion. We show that the following property holds for each $k=0,\ldots,N-1$, backward inductively: \begin{itemize} \item[$(\mathrm{P}_{k})$] For any $s \in [0,T]$, $\mathscr{Y}^{\pi}(t_{k},s)$ and $\mathscr{Z}^{\pi}(t_{k},s)$ are in $\mathbb{D}^{1,2}(\mathbb{R}^{m})$, and it holds that \begin{align*} \begin{cases} D_{\theta}\mathscr{Y}^{\pi}(t_{k},s) \displaystyle = \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},s) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)), \\ D_{\theta}\mathscr{Z}^{\pi}(t_{k},s) \displaystyle = \nabla_{\theta}\mathscr{Z}^{\pi}(t_{k},s) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)), \end{cases} ~0\leq \theta \leq s \leq T. \end{align*} \end{itemize} For $k=N-1$, note that $(\mathscr{Y}^{\pi}(t_{N-1},\cdot),\mathscr{Z}^{\pi}(t_{N-1},\cdot))$ is the adapted solution of the following BSDE: \begin{align*} \mathscr{Y}^{\pi}(t_{N-1},s) = \psi(t_{N-1},X(t_{N-1}),X(T)) - \int_{s}^{T} \mathscr{Z}^{\pi}(t_{N-1},r) \,\mathrm{d} W(r), ~s \in [0,T]. \end{align*} Thus, by the well-known result on the Malliavin calculus for BSDEs (cf.\ \cite{PaPe92}), we see that $\mathscr{Y}^{\pi}(t_{N-1},s)$ and $\mathscr{Z}^{\pi}(t_{N-1},s)$ are in $\mathbb{D}^{1,2}(\mathbb{R}^{m})$ for any $s \in [0,T]$. Moreover, for any $\theta \in [0,T]$, $(D_{\theta}\mathscr{Y}^{\pi}(t_{N-1},\cdot), D_{\theta}\mathscr{Z}^{\pi}(t_{N-1},\cdot))$ is the adapted solution of the following BSDE: \begin{align*} D_{\theta}\mathscr{Y}^{\pi}(t_{N-1},s) = D_{\theta} \psi(t_{N-1},X(t_{N-1}),X(T)) - \int_{s}^{T} D_{\theta}\mathscr{Z}^{\pi}(t_{N-1},r) \,\mathrm{d} W(r), ~s \in [\theta, T]. \end{align*} By using the chain rule (cf.\ Proposition 1.2.3 in \cite{Nu06}) and \eqref{Lem_SDE_0_1}, we see that \begin{align*} D_{\theta} \psi(t_{N-1},X(t_{N-1}),X(T)) &= \psi_{x_{1}}(t_{N-1}) D_{\theta}X(t_{N-1}) + \psi_{x_{2}}(t_{N-1}) D_{\theta}X(T) \\&= \big\{ \psi_{x_{1}}(t_{N-1}) \nabla X(t_{N-1})\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{\theta \leq t_{N-1}\}} + \psi_{x_{2}}(t_{N-1}) \nabla X(T) \big\} (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)). \end{align*} On the other hand, by \eqref{Prop_L2_2}, \begin{align*} \nabla_{\theta}\mathscr{Y}^{\pi}(t_{N-1},s) &= \psi_{x_{1}}(t_{N-1}) \nabla X(t_{N-1}) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{\theta \leq t_{N-1}\}} + \psi_{x_{2}}(t_{N-1}) \nabla X(T) \\&\quad - \int_{s}^{T} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{N-1},r) \,\mathrm{d} W(r), ~s \in [0,T]. \end{align*} Hence, by the uniqueness of the adapted solution of the BSDE, we see that, \begin{align*} \begin{cases} D_{\theta}\mathscr{Y}^{\pi}(t_{N-1},s) = \nabla_{\theta}\mathscr{Y}^{\pi}(t_{N-1},s) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)), \\ D_{\theta}\mathscr{Z}^{\pi}(t_{N-1},s) = \nabla_{\theta}\mathscr{Z}^{\pi}(t_{N-1},s) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)), \end{cases} ~s \in [\theta,T]. \end{align*} Thus $(\mathrm{P}_{N-1})$ holds. Next, for a fixed $k' \in \{0,\ldots,N-2\}$, we assume that $(\mathrm{P}_{k})$ holds for any $k=k'+1,\ldots,N-1$. We observe that $(\mathscr{Y}^{\pi}(t_{k'},\cdot),\mathscr{Z}^{\pi}(t_{k'},\cdot))$ is the adapted solution of the BSDE \begin{align*} \mathscr{Y}^{\pi}(t_{k'},s) &= \psi(t_{k'},X(t_{k'}),X(T)) \\&\quad + \int_{s}^{T} g( t_{k'}, r, X(t_{k'}), X(r), \mathscr{Y}^{\pi}(\tau(r),r), \mathscr{Z}^{\pi}(t_{k'},r), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k'+1},T)}(r) \,\mathrm{d} r \\&\quad - \int_{s}^{T} \mathscr{Z}^{\pi}(t_{k'},r) \,\mathrm{d} W(r),~s \in [0,T]. \end{align*} By the assumption of the induction, for any $r \in [t_{k'+1},T)$, $\mathscr{Y}^{\pi}(\tau(r),r)$ and $ \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'})$ are in $\mathbb{D}^{1,2}(\mathbb{R}^{m})$. Thus, by the well-known result on the Malliavin calculus for BSDEs (cf.\ \cite{PaPe92}), $\mathscr{Y}^{\pi}(t_{k'},s)$ and $\mathscr{Z}^{\pi}(t_{k'},s)$ are in $\mathbb{D}^{1,2}(\mathbb{R}^{m})$ for any $s \in [0,T]$. Also, noting the chain rule, for each $\theta \in [0,T]$, we see that the pair $(D_{\theta} \mathscr{Y}^{\pi}(t_{k'},\cdot),D_{\theta} \mathscr{Z}^{\pi}(t_{k'},\cdot))$ solves the following BSDE: \begin{align*} D_{\theta}\mathscr{Y}^{\pi}(t_{k'},s) &= \psi_{x_{1}}(t_{k'}) D_{\theta}X(t_{k'}) + \psi_{x_{2}}(t_{k'}) D_{\theta}X(T) \\&\quad + \int_{s}^{T} \big\{ g_{x_{1}}(t_{k'},r) D_{\theta} X(t_{k'}) + g_{x_{2}}(t_{k'},r) D_{\theta} X(r) + g_{y}(t_{k'},r) D_{\theta} \mathscr{Y}^{\pi}(\tau(r),r) \\&\quad\quad\quad\quad\quad + g_{z_{1}}(t_{k'},r) D_{\theta} \mathscr{Z}^{\pi}(t_{k'},r) + g_{z_{2}}(t_{k'},r) D_{\theta} \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k'+1},T)}(r) \,\mathrm{d} r \\&\quad - \int_{s}^{T} D_{\theta} \mathscr{Z}^{\pi}(t_{k'},r) \,\mathrm{d} W(r), ~s \in [\theta,T]. \end{align*} On the other hand, by \eqref{Prop_L2_2}, $(\nabla_{\theta}\mathscr{Y}^{\pi}(t_{k'},\cdot), \nabla_{\theta}\mathscr{Z}^{\pi}(t_{k'},\cdot))$ is the adapted solution of the BSDE \begin{align*} \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k'},s) &= \psi_{x_{1}}(t_{k'}) \nabla X(t_{k'}) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{\theta \leq t_{k'}\}} + \psi_{x_{2}}(t_{k'}) \nabla X(T) \\*&\quad + \int_{s}^{T} \big\{ g_{x_{1}}(t_{k'},r) \nabla X(t_{k'}) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{\theta \leq t_{k'}\}} + g_{x_{2}}(t_{k'},r) \nabla X(r) + g_{y}(t_{k'},r) \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(r),r) \\*&\quad\quad\quad\quad\quad + g_{z_{1}}(t_{k'},r) \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k'},r) + g_{z_{2}}(t_{k'},r) \mathcal{I}^{\pi,\theta}[\nabla_{\theta} \mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k'+1},T)}(r) \,\mathrm{d} r \\*&\quad - \int_{s}^{T} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k'},r) \,\mathrm{d} W(r), ~s \in [0,T]. \end{align*} By the assumption of the induction, for any $r \in [t_{k'+1} \vee \theta, T)$, we have \begin{align* D_{\theta}\mathscr{Y}^{\pi}(\tau(r),r) &= \nabla_{\theta}\mathscr{Y}^{\pi}(\tau(r),r) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)) \end{align*} and, noting that $\mathscr{Z}^{\pi}(\tau(r),\cdot)$ is adapted, \begin{align* D_{\theta} \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) &= \frac{1}{\Delta t_{k'}} D_{\theta} \int_{t_{k'}}^{t_{k'+1}} \mathscr{Z}^{\pi}(\tau(r),s) \,\mathrm{d} s = \frac{1}{\Delta t_{k'}} \int_{t_{k'}\vee \theta}^{t_{k'+1} \vee \theta} D_{\theta} \mathscr{Z}^{\pi}(\tau(r),s) \,\mathrm{d} s \notag\\&= \frac{1}{\Delta t_{k'}} \int_{t_{k'}\vee \theta}^{t_{k'+1} \vee \theta} \nabla_{\theta}\mathscr{Z}^{\pi}(\tau(r),s) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)) \,\mathrm{d} s \notag\\&= \mathcal{I}^{\pi,\theta}[\nabla_{\theta} \mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)). \end{align*} From the above, together with \eqref{Lem_SDE_0_1}, by the uniqueness of the adapted solution of the BSDE, we have \begin{align*} \begin{cases} D_{\theta}\mathscr{Y}^{\pi}(t_{k'},s) = \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k'},s) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)), \\ D_{\theta}\mathscr{Z}^{\pi}(t_{k'},s) = \nabla_{\theta}\mathscr{Z}^{\pi}(t_{k'},s) (\nabla X(\theta))^{-1} \sigma(\theta,X(\theta)), \end{cases} ~s \in [\theta,T]. \end{align*} Thus $(\mathrm{P}_{k'})$ holds. By the backward induction, we see that $(\mathrm{P}_{k})$ holds for every $k=0,\ldots,N-1$. It remains to prove \eqref{Prop_L2_3}. Let $k,\ell=0,\ldots,N-1$ and $s \in (t_{\ell},t_{\ell+1}]$ be fixed. We observe that \begin{align*} \mathscr{Y}^{\pi}(t_{k},t_{\ell}) &= \mathscr{Y}^{\pi}(t_{k},t_{\ell+1}) + \int_{t_{\ell}}^{t_{\ell+1}} g( t_{k}, r, X(t_{k}), X(r), \mathscr{Y}^{\pi}(t_{\ell},r), \mathscr{Z}^{\pi}(t_{k},r), \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) ) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}} \,\mathrm{d} r \\*&\quad - \int_{t_{\ell}}^{t_{\ell+1}} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r). \end{align*} We apply $D_{s}$ on both side of the above equality. By the chain rule and Proposition 1.3.8 in \cite{Nu06}, we have \begin{align*} 0&= D_{s}\mathscr{Y}^{\pi}(t_{k},t_{\ell+1}) \\&\quad + \int_{s}^{t_{\ell+1}} \big\{ g_{x_{1}}(t_{k},r) D_{s}X(t_{k}) + g_{x_{2}}(t_{k},r) D_{s}X(r) + g_{y}(t_{k},r) D_{s}\mathscr{Y}^{\pi}(t_{\ell},r) \\&\quad\quad\quad\quad\quad\quad + g_{z_{1}}(t_{k},r) D_{s}\mathscr{Z}^{\pi}(t_{k},r) + g_{z_{2}}(t_{k},r) D_{s} \mathcal{I}^{\pi}[\mathscr{Z}^{\pi}(t_{\ell},\cdot)](t_{k}) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}} \,\mathrm{d} r \\&\quad - \mathscr{Z}^{\pi}(t_{k},s) - \int_{s}^{t_{\ell+1}} D_{s} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r) \\ &= D_{s}\mathscr{Y}^{\pi}(t_{k},t_{\ell+1}) + \int_{s}^{t_{\ell+1}} \big\{ g_{x_{2}}(t_{k},r) D_{s}X(r) + g_{y}(t_{k},r) D_{s}\mathscr{Y}^{\pi}(t_{\ell},r) + g_{z_{1}}(t_{k},r) D_{s}\mathscr{Z}^{\pi}(t_{k},r) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}} \,\mathrm{d} r \\&\quad - \mathscr{Z}^{\pi}(t_{k},s) - \int_{s}^{t_{\ell+1}} D_{s} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r). \end{align*} Thus, by using \eqref{Lem_SDE_0_1}, \eqref{Prop_L2_1} and the equation \eqref{Prop_L2_2}, we obtain \begin{align*} \mathscr{Z}^{\pi}(t_{k},s) &= \Big\{ \nabla_{s}\mathscr{Y}^{\pi}(t_{k},t_{\ell+1}) \\*&\quad\quad + \int_{s}^{t_{\ell+1}} \big\{ g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{s}\mathscr{Y}^{\pi}(t_{\ell},r) + g_{z_{1}}(t_{k},r) \nabla_{s}\mathscr{Z}^{\pi}(t_{k},r) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{k<\ell\}} \,\mathrm{d} r \\*&\quad\quad - \int_{s}^{t_{\ell+1}} \nabla_{s} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r) \Big\} (\nabla X(s))^{-1} \sigma(s,X(s)) \\*&= \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) (\nabla X(s))^{-1} \sigma(s,X(s)). \end{align*} Hence \eqref{Prop_L2_3} holds, and we complete the proof. \end{proof} \begin{rem} Variational BSDE system~\eqref{Prop_L2_2} is a continuum of BSDE systems parametrized by $\theta\in[0,T]$ (where each BSDE system consists of a finite number of BSDEs). On one hand, due to the appearance of the operator $\mathcal{I}^{\pi,\theta}[\cdot]$, the variational BSDE system of a true Type-\Rnum{2} BSVIE (where $g_{z^{(\alpha)}_2}(t_k,r)\neq0$) cannot be reduced to a finite number of systems. On the other hand, in the case of Type-\Rnum{1} BSVIEs (where $g(t,s,x_{1},x_{2},y,z_{1},z_{2})$ does not depend on $z_{2}$, and hence $g_{z^{(\alpha)}_2}(t_k,r)=0$), it is reduced to a finite number of BSDE systems. Indeed, in this case, the dependency of the system on the parameter $\theta$ stems only from the indicator functions $\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{\{\theta\leq t_k\}}$. Since $\theta\leq t_k$ if and only if $i<k$ for each $k=0,\ldots,N-1$ and $\theta\in(t_i,t_{i+1}]$ with $i=0,\ldots,N-1$, by the uniqueness of the solution of the BSDE system (see Lemma~\ref{Lem_BSDE_sys_0}), the variational BSDE system with parameter $\theta\in(0,T]$ depends only on the number $i\in\{0,1,\ldots,N-1\}$ such that $\theta\in(t_i,t_{i+1}]$. Moreover, if in addition the free term $\psi(t,x_1,x_2)$ and the driver $g(t,s,x_1,x_2,y,z_1)$ of the Type-\Rnum{1} BSVIE do not depend on $x_1$, then the terms $\psi_{x_1}(t_k)$ and $g_{x_1}(t_k,r)$ vanish, and thus the variational BSDE system becomes independent of the parameter $\theta\in[0,T]$. \end{rem} In order to investigate the $L^2$-time regularity of $\mathscr{Z}^\pi$, we prove some key properties of variational BSDE system~\eqref{Prop_L2_2}. The following lemma shows a useful structural property. \begin{lemm}\label{Lem_Lp_0} Let the assumptions in Proposition \ref{Prop_L2_0} hold. Then for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, it holds that \begin{align*} (\nabla_{\theta} \mathscr{Y}^{\pi}(t_{k},s), \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},s)) = (\nabla_{0} \mathscr{Y}^{\pi}(t_{k},s), \nabla_{0} \mathscr{Z}^{\pi}(t_{k},s)),~ s \in [0,T],~\theta \in [0,t_{k}],~k=0,\ldots,N-1. \end{align*} \end{lemm} \begin{proof} For simplicity of notation, we suppose $d=1$, that is, $W(\cdot)$ is a one-dimensional Brownian motion. Let $\theta \in [0,t_{j}]$ with $j=0,\ldots,N-1$ be fixed. We show that, by a backward induction, the following property holds for each $k=j,j+1,\ldots,N-1$: \begin{itemize} \item[$(\mathrm{P}_{k})$] For any $s \in [0,T]$, \begin{align*} (\nabla_{\theta} \mathscr{Y}^{\pi}(t_{k},s), \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},s)) = (\nabla_{0} \mathscr{Y}^{\pi}(t_{k},s), \nabla_{0} \mathscr{Z}^{\pi}(t_{k},s)). \end{align*} \end{itemize} For $k=N-1$, we observe that \begin{align*} \nabla_{\theta}\mathscr{Y}^{\pi}(t_{N-1},s) &= \psi_{x_{1}}(t_{N-1}) \nabla X(t_{N-1}) + \psi_{x_{2}}(t_{N-1}) \nabla X(T) - \int_{s}^{T} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{N-1},r) \,\mathrm{d} W(r), ~s \in [0,T], \\ \nabla_{0}\mathscr{Y}^{\pi}(t_{N-1},s) &= \psi_{x_{1}}(t_{N-1}) \nabla X(t_{N-1}) + \psi_{x_{2}}(t_{N-1}) \nabla X(T) - \int_{s}^{T} \nabla_{0} \mathscr{Z}^{\pi}(t_{N-1},r) \,\mathrm{d} W(r), ~s \in [0,T]. \end{align*} By the uniqueness of the adapted solution of the BSDE, we see that $(\mathrm{P}_{N-1})$ holds. Next, for a fixed $k' \in \{j,j+1,\ldots,N-2\}$, assume that $(\mathrm{P}_{k})$ holds for any $k=k'+1,\ldots,N-1$. We observe that \begin{align*} \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k'},s) &= \psi_{x_{1}}(t_{k'}) \nabla X(t_{k'}) + \psi_{x_{2}}(t_{k'}) \nabla X(T) \\*&\quad+ \int_{s}^{T} \big\{ g_{x_{1}}(t_{k'},r) \nabla X(t_{k'}) + g_{x_{2}}(t_{k'},r) \nabla X(r) + g_{y}(t_{k'},r) \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(r),r) \\*&\quad\quad\quad\quad\quad\quad + g_{z_{1}}(t_{k'},r) \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k'},r) + g_{z_{2}}(t_{k'},r) \mathcal{I}^{\pi,\theta}[\nabla_{\theta}\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k'+1},T)}(r) \,\mathrm{d} r \\*&\quad - \int_{s}^{T} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k'},r) \,\mathrm{d} W(r),~s \in [0,T]. \end{align*} By the assumption of the induction, for any $r \in [t_{k'+1}, T)$, \begin{align*} \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(r),r) = \nabla_{0} \mathscr{Y}^{\pi}(\tau(r),r) \end{align*} and \begin{align*} \mathcal{I}^{\pi,\theta}[\nabla_{\theta}\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) &= \frac{1}{\Delta t_{k'}} \int_{t_{k'}\vee \theta}^{t_{k'+1} \vee \theta} \nabla_{\theta} \mathscr{Z}^{\pi}(\tau(r),s) \,\mathrm{d} s = \frac{1}{\Delta t_{k'}} \int_{t_{k'}}^{t_{k'+1}} \nabla_{0} \mathscr{Z}^{\pi}(\tau(r),s) \,\mathrm{d} s \\*&= \mathcal{I}^{\pi}[\nabla_{0}\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}). \end{align*} Thus we have \begin{align*} \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k'},s) &= \psi_{x_{1}}(t_{k'}) \nabla X(t_{k'}) + \psi_{x_{2}}(t_{k'}) \nabla X(T) \\*&\quad+ \int_{s}^{T} \big\{ g_{x_{1}}(t_{k'},r) \nabla X(t_{k'}) + g_{x_{2}}(t_{k'},r) \nabla X(r) + g_{y}(t_{k'},r) \nabla_{0} \mathscr{Y}^{\pi}(\tau(r),r) \\*&\quad\quad\quad\quad\quad\quad + g_{z_{1}}(t_{k'},r) \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k'},r) + g_{z_{2}}(t_{k'},r) \mathcal{I}^{\pi}[\nabla_{0}\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k'+1},T)}(r) \,\mathrm{d} r \\*&\quad - \int_{s}^{T} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k'},r) \,\mathrm{d} W(r),~s \in [0,T]. \end{align*} On the other hand, we have \begin{align*} \nabla_{0}\mathscr{Y}^{\pi}(t_{k'},s) &= \psi_{x_{1}}(t_{k'}) \nabla X(t_{k'}) + \psi_{x_{2}}(t_{k'}) \nabla X(T) \\&\quad+ \int_{s}^{T} \big\{ g_{x_{1}}(t_{k'},r) \nabla X(t_{k'}) + g_{x_{2}}(t_{k'},r) \nabla X(r) + g_{y}(t_{k'},r) \nabla_{0} \mathscr{Y}^{\pi}(\tau(r),r) \\&\quad\quad\quad\quad\quad\quad + g_{z_{1}}(t_{k'},r) \nabla_{0} \mathscr{Z}^{\pi}(t_{k'},r) + g_{z_{2}}(t_{k'},r) \mathcal{I}^{\pi}[\nabla_{0}\mathscr{Z}^{\pi}(\tau(r),\cdot)](t_{k'}) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k'+1},T)}(r) \,\mathrm{d} r \\*&\quad - \int_{s}^{T} \nabla_{0} \mathscr{Z}^{\pi}(t_{k'},r) \,\mathrm{d} W(r),~s \in [0,T]. \end{align*} By the uniqueness of the adapted solution of the BSDE, we see that $(\mathrm{P}_{k'})$ holds. By the backward induction, $(\mathrm{P}_{k})$ holds for any $k=j,j+1,\ldots,N-1$. Since $\theta \in [0,t_{j}]$ and $j=0,\ldots,N-1$ are arbitrary, we see that the assertion holds. \end{proof} Next, we provide some key $L^p$-estimates for $p \geq 2$. \begin{lemm}\label{Lem_Lp_1} Let the assumptions in Proposition \ref{Prop_L2_0} hold. Fix arbitrary $p \geq 2$. Then for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, it holds that \begin{align} \begin{split}\label{Lem_Lp_1_0} &\sup_{\theta \in [0,T]} \mathbb{E} \Big[ \sup_{s \in [0,T]} \Big( \sum_{k=0}^{N-1} \Delta t_{k} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \Big)^{p/2} + \Big( \int_{0}^{T} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} \\&\quad\quad\quad\quad\quad\quad\quad\quad + \Big( \int_{0}^{T} \int_{0}^{T} \big| \nabla_{\theta} \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{p/2} \Big] \leq C_{p}, \end{split} \\ \begin{split}\label{Lem_Lp_1_1} & \mathbb{E} \Big[ \sup_{s \in [0,T]} \Big( \int_{0}^{T} \big| \nabla_{t} \mathscr{Y}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} t \Big)^{p/2} + \Big( \int_{0}^{T} \big| \nabla_{t} \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} \\&\quad\quad\quad\quad\quad\quad\quad\quad + \Big( \int_{0}^{T} \int_{0}^{T} \big| \nabla_{t} \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{p/2} \Big] \leq C_{p}, \end{split} \\ \begin{split}\label{Lem_Lp_1_2} & \max_{k=0,\ldots,N-2} \sup_{\theta \in [t_{k+1},T]} \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(t_{k},s) \big|^{p} + \Big( \int_{0}^{T} \big| \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big] \leq C_{p} \end{split} \end{align} and \begin{align} \begin{split}\label{Lem_Lp_1_3} &\max_{k=0,\ldots,N-2} \max_{\ell=k+1,\ldots, N-1} \sup_{\theta \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \sup_{s \in [t_{\ell},T]} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k+1}} \mathscr{Y}^{\pi}(t_{k},s) \big|^{p} \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad + \Big( \int_{t_{\ell}}^{T} \big| \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},s) - \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big] \leq C_{p} |\pi|^{p/2}. \end{split} \end{align} \end{lemm} \begin{proof} For simplicity of notation, we suppose $d=1$, that is, $W(\cdot)$ is a one-dimensional Brownian motion. \emph{Proof of \eqref{Lem_Lp_1_0}.} Noting that $\mathbb{E}[\sup_{s \in [0,T]} |\nabla X(s)|^{p}] \leq C_{p}$, by the $L^{p}$-esimtate for BSDE systems (see Theorem \ref{Lem_Lp} (ii)), we see that \eqref{Lem_Lp_1_0} holds. \emph{Proof of \eqref{Lem_Lp_1_1}.} For any $t \in [0,T] \setminus \pi$, it holds that \begin{align*} \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) &= \psi_{x_{2}}(\tau(t)) \nabla X(T) \\*&\quad+ \int_{t}^{T} \big\{ g_{x_{2}}(\tau(t),s) \nabla X(s) + g_{y}(\tau(t),s) \nabla_{t} \mathscr{Y}^{\pi}(\tau(s),s) \\*&\quad\quad\quad\quad\quad + g_{z_{1}}(\tau(t),s) \nabla_{t} \mathscr{Z}^{\pi}(\tau(t),s) + g_{z_{2}}(\tau(t),s) \mathcal{I}^{\pi,t}[\nabla_{t}\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(t),T)}(s) \,\mathrm{d} s \\&\quad - \int_{t}^{T} \nabla_{t} \mathscr{Z}^{\pi}(\tau(t),s) \,\mathrm{d} W(s). \end{align*} From Lemma \ref{Lem_Lp_0}, for any $s \in [\tau^{*}(t),T)$, we have \begin{align*} \nabla_{t}\mathscr{Y}^{\pi}(\tau(s),s) = \nabla_{0}\mathscr{Y}^{\pi}(\tau(s),s) \quad\text{and}\quad \mathcal{I}^{\pi,t}[\nabla_{t}\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)) &= \mathcal{I}^{\pi,t}[\nabla_{0}\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)). \end{align*} Thus, we have \begin{align*} \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) &= \psi_{x_{2}}(\tau(t)) \nabla X(T) \\&\quad+ \int_{t}^{T} \big\{ g_{x_{2}}(\tau(t),s) \nabla X(s) + g_{y}(\tau(t),s) \nabla_{0} \mathscr{Y}^{\pi}(\tau(s),s) + g_{z_{1}}(\tau(t),s) \nabla_{t} \mathscr{Z}^{\pi}(\tau(t),s) \\&\quad\quad\quad\quad\quad + g_{z_{2}}(\tau(t),s) \mathcal{I}^{\pi,t}[\nabla_{0}\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(t),T)}(s) \,\mathrm{d} s \\&\quad - \int_{t}^{T} \nabla_{t} \mathscr{Z}^{\pi}(\tau(t),s) \,\mathrm{d} W(s). \end{align*} Also, it holds that \begin{align*} \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) = \mathbb{E}\Big[ \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) \Big] + \int_{0}^{t} \nabla_{t}\mathscr{Z}^{\pi}(\tau(t),s) \,\mathrm{d} W(s). \end{align*} Thus, by defining \begin{align*} \begin{cases} \eta(t) := \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t),~ t \in [0,T],\\ \zeta(t,s) := \nabla_{t}\mathscr{Z}^{\pi}(\tau(t),s),~ (t,s) \in [0,T]^{2}, \end{cases} \end{align*} we see that $(\eta(\cdot),\zeta(\cdot,\cdot))$ is the adapted M-solution of BSVIE \eqref{BSVIE_II_1} with the coefficients \begin{align*} &\Psi(t) = \psi_{x_{2}}(\tau(t)) \nabla X(T), \\ &G(t,s,y,z_{1},z_{2}) = \big\{ g_{x_{2}}(\tau(t),s) \nabla X(s) + g_{y}(\tau(t),s) \nabla_{0} \mathscr{Y}^{\pi}(\tau(s),s) + g_{z_{1}}(\tau(t),s) z_{1} \\&\hspace{3cm} + g_{z_{2}}(\tau(t),s) \mathcal{I}^{\pi,t}[\nabla_{0}\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^{*}(t),T)}(s). \end{align*} Note that $\psi_{x_{2}}$, $g_{x_{2}}$, $g_{y}$, $g_{z_{1}}$ and $g_{z_{2}}$ are bounded by $L$. Furthermore, from \eqref{Lem_Lp_1_0}, it holds that \begin{align*} \mathbb{E}\Big[ \Big( \int_{0}^{T} \big| \nabla_{0} \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} \Big] \leq C_{p} \end{align*} and \begin{align*} &\mathbb{E}\Big[ \Big( \int_{0}^{T} \int_{\tau^{*}(t)}^{T} \big| \mathcal{I}^{\pi,t}[\nabla_{0}\mathscr{Z}^{\pi}(\tau(s),\cdot)](\tau(t)) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{p/2} \Big] \\&\leq \mathbb{E}\Big[ \Big( \int_{0}^{T} \int_{\tau^{*}(t)}^{T} \frac{1}{\Delta \tau(t)} \int_{t}^{\tau^{*}(t)} \big| \nabla_{0} \mathscr{Z}^{\pi}(\tau(s),u) \big|^{2} \,\mathrm{d} u \,\mathrm{d} s \,\mathrm{d} t \Big)^{p/2} \Big] \\&\leq \mathbb{E}\Big[ \Big( \int_{0}^{T} \int_{0}^{T} \big| \nabla_{0} \mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{p/2} \Big] \leq C_{p}. \end{align*} Therefore, by the $L^{p}$-estimate for BSVIEs (see Theorem \ref{Lem_Lp} (i)), we see that \eqref{Lem_Lp_1_1} holds. \emph{Proof of \eqref{Lem_Lp_1_2}.} Let $k=0,\ldots,N-2$ and $\theta \in [t_{k+1},T]$ be fixed. Noting that $\mathcal{I}^{\pi,\theta}[\cdot](t_{k})=0$, we have \begin{align*} \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},s) &= \psi_{x_{2}}(t_{k}) \nabla X(T) \\&\quad+ \int_{s}^{T} \big\{ g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(r),r) + g_{z_{1}}(t_{k},r) \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},r) \big\} \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{k+1},T)}(r) \,\mathrm{d} r \\&\quad - \int_{s}^{T} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r),~s \in [0,T]. \end{align*} By the a priori estimate for BSDEs (see Lemma \ref{apriori_0}) and the estimate \eqref{Lem_Lp_1_0}, we have \begin{align*} & \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(t_{k},s) \big|^{p} + \Big( \int_{0}^{T} \big| \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big] \\&\leq C_{p} \mathbb{E}\Big[ \big| \psi_{x_{2}}(t_{k}) \nabla X(T) \big|^{p} + \Big( \int_{t_{k+1}}^{T} \big| g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(r),r) \big| \,\mathrm{d} r \Big)^{p} \Big] \\&\leq C_{p} \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \nabla X(s) \big|^{p} + \Big( \int_{0}^{T} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} \Big] \leq C_{p}. \end{align*} Thus, the estimate \eqref{Lem_Lp_1_2} holds. \emph{Proof of \eqref{Lem_Lp_1_3}.} Let $k=0,\ldots,N-2$, $\ell=k+1,\ldots,N-1$ and $\theta \in [t_{\ell},t_{\ell+1}]$ be fixed. Noting that $\mathcal{I}^{\pi,\theta}[\cdot](t_{k})=\mathcal{I}^{\pi,t_{k+1}}[\cdot](t_{k})=0$, it holds from Lemma \ref{Lem_Lp_0} that, for any $s \in [t_{\ell},T]$, \begin{align*} \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},s) &= \psi_{x_{2}}(t_{k}) \nabla X(T) \\*&\quad+ \int_{s}^{T} \big\{ g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(r),r) + g_{z_{1}}(t_{k},r) \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},r) \big\} \,\mathrm{d} r \\*&\quad - \int_{s}^{T} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r) \\&= \psi_{x_{2}}(t_{k}) \nabla X(T) \\&\quad+ \int_{s}^{T} \big\{ g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{0} \mathscr{Y}^{\pi}(\tau(r),r) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{\ell+1},T)}(r) \\&\quad\quad\quad\quad\quad + g_{y}(t_{k},r) \nabla_{\theta} \mathscr{Y}^{\pi}(t_{\ell},r) \mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t_{\ell},t_{\ell+1})}(r) + g_{z_{1}}(t_{k},r) \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},r) \big\} \,\mathrm{d} r \\&\quad - \int_{s}^{T} \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r), \end{align*} and \begin{align*} \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},s) &= \psi_{x_{2}}(t_{k}) \nabla X(T) \\&\quad+ \int_{s}^{T} \big\{ g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{t_{k+1}} \mathscr{Y}^{\pi}(\tau(r),r) + g_{z_{1}}(t_{k},r) \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},r) \big\} \,\mathrm{d} r \\&\quad - \int_{s}^{T} \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r) \\&= \psi_{x_{2}}(t_{k}) \nabla X(T) \\&\quad+ \int_{s}^{T} \big\{ g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{0} \mathscr{Y}^{\pi}(\tau(r),r) + g_{z_{1}}(t_{k},r) \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},r) \big\} \,\mathrm{d} r \\&\quad - \int_{s}^{T} \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r). \end{align*} By the stability estimate for BSDEs (see Lemma \ref{apriori_0}) and the estimate \eqref{Lem_Lp_1_0}, we have \begin{align*} &\mathbb{E} \Big[ \sup_{s \in [t_{\ell},T]} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k+1}} \mathscr{Y}^{\pi}(t_{k},s) \big|^{p} + \Big( \int_{t_{\ell}}^{T} \big| \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},s) - \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big)^{p/2} \Big] \\*&\leq C_{p} \mathbb{E}\Big[ \Big( \int_{t_{\ell}}^{t_{\ell+1}} \big| g_{y}(t_{k},r) \nabla_{\theta} \mathscr{Y}^{\pi}(t_{\ell},r) - g_{y}(t_{k},r) \nabla_{0} \mathscr{Y}^{\pi}(t_{\ell},r) \big| \,\mathrm{d} r \Big)^{p} \Big] \\&\leq C_{p}|\pi|^{p/2} \Big\{ \mathbb{E}\Big[ \Big( \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(t_{\ell},r) \big|^{2} \,\mathrm{d} r \Big)^{p/2} \Big] + \mathbb{E}\Big[ \Big( \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{0} \mathscr{Y}^{\pi}(t_{\ell},r) \big|^{2} \,\mathrm{d} r \Big)^{p/2} \Big] \Big\} \\&\leq C_{p}|\pi|^{p/2} \sup_{\theta \in [0,T]} \mathbb{E}\Big[ \Big( \int_{0}^{T} \big| \nabla_{\theta} \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{p/2} \Big] \leq C_{p}|\pi|^{p/2}. \end{align*} Thus, the estimate \eqref{Lem_Lp_1_3} holds, and we complete the proof. \end{proof} Now we are ready to estimate the modulus of the $L^{2}$-time regularity of $\mathscr{Z}^{\pi}$. \begin{theo}\label{Thm_L2_0} Under $(\mathrm{H}_{\psi,g})$ and $(\mathrm{H}_{b,\sigma})$, for any $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, it holds that \begin{align}\label{Thm_L2_0_1} \begin{split} & \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] \leq C(1+|x|^{2})|\pi| \end{split} \end{align} and \begin{align}\label{Thm_L2_0_0} \begin{split} & \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \leq C(1+|x|^{2}) \big\{ |\pi| + \rho_{\sigma}(|\pi|)^{2} \big\}. \end{split} \end{align} \end{theo} \begin{proof} For each $\varepsilon>0$, let $(b_{\varepsilon},\sigma_{\varepsilon},\psi_{\varepsilon},g_{\varepsilon})$ be a smooth mollifier of $(b,\sigma,\psi,g)$. Note that $(b_{\varepsilon},\sigma_{\varepsilon},\psi_{\varepsilon},g_{\varepsilon})$ satisfies $(\mathrm{H}_{\psi,g})$ and $(\mathrm{H}_{b,\sigma})$ with the same constant $L$ and continuous functions $\rho_{\psi,g}$ and $\rho_{\sigma}$. For each $\pi=\{t_{0},t_{1},\ldots,t_{N}\} \in \Pi[0,T]$, denote by $(X_{\varepsilon},\mathscr{Y}_{\varepsilon}^{\pi},\mathscr{Z}_{\varepsilon}^{\pi})$ the corresponding solution of SDE \eqref{SDE_0} and BSDE system \eqref{BSDE_sys_2}. By using the stability estimate for SDEs (cf.\ Theorem 3.2.4 in \cite{Zh17}), we see that $\lim_{\varepsilon \downarrow 0} X_{\varepsilon}(\cdot)=X(\cdot)$ in $L_{\mathbb{F}}^{2}(\Omega;C([0,T];\mathbb{R}^{n}))$. Then, by the stability estimate for BSDE systems (see Lemma \ref{Lem_BSDE_sys_0}), we can easily show that \begin{align*} \lim_{\varepsilon \downarrow 0} \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E}\Big[ \int_{0}^{T} \big| \mathscr{Z}_{\varepsilon}^{\pi}(t_{k},s) - \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] = 0 \end{align*} and \begin{align*} \lim_{\varepsilon \downarrow 0} \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} \Delta t_{\ell} \mathbb{E}\Big[ \big| \overline{\mathscr{Z}}_{\varepsilon}^{\pi}(t_{k},t_{\ell}) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \Big] = 0. \end{align*} Thus, without loss of generality, we may assume that $b(s,x)$, $\sigma(s,x)$ are $C^{1}$ in $x \in \mathbb{R}^{n}$, and $\psi(t,x_{1},x_{2})$, $g(t,s,x_{1},x_{2},y,z_{1},z_{2})$ are $C^{1}$ in $(x_{1},x_{2},y,z_{1},z_{2}) \in \mathbb{R}^{n} \times \mathbb{R}^{n} \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}$. In this case, the assumptions in Proposition \ref{Prop_L2_0} hold. We first prove \eqref{Thm_L2_0_1}. By using the representation formula \eqref{Prop_L2_3}, together with the estimates \eqref{Lem_SDE_1_0}, \eqref{Lem_SDE_0_3} and \eqref{Lem_Lp_1_1}, we have \begin{align*} & \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big] = \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) (\nabla X(s))^{-1} \sigma(s,X(s)) \big|^{2} \,\mathrm{d} s \Big] \\&\leq C \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \Big( 1 + \sup_{s \in [0,T]} \big|X(s)\big|^{2} \Big) \Big] \\&\leq C|\pi| \mathbb{E} \Big[ \int_{0}^{T} \big| \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \Big( 1 + \sup_{s \in [0,T]} \big|X(s)\big|^{2} \Big) \Big] \\&\leq C|\pi| \mathbb{E} \Big[ \Big( \int_{0}^{T} \big| \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{3} \Big]^{1/3} \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \Big( 1 + \mathbb{E} \Big[ \sup_{s \in [0,T]} \big|X(s)\textbf{}|^{6} \Big]^{1/3} \Big) \\&\leq C(1+|x|^{2})|\pi|. \end{align*} Thus, the estimate \eqref{Thm_L2_0_1} holds. Next, we prove \eqref{Thm_L2_0_0}. Let $k,\ell=0,\ldots,N-1$ be fixed. Note that $\overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell})$ is the best approximation of $\mathscr{Z}^{\pi}(t_{k},\cdot)$ on $[t_{\ell},t_{\ell+1}]$ in the following sense: \begin{align*} \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \leq \mathbb{E}\Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \zeta \big|^{2} \,\mathrm{d} s \Big] \end{align*} for any $\zeta \in L^{2}_{\mathcal{F}_{t_{\ell}}}(\Omega;\mathbb{R}^{m \times d})$. Thus, by the representation formula \eqref{Prop_L2_3}, we have \begin{align}\label{Thm_L2_0_5} \begin{split} &\mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \mathscr{Z}^{\pi}(t_{k},s) - \overline{\mathscr{Z}}^{\pi}(t_{k},t_{\ell}) \big|^{2} \,\mathrm{d} s \Big] \\& \leq \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) (\nabla X(s))^{-1} \sigma(s,X(s)) - \nabla_{t_{\ell}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) (\nabla X(t_{\ell}))^{-1} \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \\& \leq 3 \big\{ I_{k,\ell}^{(1)} + I_{k,\ell}^{(2)} + I_{k,\ell}^{(3)} \big\}, \end{split} \end{align} where \begin{align*} I_{k,\ell}^{(1)} &:= \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(s))^{-1} \big|^{2} \big| \sigma(s,X(s)) - \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big], \\ I_{k,\ell}^{(2)} &:= \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(s))^{-1} - (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big], \\ I_{k,\ell}^{(3)} &:= \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{\ell}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big]. \end{align*} We estimate $\sum_{k=0}^{N-1}\Delta t_{k} \sum_{\ell=0}^{N-1} I_{k,\ell}^{(i)}$ for $i=1,2,3$. For $i=1$, we divide the sum $\sum_{k=0}^{N-1}\Delta t_{k} \sum_{\ell=0}^{N-1} I_{k,\ell}^{(1)}$ into three cases: $k>\ell$, $k=\ell$ and $k<\ell$. \emph{The sum of $I_{k,\ell}^{(1)}$ for $k>\ell$.} By using Lemma \ref{Lem_Lp_0}, together with the estimates \eqref{Lem_SDE_1_0}, \eqref{Lem_SDE_1_1}, \eqref{Lem_SDE_0_3} and \eqref{Lem_Lp_1_0}, we have \begin{align*} & \sum_{k=1}^{N-1}\Delta t_{k} \sum_{\ell=0}^{k-1} I_{k,\ell}^{(1)} = \sum_{k=1}^{N-1}\Delta t_{k} \sum_{\ell=0}^{k-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(s))^{-1} \big|^{2} \big| \sigma(s,X(s)) - \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \\&= \sum_{k=1}^{N-1}\Delta t_{k} \sum_{\ell=0}^{k-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{0}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(s))^{-1} \big|^{2} \big| \sigma(s,X(s)) - \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \\&\leq C \sum_{\ell=0}^{N-2} \Delta t_{\ell} \mathbb{E} \Big[ \sup_{s \in [0,T]} \Big( \sum_{k=\ell+1}^{N-1} \Delta t_{k} \big| \nabla_{0}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \Big) \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \\&\quad \quad \quad\quad\quad\quad\quad \times \Big\{ \rho_{\sigma}(|\pi|)^{2} \Big( 1 + \sup_{s \in [0,T]}|X(s)|^{2} \Big) + \sup_{s \in [t_{\ell},t_{\ell+1}]} \big| X(s) - X(t_{\ell}) \big|^{2} \Big\} \Big] \\&\leq C \sum_{\ell=0}^{N-1} \Delta t_{\ell} \mathbb{E} \Big[ \sup_{s \in [0,T]} \Big( \sum_{k=0}^{N-1} \Delta t_{k} \big| \nabla_{0}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \Big)^{3} \Big]^{1/3} \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \\*&\quad \quad \quad\quad\quad \times \Big\{ \rho_{\sigma}(|\pi|)^{2} \Big( 1 + \mathbb{E}\Big[ \sup_{s \in [0,T]}\big|X(s)\big|^{6} \Big]^{1/3} \Big) + \mathbb{E}\Big[ \sup_{s \in [t_{\ell},t_{\ell+1}]} \big| X(s) - X(t_{\ell}) \big|^{6} \Big]^{1/3} \Big\} \\*&\leq C(1+|x|^{2}) \big\{ |\pi| + \rho_{\sigma}(|\pi|)^{2} \big\}. \end{align*} \emph{The sum of $I_{k,\ell}^{(1)}$ for $k=\ell$.} By using the estimates \eqref{Lem_SDE_1_0}, \eqref{Lem_SDE_1_1}, \eqref{Lem_SDE_0_3} and \eqref{Lem_Lp_1_1}, we have \begin{align*} & \sum_{k=0}^{N-1} \Delta t_{k} I_{k,k}^{(1)} = \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(s))^{-1} \big|^{2} \big| \sigma(s,X(s)) - \sigma(t_{k},X(t_{k})) \big|^{2} \,\mathrm{d} s \Big] \\&\leq C \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{0}^{T} \big| \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \\&\quad \quad \quad\quad\quad\quad\quad\quad \times \Big\{ \rho_{\sigma}(|\pi|)^{2} \Big( 1 + \sup_{s \in [0,T]}|X(s)|^{2} \Big) + \sup_{s \in [t_{k},t_{k+1}]} \big| X(s) - X(t_{k}) \big|^{2} \Big\} \Big] \\&\leq C \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \Big( \int_{0}^{T} \big| \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{3} \Big]^{1/3} \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \\&\quad \quad \quad\quad\quad \times \Big\{ \rho_{\sigma}(|\pi|)^{2} \Big( 1 + \mathbb{E}\Big[ \sup_{s \in [0,T]}|X(s)|^{6} \Big]^{1/3} \Big) + \mathbb{E}\Big[ \sup_{s \in [t_{k},t_{k+1}]} \big| X(s) - X(t_{k}) \big|^{6} \Big]^{1/3} \Big\} \\&\leq C(1+|x|^{2}) \big\{ |\pi| + \rho_{\sigma}(|\pi|)^{2} \big\}. \end{align*} \emph{The sum of $I_{k,\ell}^{(1)}$ for $k<\ell$.} By using the estimates \eqref{Lem_SDE_1_0}, \eqref{Lem_SDE_1_1}, \eqref{Lem_SDE_0_3} and \eqref{Lem_Lp_1_2}, we have \begin{align*} & \sum_{k=0}^{N-2}\Delta t_{k} \sum_{\ell=k+1}^{N-1} I_{k,\ell}^{(1)} = \sum_{k=0}^{N-2}\Delta t_{k} \sum_{\ell=k+1}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(s))^{-1} \big|^{2} \big| \sigma(s,X(s)) - \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \\&\leq \sum_{k=0}^{N-2}\! \Delta t_{k}\! \sum_{\ell=k+1}^{N-1}\! \int_{t_{\ell}}^{t_{\ell+1}}\! \mathbb{E} \Big[ \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) \big|^{6} \Big]^{1/3} \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \mathbb{E}\Big[ \big| \sigma(s,X(s)) - \sigma(t_{\ell},X(t_{\ell})) \big|^{6} \Big]^{1/3} \,\mathrm{d} s \\&\leq C \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \sup_{\theta \in [t_{k+1},T]} \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},s) \big|^{6} \Big]^{1/3} \mathbb{E} \Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \\&\hspace{4cm}\times \Big\{ \rho_{\sigma}(|\pi|)^{2} \Big( 1 + \mathbb{E}\Big[ \sup_{s \in [0,T]}|X(s)|^{6} \Big]^{1/3} \Big) + \mathbb{E}\Big[ \sup_{s \in [t_{\ell},t_{\ell+1}]} \big| X(s) - X(t_{\ell}) \big|^{6} \Big]^{1/3} \Big\} \\&\leq C(1+|x|^{2}) \big\{ |\pi| + \rho_{\sigma}(|\pi|)^{2} \big\}. \end{align*} Thus, we get \begin{align}\label{Thm_L2_0_6} \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} I_{k,\ell}^{(1)} &\leq C(1+|x|^{2}) \big\{ |\pi| + \rho_{\sigma}(|\pi|)^{2} \big\}. \end{align} By the same way as above, noting the estimate \eqref{Lem_SDE_0_4}, we can show that \begin{align}\label{Thm_L2_0_7} \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} I_{k,\ell}^{(2)} &\leq C(1+|x|^{2})|\pi|. \end{align} It remains to estimate $\sum_{k=0}^{N-1}\Delta t_{k}\sum_{\ell=0}^{N-1}I_{k,\ell}^{(3)}$. Again we divide the sum into three cases: $k>\ell$, $k=\ell$ and $k<\ell$. \emph{The sum of $I_{k,\ell}^{(3)}$ for $k>\ell$.} By using Lemma \ref{Lem_Lp_0}, we have \begin{align*} &\sum_{k=1}^{N-1} \Delta t_{k} \sum_{\ell=0}^{k-1} I_{k,\ell}^{(3)} = \sum_{k=1}^{N-1} \Delta t_{k} \sum_{\ell=0}^{k-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{\ell}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \\&= \sum_{k=1}^{N-1} \Delta t_{k} \sum_{\ell=0}^{k-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{0}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{0}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \\*&\leq |\pi| \sum_{k=1}^{N-1} \Delta t_{k} \sum_{\ell=0}^{k-1} \sup_{s \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \big| \nabla_{0}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{0}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big]. \end{align*} Observe that, for any $k=0,\ldots,N-1$, $\ell=0,\ldots,k$ and $s \in [t_{\ell},t_{\ell+1}]$, \begin{align}\label{eq_YZ_0} \begin{split} &\mathbb{E} \Big[ \big| \nabla_{0}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{0}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big] \\&= \mathbb{E} \Big[ \Big| \int_{t_{\ell}}^{s} \nabla_{0}\mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r) \Big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big] \\&= \mathbb{E} \Big[ \int_{t_{\ell}}^{s} \big| \nabla_{0}\mathscr{Z}^{\pi}(t_{k},r) \big|^{2} \,\mathrm{d} r \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big]. \end{split} \end{align} Thus, by using the estimates \eqref{Lem_SDE_1_0}, \eqref{Lem_SDE_0_3} and \eqref{Lem_Lp_1_0}, we have \begin{align*} &\sum_{k=1}^{N-1} \Delta t_{k} \sum_{\ell=0}^{k-1} I_{k,\ell}^{(3)} \\&\leq |\pi| \sum_{k=1}^{N-1} \Delta t_{k} \sum_{\ell=0}^{k-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{0}\mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big] \\&\leq C |\pi| \mathbb{E} \Big[ \sum_{k=1}^{N-1} \Delta t_{k} \int_{0}^{t_{k}} \big| \nabla_{0}\mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \Big( 1 + \sup_{s \in [0,T]} \big|X(s)\big|^{2} \Big) \Big] \\&\leq C|\pi| \mathbb{E} \Big[ \Big( \int_{0}^{T} \int_{0}^{T} \big| \nabla_{0}\mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{3} \Big]^{1/3} \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \Big( 1+ \mathbb{E}\Big[ \sup_{s \in [0,T]} \big|X(s)\big|^{6} \Big]^{1/3} \Big) \\&\leq C(1+|x|^{2})|\pi|. \end{align*} \emph{The sum of $I_{k,\ell}^{(3)}$ for $k=\ell$.} By using Lemma \ref{Lem_Lp_0}, we have \begin{align*} &\sum_{k=0}^{N-1} \Delta t_{k} I_{k,k}^{(3)} = \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k}}\mathscr{Y}^{\pi}(t_{k},t_{k}) \big|^{2} \big| (\nabla X(t_{k}))^{-1} \big|^{2} \big| \sigma(t_{k},X(t_{k})) \big|^{2} \,\mathrm{d} s \Big] \\& = \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{0}\mathscr{Y}^{\pi}(t_{k},t_{k}) \big|^{2} \big| (\nabla X(t_{k}))^{-1} \big|^{2} \big| \sigma(t_{k},X(t_{k})) \big|^{2} \,\mathrm{d} s \Big] \\&\leq 3 \Big\{ \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(t_{k}))^{-1} \big|^{2} \big| \sigma(t_{k},X(t_{k})) \big|^{2} \,\mathrm{d} s \Big] \\&\quad\quad\quad+ \sum_{k=1}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{0}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(t_{k}))^{-1} \big|^{2} \big| \sigma(t_{k},X(t_{k})) \big|^{2} \,\mathrm{d} s \Big] \\&\quad \quad\quad+ \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{0}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{0}\mathscr{Y}^{\pi}(t_{k},t_{k}) \big|^{2} \big| (\nabla X(t_{k}))^{-1} \big|^{2} \big| \sigma(t_{k},X(t_{k})) \big|^{2} \,\mathrm{d} s \Big] \Big\}. \end{align*} By using the equality \eqref{eq_YZ_0}, together with the estimates \eqref{Lem_SDE_1_0}, \eqref{Lem_SDE_0_3}, \eqref{Lem_Lp_1_0} and \eqref{Lem_Lp_1_1}, we have \begin{align*} \sum_{k=0}^{N-1} \Delta t_{k} I_{k,k}^{(3)} &\leq C|\pi| \Big\{ \mathbb{E} \Big[ \int_{0}^{T} \big| \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \Big( 1 + \sup_{s \in [0,T]} \big| X(s) \big|^{2} \Big) \Big] \\&\quad\quad\quad\quad + \mathbb{E} \Big[ \int_{0}^{T} \big| \nabla_{0}\mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \Big( 1 + \sup_{s \in [0,T]} \big| X(s) \big|^{2} \Big) \Big] \\&\quad\quad\quad\quad + \sum_{k=0}^{N-1} \Delta t_{k} \mathbb{E} \Big[ \int_{t_{k}}^{t_{k+1}} \big| \nabla_{0}\mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \Big( 1 + \sup_{s \in [0,T]} \big| X(s) \big|^{2} \Big) \Big] \Big\} \\&\leq C|\pi| \Big\{ \mathbb{E} \Big[ \Big( \int_{0}^{T} \big| \nabla_{t}\mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{3} \Big]^{1/3} + \mathbb{E} \Big[ \Big( \int_{0}^{T} \big| \nabla_{0}\mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{3} \Big]^{1/3} \\*&\quad\quad\quad\quad\quad\quad\quad + \mathbb{E} \Big[ \Big( \int_{0}^{T} \int_{0}^{T} \big| \nabla_{0}\mathscr{Z}^{\pi}(\tau(t),s) \big|^{2} \,\mathrm{d} s \,\mathrm{d} t \Big)^{3} \Big]^{1/3} \Big\} \\*&\quad \times \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \Big( 1+ \mathbb{E}\Big[ \sup_{s \in [0,T]} \big|X(s)\big|^{6} \Big]^{1/3} \Big) \\&\leq C(1+|x|^{2})|\pi|. \end{align*} \emph{The sum of $I_{k,\ell}^{(3)}$ for $k<\ell$.} By using the estimates \eqref{Lem_SDE_1_0}, \eqref{Lem_SDE_0_3} and \eqref{Lem_Lp_1_3}, we have \begin{align*} &\sum_{k=0}^{N-2} \Delta t_{k}\! \sum_{\ell=k+1}^{N-1}\! I_{k,\ell}^{(3)} = \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{\ell}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \\&\leq 3 \Big\{ \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{s}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},s) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \\&\quad\quad+ \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \mathbb{E} \Big[ \big| \nabla_{t_{\ell}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) - \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big] \\&\quad\quad+ \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \mathbb{E} \Big[ \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \,\mathrm{d} s \Big] \Big\} \\&\leq C \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \Delta t_{\ell} \sup_{\theta \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \sup_{s \in [t_{\ell},T]} \big| \nabla_{\theta}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},s) \big|^{6} \Big]^{1/3} \\&\quad\quad\quad\quad\quad\quad\quad\quad \times \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \Big( 1+ \mathbb{E}\Big[ \sup_{s \in [0,T]} \big|X(s)\big|^{6} \Big]^{1/3} \Big) \\&\quad+ 3 |\pi| \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \sup_{s \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \big| \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big] \\&\leq C(1+|x|^{2})|\pi| \\&\quad+ 3 |\pi| \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \sup_{s \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \big| \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big]. \end{align*} We estimate the last sum in the above inequalities. By using Lemma \ref{Lem_Lp_0}, together with the estimates \eqref{Lem_SDE_1_0}, \eqref{Lem_SDE_0_3}, \eqref{Lem_Lp_1_0} and \eqref{Lem_Lp_1_2}, we have \begin{align*} & \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \sup_{s \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \big| \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},s) - \nabla_{t_{k+1}}\mathscr{Y}^{\pi}(t_{k},t_{\ell}) \big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big] \\*&= \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \sup_{s \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \Big| - \int_{t_{\ell}}^{s} \Big\{ g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{t_{k+1}} \mathscr{Y}^{\pi}(t_{\ell},r) \\&\hspace{1cm} + \sum_{\alpha=1}^{d} g_{z_{1}^{(\alpha)}}(t_{k},r) \nabla_{t_{k+1}} \mathscr{Z}^{\pi,(\alpha)}(t_{k},r) \Big\} \,\mathrm{d} r + \int_{t_{\ell}}^{s} \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r) \Big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big] \\&= \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \sup_{s \in [t_{\ell},t_{\ell+1}]} \mathbb{E} \Big[ \Big| - \int_{t_{\ell}}^{s} \Big\{ g_{x_{2}}(t_{k},r) \nabla X(r) + g_{y}(t_{k},r) \nabla_{0} \mathscr{Y}^{\pi}(t_{\ell},r) \\&\hspace{1cm} + \sum_{\alpha=1}^{d} g_{z_{1}^{(\alpha)}}(t_{k},r) \nabla_{t_{k+1}} \mathscr{Z}^{\pi,(\alpha)}(t_{k},r) \Big\} \,\mathrm{d} r + \int_{t_{\ell}}^{s} \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},r) \,\mathrm{d} W(r) \Big|^{2} \big| (\nabla X(t_{\ell}))^{-1} \big|^{2} \big| \sigma(t_{\ell},X(t_{\ell})) \big|^{2} \Big] \\&\leq C \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} \mathbb{E} \Big[ \Big\{ (\Delta t_{\ell})^{2} \sup_{s \in [0,T]} \big| \nabla X(s) \big|^{2} + \Delta t_{\ell} \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{0} \mathscr{Y}^{\pi}(t_{\ell},r) \big|^{2} \,\mathrm{d} r \\&\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad + (1+\Delta t_{\ell}) \int_{t_{\ell}}^{t_{\ell+1}} \big| \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},r) \big|^{2} \,\mathrm{d} r \Big\} \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \Big( 1 + \sup_{s \in [0,T]} \big| X(s) \big|^{2} \Big) \Big] \\&\leq C \mathbb{E}\Big[ \Big\{ |\pi| \sup_{s \in [0,T]} \big| \nabla X(s) \big|^{2} + |\pi| \int_{0}^{T} \big| \nabla_{0} \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t + \sum_{k=0}^{ N-2} \Delta t_{k} \int_{t_{k+1}}^{T} \big| \nabla_{t_{k+1}} \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big\} \\&\quad\quad\quad\quad\quad \times \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{2} \Big( 1 + \sup_{s \in [0,T]} \big| X(s) \big|^{2} \Big) \Big] \\&\leq C \Big\{ |\pi| \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| \nabla X(s) \big|^{6} \Big]^{1/3} + |\pi| \mathbb{E}\Big[ \Big( \int_{0}^{T} \big| \nabla_{0} \mathscr{Y}^{\pi}(\tau(t),t) \big|^{2} \,\mathrm{d} t \Big)^{3} \Big]^{1/3} \\&\quad\quad\quad\quad + \max_{k=0,\ldots,N-2} \sup_{\theta \in [t_{k+1},T]} \mathbb{E}\Big[ \Big( \int_{0}^{T} \big| \nabla_{\theta} \mathscr{Z}^{\pi}(t_{k},s) \big|^{2} \,\mathrm{d} s \Big)^{3} \Big]^{1/3} \Big\} \\&\quad\quad\quad \times \mathbb{E}\Big[ \sup_{s \in [0,T]} \big| (\nabla X(s))^{-1} \big|^{6} \Big]^{1/3} \Big( 1+ \mathbb{E}\Big[ \sup_{s \in [0,T]} \big|X(s)\big|^{6} \Big]^{1/3} \Big) \\&\leq C(1+|x|^{2}). \end{align*} Thus, we get \begin{align*} \sum_{k=0}^{N-2} \Delta t_{k} \sum_{\ell=k+1}^{N-1} I_{k,\ell}^{(3)} &\leq C(1+|x|^{2})|\pi|. \end{align*} Consequently, it holds that \begin{align}\label{Thm_L2_0_8} \sum_{k=0}^{N-1} \Delta t_{k} \sum_{\ell=0}^{N-1} I_{k,\ell}^{(3)} &\leq C(1+|x|^{2})|\pi|. \end{align} From \eqref{Thm_L2_0_5}, \eqref{Thm_L2_0_6}, \eqref{Thm_L2_0_7} and \eqref{Thm_L2_0_8}, we obtain \eqref{Thm_L2_0_0}, and we finish the proof. \end{proof} We provide proofs of our main results. \begin{proof}[Proof of Theorem~\ref{Thm_1}] We observe that, under the assumptions $(\mathrm{H}_{\psi,g})$ and $(\mathrm{H}_{b,\sigma})$, the coefficients $(\Psi,G)$ defined by \begin{align}\label{proof_1} \begin{split} &\Psi(t) = \psi(t,X(t),X(T)),~t \in [0,T],\\ &G (t,s,y,z_{1},z_{2}) = g ( t, s, X(t), X(s), y, z_{1}, z_{2} ),~ (t,s,y,z_{1},z_{2}) \in \Delta[0,T] \times \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d}, \end{split} \end{align} satisfy $(\mathrm{H}_{\Psi,G})$ with $M$ replaced by $C\sqrt{1+|x|^2}$ and $\rho_{\Psi,G}(t)$ replaced by $\sqrt{t}+\rho_{\psi,g}(t)$. Thus, by Corollary~\ref{Cor_0}, for any $\pi=\{t_0,t_1,\ldots,t_N\}\in\Pi[0,T]$, it holds that \begin{align*} \mathcal{E}(Y;\pi)+\mathcal{E}(Z;\pi) &\leq C\Bigl\{\bigl(1+|x|^2\bigr)\bigl(|\pi|+\rho_{\psi,g}(|\pi|)^2\bigr)+\sum^{N-1}_{k=0}\Delta t_k\mathbb{E}\Bigl[\int^{t_{k+1}}_{t_k}\big|\mathscr{Z}^\pi(t_k,s)\big|^2\,\mathrm{d} s\Bigr]\\* &\hspace{1cm}+\sum^{N-1}_{k=0}\Delta t_k\sum^{N-1}_{\ell=0}\mathbb{E}\Bigl[\int^{t_{\ell+1}}_{t_\ell}\big|\mathscr{Z}^\pi(t_k,s)-\overline{\mathscr{Z}}^\pi(t_k,t_\ell)\big|^2\,\mathrm{d} s\Bigr]\Bigr\}. \end{align*} Therefore, by Theorem~\ref{Thm_L2_0}, we get the assertions. \end{proof} \begin{proof}[Proof of Theorem~\ref{Thm_2}] Under the assumptions $(\mathrm{H}_{\psi,g})'$ and $(\mathrm{H}_{b,\sigma})'$, $(\Psi,G)$ defined by \eqref{proof_1}, together with $(\Psi^\pi,G^\pi)$ defined by \begin{align*} &\Psi^{\pi}(t_{k}) = \psi(t_{k},X^{\pi}(t_{k}),X^{\pi}(t_{N})),~ k=0,\ldots,N-1, \\ &G^{\pi}(t_{k},t_{\ell},y,z_{1},z_{2}) = g(t_{k},t_{\ell},X^{\pi}(t_{k}),X^{\pi}(t_{\ell}), y, z_{1}, z_{2}),\\ & \hspace{2cm} (y,z_{1},z_{2}) \in \mathbb{R}^{m} \times \mathbb{R}^{m \times d} \times \mathbb{R}^{m \times d},~ k=0,\ldots,N-1,~\ell=k,\ldots,N-1, \end{align*} satisfy $(\mathrm{H}_{\Psi,G})'$ with $M$ replaced by $C\sqrt{1+|x|^2}$. Thus, by Proposition~\ref{Prop_EM_1}, for any $\pi=\{t_0,t_1,\ldots,t_N\}\in\Pi[0,T]$ with $|\pi|\leq\delta$, it holds that \begin{align*} &\sum^{N-1}_{k=0} \mathbb{E}\Bigl[\int^{t_{k+1}}_{t_k}\big|Y(t)-Y^\pi(t_k,t_k)\big|^2\,\mathrm{d} t + \sum^{N-1}_{k=0}\sum^{N-1}_{\ell=0} \mathbb{E}\Bigl[\int^{t_{k+1}}_{t_k}\int^{t_{\ell+1}}_{t_\ell}\big|Z(t,s)-Z^\pi(t_k,t_\ell)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr]\\ &\leq C\Bigl\{\bigl(1+|x|^2\bigr)|\pi| +\sum^{N-1}_{k=0}\Delta t_k \mathbb{E}\Bigl[\int^{t_{k+1}}_{t_k}\big|\mathscr{Z}^\pi(t_k,s)\big|^2\,\mathrm{d} s\Bigr]\\ &\hspace{2cm}+\sum^{N-1}_{k=0}\Delta t_k\sum^{N-1}_{\ell=0}\mathbb{E}\Bigl[\int^{t_{\ell+1}}_{t_\ell}\big|\mathscr{Z}^\pi(t_k,s)-\overline{\mathscr{Z}}^\pi(t_k,t_\ell)\big|^2\,\mathrm{d} s\Bigr]\Bigr\}. \end{align*} Noting that $\rho_\sigma(t)=L\sqrt{t}$, by Theorem~\ref{Thm_L2_0}, we get the assertion. \end{proof} \begin{appendix} \section{Appendix: $L^{p}$-a priori estimates}\label{sec_Appendix} In this appendix, we provide a proof of Theorem \ref{Lem_Lp}. First, we show the following lemma. \begin{lemm}\label{lemma_A} Assume that $(\mathcal{H},\mathcal{G})$ satisfies the conditions (\rnum{1}), (\rnum{2}) and (\rnum{3}) in $\mathrm{(H}_{\Psi,G}\mathrm{)}$ with $(\Psi,G)=(\mathcal{H},\mathcal{G})$, and that $\mathcal{H}$ and $\mathcal{G}$ are bounded. Suppose that a triplet \begin{equation*} (\mathcal{Y}(\cdot,\cdot),\mathcal{Z}(\cdot,\cdot),\zeta(\cdot,\cdot))\in L^2(0,T;L^2_\mathbb{F}(\Omega;C([0,T];\mathbb{R}^m)))\times L^2(0,T;L^2_\mathbb{F}(0,T;\mathbb{R}^{m\times d}))\times L^2(0,T;L^2_\mathbb{F}(0,T;\mathbb{R}^{m\times d})) \end{equation*} satisfies \begin{equation}\label{A_*} \begin{split} &\mathcal{Y}(t,s)=\mathcal{H}(t)+\int^T_s\mathcal{G}(t,r,\mathcal{Y}(r,r),\mathcal{Z}(t,r),\zeta(t,r))\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(r)\,\mathrm{d} r-\int^T_s\mathcal{Z}(t,r)\,\mathrm{d} W(r),\\ &\hspace{5cm}s\in[0,T],\ \text{a.e.}\ t\in[0,T], \text{a.s.}, \end{split} \end{equation} and \begin{equation}\label{A_**} \int^s_0\big|\zeta(t,s)\big|^2\,\mathrm{d} t\leq\int^s_0\big|\mathcal{Z}(s,t)\big|^2\,\mathrm{d} t,\ \text{a.e.}\ s\in[0,T],\ \text{a.s.} \end{equation} Then for any $p\geq2$, it holds that \begin{equation}\label{A_***} \begin{split} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\Bigl(\int^T_0\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_t\big|\mathcal{G}(t,s,0,0,0)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{split} \end{equation} \end{lemm} \begin{proof} For simplicity of notation, we let $m=d=1$. The proof can be easily generalized to the multi-dimensional case. We fix $p\geq2$ and prove the estimate \eqref{A_***}. By taking conditional expectations on both sides of \eqref{A_*}, we get \begin{equation*} \mathcal{Y}(t,s)=\mathbb{E}_s\Bigl[\mathcal{H}(t)+\int^T_s\mathcal{G}(t,r,\mathcal{Y}(r,r),\mathcal{Z}(t,r),\zeta(t,r))\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(r)\,\mathrm{d} r\Bigr],\ s\in[0,T],\ \text{a.e.}\ t\in[0,T],\ \text{a.s.} \end{equation*} Since $\mathcal{H}$ and $\mathcal{G}$ are bounded, we see that $\mathcal{Y}(\cdot,\cdot)$ is bounded. Again by \eqref{A_*} and the Burkholder--Davis--Gundy inequality, we see that \begin{equation*} \underset{t\in[0,T]}{\mathrm{ess\,sup}}\,\mathbb{E}\Bigl[\Bigl(\int^T_0\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\Bigr)^{p/2}\Bigr]<\infty. \end{equation*} We investigate some key dynamics. Fix an arbitrary constant $\lambda>0$. Noting \eqref{A_*}, by using It\^{o}'s formula for $s\mapsto e^{\lambda s}|\mathcal{Y}(t,s)|^2$ on $[t,T]$ for each fixed $t\in[0,T]$, we get \begin{equation}\label{A_1} \begin{split} e^{\lambda s}\big|\mathcal{Y}(t,s)\big|^2 &=e^{\lambda T}\big|\mathcal{H}(t)\big|^2\\ &\quad+\int^T_s\bigl\{-\lambda e^{\lambda r}\big|\mathcal{Y}(t,r)\big|^2+2e^{\lambda r}\mathcal{Y}(t,r)\mathcal{G}(t,r,\mathcal{Y}(r,r),\mathcal{Z}(t,r),\zeta(t,r))-e^{\lambda r}\big|\mathcal{Z}(t,r)\big|^2\bigr\}\,\mathrm{d} r\\ &\quad-\int^T_s2e^{\lambda r}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} W(r),\ s\in[t,T],\ \text{a.e.}\ t\in[0,T]. \end{split} \end{equation} In particular, we have \begin{equation}\label{A_2} \begin{split} e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2 &=e^{\lambda T}\big|\mathcal{H}(t)\big|^2\\ &\quad+\int^T_t\bigl\{-\lambda e^{\lambda s}\big|\mathcal{Y}(t,s)\big|^2+2e^{\lambda s}\mathcal{Y}(t,s)\mathcal{G}(t,s,\mathcal{Y}(s,s),\mathcal{Z}(t,s),\zeta(t,s))-e^{\lambda s}\big|\mathcal{Z}(t,s)\big|^2\bigr\}\,\mathrm{d} s\\ &\quad-\int^T_t2e^{\lambda s}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} W(s),\ \text{a.e.}\ t\in[0,T]. \end{split} \end{equation} Also, by using It\^o's formula for $s \mapsto |\mathcal{Y}(t,s)|^{2}$ on $[0,t]$ for each fixed $t \in [0,T]$, we have \begin{equation}\label{A_3} \big|\mathcal{Y}(t,s)\big|^2 =\big|\mathcal{Y}(t,t)\big|^2 - \int^t_s\big|\mathcal{Z}(t,r)\big|^2\,\mathrm{d} r - \int^t_s2\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} W(r),\ s\in[0,t],\ \text{a.e.}\ t\in[0,T], \end{equation} and thus \begin{equation}\label{A_Z} \int^t_0\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\leq\big|\mathcal{Y}(t,t)\big|^2-\int^t_02\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} W(s),\ \text{a.e.}\ t\in[0,T]. \end{equation} Combining \eqref{A_1}, \eqref{A_2} and \eqref{A_3}, we obtain \begin{equation}\label{A_4} \begin{split} e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|^2&=e^{\lambda T}\big|\mathcal{H}(t)\big|^2\\ &\quad+\int^T_s\bigl\{-\lambda e^{\lambda r}\big|\mathcal{Y}(t,r)\big|^2+2e^{\lambda r}\mathcal{Y}(t,r)\mathcal{G}(t,r,\mathcal{Y}(r,r),\mathcal{Z}(t,r),\zeta(t,r))\bigr\}\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(r)\,\mathrm{d} r\\ &\quad-\int^T_se^{\lambda(t\vee r)}\big|\mathcal{Z}(t,r)\big|^2\,\mathrm{d} r\\ &\quad-\int^T_s2e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} W(r),\ s\in[0,T],\ \text{a.e.}\ t\in[0,T]. \end{split} \end{equation} By integrating both sides of \eqref{A_2} and \eqref{A_4} with respect to $t\in[0,T]$, and by using (stochastic) Fubini's theorem (cf.\ Theorem 4.A in \cite{BeMi80}), we get \begin{equation}\label{A_5} \begin{split} \int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t&=e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\\ &\quad+\int^T_0\int^s_0 \bigl\{ -\lambda e^{\lambda s}\big|\mathcal{Y}(t,s)\big|^2+2e^{\lambda s}\mathcal{Y}(t,s)\mathcal{G}(t,s,\mathcal{Y}(s,s),\mathcal{Z}(t,s),\zeta(t,s))\\ &\hspace{2.5cm}-e^{\lambda s}\big|\mathcal{Z}(t,s)\big|^2 \bigr\}\,\mathrm{d} t\,\mathrm{d} s\\ &\quad-\int^T_0\int^s_02e^{\lambda s}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\,\mathrm{d} W(s) \end{split} \end{equation} and \begin{align* \int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t&=e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\\* &\quad+\int^T_s\int^r_0\bigl\{-\lambda e^{\lambda r}\big|\mathcal{Y}(t,r)\big|^2+2e^{\lambda r}\mathcal{Y}(t,r)\mathcal{G}(t,r,\mathcal{Y}(r,r),\mathcal{Z}(t,r),\zeta(t,r))\bigr\}\,\mathrm{d} t\,\mathrm{d} r\\* &\quad-\int^T_s\int^T_0e^{\lambda(t\vee r)}\big|\mathcal{Z}(t,r)\big|^2\,\mathrm{d} t\,\mathrm{d} r\\ &\quad-\int^T_s\int^T_02e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\,\mathrm{d} W(r),\ s\in[0,T]. \end{align*} For any $\varepsilon>0$, define $\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s):=\int_{0}^{T} e^{\lambda (t\vee s)}\big|\mathcal{Y}(t,s)\big|^{2}\,\mathrm{d} t+\varepsilon$, $s \in [0,T]$. We note that the process $\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(\cdot)$ is an It\^{o} process with the terminal condition $\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(T)=e^{\lambda T}\int^T_0|\mathcal{H}(t)|^2\,\mathrm{d} t+\varepsilon$. Thus, by using It\^{o}'s formula for $s\mapsto (\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s))^{p/2}$, we obtain \begin{align*} \bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2} &= \Bigl( e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2}\\ &\quad+ \int^T_s\frac{p}{2}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1} \int^r_0\bigl\{-\lambda e^{\lambda r}\big|\mathcal{Y}(t,r)\big|^2+2e^{\lambda r}\mathcal{Y}(t,r)\mathcal{G}(t,r,\mathcal{Y}(r,r),\mathcal{Z}(t,r),\zeta(t,r))\bigr\}\,\mathrm{d} t\,\mathrm{d} r\\ &\quad-\int^T_s\frac{p}{2}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}\int^T_0e^{\lambda(t\vee r)}\big|\mathcal{Z}(t,r)\big|^2\,\mathrm{d} t\,\mathrm{d} r\\ &\quad-\int^T_s\frac{p}{4}\Bigl(\frac{p}{2}-1\Bigr)\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-2}\Bigl|\int^T_02e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} r\\ &\quad-\int^T_s\frac{p}{2}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}\int^T_02e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\,\mathrm{d} W(r),~ s\in[0,T], \end{align*} and thus \begin{equation}\label{A_7} \begin{split} &\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2} + \frac{p\lambda}{2}\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}e^{\lambda r}\int^r_0\big|\mathcal{Y}(t,r)\big|^2\,\mathrm{d} t\,\mathrm{d} r +\frac{p}{2}\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}\int^T_0e^{\lambda(t\vee r)}\big|\mathcal{Z}(t,r)\big|^2\,\mathrm{d} t\,\mathrm{d} r\\ &+p\Bigl(\frac{p}{2}-1\Bigr)\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-2}\Bigl|\int^T_0e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} r\\ &=\Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2} +\frac{p}{2}\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}e^{\lambda r}\int^r_02\mathcal{Y}(t,r)\mathcal{G}(t,r,\mathcal{Y}(r,r),\mathcal{Z}(t,r),\zeta(t,r))\,\mathrm{d} t\,\mathrm{d} r\\ &\quad-p\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}\int^T_0e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\,\mathrm{d} W(r),\ s\in[0,T]. \end{split} \end{equation} By using the above dynamics, we prove \emph{Claim 1} and \emph{Claim 2} below. In the following, we use the notation $\mathcal{G}_0(t,s):=\mathcal{G}(t,s,0,0,0)$. \paragraph{} \emph{Claim 1}. For any constant $\lambda\geq1+2L^{2}(2T+3)$, it holds that \begin{align*} &\mathbb{E}\Bigl[\Bigl(\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[e^{p\lambda T/2}\Bigl(\int^T_0\big|\mathcal{H}(t)\big|^2 \,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}+\sup_{s\in[0,T]}\Bigl(\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} \emph{Proof of Claim 1}. Fix arbitrary constants $\mu,\lambda>0$. By the Lipschitz continuity of $\mathcal{G}$ and Young's inequality, it holds that \begin{equation}\label{A_Young} \begin{split} &2\mathcal{Y}(t,s)\mathcal{G}(t,s,\mathcal{Y}(s,s),\mathcal{Z}(t,s),\zeta(t,s))\\ &\leq\bigl(1+2\mu L^{2}+2L^{2}\bigr)\big|\mathcal{Y}(t,s)\big|^2+\big|\mathcal{G}_0(t,s)\big|^2+\frac{1}{\mu}\big|\mathcal{Y}(s,s)\big|^2+\frac{1}{2}\big|\mathcal{Z}(t,s)\big|^2+\frac{1}{\mu}\big|\zeta(t,s)\big|^2 \end{split} \end{equation} for any $(t,s)\in\Delta[0,T]$. Thus, by \eqref{A_5}, for any $\mu,\lambda>0$, it holds that \begin{align*} \int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t &\leq e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\\* &\quad+\int^T_0e^{\lambda s}\Bigl\{\bigl(1+2\mu L^{2}+2L^{2}-\lambda\bigr)\int^s_0\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t-\frac{1}{2}\int^s_0\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} t\\* &\hspace{2.5cm}+\int^s_0\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} t+\frac{T}{\mu}\big|\mathcal{Y}(s,s)\big|^2+\frac{1}{\mu}\int^s_0\big|\zeta(t,s)\big|^2\,\mathrm{d} t\Bigr\}\,\mathrm{d} s\\ &\quad-\int^T_0\int^s_02e^{\lambda s}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\,\mathrm{d} W(s). \end{align*} By the assumption \eqref{A_**}, together with \eqref{A_Z}, we have \begin{equation*} \int^s_0\big|\zeta(t,s)\big|^2\,\mathrm{d} t\leq\int^s_0\big|\mathcal{Z}(s,t)\big|^2\,\mathrm{d} t\leq \big|\mathcal{Y}(s,s)\big|^2-\int^s_02\mathcal{Y}(s,t)\mathcal{Z}(s,t)\,\mathrm{d} W(t),\ \text{a.e.}\ s\in[0,T]. \end{equation*} Hence, by the stochastic Fubini's theorem, we obtain \begin{align*} \int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t &\leq e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\\ &\quad+\int^T_0e^{\lambda s}\Bigl\{\bigl(1+2\mu L^{2}+2L^{2}-\lambda\bigr)\int^s_0\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t-\frac{1}{2}\int^s_0\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} t\\ &\hspace{2.5cm}+\int^s_0\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} t+\frac{T+1}{\mu}\big|\mathcal{Y}(s,s)\big|^2\Bigr\}\,\mathrm{d} s\\ &\quad-\int^T_0\Bigl\{2\int^s_0 e^{\lambda s} \mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t+\frac{2}{\mu}\int^T_se^{\lambda t}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr\}\,\mathrm{d} W(s). \end{align*} We set $\mu=2(T+1)$. Then for any $\lambda\geq1+2\mu L^{2}+2L^{2}=1+2L^{2}(2T+3)$, we have \begin{align*} &\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t+\int^T_0\int^T_te^{\lambda s}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\\ &\leq2e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+2\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\\ &\hspace{0.5cm}-\int^T_0\Bigl\{4\int^s_0 e^{\lambda s}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t+\frac{2}{T+1}\int^T_se^{\lambda t}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr\}\,\mathrm{d} W(s). \end{align*} Furthermore, again by \eqref{A_Z} and the stochastic Fubini's theorem, \begin{align*} &\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t+\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\\ &=\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t+\int^T_0\int^T_te^{\lambda s}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t+\int^T_0e^{\lambda t}\int^t_0\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\\ &\leq2\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t+\int^T_0\int^T_te^{\lambda s}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t-\int^T_0e^{\lambda t}\int^t_02\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} W(s)\,\mathrm{d} t\\ &\leq4e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+4\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\\ &\hspace{0.5cm}-\int^T_0\Bigl\{8\int^s_0 e^{\lambda s} \mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t+\Bigl(\frac{4}{T+1}+2\Bigr)\int^T_se^{\lambda t}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr\}\,\mathrm{d} W(s). \end{align*} By using the Burkholder--Davis--Gundy inequality, H\"{o}lder's inequality and Young's inequality, we see that \begin{align*} &\mathbb{E}\Bigl[\Bigl(\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\* &\leq C_p\mathbb{E}\Bigl[e^{p\lambda T/2}\Bigl(\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\ &\hspace{2cm}+\Bigl(\int^T_0\Bigl(\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|\big|\mathcal{Z}(t,s)\big|\,\mathrm{d} t\Bigr)^2\,\mathrm{d} s\Bigr)^{p/4}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[e^{p\lambda T/2}\Bigl(\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\ &\hspace{2cm}+\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} t\,\mathrm{d} s\Bigr)^{p/4}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[e^{p\lambda T/2}\Bigl(\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\ &\hspace{2cm}+\sup_{s\in[0,T]}\Bigl(\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/4}\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/4}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[e^{p\lambda T/2}\Bigl(\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}+\sup_{s\in[0,T]}\Bigl(\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\hspace{0.5cm}+\frac{1}{2}\mathbb{E}\Bigl[\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} Noting that \begin{equation*} \mathbb{E}\Bigl[\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\leq T^{p/2}e^{p\lambda T/2}\,\underset{t\in[0,T]}{\mathrm{ess\,sup}}\,\mathbb{E}\Bigl[\Bigl(\int^T_0\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\Bigr)^{p/2}\Bigr]<\infty, \end{equation*} we get the assertion of \emph{Claim 1}. \paragraph{} \emph{Claim 2}. For any constants $\mu,\lambda>0$ with $\lambda\geq1+2\mu L^{2}+2L^{2}$, it holds that \begin{align*} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\Bigl(\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[e^{p\lambda T/2}\Bigl(\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\ &\hspace{2cm}+\frac{1}{\mu^{p/2}}\Bigl(\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\frac{1}{\mu^{p/2}}\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} \emph{Proof of Claim 2}. Fix arbitrary constants $\mu,\lambda>0$. By \eqref{A_7} and \eqref{A_Young}, for each $s\in[0,T]$, we have \begin{align*} &\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2}+\frac{p\lambda}{2}\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}e^{\lambda r}\int^r_0\big|\mathcal{Y}(t,r)\big|^2\,\mathrm{d} t\,\mathrm{d} r \\& +\frac{p}{2}\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}\int^T_0e^{\lambda(t\vee r)}\big|\mathcal{Z}(t,r)\big|^2\,\mathrm{d} t\,\mathrm{d} r\\* &+p\Bigl(\frac{p}{2}-1\Bigr)\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda,\varepsilon}(r)\bigr)^{p/2-2}\Bigl|\int^T_0e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} r\\ &\leq \Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2}\\ &\hspace{0.5cm}+\frac{p}{2}\bigl(1+2\mu L^{2}+2L^{2}\bigr)\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}e^{\lambda r}\int^r_0\big|\mathcal{Y}(t,r)\big|^2\,\mathrm{d} t\,\mathrm{d} r\\ &\hspace{0.5cm}+\frac{p}{4}\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}e^{\lambda r}\int^r_0\big|\mathcal{Z}(t,r)\big|^2\,\mathrm{d} t\,\mathrm{d} r\\ &\hspace{0.5cm}+ \frac{p}{2}\int^T_s \bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}e^{\lambda r} \Big\{ \int^r_0\big|\mathcal{G}_0(t,r)\big|^2\,\mathrm{d} t + \frac{T}{\mu} \big|\mathcal{Y}(r,r)\big|^2 + \frac{1}{\mu} \int^r_0\big|\zeta(t,r)\big|^2\,\mathrm{d} t \Big\} \,\mathrm{d} r \\ &\hspace{0.5cm}-p\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}\int^T_0e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\,\mathrm{d} W(r). \end{align*} Noting the assumption \eqref{A_**}, when $\lambda\geq1+2\mu L^{2}+2L^{2}$, we have, for each $s\in[0,T]$, \begin{equation}\label{A_8} \begin{split} &\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2} + p\Bigl(\frac{p}{2}-1\Bigr)\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-2}\Bigl|\int^T_0e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} r\\ &\leq \Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2} \\ &\quad+ \frac{p}{2}\int^T_s \bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}e^{\lambda r} \Big\{ \int^r_0\big|\mathcal{G}_0(t,r)\big|^2\,\mathrm{d} t + \frac{T}{\mu} \big|\mathcal{Y}(r,r)\big|^2 + \frac{1}{\mu} \int^r_0\big|\mathcal{Z}(r,t)\big|^2\,\mathrm{d} t \Big\} \,\mathrm{d} r \\&\hspace{0.5cm}-p\int^T_s\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(r)\bigr)^{p/2-1}\int^T_0e^{\lambda(t\vee r)}\mathcal{Y}(t,r)\mathcal{Z}(t,r)\,\mathrm{d} t\,\mathrm{d} W(r). \end{split} \end{equation} Thus, by the Burkholder--Davis--Gundy inequality, we get \begin{align*} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2} \\ &\hspace{1.5cm}+ \int^T_0 \bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-1}e^{\lambda s} \Big\{ \int^s_0\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} t + \frac{1}{\mu} \big|\mathcal{Y}(s,s)\big|^2 + \frac{1}{\mu} \int^s_0\big|\mathcal{Z}(s,t)\big|^2\,\mathrm{d} t \Big\} \,\mathrm{d} s \\ &\hspace{1.5cm}+\Bigl\{\int^T_0\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p-2}\Bigl|\int^T_0e^{\lambda(t\vee s)}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} s\Bigr\}^{1/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2}\\ &\hspace{1.5cm}+\sup_{s\in[0,T]}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-1} \Bigl\{\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t+\frac{1}{\mu}\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\\&\hspace{6cm}+\frac{1}{\mu}\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr\}\\ &\hspace{1.5cm}+\sup_{s\in[0,T]}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/4}\Bigl\{\int^T_0\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-2}\Bigl|\int^T_0e^{\lambda(t\vee s)}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} s\Bigr\}^{1/2}\Bigr]. \end{align*} Furthermore, by Young's inequality, \begin{align*} \mathbb{E}\Bigl[\sup_{s\in[0,T]}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2}\Bigr] &\leq C_p\mathbb{E}\Bigl[\Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\* &\hspace{1.5cm}+\frac{1}{\mu^{p/2}}\Bigl(\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\frac{1}{\mu^{p/2}}\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\* &\hspace{1.5cm}+\int^T_0\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-2}\Bigl|\int^T_0e^{\lambda(t\vee s)}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} s\Bigr]\\* &\hspace{0.5cm}+\frac{1}{2}\mathbb{E}\Bigl[\sup_{s\in[0,T]}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2}\Bigr], \end{align*} and thus, it holds that \begin{equation}\label{A_9} \begin{split} \mathbb{E}\Bigl[\sup_{s\in[0,T]}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2}\Bigr] &\leq C_p\mathbb{E}\Bigl[\Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\ &\hspace{1.5cm}+\frac{1}{\mu^{p/2}}\Bigl(\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\frac{1}{\mu^{p/2}}\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\ &\hspace{1.5cm}+\int^T_0\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-2}\Bigl|\int^T_0e^{\lambda(t\vee s)}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} s\Bigr]. \end{split} \end{equation} On the other hand, noting that $\mathcal{Y}(\cdot,\cdot)$ is bounded and \begin{align*} \mathbb{E}\Bigl[\int^T_0\Bigl(\int^T_0\big|\mathcal{Z}(t,s)\big|\,\mathrm{d} t\Bigr)^2\,\mathrm{d} s\Bigr]\leq T^2\,\underset{t\in[0,T]}{\mathrm{ess\,sup}}\,\mathbb{E}\Bigl[\int^T_0\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\Bigr]<\infty, \end{align*} by letting $s=0$ in \eqref{A_8} and taking expectations on both sides, we have \begin{align*} &\mathbb{E}\Bigl[\int^T_0\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-2}\Bigl|\int^T_0e^{\lambda(t\vee s)}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} s\Bigr]\\* &\leq C_p\mathbb{E}\Bigl[\Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2} \\ &\hspace{1.5cm}+ \int^T_0\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-1}e^{\lambda s} \Big\{ \int^s_0\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} t + \frac{1}{\mu} \big|\mathcal{Y}(s,s)\big|^2 + \frac{1}{\mu} \int^s_0\big|\mathcal{Z}(s,t)\big|^2\,\mathrm{d} t \Big\} \,\mathrm{d} s \Big], \end{align*} and hence \begin{equation}\label{A_10} \begin{split} &\mathbb{E}\Bigl[\int^T_0\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-2}\Bigl|\int^T_0e^{\lambda(t\vee s)}\mathcal{Y}(t,s)\mathcal{Z}(t,s)\,\mathrm{d} t\Bigr|^2\,\mathrm{d} s\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2}\\ &\hspace{1.5cm}+\sup_{s\in[0,T]}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2-1} \Bigl\{\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t+\frac{1}{\mu}\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t \\&\hspace{6cm}+\frac{1}{\mu}\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr\}\Bigr]. \end{split} \end{equation} By \eqref{A_9} and \eqref{A_10}, together with Young's inequality, we can show that \begin{align*} \mathbb{E}\Bigl[\sup_{s\in[0,T]}\bigl(\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)\bigr)^{p/2}\Bigr] &\leq C_p\mathbb{E}\Bigl[\Bigl(e^{\lambda T}\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t+\varepsilon\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\\* &\hspace{1.5cm}+\frac{1}{\mu^{p/2}}\Bigl(\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\frac{1}{\mu^{p/2}}\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} Recall that $\widetilde{\mathcal{Y}}^{\lambda, \varepsilon}(s)=\int_{0}^{T} e^{\lambda (t\vee s)}|\mathcal{Y}(t,s)|^{2}\,\mathrm{d} t+\varepsilon$, $s \in [0,T]$, and that $\mathcal{Y}(\cdot,\cdot)$ and $\mathcal{H}(\cdot)$ are bounded. Thus, by letting $\varepsilon \downarrow 0$ and using the dominated convergence theorem, we see that the assertion of \emph{Claim 2} holds. \paragraph{} By \emph{Claim 1} and \emph{Claim 2}, for a sufficiently large $\lambda>0$ (which depends only on $p$, $L$ and $T$), it holds that \begin{align*} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\Bigl(\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Y}(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0e^{\lambda t}\big|\mathcal{Y}(t,t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0e^{\lambda(t\vee s)}\big|\mathcal{Z}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[e^{p\lambda T/2}\Bigl(\int^T_0\big|\mathcal{H}(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_te^{\lambda s}\big|\mathcal{G}_0(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} Therefore, the desired estimate \eqref{A_***} holds, and we finish the proof of the lemma. \end{proof} Now we are ready to prove the $L^p$-a priori estimates of the solutions of Type-\Rnum{2} BSVIEs and BSDE systems for $p\geq2$. \begin{proof}[Proof of Theorem~\ref{Lem_Lp}] For simplicity of notation, we let $m=d=1$. The proof can be easily generalized to the multi-dimensional case. First, we prove (\rnum{1}). For each $n\in\mathbb{N}$, define \begin{equation*} \Psi_{n}(t):=(-n)\vee\bigl(\Psi(t)\wedge n\bigr)\ \text{and}\ G_n(t,s,y,z_1,z_2):=(-n)\vee\bigl(G(t,s,y,z_1,z_2)\wedge n\bigr). \end{equation*} Then $(\Psi_n,G_n)$ satisfies the conditions (\rnum{1}), (\rnum{2}) and (\rnum{3}) in $\mathrm{(H}_{\Psi,G}\mathrm{)}$ with the common constant $L$, and $\Psi_n$ and $G_n$ are bounded. Denote by $(Y_n(\cdot),Z_n(\cdot,\cdot))\in L^2_\mathbb{F}(0,T;\mathbb{R})\times L^2(0,T;L^2_\mathbb{F}(0,T;\mathbb{R}))$ the adapted M-solution of Type-\Rnum{2} BSVIE \eqref{BSVIE_II_1} corresponding to the coefficients $(\Psi,G)=(\Psi_n,G_n)$, and define \begin{equation*} Y_n(t,s):=\mathbb{E}_s\Bigl[\Psi_n(t)+\int^T_sG_n(t,r,Y_n(r),Z_n(t,r),Z_n(r,t))\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(r)\,\mathrm{d} r\Bigr],\ (t,s)\in[0,T]^2. \end{equation*} Then $Y_n(\cdot,\cdot)\in L^2(0,T;L^2_\mathbb{F}(\Omega;C([0,T];\mathbb{R})))$, and $Y_n(t,t)=Y_n(t)$, a.e.\ $t\in[0,T]$, a.s. Furthermore, by the same arguments as in the proof of Proposition \ref{Prop_BSDE_0}, we see that the following holds: \begin{align*} &Y_n(t,s)=\Psi_n(t)+\int^T_sG_n(t,r,Y_n(r,r),Z_n(t,r),Z_n(r,t))\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(r)\,\mathrm{d} r-\int^T_sZ_n(t,r)\,\mathrm{d} W(r),\\ &\hspace{5cm}s\in[0,T],\ \text{a.e.}\ t\in[0,T],\ \text{a.s.} \end{align*} Noting that the process $s\mapsto Z_n(s,t)\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(s)$ is adapted for each $t\in[0,T]$, we apply Lemma~\ref{lemma_A} with \begin{equation*} \mathcal{H}=\Psi_n,\ \mathcal{G}=G_n,\ \mathcal{Y}(t,s)=Y_n(t,s),\ \mathcal{Z}(t,s)=Z_n(t,s),\ \zeta(t,s)=Z_n(s,t)\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[t,T]}(s). \end{equation*} Then we obtain \begin{align*} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\Bigl(\int^T_0\big|Y_n(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\big|Y_n(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0\big|Z_n(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(\int^T_0\big|\Psi_n(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_t\big|G_n(t,s,0,0,0)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(\int^T_0\big|\Psi(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_t\big|G(t,s,0,0,0)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} We emphasize that the constant $C_p>0$ does not depend on $n\in\mathbb{N}$. By the $L^2$-stability estimate for Type-\Rnum{2} BSVIEs (cf.\ Theorem~3.7 in \cite{Yo08}), we see that \begin{equation*} \lim_{n\to\infty}(Y_n(\cdot),Z_n(\cdot,\cdot))=(Y(\cdot),Z(\cdot,\cdot))\ \text{in}\ L^2_\mathbb{F}(0,T;\mathbb{R})\times L^2(0,T;L^2_\mathbb{F}(0,T;\mathbb{R})). \end{equation*} Furthermore, we have \begin{align*} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\int^T_0\big|Y_n(t,s)-Y(t,s)\big|^2\,\mathrm{d} t\Bigr]\\ &\leq\int^T_0\mathbb{E}\Bigl[\sup_{s\in[0,T]}\mathbb{E}_s\Bigl[\big|\Psi_n(t)-\Psi(t)\big|\\ &\hspace{3cm}+\int^T_t\bigl|G_n(t,r,Y_n(r),Z_n(t,r),Z_n(r,t))-G(t,r,Y(r),Z(t,r),Z(r,t))\bigr|\,\mathrm{d} r\Bigr]^2\Bigr]\,\mathrm{d} t\\ &\leq4\int^T_0\mathbb{E}\Bigl[\Bigl\{\big|\Psi_n(t)-\Psi(t)\big|\\ &\hspace{2cm}+\int^T_t\bigl|G_n(t,r,Y_n(r),Z_n(t,r),Z_n(r,t))-G(t,r,Y(r),Z(t,r),Z(r,t))\bigr|\,\mathrm{d} r\Bigr\}^2\Bigr]\,\mathrm{d} t\\ &\leq C\mathbb{E}\Bigl[\int^T_0\big|\Psi_n(t)-\Psi(t)\big|^2\,\mathrm{d} t+\int^T_0\int^T_t\bigl|G_n(t,s,Y(s),Z(t,s),Z(s,t))-G(t,s,Y(s),Z(t,s),Z(s,t))\bigr|^2\,\mathrm{d} s\,\mathrm{d} t\\ &\hspace{2cm}+\int^T_0\big|Y_n(t)-Y(t)\big|^2\,\mathrm{d} t+\int^T_0\int^T_0\big|Z_n(t,s)-Z(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr], \end{align*} where in the second inequality we used Doob's martingale inequality. By the dominated convergence theorem, the last term in the above inequalities tends to zero as $n\to\infty$. Thus, there exists a subsequence $\{n_i\}_{i\in\mathbb{N}}\subset\mathbb{N}$ such that \begin{align*} &\lim_{i\to\infty}\int^T_0\big|Y_{n_i}(t)\big|^2\,\mathrm{d} t=\int^T_0\big|Y(t)\big|^2\,\mathrm{d} t,\ \text{a.s.},\\ &\lim_{i\to\infty}\int^T_0\int^T_0|Z_{n_i}(t,s)|^2\,\mathrm{d} s\,\mathrm{d} t=\int^T_0\int^T_0\big|Z(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t,\ \text{a.s.},\\* &\lim_{i\to\infty}\sup_{s\in[0,T]}\int^T_0\big|Y_{n_i}(t,s)\big|^2\,\mathrm{d} t=\sup_{s\in[0,T]}\int^T_0\big|Y(t,s)\big|^2\,\mathrm{d} t,\ \text{a.s.} \end{align*} Therefore, by Fatou's lemma, we get \begin{align*} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\Bigl(\int^T_0\big|Y(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\big|Y(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0\big|Z(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\* &\leq\liminf_{i\to\infty}\mathbb{E}\Bigl[\sup_{s\in[0,T]}\Bigl(\int^T_0\big|Y_{n_i}(t,s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\big|Y_{n_i}(t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0\big|Z_{n_i}(t,s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(\int^T_0|\Psi(t)|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_t\big|G(t,s,0,0,0)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} This completes the proof of the assertion (\rnum{1}). Next, we prove (\rnum{2}). For each $n \in \mathbb{N}$, define $(\Psi_n,G_n)$ as above. Denote by $\{(\mathscr{Y}^{\pi,\theta}_n(t_k,\cdot),\mathscr{Z}^{\pi,\theta}_n(t_k,\cdot))\}^{N-1}_{k=0}$ the solution of BSDE system \eqref{BSDE_sys_0} corresponding to $\pi=\{t_0,t_1,\ldots,t_N\}\in\Pi[0,T]$, $\theta\in[0,T]$ and the coefficients $(\Psi,G)=(\Psi_n,G_n)$. We apply Lemma~\ref{lemma_A} with \begin{align*} &\mathcal{H}(t)=\Psi_n(\tau(t)),~ \mathcal{G}(t,s,y,z_1,z_2)=G_n(\tau(t),s,y,z_1,z_2)\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^*(t),T)}(s),\\ &\mathcal{Y}(t,s)=\mathscr{Y}^{\pi,\theta}_n(\tau(t),s),~ \mathcal{Z}(t,s)=\mathscr{Z}^{\pi,\theta}_n(\tau(t),s),~ \zeta(t,s)=\mathcal{I}^{\pi,\theta}[\mathscr{Z}^{\pi,\theta}_n(\tau(s),\cdot)](\tau(t))\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^*(t),T)}(s). \end{align*} We see that the triplet $(\mathcal{Y}(\cdot,\cdot),\mathcal{Z}(\cdot,\cdot),\zeta(\cdot,\cdot))$ satisfies the equation \eqref{A_*}. Also, for each $\ell=1,\ldots,N-1$ and $s\in[t_\ell,t_{\ell+1})$, we have \begin{align*} \int^s_0\big|\zeta(t,s)\big|^2\,\mathrm{d} t&=\int^s_0\bigl|\mathcal{I}^{\pi,\theta}[\mathscr{Z}^{\pi,\theta}_n(\tau(s),\cdot)](\tau(t))\mbox{\rm{1}}\hspace{-0.25em}\mbox{\rm{l}}_{[\tau^*(t),T)}(s)\bigr|^2\,\mathrm{d} t=\int^{\tau(s)}_0\bigl|\mathcal{I}^{\pi,\theta}[\mathscr{Z}^{\pi,\theta}_n(\tau(s),\cdot)](\tau(t))\bigr|^2\,\mathrm{d} t\\* &=\sum^{\ell-1}_{k=0}\Delta t_k\bigl|\mathcal{I}^{\pi,\theta}[\mathscr{Z}^{\pi,\theta}_n(t_\ell,\cdot)](t_k)\bigr|^2=\sum^{\ell-1}_{k=0}\Delta t_k\Bigl|\frac{1}{\Delta t_k}\int^{t_{k+1}\vee\theta}_{t_k\vee\theta}\mathscr{Z}^{\pi,\theta}_n(t_\ell,t)\,\mathrm{d} t\Bigr|^2\\ &\leq\sum^{\ell-1}_{k=0}\int^{t_{k+1}}_{t_k}\big|\mathscr{Z}^{\pi,\theta}_n(t_\ell,t)\big|^2\,\mathrm{d} t=\int^{\tau(s)}_0|\mathscr{Z}^{\pi,\theta}_n(\tau(s),t)|^2\,\mathrm{d} t\\ &\leq\int^s_0\big|\mathcal{Z}(s,t)\big|^2\,\mathrm{d} t. \end{align*} Thus, the inequality~\eqref{A_**} holds. By Lemma~\ref{lemma_A}, we have \begin{align*} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\Bigl(\int^T_0\big|\mathscr{Y}^{\pi,\theta}_n(\tau(t),s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\big|\mathscr{Y}^{\pi,\theta}_n(\tau(t),t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0\big|\mathscr{Z}^{\pi,\theta}_n(\tau(t),s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\* &\leq C_p\mathbb{E}\Bigl[\Bigl(\int^T_0\big|\Psi_n(\tau(t))\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_{\tau^*(t)}\big|G_n(\tau(t),s,0,0,0)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(\int^T_0\big|\Psi(\tau(t))\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_{\tau^*(t)}\big|G(\tau(t),s,0,0,0)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} By using the $L^2$-stability estimate for BSDE systems (see Lemma~\ref{Lem_BSDE_sys_0}), together with Fatou's lemma, we can show that \begin{align*} &\mathbb{E}\Bigl[\sup_{s\in[0,T]}\Bigl(\int^T_0\big|\mathscr{Y}^{\pi,\theta}(\tau(t),s)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\big|\mathscr{Y}^{\pi,\theta}(\tau(t),t)\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_0\big|\mathscr{Z}^{\pi,\theta}(\tau(t),s)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]\\ &\leq C_p\mathbb{E}\Bigl[\Bigl(\int^T_0\big|\Psi(\tau(t))\big|^2\,\mathrm{d} t\Bigr)^{p/2}+\Bigl(\int^T_0\int^T_{\tau^*(t)}\big|G(\tau(t),s,0,0,0)\big|^2\,\mathrm{d} s\,\mathrm{d} t\Bigr)^{p/2}\Bigr]. \end{align*} This completes the proof of the assertion~(\rnum{2}). \end{proof} \end{appendix} \section*{Acknowledgments} The first author was supported by JSPS KAKENHI Grant Number JP18J20973. The second author was supported by JSPS KAKENHI Grant Number 19K14552.
\section{Introduction} Let $\mathcal S_{n}$ be the symmetric group of all permutations of $[n]=\{1, 2, \dots , n\}$. A position $i\in[n-1]$ in a permutation $\pi=\pi_1\pi_2\dotsm\pi_n\in\mathcal S_n$ is a \emph{descent} if $\pi_i>\pi_{i+1}$, and an \emph{ascent} if $\pi_i<\pi_{i+1}$. Denote the number of descents of $\pi$ by $\des(\pi)$, and the number of ascents by $\asc(\pi)$. We call the number $h(\pi)=\asc(\pi)-\des(\pi)$ the \emph{height} of $\pi$. The permutation $\pi$ is said to be a \emph{ballot permutation} if $h(\pi_1\pi_2\cdots\pi_i)\ge 0$ for all $i\in[n]$. Let $\B_n$ denote the set of ballot permutations on $[n]$. Define $\B_{0}=\{\epsilon\}$, where $\epsilon$ is the empty permutation. The problem of enumerating ballot permutations is closely related with that of enumerating ordinary permutations with a given up–down signature, see \cite{And81,BFW07,Niv68,She12}. A ballot permutation of length $2n+1$ with $n$ descents is said to be a \emph{Dyck permutation}, whose enumeration is the Eulerian-Catalan number, see Bidkhori and Sullivant~\cite{BS11}. Let $\O_n$ be the set of \emph{odd order permutations} of $[n]$, viz., the set of permutations of $[n]$ which are the products of cycles with odd lengths. Bernardi, Duplantier and Nadeau \cite{BDN10} proved that the number of ballot permutations of length $n$ equals the number of odd order permutations of length $n$, by using compositions of bijections, and thus \cref{thm:BDN} follows. A short proof is given by Wang and Zhang~\cite{WZ20}. \begin{thm}[Bernardi, Duplantier and Nadeau]\label{thm:BDN} The number of ballot permutations of length $n$ is \[ b_n=\begin{cases} [(n-1)!!]^{2},&\text{if $n$ is even},\\ n!!(n-2)!!,&\text{if $n$ is odd}, \end{cases} \] where $(-1)!!=1$. \end{thm} In order to give a refinement for \cref{thm:BDN}, Spiro~\cite{Spi20} introduced a statistic $M(\pi)$ which is defined for a permutation $\pi$ such that \[ M(\pi)=\sum_{c}\min\brk1{\cdes(c),\,\casc(c)}, \] where the sum runs over all cycles $c=(c_1c_2\dotsm c_k)$ of $\pi$, with the \emph{cyclic descent} \[ \cdes(c)=\abs{\{i\in[k]\colon c_i>c_{i+1}\ \text{where $c_{k+1}=c_1$}\}}, \] and the \emph{cyclic ascent} \[ \casc(c)=\abs{\{i\in[k]\colon c_i<c_{i+1}\ \text{where $c_{k+1}=c_1$}\}} =\abs{c}-\cdes(c), \] where $\abs{c}$ is the length of $c$. Spiro conjectured that the number of ballot permutations of length $n$ with $d$ descents equals the number of odd order permutations $\pi$ of length $n$ such that $M(\pi)=d$, which is confirmed by Wang and the first author~\cite{WZ20a}, and thus \cref{thm:Spiro} follows. \begin{thm}\label{thm:Spiro} Let $n\ge 1$ and $0\le d\le \floor{(n-1)/2}$. The number of ballot permutations of length $n$ with $d$ descents equals the number of odd order permutations $\pi$ of length $n$ with $M(\pi)=d$. \end{thm} \cref{thm:Spiro} is proved by computing their bivariate generating functions in terms of the \emph{Eulerian number}~\cite{WZ20}. For $n\ge1$ and $0\le d\le n-1$, the Eulerian number, denoted as $A(n,d)$ or $\Eulerian{n}{d}$, is the number of permutations of $[n]$ with $d$ descents, see OEIS~\cite[A008292]{OEIS}. We adopt the convention $A(0,0)=1$ and \[ A(n,d)=0,\qquad\text{if $n<0$, or $d<0$, or $d=n\ge 1$, or $d>n$}. \] The $n$th \emph{Eulerian polynomial} is \[ A_n(t)=\sum_{\pi\in\mathcal S_n}t^{\des(\pi)} =\sum_{d}A(n,d)t^{d}\quad\text{for $n\ge 1$}, \] where the notation $\sum_{i}$ implies that the index $i$ runs over all nonnegative integers making the summation meaningful, and $A_0(t)=1$, see Kyle Petersen~\cite[\S 1.4]{Kyle15B}. The exponential generating function of the Eulerian polynomials is \begin{equation}\label{gf:A} \sum_{n}A_{n}(t)\frac{x^{n}}{n!} =\frac{t-1}{t-e^{(t-1)x}}, \end{equation} see \cite[Theorem 1.6]{Kyle15B} and \cite[Formula (75)]{FS09B}. Then the bivariate generating function \begin{equation}\label{Eulequ} A(t,x) =\sum_{n\ge1}\sum_{d}\frac{A(n,d)t^{d}x^{n}}{n!} =\sum_{n\ge1}A_n(t)\frac{x^{n}}{n!}\\ =\frac{t-1}{t-e^{(t-1)x}}-1 =\frac{e^{(1-t)x}-1}{1-t e^{(1-t)x}}. \end{equation} Denote by $b(n,d)$ the number of ballot permutations of length $n$ with $d$ descents, and denote the bivariate generating function of $\{b(n,d)\}_{n,d}$ by \[ B(t,x)=\sum_{n}\sum_{d\le n-1} \frac{b(n,d)\,t^{d}x^{n}}{n!}. \] Wang and the first author~\cite{WZ20a} give the following Theorem by calculating the joint distribution of the peak and descent statistics over ballot permutations. \begin{thm}[Wang and Zhao]\label{Wang and Zhao} We have \[ B(t,x)=\exp\brk3{x+2 \sum_{k\ge 1}\sum_{d\le k-1} A(2k,d)t^{d+1}\frac{x^{2k+1}}{(2k+1)!}}. \] \end{thm} Wang and Zhang~\cite{WZ20} gave another conjecture which refined \cref{thm:Spiro} by tracking the neighbors of the largest letter in these permutations. They defined a word $u$ as a \emph{factor} of a word $w$ if there exist words $x$ and $y$ such that $w = xuy$, and a word $u$ as a \emph{cyclic factor} of a permutation $\pi\in\mathcal{S}_n$ if $u$ is a factor of some word $v$ such that $(v)$ is a cycle of $\pi$. This conjecture is confirmed in this paper by computing their multivariate generating functions respectively, and thus \cref{thm:WZ} follows. \begin{thm}[Wang and Zhang]\label{thm:WZ} For all $n$, $d$, and $2\leq j \leq n-1$, we have $b_{n,d}(1,j)+b_{n,d}(j,1)= 2p_{n,d}(1,j)$, where $b_{n,d}(i,j)$ is the number of ballot permutations of length $n$ with $d$ descents which have $inj$ as a factor, and $p_{n,d}(i,j)$ is the number of odd order permutations of length $n$ with $M(\pi)=d$ which have $inj$ as a cyclic factor. \end{thm} With \cref{thm:WZ} and the Toeplitz property of $b_{n,d}(i,j)+b_{n,d}(j,i)$ and $p_{n,d}(i,j)$ showed in ~\cite{WZ20}, we obtain in \cref{RS} the generating function which P. R. Stanley expressed interest in private communication, and is defined by \[ P(t,x,y,z)=\sum_{n,d}\sum_{1\leq i<j\leq n-1}\dfrac{2p_{n,d}(i,j)t^{d}x^{n}y^{i}z^{j}}{(j-i-1)!(n-j+i-2)!}. \] There are various generalizations of Eulerian numbers. Here we focus on a refinement $A(n,d,j)$ of $A(n,d)$ defined by Brenti and Welker~\cite{BW08}, which is the number of permutations of length $n$ with $d$ descents and first letter $j$ for $n\geq 1$, $0\leq d\leq n-1$ and $1\leq j\leq n$. They show the real-rootedness of the following polynomials \[ A^{\langle j\rangle}_n(t)=\sum_{d}A(n,d,j)t^{d}\quad\text{for $n\ge 1$}, \] which refine the Eulerian polynomials. We adopt the convention $A(n,d,j)=0$ for other $n,d$ and $j$. Define \[ A(t,x,y):=\sum_{n,d}\sum_{j=1}^{n}\frac{A(n,d,j)t^{d}x^{n}y^{j}}{(j-1)!(n-j)!}, \] We would give a formula for $A(t,x,y)$ in close form, based what a series of formulas with generatingfunctionology could be established, and prove \cref{thm:WZ}. For this purpose, we give several definitions of enumerating sequences and calculate their multivariate generating functions in the following sections. For $n\geq2, 1\leq j\leq n$ and $0\leq d\leq n$, let $U(n,\,d,\,j)$ denote the number of permutations of length $n$ with $d-1$ descents or $n-d-1$ ascents and first letter $j$. Then \begin{equation}\label{undj} U(n,d,j)=A(n,\, n-d-1,\, j)+A(n,\, d-1,\, j), \end{equation} and \begin{equation}\label{undj1} U(n,d,j)=U(n,\, n-d,\, j). \end{equation} We define the multivariate generating function for $\{U(n,d,j)\}_{n,d,j}$ \[ \hat{U}(t,x,y):=\sum_{n,d}\sum_{j=1}^{n}\frac{U(n,d,j)t^{d}x^{n}y^{j}}{(j-1)!(n-j)!}, \] and \[ U(t,x,y):=\sum_{n ~\text{is odd},j}\sum_{d\leq\frac{n-1}{2}}\frac{U(n,d,j)t^{d}x^{n}y^{j}}{(j-1)!(n-j)!}. \] For $n\geq 3, 2\leq j\leq n-1$ and $0\leq d\leq n-1$, we denote by $E(n,d,j)$ the number of permutations in $S_n$ of length $n$ with $d$ descents which have $1nj$ or $jn1$ as a factor, and define $b(n,d,j):=b_{n,d}(1,j)+b_{n,d}(j,1)$. Define \[ E(t,x,y):=\sum_{n,d}\sum_{j=2}^{n-1}\dfrac{E(n,d,j)t^{d}x^{n}y^{j}}{(n-j-1)!(j-2)!}, \] \[ B(t,x,y):=\sum_{n,d}\sum_{j=2}^{n-1}\dfrac{b(n,d,j)t^dx^ny^j}{(n-j-1)!(j-2)!}, \] and \[ P(t,x,y):=\sum_{n,d}\sum_{j=2}^{n-1}\dfrac{p_{n,d}(1,j)t^{d}x^{n}y^{j}}{(j-2)!(n-j-1)!}. \] The rest of this paper is organized as follows. In Section 2, we calculate the formulas for $A(t,x,y), \hat{U}(t,x,y)$ and $U(t,x,y)$. In Section 3, we calculate the formulas for $E(t,x,y)$, $P(t,x,y)$ and a relation between $B(t,x), B(t,x,y)$ and $E(t,x,y)$. Finally, in Section 4 we confirm the conjecture of Wang and Zhang and calculate $P(t,x,y,z)$. \section{Formulas for $A(t,x,y), \hat{U}(t,x,y)$ and $U(t,x,y)$} This section is devoted to giving the generating functions of $\{A(n,d,j)\}_{n,d,j}$, which is the basis of section 3. One can get the following recursion for $A(n,d,j)$ by the values of the second letters in permutations, which could be found in \cite{BW08}. \begin{lem} \label{BWlem} For $n\geq 2$, $1\leq j\leq n$ and $0\leq d\leq n-1$, we have \begin{equation} \begin{split}\label{ditui1} A(n,d,j)=\sum_{i=1}^{j-1}A(n-1,\,d-1,\,i) + \sum_{i=j+1}^{n} A(n-1,\,d,\,i-1). \end{split} \end{equation} \end{lem} By \cref{BWlem}, we can obtain the following Theorem by generating function calculation. \begin{thm}\label{yinliv2} We have $$A(t,x,y)=\dfrac{(t-1)xye^{(t-1)xy}}{t-e^{(t-1)x(1+y)}}.$$ \end{thm} \begin{proof} Substituting $j$ by $j+1$ in \eqref{ditui1},we have \begin{equation} \begin{split}\label{ditui2} A(n,\,d,\,j+1)=\sum_{i=1}^{j}A(n-1,\,d-1,\,i)+\sum_{i=j+2}^{n}A(n-1,\,d,\,i-1). \end{split} \end{equation} subtracting \eqref{ditui1} from \eqref{ditui2},we get \begin{equation} \begin{split}\label{zuocha} A(n,\,d,\,j+1)=A(n,d,j)+A(n-1,\,d-1,\,j)-A(n-1,\,d,\,j), \end{split} \end{equation} where $n\geq 2$, $1\leq j\leq n-1$ and $0\leq d\leq n-1$. Multiplying each term in \eqref{zuocha} by$ \dfrac{t^{d}x^{n}y^{j}}{(j-1)!(n-j)!}$ and summing over all integers $n,d$ and $1 \leq j \leq n-1$ with subscript transformation, we have \begin{align}\label{key2} \sum_{n,d}\sum_{1\leq\,j\leq\,n-1}\dfrac{A(n,\,d,\,j+1)t^{d}x^{n}y^{j+1}}{(n-j-1)!(j-1)!} &=\,\sum_{n,d}\sum_{j\geq\,1}\dfrac{(j-1)A(n,\,d,\,j)t^{d}x^{n}y^{j}}{(n-j)!(j-1)!}\notag\\ &=y\sum_{n,d}\sum_{j\geq1}\dfrac{A(n,d,j)jt^{d}x^{n}y^{j-1}}{(n-j)!(j-1)!}-A(t,x,y)\notag\\ &=y\dfrac{\partial A(t,x,y)}{\partial y}-A(t,x,y), \end{align} \begin{align}\label{key3} \sum_{n,d}\sum_{1\leq\,j\leq\,n-1}\dfrac{A(n,d,j)t^{d}x^{n}y^{j+1}}{(n-j-1)!(j-1)!} &=\,\sum_{n,d}\sum_{1\leq\,j\leq\,n-1}A(n,d,j)\dfrac{(n-j)t^{d}x^{n}z^{j+1}}{(n-j)!(j-1)!}\notag\\ &=xy\sum_{n,d}\sum_{1\leq\,j\leq\,n-1}\dfrac{nA(n,d,j)t^{d}x^{n-1}y^{j}}{(n-j)!(j-1)!} \notag\\ &\quad-y^{2}\sum_{n,d}\sum_{1\leq\,j\leq\,n-1}\dfrac{jA(n,d,j)t^{d}x^{n}y^{j-1}}{(n-j)!(j-1)!}\notag\\ &=xy\dfrac{\partial A(t,x,y)}{\partial x}-y^{2}\dfrac{\partial A(t,x,y)}{\partial y}, \end{align} \begin{align}\label{key4} \sum_{n,d}\sum_{1\leq\,j\leq\,n-1}\dfrac{A(n-1,\,d-1,\,j)t^{d}x^{n}y^{j+1}}{(n-j-1)!(j-1)!} =txy A(t,x,y), \end{align} \begin{align}\label{key5} \sum_{n,d}\sum_{1\leq\,j\leq\,n-1}\dfrac{A(n-1,\,d,\,j)t^{d}x^{n}y^{j+1}}{(n-j-1)!(j-1)!} =xy A(t,x,y). \end{align} Combining \eqref{key2}, \eqref{key3}, \eqref{key4} and \eqref{key5}, we get $$y\dfrac{\partial A(t,x,y)}{\partial y}-A(t,x,y)=xy\dfrac{\partial A(t,x,y)}{\partial x}-y^{2}\dfrac{\partial A(t,x,y)}{\partial y}+txy A(t,x,y)-xy A(t,x,y).$$ By Maple, we have \begin{equation}\label{v2jielun} \begin{split} A(t,x,y)=xye^{(t-1)xy}F(t,x+xy), \end{split} \end{equation} where $F(t,x)$ is an arbitrary differentiable function. In the following we will determine $F(t,x)$. Take derivatives on both sides of \eqref{v2jielun}, we have \[ \dfrac{\partial A(t,x,y)}{\partial y}=x[(t-1)xy+1]e^{(t-1)xy}F(t,x+xy)+x^{2}ye^{(t-1)xy}F_{2}^{'}(t,x+xy), \] then \[ \dfrac{\partial A}{\partial z}(t,x,0)=xF(t,x). \] On the other hand, it is easy to see that $A(n,d,1)=A(n-1,\,d)$, then \[ \dfrac{\partial A}{\partial z}(t,x,0)=\sum_{n,d} \dfrac{A(n,d,1)t^{d}x^{n}}{(n-1)!} =x\,\sum_{n,d}\dfrac{A(n,d)\,x^{n}y^{d}}{n!} =xA(t,x)+x. \] Thus \begin{equation}\label{F} F(t,x)=A(t,x)+1=\frac{t-1}{t-e^{(t-1)x}}. \end{equation} Plugging \eqref{F} into \eqref{v2jielun},one can complete the proof. \end{proof} \begin{rem} The close form of the generating function for $\{A(n,d,j)\}$ in \eqref{yinliv2} doesn't seem to be seen elsewhere. The conclusion could also be obtained by generating function calculation through Zhang's lemma in \cite{Zhang20}: for $1\leq j\leq n$, \[ \frac{A^{\langle l\rangle}_n(x)}{(1-x)^n}=\delta_{l,1}+\sum_{i=1}^{\infty}j^{l-1}(j+1)^{n-l}x^j. \] \end{rem} It is direct to calculate $\hat{U}(t,x,y)$ according to the definition of \eqref{undj} and \cref{yinliv2}. \begin{cor} \label{utxy2} We have \[ \hat{U}(t,x,y)=tA(t,x,y)+\frac{1}{t}A(\frac{1}{t},\,xt,\,y), \] i.e., \[ \hat{U}(t,x,y)=\frac{(t-1)xy(te^{(t-1)xy}+e^{(t-1)x})}{t-e^{(t-1)x(y+1)}}. \] \end{cor} With \cref{utxy2}, we obtain the following corollary. \begin{prop} \label{utxy3} we have \[ U(t,x,y)+U(\frac{1}{t},tx,y)=\dfrac{\hat{U}(t,x,y)-\hat{U}(t,-x,y)}{2}. \] In other words, \[ U(t,x,y)=\D^{t,x}\brk4{\dfrac{xy(t+1)(t-1)^2e^{(t-1)x}\brk1{e^{2(t-1)xy}+1}} {2\brk1{e^{(t-1)x(y+1)}}-1\brk1{t-e^{(t-1)x(y+1)}}}}. \] \end{prop} \begin{proof} According to \eqref{undj1} and using subscript transformation, we have \begin{align*} U(t,x,y)+U(\frac{1}{t},tx,y) &=\sum_{n ~\text{is odd},j}\sum_{d\leq\frac{n-1}{2}}\frac{U(n,d,j)t^{d}x^{n}y^{j}}{(j-1)!(n-j)!} +\sum_{n ~\text{is odd},j}\sum_{d\leq\frac{n-1}{2}}\frac{U(n,d,j)t^{n-d}x^{n}y^{j}}{(j-1)!(n-j)!}\\ &=\sum_{n ~\text{is odd},d,j}\frac{U(n,d,j)t^{d}x^{n}y^{j}}{(j-1)!(n-j)!}=\dfrac{\hat{U}(t,x,y)-\hat{U}(t,-x,y)}{2}\\ &=\dfrac{xy(t+1)(t-1)^2e^{(t-1)x}\brk1{e^{2(t-1)xy}+1}} {2\brk1{e^{(t-1)x(y+1)}}-1\brk1{t-e^{(t-1)x(y+1)}}}. \end{align*} Noting that $U(t,x,y)$ is a multivariate formal power series with terms of the form $t^{d}x^{n}y^{k}$ such that $d \leq (n-1)/2$, and the terms of $U(\frac{1}{t},tx,y)$ are of the form $t^{d}x^{n}y^{k}$ such that $d >(n-1)/2$. According the definition of $\D^{t,x}$, we obtain the desired equation. \end{proof} \section{Formulas for $E(t,x,y)$, $P(t,x,y)$ and $B(t,x,y)$} \subsection{The generating function of $\{E(n,d,j)\}_{n,d,j}$} \begin{thm} \label{recEndj} For $n\geq3$, $2\leq j \leq n-1$ and $0\leq d\leq n-1$, We have \begin{multline}\label{Endj} E(n,d,j) =\sum_{l=1}^{n-2}\sum_{k=0}^{l-1}\sum_{u=0}^{j-2}\binom{j-2}{u}\binom{n-j-1}{l-1-u}A(n-l-2, d-k-1)U(l,k,u+1)\\+V(n-2, d-1, j-1)-V(n-2, d-2, j-1), \end{multline} where $U(l,k,u+1)=V(l, l-1-k, u+1)+V(l, k-1, u+1)$. \end{thm} \begin{proof} First we give a formula of $E(n,d,j)$ with which one can derive the expression of $E(t,x,y)$. For any permutation $\pi=\pi_1 \pi_2 \cdots \pi_n$ of length $n$ with $d$ descents which has $1nj$ or $jn1$ as a factor, there are three cases of $\pi$: \begin{itemize} \item $jn1$ is in $\pi$. Suppose that $\pi_l=j$, $\des(\pi_1 \pi_2 \cdots \pi_j)=k$ and there are $u$ letters in $\{\pi_1, \pi_2,\dotsm \pi_{l-1}\}$ which are less than $j$, where $1\leq k+1 \leq l\leq n-2$ and $0\leq u \leq j-2$. Then $\pi_{l}\pi_{l-1}\dotsm\pi_1$ is a permutation of length $l$ with the $(u+1)$th largest letter as the first letter, and \[ \des(\pi_{l}\pi_{l-1}\dotsm\pi_1)=l-1-\asc(\pi_{l}\pi_{l-1}\dotsm\pi_1)=l-1-k. \] Considering $n$ is a descent and 1 is a ascent in $\pi$, $\pi_{l+3}\pi_{l+4}\dotsm\,\pi_n$ is a permutation of length $n-l-2$ with \[ \des(\pi_{l+3}\pi_{l+4}\dotsm\,\pi_n)=d-1-\des(\pi_1 \pi_2 \cdots \pi_j)=d-k-1. \] Note that as a subset of $[n]$, there are $\binom{j-2}{u}\binom{n-j-1}{l-1-u}$ possibilities of $\{\pi_1, \pi_2,\dotsm \pi_{l-1}\}$. Thus the number of such $\pi$s is \[ \sum_{l=1}^{n-2}\sum_{k=0}^{l-1}\sum_{u=0}^{j-2}\binom{j-2}{u}\binom{n-j-1}{l-1-u}A(l, l-1-k, u+1)A(n-l-2, d-k-1). \] \item $1nj$ is in $\pi$ and $\pi_1\neq1$. Suppose that $\pi_{n-l+1}=j$, $\des(\pi_{n-l+1} \pi_{n-l+2}\dotsm \pi_{l-1})=k-1$ and there are $u$ letters in $\{\pi_{n-l+1}, \pi_{n-l+2},\dotsm \pi_{l-1}\}$ which are less than $j$, where $1\leq k+1 \leq l\leq n-3$ and $0\leq u \leq j-2$. Similar to case 1, $\pi=\pi_1\pi_2\dotsm\pi_{n-l-2}$ is a permutation of length $n-l-2$ with $d-1-k$ descents and $j\pi_{n-l+2}\pi_{n-l+3}\dotsm\pi_n$ is a permutation of length $l$ with $k-1$ descents and the $(u+1)$th largest letter as the first letter. Thus the number of such $\pi$s is \[ \sum_{l=1}^{n-3}\sum_{k=0}^{l-1}\sum_{u=0}^{j-2}\binom{j-2}{u}\binom{n-j-1}{l-1-u}V(l, k-1, u+1)A(n-l-2, d-k-1). \] \item $1nj$ is in $\pi$ and $\pi_1=1$. So the $\pi_3=j$. Then $j\pi_4\pi_5\dotsm\pi_n$ is a permutation of length $n-2$ with $d-1$ descents and the $(j-1)$th largest letter as the first letter. The number of such $\pi$s is $V(n-2, d-1, j-1)$. \end{itemize} Combining the above three cases, we have \begin{multline*} E(n,d,j)=\sum_{l=1}^{n-2}\sum_{k=0}^{l-1}\sum_{u=0}^{j-2}\binom{j-2}{u}\binom{n-j-1}{l-1-u}V(l, l-1-k, u+1)A(n-l-2, d-k-1)\\ +\sum_{l=1}^{n-3}\sum_{k=0}^{l-1}\sum_{u=0}^{j-2}\binom{j-2}{u}\binom{n-j-1}{l-1-u}V(l, k-1, u+1)A(n-l-2, d-k-1)+V(n-2, d-1, j-1)\\ =\sum_{l=1}^{n-2}\sum_{k=0}^{l-1}\sum_{u=0}^{j-2}\binom{j-2}{u}\binom{n-j-1}{l-1-u}A(n-l-2, d-k-1)U(l,k,u+1)\\ -\sum_{k=0}^{n-2}\sum_{u=0}^{j-2}\binom{j-2}{u}\binom{n-j-1}{l-1-u}V(l, k-1, u+1)A(n-l-2, d-k-1) +V(n-2, d-1, j-1). \end{multline*} It is easy to check that when $l=n-2$, \[ \sum_{k=0}^{l}\sum_{u=0}^{j-2}\binom{j-2}{u}\binom{n-j-1}{l-1-u}V(l, k-1, u+1)A(n-l-2, d-k-1)= V(n-2, d-2, j-1), \] which complete the proof. \end{proof} \cref{recEndj} is translated into the language of generating functions as follows. \begin{thm}\label{D2} \[ E(t,x,y)=tx^2y[A(t,x+xy)+1]\hat{U}(t,x,y)+t(1-t)x^2yA(t,x,y), \] i.e., \[ E(t,x,y)=\dfrac{t(t-1)^2x^3y^2e^{(t-1)x}(e^{2(t-1)xy}+1)} {(t-e^{(t-1)x(y+1)})^2}. \] \end{thm} \begin{proof} Multiplying each term in \eqref{Endj} by $\dfrac{t^dx^ny^j}{(j-2)!(n-j-1)!}$, summing over all integers $n,j$ and $d$ such that $n\geq3$, $2\leq j\leq n-1$ and $0\leq d\leq n-1$, we deduce that \begin{align*} E(t,x,y) &= \sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{j=2}^{n-1}\frac{E(n,d,j)t^dx^ny^j}{(j-2)!(n-j-1)!} \\ &= \sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{j=2}^{n-1}\sum_{l=1}^{n-2}\sum_{k=0}^{l-1} \sum_{u=0}^{j-2}\frac{\binom{j-2}{u}\binom{n-j-1}{l-1-u})t^dx^ny^j}{(j-2)!(n-j-1)!}A(n-l-2, d-k-1)U(l,k,u+1)\\ &\quad + tx^2y\sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{j=2}^{n-1}\frac{A(n-2, d-1,j-1)t^{d-1}x^{n-2}y^{j-1}}{(j-2)!(n-j-1)!} \\ &\quad - t^2x^2y\sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{j=2}^{n-1}\frac{A(n-2, d-2, j-1)t^{d-2}x^{n-2}y^{j-1}}{(j-2)!(n-j-1)!}\\ &=tx^2\sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{j=2}^{n-1}\sum_{l=1}^{n-2}\sum_{k=0}^{l-1} \sum_{u=0}^{j-2}\binom{n-l-2}{j-2-u}y^j \cdot \frac{A(n-l-2, d-k-1)x^{n-l-2}t^{d-k-1}}{(n-2-l)!}\\ &\quad \cdot\frac{U(l,k,u+1)t^kx^l}{u!(l-1-u)!}+tx^2yA(t,x,y)-t^2x^2yA(t,x,y). \end{align*} Exchanging the order of $u$ and $j$ in the summation, we have \begin{multline*} \sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{j=2}^{n-1}\sum_{l=1}^{n-2}\sum_{k=0}^{l-1} \sum_{u=0}^{j-2}\binom{n-l-2}{j-2-u}y^j \cdot \frac{A(n-l-2, d-k-1)x^{n-l-2}t^{d-k-1}}{(n-2-l)!}\\ \cdot\frac{U(l,k,u+1)t^kx^l}{u!(l-1-u)!} =\sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{u=0}^{n-3}\sum_{l=1}^{n-2}\sum_{k=0}^{l-1} \sum_{j=u+2}^{n-1}\binom{n-l-2}{j-2-u}y^j \\ \cdot \frac{A(n-l-2, d-k-1)x^{n-l-2}t^{d-k-1}}{(n-2-l)!} \cdot\frac{U(l,k,u+1)t^kx^l}{u!(l-1-u)!}. \end{multline*} For fixed nonnegative integer $n,l$ and $u$ such that $n-2\geq l\geq u+1$ (then $n-u-3 \geq n-l-2$), we have \[ \sum_{j=2}^{n-1}\binom{n-l-2}{j-2-u}y^j=y^{u+2}\sum_{i=-u}^{n-u-3} \binom{n-l-2}{i}y^{i}=(1+y)^{n-l-2}y^{u+2}. \] Thus \begin{align*} E(t,x,y) &=tx^2\sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{u=0}^{n-3}\sum_{l=1}^{n-2}\sum_{k=0}^{l-1} \sum_{j=u+2}^{n-1}\binom{n-l-2}{j-2-u}y^j \cdot \frac{A(n-l-2, d-k-1)x^{n-l-2}t^{d-k-1}}{(n-2-l)!} \\ &\quad \cdot\frac{U(l,k,u+1)t^kx^l}{u!(l-1-u)!}+tx^2yA(t,x,y)-t^2x^2yA(t,x,y).\\ &=tx^2\sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{u=0}^{n-3}\sum_{l=1}^{n-2}\sum_{k=0}^{l-1} (1+y)^{n-l-2}y^{u+2}\cdot \frac{A(n-l-2, d-k-1)x^{n-l-2}t^{d-k-1}}{(n-2-l)!} \\ &\quad \cdot\frac{U(l,k,u+1)t^kx^l}{u!(l-1-u)!}+tx^2yA(t,x,y)-t^2x^2yA(t,x,y)\\ &= tx^2y \sum_{n=3}^{\infty}\sum_{d=0}^{n-1}\sum_{u=0}^{n-3}\sum_{l=1}^{n-2}\sum_{k=0}^{l-1} \dfrac{A(n-l-2, d-k-1)[x(1+y)]^{n-l-2}t^{d-k-1}}{(n-2-l)!} \\ &\cdot\frac{U(l,k,u+1)t^kx^ly^{u+1}}{u!(l-1-u)!}+t(1-t)x^2yA(t,x,y)\\ &=tx^2y \sum_{n,d}\frac{A(n, d)[x(1+y)]^{n}t^{d}}{n!} \cdot\sum_{l,k}\sum_{u=1}^{k}\frac{U(l,k,u)t^kx^ly^{u}}{(u-1)!(l-u)!} +t(1-t)x^2yA(t,x,y) \\ &=tx^2y[A(t,x+xy)+1]\hat{U}(t,x,y)+t(1-t)x^2yA(t,x,y). \end{align*} Thus completing the proof. \end{proof} \subsection{The generating function of $\{b(n,d,j)\}_{n,d,j}$} In this subsection we will give a relation between $B(t,x,y),B(t,x)$ and $E(t,x,y)$ by the relations between their coefficients. We give a bijection proof adopting the idea of the reversal-concatenation map in~\cite{WZ20a}. The concept of lowest point in ~\cite{WZ20a} play a important role in the proof, which is defined to be the position $1\leq k\leq n$ of a permutation $\pi=\pi_1\pi_2\dotsm\pi_n$ satisfying \[ h(\pi_1\pi_2\dotsm\pi_k)=min\{h(\pi_1\pi_2\dotsm\pi_i)|1\leq\,i\leq\,n\}. \] From the definition, it is easy to see that if $l$ is the minimal lowest point of a permutation $\pi=\pi_1\pi_2\cdots\pi_n$, then $\pi_{l-1}\pi_{l-2}\cdots\pi_{1}$ and $\pi_{l}\pi_{l+1}\cdots\pi_{n}$ are both ballot permutations (empty permutation is also ballot permutation). For example, the first lowest point of permutation 143265 is 4, then 341 and 265 are ballot permutations. Similarly, if $l$ is the maximal lowest point of a permutation $\pi=\pi_1\pi_2\cdots\pi_n$, then $\pi_{l}\pi_{l-1}\cdots\pi_{1}$ and $\pi_{l+1}\pi_{l+2}\cdots\pi_{n}$ are ballot permutations. \begin{thm}\label{recendj} For all integers $n,d$ and $j$ such that $n\geq3, 0\leq d\leq n-1$ and $2\leq j\leq n-1$, we have \begin{multline}\label{E+E} E(n,d,j)+E(n,d-1,j)=\sum_{l,k,u}\binom{j-2}{u}\binom{n-j-1}{n-l-3-u}b(l,k)b(n-l,\,d-l+k,\,u+2)\\ +\sum_{l,k,u}\binom{j-2}{u}\binom{n-j-1}{l-3-u}b(n-l,d-l+k)b(l,\,k,\,u+2). \end{multline} \end{thm} \begin{proof} Define \[ \mathcal{E}(n,d,j)=\{\pi\in\mathcal{S}_n:\des(\pi)=d ~\text{and $\pi$ has $1nj$ or $jn1$ as a factor}\}, \] \[ \mathcal{B}(n,d)=\{\pi\in\mathcal{S}_n:\des(\pi)=d ~\text{and $\pi$ is a ballot permutation}\}, \] \[ \mathcal{B}_j(n,d)=\{\pi\in\mathcal{B}(n,d): \text{$\pi$ has $1nj$ or $jn1$ as a factor}\}, \] \begin{multline*} \mathcal{B}^1(n,d,j) =\{(\rho,\tau)\colon\text{$\exists$ $l,k,u\geq0$ such that} \\ \rho\in\mathcal{B}(l,k), \tau\in\mathcal{B}_{u+2}(n-l,d-l+k), ~\text{and}~ \rho\tau\in \mathcal S_{n}\},~\text{and} \end{multline*} \begin{multline*} \mathcal{B}^2(n,d,j) =\{(\rho,\tau)\colon\text{$\exists$ $l,k,u\geq0$ such that} \\ \rho\in\mathcal{B}_{u+2}(l,k),\tau\in\mathcal{B}(n-l,d-l+k), ~\text{and}~ \rho\tau\in \mathcal S_{n}\}. \end{multline*} Now we give a bijection between $\mathcal{E}(n,d,j)\cup \mathcal{E}(n,d-1,j)$ and $\mathcal{B}^1(n,d,j)\cup\mathcal{B}^2(n,d,j)$. For any permutation $\pi\in\mathcal{E}(n,d,j)$, assume that $l+1$ is the minimal lowest point. Let $\rho=\pi_l\pi_{l-1}\dotsm\pi_1$ and $\pi(2)=\pi_{l+1}\pi_{l+2}\dotsm\pi_n$. Assume that $\des(\rho)=l-k-1$. Then $\pi_l<\pi_{l+1}$, and $\rho$ or $\tau$ has $1nj$ or $jn1$ as a factor: \begin{itemize} \item if $\rho$ has the factor $1nj$ or $jn1$. Assume that there are $u+1$ numbers less than $j$ in $\rho$, then $(\rho,\tau)\in\mathcal{B}^2(n,d,j)$. \item if $\tau$ has the factor $1nj$ or $jn1$. Assume that there are $u+1$ numbers less than $j$ in $\tau$, then $(\rho,\tau)\in\mathcal{B}^1(n,d,j)$. \end{itemize} Similarly, for any permutation $\pi\in\mathcal{E}(n,d-1,j)$, assume that $l$ is the maximal lowest point. Let $\rho=\pi_l\pi_{l-1}\dotsm\pi_1$ and $\pi(2)=\pi_{l+1}\pi_{l+2}\dotsm\pi_n$. Assume that $\des(\rho)=l-k-1$. Then $(\rho,\tau)\in\mathcal{B}^1(n,d,j)\bigcup\mathcal{B}^2(n,d,j)$. It is not difficult to check that the map \begin{align*} \phi\colon \mathcal{E}(n,d,j)\cup \mathcal{E}(n,d-1,j) &\to \mathcal{B}^1(n,d,j)\bigcup\mathcal{B}^2(n,d,j)\\ \pi&\mapsto(\rho,\tau) \end{align*} is a bijection. Thus completing the proof. \end{proof} With \cref{recendj}, we obtain the following relation between $B(t,x,y),B(t,x)$ and $E(t,x,y)$. \begin{thm}\label{D1} We have that \begin{align} \label{Btxy} B(t,x,y)B\brk2{\frac{1}{t},tx(1+y)}+B\brk2{\frac{1}{t},tx,y}B(t,x+xy)=(1+t)E(t,x,y). \end{align} \end{thm} \begin{proof} Multiplying each term in \eqref{E+E} by $\dfrac{t^{d}x^{n}y^{j}}{(n-j-1)!(j-2)!}$, we have \begin{align}\label{222} &\quad\frac{E(n,d,j)t^{d}x^{n}y^{j}}{(n-j-1)!(j-2)!}+t\cdot\frac{E(n,d-1,j)t^{d-1}x^{n}y^{j}}{(n-j-1)!(j-2)!}\\ &=\sum_{l,k,u}\dfrac{b(l,k)t^{-k}(tx)^ly^{j-u-2}}{l!}\cdot \frac{b_{n-l,\,d-l+k}(1,u+2)t^{d-l+k}x^{n-l}y^{u+2}}{(n-l-3-u)!u!}\binom{l}{j-2-u}\\ &\quad+\sum_{l,k,u}\frac{b(n-l,d-l+k)t^{d-l+k}x^{n-l}y^{j-2-u}}{(n-l)!} \cdot\frac{b_{l,k}(1,u+2)t^{-k}(xy)^{l}z^{u+2}}{(l-3-u)!(n-l!)}\binom{n-l}{j-2-u}. \end{align} Summing over \eqref{222} for all $n,d$ and $j$ such that $n\geq3, 0\leq d\leq n-1$ and $2\leq j\leq n-1$, the desired generating function can be obtained by using techniques in generatingfunctionology as that is used in the proof of \cref{D2}. \end{proof} \subsection{The generating function of $\{p_{n,d}(1,j)\}_{n,d,j}$} To calculate $P(t,x,y)$, we first prove the following formula for $p_{n,d}(1,j)$. \begin{thm} For $n\geq3$, $2\leq j \leq n-1$ and $0\leq d\leq n-1$, We have \begin{multline} \label{relofpnd} p_{n,d}(1,j)=\sum_{m_1+m_2+\lambda_1 n_1+\dotsm+\lambda_s n_s=n-3,d_0\leq \frac{m_1+m_2+2}{2},\atop d_0+\lambda_1 d_1+\dotsm+\lambda_s d_s=d, n_i\,\text{is odd},\,m_1+m_2\,\text{is even}} \binom{j-2}{m_1}\binom{n-j-1}{m_2} \dfrac{(n-3-m_1-m_2)!}{\Pi_{i=1}^{s}[(n_i!)^{\lambda_i}\lambda_i!]}\\ \cdot\prod_{i=1}^{s}[l(n_i,\,d_i)]^{\lambda_i} U(m_1+m_2+1,\,d_0-1,\,m_1+1). \end{multline} \end{thm} \begin{proof} It is easy the see that, $p_{n,d}(1,j)$ is the ways of decomposition of $[n]$ satisfying the following conditions: \begin{itemize} \item (i) $s,m_1,m_2,d_0,d_i,n_i,\lambda_i(1\leq i\leq s)$ are nonnegative integers such that $d_0\leq \frac{m_1+m_2+2}{2}$, $n_i$ is odd ($1\leq i\leq s$), $m_1+m_2$ is even and \[ (m_1+m_2,d_0)+\sum_{i=1}^{s}\lambda_i(n_i,d_i)=(n-3,d). \] \item (ii) $[n]$ is divided into $1+\sum_{i=1}^{s}\lambda_i$ odd order cycles, such that there are $\lambda_i$ cycles of length $n_i$ with $M(\cdot)=d_i$ ($1\leq i\leq s$) and the remaining cycle (denoted by $c$) has length $m_1+m_2+3$ with $M(c)=d_0$. \item (iii) $c$ has $1nj$ as a cyclic factor and $m_1$ numbers belonging to $\{2,3,\dotsm,j-1\}$. \end{itemize} For odd integer $n$ and integer $0\leq d\leq \lfloor \frac{n-1}{2}\rfloor$, let $l(n,d)$ denote the number of cyclic permutations over $[n]$ of length $n$ with $M(\cdot)=d$. When $n>1$, for any such cyclic permutation $(nc_1c_2\dotsm c_{n-1})$, the permutation $c_1c_2\dotsm c_{n-1}$ has length $n-1$ and $d-1$ or $n-d-1$ descents. Since $n$ is odd, $d-1\neq n-d-1$. Noting that $A(n-1,d-1)=A(n-1,n-1-1-(d-1))=A(n-1,n-d-1)$, we have \begin{equation*} l(n,d)=\left\{ \begin{aligned} &2A(n-1,\,d-1), \,\,\, &n>1,\,\,\, d\leq\frac{n-1}{2}, \\ &1,&n=1, \,\,\,d=0. \end{aligned} \right. \end{equation*} According to \cref{Wang and Zhao}, we have \[ B(t,x)=\exp\brk3{x+2 \sum_{k\ge 1}\sum_{d\le k-1} A(2k,d)t^{d+1}\frac{x^{2k+1}}{(2k+1)!}} = \exp\brk3{\sum_{n ~\text{is odd},d}l(n,d)\frac{t^{d}x^{n}}{n!}}. \] Similarly, assume that a odd order cyclic permutation $c=(1nj\pi_1 \pi_2\,\cdots\,\pi_{n-3})$ over $[n]$ with $M(\pi)=d$ has $m$ numbers belonging to $\{2,3,\dotsm,j-1\}$. Then the permutation $j\pi_1 \pi_2\,\cdots\,\pi_{n-3}$ is over $\{2,3,\dotsm,n-1\}$ which have $d-2$ or $n-d-2$ descents. Then the number of such cyclic $c$ is \[ A(n-2,\,d-2,\,j-1)+A(n-2,\,n-d-2,\,j-1)=U(n-2,d-1,j-1). \] Thus for fixed $s,m_1,m_2,d_0,d_i,n_i,\lambda_i(1\leq i\leq s)$ satisfying condition (i), the ways of decomposition of $[n]$ satisfying condition (ii) and (iii) is \begin{multline*} \binom{j-2}{m_1}\binom{n-j-1}{m_2} \dfrac{(n-3-m_1-m_2)!}{\Pi_{i=1}^{s}[(n_i!)^{\lambda_i}\lambda_i!]} \prod_{i=1}^{s}[l(n_i,\,d_i)]^{\lambda_i}\\ \cdot U(m_1+m_2+1,\,d_0-1,\,m_1+1). \end{multline*} Summing over the integers $s,m_1,m_2,d_0,d_i,n_i,\lambda_i(1\leq i\leq s)$ satisfying condition (i) and thus completing the proof. \end{proof} \begin{thm}\label{pndxyz} We have \begin{align}\label{ptxy} P(t,x,y)=tx^2yB(t,x+xy)U(t,x,y). \end{align} \end{thm} \begin{proof} Multiplying each term in \eqref{relofpnd} by $\dfrac{t^{d}x^{n}y^{j}}{(j-2)!(n-j-1)!}$, we obtain \begin{multline*} \dfrac{p_{n,d}(1,j)t^{d}x^{n}y^{j}}{(j-2)!(n-j-1)!} =tx^{2}y\sum_{m_1+m_2+\lambda_1 n_1+\dotsm+\lambda_s n_s=n-3,d_0\leq \frac{m_1+m_2+2}{2},\atop d_0+\lambda_1 d_1+\dotsm+\lambda_s d_s=d, n_i\,\text{is odd},\,m_1+m_2\,\text{is even}} \prod_{i=1}^{s}[\dfrac{t^{d_i}x^{n_i}l(n_i,\,d_i)}{n_i!}]^{\lambda_i}\frac{1}{\lambda_i!}\\ \cdot\dfrac{U(m_1+m_2+1,d_0-1,m_1+1)t^{d_0-1}x^{m_1+m_2+1}y^{m_1+1}}{m_1!m_2!} \binom{n-m_1-m_2-3}{j-m_1-2}y^{j-m_1-2}, \end{multline*} Summing over all integers $n,d,j$ and noting that \[ \sum_{j}\binom{n-3-m_1-m_2}{j-2-m_1}y^{j-2-m_1}=(1+z)^{n-3-m_1-m_2} =\prod_{i=1}^{s}(1+y)^{\lambda_in_i}, \] we have \begin{equation}\label{jieguo} \begin{split} \quad&\quad \sum_{n,d,j}\dfrac{t^{d}x^{n}y^{j}p_{n,d}(1,j)}{(j-2)!(n-j-1)!}\\ &=tx^{2}y\sum_{n,d}\sum_{m_1+m_2+\lambda_1 n_1+\dotsm+\lambda_s n_s=n-3,d_0\leq \frac{m_1+m_2+2}{2}, \atop d_0+\lambda_1 d_1+\dotsm+\lambda_s d_s=d, n_i\,\text{is odd},\,m_1+m_2\,\text{is even}} \prod_{i=1}^{s}[\dfrac{t^{d_i}x^{n_i}(1+y)^{n_i}l(n_i,\,d_i)}{n_i!}]^{\lambda_i}\frac{1}{\lambda_i!}\\ &\quad\cdot\dfrac{U(m_1+m_2+1,d_0-1,m_1+1)t^{d_0-1}x^{m_1+m_2+1}y^{m_1+1}}{m_1!m_2!} \\ &=tx^{2}yB(t,x(1+y))\sum_{m_1+m_2 ~\text{is even}}\sum_{d_0\leq \frac{m_1+m_2+2}{2}} U(m_1+m_2+1,d_0-1,m_1+1)\\ &\quad \cdot\frac{t^{d_0-1}x^{m_1+m_2+1}y^{m_1+1}}{m_1!\,m_2!}\\ &=tx^{2}yB(t,x(1+y))\sum_{n ~\text{is odd},j}\sum_{d\leq\frac{n-1}{2}}\frac{U(n,d,j)t^{d}x^{n}y^{j}}{(j-1)!(n-j)!}\\ &=tx^{2}yB(t,x(1+y))U(t,x,y). \end{split} \end{equation} Thus completing the proof. \end{proof} \section{Proof of \cref{thm:WZ}} Now we are in a position to prove \cref{thm:WZ}. \begin{proof} The conclusion is equivalent to $B(t,x,y)=2P(t,x,y)$. Since $B(t,x,y)$ is uniquely determined by \eqref{Btxy}, we only need to prove \[ (1+t)E(t,x,y)= 2B\brk2{\frac{1}{t},tx(1+y)}P(t,x,y)+2B(t,x+xy)P\brk2{\frac{1}{t},tx,y}. \] According to \eqref{ptxy}, we just need to verify the following equation \begin{multline} \label{final} (1+t)E(t,x,y) = 2tx^2yB\brk2{\frac{1}{t},tx(1+y)}B\brk2{t,x+xy)}U(t,x,y)\\ +\frac{2(tx)^2y}{t}B(t,x+xy)B\brk2{\frac{1}{t},tx(1+y)} U\brk2{\frac{1}{t},tx,y}. \end{multline} According to \cite[Theorem 3.7]{WZ20a}, we have \[ B(t,x)B\brk2{\frac{1}{t},tx}=1+(1+t)A(t,x). \] Then \[ B(t,x+xy)B\brk2{\frac{1}{t},tx(1+y)}=1+(1+t)A(t,x+xy), \] \eqref{final} is equivalent to \[ (1+t)E(t,x,y)=2\,tx^2y\brk2{1+(1+t)A(t,x+xy)}\brk3{U(t,x,y)+U\brk2{\frac{1}{t},tx,y}}. \] According to \cref{utxy3}, we only need to prove \begin{equation*}\label{final1} (1+t)E(t,x,y)=tx^2y\brk2{1+(1+t)A(t,x+xy)}(\hat{U}(t,x,y)-\hat{U}(t,-x,y)). \end{equation*} Plugging the formulas of $A(t,x), \hat{U}(t,x,y)$ and $E(t,x,y)$ into \eqref{final1}, one can complete the proof. \end{proof} With \cref{thm:WZ}, we can prove the following theorem. \begin{thm}\label{RS} We have \[ P(t,x,y,z)=\frac{2y}{1-yz}\brk2{P(t,x,z)-P\brk1{t,xyz,\frac{1}{y}}}. \] \end{thm} \begin{proof} \begin{align*} P(t,x,y,z) & =\sum_{n,d}\sum_{1\leq i<j\leq n-1}\dfrac{2p_{n,d}(i,j) t^{d}x^{n}y^{i}z^{j}}{(j-i-1)!(n-j+i-2)!} \,(~\text{let} \,u=j-i+1)\\ &=\sum_{n,d}\sum_{u=2}^{n-1}\sum_{i=1}^{n-u}\dfrac{2p_{n,d}(1,u) t^{d}x^{n}y^{i}z^{u+i-1}}{(u-2)!(n-u-1)!} \\ &=\frac{2y}{1-yz} \sum_{n,d}\sum_{u=2}^{n-1}\dfrac{p_{n,d}(1,u) (t^{d}x^{n}z^{u}-t^{d}(xyz)^ny^{-u})}{(u-2)!(n-u-1)!} \\ &=\frac{2y}{1-yz}\brk2{P(t,x,z)-P\brk1{t,xyz,\frac{1}{y}}}. \end{align*} \end{proof}
\section{Introduction} \label{sec:introduction} Very light (sub-eV) dark matter (DM) must consist of bosonic particles. Common examples are axions, axion-like particles or dark photons~\cite{Preskill:1982cy,Abbott:1982af,Dine:1982ah,Nelson:2011sf,Arias:2012az}. By virtue of their tiny couplings and very low masses, it is often taken for granted that they make good and cosmologically stable candidates for DM. However, the fact that very light bosonic DM is long lived is far from trivial. Due to their low mass and low velocity, DM made from light bosons features very high occupation numbers which can dramatically enhance interaction rates with other particles and lead to parametric resonance phenomena~\cite{Kofman:1994rk,Shtanov:1994ce,Kofman:1997yn,Berges:2002cz}. For example, in significant parts of the parameter space the stability of axion-like particles towards their decay into photons requires a non-trivial interplay of the expansion of the Universe as well as plasma effects~\cite{Abbott:1982af,Preskill:1982cy,Alonso-Alvarez:2019ssa} (cf.~\cite{Kephart:1986vc,Tkachev:1986tr,Tkachev:1987cd,Tkachev:1987ci,Kephart:1994uy,Espriu:2011vj,Tkachev:2014dpa,Rosa:2017ury,Yoshida:2017ehj,Caputo:2018ljp,Caputo:2018vmy,Hertzberg:2018zte,Sawyer:2018ehf,Arza:2018dcy,Sen:2018cjt,Ikeda:2018nhb,Sigl:2019pmj,Arza:2019nta,Wang:2020zur,Arza:2020eik} for some situations where Bose enhancement from high occupation numbers may lead to interesting signatures for axion-like particles). Of course, these particles do not carry a conserved charge that would naturally render them stable towards decay. One may therefore wonder what happens if the light DM particles are charged and only annihilations with suitable antiparticles are possible. To be concrete, in this work, we want to address the question of cosmological ``stability'' for the case that DM carries a tiny electromagnetic charge~\cite{Goldberg:1986nk,Mohapatra:1990vq,Kors:2005uz,Feldman:2007wj,Cheung:2007ut}, often called \emph{millicharge}. Ample motivation for millicharged particles is provided by Standard Model extensions and, in particular, string theory constructions~\cite{Ignatiev:1978xj,Okun:1983vw,Holdom:1985ag,Dienes:1996zr,Lukas:1999nh,Lust:2003ky,Abel:2003ue,Blumenhagen:2005ga,Batell:2005wa,Blumenhagen:2006ux,Abel:2006qt,Abel:2008ai,Bruemmer:2009ky,Goodsell:2009xc,Shiu:2013wxa}. At the same time, such scenarios may also offer interesting new opportunities for direct detection~\cite{Berlin:2019uco} (for an overview of various detection strategies, see~\cite{Battaglieri:2017aum}). In general, having a conserved electric charge, stability towards particle decay is ensured. However, DM should not carry any net electric charge\footnote{In a scenario where very light bosonic DM does carry an approximately conserved global charge, however, today's net charge density may be non-vanishing~\cite{Alonso-Alvarez:2019pfe}.}. Therefore, it should be composed of an equal number of particles and antiparticles, opening up the possibility of annihilations, for example into radiation\footnote{In principle, a spatial separation of positive and negative charges may be possible~\cite{Gasenzer:2011by}. While we do not have a conclusive argument excluding this possibility, we strongly suspect that such a situation is not viable in the case where the particles in question carry a gauge charge and are supposed to be the dominant form of DM (e.g.~the presence of long range gauge interactions between the regions may modify the equation of state). Moreover, we note that this is, by definition, connected to a very inhomogeneous situation.}. Naively, this seems to be strongly suppressed by the tiny value of the relevant charge that is required by phenomenology (for a review see, e.g.,~\cite{Essig:2013lka}), independent of the question of cosmological stability. However, for low masses, enhancements due to high occupation numbers may set in. Indeed, in this work, we argue that the coherent nature of the very light DM particles can drastically enhance the interaction rates with gauge bosons. This, in turn, can cause an annihilation into photons, even for tiny electromagnetic charges. The basic reason for such an annihilation is that the DM coupling acts as an oscillating mass term for the photons in the coherent DM background. This can drive the gauge bosons into a parametric resonance~\cite{Kofman:1994rk,Shtanov:1994ce,Kofman:1997yn,Berges:2002cz}, such that certain momentum modes are excited quite rapidly. The enhancement of the momentum modes then corresponds to an explosive production of photons. This phenomenon can lead to an efficient depletion of the DM energy density, that seriously challenges the cosmological stability of the DM candidate\footnote{The amplification of gauge fields in the expanding Universe by a parametric resonance from charged scalars has also been considered as a source of large-scale primordial magnetic fields~\cite{Finelli:2000sh}.}. This work is structured as follows. In Section~\ref{sec:paramresonance} we discuss the phenomenon of rapid photon production in a millicharged DM background via a parametric resonance. Furthermore, we carefully examine plasma effects in the early Universe that are able to stop the depletion of the DM energy density. In Section~\ref{sec:kineticmixing} we consider the theoretically preferred situation where the millicharge arises from a hidden (or dark) photon kinetically mixed with its electromagnetic counterpart. A brief summary and discussion can be found in Section~\ref{sec:conclusions}. \section{Resonant Depletion of Millicharged Dark Matter} \label{sec:paramresonance} In a scenario where DM carries electromagnetic charge, it is subject to annihilating into visible particles and, in particular, photons. In this section, we discuss that this depletion of the DM energy density can be drastically enhanced by parametric resonance phenomena~\cite{Kofman:1994rk,Shtanov:1994ce,Kofman:1997yn,Berges:2002cz}, even for tiny charges. This implies that it is necessary to reconsider the cosmological stability of a millicharged DM candidate. Let us illustrate the underlying mechanism in a simple setup where a scalar DM candidate is minimally coupled to the photon, \begin{equation} \mathcal{L} = - \frac{1}{4} F^2 + \left( D_{\mu} \phi \right)^{\dagger} D^{\mu} \phi - m^2 \phi^{\dagger} \phi \, . \label{eq:LagrangianScalarQED} \end{equation} Here, $F_{\mu \nu}$ is the electromagnetic field strength associated to the photon $A_\mu$, $\phi$ is the DM of mass $m$ and charge $q$ and $D_{\mu} = \partial_{\mu} + i q A_{\mu}$ denotes the gauge-covariant derivative\footnote{Here, we absorbed the gauge coupling into the definition of the charge, as there is only a single field involved.}. We are interested in very light, possibly sub-eV, DM particles, which, due to their extremely high occupation numbers, can be described by classical fields. They furthermore require a non-thermal production which is, for instance, provided by the misalignment mechanism~\cite{Preskill:1982cy,Abbott:1982af,Dine:1982ah,Sikivie:2006ni,Nelson:2011sf,Arias:2012az} (but other mechanisms such as, e.g.,~\cite{AlonsoAlvarez:2019cgw,Ringwald:2015dsf,Co:2017mop,Agrawal:2018vin,Dror:2018pdh,Co:2018lka,Bastero-Gil:2018uel,Long:2019lwl,Peebles:1999fz,Graham:2015rva,Nurmi:2015ema,Kainulainen:2016vzv,Bertolami:2016ywc,Cosme:2018nly,Alonso-Alvarez:2018tus,Markkanen:2018gcw,Graham:2018jyp,Guth:2018hsa,Ho:2019ayl,Tenkanen:2019aij} may also give suitable DM densities). In first approximation the observed DM energy density can be understood as coherent oscillations of a spatially homogeneous\footnote{Indeed, in the case of the misalignment mechanism and if the field already exists during inflation, any fluctuation is stretched out by inflation, thereby providing for homogeneity.} complex scalar field $\phi$ in the expanding Universe. We can decompose the field, \begin{equation} \phi = \varphi \exp \left( i \chi \right) / \sqrt{2} \, . \end{equation} In these coordinates, charge neutrality is ensured by trivial dynamics for the angular degree of freedom\footnote{During inflation any non-trivial dynamics of $\chi$ is diluted quickly, $\dot{\chi} \propto a^{-3}$.}, $\chi = \mathrm{const}$, and without loss of generality we can take $\chi=0$. The radial mode then oscillates with decreasing amplitude \begin{equation} \begin{split} \varphi(t) & = \varphi_0 \left( \frac{a_0}{a(t)} \right)^{\frac{3}{2}} \cos \left( m \left(t-t_0\right)\right) \\ & = \Phi(t) \cos \left( m \left(t-t_0\right)\right) \, . \end{split} \label{eq:oscillation} \end{equation} Here, $a(t)$ is the scale factor and $t_0$ denotes the time today with scale factor $a_0$. Moreover, \begin{equation} \varphi_{0}=\frac{\sqrt{2\rho_{0}}}{m} = 4.5 \times 10^{-6} \, {\rm eV}\left(\frac{{\rm eV}}{m}\right)\left(\frac{\rho_{0}}{\rho_{\mathrm{DM}}}\right)^{\frac{1}{2}} \end{equation} is the (average) oscillation amplitude today where we use $\rho_{\mathrm{DM}} = 1.3 \, \mathrm{keV/cm^3}$~\cite{Aghanim:2018eyx} as a reference value. The energy density associated to the scalar field then dilutes as $\rho_\phi \sim a^{-3}$, as appropriate for a cold DM particle. \subsection{Rapid photon production via parametric resonance} Obviously, the requirement that the energy density of $\phi$ scales like that of pressureless matter is not entirely sufficient for making it the DM. In addition, a viable DM candidate also has to be cosmologically stable. Crucially, since in our scenario $\phi$ carries electromagnetic charge, annihilation channels to photons are open, eventually challenging its stability. In the simple theory~\eqref{eq:LagrangianScalarQED}, the main example of a depletion mechanism would be the pairwise annihilation of DM particles, $\phi \phi \to AA$. As we will now show, even for tiny electromagnetic charges, the interaction rates of this channel can be significantly enhanced by resonance effects that lead to an explosive production of photons. To see this, let us consider photon modes in the classical DM background during the evolution of the Universe. These satisfy \begin{equation} \ddot{A} + H \dot{A} + \left( \frac{k^2}{a^2} + q^2 \varphi^2 \right) A = 0 \, , \label{eq:EomPhotons} \end{equation} where $A$ denotes a polarization mode of momentum $k$ and $H$ is the Hubble parameter. $A$ collectively describes the spatial components of the gauge potential $A_{\mu}$, while we fix the temporal components by the Lorentz gauge condition $\partial_\mu \left( \sqrt{-g} A^\mu \right) = 0$. Once the DM field has overcome the Hubble friction, $H \lesssim m$, it oscillates according to Eq.~\eqref{eq:oscillation} with amplitude $\Phi(t)$. In this scenario, the equation of motion~\eqref{eq:EomPhotons} can be rewritten as a differential equation of Mathieu type~\cite{McLachlan:1951}, \begin{equation} \frac{\mathrm{d}^2}{\mathrm{d} x^2} A + \left( \mathcal{A}_k - 2 \mathcal{Q} \cos \left( 2 x\right) \right) A = 0 \, , \label{eq:Mathieu} \end{equation} with $x = mt$ and we have defined \begin{equation} \label{eq:qa} \mathcal{A}_k = \frac{k^2}{a^2 m^2} + \frac{3}{4} \frac{H^2}{m^2} + 2 \mathcal{Q} \, , \enspace \mathcal{Q} = \frac{q^2 \Phi^2}{4m^2} \, . \end{equation} The interaction with the millicharged DM acts as an oscillating mass term for the photons. It is therefore possible that some mode functions are enhanced by resonance effects, known as parametric resonance~\cite{Kofman:1994rk,Shtanov:1994ce,Kofman:1997yn,Berges:2002cz}. As the mode functions determine the occupation number of the gauge bosons, \begin{equation} n_k = \frac{\omega_k}{2} \left( \frac{\absl{\dot{A}}^2}{\omega_k^2} + \abs{A}^2 \right) \, , \end{equation} this process corresponds to a resonant production of photons. Crucially, the solution of~\eqref{eq:Mathieu} contains an exponential factor, $A \propto \exp \left( \mu_k x \right)$, with Floquet exponent $\mu_k$. This exponent is in general a complex number which, importantly, can have a positive real part\footnote{This can, for instance, be read off from the instability chart of $\mathcal{A}_k$ and $\mathcal{Q}$ of the Mathieu equation (see, e.g.,~\cite{McLachlan:1951}).}. For the purpose of our work, we will exclusively focus on the case where $\mu_k$ is purely real and positive. This corresponds to an exponential growth of the respective momentum modes, \begin{equation} n_k \propto \exp \left( 2 \mu_k m t \right) \, . \label{eq:numberdensityexponential} \end{equation} That is, the rate of photon production is governed by the Floquet exponent $\mu_k$, which, in general, is a function of $\mathcal{A}_k$ and $\mathcal{Q}$. Depending on the dynamics of the Mathieu equation, a parametric resonance can be considered in two different regimes. In a narrow resonance ($\mathcal{Q} \ll 1$) only very few momentum modes are enhanced, while the opposite is true in a broad resonance ($\mathcal{Q} \gg 1$). Both regimes feature resonant instabilities, which ultimately lead to an explosive production of photons. For simplicity, let us collect a few important properties of these resonance bands for our discussion. For details on the dynamics of the Mathieu equation in general and its instability bands in particular we refer the reader to~\cite{McLachlan:1951}. \subsubsection{Narrow vs broad resonance} Let us first understand the characteristic behaviour of the Mathieu equation, while neglecting the expansion of the Universe. This serves as the basis on top of which we can later include the consequences of expansion. \bigskip In the narrow resonance regime, where $\mathcal{Q} \ll 1$, the instability bands of the Mathieu equation feature a small width. In our case, this means that only a limited range of momentum modes is resonantly enhanced. The first instability band is the dominant one, as it contributes to the exponential growth with the largest Floquet exponent. The latter is given by~\cite{McLachlan:1951} \begin{equation} \mu_k = \frac{1}{2} \sqrt{ \ensuremath{{\mathcal{Q}}}^2 - \left( \frac{k^2}{m^2} - 1 + 2 \ensuremath{{\mathcal{Q}}} \right)^2} \, . \label{eq:narrowmu} \end{equation} Furthermore, to good approximation, in momentum space the resonance bandwidth reads~\cite{McLachlan:1951} \begin{equation} \label{eq:narrowdelta} \Delta k \sim m \mathcal{Q} \, . \end{equation} In combination with the requirement $\ensuremath{{\mathcal{Q}}}\ll 1$ this justifies the name \emph{narrow} resonance. Up to corrections of order $\ensuremath{{\mathcal{Q}}}$, the Floquet exponent is maximal for momenta of the order of the DM mass, $k_\ast \simeq m$, such that $\mu_{k_\ast} = \mathcal{Q}/2$. This is essentially the same result that one would obtain from a perturbative approach to interaction rates in $\phi \phi \to AA$ processes, if Bose enhancement is taken into account (see, e.g.,~\cite{Baumann:GraduateCourse}). \bigskip In the broad resonance regime, where $\mathcal{Q} \gg 1$, the situation is more complicated. Here, exact expressions for the Floquet exponents are not available. Therefore, we will use analytic approximations of $\mu_k$ given in~\cite{Fujisaki:1995ua,Fujisaki:1995dy}. As their precise form is not very enlightening, we do not quote the full expressions here. Instead, we give some approximate numbers and behaviours to facilitate the discussion. That is, typical values of the exponent for a wide range of momenta are $\mu_k \sim 0.15$ and it can obtain a maximum value of $\mu_{k_{\ast}} \sim \log \left(1 + \sqrt{2} \right) / \pi \approx 0.28$~\cite{Fujisaki:1995ua,Fujisaki:1995dy}. As a rough approximation one can therefore estimate~\cite{Fujisaki:1995ua,Fujisaki:1995dy} \begin{equation} \label{eq:broadmu} \mu_k \sim 0.15-0.28 \, , \end{equation} within the resonance bandwidth. Importantly, this does not strongly depend on $\ensuremath{{\mathcal{Q}}}$. The width of the instability band is then typically of the order~\cite{Kofman:1997yn} \begin{equation} \label{eq:broaddelta} \Delta k \sim m \mathcal{Q}^{\frac{1}{4}} \, , \end{equation} which can be parametrically large for $\mathcal{Q} \gg 1$. Moreover, we note that in the broad resonance regime we typically have to take multiple instability bands into account, once the expansion of the Universe is considered. Luckily, the above rough expressions hold for all of them. In addition, we remark that the typical distance in $\ensuremath{{\mathcal{Q}}}$ between resonance bands of the exponent $\mu_k \left( \mathcal{A}_k(\ensuremath{{\mathcal{Q}}}), \ensuremath{{\mathcal{Q}}} \right)$, for momenta of the order $k \lesssim \Delta k$, is \begin{equation} \Delta \ensuremath{{\mathcal{Q}}} \sim \sqrt{\ensuremath{{\mathcal{Q}}}} \, . \end{equation} The narrow and broad resonance regime can behave very differently with respect to the depletion of the DM energy density. Generally speaking, a broad resonance is typically more efficient, as more momentum modes are within the resonance band at the same time and the exponent is typically larger. That said, for our discussion the dependence of the rate of exponential growth, given by $\mu_k$, as well as the width of the resonance $\Delta k$ on the parameter $\ensuremath{{\mathcal{Q}}}$ is important. In the narrow resonance regime, the former is parametrically given by $\mu_k \sim \mathcal{Q}$ while for a broad resonance it is typically of the order $\mu_k \sim 0.15$, largely independent of $\ensuremath{{\mathcal{Q}}}$. The bandwidth of both regimes is also considerably modified, i.e.~$\Delta k \sim m \mathcal{Q}$ for a narrow and $\Delta k \sim m \mathcal{Q}^{1/4}$ for a broad resonance, respectively. As we will see in the following section, both aspects are crucial for an explosive production of photons. \subsubsection{Including the expansion of the Universe} The previous discussion of the dynamics of the Mathieu equation only applies to a static situation. However, in the early Universe the expansion cannot be neglected. In this case, the parameters $\mathcal{A}_k$ and $\mathcal{Q}$ explicitly depend on the scale factor. Strictly speaking, the concept of (static) resonance bands then ceases to be meaningful. Nevertheless, if the changes are sufficiently slow (compared to the time-scale of the DM oscillations) we can still get a reasonable picture by imagining the movement of a given momentum mode $k$ along the trajectory $\left(\mathcal{A}_{k}(t) , \, \ensuremath{{\mathcal{Q}}}(t) \right)$ through the instability chart. For instance, the system might start to evolve within a broad resonance, but as $\mathcal{Q}$ decreases with time, it eventually ends up in a narrow resonance regime before it terminates. In a situation where $\mathcal{Q}$ may change significantly between consecutive oscillations of the driving DM field $\phi$, one would instead have to move from a parametric resonance to a so called \emph{stochastic} resonance~\cite{Kofman:1997yn}. Here, with a single oscillation of $\phi$ the phase of each photon mode is drastically altered, such that they are practically uncorrelated at any stage of photon production. Therefore, due to interferences, the number of photons produced typically increases but can also decrease with progressing DM oscillations, thereby slightly reducing the efficiency of the resonance. For a detailed discussion of the phenomenon of a stochastic resonance in an expanding Universe, we refer the reader to~\cite{Kofman:1997yn}. Such a thorough treatment of stochastic resonance is beyond the scope of this work. We therefore follow the more intuitive approximate approach outlined above, which has already been pursued in~\cite{Alonso-Alvarez:2019ssa}. For our purpose, the most important difference between the static and the dynamical situation is that the photons experience a redshift as the Universe expands. Mathematically, the Mathieu parameter $\mathcal{A}_{k}$ directly depends on the physical momentum of the mode, $ \propto k/a$, which changes with time. Each mode therefore only spends a finite amount of time in the resonant region. This can prevent the DM from efficiently annihilating into photons, if the latter are shifted out of a resonance quickly enough. After a short amount of time $\delta t$, the momentum of a photon mode is shifted by~\cite{Alonso-Alvarez:2019ssa} \begin{equation} \frac{\delta k}{k} \simeq H \delta t \, , \label{eq:redshift} \end{equation} where $\delta t$ is thought to be differential on cosmological scales, $\delta t \ll H^{-1}$. That is, the momentum modes of the photons can only grow exponentially for a short amount of time, $\delta t_{\exp} \sim 1 / (2 \mu_k m)$, before they get shifted out of the resonance band, $\delta t_{\exp} \lesssim \delta t$. While this is a universal feature that eventually terminates the resonant production of gauge bosons, its physical manifestation within the Mathieu dynamics has to be established carefully. In particular, there can be differences between a narrow and a broad resonance due to the significant modifications of the instability chart in these regions. Hence, we will discuss both scenarios separately. \bigskip \paragraph{Narrow resonance} In a narrow resonance the Floquet instabilities occur at integer values of $k/m$ (see also Fig.~\ref{fig:mdm-instabilitychart}). In this regime, the lowest instability band, corresponding to the momentum $k_\ast \simeq m$, is the most effective and we focus on this in our analysis. Hence, effectively, there is only a single resonance band that can induce an exponential growth of the photon modes. At the same time the expansion of the Universe can redshift the photons out of this instability, thereby preventing their resonant enhancement. That is, naively, there is a competition between the characteristic time of exponential growth determined by the Floquet exponent and the time the photon modes spend inside the resonance band. Reversing this argument, it can be written as a naive condition to \emph{avoid} the rapid production of photons in the DM background, \begin{equation} \frac{1}{2 \mu_{k_\ast} m} \gtrsim \frac{\delta k}{k_\ast} \frac{1}{H} \, . \label{eq:StabilityNaive} \end{equation} Obviously, this requirement is time dependent. Loosely speaking, the condition has to be satisfied at all times in the narrow resonance regime in order to avoid the complete fragmentation of the DM field and thereby to guarantee the cosmological stability of the DM candidate. The stability condition~\eqref{eq:StabilityNaive} so far only takes into account the growing exponential factor of the photon mode functions. However, as there can still be a small prefactor in front, a single short burst of rapid photon production may not be sufficient to trigger a complete annihilation of the DM field. Instead, the latter is only effective, if a significant amount of energy is transferred from the DM to the photons, i.e.~if $\rho_A / \rho_\phi$ grows sufficiently that it becomes of order unity\footnote{When $\rho_A / \rho_\phi \sim 1$, we expect our description of the coherent DM field to break down and backreaction effects to become important. We will comment more on this later. For now, we note that this is the reason we often use the word ``fragmentation'' indicating the loss of the coherent condensate instead of speaking of ``annihilation''.}. This, in turn, can be used to obtain a more precise condition for its cosmological stability. While the DM energy density schematically reads $\rho_\phi \simeq m^2 \Phi^2 / 2$, the energy density of the photons can be obtained by summing over all modes\footnote{Here, we consider one polarization mode. In principle, the two polarizations of the photons grow equally fast leading to a factor of 2 in the energy density, which, however, has only a negligible effect on the limits we will derive.} \begin{equation} \rho_A = \frac{1}{\left(2 \pi a\right)^3} \int \mathrm{d}^3 k \, \omega_k n_k \, , \label{eq:EnergyDensityPhotons} \end{equation} where $\omega_k$ denotes the energy of each momentum mode. Indeed, if the sub-exponential prefactor of $n_k$ in~\eqref{eq:numberdensityexponential} is small, the resonance needs to be active for a considerable amount of time to transfer a significant amount of energy from the DM field into photons, \begin{equation} \delta T = \frac{\zeta}{2 \mu_k m} \, . \end{equation} In practice, the factor $\zeta$ depends on the initial conditions associated to the photon mode functions. Following~\cite{Alonso-Alvarez:2019ssa}, the sub-exponential correction can be estimated via a saddle-point approximation of~\eqref{eq:EnergyDensityPhotons}. It schematically reads \begin{equation} \zeta \sim \log \left( \frac{1}{n_0} \sqrt{\frac{m}{H}} \frac{\Phi}{qm} \right) \, , \end{equation} where $n_0$ is the initial occupation number of the photon modes, which can be determined by vacuum fluctuations or CMB photons, $n_0 = 1/2$ or $n_0 \simeq 2 T_{\mathrm{CMB}} / m$, respectively. The prefactor $\zeta$ can then be chosen conservatively, i.e.~corresponding to the larger of both options. Finally, requiring that the photons are redshifted out of the resonance quickly enough to avoid a complete fragmentation of the DM field yields a condition for the stability of the DM candidate, \begin{equation} \zeta \gtrsim 2\frac{\Delta k}{k_{\ast}} \frac{m}{H}\mu_{k_{\ast}} \, . \label{eq:DMstabilitycondition} \end{equation} Using $\Delta k / k_{\ast} = \ensuremath{{\mathcal{Q}}}$ and $\mu_{k_{\ast}} = \ensuremath{{\mathcal{Q}}} / 2$, this condition reads $\zeta \gtrsim (m/H) \ensuremath{{\mathcal{Q}}}^2$ (see also~\cite{Kofman:1997yn}). Therefore, in a narrow resonance, to avoid a fragmentation of the DM field its electromagnetic charge $q$ has to satisfy \begin{equation} \log \left( \frac{1}{n_0} \sqrt{\frac{m}{H}} \frac{\Phi}{qm} \right) \gtrsim \frac{m}{H} \left( \frac{q \Phi}{2m} \right)^4 \, . \label{eq:DMstabilityconditionNarrow} \end{equation} In principle, to guarantee stability this inequality must hold at all times of the cosmic evolution. However, to ensure consistency, the system has to be in the narrow resonance regime, $\ensuremath{{\mathcal{Q}}} \ll 1$. In general, this is not necessarily the case. For example, as typically $\zeta\sim 10-100$, this condition is not consistent with the narrow resonance regime for $m/H \sim \mathcal{O} (1)$~\cite{Kofman:1997yn}. It is therefore worthwhile to also consider the broad resonance regime. \bigskip \paragraph{Broad resonance} In a broad resonance the instability chart of the Mathieu equation is more complicated. In contrast to the case of a narrow resonance, the instability bands are not sharply localized around integer values of $k/m$. Instead, for a fixed $\ensuremath{{\mathcal{Q}}}$, they can extend from a typical scale of $k_\ast \sim m \ensuremath{{\mathcal{Q}}}^{1/4}$ down to possibly even vanishing momentum (see also Fig.~\ref{fig:mdm-instabilitychart}). This means that, as the Universe expands, a given momentum within a certain instability band is not redshifted out of a \emph{single} resonance, but, because $\ensuremath{{\mathcal{Q}}}$ decreases similarly as $\ensuremath{{\mathcal{Q}}} \sim a^{-3}$, it can cross multiple instability bands before it enters the regime of a narrow resonance. Therefore, the photon mode can experience multiple resonant enhancements on its trajectory through the instability chart. As an approximation we can model this by summing up all resonances that a given $k$-mode crosses, \begin{equation} n_k \propto \exp \left(2 m \int \mathrm{d} t \, \mu_k(t) \right) \, . \end{equation} Since the Mathieu parameter $\ensuremath{{\mathcal{Q}}}$ is now a function of time, in a radiation-dominated Universe the exponent can be written as \begin{equation} m \int \mathrm{d} t \, \mu_k(t) = \frac{1}{3} \frac{m}{H} \left(\frac{q \Phi}{2m} \right)^{\frac{4}{3}} \int \mathrm{d} \ensuremath{{\mathcal{Q}}} \, \frac{\mu_k \left( \ensuremath{{\mathcal{Q}}} \right)}{\ensuremath{{\mathcal{Q}}}^{\frac{5}{3}}} \, . \end{equation} As pointed out above, within the instability bands for the range of momenta $k \leq \Delta k \sim m \ensuremath{{\mathcal{Q}}}^{1/4}$, the Floquet exponent takes typical values of $\mu_k \sim 0.15 - 0.28$, which are mostly independent of $\ensuremath{{\mathcal{Q}}}$ to good approximation. In this case, the bands can be assumed to be of width and distance of order $\sqrt{\ensuremath{{\mathcal{Q}}}}$ in $\ensuremath{{\mathcal{Q}}}$. Hence, the integration of $\mu_k$ is dominated by small values of $\ensuremath{{\mathcal{Q}}}$. As a rough approximation we can therefore choose the integration boundaries to be $\ensuremath{{\mathcal{Q}}}_{-} = 1$ (beginning of the broad resonance region) and $\ensuremath{{\mathcal{Q}}}_{+} = \infty$. Evaluating this numerically we find \begin{equation} \kappa (k) = \int_1^{\infty} \mathrm{d} \ensuremath{{\mathcal{Q}}} \, \frac{\mu_k \left( \ensuremath{{\mathcal{Q}}} \right)}{\ensuremath{{\mathcal{Q}}}^{\frac{5}{3}}} \approx \begin{cases} 0.13 \, , & k = 0 \\ 0.046 \, , & k = m \ensuremath{{\mathcal{Q}}}^{1/4} \end{cases} \, , \label{eq:kappa} \end{equation} with monotonically decreasing values within those limiting cases. Similar to the case of a narrow resonance, the fragmentation of the DM field is efficient (ultimately leading to a breakdown of our description of the DM oscillations), if a significant fraction of energy is transferred from the DM to the photons, $\rho_A / \rho_\Phi \sim 1$. Again, this requirement can be translated into a stability condition for the DM candidate, \begin{equation} \log \left( \frac{8 \pi^{3/2}}{\sqrt{3} n_0} \sqrt{\frac{m}{H}} \frac{\kappa}{q^2 \epsilon^3} \right) \gtrsim \frac{2\kappa}{3} \frac{m}{H} \left( \frac{q \Phi}{2m} \right)^{\frac{4}{3}} \, , \label{eq:DMstabilityconditionBroad} \end{equation} where we take account of modes up to $k=\epsilon m \ensuremath{{\mathcal{Q}}}^{1/4}$ in the energy density. This is the broad resonance equivalent to the stability requirement~\eqref{eq:DMstabilityconditionNarrow}, which is applicable in the narrow resonance regime. Note that in determining this expression we have made several rough approximations. As already stated above we have neglected the dependence on the upper integration boundary in~\eqref{eq:kappa}. This ignores contributions suppressed by an inverse power of $\ensuremath{{\mathcal{Q}}}$. We have also used that, due to the exponential growth in the modes, the biggest drain in energy occurs at late times and therefore evaluated the energy drain only at the end of the broad resonance regime. Moreover, using a fixed $\kappa$ we have neglected that during the evolution the physical momentum of each mode decreases as $k \sim a^{-1}$ and therefore the exponent changes. Finally, in line with all these approximations we have simply dropped terms logarithmic in $\ensuremath{{\mathcal{Q}}}$. \bigskip \paragraph{Discussion} The stability conditions~\eqref{eq:DMstabilityconditionNarrow} and~\eqref{eq:DMstabilityconditionBroad} put strong constraints on the value of the electromagnetic charge of the DM. Before explicitly evaluating them, let us first get some analytical understanding. In principle, in order to avoid the resonant depletion of the DM, both conditions have to complement each other such that either one of them is satisfied at all times of the cosmic evolution. As we have pointed out before, we expect the fragmentation of the DM field to first be governed by a broad resonance. Then, as $\ensuremath{{\mathcal{Q}}}$ decreases with time in an expanding Universe, $\ensuremath{{\mathcal{Q}}} \sim a^{-3}$, the system will enter the narrow resonance regime before the fragmentation eventually terminates (given that the coherent field is not completely destroyed at that point). Therefore, in practice, one has to carefully establish which stability condition gives the correct, i.e.~self-consistent, constraint on the millicharge at each time. This depends on the charge as well as on the time when the stability condition is evaluated. \begin{figure} \centering \includegraphics[width=0.8\columnwidth]{mdm-paramspace_plasma} \caption{Allowed electromagnetic charge $q$ of the scalar DM candidate as a function of its mass $m$. The solid blue line corresponds to the stability condition due to parametric resonance, evaluated at the time where plasma effects terminate the latter, i.e.~where $m_A \simeq m$. The dashed and dash-dotted blue lines illustrate an estimate of where plasma photons with $m_{A}>m$ may be produced due to a broad resonance, Eq.~\eqref{eq:ResonanceHighMass}, evaluated when $m_A / m = 1$ and $m_A / m = 100$, respectively. For comparison, the dotted blue line shows the narrow resonance condition evaluated close to the earliest possible time, $1000 \, t_\ast$, while plasma effects are neglected, $m_A = 0$. The observational constraints are given by CMB observations~\cite{Xu:2018efh}, SN1987A~\cite{Chang:2018rso} and stellar cooling (SC)~\cite{Davidson:2000hf}, pulsar timing arrays~\cite{Caputo:2019tms} or by interactions with magnetic fields in galaxies and clusters~\cite{Kadota:2016tqq,Stebbins:2019xjr}. In these limits, the dashing indicates regions where we have used very naive extrapolations from the high-mass regime.} \label{fig:mdm-paramspace_plasma} \end{figure} In general, it is \emph{a priori} not at all obvious, what time gives the strongest possible constraint on $q$. In fact, both regimes~\eqref{eq:DMstabilityconditionNarrow} and~\eqref{eq:DMstabilityconditionBroad} behave very differently with the scale factor. To see this, we insert the evolution of the DM amplitude, $\Phi \sim a^{-3/2}$, and the behaviour of the Hubble constant during radiation domination, $H \sim a^{-2}$, into the exponential factor (i.e.~the right hand side) of both stability conditions. For a narrow resonance we obtain \begin{equation} \frac{m}{H} \left( \frac{q \Phi}{2m} \right)^4 \sim a^{-4} \, , \label{eq:scalingnarrow} \end{equation} while, in contrast, the broad resonance regime behaves as \begin{equation} \frac{2\kappa}{3} \frac{m}{H} \left( \frac{q \Phi}{2m} \right)^{\frac{4}{3}} \sim \mathrm{const} \, . \label{eq:scalingbroad} \end{equation} This suggests that in the narrow resonance regime the strongest constraint arises when evaluating at the earliest possible time, whereas the broad resonance case appears to be independent of the scale factor. Let us consider both scenarios. In case of a narrow resonance, Eq.~\eqref{eq:scalingnarrow} suggests that we should evaluate the stability condition when $\phi$ just starts to oscillate, i.e.~at $t_{\ast}$ when $H \simeq m$. However, as noted before, fulfilling~\eqref{eq:DMstabilityconditionNarrow} with $\zeta \sim 10-100$ is inconsistent with the narrow resonance regime at $t_\ast$. Hence, we either have to evaluate at a somewhat later time when $H\ll m$ or go into the regime of a broad resonance. For the strongest self-consistent constraint on the millicharge in the narrow resonance regime we can evaluate at $t \approx 1000 \, t_\ast$. In contrast, in the broad resonance regime, Eq.~\eqref{eq:scalingbroad} suggests that the constraint on the millicharge is independent of the time when the stability condition is evaluated. This suggests that the limit does not strengthen much when approaching the broad resonance regime\footnote{We note that the complete independence of the evaluation time is, of course, due to the simplistic approximations we employ.}. Indeed, we have checked that~\eqref{eq:DMstabilityconditionBroad} roughly provides for the same limit as~\eqref{eq:DMstabilityconditionNarrow} evaluated at $t \approx 1000 \, t_\ast$. A numerical evaluation of the stability condition~\eqref{eq:DMstabilityconditionNarrow} at $t_1 \equiv 1000 \, t_\ast$ is shown as the dotted blue line in Fig.~\ref{fig:mdm-paramspace_plasma}. However, this estimate is probably too optimistic as we still need to include plasma effects, which we will do next. \subsection{Photons inside the early Universe plasma} \label{subsec:plasma} So far, we have assumed that the photons are moving freely through the Universe. However, during the cosmological evolution, the early Universe is filled with a hot plasma that modifies their propagation. Indeed, for example in the case of axion-like particles, this is the dominant effect ensuring their stability~\cite{Preskill:1982cy,Abbott:1982af,Alonso-Alvarez:2019ssa}. Therefore, it is sensible to also consider this effect for the case of millicharged DM (a discussion of parametric resonance in charged cosmological scalars can also be found in~\cite{Finelli:2000sh} but they were focused on primordial magnetic fields rather than DM). Naively, the photons interact with the charged particles of the medium such that they acquire a modified dispersion relation (and wavefunction renormalization), see e.g.~\cite{Raffelt:1996wa}. Effectively they acquire a mass, $m_A$. In Eqs.~\eqref{eq:Mathieu} and \eqref{eq:qa} this leads to the replacement $k^2/a^2 \to k^2/a^2 + m_A^2$. Therefore, $\mathcal{A}_{k}$ is larger and, if the plasma mass is too high, the resonance becomes inefficient. In particular, in a narrow resonance regime the instabilities become ineffective if the plasma mass exceeds the mass of the DM candidate, $m_A \gtrsim m$. For nearly all $k$ the rate of exponential growth $\mu_k$ becomes imaginary, corresponding to an oscillating rather than a growing mode function. In contrast, in a broad resonance, the production of photons with masses $m_A \gg m$ is in principle possible\footnote{We thank Paola Arias, Ariel Arza and Diego Vargas for very useful discussions (triggered by the helpful comments of an anonymous referee for~\cite{Arias:2020tzl}) on this issue in a similar system.}. However, this process requires comparatively large couplings in general. In particular, photon production in this regime can only be efficient for charges satisfying~\cite{Kofman:1997yn} \begin{equation} q \gtrsim 4 \frac{m_A^2}{m \Phi} \, . \label{eq:ResonanceHighMass} \end{equation} Overall, we therefore expect that this possibility will result in a weaker constraint on the electromagnetic millicharge (see also the example below). The plasma mass of the photon depends on the temperature of the medium. That is, in an expanding Universe, it is time dependent\footnote{We use the cosmological evolution of $m_A$ as given in~\cite{Alonso-Alvarez:2019ssa} which is based on~\cite{Raffelt:1996wa,Braaten:1993jw,Redondo:2008ec,Mirizzi:2009iz,Dvorkin:2019zdi}.}. As noted above, in practice, the condition $m_A \lesssim m$ sets the earliest time at which the (narrow resonance) stability condition~\eqref{eq:DMstabilityconditionNarrow} can be evaluated and turns out to stabilize the scalar DM candidate in large parts of parameter space of the vanilla theory of millicharged DM. We show this as a solid blue line in Fig.~\ref{fig:mdm-paramspace_plasma}. In the broad resonance regime, the production of photons with masses above the DM mass is possible, but for this, larger charges are needed. In particular, as a minimal requirement, the broad resonance must be strong enough to overcome the mass threshold. This requires fulfilling the condition~\eqref{eq:ResonanceHighMass}. This is usually already a weaker requirement than evaluating the narrow resonance stability condition at the point at which the photon mass is small enough for the narrow resonance to be active. As an example, this is demonstrated by a dashed and a dashdotted blue line in Fig.~\ref{fig:mdm-paramspace_plasma}, where we choose times when the plasma mass is of the order of $m_A / m = 1$ and $m_A / m = 100$, respectively. Looking at Fig.~\ref{fig:mdm-paramspace_plasma} we can see the drastic impact of the plasma effects. Comparing the naive estimate that completely neglects plasma effects (dotted blue line) with the constraint taking into account the plasma effects (solid blue line), the former turns out to be many orders of magnitude stronger. Indeed, we observe that in the regime of very low masses, the stability condition on millicharged DM is a weaker requirement than current observational constraints~\cite{Xu:2018efh,Chang:2018rso,Davidson:2000hf,Caputo:2019tms,Kadota:2016tqq,Stebbins:2019xjr}\footnote{As indicated also in the figure, for some constraints we have extremely naively extrapolated to very small masses. Moreover, we note, that most of the DM constraints have been derived having at least implicitly particles in mind. It may therefore be worthwhile to rethink and check their validity in the fully wave-like regime. In this sense the stability constraints may even find some non-trivial application in this model. In this case the caveats on coherence and backreaction discussed in the next section should, however, also be taken into account.}. While this is desirable from a physical point of view, the simple model we have considered in this section is disfavoured from a theoretical point of view, as quantization of electromagnetic charge would be hard to justify. Let us therefore turn to a more realistic and appealing theory involving a hidden photon that is kinetically mixed with the visible sector. \section{Millicharged Particles arising from a Kinetic Mixing of a Hidden Photon with the Visible Sector} \label{sec:kineticmixing} From a theoretical point of view, a fundamental millicharge is unappealing with respect to charge quantization. A well motivated alternative is provided by kinetic mixing~\cite{Holdom:1985ag}. A simple example of this scenario is an additional massless hidden photon $X_{\mu}$ that is kinetically mixed with the electromagnetic photon $A_{\mu}$~\cite{Holdom:1985ag}, \begin{equation} \mathcal{L}_\epsilon = -\frac{\epsilon}{2} F_{\mu \nu} X^{\mu \nu} \, . \end{equation} For a hidden sector matter particle $\phi$ (in our case the DM candidate) carrying a (quantized) charge $q$ under $X_{\mu}$, a small effective electromagnetic charge appears after diagonalizing the kinetic term. To see this, one can rotate the gauge fields by $A_{\mu} \to A_{\mu}$ and $X_{\mu} \to X_{\mu} + \epsilon A_{\mu}$. While this redefinition leads to canonically normalized kinetic terms of the gauge fields, it also appears in the gauge-covariant derivatives of the hidden sector matter field, \begin{equation} D_{\mu}\phi=(\partial_{\mu}+qg X_{\mu})\phi \rightarrow (\partial_{\mu}+qg X_{\mu}+\epsilon q g A_{\mu}) \phi \, , \end{equation} where $g$ is the hidden sector gauge coupling. As a consequence, the DM carries an effective electromagnetic charge~\cite{Holdom:1985ag} \begin{equation} q_{\mathrm{eff}} = \epsilon q g \, , \label{eq:chargekineticmixing} \end{equation} where we have again absorbed the factor of the electromagnetic coupling $e$ into the charge. In this way, a small $\epsilon$ (and possibly also $g$) can lead to a tiny electromagnetic charge, even if $q$ is integer\footnote{Such a situation has, for instance, been explored in order to mediate long-range forces between hidden sector particles (see, e.g.,~\cite{Ackerman:mha,Foot:2014uba}).}. In general, the amount of kinetic mixing is a free parameter and $\epsilon$ may even be of order one. However, if we consider the hidden photon to be part of a hidden sector we usually expect that the mixing is small. For instance, the hidden gauge group may be understood as a low-energy remnant of a UV theory with a unified gauge symmetry broken at some high scale~\cite{Bruemmer:2009ky}. After symmetry breaking, some degrees of freedom, for instance a heavy fermion, usually carry a charge both under electromagnetism as well as the hidden gauge group. Quantum mechanically, a kinetic mixing between both gauge fields is then induced by a fermion loop of the UV theory. At low energies, the kinetic mixing parameter is determined by the corresponding one-loop Feynman diagram and parametrically reads (see, e.g.,~\cite{Holdom:1985ag,Bruemmer:2009ky}) \begin{equation} \epsilon \sim \frac{e g}{6 \pi^2} \log \left( \frac{m_{\psi}}{\mu} \right) \, , \label{eq:loopinducedkineticmixing} \end{equation} where $m_{\psi}$ is the mass of the heavy fermion and $\mu$ is the regularization scale of the loop integral. This typically gives a small kinetic mixing, which is particularly tiny if also the hidden sector gauge coupling is small, $g \ll 1$. \bigskip We can now apply the arguments of the previous section to this scenario. As we assume no plasma to be present in the hidden sector, we expect that annihilation into hidden photons remains possible and therefore guaranteeing stability may put stronger constraints on the millicharge. We will examine this scenario in two separate steps. First we completely neglect the (small) kinetic mixing effects, i.e.~we consider a secluded hidden sector without kinetic mixing, $\epsilon = 0$. Then we argue that the main conclusions also hold in the phenomenologically more interesting case with a small but non-vanishing kinetic mixing parameter. \subsection{Secluded hidden sector} In the case $\epsilon=0$, our discussion in Section~\ref{sec:paramresonance} completely carries over. In particular, the DM stability conditions~\eqref{eq:DMstabilityconditionNarrow} and~\eqref{eq:DMstabilityconditionBroad} in the narrow and the broad resonance regime can be applied at all times of the cosmic evolution. Most importantly, as there is no effective mass of the hidden photon that could block the resonant enhancements, they can in principle be satisfied at the earliest possible time. As discussed in the previous Section~\ref{sec:paramresonance}, a reasonable estimate is obtained by evaluating the stability condition from the narrow resonance regime at $t_1 \approx 1000 \, t_{\ast}$. This is shown as the solid blue line in Fig.~\ref{fig:mdm-HP-paramspace}, where we display the allowed value of $g$ as a function of the DM mass $m$. (Note that here, we have normalized the field to unit charge, $q=1$.) The requirement of avoiding a resonant depletion of the DM energy density into hidden photons puts severe constraints on the hidden gauge coupling for small masses. \begin{figure} \centering \includegraphics[width=0.925\columnwidth]{mdm-HP-paramspace} \caption{Allowed hidden gauge coupling $g$ to the scalar DM candidate as a function of its mass $m$. The blue lines correspond to the stability condition due to the parametric resonance, evaluated close to the time where the field starts to oscillate, $t_1 \approx 1000 \, t_{\ast}$, (solid) and at matter-radiation equality (dashed). The red line is given by a coherence condition, discussed in the main text. For comparison, the right axis shows the typical corresponding effective millicharge induced by a fermion-loop of a UV theory, $q_{\mathrm{eff}} \sim \epsilon g \sim e g^2 / (6 \pi^2)$. Along the same lines, the light-shaded grey area in the upper region corresponds to observational constraints provided by interactions with a magnetized intergalactic stellar medium~\cite{Kadota:2016tqq,Stebbins:2019xjr}, see Fig.~\ref{fig:mdm-paramspace_plasma}.} \label{fig:mdm-HP-paramspace} \end{figure} \subsubsection{Backreaction effects} The above evaluation might be an overestimation of the constraint posed by the DM stability requirement. This is because, so far, we have neglected the backreaction of the parametric resonance on the DM field. Obviously, a first effect is the depletion of the DM field. This is what we have implicitly used to set our constraint, i.e.~using energy conservation to determine the depletion from the produced gauge bosons. However, if the energy density in the hidden photons is comparable to that in the DM field, $\rho_A \sim \rho_\phi$, it is conceivable that energy starts to be transferred back to the DM field, slowing down the depletion. Although this is non-trivial due to the fact that most of the produced hidden photons have momenta $k \simeq m$, processes involving multiple hidden photons may be possible due to the high occupation numbers and the resonantly enhanced interaction rates. With the present analysis we cannot exclude this possibility. A thorough analysis of this effect would need to involve some careful numerical simulations, which is beyond the scope of this work. The overall allowed value of the hidden gauge coupling might therefore be higher. That said, let us obtain a very conservative estimate of the point where the resonance should shut off. Allowing for the backreaction effect, we nevertheless expect that in such a situation a significant fraction of the total energy in the DM-hidden photon system, possibly $\sim 1/2$, will be in hidden photons and therefore in the form of dark radiation. At matter-radiation equality such a large fraction of dark radiation is certainly excluded (cf., e.g.~\cite{Akrami:2018vks}). Therefore, we can evaluate the DM stability condition at matter-radiation equality. At this stage, at the latest, $\phi$ is required to behave as standard cold DM. At the same time, we expect the system to be in a narrow resonance regime, such that the stability condition~\eqref{eq:DMstabilityconditionNarrow} is valid. The resulting constraint on the hidden gauge coupling is shown as a dashed blue line in Fig.~\ref{fig:mdm-HP-paramspace}. It is considerably weaker than the original estimate, but still affects an appreciable region of parameter space, bearing in mind that this estimate is probably overly conservative. \subsubsection{Non-trivial initial momentum distribution} In addition to the fragmentation of the light scalar DM field via parametric resonance, there is another physical effect that may modify the interaction rate between the DM and the hidden photons. Crucially, in our analysis we treat $\phi$ as a spatially homogeneous classical field. While such a situation arises naturally in the misalignment~\cite{Preskill:1982cy,Abbott:1982af,Dine:1982ah,Sikivie:2006ni,Nelson:2011sf,Arias:2012az} effect when the field is extremely homogenized by inflation, other production mechanisms (see, e.g.,~\cite{AlonsoAlvarez:2019cgw,Ringwald:2015dsf,Co:2017mop,Agrawal:2018vin,Dror:2018pdh,Co:2018lka,Bastero-Gil:2018uel,Long:2019lwl,Peebles:1999fz,Graham:2015rva,Nurmi:2015ema,Kainulainen:2016vzv,Bertolami:2016ywc,Cosme:2018nly,Alonso-Alvarez:2018tus,Markkanen:2018gcw,Graham:2018jyp,Guth:2018hsa,Ho:2019ayl,Tenkanen:2019aij}) typically feature a non-trivial momentum distribution\footnote{Alternatively, this could also be due to the backreaction effect, which likely produces DM particles of non-vanishing momentum.} for the millicharged particles. Hence, in such a scenario, the field exhibits spatial variations. This can be approximately taken into account by ensuring that there is a sufficient amount of coherence. This has been discussed in detail in~\cite{Arias:2020tzl} (see also~\cite{Tkachev:2014dpa,Hertzberg:2018zte,Arza:2018dcy,Wang:2020zur,Arza:2020eik} for discussions in the context of DM structures) from which we summarize the main implications. In order to preserve coherence of the hidden photons produced by the resonance, the width of the resonance in momentum space has to be larger than the momentum spread of the DM, $\Delta k \gtrsim \Delta k_{\phi}$. The latter can be estimated to be $\Delta k_{\phi} \sim m v_{mr} \left(a_{mr} / a\right)$, where we require that $\phi$ should be non-relativistic at matter-radiation equality, $v_{mr} \sim 10^{-3}$ (cf., e.g.~\cite{Colombi:1995ze,Bode:2000gq,Cooray:2003dv,Kunz:2016yqy}). Therefore, the condition for preserving coherence can be written as \begin{equation} \Delta k \gtrsim m v_{mr} \left( \frac{a_{mr}}{a} \right) \, . \label{eq:coherence} \end{equation} As pointed out in Section~\ref{sec:paramresonance}, the width of the resonance bands in momentum space, i.e.~the left-hand side of this inequality, depends on the value of the Mathieu parameter $\mathcal{Q}$. Evaluating~\eqref{eq:coherence} at matter-radiation equality we see that the required width is much smaller than the mass $m$. Therefore, we can use the narrow resonance regime where $\Delta k \sim m \mathcal{Q}$. This can be immediately translated into a constraint on the hidden gauge coupling, which we similarly evaluate at matter-radiation equality. This is shown in red in Fig.~\ref{fig:mdm-HP-paramspace}. \subsubsection{Discussion} In general, our results, shown in Fig.~\ref{fig:mdm-HP-paramspace}, demonstrate that the stability requirement for a very light DM candidate in a secluded hidden sector affects sizeable regions of parameter space. The strongest constraint is posed by the parametric resonance stability condition evaluated close to the time, when the DM field starts to oscillate (solid blue). However, this neglects backreaction effects and therefore needs to be taken with caution. A more conservative estimate is given by evaluating the stability condition at matter-radiation equality (dashed blue). We expect that a more careful numerical analysis would most likely reveal a stability condition that lies in between those possibilities. Aside from backreaction effects, additionally, a non-trivial initial velocity distribution of the DM particles, possible in some models for their production, may allow to weaken the constraint as the resonance requires a sufficient amount of coherence. Taking into account that the DM velocity must be small enough to allow for successful structure formation, we find the most conservative constraint shown as the red line. Intriguingly, we are still able to probe large regions of parameter space. In fact, it seems challenging to motivate or construct models featuring gauge groups with such tiny gauge couplings. A famous example allowing for small gauge couplings is provided by the large volume scenario (LVS) of type IIB string compactifications~\cite{Balasubramanian:2005zx,Conlon:2005ki}. Here, the gauge theory is supported on D-branes wrapping cycles of the internal Calabi-Yau manifold of ten-dimensional spacetime. The volume of these internal cycles, in turn, determines the gauge coupling, $g \sim \mathcal{V}^{-1/3}$~\cite{Burgess:2008ri}. Therefore, hyper-weakly coupled gauge theories can be engineered by choosing an appropriate Calabi-Yau geometry that supports large D-brane worldvolumes. In Fig.~\ref{fig:mdm-HP-paramspace}, we show typical values of the gauge coupling achieved in a generic (orange) and low string-scale, $M_S \sim 1 \, \mathrm{TeV}$, (green) LVS~\cite{Burgess:2008ri}. Strikingly, even the extreme case of TeV-scale strings is rendered unstable for a wide range of masses even using the most conservative constraint. We note, however that the bound provided by the weak gravity conjecture~\cite{ArkaniHamed:2006dz}, shown in grey, is not reached. It would therefore be interesting to see whether consistent models with such small gauge couplings can be constructed. As we will argue in the following section, similar conclusions still hold, if the hidden sector is not completely secluded but has a small kinetic mixing parameter connecting it to the visible world. \subsection{Non-vanishing kinetic mixing} Along the lines discussed at the beginning of the section we focus on a situation with small kinetic mixing. In a homogeneous background $\varphi$, the equations of motion are linear in the photon $A$ and hidden photon $X$ and therefore couple distinct momentum modes of both fields. In fact, after having redefined the gauge fields by $A_{\mu} \to A_{\mu}$ and $X_{\mu} \to X_{\mu} + \epsilon A_{\mu}$, their mode functions satisfy \begin{equation} \begin{split} \ddot{A} + H \dot{A} + \left( \frac{k^2}{a^2} + m_A^2 + \epsilon^2 g^2 \varphi^2 \right) A &= \epsilon g^2 \varphi^2 X \, , \\ \ddot{X} + H \dot{X} + \left( \frac{k^2}{a^2} + g^2 \varphi^2 \right) X &= \epsilon g^2 \varphi^2 A \, . \end{split} \label{eq:eomkineticmixing} \end{equation} Here, we have already included an effective mass for the photon, $m_A$. Naively, the equations of motion imply that both the photon as well as the hidden photon modes can be enhanced by a parametric resonance induced by the oscillating DM background. However, a resonant enhancement of $A$ is now parametrically weaker as compared to $X$, because its coupling contains an additional factor of the mixing parameter $\epsilon$. This means that, for instance, modes of the hidden photons might be growing rapidly due to a broad resonance, while the photon modes already are in a very narrow resonance regime and not amplified efficiently. At the same time, this amplification might also act as an oscillating driving force on the right hand side of~\eqref{eq:eomkineticmixing}. Eventually, the growing modes of both fields will converge to the same resonance frequency after a certain period of time. Therefore, in general, the DM may largely annihilate into hidden photons and also, to a smaller fraction, into visible photons which follow shortly after. \begin{figure} \centering \includegraphics[width=0.8\columnwidth]{mdm-instabilitychart} \caption{Floquet instabilities of the Mathieu equation for $X$ with $m = 10^{-3} \, \mathrm{eV}$ evaluated at $t_{\ast}$ (blue). The orange dots illustrate an approximation of the same instabilities for the kinetic mixing case with $\epsilon = 0.1$ and $m_A / m = 100$. Inside the blue bands, and in between the orange points, the mode functions can grow exponentially.} \label{fig:mdm-instabilitychart} \end{figure} The above observations suggest that an efficient depletion of the DM energy density is possible in a theory featuring kinetic mixing. In practice, this is important, as the visible photon can obtain a non-negligible plasma mass, $m_A \neq 0$, while the hidden photon is still massless. However, as the DM mainly annihilates into hidden photons, we are able to avoid plasma effects of the visible photons in the early Universe almost entirely. This is illustrated in Fig.~\ref{fig:mdm-instabilitychart} where we compare the instability chart of a completely secluded hidden photon (blue) with that for non-vanishing kinetic mixing, $\epsilon=0.1$ and $m_A / m = 100$ (orange points denoting the boundary). We obtain these by numerically solving the coupled equations of motion for $X$ and $A$ for different momenta. As an example, we choose a DM mass of $m = 10^{-3} \, \mathrm{eV}$ and both instabilities are evaluated when the DM field starts to oscillate, $t_{\ast}$. Inside the instability bands, an exponential growth of the momentum modes of $X$, i.e.~rapid production of hidden photons, is possible. We can see that the unstable regions are almost identical. The plasma mass in the visible sector does not prevent the resonant annihilation of DM into hidden photons. We expect this to be true everywhere in parameter space for kinetic mixing parameters smaller\footnote{We have also checked examples with large kinetic mixing, $\epsilon \sim 1$. In this case, the exponential growth may be absent.} than $\epsilon \lesssim 0.1$. Therefore, the allowed values of the hidden gauge coupling are almost identical to what is shown in Fig.~\ref{fig:mdm-HP-paramspace}. To give an impression of the constraints of the effective millicharge, we show on the right-hand axis of Fig.~\ref{fig:mdm-HP-paramspace} indicative values of the millicharge obtained by combining Eqs.~\eqref{eq:chargekineticmixing} and \eqref{eq:loopinducedkineticmixing}. The light grey region indicates the experimental and observational constraints on the effective charge as also shown in Fig.~\ref{fig:mdm-paramspace_plasma}. There are large regions where even our most conservative estimate of the unstable region poses a stronger constraint on the effective millicharge than current observational bounds. \section{Conclusions} \label{sec:conclusions} The microscopic nature of dark matter (DM) that comprises large parts of the cosmic fabric remains elusive. As suggested by its name, so far, there is no experimental evidence of DM interacting with electromagnetism. While this naively rules out any sizable electric charge assigned to DM particles, it is still possible that their charge is tiny, thereby strongly suppressing interactions with photons. In this work, we have investigated the cosmological longevity of such DM particles in the sub-eV mass regime. In this mass range the DM particles must be bosonic and, for concreteness, we have chosen them to be scalar. The millicharged particles are either minimally coupled to photons or their electromagnetic interaction is mediated via kinetic mixing with a massless hidden photon. In both cases, due to the large occupation numbers of the light DM field, even for tiny charges the DM may efficiently annihilate into gauge bosons via a parametric resonance~\cite{Kofman:1994rk,Shtanov:1994ce,Kofman:1997yn,Berges:2002cz}. We find that, in the case of a direct coupling to photons current observational constraints on the millicharge are stronger than those arising from parametric resonance, as shown in Fig.~\ref{fig:mdm-paramspace_plasma}. This is mainly due to the plasma mass that the photons acquire in the hot medium of the early Universe, which essentially terminates the resonance if it is larger than the DM mass. In contrast, in the case of a theory featuring kinetic mixing, plasma effects are practically absent. Therefore, even employing conservative estimates large regions of parameter space are affected by the parametric resonance as illustrated in Fig.~\ref{fig:mdm-HP-paramspace}. In fact, in particular for very low DM masses, its electric millicharge has to be orders of magnitude below what has been typically obtained in UV models, e.g.~in type IIB string compactifications in the large volume limit~\cite{Balasubramanian:2005zx,Conlon:2005ki,Burgess:2008ri} (we note that, indeed, already the experimental and observational constraints rule out this region of parameter space for loop-induced kinetic mixing). That said, the limits do not yet reach the smallest possible values suggested by the weak gravity conjecture~\cite{ArkaniHamed:2006dz}, which are many orders of magnitude below the smallest values found in the concrete realizations discussed above. We conclude that it is far from trivial that very light bosonic DM carrying a tiny electric charge is long lived. Instead, its high occupation numbers can dramatically enhance interaction rates with gauge bosons leading to parametric resonance phenomena. Therefore, its cosmological stability cannot be taken for granted but has to be considered carefully. \begin{acknowledgments} We are grateful to Patrick Foldenauer, Arthur Hebecker, Ruben Kuespert and Michael Spannowsky for valuable discussions. We also thank Paola Arias, Ariel Arza and Diego Vargas for collaboration on related work. S.S.~is funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) -- 444759442. \end{acknowledgments}
\section{Introduction} Measurements of cosmic ray electron$+$positron spectrum using space and ground-based detectors are currently available up to 10~TeV energy range (see Ref. \cite{Lipari:2019abu} for a review). The space-based detectors, like Fermi/LAT \cite{Abdollahi:2017nat}, AMS-02 \cite{Aguilar:2019ksn}, CALET \cite{Adriani:2017efm}, DAMPE \cite{Ambrosi:2017wek}, run out of signal statistics already at TeV energies. At higher energy, ground-based measurements have been done with HESS \cite{Aharonian:2008aa} and VERITAS \cite{Archer:2018chh} Imaging Atmospheric Cherenkov Telescope (IACT) systems up to approximately 5~TeV, and possibly to higher, $\sim 20$~TeV, energy by HESS \cite{kerszberg_icrc}. These measurements reveal spectral features in the TeV band (Fig. \ref{fig:electron_spectrum}), in part formed by an interplay between synchrotron and inverse Compton cooling of electrons in the interstellar magnetic and radiation fields \cite{1985Afz....23..479A,2010ApJ...710..236S}, but perhaps also by further effects of acceleration of primary electrons or production of secondary electrons and positrons in yet uncertain class of astronomical sources and their subsequent propagation through the Galaxy. The positron flux measured by AMS-02 is much lower than the overall electron plus positron flux level \cite{Aguilar:2019ksn}, thus the TeV softening of the spectrum visible in Fig. \ref{fig:electron_spectrum} certainly carries information about the nature of the electron source(s). The TeV suppression can be a feature introduced by the discreetness and intermittent nature of distribution of electron sources in the local Galaxy, like pulsars and supernova remnants \cite{1995PhRvD..52.3265A} or can also be an average high-energy cutoff in the intrinsic spectra the source(s). It also can be an isolated feature superimposed on otherwise powerlaw-like spectrum. e.g. by a contribution from a specific nearby source \cite{Recchia:2018jun}. To distinguish between these different possibilities, a better characterisation of the spectrum and reliable measurements of the flux extending well into the 10-100~TeV band are needed. Such an extension can hardly be done with space-based detectors, because the electron spectrum is very soft and relatively small area space-based detectors inevitably run out of statistics. The most promising possibility for extension of the measurements to higher energies is with the ground-based detectors. Ground-based experiments detect electrons and positrons by observing Extensive Air Showers (EAS) that they initiate while penetrating into the atmosphere. The main challenge of the ground-based measurement is to distinguish the signal of electron induced EAS from the background of EAS initiated cosmic ray protons and atomic nuclei. The electron flux is at the level of $\lesssim 10^{-4}$ of the nuclei flux at 10~TeV, see Fig. \ref{fig:electron_spectrum}. Different dedicated background rejection techniques based on fitting of numerically predicted templates of "electron-like" EAS images to the observed EAS image data have been used to achieve rejection of proton and nuclei background in the HESS data \cite{Aharonian:2008aa,kerszberg_icrc,kerszberg_thesis,kraus_thesis,kolitzis_thesis}. The difficulty of this approach can be illustrated by comparison of the HESS measurement up to 20 TeV reported in conference proceedings \cite{kerszberg_icrc} and several PhD theses \cite{kerszberg_thesis,kraus_thesis,kolitzis_thesis}, with different types of background rejection techniques providing different results and indicate a large systematic uncertainty of the analysis. \begin{figure} \includegraphics[width=\columnwidth]{Electron_spectrum.png} \caption{Measurements of $e^+e^-$\ spectrum by AMS-02 \cite{Aguilar:2019ksn}, Fermi/LAT \cite{Abdollahi:2017nat}, DAMPE \cite{Ambrosi:2017wek}, CALET \cite{Adriani:2017efm}, HESS \cite{Aharonian:2008aa}, \cite{kerszberg_icrc}, VERITAS \cite{Archer:2018chh}. Dashed lines show different levels of rejection of backgorund of cosmic ray nuclei needed to detection of flux as a given level. } \label{fig:electron_spectrum} \end{figure} An alternative possibility for discrimination between the EAS induced by protons and atomic nuclei and EAS induced by electrons and positrons is provided by the measurement of muon content of the EAS. This technique is used by KASCADE \cite{Apel:2017ocm}, Carpet-2 \cite{Dzhappuev:2018qlt} and LHAASO \cite{Bai:2019khm} experiments to measure the identity of the primary cosmic ray particles in the energy range above 100~TeV or above 1~PeV. Extension of the "muon tagging" approach for cosmic ray proton and nuclei background suppression toward lower energies is considered for the SWGO experiment \cite{Albert:2019afb}. It is however challenging because of decrease of density of muons on the ground associated to the decrease of the energy of the primary cosmic ray particles. Below we show that a deployment of a large continuous muon detector counting (rather than just sampling) muons at the detection level is necessary to achieve efficiency of rejection of hadronic EAS background by a factor $>10^5$ needed for the measurement of $e^+e^-$\ spectrum in 10-100~TeV energy range. We discuss possible implementations of such large muon detector. \section{Large water Cherenkov muon detector for 10-100 TeV EAS} Muons are conventionally detected in the EAS experiments by particle detectors, like scintillator pads (e.g. in Carpet-2 experiment \cite{Dzhappuev:2018qlt}) or water tanks (like in LHAASO experiment \cite{Bai:2019khm}) buried underground, or shielded by dense material layer (like in KASCADE experiment \cite{Apel:2017ocm}). Otherwise, muons can also be identified in surface Water Cherenkov Detector Arrays (WCDA) like those of HAWC \cite{Zuniga-Reyes:2017znm} and LHAASO because they produce much larger Cherenkov light signal with specific timing signature, due to the deep penetration. Muon identification in WCDA placed on the surface (rather than under-ground) is difficult because of the mixing of the muon Cherenkov light signal with the signal of electromagnetic EAS component. Finally, deep underwater Cherenkov detectors, like ANTARES \cite{Aslanides:1999vq}, Baikal-GVD \cite{Avrorin:2019dli} and Km3NET \cite{Bagley:2009wwa} are able to track trajectories of individual muons and measure their energy, to obtain information about neutrinos that produce muons in interactions with material surrounding the detector. 10-100~TeV EAS produced by protons generate only $10^2-10^4$ muons scattered across large area within $\sim 400$~m around the shower axis \cite{Antoni:2000mg,LAGUTIN2001274}, so that the muon density is as low as $\le 10^{-2}$~m$^2$. Low density of muons on the ground complicates their detection. A muon passing through water with the speed faster than the speed of light in the medium generates some $Y_{Ch}\simeq 200 $~ph/cm Cherenkov photons in the 400-700~nm wavelength range. The number of photoelectrons detectable by a large (e.g. $d_{pmt}=10''=25$cm) photomultiplier tube (PMT) with photon detection efficiency $\kappa$ placed at a distance $R$ from the particle track is $n_{p.e.}\simeq Y_{ch} d_{pmt}^2/ (8 R\tan(\theta_{Ch}))\simeq 5\left[\kappa/0.3\right]\left[d_{pmt}/25\mbox{ cm}\right]^2\left[R/10\mbox{ m}\right]^{-1}$ where $\theta_{Ch}\simeq 41^\circ$ is the Cherenkov angle in water. Adopting $n_{p.e.}\sim 5$ as a threshold for detection of particle track in water Cherenkov detector, we find that single large photo-multiplier tube can detect muons passing at a distance as large as $R\simeq 10\left[d_{pmt}/25\mbox{ cm}\right]^2$~m. Thus, deployment of optical sensors on a sparse grid with spacing smaller $\sim 2R$, in an light-tight compartment at a depth range between $5$~m and $5$~m$+R$ (to suppress the electron/positron/gamma component of the EAS) can be sufficient. The 10-100~TeV EAS are able to reach the sea level and it is in principle not necessary to place the large muon detector at high altitude. This allows to directly use the optical modules of neutrino telescopes like ANTARES \cite{Amram:2001mi} or Baikal-GVD \cite{Avrorin:2016por} and deploy the detector in the same water reservoir as the original neutrino detector (sea or lake), partially re-using the available experimental infrastructure. Otherwise, the WCDA consisting of two-layer water tanks like foreseen for SWGO \cite{Albert:2019afb} can be considered. To determine the efficiency of the muon detector necessary for "muon tagging" of proton and nuclei induced EAS we have performed Monte-Carlo simulations of EAS using CORSIKA package (\url{https://www.iap.kit.edu/corsika/index.php}, version 75600), We have assumed two-layer detector setup at sea level altitude with the top layer counting particles with energies at least 100~MeV crossing the water surface and bottom layer sampling muons and hadrons with energies at least 1.5~GeV reaching the 5~m depth. The electron flux is by up to five orders lower than the overall cosmic ray flux in the 10-100~TeV energy range (see Fig. \ref{fig:electron_spectrum}). Thus, the detector has to assure that no more than 1 in $10^5$ hadronic EAS is mis-interpreted as an electron / positron induced EAS. To verify this, we have simulated $7\times 10^5$ proton-induced EAS in the broad energy range 1-100 TeV and $10^4$ electron-induced EAS, saving the particle content on the ground (hadrons and muons with energies above 300~MeV, electrons, positrons and gammas with energies above 30 MeV). The EAS were allowed to impact anywhere within the extent of the detector. \begin{figure} \includegraphics[width=\columnwidth]{Nmu_Nem} \caption{Muon+hadron vs Electron-positron-gamma counts for the EAS impacting the $150\times 150$~m$^2$ area of $\mu$WCDA\ for proton induced EAS (left) and electrons (right). We have replaced zero muon counts with "0.5 count" value, to show the EAS without muon counts in this logarithmic plot. Black line shows possible electron-hadron separation cut. } \label{fig:Nmu_Cher} \end{figure} The statistics of electrons, positrons and gammas with energies above 100~MeV, $N_{em}$ and statistics of muon and hadron counts with $E>1.5$~GeV for all EAS is shown in Fig. \ref{fig:Nmu_Cher} for the selection of EAS falling within $150\times 150$~m$^2$ central part of a $300\times 300$~m$^2$ detector, 100\% efficient in counting both electromagnetic cascade particles and muons. To reject the hadronic EAS background, we have considered a cut shown by the straight line in Fig. \ref{fig:Nmu_Cher} (cut optimisation has to be a subject of dedicated study). Only events to the right of the cut line or events with $N_\mu=0$ were accepted. If the muon layer of the detector is not continuous, only a fraction of the muons reaching the ground level would be counted. For example, LHAASO muon detector component is covers only about 4\% of the area. This reduces the statistics of the muon signal and hence the efficiency of electron-hadron shower discrimination. We have verified that our method of estimation of hadronic background rejection is consistent with the published estimated of backgorund rejection efficiency for LHAASO \cite{Bai:2019khm} if we assume that only 4\% of the muons are detectable. This is illustrated in Fig. \ref{fig:bkg}, where we compare the efficiency of rejection of proton shower background for different efficiencies of muon detection: 0.04 (LHAASO-type muon detector), 0.2 and 1 (continuous muon detector like that foreseen fro SWGO). One can see that deployment of continuous detector is necessary if one aims at backgorund rejection level $\sim 10^{-5}$ at 10 TeV. Decployment of muon detectors on a grid two times denser than that implemented in LHAASO would still not be sufficient. This result does not depend on the assumption about the altitude of the detector. In our simulations we counted muons reaching the sea level, but the number of muons does not change significantly with altitude in a wide altitude range, from 0 to about 4.5 km for the energy range of interest. We have verified this be repeating the simulations for the detector at 4.5 km altitude. \begin{figure} \includegraphics[width=\columnwidth]{Background_muWCDA.png} \caption{Residual cosmic ray proton and nuclei background level for the setup with the muon detector layer underlying 100\% (red thick solid line), 20\% (dashed thin red line) and 5\% (red dotted line) of WCDA. For comparison we show the background levels in selected detectors: LHAASO (black thin solid line) and HAWC (blue thin solid line).} \label{fig:bkg} \end{figure} The altitude of the detector most strongly affects the statistics of the electromagnetic shower component. Decrease of the number of electromagnetic cascade particles at low altitude increases the energy threshold of the experiment. This is illustrated in Fig. \ref{fig:efficiency} in which the thick blue dashed line shows the energy dependence of efficiency of selection of electron EAS for the sea-level detector. This efficiency approaches $\sim 0.5$ in the energy range above 10~TeV. The decrease of efficiency below 10~TeV is explained by the "quality" cut $N_{em}>100$ that we have imposed on the selection of both proton and electron events. We have imposed this cut to assure that the detected events can be properly analyzed and their energy estimated with reasonable accuracy). Also this cut has to be optimized via a detailed study for specific detector setups. The same cut for a detector at 4.5 km altitude provides a nearly 100\% detection efficiency for electron showers down to TeV energy (thin dashed line). \begin{figure} \includegraphics[width=\columnwidth]{Efficiency_muWCDA.png} \caption{Efficiency of the cut separating hadronic and $e^+e^-$\ EAS as a function of energy, for electrons (blue dashed lines) and protons (red solid lines) for a detector at sea level (thick lines) and at 4.5 km altitude (thin lines). } \label{fig:efficiency} \end{figure} The HAWC and LHAASO WCDA have areas comparable to or larger than that of the muon continuous detector considered in our analysis. In principle, both WCDAs can detect all muons passing through them. They can also distinguish muon signal form the signal of electromagnetic EAS component, because single muons crossing the full depth of the water tanks produce larger Cherenkov signal. However, from Fig. \ref{fig:bkg} one can see that in spite of detecting similar amount of muons in 10-100~TeV EAS, HAWC and LHAASO WCDAs do not reach the efficiency of rejection of hadronic EAS comparable to that of the large muon detector. This is explained by the difficulty of identification of the muon signal on top of strong electromagnetic signal that dominates the EAS signal in WCDA not screened by the $5$~m water depth. Thus, an efficient $\mu$WCDA has to include a dedicated muon detection layer, rather than aim at muon detection on top of a dominant electromagnetic signal in single WCDA layer. \begin{figure} \includegraphics[width=\columnwidth]{Electron_spectrum_muWCDA.png} \includegraphics[width=\columnwidth]{Electron_spectrum_muWCDA_SWGO.png} \caption{Expected quality of electron spectrum measurement with WCDA detector with 100\% efficient muon detection layer at sea level altitude (top), and at 4.5 km altitude (bottom). Experimental data are the same as in Fig. \ref{fig:electron_spectrum}. Two possible high-energy powerlaw extrapolations are considered, with higher and lower flux levels with opaque and semi-transparent red color. Full red color highlights the high flux (top) and low flux (bottom) extrapolations for respectively the sea level and high-altitude detectors. } \label{fig:electron_spectrum_measurement} \end{figure} Efficient suppression of hadronic background in WCDA with continuous muon detection layer enables measurement of electron spectrum in the energy range above 10~TeV. This is shown in Fig. \ref{fig:electron_spectrum_measurement}. The top panel of this figure shows numerically estimated quality of measurements of electron spectrum with the sea-level detector for possible "high" and "low" flux extrapolations of the electron spectrum measurements into 10-100 TeV range. To make these estimates we have assumed that the effective collection area for both proton background and electrons is the geometrical area of the detector times the efficiency of electron selection shown in Fig. \ref{fig:efficiency}. The angular acceptance of the WCDA is assumed to be $30^\circ$ around zenith, the exposure time is one year. The errorbars are determined by the statistical error for the electron signal detected on top of the residual hadronic background. A systematic error at the level of $5\%$ of the hadronic background is added. One can see that the flux at the level of the high flux powerlaw extrapolation from sub-10-TeV range is readily detectable up to 100~TeV and beyond on top of the residual hadronic background with an experimental setup using the $100\%$ efficient muon detection layer. Remarkably, the electron spectrum can, in principle, be measured starting from the TeV energy range, in spite of the low efficiency of electron detection with an experimental setup at the sea level altitude. This is explained by the steepness of electron spectrum. The electron flux becomes as high as $\sim 10^{-3}$ of the cosmic ray flux at TeV. Even if the efficiency of electron detection is as low as $10^{-3}$ at this energy, suppression of the background of cosmic ray nuclei by a factor $\sim 10^{-5}$ still leaves the electron signal statistics at the level of about 10\% of the nuclei background statistics. If the electron spectrum above 1 TeV is as steep as the lowest flux allowed by VERITAS \cite{Archer:2018chh} or the 2008 HESS \cite{Aharonian:2008aa} measurements (this would mean that the most recent HESS analysis \cite{kerszberg_icrc,kerszberg_thesis} still suffers from residual hadronic background contamination), the electron count statistics in a sea-level detector decreases below the residual cosmic ray nuclei statistics in all energy bins. This explains large errorbars of the measurements for this case (lower pale red data points in the top panel of Fig. \ref{fig:electron_spectrum_measurement}). In this case it might be essential to increase the efficiency of detection of electromagnetic component of the EAS, either by supplementing the sea-level detector with an IACT system or by deploying the detector at high altitude, as foreseen in the SWGO design. The expected improvement of the quality of measurements with the high-altitude detector is shown in the bottom panel of Fig. \ref{fig:electron_spectrum} where the expected quality of measurements of electron spectrum with a two-layer WCDA at 4.5 km altitude is shown. The high-altitude and sea-level detectors provide similar quality of measurements above approximately 20~TeV. At lower energies, only the high altitude setup has sufficiently high efficiency of detection of electron induced EAS to provide high quality measurement. One can see that in this case, the electron spectrum measurements can also have a good overlap with the measurements by space-based detectors. \section{Discussion and conclusions} We have shown that measurements of cosmic ray $e^+e^-$\ spectrum up to 100~TeV are possible using an experimental setup that includes an EAS array that provides nearly 100\% efficiency of muon detection across a $150\times 150$ m$^2$ area. Such a detector can be implemented as an under-water Cherenkov detector combined with a conventional WCDA, as foreseen in the design of SWGO. Moreover, if the electron flux level at 10~TeV is as high as suggested by the most recent HESS data analysis, such detector does not necessarily need to be located at high altitude. The most straightforward possibility for the sea-level setup is to implement the under-water muon detector re-using the development of water-Cherenkov neutrino detectors. The optical modules of neutrino detectors like ANTARES \cite{Aslanides:1999vq}, Baikal-GVD \cite{Avrorin:2019dli} or Km3NET \cite{Bagley:2009wwa} can be directly deployed at shallow depth in a two-storey grid (at depths about 5 and 10-15 m) within light-tight sections. Estimates of the Cherenkov light intensity show that the layout of the muon detection layer can be rather sparse, with module separation up to 20 m if large 12'' photo-multiplier tubes are used. In the absence of the high-altitude constraint, the large shallow depth water-Cherenkov detector array can even be implemented directly at the sites of the underwater neutrino observatories, to simultaneously serve as a part of cosmic ray veto for the neutrino experiment (similar to the IceTop array at the site of IceCube experiment).
\section{Introduction} Large amounts of news are published online every day, and many people now primarily consume news online \cite{reis2015breaking}. News quality affects how people consume news and which platforms they prefer \cite{facebook,news2021fb}. Expressing news quality numerically can facilitate significant improvements for users and platforms \cite{publishers2019fb}. Among various aspects of news quality, we focus on \textit{originality}, which can be contrasted with duplicates, slightly edited text, and coverage that references original news. Producing original news is laborious and requires expertise, but such efforts initiate the typical news cycle and drive the entire news industry. Original news inform people around the world, from breaking news, eye-witness reports and critical updates at the time of crisis, to in-depth investigative reports that uncover new facts. Prioritizing original news online is in everyone's long-term interest~\cite{publishers2019fb}. \blue{In this work, we first explore the landscape of online news, using the Facebook platform as an example. To enable a quantitative approach, we tabulate the spectrum of news originality from \textit{completely unoriginal} to \textit{highly original} news. Our static analysis suggests that highly original news are rare, despite a large inventory which needs to be indexed and processed to accurately identify the original ones. We also explore the dynamics of the news life-cycle on Facebook and find that news posts typically attain the greatest exposure in the first couple of hours, followed by a long tail. This result suggests that an originality score used to improve News Feed ranking must be computed promptly.} \blue{Given two challenges --- search quality at scale and fast response --- we build a near real-time system and construct a synthesized signal for news originality. News articles that cover the same news event are clustered together based on specialized BERT embeddings \cite{devlin2018bert}, which are finetuned on pairwise-labeled data (same subject or different subjects). After evaluating several clustering algorithms against human-labeled pairwise data, we settle on a two-stage clustering algorithm that is both effective and highly scalable to large datasets. To adequately capture news dynamics, our system performs incremental updates on an hourly basis.} \blue{We concluded that content alone is insufficient to judge news originality, but behavioral signals such as citations of prior posts can also be used. Integrity considerations are particularly important, given the high incentives to game online news distribution. To de-bias our algorithms, we filter out news articles produced within patterns of nefarious activity. We first evaluate the performance of our originality signal offline against ratings by professional journalists. Online evaluation is based on an A/B test where we additionally monitor the impact on news article ranking~\cite{ab2015kdd}. The signal is incorporated in the News Feed ranking system.} \\ Our contributions include: \begin{itemize} \item We examine the news originality landscape and the dynamics of the news life-cycle, then propose a quantitative approach to reason about the news ecosystem. We categorize the level of news originality by the effort spent to generate news content. \item We propose a methodology and architect a near real-time system that processes individual news articles at a large scale. Using the PageRank algorithm and three-step clustering, it calculates a synthetic score to estimate news originality. PageRank normalization within clusters is particularly novel. The method can be applied to other news serving systems. \item To facilitate live-data analysis of perceived news quality and of news quality scores, we develop quantitative and qualitative methods. These methods can zoom in on individual news articles and their distribution, and also measure entire news ecosystems. Such analyses help both news publishers and consumers, which now depend on online news \cite{publishers2019fb}. \end{itemize} \begin{figure}[t] \centering \includegraphics[width=0.95\linewidth,trim={3cm 7cm 10cm 2cm},clip]{figs/citations.pdf} \vspace{-4mm} \caption{\label{fig:ex_citation} Citations in news articles. The top snippet cites an article by another publisher. The cited article cites another article from the same publisher.} \vspace{-3mm} \end{figure} \section{Background} In this section, we first review the ideas behind PageRank and introduce the news citation graph. Then we outline ranking at Facebook, where we deploy our originality signal. However, other social media use conceptually similar ranking systems and our contributions are not specific to Facebook. \subsection{The News Citation Graph} \label{sec:graph} The PageRank algorithm was originally developed at Google to rank Web pages and sites to improve search results \cite{brin1998anatomy,cresci2015fame,cresci2017paradigm,page1999pagerank,ye2019mediarank}. Mathematically, it is a random-walk based algorithm to rank vertices in a graph. A Web page with many incoming links from large-weight web pages, has a greater weight. Page weights are propagated from each Web page to pages it links to. In the news domain, the work by \citet{del2005ranking} introduced a related graph-based ranking algorithm where each vertex represents a news source, focusing on authoritative news sources and interesting news events. \citet{ye2019mediarank} built an automated ranking system called MediaRank to rank news sources. They applied the PageRank algorithms on news reporting citation to rank news sources and proved that PageRank values are positively related to reporting quality measured by peer reputation and so on. \citet{zhang2018structured} introduced a set of signals for indicating the credibility of news collected from expert annotators. They grouped their indicators into two categories. The first group contains content indicators determined by the articles themselves --- mentions of organizations, studies, etc. Context indicators in the other group require analysis of external sources, such as author reputation and/or recognition by peers in terms of the PageRank algorithm, as in \citet{cresci2015fame,cresci2017paradigm}. Similar to citations in academic papers, it is common to cite credible peers in the news industry, and such citations are important indicators of news source quality. Therefore, we introduce the news citation graph at news article level, instead of the domain level, to estimate the credibility of individual news articles. The idea is that when a news articleƒ is disproportionately cited by its peers, this indicates higher journalistic credibility. Whereas academic papers itemize their references and use reference numbers in citations, news articles follow a different style. In this work, we only consider citations in the form of links in a news article to other news articles. Figure~\ref{fig:ex_citation} illustrates news article citations. The example at the top is from a news article by Publisher 1. This article cites multiple sources, one of them is shown: a news article from a another publisher, which cites another article by the same publisher. If a publisher breaks the story about an important news event, many other articles and publishers will cite it. We take snapshots of the news ecosystem and index all our notation by time $t$ (Section \ref{sec:pagerank}). In particular, $\mathcal{V}$ is the set of all news articles at time $t$, and $v\in \mathcal{V}$ denotes an individual article. We cluster such articles by news event or news story (Section \ref{sec:clustering}), denoting individual clusters $\mathcal{C} \subset \mathcal{V}$. When a news article $v$ cites another article $u$, we represent this by a directed edge $e_{v,u} \in \mathcal{E}$, where $\mathcal{E}$ is the set of edges in the citation graph. We also say that $e_{v,u}$ is $v$'s outbound edge and $u$'s inbound edge. Using these directed edges, we can compute the PageRank values of individual vertices (Section \ref{sec:pagerank}) by iteratively applying the following formula on every vertex in the graph in a topological order: \begin{equation} n_v = \frac{1 - d}{|\mathcal{N}|} + d \sum_{u \in \mathcal{B}_v}\frac{n_u}{|\mathcal{B}_v|}, \end{equation} where $n_v$ is the PageRank of article $v$ (initialized to 1) at time $t$, $\mathcal{B}_v$ denotes the set of adjacent vertices (neighbors) of vertex $v$, $|\mathcal{B}_v|$ is the number of neighbors of $v$, and $d$ is a (constant) \textit{damping factor}, usually set to 0.85. The latter parameter dampens the propagation of weights through multiple edges. \subsection{The News Article Representation}\label{sec:bert} When estimating article originality, it is important to check how similar two articles are. Such checks are commonly implemented with cosine similarity on vector embeddings. To produce necessary embeddings, prior work uses the BERT (Bidirectional Encoder Representations from Transformers) network architecture \cite{devlin2018bert}, which achieved state-of-art results in many natural language processing tasks across different applications \cite{reddy2019coqa,lee2020biobert}. BERT handles previously unseen words by breaking them down into known subword fragments. It can also be updated on a regular basis to handle emerging keywords such as "COVID". Original BERT models were DNNs pre-trained on the BooksCorpus \cite{zhu2015aligning} and the English Wikipedia. \hush{For example, a multilingual BERT implementation\footnote{\url{https://github.com/google-research/bert/blob/master/multilingual.md}} was trained on top 100 languages with Wikipedia data\footnote{\url{https://meta.wikimedia.org/wiki/List_of_Wikipedias}} to represent each news article based on its title. Using only titles conveniently neglects changes in article bodies, but emphasizes adequate handling of synonyms, rare words, and equivalent phrases --- BERT excels at these.} However, BERT networks can be specialized to a given use case by adding one dense layer and training it on adequate labeled data. Along these lines, \citet{reimers2019sentence} proposed a Sentence-BERT architecture that uses the Siamese network structure in the context of semantic similarity estimation. \hush{on pair-wise labeled data (Section \ref{sec:clustering}).} \hush{Whereas the pre-trained BERT embeddings are 768-dimensional, our dense layer reduces the dimensionality to 128.} \subsection{News Feed Ranking} \begin{figure*}[ht] \centering \includegraphics[width=0.85\linewidth,trim={1cm 8cm 5cm 2.5cm},clip]{figs/ranking.pdf} \vspace{-3mm} \caption{\label{fig:ranking} News Feed ranking at Facebook} \vspace{-2mm} \end{figure*} \blue{The ranking of news has been extensively studied both in academia and industry \cite{del2005ranking,hu2006discovering,ye2019mediarank}. A number of publications in the information retrieval community address this subject \cite{gwadera2009mining,kanhabua2011ranking,de2012chatter,tatar2014popularity,reis2015breaking,zheng2018drn,zhang2018structured}. In 2018, Nuzzle announced a ranking system for news sources called NuzzleRank\footnote{\url{https://nuzzel.com/rank}} that integrates various signals, including publisher authority information, into a single score to rank news sources. } \blue{Facebook's News Feed ranks not only news content, but also events from users' social graph~\cite{facebook,ranking2021fb}. Ranking objectives optimize long-term user satisfaction, account for communities (friends and family, etc) \cite{people2018fb} and News Feed integrity \cite{halevy2020integrity}(e.g., to discourage clickbait and prevent unlawful activities). When a user logs in to Facebook, they see their News Feed — which includes fresh updates from their friends, groups they joined, and pages they followed. News Feed ranking can be roughly divided into four stages: inventory, signals, prediction, and relevance scores \cite{facebook, ni2019feature, ranking2021fb}. Once a piece of content is posted, numerous signals are extracted — publication time, engagement counts, etc. Those signals are used to estimate the probabilities of possible individual user actions for each piece of content in the inventory, should they see it \cite{facebook,ni2019feature,ranking2021fb}. As a matter of notation, P(comment) represents the probability that a user comments on the update, while P(like) represents the probability that user likes the content. At the last stage, we combine these predictions and compute a ranking relevance score for each piece of content. Our news originality signal is deployed within this system summarized in Figure~\ref{fig:ranking}. News Feed ranking at Facebook incorporates many signals, and our originality signal enacts only subtle changes to the user experience as we explain later.} \section{Problem Analysis}\label{sec:problem} Here we examine the news originality landscape and motivate our work. Then we investigate the life-cycle of news stories on social media platforms. Understanding the news life-cycle is critical to deploying the originality signal within News Feed ranking. \subsection{The Landscape of News Originality} \begin{figure}[b] \vspace{-5mm} \centering \includegraphics[width=0.9\columnwidth,trim={2cm 9cm 2cm 5cm},clip]{figs/landscape.pdf} \vspace{-3mm} \caption{\label{fig:landscape} News originality by bucket: (a) completely unoriginal; (b) highly unoriginal; (c) somewhat unoriginal; (d) potentially original but lacking peer recognition; (e) recognized as original by peers. For each bucket, we show estimated total views received by all news articles.} \vspace{-2mm} \end{figure} Our quantitative approach to news originality uses content buckets: \begin{enumerate}[label=\alph*)] \item \textit{completely unoriginal}, scraped or spun content with no editorial effort \item \textit{highly unoriginal}, with very low editorial effort \item \textit{somewhat unoriginal}, may be editorially produced but heavily cite other content without original reporting or analysis \item \textit{potentially original but lacking peer recognition} \item \textit{recognized as original by peers}: breaking news, eyewitness reports, exclusive scoop, investigative reporting, etc \end{enumerate} \begin{table}[b] \vspace{-4mm} \centering \caption{\label{tab:ex_spun} Examples of spun content. Publisher 1 posted original articles, while Publisher 2 replaced isolated words, phrases, and sentences in articles from Publisher 1.} \vspace{-2mm} \begin{tabular}{L{3.5cm} | L{3.5cm}} \toprule \sc Publisher 1 - Original & \sc Publisher 2 - Spun\\ \midrule Israel grants Rashida Tlaib West \underline{{\textbf{Bank}}} \underline{\textbf{visit}} on humanitarian grounds & Israel grants Rashida Tlaib West \underline{\textbf{Financial Institution}} \underline{\textbf{go to}} humanitarian grounds \\ \hline Israel’s \underline{\textbf{interior}} minister on Friday said & Israel’s \underline{\textbf{inside}} minister on Friday said \\ \hline Pod \underline{\textbf{Foods gets}} VC backing to reinvent grocery distribution & Pod \underline{\textbf{Meals will get}} VC backing to reinvent grocery distribution \\ \bottomrule \end{tabular} \end{table} \textit{Scraped} content is copied from other sources without editorial efforts. \textit{Spun content} is taken from a post or a Web page, and posted with only minor modifications by humans or machines (see examples in Table~\ref{tab:ex_spun}). Common methods include paraphrasing, replacing words, and reordering paragraphs. By automating the \textit{spinning} of existing content one can quickly produce a large amount of content without scraping. \hush{Publisher 1 produces the original news article. Publisher 2 takes most of the content from the original one but replace the content with specific words, phrases, and sentences.} Scraped and spun content can eclipse original content and undermine its value, which warrants removal or limited distribution compared to original content. \textit{Highly unoriginal} articles are produced by low-effort text changes. We find most of the news articles actually fall into the third bucket - \textit{somewhat unoriginal}. These articles may provide useful information, but do not require much effort to produce. \textit{Potentially original but lacking peer recognition} --- this bucket includes content that does not fit in earlier buckets and so may be original, but for various reasons does not receive peer recognition throughout the news cycle. Opinion pieces that receive little support often fall into this category. Thus, citation signals alone cannot distinguish between this bucket and unoriginal articles. The \textit{highly original} news are produced with significant effort to fact-check information and produce clear narratives, high-quality writing and visuals. Thoughtful and original news content is usually cited heavily by industry peers and contributes to the reputation of individual content creators. Due to the effort and expertise required, the original news content are scarce. Prioritizing the distribution of original content can help it reach greater audiences and benefits both the readers and the news industry in the long run~\cite{publishers2019fb}. In general, it is difficult to judge each article for originality in isolation because this would require careful analysis of contents with the understanding of current events. Particularly challenging would be to distinguish rumors and fake news from reasonable reporting. Therefore, we draw additional insights from the news citation graph and the dynamics of online news. The special cases of scraped and spun content are handled by dedicated systems that are based on text hashing and fingerprinting, as well as text similarity metrics. In practice, such content does not appear in users' News Feed inventory and is therefore not treated in our work.% \subsection{The Dynamics of Online News}\label{subsec:lifecycle} News content published on the Internet can be easily indexed and archived, but it social media platforms tend to favor fresh news. That’s why news reporters strive to break a new story. To re-examine this conventional wisdom and determine how to reflect it in our work, we explore a large volume of news articles shared on Facebook and track the dynamics of user engagement metrics. We also visualize the life-cycle of typical online news stories and check the impact of adding valuable information days after the original publication. \hush{Even if additional valuable information is added later, we usually do not observe another peak of engagement.} As it turns out, the same pattern persists across different news categories --- world and local news, politics and entertainment news. Figure~\ref{fig:lifecycle1} illustrates how quickly users lose interest in a particular story. On September 27, 2019 Disney and Sony reached a deal for Spiderman movies, announcing that Spiderman would stay in the Marvel Universe. One publisher reported the story first. Almost 800 websites covered the news on the exact same day. On the second day, the engagement metrics of this story dropped significantly and eventually vanished on September 29, in just 3 days. \begin{figure}[b] \vspace{-2mm} \centering \includegraphics[width=0.95\linewidth,trim={4cm 4cm 9cm 1.5cm},clip]{figs/lifecycle1.pdf} \vspace{-2mm} \caption{ \label{fig:lifecycle1} The life-cycle of a Spiderman story} \vspace{-3mm} \end{figure} Figure~\ref{fig:lifecycle2} shows that adding information at a later time does not help gain traffic. On November 11, 2019 the Ebola vaccine by Johnson \& Johnson was approved. Our inventory showed that 17 websites published 34 related articles on that day, and user engagement metrics hit a peak. The news was first reported by a publisher who focuses on life science and medicine, which gained most traffic. Two days later, on November 13, the World Health Organization officially approved the vaccine. Many mainstream publishers covered this news, and we observed an inventory increase. However, this did not stimulate another engagement peak: traffic was mostly flat and almost vanished after seven days. \begin{figure}[b] \begin{tabular}{c} \includegraphics[width=0.95\columnwidth,trim={1cm 0.5cm 8cm 0.8cm},clip]{figs/lifecycle21.pdf} \vspace{-6pt} \\ (a) \\ \includegraphics[width=0.95\columnwidth,trim={1cm 0.5cm 7cm 0.8cm},clip]{figs/lifecycle22.pdf} \vspace{-12pt} \\ (b) \end{tabular} \vspace{-10pt} \caption{\label{fig:lifecycle2} The life-cycle of the J\&J Ebola vaccine story} \end{figure} Our data analysis suggests that ranking interventions can only be effective early in the life-cycle of a news story. This directly impacts the architecture and implementation of News Feed ranking, posing challenges to both signal computation and ranking deployment. Therefore, we only focus on news articles published within the last seven days. Our originality ranking intervention does not dramatically change users' News Feed experience because we do not alter the existing inventory of posts. However, the aggregated effect should reward publishers and reporters that produce thoughtful and original content. \section{Estimating News Originality} \label{sec:idea} Intuitively, \textit{news originality} refers to the process by which news content is created as well as the quality of news content. However, capturing these notions computationally appears challenging, especially when the content creation process remains opaque. Professional journalists and rates often find isolated text insufficient to rate originality and need additional context. Useful context includes ongoing news events and how much coverage they enjoyed, and also how a given news article is perceived by peers in the news ecosystem. A major precept in our work is that direct content analysis is neither sufficient nor necessary, whereas adequate context may provide sufficient signals to estimate originality. To capture the context of individual news articles, we construct a \textit{news citation graph} (Section \ref{sec:graph}) for the entire news inventory at a fixed time. Peer recognition of each article is evaluated using the PageRank algorithm on this graph. An original piece of news could be cited by different publishers; it could also be a local news story cited by a major publisher with many subsequent citations --- both cases are captured adequately by PageRank. Here we emphasize the use of global PageRank values not restricted to particular news events. That is because quality articles often cite out-of-topic background material and may be cited under later news events. We try to capture news ecosystem dynamics and emulate how professional raters or journalists estimate news originality level. To this end, PageRank values cannot be compared across topics and news events with very different amounts of news coverage. For a given news event or news story, we consider the entire news coverage as a cluster. Our insight is that {\em articles with the highest global PageRank values within each news-event cluster are most likely to be original}. Hence, we estimate news originality by normalizing global PageRank scores $n_v$ within each cluster $C_v$: \hush{(notation from Section \ref{sec:graph}).} \vspace{-2mm} \begin{equation}\label{eq:normalize} s_v = \Big(\frac{n_v^p} {\sum_{u \in \mathcal{C}_v} n_u^p}\Big) ^ {\frac{1}{p}},\ \hush{v \in \mathcal{C}_v, \ } p>0 \end{equation} where $\mathcal{C}_v$ is the cluster of article $v$, and the $p$ constant defaults to $p=1.0$. Increasing $p$ would favor articles with higher $n_v$ values. Our process of estimating news originality is shown in Figure~\ref{fig:workflow}. Notably, we cannot evaluate a newly published article for originality before peers cite it. This introduces a delay and requires a near real-time system to deliver originality scores early in the news cycle. When using originality scores $s_v$ in News Feed ranking, we first convert them into P(original) $\in(0,1]$ as follows \begin{equation} \label{eq:linear} \mathrm{ P(original)} = \frac{\max(s_v, \theta) - \theta} { 1 - \theta}. \end{equation} Here $\theta\in (0,1]$ is the promotion threshold, i.e., only contents with $s_i^t > \theta$ can be promoted. Then, we add P(original) to the relevance score as a second-order term: \begin{equation*} \mathrm{Relevance} = \ \alpha_1\ \cdot \mathrm{ P(comment)} \ +\ \alpha_2 \cdot \mathrm{P(share)} + \ \alpha_3\ \cdot \mathrm{P(like)} \end{equation*} \vspace{-5mm} \begin{equation}\label{eq:p_score} + \dots + \ \alpha_n \cdot \mathrm{ P(click)}\ \cdot \mathrm{ P(original)}. \end{equation} Here P(comment), P(share), P(like) and P(click) are probabilities of respective events for the news article in question, and the weights $\alpha_i$ maximize long-term user satisfaction. Clearly, our originality signal is just one component of News Feed ranking that elevates peer-recognized content. Other signals elevate other content types. \begin{figure}[t] \centering \includegraphics[width=.93\columnwidth,trim={7cm 1.5cm 8cm 1cm},clip]{figs/flowchart.pdf} \vspace{-2mm} \caption{\label{fig:workflow} The workflow of our methodology.} \vspace{-4mm} \end{figure} \section{Implementation and Scaling} Our preliminary investigation found that news articles highly cited by other articles tend to exhibit a higher level of originality. Therefore, we first build a citation graph of all news articles published in a seven-day window. Then, we calculate global PageRank values for individual articles, cluster news articles by news event/story in a scalable way, and normalize PageRank values within each cluster. \subsection{PageRank with Integrity Considerations} \label{sec:pagerank} \blue{ We index all the news articles shared on the platform by leveraging the Facebook Crawler tool\footnote{\url{https://developers.facebook.com/docs/sharing/webmasters/crawler}}. The Facebook Crawler tool crawls the HTML of an app or website that was shared on Facebook via copying and pasting the link or by a Facebook social plugin. There are other open-source crawlers that serve the same purpose. Common Crawl\footnote{\url{https://commoncrawl.org/}} is a well-maintained open repository of Web crawl data that can be accessed and analyzed by anyone.} We limit news articles in the graph to those posted within a seven-day moving window. After parsing the HTML, we traverse the output to get all {\tt <a>} tags, which define hyperlinks to other Web pages. Hyperlinks specified in the {\tt <a>} tag with different URLs may point to the same Web page. Therefore, we resolve alls URLs to canonical URLs\footnote{\href{https://developers.facebook.com/docs/sharing/webmasters/getting-started/versioned-link}{https://developers.facebook.com/docs/sharing/webmasters/getting-started/versioned-link}} and assign each news citation graph vertex a unique ID based on a canonical URL. If the cited Web page is also a recent news article, we establish an edge between the two news article vertices. With this news citation graph, we compute PageRank values for each news article. \blue{The raw citation graph is vulnerable to \textit{link farming}, as per \citet{du2007using}. That is, the graph may be manipulated by changing interconnected link structure of pages to add many inbound edges to a target page. To counter such manipulations, we disregard several types of citations before applying the PageRank algorithm. As shown in Figure~\ref{fig:ex_citation}, one typical example is \textit{self-linking} edges in $\mathcal{G}^t$ that cite an article published by the same publisher. Some Web sites link their articles to other Web sites without real content, but with automatic redirect to phishing sites or simply return to the citing article. These integrity filters mitigate the risk of manipulation. A filtered citation graph snapshot at each hour typically contains 300K--500K edges. The news articles without incoming and outgoing citations are excluded from the PageRank computation. } \red{ Despite their long history, attempts to manipulate PageRank in Web search have been successfully addressed \cite{penguin2016google}. } \blue{The original PageRank calculations work well with graphs that exhibit cycles, created when popular Web pages are revised to link to pages published later. Unlike the Web link graph, our news citation graph mostly contains links to past content since news posts on social networks are typically not revised. PageRank calculations simplify significantly on acyclic graphs and require a single linear-time graph traversal. However, in practice our citation graph contains enough cycles to question such simplifications.} \subsection{News Event Clustering}\label{sec:clustering} We now outline our clustering technique. As explained in Section \ref{sec:idea}, we normalize PageRank scores for individual news articles using PageRank scores of other articles in the same cluster. Intuitively, an important national news event and a local breaking news might carry similar amount of originality, but original articles in a larger cluster get more citations and higher PageRank scores. In addition to cluster normalization, computational scalability is also important --- on an uneventful day, our inventory snapshot contains 2M-3M articles, and we strive to process them in minutes. We estimate the {\em topical similarity} of articles based on their titles, noting that articles with identical titles may have different PageRank scores. We first lowercase article titles, remove punctuation and hash the titles to assemble duplicates into mini-clusters. For each unique title, we calculate a vector embedding based on the powerful and adaptable BERT DNN (Section~\ref{sec:bert}). In addition to handling synonyms and equivalent phrases well, BERT also supports transfer learning. To this end, we use a Siamese-twins network architecture shown in Figure~\ref{fig:bert}, previously proposed for semantic similarity estimation~\cite{reimers2019sentence}. The two article titles are processed by the two constituent BERT models, which we implement in PyTorch using HuggingFace transformers \cite{wolf-etal-2020-transformers}. An additional layer on top of BERT is a 128-dimensional fully connected (FC) layer with $tanh$ activation. In Figure~\ref{fig:bert}, $T_i$ represent the $i^{th}$ token in input sentences With the BERT network weights fixed, the top level is trained on labeled article pairs using the cosine embedding loss function $\mathcal{L}$ \begin{equation} \mathcal{L}(x_1, x_2, y) = \begin{cases} 1 - \cos(x_1, x_2) & \mbox{if } y = 1 \\ \max(0, \cos(x_1, x_2) - \mbox{ margin }) & \mbox{if } y = -1 \end{cases} \end{equation} where $x_1$ and $x_2$ represent the two input sentences respectively. $y = 1$ means the two sentences are same news event, while $y = -1$ means the two sentences are about completely different news event. \begin{figure}[ht] \centering \includegraphics[width=.65\linewidth,trim={6.5cm 0.5cm 15cm 0.1cm},clip]{figs/bert.pdf} \vspace{-3mm} \caption{\label{fig:bert} Estimating sentence similarity using pre-trained BERT networks~\cite{reimers2019sentence}. The shared dense layer is trained.} \vspace{-5mm} \end{figure} BERT-based vector embeddings optimized to capture title similarity by cosine similarity support vector-based clustering algorithms. The choice of algorithms is driven by quality considerations and the ability to process millions of titles in several minutes, which we need to ensure frequent refresh of the news originality signal (in the context of Section~\ref{subsec:lifecycle}). \hush{ Every hour, over 2 millions news articles are viewed by users. As discussed in Section~\ref{subsec:lifecycle}, online news have pretty short life-cycle. Thus, our system needs to be as real-time as possible to capture news dynamics and use it in ranking effectively. We need to cluster all the articles fast and refresh the clusters frequently. Thus, our algorithm should not only work well with vector representation (BERT embedding), but also be scalable and easy to improve and optimize. There are plenty of different clustering algorithms available. However, it's not easy to find one that satisfies all our needs. } Clustering algorithms based on K-Nearest-Neighbors (KNN) are a natural starting point, but specifying $K$ is not straightforward and for any given $K$ such algorithms risk producing inconsistent results in our application. Therefore, our three-step clustering in Figure~\ref{fig:3step} combines text hashing and KNN with greedy local search. Topical clusters often contain just a few different titles, while national news receive up to thousands citations per article. \hush{Global sparsity and tight local clusters are convenient for clustering algorithms.} \begin{figure}[b] \vspace{-3mm} \centering \includegraphics[width=.95\linewidth,trim={4.5cm 4cm 5cm 3.6cm},clip]{figs/2step.pdf} \vspace{-2mm} \caption{\label{fig:3step} Three-step clustering} \end{figure} The set of unique article vectors is converted into an undirected KNN graph $\mathcal{G}$. For each vector, we find its $K=5000$ nearest neighbors based on {\em cosine similarity} (1 - {\em cosine distance}) and use cosine similarity for edge weights between adjacent vertices $v_i^t$ and $v_j^t$. Lightweight edges are ignored, and subgraphs are defined by connected components of the resulting graph. Reasonable weight thresholds are found with a form of binary search guided by a subgraph size target. See details in Algorithm~\ref{algo:stage1}. \begin{algorithm} \SetAlgoLined \KwInput{Weighted graph $\mathcal{G}=\{\mathcal{V}, \mathcal{E}\}$, subgraph target size $t$, optimization threshold $\epsilon$, $\ell$ = 0.0, $h = 1.0$} \KwOutput{A set of subgraphs $\boldsymbol{\mathcal{S}}$ of approximately target size $t$} \DontPrintSemicolon \SetKwFunction{FMain}{findSubgraphs} \SetKwProg{Fn}{Function}{}{end} \Fn{\FMain{$\mathcal{G}$, $\epsilon$, $\ell$, $h$}:}{ {$\boldsymbol{\mathcal{S}} = \emptyset$} \While{$h - \ell > \epsilon$}{ $m = \frac{\ell + h}{2}$ \; {$\mathcal{G'} = \mathcal{G}$ without edges of weight < $m$ \;} {$\boldsymbol{\mathcal{C}}=$ {\tt connectedComponents}($\mathcal{G}'$) \;} \ForEach{$c \in \mathcal{C}$}{ \If{$|c| > b$} { Remove vertices in $c$ and their incident edges from $\mathcal{G}$ $\boldsymbol{\mathcal{S}} = \boldsymbol{\mathcal{S}}$ $\cup $ \FMain{$c$, $\epsilon$, $l$, $m$} } } $h = m$ } {$\mathcal{G'} = \mathcal{G}$ without edges of weight < $m$ \;} {$\boldsymbol{\mathcal{S}} = \boldsymbol{\mathcal{S}}$ $\cup$ {\tt connectedComponents}($\mathcal{G}'$) \;} \KwRet {$\boldsymbol{\mathcal{S}}$}\; } \caption{ \label{algo:stage1} Split a graph into subgraphs with target size} \end{algorithm} An investigation of typical outputs of Algorithm~\ref{algo:stage1} suggested that clusters were generally reasonable, but local news and events with low coverage were not handled well. To remedy this deficiency, we form local clusters using greedy optimization to maximize the total edge weight $w_c$ inside clusters. We impart a default negative weight $\omega$ to pairs of vertices within a top-down cluster that are not connected by edges (not nearest neighbors). The smaller the $\omega$, the harder it is to create subclusters. For details, see Algorithm ~\ref{algo:stage2}. \begin{example} Figure~\ref{fig:3step} illustrates local clusters in a subgraph: $\{A, B, C, D\}$ and $\{E, F\}$. Suppose $\omega=-0.1$. Then the total edge weight in cluster 1 is $w_1 = 0.7 + 0.8 + 0.8 + 0.9 + 0.95 - 0.1 = 4.15$ (no edge between $A$ and $C$), and in cluster 2 $w_2 = 0.8$. Although $A$ and $E$ are connected, the edge weight is so low that adding $E$ would not increase the total weight of cluster 1. The same reasoning applies to $F$. Therefore local clustering produces two clusters. \end{example} \begin{algorithm} \SetAlgoLined \KwInput{Weighted graph $\boldsymbol{g}$, negative weight $\omega$ for missing edges, number $R$ of independent randomized passes} \KwOutput{An integer $c_v$ for each vertex $v$ (cluster assignment)} \RepTimes{$R$}{ {Randomize the order of vertices in $\boldsymbol{g}$ } Initialize each vertex $v$ in its own cluster $\boldsymbol{c}_v$ \ForEach{$v \in \boldsymbol{g}$} { \ForEach{$u \in \mathcal{B}_v$} { {Try moving $v$ from cluster $c_v$ to cluster $c_u$} {Add up internal weights for $c_u$ and $c_v$} {Record $u$ with the highest sum of weights seen} } {Move $v$ to maximize the sum of weights of $c_v$ and $c_u$} } \eIf{$\sum {w_c}$ increased}{ repeat {\bf foreach} $v\in \boldsymbol{g} $} {Record the solution with the highest $\sum {w_c}$ seen} } \caption{ \label{algo:stage2} Greedy local clustering} \end{algorithm} \hush{ Clustering has been extensively studied in machine learning and data mining. The performance of clustering depends on both the representation of data and the clustering algorithm used. When we compare different clustering algorithms, we need to find one that can be easily scaled to millions of articles and can be computed very fast. If the clustering algorithm runs over a few hours, our final ranking intervention might not be as effective. } \hush{ \begin{algorithm} \SetAlgoLined \KwInput{KNN Graph $\mathcal{K}=\{\mathcal{V}, \mathcal{E}\}$, edge thresholds $\boldsymbol{\eta}$, a fixed size that can be fitted into a single machine $z$} \KwOutput{Sub Graphs $\boldsymbol{g}$} \For{$i\gets0$ \KwTo $|\boldsymbol{\eta}|$}{ {Ignore all edges which have weight below $\boldsymbol{\eta}_i$} \; {Run connected components}\; Get components with size less than $z$, each component is a subgraph $g$. } \caption{Split a graph into subgraphs that can be managed on individual servers} \label{algo:stage1} \end{algorithm} \paragraph{\textbf{Stage 2: Local clustering}} After the first stage, we find all subgraphs that can be processed in a single machine. Thus, we can implement more complex clustering algorithms which could be hard to distribute in the second stage. Specifically, we maximize internal cluster weights to get all clusters. The algorithm for this stage is as in Algorithm ~\ref{algo:stage2}. \begin{algorithm} \SetAlgoLined \KwInput{Sub Graphs $\boldsymbol{g}$, a default negative weight $w$ for missing edges.} \KwOutput{All News event clusters $\mathcal{C}$} Each subgraph $g \in \boldsymbol{g}$ is processed in a single machine\; Initialize each article $n$ in its own cluster $c$\; \While {weights within each cluster is not maximized}{ \ForEach{$n \in {g}$} { {\tcp{each article n}} {Try to move $n$ from current cluster and attach it to any other neighboring cluster}\; {Assign $n$ to the best possible option}\; } } \caption{Local Clustering \label{algo:stage2}} \end{algorithm} } \subsection{Scalability} Building and processing the KNN graph with $K=5000$ nearest neighbors per vertex is a major performance bottleneck. On a typical day, all news articles from the last week fit in the RAM of a single server and can be processed reasonably quickly. However, this architecture is insufficiently scalable for the following reasons. \begin{itemize} \item {\em Potential surges} of the news inventory during the election season, the New Year's Eve, etc. \item {\em Near real-time processing} benefits from additional compute resources (lower processing latency via using multiple servers). \item {\em Need for scaling to larger content inventory}. The challenge we are solving and our methods are fairly general, so can be applied to other social-network platforms that value originality. Now or in the future, such platforms may enjoy a much larger scale of content inventory. \end{itemize} The overall design described in Section ~\ref{sec:clustering} naturally supports distributed processing to ensure greater overall scalability and robustness to surges. In fact, this is why Algorithm \ref{algo:stage1} performs {\em balanced} partitioning. Our implementation supports distributed clustering as well. We found that the upper bound on single-server capacity is an important parameter --- individual servers must receive a sufficient amount of work to justify distributed processing, but the data must fit into available RAM. Between the implied lower and upper bounds, there is a transition point where one can reduce the amount of computation at the cost of greater processing latency. \section{Evaluation and Deployment} Before deploying our news originality signal to production at Facebook, we evaluate its functional components individually, evaluate the entire signal with the help of professional raters, then embed the signal into News Feed ranking and explore examples to check that everything works as expected. The production deployment is evaluated with an industry-standard technique ---an A/B test on live data for a limited subset of users before it is enabled for the main group of users~\cite{ab2015kdd}. \subsection{Evaluation of Embeddings and Clustering} In our rating flow, we ask professional raters to review pairs of news articles. The raters assign a similarity level to each pair of articles: {\em different subjects}, {\em different subject but some common contents}, {\em same subjects with different aspects}, and {\em same subjects} (the four levels are explained in Table~\ref{tab:similarity_rating}). For training, we collect 100K pairs of randomly sampled English news titles, using 40\% for finetuning, 10\% for validation, and 50\% for test. Separately, we collect another 10K pairs of news articles to evaluate clustering performance. To sample likely-positive examples, we take some number of closest neighbors in terms of document embeddings and/or text similarity. Likely-negative samples are drawn from further-away neighbors that are sufficiently close to make the labeling task nontrivial. \begin{table}[t] \centering \caption{\label{tab:similarity_rating} Guidelines for rating the similarity of article pairs} \vspace{-2mm} \begin{tabular}{L{1cm} | L{2.5cm} | L{3.5cm}} \toprule \sc Score & \sc Rating & \sc Criteria\\ \midrule 0.0 & different subjects & the two articles cover completely different subjects \\ \hline 1.0 & different subjects / some commonality & the two articles cover different subject but with share some content \\ \hline 2.0 & same subject / different aspects & the two articles cover the same subject but report different aspects of the same story \\ \hline 3.0 & same subject & the two articles cover the same subjects \\ \bottomrule \end{tabular} \vspace{-1mm} \end{table} To compare our vector embeddings with FastText \cite{joulin2016fasttext} and Pytorch-BigGraph \cite{lerer2019pytorch} embeddings, we represent similarity levels numerically by 0.0, 1.0, 2.0, 3.0 during training following Table~\ref{tab:similarity_rating}. During evaluation, we binarize model scores at thresholds 0.5, 1.5 and 2.5, then use ROC AUC as the evaluation metric. For example, [email protected] considers article pairs with cosine similarity $\geq0.5$. Table~\ref{tab:embedding} describes the performance of our BERTPairwise model, which consistently outperforms pre-trained state-of-art embeddings. \hush{After the model is trained, we feed the titles of our candidate news articles to the model to generate the embedding of each news article.} \begin{table}[b] \vspace{-3mm} \caption{ \label{tab:embedding} The pairwise embedding vs. FastText \cite{joulin2016fasttext} and Pytorch-BigGraph \cite{lerer2019pytorch} embeddings} \vspace{-2mm} \begin{tabular}{cccl} \toprule Model & AUC $@$ 0.5 (\%) & AUC $@$ 1.5 & AUC $@$ 2.5\\ \midrule FastText & 80.20 & 83.89 & 89.66 \\ BigGraph & 82.95 & 84.87 & 89.61 \\ \midrule BERTPairwise & 83.66 & 88.67 & 96.13\\ \bottomrule \end{tabular} \end{table} To evaluate our news-event clustering vs. human labels, we randomly sample 10K pairs of news articles in English from the candidate pool and send the pairs to professional annotators, along with guidelines in Table\ref{tab:similarity_rating}. Then, we apply the clustering algorithms to the entire candidate pool. For each sampled pair, if the two articles appear the same cluster, the predicted label is positive, otherwise --- negative. The clustering algorithm is evaluated by precision and recall, then compared with two well-known algorithms in Table~\ref{tab:clustering}. {\tt DBSCAN} (density-based spatial clustering of applications with noise)\cite{ester1996density,schubert2017dbscan} is a highly scalable density-based algorithm. The {\tt Louvain} algorithm \cite{blondel2008fast} is one of the fastest and best-known community detection algorithms for large networks. \begin{table}[t] \caption{ \label{tab:clustering} The performance of three-stage clustering with DBSCAN \cite{ester1996density} and the Louvain algorithm \cite{blondel2008fast}} \vspace{-2mm} \begin{tabular}{cccl} \toprule \sc Algorithm & \sc Precision & \sc Recall \\ \midrule DBSCAN & 43.07 & 73.04 \\ Louvain & 81.01 & 47.57 \\ Stage 1 + Louvain & 81.85 & 32.63\\ \midrule three-stage clustering & \textbf{83.73} & \textbf{45.33} \\ \bottomrule \end{tabular} \vspace{-1mm} \end{table} \subsection{Evaluation by Professional Raters} To assess the accuracy of our citations score signal, we sample the most viewed news articles identified as original, and the most viewed article not identified as original from the most viewed news domains over a seven-day period. Our professional raters have many years of news-industry experience and follow a deliberate process to ensure fair judgement for each article they rate on a three-point scale of news originality (Table~\ref{tab:original_rating}). For the rating 3.0, our predicted labels match these results 90\% of the time. In other words, our signal attains 90\% accuracy in identifying original news. \begin{table}[bt] \centering \caption{ \label{tab:original_rating} Originality rating guidelines for human raters } \vspace{-2mm} \begin{tabular}{L{1cm} | L{2.5cm} | L{3.5cm}} \toprule \sc Score & \sc Rating & \sc Criteria \\ \midrule 1.0 & unoriginal & borrows most of the content and language from other sources or is extremely thin / low information overall, and anything that is not properly syndicated. \\ \hline 2.0 & possibly/somewhat unoriginal & rewords borrowed content with its own language, but >70\% is borrowed OR properly syndicated \\ \hline 3.0 & fully original & is not a syndicated republishing, little to no content is borrowed \\ \bottomrule \end{tabular} \vspace{-1mm} \end{table} \subsection{An Illustrative Example} Besides the quantitative evaluation, we also performed qualitative case studies. Here we describe one example that illustrates how our system works. On January 26, 2020, an article $n$ about the death of Kobe Bryant in a Calabasas helicopter crash was first reported by the publisher TMZ\footnote{TMZ: https://www.tmz.com}. In just 10 minutes, many publishers covered this story and cited TMZ. Over 200 articles fell into this news-event cluster, and the original story by TMZ ranked the highest. For such events, users would see news articles posted by the newspages they follow and shared by their friends. If the original news article is in a users' feed inventory, it gets prioritized. Note that our originality signal is only one component in the ranking formula. Users with preferences for certain publishers or strong affinity with their friends continue seeing articles shared by those actors. \subsection{Production Deployment and Evaluation} \blue{The originality signal is intended for the relevance score calculation (see Figure~\ref{fig:ranking} and Equation~\ref{eq:p_score}) to increase the distribution of original news articles. To ensure its availability early in the news cycle, it is recalculated from scratch on an hourly basis. Building the news citation graph and news clusters takes only a few minutes, but system bottlenecks are observed in our current crawling infrastructure and in generating vector embeddings. In practice, it takes time for the original articles to get cited, but running the workflow more often could find and promote original articles earlier. Such improvements are likely with further infrastructure optimization.} \blue{Before making proposed changes to News Feed ranking at Facebook, we consulted with the academic and publishing communities and performed careful empirical evaluation. In particular, we ran an A/B test on live data for several weeks, where the control group used prior production ranking rules and a small test group used revised ranking rules~\cite{ab2015kdd}. To estimate impact, we computed the increase in view counts at different thresholds (Table~\ref{tab:stability}) and found our technique works well at different thresholds.} \blue{We have not observed statistically significant deteriorations in our proprietary metrics \cite{people2018fb,publishers2019fb,ranking2021fb} during the A/B test or after the subsequent full product launch. \hush{We have been tracking a goal metric called News Ecosystem Quality score. It is a synthetic score that combines several proprietary metrics such as clickbait prevalence. We observed a statistically significant score increase of \textbf{0.41\%} in our experiment.} After additional checks and consultations, our signal was enabled for English-language content within Facebook's News Feed ranking system for most users in June 2020 ~\cite{newsorig2020fb}. } \red{Publishers may try to manipulate our news originality signal. To this end, PageRank can be protected from abuse \cite{penguin2016google}, wheras Facebook's integrity monitoring and enforcement \cite{halevy2020integrity} has a particular focus on coordinated inauthentic behaviors \cite{coord_inauth2021fb}. } \hush{ To prevent unexpected regressions, data scientists at Facebook track hundreds of metrics before and after any changes to News Feed ranking. These metrics capture user engagement and user feedback, proxies for content quality and various aspects of News Feed integrity (such as clickbait prevalence).} \begin{table} \caption{\label{tab:stability} User engagement lift in promoting original news} \vspace{-2mm} \begin{tabular}{cccl} \toprule \sc Originality threshold & \sc Increase in num. views (\%) \\ \midrule 0.4 & 15.36 \\ 0.5 & 14.72 \\ 0.6 & 14.30 \\ 0.7 & 13.83 \\ 0.8 & 13.38 \\ \bottomrule \end{tabular} \vspace{-3mm} \end{table} \section{Conclusions and Perspectives} In this paper, we introduce a strategy to prioritize original news in social networks. This strategy computes PageRank scores of news articles and estimates originality by normalizing PageRank scores for each news event. Equation \ref{eq:normalize} is a particularly novel contribution. We deployed the originality signal to personalized Facebook News Feed, which compiles articles from sources followed by the user and user's friends \cite{facebook,news2021fb,ranking2021fb,publishers2019fb,people2018fb,ni2019feature}. When multiple articles are available in a user's inventory, we promote the more original ones. While subtle, such changes influence what the community sees. As part of our work, we performed conceptual, qualitative and quantitative evaluation to confirm that our techniques positively impact the news ecosystem. In particular, the exposure of original content has grown, and users received more content they liked. Over a longer timeframe, these developments should encourage publishers to invest more in original content. \begin{acks} We would like to thank Jon Levin, Gabriella Schwarz, Lucas Adams, David Vickrey, Xiaohong Zeng, Joe Isaacson, Gedaliah Friedenberg, Pengfei Wang, Feng Yan, Jerry Fu, Songbin Liu, Yan Qi, Ranjan Subramanian, Adrian Le Pera, Vasu Vadlamudi, Julia Smekalina and others who supported and collaborated with us throughout. \end{acks} \hush{From the engineering perspective,\footnote{Business and legal considerations aside.} our techniques can be applied to other social networks and news ecosystems where prioritizing original content is valuable. Twitter could prioritize original tweets by treating retweets as citations. News providers such as Apple News can also benefit from such our originality signal.} \hush{ Given the worldwide availability of our personalized product, novel adversarial behaviors may arise. Here we ($i$) rely on generic News Feed integrity mechanisms implemented by Facebook \cite{halevy2020integrity}, ($ii$) built specialized integrity considerations into our work, ($iii$) are monitoring the performance of the originality signal and fully expect additional integrity effort in the near future. } \hush{ \subsection{Future Work} Though we have proved that our method has postive impact on the news ecosystem, we think there are still a lot of room for improvement. First, our signal is an unsupervised signal based solely on URL level PageRank values. As we know, there might be other useful signals that could be very useful for identifying original news such as the Click-Gap signal \footnote{\url{https://about.fb.com/news/2019/04/remove-reduce-inform-new-steps/}}. There is no easy way to blend such signals into $P(original)$ in an objective way for our current method. As a followup, we plan to collect more data with originality level labels, and work on a supervised method that could incorporate more effective signals. Besides, the main focus of this work has been on promoting original reporting. The news ecosystem can be further improved by adding a demotion component to our strategy, that is, reducing the prevalence of un-original news in our ecosystem. This could also be easily added if we have more labeled data on originality levels. Nonetheless, defining original reporting and the standards for it are complex, so we will continue to work with publishers and academics to refine this approach in the future.} \bibliographystyle{ACM-Reference-Format}
\section{Introduction} \label{sec:introduction} Let $\Gamma \subset \P^n$ be a finite set of points. We say that $\Gamma$ \textbf{satisfies the Cayley--Bacharach condition with respect to degree $r$ polynomials} or simply \textbf{is ${\mathrm{CB}}(r)$} if, whenever a homogeneous degree $r$ polynomial $F$ vanishes at all but one point of $\Gamma$, $F$ vanishes at the last point. This notion was familiarized by the classical 19th century theorem of Cayley and Bacharach that states that if two plane curves of degree $d$ and $e$, respectively, meet in $de$ points, then any curve of degree $d+e-3$ that contains all but one of the intersection points must contain them all. That is, this set of $de$ points is ${\mathrm{CB}}(d+e-3)$. Since then, there have been many generalizations and conjectures based on this result. See \cite{EGH} for a thorough history and several questions that remain open; see \cite{KLR19} for a more algebraic viewpoint, particularly for the case where $r+1$ is the Castelnuovo--Mumford regularity of $\Gamma$. The Cayley--Bacharach condition has come up recently in the context of measures of irrationality for projective varieties. Specifically, if $X$ is a smooth variety of dimension $n$ and $\Gamma \subset X$ is a finite set of points, we say $\Gamma$ satisfies the Cayley--Bacharach condition with respect to a linear system $|V|$ if any section $s \in V$ vanishing at all but one point of $\Gamma$ vanishes at the last point. In the case where $\Gamma$ is a general fiber of a generically finite dominant rational map $X \dashrightarrow \P^n$, Bastianelli showed that $\Gamma$ satisfies the Cayley--Bacharach condition with respect to the canonical linear system $|K_X|$ (see \cite[Proposition 4.2]{Bas}). Several recent papers have exploited the Bastianelli result to compute the gonality, or the degree of irrationality, a higher dimensional analog of gonality, of several classes of smooth complete intersection varieties in projective space (see e.g. \cite{BCD}, \cite{BDELU}, \cite{SU}, \cite{HLU}). The theme is that if the canonical bundle of $X$ is sufficiently positive (as, for example, in the case of high degree complete intersections), the fibers are forced to lie in special positions. For instance, to this end, Bastianelli, Cortini, and De Poi prove the following: \begin{theorem}{\cite[Lemma 2.4]{BCD}} If $\Gamma \subset \P^n$ is ${\mathrm{CB}}(r)$ and \begin{equation}\label{eqn}|\Gamma| \leq 2r+1,\end{equation} then $\Gamma$ lies on a line. \end{theorem} This result allows them to show that the fibers of rational maps to $\P^r$ from a high degree hypersurface $X \subset \P^{r+1}$ are collinear. In other (non-hypersurface) examples, however, we do not expect the fibers to be collinear. A natural question, then, is: what can one say about the geometry of $\Gamma$ when the bound (\ref{eqn}) is weakened? For instance, when the bound is raised to $|\Gamma| \leq \tfrac{5}{2}r +1$, Stapleton and the second author show in \cite{SU} that $\Gamma$ lies on either a plane conic or two skew lines (see also Remark \ref{SUrem}). In this paper, we examine linear conditions on $\Gamma$ implied by the Cayley--Bacharach condition. We call a union $\mathcal{P} = P_1 \cup \cdots \cup P_k \subseteq \mathbb{P}^n$ of positive-dimensional linear spaces a {\bf plane configuration of dimension} $\dim(\mathcal{P}) = \sum \dim(P_i)$ {\bf and length} $\ell(\mathcal{P}) = k$. We propose the following conjecture: \begin{conjecture} \label{conj:main} Let $\Gamma \subset \mathbb{P}^n$ be a finite set of points satisfying ${\mathrm{CB}}(r)$. If \begin{equation} \label{eqn:conj-bound} |\Gamma| \leq (d+1)r + 1, \end{equation} then $\Gamma$ lies on a plane configuration $\mathcal{P}$ of dimension $d$. \end{conjecture} Note that this bound is easily shown to be tight: a counterexample for $(d+1)r+2$ is given by points on a rational normal curve (see Example \ref{ex:rational-normal-curve}). Our main result is as follows. \begin{theorem} \label{thm:main} Conjecture \ref{conj:main} holds in the following cases: \begin{itemize} \item[(i)] For $r \leq 2$ and all $d$. Moreover, we may take $\ell(\mathcal{P}) = 1$. \item[(ii)] For all $r$ and for $d \leq 3$. Moreover, for $r \leq 4$, we may take $\ell(\mathcal{P}) \leq 2$. \item[(iii)] For $d=4$ and $r=3$. Moreover, we may take $\ell(\mathcal{P}) \leq 2$. \end{itemize} \end{theorem} We believe a stronger statement is true in at least two respects. First, for each $d$, we believe the \emph{length} of the plane configuration can be bounded in terms of $r$, as in the above theorem. Note that this maximum length can become arbitrarily large as $r$ increases (Example \ref{ex:d-lines}). See also Corollary \ref{cor:d-lines-bound}, which gives constraints on $\frac{r}{d-1}$ in the case where $\mathcal{P}$ has maximum length, i.e. $\mathcal{P}$ is $d$ disjoint lines. Second, we believe $\Gamma$ lies on certain unions of curves of low degree and arithmetic genus, whose exact description depends on refinements of the bound on $|\Gamma|$, as in the result of Stapleton and the second author. See Section \ref{sec:conclusion} for additional discussion. Theorem \ref{thm:main} directly implies a result about the geometry of fibers of low degree maps to projective space from certain codimension two complete intersections: \begin{theorem}\label{codim2thm} Assume $n \geq 0$. Let $X \subset \P^{n+2}$ be an irreducible complete intersection of a quartic hypersurface Y and a hypersurface of degree $a\geq 4n-5.$ \begin{enumerate} \item[(a)] If $f: X \dashrightarrow \P^n$ is a finite rational map of degree $\leq 3a$ and $\Gamma \subset X$ is a fiber of $f$, then $\Gamma$ lies on a plane configuration of dimension $3$. \item[(b)] In particular, the conclusion of (a) holds for any dominant rational map $f: X \dashrightarrow \P^n$ of minimum degree. \end{enumerate} \end{theorem} \begin{remark}\label{SUrem} The cases of hypersurfaces of quadrics and cubics were dealt with in \cite{SU}. The authors showed that in the former case, the fibers must be collinear, and in the latter, the fibers must lie on plane conics or two skew lines -- in particular, the fibers lie on plane configurations of dimension two. \end{remark} Applying the conclusion of Conjecture \ref{conj:main}, we obtain the following more general conjectural result about codimension two complete intersections of arbitrary degree. \begin{proposition}\label{codim2prop} Assume $n \geq 0$. Let $X \subset \P^{n+2}$ be an irreducible complete intersection of hypersurfaces $Y_a$ and $Y_b$, of degrees $a, b \geq 2$, respectively. Suppose that Conjecture \ref{conj:main} holds for $d = b-1$ and $r = a+b-n-3$ and that $a+1 \geq b(3+n-b) .$ \begin{enumerate} \item[(a)] If $f: X \dashrightarrow \P^n$ is a finite rational map of degree $\leq a(b-1)$ and $\Gamma \subset X$ is a fiber of $f$, then $\Gamma$ lies on a plane configuration of dimension $b-1$. \item[(b)] In particular, the conclusion of (a) holds for any dominant rational map $f: X \dashrightarrow \P^n$ of minimum degree. \end{enumerate} \end{proposition} The paper is organized as follows. In Section \ref{sec:preliminaries}, we introduce the notion of a plane configuration and prove basic results about the Cayley--Bacharach condition and plane configurations which we make frequent use of throughout the remainder of the paper. In Section \ref{sec:examples}, we give some concrete examples. Sections \ref{sec:key-lemmas} and \ref{sec:proof-main} are devoted to the proof of the main theorem and requisite lemmas. Section \ref{sec:codim-2-ci} gives a short proof of Theorem \ref{codim2thm} and Proposition \ref{codim2prop}. Finally, in Section \ref{sec:conclusion}, we discuss directions for potential research and leave the reader with several open questions. The authors would like to thank Nic Ford, Joe Harris, Rob Lazarsfeld, Jessica Sidman, and David Stapleton. \section{Preliminaries} \label{sec:preliminaries} Our main object of interest is the following. \begin{definition} A {\bf plane configuration} $\mathcal{P}$ is a union of distinct positive-dimensional linear spaces $\mathcal{P} = \bigcup_{i=1}^k P_i$ in $\mathbb{P}^n$. We say its {\bf dimension} is $\dim \mathcal{P} = \sum_i \dim P_i$ and its {\bf length} is $\ell(\mathcal{P}) = k$. \end{definition} For $\mathcal{P}$ or any collection of linear spaces $P_1, \ldots, P_k$, we write $\mathrm{span}(\mathcal{P})$ or $\mathrm{span}(P_i : i=1, \ldots, k)$ for the linear span of their union. Thus a $2$-dimensional plane configuration is either two lines or one $2$-plane. In a sufficiently large $\mathbb{P}^n$, if the planes of $\mathcal{P}$ are in general position then $\mathrm{span}(\mathcal{P})$ has dimension $\dim \mathcal{P} + \ell(\mathcal{P}) - 1$. Note that, by definition, a $0$-dimensional plane configuration is empty. \begin{definition} We say a plane configuration $\mathcal{P}$ is {\bf skew} if $P_i \cap P_j = \emptyset$ for all $i \ne j$. We say it is {\bf split} if, in addition, $\mathcal{P}$ is a projectivized direct sum decomposition of the affine cone over $\mathrm{span}(\mathcal{P})$. Equivalently, \[\dim \mathrm{span}(\mathcal{P}) = \dim(\mathcal{P}) + \ell(P) - 1.\] Equivalently, for all $i$, $P_i \cap \mathrm{span}(P_j : j \ne i) = \emptyset$. \end{definition} If there exist $i \ne j$ for which $P_i \cap P_j$ is nonempty, it will frequently be preferable for us to replace $P_i$ and $P_j$ by $\mathrm{span}(P_i, P_j)$. The resulting plane configuration has lower length than $\mathcal{P}$ and at most the same dimension, while also being larger (as a variety). Since we wish to cover finite sets $\Gamma \subseteq \mathbb{P}^n$ by low-dimensional plane configurations, we may often freely reduce to $\mathcal{P}$ being skew. Note that when $\ell(\mathcal{P}) = 2$, $\mathcal{P}$ is skew if and only if $\mathcal{P}$ is split. \begin{example} In $\mathbb{P}^4$, let $\mathcal{P}$ consist of three general lines. Then $\dim \mathcal{P} = 3$ and $\ell(\mathcal{P}) = 3$, but $\mathrm{span}(\mathcal{P}) = \mathbb{P}^4$, so $\mathcal{P}$ is skew but not split. \end{example} \subsection{Basic facts} We now prove some basic facts about plane configurations and the Cayley--Bacharach condition. We will use them throughout the remaining arguments of the paper, often without explicit reference. \begin{proposition} \label{prop:extend-to-hyperplane} Let $\Gamma \subseteq \mathbb{P}^n$ be a finite set and $P$ a linear space. Then $P$ can be extended to a hyperplane $H$ containing no additional points of $\Gamma$. That is, $\Gamma \cap H = \Gamma \cap P$. \end{proposition} \begin{proof} Omitted. \end{proof} \begin{proposition}[Excision property] \label{prop:complements} Let $\Gamma \subseteq \mathbb{P}^n$ be a finite set satisfying ${\mathrm{CB}}(r)$. Let $\mathcal{P}$ be a plane configuration of length $\ell$. Then $\Gamma \setminus \mathcal{P}$ is ${\mathrm{CB}}(r-\ell)$. \end{proposition} In particular, the complement of $\Gamma$ by a single linear space is ${\mathrm{CB}}(r-1)$. \begin{proof} It suffices to show that, for a single linear space $P$, the set $\tilde\Gamma := \Gamma \setminus P$ is ${\mathrm{CB}}(r-1)$. By extending $P$ and avoiding $\tilde \Gamma$, we may replace $P$ by a hyperplane $H$. Let $Z$ be a hypersurface of degree $r-1$ containing all but one point $x \in \tilde \Gamma$. Then $Z \cup H$ has degree $r$ and contains $\Gamma \setminus \{x\}$. Since $\Gamma$ is ${\mathrm{CB}}(r)$, $Z \cup H$ contains the final point $x$. By construction $H$ does not contain $x$, so $Z$ does. \end{proof} \begin{proposition}[Basic lower bound]\label{prop:min-count} Let $\Gamma \subseteq \mathbb{P}^n$ be a finite set satisfying ${\mathrm{CB}}(r)$. If $\Gamma$ is nonempty, $|\Gamma| \geq r+2$. \end{proposition} \begin{proof} Suppose $1 \leq |\Gamma| \leq r+1$. Fix $x \in \Gamma$ and find hyperplanes $H_i$, each containing exactly one of the other points of $\Gamma$. The union of the $H_i$'s has degree $|\Gamma| - 1 \ \leq r$ and misses $x \in \Gamma$, a contradiction. \end{proof} In particular, Conjecture \ref{conj:main} holds in the case $d=0$ (recall that a $0$-dimensional plane configuration is empty). We also record the following stronger lower bound, whose proof is trivial, for use in inductive arguments below. \begin{proposition}[Inductive lower bound] \label{prop:inductive-lower-bound} Assume Conjecture \ref{conj:main} holds for fixed $r$ and dimension up to $d-1$. Let $\Gamma \subseteq \mathbb{P}^n$ such that $|\Gamma| \leq (d+1)r+1$, satisfying ${\mathrm{CB}}(r)$. Then if $\Gamma$ does \emph{not} lie on a plane configuration of dimension $d-1$, $|\Gamma| \geq dr+2$. \end{proposition} \section{Examples} \label{sec:examples} Our conjecture is sharp in certain respects and not others, as the following examples demonstrate. \begin{example}[Rational normal curves] \label{ex:rational-normal-curve} Let $r \geq 2$ and $m = (d+1)r+2$. Let $\Gamma \subset \mathbb{P}^{d+1}$ be any set of $m$ distinct points on a rational normal curve $C \subset \mathbb{P}^{d+1}$ of degree $d+1$. Then $\Gamma$ is in general linear position, hence is \emph{not} contained in a plane configuration of dimension $d$. (Any such configuration contains at most $2d$ points of $\Gamma$, by taking $d$ lines.) Nonetheless, $\Gamma$ satisfies ${\mathrm{CB}}(r)$ by B\'{e}zout. \end{example} This example demonstrates the following. \begin{corollary} \label{cor:bound-is-tight} The bound $|\Gamma| \leq (d+1)r+1$ in Conjecture \ref{conj:main} is tight. \end{corollary} We next see that, under the hypotheses of the conjecture, the points need not lie on a degree-$d$ rational curve. This is in contrast to the case $d=1$ (where the points will lie on a line) and the result of \cite{SU} (where $d$ is effectively $1.5$ and the points lie on a degree two, possibly reducible, rational curve). \begin{example}[Elliptic curve] \label{ex:elliptic-curve} Let $r=2$ and $d=3$. In $\mathbb{P}^3$, let $\Gamma$ consist of $9 = (3+1)2+1$ general points on a quartic elliptic curve $E$. Then no $8$ points of $\Gamma$ are a complete intersection of $E$ with a quadric surface (such complete intersections form only a $7$-dimensional family), so $\Gamma$ is ${\mathrm{CB}}(2)$. The unique $3$-dimensional plane configuration containing $\Gamma$ is the $\mathbb{P}^3$. Moreover, $\Gamma$ does not lie on any union of rational curves of total degree $3$. (See Question \ref{q:curves} for more discussion about points on possibly-reducible curves.) \end{example} Plane configurations of length greater than one are unavoidable: \begin{example}[Two 2-planes] Let $d=4$ and $r=3$. Let $\mathcal{P}$ be a split configuration of two 2-planes $P_1, P_2$. Let $C_i$ be a smooth conic on $P_i$ ($i=1, 2$) and let $\Gamma$ consist of $8$ general points from each $C_i$. Then $\Gamma$ is ${\mathrm{CB}}(3)$ and has $(d+1)r+1 = 16$ points. Moreover, $\mathcal{P}$ is the unique plane configuration of dimension $4$ containing $\Gamma$. \end{example} \begin{example}[$d$ general lines] \label{ex:d-lines} Suppose $r \geq 2d-1$. Let $\mathcal{P}$ consist of $d$ general lines in $\mathbb{P}^{n}$, where $n > d > \frac{1}{2}n$. Let $\Gamma$ consist of $r+2$ general points from each line. Then $\Gamma$ is ${\mathrm{CB}}(r)$ by B\'{e}zout and $|\Gamma| = d(r+2) \leq (d+1)r+1$. The only dimension-$d$ plane configuration containing $\Gamma$ is the $d$ lines. \end{example} Notably, this example shows that plane configurations of arbitrary length arise in Conjecture \ref{conj:main} for sufficiently large $r$. See also Corollary \ref{cor:d-lines-bound}, which shows that skew configurations of maximum length $d$ arise only outside the range $1 \leq \frac{r}{d-1} \leq 2$. \section{Key lemmas} \label{sec:key-lemmas} We have seen that complements of $\Gamma$ by hyperplanes must satisfy lower-degree Cayley--Bacharach conditions. These conditions seem too weak to allow inductive approaches to Conjecture \ref{conj:main}. Our core approach is to establish that, under certain conditions, subsets of $\Gamma$ again satisfy ${\mathrm{CB}}(r)$, with the same value of $r$. \subsection{Split configurations} \begin{lemma} \label{lem:disjoint-planes} Let $\Gamma \subset \mathbb{P}^n$ be a finite set of points. Let $P_1, P_2$ be disjoint, positive-dimensional planes, and suppose $\Gamma \subset P_1 \cup P_2$. Let $r \geq 1$. Then $\Gamma$ is ${\mathrm{CB}}(r)$ if and only if $\Gamma \cap P_1$ and $\Gamma \cap P_2$ are both ${\mathrm{CB}}(r)$. \end{lemma} \begin{proof} Let $p_i = \dim P_i$. First, we choose coordinates $[X_0 : \cdots : X_{p_1} : Y_0 : \cdots : Y_{p_2}]$ for $\mathrm{span}(P_1, P_2) \subseteq \mathbb{P}^n$ so that $P_1 = [X_0 : \cdots : X_{p_1} : 0 : \cdots : 0]$ and $P_2 = [0 : \cdots : 0 : Y_0 : \cdots Y_{p_2}]$. Write $\Gamma = \Gamma_1 \cup \Gamma_2$ where $\Gamma_i = \Gamma \cap P_i$. $(\Rightarrow)$ Suppose $\Gamma$ satisfies ${\mathrm{CB}}(r)$. Let $F$ be a polynomial of degree $r$ vanishing at all but possibly one point of $\Gamma_1$. We claim that $F$ vanishes at the last point. Let $G(X, Y) = F(X, 0)$, that is, the polynomial obtained by deleting all monomials involving $Y_j$'s. We may assume $G$ is not identically zero. Now $G|_{P_1} = F|_{P_1}$, and $G$ vanishes identically on $P_2$, hence on all of $\Gamma_2$. By ${\mathrm{CB}}(r)$ for $\Gamma$, $G$ vanishes at the last point of $\Gamma_1$, so $F$ does also. \medskip $(\Leftarrow)$ Suppose $\Gamma_1$ and $\Gamma_2$ satisfy ${\mathrm{CB}}(r)$. Let $F$ be a degree-$r$ polynomial vanishing at all but possibly one point of $\Gamma$, say $p \in \Gamma_1$. We may assume $F|_{P_1}$ is not identically zero, so by ${\mathrm{CB}}(r)$ for $\Gamma_1$, $F$ vanishes at the last point. \end{proof} We will primarily use this for pairs of disjoint planes, but the same argument applies to split configurations: \begin{proposition} Let $\mathcal{P} = \bigcup P_i$ be a \emph{split} plane configuration and let $\Gamma \subseteq \mathcal{P}$ be a finite set. Let $r \geq 1$. Then $\Gamma$ is ${\mathrm{CB}}(r)$ if and only if, for each $i$, $\Gamma \cap P_i$ is ${\mathrm{CB}}(r)$. \end{proposition} \begin{proposition} \label{prop:disjoint planes case} Suppose Conjecture \ref{conj:main} holds up to $d-1$ for fixed $r$. Let $|\Gamma| \leq (d+1)r+1$. Let $A, B \subseteq \mathbb{P}^n$ be disjoint, positive-dimensional planes. Suppose $\Gamma \subset A \cup B$ and $\Gamma \cap A$ and $\Gamma \cap B$ are nonempty. Then $\Gamma$ lies on a plane configuration of dimension $d$. \end{proposition} \begin{proof} Let $\Gamma_A = \Gamma \cap A$ and $\Gamma_B = \Gamma \cap B$. By counting, either \[|\Gamma_A| \leq dr+1 \text{ or } |\Gamma_B| \leq dr+1.\] Without loss of generality, assume $|\Gamma_A| \leq dr+1$. Let $d_A$ be minimal such that $\Gamma_A$ lies on a plane configuration of dimension $d_A$. By Proposition \ref{lem:disjoint-planes}, $\Gamma_A$ is ${\mathrm{CB}}(r)$, so the earlier cases of the Conjecture imply $1 \leq d_A \leq d-1$. The inductive lower bound (Proposition \ref{prop:inductive-lower-bound}) implies $|\Gamma_A| \geq d_Ar+2$ by minimality of $d_A$, and so \[|\Gamma_B| = |\Gamma| - |\Gamma_A| \leq (d-d_A+1)r - 1 < (d-d_A+1)r+1,\] so $\Gamma_B$ lies on a plane configuration of dimension $d-d_A$. Combining these two plane configurations gives a plane configuration of dimension $d$ as desired. \end{proof} \subsection{Unions of two planes meeting at a point} Let $A, B \subset \mathbb{P}^n$ be linear spaces meeting at a point $p$. Without loss of generality, assume $A$ and $B$ span $\mathbb{P}^n$. We may choose coordinates of the form $[X : \cdots Y_i \cdots : \cdots Z_j \cdots],$ where $p = [1 : 0 :\cdots : 0]$, $A = [X : \cdots Y_i \cdots : 0 \cdots 0]$ and $B = [X : 0 \cdots 0 : \cdots Z_j \cdots]$. \begin{lemma} \label{lem:point-extension} Let $F_A, F_B$ be polynomials of degree $r$ on $A$ and $B$, such that $F_A(p) = F_B(p)$. Then there exists a polynomial $F$ on $\mathbb{P}^n$ such that $F|_A = F_A$ and $F|_B = F_B$. \end{lemma} \begin{proof} Restricting to $p$ means setting all $Y_i$ and $Z_j$ to $0$, so $F_A(p) = F_B(p)$ means the coefficient $c$ of $X^r$ is the same for both. Then put \[F(X, Y, Z) = c X^r + (F_A(X, Y, 0) - c X^r) + (F_B(X, 0, Z) - c X^r),\] where by $Y$ and $Z$ we mean the corresponding tuples of variables $Y_i$ and $Z_j$. Setting all $Z_j = 0$ recovers $F_A$ and setting all $Y_i = 0$ recovers $F_B$. \end{proof} Now let $\Gamma \subset A \cup B$ be a finite set. Let $\Gamma_A = (\Gamma \cap A) \setminus \{p\}$ and $\Gamma_B = (\Gamma \cap B) \setminus \{p\}$. \begin{lemma} \label{lem:union-of-two-at-point} Suppose $\Gamma$ satisfies ${\mathrm{CB}}(r)$. \begin{itemize} \item[1.] At least one of $\Gamma_A$ and $\Gamma_A \cup \{p\}$ is ${\mathrm{CB}}(r)$. \item[2.] If $p \notin \Gamma$, at least one of $\Gamma_A$ and $\Gamma_B \cup \{p\}$ is ${\mathrm{CB}}(r)$. \item[3.] If $p \in \Gamma$, at least one of $\Gamma_A \cup \{p\}$ and $\Gamma_B \cup \{p\}$ is ${\mathrm{CB}}(r)$. \end{itemize} Note that we may exchange $A$ and $B$ in statements 1 and 2. \end{lemma} Statement (1) is the most important as it guarantees information about the points on $A$ (and, analogously, the points on $B$). We can visualize the other relationships according to a graph: \begin{center} \begin{tabular}{ccc} \xymatrix{ \Gamma_A \ar@{-}[r] \ar@{-}[dr] & \Gamma_A \cup \{p\} \ar@{-}[dl] \\ \Gamma_B \ar@{-}[r] & \Gamma_B \cup \{p\} \\ } && \xymatrix{ \Gamma_A \ar@{-}[r] & \Gamma_A \cup \{p\} \ar@{-}[d] \\ \Gamma_B \ar@{-}[r] & \Gamma_B \cup \{p\} \\ } \\ $(p \notin \Gamma)$ && $(p \in \Gamma)$ \end{tabular} \end{center} Each edge indicates ``at least one of these two sets must be ${\mathrm{CB}}(r)$''. \begin{proof} We repeatedly use the following observation: \begin{itemize} \item[$(*)$] Suppose $F_A$ is a polynomial of degree $r$ vanishing at $p$ and at all but one point of $\Gamma_A$. Then extending by $F_B = 0$ via Lemma \ref{lem:point-extension} contradicts $\Gamma$ being ${\mathrm{CB}}(r)$. Thus no such $F_A$ exists. \end{itemize} Effectively, $(*)$ says $\Gamma_A \cup \{p\}$ is ``almost ${\mathrm{CB}}(r)$'': the only degree $r$ polynomials that can leave out a point of $\Gamma_A \cup \{p\}$ are those leaving out $p$ (and therefore vanishing at all of $\Gamma_A$). \medskip 1. Suppose $\Gamma_A$ is not ${\mathrm{CB}}(r)$. Then there exists $F_A$ leaving out one point $a \in \Gamma_A$. By observation $(*)$, $F_A(p) \ne 0$. Suppose further that $\Gamma_A \cup \{p\}$ is not ${\mathrm{CB}}(r)$. Then there exists $\tilde F_A$ leaving out one point of $\Gamma_A \cup \{p\}$. Again, $(*)$ implies $\tilde F_A(p) \ne 0$, and so $\tilde F_A$ vanishes on all of $\Gamma_A$. But then a suitable linear combination of $F_A$ and $\tilde F_A$ vanishes on $\Gamma_A \setminus \{a\}$ (since both $F_A$ and $\tilde F_A$ do) and at $\{p\}$ (by choice of combination) and does not vanish at $\{a\}$ (since $F_A$ does not and $\tilde F_A$ does). This contradicts $(*)$. \medskip 2. Suppose $\Gamma_A$ is not ${\mathrm{CB}}(r)$ and let $F_A$ leave out $a \in \Gamma_A$. By observation $(*)$, $F_A(p) \ne 0$. Suppose $\Gamma_B \cup \{p\}$ is also not ${\mathrm{CB}}(r)$ and let $F_B$ be a polynomial vanishing at all but one point of $\Gamma_B \cup \{p\}$. By $(*)$ applied with $A$ and $B$ exchanged, $F_B$ must also leave out $p$ and vanish on all of $\Gamma_B$. By Lemma \ref{lem:point-extension}, there exists a global polynomial $F$ on $\mathbb{P}^n$ extending $F_A$ and $F_B$ (up to scalar). Since $p \notin \Gamma$, this contradicts $\Gamma$ being ${\mathrm{CB}}(r)$. \medskip 3. Suppose there exist $F_A$ and $F_B$ leaving out points of $\Gamma_A \cup \{p\}$ and $\Gamma_B \cup \{p\}$, respectively. By $(*)$, the left-out point must be $p$ in both cases. By Lemma \ref{lem:point-extension}, $F_A$ and $F_B$ extend to a global polynomial on $\mathbb{P}^n$ vanishing on $\Gamma_A \cup \Gamma_B$. Since $p \in \Gamma$, this contradicts $\Gamma$ being ${\mathrm{CB}}(r)$. \end{proof} \begin{proposition}\label{planes meeting at a point} Suppose the Conjecture holds up to $d-1$ for fixed $r$. Let $|\Gamma| \leq (d+1)r+1$. Let $A, B \subseteq \mathbb{P}^n$ be positive-dimensional linear spaces meeting at a point $p$. Suppose $\Gamma \subset A \cup B$ and $(\Gamma \cap A) \setminus \{p\}$ and $(\Gamma \cap B) \setminus \{p\}$ are nonempty. Then $\Gamma$ lies on a plane configuration of dimension $d$. \end{proposition} \begin{proof} Let $p, \Gamma_A, \Gamma_B$ be as above. By counting, either $|\Gamma_A| \leq dr$ or $|\Gamma_B| \leq dr$. Without loss of generality, assume the first inequality holds. Let $S$ be whichever of the sets $\Gamma_A$ or $\Gamma_A \cup \{p\}$ is ${\mathrm{CB}}(r)$, according to Lemma \ref{lem:union-of-two-at-point}(1). Let $d_1$ be minimal such that $S$ lies on a plane configuration of dimension $d_1$. Then $|S| \leq dr+1$, so the earlier cases of the conjecture imply $1 \leq d_1 \leq d-1$. By minimality of $d_1$, it follows $|S| \geq d_1r + 2$. Then since $|\Gamma_B| + |S| \leq |\Gamma|$, \[|\Gamma_B| + 1 \leq |\Gamma| - |S| + 1 \leq (d-d_1+1)r,\] so whichever of the sets $\Gamma_B$ or $\Gamma_B \cup \{p\}$ satisfies ${\mathrm{CB}}(r)$ lies on a plane configuration of dimension $d-d_1$. So we are done if the two plane configurations we have constructed cover $\Gamma$. The remaining case is where $p \in \Gamma$ but is not included in either configuration. That is, $\Gamma_A$ and $\Gamma_B$ are both ${\mathrm{CB}}(r)$, but neither $\Gamma_A \cup \{p\}$ nor $\Gamma_B \cup \{p\}$ are ${\mathrm{CB}}(r)$. This contradicts Lemma \ref{lem:union-of-two-at-point}(3). \end{proof} \subsection{Bounding the length of the configuration} The main use of the following proposition is to prove Corollary \ref{cor:d-lines-bound}, which gives conditions on $r$ and $d$ under which $\Gamma$ lies on a plane configuration of maximal length, i.e. $d$ disjoint lines. \begin{proposition} \label{prop:balancing} Suppose $\Gamma$ is ${\mathrm{CB}}(r)$ and is contained in a skew plane configuration $\mathcal{P} = \bigcup P_i$, with $\Gamma \cap P_i$ nonempty for all $i$. Then one of the following holds: \begin{itemize} \item[(i)] Each plane $P_i$ contains at least $\max(\ell(\mathcal{P}), r+2)$ points of $\Gamma$, or \item[(ii)] Some plane $P_i$ contains fewer than $\ell(\mathcal{P})$ points, and also $\ell(\mathcal{P}) \geq r+2$. \end{itemize} \end{proposition} \begin{proof} Let $i$ be such that $\gamma_i = \#(\Gamma \cap P_i)$ is of minimal cardinality. Fix $x \in \Gamma \cap P_i$. We construct a collection of hyperplanes covering $\Gamma \setminus \{x\}$ as follows. Observe that, given $j \ne i$ and a point $x' \in \Gamma \cap P_i \setminus \{x\}$, the plane $P' = \mathrm{span}(P_j, x')$ intersects $P_i$ only in $x'$, by the skewness assumption. We may extend it to a hyperplane $H'$ containing no additional points of $\Gamma \cap P_i$. We first choose $\min(\gamma_i - 1, \ell(\mathcal{P}) - 1)$ hyperplanes $H'$ according to this observation, taking a different $j$ and a different $x' \in \Gamma \cap P_i \setminus \{x\}$ each time. Suppose $\gamma_i \geq \ell(P)$. Then for each remaining point of $\Gamma \cap P_i \setminus \{x\}$, we take a hyperplane $H''$ containing that point and no other points of $\Gamma$, giving $\gamma_i - 1$ hyperplanes in all. The union of all these hyperplanes misses exactly the point $x \in \Gamma$. Since $\Gamma$ is ${\mathrm{CB}}(r)$, we see that $r < \gamma_i - 1$. By minimality of $\gamma_i$, we conclude that each plane in $\mathcal{P}$ contains at least $\max(r+2, \ell(\mathcal{P}))$ points. This gives case (i). Suppose instead $\gamma_i < \ell(P)$. Then we instead extend the remaining $P_j$'s to hyperplanes $H''$ not containing $x$, giving a total of $\ell(\mathcal{P})-1$ hyperplanes covering $\Gamma \setminus \{x\}$. Then $r < \ell(\mathcal{P}) - 1$. This gives case (ii). \end{proof} \begin{corollary} \label{cor:d-lines-bound} Let $\Gamma \subseteq \mathbb{P}^n$ be ${\mathrm{CB}}(r)$ and $|\Gamma| \leq (d+1)r+1$. Suppose the Conjecture holds, so $\Gamma$ lies on a plane configuration $\mathcal{P} = \bigcup P_i$ of dimension $d$, with $\Gamma \cap P_i$ nonempty for all $i$. By summing any intersecting planes of $\mathcal{P}$, assume $\mathcal{P}$ is skew. Suppose $1 \leq \frac{r}{d-1} \leq 2$. Then the length of $\mathcal{P}$ is at most $d-1$. \end{corollary} \begin{proof} Suppose instead that $\ell(\mathcal{P}) = d$, that is, $\Gamma$ lies on $d$ skew lines. We are not in case (ii) of Proposition \ref{prop:balancing} since $d < r+2$. But then we must be in case (i), so each line contains at least $r+2$ points of $\Gamma$. This gives $|\Gamma| \geq d(r+2)$. Combining with $|\Gamma| \leq (d+1)r+1$, we see that $r \geq 2d-1$, a contradiction. \end{proof} \section{Proof of main theorem} \label{sec:proof-main} In this section, we prove Theorem \ref{thm:main}. Throughout, $\Gamma \subseteq \mathbb{P}^n$ denotes a finite set satisfying ${\mathrm{CB}}(r)$, and such that $|\Gamma| \leq (d+1)r+1.$ We wish to show that $\Gamma$ lies on a plane configuration $\mathcal{P}$ of dimension $d$ and with length $\ell(\mathcal{P})$ bounded as in the statement of the theorem. Note that the case $r=0$ is obvious and the case $d=0$ is precisely Proposition \ref{prop:min-count}. \begin{remark}[Setup] \label{rmk:setup} Most of the proofs below begin with the following setup and notation. We let $\alpha \geq d+1$ be the maximum number of points of $\Gamma$ lying on a $d$-plane. Let $A$ be such a $d$-plane and let $\Gamma_A = \Gamma \cap A$. We denote the complementary set of points as $\Gamma_B := \Gamma \setminus \Gamma_A$, we let $\beta = |\Gamma_B|$ and we let $B$ be the linear span of $\Gamma_B$. We may assume $\beta > 0$ since otherwise $\Gamma$ lies on $A$. \qed \end{remark} \subsection{Fixed $r$, varying $d$} The case $r=1$ holds essentially by definition: \begin{proposition}\label{r=1} If $\Gamma$ is ${\mathrm{CB}}(1)$ and $|\Gamma| \leq d+2$, then $\Gamma$ lies on a $d$-plane. \end{proposition} \begin{proof} If the first $d+1$ points don't span a $d$-plane, add the last point and we're done. If they \emph{do} span a $d$-plane, that plane contains the last point by ${\mathrm{CB}}(1)$. \end{proof} \begin{remark}For $r=1$ and $d > 1$, the weaker conclusion ``$\Gamma$ lies on a $d$-dimensional plane configuration (of arbitrary length)'' is vacuous and does not require ${\mathrm{CB}}(1)$ at all: any $d+2$ points trivially lie on a $(d{-}1)$-plane and a line -- indeed they lie on $\lceil \tfrac{1}{2}(d+2) \rceil$ lines. \end{remark} We next consider the case $r=2$. This is the final case in which the plane configuration always has length $1$. \begin{proposition}\label{r=2} If $\Gamma$ is ${\mathrm{CB}}(2)$ and $|\Gamma| \leq 2d+3$, then $\Gamma$ lies on a $d$-plane. \end{proposition} \begin{proof} Let $\alpha, \Gamma_A, A, \beta, \Gamma_B, B$ be as in Remark \ref{rmk:setup}. For contradiction, assume $\beta > 0$. We reduce to the case where any $d+1$ points $\Gamma' \subseteq \Gamma_A$ lie on a $(d-1)$-plane. To see this, consider such a subset $\Gamma'$ and extend $B$ by the other $\alpha-d-1$ points of $\Gamma_A$. By excision $\Gamma_B$ is ${\mathrm{CB}}(1)$, so $\dim(B) \leq \beta-2$, so the resulting plane $P$ has dimension at most \[(\beta-2) + (\alpha-d-1) \leq d.\] If $\Gamma' \subset P$, then $\Gamma \subset P$ and the proof is complete. Otherwise, $\Gamma \setminus P = \Gamma' \setminus P$ is ${\mathrm{CB}}(1)$ by excision and so lies on a $(|\Gamma'\setminus P|-2)$-plane. Returning the points of $\Gamma' \cap P$ to the set, we see $\Gamma'$ spans a plane of dimension at most $|\Gamma'|-2 = d-1$, as desired. Now, by maximality, $\Gamma_A$ must span the $d$-plane $A$. But then $\Gamma_A$ contains $d+1$ linearly independent points. This is a contradiction, so $\beta = 0$. \end{proof} Notice that as soon as $r\geq 3,$ we can no longer conclude that $\Gamma$ lies on a plane configuration of length one, as we see in the following example. \begin{example} Let $\Gamma$ be a set of $10 = (2+1)3+1$ points on two skew lines, five points on each line. Then $\Gamma$ satisfies ${\mathrm{CB}}(3)$ by B\'{e}zout, but the only plane configuration of dimension two that $\Gamma$ lies on has length two. \end{example} See Example \ref{ex:d-lines} for a generalization to $d$ skew lines, for sufficiently large $r$. \subsection{Fixed $d$, varying $r$} We prove the cases $d=1, 2, 3$. The case $d=1$ is known. We give a short proof using our approach. \begin{theorem}[Case $d=1$; see \cite{BCD}]\label{thm:d=1} If $\Gamma$ is ${\mathrm{CB}}(r)$ and $|\Gamma| \leq 2r+1$, then $\Gamma$ lies on a line. \end{theorem} \begin{proof} Let $\alpha, \Gamma_A, A$ and $\beta, \Gamma_B, B$ be as in Remark \ref{rmk:setup}. Assume for contradiction that $\beta > 0$. By excision, $\Gamma_B$ is ${\mathrm{CB}}(r-1)$ and, by counting, $\beta \leq 2(r-1)+1$ (since $\alpha \geq 2$). By induction on $r$, $\Gamma_B$ lies on a line. By Proposition \ref{prop:min-count}, we have $(r-1)+2 \leq \beta$. By maximality of $\alpha$ we have $\beta \leq \alpha$, which gives $|\Gamma| \geq 2r+2$, a contradiction. \end{proof} \begin{theorem}[Case $d=2$]\label{thm:d=2} If $\Gamma$ is ${\mathrm{CB}}(r)$ and $|\Gamma| \leq 3r+1$, then $\Gamma$ lies on a 2-plane or two skew lines. \end{theorem} \begin{proof} We have established the cases $r=1$ and $r=2$, so we assume $r \geq 3$ and use induction on $r$. Let $\alpha, \Gamma_A, A$ and $\beta, \Gamma_B, B$ be as in Remark \ref{rmk:setup}. We may assume that $\beta > 0$. We have $\alpha \geq d+1 = 3$, and so \[\beta = |\Gamma| - \alpha \leq (3r+1) - 3 = 3(r-1)+1.\] By excision, $\Gamma_B$ is ${\mathrm{CB}}(r-1)$, so by induction, $\Gamma_B$ lies on a $2$-plane or on two skew lines. In fact, we will show that it lies on a line. We consider both cases. \vspace{.2cm} \textit{Case 1}: $\Gamma_B$ lies on a $2$-plane. By maximality of $\alpha$ and the fact $r \geq 3$, we have \[\beta \leq \tfrac{1}{2}|\Gamma| = \tfrac{3}{2}r + \tfrac{1}{2} \leq 2(r-1)+1.\] Since $\Gamma_B$ is ${\mathrm{CB}}(r-1)$, it lies on a line by Theorem \ref{thm:d=1}. \vspace{0.2cm} \textit{Case 2}: $\Gamma_B$ lies on two skew lines. Suppose each line contains at least one point of $\Gamma_B$. Since $\Gamma_B = \Gamma \setminus A$, $\Gamma_B$ is ${\mathrm{CB}}(r-1)$ by excision. Since the two lines are skew, the points of $\Gamma_B$ on each individual line are ${\mathrm{CB}}(r-1)$ by Lemma \ref{lem:disjoint-planes}. Therefore each line contains at least $r+1$ points by Lemma \ref{prop:min-count}. One line together with one point from the other line span a $2$-plane, so by maximality of $\alpha$, $\alpha \geq r+2$. Adding these up, we obtain $\alpha + \beta \geq 3r+4$, a contradiction. We now finish the proof. If $A$ and $B$ are disjoint, then $\Gamma$ lies on plane configuration of dimension $2$ by Proposition \ref{prop:disjoint planes case}. If $A$ and $B$ meet a point, the same conclusion follows from Proposition \ref{planes meeting at a point}. Otherwise, $A \supseteq B$ and $\Gamma$ lies on $A$ itself. \qedhere \end{proof} \begin{theorem}[Case $d=3$]\label{d=3} If $\Gamma$ is ${\mathrm{CB}}(r)$ and $|\Gamma| \leq 4r+1$, then $\Gamma$ lies on a plane configuration $\mathcal{P}$ of dimension $3$. \end{theorem} Note that if $r \leq 4$, then we may further conclude $\ell(\mathcal{P}) \leq 2$ by Corollary \ref{cor:d-lines-bound}. \begin{proof} The statement holds for $r=1$ and 2 by Propositions \ref{r=1} and \ref{r=2}. We can thus assume $r \geq 3$ and show the statement holds in general by induction on $r$. Let $\alpha, \Gamma_A, A$ and $\beta, \Gamma_B, B$ be as in Remark \ref{rmk:setup}. We may assume $\beta > 0$. We have $\Gamma_B = \Gamma \setminus A$, so by excision $\Gamma_B$ is ${\mathrm{CB}}(r-1)$. So, by the basic lower bound (Proposition \ref{prop:min-count}), $\beta \geq r+1$. On the other hand, \[\beta \leq |\Gamma| - \alpha \leq 4(r-1)+1\] so by induction, $\Gamma_B$ lies on a plane configuration of dimension $3$. We consider the possibilities below; in fact we will reduce to the case where $\Gamma_B$ lies on a single line. \vspace{.2cm} \textit{Case 1:} $\Gamma_B$ lies on 3 disjoint lines. If $\Gamma_B$ lies on just two lines, then it lies in a 3-plane, which is covered by Case 3. Thus, assume it lies in three disjoint lines but not in a 3-plane. We obtain a contradiction as follows. Choose two of the lines whose union contains at least $\tfrac{2}{3}\beta$ points of $\Gamma_B$. The span of those lines is a 3-plane, so by maximality of $\alpha$, $\tfrac{2}{3}\beta \leq \alpha$. We calculate \[\tfrac{2}{3}\beta + \beta \leq \alpha + \beta \leq 4r+1\] and so $\beta \leq (12r+3)/5.$ If $r \geq 5,$ this gives $$\beta \leq 3(r-1)+ 1,$$ so by Theorem \ref{thm:d=2}, $\Gamma_B$ lies on a dimension 2 plane configuration, which means it must lie on a 3-plane, contradicting our assumption. If $r=3$, then by the above inequality, $$\beta \leq (12r+3)/5 = 39/5.$$ So $\beta \leq 7,$ which means at least one of the three lines contains $\leq 2$ points of $\Gamma_B.$ The other two lines span a 3-plane, which means the leftover $\leq 2$ points are ${\mathrm{CB}}(1)$, a contradiction. An analogous argument shows that if $r=4$, one of the lines has $\leq 3$ points, and whichever of those are not in the span of the other two lines must be ${\mathrm{CB}}(2)$, a contradiction. This finishes Case 1. \vspace{.2cm} \textit{Case 2:} $\Gamma_B$ lies on the union of a line and a 2-plane. Again, we assume $\Gamma_B$ does not lie on a $3$-plane. So, the plane and line must be disjoint. Therefore, the subsets of $\Gamma_B$ on the plane and the line each satisfy ${\mathrm{CB}}(r-1)$ by Lemma \ref{lem:disjoint-planes}. Thus there are $\geq 2(r-1)+2 =2r$ points of $\Gamma_B$ on the 2-plane and $\geq r-1+2 =r+1$ on the line, which gives $\beta \geq 3r+1$. The span of one point of $\Gamma_B$ on the line along with the 2-plane is a 3-plane, which by hypothesis implies that $\alpha \geq 2r+1,$ and in turn $|\Gamma| \geq 5r+2,$ a contradiction. This leaves one final case. \vspace{.2cm} \textit{Case 3:} $\Gamma_B$ lies on a 3-plane. By maximality of $\alpha$, we have $\beta \leq \alpha$, so since $\beta + \alpha = |\Gamma| = 4r+1$, we obtain $\beta \leq 2r + \tfrac{1}{2}$, hence $\beta \leq 2r$. We split this up into two cases. \vspace{.2cm} \textit{Case 3a:} $\beta = 2r.$ Then $\alpha = 2r$ or $\alpha = 2r+1$. Since $r>2,$ we have $2r < 3r-2 =3(r-1)+1,$ which by Proposition \ref{thm:d=2} implies that the $\beta = 2r$ points of $\Gamma_B$ lie on a 2-plane or two skew lines. If two lines, the set of points of $\Gamma_B$ on each line are ${\mathrm{CB}}(r-1)$, so each line must contain at least $(r-1)+2$ points of $\Gamma_B$, a contradiction. Thus, in this case, $\Gamma_B$ lies on a 2-plane $B$. But then for any point $a \in \Gamma_A$, the $3$-plane $\mathrm{span}(B, \{a\})$ contains exactly the $2r+1$ points $\Gamma_B \cup \{a\}$, otherwise contradicting the maximality of $\alpha$. Thus, by excision, \[\Gamma \setminus \mathrm{span}(B, \{a\}) = \Gamma_A \setminus \{a\}\] is ${\mathrm{CB}}(r-1)$ and has exactly $2r$ points. By the same argument as used for $B$ above, $\Gamma_A \setminus \{a\}$ must lie on a 2-plane. Since $a$ was chosen arbitrarily, and $\alpha > 4$, all of $\Gamma_A$ must lie on a 2-plane, a contradiction, which completes this case. \vspace{.2cm} \textit{Case 3b:} $\beta \leq 2r-1.$ Since $2r-1 = 2(r-1)+1$, we deduce that $\Gamma_B$ lies on a line by Theorem \ref{thm:d=1}, that is, $B = \mathrm{span}(\Gamma_B)$ is a line. The desired statement now follows by Proposition \ref{prop:disjoint planes case} (if $A$ and $B$ are disjoint), by Proposition \ref{planes meeting at a point} (if $A$ and $B$ meet at a point) or directly (if $A \supset B$). \qedhere \end{proof} \subsection{The case $d=4, r=3$} Having established Conjecture \ref{conj:main} for $d \leq 3$ and for $r \leq 2$, we consider the next case not covered, namely $d=4$, $r=3$. Our argument uses Propositions \ref{planes meeting at a point} and \ref{prop:disjoint planes case} to handle nearly all cases. We give an ad hoc argument for the remaining case, in which $\Gamma$ lies on two hyperplanes meeting along a line. \begin{theorem}[Case $d=4$, $r=3$] Let $d=4$, let $\Gamma$ be ${\mathrm{CB}}(3)$ and suppose $|\Gamma| \leq (d+1)r+1 = 16$. Then $\Gamma$ lies on a plane configuration of dimension $4$. \end{theorem} \begin{proof} We may assume $|\Gamma| \geq 14$; otherwise we are done by the case $r=3, d=3$. Let $\alpha, \Gamma_A, A$ and $\beta, \Gamma_B, B$ be as in Remark \ref{rmk:setup}. We assume $\beta > 0$, so in particular $\Gamma_B$ is ${\mathrm{CB}}(2)$, $\beta \geq 4$ and $\alpha \leq 12$. Most cases are handled as follows. First, if $\dim B = 1$, we are done by Proposition \ref{prop:disjoint planes case} if $A \cap B$ is empty and by Proposition \ref{planes meeting at a point} if $A \cap B$ is a point. Since $\Gamma_B$ is ${\mathrm{CB}}(2)$, we may in particular assume $\beta \geq 6$, and we also have $\dim(B) \leq \lceil \tfrac{\beta-3}{2} \rceil$. Second, we may extend $B$ to a $\mathbb{P}^4$ by adding points. So, by maximality of $\alpha$, we get \[\beta + 4 - \lceil \tfrac{\beta-3}{2} \rceil \leq \beta + (4 - \dim(B)) \leq \alpha.\] By numerical consideration of $\alpha$ and $\beta$, this covers nearly every case. The remaining ones are below; we also assume $\dim(B) \geq 2$ and $\dim(A \cap B) \geq 1$. {$\mathbf{ (\alpha, \beta) = (8, 6) \text{ or } (9, 7):}$} By ${\mathrm{CB}}(2)$, $\dim(B) = 2$. We must have $\Gamma \cap A \cap B$ empty or we contradict the maximality of $\alpha$ by extending $\Gamma_B$ by two points. Therefore we can write $\Gamma_A = \Gamma \setminus B$, so $\Gamma_A$ is ${\mathrm{CB}}(2)$ by excision. Then since $|\Gamma_A| \leq 9$, $\Gamma_A$ lies on a $\mathbb{P}^3$ by the case $r=2, d=3$ of the conjecture (Proposition 5.4). This contradicts the choice of $A$. {$\mathbf{(\alpha, \beta) = (9, 6) \text{ or } (10, 6):}$} By ${\mathrm{CB}}(2)$ and the discussion above, $\dim B = 2$ and $A \cap B$ is a line $L$. By construction (as in Remark \ref{rmk:setup}), any points of $\Gamma$ lying on $L$ have been counted among the $\alpha$ points of $\Gamma_A$. Suppose $\Gamma \cap L$ is nonempty. Then $|\Gamma \setminus B| \leq 9$, hence by ${\mathrm{CB}}(2)$ lies on a $3$-plane $A' \subset A$. Then $A'$ intersects $L$ in at least a point, and does not contain $L$ since $\Gamma_A$ does not lie on a $\mathbb{P}^3$. Thus $A'$ and $B$ cover $\Gamma$ and intersect in a point, so we are done by Lemma \ref{planes meeting at a point}. Suppose $\Gamma \cap L$ is empty. We are done as above if $\alpha=9$. For $\alpha=10$, we consider all $2$-planes $A'$ such that $L \subset A' \subset A$ and $A'$ contains at least one point of $\Gamma_A$. Then the set $\Gamma \setminus \mathrm{span}(A', B)$ is ${\mathrm{CB}}(2)$, hence this set lies on some plane $C \cong \mathbb{P}^3$ (since $\alpha-1 \leq 9$). Since $\Gamma_A$ does not lie on a $\mathbb{P}^3$, we must have $C \not\supset \Gamma \cap A'$ (this containment would imply $C \supset \Gamma_A$). So, by ${\mathrm{CB}}(1)$ (excising $B$ and $C$), $\Gamma \cap A'$ contains at least 3 points. Since this is true for any choice of $A'$, combining $B$ with two such choices yields a $\mathbb{P}^4$ containing at least $\beta+3+3 > \alpha$ points, a contradiction. \end{proof} Finally, to check that the plane configuration $\mathcal{P}$ can be taken to have length $\ell(\mathcal{P}) \leq 2$: we have $\ell(\mathcal{P}) \leq 3$ by Corollary \ref{cor:d-lines-bound}. Similar considerations show that the case $\ell(\mathcal{P}) = 3$ (i.e., two lines and a $2$-plane) does not arise. \section{Codimension two complete intersections} \label{sec:codim-2-ci} In this section, we give proofs of Proposition \ref{codim2prop} and Theorem \ref{codim2thm}, which quickly follow from the main theorem and conjecture. \begin{proof}[Proof of Proposition \ref{codim2prop}] Recall that $X \subset \P^{n+2}$ is a complete intersection of hypersurfaces $Y_a$ and $Y_b$ of degrees $a$ and $b$, respectively. For part (a), let $f: X \dashrightarrow \P^n$ be a dominant rational map, and let $\Gamma \subset X$ be a general fiber of $f$. The condition of ``lying on a plane configuration of dimension $b-1$'' is closed, so it is enough to show it for $\Gamma$ to conclude it for \emph{all} fibers. The result of Bastianelli \cite[Proposition 4.2]{Bas} mentioned in the introduction implies that $\Gamma$ satisfies the Cayley--Bacharach condition with respect to $K_X = (a + b - n -3)H$, where $H$ is a hyperplane section. That is, $\Gamma$ is ${\mathrm{CB}}(a + b - n -3)$. We claim: $$|\Gamma| \leq a(b-1) \leq ((b-1) +1)(a+b-n-3) + 1 = (d+1)r+1.$$ The first inequality is by hypothesis for (a), which requires $\deg(f)$, and thus the number of points in a general fiber, to be $\leq a(b-1)$. The second inequality is implied by the assumption $a+1 \geq b(3+n-b)$. We then apply Conjecture \ref{conj:main} to conclude that $\Gamma$ lies on a plane configuration of dimension $b-1$, which completes the proof of part (a). For part (b), we first note that the statement is trivial if $n+2 \leq b-1$ since we have $\Gamma \subseteq \mathbb{P}^{n+2}$, so we can assume that $n+2 \geq b.$ The statement is also trivial if $\dim(X) = n = 0,$ since $X$ is irreducible and thus a point. So additionally, assume $n+ 2 \geq 3.$ It suffices to show that the minimal degree of a dominant rational map $X \dashrightarrow \mathbb{P}^n$ (called the \emph{degree of irrationality of $X$} or $\mathrm{irr}(X)$) satisfies $\mathrm{irr}(X) \leq a(b-1)$. For this, we exhibit such a rational map of degree $\leq a(b-1)$. Let $F(Y_b)$ be the Fano variety of lines on $X$. It is a well-known lemma that $\dim(F(Y_b)) \geq 2(n+2)-b-3.$ In particular, as long as $2(n+2)-b-3 \geq 0$, $F(Y_b)$ is non-empty. See, for example, the beginning of \cite[Section 4]{Beh} for an explanation of this fact. This inequality is guaranteed by our assumption $n+2 \geq b$. So let $\ell \subset Y_b$ be a line, so projection from $\ell$ yields a dominant rational map \[f : X \dashrightarrow \P^n.\] Notice that either $\ell \cap X$ has length $a$ or else $\ell$ is contained in $X$. In the first case, $\deg(f) = a(b-1)$. In the second case, $\deg(f) = (a-1)(b-1)$ by the excess intersection formula. Either way, $\deg(f) \leq a(b - 1).$ This completes the proof. \end{proof} Theorem \ref{codim2thm} is a special case of Proposition \ref{codim2prop}. \begin{proof}[Proof of Theorem \ref{codim2thm}] Setting $b = 4$ and $Y_b = Y$ in Proposition \ref{codim2prop}, we obtain $d = 3$ and $r = a-n+1.$ By Theorem \ref{thm:main}, the conjecture holds in this case, and the inequality $a+1 \geq b(3+n-b)$ follows from the hypothesis $a \geq 4n-3$ (again by setting $b=4$). Thus, we can apply Proposition \ref{codim2prop}, which completes the proof. \end{proof} \section{Further considerations} \label{sec:conclusion} As stated in the introduction, an immediate question raised by our Conjecture is to determine how the length of the plane configuration relates to $r$ and $d$. \begin{question} Let $\Gamma \subset \mathbb{P}^n$ be a finite set satisfying ${\mathrm{CB}}(r)$ and such that $|\Gamma| \leq (d+1)r+1$. Assuming Conjecture \ref{conj:main} holds, what can be said about the minimum length of a plane configuration $\mathcal{P}$ containing $\Gamma$? \end{question} Our main result shows that $\ell(\mathcal{P}) \leq 2$ for small values of $r$ and $d$; it's straightforward to exhibit examples in which $\ell(\mathcal{P}) \geq 3$ for higher values of $r$ and $d$. Corollary \ref{cor:d-lines-bound} shows, at the other extreme, that the case $\ell(\mathcal{P}) = d$ occurs only outside the range \[1 \leq \frac{r}{d-1} \leq 2.\] It would be interesting to generalize this result to a bound on $\ell(\mathcal{P})$ dependent on $\tfrac{r}{d-1}$ or similar data. \subsection{The Cayley--Bacharach locus of the Hilbert scheme} Let $\mathcal{H} = \mathrm{Hilb}(\mathbb{P}^n, m)$ be the Hilbert scheme of $m$ points in $\mathbb{P}^n$. The Cayley--Bacharach condition gives a locally-closed subset $\mathcal{CB}(r) \subset \mathcal{H}$ corresponding to $m$-tuples of distinct points satisfying ${\mathrm{CB}}(r)$. \begin{problem} Understand the geometry of $\mathcal{CB}(r)$ and its closure in $\mathcal{H}$, in particular its dimension, smooth locus, irreducible components and general points. \end{problem} We also observe that the conclusion of Conjecture \ref{conj:main}, of being contained in a plane configuration, is a \emph{closed} condition, hence applies to $\overline{\mathcal{CB}(r)}$ if it applies to $\mathcal{CB}(r)$. Both loci $\mathcal{CB}(r)$ and $\overline{\mathcal{CB}(r)}$ can be further decomposed into closed subsets according to the combinatorial type of the plane configuration, \[ \mathcal{CB}(r) = \bigcup_{\ell, \vec{d}} \mathcal{CB}(r)_{\ell, \vec{d}}, \qquad \overline{\mathcal{CB}(r)} = \bigcup_{\ell, \vec{d}} \overline{\mathcal{CB}(r)}_{\ell, \vec{d}} \] where $\ell$ denotes the length, $\vec{d} = (d_1, \ldots, d_\ell)$ the tuple of dimensions and the resulting loci parametrize those $\Gamma$ for which there exists a plane configuration $\mathcal{P}$ of the specified type, containing $\Gamma$. \begin{problem} Determine for which combinatorial types the corresponding subsets $\mathcal{CB}(r)_{\ell, \vec{d}}$ and $\overline{\mathcal{CB}(r)}_{\ell, \vec{d}}$ are nonempty, and determine their dimensions and geometry. \end{problem} There is also a natural analog of the Cayley--Bacharach condition for a subscheme $\xi \subseteq \mathbb{P}^n$ of finite length $m$: we may say $\xi$ is ${\mathrm{CB}}(r)$ if, whenever a homogeneous degree $r$ polynomial $F$ vanishes on a closed subscheme $\xi' \subseteq \xi$ of length $m-1$, then $F$ vanishes on $\xi$. This condition is again only \emph{locally} closed and gives another locus $\mathcal{CB}'(r)$ containing $\mathcal{CB}(r)$. \begin{question} Which ${\mathrm{CB}}(r)$ subschemes can be smoothed to \emph{reduced} ${\mathrm{CB}}(r)$ subschemes? That is, what is $\mathcal{CB}'(r) \cap \overline{\mathcal{CB}(r)}$? \end{question} \subsection{Matroids} Conjecture \ref{conj:main} and several of our arguments are highly suggestive of the theory of matroids and matroid varieties \cite{GGMS}. It would be interesting to understand this connection. Variants of the classical Cayley--Bacharach theorem have also recently arisen in studying ideals of matroid varieties via the Grassmann--Cayley algebra \cite{STW}. A basic question is as follows: \begin{question} Which matroids arise from sets of points $\Gamma \subseteq \mathbb{P}^n$ satisfying the assumptions of Conjecture \ref{conj:main}? \end{question} We may also approach the Cayley--Bacharach condition itself in purely matroidal terms. We say that a matroid $M$ satisfies the {\bf matroid Cayley--Bacharach} condition ${\mathrm{MCB}}(r)$ if, whenever a union of $r$ flats contains all but one point of $M$, the union contains the last point. (For a representable matroid, this is equivalent to restricting the geometric Cayley--Bacharach condition to fully reducible hypersurfaces.) \begin{question} Does the analog of Conjecture \ref{conj:main} hold for matroids $M$ satisfying ${\mathrm{MCB}}(r)$? That is, must $M$ be covered by a union of flats of specified dimensions? \end{question} Some of the arguments of this paper are effectively entirely matroid-theoretic and give positive answers to this question in small cases. The arguments that are not matroidal (notably Lemma \ref{lem:union-of-two-at-point}) can sometimes be replaced, at least for low values of $d$ and $r$, by substantially longer matroidal arguments. \subsection{Curves} Finally, we revisit the question of describing when $\Gamma$ lies on a union of curves of specified degree and arithmetic genus. As shown in \cite{SU}, if $\Gamma$ is ${\mathrm{CB}}(r)$ and $|\Gamma| \leq \tfrac{5}{2}r+1$, then $\Gamma$ lies on a curve, possibly reducible, of degree at most $2$. These considerations are closely related to $\Gamma$ not imposing independent conditions on degree $r$ polynomials, a weaker condition than ${\mathrm{CB}}(r)$. For example, Castelnuovo \cite{Cas} gave conditions under which, if a finite set $\Gamma$ fails to impose independent conditions on quadrics, then it lies on a rational normal curve. \begin{question} \label{q:curves} Let $c > 0$ be a positive real number. Let $\Gamma \subseteq \mathbb{P}^n$ be a finite set of points satisfying ${\mathrm{CB}}(r)$ and such that $|\Gamma| \leq cr+1$. What is the minimum $d$ such that every such $\Gamma$ lies on a (possibly reducible) curve of degree $d$? What is the arithmetic genus of such a curve? \end{question} Thus the result in \cite{SU} is that for $c = \tfrac{5}{2}$, the minimum degree is $2$ and the curve has genus $0$. If it could be shown that for $c=d+1$, $\Gamma$ lies on a degree-$d$ curve, this would imply Conjecture \ref{conj:main} as such a curve lies on a plane configuration of dimension $d$. Unfortunately, this is false: for $r=d=2$, $7$ general points on a $2$-plane satisfy ${\mathrm{CB}}(2)$, but do not lie on a conic or a union of two lines. For $r=2$, $d=3$, Example \ref{ex:elliptic-curve} of nine general points on a quartic elliptic curve $E \subset \mathbb{P}^3$ is similar: $E$ itself, of degree $4$ and genus $1$, is a minimal degree curve containing $\Gamma$. This question can be formulated more generally: it would be interesting to know when $\Gamma$ lies on special surfaces or varieties of higher dimension, on special plane configurations, and so on. \begin{question} With $c$ and $\Gamma$ as in Question \ref{q:curves}, what can be said about the geometry of $\Gamma$? \end{question} \bibliographystyle{amsalpha}
\section{Introduction} \subsection{Challenges TableLab Addresses} Recently, there has been increasing interest in extracting complex structures such as tables from PDF and image documents~\cite{burdick2020table}. Table extraction involves identifying the border and the cell structure for each document table such that it can be displayed in a structured format like HTML. The motivation for TableLab came from requests from industry professionals for the ability to easily create ground truth data and customize models for extracting tables for their specific document collections. TableLab accomplishes this by addressing the following table extraction challenges. First, there is great diversity of table formatting across different documents types and sources. Tables from invoices are formatted differently than those from scientific articles or financial reports, with the visual clues across sources providing conflicting information about the table border and/or structure. Thus, creation of a single high-quality model to support table extraction from the wide diversity of document types is difficult if not impossible when considering the fact that even humans can disagree about table definitions from the same source document (see Figure.~\ref{fig:example}). Despite the diversity of table formats encountered in real-world settings, the user's needs and table extraction expectations are ultimately the most important. TableLab leverages this observation by supporting finetuning of a high-quality table extraction model trained on hundreds of thousands of tables using a small number of user labelled examples. TableLab also supports efficient labelling of tables in documents, which involves two sub-problems. First, how do we select the most useful examples for labelling which improve finetuned model accuracy the most? Second, how do we effectively label individual example tables, particularly table structure where the same error repeatedly occurs? The mechanisms TableLab uses to improve labeller efficiency are described in the overview section. \begin{figure*}[h] \centering \includegraphics[width=0.6\textwidth]{example_cropped.png} \caption{Example document with ambiguous tables. Whether the main invoice table should be one or two tables will depend on downstream tasks for the user.} \label{fig:example} \end{figure*} \subsection{Related Works} Many deep-learning solutions have been applied to the table extraction problem in recent years. Examples for table and cell region detection include~\cite{Schreiber2017DeepDeSRTDL,Li2019TableBankTB,Gilani2017TableDU} while ~\cite{Schreiber2017DeepDeSRTDL,tensmeyer2019deep, prasad2020cascadetabnet, Li2019TableBankTB, zhong2019image} address table structure extraction. However, none of these solutions are able to extract tables exactly for all documents from all domains due to the wide variety and ambiguity of the problem (See Figure~\ref{fig:example} for an example)~\cite{burdick2020table, Hoffswell2019InteractiveRO}. Additionally, labelled data is tedious to create. There are a few existing large-scale datasets for scientific papers~\cite{zhong2019image} and financial reports~\cite{zheng2020global} but many documents in business are confidential. Research into ease of labelling and active learning for tables is not as well studied as table structure extraction. Hoffswell et al. ~\cite{Hoffswell2019InteractiveRO} design a system to help users repair extracted tables with a mobile interface. However, users are unable to directly improve the extraction model with their annotations. \subsection{TableLab Design Considerations} Current table extraction systems extract tables without the option to give feedback. Since the systems do not work well on all document types, users can be frustrated by the lower quality of extractions without the ability to improve them. Our system finetunes models in an iterative fashion, collaborating with the model to quickly label and see improvements with the model. In our system, we first use deep learning models to extract table and cells to generate table structure. Using visual embeddings derived from the model, we cluster documents into templates in order to recommend specific pages to label for users that balances between ease of labelling and the most impact on the model with a large variety of styles. Thanks to this recommendation system, we minimize the size of labeled data required. As well, since our table extraction model is modular in nature, some labels for components (ex. table border) can immediately improve results in others (cell border) such that the user does not need to repair every error in the table extraction process. \section{Overview of TableLab} \begin{figure*}[h] \centering \includegraphics[width=0.8\textwidth]{system_architecture_v2.png} \caption{System architecture of TableLab. Details for each step are described in the overview section.} \label{fig:arch} \end{figure*} \subsection{Table Extraction} To begin, we apply our table extraction module (based on the GTE framework~\cite{zheng2020global}) to the user's document collection. We provide a few base model weights that have been pre-trained on different document types for users to select the one that best matches their collection. After the deep models have been applied, we input the resulting table and cell bounding boxes as well as the document text snippets (scanned and image documents are first processed with an OCR engine in order to extract the text) into our structure clustering model. This model determines the row and column assignment and the content of each cell such that it can be represented by a structured format such as HTML. \subsection{Template Clustering and Label Selection} After the deep learning models have been applied to the collection, the visual embeddings from the detection models are used to cluster the document collection into templates. After clustering, the lowest and highest confidence pages of each template is selected for user labelling. The labels for lowest confidence pages will provide the most benefit to the model while the highest confidence pages should be easy and quick to label, allowing for faster feedback. An icon for each label recommendation type is indicated beside each page in the user interface. \begin{figure*}[h] \centering \includegraphics[width=0.75\textwidth]{combined_screenshot.png}% \caption{TableLab in model selection and table editing view. The leftmost panel contains previews of each page in the input document collection with detected table boundaries, their confidence, template type as well as a yellow or red tag if they are recommended for labelling. In center, the user may view the page in the table box (and text when a textbox is selected) Overlay mode as shown or they may magnify the contents in Magnify mode. The user can interact with the boxes to change their size and location. The right panel shows the extracted table and our table editing features. We also show the additional panel where users can view their labelling progress, finetune models with labelled data, select the model used to extract tables, add additional documents and download the table annotations.} \label{fig:edit_screenshot} \end{figure*} \subsection{Interactive Labelling with Recommendations} When the initial table structure has been extracted and label recommendations determined, the user will be able to view the extracted tables and provide feedback as needed. In a typical case, the user can first adjust the table border. This prompts the system to redo the structure clustering, providing an updated extracted table. Sometimes, this results in a completely correct extraction and the user may submit the page for finetuning at this time. Otherwise, the user has full control to merge, split cells or whole columns and rows similar to manipulations in a spreadsheet program. By leveraging the layout of the text snippet positions, users can split and move cell content by text chunks rather than word by word. The user may also edit a text snippet by typing in the content and adjusting its bounding box. \subsection{Model Finetuning} When the page has the correct table extraction, the user may submit the page for model finetuning and apply the customized model to their collection for improved extraction results. If there are additional errors, the user may make additional corrections and repeat the finetuning process. For a typical collection, we find that one finetuning round is generally enough to correct the rest of the collection but this depends largely on the diversity of the collection itself. \subsection{Technical Details} TableLab is developed in React and Flask while the model (GTE) is developed with TensorFlow. The models preloaded in the demonstration were trained on PubLayNet and PubTabNet, which are large datasets from the scientific papers domain. The documents shown for detection and correction labelling are from FinTabNet, which are tables from annual reports of S\&P 500 companies. We demonstrate TableLab's ability to customize models on this new domain with tables that have different styles. \section{Concrete demo experiences} There are three main use cases with our demo. First, users can simply visualize table extraction results with TableLab. Second, AI engineers and scientists can use our tool to quickly create ground truth labels for their documents. Finally, end users can create custom models with their private document collection with our interactive TableLab system. \bibliographystyle{ACM-Reference-Format}
\section{Introduction} \label{sec:intro} At the turn of the millennium, advancements in ground-based and space-based telescopes enabled the first glimpses of Titan's surface \citep[e.g.][]{smith_titans_1996,meier_surface_2000,coustenis_images_2001,coustenis_titans_2003,griffith_evidence_2003}. The heterogeneous surface albedo was inconsistent with a global ocean, immediately prompting discussion over the fate of ethane, anticipated to be one of the most abundant products of the atmospheric photochemistry \citep{lunine_ethane_1983}. When \emph{Cassini-Huygens} arrived in the Saturn system in 2004, a slew of fundamental advances were enabled by the combined in situ and remote sensing observations over the next 13 years. Newly identified features and processes prompted new questions, many of which will remain unanswered until a return mission to Titan \citep[e.g.][]{nixon_titans_2018,rodriguez_poseidon}. In light of these revelations--that Titan is a an organic-rich, ocean world where Earth-like geological processes rework the landscape and the complex atmospheric products that fall upon it--Titan was considered a target of high importance going into the 2012-2023 Decadal Survey \citep{national_research_council_vision_2011}. Similar to the Titan Explorer study of 2007 \citep{lockwood2008titan,lorenz2008titan}, the Titan Saturn System Mission concept study (TSSM) employed a comprehensive, three-pronged approach: an orbiter, a lander (targeting the lander to the northern lakes rather than the equatorial dunes), and a montgolfiere \citep{coustenis2009joint,reh2009titan}. This particular mission architecture was ultimately not put forward as the highest priority, instead deferred to the next decade ``primarily because of the greater technical readiness of [the Europa flagship mission]". The Vision and Voyages report further noted that ``[a Titan-returning mission's] high scientific priority, however, is especially noteworthy" and thus recommended continued development of the technologies needed to support such a mission. As the 2012-2023 decade unfolded, however, new technologies, scientific revelations, and congressional inertia motivated the addition of Titan and Enceladus to the New Frontiers 4 competition. With the selection of \emph{Dragonfly}, some--but not all--of the high priority science identified by the TSSM will be addressed. Where, then, does Titan science stand now and what questions will be beyond the scope of \emph{Dragonfly}? How is the exploration of Titan's atmospheric, surface, and subsurface processes relevant to Ocean Worlds and other planets? We discuss the answers to these questions as the community enters the purview of a new decadal survey, stemming from considerations submitted as a white paper by these same authors to the 2023-2032 National Academies Planetary Science and Astrobiology Decadal Survey. \section{Titan is an Organic World} Titan hosts the most Earth-like atmosphere in the solar system. Similarities include the atmospheric structure \citep{fulchignoni_situ_2005} (Figure \ref{atmofig}), a nitrogen-dominated composition (95\% N$_2$, 4\% CH$_4$, and 1\% trace species at the surface), and a surface pressure of 1.5 bar. The photolytic destruction of atmospheric methane initiates a chain of photochemical reactions responsible for the plethora of organic species that make up the haze observed by \emph{Cassini-Huygens} and ground-based facilities \citep{marten_new_2002,gurwell_submillimeter_2004,ali_cyclopropenyl_2013,cordiner_alma_2014,cordiner_ethyl_2015,cordiner_interferometric_2018,cordier_floatability_2019,molter_alma_2016,desai_carbon_2017,lai_mapping_2017,palmer_alma_2017,teanby_origin_2018,lombardo_detection_2019,thelen_abundance_2019,thelen_measurement_2019,thelen_detection_2020,nixon_detection_2020}. While unlike present-day Earth, Titan's haze production may be similar to processes on Early Earth \citep{trainer_organic_2006,g_trainer_atmospheric_2013}. \begin{figure} \centering \includegraphics[width=0.7\textwidth]{atmosummary.png} \caption{(top) Comparison of the temperature profiles and structure of the atmospheres of Titan and Earth. Vertical bars at left show the regions probed by Cassini instruments (Ion and Neutral Mass Spectrometer, INMS; CAssini Plasma Spectrometer, CAPS; Radio and Plasma Wave Science, RPWS; UltraViolet Imaging Spectrometer, UVIS; Imaging Science Subsystem, ISS; Visual and Infrared Mapping Spectrometer, VIMS; Composite InfraRed Spectrometer, CIRS), the Huygens Gas Chromatograph Mass Spectrometer (GCMS), and the Atacama Large Millimeter/submillimeter Array (ALMA) telescope. (bottom) Similar to the cycling of water on Earth, Titan's troposphere hosts the hydrological cycle of methane between the surface and on atmosphere. Irreversible loss of methane in the thermosphere suggests that a methane replenishment mechanism is necessary.} \label{atmofig} \end{figure} \subsection{Pressing Questions and Future Investigations} \emph{Cassini} identified the compositions of neutral and positive ions up to 99 Da but could only detect the presence of negative ions with a mass-to-charge ratio so large as to be similar to that of terrestrial proteins \citep{coates_discovery_2007,waite_process_2007,wellbrock_cassini_2013,woodson_ion_2015}. These molecules grow larger during polar winter and with decreasing altitude \citep{wellbrock_heavy_2019}, but their ultimate fate remains unknown. Thus, our current list of known compounds represents only the tip of the organic factory iceberg. Ongoing modeling efforts and laboratory experiments continue to investigate what reactions might be at work \citep{rannou_coupled_2004,waite_process_2007,vuitton_ion_2007,vuitton_simulating_2019,krasnopolsky_photochemical_2009,krasnopolsky_chemical_2014,nixon_isotopic_2012,waite_model_2013,larson_simulating_2014,dobrijevic_coupling_2014,dobrijevic_1d-coupled_2016,hickson_evolution_2014,lara_time-dependent_2014,loison_neutral_2015,loison_photochemical_2019,luspay-kuti_effects_2015,wong_plutos_2015,sebree_13c_2016,barth_modeling_2017,douglas_low_2018,mukundan_model_2018,berry_chemical_2019,bourgalais_low-pressure_2019,dubois_nitrogen-containing_2019,dubois_situ_2019,dubois_positive_2020} and to explore the properties of Titan haze analogs, tholins \citep{cable_titan_2012,gautier_influence_2017,sciamma-obrien_titan_2017,horst_haze_2018,sebree_detection_2018}. However, determining the dominant chemical pathways of Titan’s organic factory will require a more complete understanding of the chemical composition, abundance, and distribution of organic hazes in the atmosphere. Observations at different seasons in Titan’s year (29.5 Earth years) are critical, as monitoring with Cassini spanned only from the middle of northern winter to the very early summer \citep[e.g.][]{teanby_seasonal_2019,vinatier_optical_2012,vinatier_temperature_2020,seignovert_haze_2021}. Global atmospheric circulation in the upper atmosphere, which shows strong zonal prograde winds rapidly changing close to the northern summer solstice, has only been investigated very recently with ALMA \citep{lellouch_intense_2019,cordiner_detection_2020}. These wind changes also propagate in the middle atmosphere, as evidenced by CIRS data in the same period \citep{vinatier_temperature_2020,sharkey_potential_2021}. Observations from an orbiter would be necessary to monitor interactions between the middle and upper atmospheric circulation as well as their potential couplings with atmospheric chemistry--all of which are currently poorly known. Beyond chemical pathways, many questions remain or have arisen from \emph{Cassini-Huygens}. How seasonal trends in condensate distributions extend to lower altitudes \citep{coates_discovery_2007,desai_carbon_2017} and whether these affect sedimentation onto the surface remains unknown. Models indicate that microphysics plays an important role in cloud and haze formation \citep{barth_modeling_2017}; increased understanding of the distribution, optical properties, and composition of hazes and clouds from observational (at Titan and ground-based) \citep{jennings_first_2012,jennings_seasonal_2012,jennings_evolution_2015,vinatier_optical_2012,seignovert_aerosols_2017,seignovert_haze_2021,le_mouelic_mapping_2018,west_seasonal_2018,anderson_organic_2018} and laboratory data \citep{anderson_spectral_2018,nna-mvondo_detailed_2019} would constrain physical models \citep[e.g.][]{loison_gas-grain_2020}. Several approaches to constrain the age of Titan’s atmosphere overlap at $\sim$300-500 Myr, but whether this indicates the age of the atmosphere or ongoing methane photolysis is unclear \citep{horst_titans_2017}. Replenishment from the interior offers a compelling solution to the methane loss, but more data are required to evaluate the likelihood of candidate mechanisms like clathrate dissociation and cryovolcanism \citep{lunine_clathrate_1987,tobie_episodic_2006,choukroun_stability_2010,choukroun_is_2012,sotin_observations_2012}. Examples of necessary data include crustal dynamics, surface feature identification, isotopic fractionation, and a high-degree gravity field. \subsection{Role in an Ocean Worlds Program} Atmospheric organic species are the ultimate source of the organic sediments that dominate Titan’s surface, so their formation and evolution in the atmosphere have important implications for surface geology and possible subsurface nutrient availability. Furthermore, investigating the processes that create complex species in Titan’s atmosphere—without, presumably, biological catalysts like those responsible for large molecules here on Earth—offers fundamental insight into the chemistry that may precede or facilitate the rise of biochemistry on Early Earth \citep{trainer_organic_2006,g_trainer_atmospheric_2013} and beyond. The study of Titan’s atmospheric chemistry therefore offers crucial context for the habitability potential of other ocean worlds where the essential elements may be less abundant. \subsection{Relevance to other planets} Questions surrounding the dynamics and longevity of Titan’s atmosphere link to questions about the gas and ice giants \citep{robinson_titan_2014,toledo_constraints_2019} and—given the coupling between the atmosphere and surface—about Earth, Venus, Mars, and Pluto \citep{mitchell_effects_2014,mandt_comparative_2015,brain_atmospheric_2016,guendelman_axisymmetric_2018,read_superrotation_2018,crismani_localized_2019,kohn_streamer_2019,faulk_titans_2020,kite_methane_2020} (Figure \ref{comparisons}). Without its own magnetic field, Titan’s interactions with the solar wind and Saturn’s magnetosphere offer the opportunity to explore whether magnetic fields are necessary for habitability. Moreover, Titan’s atmosphere serves as a powerful backyard analog for hazy exoplanets—from understanding the formation and evolution of atmospheric aerosols to how we might best detect and observe them—as we have ground truth from both remote and in situ sensing \citep{de_kok_influence_2012,forget_possible_2014,tokano_precipitation_2015,arney_pale_2016,checlair_titan-like_2016,munoz_titan_2017,he_carbon_2017,horst_haze_2018,levi_equation_2019,lora_atmospheric_2018,alvarez_navarro_effects_2019,martinez-rodriguez_exomoons_2019,miguel_observability_2019}. \begin{figure} \centering \includegraphics[width=0.9\textwidth]{comparisons_atmos.png} \caption{Titan's atmospheric density compared to that of terrestrial worlds both within and beyond \citep[e.g.][]{morley2017observing} our solar system, highlighting the potential for comparative planetology between Titan and other worlds with atmospheres.} \label{comparisons} \end{figure} \section{Titan is an Active Hydrological and Sedimentary World} Titan also has a methane-based hydrologic cycle akin to Earth’s \citep{mitchell_climate_2016,hayes_post-cassini_2018}. The seasonal timing and magnitude of surface-atmosphere fluxes of methane, including observed clouds and rainstorms \citep{turtle_cassini_2009,turtle_rapid_2011,turtle_seasonal_2011,turtle_titans_2018,brown_clouds_2010,barnes_transmission_2013,lemmon_large-scale_2019,dhingra_observational_2019}, are probably linked to existing surface and subsurface liquid reservoirs \citep{mitchell_drying_2008,mitchell_climate_2016,tokano_limnological_2009,tokano_modeling_2019,tokano_stable_2020,lora_titans_2015,lora_gcm_2015,lora_model_2019,newman_simulating_2016,faulk_regional_2017,faulk_titans_2020}. The hydrological cycle shapes the surface, producing landforms that bear a striking resemblance to those found on Earth \citep{hayes_lakes_2016} (Figure \ref{terrains}). Lakes and seas of liquid methane and ethane \citep{brown_identification_2008,mastrogiuseppe_bathymetry_2014,mastrogiuseppe_radar_2016,mastrogiuseppe_bathymetry_2018} up to hundreds of meters deep \citep{mastrogiuseppe_bathymetry_2014,mastrogiuseppe_radar_2016,mastrogiuseppe_bathymetry_2018,stofan_lakes_2007} are found across Titan’s polar regions \citep{turtle_rapid_2011,sotin_observations_2012,barnes_transmission_2013,dhingra_observational_2019,barnes_production_2015,hofgartner_transient_2014,hofgartner_titans_2016,cornet_dissolution_2015,mackenzie_case_2019,solomonidou_spectral_2020}. River channels and rounded cobbles imaged by Huygens \citep{karkoschka_disr_2016} and the radar-bright channels \citep{barnes_global-scale_2007,lorenz_titans_2008,burr_fluvial_2009,burr_morphology_2013,le_gall_radar-bright_2010,cartwright_channel_2011,black_estimating_2012,langhans_titans_2013} and fans \citep{birch_alluvial_2016,radebaugh_alluvial_2018,cartwright_using_2017} observed by \emph{Cassini} \citep{wasiak_geological_2013,poggiali_liquid-filled_2016} demonstrate that Titan’s hydrologic cycle is intimately connected with the sedimentary cycle: complex organic compounds synthesized and advected in and by the atmosphere are further transported and modified across the surface by the only known active extraterrestrial hydrologic cycle. \begin{figure} \centering \includegraphics[width=0.65\textwidth]{terrainexamples.png} \caption{Select examples of terrains shaped by Titan's hydrological and sedimentological processes as viewed by Cassini RADAR and terrestrial analogs observed by SENTINEL 1: (a) shorelines of Kraken Mare from T28; (b) Chesapeake Bay (38.884$^{\circ}$N, 76.398$^{\circ}$W) ; (c) river channels terminating in fans from Ta; (d) Death Valley channels and fans (36.688$^{\circ}$N,117.177$^{\circ}$W); (e) organic sands organized into dunes from T49; (f) Namibian longitudinal dunes (24.285$^{\circ}$S,15.437$^{\circ}$E).} \label{terrains} \end{figure} Perhaps the best studied sediments on Titan are the organic sands that occupy 17\% of the moon’s surface \citep{soderblom_correlations_2007,barnes_spectroscopy_2008,bonnefoy_compositional_2016,le_gall_cassini_2011,le_gall_modeling_2014,rodriguez_global_2014,brossier_geological_2018}. Linear dunes (100s of kilometers long and $\sim$100 m in height) demonstrate the importance of aeolian processes and underlying topography in the redistribution of Titan’s organics \citep{rodriguez_global_2014,radebaugh_dunes_2008,radebaugh_linear_2010,lorenz_global_2009,malaska_geomorphological_2016,paillou_radar_2016,telfer_long-wavelength_2019}. Titan’s vast mid-latitude plains ($\sim$65\% of the surface) are also hypothesized to consist of organic materials \citep{malaska_material_2016,lopes_nature_2016,lopes_global_2020,solomonidou_spectral_2018,mackenzie_thermal_2019}, but their composition and origin remains unknown. \subsection{Pressing Questions and Future Investigations} Despite advances in our understanding of the landscapes of Titan, the composition of the surface remains ill-constrained. \emph{Cassini} observations, limited in spectral and spatial resolution, suggest two general categories of materials: organic-rich and water-ice rich \citep{barnes_spectroscopy_2008,rodriguez_global_2014,brossier_geological_2018,solomonidou_spectral_2018,soderblom_geology_2009,griffith_corridor_2019}. Continued laboratory and theoretical work into the possible compositions and physical properties of Titan's solid \citep{mendez_harper_electrification_2017,cable_acetylene-ammonia_2018,cable_co-crystal_2019,cable_properties_2020,maynard-casely_prospects_2018,yu_where_2018,yu_single_2020} and liquid \citep[e.g.][]{farnsworth_nitrogen_2019,hanley_effects_2020,engle_phase_2020,steckloff_stratification_2020,vu_rapid_2020} surface materials are crucial for informing interpretations of \emph{Cassini-Huygens} data and supporting future exploration of the surface like the \emph{Dragonfly} mission. Dramatic advances in our understanding of Titan’s seasonally-evolving weather and climate \citep{mitchell_dynamics_2006,mitchell_climate_2016,hayes_post-cassini_2018} are similarly accompanied by new questions and key unknowns. The principal mechanisms controlling the timing and distribution of humidity \citep{adamkovics_meridional_2016,adamkovics_observations_2017}, convection, methane cloud formation, and precipitation remain incompletely understood, as do the sources and sinks of atmospheric methane and the roles of atmospheric variability \citep{griffith_titans_2008,mitchell_impact_2009,roe_titans_2012,mitchell_climate_2016,hayes_post-cassini_2018} and transient phenomena like dust storms \citep{rodriguez_observational_2018} in the climate. Likewise, the impact of heterogeneous surface-atmosphere coupling—for example, how Titan’s lakes affect the north polar environment \citep{rafkin_air-sea_2020}—and the magnitude and importance of regional climate variability are still largely unexplored. Further observations of Titan’s weather phenomena, coupled with improvements in physical modeling, are needed to continue elucidating Titan’s climate system and to link synoptic-scale processes to those at global and interannual scales, as well as to their impacts on the surface. Global, high-resolution imaging ($<$100m) would revolutionize our understanding of Titan’s landforms, how they interact with each other and the atmosphere, and how they have evolved in the same way that Mars Global Surveyor’s orbital campaign fundamentally changed the study of Mars. Similarly, the lack of knowledge of Titan's topography specifically limits study of the transport of liquids and sediments on the surface, as well as of the influence of the surface on the atmosphere. \emph{Cassini} data covers only 9\% of Titan at scales too coarse for detailed geophysical and hydrological analysis of hydrologic catchments, mountain wave effects, or orographic clouds and precipitation \citep{corlies_titans_2017}. \emph{Huygens} data offer higher resolution but only over a few square kilometers \citep{daudon_new_2020}. In conjunction with maps of surface composition at high spatial and spectral resolution, global imaging and topographic data would address fundamental questions surrounding the hydrological, sedimentological, and meteorological cycles of Titan, augmenting \emph{Cassini} data and complementing \emph{Dragonfly}’s planned local in situ investigations. \subsection{Role in an Ocean Worlds Program} Titan represents the organic-rich endmember of the Ocean World spectrum (Figure \ref{comparisonsocean}). Understanding the surface and atmospheric processes that create, modify, and transport these materials on Titan, and the timescales and volumes on which they act, would elucidate the role these processes play in planetary habitability and their significance. \subsection{Relevance to other planets} Titan’s surface and climate system serves as a natural laboratory for studying the fundamentals of a planetary-scale hydrologic cycle, offering the unique opportunity to observe how this cycle controls the physical and chemical evolution of the landscape in an environment akin to but less complex than Earth’s. For example, sea level rise is likely ongoing and has dramatically shaped the coasts of Titan’s large seas \citep{aharonson_asymmetric_2009,hayes_transient_2011,hayes_topographic_2017,lora_simulations_2014,mackenzie_evidence_2014,mackenzie_case_2019,birch_morphological_2018,tokano_modeling_2019,tokano_stable_2020} and is likely ongoing although the rates remain loosely constrained; study of Titan’s coasts and ongoing erosional/depositional processes could be directly compared to the rapid changes on Earth and inform the study of paleo coastlines on Mars. \begin{figure} \centering \includegraphics[width=0.2\textwidth]{comparisons_oceans.png} \caption{Titan on the water-rock interaction spectrum of Ocean Worlds, as anticipated from models of interior structure \citep[insets, based on the work of][]{vance_geophysical_2018}).} \label{comparisonsocean} \end{figure} \section{Titan is an Ocean World} A subsurface water ocean lies beneath Titan’s organic-covered ice crust \citep{nimmo_ocean_2016}, evidence for which includes gravitational tides \citep{iess_tides_2012,mitri_shape_2014} and larger-than-expected obliquity \citep{baland_titans_2011,baland_titans_2014}. \subsection{Pressing Questions and Future Investigations} The thickness of Titan’s crust is loosely constrained to 50-200 km \citep{choukroun_is_2012,nimmo_ocean_2016,hemingway_rigid_2013,lefevre_structure_2014} and the extent and duration of convection within the ice crust \citep{hemingway_rigid_2013,lefevre_structure_2014,noguchi_rheological_2020} is still debated. Estimates of the oceanic depth span 500-700 km \citep{iess_tides_2012,castillorogez_evolution_2010,gao_nonhydrostatic_2013,chen_tidal_2014} and the state of differentiation in the core is unknown \citep{nimmo_ocean_2016,baland_titans_2014,gao_nonhydrostatic_2013,orourke_stability_2014}. The presence of salts or ammonia may explain the ocean’s high density \citep{mitri_shape_2014,leitner_modeling_2019}, but magnesium sulfate is also a potential solution \citep{vance_geophysical_2018}. Primordial icy bodies provided noble gases and organic matter during Titan’s accretion, making the interior an even vaster source of organics than the atmosphere, with some models predicting 1000$\times$ the current atmospheric methane abundance \citep{tobie_titantextquotesingles_2012}. These considerations, coupled with detection of radiogenic $^{40}$Ar by \emph{Huygens} \citep{niemann_abundances_2005} suggest that outgassing from the interior may be responsible for the atmosphere. New isotopic measurements of noble gases and methane are necessary to resolve key questions concerning the ocean composition, the evolution of the interior and atmosphere, and the formation of Titan \citep{glein_noble_2015,glein_whiff_2017,marounina_evolution_2015,marounina_role_2018,miller_contributions_2019,journaux_holistic_2020}. At pressures $>$500 MPa, a layer of high-pressure ice may separate Titan’s core from the ocean \citep{vance_geophysical_2018}, but if the heat flux is high enough and/or salinity high enough, the ocean may be in direct contact with the silicate core \citep{journaux_large_2020}. Initially, the presence of high-pressure ice prompted the oceans of the largest icy satellites to be deemed inhospitable, assuming that separation by ice precluded exchange between the ocean and core. However, advances in our knowledge of how ices behave at high pressure show that convection can move material through the ice layer \citep{choblet_heat_2017,kalousova_two-phase_2018}, including salts and volatiles like $^{40}$Ar \citep{journaux_salt_2017,kalousova_melting_2018}. More laboratory and theoretical investigations into the properties of high pressure ices and hydrates are needed before we fully understand their implications on Ocean World habitability. \subsection{Role in an Ocean Worlds Program} Determining whether Titan’s ocean is in contact with the rocky core would provide a key constraint to the formation and longevity of large Ocean Worlds both within and beyond our solar system \citep{journaux_influence_2013}. Studying the very origins of Titan’s organic cycle—from the primordial to hydrothermally altered material—informs our understanding of the role of volatile-rich ices in the early solar system. \section{Is Titan a Habitable World?} The search for life elsewhere in the universe logically employs the guide of the biochemical foundations of Earth’s biosphere, giving rise to the classical conditions necessary for habitability: liquid water, essential elements (CHNO; the availabilities of P and S are yet to be determined), and energy sources \citep{hoehler_energy_2007,shock_quantitative_2007,domagal-goldman_astrobiology_2016}. All three factors exist on Titan. The question is where they have been or may be collocated and for how long. \subsection{Pressing Questions and Future Investigations} Titan’s deep crustal ice and subsurface ocean could be one of the largest habitable realms in the solar system, with a volume of liquid water 18x that of the Earth’s oceans and CHNOPS \citep[potentially available from primordial and/or thermally processed materials;][]{miller_contributions_2019}. Tectonic activity and cryovolcanism may facilitate the delivery of surface organics through the crust. Whether any or all of these processes are at work and on what timescales they operate on Titan remain open questions, with implications for other ocean worlds where habitability may rely even more heavily upon the exchange of surface and subsurface material. For example, temperature and pressure conditions at the putative depth of Titan’s stagnant lid/convective ice transition are very similar to those encountered within terrestrial deep glacial ice, which hosts a diversity of microbial life \citep{miteva_comparison_2009} in the intergrain channels between solid ice grains \citep{price_microbial_2007,barletta_chemical_2012}. In these intergrain regions, microbial metabolism is slow enough that the environment may be habitable for 10,000 years—only a few orders of magnitude lower than Titan’s hypothesized convective cycle. A frigid ambient temperature of $\sim$90 K \citep{jennings_titans_2009,jennings_seasonal_2011,jennings_surface_2016,jennings_titan_2019,cottini_spatial_2012} makes Titan’s surface largely inhospitable for Earth-like life using water as the biochemical solvent. However, there are ephemeral scenarios in which liquid water is present at Titan’s surface: lavas erupting from cryovolcanoes and impact-generated melt. While some geomorphological evidence supports the existence of cryovolcanism \citep{lopes_global_2020,lopes_cryovolcanic_2007,lopes_cryovolcanism_2013}, its mechanics \citep{mitri_resurfacing_2008,moore_titan_2011} are not well understood, in part due to the lack of constraints on the extent, makeup, and activity of the crust as well as the ocean composition. However, impact craters are found across Titan’s surface \citep{lorenz_titans_2007,le_mouelic_mapping_2018,soderblom_geology_2010,neish_titans_2012,neish_crater_2013,neish_elevation_2014,neish_fluvial_2016,werynski_compositional_2019,hedgepeth_titans_2020,solomonidou_chemical_2020}. During the impact, crustal material and surface organics mix; the resulting pockets of liquid water eventually freeze on timescales loosely constrained to up to 10,000s of years \citep{artemieva_cratering_2003,artemieva_impact_2005,obrien_numerical_2005,neish_potential_2006,davies_atmospheric_2010,davies_cryolava_2016}. Mixing tholins with liquid water in the laboratory produces amino acids on a timescale of days \citep{neish_rate_2008,neish_low_2009,neish_titans_2010,neish_strategies_2018}. Titan’s transient liquid water environments are thus extraterrestrial laboratories for exploring how far prebiotic chemistry can progress under time and energy constraints that are difficult to realistically reproduce experimentally \citep{neish_strategies_2018}. The \emph{Dragonfly} mission will take advantage of this opportunity with surface composition measurements near a large impact crater. Without an understanding of the chemical processes necessary for the emergence of life, it is impossible to say with certainty how long it takes for life to arise \citep{orgel_origin_1998}. This timescale is a critical unknown in our concept of habitability: is there a minimum time necessary for all the key ingredients to be collocated? The answer to this question has immediate implications for strategizing the search for life elsewhere (both where to search and whether to target extant or extinct life), especially since the lifetime of the liquid oceans on both confirmed and candidate ocean worlds remains an active area of research \citep{nimmo_ocean_2016,neveu_evolution_2019}. Any constraints on habitability timescales from Titan’s transient liquid water environments would provide key context for exploration of potentially habitable environments and the search for life. Finally, Titan’s lakes and seas of liquid hydrocarbons offer a unique opportunity to investigate whether the solvent necessary for biochemistry must be water. Theoretical considerations suggest alternative chemistries are possible \citep{benner_is_2004,lv_oxygen-free_2017} and the abundance of solid and liquid organic molecules available on the surface and lack of UV radiation make the surface of Titan an advantageous place for exploring the possibility of a true second genesis \citep{lunine_rivers_2009,lunine_titan_2010,mckay_titan_2016}. Theoretical investigations are exploring both the possibilities for lipid membrane-like structures in low temperature environments and whether cell membranes are even necessary \citep{palmer_alma_2017,stevenson_membrane_2015,rahm_polymorphism_2016,sandstrom_can_2020}. Laboratory and theoretical models are revolutionizing our understanding of the possible conditions within Titan’s lakes and seas \citep{cordier_floatability_2019,luspay-kuti_effects_2015,cordier_titans_2012,cordier_structure_2016,cordier_bubble_2017,cordier_bubbles_2018,hodyss_solubility_2013,corrales_acetonitrile_2017,malaska_laboratory_2017,hartwig_analytical_2018,czaplinski_experimental_2019,czaplinski_experimental_2020,farnsworth_nitrogen_2019}. Employing these new findings to constrain the habitability potential of Titan’s liquid hydrocarbons requires both determining the composition of Titan sediments—as the \emph{Dragonfly} mission’s plans to do by exploring at a portion of one of Titan's low-latitude dune fields—and monitoring the composition, physical conditions, and seasonal evolution of Titan’s polar lakes and seas with future missions. \section{Future Investigations at Titan} \emph{Dragonfly}, the next New Frontiers (NF) mission, is a relocatable lander, to explore the prebiotic chemistry of Titan’s surface \citep{turtle_dragonfly_2017,lorenz_dragonfly_2018}. \citep[For a detailed description of \emph{Dragonfly}'s science goals and objectives, see][]{barnes2021dragonfly}. Arriving in the 2030s, \emph{Dragonfly} will resolve a critical unknown: the chemical composition of Titan’s solid sediments. By using a mass spectrometer to measure compositions of the organic-rich sands of the equatorial dune fields, water-ice rich clasts from the relatively unaltered interdunes, and previously melted impact melt ejecta from an impact crater, \emph{Dragonfly} will begin to answer the question of how far prebiotic chemistry can progress in environments that provide long-term access to key ingredients for life, thereby providing crucial context for astrobiological investigations across the solar system. \emph{Dragonfly} will also determine elemental abundances in the near subsurface beneath the lander with a gamma ray neutron spectrometer, thus informing the availability and distribution of elements key to habitability. Sample provenance both at the scale of \emph{Dragonfly}’s immediate environs and the local region is essential to interpreting the chemical findings in context. \emph{Dragonfly} is thus equipped with a suite of cameras to conduct imaging campaigns at local, nested scales. Meteorological and geophysical instruments will determine aeolian transport rates and monitor local weather conditions, as well as probing the thermal and electrical properties of the surface. Geophones and a seismometer round out the contextual measurements by probing the dynamics and properties of the ice crust, potentially constraining the depth to the ocean \citep{stahler_seismic_2018}. \emph{Dragonfly}’s payload is thus poised to revolutionize not only our understanding of Titan’s chemistry and geology but address more broadly how far prebiotic chemistry can progress and what chemical and geological processes make a planet or moon habitable. But, just as \emph{Curiosity} addresses different fundamental science than the \emph{Mars Reconnaissance Orbiter}, the NF-scope and architectural choices that make \emph{Dragonfly} best suited for its local in situ investigation necessarily preclude addressing many other outstanding questions at Titan, especially those requiring a global perspective. Thus, as demonstrated by exploration of Mars, a sequence of opportunities is needed to build upon and sufficiently leverage the detailed exploration of Titan begun by \emph{Cassini-Huygens} and to be continued by \emph{Dragonfly} in the coming decades. In particular, exploring the polar lakes and seas, their influence on Titan’s global hydrologic cycle, and their potential habitability, will remain out of even Dragonfly’s impressive range. Such measurements would also be complemented by orbital imaging at higher spatial and temporal resolutions than what \emph{Cassini} or ground-based observations could provide. A higher order gravity field would reveal eroded craters and thus constrain the prevalence of transient liquid water environments. More specifically, \emph{Dragonfly}’s seismic investigation of the interior would be significantly enhanced by a global topographic dataset and higher fidelity mapping of the gravity field. Further study of the dynamics of Titan’s climate and the seasonal evolution of hazes and weather phenomena \citep[e.g. clouds and haboobs,][]{smith_possible_2016,west_cassini_2016,le_mouelic_mapping_2018,rodriguez_observational_2018,stahler_seismic_2018,vinatier_study_2018,lemmon_large-scale_2019} requires continued long-term monitoring with ground- and space-based assets as Titan’s northern summer unfolds. A global imaging dataset would facilitate understanding the beginning-to-end life cycle of the materials sampled by \emph{Dragonfly}. Furthermore, as new species are identified in Titan's atmosphere, such as with ALMA (Figure \ref{molecules}), the needs of Titan exploration evolve. For example, as some of these species are only detected above 300 km and thus require orbital monitoring since low vapor pressures in the troposphere would make detection difficult for \emph{Dragonfly}. \begin{figure} \centering \includegraphics[width=0.85\textwidth]{titanmolecules.pdf} \caption{Molecules in Titan's atmosphere that have been uniquely identified via remote sensing. (Molecule image credit: Ben Mills/Wikimedia Commons) } \label{molecules} \end{figure} At least two examples for how to manifest these complementary investigations in the next decade were described in white papers to the 2023-2032 National Academies Planetary Science and Astrobiology Decadal Survey, representing New Frontiers and Flagship-scope efforts. But these are far from a comprehensive representation of possible architectures for returning to Titan. A return to the Saturn system could orbit Titan \citep{sotin_oceanus_2017} for global mapping and geophysics or leverage the proximity of two prime Ocean World targets to jointly explore both Enceladus and Titan, via orbiting Saturn with plume flythroughs and frequent Titan flybys \citep{coustenis_tandem_2009,sotin_jet_2011} or shuttling between Titan and Enceladus \citep{russell_cycler_2009,sulaiman_joint}. Titan's thick atmosphere can be leveraged for long-duration flight \citep{lorenz_review_2008,barnes_aviatraerial_2012,ross_titan_2016} at altitudes high enough to maximize areal coverage and minimize atmospheric interference on compositional surface mapping \citep[e.g.][]{corlies_modeling_2021}. Ride-along small satellites can be exploited for gravity science \citep{tortora_ocean_2018}. On the surface, the diversity of interesting terrains inspired the study of a fleet of shape-changing robots \citep{tagliabue_shapeshifter_2020}, a fleet of mini-drones, and a drone capable of also floating on the surface of the seas \citep{rodriguez_poseidon}. A mission to float on Titan's seas has been proposed \citep{stofan_time_2013} and submerged instrumentation and/or vessels have been studied \citep[e.g.][]{lorenz_submarine_2016,lorenz_dropsonde_2018}. These in situ elements would benefit and/or require an orbiter for data relay. The diversity of mission concepts (and combinations thereof) that have been proposed and studied reflect the diversity of science questions left to answer at Titan and, importantly, demonstrate that compelling architectures span the full spectrum of NASA and ESA mission classes. \section{Titan is an Unparalleled Destination} Titan offers the opportunity to study a myriad of fundamental planetary science questions. The processes that govern its atmosphere, surface, and interior and interactions between these three environments make Titan an analog for destinations across the solar system and beyond. In the next decade, \emph{Dragonfly} will continue the legacy of \emph{Cassini-Huygens} and radically transform our understanding of Titan’s chemistry, geology, and astrobiological potential. But if the last decade has taught us anything, it’s that this moon’s complexity tends to defy our imagination. There is still much left to learn before we fully understand Saturn’s largest moon, requiring mission opportunities in addition to \emph{Dragonfly} in the next decade. \acknowledgements We thank the broader Titan community for supporting the submission of a white paper of similar content to the 2023-2032 Decadal Survey. We also thank Caleb Heidel (JHU APL) for graphical contributions to Figure \ref{atmofig}. S.M.M. acknowledges support from JHU APL and Cassini Data Analysis and Participating Scientst Program (CDAP) grant \#80NSSC19K0888. S.P.D.B was supported by the Heising-Simons Foundation (51 Pegasi b Fellowship). Part of this work was conducted at the Jet Propulsion Laboratory, California Institute of Technology, under contract with NASA. R.L. and A.S. were partly supported by the CDAP grant \#NH16ZDA001N. This research was partly supported by the NASA Astrobiology Institute project entitled Habitability of Hydrocarbon Worlds: Titan and Beyond. D.N.-M gratefully acknowledges internal support received from the Center for Space Sciences and Technology of the University of Maryland Baltimore County. \section{Introduction} \label{sec:intro} At the turn of the millennium, advancements in ground-based and space-based telescopes enabled the first glimpses of Titan's surface \citep[e.g.][]{smith_titans_1996,meier_surface_2000,coustenis_images_2001,coustenis_titans_2003,griffith_evidence_2003}. The heterogeneous surface albedo was inconsistent with a global ocean, immediately prompting discussion over the fate of ethane, anticipated to be one of the most abundant products of the atmospheric photochemistry \citep{lunine_ethane_1983}. When \emph{Cassini-Huygens} arrived in the Saturn system in 2004, a slew of fundamental advances were enabled by the combined in situ and remote sensing observations over the next 13 years. Newly identified features and processes prompted new questions, many of which will remain unanswered until a return mission to Titan \citep[e.g.][]{nixon_titans_2018,rodriguez_poseidon}. In light of these revelations--that Titan is a an organic-rich, ocean world where Earth-like geological processes rework the landscape and the complex atmospheric products that fall upon it--Titan was considered a target of high importance going into the 2012-2023 Decadal Survey \citep{national_research_council_vision_2011}. Similar to the Titan Explorer study of 2007 \citep{lockwood2008titan,lorenz2008titan}, the Titan Saturn System Mission concept study (TSSM) employed a comprehensive, three-pronged approach: an orbiter, a lander (targeting the lander to the northern lakes rather than the equatorial dunes), and a montgolfiere \citep{coustenis2009joint,reh2009titan}. This particular mission architecture was ultimately not put forward as the highest priority, instead deferred to the next decade ``primarily because of the greater technical readiness of [the Europa flagship mission]". The Vision and Voyages report further noted that ``[a Titan-returning mission's] high scientific priority, however, is especially noteworthy" and thus recommended continued development of the technologies needed to support such a mission. As the 2012-2023 decade unfolded, however, new technologies, scientific revelations, and congressional inertia motivated the addition of Titan and Enceladus to the New Frontiers 4 competition. With the selection of \emph{Dragonfly}, some--but not all--of the high priority science identified by the TSSM will be addressed. Where, then, does Titan science stand now and what questions will be beyond the scope of \emph{Dragonfly}? How is the exploration of Titan's atmospheric, surface, and subsurface processes relevant to Ocean Worlds and other planets? We discuss the answers to these questions as the community enters the purview of a new decadal survey, stemming from considerations submitted as a white paper by these same authors to the 2023-2032 National Academies Planetary Science and Astrobiology Decadal Survey. \section{Titan is an Organic World} Titan hosts the most Earth-like atmosphere in the solar system. Similarities include the atmospheric structure \citep{fulchignoni_situ_2005} (Figure \ref{atmofig}), a nitrogen-dominated composition (95\% N$_2$, 4\% CH$_4$, and 1\% trace species at the surface), and a surface pressure of 1.5 bar. The photolytic destruction of atmospheric methane initiates a chain of photochemical reactions responsible for the plethora of organic species that make up the haze observed by \emph{Cassini-Huygens} and ground-based facilities \citep{marten_new_2002,gurwell_submillimeter_2004,ali_cyclopropenyl_2013,cordiner_alma_2014,cordiner_ethyl_2015,cordiner_interferometric_2018,cordier_floatability_2019,molter_alma_2016,desai_carbon_2017,lai_mapping_2017,palmer_alma_2017,teanby_origin_2018,lombardo_detection_2019,thelen_abundance_2019,thelen_measurement_2019,thelen_detection_2020,nixon_detection_2020}. While unlike present-day Earth, Titan's haze production may be similar to processes on Early Earth \citep{trainer_organic_2006,g_trainer_atmospheric_2013}. \begin{figure} \centering \includegraphics[width=0.7\textwidth]{atmosummary.png} \caption{(top) Comparison of the temperature profiles and structure of the atmospheres of Titan and Earth. Vertical bars at left show the regions probed by Cassini instruments (Ion and Neutral Mass Spectrometer, INMS; CAssini Plasma Spectrometer, CAPS; Radio and Plasma Wave Science, RPWS; UltraViolet Imaging Spectrometer, UVIS; Imaging Science Subsystem, ISS; Visual and Infrared Mapping Spectrometer, VIMS; Composite InfraRed Spectrometer, CIRS), the Huygens Gas Chromatograph Mass Spectrometer (GCMS), and the Atacama Large Millimeter/submillimeter Array (ALMA) telescope. (bottom) Similar to the cycling of water on Earth, Titan's troposphere hosts the hydrological cycle of methane between the surface and on atmosphere. Irreversible loss of methane in the thermosphere suggests that a methane replenishment mechanism is necessary.} \label{atmofig} \end{figure} \subsection{Pressing Questions and Future Investigations} \emph{Cassini} identified the compositions of neutral and positive ions up to 99 Da but could only detect the presence of negative ions with a mass-to-charge ratio so large as to be similar to that of terrestrial proteins \citep{coates_discovery_2007,waite_process_2007,wellbrock_cassini_2013,woodson_ion_2015}. These molecules grow larger during polar winter and with decreasing altitude \citep{wellbrock_heavy_2019}, but their ultimate fate remains unknown. Thus, our current list of known compounds represents only the tip of the organic factory iceberg. Ongoing modeling efforts and laboratory experiments continue to investigate what reactions might be at work \citep{rannou_coupled_2004,waite_process_2007,vuitton_ion_2007,vuitton_simulating_2019,krasnopolsky_photochemical_2009,krasnopolsky_chemical_2014,nixon_isotopic_2012,waite_model_2013,larson_simulating_2014,dobrijevic_coupling_2014,dobrijevic_1d-coupled_2016,hickson_evolution_2014,lara_time-dependent_2014,loison_neutral_2015,loison_photochemical_2019,luspay-kuti_effects_2015,wong_plutos_2015,sebree_13c_2016,barth_modeling_2017,douglas_low_2018,mukundan_model_2018,berry_chemical_2019,bourgalais_low-pressure_2019,dubois_nitrogen-containing_2019,dubois_situ_2019,dubois_positive_2020} and to explore the properties of Titan haze analogs, tholins \citep{cable_titan_2012,gautier_influence_2017,sciamma-obrien_titan_2017,horst_haze_2018,sebree_detection_2018}. However, determining the dominant chemical pathways of Titan’s organic factory will require a more complete understanding of the chemical composition, abundance, and distribution of organic hazes in the atmosphere. Observations at different seasons in Titan’s year (29.5 Earth years) are critical, as monitoring with Cassini spanned only from the middle of northern winter to the very early summer \citep[e.g.][]{teanby_seasonal_2019,vinatier_optical_2012,vinatier_temperature_2020,seignovert_haze_2021}. Global atmospheric circulation in the upper atmosphere, which shows strong zonal prograde winds rapidly changing close to the northern summer solstice, has only been investigated very recently with ALMA \citep{lellouch_intense_2019,cordiner_detection_2020}. These wind changes also propagate in the middle atmosphere, as evidenced by CIRS data in the same period \citep{vinatier_temperature_2020,sharkey_potential_2021}. Observations from an orbiter would be necessary to monitor interactions between the middle and upper atmospheric circulation as well as their potential couplings with atmospheric chemistry--all of which are currently poorly known. Beyond chemical pathways, many questions remain or have arisen from \emph{Cassini-Huygens}. How seasonal trends in condensate distributions extend to lower altitudes \citep{coates_discovery_2007,desai_carbon_2017} and whether these affect sedimentation onto the surface remains unknown. Models indicate that microphysics plays an important role in cloud and haze formation \citep{barth_modeling_2017}; increased understanding of the distribution, optical properties, and composition of hazes and clouds from observational (at Titan and ground-based) \citep{jennings_first_2012,jennings_seasonal_2012,jennings_evolution_2015,vinatier_optical_2012,seignovert_aerosols_2017,seignovert_haze_2021,le_mouelic_mapping_2018,west_seasonal_2018,anderson_organic_2018} and laboratory data \citep{anderson_spectral_2018,nna-mvondo_detailed_2019} would constrain physical models \citep[e.g.][]{loison_gas-grain_2020}. Several approaches to constrain the age of Titan’s atmosphere overlap at $\sim$300-500 Myr, but whether this indicates the age of the atmosphere or ongoing methane photolysis is unclear \citep{horst_titans_2017}. Replenishment from the interior offers a compelling solution to the methane loss, but more data are required to evaluate the likelihood of candidate mechanisms like clathrate dissociation and cryovolcanism \citep{lunine_clathrate_1987,tobie_episodic_2006,choukroun_stability_2010,choukroun_is_2012,sotin_observations_2012}. Examples of necessary data include crustal dynamics, surface feature identification, isotopic fractionation, and a high-degree gravity field. \subsection{Role in an Ocean Worlds Program} Atmospheric organic species are the ultimate source of the organic sediments that dominate Titan’s surface, so their formation and evolution in the atmosphere have important implications for surface geology and possible subsurface nutrient availability. Furthermore, investigating the processes that create complex species in Titan’s atmosphere—without, presumably, biological catalysts like those responsible for large molecules here on Earth—offers fundamental insight into the chemistry that may precede or facilitate the rise of biochemistry on Early Earth \citep{trainer_organic_2006,g_trainer_atmospheric_2013} and beyond. The study of Titan’s atmospheric chemistry therefore offers crucial context for the habitability potential of other ocean worlds where the essential elements may be less abundant. \subsection{Relevance to other planets} Questions surrounding the dynamics and longevity of Titan’s atmosphere link to questions about the gas and ice giants \citep{robinson_titan_2014,toledo_constraints_2019} and—given the coupling between the atmosphere and surface—about Earth, Venus, Mars, and Pluto \citep{mitchell_effects_2014,mandt_comparative_2015,brain_atmospheric_2016,guendelman_axisymmetric_2018,read_superrotation_2018,crismani_localized_2019,kohn_streamer_2019,faulk_titans_2020,kite_methane_2020} (Figure \ref{comparisons}). Without its own magnetic field, Titan’s interactions with the solar wind and Saturn’s magnetosphere offer the opportunity to explore whether magnetic fields are necessary for habitability. Moreover, Titan’s atmosphere serves as a powerful backyard analog for hazy exoplanets—from understanding the formation and evolution of atmospheric aerosols to how we might best detect and observe them—as we have ground truth from both remote and in situ sensing \citep{de_kok_influence_2012,forget_possible_2014,tokano_precipitation_2015,arney_pale_2016,checlair_titan-like_2016,munoz_titan_2017,he_carbon_2017,horst_haze_2018,levi_equation_2019,lora_atmospheric_2018,alvarez_navarro_effects_2019,martinez-rodriguez_exomoons_2019,miguel_observability_2019}. \begin{figure} \centering \includegraphics[width=0.9\textwidth]{comparisons_atmos.png} \caption{Titan's atmospheric density compared to that of terrestrial worlds both within and beyond \citep[e.g.][]{morley2017observing} our solar system, highlighting the potential for comparative planetology between Titan and other worlds with atmospheres.} \label{comparisons} \end{figure} \section{Titan is an Active Hydrological and Sedimentary World} Titan also has a methane-based hydrologic cycle akin to Earth’s \citep{mitchell_climate_2016,hayes_post-cassini_2018}. The seasonal timing and magnitude of surface-atmosphere fluxes of methane, including observed clouds and rainstorms \citep{turtle_cassini_2009,turtle_rapid_2011,turtle_seasonal_2011,turtle_titans_2018,brown_clouds_2010,barnes_transmission_2013,lemmon_large-scale_2019,dhingra_observational_2019}, are probably linked to existing surface and subsurface liquid reservoirs \citep{mitchell_drying_2008,mitchell_climate_2016,tokano_limnological_2009,tokano_modeling_2019,tokano_stable_2020,lora_titans_2015,lora_gcm_2015,lora_model_2019,newman_simulating_2016,faulk_regional_2017,faulk_titans_2020}. The hydrological cycle shapes the surface, producing landforms that bear a striking resemblance to those found on Earth \citep{hayes_lakes_2016} (Figure \ref{terrains}). Lakes and seas of liquid methane and ethane \citep{brown_identification_2008,mastrogiuseppe_bathymetry_2014,mastrogiuseppe_radar_2016,mastrogiuseppe_bathymetry_2018} up to hundreds of meters deep \citep{mastrogiuseppe_bathymetry_2014,mastrogiuseppe_radar_2016,mastrogiuseppe_bathymetry_2018,stofan_lakes_2007} are found across Titan’s polar regions \citep{turtle_rapid_2011,sotin_observations_2012,barnes_transmission_2013,dhingra_observational_2019,barnes_production_2015,hofgartner_transient_2014,hofgartner_titans_2016,cornet_dissolution_2015,mackenzie_case_2019,solomonidou_spectral_2020}. River channels and rounded cobbles imaged by Huygens \citep{karkoschka_disr_2016} and the radar-bright channels \citep{barnes_global-scale_2007,lorenz_titans_2008,burr_fluvial_2009,burr_morphology_2013,le_gall_radar-bright_2010,cartwright_channel_2011,black_estimating_2012,langhans_titans_2013} and fans \citep{birch_alluvial_2016,radebaugh_alluvial_2018,cartwright_using_2017} observed by \emph{Cassini} \citep{wasiak_geological_2013,poggiali_liquid-filled_2016} demonstrate that Titan’s hydrologic cycle is intimately connected with the sedimentary cycle: complex organic compounds synthesized and advected in and by the atmosphere are further transported and modified across the surface by the only known active extraterrestrial hydrologic cycle. \begin{figure} \centering \includegraphics[width=0.65\textwidth]{terrainexamples.png} \caption{Select examples of terrains shaped by Titan's hydrological and sedimentological processes as viewed by Cassini RADAR and terrestrial analogs observed by SENTINEL 1: (a) shorelines of Kraken Mare from T28; (b) Chesapeake Bay (38.884$^{\circ}$N, 76.398$^{\circ}$W) ; (c) river channels terminating in fans from Ta; (d) Death Valley channels and fans (36.688$^{\circ}$N,117.177$^{\circ}$W); (e) organic sands organized into dunes from T49; (f) Namibian longitudinal dunes (24.285$^{\circ}$S,15.437$^{\circ}$E).} \label{terrains} \end{figure} Perhaps the best studied sediments on Titan are the organic sands that occupy 17\% of the moon’s surface \citep{soderblom_correlations_2007,barnes_spectroscopy_2008,bonnefoy_compositional_2016,le_gall_cassini_2011,le_gall_modeling_2014,rodriguez_global_2014,brossier_geological_2018}. Linear dunes (100s of kilometers long and $\sim$100 m in height) demonstrate the importance of aeolian processes and underlying topography in the redistribution of Titan’s organics \citep{rodriguez_global_2014,radebaugh_dunes_2008,radebaugh_linear_2010,lorenz_global_2009,malaska_geomorphological_2016,paillou_radar_2016,telfer_long-wavelength_2019}. Titan’s vast mid-latitude plains ($\sim$65\% of the surface) are also hypothesized to consist of organic materials \citep{malaska_material_2016,lopes_nature_2016,lopes_global_2020,solomonidou_spectral_2018,mackenzie_thermal_2019}, but their composition and origin remains unknown. \subsection{Pressing Questions and Future Investigations} Despite advances in our understanding of the landscapes of Titan, the composition of the surface remains ill-constrained. \emph{Cassini} observations, limited in spectral and spatial resolution, suggest two general categories of materials: organic-rich and water-ice rich \citep{barnes_spectroscopy_2008,rodriguez_global_2014,brossier_geological_2018,solomonidou_spectral_2018,soderblom_geology_2009,griffith_corridor_2019}. Continued laboratory and theoretical work into the possible compositions and physical properties of Titan's solid \citep{mendez_harper_electrification_2017,cable_acetylene-ammonia_2018,cable_co-crystal_2019,cable_properties_2020,maynard-casely_prospects_2018,yu_where_2018,yu_single_2020} and liquid \citep[e.g.][]{farnsworth_nitrogen_2019,hanley_effects_2020,engle_phase_2020,steckloff_stratification_2020,vu_rapid_2020} surface materials are crucial for informing interpretations of \emph{Cassini-Huygens} data and supporting future exploration of the surface like the \emph{Dragonfly} mission. Dramatic advances in our understanding of Titan’s seasonally-evolving weather and climate \citep{mitchell_dynamics_2006,mitchell_climate_2016,hayes_post-cassini_2018} are similarly accompanied by new questions and key unknowns. The principal mechanisms controlling the timing and distribution of humidity \citep{adamkovics_meridional_2016,adamkovics_observations_2017}, convection, methane cloud formation, and precipitation remain incompletely understood, as do the sources and sinks of atmospheric methane and the roles of atmospheric variability \citep{griffith_titans_2008,mitchell_impact_2009,roe_titans_2012,mitchell_climate_2016,hayes_post-cassini_2018} and transient phenomena like dust storms \citep{rodriguez_observational_2018} in the climate. Likewise, the impact of heterogeneous surface-atmosphere coupling—for example, how Titan’s lakes affect the north polar environment \citep{rafkin_air-sea_2020}—and the magnitude and importance of regional climate variability are still largely unexplored. Further observations of Titan’s weather phenomena, coupled with improvements in physical modeling, are needed to continue elucidating Titan’s climate system and to link synoptic-scale processes to those at global and interannual scales, as well as to their impacts on the surface. Global, high-resolution imaging ($<$100m) would revolutionize our understanding of Titan’s landforms, how they interact with each other and the atmosphere, and how they have evolved in the same way that Mars Global Surveyor’s orbital campaign fundamentally changed the study of Mars. Similarly, the lack of knowledge of Titan's topography specifically limits study of the transport of liquids and sediments on the surface, as well as of the influence of the surface on the atmosphere. \emph{Cassini} data covers only 9\% of Titan at scales too coarse for detailed geophysical and hydrological analysis of hydrologic catchments, mountain wave effects, or orographic clouds and precipitation \citep{corlies_titans_2017}. \emph{Huygens} data offer higher resolution but only over a few square kilometers \citep{daudon_new_2020}. In conjunction with maps of surface composition at high spatial and spectral resolution, global imaging and topographic data would address fundamental questions surrounding the hydrological, sedimentological, and meteorological cycles of Titan, augmenting \emph{Cassini} data and complementing \emph{Dragonfly}’s planned local in situ investigations. \subsection{Role in an Ocean Worlds Program} Titan represents the organic-rich endmember of the Ocean World spectrum (Figure \ref{comparisonsocean}). Understanding the surface and atmospheric processes that create, modify, and transport these materials on Titan, and the timescales and volumes on which they act, would elucidate the role these processes play in planetary habitability and their significance. \subsection{Relevance to other planets} Titan’s surface and climate system serves as a natural laboratory for studying the fundamentals of a planetary-scale hydrologic cycle, offering the unique opportunity to observe how this cycle controls the physical and chemical evolution of the landscape in an environment akin to but less complex than Earth’s. For example, sea level rise is likely ongoing and has dramatically shaped the coasts of Titan’s large seas \citep{aharonson_asymmetric_2009,hayes_transient_2011,hayes_topographic_2017,lora_simulations_2014,mackenzie_evidence_2014,mackenzie_case_2019,birch_morphological_2018,tokano_modeling_2019,tokano_stable_2020} and is likely ongoing although the rates remain loosely constrained; study of Titan’s coasts and ongoing erosional/depositional processes could be directly compared to the rapid changes on Earth and inform the study of paleo coastlines on Mars. \begin{figure} \centering \includegraphics[width=0.2\textwidth]{comparisons_oceans.png} \caption{Titan on the water-rock interaction spectrum of Ocean Worlds, as anticipated from models of interior structure \citep[insets, based on the work of][]{vance_geophysical_2018}).} \label{comparisonsocean} \end{figure} \section{Titan is an Ocean World} A subsurface water ocean lies beneath Titan’s organic-covered ice crust \citep{nimmo_ocean_2016}, evidence for which includes gravitational tides \citep{iess_tides_2012,mitri_shape_2014} and larger-than-expected obliquity \citep{baland_titans_2011,baland_titans_2014}. \subsection{Pressing Questions and Future Investigations} The thickness of Titan’s crust is loosely constrained to 50-200 km \citep{choukroun_is_2012,nimmo_ocean_2016,hemingway_rigid_2013,lefevre_structure_2014} and the extent and duration of convection within the ice crust \citep{hemingway_rigid_2013,lefevre_structure_2014,noguchi_rheological_2020} is still debated. Estimates of the oceanic depth span 500-700 km \citep{iess_tides_2012,castillorogez_evolution_2010,gao_nonhydrostatic_2013,chen_tidal_2014} and the state of differentiation in the core is unknown \citep{nimmo_ocean_2016,baland_titans_2014,gao_nonhydrostatic_2013,orourke_stability_2014}. The presence of salts or ammonia may explain the ocean’s high density \citep{mitri_shape_2014,leitner_modeling_2019}, but magnesium sulfate is also a potential solution \citep{vance_geophysical_2018}. Primordial icy bodies provided noble gases and organic matter during Titan’s accretion, making the interior an even vaster source of organics than the atmosphere, with some models predicting 1000$\times$ the current atmospheric methane abundance \citep{tobie_titantextquotesingles_2012}. These considerations, coupled with detection of radiogenic $^{40}$Ar by \emph{Huygens} \citep{niemann_abundances_2005} suggest that outgassing from the interior may be responsible for the atmosphere. New isotopic measurements of noble gases and methane are necessary to resolve key questions concerning the ocean composition, the evolution of the interior and atmosphere, and the formation of Titan \citep{glein_noble_2015,glein_whiff_2017,marounina_evolution_2015,marounina_role_2018,miller_contributions_2019,journaux_holistic_2020}. At pressures $>$500 MPa, a layer of high-pressure ice may separate Titan’s core from the ocean \citep{vance_geophysical_2018}, but if the heat flux is high enough and/or salinity high enough, the ocean may be in direct contact with the silicate core \citep{journaux_large_2020}. Initially, the presence of high-pressure ice prompted the oceans of the largest icy satellites to be deemed inhospitable, assuming that separation by ice precluded exchange between the ocean and core. However, advances in our knowledge of how ices behave at high pressure show that convection can move material through the ice layer \citep{choblet_heat_2017,kalousova_two-phase_2018}, including salts and volatiles like $^{40}$Ar \citep{journaux_salt_2017,kalousova_melting_2018}. More laboratory and theoretical investigations into the properties of high pressure ices and hydrates are needed before we fully understand their implications on Ocean World habitability. \subsection{Role in an Ocean Worlds Program} Determining whether Titan’s ocean is in contact with the rocky core would provide a key constraint to the formation and longevity of large Ocean Worlds both within and beyond our solar system \citep{journaux_influence_2013}. Studying the very origins of Titan’s organic cycle—from the primordial to hydrothermally altered material—informs our understanding of the role of volatile-rich ices in the early solar system. \section{Is Titan a Habitable World?} The search for life elsewhere in the universe logically employs the guide of the biochemical foundations of Earth’s biosphere, giving rise to the classical conditions necessary for habitability: liquid water, essential elements (CHNO; the availabilities of P and S are yet to be determined), and energy sources \citep{hoehler_energy_2007,shock_quantitative_2007,domagal-goldman_astrobiology_2016}. All three factors exist on Titan. The question is where they have been or may be collocated and for how long. \subsection{Pressing Questions and Future Investigations} Titan’s deep crustal ice and subsurface ocean could be one of the largest habitable realms in the solar system, with a volume of liquid water 18x that of the Earth’s oceans and CHNOPS \citep[potentially available from primordial and/or thermally processed materials;][]{miller_contributions_2019}. Tectonic activity and cryovolcanism may facilitate the delivery of surface organics through the crust. Whether any or all of these processes are at work and on what timescales they operate on Titan remain open questions, with implications for other ocean worlds where habitability may rely even more heavily upon the exchange of surface and subsurface material. For example, temperature and pressure conditions at the putative depth of Titan’s stagnant lid/convective ice transition are very similar to those encountered within terrestrial deep glacial ice, which hosts a diversity of microbial life \citep{miteva_comparison_2009} in the intergrain channels between solid ice grains \citep{price_microbial_2007,barletta_chemical_2012}. In these intergrain regions, microbial metabolism is slow enough that the environment may be habitable for 10,000 years—only a few orders of magnitude lower than Titan’s hypothesized convective cycle. A frigid ambient temperature of $\sim$90 K \citep{jennings_titans_2009,jennings_seasonal_2011,jennings_surface_2016,jennings_titan_2019,cottini_spatial_2012} makes Titan’s surface largely inhospitable for Earth-like life using water as the biochemical solvent. However, there are ephemeral scenarios in which liquid water is present at Titan’s surface: lavas erupting from cryovolcanoes and impact-generated melt. While some geomorphological evidence supports the existence of cryovolcanism \citep{lopes_global_2020,lopes_cryovolcanic_2007,lopes_cryovolcanism_2013}, its mechanics \citep{mitri_resurfacing_2008,moore_titan_2011} are not well understood, in part due to the lack of constraints on the extent, makeup, and activity of the crust as well as the ocean composition. However, impact craters are found across Titan’s surface \citep{lorenz_titans_2007,le_mouelic_mapping_2018,soderblom_geology_2010,neish_titans_2012,neish_crater_2013,neish_elevation_2014,neish_fluvial_2016,werynski_compositional_2019,hedgepeth_titans_2020,solomonidou_chemical_2020}. During the impact, crustal material and surface organics mix; the resulting pockets of liquid water eventually freeze on timescales loosely constrained to up to 10,000s of years \citep{artemieva_cratering_2003,artemieva_impact_2005,obrien_numerical_2005,neish_potential_2006,davies_atmospheric_2010,davies_cryolava_2016}. Mixing tholins with liquid water in the laboratory produces amino acids on a timescale of days \citep{neish_rate_2008,neish_low_2009,neish_titans_2010,neish_strategies_2018}. Titan’s transient liquid water environments are thus extraterrestrial laboratories for exploring how far prebiotic chemistry can progress under time and energy constraints that are difficult to realistically reproduce experimentally \citep{neish_strategies_2018}. The \emph{Dragonfly} mission will take advantage of this opportunity with surface composition measurements near a large impact crater. Without an understanding of the chemical processes necessary for the emergence of life, it is impossible to say with certainty how long it takes for life to arise \citep{orgel_origin_1998}. This timescale is a critical unknown in our concept of habitability: is there a minimum time necessary for all the key ingredients to be collocated? The answer to this question has immediate implications for strategizing the search for life elsewhere (both where to search and whether to target extant or extinct life), especially since the lifetime of the liquid oceans on both confirmed and candidate ocean worlds remains an active area of research \citep{nimmo_ocean_2016,neveu_evolution_2019}. Any constraints on habitability timescales from Titan’s transient liquid water environments would provide key context for exploration of potentially habitable environments and the search for life. Finally, Titan’s lakes and seas of liquid hydrocarbons offer a unique opportunity to investigate whether the solvent necessary for biochemistry must be water. Theoretical considerations suggest alternative chemistries are possible \citep{benner_is_2004,lv_oxygen-free_2017} and the abundance of solid and liquid organic molecules available on the surface and lack of UV radiation make the surface of Titan an advantageous place for exploring the possibility of a true second genesis \citep{lunine_rivers_2009,lunine_titan_2010,mckay_titan_2016}. Theoretical investigations are exploring both the possibilities for lipid membrane-like structures in low temperature environments and whether cell membranes are even necessary \citep{palmer_alma_2017,stevenson_membrane_2015,rahm_polymorphism_2016,sandstrom_can_2020}. Laboratory and theoretical models are revolutionizing our understanding of the possible conditions within Titan’s lakes and seas \citep{cordier_floatability_2019,luspay-kuti_effects_2015,cordier_titans_2012,cordier_structure_2016,cordier_bubble_2017,cordier_bubbles_2018,hodyss_solubility_2013,corrales_acetonitrile_2017,malaska_laboratory_2017,hartwig_analytical_2018,czaplinski_experimental_2019,czaplinski_experimental_2020,farnsworth_nitrogen_2019}. Employing these new findings to constrain the habitability potential of Titan’s liquid hydrocarbons requires both determining the composition of Titan sediments—as the \emph{Dragonfly} mission’s plans to do by exploring at a portion of one of Titan's low-latitude dune fields—and monitoring the composition, physical conditions, and seasonal evolution of Titan’s polar lakes and seas with future missions. \section{Future Investigations at Titan} \emph{Dragonfly}, the next New Frontiers (NF) mission, is a relocatable lander, to explore the prebiotic chemistry of Titan’s surface \citep{turtle_dragonfly_2017,lorenz_dragonfly_2018}. \citep[For a detailed description of \emph{Dragonfly}'s science goals and objectives, see][]{barnes2021dragonfly}. Arriving in the 2030s, \emph{Dragonfly} will resolve a critical unknown: the chemical composition of Titan’s solid sediments. By using a mass spectrometer to measure compositions of the organic-rich sands of the equatorial dune fields, water-ice rich clasts from the relatively unaltered interdunes, and previously melted impact melt ejecta from an impact crater, \emph{Dragonfly} will begin to answer the question of how far prebiotic chemistry can progress in environments that provide long-term access to key ingredients for life, thereby providing crucial context for astrobiological investigations across the solar system. \emph{Dragonfly} will also determine elemental abundances in the near subsurface beneath the lander with a gamma ray neutron spectrometer, thus informing the availability and distribution of elements key to habitability. Sample provenance both at the scale of \emph{Dragonfly}’s immediate environs and the local region is essential to interpreting the chemical findings in context. \emph{Dragonfly} is thus equipped with a suite of cameras to conduct imaging campaigns at local, nested scales. Meteorological and geophysical instruments will determine aeolian transport rates and monitor local weather conditions, as well as probing the thermal and electrical properties of the surface. Geophones and a seismometer round out the contextual measurements by probing the dynamics and properties of the ice crust, potentially constraining the depth to the ocean \citep{stahler_seismic_2018}. \emph{Dragonfly}’s payload is thus poised to revolutionize not only our understanding of Titan’s chemistry and geology but address more broadly how far prebiotic chemistry can progress and what chemical and geological processes make a planet or moon habitable. But, just as \emph{Curiosity} addresses different fundamental science than the \emph{Mars Reconnaissance Orbiter}, the NF-scope and architectural choices that make \emph{Dragonfly} best suited for its local in situ investigation necessarily preclude addressing many other outstanding questions at Titan, especially those requiring a global perspective. Thus, as demonstrated by exploration of Mars, a sequence of opportunities is needed to build upon and sufficiently leverage the detailed exploration of Titan begun by \emph{Cassini-Huygens} and to be continued by \emph{Dragonfly} in the coming decades. In particular, exploring the polar lakes and seas, their influence on Titan’s global hydrologic cycle, and their potential habitability, will remain out of even Dragonfly’s impressive range. Such measurements would also be complemented by orbital imaging at higher spatial and temporal resolutions than what \emph{Cassini} or ground-based observations could provide. A higher order gravity field would reveal eroded craters and thus constrain the prevalence of transient liquid water environments. More specifically, \emph{Dragonfly}’s seismic investigation of the interior would be significantly enhanced by a global topographic dataset and higher fidelity mapping of the gravity field. Further study of the dynamics of Titan’s climate and the seasonal evolution of hazes and weather phenomena \citep[e.g. clouds and haboobs,][]{smith_possible_2016,west_cassini_2016,le_mouelic_mapping_2018,rodriguez_observational_2018,stahler_seismic_2018,vinatier_study_2018,lemmon_large-scale_2019} requires continued long-term monitoring with ground- and space-based assets as Titan’s northern summer unfolds. A global imaging dataset would facilitate understanding the beginning-to-end life cycle of the materials sampled by \emph{Dragonfly}. Furthermore, as new species are identified in Titan's atmosphere, such as with ALMA (Figure \ref{molecules}), the needs of Titan exploration evolve. For example, as some of these species are only detected above 300 km and thus require orbital monitoring since low vapor pressures in the troposphere would make detection difficult for \emph{Dragonfly}. \begin{figure} \centering \includegraphics[width=0.85\textwidth]{titanmolecules.pdf} \caption{Molecules in Titan's atmosphere that have been uniquely identified via remote sensing. (Molecule image credit: Ben Mills/Wikimedia Commons) } \label{molecules} \end{figure} At least two examples for how to manifest these complementary investigations in the next decade were described in white papers to the 2023-2032 National Academies Planetary Science and Astrobiology Decadal Survey, representing New Frontiers and Flagship-scope efforts. But these are far from a comprehensive representation of possible architectures for returning to Titan. A return to the Saturn system could orbit Titan \citep{sotin_oceanus_2017} for global mapping and geophysics or leverage the proximity of two prime Ocean World targets to jointly explore both Enceladus and Titan, via orbiting Saturn with plume flythroughs and frequent Titan flybys \citep{coustenis_tandem_2009,sotin_jet_2011} or shuttling between Titan and Enceladus \citep{russell_cycler_2009,sulaiman_joint}. Titan's thick atmosphere can be leveraged for long-duration flight \citep{lorenz_review_2008,barnes_aviatraerial_2012,ross_titan_2016} at altitudes high enough to maximize areal coverage and minimize atmospheric interference on compositional surface mapping \citep[e.g.][]{corlies_modeling_2021}. Ride-along small satellites can be exploited for gravity science \citep{tortora_ocean_2018}. On the surface, the diversity of interesting terrains inspired the study of a fleet of shape-changing robots \citep{tagliabue_shapeshifter_2020}, a fleet of mini-drones, and a drone capable of also floating on the surface of the seas \citep{rodriguez_poseidon}. A mission to float on Titan's seas has been proposed \citep{stofan_time_2013} and submerged instrumentation and/or vessels have been studied \citep[e.g.][]{lorenz_submarine_2016,lorenz_dropsonde_2018}. These in situ elements would benefit and/or require an orbiter for data relay. The diversity of mission concepts (and combinations thereof) that have been proposed and studied reflect the diversity of science questions left to answer at Titan and, importantly, demonstrate that compelling architectures span the full spectrum of NASA and ESA mission classes. \section{Titan is an Unparalleled Destination} Titan offers the opportunity to study a myriad of fundamental planetary science questions. The processes that govern its atmosphere, surface, and interior and interactions between these three environments make Titan an analog for destinations across the solar system and beyond. In the next decade, \emph{Dragonfly} will continue the legacy of \emph{Cassini-Huygens} and radically transform our understanding of Titan’s chemistry, geology, and astrobiological potential. But if the last decade has taught us anything, it’s that this moon’s complexity tends to defy our imagination. There is still much left to learn before we fully understand Saturn’s largest moon, requiring mission opportunities in addition to \emph{Dragonfly} in the next decade. \acknowledgements We thank the broader Titan community for supporting the submission of a white paper of similar content to the 2023-2032 Decadal Survey. We also thank Caleb Heidel (JHU APL) for graphical contributions to Figure \ref{atmofig}. S.M.M. acknowledges support from JHU APL and Cassini Data Analysis and Participating Scientst Program (CDAP) grant \#80NSSC19K0888. S.P.D.B was supported by the Heising-Simons Foundation (51 Pegasi b Fellowship). Part of this work was conducted at the Jet Propulsion Laboratory, California Institute of Technology, under contract with NASA. R.L. and A.S. were partly supported by the CDAP grant \#NH16ZDA001N. This research was partly supported by the NASA Astrobiology Institute project entitled Habitability of Hydrocarbon Worlds: Titan and Beyond. D.N.-M gratefully acknowledges internal support received from the Center for Space Sciences and Technology of the University of Maryland Baltimore County.
\section{\en{Introduction}\de{Einführung}} \en{The last few years have seen a number of tremendous breakthroughs in the field of artificial intelligence (AI). A significant part of this success is due to major advances in machine learning (ML), the data analytics technique behind AI. Machine learning does recognise correlations in large data sets. Due to its ability to process loads of information in short time, it can uncover statistical patterns in data that humans cannot spot. This gives access to new kind of insights from the data which allow improved data analysis and model predictions. Although not absolutely error-free, the results clearly outperform conventional approaches, and often even human experts. The areas of application are extensive and include medical diagnosis, university admission, loan allocation, recidivism prediction, recruitment, online advertisement, face recognition, language translation, recommendation engines, fraud detection, credit limits, pricing and false news detection. The heavy dependence on data poses a new challenge though. The data used for training a machine learning algorithm are considered the \emph{ground truth}. This means that during the learning phase, these data constitute the comprehensive representation of the real world which the algorithm seeks to approximate. If the training data includes any kind of unwanted bias, the resulting algorithm will incorporate and enforce it. Worse still, in the absence of robust explanations for the results, it is hardly possible for humans to recognise biased predictions of machine learning algorithms as such. Unwanted bias may happen to be directed against sensitive subgroups, defined for instance by gender, ethnicity or age. As a consequence, people from one such group would be generally disadvantaged by the system. However, systematic unequal treatment of individuals from different sensitive groups is considered discrimination, and there is broad consensus in our society that making a distinction based on a personal characteristic which is usually not a matter of choice is unfair. Hence, anti-discrimination laws in plenty of legislations prohibit actions of this nature. The traditional approach to fight discrimination in statistical models when using deterministic algorithms is known as "anti-classification". This principle is firmly encoded in current legal standards and it simply rules to exclude any attribute which defines membership in a sensitive subgroup as feature from the data. For example, a user's gender may not be collected and processed in many scenarios. However, since machine learning is backed by "big data" which contain highly correlated features that can serve as possible proxies for those sensitive attributes, this approach has been shown to be insufficient to avoid discrimination in AI systems~\cite{Corbett2018}. Two main sources for undesired bias have been identified in the machine learning pipeline. First, if the training data are incorrect or not sufficiently representative in certain aspects, this fault may become the source of correlations which do not exist in this form in reality. In such a case, the machine learning algorithm may detect patterns which are in fact not meaningful. Second, the training data may indeed faithfully represent the real world, but the status quo does not appear ideal. Without correction, the machine learning algorithm would reproduce the current state and thus manifest an existing shortcoming. The objective is therefore to adjust for this bias in the resulting algorithm. Whatever the source, plenty of mitigation techniques have been presented by researchers lately to deal with bias in data and make AI applications more fair. This is an encouraging development towards maintaining trust in AI and eventually overcoming some of the potentially biased human judgments which impair automatic decision-making. Besides the technical task of adjusting the algorithms or the data, an equally important philosophical question needs to be settled: what kind of fairness is the objective? Fairness is a concept of justice and a variety of definitions exist which sometimes conflict with each other. Hence, there is no uniformly accepted notion of fairness available. In fact, the most appropriate fairness definition depends on the use case and it is often a matter of legal requirements and ethical standards. The purpose of this document is to assist AI stakeholders in settling for the desired ethical principles by questions and examples. Applying such a procedure will not only help to identify the best fairness definition for a given AI application, but it will also make the choice transparent and the implemented fairness more understandable for the end user. In the remainder, we first introduce some mathematical basics which are useful to assess and compare the performance of machine learning algorithms. Second, we explain the problem of unwanted bias in data. Next, we present the most commonly used fairness definitions in research and explain the ethical principles they stand for. Afterwards, we illustrate by example how these fairness definitions may be mutually contradictory. Finally, we present the "Fairness Compass" which constitutes an actionable guide for AI stakeholders to translate ethical principles into fairness definitions.} \de{Im Laufe der letzten Jahre konnten bedeutende Durchbrüche im Bereich der Künstlichen Intelligenz (KI) erzielt werden. Ein großer Anteil an diesen Erfolgen ist auf Fortschritte beim Machinellen Lernen (ML) zurückzuführen, der Schlüsseltechnologie hinter kognitiven Systemen. Machinelles Lernen beschreibt die Fähigkeit einer Maschine, in großen Datensätzen Korrelationen zu erkennen. Aufgrund seiner Eigenschaft, riesige Mengen an Informationen in kurzer Zeit zu analysieren, können statistische Muster in Daten erkannt werden, die dem menschlichen Auge verborgen bleiben. Diese wiederum ermöglichen neuartige Erkenntnisse aus den Daten, welche die Datenanalyse und Modellprognosen optimieren helfen. Obwohl auch diese Ergebnisse nicht komplett fehlerfrei sind, so übertreffen sie doch die herkömmlichen Ansätze, und schneiden oft sogar besser ab als menschliche Experten. Die Anwendungsgebiete für diese Technik sind vielfältig und umfassen medizinische Diagnosen, Studienplatzvergaben, Kreditbewilligungen, Rückfallprognosen, Rekrutierung, Onlinewerbung, Gesichtserkennung, Sprachübersetzung, Empfehlungssysteme, Betrugserkennung, Kreditkartenlimits, Preisgestaltung und Faktencheck in Sozialen Netzwerken. Die große Abhängigkeit von den Daten birgt allerdings eine neue Herausforderung. Die Daten, die zum Training eines Algorithmus herangezogen werden, betrachtet man als \emph{Ground Truth}. Das bedeutet, dass diese Daten während der Lernphase die vollumfängliche Realität abbilden, die das Prognosemodell anzunähern sucht. Sollten die Trainingsdaten auf irgendeine Weise unerwünschte Verzerrungen (\textit{bias}) aufweisen, wird der trainierte Algorithmus diese widerspiegeln und sogar verstärken. Und weil die Logik von KI-Algorithmen für Menschen bislang nicht verständlich erklärbar ist, lassen sich diese Verzerrungen weder im Modell noch im Ergebnis ohne Weiteres als solche erkennen. Von unerwünschten Verzerrungen können Teile der Gesellschaft betroffen sein, die sich über sensible Merkmale wie zum Beispiel das Geschlecht, die ethnische Herkunft oder das Alter definieren. Demzufolge kann es vorkommen, dass Menschen aus diesen Gruppen von einem KI-System kategorisch benachteiligt werden. Systematische, ungleiche Behandlung von Individuen mit verschiedenen sensiblen Merkmalen wird als Diskriminierung betrachtet, und es herrscht breiter Konsens in unserer Gesellschaft, dass es unfair ist, wenn Ungleichbehandlung auf Grundlage persönlicher Eigenschaften stattfindet, auf welche der oder die Betroffene in der Regel keinen Einfluss hat. Entsprechend verbieten Antidiskriminierungsgesetze in vielen Ländern derartiges Handeln. Bei statistischen Modellen, die mit traditionellen, deterministischen Algorithmen erzeugt werden, wird zur Vermeidung von Diskriminierung ein Verfahren eingesetzt, das als "Anti-Classification" bekannt ist. Dieses Prinzip ist auch in der aktuellen Gesetzgebung verankert und sieht einfach vor, dass Datenparameter, die sensible Merkmale beschreiben, von der Verwendung ausgeschlossen sind. So darf zum Beispiel das Geschlecht einer Person in vielen Anwendungsfällen weder erhoben noch verwendet werden. Nun basiert Maschinelles Lernen allerdings auf "Big Data", welche äußerst komplexe Korrelationen enthalten. Diese haben zur Folge, dass mitunter Parameter, welche unbedenklich scheinen und nicht als "sensibel" eingestuft sind, indirekt sensible Informationen preisgeben können. Auf Grundlage dieser Verflechtungen konnte demonstriert werden, dass für KI-Systeme ein solcher Ansatz zur Bekämpfung von Diskriminierung ungenügend ist~\cite{Corbett2018}. Im Entwicklungsprozess von ML-Modellen wurden zwei Hauptquellen für unerwünschte Verzerrungen festgestellt. Erstens kann es vorkommen, dass die Trainingsdaten fehlerhaft oder in bestimmter Hinsicht unzureichend repräsentativ sind. Derartige Mängel können die Ursache für Korrelationen in den Daten sein, die auf diese Weise in der Realität nicht zu finden sind. In so einem Fall erkennt der Algorithmus ein Muster, welches eigentlich keine Bedeutung hat. Zweitens ist es möglich, dass die Trainingsdaten zwar durchaus die Wirklichkeit abbilden, dieser Status Quo aber nicht der idealen Zielvorstellung entspricht. Wenn keine Korrektur erfolgt, reproduziert der Algorithmus den aktuellen Zustand und verfestigt so den bestehenden Missstand. Das Ziel besteht unter diesen Umständen darin, dass der finale Algorithmus die vorhandenen Verzerrungen ausgleicht. In den letzten Jahren haben Forscherinnen und Forscher zahlreiche Methoden entwickelt, die diese Verzerrungen in den Daten, egal welchen Ursprungs, abschwächen, und KI-Systeme so fairer machen können. Das ist eine ermutigende Entwicklung, die hoffentlich das Vertrauen in KI stärkt und an deren Ende manche potentiell voreingenommene, menschliche Entscheidungen möglicherweise von unparteiischen, automatischen Entscheidungen ersetzt werden können. Neben der technischen Herausforderung, die Algorithmen oder die Daten anzupassen, gilt es allerdings eine ebenso wichtige, philosophische Frage zu klären: Welche Art von Fairness ist das Ziel? Fairness ist ein theoretisches Konzept von Gerechtigkeit, und es existieren verschiedene Definitionen, von denen manche untereinander in Konflikt stehen. Es gibt also keine universell anwendbare Form von Fairness, die allen Vorstellungen gleichermaßen genügt. Die optimale Definition hängt vielmehr vom konkreten Anwendungsfall ab und wird meistens von ethischen Grundsätzen und gesetzlichen Rahmenbedingungen bestimmt. Dieses Dokument soll die Verantwortlichen für KI-Systemen unterstützen, die angestrebten ethischen Prinzipien anhand von Fragen und Beispielen festzulegen. Das vorgeschlagene Verfahren vereinfacht dabei nicht nur die Wahl der besten Fairnessdefinition für eine bestimmte Anwendung, sondern es macht diese Auswahl auch transparent und die implementierte Fairness für alle Beteiligten besser nachvollziehbar. Die nachfolgenden Kapitel sind wie folgt strukturiert. Zunächst führen wir einige mathematische Grundlagen ein, die nützlich sind, um die Eigenschaften von Algorithmen des Maschinellen Lernens zu bewerten und zu vergleichen. Dann vertiefen wir das Problem von Verzerrungen in Daten. Anschließend präsentieren wir die am häufigsten verwendeten Definitionen von Fairness in der Forschung und erläutern die ethischen Prinzipien, die sie repräsentieren. Im folgenden Kapitel illustrieren wir beispielhaft, wie sich diese Fairnessdefinitionen mitunter gegenseitig widersprechen. Schließlich führen wir den "Fairness Compass" ein: unser praxisnahes Tool für KI-Entscheider, mit dem sich angestrebte ethische Standards in die passende Fairnessdefinition übersetzen lassen.} \section{\en{Fundamentals}\de{Grundlagen}} \en{For better understanding of the following sections, we introduce here some fundamental knowledge about machine learning, and a few statistical measures commonly used to characterise its performance.} \de{Um die nachstehenden Kapitel besser verstehen zu können, vermitteln wir hier zunächst gewisse Grundkenntnisse zu Maschinellem Lernen und führen außerdem einige statistische Maße ein, die zur Prüfung und Bewertung der Systeme nützlich sind. } \subsection{\en{Machine Learning}\de{Maschinelles Lernen}} \en{Compared with traditional programming, the difference of machine learning is that the reasoning behind the algorithm’s decision-making is not defined by hard-coded rules which were explicitly programmed by a human, but it is rather learned by example data: Thousands, sometimes millions of parameters get optimised without human intervention to finally capture a generalised pattern of the data. The resulting model allows to make predictions on new, unseen data with high accuracy. This approach can be used for two different kinds of problems: On the one hand for classification, where the task is to predict discrete classes such as categories, for example. On the other hand for regression, where the objective is to predict a continuous quantity, for instance a price. Throughout this document, we only consider classification tasks, and for the sake of simplicity, we focus on the binary case with two classes: positive (1) or negative (0). For model output we either consider those very class labels 0 and 1, or a score $S$ which corresponds to the probability for the sample to be positive. To illustrate the concepts in this document, we introduce a sample scenario about fraud detection in insurance claims. This fictional setting will serve as a running example throughout the following sections. Verifying the legitimacy of an insurance claim is essential to prevent abuse. However, fraud investigations are labour intensive for the insurance company. In addition, for some types of insurance, many claims may occur at the same time – for example, due to natural disasters that affect entire regions. For policyholders, on the other hand, supplementary checks can be annoying, for example when they are asked to answer further questions or provide additional documents. Both parties are interested in a quick decision: The customers expect timely remedy, and the company tries to keep the effort low. Therefore, an AI system that speeds up such a task could prove very useful. Concretely, it should be able to reliably identify legitimate insurance claims in order to make prompt payment possible. Potentially fraudulent cases should also be reliably detected and flagged for further investigation. In order to analyse the performance of a classifier, we compare the predicted output $\widehat{Y}$ with the true output value $Y$. In the claims data, the output value 1 stands for a fraudulent claim, while 0 represents a legitimate claim. \autoref{table:predictions} shows sample predictions for our running example. For better illustration, we also provide a graphical representation of the same results in \autoref{fig:graphical_representation}. The white dots correspond to the positive samples ($Y=1$), here actual fraudulent claims. The black dots represent negative samples ($Y=0$), actual legitimate claims in the present scenario. The big circle constitutes the boundary of the classifier: Dots within the circle have been predicted as positive/fraudulent ($\widehat{Y}=1$), dots outside the circle as negative/legitimate ($\widehat{Y}=0$). The different background colours further show where the classifier was right (green and dark grey), and where not (red and light grey).} \de{Maschinelles Lernen unterscheidet sich von traditioneller Programmierung dadurch, dass die Logik des Algorithmus nicht auf hartkodierten Regeln beruht, die von einem Menschen so explizit festgelegt wurden, sondern vielmehr anhand von Beispielen erlernt wird: Tausenden, manchmal sogar Millionen Parameter werden ohne menschliches Eingreifen optimiert, um letztlich ein strukturelles Muster aus den Daten abzubilden. Das resultierende Prognosemodell ist dann im Stande, für neue Datensätze aus demselben Anwendungsbereich Vorhersagen mit hoher Präzision zu treffen. Dieser Ansatz kann für zwei unterschiedliche Arten von Problemen eingesetzt werden: Für Klassifikation, wo die Aufgabe darin besteht, diskrete Klassen vorherzusagen, wie etwa Kategorien. Und für Regression, wo das Ziel ist, einen kontinuierlichen Wert zu prognostizieren, wie zum Beispiel einen Preis. Im vorliegenden Bericht gehen wir ausschließlich auf Klassifikationsprobleme ein, und der Einfachheit halber konzentrieren wir uns auf den binären Fall mit zwei Klassen: positiv (1) oder negativ (0). Als Ausgabewerte des Modells erwarten wir entweder eben jene Label 0 und 1; oder einen Score $S$, welcher die Wahrscheinlichkeit ausdrückt, dass eine Instanz positiv ist. Um die hier vorgestellten Konzepte besser veranschaulichen zu können, verwenden wir ein fiktionales Szenario aus dem Bereich der Betrugserkennung bei Versicherungsfällen. Im Laufe der folgenden Kapitel werden wir uns immer wieder auf dieses Anwendungsbeispiel beziehen. Die Prüfung der Legitimität eines Versicherungsfalls ist unerlässlich um Missbrauch zu verhindern. Allerdings handelt es sich dabei für das Versicherungsunternehmen um einen aufwendigen und personalintensiven Vorgang. Zudem treten für manche Versicherungsarten viele Schadensfälle zeitgleich ein – etwa durch Naturkatastrophen, die ganze Regionen betreffen. Für Versicherungsnehmer wiederum können genaue Kontrollen lästig sein, zum Beispiel wenn sie gebeten werden, weitere Fragen zu beantworten oder zusätzliche Dokumente nachzureichen. Beiden Parteien ist dabei an einer raschen Entscheidung gelegen: Die Kunden erwarten schnelle Abhilfe, und das Unternehmen versucht den Aufwand gering zu halten. Ein KI-System, das eine solche Aufgabe beschleunigt, könnte sich also als sehr nützlich erweisen. Konkret sollte es im Stande sein, rechtmäßige Versicherungsfälle sicher zu erkennen, um eine zeitnahe Auszahlung möglich zu machen. Potentiell betrügerische Fälle sollten ebenfalls zuverlässig entdeckt und für weitere Ermittlungen gekennzeichnet werden. Zur Bewertung der Qualität eines Vorhersagemodells vergleichen wir die Prognosen $\widehat{Y}$ mit den wahren Klassen $Y$. Im System unseres Anwendungsszenarios ist dabei ein legitimer Versicherungsfall mit dem Wert 0 kodiert, und ein Betrugsversuch mit 1. \autoref{table:predictions} enhält einige Beispielvorhersagen, die wir in \autoref{fig:graphical_representation} grafisch umsetzen, um die Zahlen besser verständlich zu machen: Die weißen Punkte entsprechen den positiven Datensätzen ($Y=1$), im Beispielkontext die tatsächlich betrügerischen Versicherungsfälle. Die schwarzen Punkte repräsentieren die negativen Instanzen ($Y=0$), hier also die legitimen Fälle. Der große Kreis stellt die Grenzen des Vorhersagemodells dar: Punkte innerhalb des Kreises wurden als positiv/betrügerisch klassifiziert ($\widehat{Y}=1$), Punkte außerhalb als negativ/legitim ($\widehat{Y}=0$). Die unterschiedlichen Hintergrundfarben machen sichtbar, wo das Modell richtig lag (grün und dunkelgrau), und wo nicht (rot und hellgrau).} \def9{9} \def12{12} \def12{12} \def30{30} \begin{table}[h] \predictions{9}{12}{12}{30} \caption{\en{Tabular evaluation of the sample scenario: true output class $Y$ compared to predictions $\widehat{Y}$}\de{Beispieldaten für das Versicherungsszenario. Legitime Fälle sind mit 0 kodiert, unrechtmäßige mit 1. In der oberen Zeile stehen die wahren Klassen $Y$, in der unteren die zugehörigen Prognosen $\widehat{Y}$ des Modells.}} \label{table:predictions} \end{table} \begin{figure}[h] \centering \includegraphics[width=0.5\linewidth]{images/graphical_representation.pdf} \caption{\en{Graphical representation of the sample scenario. White dots represent positive samples, black ones negative samples. The big circle constitutes the classifier.}\de{Grafische Darstellung der Ergebnisse aus \autoref{table:predictions}. Weiße Punkte repräsentieren unrechtmäßige Fälle (1), schwarze Punkte stehen für legitime Fälle (0). Der große Kreis stellt das Vorhersagemodell dar.}} \label{fig:graphical_representation} \end{figure} \en{It is worth noting that in this oversimplified 2-dimensional example, drawing an ideal border which separates black and white dots and thus defining a perfect classifier would be obvious. In high-dimensional real world use cases, however, it is hardly possible to obtain a perfect classifier with error rates of zero; optimisation always remains a matter of trade-offs.} \de{Selbstverständlich wäre es in diesem stark vereinfachten zweidimensionalen Beispiel nicht weiter schwer, die perfekte Grenze zwischen schwarzen und weißen Punkten zu ziehen und damit ein ideales Vorhersagemodell zu erhalten. In echten Applikationen, die oft tausende Aspekte in Form von Datenparametern berücksichtigen, ist es allerdings kaum möglich, ein perfektes, fehlerfreies Modell zu finden; Kompromisse sind bei der Modellbildung unumgänglich.} \subsection{\en{Statistical Measures}\de{Statistische Kennzahlen}}\label{ssec:statistical_measures} \en{A so-called "confusion matrix" helps to visualise and compute statistical measures commonly used to inspect the performance of a machine learning model. The rows of the matrix represent the actual output classes, in our case 0 or 1. The columns represent the predicted output classes by the given classifier. The cells where the predicted class corresponds to the actual class contain the counts of the correctly classified instances. Wherever the classes differ, the classifier got it wrong and the numbers represent incorrectly classified samples.} \de{Die sogenannte "Wahrheitsmatrix" ist ein nützliches Mittel, um statistische Kennzahlen, die häufig zur Bewertung von Vorhersagemodellen herangezogen werden, darzustellen und zu berechnen. Die Zeilen der Matrix repräsentieren dabei die wahren Klassen, in unserem Fall 0 oder 1. Die Spalten beziehen sich auf die Vorhersagen des Modells. In den Zellen, wo die vorhergesagte Klasse mit dem tatsächlichen Ausgabewert übereinstimmt, stehen die Summen der jeweils korrekt klassifizierten Datensätze. Wo sich die Klassen unterscheiden, lag das Modell in seiner Vorhersage falsch und die Zellen enthalten die Summen der entsprechend fehlerhaft eingeordneten Fälle.} \begin{table}[h] \confusionmatrixterms \caption{\en{Schema of confusion matrix}\de{Schema einer Wahrheitsmatrix}} \label{table:confusionmatrix_schema} \end{table} \en{On an abstract level, the figures in the cells are generally identified by the terms provided in \autoref{table:confusionmatrix_schema}. Taking the data from our running example in \autoref{table:predictions} as a basis, the related confusion matrix looks like \autoref{table:confusionmatrix_example}. We notice that the given classifier correctly predicted 9\ claims to be fraudulent and 30\ claims to be legitimate. However, it also falsely predicted 12\ claims to be legitimate, which were in fact fraudulent, and 12\ claims to be fraudulent, which really were not.} \de{Auf abstrakter Ebene werden die Werte aus den Zellen üblicherweise mit den Begriffen aus \autoref{table:confusionmatrix_schema} bezeichnet. Wenn wir die Daten aus unserem laufenden Beispiel in \autoref{table:predictions} als Grundlage nehmen, ergibt sich die Wahrheitsmatrix in \autoref{table:confusionmatrix_example}. Wir stellen fest, dass das Vorhersagemodell in diesem Beispiel 9\ Versicherungsfälle korrekt als betrügerisch einstuft, und 30\ ebenfalls richtig als legitim. Es klassifiziert jedoch auch 12\ weitere Fälle als legitim, die eigentlich widerrechtlich sind, und 12\ rechtmäßige Fälle zu Unrecht als Betrugsversuch. } \begin{table}[ht] \confusionmatrixshort{9}{12}{12}{30} \caption{\en{Confusion matrix for the sample data from \autoref{table:predictions}}\de{Resultierende Wahrheitsmatrix aus den Beispieldaten in \autoref{table:predictions}}} \label{table:confusionmatrix_example}% \end{table} \en{Revisiting the illustration in \autoref{fig:graphical_representation}, we further realise that the coloured segments in the schema correspond to the different cells in the confusion matrix: false negatives (light grey), true positives (green), false positives (red), and true negatives (dark grey). From the confusion matrix we can extract plenty of interesting statistical measures. We describe those measures in the text and provide their formulas and graphical representations in \autoref{table:metrics}.} \de{Wenn wir uns erneut die grafische Darstellung in \autoref{fig:graphical_representation} vor Augen führen sehen wir nun, dass die farbig hinterlegten Segmente den unterschiedlichen Zellen in der Wahrheitsmatrix entsprechen: Falsch-negative Prognosen (hellgrau), richtig-positive Prognosen (grün), falsch-positive Prognosen (rot) und richtig-negative Prognosen (dunkelgrau). Der Wahrheitsmatrix lassen sich zahlreiche statistische Kennzahlen entnehmen, die für eine Analyse des Modells interessant sind. Wir beschreiben diese im Einzelnen im nachfolgenden Text und stellen in \autoref{table:metrics} außerdem ihre Formeln und grafischen Darstellungen bereit.} \begin{table}[] \centering \begin{tabular}{ | m{13em} | m{10em}| m{3em} | } \hline \en{Actual positives}\de{Tatsächlich positive Fälle} & $P=FN+TP$ & \begin{center} \hspace*{0.05in} \includegraphics[height=0.05\textwidth]{images/p.pdf} \vspace*{-0.1in} \end{center}\\ \hline \en{Actual negatives}\de{Tatsächlich negative Fälle} & $N=FP+TN$ & \begin{center} \hspace*{-0.2in} \vspace*{-0.1in} \includegraphics[height=0.05\textwidth]{images/n.pdf} \end{center}\\ \hline \en{Base rate}\de{Basisrate} & $BR=\frac{P}{P+N}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/br.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{Positive rate}\de{Positivrate} & $PR=\frac{TP+FP}{P+N}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/pr.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{Negative rate}\de{Negativrate} & $NR=\frac{TN+FN}{P+N}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/nr.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{Accuracy}\de{Korrektklassifikationsrate (\textit{Accuracy})} & $ACC=\frac{TP+TN}{P+N}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/acc.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{Misclassification rate}\de{Fehlklassifikationsrate (\textit{Misclassification rate})}& $MR=\frac{FN+FP}{P+N}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/mr.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{True positive rate}\de{Richtig-positiv-Rate\newline(\textit{True positive rate})} & $TPR=\frac{TP}{P}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/tpr.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{True negative rate}\de{Richtig-negativ-Rate\newline(\textit{True negative rate})} & $TNR=\frac{TN}{N}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/tnr.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{False positive rate}\de{Falsch-positiv-Rate} & $FPR=\frac{FP}{N}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/fpr.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{False negative rate}\de{Falsch-negativ-Rate} & $FNR=\frac{FN}{P}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/fnr.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{False discovery rate}\de{Falscherkennungsrate\newline(\textit{False discovery rate})} & $FDR=\frac{FP}{TP+FP}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/fdr.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{Positive predictive value}\de{Positiver Vorhersagewert\newline(\textit{Positive predictive value})} & $PPV=\frac{TP}{TP+FP}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/ppv.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{False omission rate}\de{Falschauslassungsrate\newline(\textit{False omission rate})} & $FOR=\frac{FN}{TN+FN}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/for.pdf} \vspace*{-0.18in} \end{center}\\ \hline \en{Negative predictive value}\de{Negativer Vorhersagewert\newline(\textit{Negative predictive value})} & $NPV=\frac{TN}{TN+FN}$ & \vspace*{-0.11in} \begin{center} \includegraphics[height=0.09\textwidth]{images/npv.pdf} \vspace*{-0.18in} \end{center}\\ \hline \end{tabular} \caption{\en{Metrics derived from confusion matrix}\de{Abgeleitete Formeln aus der Wahrheitsmatrix}} \label{table:metrics} \end{table} \en{First, we count the \textbf{actual positives} in the data set. This number is the sum of the true positives and the false negatives, which can be viewed as missed true positives. Likewise, the number of \textbf{actual negatives} is the sum of the true negatives and the false positives, which again can be viewed as missed true negatives. In our example, those figures represent the numbers of actual fraudulent claims and actual legitimate claims. The (positive) \textbf{base rate}, sometimes also called the prevalence rate, represents the proportion of actual positives with respect to the entire data set. In our example, this rate describes the share of actual fraudulent claims in the data set. The \textbf{positive rate} is the overall rate of positively classified instances, including both correct and incorrect decisions. The \textbf{negative rate} is the ratio of negative classification, again irrespective of whether the decisions were correct or incorrect. In our example, the positive rate is the rate of all claims suspected to be fraudulent, and the negative rate represents the rate of claims which are predicted to be legitimate. \textbf{Accuracy} is the ratio of the correctly classified instances (positive and negative) of all decisions. In return, the \textbf{misclassification rate} is the ratio of the misclassified instances over all decisions. In our example, accuracy is the proportion of claims which were correctly classified, either as fraudulent or as legitimate. The misclassification rate refers to the failed classifications, the proportion of incorrect decisions taken by the classifier. The \textbf{true positive rate} and the \textbf{true negative rate} describe the proportions of correctly classified positive and negative instances, respectively, of their actual occurrences. In the example, the true positive rate describes the share of all actual fraudulent claims which were detected as such. The true negative rate is the share of actual legitimate claims which were successfully discovered. Directly linked, the \textbf{false positive rate} and the \textbf{false negative rate} describe the error rates. The false positive rate denotes the proportion of actual negatives which was falsely classified as positive. In the same way, the false negative rate describes the proportion of actual positives which was misclassified as negative. In our example, the false positive rate is the proportion of all actual legitimate claims which were falsely classified as fraudulent. On the other way around, the false negative rate is the proportion of all actual fraudulent claims which slipped through the system and were falsely classified as legitimate. The \textbf{false discovery rate} describes the share of misclassified positive classifications of all positive predictions. So, it is about the proportion of positively classified instances which were falsely identified or discovered as such. On the contrary, the \textbf{false omission rate} describes the proportion of false negative predictions of all negative predictions. These instances, which are actually positive, were overlooked – they were mistakenly passed over or omitted. In our example, the false discovery rate is the error rate of all claims which were classified as fraudulent. The false omission rate describes the share of actually fraudulent claims of all claims which were classified as legitimate. In a similar approach, but rather focusing on the correctly classified samples, the \textbf{positive} and the \textbf{negative predictive values} describe the ratio of samples which were correctly classified as positive or negative from all the positive or negative predictions. In the example, the positive predictive value is the proportion of correctly identified claims in all claims which were flagged as fraudulent. The negative predictive value is the proportion of correctly classified claims in all claims which were flagged as legitimate.} \de{Zunächst ermitteln wir die \textbf{tatsächlich positiven Fälle} im Datensatz. Diese Zahl ergibt sich aus den Summen der richtig-positiven und der falsch-negativen Prognosen. Letztere können auch als verfehlte positive Prognosen betrachtet werden. Entsprechend ergibt sich die Zahl der \textbf{tatsächlich negativen Fälle} aus der Summe der richtig-negativen und der falsch-positiven Prognosen, welche wiederum als verpasste negative Prognosen verstanden werden können. In unserem Beispiel entsprechen diese Kennzahlen den jeweiligen Summen der tatsächlich betrügerischen und der tatsächlich legitimen Versicherungsfälle. Die (positive) \textbf{Basisrate}, manchmal auch als Prävalenzrate bezeichnet, steht für den Anteil der tatsächlich positiven Fälle, bezogen auf den kompletten Datensatz. Im Beispiel beschreibt diese Rate den wahren Anteil betrügerischer Fälle im Datensatz. Die \textbf{Positivrate} wiederum ist der proportionale Anteil der positiven Bescheide, unabhängig davon, ob die Entscheidung richtig oder falsch war. Die \textbf{Negativrate} beschreibt umgekehrt die Rate der Negativebescheide, wieder ungeachtet dessen, ob die Entscheidung korrekt oder inkorrekt war. In unserem Beispiel entspricht die Positivrate der Rate jener Fälle, die als betrügerisch eingestuft wurden. Die Negativrate bezeichnet den Anteil der als legitim klassifizierten Fälle. Die \textbf{Korrektklassifikationsrate} (\textit{accuracy}) ist die Erfolgsquote, die den Anteil der korrekten Prognosen (positiv und negativ) von allen Entscheidungen bemisst. Im Gegenzug definiert die \textbf{Fehlklassifikationsrate} (\textit{misclassification rate}) den Anteil der Fehlentscheidungen. In unserem Anwendungsbeispiel gibt die Korrektklassifikationsrate den Anteil der zurecht als legitim und der zurecht als betrügerisch eingeordneten Fälle wieder. Die Fehlklassifikationsrate bezieht sich auf die Fehlentscheidungen – der Anteil jener Instanzen also, bei der sich das Modell geirrt hat. Die \textbf{Richtig-positiv-Rate} und die \textbf{Richtig-negativ-Rate} beschreiben die Proportionen der korrekt positiv bzw. korrekt negativ eingeordneten Instanzen, anteilig ihrer tatsächlichen Vorkommnisse. Im Beispiel steht die Richtig-positiv-Rate für den Anteil der tatsächlich betrügerischen Fälle, der vom Modell als solche erkannte wurde. Die Richtig-negativ-Rate beschreibt die Rate der tatsächlich legitimen Fälle, die erfolgreich als solche eingeordnet wurden. In direktem Zusammenhang dazu beschreiben die \textbf{Falsch-positiv-Rate} und die \textbf{Falsch-negativ-Rate} die Fehlerquoten. Die Falsch-positiv-Rate bezeichnet den Anteil der eigentlich negativen Instanzen, der fälschlicherweise positiv klassifiziert wurde. Gleichermaßen steht die Falsch-negativ-Rate für die Rate der eigentlich positiven Fälle, die fälschlicherweise als negativ eingestuft wurden. Im Beispielszenario steht die Falsch-positiv-Rate für den Anteil der legitimen Fälle, welcher irrtümlich als betrügerisch klassifiziert wurde. Umgekehrt ist die Falsch-negativ-Rate der Anteil von den eigentlich betrügerischen Fällen, der vom System "übersehen" und inkorrekt als legitim klassifiziert wurde. Die \textbf{Falscherkennungsrate} (\textit{false discovery rate}) bezeichnet den Anteil der Fehlentscheidungen von allen positiv beschiedenen Fällen. Es geht also um den Anteil jener Instanzen, die zu Unrecht als positiv identifiziert bzw. entdeckt wurden. Andersherum beschreibt die \textbf{Falschauslassungsrate} (\textit{false omission rate}) die Rate der fälschlicherweise negativ eingeordneten Fälle von allen Negativbescheiden. Diese eigentlich positiven Instanzen wurden ignoriert, d.h. sie wurden irrtümlich übergangen bzw. ausgelassen. Im Beispiel entspricht die Falscherkennungsrate der Fehlerrate von den Fällen, die als betrügerisch eingestuft wurden. Die Falschauslassungsrate bezeichnet hingegen die Fehlerrate von den als legitim vorhergesagten Versicherungsfälle – wie viele Fälle also irregulär als rechtmäßig eingestuft wurden. Ähnlich, aber mit Schwerpunkt auf die korrekt klassifizierten Instanzen, beschreiben der \textbf{positive} und der \textbf{negative Vorhersagewert} den jeweiligen Anteil der positiven bzw. negativen Vorhersagen, der richtig war. Im Beispiel ist der positive Vorhersagewert der Anteil von jenen Prognosen, die einen Betrug vermuten, und damit richtig liegen. Der negative Vorhersagewert wiederum ist der Anteil der Fälle, die als legitim prognostiziert wurden, und das zurecht.} \section{\en{Problem of Bias}\de{Das Problem von Verzerrungen}} \en{Up until here, we have analysed the data as one population and did not consider the possible existence of sensitive subgroups in the data. However, since decisions from machine learning algorithms often affect humans, many data sets contain sensitive subgroups by nature of the data. Such subgroups may for example be defined by gender, race or religion. The membership of an instance is usually identified by a sensitive attribute $A$. To analyse potential bias of a classifier, we split the results by this sensitive attribute into subgroups and investigate possible discrepancies among them. Any such deviation could be an indicator for discrimination against one sensitive group. The idea of pursuing fairness on the basis of membership in one or several sensitive groups is called "group fairness"~\cite{mehrabi2019}. This approach is also adopted in anti-discrimination laws in many legislations with varying lists of sensitive attributes~\cite{EU2012,Barocas2016}. In addition, another concept exists in research which tries to achieve "individual fairness" by aiming at similar treatment of similar individuals, taking any attribute into account~\cite{Dwork2011}. In the scope of this document, we focus on group fairness, and to facilitate matters, we only consider two different sensitive subgroups. Therefore, we assume one sensitive binary attribute $A$ which can take the values 0 or 1, for instance representing the gender. Unwanted bias is said to occur when the statistical measures described in the previous section significantly differ from one sensitive subgroup to another. Without any closer analysis on a per-subgroup basis, such a problem can go completely unnoticed. Please note that in order to "see" the groups in the data the sensitive information is obviously required to be available. We now examine our running example on insurance fraud detection for unwanted bias. The output from the trained model remains unchanged, but this time we assume two sensitive subgroups in the data, specified by the sensitive attribute $A$. For instance, we split the data into men ($A$=0) and women ($A$=1). The separate confusion matrices for each subgroup in \autoref{table:confusionmatrices_separated} enable us to compare the performance measures.} \de{Bis jetzt haben wir für die statistische Analyse immer die Daten als Ganzes zugrunde gelegt, und nicht weiter berücksichtigt, dass der Datensatz aus sensiblen Untergruppen bestehen könnte. Die Entscheidungen von ML-Algorithmen betreffen jedoch oft Menschen. Daher ist es schon aufgrund der Beschaffenheit der Daten naheliegend, dass diese unterschiedliche demographische Gruppen umfassen, beispielsweise definiert durch das Geschlecht einer Person, deren ethnischem Hintergrund oder Konfession. Technisch wird die Zugehörigkeit zu einer solchen Gruppe meistens durch ein sensibles Attribut $A$ im Datensatz festgehalten. Um ein Prognosemodell auf mögliche Verzerrungen zu prüfen, unterteilen wir die Ergebnisse mithilfe dieses sensiblen Attributs in verschiedene Datensätze und untersuchen deren statistische Merkmale auf Abweichungen. Unterschiedliche Kennwerte können Anzeichen von strukturellen Fehlern (\textit{biases}) sein – verzerrte Prognosen also, die eine Ungleichbehandlung der sensiblen Untergruppen bedeutet. Die Idee, Fairness auf Grundlage der Zugehörigkeit zu einer oder mehreren sensiblen Gruppen anzustreben, wird "Gruppenfairness" genannt~\cite{mehrabi2019}. Dieser Ansatz findet sich auch in den Antidiskriminierungsgesetzen zahlreicher Gesetzgebungen wieder, mit verschiedenen Listen geschützter, sensibler Attribute~\cite{EU2012,Barocas2016}. Alternativ gibt es in der Forschung ein weiteres Konzept names "Individuelle Fairness", das stattdessen eine Gleichbehandlung von Individuen angestrebt, die sich in sämtlichen Attributen ähneln – sensibel und nicht-sensibel~\cite{Dwork2011}. Im Rahmen dieses Dokuments konzentrieren wir uns auf das Konzept der Gruppenfairness, und der Einfachheit halber gehen wir außerdem nur von zwei sensiblen Untergruppen aus. Folglich enthält unser Datensatz nur ein binäres, sensibles Attribute $A$, das die Werte 0 oder 1 annehmen kann, zum Beispiel um das Geschlecht zu kodieren. Von unerwünschten Verzerrungen ist die Rede, wenn einige der statistischen Kennzahlen aus dem vorherigen Kapitel zwischen den Gruppen wesentlich abweichen. Es ist also notwendig, auf Basis der sensiblen Untergruppen separate Datenanalysen durchzuführen, was im Übrigen die Verfügbarkeit der sensiblen Attribute voraussetzt. Anderenfalls lassen sich Probleme dieser Art nur schwer erkennen. Wir untersuchen nun unser Anwendungsbeispiel zum Thema Betrugserkennung bei Versicherungsfällen auf Verzerrungen. Die Prognosedaten des trainierten Modells bleiben dabei unverändert, allerdings betrachten wir die Daten jetzt für zwei sensible Untergruppen, die durch das sensible Attribute $A$ definiert sind. Zu diesem Zweck unterteilen wir die Daten für Männer ($A$=0) und Frauen ($A$=1). Anhand der unterschiedlichen Wahrheitsmatrizen für diese Untergruppen in \autoref{table:confusionmatrices_separated} können wir jetzt deren statistische Eigenschaften inspizieren.} \begin{table}[ht] \begin{subfigure}{.48\textwidth} \confusionmatrix{7}{7}{6}{22}{$A$=0} \caption{\en{Men}\de{Männer}} \end{subfigure} \hfill \begin{subfigure}{.48\textwidth} \confusionmatrix{2}{5}{6}{8}{$A$=1} \caption{\en{Women}\de{Frauen}} \end{subfigure} \caption{\en{Separate confusion matrices for sensitive subgroups}\de{Unterschiedliche Wahrheitsmatrizen für sensible Untergruppen}} \label{table:confusionmatrices_separated} \end{table} \en{We notice that the base rates (BR) are identical in both subgroups which means in this example that men and women are equally likely to file a fraudulent (or a legitimate) claim. However, the true negative rate (TNR) for men is 0.79, while for women it is 0.57. This means 79\% of the valid claims filed by men get correctly classified as legitimate, while for women that’s the case for only 57\% of the same type of claims. On the other hand, the false omission rate for men is 24\% and for women it is 38\%. So, fraudulent claims filed by women have a higher chance to remain undetected than fraudulent claims filed by men.} \de{Wir stellen fest, dass die Basisraten (BR) für beide Gruppen identisch sind, was bedeutet, dass die Wahrscheinlichkeit, dass Männer und Frauen einen betrügerischen (oder einen legitimen) Schadensfall melden, gleich hoch ist. Die Richtig-negativ-Rate (TNR) liegt für Männer allerdings bei 0.79, während sie für Frauen 0.57 beträgt. Das bedeutet, dass 79\% aller legitimen Fälle, die von Männern eingereicht wurden, korrekt als legitim eingeordnet wurden, wohingegen für Frauen das nur für 57\% der Fälle des gleichen Typs gilt. Andererseits liegt die Falschauslassungsrate (FOR) für Männer bei 24\% und für Frauen bei 38\%. Betrügerische Fälle, die von Frauen eingereicht werden, haben also eine höhere Chance unerkannt zu bleiben, als betrügerische Fälle von Männern.} \section{\en{Available Fairness Definitions}\de{Verfügbare Fairnessdefinitionen}} \en{The problem of biased AI has attracted attention only recently, but the research community has already produced several fairness definitions to measure unwanted bias in outputs of machine learning models as described in the previous section. Additionally, plenty of mitigation methods have been proposed to ensure the kind of fairness they represent. For more details on the different mitigation approaches we refer the interested reader to survey papers on the subject as a starting point~\cite{Corbett2018,mehrabi2019}. In this document, we focus on the definitions of fairness and their impact on the results in real world scenarios. In the following, we present the most commonly used definitions for group fairness and explain their characteristics by example. Since all notions relate to one of three fundamental conditions of statistical independence which are commonly known as independence, sufficiency, and separation, we segment the definitions by those categories~\cite{barocas2019}.} \de{Obwohl das Problem von Verzerrungen in KI-Systemen erst seit wenigen Jahren diskutiert wird, hat die Forschungsgemeinschaft bereits zahlreiche Lösungs\-vorschläge präsentiert. Dazu zählen etliche Fairnessdefinitionen, mit denen sich unerwünschte Verzerrungen in den Ergebnissen von Prognosemodellen, wie wir sie im vorherigen Kapitel beschrieben haben, messen lassen. Außerdem wurden verschiedene Methoden präsentiert, mit denen sich die jeweilige Art von Fairness erwirken lässt. Für weiterführende Informationen zu diesen Methoden verweisen wir auf entsprechende Übersichtsartikel als Ausgangspunkt~\cite{Corbett2018,mehrabi2019}. In diesem Bericht konzentrieren wir uns auf die Fairnessdefinitionen und deren Auswirkungen auf die Ergebnisse in realen Anwendungsszenarien. Im weiteren Verlauf stellen wir die am häufigsten verwendeten Fairnessdefinitionen für Gruppenfairness vor, und erklären deren Eigenschaften an Beispielen. Alle Definitionen lassen sich einem von drei statistischen Prinzipien zuordnen, die wir im Folgenden als Überkategorien verwenden: Die "bedingungslose" Unabhängigkeit, sowie die bedingten Unabhängigkeiten Suffizienz und Separierung~\cite{barocas2019}.} \subsection{\en{Independence}\de{Unabhängigkeit}}\label{ssec:independence} \en{Statistically, fairness definitions satisfy independence if the sensitive attribute $A$ is unconditionally independent of the prediction $\widehat{Y}$. Practically, this means that when considering all predictions made, the share of positive and negative decisions is proportionally equal among the two sensitive subgroups. On an individual level, this means that the likelihood of being classified as one of the classes is equal for two individuals with different sensitive attributes.} \de{Statistisch betrachtet erfüllen Fairnessdefinitionen das Prinzip der Unabhängigkeit, wenn das sensible Attribut $A$ von der Prognose $\widehat{Y}$ unbedingt unabhängig ist. Praktisch bedeutet das, dass auf alle Prognosen bezogen, der Anteil positiver und negativer Entscheidungen zwischen den sensiblen Gruppen proportional gleich ist. Auf individueller Ebene gilt dann für zwei Personen mit verschiedenen sensiblen Attributen, dass es für sie gleich wahrscheinlich ist, eine der beiden Klassen zugewiesen zu bekommen.} \subsubsection{Demographic Parity}\label{ssec:demographic_parity} \en{The goal of demographic parity is that the favourable outcome should be assigned to each subgroup of a sensitive class at equal rates~\cite{Dwork2011}. In our running sample scenario, this objective translates to equal rates of negative predictions (=classifications as legitimate) for any claims submitted by men or women. In statistical terms, the negative rates (NR) of both subgroups should be identical. However, for the distributions above, NR=0.42 for men and NR=0.67 for women. We notice a gap of 25 percent points for the favourable outcome between the two sensitive subgroups. The confusion matrices in \autoref{table:confusionmatrices_demographicparity} show possible results for a new model which was optimised for demographic parity. The number of negative predictions has increased for men, the distribution for women remains unchanged. Both confusion matrices now feature a NR of 0.67. Therefore, demographic parity was successfully achieved. It is not surprising though that manipulating the distribution for men also changes true positive and true negative rates.} \de{Das Ziel von Demographic Parity ist es, den sensiblen Untergruppen das vorteilhaftere Ergebnis in gleichen Raten zuzuweisen~\cite{Dwork2011}. In unserem Beispiel ist das negative Ergebnis (=Klassifikation als legitimer Fall) das vorteilhaftere. Demographic Parity verlangt also negative Entscheidungen zu gleichen Raten für Männer und Frauen. Statistisch betrachtet müssen die Negativraten (NR) beider Untergruppen identisch sein. In der vorliegenden Verteilung (\autoref{table:confusionmatrices_separated}) gilt allerdings für Männer NR=0.42 und für Frauen NR=0.67. Wir stellen also eine Abweichung von 25 Prozentpunkten für das vorteilhaftere Ergebnis zwischen den beiden sensiblen Untergruppen fest. Die Wahrheitsmatrizen in \autoref{table:confusionmatrices_demographicparity} enthalten eine mögliche Verteilung der Ergebnisse eines neuen Modells, das für Demographic Parity optimiert wurde. Die Zahl der negativen Prognosen für Männer ist gestiegen, die Matrix für Frauen bleibt unverändert. Beide Wahrheitsmatrizen weisen jetzt eine NR von 0.67 aus. Insofern wurde Demographic Parity erzielt. Allerdings ist es wenig überraschend, dass die Manipulation der Verteilung der Männer auch Ände\-rungen der Richtig-positiv-Rate und der Richtig-negativ-Rate zur Folge hat.} \begin{table}[ht] \begin{subfigure}{.48\textwidth} \setboolean{NR}{true} \confusionmatrix{3}{9}{9}{15}{$A$=0} \caption{\en{Men}\de{Männer}} \end{subfigure} \hfill \begin{subfigure}{.48\textwidth} \setboolean{NR}{true} \confusionmatrix{6}{3}{3}{15}{$A$=1} \caption{\en{Women}\de{Frauen}} \end{subfigure} \caption{\en{Optimised for Demographic Parity}\de{Optimiert für Demographic Parity}} \label{table:confusionmatrices_demographicparity} \end{table} \subsubsection{Conditional Statistical Parity}\label{ssec:conditional_statistical_parity} \en{This definition extends demographic parity by allowing a set of legitimate factors to affect the prediction. The definition is satisfied if members in both subgroups have equal probabilities of being assigned to the favourable outcome while controlling for a set of legitimate attributes~\cite{Kamiran2013}. In our example, a person's history of prior convictions for fraud could be a legitimate attribute affecting the probability for a claim to be investigated. In this case, an attribute which documents previous attempts of fraud could serve as explaining variable.} \de{Diese Definition erweitert Demographic Parity durch eine Reihe vordefinierter Attribute, deren Einfluss auf die Prognose als legitim betrachtet wird. Das Ziel ist bei dieser Fairnessdefinition erreicht, wenn beide Untergruppen dieselben Chancen auf das vorteilhaftere Ergebnis haben, nachdem die Effekte der legitimen Kontrollvariablen herausgerechnet wurden~\cite{Kamiran2013}. In unserem Beispiel könnten vorherige Betrugsversuche eines Versicherungsnehmers die Wahrscheinlichkeit einer genaueren Untersuchung erhöhen. In diesem Fall wäre ein Attribut, das etwaige frühere Betrugsversuche dokumentiert, eine passende Kontrollvariable.} \subsubsection{Equal Selection Parity}\label{ssec:equal_selection_parity} \en{While demographic parity seeks to obtain equal rates of a positive outcome, proportional towards the group size, the objective of equal selection parity is to have equal absolute numbers of favourable outcomes across the groups, independent of their group sizes~\cite{Saleiro2018}. In the example about fraud detection, this fairness definition would be satisfied if the exact same number of cases were to be identified as legitimate from both groups, even when one group had filed more cases than the other.} \de{Während Demographic Parity gleiche Raten proportional zu den Gruppengrößen anstrebt, ist es das Ziel von Equal Selection Parity, dass jeder Untergruppe das bevorzugte Ergebnis in absoluten Zahlen gleich oft zugeteilt wird – unabhängig von den Gruppengrößen~\cite{Saleiro2018}. Im Beispiel der Betrugserkennung wäre diese Fairnessdefinition erfüllt, wenn für Männer und Frauen die gleiche Anzahl von Schadensfällen als legitim akzeptiert würde, selbst wenn eine Gruppe insgesamt mehr Fälle gemeldet hat, als die andere.} \subsection{\en{Sufficiency}\de{Suffizienz}}\label{ssec:sufficiency} \en{Fairness notions satisfy the statistical concept of sufficiency when the sensitive attribute $A$ is conditionally independent of the true output value $Y$ given the predicted output $\widehat{Y}$. In other words, when considering all positive and negative predictions, the share of correct decisions is equal for both sensitive subgroups. On the individual level this translates to equal chances for individuals with identical predictions but different sensitive attributes to have obtained the right label.} \de{Fairnesskonzepte erfüllen das Prinzip der Suffizienz, wenn das sensible Attribut $A$ bedingt unabhängig von der wahren Klasse $Y$ gegeben die Prognose $\widehat{Y}$ ist. Für die Prognosen einer jeden Klasse gilt also jeweils, dass $A$ von $Y$ unabhängig ist. In anderen Worten: Für alle positiven und alle negativen Vorhersagen ist der jeweilige Anteil korrekter Entscheidungen für beide sensiblen Untergruppen gleich. Auf individueller Basis lässt sich feststellen, dass Personen, die dieselbe Prognose erhalten haben, aber aus unterschiedlichen sensiblen Gruppen stammen, mit der gleichen Wahrscheinlichkeit der richtigen Klasse zugewiesen wurden.} \subsubsection{Conditional Use Accuracy Equality}\label{ssec:conditional_use_accuracy_equality} \en{This fairness definition conditions on the algorithm's predicted outcome, not on the actual outcome~\cite{Berk2016}. In statistical terms this means that the positive predictive value (PPV) and the negative predictive value (NPV) across both groups should be equal. In the context of our example, the objective of this fairness definition is that for the claims which were predicted as fraud, the proportion of correct predictions should be equal across all groups. Likewise, for the claims which were predicted as legitimate, the proportion of correct predictions should be the same.} \de{Entsprechend des Suffizienzkriteriums richtet sich diese Fairnessdefinition an der Prognose des Modells aus~\cite{Berk2016}. Statistisch betrachtet werden der positive Vorhersagewert (PPV) und der negative Vorhersagewert (NPV) für beide Gruppen angeglichen. Im Zusammenhang mit unserem Beispiel heißt das, dass für alle Versicherungsfälle, die als betrügerisch klassifiziert wurden, diese Prognose für beide Untergruppen zu gleichen Teilen korrekt sein sollte. Und für die als legitim eingestuften Fälle sollten diese Entscheidungen entsprechend für beide Gruppen gleichermaßen korrekt sein.} \subsubsection{Predictive Parity}\label{ssec:predictive_parity} \en{Predictive parity is a relaxed version of conditional use accuracy equality which only conditions on the positive predicted outcome~\cite{Chouldechova2016}. Hence, this fairness definition is already satisfied when only the positive predictive value (PPV) is equal for both groups.} \de{Bei Predictive Parity handelt es sich um eine abgeschwächte Form von Conditional Use Accuracy Equality, bei der die bedingte Unabhängigkeit nur den positiven Erwartungswert einschließt~\cite{Chouldechova2016}. Folglich ist diese Fairnessdefinition bereits erfüllt, wenn bloß der positive Vorhersagewert (PPV) für beide Gruppen gleich ist.} \subsubsection{Calibration}\label{ssec:calibration} \en{Calibration is similar to conditional use accuracy equality but instead of the binary output it conditions on the predicted probability score $S$. The objective is again to obtain equal positive and negative predictive values for all sensitive groups~\cite{Crowson2016}. Such a form of calibration across subgroups corresponds to equal probabilities of correct (or incorrect) classification and can therefore be achieved by aligning false discovery and false omission rates. In the context of our example, calibrating the predictions of the classifier would result in equal chances for men and women to get their legitimate claims investigated without cause or to have their fraudulent claims falsely approved. The two confusion matrices in \autoref{table:confusionmatrices_calibration} show the results of the classifier after calibration. The distribution for men was adjusted to match the one for women, which was not modified. Due to the equal base rates in both distributions, this action has also aligned all other statistical measures.} \de{Calibration ist vergleichbar mit Conditional Use Accuracy Equality, wobei als bedingter Erwartungswert anstatt der binären Klassen ein Score $S$ verwendet wird, der die Wahrscheinlichkeit einer Zuordnung zur positiven Klasse ausdrückt. Das Ziel ist wieder, für alle Untergruppen gleiche positive Vorhersagewerte (PPV) und gleiche negative Vorhersagewerte (NPV) zu erreichen~\cite{Crowson2016}. Diese Form von Kalibrierung der Ergebnisse für beide Untergruppen kann mit identischen Wahrscheinlichkeiten einer korrekten (oder inkorrekten) Klassifizierung gleichgesetzt und entsprechend auch über eine Angleichung der Falscherkennungsrate (FDR) und der Falschauslassungsrate (FOR) erreicht werden. Im Rahmen unseres Beispiels hat eine Kalibrierung der Modellvorhersagen zur Folge, dass Männer und Frauen die gleichen Chancen haben, dass ihre eigentlich legitimen Fälle als betrügerisch eingestuft, oder dass unrechtmäßige Fälle fälschlicherweise akzeptiert werden. Die beiden Wahrheitsmatrizen in \autoref{table:confusionmatrices_calibration} enthalten die kalibrierten Ergebnisse. Die Verteilung der Männer wurde angepasst, damit die FDR und die FOR den Werten der Frauen entspricht. Die Verteilung der Frauen wurde nicht verändert. Augrund der zugrundeliegenden identischen Basisraten in beiden Verteilungen hat diese Operation auch alle anderen statistischen Kennzahlen angeglichen.} \begin{table}[ht] \begin{subfigure}{.48\textwidth} \setboolean{FDR}{true} \setboolean{FOR}{true} \confusionmatrix{8}{4}{4}{20}{$A$=0} \caption{\en{Men}\de{Männer}} \end{subfigure} \hfill \begin{subfigure}{.48\textwidth} \setboolean{FDR}{true} \setboolean{FOR}{true} \confusionmatrix{6}{3}{3}{15}{$A$=1} \caption{\en{Women}\de{Frauen}} \end{subfigure} \caption{\en{Optimised for Calibration}\de{Optimiert für Calibration}} \label{table:confusionmatrices_calibration} \end{table} \subsection{\en{Separation}\de{Separierung}}\label{ssec:separation} \en{Fairness definitions satisfy the principle of separation if the sensitive attribute $A$ is conditionally independent of the predicted output $\widehat{Y}$ given the true output value $Y$. This means that among both classes, the proportions of correct predictions are equal per sensitive subgroup. On an individual basis, this condition ensures that two individuals who actually belong to the same class but have different sensitive attributes share the same chance to obtain a correct prediction.} \de{Fairnessdefinitionen erfüllen das Prinzip der Separierung, wenn das sensible Attribut $A$ bedingt unabhängig vom Vorhersagewert $\widehat{Y}$ gegeben die wahre Klasse $Y$ ist. Die Unabhängigkeit zwischen $A$ und $\widehat{Y}$ ist also gegeben, wenn man die wahren Klassen separat betrachtet. Für sie gilt, dass die Anteile der korrekten Vorhersagen für beide sensible Untergruppen gleich sind. Individuell betrachtet garantiert diese Eigenschaft, dass zwei Personen, die zur gleichen Klasse gehören aber Mitglieder von verschiedenen sensiblen Untergruppen sind, die gleiche Chance auf eine richtige Einordnung haben.} \subsubsection{Equalised Odds}\label{ssec:equalised_odds} \en{Another fairness definition called equalised odds aims at equal true positive and true negative rates~\cite{Hardt2016}. The reasoning behind this concept is that the probabilities of being correctly classified should be the same for everyone. In our recurring example, pursuing equalised odds means that the chances for claims to be correctly classified as legitimate or fraudulent should be equal for men and women; the classifier should not be more or less accurate for one of the subgroups. In \autoref{table:confusionmatrices_equalisedodds}, we show a possible outcome for our example after optimising for equalised odds. The results for men have been reshuffled to match the true positive and true negative rates of the women. Since the base rates are equal in both subgroups, all other statistical measures have been aligned, too, by this operation.} \de{Die Fairnessdefinition Equalised Odds erzielt Separierung: Für die wahren Klassen ist jeweils Unabhängigkeit gewährleistet, indem die Richtig-positiv und Richtig-negativ-Raten für die sensible Untergruppen gleich sind~\cite{Hardt2016}. Die Über\-legung hinter diesem Konzept ist, dass die Chancen auf eine korrekte Klassifikation für alle Personen gleich sein sollten. Auf unser wiederkehrendes Beispiel bezogen bedeutet Equalised Odds, dass für Männer und Frauen die Chancen gleich sind, dass ihre Versicherungsfälle zurecht als legitim oder betrügerisch eingeordnet werden; das Prognosemodell sollte nicht für eine Untergruppe mehr oder weniger präzise funktionieren, als für die andere. \autoref{table:confusionmatrices_equalisedodds} zeigt ein mögliches Ergebnis für unsere Beispielverteilungen, das Equalised Odds erfüllt. Die Prognosen für Männer wurden angepasst, damit die Richtig-positiv-Rate (TPR) und die Richtig-negativ-Rate (TNR) denen der Frauen entsprechen. Da beide Gruppen die gleichen Basisraten haben, hat dieser Vorgang zur Folge, dass sich auch die übrigen statistischen Kennzahlen angeglichen haben.} \begin{table}[ht] \begin{subfigure}{.48\textwidth} \setboolean{TPR}{true} \setboolean{TNR}{true} \confusionmatrix{8}{4}{4}{20}{$A$=0} \caption{\en{Men}\de{Männer}} \end{subfigure} \hfill \begin{subfigure}{.48\textwidth} \setboolean{TPR}{true} \setboolean{TNR}{true} \confusionmatrix{6}{3}{3}{15}{$A$=1} \caption{\en{Women}\de{Frauen}} \end{subfigure} \caption{\en{Optimised for Equalised Odds}\de{Optimiert für Equalised Odds}} \label{table:confusionmatrices_equalisedodds} \end{table} \subsubsection{Equalised Opportunities}\label{ssec:equalised_opportunities} \en{Optimising for equalised odds can be a difficult task with more complex, real data, therefore the fairness definition equalised opportunities was proposed as more practicable alternative~\cite{Hardt2016}. In this relaxed version of equalised odds, only the error rates for the positive outcome are required to be equal. In our example, equalised opportunities is achieved when men and women who filed fraudulent claims are exposed at same rates. For legitimate claims, the rates may differ.} \de{Bei komplexen Daten aus echten Anwendungen kann sich das Erzielen von Equalised Odds als schwierig erweisen. Daher wurde die Fairnessdefinition Equalised Opportunities als praktikablere Alternative vorgeschlagen~\cite{Hardt2016}. In dieser abgeschwächten Version von Equalised Odds muss lediglich die Fehlerrate für die positive Prognose identisch sein. Im Beispielkontext ist Equalised Opportunities erfüllt, wenn tatsächlich betrügerische Fälle von Männern und Frauen zu gleichen Raten abgelehnt werden. Für legitime Fälle darf die Rate der akzeptierten Fälle zwischen den beiden Gruppen abweichen.} \subsubsection{Predictive Equality}\label{ssec:predictive_equality} \en{Another relaxation of equalised odds is predictive equality. Here, only the error rates for the negative outcome are required to be equal~\cite{Corbett2017}. In our example, predictive equality is satisfied when men and women can expect their legitimate claims to get classified as legitimate at equal rates. The error rates for fraudulent claims may differ between the subgroups for this fairness definition. As before, the confusion matrix for women in \autoref{table:confusionmatrices_predicitveequality} is unchanged. For men, the output was modified in order to harmonise the false positive rate among the subgroups. The error rates for the unfavourable outcome of being suspect of fraud still deviate depending on the gender.} \de{Eine weitere Abwandlung von Equalised Odds ist Predictive Equality. Hierbei müssen sich nur die Fehlerraten für die negative Prognose entsprechen~\cite{Corbett2017}. In unserem Beispiel ist Predictive Equality erfüllt, wenn Männer und Frauen erwarten können, dass ihre legitimen Versicherungsfälle zu gleichen Raten genehmigt werden. Die Fehlerraten für betrügerische Fälle können indessen bei dieser Fairnessdefinition für die beiden Untergruppen abweichen. Wie zuvor bleibt die Wahrheitsmatrix für Frauen in \autoref{table:confusionmatrices_predicitveequality} unverändert. Für Männer wurde die Verteilung dahingehend angepasst, dass die Falsch-positiv-Rate (TNR) mit der der Frauen übereinstimmt. Die Fehlerraten für das unvorteilhaftere Ergebnis, dass ein Fall nämlich als betrügerisch eingestuft wird, können weiterhin für die beiden Geschlechter abweichen.} \begin{table}[ht] \begin{subfigure}{.48\textwidth} \setboolean{TNR}{true} \confusionmatrix{9}{3}{4}{20}{$A$=0} \caption{\en{Men}\de{Männer}} \end{subfigure} \hfill \begin{subfigure}{.48\textwidth} \setboolean{TNR}{true} \confusionmatrix{6}{3}{3}{15}{$A$=1} \caption{\en{Women}\de{Frauen}} \end{subfigure} \caption{\en{Optimised for Predictive Equality}\de{Optimiert für Predictive Equality}} \label{table:confusionmatrices_predicitveequality} \end{table} \subsubsection{Balance}\label{ssec:balance} \en{All previous fairness notions which aim at satisfying separation took binary outputs as a basis. The balance definition uses the predicted probability score instead and compares the average score for both groups per class. This approach seeks to avoid steadily lower outcomes in one group, which might go unnoticed in the binary case, and instead achieve balanced scores for both groups. Depending on the objective it is possible to balance for the positive or negative class~\cite{Kleinberg2016}.} \de{Alle vorherigen Fairnessdefinitionen, die sich auf das Prinzip der Separierung stützen, haben Prognosen in Form binärer Ausgabewerte verwendet. Bei der Definition Balance werden stattdessen die Wahrscheinlichkeiten zugrunde gelegt, und deren Durchschnittswerte je Klasse für beide Gruppen verglichen. Dieser Ansatz soll verhindern, dass die Prognosen für eine Gruppe systematisch niedriger ausfallen, was im binären Fall eventuell nicht weiter auffallen würde. Stattdessen strebt diese Fairnessdefinition ausgeglichene Ergebnisse auf Basis der gemittelten Wahrscheinlichkeitswerte je Gruppe an. Abhängig vom Anwendungsfall ist es möglich, eine entsprechende Balance für die positive oder für die negative Klasse anzustreben~\cite{Kleinberg2016}.} \section{\en{The Dilemma}\de{Das Dilemma}} \en{Presented with all these different fairness definitions it would be convenient to obtain "complete fairness" – one ultimate solution which satisfies all kinds of fairness at the same time. However, there is mathematical tension across the different fairness definitions, and it has been shown that some of them are actually incompatible with each other in realistic scenarios~\cite{Kleinberg2016,Berk2017,Corbett2018}. In this case, optimising for one metric comes with discounts for another. Taking a closer look this seems obvious considering the links between the fairness definitions and the conditional relations within the confusion matrix: The formulas share some of the cell counts, and the cell counts themselves are related to each other (e.g. the sums across the rows, which represent the numbers of true observations, are fixed). In public, especially the trade-off between \hyperref[ssec:calibration]{\color{olive}{calibration}} and equal false positive and false negative rates (\hyperref[ssec:equalised_odds]{\color{olive}{equalised odds}}) was much discussed. The debate was initiated by a ML algorithm called the "Correctional Offender Management Profiling for Alternative Sanctions", or COMPAS, which had been developed by the company Northpointe, Inc. The objective of the COMPAS algorithm was to generate an independent, data derived "risk score" for several forms of recidivism. This kind of algorithm is used in the criminal justice sector in the US to support the judge with particular decisions such as granting of bail or parole. The score is of informative character and the final decision is still up to the judge. In May 2016, the investigative journalism website ProPublica focused attention on possible racial biases in the COMPAS algorithm~\cite{Angwin2016}. Its main argument was based on analysis of the data which showed that the results were biased. In particular, the false positive rate for people who were black was significantly higher compared to people who were white. As a result, black people were disproportionately often falsely attributed a high risk of recidivism. Northpointe, on the other hand, responded to the accusations by arguing that the algorithm effectively achieved \hyperref[ssec:predictive_parity]{\color{olive}{predictive parity}} for both groups~\cite{Dieterich2016}. In a nutshell, this ensured that risk scores corresponded to probabilities of reoffending, irrespective of any skin colour. From an objective point of view, it can be stated that both parties make valid and reasonable observations of the data. However, the heated public debate revealed that it is unavoidable to precisely define and communicate the desired fairness objective for an application. This decision usually involves arbitration and compromise. For example in the given scenario, calibration and equalised odds could only be mutually satisfied if one of the following conditions was met: Either the base rates of the sensitive subgroups are exactly identical. Or, the outcome classes are perfectly separable which would allow for creating an ideal classifier that achieves perfect accuracy. Unfortunately, both requirements are very unlikely in real world scenarios.} \de{Angesichts all dieser unterschiedlichen Fairnessdefinitionen ist der Wunsch naheliegend, eine Art von "kompletter Fairness" zu finden – eine ultimative Lösung also, die allen Typen von Fairness gleichermaßen gerecht wird. Manche der Fairnessformeln hängen jedoch über gemeinsame Variablen zusammen, und für einige von ihnen wurde mathematisch nachgewiesen, dass es zumindest unter Praxisbedingungen unmöglich ist, sie parallel zu optimieren~\cite{Kleinberg2016,Berk2017,Corbett2018}. Stattdessen bringen Verbesserungen für die eine Fairnessdefinition immer Verschlechterungen für eine andere mit sich. Wenn man die Zusammenhänge zwischen den Fairnessdefinitionen und die konditionalen Beziehungen innerhalb der Wahrheitsmatrix betrachtet, ist der Grund hierfür leicht nachvollziehbar: Die Formeln verwenden mitunter dieselben Zellwerte, und die Zellen selbst stehen in Beziehung zueinander (z.B. sind die Summen der Zeilen, welche die tatsächlichen Vorkommnisse für die jeweilige Klasse darstellen, fix). In der Öffentlichkeit ist vor allem der Kompromiss zwischen kalibrierten Prognosen (\hyperref[ssec:calibration]{\color{olive}{Calibration}}) sowie gleichen Falsch-positiv und Falsch-negativ-Raten (gleichzusetzen mit \hyperref[ssec:equalised_odds]{\color{olive}{Equalised Odds}}) diskutiert worden. Die Debatte wurde durch einen ML-Algorithmus namens "Correctional Offender Management Profiling for Alternative Sanctions", kurz COMPAS, ausgelöst. Dieser war von der Firma Northpointe, Inc. entwickelt worden, und sein Zweck bestand darin, einen unabhängigen, datengestützten "Risikoscore" für verschiedene Formen von Rückfallkriminalität zu ermitteln. Algorithmen dieser Art werden in den USA in der Strafjustiz verwendet, um den Richter oder die Richterin bei bestimmten Entscheidungen wie der Gewährung von Kaution oder Bewährung zu unterstützen. Der Score hat rein informativen Charakter, die finale Entscheidung liegt weiterhin beim Mensch. Im Mai 2016 hat ProPublica, eine Plattform für investigativen Journalismus, mit einem Artikel für Aufsehen gesorgt, der dem COMPAS-Algorithmus rassistische Entscheidungen vorwirft~\cite{Angwin2016}. Das Hauptargument des Berichts stützt sich auf eine Datenanalyse, die Verzerrungen bei den Prognosen feststellt. Insbesondere fiel die Falsch-positiv-Rate für Schwarze deutlich höher aus, als für Weiße. Konkret bedeutet das, dass Schwarzen überproportional häufig Prognosen ausgestellt werden, die zu Unrecht eine erhöhte Rückfälligkeit suggerieren. Northpointe widersprach dem Vorwurf der Diskriminierung mit dem Argument, dass ihr Algorithmus durchaus faire Entscheidungen träfe, indem er \hyperref[ssec:predictive_parity]{\color{olive}{Predictive Parity}} für beide Gruppen erziele: Der Risikoscore gibt also die Wahrscheinlichkeit eines Rückfalls wieder, und das mit gleicher Zuverlässigkeit für beide Gruppen~\cite{Dieterich2016}. Objektiv betrachtet kann festgehalten werden, dass die Argumente beider Seiten richtig und berechtigt sind. Die hitzige Debatte allerdings hat deutlich gemacht, dass es für eine KI-Anwendung unumgänglich ist, die angestrebte Art von Fairness vorab festzulegen und zu kommunizieren. Die Wahl bedarf in der Regel Abwägungen und Kompromisse. Im vorliegenden Fall zum Beispiel könnten Calibration und Equalised Odds theoretisch nur dann gemeinsam erreicht werden, wenn eine der beiden folgenden Konditionen eintritt: Entweder, wenn die beiden Basisraten der Untergruppen exakt identisch sind, oder wenn sich die Klassen perfekt separieren lassen. Letzteres würde nämlich das Erstellen eines idealen, fehlerfreien Prognosemodells möglich machen. Leider sind beide Vorausetzungen unter realen Bedingungen sehr unwahrscheinlich.} \section{\en{Fairness Compass}\de{Der Fairness Compass}} \en{Based on the limitations explained in the previous section, we conclude that it is crucial to consciously identify the most appropriate fairness definition for every single use case. To support AI stakeholders with this task, we propose the "Fairness Compass", a schema in form of a decision tree which simplifies the selection process. By settling for the desired ethical principles in a formalised way, this schema not only makes identifying the most appropriate fairness definition a straightforward procedure, but it also helps document the underpinning decisions which may serve as deeper explanations to the end user why a specific fairness objective was chosen for the given application. In this section, we first explain the general intended usage and then deep dive into the key decision points. Finally, we provide some technical specifications and outline how we hope to see this project evolve.} \de{Aufgrund der im vorherigen Kapitel beschriebenen Einschränkungen sollte beim Einsatz von Künstlicher Intelligenz für jeden Anwendungsfall vorab sorgfältig die passende Definition von Fairness ausgewählt werden. Um KI-Entscheider in dieser Aufgabe zu unterstützen, haben wir den "Fairness Compass" entwickelt: ein Schema in Form eines Entscheidungsbaums, das den Auswahlprozess systematisch vereinfacht. Dabei hilft die Struktur, die ethischen Grundprinzipien für eine Anwendung festzulegen und die jeweiligen Argumente zu dokumentieren. Im Ergebnis formalisiert dieses Tool den Entscheidungsprozess und ermöglicht es so, die Wahl der implementierten Art von Fairness beispielsweise dem Verbraucher detailliert zu begründen. In diesem Kapitel beschreiben wir zunächst die allgemeine Anwendung des Tools und erläutern dann die Knotenpunkte des Entscheidungsbaums im Einzelnen. Schließlich erklären wir einige technische Einzelheiten und führen aus, wie sich dieses Projekt weiterentwickeln könnte.} \subsection{\en{Usage}\de{Anwendung}} \en{Primarily, the tool consists of the decision tree in \autoref{fig:flow_chart} which formalises the decision process. There are three different types of nodes: The diamonds symbolise decision points, the white boxes stand for actions and the grey boxes with round corners are the fairness definitions. The arrows which connect the nodes represent the possible choices. For increased usability, the schema is also available as interactive \href{https://axa-rev-research.github.io/fairness-compass.html}{online tool\footnote{https://axa-rev-research.github.io/fairness-compass.html}}. In this version, tooltips with extended information, examples and references facilitate navigating the tree. Furthermore, the interactive online tool can be used to document the decision-making process for a specific application. The decision path can be highlighted in the diagram and the reasoning behind each decision can be added in the form of tooltips. In this way, the tool not only serves the AI stakeholders for decision-making but also as means of communication with the users. Due to the general complexity of the topic and the need for context-dependent solutions, we argue that sharing details with the broader audience when specifying fairness for a given use case is the best way forward to maintain confidence in AI systems.} \de{In erster Linie besteht das Tool aus dem Entscheidungsbaum in \autoref{fig:flow_chart}, der den Auswahlprozess beschreibt. Das Diagramm enthält drei verschiedene Arten von Symbolen: die Rauten stellen die Entscheidungspunkte dar, die weißen Boxen sind Aktionsfelder, und die grauen Boxen mit runden Ecken symbolisieren die jeweiligen Fairnessdefinitionen. Die Pfeile, welche die Symbole verbinden, repräsentieren die Wahlmöglichkeiten. Um die Nutzbarkeit zu vereinfachen ist das Schema auch als interaktives \href{https://axa-rev-research.github.io/fairness-compass.html}{Online Tool\footnote{https://axa-rev-research.github.io/fairness-compass.html}} verfügbar. In dieser Version kann man den Entscheidungsbaum leichter erkunden, da sich Tooltips mit weiterführenden Informationen, Beispielen und Referenzen einblenden lassen. Das interaktive Tool bietet sich außerdem dazu an, den Entscheidungsprozess für einen bestimmten Anwendungsfall hervorzuheben, und die Begründung für jede Entscheidung in Form von Tooltips zu hinterlegen. Auf diese Weise nützt das Tool nicht nur KI-Verantwortlichen bei der Entscheidungsfindung, sondern es eignet sich auch als Mittel, dem Verbraucher diese Entscheidung zu erklären. KI-Systeme fair zu gestalten ist ein vielschichtiges Thema und bedarf kontextbezogener Lösungen. Wir sind daher überzeugt, dass die breitere Öffentlichkeit in die Details einbezogen werden sollte, um das Vertrauen in KI-gestützte Anwendungen langfristig zu stärken.} \afterpage{% \begin{figure}[p] \thispagestyle{empty} \vspace*{-3.5cm} \makebox[\linewidth]{ \en{\includegraphics[width=1.50\linewidth]{images/fairness_compass.pdf}} \de{\includegraphics[width=1.50\linewidth]{images/fairness_compass_de.pdf}} } \vspace*{-0.85cm} \caption{\en{Proposed schema to structure the complex landscape of fairness\\ definitions for classification. Decision tree also available as \href{https://axa-rev-research.github.io/fairness-compass.html}{online tool}. } \de{Schema zur Strukturierung des komplexen Angebots von Fairnessdefinitionen für Klassifizierungsprobleme. Auch als \href{https://axa-rev-research.github.io/fairness-compass.html}{Online Tool} abrufbar. }} \label{fig:flow_chart} \end{figure} \clearpage } \subsection{\en{Key Decision Nodes}\de{Entscheidungspunkte}} \en{In the following, we present the major questions we have identified in order to distinguish between the available fairness definitions. We describe each of them and provide practical examples.} \de{Im Folgenden präsentieren wir Kernfragen, die wir identifiziert haben, um zwischen den vorhandenen Fairnessdefinitionen zu unterscheiden. Wir beschreiben jeden Punkt im Einzelnen und ergänzen die Ausführungen mit praktischen Beispielen.} \subsubsection{\en{Policy}\de{Richtlinien}}\label{ssec:policy} \en{Fairness objectives can go beyond equal treatment of different groups or similar individuals. If the target is to bridge prevailing inequalities by boosting underprivileged groups, affirmative actions or quotas can be valid measures. Such a goal may stem from law, regulation or internal organisational guidelines. This approach rules out any possible causality between the sensitive attribute and the outcome. If the data tells a different story in terms of varying base rates across the subgroups, this is a strong commitment which leads to subordinating the algorithm's accuracy to the policy's overarching goal. In any case, this decision limits the options to fairness definitions which hold the statistical principle of independence (\autoref{ssec:independence}). For example, many universities aim to improve diversity by accepting more students from disadvantaged backgrounds. Such admission policies acknowledge an equally high academic potential of students from sensitive subgroups and considers their possibly lower level of education rather an injustice in society than a personal shortcoming.} \de{Zielvorgaben für Fairness können über bloße Gleichbehandlung unterschiedlicher Gruppen oder ähnlicher Individuen hinausgehen. Wenn angestrebt wird, benachteiligte Gruppen direkt zu fördern, um bestehende Ungerechtigkeiten auszugleichen, können Maßnahmen wie "positive Diskriminierung" oder Quoten adäquate Mittel sein. Ein derartiges Ziel kann sich von Gesetzen, Vorgaben von Regulierungsbehörden oder internen Richtlinien einer Organisation ableiten. Dieser Ansatz schließt jeglichen kausalen Zusammenhang zwischen dem sensiblen Attribut und dem Vorhersagewert aus. Falls die vorliegenden Daten in Form von unterschiedlichen Basisraten ein anderes Bild zeichnen, ist das ein starkes Bekenntnis, welches die mathematische Genauigkeit des Algorithmus dieser Überzeugung unterordnet. Wird dieser Entscheidungspunkt bejaht, reduzieren sich die verbleibenden Optionen auf jene Fairnessdefinitionen, die das Prinzip statistischer Unabhängigkeit erfüllen (\autoref{ssec:independence}). Zum Beispiel haben es sich viele Universitäten zum Ziel gesetzt, ihre Diversität zu erhöhen, indem sie Studenten und Studentinnen aus benachteiligten Verhältnissen bevorzugt Studienplätze anbieten. Eine derartige Zulassungspolitik gesteht diesen Menschen das gleiche akademische Potential wie Studierenden aus privilegierten Kreisen zu, und macht für ihren eventuell niedrigeren Bildungsstand vielmehr gesellschaftliche Missstände als persönliches Versagen verantwortlich.} \subsubsection{\en{Type of Representation}\de{Art der Repräsentation}}\label{ssec:type_of_representation} \en{If the decision node about policies from the previous section was answered with yes, particular emphasis is placed on equal representation of the sensitive subgroups. In this case, two different types of representation exist: equal numbers, regardless of the sizes of the subgroups; or proportional equality. Let's assume a recruitment scenario, for example, where ten women and two men applied for a job. Inviting two women and two men for an interview would satisfy gender fairness based on equal numbers. For proportional equality, it would be necessary to invite five women and one man.} \de{Wenn die Entscheidung im vorangegangen Punkt zur Beachtung von Richtlinien positiv ausgefallen ist, wird ein besonderer Schwerpunkt auf die ausgewogene Vertretungen der sensiblen Untergruppen gelegt. In diesem Fall gibt es zwei verschiedene Arten von Repräsentation: gleiche Anzahl, unabhängig von den Größen der Untergruppen; oder proportionale Vertretung. Beispielsweise angenommen, auf eine Stellenausschreibung bewerben sich zehn Frauen und zwei Männer. In Bezug auf das Geschlecht wäre eine Vertretung in gleicher Anzahl gegeben, wenn zwei der Frauen sowie die beiden Männer zum Vorstellungsgespräch eingeladen würden. Um eine proportionale Vertretung zu gewährleisten, müssten fünf Frauen und ein Mann eingeladen werden.} \subsubsection{\en{Base Rates}\de{Basisraten}}\label{ssec:base_rates} \en{Provided there is no policy in place which determines further proceedings, the next crucial question to settle concerns the base rate. This measure was already briefly introduced and it constitutes the proportion of actual positives or actual negatives of the entire data set (recapped in \autoref{fig:base_rate}). Across subgroups, the base rate can be equal, or it can be different. In case of varying rates, it is necessary to decide if the fairness definition should reflect this discrepancy or not. The former is the case when it is legitimate to assume a causal relationship between the group membership and the base rate, and the fairness definition is supposed to take this into account. The latter would be appropriate if there is no rational reason per se to believe that the groups perform differently, and the origin of the different base rates is rather to be found in the data collection process or other data related reasons. Yet another reason to choose equal rates as a basis, even though the data suggest otherwise, is when the discrepancy is considered to originate from historical discrimination. If the fairness objective is meant to make up for such social injustice in the past, assuming equal base rates helps to push the underprivileged group. In \cite{Friedler2016}, this question is formalised as two opposing worldviews: The worldview \emph{what you see is what you get (WYSIWYG)} assumes the absence of structural bias in the data. Accordingly, this view supposes that any statistical variation in different groups actually represents deviating base rates which should get explored. On the other hand, the worldview \emph{we're all equal (WAE)} presupposes equal base rates for all groups. Possible deviations are considered as unwanted structural bias that needs to get corrected. If base rates are assumed or expected to be equal across subgroups, only fairness definitions which satisfy independence (\autoref{ssec:independence}) remain eligible. Otherwise, if the implemented fairness is to reflect the different base rates, definitions which hold sufficiency or separation (subsections~\ref{ssec:sufficiency} and \ref{ssec:separation}) are to be considered. In a medical scenario, the base rates for women and men to suffer from diabetes are equal, while 99\% of breast cancer occurs in women. A fair diagnostic application should acknowledge this discrepancy. In a college admission scenario, however, different base rates in admission exams across different ethnic groups could be attributed to unequal opportunities. If the declared objective of the fairness definition is to correct such social injustice, choosing equal base rates can be a suitable approach.} \begin{figure}[] \centering \begin{tabular}{ m{6em} m{4em} } $BR=\frac{P}{P+N}$ & \includegraphics[height=0.15\textwidth]{images/br.pdf} \end{tabular} \caption{\en{Formula and graphical representation of the (positive) base rate}\de{Formel und grafische Darstellung der (positiven) Basisrate}} \label{fig:base_rate} \end{figure} \de{Vorausgesetzt es sind keine Richtlinien zu befolgen, die eine repräsentative Verteilung vorschreiben, dann betrifft die nächste Frage die Basisrate. Diese statistische Kennzahl wurde bereits eingeführt und beschreibt den Anteil der tatsächlich positiven oder negativen Fälle vom gesamten Datensatz (wiederholt in \autoref{fig:base_rate}). Zwischen den Untergruppen kann die Basisrate gleich ausfallen, oder sie kann abweichen. Wenn die Raten abweichen muss entschieden werden, ob die Fairnessdefinition diesen Unterschied reflektieren soll, oder nicht. Der erste Fall ist gegeben, wenn es einen berechtigten Grund zur Annahme gibt, dass ein Kausalzusammenhang zwischen der Gruppenzugehörigkeit und der Basisrate besteht, und die Fairnessdefinition diesen Effekt berücksichtigen soll. Der zweite Fall gilt, wenn es keine rationale Erklärung gibt, warum die beiden Gruppen grundsätzlich unterschiedliche Ergebnisse liefern sollten. Dann wird die Ursache vielmehr beim Datenerhebungsverfahren vermutet, oder auf andere datenbezogene Aspekte zurückgeführt. Ein weiterer Anlass, von gleichen Basisraten auszugehen, obwohl die Daten andere Rückschlüsse zulassen, liegt vor, wenn für die Abweichung soziale Diskriminierung in der Vergangenheit verantwortlich gemacht wird. Soll die gewünschte Fairnessdefinition eine derartige historische Ungerechtigkeit ausgleichen helfen, stärkt es die Position der unterprivilegierten Gruppe, wenn trotzallem von gleichen Basisraten ausgegangen wird. In \cite{Friedler2016} wird diese Frage als zwei gegensätzliche Weltanschauungen definiert: Die Weltanschauung \emph{What you see is what you get (WYSIWYG)} nimmt an, dass keine strukturellen Verzerrungen in den Daten existieren. Entsprechend geht diese Theorie davon aus, dass statistische Abweichungen in den Basisraten für das Prognosemodell von Relevanz sind und berücksichtigt werden müssen. Dem gegenüber steht die Weltanschauung \emph{We're all equal (WAE)}, welche grundsätzlich gleiche Basisraten für alle Gruppen vermutet. Etwaige Abweichungen werden als unerwünschte, strukturelle Verzerrungen interpretiert, die es zu korrigieren gilt. Wenn davon ausgegangen wird, dass die Basisraten aller Untergruppen identisch sind, kommen als Fairnessdefinitionen nur jene in Frage, die das Prinzip der unbedingten statistischen Unabhängigkeit erfüllen (\autoref{ssec:independence}). Anderenfalls, wenn die zu implementierende Fairness die unterschiedlichen Basisraten widerspiegeln soll, kommen Fairnessdefinitionen, die Suffizienz oder Separierung erfüllen (Unterabschnitte~\ref{ssec:sufficiency} und \ref{ssec:separation}) in Betracht. In einem medizinischen Kontext zum Beispiel kann festgestellt werden, dass die Basisraten für Männer und Frauen, die an Diabetes leiden, etwa gleich sind, wohingegen Brustkrebs in 99\% der Fällen bei Frauen auftritt. Eine faire Diagnoseanwendung sollte diesen Unterschied berücksichtigen. Bei Zulassungstests im Rahmen einer Studienplatzvergabe hingegen könnten unterschiedliche Basisraten bei verschiedenen ethnischen Gruppen auf Chancenungleichheiten zurückzuführen sein. Besteht der Anspruch, soziale Ungerechtigkeit auszugleichen, kann hier der passende Ansatz sein, trotzdem gleiche Basisraten anzusetzen.} \subsubsection{Ground Truth}\label{ssec:ground_truth} \en{Machine learning algorithms are trained by example. The assumption is that the labels of the training data represent the true output, they constitute the supposed ground truth. As the labels serve as reference to estimate the model's accuracy, but also to satisfy a fairness metric when this one is conditioning on the label, the availability of a reliable ground truth makes a significant difference. Depending on the scenario, the ground truth may not exist or it may exist but not be available. When the correct outcome can be observed, the ground truth exists, and when the labels result from objective measurements or describe indisputable facts, the truth is easily accessible. In other cases, the correct outcome may not be directly measurable, but it is still unambiguously observable by humans who can perform annotation tasks with sufficient diligence to produce reliable labels. Sometimes, the ground truth does not exist. In such a scenario, labels are only inferred and represent subjective human decisions based on experience, and they may contain human bias. When the ground truth is not available, and it cannot be produced in a trustworthy way neither, it is not recommended to select fairness definitions which rely on the true output value as is the case for the separation principle (\autoref{ssec:separation}). Under these conditions, it is rather advisable to choose from fairness definitions which satisfy independence (\autoref{ssec:independence}) and do not condition on the training label. In a medical scenario, it is possible to conclusively clarify if a tumour is benign or malignant by taking a biopsy and performing a laboratory examination. Hence, the ground truth is available. In an image recognition application which helps classify animals, humans can make training data of good quality available by manually labelling the different species. When predicting recidivism, the ground truth is not immediately available since a possible new criminal offence would take place in the future and may not even be caught.} \de{ML-Algorithmen lernen von Beispielen. Dabei wird vorausgesetzt, dass die Label der Trainingsdaten den wahren Ausgabewert repräsentieren – sie stellen die sogenannte \textit{Ground Truth} dar. Da diese Label auch zur Bewertung der Genauigkeit des Prognosemodells herangezogen werden, und sogar eine Referenz für das Fairnessmaß abgeben, falls die gewählte Fairnessdefinition das Label bedingt, spielt die Präsenz einer verlässlichen Ground Truth eine erhebliche Rolle. Abhängig vom Anwendungsfall kann es allerdings vorkommen, dass keine Ground Truth vorhanden ist, oder dass diese zwar existiert, aber nicht direkt zugänglich ist. Wenn sich das wahre Ergebnis beobachten lässt, besteht eine Ground Truth, und wenn die Label zum Beispiel objektive Messungen oder eindeutige Fakten darstellen, ist der Zugriff meistens nicht weiter schwierig. In anderen Fällen kann das korrekte Ergebnis zwar nicht maschinell erfasst werden, aber es kann von Menschen dennoch eindeutig beobachtet werden, die per sorgfältiger, manueller Zuordnung ausreichend verlässliche Label erzeugen können. Manchmal jedoch ist auch keine Ground Truth vorhanden. Unter diesen Umständen werden die Label abgeleitet und basieren auf menschlichen Entscheidungen, die auf subjektiver Erfahrung beruhen. Solche Label sind möglicherweise vorurteilbehaftet. Ist keine Ground Truth vorhanden, und lässt sich diese auch nicht auf verläss\-liche Weise erschließen, dann reduzieren sich die Auswahlmöglichkeiten. Fairnessdefinitionen, die das Prinzip der Separierung (\autoref{ssec:separation}) erfüllen und die wahre Klasse bedingen, sind in diesem Fall nicht zu empfehlen. Stattdessen kommt eher eine Fairnessdefinition in Frage, die das Prinzip der Unabhängigkeit erfüllt (\autoref{ssec:independence}) und keine Trainingslabel voraussetzt. In einem medizinischen Szenario kann für einen Tumor mithilfe einer Biopsie und anschließender Laboruntersuchung abschließend geklärt werden, ob er gut- oder bösartig ist. Die Ground Truth ist also verfügbar. In einer Bilderkennungssoftware wiederum, die Tierarten spezifizieren soll, können menschliche Experten Fotos manuell annotieren und so Trainingsdaten von guter Qualität erzeugen. Soll allerdings die Rückfallkriminalität vorhergesagt werden, ist keine Ground Truth unmittelbar verfügbar, da mögliche neue Straftaten erst in der Zukunft stattfinden, und außerdem gar nicht jedes Verbrechen aktenkundig wird.} \subsubsection{\en{Explaining Variables}\de{Erklärende Variablen}}\label{ssec:explaining_variables} \en{The data may contain variables which are considered legitimate sources of discrepancy. If some kind of inequality between the groups can be shown to stem from those variables, this sort of discrimination can be considered explainable and accepted~\cite{Kamiran2013}. Let's suppose salary ranges are to be estimated for job applicants. However, the training data show that one group works fewer hours on average than the other. In this case, a variable \emph{working\_hours} could serve as an explaining variable.} \de{Unter Umständen gibt es Attribute, die als legitime Quelle für Unterschiede in den Daten betrachtet werden können. Wenn aufgezeigt werden kann, dass eine Verzerrung in den Daten zwischen den Untergruppen auf diese Variablen zurückzuführen ist, kann dieser Unterscheid begründet und die Abweichung akzeptiert werden~\cite{Kamiran2013}. Angenommen es sollen Gehaltsklassen für Jobbewerber geschätzt werden. Im vorliegenden Datensatz arbeitet eine Gruppe aber im Durchschnitt weniger Arbeitsstunden als die andere. Dann könnte ein Attribut \emph{working\_hours} als erklärende Variable dienen.} \subsubsection{\en{Label Bias}\de{Verzerrte Label}}\label{ssec:label_bias} \en{When no ground truth exists and the available labels are based on decisions which were inferred by humans, they may contain human bias. As the labels serve as reference to estimate the model's accuracy but also to satisfy a fairness metric when this one is based on classification rates, it is crucial to mitigate this potential source of bias, possibly using a label correction framework~\cite{Wick2019, Jiang2019}. If such action does not yield satisfying results, the ground truth is missing and therefore the same reasoning as before applies: It is not recommendable to use fairness definitions which condition on the true output value but rather choose from the ones which hold independence (\autoref{ssec:independence}). For example, if software is to learn to describe photos with words, then humans generate the training data by tagging sample images. This task allows for a certain degree of creative freedom, for example in the selection of objects or their description. Especially if this activity is performed by only a small group of people, the training data may include human bias.} \de{Wenn die Ground Truth nicht direkt zugänglich ist, und die vorhandenen Label von Menschen manuell zugeordnet wurden, besteht das Risiko, dass die so erhobenen Daten gewisse Verzerrungen enthalten. Die Label werden zur Bestimmung der Genauigkeit des Prognosemodells herangezogen, und spielen auch für die Bewertung der Fairness eine Rolle, falls deren Definition die Label berücksichtigt. Daher ist es entscheidend, möglichen Quellen von Verzerrung entgegenzuwirken, zum Beispiel mit einem Labelkorrektur-Framework~\cite{Wick2019, Jiang2019}. Sollte dieser Vorgang keine zufriedenstellenden Ergebnisse liefern, ist keine belastbare Ground Truth vorhanden, und es gilt die gleiche Argumentation wie zuvor: Es ist nicht ratsam, eine Fairnessdefinition zu verwenden, welche sich auf den wahren Ausgabewerte stützt, sondern besser eine Definition zu wählen, die das Prinzip der Unabhängigkeit erfüllt (\autoref{ssec:independence}). Wenn zum Beispiel eine Software lernen soll, Fotos mit Worten zu beschreiben, dann erzeugen Menschen die zugehörigen Trainingsdaten, indem sie Beispielbilder verschlagworten. Diese Aufgabe lässt einen gewissen kreativen Freiraum zu, etwa durch die Auswahl der Objekte, oder deren Bezeichnung. Insbesondere wenn diese Tätigkeit nur von einer kleinen Gruppe Menschen ausgeübt wird, können sich in den Trainingsdaten Verzerrungen niederschlagen.} \subsubsection{\en{Precision and Recall}\de{Relevanz und Sensitivität}}\label{ssec:evaluation_metric} \en{After concluding that some sort of reliable ground truth is available, a well-known problem in machine learning needs to be tackled: the trade-off between precision and recall. Precision describes the fraction of positively predicted instances which were actually positive, previously introduced as positive predictive value (PPV). Recall is the fraction of actual positive instances which were correctly identified as such, also defined as true positive rate (TPR) earlier in this document. \autoref{fig:precision_recall} brings back the two formulas in a graphical representation. The question to be addressed here is which of the two metrics is more sensitive to fairness in the given use case. A general rule is that when the consequences of a positive prediction have a negative, punitive impact on the individual, the emphasis with respect to fairness often is on precision. When the result is rather beneficial in the sense that the individuals are provided help they would otherwise forgo, fairness is often more sensitive to recall. The answer to this decision node also determines to which of the two remaining categories the ultimate fairness definition will belong to: If the focus is on equal precision rates for the sensitive subgroups, the final definition will condition on the predicted output and therefore hold sufficiency (\autoref{ssec:sufficiency}). Otherwise, if the focus is on equal recall rates, the resulting fairness definition will condition on the true output and satisfy separation (\autoref{ssec:separation}). In a fraud detection scenario where insurance claims are to be investigated it could be considered fair to limit the number of wrongly suspected cases and therefore maximise precision at equally high level for all subgroups. In a loan approval scenario, the focus regarding fairness could be on recall, that is, approving an equally high level of loans to creditworthy applicants across all groups.} \de{Wenn feststeht, dass eine ausreichend verlässliche Ground Truth vorhanden ist, muss als nächstes über ein bekanntes Problem beim Maschinellen Lernen entschieden werden: der Kompromiss zwischen Relevanz und Sensitivität. Relevanz (\textit{precision}) beschreibt den Anteil der positiven Vorhersagen, der korrekt ist – zuvor eingeführt als positiver Vorhersagewert (PPV). Sensitivität (\textit{recall}) beschreibt den Anteil der tatsächlich positiven Fälle, der korrekt vorhergesagt wurde – in diesem Bericht auch als Richtig-Positiv-Rate (TPR) bezeichnet. In \autoref{fig:precision_recall} stellen wir beide Kennzahlen erneut mathematisch und symbolisch dar. Zu klären ist nun, welches der beiden Maße für den gegebenen Anwendungsfall in Bezug auf die Fairness eine kritischere Rolle spielt. Als Faustregel gilt, dass wenn die Konsequenzen für den oder die Betroffene im Zweifelsfall eine negative, strafende Auswirkung haben, dann der Schwerpunkt bezüglich Fairness auf der Relevanz liegen sollte. Ist das Ergebnis im besten Fall vielmehr vorteilhaft, im Sinne von Unterstützung, auf die die Person sonst verzichten müsste, dann ist oft der Aspekt der Sensitivität wesentlicher in puncto Fairness. Die Antwort auf diese Frage legt fest, aus welcher der verbleibenden beiden Kategorien die endgültige Fairnessdefinition stammen wird: Wenn der Schwerpunkt auf gleichen Relevanzraten für beide Untergruppen liegt, dann wird die Fairnessdefinition auf der vorhergesagten Klasse beruhen, und folglich dem Prinzip der Suffizienz genügen (\autoref{ssec:sufficiency}). Anderenfalls, wenn der Fokus auf der Sensitivität liegt, wird die resultierende Fairnessdefinition auf der wahren Klasse basieren und das Separierungs-Prinzip erfüllen (\autoref{ssec:separation}). In einem Anwendungsfall, bei dem es um Betrugserkennung bei Versicherungsfällen geht, könnte man es als oberstes Fairnessziel betrachten, die Zahl der zu Unrecht als betrügerisch eingeordneten Fälle zu minimieren und für beide Untergruppen die Relevanzraten gleich niedrig zu halten. In einem Kreditvergabeszenario hingegen könnte der Fokus in Bezug auf Fairness bei der Sensitivität liegen. Das hieße, kreditwürdigen Bewerbern und Bewerberinnen aus beiden Untergruppen sollten ihre Anträge zu gleich hohen Raten bewilligt werden.} \begin{figure}[h] \centering \begin{subfigure}{.49\textwidth} \centering \begin{tabular}{ m{7em} m{3em} } $PPV=\frac{TP}{TP+FP}$ & \includegraphics[height=0.3\textwidth]{images/ppv.pdf} \end{tabular} \caption{\en{Precision}\de{Relevanz}} \end{subfigure} \begin{subfigure}{.49\textwidth} \centering \begin{tabular}{ m{6em} m{3em} } $TPR=\frac{TP}{P}$ & \includegraphics[height=0.3\textwidth]{images/tpr.pdf} \end{tabular} \caption{\en{Recall}\de{Sensitivität}} \end{subfigure} \caption{\en{Formulas and graphical representations of precision and recall}\de{Formeln und symbolische Darstellung beider Metriken}} \label{fig:precision_recall} \end{figure} \subsubsection{\en{Output Type}\de{Ausgabearten}}\label{ssec:output_type} \en{A more practical than ethical question, but nonetheless relevant to determining the ultimate fairness definition, is that of the desired output type. A score is a continuous value, often between 0 and 1, which can represent the probability for the positive class to be true. When the output is a label instead, the result is an unambiguous decision for one of the classes. For example in a loan approval scenario, a score is often preferred because the value of the score leaves the "human in the loop" some room for interpretation. However, when the result is automatically processed, for example in an online marketing scenario, the class label may be the preferred output type.} \de{Eine mehr praktische als ethische Frage, aber dennoch relevant um die finale Fairnessdefinition zu wählen, ist jene nach der gewünschten Ausgabeart. Ein Score ist ein kontinuierlicher Wert. Oftmals liegt er zwischen 0 und 1, und beschreibt dann die Wahrscheinlichkeit, dass der gegebene Fall der positiven Klasse angehört. Ist die Ausgabeart stattdessen ein Label, entspricht das Ergebnis eindeutig einer der beiden Klassen. In einem Kreditvergabeszenario wird oft ein Score bevorzugt, weil sein Wert mehr Interpretationsspielraum für den Mensch lässt, der die finale Entscheidung trifft. Wird das Ergebnis allerdings automatisch weiterverarbeitet, zum Beispiel in einem Online-Marketing Szenario, könnten Klassenlabel als Ausgabeart sinnvoller sein.} \subsubsection{\en{Error Types}\de{Fehlerarten}}\label{ssec:error_types} \en{Eventually, the final decision depends on which error types are considered most sensitive to fairness for the use case. The different error types to take into account are the false positive and the false negative rate (as introduced earlier and recapped in \autoref{fig:false_positive_and_false_negative_rates}). Both represent measures of misclassification, but based on the use case, one error type may be more sensitive to fairness than the other. Generally, the goal for high-risk applications is to keep positive and negative classification rates equal for all groups. For low-risk applications the fairness objective could be weakened by accepting a manageable degree of extra risk in order to increase utility of the metric~\cite{Hardt2016}. For better clarity, it may be helpful to enhance the confusion matrix (see \autoref{ssec:statistical_measures}) by the expected benefits and harms in order to visualise the consequences of correct or false classification scenarios and weight the error types accordingly. In an online marketing scenario where a job offer is supposed to be shown to men and women of relevant profiles, differences in false positive rates (showing the ad to people who are not eligible) across the groups may be acceptable as long as the fractions of people with relevant profiles are equal. On the other hand, in a face recognition application both error types should be equally low for all sorts of skin types.} \de{Die letzte Entscheidung betrifft schließlich die Frage, welche Fehlerart im gegebenen Anwendungsfall eine höhere Priorität bezüglich Fairness hat. Die unterschiedlichen zu berücksichtigenden Fehlerarten sind die Falsch-positiv und die Falsch-negativ-Rate (wie bereits etwas früher eingeführt und in \autoref{fig:false_positive_and_false_negative_rates} rekapituliert). Beide Kennzahlen bemessen Fehlklassifikation, abhängig vom Einsatzgebiet kann eine Fehlerart allerdings eine bedeutsamere Rolle beim Erreichen von Fairness haben, als die andere. Generell gilt, dass für Hochrisiko-Anwendungen sowohl die Falsch-positiv als auch die Falsch-negativ-Rate für alle Gruppen auf gleichem Niveau gehalten werden sollte. Für weniger sicherheitskritische Anwendungen könnte das Fairnessziel zugunsten erhöhter technischer Flexibilität etwas abgeschwächt werden, indem ein überschaubares zusätzliches Risiko in Kauf genommen wird~\cite{Hardt2016}. Um in dieser Angelegenheit einen besseren Überblick zu haben, kann es nützlich sein, die Wahrheitsmatrix (siehe \autoref{ssec:statistical_measures}) um eine Beschreibung der Ereignisse im Fehlerfall zu ergänzen. So lassen sich die Konsequenzen einer korrekten oder inkorrekten Einordnung vor Augen führen und entsprechend gewichten. In einem Online-Marketing Szenario, wo eine Stellenanzeige Männer und Frauen mit relevanten Profilen eingeblendet werden soll, mögen Unterschiede in der Falsch-positiv-Rate (die Anzeige also Menschen zu zeigen, die eigentlich nicht für die Stelle in Frage kommen) zwischen den Untergruppen verkraftbar sein, solange die Anteile der Leute mit relevanten Profilen gleichermaßen hoch sind. Bei einer Gesichtserkennungssoftware andererseits sollten beide Fehlerarten für sämtliche Hauttypen gleich niedrig sein.} \begin{figure}[h] \centering \begin{subfigure}{.49\textwidth} \centering \begin{tabular}{ m{6em} m{3em} } $FPR=\frac{FP}{N}$ & \includegraphics[height=0.3\textwidth]{images/fpr.pdf} \end{tabular} \caption{\en{False positive rate}\de{Falsch-positiv-Rate}} \end{subfigure} \begin{subfigure}{.49\textwidth} \centering \begin{tabular}{ m{6em} m{3em} } $FNR=\frac{FN}{P}$ & \includegraphics[height=0.3\textwidth]{images/fnr.pdf} \end{tabular} \caption{\en{False negative rate}\de{Falsch-negativ-Rate}} \end{subfigure} \caption{\en{Formulas and graphical representations of error rates}\de{Formeln und symbolische Darstellungen der Fehlerarten}} \label{fig:false_positive_and_false_negative_rates} \end{figure} \subsection{\en{Sample Application}\de{Beispielanwendung}} \en{We apply the "Fairness Compass" on our running sample scenario about fraud detection in insurance claims. Thanks to our online tool, it becomes a straightforward and transparent task to provide a possible chain of arguments (see \href{https://axa-rev-research.github.io/fairness-fraud-study.html}{online resource\footnote{https://axa-rev-research.github.io/fairness-fraud-study.html}}). Please note that this example remains a thought experiment. For the same scenario, other considerations with different outcomes are possible. The purpose of the "Fairness Compass" is not to impose one solution but to assist with the decision making and to underpin the result.} \de{Wir testen den "Fairness Compass" für unser wiederkehrendes Beispiel zur Betrugserkennung bei Versicherungsfällen. Mit unserem interaktiven Tool lässt sich die Entscheidungsfindung für die Wahl einer Fairnessdefinition einfach und transparent darstellen (siehe \href{https://axa-rev-research.github.io/fairness-fraud-study.html}{Online-Tool\footnote{https://axa-rev-research.github.io/fairness-fraud-study.html}}). Wohlgemerkt handelt es sich bei diesem Beispiel um ein Gedankenexperiment. Für dasselbe Szenario sind verschiedene Argumente denkbar, die zu einem anderen Ergebnis führen. Der Zweck des "Fairness Compass" ist nicht, eine Lösung vorzuschreiben, sondern vielmehr die Entscheidungsfindung zu strukturieren und das Ergebnis argumentativ zu rechtfertigen.} \subsection{\en{Future Development}\de{Weitere Entwicklung}} \en{Research in fair machine learning is constantly advancing, new types of fairness definitions may evolve and the general debate on fairness will move on. To anticipate those future developments, our technical architecture puts easy expandability and adaptability at the centre. The online tool was realised using the free online diagram software \href{https://www.diagrams.net/}{diagrams.net}. We used it to design the tree and to publish it online. The schema is encoded in XML which allows the use of version control to track modifications and enhancements. We further developed a plugin for diagrams.net to extend its scope of functions for the interactive features we described above. We also made the \href{https://axa-rev-research.github.io/fairness-compass/src/main/webapp/plugins/props.js}{source code\footnote{https://axa-rev-research.github.io/fairness-compass/src/main/webapp/plugins/props.js}} of this plugin publicly available.} \de{Die Forschung im Bereich KI und Fairness schreitet stetig voran. Wahrscheinlich werden neue Fairnessdefinitionen entwickelt werden. Die allgemeine Fairness-Debatte wird sicherlich fortgesetzt werden, und die Gesellschaft wird konkretere Erwartungen formulieren, wie faire Entscheidungen in bestimmten Anwendungsbereiche auszusehen haben. Um diese zukünftigen Entwicklungen zu berücksichtigen, haben wir bei unserer technischen Architektur den Schwerpunkt auf Erweiterbarkeit und Anpassbarkeit gelegt. Das Online-Tool wurde mit der kostenlosen Online-Diagrammsoftware \href{https://www.diagrams.net/}{diagrams.net} realisiert. Wir haben damit den Entscheidungsbaum entworfen und online veröffentlicht. Das Schema ist im XML-Format gespeichert, was eine Versionierung und Nachverfolgung von Änderungen und Erweiterungen möglich macht. Wir haben außerdem ein Plug-In für diagrams.net implementiert, das dessen Funktionsumfang um die oben beschriebenen interaktiven Features erweitert. Den \href{https://axa-rev-research.github.io/fairness-compass/src/main/webapp/plugins/props.js}{Quellcode\footnote{https://axa-rev-research.github.io/fairness-compass/src/main/webapp/plugins/props.js}} für dieses Plugin haben wir ebenfalls online zur Verfügung gestellt.} \section{\en{Conclusion}\de{Schlussfolgerungen}} \en{This document seeks to explain in a comprehensible way the problem of bias in AI, and why there is no silver bullet to overcome it. We provide background information on a various list of fairness definitions for classification problems in machine learning and illustrate their different properties by example. As a practical approach for better orientation in the complex landscape of fairness definitions, we further propose the "Fairness Compass", a decision tree which outputs the best suited option for a given use case after settling a few crucial questions on the desired type of fairness. This tool also helps document the reasoning behind the selection process which contributes to more transparency and potentially provides better understanding and increased trust among the affected users. We would like to point out that the presented diagram is certainly not the last word on the subject. Research in fair machine learning is constantly advancing, new types of fairness definitions may evolve and the general debate on fairness will move on. Therefore, we consider this work as first step towards structuring the complex landscape of fairness definitions. We would be happy to see this project help illustrate the decision making in particular application scenarios but also serve as a basis for fundamental discussions and further refinements in the course of implementing fair machine learning. Eventually, we hope that our proposal makes a useful contribution to a smooth implementation of fair machine learning in real world applications.} \de{Dieser Bericht behandelt das Problem von Verzerrungen in Daten und KI-Anwendungen. Wir erklären seine Ursachen und Konsequenzen, und führen zudem aus, warum es für die Lösung keinen Königsweg gibt. Zur allgemeinen Übersicht stellen wir die verfügbaren Fairnessdefinitionen für Klassifizierungsprobleme vor, und erläutern deren unterschiedlichen Eigenschaften anhand von Beispielen. Als Orientierungshilfe und praktischen Lösungsansatz präsentieren wir den "Fairness Compass" – ein Tool in Form eines Entscheidungsbaums, das einige wesentliche Fragen zur gewünschten Art von Fairness abfragt, und dann auf Grundlage der Antworten für einen konkreten Anwendungsfall die am besten passende Option liefert. Dieses Tool ist auch nützlich, um die Argumente bei der Entscheidungsfindung zu dokumentieren. Menschen, die von der Entscheidung eines KI-Systems betroffen sind, können so einfacher nachvollziehen, warum die vorliegende Art von Fairness implementiert wurde. Erhöhte Transparenz in dieser Form kann dazu beitragen, das Vertrauen in KI-Anwendungen zu stärken. Wir möchten betonen, dass das hier vorgestellte Schema wohl nicht das letzte Wort zu diesem Thema sein wird. Die Forschung wird neue Erkenntnisse liefern, und die gesellschaftlichen Erwartungen werden sich konkretisieren. Wir verstehen unsere Arbeit daher als ersten Schritt, das komplexe aktuelle Angebot von Fairnessdefinitionen zu strukturieren. Wir würden uns freuen, wenn dieses Projekt zu fundierten Entscheidungen in konkreten Anwendungsszenarien beiträgt, und hoffen weiterhin, dass es als Basis für grundsätzliche Diskussionen dient, und so einen nützlichen Beitrag für die Implementierung von mehr Fairness in realen KI-Systemen leistet.} \section*{\en{Acknowledgements}\de{Danksagungen}} \en{We thank Jonathan Aigrain for helpful discussion and valuable feedback on this document. Many thanks also to George Woodman for the proofreading.} \de{Wir bedanken uns bei Jonathan Aigrain für die anregenden Diskussionen und das konstruktive Feedback zu diesem Dokument.} \bibliographystyle{unsrt}
\section{Proofs} \subsection{Proof of Theorem \ref{thm:local_robustness} }\label{proof:local_robustness} \paragraph{Theorem~\ref{thm:local_robustness}.} \textit{% If $\margin F(x) \neq \bot$, then $\margin F(x) = F(x)$ and $F$ is $\epsilon$-locally-robust at $x$. } \input{proof_local_robustness} \subsection{Tighter Bounds for Theorem \ref{thm:local_robustness} }\label{proof:tighter_bound} Note that in the formulation of GloRo Nets given in Section~\ref{sec:gloro_nets}, we assume that the predicted class, $j$, will decrease by the maximum amount within the $\epsilon$-ball, while all other classes increase by their respective maximum amounts. This is a conservative assumption that guarantees local robustness; however, in practice, we can dispose of this assumption by instead calculating the Lipschitz constant of the margin by which the logit of the predicted class surpasses the other logits, $f_j - f_i$. The \emph{margin Lipschitz constant} of $f$, defined for a pair of classes, $i\neq j$, is given by Definition~\ref{def:margin_lip}. \begin{definition}{Margin Lipschitz Constant}\label{def:margin_lip} For network, $f : \mathds{R}^n \rightarrow \mathds{R}^m$, and classes $i\neq j \in [m]$, $K^*_{ij}$ is an upper bound on the margin Lipschitz constant of $f$ if $\forall x_1, x_2$, $$ \frac{|f_j(x_1) - f_i(x_1) - (f_j(x_2) - f_i(x_2))|}{||x_1 - x_2||} \leq K^*_{ij} $$ \end{definition} We now define a variant of GloRo Nets (Section~\ref{sec:gloro_nets}) as follows: For input, $x$, let $j = F(x)$, i.e., $j$ is the label assigned by the underlying model to be instrumented. Define $\margin f_i(x) ::= f_i(x)$, and $\margin f_\bot(x) ::= \max_{i\neq j}\{f_i(x) + \epsilon K^*_{ij}\}$. \begin{theorem}\label{thm:gloro_variant} Under this variant, if $\margin F(x) \neq \bot$, then $\margin F(x) = F(x)$ and $F$ is $\epsilon$-locally-robust at $x$. \end{theorem} \begin{proof} The proof is similar to the proof of Theorem~\ref{thm:local_robustness} (Appendix~\ref{proof:local_robustness}). Let $j = F(x)$. As before, when $\margin F(x) \neq \bot$, we see that $\margin F(x) = j = F(x)$. Now assume $x'$ satisfies $||x - x'|| \leq \epsilon$. Let $K^*_{ij}$ be an upper bound on the margin Lipschitz constant. Then, $\forall i$ \begin{equation}\label{step:apply_m_lipschitz} |f_j(x) - f_i(x) - (f_j(x') - f_i(x'))| \leq K^*_{ij} \epsilon \end{equation} We proceed to show that for any such $x'$, $F(x')$ is also $j$. In other words, $\forall i \neq j$, $f_i(x') < f_j(x')$. By applying (\ref{step:apply_m_lipschitz}), we obtain (\ref{step:to_Kij_eps}). Next, (\ref{step:to_f_bot_m}) follows from the fact that $\margin f_\bot(x) = \max_{i\neq j}\left\{f_i(x) + K^*_{ij}\epsilon\right\}$. We then obtain (\ref{step:apply_prediction_m}) from the fact that $f_j(x) > \margin f_\bot(x)$, as $\margin F(x) = j \neq \bot$. \begin{align} &\cancel{f_i(x)} + f_j(x) - \cancel{f_i(x)} - f_j(x') + f_i(x') \nonumber \\ \leq~& f_i(x) + |f_j(x) - f_i(x) - (f_j(x') - f_i(x'))| \nonumber \\ \leq~& f_i(x) + K^*_{ij} \epsilon \label{step:to_Kij_eps}\\ \leq~& \margin f_\bot(x) \label{step:to_f_bot_m} \\ <~& f_j(x) \label{step:apply_prediction_m} \end{align} Rearranging terms, we obtain that $f_i(x') < f_j(x')$. Thus, $F(x') = j$; this means that $F$ is locally robust at $x$. \end{proof} \subsection{Proof of Theorem \ref{thm:global_robustness} }\label{proof:global_robustness} \paragraph{Theorem~\ref{thm:global_robustness}.} \textit{% $\margin[\nicefrac{\epsilon}{2}]{F}$ is $\epsilon$-globally-robust. } \input{proof_global_robustness} \subsection{Proof of Theorem \ref{thm:global_vs_local} }\label{proof:global_vs_local} \paragraph{Theorem~\ref{thm:global_vs_local}.} \textit{% Let $f$ be a binary classifier that predicts $1 \Longleftrightarrow f(x) > 0$. Let $K_L(x, \epsilon)$ be the local Lipschitz constant of $f$ at point $x$ with radius $\epsilon$. } \textit{% Suppose that for some finite set of points, $S$, $\forall x \in S$, $|f(x)| > \epsilon K_L(x, \epsilon)$, i.e., all points in $S$ can be verified via the local Lipschitz constant. } \textit{% Then there exists a classifier, $g$, with global Lipschitz constant $K_G$, such that $\forall x\in S$, (1) $g$ makes the same predictions as $f$ on $S$, and (2) $|g(x)| > \epsilon K_G$, i.e., all points in $S$ can be verified via the global Lipschitz constant. } \begin{figure}[t] \centering \includegraphics[page=1, height=0.5\columnwidth]{figures/proof_sketch.pdf} \caption{Illustration of a function, $g$, constructed to satisfy Theorem~\ref{thm:global_vs_local}. The points in $S$ are shown in light and dark gray, with different shades indicating different labels. The Voronoi tessellation is outlined in black, and the faces belonging to the decision boundary are highlighted in bold. The level curves of $g$ are shown in various shades of gray and correspond to points, $x$, at some fixed distance, $d(x)$, from the decision boundary.} \label{fig:proof_sketch} \end{figure} \input{proof_global_vs_local} Note that while Theorem~\ref{thm:global_vs_local} is stated for binary classifiers, the result holds for categorical classifiers as well. We can modify the construction of $g$ from the above proof in a straightforward way to accommodate categorical classifiers. In the case where there are $m$ different classes, the output of $g$ has $m$ dimensions, each corresponding to a different class. Then, for $x$ in a Voronoi cell corresponding to $p_x\in S$ with label, $j$, we define $g_j(x) ::= \nicefrac{d(x)}{\epsilon}$ and $g_i(x) ::= 0$ $\forall i \neq j$. We can see that, for all pairs of classes, $i$ and $j$, the Lipschitz constant of $g_i - g_j$ in this construction is the same as the Lipschitz constant of $g$ in the above proof, since only one dimension of the output of $g$ changes at once. Thus, we can use the global bound suggested in Appendix~\ref{proof:tighter_bound} to certify the points in $S$. \vspace{1.5em} \subsection{Proof of Lemma \ref{lemma:separation} }\label{proof:separation} \paragraph{Lemma~\ref{lemma:separation}.} \textit{% Suppose that for some classifier, $F$, and some set of points, $S$, $\forall x \in S$, $F$ is $\epsilon$-locally-robust at $x$. Then $\forall x_1, x_2\in S$ such that $F(x_1) \neq F(x_2)$, $||x_1 - x_2|| > 2\epsilon$. } \input{proof_2e_separation} \vspace{1.5em} \section{Hyperparameters}\label{appendix:hyperparams} \begin{table*}[!t] \begin{center} \resizebox*{!}{0.475\dimexpr\textheight-2\baselineskip\relax}{% \small \begin{tabular}{ccccccccc} \toprule \textit{architecture} & \textit{dataset}& \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$\\ \midrule \multirow{5}{*}{\shortstack[l]{2C2F\\ \\ GloRo}} &MNIST& \multicolumn{2}{c}{\texttt{\texttt{None}}} & 0 & 512 & 500 & 0.3 & 0.3\\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{\texttt{orthogonal}} & 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_1e-6}} & \texttt{0.1,2.0,500}& \texttt{single}&5\\ \midrule \midrule \textit{architecture} & \textit{dataset}& \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$\\ \midrule \multirow{5}{*}{\shortstack[l]{4C3F\\ \\ GloRo}} &MNIST& \multicolumn{2}{c}{\texttt{\texttt{None}}} & 0 & 512 & 200 & 1.74 & 1.58\\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{\texttt{orthogonal}} & 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_1e-6}} & \texttt{1.5}& \texttt{log}&5\\ \midrule \midrule \textit{architecture} & \textit{dataset} & \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$\\ \midrule \multirow{5}{*}{\shortstack[l]{6C2F\\ \\ GloRo}} &CIFAR-10 & \multicolumn{2}{c}{\texttt{tfds}} & 0 & 512 &800&0.141 &0.141 \\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{orthogonal}& 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_1e-6}}&\texttt{1.2} &\texttt{log} &5\\ \midrule \midrule \textit{architecture} & \textit{dataset} & \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$ \\ \midrule \multirow{5}{*}{\shortstack[l]{8C2F\\ \\ GloRo}} &Tiny-Imagenet &\multicolumn{2}{c}{\texttt{default}} & 0 & 512& 800& 0.141& 0.141\\ \cmidrule{2-9} & \textit{optimizer} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ & \texttt{default} & 1e-4 &\multicolumn{2}{c}{\texttt{decay\_to\_5e-6}} &\texttt{1.2,10,800} &\texttt{log} & 5\\ \bottomrule \end{tabular}} \end{center} \caption{ Hyperparameters used for training (MinMax) GloRo Nets.}\label{appendix:fig:supply:hyperparameters-minmax} \end{table*} \begin{table*}[!t] \begin{center} \resizebox*{!}{0.95\dimexpr\textheight-2\baselineskip\relax}{% \small \begin{tabular}{ccccccccc} \toprule \textit{architecture} & \textit{dataset}& \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$\\ \midrule \multirow{5}{*}{\shortstack[l]{2C2F\\ \\ GloRo (CE)}} &MNIST& \multicolumn{2}{c}{\texttt{None}} & 0 & 256& 500& 0.45& 0.3\\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{default} & 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_1e-6}} & \texttt{CE}& \texttt{single}&10\\ \midrule \midrule \textit{architecture} & \textit{dataset}& \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$ \\ \midrule \multirow{5}{*}{\shortstack[l]{2C2F\\ \\ GloRo (T)}} &MNIST& \multicolumn{2}{c}{\texttt{None}} & 0 & 256& 500& 0.45& 0.3\\ \cmidrule{2-9}\\ & \textit{initialization}& \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{default} & 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_1e-6}} & \texttt{0,2,500}& \texttt{single}&10\\ \midrule \midrule \textit{architecture} & \textit{dataset}& \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$ \\ \midrule \multirow{5}{*}{\shortstack[l]{4C3F\\ \\ GloRo (CE)}} &MNIST& \multicolumn{2}{c}{\texttt{None}} & 0 & 256& 300& 1.75& 1.58\\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{default} & 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_5e-6}} & \texttt{CE}& \texttt{single}&10\\ \midrule \midrule \textit{architecture} & \textit{dataset} & \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$ \\ \midrule \multirow{5}{*}{\shortstack[l]{4C3F\\ \\ GloRo (T)}} &MNIST & \multicolumn{2}{c}{\texttt{None}} & 0 & 256& 300& 1.75& 1.58 \\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{default} & 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_5e-6}} & \texttt{0,3,300}& \texttt{single}&10\\ \midrule \midrule \textit{architecture} & \textit{dataset} & \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$\\ \midrule \multirow{5}{*}{\shortstack[l]{6C2F\\ \\ GloRo (CE)}} &CIFAR-10 & \multicolumn{2}{c}{\texttt{default}} & 20 & 256 &800&0.1551 &0.141 \\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{orthogonal}& 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_1e-6}}&\texttt{CE} &\texttt{log} &5\\ \midrule \midrule \textit{architecture} & \textit{dataset} & \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$\\ \midrule \multirow{5}{*}{\shortstack[l]{6C2F\\ \\ GloRo (T)}} &CIFAR-10 & \multicolumn{2}{c}{\texttt{default}} &20 & 256 &800&0.1551 &0.141 \\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{default}& 1e-3 & \multicolumn{2}{c}{\texttt{decay\_to\_1e-6}}&\texttt{1.2} &\texttt{log} &5\\ \midrule \midrule \textit{architecture} & \textit{dataset} & \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$ \\ \midrule \multirow{5}{*}{\shortstack[l]{8C2F\\ \\ GloRo (CE)}} &Tiny-Imagenet &\multicolumn{2}{c}{\texttt{default}} & 0 & 256& 250& 0.16& 0.141\\ \cmidrule{2-9} & \textit{optimizer} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ & \texttt{default} & 2.5e-4 &\multicolumn{2}{c}{\texttt{decay\_to\_5e-7}} &\texttt{CE} &\texttt{single} & 5\\ \midrule \midrule \textit{architecture} & \textit{dataset} & \multicolumn{2}{c}{\textit{data augmentation}} &\textit{warm-up}& \textit{batch size} & \# \textit{epochs} & $\epsilon_{\text{train}}$ & $\epsilon_{\text{test}}$ \\ \midrule \multirow{5}{*}{\shortstack[l]{8C2F\\ \\ GloRo (T)}} &Tiny-Imagenet &\multicolumn{2}{c}{\texttt{default}} & 0 & 256& 500& 0.16& 0.141\\ \cmidrule{2-9}\\ & \textit{initialization} & \textit{init\_lr} & \multicolumn{2}{c}{\textit{lr\_decay}} & \textit{loss} & $\epsilon$ \textit{schedule}& \textit{power\_iter}\\ \cmidrule{2-9}\\ &\texttt{default} & 2.5e-4 & \multicolumn{2}{c}{\texttt{decay\_to\_5e-7}} & \texttt{1,10,500}&\texttt{single} &1\\ \bottomrule \end{tabular}} \end{center} \caption{ Hyperparameters used for training (ReLU) GloRo Nets. We provide models trained with both TRADES (Definition~\ref{def:trades_loss}) loss (denoted by ``(T)'') and with cross-entropy loss (denoted by ``(CE)'').}\label{appendix:fig:supply:hyperparameters} \end{table*} In this appendix, we describe hyperparameters used in the training of GloRo Nets to produce the results in Section~\ref{sec:eval}. The full set of hyperparameters used for all experiments is shown in Tables~\ref{appendix:fig:supply:hyperparameters-minmax} and \ref{appendix:fig:supply:hyperparameters}. We explain each column as follows and discuss how a particular value is selected for each hyperparameter. \paragraph{Architectures.}\label{appendix:hyperparams:architecture} To denote architectures, we use $c(C,K,S)$ to denote a convolutional layer with $C$ output channels, a kernel of size $K \times K$, and strides of width $S$. We use \texttt{SAME} padding unless noted otherwise. We use $d(D)$ to denote a dense layer with $D$ output dimensions. We use MinMax~\cite{anil19a} or ReLU activations (see Appendix~\ref{appendix:minmax_vs_relu} for a comparison) after each layer except the top of the network, and do not include an explicit Softmax activation. Using this notation, the architectures referenced in Section~\ref{sec:eval} are as shown in the following list. \begin{itemize} \item 2C2F: c(16,4,2).c(32,4,2).d(100).d(10) \item 4C3F: c(32,3,1).c(32,4,2).c(64,3,1).c(64,4,2)\\.d(512).d(512).d(10) \item 6C2F: c(32,3,1).c(32,3,1).(32,4,2).(64,3,1)\\ .c(64,3,1).c(64,4,2).d(512).d(10) \item 8C2F: c(64,3,1).c(64,3,1).c(64,4,2).c(128,3,1).\\c(128,4,2).c(256,3,1).(256,4,2).d(200) \end{itemize} We arrived at these architectures in the following way. 2C2F, 4C3F~and 6C2F~are used in the prior work~\cite{lee20local_margin, croce19mmr, wong2017provable} to evaluate the verifiable robustness, and we used them to facilitate a direct comparison on training cost and verified accuracy. For Tiny-ImageNet, we additionally explored the architecture described in~\cite{lee20local_margin} for use with that dataset, but found that removing one dense and one convolutional layer (denoted by 8C2F~in the list above) produced the same (or better) verified accuracy, but lowered the total training cost. \paragraph{Data preprocessing.}\label{appendix:hyperparams:data-preprocessing} For all datasets, we scaled the features to the range [0,1]. On some datasets, we used the following data augmentation pipeline \texttt{ImageDataGenerator} from \texttt{tf.keras}, which is denoted by \texttt{default} in Table~\ref{appendix:fig:supply:hyperparameters} and ~\ref{appendix:fig:supply:hyperparameters-minmax}. \begin{verbatim} rotation_range=20 width_shift_range=0.2 height_shift_range=0.2 horizontal_flip=True shear_range=0.1 zoom_range=0.1 \end{verbatim} When integrating our code with \texttt{tensorflow-dataset}, we use the following augmentaiton pipeline and denote it as \texttt{tfds} in Table~\ref{appendix:fig:supply:hyperparameters} and ~\ref{appendix:fig:supply:hyperparameters-minmax}. \begin{verbatim} horizontal_flip=True zoom_range=0.25 random_brightness=0.2 \end{verbatim} Our use of augmentation follows the convention established in prior work~\cite{NEURIPS2018_358f9e7b,lee20local_margin}: we only use it on CIFAR and tiny-imatenet, but not on MNIST. \paragraph{$\epsilon$ scheduling.}\label{appendix:hyperparams:epsilon-schedule} Prior work has also established a convention of gradually scaling $\epsilon$ up to a value that is potentially larger than the one used to measure verified accuracy leads to better results. We made use of the following schemes for accomplishing this. \begin{itemize} \item No scheduling: we use `\texttt{single}' to denote we $\epsilon_\text{train}$ for all epochs. \item Linear scheduling: we use a string `\texttt{x,y,e}' to denote the strategy that at training epoch $t$, we use $\epsilon_t = x + (y - x)*(t/e)$ if $t \leq e$. When $t>e$, we use the provided $\epsilon_{\text{train}}$ to keep training the model. \item Logarithmic scheduling: we use `\texttt{log}' to denote that we increase the epsilon with a logarithmic rate from 0 to $\epsilon_{\text{train}}$. \end{itemize} We found that scheduling $\epsilon$ is often unnecessary when instead scheduling the TRADES parameter $\lambda$ (discussed later in this section), which appears to be more effective for that loss. To select a scheme for scheduling $\epsilon$, we compared the results of the three options listed above, and selected the one that achieved the highest verified accuracy. If there was no significant difference in this metric, then we instead selected the schedule with the least complexity, assuming the following order: \texttt{single}, (\texttt{x,y,e}), \texttt{log}. When applying (\texttt{x,y,e}) and \texttt{log}, we began the schedule on the first epoch, and ended it on $(\mathrm{\#\ epochs}) / 2$. \paragraph{Initialization \& optimization.}\label{appendix:hyperparams:initialization} In Table~\ref{appendix:fig:supply:hyperparameters}, \texttt{default} refers to the Glorot uniform initialization, given by $\mathtt{tf.keras.initializers.GlorotUniform()}$. The string `\texttt{ortho}' refers to an orthogonal initialization given by $\mathtt{tf.keras.initializers.Orthogonal()}$. To select an initialization, we compared the verified accuracy achieved by either, and selected the one with the highest metric. In the case of a tie, we defaulted to the Glorot uniform initialization. We used the \texttt{adam} optimizer to perform gradient descent in all experiments, with the initial learning rate specified in Table~\ref{appendix:fig:supply:hyperparameters} and ~\ref{appendix:fig:supply:hyperparameters-minmax}, and default values for the other hyperparameters ($\beta_1=0.9$, $\beta_2=0.999$, $\epsilon=1e-07$, $\mathtt{amsgrad}$ disabled). \paragraph{Learning rate scheduling.}\label{appendix:hyperparams:lr-schedule} We write `\texttt{decay\_to\_lb}' to denote a schedule that continuously decays the learning rate to $\mathtt{lb}$ at a negative-exponential rate, starting the decay at $(\mathrm{\# epochs}) / 2$. To select $\mathtt{lb}$, we searched over values $\mathtt{lb} \in \{1 \times 10^{-7}, 5 \times 10^{-7}, 1 \times 10^{-6}, 5 \times 10^{-6}\}$, selecting the value that led to the best VRA. We note that for all datasets except Tiny-Imagenet, we used the default initial rate of $1 \times 10^{-3}$. On Tiny-Imagenet, we observed that after several epochs at this rate, as well as at $5 \times 10^{-4}$, the loss failed to decrease, so again halved it to arrive at $2.5 \times 10^{-4}$. \paragraph{Batch size \& epochs.}\label{appendix:hyperparams:batch-size} For all experiments, we used minibatches of 256 instances. Because our method does not impose a significant memory overhead, we found that this batch size made effective use of available hardware resources, increasing training time without impacting verified accuracy, when compared to minibatch sizes 128 and 512. Because the learning rate, $\epsilon$, and $\lambda$ schedules are all based on the total number of epochs, and can have a significant effect on the verified accuracy, we did not monitor convergence to determine when to stop training. Instead, we trained for epochs in the range $[100, 1000]$ in increments of 100, and when verified accuracy failed to increase with more epochs, attempted training with fewer epochs (in increments of 50), stopping the search when the verified accuracy began to decrease again. \paragraph{Warm-up.}\label{appendix:hyperparams:warm-up} \citet{lee20local_margin} noted improved performance when models were pre-trained for a small number of epochs before optimizing the robust loss. We found that this helped in some cases with GloRo networks as well, in particular on CIFAR-10, where we used the same number of warm-up epochs as prior work. \paragraph{$\lambda$ scheduling.}\label{appendix:hyperparams:trades} When using the TRADES loss described in Section~\ref{sec:implementation}, we found that scheduling $\lambda$ often yielded superior results. We use `\texttt{x,y,e}' to denote that at epoch $t$, we set $\lambda_t = x + (y-x) * (t/e)$ if $t < e$ else $\lambda_t = y$. We write `\texttt{x}' to denote we use $\lambda=x$ all the time. To select the final $\lambda$, we trained on values in the range $[1,10]$ in increments of $1$, and on finding the whole number that yielded the best result, attempted to further refine it by increasing in increments $0.1$. \paragraph{Power iteration.}\label{appendix:hyperparams:power-iteration} As discussed in Section~\ref{sec:implementation}, we use power iteration to compute the spectral norm for each layer to find the layer-wise Lipschitz constants. In Table~\ref{appendix:fig:supply:hyperparameters}, \textit{power\_iter} denotes the number of iterations we run for each update during training. We tried values in the set $\{1,2,5,10\}$, breaking ties to favor fewer iterations for less training cost. After each epoch, we ran the power iteration until convergence (with tolerance $1 \times 10^{-5}$), and all of the verified accuracy results reported in Section~\ref{sec:eval} are calculated using a global bound based on running power iteration to convergence as well. Since the random variables used in the power iterations are initialized as \texttt{tf.Variables}, they are stored in \texttt{.h5} files together with the architecture and network parameters. Therefore, one can directly use the converged random variables from the training phase during the test phase. \paragraph{Search strategy.} Because of the number of hyperparameters involed in our evaluation, and limited hardware resources, we did not perform a global grid search over all combinations of hyperparameters discussed here. We plan to do so in future work, as it is possible that results could improve as we may have missed better settings than those explored to produce the numbers reported in our evaluation. Instead, we adopted a greedy strategy, prioritizing the choices that we believed would have the greatest impact on verified accuracy and training cost. In general, we explored parameter choices in the following order: $\epsilon$ schedule, $\lambda$ schedule, \# epochs, LR decay, warm-up, initialization, \# power iterations, minibatch size. \section{Comprehensive VRA Comparisons} \label{appendix:comprehensive_vra} \begin{table} \centering \resizebox{\columnwidth}{!}{% \begin{tabular}{ll|cccl} \multicolumn{6}{c}{\textbf{Deterministic Guarantees}} \\ \midrule \hspace{2em} &\textit{method} & Clean (\%)& PGD (\%) & VRA(\%)&\hspace{2em} \\ \midrule \multicolumn{6}{c}{\textbf{MNIST} $(\epsilon=0.3)$} \\ \midrule &GloRo & 99.0 &97.8 &95.7 \\ &BCP & 93.4 &89.5 &84.7\\ &KW & 98.9 & 97.8&94.0\\ &MMR & 98.2 &96.2 &93.6\\ \midrule \multicolumn{6}{c}{\textbf{MNIST} $(\epsilon=1.58)$} \\ \midrule &GloRo & 97.0 & 81.9 &62.8\\ &BCP & 92.4 &65.8 &47.9\\ &KW & 88.1 &67.9 &44.5\\ &BCOP & 98.8 & - &56.7\\ &LMT & 86.5& 53.6 &40.6\\ \midrule \multicolumn{6}{c}{\textbf{CIFAR} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule &GloRo & 77.0 & 69.2 & 58.4\\ &BCP & 65.7 & 60.8&51.3\\ &KW & 60.1 & 56.2 & 50.9\\ &Cayley & 75.3 & 67.6 &59.1\\ &BCOP & 72.4 & 64.4 &58.7\\ &LMT & 63.1 & 58.3&38.1\\ \midrule \multicolumn{6}{c}{} \\ \multicolumn{6}{c}{\textbf{Stochastic Guarantees}} \\ &\textit{method} & Clean (\%)& PGD (\%) & VRA(\%)\\ \midrule \multicolumn{6}{c}{\textbf{CIFAR} $(\epsilon=0.5)$} \\ \midrule &RS & 67.0 & - &49.0\\ &SmoothADV & - & - & 63.0\\ &MACER & 81.0 & - & 59.0\\ \bottomrule \end{tabular}} \caption{Comprehensive VRA comparisons for deterministic guarantees and stochastic guarantees. Best results reported in the literature are included in the table.} \label{appendix:figure:full-results} \end{table} In Section~\ref{sec:eval} of the main paper, we compare, in depth, the performance of GloRo Nets to two approaches to deterministic certification that have been reported as achieving the state-of-the-art in recently published work on robustness certification~\cite{lee20local_margin}. For completeness, we present a brief overview of a wider range of approaches, providing the VRAs reported in the original respective papers. Table~\ref{appendix:figure:full-results} contains VRAs reported by several other approaches to deterministic certification, including the methods compared against in Section~\ref{sec:eval}: KW~\cite{wong2017provable} and BCP~\cite{lee20local_margin}; work that was superseded by KW or BCP: MMR~\cite{croce19mmr} and LMT~\cite{tsuzuku18margin}; work that we became aware of after the completion of this work: BCOP~\cite{NEURIPS2019_1ce3e6e3}; and concurrent work: Cayley~\cite{trockman2021orthogonalizing}. In addition, we include work that provides a \emph{stochastic} guarantee: Randomized Smoothing (RS)~\cite{cohen19smoothing}, SmoothADV~\cite{NEURIPS2019_3a24b25a}, and MACER~\cite{Zhai2020MACER}. The results for stochastic certification typically use different radii, as reflected in Table~\ref{appendix:figure:full-results}. We note that because these numbers are taken from the respective papers, the results in Table~\ref{appendix:figure:full-results} should be interpreted as ball-park figures, as they do not standardize the architecture, data scaling and augmentation, etc., and are thus not truly ``apples-to-apples.'' We find that GloRo Nets provide the highest VRA for both $\epsilon=0.3$ and $\epsilon=1.58$ on MNIST. GloRo Nets also match the result on CIFAR-10 from concurrent work, Cayley, coming within one percentage point of the VRA reported by \citeauthor{trockman2021orthogonalizing}. \vspace{0.4em} \section{MinMax vs. ReLU GloRo Nets} \label{appendix:minmax_vs_relu} \begin{figure*}[t] \centering \begin{subfigure}[t]{0.62\textwidth} \vspace{1.0em} \resizebox{\textwidth}{!}{% \begin{tabular}{l|c|ccc|ccc} \toprule \textit{method} & Model & Clean (\%) & PGD (\%)& VRA(\%) & Sec./epoch & \# Epochs & Mem. (MB) \\ \midrule \multicolumn{8}{c}{\textbf{MNIST} $(\epsilon=0.3)$} \\ \midrule ReLU GloRo (CE) & 2C2F & 98.4 &96.9 & 94.6 & 0.7 & 500 & 0.7 \\ ReLU GloRo (T) & 2C2F & 98.7 & 97.4& 94.6 & 0.7 & 500 & 0.7 \\ MinMax GloRo & 2C2F & 99.0 &97.8 & \textbf{95.7}& 0.9 & 500 & 0.7 \\ \midrule \multicolumn{8}{c}{\textbf{MNIST} $(\epsilon=1.58)$} \\ \midrule ReLU GloRo (CE) & 4C3F & 92.9 & 68.9 & 50.1 & 2.3 & 300 & 2.2 \\ ReLU GloRo (T) &4C3F & 92.8 & 67.0 & 51.9 & 2.0 & 300 & 2.2 \\ MinMax GloRo & 4C3F & 97.0 & 81.9 & \textbf{62.8}& 3.7 & 300 & 2.7 \\ \midrule \multicolumn{8}{c}{\textbf{CIFAR-10} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule ReLU GloRo (CE) & 6C2F & 70.7 & 63.8 & 49.3 & 3.2 & 800 & 2.6 \\ ReLU GloRo (T) & 6C2F & 67.9 & 61.3 & 51.0 & 3.3 & 800 & 2.6 \\ MinMax GloRo & 6C2F & 77.0 & 69.2 & \textbf{58.4}& 6.9 & 800 & 3.6 \\ \midrule \multicolumn{8}{c}{\textbf{Tiny-Imagenet} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule ReLU GloRo (CE) & 8C2F & 31.3 & 28.2 & 13.2 & 14.0 & 250 & 7.3 \\ ReLU GloRo (T) & 8C2F &27.4 & 25.6 & 15.6 & 13.7 & 500 & 7.3 \\ MinMax GloRo & 8C2F & 35.5 & 32.3 & \textbf{22.4}& 40.3 & 800 & 10.4 \\ \bottomrule \end{tabular}} \caption{}\label{fig:appendix:train-results} \end{subfigure} \hspace{0.1em} \begin{subfigure}[t]{0.35\textwidth} \vspace{0.1 em} \resizebox{\textwidth}{!}{% \begin{tabular}{l|c|cc} \toprule \textit{method} & Model & Time (sec.) & Mem. (MB)\\ \midrule ReLU GloRo & 6C2F & 0.2 & 2.5 \\ MinMax GloRo & 6C2F & 0.4 & 1.8 \\ \bottomrule \end{tabular} } \caption{}\label{fig:appendix:cert-results} \vspace{0.5em} \resizebox{\textwidth}{!}{% \begin{tabular}{l|c|cc} \toprule \textit{method} \hspace{1em} & global UB & global LB & local LB \\ \midrule \multicolumn{4}{c}{\textbf{MNIST} $(\epsilon=1.58)$} \\ \midrule Standard & $5.4\cdot10^4$ & $1.4\cdot10^2$ & $17.1$ \\ ReLU GloRo & $3.2$ & $3.0$ & $2.1$ \\ MinMax GloRo & $2.3$ & $1.9$ & $0.8$ \\ \midrule \multicolumn{4}{c}{\textbf{CIFAR-10} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule Standard & $1.2\cdot10^7$ & $1.1\cdot10^3$ & $96.2$ \\ ReLU GloRo & $18.9$ & $11.4$ & $6.2$ \\ MinMax GloRo & $15.8$ & $11.0$ & $3.7$ \\ \midrule \multicolumn{4}{c}{\textbf{Tiny-Imagenet} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule Standard & $2.2\cdot10^7$ & $3.6\cdot10^2$ & $40.7$ \\ ReLU GloRo & $7.7$ & $3.3$ & $1.5$ \\ MinMax GloRo & $12.5$ & $5.9$ & $0.8$ \\ \bottomrule \end{tabular} } \caption{}\label{fig:appendix:lipschitz-results} \end{subfigure} \caption{ \textbf{(\subref{fig:eval:train-results})} Certifiable training evaluation results on benchmark datasets. Best results highlighted in bold. For ReLU GloRo Nets, we provide models trained with both TRADES (Definition~\ref{def:trades_loss}) and with cross-entropy: ``(T)'' indicates that TRADES loss was used and ``(CE)'' indicates that cross-entropy was used. \textbf{(\subref{fig:eval:cert-results})} Certification timing and memory usage results on CIFAR-10 ($\epsilon=\nicefrac{36}{255}$). \textbf{(\subref{fig:eval:lipschitz-results})} Upper and lower bounds on the global and average local Lipschitz constant. In (\subref{fig:eval:train-results}) and (\subref{fig:eval:cert-results}), peak GPU Memory usage is calculated per-instance by dividing the total measurement by the training or certification batch size. } \end{figure*} Recently, \citet{anil19a} proposed replacing ReLU activations with sorting activations to construct a class of \emph{universal Lipschitz approximators}, that that can approximate any Lipschitz-bounded function over a given domain, and \citet{cohen2019universal} subsequently studied the application to robust training. We found that these advances in architecture complement our work, improving the VRA performance of GloRo Nets substantially compared to ReLU activations. The results achieved by GloRo Nets in Figure~\ref{fig:eval:train-results} in Section~\ref{sec:eval} of the main paper are achieved using \emph{MinMax} activations~\cite{anil19a} rather than ReLU activations. Figure~\ref{fig:appendix:train-results} shows a comparison of the VRA that can be achieved by GloRo Nets using ReLU activations as opposed to MinMax activations. We see that in each case, the GloRo Nets using MinMax activations outperform those using ReLU activations by a several percentage points. Nonetheless, the ReLU-based GloRo Nets are still competitive with the VRA performance of KW and BCP. We observed that MinMax activations result in a slight penalty to training and evaluation cost, as they are slightly slower to compute than ReLU activations. Figures~\ref{fig:appendix:train-results} and \ref{fig:appendix:cert-results} provide the cost in terms of time and memory incurred by GloRo Nets using each activation function. We see that the MinMax-based GloRo Nets are slightly slower and more memory-intensive; however, the difference is not particularly significant. Finally, we compared the Lipschitz bounds obtained on MinMax and ReLU GloRo Nets, presented in Figure~\ref{fig:appendix:lipschitz-results}. We see that the Lipschitz bounds are fairly similar, in terms of both their magnitude a well as their tightness with respect to the empirical lower bounds. \section{Measuring Memory Usage}\label{appendix:memory_usage} In our experiments, we used Tensorflow to train and evaluate standard and GloRo networks, and Pytorch to train and evaluate KW and BCP (since \citet{wong2017provable} and \citet{lee20local_margin} implement their respective methods in Pytorch). To measure memory usage, we invoked $\mathtt{tf.contrib.memory\_stats.MaxBytesInUse()}$ at the end of each epoch for standard and GloRo networks, and took the peak active use from $\mathtt{torch.cuda.memory\_summary()}$ at the end of each epoch for KW and BCP. We note that some differences may arise as a result of differences in memory efficiency between Tensorflow and Pytorch. In particular, Pytorch enables more control over memory management than does Tensorflow. In order to mitigate this difference as much as possible, we did not disable gradient tracking when evaluating certification times and memory usage in Pytorch. While gradient tracking is unnecessary for certification (it is only required for training), Tensorflow does not allow this optimization, so by forgoing it the performance results recorded in Figure~\ref{fig:eval:cert-results} in Section~\ref{sec:eval} are more comparable across frameworks. In Section~\ref{sec:eval:cost}, we note that Randomized Smoothing (RS) training times have been omitted. This is because RS essentially acts as a post-processing method on top of a pre-trained model. In practice the only difference between the training routine to produce a model for RS and standard training is the addition of Gaussian noise (mathcing the noise radius used for smoothing) to the data augmentation; we assume that this has a negligible impact on training cost. \section{Optimizing for Lipschitz Lower Bounds}\label{appendix:lower_bounds} Figure~\ref{fig:eval:lipschitz-results} in Section~\ref{sec:eval} gives empirical lower bounds on the global and average local Lipschitz constants on the models trained in our evaluation. We use optimization to obtain these lower bounds; further details are provided below. \paragraph{Global Lower Bounds.} We use the \emph{margin Lipschitz constant}, $K^*_{ij}$ (Definition~\ref{def:margin_lip} in Appendix~\ref{proof:tighter_bound}), which takes a different value for each pair of classes, $i$ and $j$. To obtain the lower bound we optimize \begin{equation*}\label{eq:glob_lower} \max_{x_1, x_2}~\max_i\left\{\frac{\left|f_{j_1}(x_1) - f_i(x_1) - \left(f_{j_1}(x_2) - f_i(x_2)\right)\right|}{||x_1 - x_2||}\right\} \end{equation*} where $j_1 = F(x_1)$. Optimization is performed using Keras' default \texttt{adam} optimizer with 7,500 gradient steps. Both $x_1$ and $x_2$ are initialized to random points in the test set; we perform this optimization over 100 such initial pairs, and report the maximum value obtained over all initializations. \paragraph{Local Lower Bounds.} We use a variant of the \emph{margin Lipschitz constant} (Definition~\ref{def:margin_lip} in Appendix~\ref{proof:tighter_bound}) analogous to the local Lipschitz constant at a point, $x_0$, with radius $\epsilon$. To obtain this lower bound we optimize \begin{equation*}\label{eq:loc_lower} \max_{x_1, x_2~}~\max_i\left\{\frac{\left|f_{j}(x_1) - f_i(x_1) - \left(f_{j}(x_2) - f_i(x_2)\right)\right|}{||x_1 - x_2||}\right\} \end{equation*} $$ \text{subject to}~~||x_1 - x_0|| \leq \epsilon,~||x_2 - x_0|| \leq \epsilon $$ where $j = F(x_0)$. Optimization is performed using Keras' default \texttt{adam} optimizer with 5,000 gradient steps. After each gradient step, $x_1$ and $x_2$ are projected onto the $\epsilon$-ball centered at $x_0$. Both $x_1$ and $x_2$ are initialized to random points in the test set, and $x_0$ is a fixed random point in the test set. We perform this optimization over 100 random choices of $x_0$, and report the mean value. \paragraph{Discussion.} In Section~\ref{sec:eval:tightness}, we observe that the global upper bound is fairly tight on the GloRo Net trained on MNIST, but decreasingly so on CIFAR-10 and Tiny-Imagenet. While this suggests that there is room for improvement in terms of the bounds obtained by GloRo Nets, we make note of two subtleties that may impact these findings. First, the tightness decreases inversely with the dimensionality of the input. While it is reasonable to conclude that learning tight GloRo Nets in higher dimensions becomes increasingly difficult, it is worth noting that the optimization process described above also becomes more difficult in higher dimensions, meaning that some of the looseness may be attributable to looseness in the \emph{lower} bound, rather than in the upper bound. Second, the hyperparameters used may have an effect on the tightness of the Lipschitz bound. As seen in Appendix~\ref{appendix:hyperparams}, different hyperparameters were used on MNIST, CIFAR-10, and Tiny-Imagenet; some of these differences were selected based on impacting training time, which is of greater concern for larger datasets that naturally take longer to train. Specifically, we note that fewer power iterations were used for CIFAR-10, and even fewer for Tiny-Imagenet. While this is good for expediency, and still produces state-of-the-art VRA, we note that tighter bounds may be learned by putting more computation time into training, in the form of more power iterations (for example). More generally, this speculation suggests that slightly different training strategies, hyperparameters, etc., from the ones used in this work may be sufficient to improve the bounds and the VRA achieved by GloRo Nets. We conclude that future work should further explore this possibility. \section*{Acknowledgments} The work described in this paper has been supported by the Software Engineering Institute under its FFRDC Contract No. FA8702-15-D-0002 with the U.S. Department of Defense, as well as DARPA and the Air Force Research Laboratory under agreement number FA8750-15-2-0277. \section{Conclusion}\label{sec:conclusion} In this work, we provide a method for training certifiably-robust neural networks that is simple, fast, memory-efficient, and that yields state-of-the-art deterministic verified accuracy. Our approach is particularly efficient because of its effective use of global Lipschitz bounds, and while we prove that the potential of our approach is in theory not limited by the global Lipschitz constant itself, it remains an open question as to whether our bounds on the Lipschitz constant can be tightened, or if additional training techniques can help unlock its remaining potential. Finally, we note that if instances arise where a global bound is not sufficient in practice, costlier post-hoc certification techniques may be complimentary, as a fall-back. \section{Evaluation}\label{sec:eval} In this section, we present an empirical evaluation of our method. We first compare GloRo Nets with several certified training methods from the recent literature in Section~\ref{sec:eval:accuracy}. We also report the training cost, in terms of per-epoch time and peak memory usage, required to train and certify the robustness of our method compared with other competitive approaches (Section~\ref{sec:eval:cost}). We end by demonstrating the relative tightness of the estimated Lipschitz bounds for GloRo Nets in Section~\ref{sec:eval:tightness}. We compare against the KW~\cite{NEURIPS2018_358f9e7b} and BCP~\cite{lee20local_margin} certified training algorithms, which prior work~\cite{lee20local_margin,croce19mmr} reported to achieve the best verified accuracy on MNIST~\cite{lecun2010mnist}, CIFAR-10~\cite{Krizhevsky09learningmultiple} and Tiny-Imagenet~\cite{Le2015TinyIV} relative to other previous certified training methods for $\ell_2$ robustness. We train GloRo nets to certify robustness against $\ell_2$ perturbations within an $\epsilon$-neighborhood of $0.3$ and $1.58$ for MNIST and $36/255$ for CIFAR-10 and Tiny-Imagenet (these are the $\ell_2$ norm bounds that have been commonly used in the previous literature). For each model, we report the \emph{clean accuracy}, i.e., the accuracy without verification on non-adversarial inputs, the \emph{PGD accuracy}, i.e., the accuracy under adversarial perturbations found via the PGD attack~\cite{madry2018towards}, and the \emph{verified-robust accuracy} (VRA), i.e., the fraction of points that are both correctly classified \emph{and} certified as robust. For KW and BCP, we report the corresponding best VRAs from the original respective papers when possible, but measure training and certification costs on our hardware for an equal comparison. We run the PGD attacks using ART~\cite{nicolae2019adversarial} on our models and on any of the models from the prior work for which PGD accuracy is not reported. When training BCP models for MNIST with $\epsilon=0.3$, we found a different set of hyperparameters that outperforms those given by \citeauthor{lee20local_margin}. For GloRo Nets, we found that MinMax activations~\cite{anil19a} performed better than ReLU activations (see Appendix~\ref{appendix:minmax_vs_relu} for more details); for all other models, ReLU activations were used. Further details on the precise hyperparameters used for training and attacks, the process for obtaining these parameters, and the network architectures are provided in Appendix~\ref{appendix:hyperparams}. An implementation of our approach is available on GitHub\footnote{Code available at ~{\fontsize{7.5}{11}\selectfont \url{https://github.com/klasleino/gloro}}}. \begin{figure*}[t] \centering \begin{subfigure}[t]{0.62\textwidth} \resizebox{\textwidth}{!}{% \begin{tabular}{l|c|ccc|ccc} \toprule \textit{method} & Model & Clean (\%) & PGD (\%)& VRA(\%) & Sec./epoch & \# Epochs & Mem. (MB) \\ \midrule \multicolumn{8}{c}{\textbf{MNIST} $(\epsilon=0.3)$} \\ \midrule Standard & 2C2F & 99.2 & 96.9 & 0.0 & 0.3 & 100 & 0.6 \\ GloRo & 2C2F & 99.0 &97.8 & \textbf{95.7} & 0.9 & 500 & 0.7 \\ KW & 2C2F & 98.9 & 97.8 & 94.0 & 66.9 & 100 & 20.2 \\ BCP & 2C2F & 93.4 & 89.5 & 84.7 & 44.8 & 300 & 12.6 \\ \midrule RS$^*$ & 2C2F & 98.8 & - & 97.4 & - & - & - \\ \midrule \multicolumn{8}{c}{\textbf{MNIST} $(\epsilon=1.58)$} \\ \midrule Standard & 4C3F & 99.0 & 45.4 & 0.0 & 0.9 & $\text{42}^\dagger$ & 2.2 \\ GloRo & 4C3F & 97.0 & 81.9 & \textbf{62.8} & 3.7 & 300 & 2.7 \\ KW & 4C3F & 88.1 & 67.9 & 44.5 & 138.1 & 60 & 84.0 \\ BCP & 4C3F & 92.4 & 65.8 & 47.9 & 43.4 & 60 & 12.6 \\ \midrule RS$^*$ & 4C3F & 99.0 & - & 59.1 & - & - & - \\ \midrule \multicolumn{8}{c}{\textbf{CIFAR-10} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule Standard & 6C2F & 85.7 & 31.9 & 0.0 & 1.8 & $\text{115}^\dagger$ & 2.5 \\ GloRo & 6C2F & 77.0 & 69.2 & \textbf{58.4} & 6.9 & 800 & 3.6 \\ KW & 6C2F & 60.1 & 56.2 & 50.9 & 516.8 & 60 & 100.9 \\ BCP & 6C2F & 65.7 & 60.8 & 51.3 & 47.5 & 200 & 12.7 \\ \midrule RS$^*$ & 6C2F & 74.1 & - & 64.2 & - & - & - \\ \midrule \multicolumn{8}{c}{\textbf{Tiny-Imagenet} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule Standard & 8C2F & 35.9 & 19.4&0.0 & 10.7 & $\text{58}^\dagger$ & 6.7 \\ GloRo & 8C2F & 35.5 & 32.3 & \textbf{22.4} & 40.3 & 800 & 10.4 \\ KW & - & - & - & - & - & - & - \\ BCP & 8C2F & 28.8 & 26.6 & 20.1 & 798.8 & 102 & 715.2 \\ \midrule RS$^*$ & 8C2F & 23.4 & - & 16.9 & - & - & - \\ \bottomrule \end{tabular}} \caption{}\label{fig:eval:train-results} \end{subfigure} \hspace{0.1em} \begin{subfigure}[t]{0.35\textwidth} \vspace{-12em} \resizebox{\textwidth}{!}{% \begin{tabular}{l|c|cc} \toprule \textit{method} & Model & Time (sec.) & Mem. (MB)\\ \midrule GloRo & 6C2F & 0.4 & 1.8 \\ KW & 6C2F & 2,515.6 & 1,437.5 \\ BCP & 6C2F & 5.8 & 19.1 \\ \midrule RS$^*$ & 6C2F & 36,845.5 & 19.8 \\ \bottomrule \end{tabular} } \caption{}\label{fig:eval:cert-results} \vspace{3em} \resizebox{\textwidth}{!}{% \begin{tabular}{l|c|cc} \toprule \textit{method} \hspace{1em} & global UB & global LB & local LB \\ \midrule \multicolumn{4}{c}{\textbf{MNIST} $(\epsilon=1.58)$} \\ \midrule Standard & $5.4\cdot10^4$ & $1.4\cdot10^2$ & $17.1$ \\ GloRo & $2.3$ & $1.9$ & $0.8$ \\ \midrule \multicolumn{4}{c}{\textbf{CIFAR-10} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule Standard & $1.2\cdot10^7$ & $1.1\cdot10^3$ & $96.2$ \\ GloRo & $15.8$ & $11.0$ & $3.7$ \\ \midrule \multicolumn{4}{c}{\textbf{Tiny-Imagenet} $(\epsilon=\nicefrac{36}{255})$} \\ \midrule Standard & $2.2\cdot10^7$ & $3.6\cdot10^2$ & $40.7$ \\ GloRo & $12.5$ & $5.9$ & $0.8$ \\ \bottomrule \end{tabular} } \caption{}\label{fig:eval:lipschitz-results} \end{subfigure} \caption{ \textbf{(\subref{fig:eval:train-results})} Certifiable training evaluation results on benchmark datasets. Best results are highlighted in bold. Randomized Smoothing (RS) is marked with a * superscript to indicate that it provides only a \emph{stochastic} robustness guarantee. Training cost for RS is omitted as it essentially post-processes standard-trained models (see Appendix~\ref{appendix:memory_usage} for more details). A $\dagger$ superscript on the number of epochs denotes that an early-stop callback was used to determine convergence. \textbf{(\subref{fig:eval:cert-results})} Certification timing and memory usage results on CIFAR-10 ($\epsilon=\nicefrac{36}{255}$). \textbf{(\subref{fig:eval:lipschitz-results})} Upper and lower bounds on the global and average local Lipschitz constant. In (\subref{fig:eval:train-results}) and (\subref{fig:eval:cert-results}), peak GPU Memory usage is calculated per-instance by dividing the total measurement by the training or certification batch size. } \end{figure*} \subsection{Verified Accuracy}\label{sec:eval:accuracy} We first compare the VRA obtained by GloRo Nets to the VRA achieved by prior deterministic approaches. KW and BCP have been found to achieve the best VRA on the datasets commonly used in the previous literature~\cite{lee20local_margin,croce19mmr}. In Appendix~\ref{appendix:comprehensive_vra} we provide a more comprehensive comparison to the VRAs that have been reported in prior work. Figure~\ref{fig:eval:train-results} gives the best VRA achieved by standard training, GloRo Nets, KW, and BCP on several benchmark datasets and architectures. In accordance with prior work, we include the clean accuracy and the PGD accuracy as well. Whereas the VRA gives a lower bound on the number of correctly-classified points that are locally robust, the PGD accuracy serves as an upper bound on the same quantity. We also provide the (probabilistic) VRA achieved via Randomized Smoothing (RS)~\cite{cohen19smoothing} on each of the datasets in our evaluation, as a comparison to stochastic certification. We find that GloRo Nets consistently outperform the previous state-of-the-art deterministic VRA. On MNIST, GloRo Nets outperform all previous approaches with both $\ell_2$ bounds commonly used in prior work ($\epsilon = 0.3$ and $\epsilon = 1.58$). When $\epsilon = 0.3$, the VRA begins to approach the clean accuracy of the standard-trained model; for this bound, GloRo Nets outperform the previous best VRA (achieved by KW) by nearly two percentage points, accounting for roughly $33\%$ of the gap between the VRA of KW and the clean accuracy of the standard model. For $\epsilon = 1.58$, GloRo Nets improve upon the previous best VRA (achieved by BCP) by approximately $15$ percentage points---in fact, the VRA achieved by GloRo Nets in this setting even slightly exceeds that of Randomized Smoothing, despite the fact that RS provides only a stochastic guarantee. On CIFAR-10, GloRo Nets exceed the best VRA (achieved by BCP) by approximately $7$ percentage points. Finally, on Tiny-Imagenet, GloRo Nets outperform BCP by approximately $2$ percentage points, improving the state-of-the-art VRA by roughly $10\%$. KW was unable to scale to Tiny-Imagenet due to memory pressure. The results achieved by GloRo Nets in Figure~\ref{fig:eval:train-results} are achieved using MinMax activations~\cite{anil19a} rather than ReLU activations, as we found MinMax activations provide a substantial performance boost to GloRo Nets. We note, however, that both KW and BCP tailor their analysis specifically to ReLU activations, meaning that they would require non-trivial modifications to support MinMax activations. Meanwhile, GloRo Nets easily support generic activation functions, provided the Lipschitz constant of the activation can be bounded (e.g., the Lipschitz constant of a MinMax activation is $1$). Moreover, even with ReLU activations, GloRo Nets outperform or match the VRAs of KW and BCP; Appendix~\ref{appendix:minmax_vs_relu} provides these results for comparison. \subsection{Training and Certification Cost}\label{sec:eval:cost} A key advantage to GloRo Nets over prior approaches is their ability to achieve state-of-the-art VRA (see Section~\ref{sec:eval:accuracy}) using a global Lipschitz bound. As discussed in Section~\ref{sec:local_bounds}, this confers performance benefits---both at train and test time---over using a local bound (e.g., BCP), or other expensive approaches (e.g., KW). Figure~\ref{fig:eval:train-results} shows the cost of each approach both in time per epoch and in memory during training (results given for CIFAR-10). All timings were taken on a machine using a Geforce RTX 3080 accelerator, 64 GB memory, and Intel i9 10850K CPU, with the exception of those for the KW~\cite{NEURIPS2018_358f9e7b} method, which were taken on a Titan RTX card for toolkit compatibility reasons. Appendix~\ref{appendix:memory_usage} provides further details on how memory usage was measured. Because different batch sizes were used to train and evaluate each model, we control for this by reporting the memory used \emph{per instance in each batch}. The cost for standard training is included for comparison. The training cost of RS is omitted, as RS does not use a specialized training procedure, and is thus comparable to standard training. Appendix~\ref{appendix:memory_usage} provides more information on this point. We see that KW is the most expensive approach to train, requiring tens to hundreds of seconds per epoch and roughly $35\times$ more memory per batch instance than standard training. BCP is less expensive than KW, but still takes nearly one minute per epoch on MNIST and CIFAR and 15 minutes on Tiny-Imagenet, and uses anywhere between $5$-$106\times$ more memory than standard training. Meanwhile, the cost of GloRo Nets is more comparable to that of standard training than of KW or BCP, taking only a few seconds per epoch, and at most $50\%$ more memory than standard training. Because of its memory scalability, we were able to use a larger batch size with GloRo Nets. As a result, more epochs were required during training however, this did not outweigh the significant reduction in time per epoch, as the total time for training was still only at most half of the total time for BCP. Figure~\ref{fig:eval:cert-results} shows the cost of each approach both in the time required to certify the entire test set and in the memory used to do so (results given for CIFAR-10). KW is the most expensive deterministic approach in terms of time and memory, followed by BCP. Here again, GloRo Nets are far superior in terms of cost, making certified predictions over $14\times$ faster than BCP with less than a tenth of the memory, and over 6,000$\times$ faster than KW. We thus conclude that GloRo Nets are the most scalable state-of-the-art technique for robustness certification. As reported in Figure~\ref{fig:eval:train-results}, Randomized Smoothing typically outperforms the VRA achieved by GloRo Nets, and is also inexpensive to train; though the VRA achieved by RS reflects a stochastic guarantee rather than a deterministic one. However, we see in Figure~\ref{fig:eval:cert-results} that GloRo Nets are \emph{several orders of magnitude} faster at certification than RS. GloRo Nets perform certification in a single forward pass, enabling certification of the entire CIFAR-10 test set in \emph{under half a second}; on the other hand, RS requires tens of thousands of samples to provide confident guarantees, reducing throughput by orders of magnitude and requiring over \emph{ten hours} to certify the same set of instances. \subsection{Lipschitz Tightness}\label{sec:eval:tightness} Theorem~\ref{thm:global_vs_local} demonstrates that a global Lipschitz bound is theoretically sufficient for certifying $2\epsilon$-separated data. However, as discussed in Section~\ref{sec:local_bounds}, there may be several practical limitations making it difficult to realize a network satisfying Theorem~\ref{thm:global_vs_local}; we now assess how these limitations are borne out in practice by examining the Lipschitz bounds that GloRo Nets use for certification. \citet{weng18fastlip} report that an upper bound on the global Lipschitz constant is not capable of certifying robustness for a non-trivial radius. While this is true of models produced via \emph{standard training}, GloRo Nets impose a strong implicit regularization on the global Lipschitz constant. Indeed, Figure~\ref{fig:eval:lipschitz-results} shows that the global upper bound is several orders of magnitude smaller on GloRo Nets than on standard networks. Another potential limitation of using an upper bound of the global Lipschitz constant is the bound itself~\cite{huster2018limitations}. Figure~\ref{fig:eval:lipschitz-results} shows that a lower bound of the Global Lipschitz constant, obtained via optimization, reaches an impressive $83\%$ of the upper bound on MNIST, meaning that the upper bound is fairly tight. On CIFAR-10 and Tiny-Imagenet the lower bound reaches approximately $70\%$ and $47\%$ of the upper bound, respectively. However, on a standard model, the lower bound is potentially orders of magnitude looser. These results show there is still room for improvement; for example, using the lower bound in place of the upper bound would lead to roughly a $10\%$ increase in VRA on CIFAR-10, from $58\%$ to $64\%$. However, the fact that the bound is tighter for GloRo Nets suggests the objective imposed by the GloRo Net helps by incentivizing parameters for which the upper bound estimate is sufficiently tight for verification. Finally, we compare the global upper bound to an empirical lower bound of the local Lipschitz constant. The local lower bound given in Figure~\ref{fig:eval:lipschitz-results} reports the \emph{mean} local Lipschitz constant found via optimization in the $\epsilon$-balls centered at each of the test points. In the construction given for the proof of Theorem~\ref{thm:global_vs_local}, the local Lipschitz constant is the same as the global bound at all points. While the results in Figure~\ref{fig:eval:lipschitz-results} show that this may not be entirely achieved in practice, the ratio of the local lower bound to the global upper bound is essentially zero in the standard models, compared to $6$-$35\%$ in the GloRo Nets, establishing that the upper bound is again much tighter for GloRo Nets. Still, this suggests that a reasonably tight estimate of the local bound may yet help improve the VRA of a GloRo Net at runtime, although this is a challenge in its own right. Intriguingly, GloRo Nets outperform BCP, which utilizes a \emph{local} Lipschitz bound for certification at train and test time, suggesting that GloRo Nets provide a better objective for certifiable robustness despite using a looser bound during training. We provide further discussion of the upper and lower bounds, and details for how the lower bounds were obtained in Appendix~\ref{appendix:lower_bounds}. \section{Introduction}\label{sec:intro} We consider the problem of training neural networks that are robust to input perturbations with bounded $\ell_p$ norm. Precisely, given an input point, $x$, network, $F$, and norm bound, $\epsilon$, this means that $F$ makes the same prediction on all points within the $\ell_p$-ball of radius $\epsilon$ centered at $x$. This problem is significant as deep neural networks have been shown to be vulnerable to \emph{adversarial examples}~\cite{PapernotMJFCS16,SzegedyZSBEGF13}, wherein perturbations are chosen to deliberately cause misclassification. While numerous heuristic solutions have been proposed to address this problem, these solutions are often shown to be ineffective by subsequent adaptive attacks~\cite{Carlini17Detected}. Thus, this paper focuses on training methods that produce models whose robust predictions can be efficiently certified against adversarial perturbations~\cite{lee20local_margin,tsuzuku18margin,NEURIPS2018_358f9e7b}. \begin{figure}[t] \centering \includegraphics[page=1, height=0.55\columnwidth]{figures/global_robustness_example.pdf} \caption{ Illustration of global robustness. The model abstains from predicting on the margin between the classes (dark gray), which has width at least $\epsilon$. } \label{fig:margin_example} \end{figure} We begin by introducing a notion of \emph{global robustness} for classification models (Section~\ref{sec:global_rob}), which requires that classifiers maintain a separation of width at least $\epsilon$ (in feature space) between any pair of regions that are assigned different prediction labels. This separation means that there are certain inputs on which a globally-robust classifier must refuse to give a prediction, instead signaling that a violation has occurred (see Figure~\ref{fig:margin_example}). While requiring the model to abstain in some cases may at first appear to be a hindrance, we note that in operational terms this is no different than composing a model with a routine that only returns predictions when $\nicefrac{\epsilon}{2}$-local robustness can be certified. While it is straightforward to construct a globally-robust model in this way via composition with a certification procedure, doing so with most current certification methods leads to severe penalties on performance or utility. Most techniques for verifying local robustness are costly even on small models~\cite{Fischetti18MILP,fromherz20fgp,gehr2018ai,jordan19geocert,tjeng18MIP}, requiring several orders of magnitude more time than a typical forward pass of a network; on moderately-large CNNs, these techniques either time out after minutes or hours, or simply run out of memory. One approach to certification that shows promise in this regard uses Lipschitz bounds to efficiently calculate the robustness region around a point~\cite{weng18fastlip,zhang18crown}. In particular, when \emph{global} bounds are used with this approach, it is possible to implement the bound computation as a neural network of comparable size to the original (Section~\ref{sec:bounds}), making on-line certification nearly as efficient as inference. Unfortunately, current training methods do not produce models with sufficiently small global bounds for this to succeed~\cite{weng18fastlip}. Recent work~\cite{lee20local_margin} explored the possibility of training networks with sufficiently small \emph{local} bounds, but the training cost in time and memory remains prohibitive in many cases. Surprisingly, we find that using global Lipschitz bounds for certification may not be as limiting as previously thought~\cite{huster2018limitations,yang20acc_rob_tradeoff}. We show that for any set of points that can be robustly-classified using a local Lipschitz bound, there exists a model whose global bound implies the same robust classification (Theorem~\ref{thm:global_vs_local}). This motivates a new approach to certifiable training that makes exclusive use of global bounds (Section~\ref{sec:gloro_nets}). Namely, we construct a globally-robust model that incorporates a Lipschitz bound in its forward pass to define an additional ``robustness violation'' class, and use standard training methods to discourage violations while simultaneously encouraging accuracy. Focusing on the case of deterministic guarantees against $\ell_2$-bounded perturbations, we show that this approach yields state-of-the-art verified-robust accuracy (VRA), while imposing little overhead during training and \emph{none} during certification. For example, we find that we can achieve $63\%$ VRA with a large robustness radius of $\epsilon = 1.58$ on MNIST, surpassing all prior approaches by multiple percentage points. We also achieve state-of-the-art VRA on CIFAR-10, and scale to larger applications such as Tiny-Imagenet (see Section~\ref{sec:eval}). To summarize, we provide a method for training certifiably-robust neural networks that is simple, fast, capable of running with limited memory, and that yields state-of-the-art deterministic verified accuracy. We prove that the potential of our approach is not hindered by its simplicity; rather, its simplicity is an asset---our empirical results demonstrate the many benefits it enjoys over more complicated methods. \section{Constructing Globally-Robust Networks}\label{sec:method} In this section we present our method for constructing globally-robust networks, which we will refer to as \emph{GloRo Nets}. We begin in Section~\ref{sec:global_rob} by formally introducing our notion of \emph{global robustness}, after briefly covering the essential background and notation. We then show how to mathematically construct GloRo Nets in Section~\ref{sec:gloro_nets}, and prove that our construction is globally robust. \subsection{Global Robustness}\label{sec:global_rob} Let $f : \mathds{R}^n \rightarrow \mathds{R}^m$ be a neural network that categorizes points into $m$ different classes. Let $F$ be the function representing the predictions of $f$, i.e., $F(x) = \text{argmax}_{i}\left\{f_i(x)\right\}$. $F$ is said to be $\epsilon$-\emph{locally-robust} at point $x$ if it makes the same prediction on all points in the $\epsilon$-ball centered at $x$ (Definition~\ref{def:local_robustness}). \begin{definition} \label{def:local_robustness} (Local Robustness) A model, $F$, is $\epsilon$-\emph{locally-robust} at point, $x$, with respect to norm, $||\cdot||$, if~~$\forall$ $x'$, $$ ||x - x'|| \leq \epsilon \ \ \Longrightarrow \ \ F(x) = F(x'). $$ \end{definition} Most work on robustness verification has focused on this local robustness property; in this work, we present a natural notion of \emph{global robustness}, which captures the operational properties of on-line local robustness certification. Clearly, local robustness cannot be simultaneously satisfied at every point---unless the model is entirely degenerate, there will always exist points that are arbitrarily close to a decision boundary. Instead, we will introduce a global robustness definition that can be satisfied even on models with non-trivial behavior by using an additional class, $\bot$, that signals that a point cannot be certified as globally robust. At a high level, we can think of separating each of the classes with a margin of width at least $\epsilon$ in which the model always predicts $\bot$. In order to satisfy global robustness, we require that no two points at distance $\epsilon$ from one another are labeled with different non-$\bot$ classes. More formally, let us define the following relation ($\classRel$): we will say that $c_1 \classRel c_2$ if $c_1 = \bot$ or $c_2 = \bot$ or $c_1 = c_2$. Using this relation, we provide our formal notion of global robustness in Definition~\ref{def:global_robustness}. \begin{definition} \label{def:global_robustness} (Global Robustness) A model, $F$, is $\epsilon$-\emph{globally-robust}, with respect to norm, $||\cdot||$, if~~$\forall$ $x_1$, $x_2$, $$ ||x_1 - x_2|| \leq \epsilon \ \ \Longrightarrow \ \ F(x_1) \classRel F(x_2). $$ \end{definition} An illustration of global robustness is shown in Figure~\ref{fig:margin_example}. While global robustness can clearly be trivially satisfied by labeling all points as $\bot$, we note that the objective of robust training is typically to achieve high robustness \emph{and} accuracy (i.e., VRA), thus ideally only points off the data manifold are labeled $\bot$, as illustrated in Figure~\ref{fig:margin_example}. \subsection{Certified Globally-Robust Networks}\label{sec:gloro_nets} Because of the threat posed by adversarial examples, and the elusiveness of such attacks against heuristic defenses~\cite{Carlini17Detected}, there has been a volume of previous work seeking to verify local robustness on specific points of interest. In this work, we shift our focus to global robustness directly, resulting in a method for producing models that make predictions that are verifiably robust \emph{by construction}. Intuitively, we aim to instrument a model with an extra output, $\bot$, that labels a point as ``not locally-robust,'' such that the instrumented model predicts a non-$\bot$ class \emph{only if the point is locally-robust} (with respect to the original model). At a high level, we do this by ensuring that in order to avoid predicting $\bot$, the maximum output of $f$ must surpass the other outputs by a sufficient margin. While this margin is measured in the output space, we can ensure it is sufficiently large to ensure local robustness by relating the output space to the input space via an upper bound on the model's Lipschitz constant. Suppose that $K_i$ is an upper bound on the Lipschitz constant for $f_i$. I.e., for all $x_1$, $x_2$, Equation~\ref{eq:lipschitz_def} holds. Intuitively, $K_i$ bounds the largest possible change in the logit output for class $i$ per unit change in the model's input. \begin{equation} \label{eq:lipschitz_def} \frac{|f_i(x_1) - f_i(x_2)|}{||x_1 - x_2||} \leq K_i \end{equation} Let $y = f(x)$, and let $j = F(x)$, i.e., the class predicted on point $x$. Let $y_\bot = \max_{i\neq j}\left\{y_i + (K_i + K_j)\epsilon\right\}$. Intuitively, $y_\bot$ captures the value that the class that is most competitive with the chosen class would take under the worst-case change to $x$ within an $\epsilon$-ball. Figure~\ref{fig:construction_illustration} provides an illustration of this intuition. We then define the instrumented model, or GloRo Net, $\margin f$, as follows: $\margin f_i(x) ::= y_i$ $\forall i\in[m]$ and $\margin f_\bot(x) ::= y_\bot$; that is, $\margin f$ concatenates $y_\bot$ with the output of $f$. \begin{figure} \centering \resizebox{\columnwidth}{!}{% \includegraphics{figures/construction_illustration.pdf}} \caption{ Illustration of calculating the $\bot$ logit. Note that $\epsilon K_i$ provides a bound on changes to logit $i$ within an $\epsilon$-ball. The $\bot$ logit is chosen to account for the predicted class \emph{decreasing} by the maximum amount and each other class \emph{increasing} by the maximum amount. If the $\bot$ logit does not surpass that of the predicted class, then no class can overtake the predicted class within an $\epsilon$-ball (Theorem~\ref{thm:local_robustness}). } \label{fig:construction_illustration} \end{figure} We show that the predictions of this GloRo Net, $\margin F$, can be used to certify the predictions of the instrumented model, $F$: whenever $\margin F$ predicts a class that is not $\bot$, the prediction coincides with the prediction of $F$, and $F$ is guaranteed to be locally robust at that point (Theorem~\ref{thm:local_robustness}). \begin{theorem} \label{thm:local_robustness} If $\margin F(x) \neq \bot$, then $\margin F(x) = F(x)$ and $F$ is $\epsilon$-locally-robust at $x$. \end{theorem} The proof of Theorem~\ref{thm:local_robustness} is given in Appendix~\ref{proof:local_robustness}. Note that in this formulation, we assume that the predicted class, $j$, will decrease by the maximum amount within the $\epsilon$-ball, while all other classes increase by their respective maximum amounts. This is a conservative assumption that guarantees local robustness; however, in practice, we can dispose of this assumption by instead calculating the Lipschitz constant of the margin by which the logit of the predicted class surpasses the other logits, i.e., the Lipschitz constant of $y_j - y_i$ for $i\neq j$. The details of this tighter variant are presented in Appendix~\ref{proof:tighter_bound}, along with the corresponding correctness proof. Notice that the GloRo Net, $\margin F$, will always predict $\bot$ on points that lie directly on the decision boundary of $F$. Moreover, any point that is within $\epsilon$ of the decision boundary will also be labeled as $\bot$ by $\margin F$. From this, it is perhaps clear that GloRo Nets achieve global robustness (Theorem~\ref{thm:global_robustness}). \begin{theorem} \label{thm:global_robustness} $\margin[\nicefrac{\epsilon}{2}]{F}$ is $\epsilon$-globally-robust. \end{theorem} The proof of Theorem~\ref{thm:global_robustness} is given in Appendix~\ref{proof:global_robustness}. \section{Revisiting the Global Lipschitz Constant}\label{sec:local_bounds} The global Lipschitz constant gives a bound on the maximum rate of change in the network's output over the entire input space. For the purpose of certifying robustness, it suffices to bound the maximum rate of change in the network's output over any pair of points \emph{within the $\epsilon$-ball} centered at the point being certified, i.e., the \emph{local} Lipschitz constant. Recent work has explored methods for obtaining upper bounds on the local Lipschitz constant~\cite{weng18fastlip,zhang18crown,lee20local_margin}; the construction of GloRo Nets given in Section~\ref{sec:method} remains correct whether $K$ represents a global or a local Lipschitz constant. The advantage to using a local bound is, of course, that we may expect tighter bounds; after all, the local Lipschitz constant is no larger than the global Lipschitz constant. However, using a local bound also has its drawbacks. First, a local bound is typically more expensive to compute. In particular, a local bound always requires more memory, as each instance has its own bound, hence the required memory grows with the batch size. This in turn reduces the amount of parallelism that can be exploited when using a local bound, reducing the model's throughput. Furthermore, because the local Lipschitz constant is different for every point, it must be computed every time the network sees a new point. By contrast, the global bound can be computed in advance, meaning that verification via the global bound is essentially free. This makes the global bound advantageous, assuming that it can be effectively leveraged for verification. It may seem initially that a local bound would have greater prospects for successful certification. First, \emph{local} Lipschitzness is sufficient for robustly classifying well-separated data~\cite{yang20acc_rob_tradeoff}; that is, global Lipschitzness is not necessary. Meanwhile, global bounds on typical networks have been found to be prohibitively large~\cite{weng18fastlip}, while local bounds on in-distribution points may tend to be smaller on the same networks. However, the potential disadvantages of a global bound become less clear if the model is specifically trained to have a small global Lipschitz constant. For example, GloRo Nets that use a global Lipschitz constant will be penalized for incorrect predictions if the global Lipschitz constant is not sufficiently small to verify its predictions; therefore, the loss actively discourages any unnecessary steepness in the network function. In practice, this natural regularization of the global Lipschitz constant may serve to make the steepness of the network function more uniform, such that the global Lipschitz constant will be similar to the local Lipschitz constant. We show that this is possible in theory, in that for any network for which local robustness can be verified on some set of points using the local Lipschitz constant, there exists a model on which the same points can be certified using the global Lipschitz constant (Theorem~\ref{thm:global_vs_local}). This suggests that if training is successful, our approach has the same potential using a global bound as using a local bound. \begin{theorem}\label{thm:global_vs_local} Let $f$ be a binary classifier that predicts $1 \Longleftrightarrow f(x) > 0$. Let $K_L(x, \epsilon)$ be the local Lipschitz constant of $f$ at point $x$ with radius $\epsilon$. Suppose that for some finite set of points, $S$, $\forall x \in S$, $|f(x)| > \epsilon K_L(x, \epsilon)$, i.e., all points in $S$ can be verified via the local Lipschitz constant. Then there exists a classifier, $g$, with global Lipschitz constant $K_G$, such that $\forall x\in S$, (1) $g$ makes the same predictions as $f$ on $S$, and (2) $|g(x)| > \epsilon K_G$, i.e., all points in $S$ can be verified via the global Lipschitz constant. \end{theorem} \begin{figure}[t] \centering \includegraphics[page=1, height=0.5\columnwidth]{figures/proof_sketch.pdf} \caption{Illustration of a function, $g$, constructed to satisfy Theorem~\ref{thm:global_vs_local}. The points in $S$ are shown in light and dark gray, with different shades indicating different labels. The Voronoi tessellation is outlined in black, and the faces belonging to the decision boundary are highlighted in bold. The level curves of $g$ are shown in various shades of gray and correspond to points, $x$, at some fixed distance, $d(x)$, from the decision boundary.} \label{fig:proof_sketch} \end{figure} Theorem~\ref{thm:global_vs_local} is stated for binary classifiers, though the result holds for categorical classifiers as well. Details on the categorical case and the proof of Theorem~\ref{thm:global_vs_local} can be found in Appendix~\ref{proof:global_vs_local}; however we provide the intuition behind the construction here. The proof relies on the following lemma, which states that among locally-robust points, points that are classified differently from one another are $2\epsilon$-separated. The proof of Lemma~\ref{lemma:separation} can be found in Appendix~\ref{proof:separation}. \begin{lemma}\label{lemma:separation} Suppose that for some classifier, $F$, and some set of points, $S$, $\forall x \in S$, $F$ is $\epsilon$-locally-robust at $x$. Then $\forall x_1, x_2\in S$ such that $F(x_1) \neq F(x_2)$, $||x_1 - x_2|| > 2\epsilon$. \end{lemma} In the proof of Theorem~\ref{thm:global_vs_local}, we construct a function, $g$, whose output on point $x$ increases linearly with $x$'s minimum distance to any face in the Voronoi tessellation of $S$ that separates points in $S$ with different labels. An illustration with an example of $g$ is shown in Figure~\ref{fig:proof_sketch}. Notably, the local Lipschitz constant of $g$ is everywhere the same as the global constant. However, we note that while Theorem~\ref{thm:global_vs_local} suggests that networks exist \emph{in principle} on which it is possible to use the global Lipschitz constant to certify $2\epsilon$-separated data, it may be that such networks are not easily obtainable via training. Furthermore, as raised by \citet{huster2018limitations}, an additional potential difficulty in using the global bound for certification is the estimation of the global bound itself. Methods used for determining an upper bound on the global Lipschitz constant, such as the method presented later in Section~\ref{sec:bounds}, may provide a loose upper bound that is insufficient for verification even when the true bound would suffice. Nevertheless, our evaluation in Section~\ref{sec:eval} shows that in practice the global bound \emph{can} be used effectively for certification (Section~\ref{sec:eval:accuracy}), and that the bounds obtained on the models trained with our approach are far tighter than those obtained on standard models (Section~\ref{sec:eval:tightness}). \section{Implementation}\label{sec:implementation} In this section we describe how GloRo Nets can be trained and implemented. Section~\ref{sec:training} covers training, as well as the loss functions used in our evaluation, and Section~\ref{sec:bounds} provides detail on how we compute an upper bound on the global Lipschitz constant. \subsection{Training}\label{sec:training} Crucially, because certification is intrinsically captured by the GloRo Net's predictions---specifically, the $\bot$ class represents inputs that cannot be verified to be locally robust---a standard learning objective for a GloRo Net corresponds to a robust objective on the original model that was instrumented. That is, we can train a GloRo Net by simply appending a zero to the one-hot encodings of the original data labels (signifying that $\bot$ is never the correct label), and then optimizing a standard classification learning objective, e.g., with cross-entropy loss. Using this approach, $\margin F$ will be penalized for incorrectly predicting each point, $x$, unless $x$ is both predicted correctly \emph{and} $F$ is $\epsilon$-locally-robust at $x$. While the above approach is sufficient for training models with competitive VRA, we find that the resulting VRA can be further improved using a loss inspired by TRADES~\cite{zhang19trades}, which balances separately the goals of making \emph{correct} predictions, and making \emph{robust} predictions. Recent work~\cite{yang20acc_rob_tradeoff} has shown that TRADES effectively controls the local Lipschitz continuity of networks. While TRADES is implemented using adversarial perturbations, which provide an under-approximation of the robust error, GloRo Nets naturally lend themselves to a variant that uses an over-approximation, as shown in Definition~\ref{def:trades_loss}. \begin{definition}\label{def:trades_loss} (TRADES Loss for GloRo Nets) Given a network, $f$, cross-entropy loss $L_{\text{CE}}$, and parameter, $\lambda$, the GloRo-TRADES loss ($L_T$) of $(x, y)$ is $$ L_{T}(x,y) = L_{\text{CE}}\big(f(x), y\big) + \lambda D_{\text{KL}}\left(\margin f(x) || f(x)\right) $$ \end{definition} Intuitively, $L_T$ combines the normal classification loss with the over-approximate robust loss, assuming that the class predicted by the underlying model is correct. Empirically we find that using the KL divergence, $D_{\text{KL}}$, in the second term produces the best results, although in many cases using $L_{\text{CE}}$ in both terms works as well. \subsection{Bounding the Global Lipschitz Constant}\label{sec:bounds} There has been a great deal of work on calculating upper bounds on the Lipschitz constants of neural networks (see Section~\ref{sec:related} for a discussion). Our implementation uses the fact that the product of the spectral norm of each of the individual layers of a feed-forward network provides an upper bound on the Lipschitz constant of the entire network~\cite{SzegedyZSBEGF13}. That is, if the output at class $i$ of a neural network can be decomposed into a series of $k$ transformations, i.e., $f_i = h^k \circ h^{k-1} \circ \dots \circ h^1$, then Equation~\ref{eq:spectral_norm_bound} holds (where $||\cdot||$ is the spectral norm). \begin{equation}\label{eq:spectral_norm_bound} K_i \leq \prod_{j=1}^{k}{||h^j||} \end{equation} In the case of a CNN consisting of convolutional layers, dense layers, and ReLU activations, we use $1$ for the spectral norm of each of the ReLU layers, and we use the power method~\cite{farnia2018generalizable,Gouk2021} to compute the spectral norm of the convolutional and dense layers. \citeauthor{Gouk2021} also give a procedure for bounding the spectral norm of skip connections and batch normalization layers, enabling this approach on ResNet architectures. For more complicated networks, there is a growing body of work on computing layer-wise Lipschitz bounds for various types of layers that are commonly used in neural networks~\cite{zou2019lipschitz,fazlyab2019efficient,sedghi2018the,singla19arxiv,miyato2018spectral}. The power method may need several iterations to converge; however, we can reduce the number of iterations required at each training step by persisting the state of the power method iterates across steps. While this optimization may not guarantee an upper bound, this fact is inconsequential so long as we still obtain a model that can be certified with a true upper bound that is computed after training; this is actually not unreasonable to expect, presuming the underlying model parameters do not change too quickly. With a small number of iterations, the additional memory required to compute the Lipschitz constant via this method is approximately the same as to run the network on a single instance. At test time, the power method must be run to convergence; however, after training, the global Lipschitz bound will remain unchanged and therefore it can be computed once in advance. This means that new points can be certified with \emph{no additional non-trivial overhead}. \paragraph{$\ell_\infty$ Bounds.} While in this work, we focus on the $\ell_2$ norm, the ideas presented in Section~\ref{sec:method} can be applied to other norms, including the $\ell_\infty$ norm. However, we find that the analogue of the approximation of the global Lipschitz bound given by Equation~\ref{eq:spectral_norm_bound} is loose in $\ell_\infty$ space. Meanwhile, a large volume of prior work applies $\ell_\infty$-specific certification strategies that proven effective for $\ell_\infty$ certification~\cite{zhang20crown_ibp,balunovic20colt,Gowal_2019_ICCV}. \section{Related Work}\label{sec:related} Utilizing the Lipschitz constant to certify robustness has been studied in several instances of prior work. On discovering the existence of adversarial examples, \citet{SzegedyZSBEGF13} analyzed the sensitivity of neural networks using a global Lipschitz bound, explaining models' ``blind spots'' partially in terms of large bounds and suggesting Lipschitz regularization as a potential remedy. \citet{huster2018limitations} noted the potential limitations of using global bounds computed layer-wise according to Equation~\ref{eq:spectral_norm_bound}, and showed experimentally that direct regularization of the Lipschitz constant by penalizing the weight norms of a two-layer network yields subpar results on MNIST. While Theorem~\ref{thm:global_vs_local} does not negate their concern, as it may not always be feasible to compute a tight enough bound using Equation~\ref{eq:spectral_norm_bound}, our experimental results show to the contrary that global bounds can suffice to produce models with at least comparable utility to several more expensive and complicated techniques. More recently, \citet{yang20acc_rob_tradeoff} showed that robustness and accuracy need not be at odds on common benchmarks when locally-Lipschitz functions are used, and call for further investigation of methods that impose this condition while promoting generalization. Our results show that globally-Lipschitz functions, which bring several practical benefits (Section~\ref{sec:local_bounds}), are a promising direction as well. Lipschitz constants have been applied previously for fast post-hoc certification~\cite{weng18fastlip,hein2017lipschitz,weng2018evaluating}. While our work relies on similar techniques, our exclusive use of the global bound means that no additional work is needed at inference time. Additionally, we apply this certification only to networks that have been optimized for it. There has also been prior work seeking to use Lipschitz bounds, or close analogues, during training to promote robustness~\cite{tsuzuku18margin,raghunathan2018certified,cisse17a,cohen2019universal,anil19a,pauli21control,qin19locallin,finlay_2019_scaleable,lee20local_margin,Gouk2021,singla19arxiv,farnia2018generalizable}. \citet{cisse17a} introduced Perseval networks, which enforce contractive Lipschitz bounds on all layers by orthonormalizing their weights. \citet{anil19a} proposed replacing ReLU activations with sorting activations to construct a class of \emph{universal Lipschitz approximators}, that that can approximate any Lipschitz-bounded function over a given domain, and \citet{cohen2019universal} subsequently studied the application to robust training; these advances in architecture complement our work, as noted in Appendix~\ref{appendix:minmax_vs_relu}. The closest work in spirit to ours is Lipschitz Margin Training (LMT)~\cite{tsuzuku18margin}, which also uses global Lipschitz bounds to train models that are more certifiably robust. The approach works by constructing a loss that adds $\sqrt{2}\epsilon K_G$ to all logits other than that corresponding to the ground-truth class. Note that this is different from GloRo Nets, which add a \emph{new logit} defined by the \emph{predicted} class at $x$. In addition to providing different gradients than those of LMT's loss, our approach avoids penalizing logits corresponding to boundaries distant from $x$. In practical terms, \citet{lee20local_margin} showed that LMT yields lower verified accuracy than more recent methods that use local Lipschitz bounds~\cite{lee20local_margin} or dual networks~\cite{NEURIPS2018_358f9e7b}, while Section~\ref{sec:eval:accuracy} shows that our approach can provide greater verified accuracy than either. LMT's use of global bounds means its cost is comparable to our approach. More recently, \citet{lee20local_margin} explored the possibility of training networks against local Lipschitz bounds, motivated by the fact that the global bound may vastly exceed a typical local bound on some networks. They showed that a localized refinement of the global spectral norm of the network offers a reasonable trade-off of precision for cost, and were able to achieve competitive, and in some cases superior, verified accuracy to prior work. Theorem~\ref{thm:global_vs_local} shows that in principle, the difference in magnitude between local and global bounds may not matter for robust classification. Moreover, while it is true that the bounds computed by Equation~\ref{eq:spectral_norm_bound} may be loose on some models, our experimental results suggest that it is possible in many cases to mitigate this limitation by training against a global bound with the appropriate loss. The advantages of doing so are apparent in the cost of both training and certification, where the additional overhead involved with computing tighter local bounds is an impediment to scalability. Finally, several other methods have been proposed for training $\ell_2$-certifiable networks that are not based on Lipschitz constants. For example, \citet{wong2017provable} use an LP-based approach that can be optimized relatively efficiently using a \emph{dual network}, \citet{croce19mmr} and \citet{madry2018towards} propose training routines based on maximizing the size of the linear regions within a network, and \citet{mirman18diffai} propose a method based on abstract interpretation. \paragraph{Randomized Smoothing.} The certification methods discussed thus far provide \emph{deterministic} robustness guarantees. By contrast, another recent approach, Randomized Smoothing~\cite{cohen19smoothing,lecuyer18smoothing}, provides \emph{stochastic} guarantees---that is, points are certified as \emph{robust with high probability} (i.e., the probability can be bounded from below). Randomized Smoothing has been found to achieve better VRA performance than any deterministic certification method, including GloRo Nets. However, GloRo Nets compare favorably to Randomized Smoothing in a few key ways. First, the fact that GloRo Nets provide a deterministic guarantee is an advantage in and of itself. In safety-critical applications, it may not be considered acceptable for a small fraction of adversarial examples to go undetected; meanwhile, Randomized Smoothing is typically evaluated with a false positive rate around $0.1\%$~\cite{cohen19smoothing}, meaning that instances of incorrectly-certified points are to be expected in validation sets with thousands of points. Furthermore, as demonstrated in Section~\ref{sec:eval:cost}, GloRo Nets have far superior run-time cost. Because Randomized Smoothing does not explicitly represent the function behind its robust predictions, points must be evaluated and certified using as many as 100,000 samples~\cite{cohen19smoothing}, reducing throughput by several orders of magnitude. Meanwhile, GloRo Nets can certify a batch of points in \emph{a single forward pass}.
\section{\label{sec:introduction}Introduction} \begin{figure}[tb] \centering \includegraphics[width=.95\columnwidth]{overview_flowchart.pdf} \caption{\label{fig:1}Schematic depiction of the key workflow steps in computational molecular and materials {modeling}: Model building and method choice, electronic structure calculations, structure exploration and dynamics, and connection to experiment. All of these steps can benefit from ML models. In many cases ML methods do not just enhance existing approaches, but also open avenues {toward} new workflows. } \end{figure} Atomistic and electronic structure simulations based on quantum theoretical calculations form a central aspect of modern chemistry and materials research. {They enable the prediction of molecular and materials properties from first-principles as well as the simulation of atomic-scale dynamics. On this basis, computational chemists and physicists in academia and industry contribute to fundamental mechanistic understanding of chemical processes, to the identification of novel materials, and the optimization of existing ones.} Over the last few decades, computational molecular simulation has been firmly established in the chemical sciences as an important part of the method portfolio. This was accompanied by a move to streamline and optimize common workflows for model building and simulation (see Figure \ref{fig:1}). {Algorithms for molecular geometry optimization, efficient molecular dynamics simulations, and electronic structure calculations perform highly specialized tasks while being massively scalable and parallelized across a diverse range of hardware architectures.~\cite{ESL,ELSI}} Simultaneously, PhD graduates in the field have been trained to be expert users of existing and developers of new simulation workflows. This is the \emph{status quo} at the time when machine learning (ML) methods enter the stage. \comment{The application of ML to atomistic simulation and electronic structure theory has been developing rapidly since its earliest works in a modern context.~\cite{behler2007,Carbogno2008PRL,Dawes2008JCP,Manzhos2009,Bartok2010,rupp2012fast,Netzloff2006JCP,Evenhuis2011JCP,Braams2009IRPC}} A number of excellent reviews have recently been written to highlight progress in various contexts including the role of ML in catalyst design,~\cite{freeze2019search,Elton2019} in the development of force-fields and interatomic potentials for ground state properties{~\cite{Behler2017, Mueller2020, Manzhos2020_review, Gkeka2020,Unke2020arXiv,Deringer2019AM}} and excited states,~\comment{\cite{Westermayr2020CR,Westermayr2020MLST_Perspective,Dral2021NRC}} in quantum chemistry,~\cite{Dral2020,von2020exploring} in finding solutions to the Schr\"odinger equation,~\cite{Manzhos2020} and the role of unsupervised learning in atomistic simulation~\cite{Ceriotti2019} (see Table I for a non-exhaustive list). An excellent retrospective of the last decade of ML in the context of chemical discovery has recently been published by von Lilienfeld and Burke,~\citep{Lilienfeld2020NC} predicting a bright future in the context of ML for quantum chemistry that lies ahead. Indeed, not a day goes by without another novel ML approach being published, which promises to predict atomic and electronic properties of molecules and materials at ever greater accuracy and efficiency. {A main goal of many ML models is the parametrization of analytical models to represent electronic structure. These ML models can then be evaluated extremely fast. Thus ML models can speed up simulations to achieve longer time and length scales. Their efficiency depends strongly on the design of descriptors or neural network architectures that optimally chart the vast space of chemical compounds and materials.}~\cite{Lilienfeld2018review,schutt2020machine} These approaches have the potential to fundamentally change day-to-day practices, workflows and paradigms in atomistic and quantum simulation {as they become more tightly integrated with existing tools}. \textbf{But how exactly will ML affect the method portfolio of future computational scientists working in electronic structure theory and molecular simulation?} How will this affect a practitioner who wants to determine the equilibrium structure and ground-state energy of a molecular system using electronic structure theory? How will it change the required expertise and demands on PhD graduates? \comment{For the uninitiated, it is easy to get lost in the vast array of ML models, which might soon be comparable to the zoo of exchange-correlation functionals available in density functional theory (DFT).~\cite{Becke2014JCP}} What will become the ML equivalent of go-to DFT functionals for practitioners? At the moment, there are relatively few examples where ML models have become generally applicable to researchers outside the immediate circle of developers. In this perspective, we are discussing recent advances through the lens of their potential benefit to a wide community of computational molecular scientists {who are not ML experts. Our goal is} to identify future possibilities of permanent integration of ML-based approaches into workflows and electronic structure and simulation software packages. {This can for example involve a common code base and data structure for ML and simulation algorithms or bidirectional data exchange between workflows based on ML or physical simulation.} Central to this perspective is the question how ML can effectively address the computational bottlenecks {and capability gaps} in electronic structure calculations and molecular simulations and what are the steps needed to make ML an integral part of the method portfolio of this field. \comment{Our goal is to make this account as accessible as possible and to highlight applications and approaches that the community might want to keep track of in the future.} We stress that our aim is not to provide a comprehensive review of existing {ML descriptors, representations, and} approaches, which is beyond the scope of this perspective {and well covered by further reading} material in Table \ref{tab:my_label}. Following the key steps of molecular {modeling} shown in Figure \ref{fig:1}, each section focuses on how ML methods can benefit a central workflow or aspect of computational molecular and material science {(\textit{cf.} highlighted sentences in each paragraph)}. We place a particular focus on approaches that have the potential to augment existing or introduce new prevalent approaches. \begin{table}[t] \centering \begin{tabular}{lll} \toprule \textbf{Year} & \textbf{References} & \textbf{Topic of ML Review} \\ \midrule 2017 &\citet{Behler2017} & Interatomic Potentials \\ 2018 & \citet{Goldsmith2018} & ML in Catalysis \\ 2019 & \citet{Carleo2019} & ML in Physical Sciences \\ 2019 & \citet{Yang2019CR} & Drug Discovery \\ 2019 & \citet{Elton2019} & Molecular Design \\ 2019 & \citet{Schleder2019} & ML in Materials Science \\ 2019 & \citet{Ceriotti2019} & Unsupervised Learning \\ 2020 & \citet{Dral2020} & ML in Quantum Chemistry \\ 2020 & \citet{noe2020machine} & Molecular Simulation \\ 2020 & von Lilienfeld \textit{et al.} \cite{von2020exploring} & Chemical Space \\ 2020 & Mueller \textit{et al.} \cite{Mueller2020} & Interatomic Potentials \\ 2020 & Manzhos \textit{et al.} \cite{Manzhos2020_review} & Small Molecules and Reactions \\ 2020 & \citet{Gkeka2020} & Force Fields \& Coarse Graining \\ 2020 & \citet{Unke2020arXiv} & Force Fields \\ 2020 & \citet{Toyao2020_ACS_Catalysis} & Catalysis Informatics \\ 2020 & \citet{Manzhos2020} & ML in Electronic Structure \\ 2020 & Westermayr \textit{et al.}\cite{Westermayr2020CR} & ML for Excited States \\ 2021 & \citet{Behler2021} & Neural Network Potentials \\ \bottomrule \end{tabular} \caption{Overview of recent reviews of machine learning methods in electronic structure theory and atomistic simulation. This is not intended to be a complete list of all reviews on the subject, but a selection of suggested further reading.} \label{tab:my_label} \end{table} \section{Machine Learning Primer}\label{sec:mlprimer} {We start by introducing basic terminology and concepts of ML that will be used in the remaining sections of the perspective.} ML is concerned with algorithms that improve with increasing amount of available data under some performance measure. {Statistical learning theory offers a general framework to find predictive functions $f: \mathcal{X} \rightarrow \mathcal{Y}$ mapping an input space $\mathcal{X}$ to a target space $\mathcal{Y}$.~\cite{hastie2009elements} } In contrast to conventional physical models, where one often starts with clear assumptions about the system to be modelled, ML focuses on \emph{universal approximators}. These are able to represent any function with arbitrary accuracy, when given enough training data and parameters. {Examples for this class of models are Gaussian processes (GPs) or neural networks (NNs).~\cite{leshno1993multilayer} GPs are defined by linear combinations of the covariances between data points. These are given by a suitable (nonlinear) kernel function. NNs consist of a sequence of multiple linear transforms, alternated with nonlinear \emph{activation functions}. This is also referred to as \emph{deep learning}, where each set of transform and nonlinearity is called a \emph{layer}.} {The functional relationship to be found is specified by choosing a suitable \emph{loss function}. If the loss $\ell(f(x), y)$ requires knowledge of the targets $y \in \mathcal{Y}$, this is called \textbf{supervised learning}. This includes classification and regression for categorical and continuous target spaces $\mathcal{Y}$, respectively (see also Fig. \ref{fig:2}).} ML force fields are examples of regression tasks (see section \ref{sec:QM}),~\cite{hansen2013assessment} {where often the squared error is used as loss function. } For instance, classifiers can be used to automatically select appropriate quantum chemistry methods for a given system (see section \ref{sec:model}). In contrast, \textbf{unsupervised ML} aims to find patterns in the data that are specified by a loss function without having access to the ground truth targets $y$. {Tasks falling under this category include clustering, dimensionality reduction, or density estimation of the data distribution}. In the context of computational chemistry, unsupervised ML finds application in post-processing and analysis of {molecular} simulation data, {\textit{e.g.}}{,} in {identifying collective variables (CVs)}and reaction pathways that will be discussed in section \ref{sec:QD} (see also Fig. \ref{fig:2}). {The optimal predictive function minimizes the \emph{expected risk}, {\textit{i.e.}}, the expectation of the loss function weighted by the probability distribution over the data.~\cite{muller2001introduction} However, the data distribution is usually unknown and, in supervised learning, the loss requires access to the targets. Thus, one instead optimizes the \emph{empirical risk}, {\textit{i.e.}}, the expectation over a training set sampled from the data distribution. This could for example consist of electronic structure calculations of systems $x \in \mathcal{X}$ with properties $y \in \mathcal{Y}$. Since there typically exist many possible approximates that fit a finite training set, one introduces regularizer terms to the optimization problem, which punish complex solutions. This avoids \emph{overfitting}, {\textit{i.e.}}, an increased error on unseen data due to approximating a simple functional relationship with an overly complex function on the training set.} {Another important aspect to consider is the selection of training examples, which should be representative of the distribution encountered when applying the ML model. This requires not only a sufficient number of training examples, but also sufficient coverage of the input space. If an ML model is applied outside of its training domain, {\textit{i.e.}}, if it is used for extrapolation, its predictions quickly become unreliable. \emph{Active learning} aims to detect this and acquire additional training data in the corresponding regions. Similarly, \emph{Bayesian optimization} is an approach for global search that obtains additional examples where there is a high probability to optimize a given criterion based on the current model and its uncertainty.} \comment{ ML models are typically evaluated on a separate test set that is not used during the training process, \text{i.e.}, also not for controlling overfitting. To get a better measure of the reliability of ML models in different regions and to detect holes, additional sampling of data can be carried out with \textit{e.g.} enhanced sampling techniques.~\cite{Tao2019TCA,Yang2019JCP} Alternatively, when using two NNs, minima of their negative squared difference surface can be used to detect sparse conformational regions.~\cite{Lin2020JCP}} {To design accurate and data-efficient ML models, it is important to be aware of the structure of the input space and how it is represented. Encoding prior knowledge in the model reduces the effective space to cover and, thus, the required amount of training data. Examples include the use of convolutions to encode roto-translational invariances~\cite{Schutt2017_double} or delta learning, where only the difference to a baseline is learned.~\cite{ramakrishnan2015big}. Beyond that, \emph{transfer learning} studies how knowledge contained in models trained on one task can be reused for related tasks. This also means that, the question of whether a prediction is an extrapolation depends not only on the given training data, but also on the prior knowledge built into the ML model.} \begin{figure} \centering \includegraphics[width=0.90\linewidth]{fig2_v3.pdf} \caption{Schematic depiction of different ML model categories. Unsupervised learning techniques use unlabeled data and are often used for dimensionality reduction or clustering, whereas supervised ML models perform regression or classification tasks on labelled data. \label{fig:2} \end{figure} {By employing a probabilistic input space and a structured target space, one obtains a model that can{,} {\textit{e.g.}}{,} be used to generate novel molecular structures.} The probability distribution over molecular space can be modeled explicitly, for example using variational autoencoders,~\cite{kingma2013auto} or implicitly{,} {\textit{e.g.}}{,} by generative adversarial networks~\cite{goodfellow2014generative} that provide access to the distribution only through sampling. In a supervised setting, generative models can facilitate inverse design by learning a probability distribution of chemical structures conditioned on a desired target range of one or multiple properties. Finally, \textbf{reinforcement learning} is concerned with learning the optimal action in a given state to maximize a specified, future reward. An example for this is an unfolded protein (state), where one applies changes to the geometry (action) in order to come closer to the folded structure with minimum energy (future reward).~\cite{shamsi2018reinforcement} Reinforcement learning includes an exploration strategy such that more data is collected during the training process. Therefore, it can, for example, be used for molecular design without requiring a representative set of reference structures before training. \section{ML improves model building, method choice, and opens new multi-scale approaches}\label{sec:model} The first task one faces when investigating a chemical problem \emph{in silico} is to determine a suitable computational model. The modeling process involves the design of the atomistic structural model and the choice of computational method for calculating the properties of interest. Both choices traditionally are based on achieving a balance between a sufficiently accurate description of the chemical phenomena to be studied and limited computational effort that renders the calculations feasible. {Computational methods can range from electronic structure theory methods ({\textit{e.g.}}{,} correlated wavefunction or density functional approaches) to more approximate empirical force fields. Depending on the level of approximation, a method can be appropriate for modeling certain phenomena, while being less reliable for others. One example are classical empirical force fields, which sacrifice the ability to model chemical {bond breaking in favor of computational speed, but yield excellent predictions for ensemble averages of macromolecular systems. Different applications also place different accuracy requirements on the reference method. A concept often mentioned in the context of ML in chemistry is chemical accuracy, which originally specified that the energy error of a computational method deviates at most 1 kcal/mol from experiment. This accuracy requirement was coined by Pople in his Noble lecture~\cite{PopleNobel} for thermodynamic properties, where it allows reliable comparison with experiment.~\cite{Curtiss2000JCP} However, other applications may necessitate significantly more rigorous error limits. In the field of high-resolution vibrational spectroscopy for example, reliable predictions require so-called spectroscopic accuracy, which corresponds to an energy error smaller than 1 cm$^{-1}$ or 0.003 kcal/mol.~\cite{Puzzarini2019CR}} The model building stage furthermore involves a range of decisions on how to represent the system, for example, how to treat environments such as solvents, what size the simulation cell should have, or which atoms to model explicitly. All these decisions can influence the quality of results at a fundamental level and hence need to be considered carefully.} {Unfortunately, choices are often ambiguous and different strategies can still yield similar results or may only work in certain combinations. The associated design choices typically require a mix of expertise and chemical intuition of experienced practitioners. This makes it hard to see how ML could help to automate this process. Nevertheless, ML models can{,} {\textit{e.g.}}{,} learn to infer decision rules or categorize complex patterns in a purely data driven fashion. This makes them a promising tool to provide support during the model building stage, making balanced model building choices more widely available and potentially achieving fully automated decision making in the future.} {Transparent method selection protocols can be based on \textbf{uncertainty quantification}.}~\cite{ruscic2014uncertainty,chernatynskiy2013uncertainty} Currently, theoretical predictions tend to be reduced to a single number, without considering the spread due to{,} {\textit{e.g.}}{,} method-specific modeling errors. Access to confidence intervals can provide several key advantages beyond determining how well a particular method is suited for a task. Trends in method predictions can be analyzed in a more general manner, going beyond the snapshots provided by traditional benchmark studies. When combined with experiment, uncertainties assigned to theoretical predictions allow for a better separation of error sources and interpretation of results. Recently, some progress has been made in tackling this problem with ML algorithms and Bayesian approaches in particular. Bayesian error estimation has been successfully used to construct multiple density functionals. \citet{wellendorff2012density} reported a Bayesian functional with a non-local van der Waals {(vdW)} correlation term. This so-called BEEF-vdW functional provides predictions as well as computational error estimates. They demonstrated the utility of BEEF-vdW based on two surface science problems, modeling graphene adsorption on a Ni(111) surface and the binding of CO to Pt(111) and Rh(111) substrates. Bayesian frameworks for density functionals were also developed by \citet{aldegunde2016development} and \citet{simm2016systematic}. All these approaches allow for the construction of specialized density functionals which yield confidence intervals for computed energies. This makes it possible to automatically probe the reliability of the method for different compounds and structures and identify problematic situations. {\citet{simm2016systematic} used their approach to estimate the errors associated with different reaction barriers along the catalytic cycle of Yandulov--Schrock catalyst, where they demonstrated that even similar reaction steps can exhibit very different confidence levels due to shortcomings of the computational method.} By applying this approach to chemical reaction networks, \citet{proppe2017uncertainty} demonstrated how this method can further be used to provide uncertainty estimates for chemical reaction rates. Beyond error estimates, ML has been employed to automatically construct basis sets for electronic structure methods.~\cite{schuett2018machine} {Usually, pre-defined basis sets are used for electronic structure computations, which aim to provide reasonable accuracy over a wide range of compounds. As such they use higher radial and angular resolution than might be necessary for certain molecules. \citet{schuett2018machine} have shown how ML can be used to generate an adaptive basis set tailored to a specific system based only on local structural information. Using liquid water as example, their adaptive basis set was able to reduce computational cost by up to a factor of 200.} Similarly, local pseudopotentials have been constructed based on kernel ridge regression.~\cite{Lueder2020} Another important decision in method selection is whether the problem of interest exhibits strong electron correlation (also referred to as multi-reference character or static correlation). In this case, a single {antisymmetric product wave function} is no longer sufficient to describe the {electronic} system and single-reference methods ({\textit{e.g.}}{, semi-local approximations to DFT, single-reference {coupled-cluster (CC)} theory) yield inconsistent performance across configurational space and fail to describe bond breaking.} \citet{Duan2020JPCL} have proposed a {semi-supervised} ML approach to automatically classify chemical systems according to their multi-reference character in an efficient manner. {This makes it possible to identify problematic systems without the need to carry out expensive high-level calculations and thus aid in the method selection process.} In some situations, it can be advantageous to rely not on a single method, but instead employ a combination of electronic structure theories and basis set levels. Such composite methods {have a long history in computational chemistry, with the Gaussian methods for thermochemistry (G2-G4)~\cite{Curtiss1991JCP,Curtiss1998JCP,Curtiss2007JCP} being some of the most prominent examples. All composite methods have in common, that they} profit from the cancellation of errors at different levels of theory and can offer improved accuracy at lower computational cost. \citet{zaspel2018boosting} have leveraged ML and combination techniques to derive a composite method in a data driven fashion. They could demonstrate that their method achieved CC accuracy using only lower levels of theory. The \textbf{model building} process encompasses many other aspects apart from method selection. This includes decisions on which structural aspects of the system need to be {considered explicitly or only accounted for in their implicit effect on the system} ({\textit{e.g.}}{,} implicit versus explicit solvation models), whether periodic boundary conditions are required or which boundary box shapes and sizes are appropriate. Other aspects concern the electronic structure, especially in the context of multi-reference methods. Most of these approaches require decisions on which particular electronic reference configurations, often referred to as active space, to include in the description of a system. This problem is highly nontrivial, as it not only depends on the intrinsic electronic structure of a system but also on the chemical {reaction} to be studied. As a consequence, these methods ({\textit{e.g.}}{, Complete Active Space Self Consistent Field (CASSCF))} have been hard to use {by non-expert users} in a black box manner {in the past}. \citet{Jeong2020JCTC} recently introduced a ML protocol {based on decision trees} for active space selection in bond dissociation studies. Their approach is able to predict active spaces {able to reproduce the dissociation curves of diatomic molecules} with {a success rate of approximately 80 percent precision compared to random selection. This} constitutes an important step {toward} black box applications of multi-reference methods. ML approaches further show great potential in the context of \textbf{multi-scale modeling}. Multi-scale approaches combine information from different levels of theory to bridge different physical scales. Examples include hybrid quantum mechanics/molecular mechanics (QM/MM) simulations~\cite{zhang2018potential}. For example, \citet{zhang2018solvation} have shown how a simple $\Delta$-learning based model can improve the accuracy of solvent free energy calculations{, where they could reach hybrid DFT accuracy using a semi-empirical DFTB baseline.} A similar scheme has been employed by \citet{boselt2020machine} to simulate the interactions of organic compounds in water. \citet{gastegger2020machine} used a ML/MM approach where a ML model completely replaced the QM region to model solvent effects on molecular spectra and reactions. {This made it possible to achieve an acceleration of up to four orders of magnitude, while still retaining the accuracy of the hybrid functional reference method.} Combining fragment methods with ML techniques, \citet{Chen2019JPCL} were able to investigate excited states in extended systems {in an efficient manner by only treating the photochemically active region with a multi-reference method while the environment is modeled with ML.} Finally, \citet{caccin2015framework} have introduced a general framework for leveraging multi-scale models using ML to simulate crack propagation through materials{, thus enabling simulations which would otherwise be impossible using either classical force-fields or electronic structure methods alone.} {\textit{Future directions:} While a complete automation of the model building stage has not yet been achieved, ML based algorithms have nevertheless led to significant progress toward this endeavor. Due to the complexity of the model building process, there still is a large number of untouched subjects which may serve as fruitful substrate for future ML research. Potential avenues include the automated selection of suitable levels of correlation methods for specific problems and using ML to automatically generate partitions in multi-scale approaches. } \section{\label{sec:QM}ML in electronic structure theory} The solution to the electronic Schr\"odinger equation can be approximated in various ways, where a tug-of-war between accuracy and computational efficiency is crucial to any choice of method. The bottlenecks that need to be addressed to achieve more efficient electronic structure calculations are mainly: \begin{itemize} \item[(1)] the evaluation of multi-centre and multi-electron interaction integrals, which requires optimally-tuned basis representations to construct Hamiltonians and sets of secular equations and \item[(2)] the (iterative) solution of coupled sets of equations to predict total energies, wave functions, electron densities, and other properties derived thereof. \end{itemize} To overcome these bottlenecks, developments of correlated wave-function-based methods, exchange-correlation functionals within DFT, and methods based on many-body perturbation theory must go hand in hand with algorithmic advances. Progress on challenge (2) has been propelled by algorithmic ingenuity and a collective community effort to develop massively scalable linear algebra algorithms to be collected in central libraries such as the Electronic Structure Library (\hyperlink{https://esl.cecam.org/}{ESL}~\cite{ESL}) and the Electronic Structure Interface (\hyperlink{https://wordpress.elsi-interchange.org/}{ELSI}~\cite{ELSI}). It is challenge (1), where ML methods can potentially have the biggest impact in eliminating computational bottlenecks while maintaining high predictive power. Currently, the most pervasive application of ML is \textbf{to replace \emph{ab-initio} electronic structure calculations with \emph{ab-initio}-quality interatomic potentials}. {In doing so, ML methods also significantly improve the predictive capabilities of molecular dynamics {(MD)} simulations by enabling \emph{ab-initio}-accuracy at computational costs comparable to classical force fields (\textit{cf.} section~\ref{sec:QD}).} In principle, ML models can parametrize any {smooth} function, such as the ground-state total energy, the forces, and other derived properties obtained from a first-principles calculation. Related ML models for {interatomic potentials have already been} reviewed extensively (see Table \ref{tab:my_label} for example). {We therefore focus on ML representations of electronic structure quantities beyond ground-state energies and forces in the following.} \textbf{Many ML representations of excited state properties}, such as HOMO-LUMO gaps,~\cite{Pronobis2018EPJB,Ghosh2019AS,schutt2019unifying} excited-state energies,{~\cite{Ramakrishnan2015,Westermayr2020MLST_Perspective,Westermayr2020JCP,Westermayr2021physically}} or band gaps \cite{schutt2014represent,zhuo2018predicting,Lee2016PRB,Pilania2017CMS} have been proposed {and were mainly based on NNs or kernel methods.} Recently, ML models have also been applied to derive {excited-state or response properties explicitly by learning the density of states~\cite{Mahmoud2020PRB} or orbital energies,~\cite{Ghosh2019AS,Westermayr2021physically} respectively. These models have further been applied to obtain excitation spectra.} {However, a main} challenge that is frequently encountered when fitting {many energy levels} is the non-smoothness of the target functions, {which is true for orbital energies as well as adiabatic potential energy surfaces (PESs)}.~\cite{Westermayr2019CS,Duan2020JPCL} Avoided crossings {at conical intersections in adiabatic potential energy landscapes} represent a good example for this behaviour: When two potential energies become degenerate and form a cusp, the respective coupling values become singular at this point in the conformational space. Consequently, a direct learning of such properties is prohibited {in many cases, making a smoothing of the target property or novel fitting approaches preferable. Approaches to achieve better learning behaviour strongly depend on the purpose of the ML model. For instance, in case of spectroscopic predictions it is sufficient to learn the spectral shape directly instead of the energy levels. This has been done with Gaussian Approximation Potentials for the density-of-states~\cite{Mahmoud2020PRB} and with NNs for X-ray spectroscopy~\cite{Rankine2020JPCA,Rankine2021JPCA} or for excitation spectra.~\cite{Ghosh2019AS} In the latter case, NNs could describe spectral intensities with deviations of 0.03 arb.u.. The same authors also fitted orbital energies of the QM9 data set comprising 134k organic molecules with a mean average error of 0.186~eV.~\cite{Ghosh2019AS} Alternatively, a diabatic\cite{Shu2020JCTC} or latent Hamiltonian matrix\cite{Westermayr2021physically} can be learned and used to obtain orbital energies or adiabatic energies as eigenvalues of the matrix, respectively. The latter approach was shown to improve the accuracy of orbital energy predictions by a factor of 2 compared to direct learning.\cite{Westermayr2021physically}} {ML parametrization of excited states is especially challenging when multi-reference methods are required, because states can switch their character along certain reaction paths, which leads to jumps in the PESs. While this can also be the case for ground-state PESs, this problem is more pronounced for higher-lying excited states in regions where the density of states is high, leading to significant higher noise in excited-state PESs and consequently, more difficult learning.~\cite{Westermayr2019CS}} {While ML parametrization of electronic structure data is well established, it is intrinsically limited in its application range} by the unfavorable scaling associated with bottleneck (1), \textit{i.e.}{,} many highly accurate electronic structure methods are too computationally costly to generate sufficiently large training datasets that enable reliable parametrization. Sometimes, \textbf{better accuracy can be achieved with $\Delta$-ML approaches}. This approach is based on the assumption that the difference in energy between two electronic structure methods - a low-level one and a high-level one - is easier to represent than either one of the two methods.~\cite{ramakrishnan2015big} An alternative to the $\Delta$-learning approach is \textbf{transfer learning},~\cite{Pan2010IEEE} where a model is trained on data from a low level of theory and retrained with less data points of a more accurate method. A rule for determination of the number of data points needed in consecutive $\Delta$-learning approaches that takes computational cost and prediction accuracy into account is proposed by~\citet{Dral2020JCP}. Many studies use about 10\% of the original training data for \comment{$\Delta$-learning~\cite{Boselt2021JCTC,Ramakrishnan2015,Westermayr2021physically,Nandi2020JCP} and transfer learning.~\cite{Smith2019NC,ward2019machine,Kaeser2020JPCA,Kaeser2021arXiv,Qu2021breaking}} In both cases, the ML model ideally yields an accuracy that is comparable to the higher-level theory. The prediction of energies with CC accuracy for the QM data sets was shown by \citet{Smith2017} using transfer learning and mostly range-separated semi-local DFT data {(5 million DFT data points compared to 500,000 CC data points)}. Very recently, \citet{Bogojeski2020NC} have demonstrated that {with $\Delta$-ML a model with CC accuracy was generated} by using mostly semi-local DFT reference data and only a few data points calculated with CC theory. {For instance, MD of resorcinol (C$_6$H$_4$(OH)$_2$) could be achieved with 1004 data points at DFT and CC accuracy. While the DFT ML model had mean absolute errors of 2-3~kcal/mol compared to CC, the $\Delta$-ML model could achieve already 1~kcal/mol accuracy with respect to CC with as few as 25 data points.~\cite{Bogojeski2020NC}} Data efficiency can also be improved by designing NN architectures that implicitly satisfy symmetry constraints ({\textit{i.e.}}{,} rotational equivariance and permutational invariance) and, as a consequence, require much fewer data points to achieve a given accuracy.~\cite{batzner2021se3equivariant,schutt2021equivariant} This is only one of many possible strategies to \textbf{include more physical information into ML model architectures}. Including the mathematical structures and the physical boundary conditions relevant to electronic structure methods into deep learning models leads to a further boost of data efficiency and model transferability. This has \comment{recently} been shown \comment{with reproducing kernels optimized for long-range intermolecular forces~\cite{Marko2006MP} and with} an ML-based parametrization of Density Functional Tight-binding (DFTB). \comment{The latter model provided} error reductions of up to 67\% for test molecules containing 8 heavy elements compared to existing DFTB parametrizations.~\cite{Li2018} Similarly, the MOB-ML approach uses localized 2-electron interaction integrals from Hartree-Fock calculations as input to construct a highly accurate and transferable GPR model. This is applied to the prediction of CCSD correlation energies for a diverse range of molecular systems.~\cite{Welborn2018,Cheng2019,husch2020improved} {The MOB-ML approach for instance reaches chemical accuracy by using three times fewer training data points for organic molecules with up to 7 heavy atoms compared to $\Delta$-ML approaches. Transferability was tested with molecules with up to 13 heavy atoms and MOB-ML could achieve chemical accuracy with 36 times fewer data points compared with $\Delta$-ML.\cite{Cheng2019}} Alternatively, rather than circumventing the solution of iterative equations of correlated wavefunction methods, ML models may also be used to facilitate faster convergence. {On average about 40\% reduction of the number of iterations for different basis sets could be achieved by \citet{Townsend2019JPCL}. They trained} an ML model to facilitate the convergence of CC methods based on lower-level theory electronic structure data. Besides ML models being powerful to accelerate the computation of target properties, they can also be used to predict correlated total energies of molecules based on Hartree-Fock or DFT results. Examples are NeuralXC,~\cite{Dick2020NC} DeepHC,~\cite{Chen2020_JPCA} and OrbNet~\cite{Quiao2020JCP} {which provide} NN representations based on atomic orbital features. \textbf{ML becomes increasingly important as an integrated element of solving quantum many-body problems}. First attempts to solve non-homogeneous ordinary and partial differential equations using ML algorithms~\cite{Lagaris1997CPC,Lagaris1998CoRR,Sugawara2001,Manzhos2009} already date back to more than 20 years ago for model systems and have recently been applied to solve the quantum many-body problem for small organic molecular systems.~\cite{Carleo2017,Saito2017JPCJ,Nomura2017PRB,Han2018JCP,Pfau2020PRR,Hermann2020NC,Choo2018PRL,Zheng2019PRL} These efforts have recently been summarized in a comprehensive review~\cite{Manzhos2020_review} and perspective.~\cite{Manzhos2020} While they are conceptually exciting and potentially transformative in solving the many body problem, their integration into existing, widely accessible electronic structure software may not be fully practicable yet as existing models are limited to small system sizes and {not yet} transferable. Rather than using ML methods to learn a representation of quantum states, they can also be used to parametrize electronic structure in an already known representation that is compatible with well-established electronic structure packages. Such \textbf{ML models are on their way to becoming an integrated element of electronic structure codes}. The resulting surrogate models, thereby, provide not only predictions of total energies and their derivatives, but further enable the derivation of many additional properties. One such example is the SchNOrb model (SchNet for Orbitals),~\cite{schutt2019unifying} which is based on the deep tensor NN SchNet.~\cite{Schutt2018,Schuett2019JCTC} SchNOrb predicts Hamiltonians and overlap matrices in local atomic orbital representation compatible with most quantum chemistry software packages. Thus, it can be trained with data from quantum chemistry codes and its prediction can directly enter further quantum chemical calculations, {\textit{e.g.}}{,} as an initial guess of the wave functions in self-consistent field calculations or to perform perturbation theory calculations of correlation energies. {Self-consistent field iterations could be reduced by an average of 77\% when using the SchNOrb wave function as an initial guess.} Beyond that, it has been shown that the model can represent interaction integrals in localized effective minimal basis representations{, which benefits the prediction accuracy for larger systems}.~\cite{Gastegger2020JCP} \begin{figure}[h] \centering \includegraphics[width=1.00\linewidth]{fig_end_v3.pdf} \caption{\label{fig:scf}Electronic structure software is increasingly becoming more modular. By moving away from monolithic (all-in-one) code models to a modular design, atomistic ML toolkits and data repositories, together with other standardized libraries, can be more {tightly} integrated into electronic structure workflows.} \end{figure} Alternatively, an ML model may predict \textbf{the electron density or a density functional}.~\cite{Mahmoud2020PRB,Li2020PRL,Dick2020NC,Manzhos2020_review} A recent example of a deep learning framework to predict the electronic density or properties related to the density of a reference DFT method is DeepDFT.~\cite{Jorgensen2020arxiv_deepdft} {A symmetry-adapted method that considers geometrical covariance was proposed by \citet{Fabrizio2019CS} and \citet{Grisafi2019ACSCS} to learn the charge density of different organic molecules via Gaussian Process Regression (GPR) models.~\cite{Fabrizio2019CS,Grisafi2019ACSCS} This model is physically inspired and learns the charge density via a sum of atom-centered basis functions with the coefficients of these functions being predicted by the ML model. The authors achieve linear scaling with respect to the number of atoms and allow for size-extensive transferability. The latter was showcased by training the density of butadiene and butane and predicting the density of octa-tetraene and octane.\cite{Grisafi2019ACSCS} ~\citet{Fabrizio2020JCP} have further shown on the example of organic molecules that ML can be used to predict the on-top pair density in combination with a newly developed basis set. The on-top pair density can be used to assess electron correlation effects of a target compound, which most often cannot be described accurately using DFT. However, its evaluation requires post-HF or multi-reference calculations, which could be avoided due to the use of ML.} A \textbf{universal density functional provided by an ML model} could potentially eliminate the need for exhaustively comparing different types of functionals for a given chemical problem. So far, ML has been used to generate new DFT functionals or to adjust the energy functional, bypassing the need to solve the iterative Kohn-Sham equations and accelerating simulations for the ground state~\cite{snyder2012finding,Brockherde2017, Babaei2020PRB,Schmidt2019JPCL,Nelson2019PRB,Lei2019PRM,Cheng2019,Dick2020NC} and excited states~\cite{Suzuki2020PRA} significantly. These models further promise better transferability for different types of molecular systems. Orbital-free DFT is another effort that allows for more reliable DFT calculations, but it requires the kinetic energy density functional.~\cite{Ligneres2005} However, various approaches have been put forward to parametrize the kinetic energy density functional with different kernel-based and deep learning methods.~\cite{Wang1999PRB,Golub2019PCCP,Seino2019CPL,Meyer2020JCTC} \citet{Li2020PRL} recently presented an approach that integrates the iterative self-consistent field algorithm into an ML model to construct a learned representation of the exchange-correlation potential for 1D model systems of H$_2$ and H$_4$. The concept of ML-based Hamiltonian and density-functional surrogate models directly leads to the construction of \textbf{approximate electronic structure models based on ML}. Recently reported approaches include an ML-based H\"uckel model,~\cite{Zubatyuk2019} parametrized Frenkel~\cite{Farahvash2020JCP,Haese2016CS,zhang2020towards,Li2018,Kraemer2020JCTC} and Tight-binding (TB) Hamiltonians{~\cite{Wang2021}} as well as semi-empirical methods with ML-tuned parameters.~\cite{Dral2015,Chou2016JCTC}. Beyond that, several groups have proposed to combine established DFTB Slater-Koster parametrizations with kernel ridge regression or NN representations of the repulsive energy contributions to improve the accuracy and transferability of DFTB.~\cite{Stoer2020JPCL,Panosetti2020JCTC} {On the example of the QM7-X data set~\cite{Hoja2021SD}, a mean absolute error of 0.5 kcal/mol could be achieved on the atomization energies of the DFTB-ML model compared to hybrid DFT reference values.~\cite{Stoer2020JPCL} { \textit{Future directions:} We expect a vivid development regarding the {tight} integration of ML within electronic structure software - an approach that some package developers already pursue ({\textit{e.g.}}{,} in the case of \textit{entos}~\cite{Manby2019} and DFTB+~\cite{Hourahine2020}). Already in recent years, electronic structure software has started to move away from monolithic (all-in-one) software to more modular designs with interfaces to general-purpose standalone libraries\cite{CEN_Modular} (see Fig. \ref{fig:scf}). These developments will be helpful in the future to achieve integrated ML/QM solutions in computational workflows. As can be seen in Fig. \ref{fig:scf}, existing atomistic ML packages such as AMP,~\cite{Khorshidi2016CPC} sGDML~\cite{Chmiela2019CPC} or SchNetPack~\cite{Schutt2017_double,Schutt2018} could be interfaced with electronic structure packages that heavily expose internal routines ({\textit{e.g.}}{,} FHI-aims,\cite{Blum2009} PSI4,~\cite{Smith2020JCP} or PySCF~\cite{PYSCF}) and be used alongside dynamics packages such as i-Pi~\cite{Kapil2019CPC} and SHARC,~\cite{Mai2018WCMS,Richter2011JCTC} as well as algebra and electronic structure libraries such as ELSI~\cite{ELSI} and ESL.~\cite{ESL} The structure generation, workflow and parser tool Atomic Simulation Environment (ASE)~\cite{Larsen2017IOPP} is for example already interfaced with the above examples of AMP and SchNetPack. This could also involve a closer integration with existing data repositories such as NOMAD,~\cite{Draxl2018,Draxl_2019} the Materials Project,\cite{Draxl2018,Draxl_2019} {the MolSSI QC Archive~\cite{Molssi2021}} or the \hyperlink{http://quantum-machine.org/datasets/}{Quantum Machine repository}.\cite{QMR} Universal data communication standards between quantum chemistry and ML will play an important role in the future. Efficient and scalable multi-language interoperability would further be needed to pursue the goal of tight integration of ML in electronic structure theory. In the future, we believe that ML will be part of many electronic structure codes to enable highly accurate electronic structure predictions at generally low computational costs. In this regard, data-efficient ML models are highly beneficial. Many recent works have shown that incorporation of symmetries and physical information into ML representations improves data efficiency, \textit{e.g.}, via the use of features derived from efficient low-level methods such as Hartree-Fock or MP2 theory to predict observables at high level of theories.~\cite{Welborn2018} Existing electronic structure software may further benefit from latent ML representations to mitigate existing bottlenecks in integral evaluations or to efficiently represent scalar and vector field quantities.} \section{\label{sec:structure}ML will improve our ability to explore molecular structure and materials composition} \begin{figure*} \includegraphics[width=0.9\textwidth]{fig_pes.pdf} \caption{\label{fig:pes_exploration}Exploration methods can target different scales of molecular and material space. At the highest level, chemical space, both chemical composition and structure are varied. Global exploration targets a single {PES} with constant chemical composition and explores different structural conformations and their relative stability. At the lowest level, local details of the {PES} such as reaction pathways and transition states are investigated.} \end{figure*} A key objective of computational chemistry and materials science is the prediction of new stable structures and viable reaction pathways to synthesize them. Beyond the significance to the discovery of new drugs and materials, finding stable equilibrium geometries and accessible transition states is a crucial element of computational molecular and materials discovery that typically involves tailored workflows.~\cite{Oganov2019} As shown in Fig. \ref{fig:pes_exploration}, optimization problems in atomistic simulation span different scales from searching stable molecules across chemical space to charting the global energy landscape spanned by the chemical coordinates of a given molecule down to local structure relaxation and transition state search. Even without considering the computational cost of electronic structure calculations, high-dimensional structure search is uniquely challenging and can be greatly facilitated by ML methods. Efficient chemical exploration methods need to be able to identify CVs in high-dimensional spaces that are associated with relevant reaction events that occur at vastly different time scales ranging from the femtosecond regime (electron transfer and vibrational motion) to multiple nanoseconds (configurational dynamics of biomolecules) \cite{fleming1990chemical}. It is therefore not surprising that the use of a variety of methods that fall under the umbrella of ML, has led to a significant boost in the capability to explore chemical structure space. Even a task that is nominally as simple as \textbf{finding the nearest equilibrium structure}, \textit{i.e.}{,} the local minimum of the potential energy landscape, can benefit from ML approaches. The most common geometry optimization algorithms are based on quasi-Newton methods that determine trial steps based on an approximate Hessian. Finding optimal initial guesses and preconditioners for the Hessian is key to minimizing the number of geometry optimizations that are required. Recently, several more sophisticated preconditioning schemes have been proposed based on GPR that{, compared to established quasi-Newton algorithms,} significantly reduce the required number of geometry optimization steps for molecules and transition metal complexes~\cite{Denzel2018, Meyer2020,Raggi2020}, for correlated quantum chemistry methods that require numerical differentiation~\cite{Schmitz2018}, and for bulk materials and molecules adsorbed at surfaces.~\cite{PhysRevB.100.104103, GarijodelRio2020} Furthermore, unsupervised ML can be used to automatically identify if geometry optimization has failed or led to an irrelevant outcome as recently shown for transition metal complexes.~\cite{Duan2020JPCL} \textbf{ML methods have also recently been used to accelerate the search of first-order saddle points or transition states}. \citeauthor{Denzel2018} have used GPR {to speed-up} gradient-based transition state search starting from an equilibrium structure (one-ended search) {by a factor of 2 compared to conventional methods}.~\cite{Denzel2018,Denzel2020} Simultaneously, several approaches have been proposed to incorporate aspects of ML into double-ended transition state search based on the Nudged Elastic Band (NEB) method.~\cite{Peterson2016,Koistinen2017, GarridoTorres2019} \citet{GarridoTorres2019} have proposed a surrogate GPR model to accelerate a NEB method, leading to a factor of 5 to 25 fewer energy and force evaluations when compared to the conventional NEB method. One of the most challenging tasks, namely \textbf{identifying the global minimum of a potential energy landscape associated with the most stable structure}, can be significantly facilitated by the use of ML. Established methods to perform global optimization are often evolutionary algorithms or stochastic methods. {Examples for the former are} genetic algorithms~\cite{Curtis2018} and for the latter random structure search~\cite{Pickard2011} or basin hopping.~\cite{Doye_1997_BH,Panosetti2015} A prominent example of a global optimisation problem on a complex high-dimensional energy landscape is protein folding. Here, the alphaFold~\cite{alphafold} and alphaFold2~\cite{alphafold2} deep NN models were recently able to show what can be achieved when ML and structure optimisation methods are combined. In alphaFold, the ML model predicts residue distances and torsional angle distributions. On the basis of this, a coarse-grained potential is constructed to perform a sequence of random structure search and optimization cycles. Hammer and coworkers have proposed a global structure prediction algorithm, called ASLA, based on image recognition and reinforcement learning.~\cite{Jorgensen2019,PhysRevB.102.075427} The use of image recognition to identify structural characteristics removes the need for encoding strings such as SMILES or descriptors of the atomic environment. The approach is applicable to molecules as well as materials and has been showcased on graphene formation, and oxide surface reconstructions.~\cite{Meldgaard2020} {In the case of graphene, the method is able to generate graphene as the most stable two-dimensional phase starting from initially random atom placement}. Bayesian optimisation has become a common tool to achieve efficient structure prediction for crystals,~\cite{Yamashita2018,Deringer2018_faraday} surface reconstructions,~\cite{Bisbo2020} and hybrid organic/inorganic interfaces to name just a few examples.~\cite{Todorovic2019, Hormann2019} They often outperform evolutionary algorithms in terms of efficiency. As shown in Figure \ref{fig:pes_exploration}, one level above the search for stable structures in energy landscapes lies the search for possible stable molecular compositions in chemical space. Generative ML models have recently shown great utility to predict molecules with tailored properties~\cite{Sanchez-Lengeling2018,schwalbe2020generative}, for example using SMILES representation~\cite{gomez2018automatic} or molecular graphs~\cite{liu2018constrained}. While these are supervised approaches that require reference data for training, several related approaches have been proposed that use reinforcement learning.~\cite{Putin2018, Popova2018} These models can further be constrained to only predict SMILES strings that are chemically valid.~\cite{kusner2017grammar,Zhou2019} Well beyond providing stability ranking, this approach can be used to generate molecules with arbitrary target properties to be used in drug and materials discovery. Unfortunately, {molecular} graph-based generative models are limited in their applicability, since they can not distinguish between different conformations that lead to the same graph. However, for applications such as protein folding, optimizing reaction environments or finding reaction paths, it is paramount to have full access to conformation space. \citet{mansimov2019molecular} proposed a generative model to sample 3d conformations from SMILES. This approach suffers from the same limitations as the graph representation it is built upon when properties are directly related to the 3d structure. There have been several recent efforts to directly generate 3d molecular structures: \citet{kohler2019equivariant} proposed equivariant normalizing flows, which are able to estimate a probability density over many-particle systems. This has been applied to finding meta-stable states of large Lennard-Jones systems. \citet{gebauer_symmetry-adapted_2019} introduced G-SchNet that places atoms successively, incorporating rotational and translational symmetries. The model can be fine-tuned to generate molecules with properties in a specified target range. {\textit{Future directions}: With ML methods affecting every aspect of our ability to explore molecular configurations and compositions, their routine application to facilitate continuous exploration across composition space is not far, which would allow for the variation of the number and type of atoms in the system via \textbf{ML-enabled alchemical optimization}. So-called alchemical potentials have long been applied to rational drug design~\cite{von2005variational,von2007alchemical} and changing of reaction barriers.~\cite{sheppard2010alchemical} ML methods, such as NNs, have shown to be capable of modeling alchemical potentials~\cite{Faber2018,de2016comparing} as well as to produce smooth paths through alchemical space.~\cite{Schutt2016} We expect a lot of activity in this area in the future with ML methods enabling the continuous variation of elemental composition in materials to optimize their properties. } \section{\label{sec:QD} ML enables classical and quantum dynamics for systems of unprecedented scale and complexity} The dynamical motion of atoms is a central target of a large part of computational research. In molecular simulation, we study the time evolution of electrons and atoms to predict static and dynamic equilibrium properties of molecules and materials at realistic temperature and pressure conditions, but also to understand nonequilibrium dynamics and rare events that govern chemical reactions. Dynamics methods range from classical {MD}, via mixed quantum-classical dynamics (MQCD) methods (incorporating electronic quantum effects) to quantum dynamics in full quantum or semi-classical formalisms. In all cases, equations of motion need to be integrated over time, which involves numerous evaluations of forces and other properties that govern the dynamics. ML methods can address bottlenecks in such simulations on various levels: {Their most prevalent use is to speed up energy, force, and property evaluations in each time step by providing ML-based force fields and interatomic potentials. Other ML approaches directly target MD by supporting coarse-graining and the use of larger time steps, or by replacing MD completely with a direct prediction of dynamical properties, expectation values, and correlation functions.} The most obvious way in which ML can facilitate MD simulations is the \textbf{use of ML-based interatomic potentials instead of on-the-fly \emph{ab-initio} MD}. {Many early applications of ML in molecular simulation were mostly focused on ML parametrization of electronic structure data for the benefit of MD simulation.} ML-based interatomic potentials that replace electronic structure evaluation during dynamics {are} by now commonly established, see{,} {\textit{e.g.}}{,} Refs.~\citenum{Behler2016},~\citenum{Unke2020arXiv}, and \citenum{Botu2017JPCC}, and {have} since enabled simulations of unprecedented complexity and scale. For example, a recent breakthrough by \citet{Deringer2021N} showed that Gaussian Approximation Potentials\cite{Bartok2010,de2016comparing} could be used to predict phase transitions and electronic properties of systems containing more than 100,000 atoms. \citet{Jiang2020JPCL} have recently reviewed the transformative role that ML-based high-fidelity PESs play in gas-surface dynamics simulations. \comment{In principle, approaches can be distinguished between those that sample molecule deformations around an equilibrium geometry, e.g. for optimizations,~\cite{Meyer2020JCP} or those that consider "reactive" potential energy surfaces.~\cite{Unke2020MLST,Koner2019JCP,Danielsson2008JCTC,Bowman2011PCCP,Jiang2020JPCL,Meuwly2021arXiv} An alternative approach is to directly predict targeted simulation properties such as reaction yields.~\cite{Haese2019CS,Houston2019JPCL}} A key factor in building ML force fields {for MD simulations} is the efficient and comprehensive sampling of relevant data points. Active learning schemes have been proposed\comment{~\cite{Li2015PRL,Botu2015PRB,Behler2015IJQC,gastegger2017machine,Akimov2018JPCL,Westermayr2019CS}} to efficiently sample the relevant configuration space {that a molecule visits during an} MD simulation. These schemes are based on an uncertainty measure during ML dynamics, which can be used to detect unexplored or undersampled conformational regions. \comment{The uncertainty measure could be for instance the deviation of two NNs or the statistical uncertainty estimate of the inferences made with{,} {\textit{e.g.}}{,} GPR. One way to measure the accuracy and interpolative regime of ML models is to use the previously mentioned adaptive sampling techniques also during the production runs. This allows to detect holes in the potential energy surfaces \emph{on-the-fly}.~\cite{Westermayr2019CS}} By using gradient-domain ML models that are trained on gradients rather than energies, energy-conserving ML force fields can be obtained with high accuracy and little amount of training data required.~\cite{chmiela2017,Chmiela2018NC,Chmiela2019CPC} {$\Delta$-ML models, in the context of MD simulations, have also proven to be very powerful in providing a data-efficient representation of CC accuracy from DFT data~\cite{Bogojeski2020NC} or DFT accuracy from mostly DFTB data in the context of QM/MM simulations~\cite{Boselt2021JCTC}, to name two recent examples.} {Beyond the use of ML to facilitate accurate force evaluations in MD,} ML methods {have been used to} enable the simulation of rare events that occur on time scales inaccessible to conventional MD. A perspective review that recently arose from a CECAM conference on "Coarse-graining with ML in molecular dynamics" provides a comprehensive overview of ML for free energy sampling, coarse-graining, and long-time MD~\cite{Gkeka2020}. \textbf{ML methods help to identify CVs, which characterize long-time dynamics} of molecular systems. This is important to identify long-lived attractor states in phase spaces and to find strategies to efficiently explore dynamics in complex hierarchical energy landscapes, {\textit{e.g.}}{,} for \comment{ the isomerization of alanine dipeptide~\cite{Ma2005JPCB} or for} protein folding.~\cite{Noe2020a} ML methods in this domain based on principal component analysis~\cite{pearson1901lines} date back to over 20 years ago.~\cite{Balsera1996} \comment{More recent approaches include} kernel principal component analysis~\cite{scholkopf1998nonlinear,Zhang2008,Lange2008}, diffusion maps,~\cite{Coifman2006,Preto2014,Zheng2013}, \comment{the Sketch map method,~\cite{Tribello2012PNAS,Ceriotti2011PNAS}} Markov state models~\cite{Mardt2018,Noe2019} and various types of autoencoders.~\cite{Chen2018,Ribeiro2018} Several ML models have been developed that aim to achieve \textbf{bottom-up coarse-graining} by representing the potential of mean force or free energy surface as a function of coarse grained variables. This has been done for instance using NNs to infer conformational free energies for oligomers~\cite{Lemke2017} or to construct a coarse-grained liquid water potential~\cite{Zhang2018} or using a Gaussian approximation-based coarse-grained potential for alanine dipeptide~\cite{wang2020} and molecular liquids.~\cite{John2017} MQCD, {\textit{i.e.}}{,} classical dynamics of nuclei coupled to the time-dependent quantum mechanical evolution of electrons, are commonly used to simulate light-induced nonadiabatic dynamics of molecules,~\cite{Barbatti2011,gonzalez2020quantum,Mai2020ACIE} as well as coupled electron-nuclear dynamics in extended systems.~\cite{Smith2020_JPCM} While on-the-fly MQCD simulations have become feasible in the last decade, the accessible time scale and the number of non-equilibrium trajectories that can {realistically} be simulated on-the-fly is too limited to enable comprehensive statistical analysis and ensemble averaging. \textbf{ML shows great promise in nonadiabatic excited-state simulations}\cite{Westermayr2020CR,Westermayr2020MLST_Perspective} as documented by recent works using NNs to construct excited-state energy landscapes to perform fewest-switches surface hopping MD at longer time scales or with more comprehensive ensemble averaging {than would otherwise be possible with on-the-fly dynamics}.~\cite{Westermayr2020JPCL,Westermayr2019CS,Li2020chemrxiv} Similar progress has been achieved in nonadiabatic dynamics at metal surfaces, where NNs have been used to construct excited-state landscapes~\cite{Carbogno2008PRL,Carbogno2010PRB} and continuous representations of the electronic friction tensor~\cite{Zhang2020_friction} used in {MD} with electronic friction simulations.~\cite{C8SC03955K,Box2020JACSAu} Even \textbf{full quantum dynamics simulations} have recently seen an increasing uptake of ML methodology to push beyond longstanding limitations in the dimensionality of systems that can be simulated. The main bottleneck in quantum dynamics simulations is not the evaluation of the temporal evolution of the electrons, but the temporal evolution of the nuclear wavefunction, which involves computations that (formally) scale exponentially with the number of atoms in the system. Potential energy landscapes in quantum dynamics are typically represented in a diabatic basis rather than the adiabatic representation (directly outputted by electronic structure codes) in a process called (quasi-)diabatization.~\cite{Yarkony2012CR,Koeppel2004} However, quasi-diabatization requires expert knowledge and is highly complex for more than two coupled electronic states. The construction of diabatic representations with deep NNs has recently shown {great} potential to simplify and automate this laborious task.~\cite{Shu2020JCTC,Jiang2016IRPC,Lenzen2017JCP,Williams2018JCP,Xie2018JCP,Williams2020JPCA} Besides the PES generation itself, recent works use GPR to fit the diabatic PESs in reduced dimensions.~\cite{Richings2017CPL,Richings2018JCP,Richings2019JCTC,Richings2020JCP} One of the largest ML-enhanced quantum dynamics simulation was {recently} performed on a 14-dimensional energy landscape for a mycosporine-like amino acid~\cite{Richings2019FD}. \comment{The computational efficiency of ML models is an important point to consider. MD simulations based on ML models are considerably more efficient than \emph{ab initio} MD, yet still relatively slow compared to empirical force fields. For example, 100 femtosecond MQCD MD of CH$_2$NH$_2^+$ on a single compute core take 24 seconds with ML potentials compared to 74,224 seconds with the reference method (MR-CISD/aug-cc-pVDZ).~\cite{Westermayr2020JPCL} The simulation of 100 femtosecond classical MD of the same molecule in the gas phase with an empirical force field takes 0.005 seconds with Amber.~\cite{salomon2013overview} The computational efficiency of ML models can become a bottleneck if long time scales or ensemble averages over many thousands of reaction events are required. Similar memory and CPU efficiency bottlenecks can arise during model training of kernel methods and deep neural networks if large training data sets and complex high dimensional models are involved. } {\textit{Future directions}: ML-based interatomic potentials and continuous regression models already play an important role across almost all domains of MD simulations and we expect that the use of ML in MD will further increase in the coming years. \comment{As larger and more complex systems are targeted and longer time scales are needed, a future challenge that needs to be tackled is the computational efficiency of ML models, especially for MD simulations. The concept of sparsity in terms of ML methods and data representation can lead to better computational efficiency. Recently, explicit atomic high body order expansions in permutationally invariant polynomials (\textit{e.g.} aPIPs\cite{oordRegularisedAtomicBodyordered2020}, ACE\cite{drautzAtomicClusterExpansion2019}) have emerged as appealing alternative to kernel and deep learning methods as they accurately allow high-dimensional parametrization as a function of atomic coordinate spaces and can be trained by linear regression. As a result, both training and evaluation are highly efficient with evaluation times on the order of few milliseconds per atom.~\cite{allenAtomicPermutationallyInvariant2021a}} While most approaches focus on assisting MD by providing highly-accurate interatomic potentials and force fields, they have also shown great potential in predicting dynamical properties directly and skipping the MD simulation completely or in assessing the validity of different approximations in dynamical simulations. The latter has only recently been shown by \citet{Jasinski_2020} with a Bayesian model to estimate errors due to different approximations in quantum scattering simulations. Going forward, complex dynamical simulation methods will become more accessible to non-expert users with the help of ML and will open avenues to tackle complex systems in solvent environments~\cite{Chen2019JPCL} or dynamics at hybrid organic-inorganic interfaces.~\cite{Box2020JACSAu} It is evident that ML methods will play an important role in extending the range of applications for MQCD methods in the coming years. A recent work by \citet{Brieuch2020JCP} employing ML methods to achieve converged path-integral MD simulations of reactive molecules in superfluid helium under cryogenic conditions is an exemplary showcase of what the synergy of ML and quantum dynamics methods can achieve. } \section{ML helps to connect theory and experiment}~\label{sec:exp} \begin{figure} \includegraphics[width=0.9\columnwidth]{perspective_draft_v3.pdf} \label{fig:experiment} \caption{Depiction of how ML methods can act as a bridge between theory and experiment. ML models trained on theory predict spectra with realistic lineshapes. At the same time, ML models can be used to infer structural information from experimental measurements.} \end{figure} The ultimate goal of computational molecular and materials simulation is to connect theory and experiment. This could mean supporting the explanation of experimental outcomes or finding new theoretical rules in observations, in both cases leading to a {better} understanding of the physical world and its laws. Forming this connection is a hard task. A plethora of different effects need to be considered in even the simplest atomistic systems, making it very difficult to faithfully reproduce experimental conditions in silico. On the other hand, experimental observations can be obscured by a variety of influences or by the sheer complexity of the measured signal. As we have seen in the preceding sections, \textbf{ML approaches can increase the accuracy of predictions and the speed with which they can be obtained.} This makes it possible to carry out computational studies which close the gap between theory and experiment by more efficiently incorporating experimental parameters such as finite temperature, measurement conditions, and solvent effects. Moreover, ML techniques can also provide invaluable support in extracting information from experimental observations and uncovering trends that are not directly apparent to the practitioner. One field which has greatly profited from these developments is \textbf{computational spectroscopy}. The prediction of spectroscopic properties is a central aspect of computational modeling, as it provides results which can be directly compared against experiments. Examples of successful ML applications include the prediction of different vibrational spectra, combined with different response properties of the electric field. \citet{gastegger2017machine} have combined a latent charge dipole model with interatomic potentials in order to efficiently simulate infrared spectra (IR) of organic molecules in gas phase {without having to resort to electronic structure computations of the molecular dipole}. This approach has further been applied to model absorption spectra.~\cite{zhang2020towards,Westermayr2020JCP} \citet{raimbault2019using} introduced a kernel approach for predicting the Raman spectra of organic crystals based on molecular polarizabilities. Using a NN based approach, \citet{sommers2020raman} have demonstrated that ML can also be used to simulate Raman spectra of extended systems such as liquid water{, which would be computationally unfeasible when done with DFT}. In addition to vibrational spectra, ML models are also capable of modeling response properties, allowing the simulation of electronic excitations using{,} {\textit{e.g.}}{,} MQCD approaches (see Section~\ref{sec:QD}). For example, \citet{zhang2020towards} use NN models to obtain transition dipole moments, which in turn could be used to predict UV and visible light spectra. ML approaches have further been used to predict nuclear magnetic resonance (NMR) spectra from molecular simulations. \citet{paruzzo2018chemical}, for example, have used the kernel model from Ref.~ \citenum{raimbault2019using} to predict the chemical shifts in molecular solids. Recently, Christensen \emph{et al.} have introduced an electric field dependent descriptor in the FCHL Kernel framework\cite{Christensen2019}. Based on this, they have derived molecular dipole moments as a general response to the electric field, which can be used to simulate IR spectra of small organic molecules. \citet{gastegger2020machine} have applied a response theory approach in combination with a deep NN architecture which explicitly depends on electric and magnetic fields. They could show that, in this manner, a single ML model can predict IR, Raman and NMR spectra. Moreover, by introducing the field generated by a molecular environment they were able to model the effect of solvents on the resulting spectra. {Beyond that, ML offers the possibility to \textbf{directly extract information from experimental observations} and relate them to fundamental chemical concepts. One example is the use of ML to interpret different types of spectroscopic measurements to determine structural or electronic properties of molecules and materials.} \citet{fine2020spectral} have recently presented a ML approach to extract data on functional groups from infrared and mass spectroscopy data, while \citet{kiyohara2018data} have successfully applied a ML scheme to obtain chemical, elemental, and geometric information from the X-ray spectra of materials. Another application where ML shows promise is the automated interpretation of nuclear magnetic resonance spectra with respect to atomic structure, which typically relies heavily on experience.~\cite{cobas2020nmr} However, \textbf{ML can also be used to leverage {information contained in large collections of scientific data}}. The majority of chemical knowledge is collected in the form of publications. ML approaches such as natural language processing and image recognition offer the possibility to directly distill functional relationships and chemical insights from the massive body of scientific literature. For instance, \citet{tshitoyan2019unsupervised} have used natural language processing to extract complex materials science concepts, such as structure property relationships, from a large collection of research literature. They could further demonstrate, that their model was able to generalize on the learned concepts and recommend materials for different functional applications. \citet{raccuglia2016machine} recently trained a ML model using information on failed experiments extracted from archived laboratory notebooks to predict the reaction success for the crystallization of templated vanadium selenites. Their model was able to learn general reaction conditions and even revealed new hypotheses regarding the conditions for successful product formation. Finally, ML offers new ways in which theory can guide experiment. Two fields where ML has played a transformative role are \textbf{molecular/materials discovery and computational high-throughput screening}, with several reviews summarizing recent advances.~\cite{Schleder2019, Elton2019, Yang2019CR, Goldsmith2018,Toyao2020_ACS_Catalysis,McCullough2020} The combination of high-throughput screening with accurate and efficient ML models has proven to be highly valuable, as it allows to substitute most of the required electronic structure calculations~\cite{melville2009machine}. Examples of what is possible in this space include the objective-free exploration of light-absorbing molecules,~\cite{Terayama2020} drug design,~\cite{ekins2019exploiting} the computational search for highly active transition metal complexes that catalyse C-C cross coupling reactions,~\cite{Meyer2018} or the discovery of new perovskite materials~\cite{GomezPeralta2020} or polymers for organic photovoltaic applications.~\cite{jorgensen2018machine, StJohn2019} Still, chemical space is estimated to cover more than $10^{60}$ molecules~\cite{Dobson2004N}, hence exhaustive computational screening remains infeasible -- even with fast and accurate ML models. In this context, \textbf{ML-enabled inverse design} offers a promising alternative by reversing the usual paradigm of obtaining properties from structure~\cite{Weymuth2014,zunger2018inverse}. Instead, the aim is to create structures exhibiting a range of desired properties. Since such ML models readily provide analytic gradients, an application to property-based structure optimization is straightforward. First steps of applying ML in these areas have recently been achieved. Examples include the optimization of the HOMO-LUMO gap as demonstrated by \citet{schutt2019unifying} and relaxation for crystal structure prediction as investigated by \citet{podryabinkin2019accelerating}. While ML only provides gradient-based local optimization in these examples, it can be combined with genetic algorithms~\cite{podryabinkin2019accelerating} or global optimization methods such as simulated annealing or minima hopping~\cite{noh2020machine}. \textit{Future directions}: While ML techniques and atomistic ML potentials in particular have contributed greatly to closing the gap between theory and experiment, a range of open issues remains. Problems that have only recently begun to be studied include how to extend ML simulations to efficiently reproduce different experimental conditions, such as solvents or electromagnetic fields. Another frequently encountered issue concerns the data efficiency of ML models, as well as the availability of reliable reference data. \comment{For example, most generative models and inverse design approaches to date primarily target simulated properties rather than experimentally measured ones. While calculated quantities (\textit{e.g.} redox potentials, singlet-triplet gaps) can offer invaluable guidance for design endeavors, they ultimately represent approximations to the physical characteristics of a system, which can only be fully captured through experiments (\textit{e.g.} full-cell study for redox kinetics and electrochemical stability). Successful design endeavors therefore often combine theoretical computations with experimental data or calibrate against them\cite{gomez2016design, lin2016redox}.} \section{Outlook} We expect that ML methods will soon become {an integrated} part of electronic structure and molecular simulation software pushing the boundaries of existing techniques {toward} more computationally efficient simulations. ML methods may for example replace complex integral evaluations in the construction of Hamiltonians and secular equations or they can provide improved initial guesses to iteratively solve integro-differential equations. ML methods can further help to describe non-local effects in time and space and provide mechanisms for on-the-fly uncertainty quantification and accuracy improvements. The beneficial scaling properties of ML algorithms with respect to the size of atomistic systems will play an important role in extending the range of application of existing electronic structure and dynamics simulation methods. The application of ML to MQCD simulations will {make it possible to reach} currently unfeasible time and length scales {beyond few picoseconds and tens of atoms. This will in turn require the improvement of existing molecular simulation methods to capture long time dynamics.} As we explore systems of increasing size, we will be able to better study the boundary between quantum effects at the nanoscale as well as collective many-body effects and fluctuations at the meso- and macroscale.~\cite{Ambrosetti1171} A necessary requirement is the establishment and the distribution of user-friendly and well-maintained \textbf{simulation software with {tight} integration of ML methodology} in chemistry and materials science. Software solutions will need to be modular to allow interfacing with well-established deep learning platforms such as TensorFlow or PyTorch. This should involve the establishment of common data standards to easily communicate atomistic simulation and electronic structure data between chemistry and ML packages. In many ways, this requirement is in line with recent trends of increased modularity of codes via general libraries such as ESL~\cite{ESL} and ELSI~\cite{ELSI} (see Fig.~\ref{fig:scf}). A {recent} initiative {toward} an integration of ML is the ENTOS quantum chemistry package and ENTOS AI~\cite{Manby2019}. Another challenge ahead is related to \textbf{establishing a culture of openness and willingness to share data and ML models} as the availability of training data is a crucial aspect of driving advances in this field. {While data sharing is quite common in material science, it is not yet so common in computational molecular science.} Well defined materials data standards as put forward by the Fair Data Infrastructure project (\hyperlink{https://www.fair-di.eu/fairmat/}{FAIR-DI})\cite{Wilkinson2016SD} and \emph{ab-initio} data repositories such as for example the NOMAD repository\cite{Draxl2018,Draxl_2019}, the Materials Project\cite{Jain2013}{, and the MolSSI QCArchive~\cite{Molssi2021}} are needed {in all research areas}. The need for open access to vast amounts of data will need to be balanced against other needs, such as commercial interests that arise from industrial research or commercial software projects. Sustainable integration of ML methods into widely-used software will require long-term community effort and might be less glamorous than exciting proof-of-principle applications of ML in chemistry and materials science. Research funding agencies, reviewers, and industrial stakeholders need to acknowledge this and ensure that sustained funding for such efforts is put in place. If achieved, {an integration} of ML methodology into electronic structure and molecular simulation software, will induce lasting change in workflows and capabilities for computational molecular scientists. Furthermore, it will offer the opportunity to reconsider many of the underpinning design choices of electronic structure and molecular simulation software packages which, in many cases, historically arose from computational efficiency considerations. For example, Gaussian basis representations have been chosen decades ago in quantum chemistry due to the ease of evaluating multi-centre integrals. If ML methods can vastly facilitate the evaluation of multi-centre integrals, are Gaussian basis functions still the best choice of basis representation? {An i}ntegration of ML and molecular simulation will drastically widen participation in the field and uptake of our methods and problem solving approaches. If codes require dramatically fewer computing resources and offer the ability to directly predict experimentally accessible quantities, computational simulation will become more appealing as a complementary tool in synthetic and analytical labs. In many industrial applications, cost-benefit analysis requires that a clear correspondence exists between the cost of delivering predictions and the accuracy and precision that is required for an application. {The use of} ML methods {within such workflows} will hopefully also provide a drive {toward} establishing better measures of uncertainty in atomistic simulation. Finally, \textbf{the method portfolio and skill set of computational molecular scientists will need to adapt} as a consequence of the growing importance of ML methods in electronic structure theory and molecular simulation. In many cases, the presence of some aspects of ML "under the hood" of existing methods and workflows will not change how we apply these methods. For example, a DFT functional parametrized by a ML approach, can be applied as any existing functional (although its range of applicability might be very different). In other cases, the presence of ML methods will fundamentally change basic workflows as we have discussed across the sections of this perspective. In those instances, practitioners need a basic understanding of ML concepts and the different models that they are working with. This involves knowledge of the capabilities and limitations of most standard applications to avoid pitfalls. As such, ML methodology will have to become an integral part of education in computational chemistry and materials science. \begin{acknowledgments} This work was funded by the Austrian Science Fund (FWF) [J 4522-N] (J.W.), the Federal Ministry of Education and Research (BMBF) for the Berlin Center for Machine Learning / BIFOLD (01IS18037A) (K.T.S.), and the UKRI Future Leaders Fellowship programme (MR/S016023/1) (R.J.M.). M.G. works at the BASLEARN – TU Berlin/BASF Joint Lab for Machine Learning, co-financed by TU Berlin and BASF SE. \end{acknowledgments} \section*{Data Availability Statement} Data sharing is not applicable to this article as no new data were created or analyzed in this study. \section*{References}
\section{Background} \label{sec:background} \paragraph{Notations.} Let $\mathcal D$ denote the dataset $\{(\bm{x}_i,\bm{y}_i)\}_{i=1}^N$, where $\bm{x}_i \in \mathbb R^S$ is an input, and $\bm{y}_i \in \{0,1\}^L$ is an output associated with sample $i$. Input $\bm{x}_i$ can be either an ordered or an unordered set, and output $\bm{y}_i$ has $L$ binary labels with 1 indicating the presence of a label and 0 otherwise. We note that in the noisy learning setting, $\bm{y}_i$ could be flipped from the actual truth value. Our goal is to make few mistakes on unseen data even when there are corrupted labels. \paragraph{Word Embeddings.} Word embedding is a language modeling technique where words from the vocabulary are mapped to vectors of real values. They are often trained from very large online text corpora in an unsupervised manner. Common word embeddings include GloVe~\cite{pennington2014glove}, GoogleNews~\cite{mikolov2013efficient}, FastText~\cite{joulin2016fasttext}. we will use GloVe, as it features a nearest-neighbors property, where words that are semantically similar will have smaller Euclidean distances. \paragraph{Attention-based Message Passing Neural Networks (MPNN).} \emph{Self-attention}, or \emph{intra-attention}, is a mechanism that learns to assign different importance weights to each part of a larger piece to focus on more important portions~\cite{vaswani2017attention}. Let $G=(V,E)$ be a directed graph where $V$ is the node set and $E$ is the edge set. We assume $G$ to be a complete graph. To define self-attention on a graph in which each node attends to every other nodes and all edges carry attention weights, attention weight $a_{lj}^t$ for a node pair $(\bm{v}_l, \bm{v}_j)$ is computed as: \begin{align} \label{eq:alpha} e^t_{lj} = a(\bm{v}^t_l,\bm{v}^t_j) = \frac{(\mathbf{W}^q\bm{v}^t_l)^{\top} (\mathbf{W}^u\bm{v}^t_j)}{\sqrt{\smash[b]d}} \\ \alpha^t_{lj} = \textrm{softmax}_j(e^t_{lj}) = \frac{\textrm{exp}(e^t_{lj})}{\sum_{k \in \mathcal{N}(l)}{\textrm{exp}(e^t_{lk})}}, \end{align} where $a(\cdot)$ is a dot product with node-wise linear transformations $\mathbf{W}^q \in \mathbb R^{d \times d}$ on node $\bm{v}_l^t$ and $\mathbf{W}^u \in \mathbb R^{d \times d}$ on node $\bm{v}_j^t$, scaled by $\sqrt{d}$; $e_{lj}^t$ represents the raw importance of label $j$ to label $l$ and is normalized by $\textrm{softmax}(\cdot)$ to obtain $\alpha^t_{lj}$. We briefly introduce LaMP, which applies self-attention to learn label interactions for MLC~\cite{lanchantin2019neural}. Each $v \in V$ associates with a label. To predict whether a label is present, LaMP collects states from its neighbors based on the computed attention weights and makes an update on the current state of the node. If an attention weight is large from one label to another, it suggests the one label has a strong dependency on the other label. We describe this process formally. In the $t$-th self-attention layer, each label is represented by a node $\bm{v}_l^t \in \mathbb R^d$. LaMP first generates the message $\bm{m}_l^t$ of $\bm{v}_l^t$: \begin{gather} \label{eq:m_attention} M_{\textrm{atn}}(\bm{v}^t_l,\bm{v}^t_j) = \alpha^t_{lj} \mathbf{W}^v \bm{v}^t_j,\\ \bm{m}^t_l = \bm{v}^t_l + \sum_{j\in \mathcal{N}(l)} M_{\textrm{atn}}(\bm{v}^t_l,\bm{v}^t_j), \label{eq:mt} \end{gather} where $\mathbf{W}^v \in \mathbb R^{d \times d}$ is a node-wise linear transformation. After going through the $t$-th feed forward layer $U^t$, we obtain $\bm{v}_l^{t+1}$ in the $(t+1)$-th self-attention layer as: \begin{align} {\bm{v}}^{t+1}_l &= \bm{m}^t_l + U^{t}(\bm{m}^{t}_l; \bm{W}). \label{eq:u_attention} \end{align} Finally, we can feed this into a multi-layer perceptron (MLP) to obtain a probability for label $\bm{v}$. In later sections, we will refer to this module as an attention-based MPNN. \paragraph{Asymmetric Loss Functions.} The most widely-used loss function for MLC is binary cross entropy (BCE). For each training sample, BCE is defined as follows: \begin{equation} \label{eq:bce_loss} \resizebox{0.4\textwidth}{!}{$\textrm{BCE}(\bm{y},\hat{\bm{y}}) = \frac{1}{L}\sum_{l=0}^{L-1} -(y_l\log(\hat{y}_l)+(1-y_l)\log(1-\hat{y}_l))$} \end{equation} where $\bm{y}$ is the annotated label vector and $\hat{\bm{y}}$ is the predicted label vector. The label class is indexed by $l$. An issue BCE introduces is the penalty for misclassifying every label class is equal, and thus the loss reduced by easy negative labels may outweigh the penalty from the rare positive samples. Therefore, a loss to decouple the focusing levels of the positive and negative classes would be useful. \citeauthor{ben2020asymmetric} propose asymmetric BCE that enables this flexibility: \begin{equation} \label{eq:asl} \resizebox{0.45\textwidth}{!}{$\textrm{ASL}(\bm{y},\hat{\bm{y}}) = \frac{1}{L}\sum_{l=0}^{L-1} -y_l(1-\hat{y}_l)^{\gamma^+}\log(\hat{y}_l) \\ -(1-y_l)\hat{y}_l^{\gamma^-}\log(1-\hat{y}_l))$} \end{equation} where $\gamma^+$, $\gamma^-$ are the focusing parameters for positive, negative classes, respectively. By setting $\gamma^+ < \gamma^-$, we are able to concentrate the optimization on making correct classifications on positive classes. Furthermore, to make additional efforts for reducing the effect of very easy negative samples, probability shifting is introduced: \begin{equation} \label{eq:prob_shres} \hat{y}_l = \textrm{max}(\hat{y}_l - m, 0) \end{equation} where $m$ is a hyper-parameter that controls how many negative samples to drop. When a class probability is below $m$, we drop any loss penalty for the class. \section{Conclusion} While label noise is a common problem in MLC, few works have evaluated MLC algorithms with noisy labels. We identify three common noise scenarios and create a noise setting to perform evaluations with combined noise types. As the MLC methods that learn label interactions can easily be affected by noisy data, we present CbMLC, which employs an asymmetric loss function with context-based regularization. Our experiments show substantial improvements over other SOTA MLC techniques on the noisy datasets. \section{Experiments} \begin{figure*}[h] \centering \includegraphics[width=0.8\textwidth]{figs/exps_uniform.pdf} \includegraphics[width=0.8\textwidth]{figs/exps_uniformpos.pdf} \caption{Performance comparison (based on label-based F1 scores) of CbMLC to SOTA MLC models on three datasets with uniform noise across all labels \textbf{(top)} and with uniform noise across positive labels \textbf{(bottom)}. The blue lines are miF1 scores, and the red lines are the maF1 scores. The dashed lines represent CbMLC; the dotted lines represent the best SOTA methods for the corresponding datasets.} \label{fig:exps_uniformpos} \end{figure*} We perform a thorough comparison of CbMLC to the state of the art (SOTA) on a variety of datasets ranging from NLP to CV under both clean and noisy settings. We also present an ablation study to demonstrate the effectiveness of the context-based regularization. \paragraph{Datasets and Evaluation Metrics.} We run experiments on the following datasets available for download online~\footnote{http://mulan.sourceforge.net/datasets-mlc.html}~\footnote{http://host.robots.ox.ac.uk/pascal/VOC/}: \emph{reuters-21578} and \emph{rcv1-v2}~\cite{lewis2004rcv1}, natural language sequences with predefined categories based on their content, \emph{bibtex}~\cite{katakis2008multilabel} and \emph{delicious}~\cite{pmlr-v28-bi13}, collections of unordered text objects associated with tags, and \emph{Pascal VOC}~\cite{Everingham15}, RGB images with multiple objects simultaneously present. For \emph{reuters-21578}, \emph{rcv1-v2}, \emph{bibtex}, and \emph{delicious}, we split them into a training set, a validation set, and a test set in an identical way as that in \citet{bai2020disentangled} and \citet{lanchantin2019neural}. For \emph{Pascal VOC} (for brevity, we later refer to it as \emph{VOC}), we follow the exact training settings used in \citet{chen2019multi} and \citet{ben2020asymmetric}. Following conventional MLC settings, we report example-based F1 (ebF1) scores, label-based micro-averaged F1 scores, and label-based macro-averaged F1 scores. When there are imbalanced classes, high miF1 scores indicate better performance on frequent labels, and high maF1 scores indicate strong results on less frequent labels. \paragraph{Baseline Comparisons.} We compare CbMLC with domain specific SOTA MLC methods: Seq2Seq~\cite{nam2017maximizing} and LaMP~\cite{lanchantin2019neural} are two SOTA approaches for multi-label text classification, and ML-GCN~\cite{chen2019multi} is the SOTA in image recognition. MLKNN~\cite{zhang2007ml}, SLEEC~\cite{NIPS2015_5969}, and MPVAE~\cite{bai2020disentangled} are general MLC techniques, but they cannot handle image or sequence inputs. For CV datasets, we also compare to the resnet101~\cite{He_2016_CVPR}, with either BCE or ASL as the loss function. Among all baseline methods, \emph{MPVAE claims to be a noise-robust model}. We follow the same training settings and tune hyper-parameters to achieve the best performance for every baseline method. We note that, we do not directly compare to single-label methods for dealing with noise because 1) many such works assume a softmax output layer~\cite{zhang2018generalized,Lyu2020Curriculum,jindal2019effective} or access to a small set of clean data~\cite{zhang2020distilling}, and 2) CbMLC is general in that the decoder and the context-based regularization can be combined with any feature extractor, so CbMLC can be incorporated with other noise learning methods such as meta-learning approaches~\cite{garcia2016noise}. However, we do modify one SOTA single-label noise method using loss correction and include the comparison results in supplementary material. \paragraph{Training and Implementation Details, etc.} We run experiments on NVIDIA Tesla V100 GPUs, each with 16GB memory. We train CbMLC for up to 50 epochs with the Adam~\cite{DBLP:journals/corr/KingmaB14} optimizer and use a weight decay of $1e^{-5}$. The number of decoder layers is 4. For NLP datasets, we adopt a transformer-style encoder used in \citet{lanchantin2019neural} and set the learning rate to be $2^{-4}$. For CV datasets, we use resnet101~\cite{He_2016_CVPR} as the encoder, and the learning rate is $1e^{-5}$. CbMLC only requires minimal tuning; we only search $\lambda$ from $\{0.001, 0.01, 0.1, 1\}$ and $\gamma^{+}$ as well as $\gamma^{-}$ from $\{1, 2, 4\}$. $m$ is $0.05$ or $0.1$. \subsection{Experiments on Clean Datasets} Table~\ref{tab:main_exps} presents the performance comparison of CbMLC to other SOTA MLC methods on the five datasets. On all five datasets, CbMLC produces superior or at least comparable performance to that of previous works. Furthermore, we have the highest maF1 score for every dataset; that is, our method tends to learn better for the classes with less positive labels. CbMLC produces relatively smaller improvements in miF1 scores; this could be because there are already many samples with frequent labels, so it is possible to learn how the labels interact from label co-occurrences alone. \subsection{Experiments on Datasets with Injected Noise} We compare CbMLC to other SOTA MLC methods with injected noise discussed in Section~\ref{sec:noise}. For type 1 noise, we test with $\{1\%,2\%,3\%,4\%,5\%\}$ uniform noise for the NLP datasets and $\{10\%,20\%,30\%,40\%,50\%\}$ uniform noise for the CV datasets across both positive and negative labels (since there are far fewer label classes for the CV datasets, adding as little noise as we add to the NLP datasets leads to very minor drop in performance). For type 2 noise, we test with $\{10\%,20\%,30\%,40\%,50\%\}$ uniform noise on all the datasets across all positive labels. We also test on type 3 noise, where each training sample only has one positive label that is randomly chosen. Due to the page limit, we select one dataset from each task to present the results for type 1 and type 2 noise. We include comprehensive results for all the datasets in the supplementary material. To produce a noisy setting close to the real world, we also test the methods with combined noise: for each instance, there is 1/3 chance for it to be corrupted by one type of noise; for type 1 noise, 0\% to 10\% positive and negative labels are modified, and for type 2 noise, 0\% to 50\% positive negative labels are modified. We present the results for type 1 noise and type 2 noise in Figure~\ref{fig:exps_uniformpos}. The dashed lines show the performance of CbMLC, and the dotted lines show the performance of the best performing SOTA MLC method on the corresponding dataset. The blue lines represent the miF1 scores, and the red lines are the maF1 scores. In most cases, we produce a substantial improvement. On \emph{reuters} and \emph{bibtex}, light noise (e.g., 1\%, 2\% type 1 noise and 10\%, 20\% type 2 noise) does not lead to much drop in the classification results; they are even comparable to running other SOTA methods on the clean datasets. We also highlight how our method performs on \emph{Pascal VOC}. When there is 30\% type 1 noise, we improve the maF1 score by the best SOTA method by nearly 30\%, and when there is 40\% type 1 noise, we improve the miF1 score by the best SOTA method by 30\% as well. We summarize the results for type 3 noise in Table~\ref{tab:exps_onepos} and the results for the combined noise in Table~\ref{tab:exps_combined}. We outperform the best SOTA method on every dataset (except for the miF1 score on \emph{rcv1} with type 3 noise). When the noise becomes more complex, the performance gaps between the best SOTA method and CbMLC further increase. Therefore, context-based regularization is a simple yet very effective trick to prevent overfit label noise. To summarize, CbMLC produce relativelly small improvements on the clean datasets; however, when there are noisy labels, CbMLC is more robust than other SOTA methods. \begin{table}[t] \centering \resizebox{0.45\textwidth}{!}{% \begin{tabular}{cc"c|c|c|c|c} \multicolumn{1}{l}{} & \textbf{F1 score} & \textbf{bibtex} & \textbf{reuters} & \textbf{delicious} & \textbf{rcv1} & \textbf{VOC} \\ \thickhline \multirow{2}{*}{\textbf{SOTA}} & \textbf{miF1} & 0.3572 & 0.8165 & 0.2737 & {\ul \textit{\textbf{0.8483}}} & 0.8350\\ & \textbf{maF1} & 0.2387 & 0.4000 & 0.0363 & 0.6770 & 0.8302\\ \hline \multirow{2}{*}{\textbf{CbMLC}} & \textbf{miF1} & {\ul \textit{\textbf{0.4210}}} & {\ul \textit{\textbf{0.8581}}} & {\ul \textit{\textbf{0.2805}}} & 0.8448 & {\ul \textit{\textbf{0.8447}}}\\ & \textbf{maF1} & {\ul \textit{\textbf{0.3049}}} & {\ul \textit{\textbf{0.4758}}} & {\ul \textit{\textbf{0.0636}}} & {\ul \textit{\textbf{0.7007}}} & {\ul \textit{\textbf{0.8442}}} \end{tabular}% } \caption{Performance comparison (based on label-based F1 scores) of CbMLC to SOTA MLC models on the five datasets with injected noise where each training sample only has one positive label.} \label{tab:exps_onepos} \end{table} \begin{table}[t] \centering \resizebox{0.45\textwidth}{!}{% \begin{tabular}{cc"c|c|c|c|c} \multicolumn{1}{l}{} & \textbf{F1 score} & \textbf{bibtex} & \textbf{reuters} & \textbf{delicious} & \textbf{rcv1} & \textbf{VOC} \\ \thickhline \multirow{2}{*}{\textbf{SOTA}} & \textbf{miF1} & 0.3238 & 0.7484 & 0.1973 & 0.8579 & 0.7138 \\ & \textbf{maF1} & 0.1888 & 0.2768 & 0.0682 & 0.6646 & 0.6281 \\ \multirow{2}{*}{\ul\textbf{CbMLC}} & \textbf{miF1} & {\ul\textit{\textbf{0.3282}}} & {\ul\textit{\textbf{0.8200}}} & {\ul\textit{\textbf{0.3290}}} & {\ul\textit{\textbf{0.8580}}} & {\ul\textit{\textbf{0.7621}}} \\ & \textbf{maF1} & {\ul\textit{\textbf{0.1993}}} & {\ul\textit{\textbf{0.3325}}} & {\ul\textit{\textbf{0.0811}}} & {\ul\textit{\textbf{0.6735}}} & {\ul\textit{\textbf{0.7281}}} \end{tabular}% } \caption{Performance comparison (based on label-based F1 scores) of CbMLC to SOTA MLC models on the five datasets injected with combined noise types.} \label{tab:exps_combined} \end{table} \begin{figure}[t] \centering \includegraphics[width=0.35\textwidth]{figs/emb_dist.pdf} \caption{Embedding distances between label pairs averaged over top 100 most frequently co-occurring label pairs for each dataset. A smaller distance for a label pair indicates the two labels have stronger correlation. \textit{Using word embeddings with the context-based regularizer for label embeddings produces smaller distances for label pairs with frequent co-occurrences than not using word embeddings, suggesting CbMLC learns better label semantics.}} \label{fig:emb_dist} \end{figure} \begin{table}[h] \centering \resizebox{0.45\textwidth}{!}{% \begin{tabular}{cc"c|c|c|c|c} \multicolumn{1}{l}{} & \textbf{F1 score} & \textbf{bibtext} & \textbf{reuters} & \textbf{delicious} & \textbf{rcv1} & \textbf{VOC} \\ \thickhline \multirow{3}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}Fixed\\ WordEmb\end{tabular}}} & \textbf{ebF1} & 0.4484 & 0.9045 & {\ul \textit{\textbf{0.3634}}} & 0.8867 & 0.9023\\ & \textbf{miF1} & 0.4814 & 0.8830 & {\ul \textit{\textbf{0.3749}}} & 0.8734 & 0.8901\\ & \textbf{maF1} & 0.3834 & 0.5530 & 0.1949 & 0.7320 & 0.8797\\ \hline \multirow{3}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}Regularized\\ WordEmb\end{tabular}}} & \textbf{ebF1} & {\ul \textit{\textbf{0.4538}}} & {\ul \textit{\textbf{0.9064}}} & 0.3558 & {\ul \textit{\textbf{0.8868}}} & {\ul \textit{\textbf{0.9049}}}\\ & \textbf{miF1} & {\ul \textit{\textbf{0.4893}}} & {\ul \textit{\textbf{0.8893}}} & 0.3699 & {\ul \textit{\textbf{0.8735}}} & {\ul \textit{\textbf{0.8919}}}\\ & \textbf{maF1} & {\ul \textit{\textbf{0.3940}}} & {\ul \textit{\textbf{0.6024}}} & {\ul \textit{\textbf{0.1984}}} & {\ul \textit{\textbf{0.7460}}} & {\ul \textit{\textbf{0.8822}}} \end{tabular}% } \caption{Comparison on whether the context-based regularization yields an improvement over having fixed word embeddings. Highlighted numbers are the best in each row.} \label{tab:emb_effect} \end{table} \subsection{Ablation Study} \paragraph{Regularized vs. Fixed Word Embeddings.} To verify context-based regularization provides a benefit, we first show a performance comparison of applying regularized word embeddings to applying fixed word embeddings as label embeddings in Table~\ref{tab:emb_effect}. Except for \emph{delicious}, all other datasets favor using context-based regularization. \paragraph{Measuring Label Correlations.} Additionally, we measure the Euclidean distance between pairs of label embeddings. In particular, we sort label pairs based on the number of times they co-occur in the training set and compute the average distance for the 100 pairs with most co-occurrences for the label embeddings with random initialization and for the label embeddings with context-based regularization. We observe that training with randomly initialized label embeddings often suffers from a more severe over-smoothing problem; in order to reduce this effect, we normalize the distance before comparing Euclidean distances across different embedding spaces. For a highly correlated label pair, having a closer distance in the embedding space suggests the model successfully captures their correlation. We present the results in Figure~\ref{fig:emb_dist}. Out of the five datasets, we learn more accurate label similarities on four of them. \section{Introduction} Unlike a traditional single-output learning problem where we assign one label to a given sample, multi-label classification (MLC) aims to predict a set of target objects simultaneously. MLC has been an active research topic in domains including computer vision~\cite{wang2016cnn}, natural language processing~\cite{nam2014large}, and recommendation systems~\cite{liu2017deep}. Notable applications are assigning tags to online images, identifying topics for web articles, and generating product recommendations. Developing an effective MLC technique can lead to improvements in many real-world problems. One challenge MLC faces is the introduction of complex noise in the annotation process. A common way to collect labels is to use crowdsourcing platforms such as Amazon Mechanical Turk (MTurk). Because a large-scale dataset could be labeled by potentially thousands of different human annotators, the labels they provide could naturally be in varying qualities~\cite{snow2008cheap,ipeirotis2010quality,raykar2010learning,yuen2011survey}; the interface a crowdsourcing platform provides can also introduce bias~\cite{li2017webvision}. We refer readers to \citet{openimages} for an example of a data collection process for a dataset of millions of samples, where 26.6\% labels are false positive~\cite{veit2017learning}! Another source of labels is citizen science projects. For example, in the \emph{eBird} project~\cite{sullivan2009ebird}, amateurs observe and record birds at locations they have been to, but one may misidentify a species, and it is difficult to differentiate between one species not being a habitant of a place and the species simply not yet being observed at the place. To develop an accurate MLC method, it is important to consider how label noise is introduced and how it may affect performance. \begin{figure}[t] \centering \includegraphics[width=0.45\textwidth]{figs/generalization.pdf} \caption{Mean average precision (mAP) curves on Pascal VOC produced by ML-GCN and our method, CbMLC. We inject different types of asymmetric noise on the trainval set and test with the clean test set. ML-GCN quickly overfits the trainval set in the first ten epochs, whereas CbMLC generalizes well on the test set as the trainval accuracy grows.} \label{fig:generalization} \end{figure} Considering label noise for the single-label setting is straightforward, as each instance only has one positive label. That is, a mislabeled instance has exactly two classes that are flipped. However, label noise under the multi-label setting is more complicated, as there is an unknown number of positive labels associated to an instance. In other words, the number of mislabeled classes is arbitrary. Despite the prevalence of label noise in MLC, little attention has been given to evaluate MLC with noisy labels. Among the several works~\cite{li2021towards,bai2020disentangled,yao2018deep} that consider noisy labels, they only evaluate with uniform noise that is symmetric on positive and negative labels. In the real world, positive labels in MLC are very sparse, and therefore it is unreasonable to assume symmetric noise across positive and negative labels. We are in need of a way to model noisy labels in MLC that is closer to real-world scenarios. Recent successes in MLC are the outcome of leveraging label correlations via graph neural networks (GNNs)~\cite{scarselli2008graph} which model how labels interact with each other~\cite{lanchantin2019neural,chen2019multi,wang2020multi}, or via label covariance matrices~\cite{chen2017deep, bai2020disentangled, tang2018multi}. However, these methods are particularly prone to errors. For example, ML-GCN~\cite{chen2019multi}, a state-of-the-art multi-label classification model for image recognition, pre-computes a label correlation matrix purely based on the label co-occurrences in the training set, and uses the matrix to guide information propagation among label nodes during training. Given the over-parameterized nature of deep neural networks, it is easy to overfit label noise, leading to poor generalization~\cite{45820}. In Figure~\ref{fig:generalization}, we show the mean averaged precision (mAP) curves for ML-GCN and our proposed method, CbMLC, on a corrupted version of \emph{Pascal VOC}, where we inject different types of asymmetric noise in the trainval set. ML-GCN quickly overfits the noisy trainval set, and test accuracy starts dropping in the first 10 epochs. However, using the proposed regularization technique, CbMLC substantially shrinks the generalization gap. \textbf{Our contributions} are (1) We identify three real-world noise scenarios and show how state-of-the-art MLC techniques perform poorly under these scenarios. We test with both symmetric and asymmetric noise types, and combined noise types with varying ratios on different instances. (2) We propose a Context-based Multi-label Classifier (CbMLC), an end-to-end framework that leverages large pretrained word embeddings to perform context-based regularization for multi-label classification to avoid overfitting. It employs an encoder-to-decoder network architecture with an asymmetric loss function, a domain-specific encoder to encode features into a latent vector, and a message passing decoder operating on a label graph to learn label dependencies. This proposed framework not only benefits from employing a graph neural network to learn label correlations, but also alleviates the overfitting issue \emph{without requiring access to any clean labels}. (3) We conduct extensive experiments on public datasets in a variety of application domains including computer vision (CV) and natural language processing (NLP). On clean datasets, our framework outperforms (or is comparable to) the state-of-the-art methods. On datasets with noise, CbMLC produces substantial improvements over previous methods in most cases. We provide an ablation study that shows CbMLC learns better label semantics guided by the context-based regularization. \section{A Context-Based Multi-label Classifier} We propose CbMLC, an end-to-end learning framework for multi-label classification, extending robust predictive performance on real-world datasets with noisy labels. The key to its robustness is that CbMLC exploits rich contextual information in large-scale pretrained word embeddings by encouraging label embeddings similar to but not the same as word embeddings. The context-based regularization provides the following benefits: (1) over-parameterized neural networks can easily overfit noisy and less frequent labels, and incorporating word similarity information from pretrained word embeddings helps CbMLC to avoid spurious label correlations; (2) when we are given a dataset with zero prior knowledge, the pretrained word embeddings guide learning in a promising direction; and (3) regularizing based on the word embeddings alleviates the over-smoothing problem in GNNs. In addition to the regularization, CbMLC also leverages recent advances in MLC such as asymmetric losses and employs self-attention in label graphs. \label{sec:exp} \subsection{Context-Based Regularization} \label{sec:reg} The key to context-based regularization is that we inject the word similarities learned by pre-trained word embeddings on label embeddings, which is done by adjusting the $\mathcal{L}2$ distance between the word embeddings and the label embeddings. To begin, we have a word embedding function $g: \Delta \mapsto \mathbb R^P$, where $\Delta$ is a dictionary of word tokens, and $P$ is the dimensionality of the embedding space. $g(\cdot)$ is often pretrained from large online corpora in an unsupervised fashion; thus, acquiring this contextual information does not require any additional supervision. We denote a label embedding by $\bm{e}_l$ for the $l$th label. To construct initial label embeddings, we define a mapping $h$ from word tokens of a label class $s_l$ to its embedding in $\mathbb R^P$. If $s_l$ is a single word token $d$ and $s_l=d \in \Delta$, then $h(s_l) = g(d)$; however, if $s_l \notin \Delta$, then $h(s_l) \sim N(\mu, \sigma)^P$, where $\mu, \sigma$ are the mean and the variance of all the label tokens in $\Delta$. If $s_l$ is a label of multiple word tokens $\{d1, ..., d_K\}$, then $h(s_l) = \frac{1}{K}\sum_1^K h(d_k)$. $\bm{e}_l$ is initially set as $h(s_l)$ and updated at every gradient step. We define the context-based regularization as follows: \begin{equation} \mathcal{L}_{CB} = \sum_{l=0}^{L-1} (\bm{e}_l - h(s_l))^2 \end{equation} With this regularizer, CbMLC can learn label embeddings customized to each dataset while still maintaining some degree of global word similarities obtained from pre-trained word embeddings to prevent over-fitting. \subsection{Model Architecture} Figure~\ref{fig:framework} presents the model architecture of the CbMLC framework. In Figure~\ref{fig:framework}A, the overall network flow follows an encoder-to-decoder structure: the encoder first maps input $x$ to a latent space, and the decoder takes the latent vector $\bm{z}$ to produce the final label probabilities. The encoder can be parameterized by any function depending on the specific tasks, and the decoder is an attention-based MPNN on a label graph, where each node corresponds to a label. From Figure~\ref{fig:framework}B, we can see that the label graph is by default a complete graph, where every pair of nodes is connected by an edge in both directions. We can also remove edges if two labels are known to have no correlations. In Figure~\ref{fig:framework}C, label node 0 first receives $\bm{z}$ and treats it as a single message to make an updates. Then, label node 0 collects messages from its neighbors based on their attention weights to make the second update. Figure~\ref{fig:framework}D demonstrates how to make one update. Each label node has hidden states that are represented as embedded vectors $\{\bm{v}^t_0, \bm{v}^t_1, \dots, \bm{v}^t_{L-1}\}$, where $\bm{v}^t_l \in \mathbb R^P$ and $t$ is the time step, and $\bm{v}^0_l=\bm{e}_l$. Self-attention is computed based on Equations~\ref{eq:alpha}-\ref{eq:mt}, and feedforward is computed using Equation~\ref{eq:u_attention}. Specifically, we use multi-head self-attention~\cite{vaswani2017attention}, so that a node can focus on different parts simultaneously. Each of the attention and feedforward sublayers is followed by layer normalization~\cite{ba2016layer} to reduce training instability. Because at every $t$, $\bm{v}^t_l$ needs to update twice, there are $2T$ layers. After the $2T$ layers, a readout layer predicts each label $\hat{y}_l$, where a readout function $R$ projects $\bm{v}_l^{2T}$ using a projection matrix $\textbf{W}^o \in \mathbb R^{d\times d}$. The $l$th row of $\textbf{W}^o$ is denoted by $\textbf{W}^o_l$. The resulting vector of size $L \times 1$ is then fed through an element-wise sigmoid function to produce the final probabilities of all labels: \begin{equation} \label{eq:readout} \hat{y}_l = R({\bm{v}}^{2T}_l;{\textbf{W}^o}) = \textrm{sigmoid}({\textbf{W}^o_l} {\bm{v}}^{2T}_l). \end{equation} We note that $R(\cdot)$ is shared across all nodes; therefore, the prediction result is invariant to any node permutation. \subsection{Loss Function} The loss function $\mathcal{L}$ consists of two parts: the first part is a 0/1 loss that penalizes incorrect predictions, and the second part is the context-based (CB) regularizer described in Sec.~\ref{sec:reg}. $\mathcal{L}$ is as follows: \begin{equation} \mathcal{L} = \mathcal{L}_{\textrm{ASL}} + \lambda \mathcal{L}_{CB} \end{equation} $\mathcal{L}_{ASL}$ is the asymmetric cross entropy loss defined in Sec.~\ref{sec:background}. Hyperparameter $\lambda$ controls to which degree we encourage labels to follow the word similarity structure from the pretrained word embbedings. In a dataset with more training examples, we can set a small $\lambda$ as CbMLC has more examples to learn how labels interact with each other. In summary, the parameters to be optimized are the model parameters together with the label embeddings. \section{Modeling Real-World Noise in MLC} \label{sec:noise} Though there is a vast amount of research focusing on deep learning for single-label classification~\cite{song2020learning}, little attention has been drawn to the multi-label setting. In particular, few works have examined how to model noise in a learning algorithm so that it is closer to real-world scenarios, nor is it a common practice for researchers to evaluate their MLC methods with noisy labels. To identify possible noise types, we first discuss how noise is generated. Due to ever-increasing dataset sizes, it becomes impossible to have human experts to annotate all available data; hence, we turn to crowd-sourcing platforms~\cite{yuen2011survey}. A problem these platforms suffer from is that the reliability of individual workers varies, and there are individuals who are careless and give very noisy responses~\cite{snow2008cheap}. Other automatic methods such as $k$-NN induction are used~\cite{10.1145/1646396.1646452}. Additionally, in citizen science projects, even people with more expertise may also make mistakes due to various reasons such as environments and perceptual errors~\cite{mcnicol1972statistical}. We consider label noise from a statistical point of view, inspired by the noise taxonomy for the single-label setting~\citet{frenay2013classification}. To model the label noise process, we introduce three random variables: $Y$ is the true label for one class being either 0 or 1, $\Tilde{Y}$ is the annotated label, and $E$ is a binary variable indicating whether an error occurred (i.e., $Y \neq \Tilde{Y}$). We focus on two statistical models of label noise. The first model is the \emph{noisy completely at random (NCAR)} model, where the occurrence of an error $E$ is independent of $Y$. Formally, the error rate, or the probability of a true label different from the observed label is, $p_e = P(E = 1) = P(Y \neq \Tilde{Y})$. In the case of MLC, we assume a biased coin is flipped independently for every class label of an instance to decide whether the observed label is correct or not. Therefore, if the error rate is $p_e$ in a labeling process, an annotated instance will in expectation have $|\mathcal{Y}| \cdot p_e$ corrupted labels, where $|\mathcal{Y}|$ is the number of labels. The second model is the \emph{noisy at random (NAR)} model, where the probability of an error $E$ depends on $Y$. In other words, this model can represent anisotropic noise varying from classes to classes. Formally, the error rate for a label in an instance is $p_e = P(E = 1) = P(Y=1) \cdot P(E = 1|Y=1)+P(Y=0)\cdot P(E = 1|Y=0)$. We note these two noise models are independent of features. While features could also impact how noise is introduced because mislabeled samples are likely similar to examples of another class~\cite{beigman2009annotator}, or have labels with low density~\cite{denoeux2000neural}, due to its complexity we leave it to future work. Based on the two noise models, we evaluate MLC methods with the following noise types that are likely to occur in the real-world annotation processes: \begin{enumerate} \item Under NCAR, we consider an example with $x\%$ labels uniformly flipped. This is by far the most widely evaluated noise type in the existing MLC literature~\cite{li2021towards,bai2020disentangled}. \item Under NAR, we consider an example with $x\%$ positive labels uniformly flipped. It is common to see this type of noise in citizen science projects~\cite{sullivan2009ebird}. In general, it is more often to label positive classes as negative in MLC~\cite{ben2020asymmetric}. \item Under NAR, we consider an example with only one positive label that is selected from all positive labels. This is a standard assumption made when collecting data from the web~\cite{li2017webvision}. In fact, because of ignoring the intrinsic multi-label nature of the images, the classification performance on ImageNet~\cite{russakovsky2015imagenet} produced by state-of-the-art classifiers is under-estimated~\cite{stock2018convnets}. \end{enumerate} We thoroughly evaluate state-of-the-art MLC methods and CbMLC with the three noise types in Section~\ref{sec:exp}. We note that in the real world, it is rare to have uniform noise or to have only one noise type in a dataset, and thus we test the MLC algorithms with a single noise type as well as combined noise types with varying ratios. \section{Related Work} Existing MLC approaches that are related to our work incorporate label correlations, use regularization or an unconventional loss, or consider MLC under a noisy label setting. \paragraph{Learning Label Dependencies.} Our technique is within the line of work where conditional label dependencies are considered when making label predictions, as opposed to the methods that decompose a MLC problem into a set of independent binary classification problems~\cite{boutell2004learning,zhang2007ml}. Probabilistic chain classifiers (PCCs) stack binary classifiers sequentially and produce one label at a time conditioned on all previous outputs~\cite{cheng2010bayes,read2011classifier}. Followup works extend PCCs to recurrent neural networks (RNNs)~\cite{wang2016cnn,nam2017maximizing}. There are two major drawbacks of these proposed models. They are not parallelizable due to the auto-regressive nature, so either training or performing inference is time-cosuming. Additionally, MLC labels are unordered sets, but sequential prediction is highly order-dependent; therefore, ordering labels differently could significantly impact performance. \citeauthor{chen2017deep,chen2018end,bai2020disentangled} develop deep multi-variate probit models (DMVPs) to tackle MLC problems. DMVPs first compute a probability of each label being present and use a label covariance matrix to make adjustments. However, because of covariance matrices, DMVPs can only model pairwise label correlations, and real-world label interactions often happen beyond second order~\cite{wang2020multi}. Building label graphs on GNNs overcome the prior obstacles: their graphical structures enables to learn label dependencies in an order-invariant manner, and they have the potential to capture high-order label dependencies by stacking multiple layers together. \citeauthor{chen2019multi,10.1145/3394486.3403368,DBLP:conf/aaai/WangHLLZMW20,wang2018joint} represent each node of the graph as a word embedding of the corresponding label. This may be problematic: word embeddings are fixed for all datasets, but the pretrained word embeddings are unlikely to fully capture the relations between words for every dataset. The learning capacities are thus degraded. \citeauthor{lanchantin2019neural,wang2020multi,DBLP:conf/aaai/YouGCLBW20} model label interactions using attention-based message passing neural networks (MPNNs)~\cite{gilmer2017neural}, where they learn label representations from scratch. However, this may easily overfit when there are noisy labels. \paragraph{Losses and Regularization Techniques.} In addition to BCE, other losses have been proposed to train multi-label classifiers. \citet{gong2014deep} perform extensive experiments on evaluating softmax~\cite{guillaumin2009tagprop}, pairwise ranking~\cite{joachims2002optimizing}, and weighted approximate ranking~\cite{weston2011wsabie} for MLC. \cite{lin2017focal} present focal loss to weight positive and negative labels differently. Regularization techniques are an important research direction to prevent overfitting on training sets. \citet{zhang2017learning,krichene2018efficient,guo2019breaking} maximize the distances between all pairs of label embeddings to account for sparse labels in extreme MLC. \paragraph{MLC with Noisy Labels} To handle noisy labels in MLC, \citet{garcia2016noise} propose to adjust incorrectly estimated label transition probabilities by quality embedding. Partial multi-label learning (PMLL) setting is also related~\cite{xie2018partial}, where each example is annotated with a candidate label set that contains relevant labels and noisy labels. To identify the noisy labels, \cite{zhang2020partial} recover true labels by introducing labeling confidence, \cite{sun2019partial} exploit a low-rank and sparse decomposition scheme, and \cite{Xie_Huang_2020} optimize the multi-label classifier and noisy label identifier under a unified framework. \section{Supplementary Material} \subsection{Dataset Statistics} \begin{table*}[t] \centering \resizebox{\textwidth}{!}{% \begin{tabular}{l|llllllllllll} Dataset & Input Type & \#Train & \#Val & \#Test & Labels (L) & Features & \begin{tabular}[c]{@{}l@{}}Mean\\ Label\\ /Sample\end{tabular} & \begin{tabular}[c]{@{}l@{}}Median\\ Label\\ /Sample\end{tabular} & \begin{tabular}[c]{@{}l@{}}Max\\ Label\\ /Sample\end{tabular} & \begin{tabular}[c]{@{}l@{}}Mean\\ Sample\\ /Label\end{tabular} & \begin{tabular}[c]{@{}l@{}}Median\\ Label\\ /Sample\end{tabular} & \begin{tabular}[c]{@{}l@{}}Max\\ Label\\ /Sample\end{tabular} \\ \hline reuters & Sequential & 6,993 & 777 & 3,019 & 90 & 23662 & 1.23 & 1 & 15 & 106.50 & 18 & 2,877 \\ rcv1 & Sequential & 703,135 & 78,126 & 23,149 & 103 & 368,998 & 3.21 & 3 & 17 & 24,362 & 7,250 & 363,991 \\ bibtex & Binary Vector & 4,377 & 487 & 2515 & 159 & 1836 & 2.38 & 2 & 28 & 72.79 & 54 & 689 \\ delicious & Binary Vector & 11,579 & 1,289 & 3,185 & 983 & 500 & 19.06 & 20 & 25 & 250.15 & 85 & 5,189 \\ Pascal VOC & Image & 5011 & N/A & 4952 & 20 & 448 $\times$ 448 & 1.56 & 1 & 7 & 395.65 & 268 & 2,095 \end{tabular}% } \caption{\textbf{Dataset Statistics}. We select five datasets that vary in a number of aspects including the input type, number of samples, number of labels, and how imbalanced the label classes are.} \label{tab:dataset_stats} \end{table*} We use five well-studied MLC datasets. We show the dataset statistics in Table~\ref{tab:dataset_stats}: the five datasets vary in the input type, number of samples, number of labels, and number of input features; additionally, some datasets have more imbalanced classes than the others. \subsection{Evaluation Metrics} We use the following metrics in the experimental evaluation. \paragraph{F1-scores.} We denote the number of true positives by $tp$, the number of false positives by $fp$, and the number of false negatives by $fn$. An F1-score is defined as follows: \begin{equation*} F_1 = \frac{2tp}{2tp+(fp+fn)} \end{equation*} The example-based F1-score calculates F1-scores for all test samples individually and take the average over them: \begin{equation*} \mathrm{eb}F_1=\frac{1}{N}\sum_{i=1}^{N}\frac{\sum_{j=1}^L 2y_j^i\hat{y}_j^i}{\sum_{j=1}^L y_j^i+\sum_{j=1}^L\hat{y}_j^i} \end{equation*} where $N$ is the number of test samples, $y_j^i$ is the $j$-th ground-truth label of test sample $i$ and $\hat{y}_j^i$ is the $j$-th predicted label of test sample $i$. The micro-averaged F1-score sums up individual true positives, false positives, and false negatives of all predication outcomes, and use them to compute an F1-score: \begin{equation*} \mathrm{mi}F_1=\frac{\sum_{l=1}^L\sum_{i=1}^{N} 2y_l^i\hat{y}_l^i}{\sum_{l=1}^L\sum_{i=1}^{N}[2y_l^i\hat{y}_l^i+(1-y_l^i)\hat{y}_l^i+y_l^i(1-\hat{y}_l^i)]} \end{equation*} The macro-averaged F1-score is the averaged F1-score over all label classes: \begin{equation*} \mathrm{ma}F_1=\frac{1}{L}\sum_{l=1}^{L}\frac{ \sum_{i=1}^{N}2y_l^i\hat{y}_l^i}{\sum_{i=1}^{N} [2y_l^i\hat{y}_l^i+(1-y_l^i)\hat{y}_l^i+y_l^i(1-\hat{y}_l^i)]} \end{equation*} \subsection{Additional Experiments} \begin{figure*}[t] \centering \includegraphics[width=0.75\textwidth]{figs/voc_tsne_word_10.pdf} \caption{t-SNE visualization of various label embeddings on Pascal VOC. \textbf{Left:} Randomly initialized label embeddings learned over the training process. \textbf{Middle:} Fixed word embeddings as label embeddings. \textbf{Right:} Label embeddings initialized as word embeddings and learned with context-based regularization during training. \textit{While the first setting already produces label embeddings with good qualities, the last setting learns ``perfect'' label clusters.}} \label{fig:voc_tsne} \end{figure*} \subsubsection{Visualization} In Figure~\ref{fig:voc_tsne}, we present a t-SNE visualization~\cite{van2008visualizing} of label embeddings of \emph{Pascal VOC} obtained from various settings. With enough training data, starting to learn with randomly initialized label embeddings already produces reasonable results. However, with word embeddings, we are able to obtain more precise label clusterings. The word embedding clusterings (middle) and the regularized word embedding clusterings (right) look similar. That said, regularized word embeddings clusterings are more accurate in the context of \emph{Pascal VOC}; they begin from the word embeddings, but become more relevant to the dataset through the training process. Since the objects falling into the same category have more co-occurrences, they are closer to each other in the embedding space. \subsubsection{When CbMLC fails} \begin{table}[h] \centering \resizebox{0.45\textwidth}{!}{% \begin{tabular}{c"c|c|c|c} \multicolumn{1}{l}{} & \textbf{No WordEmb} & \textbf{WordEmb 0.01} & \textbf{WordEmb 0.10} & \textbf{WordEmb 1.00} \\ \thickhline \textbf{miF1} & {\ul \textit{\textbf{0.4119}}} & 0.4117 & 0.4106 & 0.4104 \\ \textbf{maF1} & {\ul \textit{\textbf{0.2538}}} & 0.238 & 0.2375 & 0.2354 \end{tabular}% } \caption{Performance comparison of using randomly initialized label embeddings to using label embbedings with context-based regularization on the \emph{ebird} dataset. The numbers next to WordEmb are the regularization coefficients. Highlighted numbers are the best of a row.} \label{tab:ebird} \end{table} We briefly discuss when context-based regularization fails. CbMLC is highly dependent on the quality of pretrained word embeddings. We run it on an additional dataset, \emph{ebird}~\cite{sullivan2009ebird}, which is a bird distribution dataset across the world. Given a set of environmental features $\bm{x}$ associated to a location, the task is to predict what bird species $\bm{y}$ there are at the given location. Again, we retrieve species names from GloVe. We summarize the results in Table~\ref{tab:ebird}. Since these are less frequent words, initializing label embeddings as word embeddings yields a worst result than learning label embeddings from scratch. \subsubsection{Comparing to a SOTA Single-Label Denoise Method} While there is no regularization-based unsupervised method developed for noisy single-label learning that can be directly applied to MLC, we modify \emph{MD-DYR-SH}~\cite{arazo2019unsupervised} so that we can see how a SOTA single-label denoise method performs compared to CbMLC. MD-DYR-SH is based on \emph{mixup}~\cite{zhang2018mixup}, which assumes inputs to be real numbers. For this reason, MD-DYR-SH can only be applied on \emph{Pascal VOC}. \begin{table}[t] \centering \resizebox{0.3\textwidth}{!}{% \begin{tabular}{c"c|c|c} \textbf{F1-score} & \textbf{MD-DYR-SH} & \textbf{ML-GCN} & \textbf{CbMLC} \\\thickhline \textbf{miF1} & 0.7290 & 0.7138 & {\ul \textit{\textbf{0.7621}}} \\ \textbf{maF1} & 0.6396 & 0.6281 & {\ul \textit{\textbf{0.7281}}} \end{tabular}% } \caption{Comparison of CbMLC to ML-GCN, a SOTA multi-label image recognition method, and MD-DYR-SH, a SOTA single-label denoise method. Highlighted numbers are the best of a row.} \label{tab:single-label} \end{table} MD-DYR-SH leverages an observation that a deep model fits clean labels before noisy labels: they fit training loss curve with a beta mixture models (BMM) to identify noisy labels. To adapt it for MLC, instead of only penalizing false negatives, we also add loss for false positives. We test MD-DYR-SH with the combined noise. We fine tune MD-DYR-SH to achieve its best possible performance and show the results in Table~\ref{tab:single-label}. We can see that although, modified MD-DYR-SH slightly improves over ML-GCN, a SOTA multi-label image recognition method, the gap between MD-DYR-SH and CbMLC is still large. Our intepretation is that single-label learning only optimizes on the one true positive label per instance, but the MLC loss simultaneously penalizes all misclassified labels for an instance; therefore, we need to develop regularization techniques that is suitable for the MLC loss rather than simply adapting approaches from single-label learning. \subsubsection{Complete Results for Type 1 and Type 2 Noise} \begin{table*}[h] \centering \resizebox{0.7\textwidth}{!}{% \begin{tabular}{c|c"cc|cc|cc|cc|cc} \multicolumn{2}{c}{\textbf{Noise Level}} & \multicolumn{2}{c}{\textbf{0.01}} & \multicolumn{2}{c}{\textbf{0.02}} & \multicolumn{2}{c}{\textbf{0.03}} & \multicolumn{2}{c}{\textbf{0.04}} & \multicolumn{2}{c}{\textbf{0.05}} \\ \hline \textbf{Dataset} & \textbf{Method} & \textbf{miF1} & \textbf{maF1} & \textbf{miF1} & \textbf{maF1} & \textbf{miF1} & \textbf{maF1} & \textbf{miF1} & \textbf{maF1} & \textbf{miF1} & \textbf{maF1} \\ \thickhline \multirow{2}{*}{\textbf{delicious}} & \textbf{SOTA} & {\ul \textit{\textbf{0.3794}}} & {\ul \textit{\textbf{0.1734}}} & {\ul \textit{\textbf{0.3732}}} & {\ul \textit{\textbf{0.1605}}} & {\ul \textit{\textbf{0.3677}}} & {\ul \textit{\textbf{0.1532}}} & {\ul \textit{\textbf{0.3612}}} & {\ul \textit{\textbf{0.1476}}} & {\ul \textit{\textbf{0.3452}}} & 0.1352 \\ & \textbf{CbMLC} & 0.3668 & 0.1409 & 0.3544 & 0.1409 & 0.3543 & 0.1409 & 0.3482 & 0.1409 & 0.3306 & {\ul \textit{\textbf{0.1409}}} \\ \multirow{2}{*}{\textbf{rcv1}} & \textbf{SOTA} & 0.8720 & 0.7265 & {\ul \textit{\textbf{0.8857}}} & 0.7232 & {\ul \textit{\textbf{0.8704}}} & 0.7123 & 0.8704 & 0.7021 & {\ul \textit{\textbf{0.8721}}} & 0.7158 \\ & \textbf{CbMLC} & {\ul \textit{\textbf{0.8725}}} & {\ul \textit{\textbf{0.7372}}} & 0.8726 & {\ul \textit{\textbf{0.7249}}} & 0.8688 & {\ul \textit{\textbf{0.7242}}} & {\ul \textit{\textbf{0.8706}}} & {\ul \textit{\textbf{0.7212}}} & 0.8689 & {\ul \textit{\textbf{0.7236}}} \end{tabular}% } \caption{Performance comparison of CbMLC to the best SOTA model on the additional two datasets with type 1 noise. Higher scores are better. Highlighted numbers are the best of in each row.} \label{tab:adduniform} \end{table*} \begin{table*}[h] \centering \resizebox{0.7\textwidth}{!}{% \begin{tabular}{c|c"cc|cc|cc|cc|cc} \multicolumn{2}{c}{\textbf{Noise Level}} & \multicolumn{2}{c}{\textbf{0.1}} & \multicolumn{2}{c}{\textbf{0.2}} & \multicolumn{2}{c}{\textbf{0.3}} & \multicolumn{2}{c}{\textbf{0.4}} & \multicolumn{2}{c}{\textbf{0.5}} \\ \hline \textbf{Dataset} & \textbf{Method} & \textbf{miF1} & \textbf{maF1} & \textbf{miF1} & \textbf{maF1} & \textbf{miF1} & \textbf{maF1} & \textbf{miF1} & \textbf{maF1} & \textbf{miF1} & \textbf{maF1} \\ \thickhline \multirow{2}{*}{\textbf{delicious}} & \textbf{SOTA} & {\ul \textit{\textbf{0.3689}}} & 0.1871 & {\ul \textit{\textbf{0.3646}}} & 0.1867 & {\ul \textit{\textbf{0.3644}}} & 0.1784 & {\ul \textit{\textbf{0.3634}}} & 0.1755 & {\ul \textit{\textbf{0.3620}}} & 0.1652 \\ & \textbf{CbMLC} & 0.3668 & {\ul \textit{\textbf{0.1933}}} & 0.3544 & {\ul \textit{\textbf{0.1911}}} & 0.3543 & {\ul \textit{\textbf{0.1839}}} & 0.3482 & {\ul \textit{\textbf{0.1763}}} & 0.3306 & {\ul \textit{\textbf{0.1708}}} \\ \multirow{2}{*}{\textbf{rcv1}} & \textbf{SOTA} & 0.8711 & {\ul \textit{\textbf{0.7374}}} & 0.8707 & {\ul \textit{\textbf{0.7357}}} & 0.8648 & 0.7147 & 0.8630 & 0.7163 & 0.8647 & 0.7166 \\ & \textbf{CbMLC} & {\ul \textit{\textbf{0.8720}}} & 0.7430 & {\ul \textit{\textbf{0.8710}}} & 0.7350 & {\ul \textit{\textbf{0.8712}}} & {\ul \textit{\textbf{0.7355}}} & {\ul \textit{\textbf{0.8674}}} & {\ul \textit{\textbf{0.7393}}} & {\ul \textit{\textbf{0.8658}}} & {\ul \textit{\textbf{0.7290}}} \end{tabular}% } \caption{Performance comparison of CbMLC to the best SOTA model on the additional two datasets with type 2 noise. Higher scores are better. Highlighted numbers are the best of in each row.} \label{tab:adduniformpos} \end{table*} We add the performance comparison of CbMLC to the best SOTA model on \emph{delicious} and \emph{rcv1}. We present the results for type 1 noise in Table~\ref{tab:adduniform} and the results for type 2 noise in Table~\ref{tab:adduniformpos}. For type 1 noise, the best SOTA model outperforms CbMLC at the beginning on \emph{delicious}, and the performance gap shrinks as the noise becomes more severe. For \emph{rcv1}, our method generally improves over the best SOTA model. However, due to the large numbers of labels in these two datasets, the noise we injected is relatively small, and therefore CbMLC provides a limited improvement. For type 2 noise on \emph{delicious}, better maF1 scores from CbMLC indicate that we are better with handling imbalanced classes, and better miF1 scores from the best SOTA model suggests that it performs better for classes with frequent labels under this noisy setting. For type 2 noise on \emph{rcv1}, again, our improvement is larger for classes with less frequent labels. Further, we can also improve on miF1 scores when the noise becomes more severe.
\section{Introduction} In recent decades, there has been a growing interest in the investigation of algebraic invariants associated to combinatorial structures. Toric ideals of graphs (and the associated edge rings), a special case of the classical notion of a toric ideal, have been studied by various authors with regard to invariants such as depth, dimension, projective dimension, regularity, graded Betti numbers, Hilbert series, and multiplicity, usually for particular families of graphs (see for example \cite{KOH,BIERMANN2017,Ferrers,DALI20153862,FKVT20,Galet,GITLER2005107,GREIF20201,HH20,HHKO11,HK14,HMO16,HMT19,mori2020edge,RNRN,TATAKIS20111540}). We note in Remarks~\ref{graphtaurmk} and~\ref{distinct} that the family we consider does not overlap at all or for large $n$ with those considered in \cite{Ferrers}, \cite{FKVT20}, \cite{Galet}, and \cite{RNRN}; it is more obviously distinct from other families that have been studied. We think it fitting to mention that the recent book by Herzog, Hibi, and Ohsugi (\cite{herzog-hibi-ohsugi}) also investigates toric ideals of graphs as well as binomial ideals coming from other combinatorial structures. In this work, we consider a family of graphs with iterated subfamilies and develop algebraic properties of the toric rings associated to the family which depend only on the number of vertices (equivalently, the number of edges) in the associated graphs. In the development of this project, we were particularly inspired by the work of Jennifer Biermann, Augustine O'Keefe, and Adam Van Tuyl in \cite{BIERMANN2017}, where they establish a lower bound for the regularity of the toric ideal of any finite simple graph and an upper bound for the regularity of the toric ideal of a chordal bipartite graph. Our goal is to construct as ``simple" a family of graphs as possible that still yields interesting toric ideals. It is our hope that our process and results will lead to further generalizations of properties of toric ideals for other (perhaps broader) families of graphs, or for graphs containing or arising from such graphs. Herein, we introduce the infinite family $\mathcal{F}$ of chordal bipartite graphs $G_n^t$, where $n$ determines the number of edges and vertices and $t$ determines the structure of the graph, and establish some algebraic properties of the toric rings $R(n,t)$ associated to the graphs $G_n^t$. The use of bipartite graphs makes each $R(n,t)$ normal and Cohen-Macaulay by \cite{SVV94} and \cite{herzog-hibi-ohsugi}; we use the latter in Section~\ref{resultsprops}. Our main results prove to be independent of $t$ and depend only on $n$. In Section \ref{family}, we construct the family $\mathcal{F}$ of graphs $G_n^t$ from a family of ladder-like structures $L_n^t$ so that the toric ideals of the $G_n^t$ are generalized determinantal ideals of the $L_n^t$. The ladder-like structures associated to a subfamily $\mathcal{F}_1\subset\mathcal{F}$, introduced in Example \ref{mexmp2}, are in fact two-sided ladders (for large $n$), so that the family of rings $R(n,t)$ is a generalization of the family of ladder determinantal rings coming from $\mathcal{F}_1$. While the rings arising from $\mathcal{F}_1$ come from a distributive lattice and have easily derived properties (see for example \cite{herzog-hibi-ohsugi}), we show that the rings associated to $\mathcal{F}$ do not naturally arise from any lattice in general, and merit closer study. In Section \ref{resultsprops}, we establish some algebraic properties of the $R(n,t)$, particularly Krull dimension, projective dimension, multiplicity, and regularity. To do so, we prove that the determinantal generators of the defining ideal $I_{G_n^t}$ are a Gr\"obner basis (it follows immediately from \cite{herzog-hibi-ohsugi} that $R(n,t)$ is Koszul) and work with the initial ideal $\text{in}_> I_{G_n^t}$. We also develop a system of parameters $\overline{X_n}$ that allows us to work with Artinian reductions in part of our treatment, and their Hilbert series. Our first result establishes the Krull dimension of the toric ring $R(n,t)=S(n)/I_{G_n^t}$, where the ring $S(n)=k[x_0,x_2,x_3,\ldots,x_{2n+3},x_{2n+4}]$ is the polynomial ring over the edges of $G_n^t$ and $I_{G_n^t}$ is the toric ideal of $G_n^t$. \begin{thm}[Theorem \ref{dimension}] The dimension of $R(n,t)$ is \[ \dim R(n,t)= n+3. \] \end{thm} \noindent As a corollary, since $R(n,t)$ comes from a bipartite graph and is hence Cohen-Macaulay (Corollary~\ref{CM}), we obtain the projective dimension of $R(n,t)$. \begin{cor}[Corollary \ref{pdimension}] The projective dimension of $R(n,t)$ over $S(n)$ is \[ \textnormal{pd}_{S(n)} R(n,t)= n+1. \] \end{cor} We then develop a linear system of parameters for $R(n,t)$, using differences of elements on antidiagonals of the ladder-like structure $L_n^t$. \begin{prop}[Proposition \ref{sopedgering}] Let $R(n,t)=S(n)/I_{G_n^t}$. Then the image of \begin{equation*} X_n=x_{0},x_{2}-x_{3},x_{4}-x_{5},\ldots,x_{2n}-x_{2n+1},x_{2n+2}-x_{2n+3},x_{2n+4} \end{equation*} in $R(n,t)$ is a system of parameters for $R(n,t)$. \end{prop} \noindent Since $R(n,t)$ is Cohen-Macaulay, the linear system of parameters above is a regular sequence (Corollary \ref{xt}). With the aim of obtaining the multiplicity and regularity of $R(n,t)$, we form an Artinian quotient of $R(n,t)$ by the regular sequence above and call it $\widehat{R(n,t)}$. We note that $\widehat{R(n,t)}$ does not denote the completion, and explain the choice of notation in Definition~\ref{widehatnotation}. Using a convenient vector space basis for $\widehat{R(n,t)}$ established in Lemma~\ref{uniquerep}, we show the coefficients of the Hilbert series for $\widehat{R(n,t)}$. \begin{thm}[Theorem \ref{Hilbert Series mod reg seq}] If $R(n,t)=S(n)/I_{G_n^t}$ and $\widehat{R(n,t)}\cong R(n,t)/(\overline{X_n})$, we have \begin{equation*} {\displaystyle \dim_k(\widehat{R(n,t)})_{i}=\begin{cases} 1 & i=0\\ {\displaystyle \frac{1}{i!}\prod_{j=1}^{i}(n+j-2(i-1))} & i\geq 1. \end{cases}} \end{equation*} In particular, $\dim_k(\widehat{R(n,t)})_{i}=0$ when $i>n/2+1$. \end{thm} \noindent As a corollary, we obtain the regularity of $R(n,t)$, which is equal to the top nonzero degree of $\widehat{R(n,t)}$. \begin{cor}[Corollary \ref{regcor}] For $G_n^t\in\mathcal{F}$, \begin{equation*} \operatorname{reg} R(n,t)=\left\lfloor n/2 \right \rfloor+1. \end{equation*} \end{cor} \noindent We include an alternate graph-theoretic proof of the result above at the end of this work. Beginning with an upper bound from \cite{BIERMANN2017} (or equivalently for our purposes, one from \cite{HH20}) and then identifying the initial ideal $\text{in}_> I_{G_n^t}$ with the edge ideal of a graph, we use results from \cite{conca2018squarefree} (allowing us to use $\text{in}_> I_{G_n^t}$ instead of $I_{G_n^t}$) and then \cite{Tai-Ha-Van-Tuyl-2008} for a lower bound which agrees with our upper bound. From a recursion established in Lemma~\ref{recursion}, we go on to prove a Fibonacci relationship between the lengths of the Artinian rings $\widehat{R(n,t)}$ in Proposition~\ref{Fibonacci}, and obtain the multiplicity of $R(n,t)$ as a corollary. In the following, we drop $t$ for convenience. \begin{cor}[Corollary \ref{multcor}] For $n\geq 2$, there is an equality of multiplicities \[ e(R(n))=e(R(n-1))+e(R(n-2)).\] In particular, \[e(R(n))=F\left(n+3\right)=\frac{(1+\sqrt{5})^{n+3}-(1-\sqrt{5})^{n+3}}{2^{n+3}\sqrt{5}}. \] \end{cor} For more background, detail, and motivation, we refer the reader to \cite{LauraThesis}, but note that different notation and indexing conventions have been employed in this work. Throughout, $k$ is a field. \vspace{12pt} \noindent \textbf{Acknowledgements.} Macaulay2 \cite{M2} was used for computation and hypothesis formation. We would like to thank Syracuse University for its support and hospitality and Claudia Miller for her valuable input on the original project in \cite{LauraThesis} and this condensed version. We also acknowledge the partial support of an NSF grant. \section{The Family of Toric Rings} \label{family} In the following, we define a family of toric rings $R(n,t)$ coming from an iterative chordal bipartite family of graphs, $\mathcal{F}$. We show that although one subfamily of these rings comes from join-meet ideals of a (distributive) lattice and has some easily derived algebraic invariants, this is not true in general. The reader may find the definition of the toric ideal of a graph in Section~\ref{toricringsforF}, when it becomes relevant to the discussion. We recall for the reader that a \textit{chordal bipartite} graph is a bipartite graph in which every cycle of length greater than or equal to six has a chord. \subsection{The Family \texorpdfstring{$\mathcal{F}$}{F} of Graphs} Below, we define the family $\mathcal{F}$ of chordal bipartite graphs iteratively from a family of ladder-like structures $L_n^t$. We note that the quantities involved in the following definition follow patterns as follows: \begin{center} \begin{tabular}{ |c|c|c| } \hline $n$ & $\left \lfloor{n/2}\right \rfloor+2$ & $\left \lceil{n/2}\right \rceil+2$\\ \hline 0 & 2 & 2\\ 1 & 2 & 3\\ 2 & 3 & 3\\ 3 & 3 & 4\\ \vdots & \vdots & \vdots\\ \hline \end{tabular} \end{center} \begin{defn}\label{Ln} For each $n\geq 0$ and each $t\in \mathbb{F}_2^{n+1}$, we construct a ladder-like structure $L_n^t$ with $(\left \lfloor{n/2}\right \rfloor+2)$ rows and $(\left \lceil{n/2}\right \rceil+2)$ columns and with nonzero entries in the set $\{x_0,x_2,x_3,\ldots,x_{2n+4}\}$. To do so, we use the notation $\widehat{t}\in\mathbb{F}_2^{n}$ for the first $n$ entries of $t$, that is, all except the last entry. The construction is as follows, where throughout, indices of entries in $L_n^t$ are strictly increasing from left to right in each row and from top to bottom in each column. We note that $L_n^t$ does not depend on $t$ for $n<2$, but does for $n\geq 2$. \begin{itemize} \item For $n=0$, the ladder-like structure $L_0^0=L_0^1$ is \[ \begin{matrix} x_0 & x_2 \\ x_3 & x_4 \end{matrix} \] \item For $n=1$, to create $L_1^t$ (regardless of what $t$ is in $\mathbb{F}_2^2$), we add another column with the entries $x_5$ and $x_6$ to the right of $L_0^{\widehat{t}}$ to obtain \[ \begin{matrix} x_0 & x_2 & x_5\\ x_3 & x_4 & x_6 \end{matrix} \] \item For $2\leq n\equiv 0 \mod 2 (\equiv 1 \mod 2)$, to create $L_n^t$, we add another row (column) with the entries $x_{2n+3},x_{2n+4}$ below (to the right of) $L_{n-1}^{\widehat{t}}$ in the following way: \begin{itemize} \item [$\circ$] The entry $x_{2n+4}$ is in the ultimate row and column, row $\left \lfloor{n/2}\right \rfloor+2$ and column $\left \lceil{n/2}\right \rceil+2$. \item [$\circ$] The entry $x_{2n+3}$ is in the new row (column) in a position directly below (to the right of) another nonzero entry in $L_n^t$. \begin{itemize} \item If the last entry of $t$ is $0$, $x_{2n+3}$ is directly beneath (to the right of) the first nonzero entry in the previous row (column). \item If the last entry of $t$ is $1$, $x_{2n+3}$ is directly beneath (to the right of) the second nonzero entry in the previous row (column). \end{itemize} \end{itemize} \end{itemize} \noindent In this way, the entries in $t$ determine the choice at each stage for the placement of $x_{2n+3}$. \end{defn} \begin{rmk}\label{construction} We note a few things about this construction for $n\equiv 0 \mod 2$ ($\equiv 1 \mod 2$), which may be examined in the examples below: \begin{itemize} \item We note that $x_{2n+4}$ is directly beneath (to the right of) $x_{2n+2}$. \item We note that the only entries in row $\left \lfloor{n/2}\right \rfloor+1$ (column $\left \lceil{n/2}\right \rceil+1$) of $L_{n-1}^{\widehat{t}}$ are $x_{2n-1}$, $x_{2n}$, and $x_{2n+2}$, so that the choices listed for placement of $x_{2n+3}$ are the only cases. In particular, $t_{n+1}=0$ if and only if $x_{2n+3}$ is directly beneath (to the right of) $x_{2n-1}$, and $t_{n+1}=1$ if and only if $x_{2n+3}$ is directly beneath (to the right of) $x_{2n}$. \item Finally, we note that the only entries in column $\left \lceil{n/2}\right \rceil+2$ (row $\left \lfloor{n/2}\right \rfloor+2$) of $L_{n}^{t}$ are $x_{2n+1}$, $x_{2n+2}$, and $x_{2n+4}$, and that the only entries in row $\left \lfloor{n/2}\right \rfloor+2$ (column $\left \lceil{n/2}\right \rceil+2$) of $L_{n}^{t}$ are $x_{2n+3}$ and $x_{2n+4}$. \end{itemize} \end{rmk} \begin{exmp}\label{mexmp1} We have \[ L_2^{(1,1,1)}= \begin{matrix} x_0 & x_2 & x_5\\ x_3 & x_4 & x_6\\ & x_7 & x_8 \end{matrix} \hspace{2cm} L_2^{(0,0,0)}= \begin{matrix} x_0 & x_2 & x_5\\ x_3 & x_4 & x_6\\ x_7 & & x_8 \end{matrix} \] In either of the cases above, we could go on to construct $L_3^{\widehat{t}}$ and $L_4^t$ in the following way: For $n=3$, place $x_{10}$ to the right of $x_8$ and place $x_9$ to the right of either $x_5$ or $x_6$, depending whether the last entry of $\widehat{t}$ is $0$ or $1$, respectively. Then for $n=4$, place $x_{12}$ below $x_{10}$ and place $x_{11}$ below either $x_7$ or $x_8$, depending whether the last entry of $t$ is $0$ or $1$, respectively. \end{exmp} \begin{exmp}\label{mexmp2} In fact, when the entries of $t$ are all ones, we see that $L_n^{(1,1,\ldots,1)}$ has a ladder shape (is a two-sided ladder for $n\geq 3)$, shown below in the case when $2\leq n\equiv 0 \mod 2$: \[ \begin{matrix} x_0 & x_2 & x_5 &\\ x_3 & x_4 & x_6 & x_9 &\\ & x_7 & x_8 & x_{10} & x_{13} &\\ & & x_{11} & x_{12} & x_{14} & x_{17} &\\ & & & x_{15} & x_{16} & x_{18} & x_{21} &\\ & & & & x_{19} & x_{20} & x_{22} & x_{25} &\\ & & & & & x_{23} & x_{24} & x_{26} & \ddots &\\ & & & & & & x_{27} & x_{28} & \ddots & x_{2n+1}\\ & & & & & & & \ddots & \ddots & x_{2n+2}\\ & & & & & & & & x_{2n+3} & x_{2n+4}. \end{matrix} \] We denote the subfamily of graphs coming from $t=(1,1,\ldots,1)$ by $\mathcal{F}_1\subset \mathcal{F}$. When the entries of $t$ are all zeros, $L_n^{(0,0,\ldots,0)}$ has the following structure, shown below in the case when $2\leq n\equiv 0 \mod 2$: \[\begin{matrix} x_0 & x_2 & x_5 & x_9 & x_{13} & x_{17} & x_{21} & x_{25} & \cdots & x_{2n+1}\\ x_3 & x_4 & x_6\\ x_7 & & x_8 & x_{10}\\ x_{11} & & & x_{12} & x_{14}\\ x_{15} & & & & x_{16} & x_{18}\\ x_{19} & & & & & x_{20} & x_{22}\\ x_{23} & & & & & & x_{24} & x_{26}\\ x_{27} & & & & & & & x_{28} & \ddots\\ \vdots & & & & & & & & \ddots & x_{2n+2}\\ x_{2n+3} & & & & & & & & & x_{2n+4}. \end{matrix} \] For a more varied example, we have $L_{16}^{(1,0,1,0,1,1,0,0,1,1,1,0,0,0,1,0,0)}$ below: \[ \begin{matrix} x_0 & x_2 & x_5 & x_9 & & & & & & \\ x_3 & x_4 & x_6 & & & & & & & \\ & x_7 & x_8 & x_{10} & x_{13} & x_{17} & & & & \\ & &x_{11}& x_{12}& x_{14} & & & & & \\ & &x_{15}& & x_{16} & x_{18} & x_{21} & x_{25} & x_{29} & x_{33} \\ & & & & x_{19} & x_{20} & x_{22} & & & \\ & & & & & x_{23} & x_{24} & x_{26} & & \\ & & & & & x_{27} & & x_{28} & x_{30} & \\ & & & & & & & x_{31} & x_{32} & x_{34} \\ & & & & & & & x_{35} & & x_{36}. \end{matrix} \] \end{exmp} \begin{defn}\label{graphtaudef} If we associate a vertex to each row and each column and an edge to each nonzero entry of $L_n^t$, we have a finite simple connected bipartite graph $G_n^t$. The set $V_r$ of vertices corresponding to rows and the set $V_c$ of vertices corresponding to columns form a bipartition of the vertices of $G_n^t$. We say a graph $G$ is in $\mathcal{F}$ if $G=G_n^t$ for some $n\geq 0$ and some $t\in\mathbb{F}_2^{n+1}$. \end{defn} \begin{rmk}\label{graphtaurmk} We note that by construction $G_n^t$ has no vertices of degree one, since each row and each column of $L_n^t$ has more than one nonzero entry. This ensures that for large $n$ our family is distinct from that studied in \cite{Ferrers}, since a Ferrers graph with bipartitation $V_1$ and $V_2$ with no vertices of degree one must have at least two vertices in $V_1$ of degree $|V_2|$ and at least two vertices in $V_2$ of degree $|V_1|$, impossible for our graphs when $n\geq 3$, as the reader may verify. We also use the fact that $G_n^t$ has no vertices of degree one for an alternate proof of the regularity of $R(n,t)$ at the end of this work. \end{rmk} \begin{exmp} When $n=5$, $G_5^{(1,1,\ldots,1)}\in \mathcal{F}_1$ is \tikzset{main node/.style={circle,fill=blue!20,draw,minimum size=20pt,inner sep=0pt}, } \begin{center} \begin{tikzpicture} \node[main node] (1) {$r1$}; \node[main node] (5) [below left = 1.4cm and 1.4cm of 1] {$c1$}; \node[main node] (6) [below right = 1.4cm and 1.4cm of 1] {$c2$}; \node[main node] (2) [below right = 1.4cm and 1.4cm of 5] {$r2$}; \node[main node] (7) [left = 1.4cm of 5] {$c3$}; \node[main node] (3) [above = 1.4cm of 1] {$r3$}; \node[main node] (8) [right = 1.4cm of 6] {$c4$}; \node[main node] (4) [below = 1.4cm of 2] {$r4$}; \node[main node] (9) [left = 1.4cm of 7] {$c5$}; \path[draw,thick] (1) edge node [below] {$x_0$} (5) (1) edge node [below] {$x_2$} (6) (1) edge node [above] {$x_5$} (7) (2) edge node [above] {$x_3$} (5) (2) edge node [above] {$x_4$} (6) (2) edge node [below] {$x_6$} (7) (2) edge node [left] {$x_9$} (8) (3) edge node [right] {$x_7$} (6) (3) edge node [left] {$x_8$} (7) (3) edge node [right] {$x_{10}$} (8) (3) edge node [left] {$x_{13}$} (9) (4) edge node [right] {$x_{11}$} (7) (4) edge node [right] {$x_{12}$} (8) (4) edge node [left] {$x_{14}$} (9) ; \end{tikzpicture} \end{center} \end{exmp} We develop properties of the $L_n^t$ which allow us to show in Section~\ref{edgeringsforF} that certain minors of the $L_n^t$ are generators for the toric rings of the corresponding graphs $G_n^t$. \begin{defn} For this work, a \textit{distinguished minor} of $L_n^t$ is a $2$-minor involving only (nonzero) entries of the ladder-like structure $L_n^t$, coming from a $2\times 2$ subarray of $L_n^t$. \end{defn} \begin{prop}\label{det} For each $i\geq 1$ and each $f\in\mathbb{F}_2^{i+1}$, the entry $x_{2i+3}$ and the entry $x_{2i+4}$ each appear in exactly two distinguished minors of $L_i^f$. For $i\equiv 0 \mod 2 (\equiv 1 \mod 2)$, these minors are of the form \[ s_{2i}:=x_{2i+1}x_{2i+3}-x_{j_{2i}}x_{2i+4} \] coming from the subarray \[ \begin{bmatrix} x_{j_{2i}} & x_{2i+1} \\ x_{2i+3} & x_{2i+4} \end{bmatrix} \hspace{2cm} \left( \begin{bmatrix} x_{j_{2i}} & x_{2i+3} \\ x_{2i+1} & x_{2i+4} \end{bmatrix}\right) \] for some $j_{2i}\in\{0,2,3,\ldots,2i-2\}$ and \[ s_{2i+1}:=x_{2i+2}x_{2i+3}-x_{j_{2i+1}}x_{2i+4} \] coming from the subarray \[ \begin{bmatrix} x_{j_{2i+1}} & x_{2i+2} \\ x_{2i+3} & x_{2i+4} \end{bmatrix} \hspace{2cm} \left( \begin{bmatrix} x_{j_{2i+1}} & x_{2i+3} \\ x_{2i+2} & x_{2i+4} \end{bmatrix} \right) \] for some $j_{2i+1} \in\{2i-1,2i\}$, and the only distinguished minor of $L_n^t$ with indices all less than $5$ is $s_1:=x_2x_3-x_0x_4$. \end{prop} \begin{proof} The last statement is clear by Definition~\ref{Ln}; we prove the remaining statements by induction on $i$. For $i=1$, we have the distinguished minors $s_2=x_3x_5-x_0x_6$ and $s_3=x_4x_5-x_2x_6$ coming from the subarrays \[ \begin{bmatrix} x_0 & x_5 \\ x_3 & x_6 \end{bmatrix} \] and \[ \begin{bmatrix} x_2 & x_5 \\ x_4 & x_6 \end{bmatrix} \] where $j_2=0\in\{0\}$ and $j_3=2\in\{1,2\}$, so we have our base case. Now suppose the statement is true for $i$ with $1\leq i<n$, and let $n\equiv 0\mod 2 (\equiv 1 \mod 2)$ and $t\in\mathbb{F}_2^{n+1}$. Case 1: If $t_{n+1}=0$, then by Remark~\ref{construction}, $x_{2n+3}$ is in the same column (row) as $x_{2n-1}$. By induction, we have the distinguished minor $s_{2n-2}=x_{2n-1}x_{2n+1}-x_{j_{2n-2}}x_{2n+2}$ coming from the subarray \[ \begin{bmatrix} x_{j_{2n-2}} & x_{2n+1} \\ x_{2n-1} & x_{2n+2} \end{bmatrix} \hspace{2cm} \left( \begin{bmatrix} x_{j_{2n-2}} & x_{2n-1} \\ x_{2n+1} & x_{2n+2} \end{bmatrix} \right). \] Then in fact we have a subarray of the form \[ \begin{bmatrix} x_{j_{2n-2}} & x_{2n+1} \\ x_{2n-1} & x_{2n+2}\\ x_{2n+3} & x_{2n+4} \end{bmatrix} \hspace{2cm} \left( \begin{bmatrix} x_{j_{2n-2}} & x_{2n-1} & x_{2n+3}\\ x_{2n+1} & x_{2n+2} & x_{2n+4} \end{bmatrix} \right), \] so that we have the distinguished minors \begin{eqnarray*} s_{2n}&=&x_{2n+1}x_{2n+3}-x_{j_{2n-2}}x_{2n+4}\\ s_{2n+1}&=&x_{2n+2}x_{2n+3}-x_{2n-1}x_{2n+4} \end{eqnarray*} with \[ j_{2n}=j_{2n-2}\in\{0,2,3,\ldots,2n-4\}\subset\{0,2,3,\ldots,2n-2\} \] by induction and with \[ j_{2n+1}=2n-1\in\{2n-1,2n\}. \] Since the only entries in row $\left \lfloor{n/2}\right \rfloor+2$ (column $\left \lceil{n/2}\right \rceil+2$) of $L_n^t$ are $x_{2n+3}$ and $x_{2n+4}$ and since the only entries in column $\left \lceil{n/2}\right \rceil+2$ (row $\left \lfloor{n/2}\right \rfloor+2$) of $L_n^t$ are $x_{2n+1}$, $x_{2n+2}$, and $x_{2n+4}$ by Remark~\ref{construction}, these are the only distinguished minors of $L_n^t$ containing either $x_{2n+3}$ or $x_{2n+4}$, as desired. Case 2 for $t_{n+1}=1$ is analogous and yields \[ j_{2n}=j_{2n-1}\in\{2n-3,2n-2\}\subset\{0,2,3,\ldots,2n-2\} \] and \[ j_{2n+1}=2n\in\{2n-1,2n\}. \] \end{proof} \begin{defn} Define the integers $j_{2i}$, $j_{2i+1}$ for $j_2,\ldots,j_{2n+1}$ as in the statement of Proposition~\ref{det}. We note in the remark below some properties of the $j_k$. \end{defn} \begin{rmk}\label{jk} From the proof of Proposition~\ref{det}, we note that $j_2=0$, $j_3=2$, and that for $i\geq 2$, we have the following: \begin{eqnarray*} t_{i+1}&=&0\iff j_{2i}=j_{2i-2}\iff j_{2i+1}=2i-1\\ t_{i+1}&=&1\iff j_{2i}=j_{2i-1}\iff j_{2i+1}=2i. \end{eqnarray*} For the sake of later proofs, we extend the notion of $j_k$ naturally to $s_1=x_2x_3-x_0x_4$ and say that $j_1=0$, and note the following properties of the $j_k$ for $1 \leq k \leq 2n+1$: \begin{itemize} \item We have $j_{2i}\in\{j_{2i-2},j_{2i-1}\}$ and $j_{2i}\leq 2i-2$. Indeed, for $i=1$, $j_2=j_1=0$, and for $i\geq 2$, this is clear from the statement above. \item We have $j_{2i+1}\in\{2i-1,2i\}$. Indeed, for $i=0$, $j_1=0\in\{-1,0\}$, for $i=1$, $j_3=2\in\{1,2\}$, and for $i\geq 2$, this follows from the statement above. \item The $j_{2i}$ form a non-decreasing sequence. Indeed, for $i\geq 2$, either $j_{2i}=j_{2i-2}$ or $j_{2i}=j_{2i-1}\geq 2i-3>2i-4\geq j_{2i-2}$. \end{itemize} \end{rmk} \begin{rmk}\label{subarray} We also note from the proof above that the following is a subarray of $L_n^t$ for all $i\equiv 0 \mod 2 (\equiv 1 \mod 2)$ such that $1\leq i\leq n$, which we use in the proof of the proposition below: \[ \begin{bmatrix} x_{j_{2i}} & x_{2i+1} \\ x_{j_{2i+1}} & x_{2i+2}\\ x_{2i+3} & x_{2i+4} \end{bmatrix} \hspace{2cm} \left( \begin{bmatrix} x_{j_{2i}} & x_{j_{2i+1}} & x_{2i+3} \\ x_{2i+1} & x_{2i+2} & x_{2i+4} \end{bmatrix} \right) \] \end{rmk} \begin{prop}\label{chordal} For $n\geq 0$, each graph $G_n^t\in \mathcal{F}$ is chordal bipartite with vertex bipartition $V_r\cup V_c$ of cardinalities \begin{eqnarray*} |V_r|=\left \lfloor \frac{n}{2} \right \rfloor +2\\ |V_c|=\left \lceil \frac{n}{2} \right \rceil +2. \end{eqnarray*} \end{prop} \begin{proof} We already know by Definition~\ref{graphtaudef} that every graph $G_n^t$ is bipartite for $n\geq 0$, with the bipartition above coming from the rows and columns of $L_n^t$. The cardinalities of the vertex sets follow from Definition~\ref{construction}. We prove the chordal bipartite property by induction on $n$. It is clear for $i=0$ and $i=1$ that $G_i^f$ is chordal bipartite for $f\in \mathbb{F}_2^{i+1}$, since these graphs have fewer than six vertices. Now suppose $G_{i}^f$ is chordal bipartite for $i$ with $1\leq i<n\equiv 0 \mod 2 (\equiv 1 \mod 2)$, and consider $G_n^t$ for $t\in \mathbb{F}_2^{n+1}$. We know that the following array (or its transpose) is a subarray of $L_n^t$ by Remark~\ref{subarray}, and we include for reference the corresponding subgraph of $G_n^t$ with vertices labeled by row and column. \[ \begin{bmatrix} x_{j_{2n}} & x_{2n+1} \\ x_{j_{2n+1}} & x_{2n+2}\\ x_{2n+3} & x_{2n+4} \end{bmatrix} \] \begin{center} \tikzset{main node/.style={circle,fill=blue!20,draw,minimum size=20pt,inner sep=0pt}, } \begin{tikzpicture} \node[main node] (4) {$c1$}; \node[main node] (1) [below left = 1.5cm and 1.5cm of 4] {$r1$}; \node[main node] (2) [below right = 1.5cm and 1.5cm of 4] {$r2$}; \node[main node] (5) [below right = 1.5cm and 1.5cm of 1] {$c2$}; \node[main node] (3) [right = 1.5cm of 2] {$r3$}; \path[draw,thick] (1) edge node [left] {$x_{j_{2n}}$} (4) (1) edge node [left] {$x_{2n+1}$} (5) (2) edge node [left] {$x_{j_{2n+1}}$}(4) (2) edge node [left] {$x_{2n+2}$} (5) (3) edge node [right] {$x_{2n+3}$} (4) (3) edge node [right] {$x_{2n+4}$} (5) ; \end{tikzpicture} \end{center} We know the only difference between $G_n^t$ and $G_{n-1}^{\widehat{t}}$ is one vertex $r_3$ corresponding to row $\left \lfloor{n/2}\right \rfloor+2$ (column $\left \lceil{n/2}\right \rceil+2$) and two edges $x_{2n+3}=\{r_3,c_1\}$ and $x_{2n+4}=\{r_3,c_2\}$, where $c_1$ corresponds to the column (row) containing $x_{2n+3}$ and $c_2$ corresponds to column $\left \lceil{n/2}\right \rceil+2$ (row $\left \lfloor{n/2}\right \rfloor+2$). By Remark~\ref{construction}, $\deg r_3=2$, since the only entries in row $\left \lfloor{n/2}\right \rfloor+2$ (column $\left \lceil{n/2}\right \rceil+2$) are $x_{2n+3}$ and $x_{2n+4}$. Then any even cycle containing $r_3$ must also contain $x_{2n+3}$ and $x_{2n+4}$. Similarly, by the same remark, the only other edges with endpoint $c_2$ are $x_{2n+1}$ and $x_{2n+2}$, the entries added to make $L_{n-1}^{\widehat{t}}$, so we know that any even cycle containing $x_{2n+4}$ and $x_{2n+3}$ must contain either $x_{2n+1}$ or $x_{2n+2}$. We see that any even cycle containing $r_3$ and $x_{2n+1}$ is either a 4-cycle or has $x_{j_{2n}}$ as a chord, and any even cycle containing $r_3$ and $x_{2n+2}$ is either a 4-cycle or has $x_{j_{2n+1}}$ as a chord. Thus every graph $G_n^t$ is chordal bipartite for $n\geq 0$, with the bipartition above. \end{proof} \begin{rmk}\label{distinct} We note that the previous proposition ensures that our graphs are distinct from those studied in \cite{FKVT20}, \cite{Galet}, and \cite{RNRN}, which are not chordal bipartite except for the first family in \cite{FKVT20}, in which every four-cycle shares exactly one edge with every other four-cycle (also distinct from our family except for the trivial case with only one four-cycle, corresponding to $G_0^t$). \end{rmk} \subsection{Toric Rings for \texorpdfstring{$\mathcal{F}$}{F}}\label{edgeringsforF} \label{toricringsforF} In this section, we develop the toric ring $R(n,t)$ for each of the chordal bipartite graphs $G_n^t$ in the family $\mathcal{F}$. We first show that the toric ideal $I_{G_n^t}$ of the graph $G_n^t$ is the same as the ideal $I(n,t)$ generated by the distinguished minors of $L_n^t$. We then demonstrate that for some $n$ and $t$, these ideals do not arise from the join-meet ideals of lattices in a natural way, so that results in lattice theory do not apply to the general family $\mathcal{F}$ in an obvious way. We first define the toric ideal of a graph. For any graph $G$ with vertex set $V$ and edge set $E$, there is a natural map $\pi:k[E]\to k[V]$ taking an edge to the product of its endpoints. The polynomial subring in $k[V]$ generated by the images of the edges under the map $\pi$ is denoted $k[G]$ and is called the \textit{edge ring of $G$}. The kernel of $\pi$ is denoted $I_G$ and is called the \textit{toric ideal of $G$}; the ring $k[G]$ is isomorphic to $k[E]/I_G$. In this work, we consider the toric ring $k[E]/I_G$ and the toric ideal $I_G$ for our particular graphs. It is known in general that $I_G$ is generated by binomial expressions coming from even closed walks in $G$ \cite[Prop 3.1]{V95} and that the toric ideal of a chordal bipartite graph is generated by quadratic binomials coming from the $4$-cycles of $G$ (see \cite[Th 1.2]{HO99}). Let $S(n)=k[x_{0},x_{2},x_{3},\ldots,x_{2n+4}]$ be the polynomial ring in the edges of $G_n^t$. The edge ring for $G_n^t\in\mathcal{F}$ is denoted by $k[G_n^t]$ and is isomorphic to the toric ring \begin{equation*} R(n,t):=\frac{S(n)}{I_{G_n^t}}, \end{equation*} where $I_{G_n^t}$ is the toric ideal of $G_n^t$ \cite[5.3]{herzog-hibi-ohsugi}. For the general construction of a toric ideal, we refer the reader to \cite[Ch 4]{Peeva2011}. Our goal is to show that the toric ideal $I_{G_n^t}$ of $G_n^t$ is equal to \begin{equation*} I(n,t)=(\{\text{distinguished minors of $L_n^t$}\}). \end{equation*} \begin{prop}\label{edgerings} Let $S(n)=k[x_{0},x_{2},x_{3},\ldots,x_{2n+4}]$. For $G_n^t\in\mathcal{F}$, we have \begin{equation*} R(n,t)=\frac{S(n)}{I(n,t)}, \end{equation*} where \begin{equation*} I(n,t)=(\{\text{distinguished minors of $L_n^t$}\}). \end{equation*} \end{prop} \begin{proof} To prove this, we need only show that $I(n,t)$ is the toric ideal $I_{G_n^t}$ of the graph $G_n^t$. By Definition~\ref{graphtaudef}, it is clear that the distinguished minors of $L_n^t$ are in $I_{G_n^t}$, corresponding to the $4$-cycles of $G_n^t$. Since $G$ is chordal bipartite by Proposition~\ref{chordal}, these are the only generators of $I_{G_n^t}$ \cite[Cor 5.15]{herzog-hibi-ohsugi}. \end{proof} \begin{cor}\label{CM} The rings $R(n,t)$ are normal Cohen-Macaulay rings. \end{cor} \begin{proof} By Definition~\ref{graphtaudef} and Proposition~\ref{edgerings}, the ring $R(n,t)$ is the toric ring of a finite simple connected bipartite graph, and hence by Corollary 5.26 in \cite{herzog-hibi-ohsugi}, $R(n,t)$ is Cohen-Macaulay for each $n$ and $t$. The fact that each $R(n,t)$ is normal follows from \cite[Th 5.9, 7.1]{SVV94}. \end{proof} Because we know the distinguished minors of $L_n^t$, we are now able to characterize the generators for the toric ideal $R(n,t)$ of $G_n^t$. \begin{rmk}\label{ti} By Proposition~\ref{det}, the generators $s_1,\ldots,s_{2n+1}$ for $I_{G_n^t}$ may be summarized as follows. For integers $i$ such that $1\leq i \leq n$, set \begin{eqnarray*} s_{1}&=&x_{2}x_{3}-x_{j_{1}}x_{4}\\ s_{2i}&=&x_{2i+1}x_{2i+3}-x_{j_{2i}}x_{2i+4}\\ s_{2i+1}&=&x_{2i+2}x_{2i+3}-x_{j_{2i+1}}x_{2i+4}, \end{eqnarray*} where the nonnegative integers $j_{k}$ are as in Remark~\ref{jk}, that is, $j_1=j_2=0$, $j_3=2$, and for $i\geq 2$, we have \begin{eqnarray*} t_{i+1}&=&0\iff j_{2i}=j_{2i-2}\iff j_{2i+1}=2i-1\\ t_{i+1}&=&1\iff j_{2i}=j_{2i-1}\iff j_{2i+1}=2i. \end{eqnarray*} We note that the number of generators depends on $n$ and that the $j_k$ depend on $t$, but we may ignore dependence on $t$ when working with general $j_k$. We sometimes call $s_1,\ldots,s_{2n+1}$ the \textit{standard generators} of $I_{G_n^t}$, and show in Section~\ref{distinction} that for certain $n$ and $t$, they are not equal to the usual generators for the join-meet ideal of any lattice $D$. \end{rmk} \begin{exmp} We consider the toric ideal of a graph in $\mathcal{F}_1$. For $n=5$ and $t=(1,1,\ldots,1)$, by Remark~\ref{jk} we have $j_1=j_2=0$, $j_3=2$, $j_{2i}=j_{2i-1}$ and $j_{2i+1}=2i$ for $i\geq 2$, so that \[ R(5,(1,1,\ldots,1))=\frac{k[x_0,x_2,\ldots,x_{14}]}{I_{G_5^{(1,1,\ldots,1)}}}, \] where $I_{G_5^{(1,1,\ldots,1)}}$ is generated by the distinguished minors of $L_5^{(1,1,\ldots,1)}$: \begin{align*} s_1 &= x_2x_3-x_0x_4 & s_2 &= x_3x_5-x_0x_6\\ s_3 &= x_4x_5-x_2x_6 & s_4 &= x_5x_7-x_2x_8\\ s_5 &= x_6x_7-x_4x_8 & s_6 &= x_7x_9-x_4x_{10}\\ s_7 &= x_8x_9-x_6x_{10} & s_8 &= x_9x_{11}-x_6x_{12}\\ s_9 &= x_{10}x_{11}-x_8x_{12} & s_{10} &=x_{11}x_{13}-x_8x_{14}\\ s_{11} &= x_{12}x_{13}-x_{10}x_{14}. \end{align*} \end{exmp} \subsection{Distinction From Join-Meet Ideals of Lattices}\label{distinction} We saw in Example~\ref{mexmp2} and Proposition~\ref{edgerings} that if $G_n^t\in\mathcal{F}_1\subset\mathcal{F}$, then $I_{G_n^t}$ is a ladder determinantal ideal for $n\geq 2$. It is known that a ladder determinantal ideal is equal to the join-meet ideal of a (distributive) lattice (indeed, with a natural partial ordering which decreases along rows and columns of $L_n^t$ we obtain such a lattice). Some algebraic information such as regularity and projective dimension may be easily derived for some join-meet ideals of distributive lattices (see, for example, Chapter 6 of \cite{herzog-hibi-ohsugi}). We spend some time in this section establishing that not all rings $R(n,t)\in \mathcal{F}$ arise from a lattice in a natural way (see Remark~\ref{natural}), and so there does not seem to be any obvious way to obtain our results in Section~\ref{resultsprops} from the literature on join-meet ideals of distributive lattices or on ladder determinantal ideals. The results in Section~\ref{resultsprops} may be viewed as an extension of what may already be derived for the family $\mathcal{F}_1$ from the existing literature. The following five lemmas serve to provide machinery to show that there is at least one ring in the family $\mathcal{F}$, namely $R(5,(1,1,1,1,1,0))$, whose toric ideal does not come from a lattice on the set $\{x_0,x_2,\ldots,x_{14}\}$ in any obvious way. That is, we show that the standard generators of $I_{G_{5}^t}$, the $s_k$ from Remark~\ref{ti}, are not equal to the standard generators (see Definition~\ref{standard}) for any lattice $D$ on $\{x_0,x_2,\ldots,x_{14}\}$. Before we begin, we introduce some definitions and notation that we use extensively throughout. \begin{defn}\label{standard} The join-meet ideal of a lattice is defined from the join (least upper bound) $x\vee y$ and meet (greatest lower bound) $x\wedge y$ of each pair of incomparable elements $x,y\in L$. In this work, a \textit{standard generator} of the join-meet ideal of a lattice $D$ is a nonzero element of one of the following four forms: \begin{eqnarray*} x_ax_b-(x_a\vee x_b)(x_a\wedge x_b) &=& x_ax_b-(x_a\wedge x_b)(x_a\vee x_b)\\ (x_a\vee x_b)(x_a\wedge x_b)-x_ax_b &=& (x_a\wedge x_b)(x_a\vee x_b)-x_ax_b \end{eqnarray*} for $x_a,x_b\in L$. We sometimes refer to such an element as a \textit{standard generator of $D$} (the join-meet ideal is defined by analogous generators in the literature, though sometimes $a,b\in L$ instead of $x_a$ and $x_b$). We note that for a standard generator, the pair $\{x_a,x_b\}$ is an incomparable pair, and the pair $\{(x_a\vee x_b),(x_a\wedge x_b)\}$ is a comparable pair. \end{defn} Though we are in a commutative ring, we provide all possible orderings for factors within the terms of a standard generator to emphasize that either factor of the monomial \[ (x_a\vee x_b)(x_a\wedge x_b)=(x_a\wedge x_b)(x_a\vee x_b) \] may be the join or the meet of $x_a$ and $x_b$. \begin{rmk}\label{natural} We give an explanation for why it makes sense to focus only on the standard generators of a join-meet ideal. We recall that the standard generators $s_k$ for $I_{G_n^t}$ from Remark~\ref{ti} come from distinct $2\times 2$ arrays within the ladder-like structure $L_n^t$ and recognize that either monomial of $s_k$ determines its $2 \times 2$ array. Then an element of the form $ab-cd$ in $I_{G_{5}^t}$ with $a,b,c,d\in \{x_0,x_2,x_3,\ldots,x_{14}\}$ must be equal to $\pm s_i$ for some $i$, since a nontrivial sum of $s_k$ with coefficients in $\{-1,1\}$ either has more than two terms or is equal to $s_i$ for some $i$, and other coefficients would be extraneous. Then any generating set for $I_{G_{5}^t}$ where each element has the form $ab-cd$ in $I_{G_{5}^t}$ with $a,b,c,d\in \{x_0,x_2,x_3,\ldots,x_{14}\}$ must consist of all the $s_k$ (up to sign). We conclude that it is natural to check whether the $s_k$ are standard generators of a lattice $D$, instead of non-standard generators. \end{rmk} \begin{defn}\label{F} Given a standard generator $s=uz-wv$ of a lattice $D$, where $u,v,w,z\in D$, let $F_s\in \mathbb{F}_2$ be defined as follows: \begin{itemize} \item If $F_s=0$, the elements in the first (positive) monomial of $s$ are not comparable in $D$ (so the elements in the second (negative) monomial of $s$ are comparable in $D$). \item If $F_s=1$, the elements in the negative monomial of $s$ are not comparable in $D$ (so the elements in the positive monomial of $s$ are comparable in $D$). \end{itemize} For a given list $s_1,s_2,\ldots,s_m$ of standard generators of a lattice $D$, we use \begin{equation*} F=(F_1,\ldots,F_{m})\in\mathbb{F}_2^{m}, \end{equation*} where $F_j=F_{s_j}$, to encode the comparability of the variables in these generators. \end{defn} \noindent We note that exactly one of $F_j=0$ or $F_j=1$ happens for each $j$; we are merely encoding which monomial in $s_j$ corresponds to $x_ax_b$, and which to $(x_a\vee x_b)(x_a\wedge x_b)=(x_a\wedge x_b)(x_a\vee x_b)$. \begin{notation} We use the notation $u>\{w,v\}$ if $u>w$ and $u>v$ in a lattice $D$, and $\{w,v\}>z$ if $w>z$ and $v>z$ in $D$. \end{notation} In the first lemma, we begin by showing what restrictions we must have on a lattice whose join-meet ideal contains the 2-minors of the following array as standard generators: \vspace{12pt} \begin{center} $\begin{matrix} a & b & e\\ c & d & f \end{matrix}$ \end{center} \vspace{12pt} \begin{lemma}\label{3rel} Suppose \begin{eqnarray*} s_1&=&bc-ad\\ s_2&=&ce-af\\ s_3&=&de-bf \end{eqnarray*} are standard generators of a lattice $D$. Let $F\in\mathbb{F}_2^3$ be defined for these three elements as in Definition~\ref{F}. Then up to relabeling of variables, \begin{equation*} F\in\{\{0,0,0\},\{0,0,1\},\{0,1,1\}\}. \end{equation*} \end{lemma} \begin{proof} We first note that some of the cases we consider are equivalent. If we relabel variables according to the permutation $(ac)(bd)(ef)$, we see that \begin{equation*} F=\{i,j,k\}\equiv\{1-i,1-j,1-k\}. \end{equation*} This limits the cases we need to consider to \begin{equation*} F\in\{\{0,0,0\},\{0,0,1\},\{0,1,0\},\{0,1,1\}\}. \end{equation*} That is, we only need to show that the case $F=\{0,1,0\}$ is impossible. Let $F_1=0$. Then without loss of generality, up to reversing the order in the lattice (which does not affect the join-meet ideal), we have $a>\{b,c\}>d$. If $F_2=1$, we have $e>\{a,f\}>c$, so $e>\{b,f\}>d$ and hence $F_3=1$. We conclude that the case $F=\{0,1,0\}$ is impossible. \end{proof} In the second lemma, we show what restrictions we must have on a lattice whose join-meet ideal contains the 2-minors of the ladder \vspace{12pt} \begin{center} $\begin{matrix} a & b & e\\ c & d & f\\ & g & h\\ \end{matrix}$ \end{center} \noindent as standard generators, and which meets certain comparability conditions. \vspace{12pt} \begin{lemma}\label{5rel} Suppose \begin{eqnarray*} s_1&=&bc-ad\\ s_2&=&ce-af\\ s_3&=&de-bf\\ s_4&=&eg-bh\\ s_5&=&fg-dh \end{eqnarray*} are standard generators of a lattice $D$, and that $\{a,g\}$,$\{a,h\}$,$\{c,g\}$, and $\{c,h\}$ are comparable pairs in $D$. Let $F\in \mathbb{F}_2^{5}$ be defined for these five elements as in~\ref{F}. Then up to relabeling of variables, $F=\{0,0,0,0,0\}$. \end{lemma} \begin{proof} We first note that with natural relabeling, both $\{s_1,s_2,s_3\}$ and $\{s_3,s_4,s_5\}$ satisfy the hypotheses of Lemma~\ref{3rel}, so if we let $F$ be defined as in Definition~\ref{F}, this limits the cases we need to consider to 5-tuples whose first three elements and whose last three elements satisfy the conclusion of Lemma~\ref{3rel}. We note that some of the cases we consider are equivalent. If we relabel variables according to the permutation $(ac)(bd)(ef)$, we see that $F=\{i,j,k,l,m\}\equiv\{1-i,1-j,1-k,m,l\}$, and if we relabel the variables according to the permutation $(be)(df)(gh)$, we have $F=\{i,j,k,l,m\}\equiv\{j,i,1-k,1-l,1-m\}$. The permutation $(ah)(cg)(bf)$ yields $F=\{i,j,k,l,m\}\equiv\{m,l,k,j,i\}$. Then by Lemma~\ref{3rel} we have the eighteen cases \pagebreak \begin{equation*} \{0,0,0,0,0\}\equiv \{1,1,1,0,0\}\equiv \{1,1,0,1,1\}\equiv \{0,0,1,1,1\} \end{equation*} \begin{eqnarray*} \{0,0,0,0,1\}\equiv \{1,1,1,1,0\}\equiv \{1,1,0,0,1\}\equiv \{0,0,1,1,0\}&\equiv& \{0,1,1,0,0\}\\ &\equiv& \{1,0,0,0,0\}\\ &\equiv& \{0,1,1,1,1\}\\ &\equiv& \{1,0,0,1,1\} \end{eqnarray*} \begin{equation*} \{0,0,0,1,1\}\equiv \{1,1,1,1,1\}\equiv \{1,1,0,0,0\}\equiv \{0,0,1,0,0\} \end{equation*} \begin{equation*} \{0,1,1,1,0\}\equiv \{1,0,0,0,1\} \end{equation*} \vspace{12pt} \noindent Case 1: $F=\{0,0,0,0,1\}$. Since $F_1=0$, without loss of generality (reversing the order on the entire lattice if needed) we have $a>\{b,c\}>d$. Then $F_2=F_3=F_4=0$ and $F_5=1$, with the ordering chosen, yield \begin{align*} &a>\{c,e\}>f\\ &b>\{d,e\}>f\\ &b>\{e,g\}>h\\ &g>\{d,h\}>f. \end{align*} If $c>g$, then $a>\{b,c\}>g>d$, but then $bc-ad$ is not a standard generator of $D$, and this is a contradiction. If $c<g$, then $c<g<b$ so that both $\{b,c\}$ and $\{a,d\}$ from $s_1$ are comparable pairs, but this is a contradiction. We conclude that the case $\{0,0,0,0,1\}$ is impossible. \vspace{12pt} Because of the comparability of the pair $\{c,g\}$, the case $F=\{0,1,1,1,0\}$ forces comparability of $\{f,g\}$ or $\{b,c\}$ and hence yields a contradiction, as the reader may verify. In the case $F=\{0,0,0,1,1\}$, the comparability of $\{c,g\}$ forces either the comparability of $\{b,c\}$ (a contradiction), or $d<\{b,c\}<a<g$, up to reversing the order in the lattice, since $s_1$ is a standard generator. Since $\{a,h\}$ is a comparable pair, it immediately follows that either $\{b,h\}$ is comparable (a contradiction) or $e<\{b,h\}<a<g$, which is a contradiction since $s_4$ is a standard generator, as the reader may verify. These cases are compatible with the given relabelings and thus conclude our proof. \end{proof} In the third lemma, we show what restrictions we must have on a lattice whose join-meet ideal contains the 2-minors of the ladder \vspace{12pt} \begin{center} $\begin{matrix} a & b & e & \\ c & d & f & i\\ & g & h & j \end{matrix}$ \end{center} \noindent as standard generators and which meets certain comparability conditions. \vspace{12pt} \begin{lemma}\label{7rel} Suppose \begin{eqnarray*} s_1&=&bc-ad\\ s_2&=&ce-af\\ s_3&=&de-bf\\ s_4&=&eg-bh\\ s_5&=&fg-dh\\ s_6&=&gi-dj\\ s_7&=&hi-fj \end{eqnarray*} are standard generators of a lattice $D$, and that $\{a,g\}$, $\{a,h\}$, $\{c,g\}$, $\{c,h\}$, $\{b,i\}$, $\{b,j\}$, $\{e,i\}$, and $\{e,j\}$ are comparable pairs in $D$. Let $F\in \mathbb{F}_2^{7}$ be defined for these seven elements as in Definition~\ref{F}. Then up to relabeling of variables, $F=\{0,0,0,0,0,0,0\}$. \end{lemma} \begin{proof} We first note that with natural relabeling, both $\{s_1,s_2,s_3,s_4,s_5\}$ and $\{s_3,s_4,s_5,s_6,s_7\}$ satisfy the hypotheses of Lemma~\ref{5rel}, so if we let $F$ be defined as in Definition~\ref{F}, this limits the cases we need to consider to 7-tuples whose first five elements and whose last five elements satisfy the conclusion of Lemma~\ref{5rel}. The only possible cases are $\{0,0,0,0,0,0,0\}$ and $\{0,0,1,1,1,0,0\}$. If we relabel variables according to the permutation $(be)(df)(gh)$, we see that $F=\{i,j,k,l,m,n,o\}\equiv\{j,i,1-k,1-l,1-m,o,n\}$, so that these two cases are equivalent. Then up to relabeling of variables, $F=\{0,0,0,0,0,0,0\}$. \end{proof} In the fourth lemma, we show what restrictions we must have on a lattice whose join-meet ideal contains the 2-minors of the ladder \vspace{12pt} \begin{center} $\begin{matrix} a & b & e & \\ c & d & f & i\\ & g & h & j\\ & & k & l \end{matrix}$ \end{center} \noindent as standard generators, and which meets certain comparability conditions. \vspace{12pt} \begin{lemma}\label{9rel} Suppose \begin{eqnarray*} s_1&=&bc-ad\\ s_2&=&ce-af\\ s_3&=&de-bf\\ s_4&=&eg-bh\\ s_5&=&fg-dh\\ s_6&=&gi-dj\\ s_7&=&hi-fj\\ s_8&=&ik-fl\\ s_9&=&jk-hl \end{eqnarray*} are standard generators of a lattice $D$, and that $\{a,g\}$, $\{a,h\}$, $\{c,g\}$, $\{c,h\}$, $\{b,i\}$, $\{b,j\}$, $\{e,i\}$, $\{e,j\}$, $\{d,k\}$, $\{d,l\}$, $\{g,k\}$, and $\{g,l\}$ are comparable pairs in $D$. Let $F\in \mathbb{F}_2^{9}$ be defined for these nine elements as in Definition~\ref{F}. Then $F=\{0,0,0,0,0,0,0,0,0\}$. \end{lemma} \begin{proof} We first note that with natural relabeling, both $\{s_1,s_2,s_3,s_4,s_5,s_6,s_7\}$ and \\$\{s_3,s_4,s_5,s_6,s_7,s_8,s_9\}$ satisfy the hypotheses of Lemma~\ref{7rel}, so if we let $F$ be defined as in Definition~\ref{F}, this limits the cases we need to consider to 9-tuples whose first seven entries and whose last seven entries satisfy the conclusion of Lemma~\ref{7rel}. We see by Lemma~\ref{7rel} that $F=\{0,0,0,0,0,0,0,0,0\}$. \end{proof} We now have the machinery necessary to show that for $t=(1,1,1,1,1,0)$, $I_{G_{5}^t}$ does not come from a lattice. In our proof, we use the previous four lemmas and the fact that $I_{G_{5}^t}$ is generated by the distinguished minors of $L_5^{(1,1,1,1,1,0)}$: \vspace{12pt} \begin{center} $\begin{matrix} x_0 & x_2 & x_5 & & \\ x_3 & x_4 & x_6 & x_9 & x_{13}\\ & x_7 & x_8 & x_{10} & \\ & & x_{11} & x_{12} & x_{14} \end{matrix}$ \end{center} \vspace{12pt} \begin{prop}\label{nolattice} Let $n=5$ and $t=(1,1,1,1,1,0)$. Then the set of standard generators for $I_{G_{5}^t}$ is not equal to the complete set of standard generators (up to sign) of any (classical) lattice. \end{prop} \begin{proof} By Remark~\ref{ti} and choice of $n=5$ and $t=(1,1,1,1,1,0)$, the generators of $I_{G_{5}^t}$ are \begin{align*} s_1 &= x_2x_3-x_0x_4 & s_2 &= x_3x_5-x_0x_6\\ s_3 &= x_4x_5-x_2x_6 &s_4 &= x_5x_7-x_2x_8\\ s_5 &= x_6x_7-x_4x_8 &s_6 &= x_7x_9-x_4x_{10}\\ s_7 &= x_8x_9-x_6x_{10} &s_8 &= x_9x_{11}-x_6x_{12}\\ s_9 &= x_{10}x_{11}-x_8x_{12} &s_{10} &= x_{11}x_{13}-x_6x_{14}\\ s_{11} &= x_{12}x_{13}-x_9x_{14} & & \end{align*} Suppose a lattice $D$ exists whose complete set of standard generators (up to sign) equals \{$s_1,\ldots,s_{11}$\}. We note that if the monomial $x_ix_j$ does not appear in any of the $s_k$, then $\{x_i,x_j\}$ is a comparable pair, since otherwise $\pm(x_ix_j-(x_i\vee x_j)(x_i\wedge x_j))$ would be in the set of standard generators of $D$. Thus the pairs $\{x_0,x_7\}$, $\{x_0,x_8\}$, $\{x_3,x_7\}$, $\{x_3,x_8\}$, $\{x_2,x_9\}$, $\{x_2,x_{10}\}$, $\{x_5,x_9\}$, $\{x_5,x_{10}\}$, $\{x_4,x_{11}\}$, $\{x_4,x_{12}\}$, $\{x_7,x_{11}\}$, $\{x_7,x_{12}\}$, $\{x_{10},x_{13}\}$, and $\{x_{10},x_{14}\}$ are comparable pairs in $D$. Let $F\in \mathbb{F}_2^{11}$ be defined as in Definition~\ref{F}. Then with natural relabeling of the first nine relations, this lattice satisfies the hypotheses of Lemma~\ref{9rel}, so the only cases we need to consider are $F=\{0,0,0,0,0,0,0,0,0,a,b\}$. Since $F_1=0$, without loss of generality, we have $x_0>\{x_2,x_3\}>x_4$. Then with the ordering chosen, the fact that $F_3=F_5=F_7=F_9=0$ yields \begin{align*} &x_2>\{x_4,x_5\}>x_6\\ &x_4>\{x_6,x_7\}>x_8\\ &x_6>\{x_8,x_9\}>x_{10}\\ &x_8>\{x_{10},x_{11}\}>x_{12}. \end{align*} The reader may verify that $b=0$ and $b=1$ both yield contradictions based on inspecting the standard generator $s_{11}$ in light of the comparability of the pairs $\{x_{10},x_{13}\}$ and $\{x_{10},x_{14}\}$, respectively, using the same technique employed in Case 1 of the proof of Lemma~\ref{5rel}. We conclude that there is no lattice whose complete set of standard generators (up to sign) equals the set of standard generators of $I_{G_{5}^{(1,1,1,1,1,0)}}$. \end{proof} \section{Properties of the Family of Toric Rings} \label{resultsprops} In Section~\ref{family}, we defined a family of toric rings, the rings $R(n,t)$ coming from the family $\mathcal{F}$, and we demonstrated some context for these rings in the area of graph theory. Now we investigate some of the algebraic properties of each $R(n,t)$. We develop proofs to establish dimension, regularity, and multiplicity. \subsection{Dimension and System of Parameters} We use the the degree reverse lexicographic monomial order with $x_0>x_2>x_3>\cdots$ throughout this section, and denote it by $>$. We show that the standard generators $s_k$ given in Remark~\ref{ti} are a Gr\"obner basis for $I_{G_n^t}$ with respect to $>$. \begin{lemma}\label{Grobner} If $s_1,\ldots,s_{2n+1}$ are as in Remark~\ref{ti}, then $B=\{s_1,\ldots,s_{2n+1}\}$ is a Gr{\"o}bner basis for $I_{G_n^t}$ with respect to $>$. \end{lemma} \begin{proof} This is a straightforward computation using Buchberger's Criterion and properties of the $j_k$ from Remark~\ref{jk}. By Remark~\ref{ti}, for $1\leq i \leq n$ the ideal $I_{G_n^t}$ is generated by \begin{eqnarray*} s_{1}&=&x_{2}x_{3}-x_{j_{1}}x_{4}\\ s_{2i}&=&x_{2i+1}x_{2i+3}-x_{j_{2i}}x_{2i+4}\\ s_{2i+1}&=&x_{2i+2}x_{2i+3}-x_{j_{2i+1}}x_{2i+4}, \end{eqnarray*} where $j_1=j_2=0$, $j_3=2$, and for $i\geq 2$, we have \begin{eqnarray*} t_{i+1}&=&0\iff j_{2i}=j_{2i-2}\iff j_{2i+1}=2i-1\\ t_{i+1}&=&1\iff j_{2i}=j_{2i-1}\iff j_{2i+1}=2i. \end{eqnarray*} If we adopt $S$-polynomial notation $S_{i,j}$ for the $S$-polynomial of $s_i$ and $s_j$, then the cases to consider are \[ S_{2i-1,2i}\text{ and } S_{2i,2i+1}\text{ for }1\leq i\leq n \] \[ S_{2i,2i+2}\text{ for }1\leq i\leq n-1. \] To give a flavor of the computation involved, we show the case $S_{2i-1,2i}$ for $1\leq i\leq n$, and leave the remaining cases to the reader. We show in each subcase that $S_{2i-1,2i}$ is equal to a sum of basis elements with coefficients in $S(n)$, so that the reduced form of $S_{2i-1,2i}$ is zero in each subcase. We have \begin{eqnarray*} S_{2i-1,2i}&=&x_{2i+3}(x_{2i}x_{2i+1}-x_{j_{2i-1}}x_{2i+2})-x_{2i}(x_{2i+1}x_{2i+3}-x_{j_{2i}}x_{2i+4})\\ &=&-x_{j_{2i-1}}x_{2i+2}x_{2i+3}+x_{j_{2i}}x_{2i}x_{2i+4} \end{eqnarray*} \vspace{12pt} Case 1: If $i\geq 2$ and $t_{i+1}=0$, then $j_{2i}=j_{2i-2}$ and $j_{2i+1}=2i-1$, so we have \begin{eqnarray*} S_{2i-1,2i}&=&-x_{j_{2i-1}}x_{2i+2}x_{2i+3}+x_{j_{2i-2}}x_{2i}x_{2i+4} \end{eqnarray*} \begin{quote} Case 1.1: If in addition $i\geq 3$ and $t_{i}=0$, then $j_{2i-2}=j_{2i-4}$ and $j_{2i-1}=2i-3$, so we have \begin{eqnarray*} S_{2i-1,2i}&=&-x_{2i-3}x_{2i+2}x_{2i+3}+x_{j_{2i-4}}x_{2i}x_{2i+4}\\ &=&-x_{2i-3}(x_{2i+2}x_{2i+3}-x_{j_{2i+1}}x_{2i+4})+x_{2i+4}(x_{2i-3}x_{2i-1}-x_{j_{2i-4}}x_{2i})\\ &=&-x_{2i-3}s_{2i+1}+x_{2i+4}s_{2i-4}. \end{eqnarray*} \end{quote} \begin{quote} Case 1.2: If in addition $i=2$ or $i\geq 3$ and $t_{i}=1$, then $j_{2i-2}=j_{2i-3}$ and $j_{2i-1}=2i-2$, so we have \begin{eqnarray*} S_{2i-1,2i}&=&-x_{2i-2}x_{2i+2}x_{2i+3}+x_{j_{2i-3}}x_{2i}x_{2i+4}\\ &=&-x_{2i-2}(x_{2i+2}x_{2i+3}-x_{j_{2i+1}}x_{2i+4})+x_{2i+4}(x_{2i-2}x_{2i-1}-x_{j_{2i-3}}x_{2i})\\ &=&-x_{2i-2}s_{2i+1}+x_{2i+4}s_{2i-3}. \end{eqnarray*} \end{quote} Case 2: If $i=1$ or if $i\geq 2$ and $t_{i+1}=1$, then $j_{2i}=j_{2i-1}$ and $j_{2i+1}=2i$, so we have \begin{eqnarray*} S_{2i-1,2i}&=&-x_{j_{2i}}x_{2i+2}x_{2i+3}+x_{j_{2i}}x_{2i}x_{2i+4}\\ &=&-x_{j_{2i}}s_{2i+1}. \end{eqnarray*} This concludes the case $S_{2i-1,2i}$ for $1\leq i\leq n-1$. The remaining cases are similar. \end{proof} \begin{cor}\label{koszul} The ring $R(n,t)$ is Koszul for all $n$ and all $t$. \end{cor} \begin{proof} Since $I_{G_n^t}$ has a quadratic Gr\"obner basis, the ring $R(n,t)$ is Koszul for all $n$ and all $t$ due to \cite[Th 2.28]{herzog-hibi-ohsugi}. \end{proof} \begin{cor}\label{initial} The initial ideal for $I_{G_n^t}$ with respect to the degree reverse lexicographic monomial order $>$ is \begin{equation*} \text{in}_> I_{G_n^t}=(x_{2}x_{3},\{x_{2i+1}x_{2i+3},x_{2i+2}x_{2i+3} \mid 1\leq i\leq n\}). \end{equation*} \end{cor} \noindent We note that $\text{in}_> I_{G_n^t}$ does not depend on $t$, which will be useful for the following sections. We use the initial ideal $\text{in}_> I_{G_n^t}$ from Corollary~\ref{initial} and direct computation to show the Krull dimension of $R(n,t)$. As a corollary, we obtain the projective dimension of $R(n,t)$. We note that the Krull dimension, like the initial ideal, does not depend on $t$. We refer the reader to Remark~\ref{ti} for a reminder of how to think of the toric ring \[ R(n,t)=\frac{S(n)}{I_{G_n^t}}=\frac{k[x_0,x_2,x_3,\ldots, x_{2n+4}]}{I_{G_n^t}} \] in the context of this work. \begin{thm}\label{dimension} The Krull dimension of $R(n,t)$ is \[ \dim R(n,t)= n+3. \] \end{thm} \begin{proof} Let $>$ be the degree reverse lexicographic monomial order with \[ x_0>x_2>x_3>\cdots>x_{2n+4}. \] By Corollary~\ref{initial}, the initial ideal of $I_{G_n^t}$ with respect to $>$ is \begin{equation*} \text{in}_> I_{G_n^t}=(x_{2}x_{3},\{x_{2i+1}x_{2i+3},x_{2i+2}x_{2i+3} \mid 1\leq i\leq n\}). \end{equation*} Since $S(n)/(\text{in}_> I_{G_n^t})$ and $R(n,t)=S(n)/I_{G_n^t}$ are known to have the same Krull dimension (see for example \cite[Props 9.3.4 and 9.3.12]{cox-little-oshea}), it suffices to prove that \[ \dim S(n)/(\text{in}_> I_{G_n^t}) = n+3. \] To see that the dimension is at least $n+3$, we construct a chain of prime ideals in $S(n)$ containing $\text{in}_> I_{G_n^t}$. Since every monomial generator of $\text{in}_> I_{G_n^t}$ contains a variable of odd index, we begin with $P_{n}=(\{x_{k} \mid \text{$k$ odd, $2<k<2n+4$}\})$, a prime ideal containing $\text{in}_> I_{G_n^t}$. Then we have the chain of prime ideals $P_{n}\subsetneq P_{n}+(x_{0})\subsetneq P_{n}+(x_{0},x_{2})\subsetneq P_{n}+(x_{0},x_{2},x_{4})\subsetneq\cdots\subsetneq P_{n}+(\{x_{2i} \mid 0\leq i \leq n+2\})$, so that \[ \dim S(n)/(\text{in}_> I_{G_n^t})\geq n+3. \] To see that the dimension is at most $n+3$, we find a sequence of $n+3$ elements in $S(n)/(\text{in}_> I_{G_n^t})$ such that the quotient by the ideal they generate has dimension zero. Let \[ X_n=x_0,x_2-x_3,x_4-x_5,\ldots,x_{2n}-x_{2n+1},x_{2n+2}-x_{2n+3},x_{2n+4} \] in $S(n)$, and take the quotient of $S(n)/(\text{in}_> I_{G_n^t})$ by the image of $X_n$ to obtain the following. In the last step, we rewrite the quotient of $S(n)$ and $(\text{in}_> I_{G_n^t})+(X_n)$ by $(X_n)$ by setting $x_0$ and $x_{2n+4}$ equal to zero and replacing $x_{2i}$ with $x_{2i+1}$ for $1\leq i\leq n+1$: \begin{eqnarray*} \frac{S(n)/(\text{in}_> I_{G_n^t})}{((\text{in}_> I_{G_n^t})+(X_n))/(\text{in}_> I_{G_n^t})}&\cong&\frac{S(n)}{((\text{in}_> I_{G_n^t})+(X_n))}\\ &\cong&\frac{S(n)/(X_n)}{((\text{in}_> I_{G_n^t})+(X_n))/(X_n)}\\ &\cong&\frac{k[x_3,x_5,\ldots,x_{2n+1},x_{2n+3}]}{(x_3^2,\{x_{2i+1}x_{2i+3},x_{2i+3}^2\mid 1\leq i\leq n\})}. \end{eqnarray*} Since \[ \sqrt{(x_3^2,\{x_{2i+1}x_{2i+3},x_{2i+3}^2\mid 1\leq i\leq n\})}=(x_3,x_5,\ldots,x_{2n+3}), \] the above ring has dimension zero. Thus, \[ \dim S(n)/(\text{in}_> I_{G_n^t}) \leq n+3. \] We conclude that $\dim R(n,t) = \dim S(n)/(\text{in}_> I_{G_n^t})=n+3$. \end{proof} \begin{cor}\label{pdimension} The projective dimension of $R(n,t)$ over $S(n)$ is \[ \textnormal{pd}_{S(n)} R(n,t)= n+1. \] \end{cor} \begin{proof} We know the Krull dimension of the polynomial ring $S(n)$ is $2n+4$. The result follows from the fact that $R(n,t)$ is Cohen-Macaulay (Corollary~\ref{CM}) and from the graded version of the Auslander-Buchsbaum formula. \end{proof} \begin{rmk}\label{xtsop} The proof of the previous theorem shows that the image of \[ X_n=x_{0},x_{2}-x_{3},x_{4}-x_{5},\ldots,x_{2n}-x_{2n+1},x_{2n+2}-x_{2n+3},x_{2n+4} \] in $S(n)/(\text{in}_> I_{G_n^t})$ is a system of parameters for $S(n)/(\text{in}_> I_{G_n^t})$. We prove in the next theorem that the image of $X_n$ in $R(n,t)$ (which we call $\overline{X_n}$) is also a system of parameters for $R(n,t)$. Before doing so, we introduce some notation and a definition which allows us to better grapple with the quotient ring $R(n,t)/(\overline{X_n})$. \end{rmk} \begin{defn}\label{widehatnotation} Consider the isomorphism \[ \frac{R(n,t)}{(\overline{X_n})}=\frac{S(n)/(I_{G_n^t})}{((I_{G_n^t})+(X_n))/(I_{G_n^t})}\cong\frac{S(n)/(X_n)}{((I_{G_n^t})+(X_n))/(X_n)} \] We view taking the quotient by $X_n$ as setting $x_0$ and $x_{2n+4}$ equal to zero and replacing $x_{2i}$ with $x_{2i+1}$ for $1\leq i\leq n+1$ to obtain \begin{equation*} \widehat{S(n)}:=k[x_3,x_5,\ldots,x_{2n+1},x_{2n+3}]\cong S(n)/(X_n). \end{equation*} By the same process (detailed below), we obtain the ideal $\widehat{I_{G_n^t}}\cong(I_{G_n^t}+(X_n))/(X_n)$. We further define the quotient \begin{equation*} \widehat{R(n,t)}:=\widehat{S(n)}/\widehat{I_{G_n^t}}\cong R(n,t)/(\overline{X_n}). \end{equation*} We find this notation natural since it is often used for the removal of variables, and the quotient by $X_n$ may be viewed as identifying and removing variables. Since this work has no completions in it, there should be no conflict of notation. \end{defn} \begin{defn}\label{widehati} To define $\widehat{I_{G_n^t}}$ in particular, we recall the standard generators of $I_{G_n^t}$ and introduce further notation to describe the generators of $\widehat{I_{G_n^t}}\cong(I_{G_n^t}+(X_n))/(X_n)$. By Remark~\ref{ti}, the standard generators of $I_{G_n^t}$ are \begin{eqnarray*} s_1&=&x_{2}x_{3}-x_{j_{1}}x_{4}\\ s_{2i}&=&x_{2i+1}x_{2i+3}-x_{j_{2i}}x_{2i+4}\\ s_{2i+1}&=&x_{2i+2}x_{2i+3}-x_{j_{2i+1}}x_{2i+4}, \end{eqnarray*} for $1\leq i\leq n$, where the nonnegative integers $j_k$ are as in Remark~\ref{jk}. Let $\widehat{\iota}$ be the largest index such that $j_{2\widehat{\iota}}=0$. By Remark~\ref{jk}, we see that the $j_{2i}$ are defined recursively and form a non-decreasing sequence. Then \begin{equation*} j_1=j_2=j_4=j_6=\cdots=j_{2\widehat{\iota}}=0, \end{equation*} and since we view taking the quotient by $X_n$ as setting $x_0$ and $x_{2n+4}$ equal to zero and replacing $x_{2i}$ with $x_{2i+1}$ for $1\leq i\leq n+1$, we define $\widehat{I_{G_n^t}}$ by replacing $x_{j_k}$ with $x_{J_k}$ (defined below) for $1\leq k<2n$ to obtain \begin{eqnarray*} \widehat{s_1}&=&x_{3}^2-x_{J_{1}}x_{5}\\ \widehat{s_{2i}}&=&x_{2i+1}x_{2i+3}-x_{J_{2i}}x_{2i+5}\\ \widehat{s_{2i+1}}&=&x_{2i+3}^2-x_{J_{2i+1}}x_{2i+5}\\ \widehat{s_{2n}}&=&x_{2n+1}x_{2n+3}\\ \widehat{s_{2n+1}}&=&x_{2n+3}^2 \end{eqnarray*} for $1\leq i< n$, where \[ x_{J_k}=\begin{cases} 0&\text{ if }k\text{ is even and }k\leq2\widehat{\iota}, \text{ or if }k=1\\ x_{j_k+1} &\text{ if } 2\widehat{\iota}<k<2n \text{ and $j_k$ is even}\\ x_{j_k} &\text{ if }j_k\text{ is odd} \end{cases} \] We note that $J_k\leq k$ for each $1\leq k< 2n$, since $j_k\leq k-1$ by Remark~\ref{jk}. By properties of the original $j_k$ from Remark~\ref{jk}, we know that $x_{J_1}=x_{J_2}=0$, $J_3=3$, and for $2\leq i<n$, \begin{eqnarray*} t_{i+1}&=&0\iff x_{J_{2i}}=x_{J_{2i-2}}\iff J_{2i+1}=2i-1\\ t_{i+1}&=&1\iff x_{J_{2i}}=x_{J_{2i-1}}\iff J_{2i+1}=2i+1. \end{eqnarray*} \end{defn} \begin{exmp} We construct the ring $R(2,(0,0,0))$. For the graph $G_2^{(0,0,0)}\in \mathcal{F}$, we have the toric ring \[ R(2,(0,0,0))=\frac{k[x_0,x_2,x_3,\ldots,x_{8}]}{(x_2x_3-x_0x_4,x_3x_5-x_0x_6,x_4x_5-x_2x_6,x_5x_7-x_0x_8,x_6x_7-x_3x_8)} \] coming from the ladder-like structure \[ L_2^{(0,0,0)}= \begin{matrix} x_0 & x_2 & x_5\\ x_3 & x_4 & x_6\\ x_7 & & x_8 \end{matrix} \] from Example~\ref{mexmp1}. We know \[ X_2=x_{0},x_{2}-x_{3},x_{4}-x_{5},\ldots,x_4-x_{5},x_{6}-x_{7},x_{8}, \] so that $R(2,(0,0,0))/(\overline{X_2})$ is isomorphic to \begin{equation*} \frac{k[x_0,x_2,x_3,x_4,x_5,x_6,x_7,x_{8}]}{(x_2x_3-x_0x_4,x_3x_5-x_0x_6,x_4x_5-x_2x_6,x_5x_7-x_0x_8,x_6x_7-x_3x_8,x_{0},x_{2}-x_{3},\ldots,x_{8})} \end{equation*} \begin{equation*} \cong\frac{k[x_3,x_5,x_7]}{(x_3^2,x_3x_5,x_5^2-x_3x_7,x_5x_7,x_7^2)}=\widehat{R(2,(0,0,0))}. \end{equation*} \end{exmp} Now we show that $X_n$ is also a system of parameters for $R(n,t)$, and not just for the quotient by the initial ideal. \begin{prop}\label{sopedgering} Let $R(n,t)=S(n)/I_{G_n^t}$ and let \begin{equation*} X_n=x_{0},x_{2}-x_{3},x_{4}-x_{5},\ldots,x_{2n}-x_{2n+1},x_{2n+2}-x_{2n+3},x_{2n+4} \end{equation*} so that the image of $X_n$ in $S(n)/(\text{in}_> I_{G_n^t})$ is the system of parameters from Remark~\ref{xtsop}. Then the image of $X_n$ in $R(n,t)$ is a system of parameters for $R(n,t)$. \end{prop} \begin{proof} Let $X_n$ be defined as above. Then by Theorem~\ref{dimension} and Definition~\ref{widehatnotation} we need only show that $\dim \widehat{R(n,t)}=0$. We have for $n=0$ that \begin{equation*} \widehat{R(0,t)}=\frac{k[x_3]}{(x_3^2)}, \end{equation*} for $n=1$ \begin{equation*} \widehat{R(1,t)}=\frac{k[x_3,x_5]}{(x_3^2,x_3x_5,x_5^2)}, \end{equation*} and for $ n>1$ \begin{equation*} \widehat{R(n,t)}=\frac{\widehat{S(n)}}{\widehat{I_{G_n^t}}}=\frac{k[x_3,x_5,\ldots,x_{2n+1},x_{2n+3}]}{(\{\widehat{s_1},\widehat{s_{2i}},\widehat{s_{2i+1}}\mid 1\leq i\leq n\})}, \end{equation*} where \begin{eqnarray*} \widehat{s_1}&=&x_{3}^2\\ \widehat{s_{2i}}&=&x_{2i+1}x_{2i+3}-x_{J_{2i}}x_{2i+5}\\ \widehat{s_{2i+1}}&=&x_{2i+3}^2-x_{J_{2i+1}}x_{2i+5}\\ \widehat{s_{2n}}&=&x_{2n+1}x_{2n+3}\\ \widehat{s_{2n+1}}&=&x_{2n+3}^2 \end{eqnarray*} for $1\leq i < n$ from Definition~\ref{widehati}. We know $\dim \widehat{R(n,t)}=\dim \widehat{S(n)}/\widehat{I_{G_n^t}}=\dim \widehat{S(n)}/\sqrt{\widehat{I_{G_n^t}}}$. We claim that \begin{equation*} \sqrt{\widehat{I_{G_n^t}}}=\left(x_{3},x_{5},\ldots,x_{2n+1},x_{2n+3}\right). \end{equation*} This is clear for $n\in\{0,1\}$. For $n >1$, we prove this by induction. Since $\widehat{s_1}=x_3^2$ and $\widehat{s_{2n+1}}=x_{2n+3}^2$ are in $\widehat{I_{G_n^t}}$, we have $x_{3}, x_{2n+3}\in\sqrt{\widehat{I_{G_n^t}}}$. Since \[ \widehat{s_{3}}=x_5^2-x_3x_7\in \widehat{I_{G_n^t}}\subseteq \sqrt{\widehat{I_{G_n^t}}} \] and $x_{3}\in\sqrt{\widehat{I_{G_n^t}}}$, we get $x_{5}^2\in\sqrt{\widehat{I_{G_n^t}}}$, so that $x_{5}\in\sqrt{\widehat{I_{G_n^t}}}$. Now suppose $x_{2i-1},x_{2i+1}\in\sqrt{\widehat{I_{G_n^t}}}$ for $2\leq i< n$. We have \[ \widehat{s_{2i+1}}=x_{2i+3}^{2}-x_{J_{2i+1}}x_{2i+5}\in\widehat{I_{G_n^t}}\subseteq\sqrt{\widehat{I_{G_n^t}}}. \] But $x_{J_{2i+1}}\in\{x_{2i-1},x_{2i+1}\}$ by Definition~\ref{widehati} and $\{x_{2i-1},x_{2i+1}\}\subseteq\sqrt{\widehat{I_{G_n^t}}}$ by induction, so that $x_{2i+3}^{2}\in\sqrt{\widehat{I_{G_n^t}}}$, and hence $x_{2i+3}\in\sqrt{\widehat{I_{G_n^t}}}$. We conclude that \[ \left(x_{3},x_{5},\ldots,x_{2n+1},x_{2n+3}\right)\subseteq\sqrt{\widehat{I_{G_n^t}}}\subseteq\left(x_{3},x_{5},\ldots,x_{2n+1},x_{2n+3}\right), \] so we have equality. Since $\widehat{S(n)}/\sqrt{\widehat{I_{G_n^t}}}\cong k$ has dimension zero, so does $\widehat{R(n,t)}\cong R(n,t)/(\overline{X_n})$. Thus, the image of $X_n$ is a system of parameters for $R(n,t)$. \end{proof} \begin{rmk}\label{art} We note that as a consequence of the proof of the preceding theorem, the ring $\widehat{R(n,t)}$ is Artinian, which will be relevant in Section~\ref{lmr}. \end{rmk} \begin{cor}\label{xt} The image of \begin{equation*} X_n=x_{0},x_{2}-x_{3},x_{4}-x_{5},\ldots,x_{2n}-x_{2n+1},x_{2n+2}-x_{2n+3},x_{2n+4} \end{equation*} in $R(n,t)=S(n)/I_{G_n^t}$ is a regular sequence for $R(n,t)$. \end{cor} \begin{proof} We know by Proposition~\ref{sopedgering} that the image of $X_n$ in $R(n,t)$ is a linear system of parameters. Since the rings $R(n,t)$ are Cohen-Macaulay (Corollary~\ref{CM}), we are done. \end{proof} \subsection{Length, Multiplicity, and Regularity} \label{lmr} In this section, we determine the multiplicity and Castelnuovo-Mumford regularity of the toric rings $R(n,t)$ coming from the associated graphs $G_n^t\in\mathcal{F}$ by computing the length of the Artinian rings \[ \widehat{R(n,t)}\cong R(n,t)/(\overline{X_n}) \] from Definition~\ref{widehatnotation}. We know by Corollary~\ref{xt} that $\overline{X_n}$ is a linear regular sequence for $R(n,t)$, which allows us to compute the multiplicity of the rings $R(n,t)$. As a corollary of Theorem~\ref{Hilbert Series mod reg seq}, which establishes the Hilbert function for $\widehat{R(n,t)}$, we obtain the multiplicity and regularity of $R(n,t)$. We also develop an alternate graph-theoretic proof for the regularity of $R(n,t)$, which is included at the end of this section. We begin with a lemma establishing a vector space basis for $\widehat{R(n,t)}$, which we use extensively for our results. \begin{lemma}\label{uniquerep} The image of all squarefree monomials with only odd indices whose indices are at least four apart, together with the image of $1_k$, forms a vector space basis for $\widehat{R(n,t)}$ over $k$. \end{lemma} \begin{proof} We recall for the reader the definition of $\widehat{R(n,t)}$ and then find the initial ideal of $\widehat{I_{G_n^t}}$ and use Macaulay's Basis Theorem to show that the desired representatives form a basis for $\widehat{R(n,t)}$ as a vector space over $k$. From Definition~\ref{widehatnotation}, we have \begin{equation*} R(n,t)/(\overline{X_n})\cong\widehat{R(n,t)}= \widehat{S(n)}/\widehat{I_{G_n^t}}, \end{equation*} where \begin{equation*} \widehat{S(n)}=k[x_3,x_5,\ldots,x_{2n+1},x_{2n+3}]. \end{equation*} By Definition~\ref{widehati}, for $1\leq i< n$ the ideal $\widehat{I_{G_n^t}}$ is generated by \begin{eqnarray*} \widehat{s_1}&=&x_{3}^2-x_{J_{1}}x_{5}\\ \widehat{s_{2i}}&=&x_{2i+1}x_{2i+3}-x_{J_{2i}}x_{2i+5}\\ \widehat{s_{2i+1}}&=&x_{2i+3}^2-x_{J_{2i+1}}x_{2i+5}\\ \widehat{s_{2n}}&=&x_{2n+1}x_{2n+3}\\ \widehat{s_{2n+1}}&=&x_{2n+3}^2, \end{eqnarray*} where $x_{J_1}=x_{J_2}=0$, $J_3=3$, and for $2\leq i<n$, \begin{eqnarray*} t_{i+1}&=&0\iff x_{J_{2i}}=x_{J_{2i-2}}\iff J_{2i+1}=2i-1\\ t_{i+1}&=&1\iff x_{J_{2i}}=x_{J_{2i-1}}\iff J_{2i+1}=2i+1. \end{eqnarray*} We first show that the image of the monomials with the desired property is a basis in the quotient of $\widehat{S(n)}$ by the initial ideal $\text{in}_> \widehat{I_{G_n^t}}$. By Macaulay's Basis Theorem, which is Theorem 1.5.7 in \cite{cca1-kreuzer-robbiano}, the image of these monomials in $\widehat{R(n,t)}$ is also a basis. To find the initial ideal of $\widehat{I_{G_n^t}}$, we establish that the given generators $\widehat{s_k}$ are a Gr\"{o}bner basis for $\widehat{I_{G_n^t}}$ with respect to the degree reverse lexicographic order $>$. This is a relatively straightforward computation using Buchberger's Criterion, with separate cases for when $x_{J_k}=0$. If we adopt $S$-polynomial notation $S_{i,j}$ for the $S$-polynomial of $\widehat{s_i}$ and $\widehat{s_j}$, then the cases to consider are \[ S_{1,2},S_{2,3},S_{2,4},S_{2n-2,2n},S_{2n-1,2n},S_{2n,2n+1} \] \[ S_{2i-1,2i}\text{ for }1<i<n \] \[ S_{2i,2i+1}\text{ for }1<i<n \] \[ S_{2i,2i+2}\text{ for }1<i<n-1. \] To give a flavor of the computation involved, we show the case $S_{2i,2i+2}$ for $1<i<n-1$, and leave the remaining cases to the reader. We show in each subcase that $S_{2i,2i+2}$ is equal to zero or to a sum of basis elements with coefficients in $\widehat{S(n)}$, so that the reduced form of $S_{2i,2i+2}$ is zero in each subcase. We have \begin{eqnarray*} S_{2i,2i+2}&=&x_{2i+5}(x_{2i+1}x_{2i+3}-x_{J_{2i}}x_{2i+5})-x_{2i+1}(x_{2i+3}x_{2i+5}-x_{J_{2i+2}}x_{2i+7})\\ &=&-x_{J_{2i}}x_{2i+5}^2+x_{2i+1}x_{J_{2i+2}}x_{2i+7} \end{eqnarray*} \vspace{12pt} Case 1: If $t_{i+2}=0$, then $x_{J_{2i+2}}=x_{J_{2i}}$ and $J_{2i+3}=2i+1$, so we have \begin{eqnarray*} S_{2i,2i+2}&=&-x_{J_{2i}}x_{2i+5}^2+x_{J_{2i}}x_{2i+1}x_{2i+7}\\ &=&-x_{J_{2i}}\widehat{s_{2i+3}} \end{eqnarray*} We note that if $x_{J_{2i}}=x_{J_{2i+2}}=0$, then $S_{2i,2i+2}=0$. \vspace{12pt} Case 2: If $t_{i+2}=1$, then $x_{J_{2i+2}}=x_{J_{2i+1}}$ and $J_{2i+3}=2i+3$, so we have \begin{eqnarray*} S_{2i,2i+2}&=&-x_{J_{2i}}x_{2i+5}^2+x_{2i+1}x_{J_{2i+1}}x_{2i+7}. \end{eqnarray*} \begin{quote} Case 2.1: If in addition $t_{i+1}=0$, then $x_{J_{2i}}=x_{J_{2i-2}}$ and $J_{2i+1}=2i-1$, so we have \begin{eqnarray*} S_{2i,2i+2}&=&-x_{J_{2i-2}}x_{2i+5}^2+x_{2i+1}x_{2i-1}x_{2i+7}\\ &=&-x_{J_{2i-2}}(x_{2i+5}^2-x_{J_{2i+3}}x_{2i+7})+x_{2i+7}(x_{2i-1}x_{2i+1}-x_{J_{2i-2}}x_{2i+3})\\ &=&-x_{J_{2i-2}}\widehat{s_{2i+3}}+x_{2i+7}\widehat{s_{2i-2}}. \end{eqnarray*} We note that if $x_{J_{2i}}=x_{J_{2i-2}}=0$, then $S_{2i,2i+2}=x_{2i+7}\widehat{s_{2i-2}}$. \vspace{12pt} \noindent Case 2.2: If in addition $t_{i+1}=1$, then $x_{J_{2i}}=x_{J_{2i-1}}$ and $J_{2i+1}=2i+1$, so we have \begin{eqnarray*} S_{2i,2i+2}&=&-x_{J_{2i-1}}x_{2i+5}^2+x_{2i+1}^2x_{2i+7}\\ &=&-x_{J_{2i-1}}(x_{2i+5}^2-x_{J_{2i+3}}x_{2i+7})+x_{2i+7}(x_{2i+1}^2-x_{J_{2i-1}}x_{2i+3})\\ &=&-x_{J_{2i-1}}\widehat{s_{2i+3}}+x_{2i+7}\widehat{s_{2i-1}}. \end{eqnarray*} \end{quote} This concludes the case $S_{2i,2i+2}$ for $1<i<n-1$. The remaining cases are similar. Then the given generators $\widehat{s_k}$ are a Gr\"{o}bner Basis for $\widehat{I_{G_n^t}}$, so that the initial ideal is \[ \text{in}_>(\widehat{I_{G_n^t}})=(x_3^2,\{x_{2i+1}x_{2i+3},x_{2i+3}^2 \mid 1\leq i \leq n\} ) \] in the ring $\widehat{S(n)}=k[x_3,x_5,\ldots,x_{2n+1},x_{2n+3}]$. Since $\text{in}_>(\widehat{I_{G_n^t}})$ consists precisely of all squares of variables in $\widehat{S(n)}$ and all degree two products of variables whose indices differ by exactly two, it follows that the image of the squarefree monomials whose indices are at least four apart, together with the image of $1_k$, forms a basis for $\frac{\widehat{S(n)}}{\text{in}_>\widehat{I_{G_n^t}}}$. By Macaulay's Basis Theorem, the image of these monomials in $\widehat{R(n,t)}=\frac{\widehat{S(n)}}{\widehat{I_{G_n^t}}}$ is also a basis. \end{proof} We use the lemma above to establish facts about the vector space dimensions of degree $i$ pieces of $\widehat{R(n,t)}$, which are applied further below to establish length and multiplicity. \begin{notation}\label{d} Throughout this section, we use $d_{n,i}:=\dim_k (\widehat{R(n,t)})_{i}$ for the vector space dimension of the degree $i$ piece of $\widehat{R(n,t)}$, that is, for the $i$th coefficient in the Hilbert series of $\widehat{R(n,t)}$. By Lemma~\ref{uniquerep}, these are independent of $t$. \end{notation} We establish a recursive relationship between these dimensions by introducing a short exact sequence of vector spaces. \begin{lemma}\label{recursion} For $n\geq 2$ and $i\geq 1$, the vector space dimension $d_{n,i}=\dim_k (\widehat{R(n,t)})_{i}$ satisfies the recursive relationship \[ d_{n,i}=d_{n-1,i}+d_{n-2,i-1}. \] \end{lemma} \begin{proof} We use the vector space basis defined in Lemma~\ref{uniquerep}. We note that the basis elements described are actually monomial representatives (which do not depend on $t$) of equivalence classes (which do depend on $t$), but we suppress this and speak as if they are monomials, not depending on $t$. We then take the liberty of suppressing $t$ in what follows, for convenience. We recall for the reader that \begin{eqnarray*} \widehat{S(n)}&=&k[x_3,x_5,\ldots,x_{2n-3},x_{2n-1},x_{2n+1},x_{2n+3}]\\ \widehat{S(n-1)}&=&k[x_3,x_5,\ldots,x_{2n-3},x_{2n-1},x_{2n+1}]\\ \widehat{S(n-2)}&=&k[x_3,x_5,\ldots,x_{2n-3},x_{2n-1}] \end{eqnarray*} Let $x_{2n+3}:(\widehat{R(n-2)})_{i-1}\to (\widehat{R(n)})_{i}$ be multiplication by $x_{2n+3}$, and let\\ $\widehat{x_{2n+3}}:(\widehat{R(n)})_{i}\to (\widehat{R(n-1)})_{i}$ be defined for a basis element $b$ by \[ \widehat{x_{2n+3}}(b)=\begin{cases} b &\text{if }x_{2n+3}\nmid b\\ 0 &\text{if }x_{2n+3}\mid b. \end{cases} \] We note that these vector space maps are well-defined, since $1_k$ or a squarefree monomial with odd indices at least four apart has an output of 0, $1$, or a monomial with the same properties. The following sequence of vector spaces is exact \[ \xymatrix{0\ar[r] & (\widehat{R(n-2)})_{i-1}\ar[r]^{x_{2n+3}} & (\widehat{R(n)})_{i}\ar[r]^{\widehat{x_{2n+3}}} & (\widehat{R(n-1)})_{i}\ar[r] & 0,} \] so that \[ d_{n,i}=d_{n-1,i}+d_{n-2,i-1}. \] \end{proof} Applying Lemma~\ref{recursion} and induction, we achieve the following closed formula for the coefficients of the Hilbert series of $\widehat{R(n,t)}$. \begin{thm}\label{Hilbert Series mod reg seq} If $R(n,t)=S(n)/I_{G_n^t}$ and $\widehat{R(n,t)}\cong R(n,t)/(\overline{X_n})$, we have \begin{equation*} {\displaystyle \dim_k(\widehat{R(n,t)})_{i}=\begin{cases} 1 & i=0\\ {\displaystyle \frac{1}{i!}\prod_{j=1}^{i}(n+j-2(i-1))} & i\geq 1. \end{cases}} \end{equation*} In particular, $\dim_k(\widehat{R(n,t)})_{i}=0$ when $i>n/2+1$. \end{thm} \vspace{0.25cm} \begin{proof} We begin with the proof of the last statement, and note that throughout the following proof we use Notation~\ref{d}. When $n\geq 0$ is even, $i=n/2+2$, and $j=2(\leq i)$, we have a factor of zero, and when $n\geq 1$ is odd, $i=n/2+3/2$, and $j=1(<i)$, we have a factor of zero. Thus $d_{n,i}=0$ when $i>n/2+1$. Now we establish the base cases $i,n\in\{0,1\}$, then proceed by induction. It is clear that $d_{n,0}=1$, generated by $1_k$. By Lemma~\ref{uniquerep} and by the fact that $\widehat{R(n,t)}$ is a graded quotient, every nonzero element of positive degree $i$ can be represented uniquely as a sum of degree $i$ squarefree monomials with odd indices whose indices are at least four apart. Then $(\widehat{R(n,t)})_{1}$ is generated by the images of all the odd variables \[ x_3,x_{2(1)+3},\ldots,x_{2n+3} \] in $S(n)$, so that \[ d_{n,1}=n+1=\frac{1}{1!}\prod_{j=1}^{1}(n+j-2(1-1)) \] matches the given formula. Now we establish the base cases $n=0$ and $n=1$ for all $i$. We recognize that the first monomial of degree two with odd indices at least four apart is $x_3x_7$, which does not exist until $n=2$, so we have \begin{equation*} d_{0,i}=\begin{cases} 1 & i=0\\ 1 & i=1\\ 0 & \text{else} \end{cases} = \begin{cases} 1 & i= 0\\ {\displaystyle \frac{1}{i!}\prod_{j=1}^{i}(j-2(i-1))} & i \geq 1 \end{cases} \end{equation*} and \begin{equation*} d_{1,i}=\begin{cases} 1 & i=0\\ 2 & i=1\\ 0 & \text{else} \end{cases} = \begin{cases} 1 & i=0\\ {\displaystyle \frac{1}{i!}\prod_{j=1}^{i}(1+j-2(i-1))} & i \geq 1, \end{cases} \end{equation*} which match the given formula. This gives us the following table of base cases for $d_{n,i}$, which match the given formula: \begin{center} \begin{tabular}{|c|c|c|c|c|c|c|c|c|c|} \hline $n\setminus i$&0&1&2&3&4&5&6&7&$\cdots$\\ \hline 0&1&1&0&0&0&0&0&0&$\cdots$\\ \hline 1&1&2&0&0&0&0&0&0&$\cdots$\\ \hline 2&1&3&&&&&&&\\ \hline 3&1&4&&&&&&&\\ \hline 4&1&5&&&&&&&\\ \hline $\vdots$&$\vdots$&$\vdots$&&&&&&&\\ \hline \end{tabular} \end{center} We recall by Lemma~\ref{recursion} that we have the recursive relationship \[ d_{n,i}=d_{n-1,i}+d_{n-2,i-1} \] for $n\geq 2$ and $i\geq 1$. We proceed by induction. Suppose $N,I\geq 2$ and that the dimension formula holds for all $i$ when $n<N$. By our recursion and by induction, we have \begin{eqnarray*} d_{N,I} & = & d_{N-1,I}+d_{N-2,I-1}\\ & = & \frac{1}{I!}\prod_{j=1}^{I}(N-1+j-2(I-1))+\frac{1}{(I-1)!}\prod_{j=1}^{I-1}(N-2+j-2(I-2))\\ & = & \frac{1}{I!}(N-2(I-1))\prod_{j=1}^{I-1}(N+j-2(I-1))+\frac{1}{I!}(I)\prod_{j=1}^{I-1}(N+j-2(I-1))\\ & = & \frac{1}{I!}\prod_{j=1}^{I}(N+j-2(I-1)), \end{eqnarray*} as desired. \end{proof} \begin{rmk}\label{lengths and dim to note} We note from the proof of the theorem above a few facts for future reference. By our base cases, we have $\ell(\widehat{R(0,t)})=1+1=2$ and $\ell(\widehat{R(1,t)})=1+2=3$. Taking the Fibonacci sequence $F(n)$ with $F(0)=0$ and $F(1)=1$, we have $F(2)=1$, $F(3)=2$, and $F(4)=3$, so that \begin{eqnarray*} \ell(\widehat{R(0,t)})&=&F(3)\\ \ell(\widehat{R(1,t)})&=&F(4). \end{eqnarray*} These facts become useful in Proposition~\ref{Fibonacci}. \end{rmk} We see in the following corollary that the regularity of $R(n,t)$ is $\left \lfloor n/2\right \rfloor+1$. For an alternate proof of the regularity of $R(n,t)$ which uses different machinery and more graph-theoretic properties, see the end of this section. \begin{cor}\label{regcor} For $G_n^t\in\mathcal{F}$, \begin{equation*} \operatorname{reg} R(n,t)=\left\lfloor n/2 \right \rfloor+1. \end{equation*} \end{cor} \begin{proof} We show that $\operatorname{reg} R(n,t)$ is equal to the top nonzero degree of $\widehat{R(n,t)}$ and that this value agrees with the above. Since $\widehat{R(n,t)}$ is Artinian by Remark~\ref{art}, it is clear that $\operatorname{reg} \widehat{R(n,t)}$ is the top nonzero degree of $\widehat{R(n,t)}$. By Theorem~\ref{Hilbert Series mod reg seq}, we know the top nonzero degree is $N$ for some $N\leq n/2+1$, so that $N\leq \left \lfloor n/2\right\rfloor+1$. In fact, the top nonzero degree is $\left\lfloor n/2\right\rfloor+1$, provided $d_{n,\left \lfloor n/2\right \rfloor+1}\neq 0$. The only way we have a factor of zero in \[ d_{n, \lfloor n/2 \rfloor+1}={\displaystyle \frac{1}{(\lfloor n/2 \rfloor+1)!}\prod_{j=1}^{\lfloor n/2 \rfloor+1}(n+j-2(\lfloor n/2 \rfloor))} \] is if $n+j-2(\lfloor n/2\rfloor)=0$, which means $j/2= \lfloor n/2 \rfloor -n/2$. This can only happen when $j<1$, but $j\geq 1$, so we conclude that $d_{n,\left \lfloor n/2\right \rfloor+1}\neq 0$. Since $\widehat{R(n,t)}$ is an Artinian quotient of $R(n,t)$ by a linear regular sequence, we conclude that \[ \operatorname{reg} R(n,t)=\operatorname{reg} \widehat{R(n,t)}=\left \lfloor n/2\right \rfloor+1. \] \end{proof} In the following, we first compute the lengths of the dimension zero rings $\widehat{R(n,t)}$, and then show a closed form for the multiplicity of our original rings $R(n,t)$ by using a Fibonacci relationship between the lengths of the rings $\widehat{R(n,t)}$ and applying Binet's formula for $F(n)$, the $n$th number in the Fibonacci sequence: \[ F(n)=\frac{(1+\sqrt{5})^{n}-(1-\sqrt{5})^{n}}{2^{n}\sqrt{5}}. \] In the theorem and corollaries which follow, we suppress $t$ for convenience, since the statements are independent of $t$. \begin{prop}\label{Fibonacci} The lengths of the rings $\widehat{R(n)}$ satisfy the recursive formula \[ \ell(\widehat{R(n)})=\ell(\widehat{R(n-1)})+\ell(\widehat{R(n-2)}) \] for $n\geq 2$. Consequently, if $F(n)$ is the Fibonacci sequence, with $F(0)=0$ and $F(1)=1$, then \[ \ell(\widehat{R(n)})=F\left(n+3\right)=\frac{(1+\sqrt{5})^{n+3}-(1-\sqrt{5})^{n+3}}{2^{n+3}\sqrt{5}}. \] \end{prop} \begin{proof} Again, we use Notation~\ref{d}. By the recursive relationship from Lemma~\ref{recursion}, since $d_{n,0}=1$ in general, and since $d_{n,i}=0$ in general for $i> n/2 +1$ by Theorem~\ref{Hilbert Series mod reg seq}, we have for $n\geq 2$ that \begin{eqnarray*} \ell(\widehat{R(n)}) = \sum_{i=0}^{\left\lfloor n/2\right\rfloor +1}d_{n,i} & = & 1+\sum_{i=1}^{\left\lfloor n/2\right\rfloor +1}\left(d_{n-1,i}+d_{n-2,i-1}\right)\\ & = & \sum_{i=0}^{\left\lfloor n/2\right\rfloor +1}d_{n-1,i}+\sum_{i=0}^{\left\lfloor (n-2)/2\right\rfloor +1}d_{n-2,i}\\ & = & \ell(\widehat{R(n-1)})+\ell(\widehat{R(n-2)}). \end{eqnarray*} Now we show the second statement. For our base cases, we see from Remark~\ref{lengths and dim to note} that $\ell(\widehat{R(0)})=F(3)=F(0+3)$ and that $\ell(\widehat{R(1)})=F(4)=F(1+3)$. Now suppose that ${\displaystyle \ell(\widehat{R(n-1)})=F\left(n+2\right)}$ and ${\displaystyle \ell(\widehat{R(n-2)})=F\left(n+1\right)}$. \\ Then we have \begin{equation*} \ell(\widehat{R(n)}) = \ell(\widehat{R(n-1)})+\ell(\widehat{R(n-2)})\\ = F\left(n+3\right), \end{equation*} as desired. The closed form for $\ell(\widehat{R(n)})$ follows directly from Binet's formula for the Fibonacci sequence. \end{proof} \begin{cor} For $n\geq 2$, there is an equality of multiplicities \[ e(\widehat{R(n)})=e(\widehat{R(n-1)})+e(\widehat{R(n-2)}). \] \end{cor} \begin{proof} We have established the length of the Artinian rings $\widehat{R(n)}$, and hence the multiplicity $e(\widehat{R(n)})$. \end{proof} \pagebreak \begin{cor}\label{multcor} For $n\geq 2$, there is an equality of multiplicities \[ e(R(n))=e(R(n-1))+e(R(n-2)).\] In particular, \[e(R(n))=F\left(n+3\right)=\frac{(1+\sqrt{5})^{n+3}-(1-\sqrt{5})^{n+3}}{2^{n+3}\sqrt{5}}. \] \end{cor} \begin{proof} To obtain the multiplicity of $R(n)$, we look at $\widehat{R(n)}=R(n)/(\overline{X_n})$, which by Remark~\ref{art} and Corollary~\ref{xt} is the Artinian quotient of $R(n)$ by a linear regular sequence. By a standard result, we may calculate length along the obvious short exact sequences coming from multiplication by elements of our regular sequence to obtain the equality \[ \text{Hilb}_{R(n)}(t)(1-t)^{d}=\text{Hilb}_{\widehat{R(n)}}(t), \] where $d$ is the Krull dimension of $R(n)$. Defining multiplicity as in and preceding \cite[Thm 16.7]{Peeva2011}, it follows immediately that \[ e(R(n))=\text{Hilb}_{R(n)}(t)(1-t)^{d}\big\rvert_{t=1}=\text{Hilb}_{\widehat{R(n)}}(1)=\ell(\widehat{R(n)}). \] We are done by Proposition~\ref{Fibonacci}. \end{proof} We reintroduce $t$ and spend the remainder of this section providing an alternate \\graph-theoretic proof for the regularity of $R(n,t)$. \begin{proof}[Alternate proof of Corollary~\ref{regcor}] We show that $\operatorname{reg} R(n,t)=\left\lfloor n/2 \right \rfloor+1$ by proving that $\operatorname{reg} I_{G_n^t}=\left\lfloor n/2 \right \rfloor+2$. We first show that \[ \operatorname{reg} I_{G_n^t}\leq \left\lfloor n/2 \right \rfloor+2. \] We recall by Proposition~\ref{chordal} that the graph $G_n^t$ is chordal bipartite with vertex bipartition $V_1\cup V_2$ of cardinalities \begin{eqnarray*} |V_1| &=& \left \lfloor \frac{n}{2} \right \rfloor +2\\ |V_2| &=& \left \lceil \frac{n}{2} \right \rceil +2, \end{eqnarray*} and that $G_n^t$ does not have any vertices of degree one by Remark~\ref{graphtaurmk}. Then by Theorem 4.9 of \cite{BIERMANN2017}, we have \begin{equation*} \operatorname{reg} I_{G_n^t}\leq \min\left \{\left \lfloor \frac{n}{2} \right \rfloor +2,\left \lceil \frac{n}{2} \right \rceil +2\right \}=\left \lfloor \frac{n}{2} \right \rfloor +2. \end{equation*} \noindent We note that we may equivalently prove $\operatorname{reg} R(n,t)\leq \left \lfloor \frac{n}{2} \right \rfloor +1$ by choosing the $\left \lfloor \frac{n}{2} \right \rfloor +2$ edges whose indices are equivalent to zero modulo $4$, one from each row of $L_n^t$, to obtain an edge matching (different from an induced matching, below) and then applying \cite[Th 1]{HH20}. We now show that $\operatorname{reg} I_{G_n^t}\geq \left\lfloor n/2 \right \rfloor+2$. Since $I_{G_n^t}$ is homogeneous and $\text{in}_> I_{G_n^t}$ consists of squarefree monomials by Corollary~\ref{initial}, we have by Corollary 2.7 of \cite{conca2018squarefree} that $\operatorname{reg} \text{in}_> I_{G_n^t} = \operatorname{reg} I_{G_n^t}$, so it suffices to prove that $\operatorname{reg} \text{in}_> I_{G_n^t}\geq \left\lfloor n/2 \right \rfloor+2$. The ideal $\text{in}_> I_{G_n^t}$ can be viewed as the edge ideal of a simple graph, a ``comb” with $n+1$ tines, with consecutive odd variables corresponding to vertices along the spine, as pictured below: \begin{center} \begin{tikzpicture} \definecolor{ddpp}{rgb}{0,.4,.4} [scale=.8,every node/.style={circle,fill=none}] \node (n2) at (4,10) {$x_2$}; \node (n3) at (4,8) {$x_3$}; \node (n5) at (6,8) {$x_5$}; \node (n4) at (6,10) {$x_4$}; \node (n7) at (8,8) {$x_7$}; \node (n6) at (8,10) {$x_6$}; \node (n9) at (10,8) {$x_9$}; \node (n8) at (10,10) {$x_8$}; \node (n11) at (12,8) {$x_{11}$}; \node (n10) at (12,10) {$x_{10}$}; \node (n13) at (14,8) {$x_{2n+1}$}; \node (n12) at (14,10) {$x_{2n}$}; \node (n15) at (16,8) {$x_{2n+3}$}; \node (n14) at (16,10) {$x_{2n+2}$}; \path (n11) -- node[auto=false, fill=none]{\ldots} (n13); \foreach \from/\to in {n2/n3,n4/n5,n6/n7,n8/n9,n10/n11,n12/n13,n14/n15,n3/n5,n5/n7,n7/n9,n9/n11,n13/n15} \draw (\from) -- (\to); \end{tikzpicture} \end{center} We know from Theorem 6.5 of \cite{Tai-Ha-Van-Tuyl-2008} that the regularity of an edge ideal is bounded below by the number of edges in any induced matching plus one, so we choose $\left \lfloor{n/2}\right \rfloor+1$ edges (tines) corresponding to certain odd variables that create an induced matching. By beginning with the $x_3$-tine and choosing every other tine corresponding to the variables \begin{equation*} x_3,x_{3+4(1)},\ldots,x_{3+4(\left \lfloor{n/2}\right \rfloor)}, \end{equation*} we obtain $\left \lfloor{n/2}\right \rfloor+1$ edges that are an induced matching, so we have \[ \operatorname{reg}\text{in}_> I_{G_n^t}\geq \left \lfloor{n/2}\right \rfloor +2, \] as desired. We conclude that $\operatorname{reg} I_{G_n^t}= \left\lfloor n/2 \right \rfloor+2$, and hence that $\operatorname{reg} R(n,t)=\left\lfloor n/2 \right \rfloor+1.$ \end{proof} \newpage \bibliographystyle{abbrv}
\section{Introduction}\label{sec:introduction} \vspace{-0.01\textheight} Gradient-based optimization has been critical for the success of machine learning, updating a single set of parameters to minimize a single loss. A growing number of applications require learning in games, which generalize single-objective optimization. Common examples are GANs~\citep{goodfellow2014generative}, actor-critic models~\citep{pfau2016connecting}, curriculum learning~\citep{baker2019emergent, balduzzi2019open, sukhbaatar2017intrinsic}, hyperparameter optimization~\citep{lorraine2018stochastic, lorraine2019optimizing, mackay2019self, raghu2020teaching}, adversarial examples~\citep{bose2020adversarial, yuan2019adversarial}, learning models~\citep{rajeswaran2020game, abachi2020policy, baconlagrangian}, domain adversarial adaptation~\citep{acuna2021fdomainadversarial}, neural architecture search~\citep{grathwohl2018gradient, adam2019understanding}, and meta-learning~\citep{ren2018meta, ren2020flexible}. Games consist of multiple players, each with parameters and objectives. We often want solutions where no player gains from changing their strategy unilaterally, e.g., Nash equilibria~\citep{morgenstern1953theory} or Stackelberg equilibria~\citep{von2010market}. Classical gradient-based learning often fails to find these equilibria due to rotational dynamics~\citep{berard2019closer}. % Numerous saddle point finding algorithms for zero-sum games have been proposed~\citep{arrow1958studies, freund1999adaptive}. \citet{gidel2018negative} generalizes GD with momentum to games, showing we can use a negative momentum to converge if the eigenvalues of the Jacobian of the gradient vector field have a large imaginary part. We use the terminology in \citet{gidel2018negative} and say \textit{(purely) cooperative or adversarial games} for games with (purely) real or imaginary eigenvalues. Setups like GANs are not purely adversarial, but rather have both \emph{purely cooperative and adversarial eigenspaces} -- i.e., eigenspaces with purely real or imaginary eigenvalues. In cooperative eigenspaces, the players do not interfere with each other. We want solutions that converge with simultaneous and alternating updates in purely adversarial games -- a setup where existing momentum methods fail. Also, we want solutions that are robust to different mixtures of adversarial and cooperative eigenspaces, because this depends on the games eigendecomposition which can be intractable. To solve this we unify and generalize existing momentum methods~\citep{lucas2018aggregated, gidel2018negative} to recurrently linked momentum -- a setup with multiple recurrently linked momentum buffers with potentially negative coefficients shown in Figure~\ref{fig:recurrent_comp_graph}. We show that selecting two of these recurrently linked buffers with appropriate momentum coefficients can be interpreted as the real and imaginary parts of a single \emph{complex buffer} and complex momentum coefficient -- see Figure~\ref{fig:cm_comp_graph}. This setup (a) allows us to converge in adversarial games with simultaneous updates, (b) only introduces one new optimizer parameter -- the phase or $\arg$ of our momentum, (c) allows us to gain intuitions via complex analysis, (d) is trivial to implement in libraries supporting complex arithmetic, and (e) robustly converges for different eigenspace mixtures. Intuitively, our complex buffer stores historical gradient information, oscillating between adding or subtracting at a frequency dictated by the momentum coefficient. Classical momentum only adds gradients, and negative momentum changes between adding or subtracting each iteration, while we oscillate at an arbitrary (fixed) frequency -- see Figure~\ref{fig:frequency_vis}. This reduces rotational dynamics during training by canceling out opposing updates. \vspace{-0.00\textheight} \subsection*{Contributions}\label{subsec:contributions} \begin{itemize} \item We provide generalizations and variants of classical~\citep{polyak1964some, nesterov1983method, sutskever2013importance}, negative~\citep{gidel2018negative, zhang2020suboptimality}, and aggregated~\citep{lucas2018aggregated} momentum for learning in differentiable games. \item We show our methods converges on adversarial games -- including bilinear zero-sum games and the Dirac-GAN -- with simultaneous and alternating updates. \item We illustrate a robustness during optimization, converging faster and over a larger range of mixtures of cooperative and adversarial games than existing first-order methods. \item We give a practical extension of our method to a complex-valued Adam~\citep{kingma2014adam} variant, which we use to train a BigGAN~\citep{brock2018large} on CIFAR-10, improving \citep{brock2018large}'s inception scores. \vspace{-0.005\textheight} \end{itemize} \begin{wrapfigure}[20]{R}{.56\textwidth} \centering \begin{minipage}{.55\textwidth} \centering \vspace{-0.045\textheight} \lstset{ language=Python, basicstyle=\footnotesize\ttfamily, alsoletter={., +}, keywords=[2]{jnp.real, .3j}, keywordstyle=[2]{\color{green!80!black}} } \textbf{Actual JAX implementation: changes in {\color{green}green}}\par\medskip \vspace{-0.015\textheight} \captionsetup{type=figure} \begin{lstlisting} mass = .8 + .3j def momentum(step_size, mass): ... def update(i, g, state): x, velocity = state velocity = mass * velocity + g x=x-jnp.real(step_size(i)*velocity) return x, velocity ... \end{lstlisting} % \end{minipage} \vspace{-0.02\textheight} \hspace{1cm} \caption{ How to modify JAX's \ref{eq:single_objective_gd} with momentum \href{https://jax.readthedocs.io/en/latest/_modules/jax/experimental/optimizers.html}{{\color{blue}here}} to use complex momentum. The only changes are in {\color{green}green}. $\texttt{jnp.real}$ gets the real part of \texttt{step\_size} times the momentum buffer (called $\texttt{velocity}$ here). We use a complex \texttt{mass} for our method in this case $\beta = |\beta|\exp(i\arg(\beta)) = \num{0.9}\exp(i\nicefrac{\pi}{\num{8}}) \approx .8 + .3 i$. } \label{fig:jax_code_change} \end{wrapfigure} \vspace{-0.01\textheight} \section{Background}\label{sec:background} \vspace{-0.01\textheight} Appendix Table~\ref{tab:TableOfNotation} summarizes our notation. Consider the optimization problem: \begin{equation}\label{eq:single_objective_opt} \boldsymbol{\theta}^{*} \vcentcolon= \textnormal{arg\,min}_{\boldsymbol{\theta}} \loss(\boldsymbol{\theta}) \end{equation} % We can find local minima of loss $\loss$ using (stochastic) gradient descent with step size $\alpha$. We denote the loss gradient at parameters $\boldsymbol{\theta}^{j}$ by $\boldsymbol{g}^j \!\!\vcentcolon=\!\! \boldsymbol{g}(\boldsymbol{\theta}^j) \!\!\vcentcolon=\!\! \smash{\left. \nabla_{\boldsymbol{\theta}} \loss(\boldsymbol{\theta}) \right|_{\boldsymbol{\theta}^{j}}}$. % \begin{equation}\label{eq:single_objective_gd}\tag{SGD} \smash{\boldsymbol{\theta}^{j\!+\!1} = \boldsymbol{\theta}^{j} - \alpha \boldsymbol{g}^j} \end{equation} % Momentum can generalize \ref{eq:single_objective_gd}. For example, Polyak's Heavy Ball~\citep{polyak1964some}: % \begin{align}\label{eq:single_objective_polyak \smash{\boldsymbol{\theta}^{j\!+\!1} = \boldsymbol{\theta}^{j} - \alpha \boldsymbol{g}^j + \beta (\boldsymbol{\theta}^{j} - \boldsymbol{\theta}^{j-1})} \end{align} Which can be equivalently written with momentum buffer $\smash{\boldsymbol{\mu}^{j} = \nicefrac{(\boldsymbol{\theta}^{j} - \boldsymbol{\theta}^{j-1})}{\alpha}}$. % \begin{equation}\label{eq:single_objective_sgdm}\tag{SGDm} \smash{\boldsymbol{\mu}^{j\!+\!1} = \beta \boldsymbol{\mu}^{j} - \boldsymbol{g}^j,\quad\quad \boldsymbol{\theta}^{j\!+\!1} = \boldsymbol{\theta}^{j} + \alpha \boldsymbol{\mu}^{j\!+\!1}} \end{equation} We can also generalize \ref{eq:single_objective_sgdm} to aggregated momentum~\citep{lucas2018aggregated}, shown in Appendix Algorithm~\ref{alg:aggmo}. % \vspace{-0.01\textheight} \subsection{Game Formulations} Another class of problems is learning in \textit{games}, which includes problems like generative adversarial networks (GANs)~\citep{goodfellow2014generative}. We focus on $\num{2}$-player games ---with players denoted by $A$ and $B$---where each player minimizes their loss $\loss_A, \loss_B$ with their parameters $\boldsymbol{\theta}_A \in \mathbb{R}^{d_{A}}$, $\boldsymbol{\theta}_B \in \mathbb{R}^{d_{B}}$\!\!. Solutions to \num{2}-player games -- which are assumed unique for simplicity -- can be defined as: % \begin{align}\label{eq:nash_equilibrium} \smash{\paramSymbol_{\!\outSymbol}^{*} \!\vcentcolon=\! \textnormal{arg\,min}_{\paramSymbol_{\!\outSymbol}}\! \loss_{\!\outSymbol}(\paramSymbol_{\!\outSymbol},\! \paramSymbol_{\!\inSymbol}^{*}),\,\,\,\,\, \paramSymbol_{\!\inSymbol}^{*} \!\vcentcolon=\! \textnormal{arg\,min}_{\paramSymbol_{\!\inSymbol}}\! \loss_{\!\inSymbol}(\paramSymbol_{\!\outSymbol}^{*},\! \paramSymbol_{\!\inSymbol})} \end{align} % In deep learning, losses are non-convex with many parameters, so we often focus on finding local solutions. If we have a player ordering, then we have a Stackelberg game. For example, in GANs, the generator is the leader, and the discriminator is the follower. In hyperparameter optimization, the hyperparameters are the leader, and the network parameters are the follower. If \smash{$\paramSymbol_{\!\inSymbol}^*(\paramSymbol_{\!\outSymbol})$} denotes player $B$'s best-response function, then Stackelberg game solutions can be defined as: % \begin{align}\label{eq:stackelberg_equilibrium} \begin{smash} \paramSymbol_{\!\outSymbol}^{*} \!\vcentcolon= \textnormal{arg\,min}_{\paramSymbol_{\!\outSymbol}}\! \loss_{\!\outSymbol}(\paramSymbol_{\!\outSymbol},\! \paramSymbol_{\!\inSymbol}^{*}(\paramSymbol_{\!\outSymbol})),\,\,\,\,\, \paramSymbol_{\!\inSymbol}^{*}(\paramSymbol_{\!\outSymbol}) \!\vcentcolon= \textnormal{arg\,min}_{\paramSymbol_{\!\inSymbol}}\! \loss_{\!\inSymbol}(\paramSymbol_{\!\outSymbol},\! \paramSymbol_{\!\inSymbol}) \end{smash} \end{align} % If $\loss_{\!\outSymbol}$ and $\loss_{\!\inSymbol}$ are differentiable in $\paramSymbol_{\!\outSymbol}$ and $\paramSymbol_{\!\inSymbol}$ we say the game is differentiable. We may be able to approximately find \smash{$\paramSymbol_{\!\outSymbol}^{*}$} efficiently if we can do \ref{eq:single_objective_gd} on: \begin{equation} \loss_{\!\outSymbol}^*(\paramSymbol_{\!\outSymbol}) \vcentcolon= \loss_{\!\outSymbol}(\paramSymbol_{\!\outSymbol}, \paramSymbol_{\!\inSymbol}^{*}(\paramSymbol_{\!\outSymbol})) \end{equation} % Unfortunately, SGD would require computing $\nicefrac{d \loss_{\!\outSymbol}^*}{d \paramSymbol_{\!\outSymbol}}$, which often requires $\nicefrac{d \paramSymbol_{\!\inSymbol}^{*}}{d \paramSymbol_{\!\outSymbol}}$, but \smash{$\paramSymbol_{\!\inSymbol}^{*}(\paramSymbol_{\!\outSymbol})$} and its Jacobian are typically intractable. A common optimization algorithm to analyze for finding solutions is simultaneous SGD (\ref{eq:multi_objective_gd_long}) -- sometimes called gradient descent ascent for zero-sum games -- where \smash{$\gradSymbol_{\!\outSymbol}^j \vcentcolon= \gradSymbol_{\!\outSymbol}(\paramSymbol_{\!\outSymbol}^j, \paramSymbol_{\!\inSymbol}^j)$} and \smash{$\gradSymbol_{\!\inSymbol}^j \vcentcolon= \gradSymbol_{\!\inSymbol}(\paramSymbol_{\!\outSymbol}^j, \paramSymbol_{\!\inSymbol}^j)$} are estimators for \smash{$\left. \smash{\nabla_{\paramSymbol_{\!\outSymbol}}} \loss_{\!\outSymbol}\right|_{\paramSymbol_{\!\outSymbol}^j, \paramSymbol_{\!\inSymbol}^j}$ and $\left. \smash{\nabla_{\paramSymbol_{\!\inSymbol}} \loss_{\!\inSymbol}} \right|_{\paramSymbol_{\!\outSymbol}^j, \paramSymbol_{\!\inSymbol}^j}$}: % \begin{align}\label{eq:multi_objective_gd_long}\tag{SimSGD} \smash{ \paramSymbol_{\!\outSymbol}^{j\!+\!1} = \paramSymbol_{\!\outSymbol}^{j} - \alpha \gradSymbol_{\!\outSymbol}^j,\quad \paramSymbol_{\!\inSymbol}^{j\!+\!1} = \paramSymbol_{\!\inSymbol}^{j} - \alpha \gradSymbol_{\!\inSymbol}^j } \end{align} % We simplify notation with the concatenated or joint-parameters $\smash{\boldsymbol{\omega} \!\vcentcolon=\! [\paramSymbol_{\!\outSymbol}, \paramSymbol_{\!\inSymbol}] \!\in\! \mathbb{R}^{\dimSymbol}}$ and the joint-gradient vector field $\hat{\gradSymbol}: \mathbb{R}^{\dimSymbol} \to \mathbb{R}^{\dimSymbol}$, which at the $j^{th}$ iteration is the joint-gradient denoted: \begin{equation} \hat{\gradSymbol}^j \vcentcolon= \hat{\gradSymbol}(\boldsymbol{\omega}^j) \vcentcolon= [\gradSymbol_{\!\outSymbol}(\boldsymbol{\omega}^j), \gradSymbol_{\!\inSymbol}(\boldsymbol{\omega}^j)] = [\gradSymbol_{\!\outSymbol}^j, \gradSymbol_{\!\inSymbol}^j] \end{equation} We extend to $n$-player games by treating $\boldsymbol{\omega}$ and $\hat{\gradSymbol}$ as concatenations of the players' parameters and loss gradients, allowing for a concise expression of the \ref{eq:multi_objective_gd_long} update with momentum (\ref{eq:multi_objective_sgdm}): % \begin{align}\label{eq:multi_objective_sgdm}\tag{SimSGDm} \smash{ \boldsymbol{\mu}^{j\!+\!1} = \beta \boldsymbol{\mu}^{j} - \hat{\gradSymbol}^j,\quad\quad \boldsymbol{\omega}^{j\!+\!1} = \boldsymbol{\omega}^{j} + \alpha \boldsymbol{\mu}^{j\!+\!1} } \end{align} % \begin{wrapfigure}{r}{.52\textwidth} \vspace{-0.02\textheight} \end{wrapfigure} \citet{gidel2018negative} show classical momentum choices of $\beta \in [\num{0}, \num{1})$ do not improve solution speed over \ref{eq:multi_objective_gd_long} in some games, while negative momentum helps if the Jacobian of the joint-gradient vector field $\nabla_{\boldsymbol{\omega}} \hat{\gradSymbol}$ has complex eigenvalues. Thus, for purely adversarial games with imaginary eigenvalues, any non-negative momentum and step size will not converge. For cooperative games -- i.e., minimization -- $\nabla_{\boldsymbol{\omega}} \hat{\gradSymbol}$ has strictly real eigenvalues because it is a losses Hessian, so classical momentum works well. % % \begin{figure}[b \vspace{-0.025\textheight} \centering \begin{subfigure}{.16\linewidth} \begin{tikzpicture}[ > = stealth, shorten > = 1pt, auto, node distance = 1.8cm, semithick ] \tikzstyle{state}=[ draw = black, thick, fill = white, minimum size = 4mm ] \node[state] (gNext) {gradient}; \node[state] (more) [yshift=.6cm, below of=gNext] {$\boldsymbol{\mu}$}; \node[state] (wNext) [yshift=.6cm, below of=more] {update}; \path[->] (gNext) edge node [xshift=-0cm,]{} (more) (more) edge node [xshift=0cm, yshift=0cm]{$\alpha$} (wNext) edge[loop left] node {$\beta$} (re) ; \end{tikzpicture} \caption{Classical~\citep{polyak1964some}} \end{subfigure} \begin{subfigure}{.27\linewidth} \begin{tikzpicture}[ > = stealth, shorten > = 1pt, auto, node distance = 1.8cm, semithick ] \tikzstyle{state}=[ draw = black, thick, fill = white, minimum size = 4mm ] \node[state] (gNext) {gradient}; \node[state] (re) [below left of=gNext] {$\boldsymbol{\mu}_{(1)}$}; \node[state] (more) [xshift=-.55cm, right of=re] {\dots}; \node[state] (im) [below right of=gNext] {$\boldsymbol{\mu}_{(n)}$}; \node[state] (wNext) [below right of=re] {update}; \path[->] (re) edge node [xshift=-.7cm, yshift=-.45cm]{$\alpha_{(1)}$} (wNext) edge[loop above] node {$\beta_{(1)}$} (re) (im) edge node {$\alpha_{(n)}$} (wNext) edge[loop above] node {$\beta_{(n)}$} (im) (gNext) edge node [xshift=-.6cm, yshift=.65cm]{} (re) edge node [xshift=-.2cm,]{} (im) edge node [xshift=-0cm,]{} (more) (more) edge node [xshift=0cm, yshift=-.25cm]{} (wNext) edge[loop right] node [xshift=0cm]{} (re) ; \end{tikzpicture} \caption{Aggregated~\citep{lucas2018aggregated}} \label{fig:aggmo_comp_graph} \end{subfigure} \begin{subfigure}{.27\linewidth} \begin{tikzpicture}[ > = stealth, shorten > = 1pt, auto, node distance = 1.8cm, semithick ] \tikzstyle{state}=[ draw = black, thick, fill = white, minimum size = 4mm ] \node[state] (gNext) {gradient}; \node[state] (re) [below left of=gNext] {$\boldsymbol{\mu}_{(1)}$}; \node[state] (im) [below right of=gNext] {$\boldsymbol{\mu}_{(2)}$}; \node[state] (wNext) [below right of=re] {update}; \path[->] (re) edge[bend left] node [yshift=-.1cm]{$\beta_{(1,2)}$} (im) edge node [xshift=-.7cm, yshift=-.45cm]{$\alpha_{(1)}$} (wNext) edge[loop above] node {$\beta_{(1,1)}$} (re) (im) edge[bend left] node [xshift=0cm, yshift=.65cm]{$\beta_{(2,1)}$} (re) edge node {$\alpha_{(2)}$} (wNext) edge[loop above] node {$\beta_{(2,2)}$} (im) (gNext) edge node [xshift=-.6cm, yshift=.65cm]{} (re) edge node [xshift=-.2cm,]{} (im) ; \end{tikzpicture} \caption{Recurrently linked (new)} \label{fig:recurrent_comp_graph} \end{subfigure} \begin{subfigure}{.27\linewidth} \begin{tikzpicture}[ > = stealth, shorten > = 1pt, auto, node distance = 1.8cm, semithick ] \tikzstyle{state}=[ draw = black, thick, fill = white, minimum size = 4mm ] \node[state] (gNext) {gradient}; \node[state] (re) [below left of=gNext] {$\Re(\boldsymbol{\mu}$)}; \node[state] (im) [below right of=gNext] {$\Im(\boldsymbol{\mu}$)}; \node[state] (wNext) [below right of=re] {update}; \path[->] (re) edge[bend left] node [yshift=-.1cm]{${\color{red}\Im(\beta)}$} (im) edge node [xshift=-.5cm, yshift=-.45cm]{$\alpha$} (wNext) edge[loop above] node {{\color{blue}$\Re(\beta)$}} (re) (im) edge[bend left] node [xshift=0cm, yshift=.65cm]{$-{\color{red}\Im(\beta)}$} (re) edge[loop above] node {{\color{blue}$\Re(\beta)$}} (im) (gNext) edge node {} (re) ; \end{tikzpicture} \caption{Complex (ours)} \label{fig:cm_comp_graph} \end{subfigure} \vspace{-0.005\textheight} \caption{ \new{ We show computational diagrams for momentum variants simultaneously updating all players parameters, which update the momentum buffers $\boldsymbol{\mu}$ at iteration $j\!+\!1$ with coefficient $\beta$ via \smash{$\boldsymbol{\mu}^{j\!+\!1} \!=\! (\beta \boldsymbol{\mu}^{j} - $gradient$)$}. Our parameter update is a linear combination of the momentum buffers weighted by step sizes $\alpha$. \emph{(a)} Classical momentum~\citep{polyak1964some, sutskever2013importance}, with a single buffer and coefficient $\beta \in [0, 1)$. \emph{(b)} Aggregated momentum~\citep{lucas2018aggregated} which adds multiple buffers with different coefficients. \emph{(c)} Recurrently linked momentum, which adds cross-buffer coefficients and updates the buffers with \smash{$\boldsymbol{\mu}_{(k)}^{j+1} \!=\! (\sum_l \beta_{(l, k)}\boldsymbol{\mu}_{(l)}^{j} - $gradient$)$}. We allow $\beta_{(l, k)}$ to be negative like negative momentum~\citep{gidel2018negative} for solutions with simultaneous updates in adversarial games. \emph{(d)} Complex momentum is a special case of recurrently linked momentum with two buffers and \smash{${\color{blue}\beta_{(1,1)}}\!=\!{\color{blue}\beta_{(2,2)}} \!=\! {\color{blue}\Re(\beta)}$, ${\color{red}\beta_{(1,2)}} \!=\! -{\color{red}\beta_{(2,1)}} \!=\! {\color{red}\Im(\beta)}$}. Analyzing other recurrently linked momentum setups is an open problem. } }\label{fig:scalar_complex} \end{figure} \new{ \vspace{-0.0145\textheight} \subsection{Limitations of Existing Methods}\label{sec:limitation_existing} \vspace{-0.0125\textheight} \textbf{Higher-order:} Methods using higher-order gradients are often harder to parallelize across GPUs,~\citep{osawa2019large}, get attracted to bad saddle points~\citep{mescheder2017numerics}, require estimators for inverse Hessians~\citep{schafer2019competitive, wang2019solving}, are complicated to implement, have numerous optimizer parameters, and can be more expensive in iteration and memory cost~\citep{hemmat2020lead, wang2019solving, schafer2019competitive, schafer2020competitive, czarnecki2020real, zhang2020newton}. Instead, we focus on first-order methods. \textbf{First-order:} Some first-order methods such as extragradient~\citep{korpelevich1976extragradient} require a second, costly, gradient evaluation per step. Similarly, methods alternating player updates are bottlenecked by waiting until after the first player's gradient is used to evaluate the second player's gradient. But, many deep learning setups can parallelize computation of both players' gradients, making alternating updates effectively cost another gradient evaluation. We want a method which updates with the effective cost of one gradient evaluation. Also, simultaneous updates are a standard choice in some settings~\citep{acuna2021fdomainadversarial}. \textbf{Robust convergence:} We want our method to converge in purely adversarial game's with simultaneous updates -- a setup where existing momentum methods fail~\citep{gidel2018negative}. Furthermore, computing a games eigendecomposition is often infeasibly expensive, so we want methods that robustly converge over different mixtures of adversarial and cooperative eigenspaces. We are particularly interested in eigenspace mixtures that that are relevant during GAN training -- see Figure~\ref{fig:gan_spectrum_main} and Appendix Figure~\ref{fig:gan_decomp}. \vspace{-0.0145\textheight} \subsection{Coming up with our Method} \vspace{-0.0125\textheight} \textbf{Combining existing methods:} Given the preceding limitations, we would like a robust first-order method using a single, simultaneous gradient evaluation. We looked at combining aggregated~\citep{lucas2018aggregated} with negative~\citep{gidel2018negative} momentum by allowing negative coefficients, because these methods are first-order and use a single gradient evaluation -- see Figure~\ref{fig:aggmo_comp_graph}. Also, aggregated momentum provides robustness during optimization by converging quickly on problems with wide range of conditioning, while negative momentum works in adversarial setups. We hoped to combine their benefits, gaining robustness to different mixtures of adversarial and cooperative eigenspaces. However, with this setup we could not find solutions that converge with simultaneous updates in purely adversarial games. \textbf{Generalize to allow solutions:} We generalized the setup to allow recurrent connections between momentum buffers, with potentially negative coefficients -- see Figure~\ref{fig:recurrent_comp_graph} and Appendix Algorithm~\ref{alg:recurrent_momentum}. There are optimizer parameters so this converges with simultaneous updates in purely adversarial games, while being first-order with a single gradient evaluation -- see Corollary~\ref{thm:theorem_existence}. However, in general, this setup could introduce many optimizer parameters, have unintuitive behavior, and not be amenable to analysis. So, we choose a special case of this method to help solve these problems. \textbf{A simple solution:} With two momentum buffers and correctly chosen recurrent weights, we can interpret our buffers as the real and imaginary part of one complex buffer -- see Figure~\ref{fig:cm_comp_graph}. This method is (a) capable of converging in purely adversarial games with simultaneous updates -- Corollary~\ref{thm:theorem_existence}, (b) only introduces one new optimizer parameter -- the phase of the momentum coefficient, (c) is tractable to analyze and have intuitions for with Euler's formula -- ex., Eq. (\ref{eq:polar_complex_update}), (d) is trivial to implement in libraries supporting complex arithmetic -- see Figure~\ref{fig:jax_code_change}, and (e) can be robust to games with different mixtures of cooperative and adversarial eigenspaces -- see Figure~\ref{fig:partial_coop_phases}. % % % } \begin{figure}[b \vspace{-0.04\textheight} \centering \begin{tikzpicture} \centering \node (img1){\includegraphics[trim={.1cm 1.cm 1.0cm .35cm},clip,width=.47\linewidth]{images/bilinear/theory_trajectories_limited.png}}; \node[left=of img1, rotate=90, node distance=0cm, xshift=.9cm, yshift=-.9cm, font=\color{black}] {Discriminator}; \node[below=of img1, node distance=0cm, xshift=-.7cm, yshift=1.2cm,font=\color{black}] {Generator}; \node[right=of img1, rotate=270, node distance=0cm, xshift=-1.8cm, yshift=-1.25cm, font=\color{black}] {Norm of joint-gradient $\|\hat{\gradSymbol}\|$}; \node (img3)[right=of img1, node distance=0cm, xshift=-.75cm, yshift=-.2cm, font=\color{black}]{\includegraphics[trim={.8cm .8cm .25cm .2cm},clip,width=.45\linewidth]{images/bilinear/theory_norms.pdf}}; \node[left=of img3, rotate=90, node distance=0cm, xshift=1.75cm, yshift=-1cm, font=\color{black}] {Distance to optimum}; \node[below=of img3, node distance=0cm, xshift=.15cm, yshift=1.25cm,font=\color{black}] {Iterations}; \end{tikzpicture} \vspace{-0.02\textheight} \caption{ Complex momentum helps correct rotational dynamics when training a Dirac-GAN~\citep{mescheder2018training}. \emph{Left:} Parameter trajectories with step size $\alpha \!=\! 0.1$ and momentum $\beta \!=\! 0.9 \exp(i \nicefrac{\pi}{8})$. We include the classical, real and positive momentum which diverges for any step size. \emph{Right:} The distance from optimum, which has a linear convergence rate matching our prediction with Theorem~\ref{thm:theorem} and (\ref{eq:spectrum_desired}). } \label{fig:trajectories_limited} \vspace{-0.01\textheight} \end{figure} % % % \vspace{-0.0125\textheight} \section{Complex Momentum}\label{sec:theory} \vspace{-0.0125\textheight} We describe our proposed method, where the momentum coefficient $\beta \in \mathbb{C}$, step size $\alpha \in \mathbb{R}$, momentum buffer $\boldsymbol{\mu} \in \mathbb{C}^{\dimSymbol}$, and player parameters $\boldsymbol{\omega} \in \mathbb{R}^{\dimSymbol}$. The simultaneous (or Jacobi) update is: \vspace{-0.005\textheight} \newcommand{\boldsymbol{h}}{\boldsymbol{h}} \begin{align*}\label{eq:simul_update}\tag{SimCM} \smash{ \boldsymbol{\mu}^{j\!+\!1} = \beta \boldsymbol{\mu}^{j} - \hat{\gradSymbol}^j,\,\,\,\,\, \boldsymbol{\omega}^{j\!+\!1} = \boldsymbol{\omega}^j + \Re(\alpha \boldsymbol{\mu}^{j\!+\!1} } \end{align*} % There are many ways to get a real-valued update from $\boldsymbol{\mu} \in \mathbb{C}$, but we only consider updates equivalent to classical momentum when $\beta \in \mathbb{R}$. Specifically, we simply update the parameters using the real component of the momentum: $\Re(\boldsymbol{\mu})$. % \begin{wrapfigure}{r}{0.35\linewidth \vspace{-0.04\textheight} \begin{minipage}{0.35\textwidth} \begin{algorithm}[H] \caption{(\ref{eq:simul_update}) Momentum} \label{alg:simultaneous_complex} \begin{algorithmic}[1] \State $\smash{\beta, \alpha \in \mathbb{C}, \boldsymbol{\mu} \in \mathbb{C}^{\dimSymbol}, \boldsymbol{\omega}^{\num{0}} \in \mathbb{R}^{\dimSymbol}}$ \For{$i = \num{1} \dots N$ $\vphantom{\gradSymbol_{\!\outSymbol}^j}$} \State $\smash{\boldsymbol{\mu}^{j\!+\!1} \!=\! \beta \boldsymbol{\mu}^j \!-\! \hat{\gradSymbol}^j}$ \State $\boldsymbol{\omega}^{j\!+\!1} \!=\! \boldsymbol{\omega}^{j} \!+\! \Re(\alpha \boldsymbol{\mu}^{j\!+\!1})$ \EndFor \Return $\boldsymbol{\omega}^N$ \end{algorithmic} \end{algorithm} \end{minipage} \vspace{-0.04\textheight} \end{wrapfigure} We show the \ref{eq:simul_update} update in Algorithm~\ref{alg:simultaneous_complex} and visualize it in Figure~\ref{fig:cm_comp_graph}. We also show the alternating (or Gauss-Seidel) update, which is common for GAN training: % \begin{align*}\label{eq:alt_update}\tag{AltCM} \boldsymbol{\mu}^{j\!+\!1}_{A} \!&=\! \beta \boldsymbol{\mu}^{j}_{A} \!-\! \hat{\gradSymbol}_{A}(\boldsymbol{\omega}^j\!) \paramSymbol_{\!\outSymbol}^{j\!+\!1} \!=\! \paramSymbol_{\!\outSymbol}^j \!+\! \Re(\alpha \boldsymbol{\mu}^{j\!+\!1}_{A}\!)\\ \boldsymbol{\mu}^{j\!+\!1}_{B} \!&=\! \beta \boldsymbol{\mu}^{j}_{B} \!-\! \hat{\gradSymbol}_{B}(\paramSymbol_{\!\outSymbol}^{j\!+\!1}\!\!, \paramSymbol_{\!\inSymbol}^{j}\!), \paramSymbol_{\!\inSymbol}^{j\!+\!1} \!=\! \paramSymbol_{\!\inSymbol}^j \!+\! \Re(\alpha \boldsymbol{\mu}^{j\!+\!1}_{B}\!) \end{align*} \paragraph{Generalizing negative momentum:} Consider the negative momentum from \citet{gidel2018negative}: $\boldsymbol{\omega}^{j\!+\!1} = \boldsymbol{\omega}^j - \alpha \hat{\gradSymbol}^j + \beta (\boldsymbol{\omega}^j - \boldsymbol{\omega}^{j-1})$. % Expanding (\ref{eq:simul_update}) with $\boldsymbol{\mu}^j = \nicefrac{(\boldsymbol{\omega}^j - \boldsymbol{\omega}^{j-1})}{\alpha}$ for real momentum shows the negative momentum method of \citet{gidel2018negative} is a special case of our method: \begin{align} \boldsymbol{\omega}^{j\!+\!1} = \boldsymbol{\omega}^j + \Re(\alpha (\beta\nicefrac{(\boldsymbol{\omega}^j - \boldsymbol{\omega}^{j-1})}{\alpha} - \hat{\gradSymbol}^j)) = \boldsymbol{\omega}^j - \alpha \hat{\gradSymbol}^j + \beta (\boldsymbol{\omega}^j - \boldsymbol{\omega}^{j-1}) \end{align} % \vspace{-0.0125\textheight} \subsection{Dynamics of Complex Momentum}\label{sec:dynamics} \vspace{-0.0125\textheight} For simplicity, we assume Numpy-style~\citep{numpy} component-wise broadcasting for operations like taking the real-part $\Re(\boldsymbol{z})$ of vector $\boldsymbol{z} = [z_1, \dots, z_n] \in \mathbb{C}^{n}$, with proofs in the Appendix. \new{ Expanding the buffer updates with the polar components of $\beta$ gives intuition for complex momentum: \begin{align}\label{eq:polar_complex_update} \begin{split} \vphantom{A^{A^{A^{A}}}} \boldsymbol{\mu}^{j\!+\!1} \!=\! \beta \boldsymbol{\mu}^{j} - \hat{\gradSymbol}^j &\iff \boldsymbol{\mu}^{j\!+\!1} \!=\! \beta (\beta (\cdots) - \hat{\gradSymbol}^{j-1}) - \hat{\gradSymbol}^j \iff \boldsymbol{\mu}^{j\!+\!1} \!=\! \smash{-\sum_{k=0}^{k=j}\beta^{k}\hat{\gradSymbol}^{j-k}} \iff\\ \Re(\boldsymbol{\mu}^{j\!+\!1}) \!=\! -&\sum_{k=0}^{k=j}|\beta|^{k} \cos(k \arg(\beta))\hat{\gradSymbol}^{j-k},\,\,\,\,\, \Im(\boldsymbol{\mu}^{j\!+\!1}) \!=\! -\sum_{k=0}^{k=j}|\beta|^{k} \sin(k \arg(\beta))\hat{\gradSymbol}^{j-k} \end{split} \end{align} The final line is simply by Euler's formula (\ref{eq:euler_formula}). From (\ref{eq:polar_complex_update}) we can see $\beta$ controls the momentum buffer $\boldsymbol{\mu}$ by having $|\beta|$ dictate prior gradient decay rates, while $\arg(\beta)$ controls oscillation frequency between adding and subtracting prior gradients, which we visualize in Figure~\ref{fig:frequency_vis}. } \begin{figure \vspace{-0.065\textheight} \centering \begin{subfigure}{.43\textwidth} \begin{tikzpicture} \centering \node (img1){\includegraphics[trim={1.0cm .6cm .97cm .9cm},clip,width=.89\linewidth]{images/complex_momentum_frequency_vis.pdf}}; \node[left=of img1, node distance=0cm, rotate=90, xshift=2.0cm, yshift=-.8cm, font=\color{black}] {Dependence on gradient $k$} \node[below=of img1, node distance=0cm, xshift=-.1cm, yshift=1.2cm,font=\color{black}] {Iteration $k$}; \end{tikzpicture} \vspace{-0.02\textheight} \newsubcap{ \new{ We show the real part of our momentum buffer -- which dictates the parameter update -- at the $50^{th}$ iteration $\Re(\boldsymbol{\mu}^{50})$ dependence on past gradients $\hat{\gradSymbol}^{k}$ for $k \!=\! 1 \dots 50$. The momentum magnitude is fixed to $| \beta| \!=\! \num{.9}$ as in Figure~\ref{fig:trajectories_limited}. Euler's formula is used in (\ref{eq:polar_complex_update}) to for finding dependence or coefficient of $\hat{\gradSymbol}^{k}$ via $\Re(\boldsymbol{\mu}^{50}) \!=\! -\sum_{k=0}^{k=50}|\beta|^{k} \cos(k \arg(\beta))\hat{\gradSymbol}^{j-k}$. Complex momentum allows smooth changes in the buffers dependence on past gradients. } } \label{fig:frequency_vis} \end{subfigure} \hspace{0.01\textwidth} \begin{subfigure}{.54\textwidth} \begin{tikzpicture} \centering \node (img1){\includegraphics[trim={1.0cm .9cm .97cm .9cm},clip,width=.87\linewidth]{images/bilinear/ExpAvg_Simul_Deterministic_beta_tune.png}}; \node[left=of img1, node distance=0cm, rotate=90, xshift=2.0cm, yshift=-.9cm, font=\color{black}] {Momentum phase $\arg(\beta)$}; \node[below=of img1, node distance=0cm, xshift=-.1cm, yshift=1.3cm,font=\color{black}] {Momentum magnitude $| \beta |$}; \node[right=of img1, node distance=0cm, rotate=270, xshift=-2.1cm, yshift=-.9cm, font=\color{black}] {Number of steps to converge}; \end{tikzpicture} \vspace{-0.03\textheight} \newsubcap{ How many steps simultaneous complex momentum on a Dirac-GAN takes for a set solution distance. We fix step size $\alpha \!=\! \num{0.1}$ as in Figure~\ref{fig:trajectories_limited}, while varying the phase and magnitude of our momentum $\beta \!=\! |\beta| \exp(i \arg(\beta))$. There is a {\color{red}red} star at the optima, dashed {\color{red}red} lines at real $\beta$, and a dashed {\color{magenta}magenta} line for simultaneous gradient descent. There are no real-valued $\beta$ that converge for this -- or any -- $\alpha$ with simultaneous updates ~\citep{gidel2018negative}. Appendix Figure~\ref{fig:det_minmax_expAvg_alt_phase_tune} compares this with alternating updates (\ref{eq:alt_update}). } \label{fig:det_minmax_expAvg_simul_phase_tune} \end{subfigure} \vspace{-0.025\textheight} \end{figure} Expanding the parameter updates with the Cartesian components of $\alpha$ and $\beta$ is key for Theorem~\ref{thm:theorem}, which characterizes the convergence rate: \vspace{-0.005\textheight} \begin{align}\label{eq:cartesian_complex_update} \begin{split} \smash{\boldsymbol{\mu}^{j\!+\!1}} \!=\! \smash{\beta \boldsymbol{\mu}^{j} - \hat{\gradSymbol}^j \iff} \\ \smash{\Re(\boldsymbol{\mu}^{j\!+\!1})} \!=\! \smash{\Re(\beta) \! \Re(\boldsymbol{\mu}^j) \!-\! \Im(\beta) \! \Im(\boldsymbol{\mu}^j) \!-\! \Re(\hat{\gradSymbol}^j)},\,\,\ &\Im(\boldsymbol{\mu}^{j\!+\!1}) \!=\! \Im(\beta) \! \Re(\boldsymbol{\mu}^{j}) \!+\! \Re(\beta) \! \Im(\boldsymbol{\mu}^{j}) \end{split} \end{align} \vspace{-0.02\textheight} \begin{align}\label{eq:parameter_dynamics} \boldsymbol{\omega}^{j\!+\!1} \!=\! \boldsymbol{\omega}^j \!+\! \Re(\alpha \boldsymbol{\mu}^{j\!+\!1}) \if \boldsymbol{\omega}^{j\!+\!1} \!=\! \boldsymbol{\omega}^j \!-\! \alpha\hat{\gradSymbol}^j \!+\! \Re(\alpha \beta) \! \Re(\boldsymbol{\mu}^j) \!-\! \Im(\alpha \beta)\!\Im(\boldsymbol{\mu}^j) \end{align} % So, we can write the next iterate with a fixed-point operator:\vspace{-0.005\textheight} \begin{equation}\label{eq:fixed_point_operator} \smash{ [\Re(\boldsymbol{\mu}^{j\!+\!1}),\! \Im(\boldsymbol{\mu}^{j\!+\!1}),\! \boldsymbol{\omega}^{j\!+\!1}] \!\!=\! \boldsymbol{F}_{\lr, \momCoeff} ([\Re(\boldsymbol{\mu}^{j}),\! \Im(\boldsymbol{\mu}^{j}),\! \boldsymbol{\omega}^{j}]\!) } \end{equation} (\ref{eq:cartesian_complex_update}) and (\ref{eq:parameter_dynamics}) allow us to write the Jacobian of $\boldsymbol{F}_{\lr, \momCoeff}$ which can be used to bound convergence rates near fixed points, which we name the Jacobian of the augmented dynamics of buffer $\boldsymbol{\mu}$ and joint-parameters $\boldsymbol{\omega}$ and denote with: \vspace{-0.01\textheight} \begin{equation} \boldsymbol{R} \!\vcentcolon=\! \nabla_{[\boldsymbol{\mu}, \boldsymbol{\omega}]}\boldsymbol{F}_{\lr, \momCoeff} = \begin{bmatrix} \Re(\beta) \boldsymbol{I} & -\Im(\beta) \boldsymbol{I} & -\nabla_{\boldsymbol{\omega}} \hat{\gradSymbol}\\ \Im(\beta) \boldsymbol{I} & \Re(\beta) \boldsymbol{I} & 0\\ \Re(\alpha \beta) \boldsymbol{I} & -\Im(\alpha \beta) \boldsymbol{I} & \boldsymbol{I} \!-\! \alpha\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol}\\ \end{bmatrix} \end{equation} So, for quadratic losses our parameters evolve via: \begin{equation}\label{eq:dyn_system} \smash{ [\Re(\boldsymbol{\mu}^{j\!+\!1}),\! \Im(\boldsymbol{\mu}^{j\!+\!1}),\! \boldsymbol{\omega}^{j\!+\!1}]^{\top}%{\intercal} \!\!=\! \boldsymbol{R} \, [\Re(\boldsymbol{\mu}^{j}),\! \Im(\boldsymbol{\mu}^{j}),\! \boldsymbol{\omega}^{j}]^{\top}%{\intercal}\! } \end{equation} We can bound convergence rates by looking at the spectrum of $\boldsymbol{R}$ with Theorem~\ref{thm:theorem} % \begin{restatable}[Consequence of Prop. 4.4.1 ~\citet{bertsekas2008nonlinear}]{thm}{mainThm \label{thm:theorem} Convergence rate of complex momentum: If the spectral radius $\rho(\boldsymbol{R}) \!=\! \rho(\nabla_{[\boldsymbol{\mu}, \boldsymbol{\omega}]}\boldsymbol{F}_{\lr, \momCoeff}) \!<\! 1$, then, for $[\boldsymbol{\mu}, \boldsymbol{\omega}]$ in a neighborhood of $[\boldsymbol{\mu}^*\!, \boldsymbol{\omega}^*]$, the distance of $[\boldsymbol{\mu}^{j}\!, \boldsymbol{\omega}^{j}]$ to the stationary point $[\boldsymbol{\mu}^*\!, \boldsymbol{\omega}^*]$ converges at a linear rate $\mathcal{O}((\rho(\boldsymbol{R}) + \epsilon)^j), \forall \epsilon \!>\! 0$. \end{restatable} % % \vspace{-0.005\textheight} Here, linear convergence means $\lim_{j \to \infty} \!\! \nicefrac{\| \boldsymbol{\omega}^{j\!+\!1} - \boldsymbol{\omega}^*\|}{\| \boldsymbol{\omega}^{j} - \boldsymbol{\omega}^*\|} \!\in\! (\num{0}, \num{1})$, where $\boldsymbol{\omega}^*$ is a fixed point. We should select optimization parameters $\alpha, \beta$ so that the augmented dynamics spectral radius $\lambda(\boldsymbol{R}(\alpha, \beta)) \!<\! 1$---with the dependence on $\alpha$ and $\beta$ now explicit. We may want to express $\lambda(\boldsymbol{R}(\alpha, \beta))$ in terms of the spectrum $\lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol})$, as in Theorem 3 in \citet{gidel2018negative}: % \vspace{-0.005\textheight} \begin{equation}\label{eq:spectrum_desired} \smash{\boldsymbol{f}(\lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol}), \alpha, \beta) \!=\! \lambda(\boldsymbol{R}(\alpha, \beta))} \end{equation} % We provide a Mathematica command in Appendix~\ref{sec:poly} for a cubic polynomial $p$ characterizing $\boldsymbol{f}$ with coefficients that are functions of $\alpha, \beta$ \& $\lambda \in \lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol})$, whose roots are eigenvalues of $\boldsymbol{R}$, which we use in subsequent results. \citet{o2015adaptive, lucas2018aggregated} mention that in practice we do not know the condition number, eigenvalues -- or the mixture of cooperative and adversarial eigenspaces -- of a set of functions that we are optimizing, so we try to design algorithms which work over a large range. Sharing this motivation, we consider convergence behavior on games ranging from purely adversarial to cooperative. In Section~\ref{sec:exp_spectrum} at every non-real $\beta$ we could select $\alpha$ and $| \beta |$ so Algorithm~\ref{alg:simultaneous_complex} converges. We define \emph{almost-positive} to mean $\arg(\beta) \!=\! \epsilon$ for small $\epsilon$, and show there are almost-positive $\beta$ which converge.\vspace{-0.01\textheight} \begin{restatable}[Convergence of Complex Momentum]{result}{resultExist} \label{thm:theorem_existence} There exist $\alpha \in \mathbb{R}, \beta \in \mathbb{C}$ so Algorithm~\ref{alg:simultaneous_complex} converges for bilinear zero-sum games. More-so, for small $\epsilon$ (we show for $\epsilon = \frac{\pi}{\num{16}}$), if $\arg(\beta) = \epsilon$ (i.e., almost-positive) or $\arg(\beta) = \pi - \epsilon$ (i.e., almost-negative), then we can select $\alpha, |\beta|$ to converge. \end{restatable} \vspace{-0.0075\textheight} % \textbf{Why show this?} Our result complements \citet{gidel2018negative} who show that for all real $\alpha, \beta$ Algorithm~\ref{alg:simultaneous_complex} \emph{does not} converge. We include the proof for bilinear zero-sum games, but the result generalizes to some games that are purely adversarial near fixed points, like Dirac GANs~\citep{mescheder2017numerics}. The result's second part shows evidence there is a sense in which the only $\beta$ that do not converge are real (with simultaneous updates on purely adversarial games). It also suggests a form of robustness, because almost-positive $\beta$ can approach acceleration in cooperative eigenspaces, while converging in adversarial eigenspaces, so almost-positive $\beta$ may be desirable when we have games with an uncertain or variable mixtures of real and imaginary eigenvalues like GANs. Sections~~\ref{sec:exp_spectrum}, \ref{sec:train_small_gan}, and \ref{sec:train_big_gan} investigate this further. \vspace{-0.0125\textheight} \subsection{What about Acceleration?}\label{sec:acceleration} \vspace{-0.0125\textheight} With classical momentum, finding the step size $\alpha$ and momentum $\beta$ to optimize the convergence rate tractable if $\num{0} \!<\! l \!\leq\! L$ and $\smash{\lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol}) \!\in\! [l, L]^{\dimSymbol}}$~\citep{goh2017momentum} -- i.e., we have an $l$-strongly convex and $L$-Lipschitz loss. The conditioning $\kappa \!=\! \nicefrac{L}{l}$ can characterize problem difficulty. Gradient descent with an appropriate $\alpha$ can achieve a convergence rate of $\smash{\frac{\kappa - \num{1}}{\kappa + \num{1}}}$, but using momentum with appropriate $(\alpha^*\!, \beta^*)$ can achieve an \emph{accelerated} rate of $\smash{\rho^* \!=\! \frac{\sqrt{\kappa} - \num{1}}{\sqrt{\kappa} + \num{1}}}$. % However, there is no consensus for constraining $\smash{\lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol})}$ in games for tractable and useful results. Candidate constraints include monotonic vector fields generalizing notions of convexity, or vector fields with bounded eigenvalue norms capturing a kind of sensitivity~\citep{azizian2019tight}. % Figure~\ref{fig:gan_spectrum_main} shows $\smash{\lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol})}$ for a GAN -- we can attribute some eigenvectors to a single player's parameters. The discriminator can be responsible for the largest and smallest norm eigenvalues, suggesting we may benefit from varying $\alpha$ and $\beta$ for each player as done in Section~\ref{sec:train_big_gan}. \vspace{-0.0125\textheight} \subsection{Implementing Complex Momentum} \vspace{-0.0125\textheight} Complex momentum is trivial to implement with libraries supporting complex arithmetic like JAX~\citep{jax2018github} or Pytorch~\citep{paszke2017automatic}. Given an SGD implementation, we often only need to change a few lines of code -- see Figure~\ref{fig:jax_code_change}. Also, (\ref{eq:cartesian_complex_update}) and (\ref{eq:parameter_dynamics}) can be easily used to implement Algorithm~\ref{alg:simultaneous_complex} in a library without complex arithmetic. More sophisticated optimizers like Adam can trivially support complex optimizer parameters with real-valued updates, which we explore in Section~\ref{sec:train_big_gan}. \new{ \vspace{-0.0125\textheight} \subsection{Scope and Limitations} \vspace{-0.0125\textheight} For some games, we need higher than first-order information to converge -- ex., pure-response games ~\citep{lorraine2019optimizing} -- because the first-order information for a player is identically zero. So, momentum methods only using first-order info will not converge in general. However, we can combine methods with second-order information and momentum algorithms~\citep{lorraine2019optimizing, raghu2020teaching}. % Complex momentum's computational cost is almost identical to classical and negative momentum, except we now have a buffer with twice as many real parameters. We require one more optimization hyperparameter than classical momentum, which we provide an initial guess for in Section~\ref{sec:init_guess}. } \newcommand{\frac{\pi}{\num{16}}}{\frac{\pi}{\num{16}}} \vspace{-0.0175\textheight} \section{Experiments}\label{sec:experiments} \vspace{-0.015\textheight} We investigate complex momentum's performance in training GANs and games with different mixtures of cooperative and adversarial eigenspaces, showing improvements over standard baselines. Code for experiments will be available on publication, with reproducibility details in Appendix~\ref{app:experiments}. \textbf{Overview:} We start with a purely adversarial Dirac-GAN and zero-sum games, which have known solutions $\boldsymbol{\omega}^* \!=\! (\paramSymbol_{\!\outSymbol}^*, \paramSymbol_{\!\inSymbol}^*)$ and spectrums $\lambda(\nabla_{\boldsymbol{\omega}} \hat{\gradSymbol})$, so we can assess convergence rates. Next, we evaluate GANs generating $\num{2}$D distributions, because they are simple enough to train with a plain, alternating SGD. Finally, we look at scaling to larger-scale GANs on images which have brittle optimization, and require optimizers like Adam. Complex momentum provides benefits in each setup. \new{ We only compare to first-order optimization methods, despite there being various second-order methods due limitations discussed in Section~\ref{sec:limitation_existing}. } \vspace{-0.0125\textheight} \subsection{Optimization in Purely Adversarial Games}\label{sec:single_param_det} \vspace{-0.0125\textheight} \newcommand{(\num{1}, \num{1})}{(\num{1}, \num{1})} \newcommand{\num{1.0}}{\num{2}} \newcommand{\num{.5}}{\nicefrac{\num{1}}{\num{3}}} \newcommand{\num{300}}{\num{300}} \newcommand{\num{50}}{\num{50}} \newcommand{\fixedPhase}{\frac{\pi}{\num{16}}} \new{ Here, we consider the optimizing the Dirac-GAN objective, which is surprisingly hard and where many classical optimization methods fail, because $\lambda(\nabla_{\boldsymbol{\omega}} \hat{\gradSymbol})$ is imaginary near solutions: \vspace{-0.005\textheight} \begin{equation}\label{eq:min_max_xy} \smash{ \min_x \max_y -\log(1 + \exp(-xy)) - \log(2) } \end{equation} } % Figure~\ref{fig:trajectories_limited} empirically verifies convergence rates given by Theorem~\ref{thm:theorem} with (\ref{eq:spectrum_desired}), by showing the optimization trajectories with simultaneous updates. Figure~\ref{fig:det_minmax_expAvg_simul_phase_tune} investigates how the components of the momentum $\beta$ affect convergence rates with simultaneous updates and a fixed step size. The best $\beta$ was almost-positive (i.e., $\arg(\beta) \!=\! \epsilon$ for small $\epsilon$). We repeat this experiment with alternating updates in Appendix Figure~\ref{fig:det_minmax_expAvg_alt_phase_tune}, which are standard in GAN training. There, almost-positive momentum is best (but negative momentum also converges), and the benefit of alternating updates can depend on if we can parallelize player gradient evaluations. \newcommand{\num{16}}{\num{16}} \vspace{-0.02\textheight} \new{ \subsection{How Adversarialness Affects Convergence Rates}\label{sec:exp_spectrum} \vspace{-0.01\textheight} % Here, we compare optimization with first-order methods for purely adversarial, cooperative, and mixed games. We use the following game, allowing us to easily interpolate between these regimes:\vspace{-0.005\textheight} } \begin{equation}\label{eq:bilinear_adversarial_interpolate} \smash{ \min_{\boldsymbol{x}} \max_{\boldsymbol{y}} \boldsymbol{x}^\top}%{\intercal (\boldsymbol{\gamma} \boldsymbol{A}) \boldsymbol{y} + \boldsymbol{x}^\top}%{\intercal ((\boldsymbol{I} - \boldsymbol{\gamma})\boldsymbol{B}_1) \boldsymbol{x} - \boldsymbol{y}^\top}%{\intercal ((\boldsymbol{I} - \boldsymbol{\gamma})\boldsymbol{B}_2) \boldsymbol{y } \end{equation} \begin{wrapfigure}[34]{r}{.51\textwidth} \vspace{-0.035\textheight} \centering \begin{tikzpicture} \centering \node (img1){\includegraphics[trim={.0cm .0cm .0cm .0cm},clip,width=.93\linewidth]{images/spectrum/phase_compare.pdf}}; \node[left=of img1, node distance=0cm, rotate=90, xshift=2.0cm, yshift=-1.0cm, font=\color{black}] {\# grad. eval. to converge}; \node[below=of img1, node distance=0cm, xshift=-.1cm, yshift=1.3cm,font=\color{black}]{Max adversarialness $\gamma_{max}$}; \end{tikzpicture} \vspace{-0.025\textheight} \caption{ \new{ We compare first-order methods convergence rates on the game in (\ref{eq:bilinear_adversarial_interpolate}), with $\boldsymbol{A} \!=\! \boldsymbol{B}_1 \!=\! \boldsymbol{B}_2$ diagonal and entries linearly spaced in $[\nicefrac{\num{1}}{\num{4}}, \num{4}]$. We interpolate from purely cooperative to a mixture of purely cooperative and adversarial eigenspaces in $\lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol})$ by making $\boldsymbol{\gamma}$ diagonal with $\gamma_j \!\sim\! U[0, \gamma_{max}]$, inducing $j^{th}$ eigenvalue pair to have $\arg(\lambda_j) \!\approx\! \pm \gamma_j \frac{\pi}{2}$. So, $\gamma_{max}$ controls the largest possible eigenvalue $\arg$ or \emph{max adversarialness}. Every method generalizes gradient descent-ascent (GDA) by adding an optimizer parameter, tuned via grid search. {\color{blue}Positive momentum} and {\color{green}negative momentum} do not converge if there are purely adversarial eigenspaces (i.e., $\gamma_{max} \!=\! 1$). {\color{orange}Almost-positive momentum $\arg(\beta) \!=\! \epsilon$} $>\! 0$ like ${\color{orange}\nicefrac{\pi}{8}}$ allows us to approach the acceleration of positive momentum if sufficiently cooperative (i.e., $\gamma_{max} \!<\! \num{.5}$), while still converging if there are purely adversarial eigenspaces (i.e., $\gamma_{max} \!=\! 1$). Tuning $\arg(\beta)$ with complex momentum performs competitively with {\color{red}extragradient (EG)}, {\color{magenta}optimistic gradient (OG)} for any adversarialness -- ex., ${\color{brown}\arg(\beta) \!=\! \nicefrac{\pi}{2}}$ does well if there are purely adversarial eigenspaces (i.e., $\gamma_{max} \!=\! 1$). } } \vspace{-0.00\textheight} \label{fig:partial_coop_phases} \end{wrapfigure} If $\boldsymbol{\gamma} \!=\! \boldsymbol{I}$ the game is purely adversarial, while if the $\boldsymbol{\gamma} \!=\! \boldsymbol{0}$ the game is purely cooperative. Figure~\ref{fig:spectrum_vary_phase} explores $\lambda(\boldsymbol{R})$ in purely adversarial games for a range of $\alpha, \beta$, generalizing Figure 4 in \citet{gidel2018negative}. At every non-real $\beta$---i.e., $\arg(\beta) \!\neq\! \pi$ or $\num{0}$---we could select $\alpha, |\beta|$ that converge. \newcommand{\spectrumVaryWidth}{0.19\linewidth} \newcommand{0.012\linewidth}{0.012\linewidth} \newcommand{0.03\linewidth}{0.03\linewidth} \newcommand{-1.45cm}{-1.45cm} \begin{figure}[t] \vspace{-0.03\textheight} \centering \begin{tikzpicture} \centering \node (img0){\includegraphics[trim={1.2cm 1.05cm 23.5cm .7cm},clip,width=0.012\linewidth]{images/spectrum/phase=0.png}}; \node[left=of img1, node distance=0cm, rotate=90, xshift=1.0cm, yshift=-4cm, font=\color{black}] {$\Im(\lambda(\boldsymbol{R}))$}; \node (img1)[right=of img0, node distance=0cm, xshift=-1.265cm]{\includegraphics[trim={1.9cm 1.25cm 12.5cm .7cm},clip,width=\spectrumVaryWidth]{images/spectrum/phase=0.png}}; \node[above=of img1, node distance=0cm, xshift=-0cm, yshift=-1.25cm,font=\color{black}] {$\arg(\beta) = \num{0}$} \node (img2)[right=of img1, node distance=0cm, xshift=-1.45cm]{\includegraphics[trim={1.9cm 1.25cm 12.5cm .7cm},clip,width=\spectrumVaryWidth]{images/spectrum/phase=785.png}}; \node[above=of img2, node distance=0cm, xshift=0cm, yshift=-1.25cm,font=\color{black}] {$\arg(\beta) = \frac{\pi}{\num{4}}$} \node (img3)[right=of img2, node distance=0cm, xshift=-1.45cm]{\includegraphics[trim={1.9cm 1.25cm 12.5cm .7cm},clip,width=\spectrumVaryWidth]{images/spectrum/phase=1571.png}}; \node[below=of img3, node distance=0cm, xshift=-.1cm, yshift=1.2cm,font=\color{black}] {The real component of the spectrum of the augmented learning dynamics $\Re(\lambda(\boldsymbol{R}))$}; \node[above=of img3, node distance=0cm, xshift=0cm, yshift=-1.25cm,font=\color{black}] {$\arg(\beta) = \frac{\pi}{\num{2}}$} \node (img4)[right=of img3, node distance=0cm, xshift=-1.45cm]{\includegraphics[trim={1.9cm 1.25cm 12.5cm .7cm},clip,width=\spectrumVaryWidth]{images/spectrum/phase=2356.png}}; \node[above=of img4, node distance=0cm, xshift=0cm, yshift=-1.25cm,font=\color{black}] {$\arg(\beta) =\ \frac{\num{3}\pi}{\num{4}}$} \node (img5)[right=of img4, node distance=0cm, xshift=-1.45cm]{\includegraphics[trim={1.9cm 1.25cm 12.5cm .7cm},clip,width=\spectrumVaryWidth]{images/spectrum/phase=3142.png}}; \node[above=of img5, node distance=0cm, xshift=0cm, yshift=-1.25cm,font=\color{black}] {$\arg(\beta) = \pi$} \node (img6)[right=of img5, node distance=0cm, xshift=-1.45cm]{\includegraphics[trim={.55cm .75cm .75cm .55cm},clip,width=0.03\linewidth]{images/spectrum/mom_colorbar.png}}; \node[right=of img6, node distance=0cm, rotate=270, xshift=0.0cm, yshift=-1.cm, font=\color{black}] {$| \beta |$}; \end{tikzpicture} \vspace{-0.025\textheight} \caption{ The spectrum of the augmented learning dynamics $\boldsymbol{R}$ is shown, whose spectral norm is the convergence rate in Theorem~\ref{thm:theorem}. Each image is a different momentum phase $\arg(\beta)$ for a range of $\alpha,\! |\beta| \!\in\! [\num{0},\! \num{1}]$. The opacity of an eigenvalue (eig) is the step size $\alpha$ and the color corresponds to momentum magnitude $|\beta|$. A {\color{red}red} unit circle shows where all eigs must lie to converge for a fixed $\alpha, \beta$. If the max eig norm $<\! \num{1}$, we draw a {\color{green}green} circle whose radius is our convergence rate and a {\color{green}green} star at the associated eig. Notably, at every non-real $\beta$ we can select $\alpha,\! |\beta|$ for convergence. The eigs are symmetric over the $x$-axis, and eigs near $\Re(\lambda) \!=\! \num{1}$ dictate convergence rate. Eigs near the center are due to state augmentation, have small magnitudes, and do not impact convergence rate. Simultaneous gradient descent corresponds to the {\color{magenta}magenta} values where $|\beta| \!=\! \num{0}$. } \label{fig:spectrum_vary_phase} \vspace{-0.0225\textheight} \end{figure} % Figure~\ref{fig:partial_coop_phases} compares first-order algorithms as we interpolate from the purely cooperative games (i.e., minimization) to mixtures of purely adversarial and cooperative eigenspaces, because this setup range can occur during GAN training -- see Figure~\ref{fig:gan_spectrum_main}. Our baselines are simultaneous SGD (or gradient descent-ascent (GDA)), extragradient (EG) \citep{korpelevich1976extragradient}, optimistic gradient (OG) \citep{chiang2012online, rakhlin2013optimization, daskalakis2017training}, and momentum variants. We added extrapolation parameters for EG and OG so they are competitive with momentum -- see Appendix Section~\ref{sec:app_spectrum}. We show how many gradient evaluations for a set solution distance, and EG costs two evaluations per update. We optimize convergence rates for each game and method by grid search, as is common for optimization parameters in deep learning. \textbf{Takeaway:} In the cooperative regime -- i.e., $\gamma_{max} \!<\! .5$ or $\max_{\lambda \in \lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol})} |\arg(\lambda)| \!<\! \nicefrac{\pi}{4}$ -- the best method is classical, positive momentum, otherwise we benefit from a method for learning in games. If we have purely adversarial eigenspaces then GDA, positive and negative momentum fail to converge, while EG, OG, and complex momentum can converge. In games like GANs, our eigendecomposition is infeasible to compute and changes during training -- see Appendix Figure~\ref{fig:gan_decomp} -- so we want an optimizer that converges robustly. Choosing any non-real momentum $\beta$ allows robust convergence for every eigenspace mixture. More so, almost-positive momentum $\beta$ allows us to approach acceleration when cooperative, while still converging if there are purely adversarial eigenspaces. % % % \newcommand{\nicefrac{\num{1}}{\num{2}}}{\nicefrac{\num{1}}{\num{2}}} \newcommand{\num{2}}{\num{2}} \newcommand{.4\textwidth}{.4\textwidth} \newcommand{\num{.76}}{\num{.76}} \newcommand{\num{.79}}{\num{.79}} \subsection{Training GANs on $\num{2}$D Distributions}\label{sec:train_small_gan} \vspace{-0.0125\textheight} \new{ Here, we investigate improving GAN training using alternating gradient descent updates with complex momentum. We look at alternating updates, because they are standard in GAN training~\citep{goodfellow2014generative, brock2018large, wu2019logan}. It is not clear how EG and OG generalize to alternating updates, so we use positive and negative momentum as our baselines. We train to generate a $\num{2}$D mixture of Gaussians, because more complicated distribution require more complicated optimizers than SGD. } Figure~\ref{fig:jax_code_change} shows all changes necessary to use the JAX momentum optimizer for our updates, with full details in Appendix~\ref{sec:app_2d_gan}. We evaluate the log-likelihood of GAN samples under the mixture as an imperfect proxy for matching. Appendix Figure~\ref{fig:gan_heatmaps} shows heatmaps for tuning $\arg(\beta)$ and $|\beta|$ with select step sizes. \textbf{Takeaway:} The best momentum was found at the almost-positive $\beta \approx \num{0.7} \exp(i \nicefrac{\pi}{\num{8}})$ with step size $\alpha \!=\! 0.03$, and for each $\alpha$ we tested a broad range of non-real $\beta$ outperformed any real $\beta$. This suggests we may be able to often improve GAN training with alternating updates and complex momentum. \vspace{-0.0125\textheight} \subsection{Training BigGAN with a Complex Adam}\label{sec:train_big_gan} \vspace{-0.0125\textheight} \new{ Here, we investigate improving larger-scale GAN training with complex momentum. However, larger-scale GANs train with more complicated optimizers than gradient descent -- like Adam~\citep{kingma2014adam} -- and have notoriously brittle optimization. We look at training BigGAN~\citep{brock2018large} on CIFAR-10~\citep{krizhevsky2009learning}, but were unable to succeed with optimizers other than \citep{brock2018large}-supplied setups, due to brittle optimization. So, we attempted to change procedure minimally by taking \citep{brock2018large}-supplied code \href{https://github.com/ajbrock/BigGAN-PyTorch}{{\color{blue}here}} which was trained with Adam, and making the $\beta_1$ parameter -- analogous to momentum -- complex. The modified complex Adam is shown in Algorithm~\ref{alg:complex_adam}, where the momentum bias correction is removed to better match our theory. It is an open question on how to best carry over the design of Adam (or other optimizers) to the complex setting. Training each BigGAN took $\num{10}$ hours on an NVIDIA T4 GPU, so Figure~\ref{fig:biggan_inception_heatmap} and Table~\ref{tab:biggan} took about $\num{1000}$ and $\num{600}$ GPU hours respectively. } Figure~\ref{fig:biggan_inception_heatmap} shows a grid search over $\arg(\beta_1)$ and $|\beta_1|$ for a BigGAN trained with Algorithm~\ref{alg:complex_adam}. We only changed $\beta_1$ for the discriminator's optimizer. \textbf{Takeaway:} The best momentum was at the almost-positive $\beta_1 \!\approx\! \num{0.8} \exp(i \nicefrac{\pi}{\num{8}})$, whose samples are in Appendix Figure~\ref{fig:biggan_samples}. \begin{figure}[b \vspace{-0.04\textheight} \centering \begin{minipage}{.31\textwidth} \begin{algorithm}[H] \caption{Complex Adam variant without momentum bias-correction} \label{alg:complex_adam} \begin{algorithmic}[1] \State $\beta_1 \!\in\! \mathbb{C}, \beta_2 \!\in\! [\num{0},\! \num{1})$ \State $\alpha \!\in\! \mathbb{R}^{+}, \epsilon \!\in\! \mathbb{R}^{+}$ \For{$j = 1 \dots N$} \State $\!\!\!\!\!\boldsymbol{\mu}^{j\!+\!1} \!\!=\! \beta_1 \boldsymbol{\mu}^{j} - \boldsymbol{g}^j$ \State $\!\!\!\!\!\boldsymbol{v}^{j\!+\!1} \!\!=\! \beta_2 \boldsymbol{v}^{j} \!+\! (1\!-\!\beta_2) (\boldsymbol{g}^j)^{\!\num{2}}$ \State $\!\!\!\!\!\hat{\boldsymbol{v}}^{j\!+\!1} \!\!=\! \frac{\boldsymbol{v}^{j\!+\!1}}{1 - (\beta_2)^j}$ \State $\!\!\!\!\!\boldsymbol{\omega}^{j\!+\!1} \!\!=\! \boldsymbol{\omega}^{j} + \alpha \frac{\Re(\boldsymbol{\mu}^j)}{\sqrt{\hat{\boldsymbol{v}}^{j\!+\!1}} + \epsilon}$ \EndFor \Return $\boldsymbol{\omega}^N$ \end{algorithmic} \end{algorithm} \end{minipage} \hspace{0.01\textwidth} \begin{minipage}{.65\textwidth} \begin{table}[H] \vspace{-0.00\textheight} \centering \begin{tabular}{lll} CIFAR-10 BigGAN&\multicolumn{2}{c}{Best IS for \num{10} seeds} \\ \cmidrule(lr){2-3} Discriminator $\beta_1$ & Min & Max\\ \midrule $\num{0}$ -- \citep{brock2018large}'s default & $\num{8.9}$ & $\num{9.1}$ \\ $\num{.8}\exp(i \nicefrac{\pi}{\num{8}})$ -- ours & $\num{8.96} ({\color{green}+.06})$ & $\num{9.25} ({\color{green}+.15})$ \\ $\num{.8}$ & $\num{3.12}({\color{red}-5.78})$ & $\num{9.05}({\color{red}-0.05})$ \\ \end{tabular} \caption{ We display the best inception scores (IS) found over $\num{10}$ runs for training BigGAN on CIFAR-10 with various optimizer settings. We use a complex Adam variant outlined in Algorithm~\ref{alg:complex_adam}, where we only tuned $\beta_1$ for the discriminator. The best parameters found in Figure~\ref{fig:biggan_inception_heatmap} were $\beta_1 = \num{.8}\exp(i \nicefrac{\pi}{\num{8}})$, which improved the min and max IS from our runs of the BigGAN authors baseline, which was the SoTA optimizer in this setting to best of our knowledge. We tested $\beta_1 = \num{.8}$ to see if the gain was solely from tuning $|\beta_1|$, which occasionally failed and decreased the best IS. } \label{tab:biggan} \end{table} \end{minipage} \vspace{-0.03\textheight} \end{figure % We tested the best momentum value over $\num{10}$ seeds against the author-provided baseline in Appendix Figure~\ref{fig:biggan_inception_runs}, with the results summarized in Table~\ref{tab:biggan}. \citep{brock2018large} reported a single inception score (IS) on CIFAR-10 of $\num{9.22}$, but the best we could reproduce over the seeds with the provided PyTorch code and settings was $\num{9.10}$. % Complex momentum improves the best IS found with $\num{9.25} ({\color{green}+.15} \text{ over author code}, {\color{green}+.03} \text{ author reported})$. % We trained a real momentum $|\beta_1| \!=\! \num{0.8}$ to see if the improvement was solely from tuning the momentum magnitude. This occasionally failed to train and decreased the best IS over re-runs, showing we benefit from a non-zero $\arg(\beta_1)$. % \vspace{-0.0125\textheight} \subsection{A Practical Initial Guess for Optimizer Parameter $\arg(\beta)$}\label{sec:init_guess} \vspace{-0.0125\textheight} \new{ Here, we propose a practical initial guess for our new hyperparameter $\arg(\beta)$. Corollary~\ref{thm:theorem_existence} shows we can use almost-real momentum coefficients (i.e., $\arg(\beta)$ is close to $\num{0}$). Figure~\ref{fig:partial_coop_phases} shows almost-positive $\beta$ approach acceleration in cooperative eigenspaces, while converging in all eigenspaces. Figure~\ref{fig:gan_spectrum_main} shows GANs can have both cooperative and adversarial eigenspaces. Figures~\ref{fig:gan_heatmaps} and \ref{fig:biggan_inception_heatmap} do a grid search over $\arg(\beta)$ for GANs, finding that almost-positive $\arg(\beta) \approx \nicefrac{\pi}{\num{8}}$ works in both cases. Also, by minimally changing $\arg(\beta)$ from $0$ to a small $\epsilon$, we can minimally change other hyperparameters in our model, which is useful to adapt existing, brittle setups like in GANs. Based on this, we propose an initial guess of $\arg(\beta) = \epsilon$ for a small $\epsilon > 0$, where $\epsilon = \nicefrac{\pi}{\num{8}}$ worked in our GAN experiments. } \newcommand{0.042\textwidth}{0.042\textwidth} \begin{wrapfigure}[36]{r}{0.585\linewidth} \vspace{-0.0525\textheight} \centering \begin{tikzpicture} \centering \node (img1){\includegraphics[trim={1.3cm .5cm .9cm .475cm},clip,width=.75\linewidth]{images/16_gan_example/eig_mag_phase_distribution_decomposition_1024000.png}}; \node (img1ytick)[left=of img1, node distance=0cm, rotate=90, xshift=2.67cm, yshift=-0.825cm, font=\color{black}] {-$\pi$ \hspace{0.042\textwidth} -$\frac{\pi}{2}$ \hspace{0.042\textwidth} $\num{0}$ \hspace{0.042\textwidth} \hphantom{-}$\frac{\pi}{2}$ \hspace{0.042\textwidth} \hphantom{-}$\pi$}; \node[left=of img1ytick, node distance=0cm, rotate=90, xshift=4.6cm, yshift=-0.53cm, font=\color{black}] {Phase of eigenvalue $\arg(\lambda)$}; \node[above=of img1, node distance=0cm, xshift=-.0cm, yshift=-1.2cm,font=\color{black}] {Spectrum of Jacobian of joint-grad $\lambda(\nabla_{\boldsymbol{\omega}}\hat{\gradSymbol}^{j})$ for GAN}; \node[below=of img1, node distance=0cm, xshift=-.1cm, yshift=1.2cm,font=\color{black}] {Log-magnitude of eigenvalue $\log(|\lambda|)$}; \node (img1colortick)[right=of img1, node distance=0cm, rotate=270, xshift=-2.6cm, yshift=-0.83cm, font=\color{black}] {disc. \hspace{0.07\textwidth} unsure \hspace{0.08\textwidth} gen.}; \node[right=of img1colortick, node distance=0cm, rotate=270, xshift=-5cm, yshift=-.55cm, font=\color{black}] {Does eigenvector point at a player?}; \end{tikzpicture} \vspace{-0.0275\textheight} \caption{ A log-polar coordinate visualization reveals structure in the spectrum for a GAN at the end of the training on a $\num{2}$D mixture of Gaussians with a $\num{1}$-layer (disc)riminator and (gen)erator, so the joint-parameters $\boldsymbol{\omega} \!\in\! \mathbb{R}^{\num{723}}$. It is difficult to see structure by graphing the Cartesian (i.e., $\Re$ and $\Im$) parts of eigenvalues, because they span orders of magnitude, while being positive and negative. Appendix Figure~\ref{fig:gan_decomp} shows the spectrum through training. \newline There is a mixture of many cooperative (i.e., real or $\arg(\lambda) \!\approx\! \num{0}, \pm \pi$) and some adversarial (i.e., imaginary or $\arg(\lambda) \!\approx\! \pm \frac{\pi}{\num{2}}$) eigenvalues, so -- contrary to what the name may suggest -- generative adversarial networks are not purely adversarial. We may benefit from optimizers leveraging this structure like complex momentum. \newline Eigenvalues are colored if the associated eigenvector is mostly in one player's part of the joint-parameter space -- see Appendix Figure~\ref{fig:gan_decomp} for details on this. Many eigenvectors lie mostly in the the space of (or point at) a one player. The structure of the set of eigenvalues for the disc. ({\color{green}green}) is different than the gen. ({\color{red}red}), but further investigation of this is an open problem. Notably, this may motivate separate optimizer choices for each player as in Section~\ref{sec:train_big_gan}. } \label{fig:gan_spectrum_main} \end{wrapfigure} \vspace{-0.0175\textheight} \section{Related Work}\label{sec:related-work} \vspace{-0.015\textheight} \textbf{Accelerated first-order methods}: A broad body of work exists using momentum-type methods~\citep{polyak1964some, nesterov1983method, nesterov2013introductory, maddison2018hamiltonian}, with a recent focus on deep learning~\citep{sutskever2013importance, zhang2017yellowfin, choi2019empirical, zhang2019lookahead, chen2020self}. But, these works focus on momentum for minimization as opposed to in games. \vspace{-0.005\textheight} \textbf{Learning in games}: Various works approximate response-gradients - some by differentiating through optimization~\citep{foerster2018learning, mescheder2017numerics, maclaurin2015gradient}. Multiple works try to leverage game eigenstructure during optimization~\citep{letcher2019differentiable, nagarajan2020chaos, omidshafiei2020navigating, czarnecki2020real, gidel2020minimax, perolat2020poincar}. \vspace{-0.005\textheight} \textbf{First-order methods in games}: In some games, we can get away with using only first-order methods -- \citet{zhang2021don, zhang2020unified, ibrahim2020linear, bailey2020finite, jin2020local, azizian2019tight, nouiehed2019solving, zhang2020optimality} discuss when and how these methods work. \citet{gidel2018negative} is the closest work to ours, showing a negative momentum can help in some games. \citet{zhang2020suboptimality} note the suboptimality of negative momentum in a class of games. \citet{azizian2020accelerating, domingo2020average} investigate acceleration in some games. \vspace{-0.005\textheight} \textbf{Bilinear zero-sum games}: \citet{zhangconvergence} study the convergence of gradient methods in bilinear zero-sum games. Their analysis extends \citet{gidel2018negative}, showing that we can achieve faster convergence by having separate step sizes and momentum for each player or tuning the extragradient step size. \citet{loizou2020stochastic} provide convergence guarantees for games satisfying a \emph{sufficiently bilinear} condition. \vspace{-0.005\textheight} \textbf{Learning in GANs}: Various works try to make GAN training easier with methods leveraging the game structure~\citep{Liu2020Towards, peng2020training, albuquerque2019multi, wu2019logan, hsieh2019finding}. \citet{metz2016unrolled} approximate the discriminator's response function by differentiating through optimization. \citet{mescheder2017numerics} find solutions by minimizing the norm of the players' updates. Both of these methods and various others~\citep{qin2020training, schafer2019implicit, jolicoeur2019connections} require higher-order information. \citet{daskalakis2017training, gidel2018variational, chavdarova2019reducing} look at first-order methods. \citet{mescheder2018training} explore problems for GAN training convergence and \citet{berard2019closer} show that GANs have significant rotations affecting learning. \vspace{-0.015\textheight} \section{Conclusion}\label{sec:conclusion} \vspace{-0.015\textheight} \new{ In this paper we provided a generalization of existing momentum methods for learning in differentiable games by allowing a complex-valued momentum with real-valued updates. We showed that our method robustly converges in games with a different range of mixtures of cooperative and adversarial eigenspaces than current first-order methods. We also presented a practical generalization of our method to the Adam optimizer, which we used to improve BigGAN training. More generally, we highlight and lay groundwork for investigating optimizers which work well with various mixtures of cooperative and competitive dynamics in games. % } \new{ \vspace{-0.0125\textheight} \subsection*{Societal Impact} \vspace{-0.0125\textheight} Our main contribution in this work is methodological -- specifically, a scalable algorithm for optimizing in games. Since our focus is on improving optimization methods, we do not expect there to be direct negative societal impacts from this contribution. } \newpage \clearpage \newpage \subsection*{Acknowledgements} Resources used in preparing this research were provided, in part, by the Province of Ontario, the Government of Canada through CIFAR, and companies sponsoring the Vector Institute. Paul Vicol was supported by an NSERC PGS-D Scholarship. We thank Guodong Zhang, Guojun Zhang, James Lucas, Romina Abachi, Jonah Phillion, Will Grathwohl, Jakob Foerster, Murat Erdogdu, Ken Jackson, and Ioannis Mitliagkis for feedback and helpful discussion. {\small
\section{1. Collective-coordinate approach} \label{sec:app1} The dynamics of a domain wall can be described within the collective-coordinate formalism~\cite{ThielePRL1973, TretiakovPRL2008}. The Landau-Lifshitz-Gilbert equation with the adiabatic spin-transfer torque is given by \begin{equation} s \dot{\mathbf{m}} - \alpha s \mathbf{m} \times \dot{\mathbf{m}} = \mathbf{h}_\text{eff} \times \mathbf{m} + P (\mathbf{J} \cdot \boldsymbol{\nabla}) \mathbf{m} \, , \end{equation} where \begin{equation} \mathbf{h}_\text{eff} \equiv - \frac{\delta U}{\delta \mathbf{m}} \, , \end{equation} is the effective field. In the collective-coordinate approach, we assume that the time evolution of the magnetization $\mathbf{m}(\mathbf{r}, t)$ can be captured by the time evolution of a few collective coordinates $\xi_i (t)$: $\mathbf{m}(\mathbf{r}, t) = \mathbf{m}_0 (\mathbf{r}, \boldsymbol{\xi}(t))$. Within this assumption, the time derivative of the magnetization can be written as follows: \begin{equation} \dot{\mathbf{m}} = \dot{\xi}_j \frac{\partial \mathbf{m}_0}{\partial \xi_j} \, , \end{equation} where the Einstein summation over the index $i$ is assumed. Upon replacing $\dot{\mathbf{m}}$ by the above expression, the LLG equation becomes \begin{equation} \dot{\xi}_j \frac{\partial \mathbf{m}_0}{\partial \xi_j} - \alpha s \dot{\xi}_j \mathbf{m}_0 \times \frac{\partial \mathbf{m}_0}{\partial \xi_j} = \mathbf{h}_\text{eff} [\mathbf{m}_0] \times \mathbf{m}_0 + P (\mathbf{J} \cdot \boldsymbol{\nabla}) \mathbf{m}_0 \, . \end{equation} After taking the inner product between both sides and $\mathbf{m}_0 \times (\partial \mathbf{m}_0 / \partial \xi_j)$ followed by the integration over the volume, we obtain \begin{equation} - G_{ij} \dot{\xi}_j + D_{ij} \dot{\xi}_j = F_i + F_i^J \, , \end{equation} where \begin{eqnarray} G_{ij} &\equiv& s \int dV \mathbf{m}_0 \cdot \left( \frac{\partial \mathbf{m}_0}{\partial \xi_i} \times \frac{\partial \mathbf{m}_0}{\partial \xi_j} \right) \, , \\ D_{ij} &\equiv& \alpha s \int dV \left( \frac{\partial \mathbf{m}_0}{\partial \xi_i} \cdot \frac{\partial \mathbf{m}_0}{\partial \xi_j} \right) \, , \\ F_i &\equiv& - \frac{d U}{d \xi_i} \, , \\ F_i^J &\equiv& - P \int dV \, \mathbf{m}_0 \cdot \left( \frac{\partial \mathbf{m}_0}{\partial \xi_j} \times (\mathbf{J} \cdot \boldsymbol{\nabla}) \mathbf{m}_0 \right) \, , \end{eqnarray} are called the gyrotropic tensor, the dissipation tensor, and the equilibrium force, and the current-induced force, respectively. The gyrotropic tensor and the dissipation tensor are antisymmetric and symmetric with respect to the exchange of indices, respectively. This formalism can be applied to dynamics of various type of magnetic textures including domain walls, vortices, and Skyrmions. For the domain wall [Eq.~(\ref{eq:dw})], these are given by \begin{eqnarray} G_{Z \Phi} &=& 4 \pi \rho s \, , \\ G_{Z \Upsilon} &=& - 4 \pi \rho s Q \, , \\ G_{\Phi \Upsilon} &=& 0 \, , \\ D_{Z Z} &=& 4 \pi \alpha \rho s / \lambda_n \, , \\ D_{Z \Phi} &=& 0 \, , \\ D_{Z \Upsilon} &=& 0 \, , \\ D_{\Phi \Phi} &=& 4 \pi \alpha \rho s \lambda_n \, , \\ D_{\Phi \Upsilon} &=& - 4 \pi \alpha \rho s n \lambda_n \, , \\ D_{\Upsilon \Upsilon} &=& 4 \pi \alpha \rho s n^2 \lambda_n \, , \\ F_Z^J &=& - 4 \pi n P J_\varphi \, , \\ F_\Phi^J &=& - 4 \pi \rho P J_z \, , \\ F_\Upsilon^J &=& 4 \pi \rho Q P J_z \, , \end{eqnarray} where the skyrmion charge $Q$ is equal to the magnetization winding number $n$. Here, the expressions for the two quantities related to $\Upsilon$, $G_{Z \Upsilon} = - 4 \pi \rho s Q$ and $F_\Upsilon^J = 4 \pi \rho Q P J_z$, can be obtained without the explicit domain-wall solution as shown in the main text. Also, $G_{\Phi \Upsilon} = 0$ can be derived without the explicit solution as follows: $G_{\Phi \Upsilon} = s \int dz d\varphi \mathbf{m}_0 \cdot (\partial_\Phi \mathbf{m}_0 \times \partial_\Upsilon \mathbf{m}_0) = s \int dz d\varphi \sin \theta \partial_\varphi \theta = 0$. \section{2. A domain wall in the presence of an external field $\mathbf{H} = H \hat{\mathbf{x}}$} \label{sec:app2} Here, we discuss a domain-wall solution in the presence of the Zeeman energy, $U_Z = - \rho M H \int dz d\varphi \, \sin \theta \cos \phi$. The solution given in Eq.~(\ref{eq:dw}) is altered by the external field. The exact solution is unavailable and we use the following variational ansatz for the domain wall: \begin{equation} \begin{aligned} \cos \theta_0 &= \tanh \left[ \frac{(z - Z) \sqrt{1 + n^2 \lambda_0^2/\rho^2}}{\lambda_0} \right] \, , \\ \phi_0 &= n (\varphi - \Upsilon) - c \sin (\varphi - \Upsilon) + \Phi \, , \end{aligned} \end{equation} and look for the value of the variational parameter $c$ that minimizes the energy. The energy terms that depend on the variational parameter $c$ is given by \begin{eqnarray} && \rho \int dz d\varphi \left[ \frac{A \sin^2 \theta (\partial_\varphi \phi)^2}{2 \rho^2} - M H \sin \theta \cos \phi \right] \, , \\ &=& \frac{A \lambda_n}{\rho} \int d\varphi (n - c \sin \varphi)^2 \\ && - \pi \rho \lambda_n M H \int d\varphi \cos (n \varphi - c \sin \varphi + \Phi) \, \\ &=& \frac{\pi \lambda_n A (2 n^2 + c^2)}{\rho} - 2 \pi^2 \rho \lambda_n M H J_n(c) \cos \Phi \, , \end{eqnarray} where $J_n (x)$ is the Bessel function of the first kind. For $H > 0$, the minimum energy is obtained for $\Phi = 0$ and the variational parameter $c$ is implicitly given by $J'_n(c) / c = A / (\pi \rho^2 M H)$. In the limit of strong field $H \gg A / (\pi \rho^2 M)$, the Zeeman term dominates and the optimal value for the variation parameter is given by the first point where $J'_n (c) = 0$, which yields, e.g., $c = 0$ for $Q = 0$. The potential energy now depends on $\Phi$ as $U(Z, \Upsilon, \Phi) = - k \cos \Phi$ with $k = 2 \pi^2 \rho M H J_n(c)$ evaluated at the optimal value for $c$. For example, $k = 2 \pi^2 \rho \lambda_0 M H$ for $Q = 0$, which agrees with the result obtained from Eq.~(\ref{eq:dw}). \section{3. The effect of the dipolar interaction (finite $\kappa$ case)} \label{sec:app3} Let us discuss the dynamics of domain walls in the case of $\kappa > 0$ which captures the effect of the dipolar interaction. In terms of the spherical angles $\mathbf{m} = (\sin \theta \cos \phi, \sin \theta \sin \phi, \cos \theta)$, the energy-density term $\propto \kappa$ is given by $(\kappa/2) \sin^2 \theta \cos^2 (\phi - \varphi)$. This term breaks each of the spin-rotational symmetry and the axial symmetry, but there is a residual symmetry. The energy is invariant under simultaneous rotation of spin and space: $\phi, \varphi \mapsto \phi + \Delta, \varphi + \Delta$. We treat the term $\propto \kappa$ as a perturbation and use the previous domain-wall solution as an ansatz. Then, the energy is no longer independent of $\Phi$ and $\Upsilon$. Instead, we have \begin{eqnarray} U(\Phi, \Upsilon) &=& \rho \int dz d\varphi \left[ \frac{\kappa}{2} \sin^2 \theta_0 \cos^2 (\phi_0 - \varphi) \right] \, , \\ &=& \rho \kappa \int d\varphi \, \cos^2 ((n - 1) \varphi + \Phi - n \Upsilon) \, . \end{eqnarray} The lowest-energy state is given by $n = 1$ (and thus $Q = 1$) (which is a vortex domain-wall state studied in Ref.~\cite{HertelJPCM2016}). We focus on this case now. Then, the energy is given by \begin{equation} U(\Phi, \Upsilon) = 2 \pi \rho \kappa \cos^2 (\Phi - \Upsilon) \, . \end{equation} The equations of motion in the presence of the current density $\mathbf{J} = J \hat{\mathbf{z}}$ are given by \begin{equation} - 4 \pi \rho s \dot{\Phi} + 4 \pi \rho s Q \dot{\Upsilon} + 4 \pi \alpha \rho s \dot{Z} / \lambda_n = 0 \, , \end{equation} for the position $Z$, \begin{equation} \begin{aligned} & 4 \pi \rho s \dot{Z} + 4 \pi \alpha \rho s \lambda_n \dot{\Phi} - 4 \pi \alpha \rho s n \lambda_n \dot{\Upsilon} \\ & = - 4 \pi \rho P J + 4 \pi \rho \kappa \cos (\Phi - \Upsilon) \sin (\Phi - \Upsilon) \, , \end{aligned} \end{equation} for the spin angle $\Phi$, and \begin{equation} \begin{aligned} & - 4 \pi \rho s Q \dot{Z} + 4 \pi \alpha \rho s n^2 \lambda_n \dot{\Upsilon} - 4 \pi \alpha \rho s n \lambda_n \dot{\Phi} \\ & = 4 \pi \rho Q P J - 4 \pi \rho \kappa \cos (\Phi - \Upsilon) \sin (\Phi - \Upsilon) \, , \end{aligned} \end{equation} for the orbital angle $\Upsilon$. It is more convenient to use $(\Xi \equiv \Phi - Q \Upsilon, \Phi)$ instead of $(\Upsilon, \Phi)$. In terms of $\Xi$ and $\Phi$, we have \begin{eqnarray} && \lambda_n \dot{\Xi} - \alpha \dot{Z} = 0 \, , \\ && - s \dot{Z} - P J_z + \kappa \cos \Xi \sin \Xi - \alpha s \lambda_n \dot{\Xi} = 0 \, . \end{eqnarray} For a small current, the domain wall does not move $\dot{Z} = 0$. For the sufficiently large current so that $|J| \gg J_c \equiv \kappa / 2 P$ at which the Walker breakdown occurs~\cite{SchryerJAP1974}, we have \begin{equation} \dot{Z} \approx - \frac{P J}{(1 + \alpha^2) s} \, . \end{equation} \end{document}
\section{Coupling Argument } \label{sec:main_coupling} In this section, we will produce a coupling between a adaptive sequence of $\sigma$-smooth distributions $\adist$ and independent draws from the uniform distribution. Initially, we will focus on the case when the $\sigma$-smooth distributions are uniformly distributed on subsets of size $\sigma n$. \subsection{Warm-Up: Coupling for a Single Round} \label{sec:single_coupling} As a warm up, let us look at the coupling for a single smooth distribution. Let $ S \subseteq \left[ n \right] $ with $\abs{S } = \sigma n $ and let $X_1 \sim S$. Consider the following coupling \begin{framed} \begin{itemize} \item Draw $ k = \alpha \sigma^{-1} $ samples $Y_1 \dots Y_{k}$ from the uniform distribution. \item If $Y_i \notin S $, then $Z_i = Y_i$. \item Else, for $i$ such that $Y_i \in S $, sample $\tilde{W_i} \sim S $ and set $Z_i =\tilde{W_i}$. \item Pick $X_1 $ randomly from $ \left\{ \tilde{W_i} \right\} $. If there is no $Y_i \in S$, then sample $X_1$ uniformly from $S$. \item Output $ \left( X_1 , Z_1 , \dots Z_k \right) $. \end{itemize} \end{framed} In the following lemma, we capture the required properties of the coupling. \begin{lemma} \label{lem:single_round} Let $\left( X_1 , Z_1 , \dots Z_k \right)$ be as above. Then, \begin{enumerate} \item[a.] $X_1$ is uniformly distributed on $S$. \item[b.] $Z_i$ are uniformly distributed on $\left[ n \right]$. \item[c.] Furthermore, $Z_i$ are independent. \item[d.] With probability $1- \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} $, $X_1 \in \{ Z_1, \dots, Z_k \}$. \end{enumerate} \end{lemma} \begin{proof} The first part follows from the construction since $X_1$ is either independently drawn from $S$ or set to be equal to some $\tilde{W}_i$ each of which is uniformly distributed on $S$. For the second part, note that for any $\ell \notin S$, we have $ \Pr\left[ Z_i = \ell \right] = \Pr\left[ Y_i = \ell \right] = n^{-1} $ and for $ \ell \in S $, $\Pr\left[ Z_i = \ell \right] = \Pr\left[ Y_i \in S \right] \Pr\left[ \tilde{W}_i = \ell \right] = \sigma n^{-1} \sigma^{-1} = n^{-1} $ as required. In order to argue the independence of $Z_i$, note that $Z_i$ is a function of $Y_i $ and $\tilde{W_i} $ which are all mutually independent. Note that $X_1 \notin \{ Z_1, \dots, Z_k \} $ if and only if for all $i $, $Y_i \notin S $. Since $\abs{S} = \sigma n $, $\Pr\left[ Y_i \notin S \right] = \left( 1 - \sigma \right) $ and thus we have \begin{equation*} \Pr\left[ X_1 \notin \{ Z_1, \dots, Z_k \} \right] = \left( 1 - \sigma \right)^k = \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} \end{equation*} as required. \end{proof} \subsection{Adaptive Coupling} \label{sec:Coupling} Moving to the case of a sequence of distributions, given a smooth sequence of distribution $\adist$, we would like to find a coupling with a sequence of independent samples from the uniform distribution. We first note that an adaptively chosen sequence distribution $\adist $ corresponds to a sequence of sets $S_1, \dots S_n$ of size $n\sigma$ such that $X_i \sim S_i$ where $S_i $ depends on the instantiations of $X_j$ for $j < i$. To make this dependence explicit will denote this as $S_i \left( X_1, \dots X_{i-1} \right)$. We would like to construct a coupling similar to the one in \cref{sec:single_coupling}. Consider the following coupling \begin{framed} \begin{itemize} \item For $j = 1 \dots t$, \begin{itemize} \item Draw $ k = \alpha \sigma^{-1} $ samples $Y^{ \left( j \right) }_1 , \dots , Y^{(j)}_{k}$ from the uniform distribution. \item If $Y^{\left( j \right)}_i \notin S_j \left( X_1 , \dots , X_{j-1} \right) $, then $Z^{\left( j \right)}_i = Y^{\left( j \right)}_i$. \item Else, for $i$ such that $Y^{\left( j \right)}_i \in S_j \left( X_1 , \dots , X_{j-1} \right) $, sample $\tilde{W}^{\left( j \right)}_i \sim S_j \left( X_1 , \dots , X_{j-1} \right) $ and set $Z^{\left( j \right)}_i =\tilde{W}_i^{\left( j \right)}$. \item Pick $X_j $ randomly from $ \left\{ \tilde{W}_i^{\left( j \right)} \right\} $. If there is no $Y^{\left( j \right)}_i \in S_j \left( X_1 , \dots ,X_{j-1} \right) $, then $X_j \sim S_j \left( X_1 , \dots ,X_{j-1} \right) $. \end{itemize} \item Output $ \left( X_1 , Z_{1}^{ \left( 1 \right)} , \dots , Z_{k}^{\left( 1 \right)} , \dots, X_t , Z_{1}^{ \left( t \right)} , \dots , Z_{k}^{\left( t \right)} \right) $. \end{itemize} \end{framed} \begin{theorem} \label{thm:main_coupling_1} Let $ \left( X_1 , Z_{1}^{ \left( 1 \right)} , \dots , Z_{k}^{\left( 1 \right)} , \dots, X_t , Z_{1}^{ \left( t \right)} , \dots , Z_{k}^{\left( t \right)} \right) $ be as above. Then, \begin{itemize} \item[a.] $X_1 , \dots , X_t$ is distributed according $\adist$. \item[b.] $ Z_i^{\left( j \right)} $ are uniformly distributed on $\left[ n \right]$. \item[c.] Furthermore, $ Z_i^{\left( j \right)} $ are all mutually independent. \item[d.] With probability at least $1 - t \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} $, $ \left\{ X_1 , \dots , X_t\right\} \subseteq \left\{ Z_i^{\left( j \right)} \right\}_{ i \in \left[ k \right] , j\in \left[ t \right] } $ . \end{itemize} \end{theorem} \begin{proof} To see that $X_1 \dots X_t$ is distributed according to $\adist$, note that from the construction and \cref{lem:single_round}, we have that conditioned on $X_1 \dots X_{i-1}$, $X_i$ is uniformly distributed according on $S\left( X_1, \dots , X_{i-1} \right)$ as required. In order to show the independence of $ Z_{i}^{\left( j \right)} $, consider any subset $T$ of $ \left\{ Z_{i}^{\left( j \right)} \right\} $. Let $T = \{ Z_{i_1}^{\left( j_1 \right)} , \dots , Z_{i_m}^{\left( j_m \right)} \} $, with $j_1 \leq j_2 \dots \leq j_m $. Then, \begin{align*} \Pr \left[ Z_{i_m}^{\left( j_m \right)} = z_{i_m}^{\left( j_m \right)} | \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} \right] = \Pr \left[ z_{i_m}^{\left( j_m \right)} \notin S\left( X_1 \dots X_{j_m - 1} \right) \land Y_{i_m}^{j_m} = z_{i_m}^{\left( j_m \right)} \bigg\vert \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} \right] \\ + \Pr \left[ z_{i_m}^{\left( j_m \right)} \in S\left( X_1 \dots X_{j_m - 1} \right) \land Y_{i_m}^{j_m} \in S\left( X_1 \dots X_{j_m - 1} \right) \land \tilde{W}_{i_m}^{\left( j_m \right)} = z_{i_m}^{\left( j_m \right)} \bigg\vert \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} \right] . \end{align*} We will deal with each of these terms separately. \begin{align*} \Pr \left[ z_{i_m}^{\left( j_m \right)} \notin S\left( X_1 \dots X_{j_m - 1} \right) \land Y_{i_m}^{j_m} = z_{i_m}^{\left( j_m \right)} \bigg\vert \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} \right] \\ = \frac{1}{n} \cdot \Pr \left[ z_{i_m}^{\left( j_m \right)} \notin S\left( X_1 \dots X_{j_m - 1} \right) \bigg\vert \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} \right] . \end{align*} This follows since $Y_{i_m}^{j_m} $ is independent of $X_1 \dots X_{j_m - 1}$ and $\left\{ Z_{i_p}^{\left( j_p \right)} \right\}_{p < m} $. Moving to the second term, \begin{align*} &\Pr \left[ z_{i_m}^{\left( j_m \right)} \in S\left( X_1 \dots X_{j_m - 1} \right) \land Y_{i_m}^{j_m} \in S\left( X_1 \dots X_{j_m - 1} \right) \land \tilde{W}_{i_m}^{\left( j_m \right)} = z_{i_m}^{\left( j_m \right)} \bigg\vert \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} \right] = \\ &\hspace*{ - 55 pt}\Ex \left[ \Pr \left[ z_{i_m}^{\left( j_m \right)} \in S\left( x_1 \dots x_{j_m - 1} \right) \land Y_{i_m}^{j_m} \in S\left( x_1 \dots x_{j_m - 1} \right) \land \tilde{W}_{i_m}^{\left( j_m \right)} = z_{i_m}^{\left( j_m \right)} \bigg\vert \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} , X_1 = x_i \dots X_{j_m - 1} = x_{j_m - 1} \right]\right] = \\ & \frac{1}{n} \cdot \Ex \left[ \Pr \left[ z_{i_m}^{\left( j_m \right)} \in S\left( x_1 \dots x_{j_m - 1} \right) | \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} , X_1 = x_i \dots X_{j_m - 1} = x_{j_m - 1} \right] \right] = \\ & \frac{1}{n} \cdot \Pr \left[ z_{i_m}^{\left( j_m \right)} \in S\left( X_1 \dots X_{j_m - 1} \right) \bigg\vert \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} \right] . \end{align*} Summing the two terms, we get \begin{align*} \Pr \left[ Z_{i_m}^{\left( j_m \right)} = z_{i_m}^{\left( j_m \right)} | \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_{p < m} \right] = \frac{1}{n} \end{align*} Recursively applying this to $T \setminus \{ Z_{i_m}^{\left( j_m \right)} \} $, we get \begin{equation*} \Pr \left[ \left\{ Z_{i_p}^{\left( j_p \right)} = z_{i_p}^{\left( j_p \right)} \right\}_T \right] = \frac{1}{n^{\abs{T}}} \end{equation*} proving the required independence. As in \cref{lem:single_round}, we have that the probability that $X_j \notin \{ Z_i^{\left( j \right)} \} $ is bounded by $ \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} $. By the union bound, we have \begin{equation*} \Pr \left[ \exists j : X_j \notin \{ Z_i^{\left( j \right)} \} \right] \leq t \cdot \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} \end{equation*} as required. \end{proof} \subsection{General Smooth Distributions} In order to move from the special case of uniform distributions on subsets of size $n \sigma$, we need to note that smooth distributions are convex combinations of uniform distributions on subsets of size $\sigma n $. \begin{lemma} Let $\mathcal{P}$ be the set of $\sigma$ smooth distributions on $\left[ n \right]$ and let $\mathcal{P}_0$ be the set of distributions that are uniform on subsets of size $\sigma n $. Then, \begin{equation*} \mathcal{P} = \mathrm{conv} \left( \mathcal{P}_0 \right). \end{equation*} \end{lemma} In particular, this implies that for each $ \sigma $-smooth distribution $\mathcal{D}$, there is a distribution $\mathcal{S}_{\mathcal{D}} $ on subsets of size $\sigma n$ such that sampling from $\mathcal{D} $ can be achieved by first sampling $S \sim \mathcal{S}_{\mathcal{D}} $ and then sampling uniformly from $S$. Moving onto adaptive sequences of smooth distributions, recall that corresponding to each $X_1 , \dots , X_i$ is a smooth distribution $ \adist_t \left( X_1, \dots , X_i \right) $. We will use $\mathcal{S}_t \left( X_1 , \dots , X_i \right) $ to denote $\mathcal{S}_{ \adist\left( X_1 , \dots , X_i \right) }$. The idea is to use this in conjunction with the coupling from discussed earlier to get a coupling for all $\sigma$-smooth distributions. That is, in each stage, a set $S_t $ is first sampled from $ \mathcal{S}_t \left( X_1 , \dots , X_i \right) $ and then $S_t$ is used in the previous mentioned coupling. For infinite domains, similar argument can be made using the Choquet integral representation theorem which gives a way to represent smooth distributions as convex combinations of uniform distributions on sets of large measure. Putting this together leads to \cref{thm:main_coupling_overview}. \begin{framed} \begin{itemize} \item For $j = 1 \dots t$, \begin{itemize} \item Sample $ k = \alpha \sigma^{-1} $ many samples from the uniform distribution. \item Let $S_j \left( X_1 , \dots , X_{j-1} \right)$ be sampled from $\mathcal{S }_{j} \left( X_1 , \dots , X_{j-1} \right) $. \item If $Y^{\left( j \right)}_i \notin S_j \left( X_1 , \dots , X_{j-1} \right) $, then $Z^{\left( j \right)}_i = Y^{\left( j \right)}_i$. \item Else, for $i$ such that $Y^{\left( j \right)}_i \in S_j \left( X_1 , \dots , X_{j-1} \right) $, sample $\tilde{W}^{\left( j \right)}_i \sim S_j \left( X_1 , \dots , X_{j-1} \right) $ and set $Z^{\left( j \right)}_i =\tilde{W}_i^{\left( j \right)}$. \item Pick $X_j $ randomly from $ \left\{ \tilde{W}_i^{\left( j \right)} \right\} $. If there is no $Y^{\left( j \right)}_i \in S_j \left( X_1 , \dots ,X_{j-1} \right) $, then $X_j \sim S_j \left( X_1 , \dots ,X_{j-1} \right) $. \end{itemize} \item Output $ \left( X_1 , Z_{1}^{ \left( 1 \right)} , \dots , Z_{k}^{\left( 1 \right)} , \dots, X_t , Z_{1}^{ \left( t \right)} , \dots , Z_{k}^{\left( t \right)} \right) $. \end{itemize} \end{framed} \begin{theorem}[\cref{thm:main_coupling_overview} restated] \label{thm:main_coupling} Let $ \adist $ be an adaptive sequence of $\sigma$-smooth distribution on $\X$. Then, there is a coupling $\Pi$ such that $ \left( X_1 , Z_{1}^{ \left( 1 \right)} , \dots , Z_{k}^{\left( 1 \right)} , \dots, X_t , Z_{1}^{ \left( t \right)} , \dots , Z_{k}^{\left( t \right)} \right) \sim \Pi $ satisfy \begin{itemize} \item[a.] $X_1 , \dots , X_t$ is distributed according $\adist$. \item[b.] $ Z_i^{\left( j \right)} $ are uniformly and independently distributed on $\X$. \item[c.] $ \{ Z_i \left( j \right) \}_{j \geq t} $ are independent and uniform conditioned on $X_1 , \dots, X_{t-1}$. \item[d.] With probability at least $1 - t \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} $, $ \left\{ X_1 , \dots , X_t\right\} \subseteq \left\{ Z_i^{\left( j \right)} \mid i \in \left[ k \right] , j\in \left[ t \right] \right\} $ . \end{itemize} \end{theorem} \section{Adaptive Smooth Adversaries and Dispersed Sequences} In this section, we consider the problem of online optimization and show that adaptive smooth adversaries create \emph{dispersed} sequences. Recall that in the online optimization settings, an adversary chooses a sequence of functions $u_1, \dots, u_T$ such that $u_t : \X \to \left[0, 1\right]$ and the learner responds by taking instances $x_1, \dots, x_T \in \X$ with a goal of minimizing the regret. The main theorem of this section shows that when $u_i$s are piecewise Lipschitz functions and are chosen by an adaptive smooth adversary in such a way that the discontinuities of these functions are is smoothed, the resulting sequence of functions is dispersed. \begin{theorem}[Adaptive Smoothness leads to Dispersion] \label{thm:ada_disp} Let $u_1, \dots, u_T$ be functions from $\left[ 0,1 \right] \to \br $ that are piecewise Lipschitz with $\ell$ discontinuities each. Let $d_{i,j}$ denote the discontinuities of $u_i$ and that are sampled from an adaptive sequence of $\sigma$-smooth distributions. Then, for any $\alpha \geq 0.5 $, with probability $1-\delta$ the sequence of functions $u_1 \dots u_T $ is $(w, k)$-dispersed for \begin{equation*} w = \sigma(T \ell)^{ \alpha - 1} ~ \text{ and } ~ k = \tilde{O}\left( \left( T \ell \right)^{\alpha } \ln\left( \frac{1}{\delta}\right) + \ln\left(\frac 1\sigma\right) \right) . \end{equation*} \end{theorem} \subsection{Overview of \cite{Dispersion} and the need for Obliviousness} \cite[Lemma 13]{Dispersion} showed a similar result to \cref{thm:ada_disp} but for sequences that are generated by an oblivious smooth adversary. The crux of their argument is showing that for the number of points that can lie in any ball of small radius is small when these points are drawn \emph{independently} from a non-adaptive sequence of $\sigma$-smooth distributions. More formally, they show that $\ell$ points are picked from a non-adaptive sequence of $\sigma$-smooth distributions over $\left[ 0,1 \right]$, then with probability $1-\delta$, any interval of width $w$ contains at most \begin{equation} O\left(\frac{T \ell w}{ \sigma} + \sqrt{T \ell \log \left( \frac{1}{\delta} \right)} \right) \label{eq:dispersion-balcan} \end{equation} points. Setting $w = \sigma (T \ell)^{\alpha -1}$ for an $\alpha \geq 0.5$ then \cite{Dispersion} showed that for a \emph{non-adaptive} smooth adversary, with probability $1-\delta$, $u_1 \dots u_T $ is $\left( \sigma (T \ell)^{\alpha -1}, O\big( (T \ell)^{\alpha} \ln(\frac{1}{\delta}) \big)\right)$-dispersed. The only step in the existing analysis that requires the adversary to be non-adaptive is that of proving \autoref{eq:dispersion-balcan}. Here, \cite{Dispersion} relies on the obliviousness of the adversary an uses the fact that points drawn from a non-adaptive sequence of smooth distributions are independently (but not identically) distributed. Their approach leverages this independence between the instances and the fact that VC dimension of intervals is $2$ to use the double sampling and symmetrization tricks from VC theory and establish a uniform convergence property on the number of instances that can fall in any interval of width $w$. \subsection{Reducing Adaptivity to Obliviousness for Dispersion via the Coupling} \label{sec:dispersion} We emphasize that \autoref{eq:dispersion-balcan} is the only step in the existing approach that relies on the obliviousness of the adversary. In this section, we show how the coupling lemma can be used to obtain (almost) the same upper bound as of \autoref{eq:dispersion-balcan} for adaptive adversaries. Our approach is essentially the same as the proof of \cref{lem:net_bound} used for regret minimization, where we had to bound the expected maximum number of smooth adaptive instances that can fall in any function $g\in \G$ of bounded VC dimension. In this case, we can apply the same results to the class of intervals, which has a VC dimension of $2$, and bound the number of discontinuities than fall in any interval. We make another small change to our previous approach to achieve high probability bounds instead of bounds on the expectation. \begin{lemma} \label{lem:dispersion-instances} Let $\mathcal{J}$ be the set of all intervals of width at most $w$ over $[0,1]$. For $i\in [T]$ and $j\in[\ell]$, let $d_{i,j}$ be drawn from a $T\ell$-step adaptive sequence of $\sigma$-smooth random variables over $[0,1]$. Then, with probability $1-\delta$, \begin{equation*} \max_{J\in \mathcal{J}} \sum_{\substack{i\in[T]\\j\in[\ell]}} \mathbb{I} \left[ d_{i,j} \in J \right] < \frac{T \ell w}{\sigma} \ln \left( \frac{2 T \ell }{ \delta} \right) + 10\sqrt{ \frac{T \ell w }{ \sigma} \ln \left( \frac{2 T \ell }{ \delta} \right) \ln \left( \frac{1}{\delta}\right) } + 10\log\left( \frac{10 T \ell \log \left( 2T \ell /\delta \right) }{\sigma \delta} \right) \end{equation*} \end{lemma} \begin{proof} Let $\adist$ represent the $T\ell$-step adaptive sequence of $\sigma$-smooth distributions from which $d_{i,j}$s are drawn. Let $k= \frac{\ln(2T\ell/\delta)}{\sigma}$ and consider the coupling $\Pi$ described in \cref{sec:Coupling} over $\left(d_{i,j }, Z_{1}^{\left(i,j\right)} \dots Z_{k }^{\left( i,j \right)} \right)_{i\in[T], j\in [\ell]}$, where $d_{i,j}$s are distributed according to $\adist$ and $Z_{m}^{(i,j)}$s are distributed according to the uniform distribution over $[0,1]$. Let $\mathcal{E}$ be the event $ \left\{ d_{i , j } \mid \forall i\in [T], j\in [\ell] \right\} \not\subseteq \left\{ Z_{m}^{\left( i,j \right)} \mid \forall m\in [k], i\in[T], j\in [\ell]\right\} $. By \cref{thm:main_coupling_overview}, $\Pr[\mathcal{E}]\leq T\ell(1-\sigma)^{k}$. We now bound the probability that the number of instances $d_{i,j}$s that fall in any interval of size $w$ is bigger than a threshold $\theta$, using the coupling argument. We have \begin{align*} \Pr_\adist\left[ \max_{J\in \mathcal{J}} \sum_{i,j} \mathbb{I} \left[ d_{i,j} \in J \right] \geq \theta \right] &= \Pr_{\Pi}\left[ \max_{J\in \mathcal{J}} \sum_{i,j} \mathbb{I} \left[ d_{i,j} \in J \right] \geq \theta \right] \\ & = \Pr_{\Pi}\left[ \mathcal{E} \land \max_{J\in \mathcal{J}} \sum_{i,j} \mathbb{I} \left[ d_{i,j} \in J \right] \geq \theta \right] + \Pr_{\Pi}\left[ \overline{\mathcal{E}} \land \max_{J\in \mathcal{J}} \sum_{i,j} \mathbb{I} \left[ d_{i,j} \in J \right] \geq \theta \right] \\ & \leq T \ell \left( 1 - \sigma \right)^{k} + \Pr_{\Pi}\left[ \overline{\mathcal{E}} \land \max_{J\in \mathcal{J}} \sum_{i,j} \mathbb{I} \left[ d_{i,j} \in J \right] \geq \theta \right] \\ & \leq T \ell \left( 1 - \sigma \right)^{k} + \Pr_{\Pi}\left[ \overline{\mathcal{E}} \land \max_{J\in \mathcal{J}} \sum_{i,j,m} \mathbb{I} \left[ Z^{(i,j)}_{m} \in J \right] \geq \theta \right] \\ & \leq T \ell \left( 1 - \sigma \right)^{k} + \Pr_{\Pi}\left[ \max_{J\in \mathcal{J}} \sum_{i,j,m} \mathbb{I} \left[Z^{(i,j)}_{m} \in J \right] \geq t \right]. \end{align*} Now, using uniform convergence bounds (see e.g. \cite[Page 201]{bousquet2003introduction}) for $\mathcal{J}$, which has a VC dimension of $2$ and the fact that for any $J\in \mathcal{J}$, $\Pr\left[ Z_{m}^{\left( i , j \right)} \in J \right] \leq {w}$, we have that \[ \Pr_{\U}\left[ \max_{J\in \mathcal{J}} \sum_{i,j,m} \mathbb{I}\left[Z^{(i,j)}_{m} \in J \right] \geq T \ell k w + 10 \sqrt{T\ell w k \ln(T\ell k / \delta)} + 10\log\left( 10 T \ell k / \delta \right) \right] \leq \frac \delta 2. \] Replacing in values of $k= \frac{\ln(2T\ell/\delta)}{\sigma}$ and using the result of the above coupling, we have \begin{equation*} \Pr\left[ \max_{J\in \mathcal{J}} \sum_{i,j} \mathbb{I} \left[ d_{i,j} \in J \right] \geq \frac{T \ell w}{\sigma} \log \left( \frac{2 T \ell }{ \delta} \right) + 10\sqrt{ \frac{T w \ell }{ \sigma} \log \left( \frac{2 T \ell }{ \delta} \right) \ln \left( \frac{1}{\delta}\right) } + 10\log\left( \frac{10 T \ell \log \left( 2T \ell /\delta \right) }{\sigma \delta} \right) \right] \leq \delta \end{equation*} as required. \end{proof} \subsection{Proof of \cref{thm:ada_disp}} The proof of this theorem follows directly from \cref{lem:dispersion-instances} and by setting $w = \sigma (T \ell)^{\alpha-1} $ for $\alpha \geq 0.5$.\qed We note that \cref{thm:ada_disp} shows that even adaptive smooth adversaries generate sequence of functions that are sufficiently dispersed. This result enables us to directly tap into the results and algorithms of \cite{Dispersion} that show that online optimizing on any dispersed sequence enjoys improved runtime and regret bounds. \section{Proofs from \cref{sec:RegretBounds}} \begin{lemma} \label{lem:Littlestone} Let $ \H $ be the class defined on $ \left[ \nicefrac{1}{\sigma} \right] $ as the disjoint union of $ d $ thresholds as in \cref{sec:regretlowerproof}. Then, the Littlestone dimension of $ \H$ is lower bounded by $ \Omega\left( \sqrt{ d \log \left( \nicefrac{1}{d\sigma} \right) } \right) $. \end{lemma} \begin{proof} In order to prove this associate to each string $ \left\{ 0, 1 \right\}^{d \log\left( 1 / \sigma d \right)} $ a function in $ \mathcal{H}$ as follows. Partition the string into blocks of size $ \frac{1}{\sigma d}$. We think of each of these blocks as forming a binary search tree for the subset $A_i$ by associating $ 1 $ to the right child of a node and $0$ to the left child. Thus, every path on this tree corresponds to a threshold by associating it with the threshold consistent with the labels along the path. Doing this association separately for each block, we can associate the set of strings $ \left\{ 0, 1 \right\}^{d \log\left( 1 / \sigma d \right)} $ with a binary search tree with the leaves labeled by elements in $ \H$. Also, note that this forms a fully shattered tree as required by the definition of the Littlestone dimension. Thus, the Littlestone dimension of $ \H$ is $ d \log \left( \nicefrac{1}{\sigma d} \right) $. \end{proof} \subsection{Anti-concentration Paragraphs } In most applications where smoothed or average case analysis have led to drastic improvement over the worst-case analysis, algorithm design or analysis is leveraging anti-concentration properties of the input to get these improvements. However, as the process of creating an input becomes more and more adaptive, that is, as the adversary correlates the distribution of its current instances with the realizations of earlier instances and algorithm's actions, the randomness and anti-concentration properties of the input or the state of the algorithm may weaken. Additionally, correlations between future and past instances also create challenges as many of the tools that are used in smoothed analysis rely on the independence of input. Our coupling approach implicitly shows that adaptivity in smoothed analysis does not significantly weaken the anti-concentration properties of the input and allow us to lift algorithmic ideas and analysis that are designed for oblivious or stochastic adversaries to design and analyze algorithms that interact with an adaptive smooth adversary. An important property of our coupling is that, with high probability, $\left\{ X_1 , \dots , X_t\right\} \subseteq \big\{ Z_i^{\left( j \right)} \mid i \in [k] , j\in [t] \big\}$. This set containment property along with the fact that $Z_i^{(t)}$ are i.i.d uniform variables is an especially useful feature for lifting algorithms and proof techniques from the oblivious world that rely on anti-concentration. That is, when algorithm's failure mode is only triggered by the concentration of $X_1 , \dots , X_t$, then replacing in $\big\{ Z_i^{\left( j \right)} \mid i \in [k] , j\in [t] \big\} \supseteq X_1 , \dots , X_t$ can only increase the likelihood of hitting a failure mode. On the other hand, uniform and independent random variables, $Z_i^{(t)}$s, demonstrate excellent anti-concentration properties that are superior to most other offline stochastic or oblivious smooth distributions. Therefore, existing proofs and algorithms that work well in the stochastic or oblivious smooth settings, will continue to work well for adaptive smooth adversaries. \section{Uniform Convergence Bounds under Independence} \label{app:claim:oblivious-bernstein-regret} \begin{lemma}[\cite{boucheron2013concentration}] \label{lem:VC1} Let $\mathcal{A}$ be a countable class of measurable subsets of $\X$ with $\vc\left( \mathcal{A} \right) =d $ Let $Z_1, \dots Z_n$ be independent random variables taking values in $\X$. Assume that $ \Pr\left[ X_i \in A \right] \leq \epsilon $ for all $A \in \mathcal{A} $. Let \begin{equation*} Q = \frac{1}{\sqrt{n}} \sup_{A \in \mathcal{A} } \sum_{i=1}^n \left( \mathbb{I} \left[ X_i \in A \right] - \Pr\left[ X_i \in A \right] \right) . \end{equation*} Then, \begin{equation*} \Ex\left[ Q \right] \leq 72 \sqrt{ \epsilon d \log \left( \frac{4 e^2}{ \epsilon } \right) } \end{equation*} whenever $ \epsilon \geq \frac{120 d \log\left( \frac{4e^2}{\epsilon} \right) }{n } $. \end{lemma} We use the above theorem to get the required bound for the expected maximum of the process indexed by a VC class under our coupling. \begin{lemma} \label{lem:VC} Let $\G$ be a class with $\vc \left( \G \right) = d $ and $g \in \G $, $\Ex g( \gamma ) \leq \epsilon$ where $\gamma$ is uniformly distributed. Then, for $ \left\{ \gamma_i \right\}_{i \in \left[ Tk \right] } $ independetly and uniformly distributed, \begin{equation*} \Ex \, \left[ \sup_{g \in \G } \sum_{i} g\left( \gamma_i \right) \right] \leq 72 \sqrt{\epsilon Tk d \log \left( 1 / \epsilon \right) } + Tk\epsilon \end{equation*} for $\epsilon > \frac{120d \log \left( 4 e^2 / \epsilon \right)}{ Tk } $. \end{lemma} \begin{proof} Consider the random variable $Q = \frac{1}{ \sqrt{Tk} } \left[ \sup_{g \in \G} \sum_{i = 1}^{Tk} g\left( \gamma_i \right) - \Ex \left[ g\left( \gamma_i \right) \right] \right] $ where $\gamma_i$ are independent uniform random variables. Note that $ \Ex \left[ g\left( \gamma_i \right) \right] \leq \epsilon $. Note that this satisfies the conditions of \cref{lem:VC1} Thus, \begin{equation*} \Ex \left[ Q \right] \leq 72 \sqrt{\epsilon d \log\left( \frac{4 e^2}{\epsilon} \right) }, \end{equation*} whenever $ \epsilon \geq \frac{120 d \log \left( \frac{4e^2}{\epsilon} \right) }{T k } $. Thus, we have \begin{equation*} \Ex \left[ \sup_{g \in \G} \sum_{i = 1}^{Tk} g\left( \gamma_i \right) - \Ex \left[ g\left( \gamma_i \right) \right] \right] \leq 72 \sqrt{\epsilon T k d \log\left( \frac{4 e^2}{\epsilon} \right) }. \end{equation*} Recalling that $\Ex \left[ g\left( \gamma_i \right) \right]\leq \epsilon $, we get the desired result. \end{proof} \section{Proofs from } \section{Proofs from \cref{sec:Discrepancy} } \label{sec:miss_proof_disc} \begin{lemma} [\cite{Bansal_Discrepancy}] \begin{equation*} \Ex_{X_t} \left[ Q \left( X_t \right) \right] \leq c \lambda^2 \Ex_{ W \sim p } \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} \end{equation*} and \begin{equation*} \Ex_{X_t} \left[ Q_{*} \left( X_t \right) \right] \leq \frac{c \lambda^2}{n } \end{equation*} \end{lemma} \begin{proof} \begin{align*} \Ex_{X_t} \left[ Q \left( X_t \right) \right] & = \Ex_{X_t} \left[ \lambda^2 \Ex_{ W \sim p } \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} W^{\top} X_tX_t^{\top} W \right] \\ & = \lambda^2 \Ex_{ W \sim p } \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} W^{\top} \Ex_{X_t} \left[ X_tX_t^{\top} \right] W \\ & = c \lambda^2 \Ex_{ W \sim p } \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} \end{align*} Similarly, \begin{align*} \Ex_{X_t } \left[ Q_{*} \left( X_t \right) \right] &= \Ex_{X_t } \left[ \lambda^2 \Ex_{ W \sim p } W_j^{\top} X_t X_t^{\top} W \right] \\ & \leq \frac{c}{n}\lambda^2 \end{align*} as required. \end{proof} \section{Discrepancy} \label{sec:Discrepancy} In this section, we consider the online vector balancing problem with adaptive smooth adversaries and achieves bounds that are almost as small as the stochastic setting where instances are drawn from the uniform distributions. Recall that in the online vector balancing or discrepancy problem, at every round $t$ the algorithm see a new vector $X_t$ with bounded norm and has to assign a sign $\epsilon_t \in \{-1,1\}$ to it. The goal of the algorithm is to ensure that for all $t\leq T$, \begin{equation*} \norm{ \sum_{i = 1}^t \epsilon_i X_i }_{\infty} \end{equation*} is small. This problem is studied under different choice of norms, but we restrict our our discussion to the infinity norm. In the adaptive adversarial model, where the adversary's choice of vector $X_t$ could depend on the past choices of the algorithm and the adversary, i.e., $\epsilon_1, \dots, \epsilon_{t-1}$ and $X_1, \dots, X_{t-1}$, no algorithm can obtain discrepancy bound of $O\left( \sqrt{T} \right)$. On the other hand, recent works of \cite{Bansal_Discrepancy} and \cite{ALS_Disc} have shown that $\mathrm{polylog}(nT)$ discrepancy bounds are achievable when $X_t$s are drawn from a fixed distribution or are fixed by an oblivious adversary in advance. We consider the online discrepancy problem under against an adaptive $\sigma$-smooth adversary. That is, the adversary chooses a $\sigma$-smooth distribution for $X_t$ after having observed $\epsilon_1, \dots, \epsilon_{t-1}$ and $X_1, \dots, X_{t-1}$. We also restrict our attention to the isotropic case where the covariance matrix $\Ex_{X_t} \left[ X_t X_t^{\top} \right] = cI$ for some $c$. In this section, we give discrepancy bounds that smoothly interpolate between the stochastic and adaptive cases. \begin{theorem} \label{thm:main_discrepancy} Let $\adist$ be an adaptive sequence of $\sigma$-smooth distributions, such that the distribution of $X_i$, with $\norm{X_i} \leq 1 $, at time $i$ is decided after observing $X_1 , \dots , X_{i-1} , \epsilon_1 , \dots , \epsilon_{i-1} $. {Furthermore, let $\Ex_{X_t} \left[ X_t X_t^{\top} \right] = cI $ for some some $c\in[0,1/n]$.} Then, there is an online algorithm for deciding the sign $\epsilon_i$ of $X_i$ such that with probability $1 - T^{-4}$ for all $t\leq T$ \begin{equation*} \norm{ \sum_{i = 1}^t \epsilon_i X_i } \leq O\left( \log^2 \left( \frac{ T n }{ \sigma} \right) \right). \end{equation*} \end{theorem} {We complement this upper bound by showing that we cannot get the logarithmic dependence on smoothness parameter $\sigma $, $n$ and $T$ simultaneously without further assumptions on the distribution such as isotropy. } \begin{theorem}\label{thm:disc_lowerbound} For any online algorithm, there is an adaptive sequence of $ \left( \nicefrac{1}{20 n^2T^2} \right) $-smooth distributions on the unit ball such that, we have \begin{equation*} \norm{ \sum_{i=1}^T \epsilon_i v_i }_{\infty} \geq \Omega \left( \sqrt{\frac{T}{n} } \right) \end{equation*} with probability $1 - \exp\left( - \nicefrac{T}{12} \right)$. \end{theorem} \subsection{Overview of Existing Approaches and their Need for Obliviousness} \label{sec:Discrepancy-bansal} \cite{Bansal_Discrepancy} consider various versions of the online discrepancy problem where the vectors are chosen stochastically from a fixed {known} distribution. One such problem is the stochastic online variant of the Komlos problem, where the input vectors come from a fixed distribution supported on the unit Euclidean ball, and the algorithms goal is to minimize the infinity norm of the discrepancy vector, i.e., $\| d_t\|_\infty$. To do this, \cite{Bansal_Discrepancy} introduced the following potential function \begin{equation*} \Phi_t = \Ex_{ W \sim p }\left[ \cosh \left( \lambda d_t^{\top} W \right)\right], \end{equation*} where $p$ denotes a mixture between sampling from the fixed distribution the vectors are drawn from and the basis vectors $e_i$s. { This potential can be seen as the exponential moment of the random variable $d_{t-1}^{\top} W$ that both bounds $ \lambda d_{t-1}^{\top}X_t \leq O \left(\log \left( T \Phi_{t-1} \right) \right) $ and induces an anti-concentration constraint on the correlations of the discrepancy vector $d_{t-1}$.} \cite{Bansal_Discrepancy} then uses an algorithm that at time $t$ observes $X_t$ and picks the sign $\epsilon_t$ that minimizes the increase in the potential function $\Phi_t - \Phi_{t-1}$, that is $\Delta \Phi = \Ex_{ W \sim p }\big[ \cosh\big( \lambda (d_{t-1} +\epsilon_t X_t) ^{\top} W \big)\big] - \Ex_{ W \sim p }\big[ \cosh \big( \lambda d_{t-1}^{\top} W \big)\big]$. At the heart of the analysis of \cite{Bansal_Discrepancy} is to show that in expectation over the choice of$X_t$ from the fixed distribution, $\Delta\Phi$ remains small at every time step. It is not hard to see that once the expected increase in the potential is upper bounded, standard martingale techniques can be used to bound the potential and thus the discrepancy at every time step. To bound $\Delta \Phi$, \cite{Bansal_Discrepancy} considers Taylor expansion of the potential function as follows \begin{equation} \Delta \Phi \lesssim \epsilon_t \lambda \Ex_{ W \sim p }\left[ \sinh \left( \lambda d_{t - 1}^{\top } W \right) X_t^{\top } W \right] + \lambda^2 \Ex_{ W \sim p }\left[\, \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} \cdot W^{\top} X_t X_t^{\top} W \right]. \label{eq:Bansal-decomp} \end{equation} \cite{Bansal_Discrepancy} leverages the the obliviousness of the adversary, i.e., the fact that $X_t$ arrive from a fixed distribution, and isotropy of $X$ to directly bound the linear and quadratic terms of the Taylor expansion as follows. The second term of \autoref{eq:Bansal-decomp} is bounded using the isotropy of the vector $X_t$ as follows \begin{equation*} \lambda^2 \Ex_{ W \sim p } \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} W^{\top} X_t X_t^{\top} W \leq \frac{1}{n } \lambda^2 \Ex_{ W \sim p } \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)}. \end{equation*} As for the first term of \autoref{eq:Bansal-decomp}, note that since the algorithm picks $\epsilon_t$ to minimize the potential rise, it is sufficient to upper bound $ \Ex_{X_t} \left[ - \big| \lambda \Ex_{ W \sim p } \big[ \sinh \big( \lambda d_{t - 1}^{\top } W \big) X_t^{\top } W \big] \big| \right]. $ Since the potential is the exponential moment of the $\lambda d_{t-1}^{\top}X_t $ and $X_t$s are drawn from an oblivious distribution, we have that $ \lambda d_{t-1}^{\top}X_t \leq O \left(\log \left( T \Phi_{t-1} \right) \right) $ with high probability. Thus, we get \begin{align*} \Ex_{X_t} \left[\, \abs{\lambda \Ex_{ W \sim p } \sinh \left( \lambda d_{t - 1}^{\top } W \right) X_t^{\top } W}\right] & \gtrsim \frac{1}{\ln(T\Phi_{t-1 })} \Ex_{X_t} \left[ \lambda^2 \Ex_{ W \sim p } \left[ \sinh \left( \lambda d_{t - 1}^{\top } W \right) d_{t-1}^{\top} X_t X_t^{\top } W \right] \right] \\ & \gtrsim \frac{ \lambda }{n \ln(T \Phi_{t-1 })} \Ex_{ W \sim p }\left[\, \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} - 2 \right]. \end{align*} using the fact that $ a \sinh (a) \geq \abs{\sinh \left( a \right)} - 2 $ and the isotopy of the distribution. Summing these two terms, we get \begin{align*} \Delta \Phi & \lesssim - \frac{ \lambda }{n \ln(T \Phi_{t-1 })} \Ex_{ W \sim p }\left[\, \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} - 2 \right] + \frac{1}{n } \lambda^2 \Ex_{ W \sim p } \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} \\ & \lesssim 2. \end{align*} We get we choose $\lambda$ such that $\lambda^{-1} \leq \log\left( T \Phi_{t-1} \right) $ if $\Phi \leq \poly\left( T \right) $. This tells us that that if the potential is small, then the change in the potential is small as required. Let us now review the steps where the obliviousness of the adversary was crucial for the analysis of \cite{Bansal_Discrepancy}. The main step is the definition and the interpretation of the potential function, that controls the moments of $d_{t-1}^{\top} X_t $ assuming that $X_t$ comes from a fixed distribution and the future vector that are represented in $W\sim p$. That is, obliviousness is primarily used to show that $\lambda d_{t-1}^\top X_t \leq O(\ln(T \Phi_{t-1}))$. In an adaptive (smooth) setting where the distribution of $X_t$ and the future vectors differ and are unknown an adversary can correlate $X_t$ and the future vectors with $d_{t-1}$. It is not immediately clear how to directly adapt the potential function to account for the an evolving sequence of distributions. A possible approach for directly altering the potential function is to work with worst-case evolution of smooth distribution across a single time step. This seems both algorithmically challenging to deal with and as we see next unnecessary. \subsection{From Adaptive to Oblivious through Coupling} \label{sec:discrepency:smooth} We emphasize that the main step in which \cite{Bansal_Discrepancy} leveraged the obliviousness of the adversary is to show that their potential function defined over random $X_t$ and a random $W\sim p$ that balances between future observations and the standard basis has the property that $\lambda d_{t-1}^\top X_t \leq O(\ln(T \Phi_{t-1}))$. We use the coupling argument to show that a similarly defined potential function in our case also demonstrate the same bounds. The main observation that allows us to move from the oblivious adversary to the adaptive adversary is that the coupling discussed in \cref{sec:coupling_overview} gives us a way to upper bound the probability that $d_{t-1}^\top X_t$ is large under an adaptive sequence of smooth distributions in terms of the probability under the uniform distribution. Let us start by defining the algorithm that obtains our results of \cref{thm:main_discrepancy} analogously to the algorithm of \cite{Bansal_Discrepancy} for the uniform distribution. At step $t$, our algorithm observes vectors the discrepancy vector $d_{t-1}$ (which is a function of $\epsilon_{1}\dots, \epsilon_{t-1}$ and the previous vectors) and receives a new vector $X_t$ that is to be colored. Let $\epsilon_t$ denote the sign that our algorithm will assign to $X_t$ and let $d_t = d_{t-1} + \epsilon_t X_t$. Let $p$ denote the following distribution. \begin{equation*} \begin{cases} Z \sim \mathcal{U} & \text{ with probability } \frac{1}{2} \\ e_i \text{ where } e_i \sim p_{\mathrm{basis}} & \text{ with probability } \frac{1}{2} \end{cases}, \end{equation*} where $p_{\mathrm{basis}}$ is the uniform distribution on the standard basis vectors (with both positive and negative signs). Defined the potential function \begin{equation*} \Phi_t = \Ex_{ W \sim p }\left[\cosh \left( \lambda d_t^{\top} W \right) \right], \end{equation*} for $\lambda = 1000 \ln\left( knT \right) $ where $k$ is a parameter to be set later. At step $t$ observing $X_t$ our algorithm greedily picks the $\epsilon_t$ minimizes the potential difference, that is \[ \Phi_t - \Phi_{t-1} = \Ex_{W\sim p}\left[\cosh \left( \lambda (d_{t-1} + \epsilon_t X_t)^{\top} W \right) \right] - \Ex_{W\sim p} \left[\cosh \left( \lambda d_{t-1}^{\top} W \right) \right].\] The following lemma uses the coupling argument to bound the probability tails of $d_{t-1}^\top X_t$. \begin{lemma} \label{lem:prob_upper} Consider any fixed $d_{t-1}$ vector and $X_t$ that is sampled from an arbitrary $\sigma$-smooth distribution. Then, \begin{equation*} \Pr_{X_t}\left[ \lambda d_{t-1}^{\top} X_t \geq 4 \ln \left( \frac{4 k \Phi_{t-1}}{\delta} \right) \right] \leq \left( 1 - \sigma \right)^k + \delta . \end{equation*} \end{lemma} \begin{proof} We will use the coupling from \cref{sec:main_coupling}. In particular, we can use a single-step coupling from \cref{lem:single_round} that shows that there exists a coupling $\Pi$ on $\left( \tilde{X_t} , Z_1^{\left( t \right)} , \dots , Z_k^{\left( t \right)} \right)$ such that $\tilde{X_t}$ has the same distribution as $X_t$, $Z_1^{\left( t \right)} , \dots , Z_k^{\left( t \right)}$ are uniformly and independently distributed and with probability at most $ \left( 1 - \sigma \right)^k $, we have $ \tilde{X_t} \notin \left\{ Z_1^{\left( t \right)} , \dots , Z_k^{\left( t \right)} \right\} $. Let $\mathcal{E}$ denote the event where $ \tilde{X_t} \notin \left\{ Z_1^{\left( t \right)} , \dots , Z_k^{\left( t \right)} \right\} $. Then, for any $\theta$ \begin{align*} \Pr_{X_t}\left[ \lambda d_{t-1}^{\top} X_t \geq \theta \right] & = \Pr\left[ \exp\left(\lambda d_{t-1}^{\top} X_t \right) \geq \exp(\theta) \right] \\ & = \Pr_{\Pi} \left[ \mathcal{E} \land \left\{ \exp\left( \lambda d_{t-1}^{\top} \tilde{X}_t \right)\geq \exp(\theta) \right\} \right] + \Pr_{\Pi}\left[ \overline{\mathcal{E} } \land \left\{ \exp\left(\lambda d_{t-1}^{\top} \tilde{X}_t \right) \geq \exp(\theta) \right\} \right] \\ & \leq \left( 1 - \sigma \right)^{k} + \Pr_{\Pi}\left[ \overline{\mathcal{E} } \land \left\{ \sum_{i=1}^{k} \exp\left( {\lambda d_{t-1}^{\top} Z_{i}^{\left( t \right)} } \right) \geq \exp(\theta) \right\} \right] \\ & \leq \left( 1 - \sigma \right)^{k} + \Pr_{\Pi}\left[ \sum_{i=1}^{k} \exp\left({\lambda d_{t-1}^{\top} Z_{i}^{\left( t \right)} } \right) \geq \exp(\theta) \right] \\ & \leq \left( 1 - \sigma \right)^{k} + \exp(-\theta) \Ex_{\Pi}\left[ \sum_{i=1}^{k} \exp\left({\lambda d_{t-1}^{\top} Z_{i}^{\left( t \right)} } \right) \right] \qquad \text{(By Markov inequality)}\\ & \leq \left( 1 - \sigma \right)^{k} + 2 \exp(-\theta) \Ex_{\Pi}\left[ \sum_{i=1}^{k} \cosh\left( \lambda d_{t-1}^{\top} Z_{i}^{(t)} \right) \right] \qquad \text{(By} \exp(x)\leq 2\cosh (x) \text{)}\\ & \leq \left( 1 - \sigma \right)^{k} + 4 \exp(-\theta) \sum_{i=1}^{k} \Ex_{W\sim p}\left[ \cosh\left( \lambda d_{t-1}^{\top} W \right) \right] \qquad \text{($p$ is w.p. $0.5$ uniform)} \\ & \leq \left( 1 - \sigma \right)^{k} + 4 k \Phi_{t-1} \exp(-\theta), \end{align*} Setting $\theta = \ln\left( \frac{4k \Phi_{t-1}}{\delta} \right)$ completes the proof. \end{proof} \subsection{Proof of \cref{thm:main_discrepancy}} Our proof follows the same approach as that of ~\cite{Bansal_Discrepancy} outlined in \cref{sec:Discrepancy-bansal} and aims to bound $\Ex_{X_t}[\Phi_t] - \Phi_{t-1}$ at every time step. The main technical challenge is to upperbound the linear term $\Ex_{X_t}[-|L(X_t)|]$ in $\Delta \Phi_t$ as a function of the correlation between $d_{t-1}$ and $X_t$ drawn from a $\sigma$-smooth distribution. We then use our \cref{lem:prob_upper} that controls this correlation to bound the linear term. Recall from \cref{sec:discrepency:smooth} that our algorithm observes $X_t$ and picks the $\epsilon_t$ that minimizes the potential difference, that is \[ \Phi_t - \Phi_{t-1} = \Ex_{W\sim p}\left[\cosh \left( \lambda (d_{t-1} + \epsilon_t X_t)^{\top} W \right) \right] - \Ex_{W\sim p} \left[\cosh \left( \lambda d_{t-1}^{\top} W \right) \right].\] The next lemma shows that when the potential at time $t-1$ is small, the expected increase in $\Phi_t$ over the choice of $X_t$ is small. \begin{lemma} \label{lem:potential} At any time $t$, if $\Phi_{t-1} \leq T^6 $, then $ \Ex_{X_t } \left[ \Phi_t \right] - \Phi_{t-1} \leq 2 $. \end{lemma} \begin{proof} Denote $ \Delta \Phi = \Phi_t - \Phi_{t-1} $. As in \cite{Bansal_Discrepancy}, we decompose this as \begin{align*} & \Delta \Phi \left( X_t \right) = \Ex_{ W \sim p } \left[ \cosh \left( \lambda (d_{t - 1}^{\top} + \epsilon_t X_t ) W \right) \right] - \Ex_{ W \sim p } \left[ \cosh \left( \lambda (d_{t - 1}^{\top} ) W \right) \right] \\ & \leq \epsilon_t \lambda \Ex_{ W \sim p } \left[ \sinh \left( \lambda d_{t - 1}^{\top } W \right) X_t^{\top } W \right] + \lambda^2 \Ex_{ W \sim p } \left[\ \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} W^{\top} X_t X_t^{\top} W \right] + \lambda^2 \Ex_{ W \sim p } \left[ W^{\top} X_t X_t^{\top} W\right]. \end{align*} Using notation similar to \cite{Bansal_Discrepancy}, we will denote the first term in last equation as $\epsilon_t L\left( X_t \right) $, the second as $Q \left( X_t \right)$ and the third as $Q_{*} \left( X_t \right)$. We need to upper bound $ \Ex_{X_t} \left[ \Delta \Phi(X_t) \right] $ and thus it suffices to bound these three quantities. Our approach for upper bounding $\Ex_{X_t} \left[ Q \left( X_t \right) \right] $ and $\Ex_{X_t} \left[ Q_{*} \left( X_t \right) \right]$ is similar to \cite{Bansal_Discrepancy} and uses that fact that the distribution of $X$ is isotropic (without the need to bring in smoothness). We state these bounds in the following claim and include the proof of them for completeness in \cref{sec:miss_proof_disc}. \begin{claim}\label{claim:lem:quadratics} Let $Q$ and $Q_{*}$ be defined as above. Then, \begin{equation*} \Ex_{X_t} \left[ Q \left( X_t \right) \right] \leq c \lambda^2 \Ex_{ W \sim p } \left[\ \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)}\ \right] \quad \text{ and } \quad \Ex_{X_t} \left[ Q_{*} \left( X_t \right) \right] \leq \frac{ c\lambda^2 }{n}. \end{equation*} \end{claim} To upper bound $\Ex[\epsilon_tL(X_t)]$, we need to use both the smoothness of $X_t$ and their isotropic nature. First note that since $\epsilon_t$ is chosen to minimize the potential drop, we can bound $\Ex_{X_t} \left[ \epsilon_t L\left( X_t \right) \right] \leq - \Ex_{X_t} \left[ \ \abs{L\left( X_t \right) }\right]$. So it's sufficient to lower bound $\Ex_{X_t} \left[\abs{L(X_t)} \right]$. \begin{claim} \label{claim:lem:linear} Let $L$ be defined as above. Then, \begin{equation*} \Ex_{X_t} \left[\ \abs{L\left( X_t \right) }\right] \geq \frac{c\lambda}{\ln\left( 4k \Phi_{t-1} / \delta \right)} \Ex_{ W \sim p }\left[\ \abs{ \sinh \left( \lambda d_{t - 1}^{\top } W \right) } \right] - 1 \end{equation*} \end{claim} \begin{proof}[Proof of \cref{claim:lem:linear}] Let $B = \ln\left( 4k \Phi_{t-1} / \delta \right)$ and let $G $ be the event that $\lambda \abs{d_{t-1}^{\top} X_t } \leq B$. Note that $\abs{L\left( X_t \right)} \geq L\left( X_t \right) \cdot f\left( X_t \right) / \norm{f}_{\infty} $ for any function $f$. We will use the function $f \left( X_t \right) = d_{t-1}^{\top} X_t \cdot \mathbb{I} \left[ X_t \in G \right] $ and note that $\norm{f}_\infty\leq B/\lambda$. This allows us to decompose $ \abs{L}$ further as follows. \begin{align*} & \Ex_{X_t} \left[\, \abs{L \left( X_t \right) } \right] \geq \Ex_{X_t} \left[ \frac{\lambda^2}{B } \Ex_{ W \sim p } \left[ \sinh \left( \lambda d_{t - 1}^{\top } W \right) d_{t - 1}^{\top} X_t X_t^{\top} W \cdot \mathbb{I} \left( X_t \in G \right) \right] \right] \\ &= \frac{\lambda^2}{B } \Ex_{ W \sim p }\left[ \sinh \left( \lambda d_{t - 1}^{\top } W \right) d_{t - 1}^{\top} \Ex_{X_t} [X_t X_t^{\top}] W \right] - \frac{\lambda^2}{B } \Ex_{ W \sim p } \left[ \sinh \left( \lambda d_{t - 1}^{\top } W \right) d_{t - 1}^{\top} \Ex_{X_t} \left[ X_t X_t^{\top} \mathbb{I} \left( X_t \notin G \right) \right] W \right]. \end{align*} Looking at the second term in the above equation and using the fact that $X$ is an isotropic distribution and \cref{lem:prob_upper} (which used the smoothness of $X$), we have \begin{equation*} \norm{ \Ex_{X_t} \left[ X_t X_t^{\top} \mathbb{I} \left( X_t \notin G \right) \right] }_{\mathrm{op}} \leq \Pr\left[ X_t \notin G \right] \leq \left( 1 - \sigma \right)^k + \delta. \end{equation*} Ensuring that $k >> \sigma^{-1} \ln \left( 1 /\delta \right) $ by $k = 100 \sigma^{-1} \ln \left( T \ln \left( T \right) \right) $ and noting that $\norm{d_{t-1}} \leq T $ \begin{equation*} d_{t - 1}^{\top} \Ex_{X_t} \left[ X_t X_t^{\top} \mathbb{I} \left( X_t \notin G \right) \right] W \leq 2 \delta T . \end{equation*} Picking $\delta^{-1} = 2\lambda \Phi_{t-1} T $, we get \begin{equation*} \lambda \abs{ d_{t - 1}^{\top} \Ex_{X_t} \left[ X_t X_t^{\top} \mathbb{I} \left( X_t \notin G \right) \right] W } \leq \Phi_{t-1}^{-1} . \end{equation*} Now let us consider the first term of the above decomposition. Using the fact that $X$ is an isotropic random variable, we have \begin{align*} \frac{\lambda^2}{B } \Ex_{ W \sim p } \left[ \sinh \left( \lambda d_{t - 1}^{\top } W \right) d_{t - 1}^{\top} \Ex_{X_t} [X_t X_t^{\top}] W \right] & = \frac{ c\lambda}{B } \Ex_{ W \sim p }\left[ \sinh \left( \lambda d_{t - 1}^{\top } W \right) \lambda d_{t - 1}^{\top} W \right] \\ & \geq \frac{ c\lambda}{B } \Ex_{ W \sim p }\left[\, \abs{ \sinh \left( \lambda d_{t - 1}^{\top } W \right) } -2 \right], \end{align*} where the last inequality used the fact that $ a\sinh\left( a \right) \geq \abs{\sinh(a)} -2 $. Putting the inequalities together, we get \begin{align*} \Ex_{X_t} \left[ \abs{L\left( X_t \right) }\right] & \geq \frac{c\lambda}{B } \Ex_{ W \sim p } \left[\, \abs{ \sinh \left( \lambda d_{t - 1}^{\top } W \right) } -2\right] - \frac{c\lambda}{B} \Phi_{t-1}^{-1} \Ex_{ W \sim p } \left[\, \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right) } \right] \\ & \geq \frac{c\lambda}{B } \Ex_{ W \sim p } \left[\, \abs{ \sinh \left( \lambda d_{t - 1}^{\top } W \right) }\right] - \frac{2 c \lambda}{B} - \frac{\lambda}{B} \\ & \geq \frac{c \lambda}{B } \Ex_{ W \sim p }\left[\, \abs{ \sinh \left( \lambda d_{t - 1}^{\top } W \right) } \right] - 1, \end{align*} where the second transition is by the definition of $\Phi_{t-1}$ and the third transition is by the values of $\lambda^{-1} = 1000\ln(knT)$, $B = \ln(8\lambda k T \Phi^2_{t-1})$, and the assumption that $\Phi_{t-1}\leq T^6$. This completes the proof of \cref{claim:lem:linear}. \end{proof} We now use \cref{claim:lem:quadratics} and \cref{claim:lem:quadratics} to finish the proof of \cref{lem:potential} as follows \begin{align*} \Ex_{X_t} \left[ \Delta \Phi \left( X_t \right) \right] & \leq \Ex_{X_t} \left[ - \abs{L} + Q + Q_{*} \right] \\ & \leq -\frac{c\lambda}{B } \Ex_{ W \sim p }\left[\, \abs{ \sinh \left( \lambda d_{t - 1}^{\top } W \right) } \right]+ 1 + c \lambda^2 \Ex_{ W \sim p } \left[\, \abs{\sinh \left( \lambda d_{t - 1}^{\top } W \right)} \right]+ \frac{c\lambda^2 }{n} \\ & \leq 2 \end{align*} Here, we use the fact that $\lambda \leq B^{-1} $ which {follows from $\lambda^{-1} = 1000\ln(knT)$, $B = \ln(8\lambda k T \Phi^2_{t-1})$, and the assumption that $\Phi_{t-1}\leq T^6$.} This completes the proof of \cref{lem:potential}. \end{proof} Note that the above argument gives us $ \Ex_{X_t} \left[ \Delta \Phi | \Phi_{t-1} \right] \leq 2 $ given that $ \Phi_{t-1} \leq T^6 $. We truncate $\Phi_t$ at $ T^6 $, i.e. setting $ \tilde{\Phi_t} = \Phi_t $ till $\Phi_t \leq T^6 $ and $ \tilde{\Phi}_t = T^6 $ afterwards. Using this and the Doob maximal martingale inequality, it follows that $ \Phi_t \leq T^6 $ with probability $1 - T^4$ as required. Next, we will see why bounding the potential suffices to bound the discrepancy. Recall that the potential was defined as $\Phi_t = \Ex_{ W \sim p }\left[ \cosh \left( \lambda d_t^{\top} W_i \right) \right]$. Since with probability $1/2 $, $p$ samples uniformly from the set of basis vectors $p_{basis}$ and given that $\exp(x) \leq 2 \cosh(x) $, we have $ \exp\left( \lambda \abs{ d_{t}^{\top} {e_i} } \right) \leq \sum_{i=1}^n \exp\left( \lambda \abs{ d_{t}^{\top} {e_j} } \right) \leq 8 n \Phi_t $ for all basis vectors $e_j$. Thus, we have \begin{equation*} \norm{ d_t }_{\infty} = \norm{ \sum_{i=1}^t \epsilon_i X_i } \leq \lambda^{-1} \ln\left( 4n \Phi_t \right). \end{equation*} Recall that $\lambda^{-1} = 1000 \ln \left( \frac{nT \ln(T)}{\sigma} \right)$, which gives us that \begin{equation*} \norm{ \sum_{i=1}^t \epsilon_i X_i } \leq \tilde{O} \left( \ln^2 \left( \frac{nT}{\sigma} \right) \right) \end{equation*} as required. \subsection{Proof of \cref{thm:disc_lowerbound}} Here, we show that the isotropy condition is required for our online discrepancy upper bound. Recall that the worst-case adversary for discrepancy generated vectors that were orthogonal to the current discrepancy vector at each time. The idea for this proof is that even with the smoothness requirements, the adversary can generate vectors such that the inner products are concentrated near zero, leading to high discrepancy. Let the discrepancy vector at time $t$ be denoted by $d_t$. Consider the set $S_t = \left\{ x : \norm{x}_2 \leq 1, \abs{\ip{x}{ {d_{t-1}} } } \leq n^{-2} T^{-2} \norm{d_{t-1}}_2 \right\}$. Note that the uniform distribution on $S_t$ is $ c n^{-2}T^{-2} $ smooth for some constant $c$. To see this, let $ \mathcal{U} $ denote the uniform distribution on the unit ball and let $V_n$ denote the volume of the unit ball in $n$ dimensions. Then, \begin{align*} \Pr_{ X \sim \mathcal{U} } \left[ X \in S_t \right] &= \frac{1}{V_n} \int_{-n^{-2}T^{-2} }^{n^{-2} T^{-2}} \left( 1 - x^2 \right)^{\frac{n-1}{2}} V_{n-1} dx \\ & \geq \frac{1}{V_n} \int_{-n^{-2}T^{-2} }^{n^{-2} T^{-2}} \left( 1 - \frac{1}{n^4 T^4} \right)^{\frac{n-1}{2}} V_{n-1} dx \\ & \geq \frac{V_{n-1}}{V_n} \cdot \frac{1}{ 2 n^{2}T^2 } \\ & \geq \frac{1}{ 20 n^{2}T^2 }. \end{align*} The second inequality follows by noting that $ \left( 1 - n^{-4}T^{-4} \right)^{\frac{n-1}{2}} \geq \nicefrac{1}{4} $. With this, we describe the adversary's strategy. At time $t$, the adversary picks $v_t$ uniformly from $S_t$. We will measure the squared $2$-norm of the discrepancy vector. \begin{align*} \norm{d_{t}}^2_2 &= \norm{ \epsilon_t v_t + d_{t-1} }^2_2 \\ & = \epsilon_t^2 \norm{v_t}^2_2 + \norm{d_{t-1}}^2_2 + 2 \ip{v_t}{d_t} \\ & \geq \norm{v_t}^2_2 + \norm{d_{t-1}}^2_2 - \frac{2 \norm{d_{t-1}}_2 }{n^2T^2} \\ & \geq \norm{v_t}^2_2 +\norm{d_{t-1} }^2_2 - \frac{2}{ n^2 T } \\ & \geq \sum_{i=1}^t \norm{v_i}_2^2 - \frac{2t}{n^2 T} . \end{align*} Note that $ \Pr\left[ \norm{v_i}_2 \leq \nicefrac{1}{2} \right] \leq 2^{-\left( n-1 \right)} $. This can be seen by noting that the probability can be computed with an integral similar to the one above but with ball of radius $\nicefrac{1}{2}$ instead of the ball of radius $1$. Also, note that the lengths $ \norm{v_i}_2 $ are independent across $i$ {(even though $v_i$ themselves are not independent).} Denote $z_i$ as a random variable which is $1$ if $ \norm{v_i} \geq \nicefrac{1}{2} $ and $0$ otherwise. Then, \begin{equation*} \sum_{i=1}^t \norm{v_i}_2^2 \geq \frac{1}{4} \sum_{i=1}^t z_i . \end{equation*} Applying a Chernoff bound to $z_i$, we get \begin{equation*} \Pr\left[ \sum_{i=1}^t \norm{v_i}^2_2 \leq \frac{t}{8} \left( 1 - 2^{-\left( d-1 \right) }\right) \right] \leq e^{ - \frac{ t }{12} }. \end{equation*} Thus with probability $1 - e^{- \frac{t}{12}}$, \begin{equation*} \norm{d_t}^2_2 \geq \frac{t}{ 16} - \frac{2t}{n^2T } \geq \frac{t}{20}. \end{equation*} We get the desired result by relating the $2$-norm and $\infty$-norm. This shows that we cannot get the logarithmic dependence on smoothness parameter $\sigma $, $n$ and $T$ simultaneously without further assumptions on the distribution such as isotropy. \subsection{Overview of our Results} \begin{table} \centering \small{ \begin{tabular}{|c|c|c|c|} \hline & Worst Case & Stochastic/ Oblivious & Adaptive Smoothed \\ \hline Online Learning & $\tilde{\Theta} \left( \sqrt{T \cdot \ldim } \right) $ & $\tilde{\Theta} \left( \sqrt{T \cdot d } \right) $ & $\tilde{\Theta} \left( \sqrt{T \cdot d \log\left( 1 / \sigma \right) } \right) $ \\ & \cite{ben2009agnostic} & \cite{haghtalab2018foundation} & \cref{thm:regret-main} \\ \hline Online Discrepancy & $\Omega\left( \sqrt{T/ n} \right) $ & $O\left( \log\left( n T \right) \right)$\cite{ALS_Disc} & $\tilde{O} \left( \log^2 \left( n T / \sigma \right) \right) $ \\ & \cite{ten_lectures} & $O\left( \log^4\left( n T \right) \right)$ \cite{Bansal_Discrepancy} & \cref{thm:main_discrepancy} (also isotropic) \\ \hline Dispersion & $\left( w , T \ell \right)$ & $\left( \sigma (T \ell)^{\alpha -1}, O\left( (T \ell)^{\alpha} \right)\right)$ & $\left( \sigma (T \ell)^{\alpha -1}, \tilde{O}\left( (T \ell)^{\alpha} \right)\right)$ \\ & $\forall w;$ (trivial) & \cite{Dispersion} & \cref{thm:ada_disp} \\ \hline \end{tabular} } \caption{\small{This table compares and summarizes the results of this paper and those from previous works. In this table, $T$ is the time horizon, $\sigma$ is the smoothness parameter, $d$ is the VC dimension of the hypothesis class in online learning, $n$ is the dimension of the space for online discrepancy, $\ell$ is the number of discontinuities of piecewise Lipschitz functions in online optimization, and $\alpha\in \left[ 0.5, 1 \right] $ is arbitrary. }} \end{table} Throughout this paper we consider $\sigma$-smooth adaptive adversaries. A $\sigma$-smooth distribution $\D$ is a distribution whose densities are bounded by $1/\sigma$ times the density of the uniform distribution over a domain. Formally this definition is captured as follows. \begin{definition}[$\sigma$-smoothness] Let $\X$ be a domain that supports a uniform distribution $\U$.\footnote{Such as $\X$ that is finite or has finite Lebesgue measure.} A measure $\mu$ on $ \X $ is said to be $\sigma$-smooth if for all measurable subsets $A \subset \X$, we have $\mu \left( A \right) \leq \frac{\U\left( A \right)}{\sigma} $. \end{definition} { This parameterized definition of ``sufficiently concentrated'' is the standard one that has been used in smoothed analysis over the past decade, for example in all analyses of the smoothed running time of local search heuristics \cite{manthey_2021}. It prevents an adversary from concentrating most of its probability mass near a specific worst-case input (as is necessary for any interesting results) without resorting to any parametric assumptions. } We focus on smoothed analysis of adaptive adversaries that at time $t$ pick a $\sigma$-smooth distribution $\D_t$ after having observed earlier instances $x_1\sim \D_1, \dots, x_{t-1}\sim \D_{t-1}$ and algorithmic choices. We denote an adaptive sequence of $\sigma$ distributions by $\adist$. We use $\adist$ to model smoothed analysis of online learning, online discrepancy, and online optimization with an adaptive adversary. \paragraph{Online Learning.} We work with the setting of smoothed \emph{online adversarial and (full-information) learning}. In this setting, a learner and an adversary play a repeated game over $T$ time steps. For a labeled pair $s = (x, y)$ and a hypothesis $h\in \H$, $\mathbb{I} \left[ h(x) \neq y \right] $ indicates whether $h$ makes a mistake on $s$. In every time step $t\in [T]$ the learner picks a hypothesis $h_t$ and adversary picks a distribution $\D_t$ whose marginal on $\X$ is $\sigma$-smooth and then draws $s_t\sim \D_t$. The learner then incurs penalty of $\mathbb{I} \left[ h(x_t) \neq y_t \right] $. We consider an \emph{adaptive} $\sigma$-smooth adversary and denote it by $\adist$, where $\D_t$ is selected by an adversary that knows the algorithm and has observed $s_1, \dots, s_{t-1}$ and $h_1, \dots, h_{t-1}$. Our goal is to design an online algorithm $\A$ such that expected regret against an adaptive adversary, \[ \Ex[\regret(\A, \adist)]{:=}\Ex_{\adist} \left[ \sum_{t=1}^T \mathbb{I} \left[ h_t(x_t) \neq y_t \right] - \min_{h\in \H} \sum_{t=1}^T \mathbb{I} \left[ h(x_t) \neq y_t \right] \right] \] is sublinear in $T$. {This is the most well-studied domain for the application of our techniques.} In the worst case (without smoothness), \cite{ben2009agnostic} showed that the optimal regret in online learning is characterized by finiteness of a combinatorial quantity known as the Littlestone dimension, more formally, it is $ \regret = \tilde{\Theta} \left( \sqrt{ \lsd \left( \F \right) T } \right)$. Unfortunately, the Littlestone dimension can be large even for classes where the VC dimension is small. \cite{NIPS2011_4262, haghtalab2018foundation, haghtalab2020smoothed} considered the smoothed analysis of online learning and asked whether regret bounds that are characterized by finiteness of $\vc(\H)$ are possible. For the oblivious smooth adversaries, \cite{haghtalab2018foundation} answered this in the positive. For adaptive smooth adversaries however, the best-known bounds are $\tilde{\Theta} \left( \sqrt{T \cdot \log \mathcal{N}_{\left[ \, \right]} } \right) $ where $\mathcal{N}_{\left[ \, \right]}$ denotes the \emph{bracketing number} which can be infinite even when $\vc(\H)$ is constant. In this paper, we bridge the gap between smoothed analysis of online learning with adaptive and non-adaptive adversaries, answer an open problem of \cite{NIPS2011_4262,haghtalab2018foundation}, and show that regret bounds against an adaptive smooth adversary are nearly the same as those in agnostic offline learning. \medskip \noindent\textbf{\cref{thm:regret-main}}(Informal)\textbf{.}\emph{ Let $\H$ be a hypothesis class of VC dimension $d$. There is an algorithm $\A$ such that for any adaptive sequence of $\sigma$-smooth distributions $\adist$ achieves a regret of \[ \Ex[\regret(\A, \adist )] \in \tilde{O} \left(\sqrt{Td \ln \left( \frac{T}{d \sigma } \right) } + d \ln\left( \frac{T }{d \sigma } \right) \right). \] } \medskip {We complement this by a nearly matching lower bound as follows.} \medskip \noindent\textbf{\cref{thm:regret_lowerbound}} (Informal)\textbf{.}\emph{ For every $d$ and $ \sigma $ such that $d \sigma\leq 1 $, there exists a hypothesis class $ \H $ with VC dimension $d$ such that for any algorithm $\A$ there is a sequence of $\sigma$-smooth distributions $\D$ where \begin{equation*} \Ex[\regret(\A, \D )] \in \Omega\left( \sqrt{T d \log \left( \frac{1}{\sigma d} \right) } \right). \end{equation*} } \medskip \paragraph{Online Discrepancy.} Our starting point is the Koml\'os problem. In this online discrepancy problem, we are given an online sequence of vectors $v_1, \dots, v_{T}$ with $\norm{v_i}_2 \leq 1$. Upon seeing $v_i$ we need to immediately and irrevocably assign sign $\epsilon_i \in \{-1, +1\}$ to $v_i$. Our goal is to keep the following discrepency vector small \begin{equation*} \max_{t\in [T]} ~~\norm{ \sum_{i=1}^t \epsilon_i v_i }_{\infty}. \end{equation*} This problem is interesting for various norms on the inputs and the discrepancy, here we restrict ourselves to $\ell_2$ and $\ell_{\infty}$ norms, respectively. It is not hard to see that in the fully adaptive setting, the adversary can pick a vector orthogonal to the current discrepancy vector leading to the $\ell_{\infty}$ discrepancy norm of growing as $ O \left( \sqrt{T/n} \right)$. To overcome this, stochastic versions of this problem have been considered where vectors $v_i$ are picked from a \emph{fixed and known} distribution from set of vectors with $\norm{v_i} \leq 1$. \cite{Bansal_Discrepancy} uses a potential-based approach to obtain a bound of $ O\left( \log^4 \left( n T \right) \right) $ for the stochastic setting. \cite{ALS_Disc} strengthens these results to hold for any sequence of inputs that is chosen by an oblivious (even deterministic) adversary and obtains $O \left( \log \left( n T \right) \right)$ on the discrepancy. We consider adversaries that pick a $\sigma$-smooth distribution $\D_t$ at time $t$ after having observed the earlier instances $v_1, \dots, v_{t-1}$ and their assigned signs $\epsilon_1, \dots, \epsilon_{t-1}$ and then draw $v_t\sim \D_t$. We bound the discrepancy of this setting by $O\big( \log^{2} \left( n T \right) \big) $. \medskip \noindent\textbf{\cref{thm:main_discrepancy}} (Informal)\textbf{.}\emph{ Let $v_1, \dots, v_T$ be chosen from an adaptive sequence of $\sigma$-smooth and isotropic distributions $\adist$.% Then, there is an online algorithm for deciding the sign $\epsilon_i$ of $v_i$, such that with high probability \begin{equation*} \max_{t\leq T}~ \norm{ \sum_{i = 1}^t \epsilon_i v_i }_{\infty} \leq O\left( \log^2 \left( \frac{ T n }{ \sigma} \right) \right). \end{equation*} } We note that our adaptive isotropic assumption is {mild}, as even for the case of stochastic uniform inputs (which are isotropic) the first $\mathrm{polylog}(nT)$ bound was introduced by \cite{bansal2020online} in STOC 2020. {Our next theorem further justifies the use of isotropic distributions by showing that smoothness alone is not enough to achieve a $\mathrm{polylog}(nT/\sigma)$ bound on discrepancy in presence of adaptive adversaries.} \medskip \noindent\textbf{\cref{thm:disc_lowerbound}} (Informal)\textbf{.}\emph{ For any online algorithm, there is an adaptive sequence of $ \left( \frac{1}{20 n^2T^2} \right) $-smooth distributions on the unit ball such that, we have \begin{equation*} \norm{ \sum_{i=1}^T \epsilon_i v_i }_{\infty} \geq \Omega \left( \sqrt{\frac{T}{n} } \right) \end{equation*} with probability $1 - \exp\left( - \frac{T}{12} \right)$. } \paragraph{Dispersion in Online Optimization.} In the online optimization setting, an adversary chooses a sequence of loss functions $u_1, \dots, u_T$ and at each time step the learner picks an instance $x_t$ in order to minimize regret \[ \sum_{t=1}^T u_t(x_t) - \min_x \sum_{t=1}^T u_t(x). \] \cite{Dispersion} studied this problem for piecewise Lipschitz functions and showed that regret is characterized by a quantity called \emph{dispersion}. At a high level, a sequence of functions is called \emph{dispersed} if no ball of small width intersects with discontinuities of many of these functions. \begin{definition}[Dispersion, \cite{Dispersion}] Let $u_1 , \dots , u_T : [0,1] \to \br$ be a collection of functions such that $u_i$ is piecewise Lipschitz over a partition $\mathcal{P}_i$ of $[0,1]$. We say that a partition $\mathcal{P}_i$ splits a set $A$ if $A$ intersects with at least two sets in $\mathcal{P}_i$. The collection of functions is called \emph{$\left( w , k \right)$-dispersed} if every interval of width $w$ is split by at most $k$ of the partitions $\mathcal{P}_1,\dots,\mathcal{P}_T $. This definition naturally extends to loss functions over $\br^d$ as well. \end{definition} Additionally, \cite{Dispersion} showed that when an oblivious $\sigma$-smooth adversary picks the discontinuities of piecewise Lipschitz functions, the resulting sequence is with high probability $\left( \sigma (T \ell)^{\alpha -1}, O\left( (T \ell)^{\alpha} \right)\right)$-dispersed, where $\alpha$ can be any value in $[0.5,1]$ where $\ell$ is the number of discontinuities. We extend this result to the case of adaptive smooth adversaries and recover almost matching bounds on dispersion parameters. Our work shows that adaptive smooth adversaries generate dispersed sequences in online optimization. This allows us to extend the power of algorithms designed for dispersed sequences, such as efficient online and private batch optimization~\cite{Dispersion}, to the larger setting of adaptive adversaries. \medskip \noindent\textbf{\cref{thm:ada_disp}} (Informal)\textbf{.}\emph{ Let $u_1 \dots u_T$ be functions from $\left[ 0,1 \right] \to \br $ that are piecewise Lipschitz with $\ell$ discontinuities each picked by a $\sigma$-smooth adaptive adversary. Then, for any $\alpha \geq 0.5 $, the sequence of functions $u_1 \dots u_T $ is $( \sigma(T \ell)^{\alpha -1}, \tilde{O}\left( \left( T \ell \right)^{\alpha } \right) )$-dispersed. } \medskip \section{Introduction (old)} Offline and online learnability are two of the most classical problems in the theory of machine learning. The first considers scenarios where a learner attempts to learn a highly accurate hypothesis on instances that are drawn i.i.d. from some fixed but unknown distribution and the second considers online scenarios where the instances are generated by an adversary. Offline and online learnability are characterized by two different notions of complexity of the hypothesis space: the VC dimension and the Littlestone dimension respectively. In many hypothesis classes, however, there is a large gap between these two notions of complexity, and as a result, there is a gap in our ability to learn in the offline and online settings. For example, while the class of $1$-dimensional threshold functions has a VC dimension of $1$ and can be learned in the offline i.i.d. setting with convergence rate of $O(\sqrt{T})$, but the Littlestone dimension of this class is unbounded, and so learning it in the online adversarial setting incurs $O(T)$ regret. Is there a middle ground between the i.i.d. and adversarial models that can lead to strong learnability results, like those achievable in the offline setting, but is still robust to the presence of an adversary? Smoothed analysis provides one approach to this question. Let us first consider the standard online learning setup with an instance space $\X$ and a set $\H$ of binary hypotheses each mapping $\X$ to $\Y =\{+1,-1\}$. Online learning is played over $T$ time steps, where at each step the learner picks a prediction function from a distribution and the \emph{adaptive} adversary chooses a pair of $(x_t, y_t) \in \X\times \Y$. The regret of an algorithm is the difference between the number of mistakes the algorithm makes and that of the best fixed hypothesis in $\H$. The basic goal in online learning is to obtain a regret of $o(T)$. We extend this model to accommodate smoothed adversaries. We say that a distribution $\D$ over instance-label pairs is {\em $\sigma$-smooth} if its density function over the instance domain is pointwise bounded by at most $1/\sigma$ times that of the uniform distribution. In the online learning setting this means that at step $t$, the adversary chooses an arbitrary $\sigma$-smooth distribution $\D_t$ from which $(x_t, y_t)\sim \D_t$ is drawn. \begin{equation*} \sum_{t=1}^T \mathbb{I} \left( \hat{y_t} \neq y_t \right) - \min_{h \in \mathcal{H} } \mathbb{I} \left( h \left( x_t \right) \neq y_t \right) \end{equation*} We would like to get regret that is sublinear in $T$. When $\alpha = 0$, that is the typical setting of online adversarial setting with no smoothing, it is well-known that $\mathbf{Regret} \in \tilde\Theta(\sqrt{T~\mathrm{LDim}(\F)})$, where $\mathrm{LDim}(\F)$ is the Littlestone Dimension of $\F$. We show that for general $\alpha$, i.e., non-zero smoothing, $\mathbf{Regret} \in \tilde\Theta(\sqrt{T~\mathrm{VCDim}(\F) \ln(1/\alpha)})$, where $\mathrm{LDim}(\F)$. That is smoothed online learning is possible if and only if offline learning is possible. \begin{theorem}[Main Theorem, Informal] There is an algorithm that achieves sublinear regret against smoothed, adaptive adversaries when the hypothesis class is of bounded VC-Dimension. \end{theorem} \subsection{Model} Let us first consider the standard online learning setup with an instance space $\X$ and a set $\H$ of binary hypotheses each mapping $\X$ to $\Y =\{+1,-1\}$. Online learning is played over $T$ time steps, where at each step the learner picks a prediction function from a distribution and the \emph{adaptive} adversary chooses a pair of $(x_t, y_t) \in \X\times \Y$. The regret of an algorithm is the difference between the number of mistakes the algorithm makes and that of the best fixed hypothesis in $\H$. The basic goal in online learning is to obtain a regret of $o(T)$. We extend this model to accommodate smoothed adversaries. We say that a distribution $\D$ over instance-label pairs is {\em $\sigma$-smooth} if its density function over the instance domain is pointwise bounded by at most $1/\sigma$ times that of the uniform distribution. In the online learning setting this means that at step $t$, the adversary chooses an arbitrary $\sigma$-smooth distribution $\D_t$ from which $(x_t, y_t)\sim \D_t$ is drawn. Why should smoothed analysis help in online learning? Consider the well-known lower bound for $1$-dimensional thresholds over $\X = [0,1]$, in which the learner may as well perform binary search and the adversary selects an instance within the uncertainty region of the learner that causes a mistake. While the learner's uncertainty region is halved each time step, the worst-case adversary can use ever-more precision to force the learner to make mistakes indefinitely. On the other hand, a $\sigma$-smoothed adversary effectively has bounded precision. That is, once the width of the uncertainty region drops below $\sigma$, a smoothed adversary can no longer guarantee that the chosen instance lands in this region. Similarly for differential privacy, there is a $\sigma$-smooth distribution that produces the same answers to the queries. Such a distribution has no more than $\alpha$ probability over an interval of width $\sigma\alpha$. So one can focus on computing the errors of the $1/(\sigma\alpha)$ hypotheses with discreized thresholds and learn a hypothesis of error at most $\alpha$. Analogous observations have been made in prior works (\cite{NIPS2011_4262}, \cite{Cohen-Addad}, \cite{Gupta_Roughgarden}), although only for very specific settings (online learning of $1$-dimensional thresholds, $1$-dimensional piecewise constant functions, and parameterized greedy heuristics for the maximum weight independent set problem, respectively). Our work is the first to demonstrate the breadth of the settings in which fundamentally stronger learnability guarantees are possible for smoothed adversaries than for worst-case adversaries. \subsection{Related Work} The study of online learning in the presence of a smoothed adversaries has received some attention recently. Below we consider a few works in this direction. Online learning Connecting online learnability and offline learnability Littlestone dimension has also been studied in model theory under the name $2$-rank. It can be shown that any class that has infinite Littlestone dimension must contain thresholds. It was recently shown that any class that can be privately learnt must have infinite Littlestone dimension \cite{private_PAC}. Smoothed analysis in algorithms \cite{Gupta_Roughgarden} considers the problem of application specific algorithm design. They consider the task of selecting a algorithm of a set of algorithms as a learning task and apply techniques from PAC learning and online learning to the problem. The part of their work most relevant to the current paper is the online learning aspect of it. They show that for the maximum weight independent set problem, there are instances that lead to linear regret. In order to circumvent this lower bound, they consider smoothed instances of the problem and show that this leads to inverse polynomial regret (in the size of the instance) albeit linear in the time horizon. This serves as a motivation to consider online learning in the smoothed setting and sets up a framework in which regret bounds against smoothed adversaries in online learning can be applied. \cite{NIPS20114262} considers the online learning problem when the action set of the adversaries is constrained. One of the constraints that they explicitly consider is the setting of smoothed adversaries. They show that the regret of a smoothed adversary can be bounded by an appropriately defined sequential Rademacher complexity. They also instantiate their bound for the class of thresholds and show $O \left( \sqrt{T} \right) $ regret, which can shown to be unachievable in the non-smoothed setting. \cite{Cohen-Addad} considers the online optimization of piecewise constant functions over the interval $\left[ 0,1 \right]$. The model they consider is that of a non-adaptive adversary that specifies smooth distributions from which to generate discontinuities of the piecewise constant functions. They give an algorithm that gets $O \left( \sqrt{T} \right) $ regret and can be implemented efficiently. \cite{Dispersion} introduces a notion called dispersion which gives a condition on an instance under which they show that online learning can be done efficiently. Roughly speaking, an instance of satisfies the dispersion condition if each ball of sufficiently small radius intersects the discontinuities of only a few of the functions. They show that under the dispersion condition, they show guarantees from online learning and private batch optimization. The paper also shows that non-adaptive adversaries drawing from a smooth distribution satisfies the dispersion condition. The main difference between our work and the previous work is that we consider adaptive adversaries. Previous work either shows regret bounds for specific classes \cite{NIPS20114262} or works under non-adaptive adversaries \cite{Cohen-Addad, Dispersion}. Our analysis makes use of the sequential Rademacher complexity characterization of the minimax regret considered by \cite{NIPS20114262}. Our analysis also shows regret guarantees using the VC-dimension of a general class where as \cite{Dispersion} gives the bounds in terms of the dispersion. It remains an interesting open question to prove or disprove that adaptive adversaries generate instances that are dispersed. \subsection{Technical Challenges} In this section, we give a overview of the challenges and technical contributions of the paper. We first summarize the techniques from the non-adaptive setting. In this setting, the adversary decides a sequence of smooth distributions $\nadist_1, \dots \nadist_2$ ahead of time and points $x_1 \sim \nadist_1 \dots x_T \sim \nadist_T $ are samples from these distributions. Note that here we have that each of the actions of the adversary is independent of the other. That is, $x_i $ and $x_j $ are statistically independent. But, these are not all identically distributed and thus it is not immediately clear how to relate the error to statistical learning. The idea is to consider a cover over the hypothesis class under the uniform distribution. Since the distributions are smooth, this cover approximates the class even under the distributions of $\nadist_i$. Since the samples are statistically independent, one can use ideas from uniform convergence to show that the difference in the classification error for the cover and classification error for the original hypothesis class is small. Note that, since we are considering a cover under a fixed distribution, the size of the cover depends only on the VC-dimension of the class (and on the error parameter). Since the cover is a finite set of hypotheses, one then can use a standard online learning algorithm, such as Hedge, in order to bound the regret. In the adaptive setting, the adversary can pick his distribution $\adist_i$ depending on the past instantiations of the noise. Though, this difference does not lead to a issue in the non-smoothed setting, the difference is evident in the smoothed setting. In particular, the previous proof idea does not carry over to this regime because the actions $x_j $ are no longer statistically independent and it is not clear how to apply ideas such as uniform convergence from statistical learning. That said, we will still continue to work with the net. As before using a no-regret strategy on the net leads to the following decomposition of the regret. \begin{equation*} \mathbb{E}[\regret(\A, \adist )] \leq O\left( \sqrt{T \ln(|\H'|)} \right) + \mathbb{E}_{\adist}\left[\max_{h\in \H}\min_{h'\in \H'} \sum_{t=1}^T 1\left(h(x_t) \neq h'(x_t) \right) \right]. \end{equation*} As noted before the issue is controlling the second term when the adversaries are adaptive. For ease of notation, let us redefine this term as \begin{equation*} \Ex_{\adist} \left[ \sup_{g \in \G } \sum_{i = 1}^T g\left( x_i \right) \right] \end{equation*} where $\G = \{ g : \exists h \in \H \text{ and } h' \in \H' \text{ with } d\left( h , h' \right) \leq \epsilon \text{ and } g = h \Delta h' \} $. Thus, the problem reduces to a problem of bounding the maximum of a process index by a hypothesis class under distributions that do not have independence. This will be our core technical challenge. The main idea in this work is to construct a coupling between sequences of smooth distributions and the independent samples for the uniform distribution. That is we construct a joint distribution between a sequence of random variables $X_1 \dots X_T$ and $Z_i^j$ such that the $X_i $ are distributed according to the smooth distribution of interest and the $Z_i^j$ are independent and uniformly distributed. The main property that we want from the coupling is that the set $\left\{ X_1 \dots X_T\right\} $ is a subset of the set $ \left\{ Z_i^j \right\} $ with high probability. The reason that this is interesting is that whenever we have $\left\{ X_1 \dots X_T\right\} \subset \left\{ Z_i^j \right\} $, we have \begin{equation*} \max_{g \in \G } \sum_{i = 1}^T g\left( X_i \right) \leq \max_{g \in \G } \sum_{i,j} g\left( Z_{i}^j \right) . \end{equation*} Thus, if this containment holds with sufficiently high probability, we can hope that the expectation is dominated by the expectation of the process on the right. This is similar in idea to that of stochastic domination though there we would insist on a coupling such that term on the right would with probability one dominate the term on the left. This difference turns out to be important as we shall discuss later. In order to understand this coupling, let us look a simple example. Let the domain be the unit interval. Consider a uniformly distributed random variable from the first half of the interval. This random variable is $ \nicefrac{1}{2} $ smooth. Now, if we draw constantly many samples from the uniform distribution, we should expect at least one of them to be in the first half. But conditioned on it being in the first half, we can think of this as being uniformly distributed on the first half. This is the key idea behind the coupling that we construct. This example already illustrates a technical consideration about the coupling allude to earlier in the discussion about stochastic domination. Even though if we take sufficiently many samples from the uniform distribution we should expect at least one to be in a large set, we could get unlucky and have no sample in this set. Thus, requiring the containment to always hold is a much more stringent requirement that ultimately will turn out to be unnecessary. We extend this idea to general sequences of smooth distributions that are adaptive. General ideas about couplings. Coupling arguments are ubiquitous in probability theory. They show up in many contexts such as when showing mixing, stochastic domination, optimal transport. Coupling of point processes Stochastic domination \section{Introduction} \paragraph{Smoothed analysis.} Kryptonite for worst-case analysis comes in the form of algorithms for which almost all inputs are ``easy'' and yet rare and pathological inputs are ``hard.'' Perhaps the most famous example is the simplex method for linear programming, which empirically always runs quickly but requires exponential time in the worst case (for all of the common pivot rules)~\cite{KM72}. Equally misleading is the worst-case exponential running time of many popular local search algorithms, such as the $k$-means clustering algorithm~\cite{arthur:vassilvitskii:2006} and the 2-OPT heuristic for the traveling salesman problem (TSP)~\cite{SY91}; such behavior is literally never observed for these algorithms in practice.\footnote{Note that in all of these examples, the problem of constructing a hard instance is challenging enough to justify its own research paper!} Taken literally, worst-case analysis recommends against using the simplex method to solve linear programs or local search as a heuristic for the TSP, flatly contradicting decades of real-world experience. Thus, for some important problems and algorithms, a more nuanced analysis framework is called for. But if not worst-case analysis, then what? Outside of applications with a stable and well-understood input distribution, average-case analysis is a far too specific approach. Spielman and Teng~\cite{ST04_2} introduced {\em smoothed analysis}, a novel interpolation between worst- and average-case analysis that is ideally suited for the analysis of algorithms that almost always perform well. In its original formulation, an adversary chooses an arbitrary (worst-case) input, which is then perturbed slightly by nature. Appealingly, the framework makes no assumptions about the input other than a small amount of uncertainty (e.g., due to measurement errors). In the more modern and general formulation of smoothed analysis, an adversary directly chooses an input distribution from a family of permissible distributions; nature then samples an input from the adversary's distribution. An algorithm is evaluated by its worst-case (over the adversarially chosen input distribution) expected (over the distribution) performance. Performance guarantees in this model (e.g., on the expected running time of an algorithm) are generally parameterized by the ``degree of anti-concentration'' enjoyed by the allowed input distributions. The holy grail in smoothed analysis is to prove guarantees on algorithm performance that, assuming only a low level of anti-concentration in the possible input distributions, are far closer to average-case guarantees than worst-case guarantees. \paragraph{Online learning, discrepancy minimization, and optimization.} Smoothed analysis makes sense for any numerical measure of algorithm performance, but to date the vast majority of work on the topic concerns the running time of algorithms for offline problems, as in the famous examples above. Our work here focuses on {\em online} problems---online learning, online discrepancy minimization, and online optimization---in which the input arrives incrementally over time and an irrevocable decision must be made at each time step. Online algorithms for these problems are traditionally assessed by their solution quality or regret (with running time a secondary concern). In the smoothed analysis version of these problems, the adversary is forced to choose each piece of the input---a point from a domain, a vector, or a function---from a distribution with non-negligible anti-concentration. The analysis of online algorithms traditionally distinguishes between {\em oblivious} adversaries who choose the entire input sequence up front (with knowledge only of the algorithm to be used) and {\em adaptive} adversaries that can condition each part of the input on the past. In the worst-case model, this distinction is relevant only for randomized algorithms, in which case adaptive adversaries choose each part of the input as a function of the algorithm's previous decisions. When the adversary itself is forced to randomize, as in the smoothed analysis model, the distinction between oblivious and adaptive adversaries takes on new meaning: while an oblivious adversary must choose a sequence of input distributions up front, an adaptive adversary can base its current choice of an input distribution on the decisions of the algorithm {\em and the realizations of the inputs} in previous time steps. {Online learning, discrepancy minimization and optimization play integral roles in a wide range of fields and applications, such as algorithm design \cite{ALO2015,MWU}, game theory \cite{blum_mansour_2007,PLG}, differential privacy \cite{Equivalence,MWHR,MWDiff}, control theory \cite{RegretControl,Control2}, design of medical trials \cite{Covariates}, and robust statistics \cite{RobustNoReg}. In these cases, adversary's adaptiveness both serves as a natural abstraction for correlations between past and presence and is an essential piece of the technical analyses (such as algorithmic reductions) that make these methods widely applicable. } \paragraph{The challenge of adaptive adversaries.} A basic question is: For which online problems are adaptive adversaries fundamentally more powerful than oblivious ones? In the smoothed analysis model, there is strong intuition about why a guarantee against oblivious adversaries might not extend to, or at least would be significantly harder to prove for, adaptive adversaries. A key to any smoothed analysis is, of course, to determine how to leverage the assumed anti-concentration properties of the permissible input distributions. With an oblivious adversary, the input distributions at each time step are independent of each other and of the algorithm's current state, and the assumed anti-concentration can typically be directly and separately exploited at each time step. An adaptive adversary, on the other hand, has the power to correlate inputs at different time steps with each other and with the algorithm's current state. This dependence seems to rule out the standard proof approaches in smoothed analysis. \paragraph{Our approach: preserving anti-concentration through a coupling-based reduction.} We introduce a general technique for reducing smoothed analysis with adaptive adversaries to the much simpler setting of oblivious adversaries. {We consider adaptive adversaries that at each time step choose an input distribution with density function bounded above pointwise by~$\tfrac{1}{\sigma}$ times that of the uniform.} The crux of our approach is a coupling argument, namely a joint distribution that connects $T$ random variables $(X_1, \dots, X_T)$ generated by an adaptive smooth adversary with $kT$ random variables $Z_i^{(t)}$ for $i\in [k]$ and $t\in [T]$ that are generated i.i.d.~from the uniform distribution. A key aspect of this coupling is a monotonicity property, that for $k = \tilde{\Theta}(1/\sigma)$, with high probability, $ \left\{ X_1 , \dots , X_T\right\} \subseteq \big\{ Z_i^{\left( j \right)} \mid i \in \left[ k \right] , j\in \left[ T \right] \big\}$. The properties of this coupling allow us to translate typical algorithms and proofs from the setting of oblivious adversaries to that of adaptive adversaries. For example, consider an algorithm that fails only when $X_1,\ldots,X_T$ ``concentrate,'' roughly meaning that many of the $X_i$'s land in an a priori chosen set of small measure (this is a recurring theme in the smoothed analysis of algorithms). After substituting in $\big\{ Z_i^{\left( j \right)} \mid i \in [k] , j\in [T] \big\} \supseteq \{X_1 , \dots , X_T\}$, the likelihood of this event only increases. (See ~\cref{sec:recipe} for precise statements.) On the other hand, i.i.d.~uniform random variables (the $Z_i^{(j)}$'s) have ideal anti-concentration properties for a smoothed analysis. The power of our coupling technique is in its versatility. To demonstrate this, we apply our coupling approach to applications to online learning, online discrepancy minimization, and dispersion in online optimization. In each of these problems, we show that existing analyses for oblivious adversaries fundamentally boil down to a suitable anti-concentration result. For online learning --- where our work resolves an open problem of \cite{NIPS2011_4262} --- what matters is the anti-concentration of the input instances in the symmetric difference between a hypothesis and its nearest neighbor in a finite cover of the hypothesis class. For online discrepancy minimization, what matters is the anti-concentration of correlations between discrepancy vectors and inputs. For dispersion, what matters is the anti-concentration of function discontinuities in small intervals. After isolating these key steps, we prove that the coupling approach can be used to lift them (and the algorithmic guarantees that they lead to) to the general case of adaptive adversaries. \section{Overview of the Techniques and Analysis} We introduce a general technique for reducing smoothed analysis with adaptive adversaries to the much simpler setting of oblivious adversaries. Our main general technique is a \emph{coupling} argument between random variables that are generated by an adaptive smooth adversary and those that are generated i.i.d.~from a uniform distribution. This coupling, that is a joint distribution between two random processes, demonstrates structural properties that are ideal for preserving and analyzing anti-concentration properties of smooth adversaries. This allows us to tap into existing techniques and algorithms that are designed for oblivious smooth adversaries and only rely on some anti-concentration properties of the input. We first give an overview of our coupling technique and its analysis in \cref{sec:coupling_overview} and then in \cref{sec:recipe} we give a general framework for applying coupling for smoothed analysis with adaptive adversaries. \subsection{Coupling Definition and Theorem statement} \label{sec:coupling_overview} In this section, we will give an overview of the coupling between smooth adaptive adversaries and the uniform distribution. A \emph{coupling} is a joint distribution between two random variables, or random processes, such that the marginals of this coupling are distributed according to the specified random variables. A more formal definition of a coupling is as follows. \begin{definition}[Coupling] Let $\mu$ and $\nu$ be two probability measures on the probability space $ \left( \X , \mathscr{F} \right) $ respectively. Then, a coupling between $\mu$ and $\nu$ is a measure $ \gamma $ on $ \left( \X \times \X , \mathscr{F} \otimes \mathscr{F} \right) $ such that for all $A \in \mathscr{F} $, we have % $\gamma \left( A \times X \right) = \mu\left( A \right) \text{ and } \gamma \left( X \times A \right) = \nu\left( A \right). $ This definition can be generalized in a natural way to multiple measures. \end{definition} Our main coupling theorem states that given any adaptive sequence of $\sigma$-smooth distributions, $\adist$, there is a coupling between a random sequence $(X_1, \dots,X_T)\sim \adist$ and uniformly distributed random variables $Z_{i}^{\left( t \right)} $ such that (with high probability) the set of uniform random variables includes set of adaptively generated $\sigma$-smooth variables. \begin{theorem} \label{thm:main_coupling_overview} Let $ \adist $ be an adaptive sequence of $\sigma$-smooth distribution on $\X$. Then, for each $ k >0 $, there is a coupling $\Pi$ such that $ \left( X_1 , Z_{1}^{ \left( 1 \right)} , \dots , Z_{k}^{\left( 1 \right)} , \dots, X_t , Z_{1}^{ \left( t \right)} , \dots , Z_{k}^{\left( t \right)} \right) \sim \Pi $ satisfy \begin{itemize} \item[a.] $X_1 , \dots , X_t$ is distributed according $\adist$. \item[b.] $ Z_i^{\left( j \right)} $ are uniformly and independently distributed on $\X$. \item[c.] $ \left\{ Z_i^{\left( j \right)} \mid j \geq t, i\in[k]\right\} $ are uniformly and independently distributed on $\X$, conditioned on $X_1 , \dots, X_{t-1}$. \item[d.] With probability at least $1 - t \left( 1 - \sigma \right)^{k} $, $ \left\{ X_1 , \dots , X_t\right\} \subseteq \left\{ Z_i^{\left( j \right)} \mid i \in \left[ k \right] , j\in \left[ t \right] \right\} $ . \end{itemize} \end{theorem} The key aspect of this theorem is the monotonicity property $ \left\{ X_1 , \dots , X_t\right\} \subseteq \big\{ Z_i^{\left( j \right)} \mid i \in \left[ k \right] , j\in \left[ t \right] \big\}$ that holds with high probability. This monotonicity and the fact that $Z_i^{\left( t \right)}$ are uniform are the crucial properties that allow us to reduce algorithms design and analysis against online adaptive adversaries to those designed against oblivious stochastic adversaries. We will give examples of how this coupling will be used in \cref{sec:recipe}. In the remainder of this section, we give an overview of the construction of this coupling and the proof sketch for \cref{thm:main_coupling_overview}. For ease of exposition, we mainly restrict ourselves to the finite universe $ \X = \left[ n \right]$ and work with smooth distributions that are uniform on an adaptively chosen subsets of size at least $\sigma n$ of the universe. We prove the theorem in its full generality in \cref{sec:main_coupling}. Let us first consider a single round of coupling between a random variable that is uniformly distributed over $S\subseteq [n]$ of size $\sigma n$, and the uniform random variables over $[n]$. Draw $k$ samples $Y_1,\dots,Y_k $ from the uniform distribution on $\left[ n \right]$. If $Y_i \notin S $, then let $Z_i = Y_i$. Otherwise (that is when $Y_i \in S$) draw a fresh $ \tilde{W}_i$ uniformly from $S$ and let $Z_i = \tilde{W}_i$. We next define $X_1$. If for all $i\in[k]$ we have $Z_i \notin S $, then let $X_1$ be a uniform pick from the set $S$, otherwise let $X_1$ be uniformly chosen from the set of all $\tilde{W}_i$s. It is clear that $X_1 $ is uniformly distributed on $S$ since it is either equal to a $\tilde{W}_i$, which is itself uniformly distributed over $S$, or is directly drawn uniformly from $S$. It is not hard to see that $Z_i$s are independent, because they are functions of $Y_i$s and $\tilde{W_i} $ which are all mutually independent. Furthermore, for any $\ell \notin S$, we have $ \Pr\left[ Z_i = \ell \right] = \Pr\left[ Y_i = \ell \right] = 1/n $. Similarly, for $ \ell \in S $, \[ \Pr\left[ Z_i = \ell \right] = \Pr\left[ Y_i \in S \right] \Pr\left[ \tilde{W}_i = \ell \right] = \sigma \times \frac{1}{\sigma n} = \frac 1n.\] This shows that $Z_i$ are uniformly and independently distributed. As for monotonicity, note that $X_1 \notin \left\{ Z_1 \dots Z_k \right\} $ only if no $Z_i$ was in $S$, which occurs only with probability $ (1- \sigma)^{k}$. Next we create a coupling for adaptive $\sigma$-smooth distributions $\adist$. Recall that in this setting an adaptive sequence corresponds to $X_{\tau} $ being sampled uniformly from a set $S_\tau \left( X_1, \dots, X_{ \tau-1} \right)$, i.e., the set at time $\tau$ is adaptively chosen given the earlier realizations. We construct the coupling inductively using the same ideas discussed for the single round coupling, but at each step using $ S_{\tau} \left( X_1, \dots, X_{ \tau-1} \right) $. Formally, the coupling is as below: \begin{framed} \begin{itemize} \item For $j = 1 \dots t$, \begin{itemize} \item Draw $ k = \alpha \sigma^{-1} $ samples $Y^{ \left( j \right) }_1 , \dots , Y^{(j)}_{k}$ from the uniform distribution. \item If $Y^{\left( j \right)}_i \notin S_j \left( X_1 , \dots , X_{j-1} \right) $, then $Z^{\left( j \right)}_i = Y^{\left( j \right)}_i$. \item Else, for $i$ such that $Y^{\left( j \right)}_i \in S_j \left( X_1 , \dots , X_{j-1} \right) $, sample $\tilde{W}^{\left( j \right)}_i$ {uniformly and independently from} $S_j \left( X_1 , \dots , X_{j-1} \right) $ and set $Z^{\left( j \right)}_i =\tilde{W}_i^{\left( j \right)}$. \item If for all $i$, $Y^{\left( j \right)}_i \notin S_j \left( X_1 , \dots ,X_{j-1} \right) $, then sample $X_j$ uniformly from $S_j \left( X_1 , \dots ,X_{j-1} \right) $. Otherwise, pick $X_j $ uniformly from $ \left\{ \tilde{W}_i^{\left( j \right)} \mid i\in[k] \right\} $. \end{itemize} \item Output $ \left( X_1 , Z_{1}^{ \left( 1 \right)} , \dots , Z_{k}^{\left( 1 \right)} , \dots, X_t , Z_{1}^{ \left( t \right)} , \dots , Z_{k}^{\left( t \right)} \right) $. \end{itemize} \end{framed} We prove that this coupling works inductively. Fixing $X_1, \dots, X_{\tau-1} $, we get $S_{\tau}\left( X_1, \dots, X_{ \tau-1}\right)$. Note that the coupling in stage $ \tau$ is similar to the single round coupling. From a similar argument, we get that $X_{\tau}$ is distributed uniformly on $S_{\tau} \left(X_1 , \dots , X_{\tau-1} \right)$. Similarly, one can argue that $Z_1^{\left( \tau \right)}, \dots, Z_{k}^{\left( \tau \right)} $ are independent and uniform. The monotonicity property follows from the monotonicity in each stage and a union bound. The only other main property that needs to be argued is that $Z_1^{\left( \tau \right)}, \dots, Z_{k}^{\left( \tau \right)}$ are independent of all the past random variables $X_1, \dots, X_{\tau-1} $ and $ \left\{ Z_{i}^{\left( j \right)} \mid i \in \left[ k \right], j \leq \tau-1 \right\} $. The key property needed here is that in the single-round coupling, the distribution of $Z_i$ is oblivious to the choice of the set $S$. We prove this formally in \cref{sec:main_coupling}. Informally, this can also be seen by noting that the one step coupling above is equivalent to the coupling where $Z_j$ are all sampled independently and uniformly and $X_1$ is set to a random $Z_j$ that is in the set $S$, or when none of them are in this set, it is sampled independently. % This in particular ensures that $\left\{ Z_i^{\left( j \right)} \mid j \geq t, i\in[k]\right\}$ are uniform and independent of the past. Note that the above reasoning works as long as the sets $S_j(X_1, \dots, X_{j-1})$ have at least $n\sigma$ elements. In order to move from the special case of uniform distributions on $S_j(X_1, \dots, X_{j-1})$s, we note that smooth distributions are convex combinations of uniform distributions on subsets of size $\geq \sigma n $. \begin{lemma} Let $\mathcal{P}$ be the set of $\sigma$-smooth distributions on $\left[ n \right]$ and let $\mathcal{P}_0$ be the set of distributions that are uniform on subsets of size at least $\sigma n $. Then, $ \mathcal{P} = \mathrm{conv} \left( \mathcal{P}_0 \right).$ \end{lemma} In particular, this implies that for each $ \sigma $-smooth distribution $\mathcal{D}$, there is a distribution $\mathcal{S}_{\mathcal{D}} $ on subsets of size at least $\sigma n$ such that sampling from $\mathcal{D} $ can be achieved by first sampling $S \sim \mathcal{S}_{\mathcal{D}} $ and then sampling uniformly from $S$. For infinite domains, similar argument can be made using the Choquet integral representation theorem which gives a way to represent smooth distributions as convex combinations of uniform distributions on sets of large measure. Putting this together leads to \cref{thm:main_coupling_overview}. \input{recipe} \section{Lower Bounds} In this section, we first show that \cref{thm:regret-main} is tight up multiplicative $ \log $ terms in $T$ and $ \log \log$ factors in $ \sigma $ and $d$ and the additive $ d \sqrt{ \log\left( \nicefrac{T}{d \sigma } \right) } $ term. In order to do this, we first formally define the notion of Littlestone dimension of a class. \begin{definition}[Littlestone Dimension, \cite{ben2009agnostic}] Let $\X$ be an instance space and $\F$ be a hypothesis class on $\X$. A mistake tree is a full binary decision tree whose internal nodes are labelled by elements of $\X$. For every choice of labels $ \{ y_i \}_{i=1}^d $, Every root to leaf path in the mistake tree corresponds to a sequence $ \{ \left( x_i , y_i \right) \}_{i=1}^{d}$ by associating a label $y_i$ to a node depending on whether it is the left or right child of its parent. A mistake tree of depth $d$ is said to be shattered by a class $\F$ if for any root to leaf path $ \{ \left( x_i , y_i \right) \}_{i=1}^{d}$, there is a function $f \in \F $ such that $ f\left( x_i \right) = y_i $ for all $i \leq d$. The Littlestone dimension of the class $\F$ denoted by $\lsd \left( \F \right) $ is the largest depth of a mistake tree shattered by the class $\F$. \end{definition} The following theorem shows that the Littlestone dimension captures the regret in the online learning game against a class. We will only need the lower bound but we will state the full theorem for completeness. \begin{theorem}[\cite{ben2009agnostic,RegretTight}]\label{thm:regretLD} Let $\X$ be an instance space and $\F$ be a hypothesis class on $\X$. Then, there exists an online learning algorithm $\mathcal{A}$ such that \begin{equation*} \mathbf{Regret} \left( \mathcal{A} \right) \leq O\left( \sqrt{ \lsd \left( \F \right) T } \right). \end{equation*} Furthermore, for any algorithm $\mathcal{A}'$, we have that \begin{equation*} \mathbf{Regret} \left( \mathcal{A} ' \right) \geq \Omega \left( \sqrt{ \lsd \left( \F \right) T } \right) . \end{equation*} \end{theorem} Using the above theorem, we lower bound the regret in the online learning against smoothed adversaries. We do this by reducing the smoothed case to the worst case for a related class and lower bound the worst case regret using the above theorem. \begin{theorem} For every $d$ and $ \sigma $ such that $d \sigma\leq 1 $, there exists a $ \H $ such that for every algorithm there is an adversary such the regret is lower bounded by \begin{equation*} \sqrt{dT \log \left( \frac{1}{\sigma d} \right) }. \end{equation*} \end{theorem} \begin{proof} We will first construct a class on $\left[ \nicefrac{1}{\sigma} \right]$ with VC dimension $d$ and Littlestone dimension $ O\left( d \log \left( \nicefrac{1}{d \sigma} \right) \right) $. For simplicity, assume $ \sigma^{-1} $ and $ d $ to be powers of two. Divide $ \left[ \nicefrac{1}{\sigma} \right] $ into $d $ subsets each of equal size, denoted by $A_i$. On each of these subsets instantiate the class of thresholds i.e for each $\gamma \in A_i $, $ h_{\gamma} \left( x \right) = 2\mathbb{I} \left[ x \geq \gamma \right] - 1 $ for $x \in A_i$ and $0 $ for $x \notin A_i$. For a $d$-tuple of thresholds $ \left( h_{\gamma_1} \dots h_{\gamma_d} \right) $ with $\gamma_i \in A_i $, define the function \begin{equation*} h_{ \gamma_1, \dots, \gamma_d } \left( x \right) = \sum_{i=1}^d \mathbb{I} \left[ x \in A_i \right] h_{\gamma_i} \left( x \right). \end{equation*} This function can be seen as the union of the thresholds $h_{\gamma_i}$ thought of as subsets of the universe $\left[ \nicefrac{1}{\sigma} \right]$. Define $\mathcal{H}$ to be the class of all such functions. It is easy to see that this class has VC dimension $d$. The VC dimension is at most $d$ since if any more than $d$ points would mean at least one of the $A_i$ must have two points but this cannot be shattered by thresholds on $A_i$. The VC dimension can be seen to be at least $d$ by taking one point in each of the $A_i$. We claim that this class has Littlestone dimension $ O\left( d \log \left( \nicefrac{1}{\sigma d} \right) \right) $. In order to prove this associate to each string $ \left\{ -1, 1 \right\}^{d \log\left( 1 / \sigma d \right)} $ a function in $ \mathcal{H}$ as follows. Divide the string into blocks of size $ \frac{1}{\sigma d}$. We think of each of these blocks as forming a binary search tree for the subset $A_i$ by associating $ +1 $ to the right child of a node and $-1$ to the left child. Thus, we path on this tree corresponds to a threshold by associating it with the threshold consistent with the labels along the path. Doing this association separately for each block, we can associate the set of strings $ \left\{ -1, 1 \right\}^{d \log\left( 1 / \sigma d \right)} $ with a binary search tree with the leaves labeled by elements in $ \H$. Also, note that this forms a fully shattered tree as required by the definition of the Littlestone dimension. Thus, the Littlestone dimension of $ \H$ is $ d \log \left( \nicefrac{1}{\sigma d} \right) $. Next consider the set $\left[ 0,1 \right]$ and divide it into contiguous subintervals of length $ \sigma $. We define the projection function $ \Pi : \left[ 0,1 \right] \to \left[ \nicefrac{1}{\sigma} \right] $ by $ \Pi\left( x \right) = i $ if $x$ is in the $i$th subinterval. Define the class $ \G$ on $\left[ 0,1 \right] $ by composing $ \H $ with $ \Pi $ i.e. $ \G = \left\{ g : g = h \circ \Pi \right\} $. Note that the uniform distribution on each subinterval is $ \sigma $-smooth. Thus, in a smoothed online learning game with the class $\G $, an adversary who plays only uniform distributions on the subintervals defined above corresponds to an adversary in the usual online learning game on $ \left[ \nicefrac{1}{\sigma} \right] $ against class $\H$. In particular, any algorithm for $\G$ against such an adversary can be converted to an algorithm for $\H$ with the same regret. From \cref{thm:regretLD}, we have that the regret against $\H$ is lower bounded by \begin{equation*} \sqrt{ T \ldim\left( \H \right) } = \sqrt{ dT \log\left( \nicefrac{1}{\sigma d} \right) } \end{equation*} Thus, the regret in the smoothed online learning game for $\G$ is lower bounded by $ \sqrt{ dT \log\left( \nicefrac{1}{\sigma d} \right) }$ as required. \end{proof} Next, we show that the isotropy condition is required for the online discrepancy result. \begin{theorem} There is an adaptive sequence of $c\left( nT \right)^{-2} $-smooth (for some constant $c$) distributions on the unit ball such that for any online algorithm producing signs $\epsilon_i$, we have \begin{equation*} \norm{ \sum_{i=1}^T \epsilon_i v_i }_{\infty} \geq \Omega \left( \sqrt{\frac{T}{n} } \right) \end{equation*} with probability $ 1 - e^{ - \frac{T}{12} } $. \end{theorem} \begin{proof} To see the idea for the proof recall that without the smoothnes restriction, the adversary can pick vectors orthogonal to the discrepancy vector to induce high discrepancy. We show that this can do essentially the same while maintaining some smoothness. Let the discrepancy vector at time $t$ be denoted by $d_t$. Consider the set $S_t = \left\{ x : \norm{x}_2 \leq 1, \abs{\ip{x}{ {d_{t-1}} } } \leq n^{-2} T^{-2} \norm{d_{t-1}}_2 \right\}$. Note that the uniform distribution on $S_t$ is $ c n^{-2}T^{-2} $ smooth for some constant $c$. To see this, let $B$ be the unit ball and let $V_n$ denote the volume of the unit ball in $n$ dimensions. Then, \begin{align*} \Pr_{ X \sim B } \left[ X \in S_t \right] &= \frac{1}{V_n} \int_{-n^{-2}T^{-2} }^{n^{-2} T^{-2}} \left( 1 - x^2 \right)^{\frac{n-1}{2}} V_{n-1} dx \\ & \geq \frac{1}{V_n} \int_{-n^{-2}T^{-2} }^{n^{-2} T^{-2}} \left( 1 - \frac{1}{n^4 T^4} \right)^{\frac{n-1}{2}} V_{n-1} dx \\ & \geq \frac{V_{n-1}}{V_n} \cdot \frac{1}{ 2 n^{2}T^2 } \\ & \geq \frac{1}{ 20 n^{2}T^2 }. \end{align*} The second inequality follows by noting that $ \left( 1 - n^{-4}T^{-4} \right)^{\frac{n-1}{2}} \geq \nicefrac{1}{4} $. With this, we describe the adversary's strategy. At time $t$, the adversary picks $v_t$ uniformly from $S_t$. We will measure the squared $2$-norm of the discrepancy vector. \begin{align*} \norm{d_{t}}^2_2 &= \norm{ \epsilon_t v_t + d_{t-1} }^2_2 \\ & = \epsilon_t^2 \norm{v_t}^2_2 + \norm{d_{t-1}}^2_2 + 2 \ip{v_t}{d_t} \\ & \geq \norm{v_t}^2_2 + \norm{d_{t-1}}^2_2 - \frac{2 \norm{d_{t-1}}_2 }{n^2T^2} \\ & \geq \norm{v_t}^2_2 +\norm{d_{t-1} }^2_2 - \frac{2}{ n^2 T } \\ & \geq \sum_{i=1}^t \norm{v_i}_2^2 - \frac{2t}{n^2 T} . \end{align*} Note that $ \Pr\left[ \norm{v_i} \leq \nicefrac{1}{2} \right] \leq 2^{-\left( n-1 \right)} $. This can be seen by noting that the probability can be computed with an integral similar to the one above but with ball of radius $\nicefrac{1}{2}$ instead of the ball of radius $1$. Also, note that $ \norm{v_i} $ are independent across $i$. Denote $z_i$ as a random variable which $1$ if $ \norm{v_i} \geq \nicefrac{1}{2} $ and $0$ otherwise. Then, \begin{equation*} \sum_{i=1}^t \norm{v_i}_2^2 \geq \frac{1}{4} \sum_{i=1}^t z_i \end{equation*} Applying a Chernoff bound to $z_i$, we get \begin{equation*} \Pr\left[ \sum_{i=1}^t \norm{v_i}^2_2 \leq \frac{t}{8} \left( 1 - 2^{-\left( d-1 \right) }\right) \right] \leq e^{ - \frac{ t }{12} }. \end{equation*} Thus with probability $1 - e^{- \frac{t}{12}}$, we have \begin{equation*} \norm{d_t}^2_2 \geq \frac{t}{ 16} - \frac{2t}{n^2T } \geq \frac{t}{20}. \end{equation*} We get the desired result by relating the $2$-norm and $\infty$-norm. \end{proof} This shows that we cannot get the logarithmic dependence on smoothness parameter $\sigma $, $n$ and $T$ simultaneously without further assumptions on the distribution such as isotropy. \section{Other Related Work} In this section, we will survey other work related to the question that we study in this paper. \paragraph{Online learning:} Similar models of smoothed online learning have been considered in prior work. For a more thorough discussion, see \cite{haghtalab2020smoothed} and the references therein. \cite{NIPS2011_4262} consider online learning when the adversary is constrained in various ways and introduce constrained versions of sequential Rademacher complexity for analyzing the regret. The work with general setting of sequential symmetrization and tangent sequences introduce in the context of general online learning but adapted to the constrained setting. Though these techniques have been applied to other constrained settings \cite{activelearning}, it is not clear how to apply them to our setting. \cite{Gupta_Roughgarden} consider smoothed online learning when looking at problems in online algorithm design. They prove that while optimizing parameterized greedy heuristics for Maximum Weight Independent Set imposes regret growing linear in $T$ in the worst-case, in presence of smoothing this problem can be learned with non-trivial sublinear regret (as long they allow per-step runtime that grows with $T$). \cite{Cohen-Addad} consider the same problem with an emphasis on the per-step runtime being logarithmic in $T$. { Smoothed analysis has also been used in a number of other online settings. For linear contextual bandits, \cite{kannan2018smoothed} use smoothed analysis to show that the greedy algorithm achieves sublinear regret even though in the worst case it can have linear regret. \cite{raghavan2018externalities} work in a Bayesian version of this setting and achieve improved regret bounds for the greedy algorithm. {Generally, our work is also related to a line of work on online learning in presence of additional assumptions modelling properties exhibited by real life data. \cite{PredictableSequences} consider settings where the learner has additional information available in terms of an estimator for future instances. They achieve regret bounds that are in terms of the path length of these estimators and can beat $\Omega(\sqrt{T})$ if the estimators are accurate. \cite{dekel2017online} also considers the importance of incorporating side information in the online learning framework and show that regrets of $O(\log(T))$ in online linear optimization maybe possible when the learner has access to vectors that are weakly correlated with the future instances.} { More broadly, our work is among a growing line of work on beyond the worst-case analysis of algorithms~\cite{roughgarden_2020}. Examples of this in machine learning mostly include improved runtime and approximation guarantees of supervised (e.g., \cite{LearningSmoothed,kalai2008decision,onebit,Masart}), and unsupervised settings~(e.g., \cite{bilu_linial_2012, kcenter, stable_clustering, TopicModelling, Decoupling,VDW, MMVMaxCut,llyods, HardtRoth}). } \paragraph{Discrepancy:} Discrepancy is well-studied area in computer science and combinatorics with rich connections to various areas. For a general overview of the area see \cite{chazelle_2000}. Many classical settings such as the Spencer problem, Komlos problem, Tusnandy problem and the Beck-Fiala problem continue to inspire active research. A recent line of work has been developing algorithmic techniques for many new settings that were previously only dealt with non-constructively and were even believed to be non-tractable \cite{disc1,disc2,disc3,disc4,disc5}. A setting that has also recently received attention is the online discrepancy setting. \cite{online_disc1} consider the setting where the inputs are all uniform on $ \left\{ -1,1\right\}^n$ and get a $ O\left( \sqrt{n} \log T \right) $ bound for the $\ell^{\infty}$ discrepancy. Motivated by questions in envy minimization, \cite{bansal2020online} and \cite{online_disc3}, consider the stochastic problem with general distributions, along with several geometric discrepancy problems such as the Tusnady problem. \cite{bansal2020online} gives a $ O\left( n^2 \log T \right) $ discrepancy in the $\ell^{\infty}$ norm algorithm when the input is in $\left[ -1,1 \right]^n $. As discussed earlier, \cite{Bansal_Discrepancy} provide a $ \sqrt{n} \log^4 \left( nT \right)$ in the same setting. They also consider various other settings such as the online Banaszczyk problem and a weighted multicolor discrepancy problem. \cite{ALS_Disc} consider a non-stochastic version of the problem where the vectors are obliviously picked from $\left[ -1,1 \right]^n$ and propose a beautiful randomized algorithm that achieves $ \sqrt{n} \log \left( nT \right) $ bound. \section{Preliminaries} Throughout this paper, we use $\X$ to denote an instance space and $\Y = \{0, 1\}$ to be the set of outcomes. A \emph{hypothesis} is a function $f: \X \rightarrow \Y$ that maps an instance $x\in \X$ to an outcome $y\in \Y$. We work with a predetermined \emph{hypothesis class} $\F \subseteq \Y^\X$. \subsection{Statistical Definitions} Let us begin by recalling a few well-studied notions from statistical learning theory. \begin{definition}[VC Dimension, See \citep{shalev2014understanding}] Let $\X$ be an instance space and $\F$ be a hypothesis class on $\X$. $\F$ is said to shatter a set of points $S =\{ x_1, \dots ,x_m \} \subseteq \X$ if for each assignment of labels $y_1, \dots, y_m$ to $S$, there is a hypothesis $f \in \F$ such that for all $x_i \in S $, $f\left( x_i \right) =y_i$. The VC dimension of $\F$ is denoted by $\vcd \left( \F \right) $ and is the largest cardinality of a set $S$ shattered by $\F$. \end{definition} For any hypothesis class $\F$ on instance space $\X$, a learning algorithm $\A$ takes as input a sample set $S$ chosen i.i.d.\ from an underlying distribution $\D$ and returns a function that achieves near-optimal performance on $\D$. As we stated below, existence of algorithms that can learn a hypothesis class $\F$ is characterized by the VC dimension $\F$. \begin{proposition}[See \citep{shalev2014understanding}] \label{fact:VC-sample} Given a hypothesis class $\F$ on instance space $\X$, there is a PAC learning algorithm $\A$ such that for any distribution $\D$ and any number of samples $m$, with probability $1-\delta$ over $S\sim \D^m$, the function returned by the algorithm $f_S = \A(S)$ satisfies \begin{equation} \Ex_{x\sim \D}\Bracks{f_{S}(x)} - \min_{f\in \F}~ \Ex_{x\sim \D}\Bracks{f(x)} \leq O\Parens{\sqrt{\frac{\vcd(\F)+ \ln(1/\delta)}{m}}}. \label{eq:pac-bound} \end{equation} The above bound can be achieved by \emph{Empirical Risk Minimization} that uses $\A(S) = \argmin_{f\in \F}\Ex[f(x)]$. Furthermore, Equation~\eqref{eq:pac-bound} is known to be tight. That is, a hypothesis class is PAC learnable if and only if it has finite VC dimension. \end{proposition} We will use the notion of a cover of a hypothesis class, which is a set of functions $\F'$ that approximate every function in $\F$ under a given distribution. This is formally defined below. \begin{definition}[$\beta$-cover] Let $\F$ be a hypothesis class. A set of function $\F'\subseteq \Y^\X$ is said to be a $\beta$-cover for $\F$ with respect to distribution $\D$ if for all $f \in \F$, there is a $f' \in \F'$ such that \begin{equation*} \Pr_{x \sim \D} \left[ f\left( x \right) \neq f' \left( x \right) \right] \leq \beta. \end{equation*} \end{definition} The following well-known fact bounds the size of a $\beta$-cover of any class with respect to any distribution as a function of its VC dimension. \begin{fact}[\cite{HAUSSLER1995217}] \label{fact:net_size} Let $\mathcal{F}$ be a hypothesis class with $d = \vcd(\F)$ and let $\D$ be any distribution over $\X$. Then, $\F$ has a $\beta$-cover of size $ \left( \nicefrac{41}{\beta} \right)^d $ with respect to distribution $\D$. \end{fact} \subsection{Online Learning} \subsubsection{Standard Setting} Online learning over a hypothesis class $\F$ is a repeated game between a learner and an adversary over $T$ rounds. On round $t$, the learner chooses a distribution $q_t\in \Delta(\F)$ and then the adversary chooses an instance $x_t \in \X$. After this, a function $f_t$ is realized from distribution $q_t$, the learner observes $x_t$, and suffers a loss of $f_t \left( x_t \right)$. The objective of the learner is to minimize the expected regret with respect to the best fixed function $f\in \F$ in hindsight, defined as \begin{equation*} \regret_\F \left( \A \right) = \Ex \left[ \sum_{t =1 }^T f_t\left( x_t \right) - \min_{f \in \F } \sum_{t =1 }^T f(x_t) \right], \end{equation*} where the expectation is taken over the draws of $f_t\sim q_t$ for all $t\in [T]$. In this paper, we mainly consider \emph{adaptive adversaries}, where adversary's choice of $x_t$ can depend on the entire history of the game up to and including round $t-1$ and the knowledge of the algorithm. The minmax regret is defined as the best possible regret that is achievable by any algorithm against a worst case adaptive adversary. This can be written as \begin{equation*} \regret_\F = \inf_{q_1} \sup _{x_{1} \in \X} \underset{ f_1 \sim q_1 }{\mathbb{E}} \ldots \inf_{q_T} \sup _{x_{T} \in \X} \underset{ f_T \sim q_T }{\mathbb{E}} \left[ \sum_{t =1 }^T f_t\left( x_t \right) - \min_{f \in \mathcal{H} } \sum_{t =1 }^T f(x_t) \right]. \end{equation*} Minmax regret can be used to bound the regret of variants of online learning. Below we give two such examples. \begin{example} Consider the online prediction setting, where a learner has to predict labels of a sequence of points. That is, on round $t$ the adversary first picks an instance $x_t$ and present it to the learner. The learner then picks a distribution, the adversary picks a point $x_t$ and a label $y_t$ and then player samples a prediction $\hat{y}$. The player suffers loss $ \mathbb{I} \left[ \hat{y}_t \neq y_t \right] $. The objective of the player is to minimize his loss relative to the best fixed hypothesis in class $\mathcal{H}$ in hindsight. Formally, regret of an algorithm $\mathcal{A} $ is defined as \begin{equation*} \regret \left( \mathcal{A} \right) = \sum_{t =1 }^T \mathbb{I} \left[ \hat{y}_t \neq y_t \right] - \min_{h \in \mathcal{H} } \sum_{t =1 }^T \mathbb{I} \left[ h\left( x_t \right) \neq y_t \right]. \end{equation*} The minmax regret is defined as minimum regret of an algorithm against a worst case adversary. This can be written as \begin{equation*} \regret \left( \mathcal{H} \right) = \inf_{q_1} \sup _{x_{1} \in \mathcal{Z}} \underset{ \hat{y}_1 \sim q_1 }{\mathbb{E}} \ldots \inf_{q_T} \sup _{x_{T} \in \mathcal{Z}} \underset{ \hat{y}_T \sim q_T }{\mathbb{E}} \left[ \sum_{t =1 }^T \mathbb{I} \left[ \hat{y}_t \neq y_t \right] - \min_{h \in \mathcal{H} } \sum_{t =1 }^T \mathbb{I} \left[ h\left( x_t \right) \neq y_t \right] \right] \end{equation*} where $q_i$ represents distributions over the predictions. Note that here the learner is not required to predict a hypothesis in class, and thus this is improper learning. But note that the regret of an improper learning can be bounded by that of a proper learner and thus it is easy to see that the online prediction game can be captured using the earlier online learning model. \end{example} As with statistical learning, in the online setting, a combinatorial dimension captures the learnability. This is known as the Littlestone dimension, which captures the largest depth of a mistake tree shattered by the class. Formally, \begin{definition}[Littlestone Dimension, See \citep{ben2009agnostic}] Let $\X$ be an instance space and $\F$ be a hypothesis class on $\X$. A mistake tree is a full binary decision tree whose internal nodes are labelled by elements of $\X$. For every choice of labels $ \{ y_i \}_{i=1}^d $, Every root to leaf path in the mistake tree corresponds to a sequence $ \{ \left( x_i , y_i \right) \}_{i=1}^{d}$ by associating a label $y_i$ to a node depending on whether it is the left or right child of its parent. A mistake tree of depth $d$ is said to be shattered by a class $\F$ if for any root to leaf path $ \{ \left( x_i , y_i \right) \}_{i=1}^{d}$, there is a function $f \in \F $ such that $ f\left( x_i \right) = y_i $ for all $i \leq d$. The Littlestone dimension of the class $\F$ denoted by $\lsd \left( \F \right) $ is the largest depth of a mistake tree shattered by the class $\F$. \end{definition} The following analogue of \cref{fact:VC-sample} for online learning shows that the Littlestone dimension captures the regret of an optimal algorithm learning a hypothesis class. In particular, it show that sublinear regret is achievable if and only if the Littlestone dimension is finite. \begin{proposition}[\citep{ben2009agnostic}] Let $\X$ be an instance space and $\F$ be a hypothesis class on $\X$. Then, there exists an online learning algorithm $\mathcal{A}$ such that \begin{equation*} \regret \left( \mathcal{A} \right) \leq \sqrt{ \frac{1}{2} \lsd \left( \F \right) T \log\left( T \right) }. \end{equation*} Furthermore, for any algorithm $\mathcal{A}'$, we have that \begin{equation*} \regret \left( \mathcal{A} ' \right) \geq \Omega \left( \sqrt{ \lsd \left( \F \right) T } \right) . \end{equation*} \end{proposition} \begin{figure} \centering \includegraphics{tree.pdf} \end{figure} In order to understand the definition of Littlestone dimension, it is instructive to consider the class of thresholds on the interval $ \left[ 0,1 \right]$,that is functions of the form $ h_{ \theta } \left( x \right) = \mathbb{I} \left[ x \leq \theta \right] $. It is easy to see that the VC dimension of this class is $1$. But it can be shown that the Littlestone dimension is unbounded. To see this, construct a tree whose nodes at depth $i$ are indexed by $k 2^{-i}$. Note that this tree is shattered by class $\F$ and can be extended to have arbitrary depth. To see why this shattered tree gives a strategy for adversary to enforce linear regret, This thus gives us an example of a hypothesis class which admits statistical learning but does not admit online learning. It is often easier to work directly with the loss instead of the hypothesis class. In this notation, the minmax regret can be written as \begin{equation*} \mathbf{Regret} \left( \F \right) = \inf_{q_1} \sup _{x_{1} \in \X} \underset{ f_1 \sim q_1 }{\mathbb{E}} \ldots \inf_{q_T} \sup _{x_{T} \in \X} \underset{ f_T \sim q_T }{\mathbb{E}} \left[ \sum_{t =1 }^T f_t\left( x_t \right) - \min_{f \in \mathcal{H} } \sum_{t =1 }^T f(x_t) \right]. \end{equation*} \subsubsection{Smoothed Setting} In the main body of the paper, we will focus our attention to finite subsets usually $\left[ n \right]$. In the smoothed online learning game, the actions of the adversary comprise of picking a sequence of $\sigma$-smooth distributions. One can consider two models for the adversary in this model. In the first model, which we refer to as the non-adaptive adversary the adversary decides this actions $\nadist_1 \dots \nadist_T$ in advance. In this model, the actions of the adversary at time $t$ does not depend on the instantiations at previous times. In the second and more relevant model, which we refer to as the adaptive adversary, the action of the adversary at time $t$ which is a smooth distribution $\adist_t$ is decided after seeing the instantiation of the past $x_1 \sim \adist_1 \dots x_{t-1} \sim \adist_{t-1} $. As before, in this setting, the minmax regret can be written as \begin{equation*} \mathbf{Regret} = \inf_{q_1} \sup _{ \adist_1 } \Ex_{f_1 \sim q_1} \Ex_{x_1 \sim \adist_1} \ldots \inf_{q_T} \sup _{ \adist_T } \Ex_{f_T \sim q_T} \Ex_{x_T \sim \adist_T} \left[ \sum_{t=1}^T f_t \left( x_t \right) - \inf_{f \in \F} \sum_{t=1}^T f \left( x_t \right) \right]. \end{equation*} \subsection{The General Framework for applying the Coupling.} \label{sec:recipe} In most applications where smoothed analysis has led to significant improvements over the worst-case analysis, these improvements hinge on the proof techniques and algorithmic approaches that leverage the anti-concentration properties of the smoothed input. However, as the process of creating an input becomes more and more adaptive, that is, as the adversary correlates the distribution of the current input with the realizations of earlier inputs and decisions the randomness and anti-concentration properties of the input and the state of the algorithm may weaken. Additionally, correlations between future and past instances present novel challenges to the methodology used against oblivious smooth adversaries, which often rely heavily on the independence of the input. Our coupling approach overcomes these challenges in two ways. First, by coupling an adaptive smooth process with a non-adaptive uniform process, it implicitly shows that anti-concentration properties of the input and the algorithm do not weaken significantly in presence of adaptive adversaries. Second, it allow us to lift algorithmic ideas and proof techniques that have been designed for oblivious smooth or stochastic adversaries to design and analyze algorithms that have to interact with adaptive smooth adversaries. An important property of our coupling is its monotonicity, i.e., with high probability, $\left\{ X_1 , \dots , X_t\right\} \subseteq \big\{ Z_i^{\left( j \right)} \mid i \in [k] , j\in [t] \big\}$. This monotonicity property paired with the fact that $Z_i^{(t)}$ are i.i.d~uniform variables are especially useful for lifting algorithms and proof techniques from the oblivious world that rely on anti-concentration. That is, if an algorithm's failure mode is only triggered when $X_1 , \dots , X_t$ concentrate, then replacing in $\big\{ Z_i^{\left( j \right)} \mid i \in [k] , j\in [t] \big\} \supseteq \{X_1 , \dots , X_t\}$ can only increase the likelihood of hitting the failure mode. On the other hand, i.i.d.~uniform random variables $Z_i^{(t)}$s demonstrate excellent anti-concentration properties that are superior to most other offline stochastic or oblivious smooth distributions. This shows that existing techniques and algorithms that work well in the stochastic or oblivious smooth settings will continue to work well for adaptive smooth adversaries. As a general blueprint for using our coupling for smoothed analysis with adaptive adversaries, first consider how you would handle smooth oblivious or stochastic adversaries and identify steps that rely on an anti-concentration property. Sometimes, this is more easily done by identifying where existing approaches rely on the obliviousness and stochasticity of the adversaries and then finding concentration properties, potential functions, or other monotone set functions that implicitly measure concentration of some measure. Next, apply the coupling to replace $T$ adaptive smooth random variables with $Tk$ i.i.d~uniform random variables and show that the previous anti-concentration (or other monotone properties) are only moderately affected by the fact that we have a larger number of random variables. Finally, use the original algorithm or technique for leveraging anti-concentration and complete the proof. In the remainder of this section, we show how the above blueprint can be applied to three important examples from online learning, discrepancy, and optimization. \paragraph{Online Learning.} One key property that enables learnability in the offline agnostic, offline PAC, and oblivious smooth online setting is that a hypothesis class $\H$ can be approximated via a finite cover $\H'$ and algorithms such as ERM and Hedge can be run on $\H'$ without incurring a large error~\cite{haghtalab2018foundation,haghtalab2020smoothed}. This is due to the fact that the performance of the best hypothesis in $\H$ is closely approximated by the performance of the best hypothesis in $\H'$ when instances are drawn from an offline stochastic or an oblivious sequence of smooth distributions. At the heart of this property is an anti-concentration of measure in the class of symmetric differences between hypotheses $h\in \H$ and their proxies $h'\in \H'$. More formally, for a fixed distribution $\D$, such as the uniform distribution, consider $\H'\subseteq \H$ that is an $\epsilon$-cover of $\H$ with respect to $\D$ so that for every hypothesis $h\in \H$ there is a proxy $h'_h\in \H'$ with $\Pr_\D[h(x)\neq h'_h(x)]\leq \epsilon$. The set $\H'$ is a good approximation for $\H$ under distribution $\D$ if not too many instances fall in any symmetric difference, that is, if with high probability, \[ \forall h\in \H, \frac{1}{T} \sum_{t=1}^T \mathbb{I} \left[ h(x_t) \neq h'_{h}(x_t) \right] \lesssim \epsilon. \] In the offline or oblivious smooth online setting this is done by leveraging the independence between $x_t$s and using techniques from the VC theory to show that each function $h\Delta h_{h'}$ is close to its expectation. We note that $\max_{h\in \H} \sum_{x\in S} \mathbb{I} \left[ h(x) \neq h'_{h}(x) \right]$, which measures concentration, is a monotone set function that only increases when replacing random variables $X_1, \dots, X_T$ with random variables $\{Z_i^{(t)} \mid i\in [k], t\in [T]\} \supseteq \{X_1, \dots, X_T\}$. This shows that the concentration of measure over a $T$-step adaptive smooth sequence of distributions $\adist$ is bounded by the concentration of measure over a $kT$ draws from the uniform distribution. We can now use the anti-concentration properties of i.i.d.~uniform random variables and techniques from the VC theory (which were used for the oblivious smooth and stochastic case) to show that each function $h\Delta h_{h'}$ is close to its expectation. \paragraph{Online Discrepancy.} Most existing approaches for designing low discrepancy algorithms, such as~\cite{Bansal_Discrepancy,bansal2020online} control and leverage anti-concentration properties of the discrepancy vector and its correlations. In particular, \cite{Bansal_Discrepancy} introduces a potential function $\Phi_t$ that, roughly speaking, is $\exp(\lambda d_t^\top W)$ where $W$ is a mixture of the future random variables and test directions. They use the fact that $X_t$s are generated i.i.d~from a fixed and known distribution to bound the tail probabilities for $\exp(\lambda d_{t-1}^\top X_t) > \Phi_{t-1}$. Note that the event $\exp(\lambda d_{t-1}^\top X_t) > \Phi_{t-1}$ is monotone, i.e., \[\sum_{i \in[k]} \exp(\lambda d_{t-1}^\top Z_i^{(t)}) \geq \exp(\lambda d_{t-1}^\top X_t), \] when $X_t \in \{Z_i^{(t)} \mid i\in [k]\}$. Therefore, the coupling argument allows us to bound the tail probability of crossing the threshold $k\Phi_{t-1}$. In other words, we bound the tail probabilities of having large correlation with an adaptive $\sigma$-smooth variable $X_t$ in terms of the tail probability of having correlations with at least one of $k$ i.i.d.~uniform random variables. With these tail bounds in place, we now have a high probability event that $\exp\big( \lambda d_{t-1}^\top X_t \big) \leq k\Phi_{t-1}$. Then, as \cite{Bansal_Discrepancy} argues, when $\Phi_{t-1}$ is large and as result $\lambda d_{t-1}^\top X_t$ by comparison cannot be large, there will be only a small increase in the potential function. Since $\Phi_t$s also measure correlations with the test vectors, an upper bound on $\Phi_t$s also bounds the discrepancy. It is important to note that discrepancy itself is not a monotone set function as additional vectors can significantly reduce the discrepancy and stop it from growing it large over time. However, anti-concentration techniques that are at the core of analyzing discrepancy are monotone and therefore can be easily used with our coupling. \paragraph{Dispersion.} At its core, dispersion is an anti-concentration property for the number of function discontinuities that fall in any sufficiently small interval. Existing results of \cite{Dispersion} leverages anti-concentration of oblivious smooth adversaries, who generate independently distributed discontinuities, and argues that the resulting sequence is dispersed with high probability. That is, when the $j$th discontinuity of the $t$th function, $d_{t,j}$, is drawn independently, with high probability for all intervals $J$ with small width, $\sum_{t,j} \mathbb{I} \left[ d_{t,j}\in J \right]$ is small. \cite{Dispersion} proves this using the independence between $d_{t,j}$s and the fact that VC dimension of the class of intervals is a constant. In an approach that mirrors our online learning analysis, we emphasize that \[\max_J \sum_{d_{t,j}\in S}^T \mathbb{I} \left[ d_{t,j}\in J \right] \] that measures concentration of function discontinuities is a monotone set function over $S$ and only increases when replacing random variables $d_{i,t}$s with random variables $\{Z_i^{(t,j)} \mid i\in [k], t\in [T], j\in[\ell] \} \supseteq \{d_{t,j} \mid j\in [\ell], t\in[T] \}$. This shows that the concentration of discontinuities over a $T\ell$-step adaptive smooth sequence of distributions $\adist$ is bounded by the concentration of discontinuities from a $kT\ell$-step uniform distribution. We can now use the anti-concentration properties of uniform and independent random variables and the fact that the VC dimension of intervals is small to show that adaptive smooth adversaries also create dispersed sequences. \section{Regret Bounds against Smooth Adaptive Adversary} \label{sec:RegretBounds} In this section, we obtain regret bounds against adaptive smooth adversaries that are solely defined in terms of VC dimension of the hypothesis class and the smoothness parameter. Recall that an adaptive adversary at every time step $t\in [T]$ chooses $\D_t$ based on the actions of the learner $h_1,\dots, h_{t-1}$ and the realizations of the previous instances $(x_1, y_1), \dots, (x_{t-1}, y_{t-1})$ and then samples $(x_t, y_t) \sim \D_t$. Our main result in this section is as follows. \begin{theorem} [Regret upper bound] \label{thm:regret-main} Let $\H$ be a hypothesis class of VC dimension $d$. There is an algorithm $\A$ such that for any adaptive sequence of $\sigma$-smooth distributions $\adist$ achieves a regret of \[ \Ex[\regret(\A, \adist )] \leq \tilde{O} \left(\sqrt{Td \ln \left( \frac{T}{d \sigma } \right) } + d \ln\left( \frac{T }{d \sigma } \right) \right). \] In the above $ \tilde{O} $ hides factors that are $\mathrm{loglog}\left( \nicefrac{T}{d \sigma} \right) $. \end{theorem} We complement this result by providing nearly matching lower bounds. We show that \cref{thm:regret-main} is tight up to a {multiplicative $ \mathrm{polylog}(T)$ and $\mathrm{polyloglog}(1/\sigma d)$ factors and an additive $ d \log\left( \nicefrac{T}{d \sigma } \right) $ term.} We provide a proof of \cref{thm:regret_lowerbound} in \cref{sec:regretlowerproof}. \begin{theorem}[Regret lower bound] \label{thm:regret_lowerbound} For every $d$ and $ \sigma $ such that $d \sigma\leq 1 $, there exists a hypothesis class $ \H $ with VC dimension $d$ such that for any algorithm $\A$ there is a sequence of $\sigma$-smooth distributions $\D$ where \begin{equation*} \Ex[\regret(\A, \D )] \in \Omega\left( \sqrt{dT \log \left( \frac{1}{\sigma d} \right) } \right). \end{equation*} \end{theorem} In order to prove \cref{thm:regret-main}, we follow the general approach for using our coupling theorem (\cref{thm:main_coupling_1}) as outlined in \cref{sec:recipe}. That is, in \cref{sec:regret-overview}, we first review the algorithmic result of \cite{haghtalab2018foundation} for obtaining regret bounds against \emph{non-adaptive} smooth adversaries and identify steps for which non-adaptivity is crucial for that approach. In \cref{sec:obli-adap}, we then alter those steps to work for adaptive smooth adversaries via the coupling argument. Lastly, in \cref{sec:regretmain}, we combine the steps to complete the proof of \cref{thm:regret-main}. \subsection{Overview of Existing Approaches and their Need for Obliviousness} \label{sec:regret-overview} \cite{haghtalab2020smoothed,haghtalab2018foundation} considered regret-minimization problem against non-adaptive smooth adversaries. This approach considered an algorithm $\A$ that uses Hedge or any other standard no-regret algorithm on a finite set $\H'$. $\H'$ is chosen to be an $\epsilon$-cover of $\H$ with respect to the uniform distribution. It is not hard to see (e.g., \cite[Equation (1)]{haghtalab2020smoothed}) that regret of algorithm $\A$ decomposes to the regret of Hedge on the cover $\H'$ and the error caused by approximating $\H$ by its cover $\H'$ as follows. \begin{equation}\label{eq:Regret_Decomp} \Ex[\regret(\A, \adist )] \leq O\left( \sqrt{T \ln(|\H'|)} \right) + \mathbb{E}_{\adist}\left[\max_{h\in \H}\min_{h'\in \H'} \sum_{t=1}^T 1\left(h(x_t) \neq h'(x_t) \right) \right] \end{equation} Given that any hypothesis class $\H$ has an $\epsilon$-cover of size $(41/\epsilon)^{\vcd(\H)}$ (see \cite{HAUSSLER1995217} or \cite[Lemma 13.6]{boucheron2013concentration}) the first term of \autoref{eq:Regret_Decomp} can be directly bounded by $O\left(\sqrt{T\ \vc(\H) \ln(1/\epsilon)} \right)$. To bound the second term of \autoref{eq:Regret_Decomp}, for any $h\in \H$ consider the $h' \in \H'$ that is the proxy for $h$, i.e., $g_{h, h'} = h\Delta h'$ is such that $\Ex_{x\sim U} [g_{h,h'}(x)]\leq \epsilon$, where $U$ is the uniform distribution over $\X$. Let $ \G = \{g_{h, h'}\mid \forall h\in \H \text{ and the corresponding proxy } h'\in \H' \}$. Note that, \begin{align} \Ex_{\adist}\left[\sup_{h\in \H}\inf_{h'\in \H'} \sum_{t=1}^T 1\left(h(x_t) \neq h'(x_t) \right) \right] \leq \Ex_{\adist}\left[ \sup_{g \in \G} \sum_{t = 1}^T g\left( x_t \right) \right]. \end{align} Note that for any fixed $g_{h,h'}\in \G$ and even an adaptive sequence of $\sigma$-smooth distributions, $\Ex_{\adist}[\sum_{t=1}^T g_{h,h'}(x_t)] \leq \sigma^{-1} \Ex_{\U}[\sum_{t=1}^T g_{h,h'}(x_t)] \leq T\epsilon/\sigma$. Up to this point, the above approach applies equally to adaptive and non-adaptive adversaries. It remains to establish that with small probability over all (infinitely many) functions in $\G$, the realized value of $g$ is close to its expected value. This is where existing approaches rely on obliviousness of the adversary. \emph{When the adversary is non-adaptive, instances $x_t\sim \D_t$ are independently (but not necessarily identically) distributed.} Existing approaches such as \cite{haghtalab2018foundation} leverage the independence between the instances to use the double sampling and symmetrization tricks from VC theory and establish a uniform convergence property even when instances are not identically distributed. That is, when $\nadist$ is a \emph{non-adaptive} sequence of smooth distributions, \begin{equation} \Ex_{\nadist}\left[ \sup_{g \in \G} \sum_{t = 1}^T g\left( x_t \right) \right] \leq \frac{T\epsilon}{\sigma} + O\left( \sqrt{Td \ln \left( \frac{T}{\sigma} \right)} \right) \label{eq:nadist-bound} \end{equation} Using $\epsilon = \sigma T^{-1/2}$ in \autoref{eq:nadist-bound} and \autoref{eq:Regret_Decomp} gives an upper bound on the regret against an oblivious smooth adversary that only depends on VC dimension of $\H$ and the smoothness parameters. \subsection{Reducing Adaptivity to Obliviousness via the Coupling} \label{sec:obli-adap} We emphasize that \autoref{eq:nadist-bound} is the only step in existing approach that relies on the obliviousness of the adversary. In this section, we show how the coupling lemma can be used to obtain an upper bound analogous to the \autoref{eq:nadist-bound} for adaptive adversaries. The main result of this section is as follows, \begin{lemma} \label{lem:net_bound} Let $\G$ be defined as described in \cref{sec:regret-overview}, $d = \vc(\H)$, and let $\adist$ be an adaptive sequence of $\sigma$-smooth distributions. We have \begin{equation*} \Ex_{\adist} \left[ \sup_{g \in \G } \sum_{i = 1}^T g\left( x_i \right) \right] \leq O\left( \sqrt{ \frac{\epsilon}{\sigma} T \ln(T)\ d \ln\left( 1 / \epsilon \right) } + T \ln(T) \frac{\epsilon }{\sigma} \right) \end{equation*} for any $\epsilon > \frac{\sigma d \log \left( 4 e^2 / \epsilon \right)}{5 T \ln(T)} $. \end{lemma} \begin{proof}[Proof of \cref{lem:net_bound}] Here we bound the value of a $T$-step adaptive process. To prove this lemma, we use the coupling described in \cref{sec:coupling_overview} to reduce the problem of bounding the value of a $T$-step adaptive process by the value of the a $\tilde O(T/\sigma)$-step uniform process. We then bound the value of the uniform process using the fact that uniform process is an oblivious process. \begin{claim} \label{claim:couple-regret} Let $\alpha = 10 \ln(T)$ and $k = \alpha / \sigma$, and let $\U$ denote the uniform distribution over the domain. We have \[ \Ex_{\adist} \left[ \sup_{g \in \G }\ \sum_{i = 1}^T g\left( x_i \right) \right] \leq T^2 \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} + \Ex_{\U}\, \left[ \sup_{g \in \G } \sum_{\substack{i \in[k]\\ j\in[T]}} g\left( Z^{\left( j \right)}_i \right) \right]. \] \end{claim} \begin{proof}[Proof of \cref{claim:couple-regret}] Consider the coupling $X_1 , \dots X_T , Z_1^{\left( 1 \right)} , \dots Z_k^{\left( T \right)} $ described in \cref{sec:Coupling} for for $k = \alpha / \sigma$ and $\alpha = 10 \ln(T)$. We will denote this by $\Pi$. First note that every $g\in \G$ is positive, since it is a symmetric difference between two functions $h$ and $h'$. Therefore, for any two sets $A$ and $B$, such that $A \subseteq B$, we have \begin{equation*} \sup_{g \in \G } \sum_{x \in A } g(x) \leq \sup_{g \in \G } \sum_{x \in B } g(x) \end{equation*} Let $\mathcal{E}$ denote the event $ \left\{ X_1 , \dots , X_T\right\} \nsubseteq \left\{ Z_i^{\left( j \right)} \mid { i \in \left[ k \right] , j\in \left[ T \right] } \right\}$. From \cref{thm:main_coupling}, we know that $\Pr\left[ \mathcal{E} \right] \leq T \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}}$. Moreover, from \cref{thm:main_coupling} we have that $X_1 \dots X_T$ is distributed according to $\adist$ and $Z_i^{\left( j \right)}$ are i.i.d according to $\U$, thus \begin{equation} \Ex_{\adist} \left[ \sup_{g \in \G } \sum_{i = 1}^T g\left( x_i \right) \right] = \Ex_{\Pi} \left[ \sup_{g \in \G } \sum_{i = 1}^T g\left( X_i \right) \right] \text{ and } \Ex_{\U}\left[ \sup_{g \in \G } \sum_{\substack{i \in[k]\\ j\in[T]}} g\left( Z^{\left( j \right)}_i \right) \right] = \Ex_{\Pi}\left[ \sup_{g \in \G } \sum_{\substack{i \in[k]\\ j\in[T]}} g\left( Z^{\left( j \right)}_i \right) \right] \label{eq:coupling-pi-marginals} \end{equation} Next note that \begin{align*} \Ex_{ \Pi } \left[ \sup_{g \in \G } \sum_{i = 1}^T g\left( X_i \right) \right] & = \Ex_{\Pi}\, \left[ \mathbb{I} \left( \mathcal{E} \right) \cdot \sup_{g \in \G } \sum_{i = 1}^T g\left( X_i \right) \right] + \Ex_{\Pi}\, \left[ \mathbb{I} \left( \mathcal{\overline{E}} \right) \cdot \sup_{g \in \G } \sum_{i = 1}^T g\left( X_i \right) \right] \\ & \leq T^2 \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} + \Ex_{\Pi}\, \left[ \mathbb{I} \left( \mathcal{\overline{E}} \right) \cdot \sup_{g \in \G } \sum_{i = 1}^T g\left( X_i \right) \right] \\ & \leq T^2 \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} + \Ex_{\Pi}\, \left[ \mathbb{I} \left( \mathcal{\overline{E}} \right) \cdot \sup_{g \in \G } \sum_{i,j} g\left( Z^{\left( j \right)}_i \right) \right] \\ & \leq T^2 \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}} + \Ex_{\Pi}\, \left[ \sup_{g \in \G } \sum_{i,j} g\left( Z^{\left( j \right)}_i \right) \right], \end{align*} where the second transition uses the fact that $\Pr\left[ \mathcal{E} \right] \leq T \left( 1 - \sigma \right)^{\frac{\alpha}{\sigma}}$ and that $ \sup_{g \in \G } \sum_{i =1}^T g\left( X_i \right) \leq T $ given that $\forall g \in \G, g\left( x \right) \leq 1$. The third transition uses the fact that conditioned on $\mathcal{\overline{E}}$, $ \left\{ X_1 , \dots , X_T\right\} \subseteq \left\{ Z_i^{\left( j \right)} \mid { i \in \left[ k \right] , j\in \left[ T \right] } \right\}$. Using \autoref{eq:coupling-pi-marginals} completes the proof of \cref{claim:couple-regret}. \end{proof} \begin{claim} \label{claim:oblivious-bernstein-regret} For any $k$ and any $\epsilon > \frac{120d \log \left( 4 e^2 / \epsilon \right)}{Tk } $, we have \begin{equation*} \Ex_{\U}\, \left[ \sup_{g \in \G } ~ \sum_{\substack{i \in[k], j\in[T]}} g\left( Z^{\left( j \right)}_i \right) \right]\leq 72 \sqrt{\epsilon\, T\, k\, d \log \left( 1 / \epsilon \right) } + T\, k\, \epsilon. \end{equation*} \end{claim} \begin{proof}[Proof sketch of \cref{claim:oblivious-bernstein-regret}] The crux of this proof is that random variables $Z_{i}^{\left( j \right)}$ are drawn i.i.d. from the uniform distribution, therefore, standard VC theory arguments provide uniform convergence bounds for them. We use Bernstein style uniform convergence bound and leverage the fact that for all $g\in \G$, $\Ex_{\U}[g(Z)] \leq \epsilon$ to get a variance that shrinks with $\epsilon$. In particular, the proof of this claim follows from \cite[Theorem 13.7]{boucheron2013concentration} and is included in \cref{app:claim:oblivious-bernstein-regret} for completeness. \end{proof} Combining \cref{claim:couple-regret} and \cref{claim:oblivious-bernstein-regret}, replacing in values of $\alpha = 10\ln(T)$, $k = \alpha/\sigma$, and $(1-\sigma)^{\alpha/\sigma} \leq \exp (-\alpha)$, we have that \begin{align*} \Ex_{\adist} \left[ \sup_{g \in \G } \sum_{i = 1}^T g\left( x_i \right) \right] &\leq T^2 \exp(- \alpha) + O\left( \sqrt{\frac{\epsilon}{\sigma} T \ln(T) d \log \left( 1 / \epsilon \right) } + T \ln(T) \frac{\epsilon}{\sigma} \right) \\ & \asedit{\leq} O\left( \sqrt{\frac{\epsilon}{\sigma} T \ln(T) d \log \left( 1 / \epsilon \right) } + T \ln(T) \frac{\epsilon}{\sigma} \right), \end{align*} where the last transition is due to $T^2 \exp(-10 \ln(T)) \in o(1)$. This completes the proof of \cref{lem:net_bound}. \end{proof} \subsection{Proof of \cref{thm:regret-main}} \label{sec:regretmain} The proof of \cref{thm:regret-main} follows the proof outline for oblivious smooth adversaries described with \cref{sec:regret-overview} with the exception of using \cref{lem:net_bound} that holds for adaptive smooth adversaries in place of \autoref{eq:nadist-bound} bound. Let $d = \vc(\H)$. Using the regret decomposition \autoref{eq:Regret_Decomp}, an upper bound on the size of an $\epsilon$-cover such as $|\H|\leq (41/\epsilon)^d$ (see \cite{HAUSSLER1995217} or \cite[Lemma 13.6]{boucheron2013concentration}), and \cref{lem:net_bound}, we have \begin{align*} \Ex[\regret(\A, \adist )] &\leq O\left( \sqrt{T d \ln\left(\frac 1\epsilon \right) } \right) + \Ex_{\adist}\left[ \sup_{g \in \G} \sum_{t = 1}^T g\left( x_t \right) \right] \\ & \leq O\left( \sqrt{T d \ln\left(\frac 1\epsilon \right) } + \sqrt{\frac{\epsilon}{\sigma} T \ln(T) d \log \left( 1 / \epsilon \right) } + T \ln(T) \frac{\epsilon}{\sigma} \right), \end{align*} Recall that we needed $\epsilon > \frac{120d \sigma \log \left( 4 e^2 / \epsilon \right)}{T \log T } $. This can be satisfied by setting $ \epsilon = O \left( \frac{d \sigma }{T \log T } \log \left(\frac{T \log T }{d \sigma } \right) \right) $ and we have that \begin{equation*} \Ex[\regret(\A, \adist )] \leq \tilde{O} \left(\sqrt{Td \ln \left( \frac{T}{d \sigma } \right) } + d \ln\left( \frac{T }{d \sigma } \right) \right) \end{equation*} as required. \subsection{Proof of \cref{thm:regret_lowerbound}} \label{sec:regretlowerproof} In this section, we provide a proof for the tightness of our regret bounds. In order to do this, we first formally define the notion of Littlestone dimension of a class. \begin{definition}[Littlestone Dimension, \cite{ben2009agnostic}] Let $\X$ be an instance space and $\F$ be a hypothesis class on $\X$. A mistake tree is a full binary decision tree whose internal nodes are labelled by elements of $\X$. For every choice of labels $ \{ y_i \}_{i=1}^d $, Every root to leaf path in the mistake tree corresponds to a sequence $ \{ \left( x_i , y_i \right) \}_{i=1}^{d}$ by associating a label $y_i$ to a node depending on whether it is the left or right child of its parent. A mistake tree of depth $d$ is said to be shattered by a class $\F$ if for any root to leaf path $ \{ \left( x_i , y_i \right) \}_{i=1}^{d}$, there is a function $f \in \F $ such that $ f\left( x_i \right) = y_i $ for all $i \leq d$. The Littlestone dimension of the class $\F$ denoted by $\lsd \left( \F \right) $ is the largest depth of a mistake tree shattered by the class $\F$. \end{definition} {As an example, the Littlestone dimension of the class of thresholds on $\{1, \dots, n\}$ is $\log_2(n)$.} The following theorem shows that the Littlestone dimension captures the regret in the online learning game against a class. We will only need the lower bound but we will state the full theorem for completeness. \begin{theorem}[\cite{ben2009agnostic,RegretTight}]\label{thm:regretLD} Let $\X$ be an instance space and $\F$ be a hypothesis class on $\X$. Then, there exists an online learning algorithm $\mathcal{A}$ such that \begin{equation*} \regret \left( \mathcal{A} \right) \leq O\left( \sqrt{ \lsd \left( \F \right) T } \right). \end{equation*} Furthermore, for any algorithm $\mathcal{A}'$, we have that \begin{equation*} \regret \left( \mathcal{A} ' \right) \geq \Omega \left( \sqrt{ \lsd \left( \F \right) T } \right) . \end{equation*} \end{theorem} Using the above theorem, we lower bound the regret in the online learning against smoothed adversaries. We do this by reducing the smoothed case to the worst case for a related class and lower bound the worst case regret using the above theorem. \begin{proof}[Proof of \cref{thm:regret_lowerbound}] We will first construct a class on the domain $\left[ \nicefrac{1}{\sigma} \right] = \left\{ 1, \dots, \frac{1}{\sigma} \right\}$ with VC dimension $d$ and Littlestone dimension $\Theta\left( d \log \left( \nicefrac{1}{d \sigma} \right) \right) $. For simplicity, assume $ \sigma^{-1} $ and $ d $ to be powers of two. Divide $ \left[ \nicefrac{1}{\sigma} \right] $ into $d $ subsets each of equal size, denoted by $A_i$. On each of these subsets instantiate the class of thresholds, i.e., for each $\gamma \in A_i $, $ h_{\gamma} \left( x \right) = \mathbb{I} \left[ x \geq \gamma \right] $ for $x \in A_i$ and $0 $ for $x \notin A_i$. For a $d$-tuple of thresholds $ \left( h_{\gamma_1} \dots h_{\gamma_d} \right) $ with $\gamma_i \in A_i $, define the function \begin{equation*} h_{ \gamma_1, \dots, \gamma_d } \left( x \right) = \sum_{i=1}^d \mathbb{I} \left[ x \in A_i \right] h_{\gamma_i} \left( x \right). \end{equation*} This function can be seen as the union of the thresholds $h_{\gamma_i}$. Define $\mathcal{H}$ to be the class of all such functions. Note that this class has VC dimension $d$. The VC dimension is at most $d$ since if any more than $d$ points would mean at least one of the $A_i$ must have two points but this cannot be shattered by thresholds on $A_i$. The VC dimension can be seen to be at least $d$ by taking one point in each of the $A_i$. { We claim that this class has Littlestone dimension $\Theta\left( d \log \left( \nicefrac{1}{\sigma d} \right) \right) $. At a high level, the Littlestone dimension of the class of thresholds defined over $A_i$ is $\log_2(\nicefrac{1}{\sigma d})$. Moreover, our definition of a $d$-tuple threshold is a disjoint union of $d$ thresholds. This allows us to combine the mistake trees for $A_1, \dots, A_d$, by gluing a copy of the mistake tree for $A_{i+1}$ at each of the leaves of the mistake tree for $A_i$, recursively. This results in a mistake tree of depth $\Theta\left( d \log \left( \nicefrac{1}{\sigma d} \right) \right) $. For more detail, see \cref{lem:Littlestone}. } Next consider the set $\left[ 0,1 \right]$ and divide it into contiguous subintervals of length $ \sigma $. We define the projection function $ \Pi : \left[ 0,1 \right] \to \left[ \nicefrac{1}{\sigma} \right] $ by $ \Pi\left( x \right) = i $ if $x$ is in the $i$th subinterval. Define the class $ \G$ on $\left[ 0,1 \right] $ by composing $ \H $ with $ \Pi $, i.e., $ \G = \left\{ g : g = h \circ \Pi \right\} $. Note that the uniform distribution on each subinterval is $ \sigma $-smooth. Thus, in a smoothed online learning game with the class $\G $, an adversary who plays only uniform distributions on the subintervals defined above corresponds to an adversary in the worst-case online learning game on $ \left[ \nicefrac{1}{\sigma} \right] $ against class $\H$. In particular, any algorithm for $\G$ against such an adversary can be converted to an algorithm for $\H$ with the same regret. From \cref{thm:regretLD}, we have that the regret against $\H$ is lower bounded by \begin{equation*} \sqrt{ T \ldim\left( \H \right) } = \sqrt{ dT \log\left( \nicefrac{1}{\sigma d} \right) } \end{equation*} Thus, the regret in the smoothed online learning game for $\G$ is lower bounded by $ \sqrt{ dT \log\left( \nicefrac{1}{\sigma d} \right) }$ as required. {We note that this reduction goes through even for non-adaptive smooth adversaries.} \end{proof}
\section{Introduction} \input{tex/introduction} \section{Related Work} \input{tex/related_work} \section{Label Leakage in Split Learning} \label{sec:leakage} We first introduce the two-party split learning problem for binary classification, and then formally describe our threat model and privacy quantification metrics with two concrete attack examples. \subsection{Two-party Split Learning in Binary Classification} \input{tex/setup} \subsection{Threat Model and Privacy Quantification} \input{tex/threat_model} \subsection{Practical Attack Methods} \input{tex/threat_example} \section{Label Leakage Protection Methods} \input{tex/gradient_perturbation} \section{Experiments} \input{tex/experiments} \section{Conclusion} \input{tex/conclusion} \bibliographystyle{unsrtnat} \subsubsection{Leak AUC progression for Avazu and Criteo} \label{app:subsubsec_leakauc_progression} In addition to the leak AUC progression on ISIC shown in Figure \ref{fig:leakage_trajectory} in the main paper, we also show the leak AUC progression on the Avazu and Criteo datasets throughout training here in Figure~\ref{app_fig:Avazu_leakage_trajectory} and Figure~\ref{app_fig:Criteo_leakage_trajectory}. We similarly compare \texttt{Marvell}~with different levels of protection strength ($s$ values) against the no protection baseline \texttt{no\_noise}. As we can see, \texttt{Marvell}~still achieves strong and flexible privacy protection on these two datasets against our label attacks at different model layers. \begin{figure*}[ht] \centering \includegraphics[width=\linewidth]{figures/leak_auc_trajectory/avazu_leak_auc_4fig.pdf} \vspace{-0.3in} \caption{Norm and cosine leak AUC (computed every batch) at the cut layer and at the first layer of \texttt{no\_noise}~(no protection) vs. \texttt{Marvell}~with different scale hyperparameter $s$ throughout the Avazu training.} \label{app_fig:Avazu_leakage_trajectory} \end{figure*} \begin{figure*}[ht] \centering \includegraphics[width=\linewidth]{figures/leak_auc_trajectory/criteo_leak_auc_4fig.pdf} \vspace{-0.3in} \caption{Norm and cosine leak AUC (computed every batch) at the cut layer and at the first layer of \texttt{no\_noise}~(no protection) vs. \texttt{Marvell}~with different scale hyperparameter $s$ throughout the Criteo training.} \label{app_fig:Criteo_leakage_trajectory} \end{figure*} \begin{comment} \begin{figure*}[ht] \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/appendix/trajectory/avazu/a_avazu_norm_leak_auc_cut_layer.pdf} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/appendix/trajectory/avazu/b_avazu_cosine_leak_auc_cut_layer.pdf} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \centering \includegraphics[width=\linewidth]{figures/appendix/trajectory/avazu/c_avazu_norm_leak_auc_first_layer.pdf} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/appendix/trajectory/avazu/d_avazu_cosine_leak_auc_first_layer.pdf} \end{minipage} \vspace{-1.em} \caption{Norm and cosine leak AUC of the cut layer and first layer gradients under no protection and {\small \texttt{Marvell}} with different scale hyperparameter $s$ throughout the Avazu training (computed every batch).} \label{app_fig:Avazu_leakage_trajectory} \end{figure*} \end{comment} \begin{comment} \begin{figure*}[ht] \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/appendix/trajectory/criteo/a_criteo_norm_leak_auc_cut_layer.pdf} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/appendix/trajectory/criteo/b_criteo_cosine_leak_auc_cut_layer.pdf} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/appendix/trajectory/criteo/c_criteo_norm_leak_auc_first_layer.pdf} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/appendix/trajectory/criteo/d_criteo_cosine_leak_auc_first_layer.pdf} \end{minipage} \vspace{-1.em} \caption{Norm and cosine leak AUC of the cut layer and first layer gradients under no protection and {\small \texttt{Marvell}} with different scale hyperparameter $s$ throughout the Criteo training (computed every batch).} \label{app_fig:Criteo_leakage_trajectory} \end{figure*} \end{comment} \subsubsection{Complete Privacy-Utility tradeoffs} We show additional Privacy-Utility tradeoff results for all three datasets considered in this paper. (Some of the plots have already been shown in the main paper but we still include them here for completeness and ease of reference.) For each dataset, we compare the privacy-utility tradeoff over multiple measures of privacy and utility: \textbf{Privacy} We consider our introduced privacy metrics using the activation gradient from the cut layer and the first layer of the \nlpartynospace~: \begin{itemize} \item 95\% norm leak AUC at cut layer \item 95\% cosine leak AUC at cut layer \item 95\% norm leak AUC at first layer \item 95\% cosine leak AUC at first layer \end{itemize} \textbf{Utility} We consider three metrics of utility: \begin{itemize} \item training loss (train loss): the lowest loss achieved on the training set throughout training. This directly measures how much the random protection perturbation influences the optimization. \item test loss. Because we only control the training optimization stochastic gradient's variance, measuring test loss directly tells us how much impact the training optimization random perturbation influences beyond optimization but on the learned model's generalization ability. \item test AUC. As we are dealing with binary classification problem (where performance is commonly measured through test AUC), we also naturally consider it as a utility metric. \end{itemize} As shown in Figure~\ref{fig:app_avazu_utility_privacy_tradeoff},\ref{fig:app_criteo_utility_privacy_tradeoff},\ref{fig:app_isic_utility_privacy_tradeoff}, \texttt{Marvell}~consistently outperforms the isotropic Gaussian baseline over all the different privacy-utility definitions. In addition, our proposed heuristic \texttt{max\_norm}~is also particularly effective against our identified norm and direction-based attacks. \begin{figure}[ht] \centering \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/a_Avazu_train_loss_deep_mask_layer_3_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/b_Avazu_train_loss_deep_mask_layer_3_unit_128_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/c_Avazu_train_loss_deep_mask_layer_1_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/d_Avazu_train_loss_deep_mask_layer_1_unit_128_cosine_leak_batch.pdf} \end{minipage} \vspace{1em} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/e_Avazu_test_loss_deep_mask_layer_3_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/f_Avazu_test_loss_deep_mask_layer_3_unit_128_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/g_Avazu_test_loss_deep_mask_layer_1_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/h_Avazu_test_loss_deep_mask_layer_1_unit_128_cosine_leak_batch.pdf} \end{minipage} \vspace{1em} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/i_Avazu_test_auc_deep_mask_layer_3_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/j_Avazu_test_auc_deep_mask_layer_3_unit_128_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/k_Avazu_test_auc_deep_mask_layer_1_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/avazu/l_Avazu_test_auc_deep_mask_layer_1_unit_128_cosine_leak_batch.pdf} \end{minipage} \caption{Privacy (norm and cosine leak AUC) vs Utility (train loss, test loss, and test AUC) trade-off of protection methods (\texttt{Marvell}, \texttt{iso}, \texttt{no\_noise}, \texttt{max\_norm}) at the cut layer and first layer on Avazu.} \label{fig:app_avazu_utility_privacy_tradeoff} \end{figure} \begin{figure}[ht] \centering \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/a_Criteo_train_loss_deep_mask_layer_3_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/b_Criteo_train_loss_deep_mask_layer_3_unit_128_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/c_Criteo_train_loss_deep_mask_layer_1_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/d_Criteo_train_loss_deep_mask_layer_1_unit_128_cosine_leak_batch.pdf} \end{minipage} \vspace{1em} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/e_Criteo_test_loss_deep_mask_layer_3_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/f_Criteo_test_loss_deep_mask_layer_3_unit_128_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/g_Criteo_test_loss_deep_mask_layer_1_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/h_Criteo_test_loss_deep_mask_layer_1_unit_128_cosine_leak_batch.pdf} \end{minipage} \vspace{1em} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/i_Criteo_test_auc_deep_mask_layer_3_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/j_Criteo_test_auc_deep_mask_layer_3_unit_128_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/k_Criteo_test_auc_deep_mask_layer_1_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/criteo/l_Criteo_test_auc_deep_mask_layer_1_unit_128_cosine_leak_batch.pdf} \end{minipage} \caption{Privacy (norm and cosine leak AUC) vs Utility (train loss, test loss, and test AUC) trade-off of protection methods (\texttt{Marvell}, \texttt{iso}, \texttt{no\_noise}, \texttt{max\_norm}) at the cut layer and first layer on Criteo.} \label{fig:app_criteo_utility_privacy_tradeoff} \end{figure} \begin{figure}[ht] \centering \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/a_ISIC_train_loss_mask_layer_4_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/b_ISIC_train_loss_mask_layer_4_conv64_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/c_ISIC_train_loss_mask_layer_1_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/d_ISIC_train_loss_mask_layer_1_conv64_cosine_leak_batch.pdf} \end{minipage} \vspace{1em} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/e_ISIC_test_loss_mask_layer_4_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/f_ISIC_test_loss_mask_layer_4_conv64_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/g_ISIC_test_loss_mask_layer_1_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/h_ISIC_test_loss_mask_layer_1_conv64_cosine_leak_batch.pdf} \end{minipage} \vspace{1em} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/i_ISIC_test_auc_mask_layer_4_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/j_ISIC_test_auc_mask_layer_4_conv64_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/k_ISIC_test_auc_mask_layer_1_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/appendix/tradeoff/isic/l_ISIC_test_auc_mask_layer_1_conv64_cosine_leak_batch.pdf} \end{minipage} \caption{Privacy (norm and cosine leak AUC) vs Utility (train loss, test loss, and test AUC) trade-off of protection methods (\texttt{Marvell}, \texttt{iso}, \texttt{no\_noise}, \texttt{max\_norm}) at the cut layer and first layer on ISIC.} \label{fig:app_isic_utility_privacy_tradeoff} \end{figure} \section{Inferring Label from Gradients Norm} \subsection{A Heuristic Protection Approach} \textbf{Random perturbation and the isotropic Gaussian baseline.} To protect against label leakage, the \lpartynospace~ should ideally communicate essential information about the gradient without communicating its actual value. Random perturbation methods generally aim to achieve this goal. One obvious consideration for random perturbation is to keep the perturbed gradients unbiased. In other words, suppose $\tilde{g}$ is the perturbed version of an example's true gradient $g$, then we want $\E[\tilde{g} \mid g] = g$. By chain rule and linearity of expectation, this ensures the computed gradients of the non-label party's parameters $f$ will also be unbiased, a desirable property for stochastic optimization. Among unbiased perturbation methods, a simple approach is to add \textit{iid} isotropic Gaussian noise to every gradient to mix the positive and negative gradient distribution before sending to the non-label party. Although isotropic Gaussian noise is a valid option, it may not be optimal because \textbf{1)} the gradients are vectors but not scalars, so the structure of the noise covariance matrix matters. Isotropic noise might neglect the direction information; \textbf{2)} due to the asymmetry of the positive and negative gradient distribution, the \lpartynospace~ could add noise with different distributions to each class's gradients. \textbf{Norm-alignment heuristic.} We now introduce an improved heuristic approach of adding zero-mean Gaussian noise with non-isotropic and example-dependent covariance. [\textbf{Magnitude choice}] As we have seen that $\|g\|_2$ can be different for positive and negative examples and thus leak label information, this heuristic first aims to make the norm of each perturbed gradient indistinguishable from one another. Specifically, we want to match the expected squared $2$-norm of every perturbed gradient in a mini-batch to the largest squared $2$-norm in this batch (denote by {\small $\|g_{\max}\|_2^2$}). [\textbf{Direction choice}] In addition, as we have seen empirically from Figure~\ref{fig:dist}(e), the positive and negative gradients lie close to a one-dimensional line in $\Real^d$, with positive examples pointing in one direction and negative examples in the other. Thus we consider only adding noise (roughly speaking) along ``this line''. More concretely, for a gradient $g_j$ in the batch, we add a zero-mean Gaussian noise vector $\eta_j$ supported only on the one-dimensional space along the line of $g_j$. In other words, the noise's covariance is the rank-$1$ matrix $\Cov[\eta_j] = \sigma_j^2 g_j g_j^T$. To calculate $\sigma_j$, we aim to match {\small $\E[\|g_j + \eta_j\|_2^2] = \|g_{\max}\|_2^2$}. A simple calculation gives {\small $\sigma_j = \sqrt{\|g_{\max}\|_2^2/\|g_j\|_2^2 - 1}$}. Since we align to the maximum norm, we name this heuristic protection method {\tt max\_norm}. The advantage of \texttt{max\_norm}~is that it has no parameter to tune. Unfortunately, it does not have a strong theoretical motivation, cannot flexibly trade-off between model utility and privacy, and may be broken by some unknown attacks. \vspace{-0.1in} \subsection{Optimized Perturbation Method: \texttt{Marvell}} \vspace{-0.1in} Motivated by the above issues of \texttt{max\_norm}, we next study how to achieve a more principled trade-off between model performance (utility) and label protection (privacy). To do so, we directly minimize the worst-case adversarial scoring function's leak AUC under a utility constraint. We name this protection method \texttt{Marvell}~(opti\textbf{M}ized perturb\textbf{A}tion to p\textbf{R}e\textbf{VE}nt \textbf{L}abel \textbf{L}eakage). \textbf{Noise perturbation structure.} Due to the distribution difference between the positive and negative class's cut layer gradients, we consider having the \lpartynospace~ additively perturb the randomly sampled positive $g^{(1)}$ and negative $g^{(0)}$ gradients with independent zero-mean random noise vectors {\scriptsize$\eta^{(1)}$} and {\scriptsize$\eta^{(0)}$} with possibly different distributions (denoted by {\scriptsize$D^{(1)}$} and {\scriptsize$D^{(0)}$)}. We use {\scriptsize$\widetilde{P}^{(1)}$} and {\scriptsize$\widetilde{P}^{(0)}$} to denote the induced perturbed positive and negative gradient distributions. Our goal is to find the optimal noise distributions {\scriptsize$D^{(1)}$} and {\scriptsize $D^{(0)}$} by optimizing our privacy objective described below. \textbf{Privacy protection optimization objective.} As the adversarial \nlpartynospace~ in our threat model is allowed to use any measurable scoring function $r$ for label recovery, we aim to protect against \textit{all such scoring functions} by minimizing the privacy loss of the worst case scoring function measured through our leak AUC metric. Formally, our optimization objective is {\small $\min_{D^{(1)}, D^{(0)}} \max_{r} \textrm{AUC}(r)$}. Here to compute $\textrm{AUC}(r)$, the $\textrm{FPR}_r(t)$ and $\textrm{TPR}_r(t)$ needs to be computed using the perturbed distributions {\scriptsize $\widetilde{P}^{(1)}$} and {\scriptsize $\widetilde{P}^{(0)}$} instead of the unperturbed {\scriptsize $P^{(1)}$} and {\scriptsize $P^{(0)}$} (Section~\ref{subsec:threatmodel}). Since AUC is difficult to directly optimize, we consider optimizing an upper bound through the following theorem: \begin{theorem} For $0 \le \epsilon < 4$ and any perturbed gradient distributions {\scriptsize$\widetilde{P}^{(1)}$} and {\scriptsize$\widetilde{P}^{(0)}$} that are absolutely continuous with respect to each other, \qquad \fourquad {\normalfont $\KL{\widetilde{P}^{(1)}}{\widetilde{P}^{(0)}} + \KL{\widetilde{P}^{(0)}}{\widetilde{P}^{(1)}} \le \epsilon$} \quad implies \quad {\normalfont $\max_r \textrm{AUC}(r) \le \frac{1}{2} + \frac{\sqrt{\epsilon}}{2} - \frac{\epsilon}{8}$}. \label{thm:AUCupperbound} \end{theorem} From Theorem~\ref{thm:AUCupperbound} (proof in Appendix~\ref{appsubsec:proof_aucupperbound}), we see that as long as the sum KL divergence is below $4$, the smaller sumKL is, the smaller $\max_r \textrm{AUC}(r)$ is. ($1/2 + \sqrt{\epsilon}/2 - \epsilon/8$ decreases as $\epsilon$ decreases.) Thus we can instead minimize the sum KL divergence between the perturbed gradient distributions: \begin{align} \textstyle \textrm{sumKL}^*:=\min_{D^{(1)}, D^{(0)}} \KL{\widetilde{P}^{(1)}}{\widetilde{P}^{(0)}} + \KL{\widetilde{P}^{(0)}}{\widetilde{P}^{(1)}}. \label{eq:protection_objective_sumKL} \end{align} \textbf{Utility constraint.} In an extreme case, we could add infinite noise to both the negative and positive gradients. This would minimize \eqref{eq:protection_objective_sumKL} optimally to $0$ and make the worst case leak AUC $0.5$, which is equivalent to a random guess. However, stochastic gradient descent cannot converge under infinitely large noise, so it is necessary to control the variance of the added noise. We thus introduce the noise power constraint: {\small $p \cdot \tr(\Cov[\eta^{(1)}]) + (1-p)\cdot\tr(\Cov[\eta^{(0)}]) \le \; P$}, where $p$ is the fraction of positive examples (already known to the label party); {\scriptsize $\tr(\Cov[\eta^{(i)}])$} denotes the trace of the covariance matrix of the random noise $\eta^{(i)}$; and the upper bound $P$ is a tunable hyperparameter to control the level of noise: larger $P$ would achieve a lower sumKL and thus lower worst-case leak AUC and better \textbf{privacy}; however, it would also add more noise to the gradients, leading to slower optimization convergence and possibly worse model \textbf{utility}. We weight each class's noise level {\scriptsize $\tr(\Cov[\eta^{(i)}])$} by its example proportion ($p$ or $1-p$) since, from an optimization perspective, we want to equally control every training example's gradient noise. The constrained optimization problem becomes: { \begin{align} \min_{D^{(1)}, D^{(0)}} \KL{\widetilde{P}^{(1)}}{\widetilde{P}^{(0)}} + \KL{\widetilde{P}^{(0)}}{\widetilde{P}^{(1)}} \label{eq:protection_problem} \;\; \textrm{s.t.}\;\; p \cdot \tr(\Cov[\eta^{(1)}]) + (1-p)\cdot\tr(\Cov[\eta^{(0)}]) \le \; P. \end{align} } \normalsize \vspace{-0.1in} \textbf{Optimizing the objective in practice.} \label{sec: optimization} To solve the optimization problem we first introduce some modelling assumptions. We assume that the unperturbed gradient of each class follows a Gaussian distribution: {\small $g^{(1)} \sim \mathcal{N}(\bar{g}^{(1)}, vI_{d \times d})$} and {\small $g^{(0)} \sim \mathcal{N}(\bar{g}^{(0)}, uI_{d \times d})$}. Despite this being an approximation, as we see later in Section~\ref{sec:experiment}, it can achieve strong protection quality against our identified attacks. In addition, it makes the optimization easier (see below) and provides us with insight on the optimal noise structure. We also search for perturbation distributions that are Gaussian: {\small $D^{(1)} = \mathcal{N}(0, \Sigma_1)$} and {\small $D^{(0)} = \mathcal{N}(0, \Sigma_0)$} with commuting covariance matrices: {\small $\Sigma_1 \Sigma_0 = \Sigma_0 \Sigma_1$}. The commutative requirement slightly restricts our search space but also makes the optimization problem more tractable. Our goal is to solve for the optimal noise structure, \ie the positive semidefinite covariance matrices $\Sigma_0$, $\Sigma_1$. Let $\Delta g \coloneqq \bar{g}^{(1)} - \bar{g}^{(0)}$ denote the difference between the positive and negative gradient's mean vectors. We now have the following theorem (proof and interpretation in Appendix~\ref{appsubsec:proof_optimalsoln}): \begin{theorem} \label{thm:optimal_solution} The optimal $\Sigma_1^*$ and $\Sigma_0^*$ to \eqref{eq:protection_problem} with the above assumptions have the form: \begin{align} \Sigma_1^* = \frac{\Lam{1}{1} - \Lam{2}{1}}{\norm{\Delta g}_2^2} (\Delta g)(\Delta g)^{\top} + \Lam{2}{1}I_d, \quad \Sigma_0^* = \frac{\Lam{1}{0} - \Lam{2}{0}}{\norm{\Delta g}_2^2} (\Delta g)(\Delta g)^{\top} + \Lam{2}{0}I_d, \label{eq:solution} \end{align} \vspace{-0.05in} where $(\Lam{1}{0}, \Lam{2}{0}, \Lam{1}{1}, \Lam{2}{1})$ is the solution to the following 4-variable optimization problem: \begin{align*} \min_{\lambda_1^{(0)}, \lambda_1^{(1)}, \lambda_2^{(0)}, \lambda_2^{(1)}} \; &(d-1) \frac{\lambda_2^{(0)} + u}{\lambda_2^{(1)} + v} + (d-1) \frac{\lambda_2^{(1)} + v}{\lambda_2^{(0)} + u} + \frac{\lambda_1^{(0)} + u + \|\Delta g\|_2^2}{\lambda_1^{(1)} + v} + \frac{ \lambda_1^{(1)} + v + \|\Delta g\|_2^2}{\lambda_1^{(0)} + u}\\ \textrm{s.t.} & \quad p \lambda_1^{(1)} + p(d-1) \lambda_2^{(1)}+ (1-p) \lambda_1^{(0)} + (1-p)(d-1)\lambda_2^{(0)} \le \; P,\nonumber \\ \quad & \quad \qquad -\lambda_1^{(1)} \le \; 0,\;\;\; -\lambda_1^{(0)} \le \; 0, \;\;\; -\lambda_2^{(1)} \le \; 0, \;\;\; - \lambda_2^{(0)} \le \; 0, \\ & \eightquad \lambda_2^{(1)} - \lambda_1^{(1)} \le \; 0, \;\;\; \lambda_2^{(0)} - \lambda_1^{(0)} \le \; 0 \nonumber \\ \end{align*} \end{theorem} \vspace{-0.2in} \textbf{Additional details of} \texttt{Marvell}. By Theorem~\ref{thm:optimal_solution}, our optimization problem over two positive semidefinite matrices is reduced to a much simpler 4-variable optimization problem. We include a detailed description of how the constants in the problem are estimated in practice and what solver we use in a full description of the \texttt{Marvell}~algorithm in Appendix~\ref{appsubsec:marvell_details}. Beyond optimization details, it is worth noting how to set the power constraint hyperparameter $P$ in Equation~\ref{eq:protection_problem} in practice. As directly choosing $P$ requires knowledge of the scale of the gradients in the specific application and the scale could also shrink as the optimization converges, we instead express $P = s \norm{\Delta g}_2^2$, and tune for a fixed hyperparameter $s > 0$. This alleviates the need to know the scale of the gradients in advance, and the resulting value of $P$ can also dynamically change throughout training as the distance between the two gradient distributions' mean $\norm{\Delta g}_2$ changes. \subsubsection{Dataset preprocessing} \label{appsubsubsec:dataset_preprocessing} \paragraph{[Criteo]} Every record of Criteo has $27$ categorical input features and $14$ real-valued input features. We first replace all the \texttt{NA} values in categorical features with a single new category (which we represent using the empty string) and replace all the \texttt{NA} values in real-valued features with $0$. For each categorical feature, we convert each of its possible value uniquely to an integer between $0$ (inclusive) and the total number of unique categories (exclusive). For each real-valued feature, we linearly normalize it into $[0,1]$. We then randomly sample $10\%$ of the entire Criteo publicly provided training set as our entire dataset (for faster training to generate privacy-utility trade-off comparision) and further make the subsampled dataset into a 90\%-10\% train-test split. \paragraph{[Avazu]} Unlike Criteo, each record in Avazu only has categorical input features. We similarly replace all \texttt{NA} value with a single new category (the empty string), and for each categorical feature, we convert each of its possible value uniquely to an integer between $0$ (inclusive) and the total number of unique categories (exclusive). We use all the records in provided in Avazu and randomly split it into 90\% for training and 10\% for test. \paragraph{[ISIC]} The official SIIM-ISIC Melanoma Classification dataset has a total $33126$ of skin lesion images with less than $2\%$ positive examples. Because for image classification model training it is desirable to use a batch size of $\sim 10^2$, it is highly likely that there won't be any positive examples sampled in a batch of such size. Thus to make the label leakage problem more severe, we modify the dataset by retaining all the 584 positive examples and randomly choosing $584 \times 9$ examples out of all the negative examples. By doing this, we enforce that there are 10\% positive examples in this modified dataset. We randomly split these 5840 examples into a 80\%-20\% training and test split. We also resize the images to size $84\times84$ for efficient model training. \subsubsection{Model architecture details} \label{appsubsubsec:model_architecture} \paragraph{[Criteo, ISIC]} We use a popular deep learning model architecture WDL \citep{cheng2016wide} for online advertising. Here the deep and wide part each first processes the categorical features in a given record by applying an embedding lookup for every categorical feature's value. We use an embedding dimension of 4 for the deep part and embedding dimension of 1 for the wide part. After the lookup, the deep/wide embeddings are then concatenated with the continuous features to form the raw input vectors for both the deep part and wide part respectively. (This step is skipped for Avazu as it has no continuous features.) Then the wide part computes the wide part logit value through a real-valued linear function (with bias) of its raw input vectors, while the deep part processes its raw input features using 6 ReLU-activated 128-unit MLP layers before producing a single deep part logit. The two logits are summed up to form the final logic value. The cut layer is after the output of the 3rd ReLU layer on the deep part. \paragraph{[ISIC]} Every input image after resizing is of size $84\times84\times3$. We use a convolutional model with 6 convolutional layers each with 64 channels $3 \times 3$ filter size with $1 \times 1$ stride size. Each convolutional layer is followed by a ReLU activation function whose output is then max pooled with $2\times2$ window and stride size $2\times 2$. The max-pooled output of the 6th layer is then flattened and pass into a 64-unit ReLU-activated MLP layer before finally being linearly transformed into a single logit score. The cut layer is after the output of the 4th max pool layer. Thus the cut layer feature and gradient are both of shape $5 \times 5 \times 64$. \subsubsection{Model training details} \label{appsubsubsec:model_training_details} Because the protection mechanism requires adding noise to the cut layer gradient, the induced variance of the gradients of non-label party's $f$-parameters becomes larger. Thus to ensure smooth optimization and sufficient training loss minimization, we use a slightly smaller learning rate than what is normally used. \paragraph{[Criteo]} We use the Adam optimizer with a batch size of 1024 and a learning rate of $1e$$-4$ throughout the entire training of 5 epochs (approximately 20k stochastic gradient updates). \paragraph{[ISIC]} We use the Adam optimizer with a batch size of 128 and a learning rate of $1e$$-5$ throughout the entire training of 1000 epochs (approximately 35k stochastic gradient updates). \paragraph{[Avazu]} We use the Adam optimizer with a batch size of 32768 and a learning rate of $1e$$-4$ throughout the entire training of 5 epochs (approximately 5.5k stochastic gradient updates). We conduct our experiments over 16 Nvidia 1080Ti GPU card. Each run of Avazu takes about 11 hours to finish on a single GPU card occupying 8GB of GPU RAM. Each run of Criteo takes about 37 hours to finish on a single GPU card using 5 GB of GPU RAM. Each run of ISIC takes about 12 hours to finish on a single GPU card occupying 4GB of GPU RAM. \subsection{Implementation Details} \subsubsection{Max norm alignment to prevent label leakage} We now introduce an improved way to add Gaussian noise by making the expected norm of the positive and negative gradients in a mini-batch equal (un-distinguishable). The key question is how to determine the standard deviation of the Gaussian noise with zero mean added to each gradient. For simplicity, we can align all the instances to have the same expected norm with the maximum gradient norm among the mini-batch. Hence, we name this heuristic protection method as {\tt max\_norm}. Suppose that instance $i$ in a mini-batch has the maximum gradient norm and its corresponding gradient is $g_i$. For arbitrary $j$, let instance $j$'s gradient be $g_j$. The noise we add is $\eta_j\cdot g_j$, where $\eta_j\sim \mathcal{N}(0,\sigma_j^2)$ and $\sigma_j$ is the standard deviation to be determined. The perturbed gradient of $g_j$ is $g'_j = g_j(1+\eta_j)$, and we require (the square of) the expected norm of ${g'_j}^2$ to be aligned to that of $g_i$, then we have: $$\|g_i\|_2^2=\mathbb{E}(||g_j||^2(1 + \eta_j)^2) = ||g_j||^2(1 + \sigma_j^2).$$ Hence $\sigma_j = \sqrt{{||g_i||^2}/{||g_j||^2} - 1}$. As designed, \texttt{max\_norm} \ can prevent the norm attack very well (more details can be seen in the experimental section). The advantage of \texttt{max\_norm} \ is that it has no parameter to tune. Unfortunately, it does not have a theoretical guarantee of the trade-off between model utility and privacy and it may be breached by some unknown attacks. \subsection{Public benchmark datasets} In this section, we first describe our experiment setup and then demonstrate the label protection quality of \texttt{Marvell}~as well as its privacy-utility trade-off relative to baseline approaches. \textbf{Empirical Setup.} We use three real-world binary classification datasets for evaluation: \citet{criteo} and \cite{avazu}, two online advertising prediction datasets with millions of examples; and \cite{isic}, a healthcare image dataset for skin cancer prediction. All datasets are naturally imbalanced, making the label leakage problem more severe (see Appendix~\ref{appsubsubsec:dataset_preprocessing} on dataset and preprocessing details). We defer similar results on Avazu to Appendix~\ref{appsubsec:experiment_results} and focus on Criteo and ISIC in this section. For Criteo, we train a Wide\&Deep model \citep{cheng2016wide} where the \nlpartynospace~ owns the embedding layers for input features and the first three $128$-unit ReLU activated MLP layers (first half of the deep part) while the \lpartynospace~ owns the remaining layers of the deep part and the entire wide part of the model\footnote{In this setting, the \lpartynospace~ will also process input features (through the wide part) just like the non-label party, further relaxing our formal split learning setup in Section~\ref{sec:leakage}.}. For ISIC, we train a model with 6 convolutional layers each with 64 channels followed by a 64-unit ReLU MLP layer, and the cut layer is after the fourth convolutional layer. In this case, an example's cut layer feature $f(X)$ and gradient $g$ are both in $\Real^{5 \times 5 \times 64}$. We treat such tensors as vectors in $\Real^{1600}$ to fit into our analysis framework (for additional model architecture and training details see Appendix~\ref{appsubsubsec:model_architecture}, \ref{appsubsubsec:model_training_details}). \subsection{Label Leakage and \texttt{Marvell}'s Strong and Flexible Protection} We first evaluate the protection quality of \texttt{Marvell}~against the norm and cosine attacks discussed in Section \ref{subsec:threat_example}. We also compare against the leakage metrics when no protection is applied (\texttt{no\_noise}). As the results across the three datasets are highly similar, we use ISIC as an example (other datasets see Appendix~\ref{app:subsubsec_leakauc_progression}). We see in Figure~\ref{fig:leakage_trajectory}(a)(b) that unlike \texttt{no\_noise}~where the label information is completely leaked (leak AUC $\approx 1$) throughout training, \texttt{Marvell}~\textbf{achieves a flexible degree of protection (by varying $s$) against both the norm 2(a) and direction attacks 2(b) on the cut layer gradients and has strong protection (leak AUC $\approx$ 0.5) at $s=4.0$}. Additionally, it is natural to ask \textit{whether the gradients of layers before the cut layer (on the \nlpartynospace~ side) can also leak the labels as the \nlpartynospace~ keeps back propagating towards the first layer}. In Figure~\ref{fig:leakage_trajectory}(c)(d), we compute the leak AUC values when using the non-label party's first layer activation gradient as inputs to the scoring functions to predict $y$. Without protection, the first layer gradient still leaks the label very consistently. In constrast, \texttt{Marvell}~still {achieves strong privacy protection at the first layer} ($s = 4.0$) despite the protection being analyzed at the cut layer. \begin{figure*}[h!] \centering \includegraphics[width=\linewidth]{figures/leak_auc_trajectory/isic_leak_auc_4fig.pdf} \caption{Norm and cosine leak AUC (computed every batch) at the cut layer and at the first layer under no protection vs. {\small \texttt{Marvell}} with different scale hyperparameter $s$ throughout the ISIC training.\vspace{.05in}} \label{fig:leakage_trajectory} \end{figure*} \subsection{Privacy-Utility Trade-off Comparison} \begin{comment} \begin{figure}[t!] \begin{minipage}[b]{0.495\linewidth} \centering \includegraphics[width=\linewidth]{figures/tradeoff/criteo_epoch_5_norm_attack_tradeoff.pdf} \caption*{ (a: Norm Attack on Criteo)} \end{minipage} \begin{minipage}[b]{0.495\linewidth} \centering \includegraphics[width=\linewidth]{figures/tradeoff/criteo_epoch_5_hint_attack_tradeoff.pdf} \caption*{(b: Hint Attack on Criteo)} \end{minipage} \medskip \begin{minipage}[b]{0.495\linewidth} \centering \includegraphics[width=\linewidth]{figures/live_experiments/avazu_norm_attack_tradeoff.pdf} \caption*{ (c: Norm Attack on Avazu)} \end{minipage} \begin{minipage}[b]{0.495\linewidth} \centering \includegraphics[width=\linewidth]{figures/live_experiments/avazu_hint_attack_tradeoff.pdf} \caption*{(d: Hint Attack on Avazu)} \end{minipage} \caption{Figure (a) and (c) shows the trade-off between utility and privacy (norm attack) on Criteo and Avazu dataset respectively. Figure (b) and (d) shows the trade-off between utility and privacy (hint attack) on Criteo and Avazu dataset respectively. Each point represents a utility and privacy performance with a specific setting (for example $s$ for \texttt{iso} \ and sumKL for \marvell). Since \texttt{max\_norm}{} \ and \texttt{no\_noise} \ has no parameter to tune, they have only one point in the corresponding Figures.} \label{fig:utility_privacy_tradeoff} \end{figure} \end{comment} After showing \texttt{Marvell}~can provide strong privacy protection against our identified attacks, we now see how well it can preserve utility by comparing its privacy-utility tradeoff against other protection baselines: \texttt{no\_noise}, isotropic Gaussian (\texttt{iso}), and our proposed heuristic \texttt{max\_norm}. Similar to how we allow \texttt{Marvell}~to use a power constraint to depend on the current iteration's gradient distribution through $P = s\|\Delta g\|_2^2$, we also allow \texttt{iso}~to have such type of dependence---specifically, we add {\small $\eta \sim \calN(\bzero, (t/d) \cdot \|g_{\max}\|_2^2 I_{d \times d})$} to every gradient in a batch with $t$ a tunable privacy hyperparameter to be fixed throughout training. To trace out the complete tradeoff curve for \texttt{Marvell}~and \texttt{iso}, we conduct more than 20 training runs for each protection method with a different value of privacy hyperparameter ($s$ for \texttt{Marvell}, $t$ for \texttt{iso}) in each run on every dataset. (Note that \texttt{no\_noise}~and \texttt{max\_norm}~do not have privacy hyperparameters.) We present the tradeoffs between privacy (measured through norm and cosine leak AUC at cut layer/first layer) and utility (measured using test loss and test AUC) in Figure~\ref{fig:utility_privacy_tradeoff}. To summarize the leak AUC over a given training run, we pick the 95\% quantile over the batch-computed leak AUCs throughout all training iterations. This quantile is chosen instead of the mean because we want to measure the most-leaked iteration's privacy leakage (highest leak AUC across iterations) to ensure the labels are not leaked at any points during training. $95\%$ quantile is chosen instead of the max ($100\%$) as we want this privacy leak estimate to be robust against randomness of the training process. \begin{figure}[h!] \centering \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/a_ISIC_test_loss_mask_layer_4_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/b_ISIC_test_loss_mask_layer_4_conv64_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/c_Criteo_test_loss_deep_mask_layer_3_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/d_Criteo_test_loss_deep_mask_layer_3_unit_128_cosine_leak_batch.pdf} \end{minipage} \vspace{1em} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/e_ISIC_test_auc_mask_layer_4_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/f_ISIC_test_auc_mask_layer_4_conv64_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/g_Criteo_test_auc_deep_mask_layer_3_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/h_Criteo_test_auc_deep_mask_layer_3_unit_128_cosine_leak_batch.pdf} \end{minipage} \vspace{1em} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/i_ISIC_test_auc_mask_layer_1_conv64_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/j_ISIC_test_auc_mask_layer_1_conv64_cosine_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/k_Criteo_test_auc_deep_mask_layer_1_unit_128_norm_leak_batch.pdf} \end{minipage} \begin{minipage}[t]{0.24\linewidth} \centering \includegraphics[width=0.97\linewidth]{figures/tradeoff/l_Criteo_test_auc_deep_mask_layer_1_unit_128_cosine_leak_batch.pdf} \end{minipage} \vspace{-1.5em} \caption{Privacy (norm \& cosine leak AUC) vs Utility (test loss \& test AUC) trade-off of protection methods (\texttt{Marvell}, \texttt{iso}, \texttt{no\_noise}, \texttt{max\_norm}) at the cut and first layer on ISIC and Criteo.\vspace{.1in}} \label{fig:utility_privacy_tradeoff} \end{figure} \textbf{Privacy-Utility Tradeoff comparison results.} In measuring the privacy-utility tradeoff, we aim to find a method that consistently achieves a lower leak AUC (better privacy) for the same utility value. \begin{itemize} \item \textbf{[}\texttt{Marvell}~\textbf{vs} \texttt{iso}\textbf{]} As shown in Figure~\ref{fig:utility_privacy_tradeoff}, \texttt{Marvell}~\textit{almost always achieves a better tradeoff than} \texttt{iso}~\textit{against both of our proposed attacks at both the cut layer and the first layer on both the} ISIC \textit{and} Criteo \textit{datasets}. It is important to note that although the utility constraint is in terms of training loss optimization, \texttt{Marvell}'s better tradeoff still translates to the generalization performance when the utility is measured through test loss or test AUC. Additionally, despite achieving reasonable (though still worse than \texttt{Marvell}) privacy-utility tradeoff against the norm-based attack, \texttt{iso}~performs much worse against the direction-based attack: on ISIC, even after applying a significant amount of isotropic noise (with $t>20$), ~\texttt{iso}'s cosine leak AUC is still higher than $0.9$ at the cut layer (Figure~\ref{fig:utility_privacy_tradeoff}(b,f)). In contrast, \texttt{Marvell}~is effective against this direction-based attack with a much lower cosine leak AUC $\approx 0.6$. \item \textbf{[}\texttt{max\_norm}~ \textbf{heuristic]} Beyond \texttt{Marvell}, we see that our heuristic approach \texttt{max\_norm}~can match and sometimes achieve even lower (Figure~\ref{fig:utility_privacy_tradeoff}(a,f,i)) leak AUC value than \texttt{Marvell}~at the same utility level. We believe this specifically results from our norm and direction consideration when designing this heuristic. However, without a tunable hyperparameter, \texttt{max\_norm}~cannot tradeoff between privacy and utility. Additionally, unlike \texttt{Marvell}~which is designed to protect against the entire class of adversarial scoring functions, \texttt{max\_norm}~might still fail to protect against other future attack methods beyond those considered here. \end{itemize} In summary, {our principled method} \texttt{Marvell}~\textbf{significantly outperforms the isotropic Gaussian baseline}, and {our proposed} \texttt{max\_norm}~\textbf{heuristic can also work particularly well against the norm- and direction-based attacks} which we identified in Section~\ref{subsec:threat_example}. \begin{comment} \begin{figure*}[h!] % \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/tradeoff/criteo_epoch_5_norm_attack_tradeoff.pdf} \vspace{-2.0em} \caption*{(a: Norm Attack on Criteo)} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/tradeoff/criteo_epoch_5_hint_attack_tradeoff.pdf} \vspace{-2.0em} \caption*{(b: Hint Attack on Criteo)} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/live_experiments/avazu_norm_attack_tradeoff.pdf} \vspace{-2.0em} \caption*{(c: Norm Attack on Avazu)} \end{minipage} \begin{minipage}[b]{0.245\linewidth} \centering \includegraphics[width=\linewidth]{figures/live_experiments/avazu_hint_attack_tradeoff.pdf} \vspace{-2.0em} \caption*{(d: Hint Attack on Criteo)} \end{minipage} \vspace{-0.5em} \caption{...} \label{fig:utility_privacy_tradeoff} \end{figure*} \begin{figure*} \includegraphics[width=0.95\textwidth]{figures/experiment_results.pdf} \caption{.} \label{fig:experiment_results} \end{figure*} \begin{figure*} \includegraphics[width=0.5\textwidth]{figures/test_auclayer1_leak_auc.pdf} \caption{.} \label{fig:experiment_results} \end{figure*} \begin{figure*} \includegraphics[width=0.5\textwidth]{figures/train_losslayer1_leak_auc.pdf} \caption{.} \label{fig:experiment_results} \end{figure*} \end{comment}
\section{Introduction} In this paper we study existence and convergence properties of solutions to pure critical problems such as \begin{equation}\label{eq:frac_crit_exp} (-\Delta)^s u_s=|u_s|^{2_s^\star-2}u_s, \qquad u_s\in D_0^s(\Omega),\qquad 2^\star_s:=\frac{2N}{N-2s}, \end{equation} where $N\geq 1$, $s>0$, $N>2s$, $(-\Delta)^s$ is the (possibly higher-order) fractional Laplacian, $\Omega$ is either $\mathbb R^N$ or a smooth bounded domain of $\mathbb R^N$, and $D^s_0(\Omega)$ is the homogeneous (fractional) Sobolev space, namely, the closure of $C^\infty_c(\Omega)$ with respect to the Gagliardo seminorm $\|\cdot\|_s$, given by \eqref{def:norm_s} below. See Section~\ref{sec:prelim} for precise definitions and main properties of the operator $(-\Delta)^s$ and the space $D^s_0(\Omega)$. Problem \eqref{eq:frac_crit_exp} is an important paradigm in nonlinear analysis of PDEs and plays an important role in the study of the well-known Yamabe problem in differential geometry and its generalizations. Moreover, the fractional Laplacian plays an important role in the study of anomalous and nonlocal diffusion, which appears for instance in continuum mechanics, graph theory, and ecology, see \cite{BV16} and the references therein. For $s=1$ there is an extensive literature on existence of solutions of \eqref{eq:frac_crit_exp} using different methods, see, for instance, \cite{GNN79,Ding86,HV94,dPMP11,dPMP13,Clapp16,FP,CSS} and the references therein. When $s\in \mathbb N$ with $s\geq 2$, equation \eqref{eq:frac_crit_exp} is the pure critical exponent problem for the polyharmonic operator and existence of solutions has been studied in~\cite{EFJ90,Gru95,BWW03,GGS03,BSW04,Ge05}. In the fractional setting, existence results in $\mathbb R^N$ for $s\in(0,1)$ are available in~\cite{Lie83,DdPS13,GM16,fang,ABR19,T20}, and for $s>1$ it is known that \eqref{eq:frac_crit_exp} has a family of radially symmetric solutions in $\mathbb R^N$, see~\cite{chen}. \medskip The first objective of this paper is to present a unified approach to show existence of solutions of \eqref{eq:frac_crit_exp} for any $s\in(0,\infty)$. For $\Omega$ bounded this is a problem that depends strongly on the geometry of the domain, whereas for $\Omega=\mathbb R^N$ all positive solutions of \eqref{eq:frac_crit_exp} are completely characterized and therefore we are particularly interested in nonradial sign-changing entire solutions. The second objective, is to investigate the convergence properties of solutions, namely, if $(u_{s_k})_{k\in\N}$ are solutions of \eqref{eq:frac_crit_exp} (with $s_k\in(0,\infty)$ instead of $s$), then what can be said about the limit of $u_{s_k}$ as $s_k\to s_0>0$. For the critical nonlinearity $f(u)=|u|^{2^\star_s-2}u$, we are not aware of any previous result in this direction. Although problem \eqref{eq:frac_crit_exp} has a variational structure (with energy functional given by \eqref{eq:func_RN}), variational methods face several compactness issues, mainly due to the following scaling invariance \begin{align}\label{issues} \|u\|_s=\|u_{\lambda,\xi}\|_s,\qquad \int_{\mathbb R^N}|u|^{2^\star_s}=\int_{\mathbb R^N}|u_{\lambda,\xi}|^{2^\star_s},\qquad u_{\lambda,\xi}(x):=\lambda^{\frac{N}{2}-s}u(\lambda x+\xi), \end{align} for $u\in D_0^s(\mathbb R^N)$, $\lambda>0$, and $\xi\in\mathbb R^N$. One way to overcome this difficulty, is to search for solutions within a symmetric framework. In this way, we regain some compactness to achieve least-energy solutions (among symmetric functions) and we also obtain directly important information about the shape of solutions, which can be used to guarantee multiplicity results. Following the framework from~\cite{Clapp16,CLR18,CS20}, let us introduce some notation. Let $G$ be a closed subgroup of the group $O(N)$ of linear isometries of $\mathbb R^N$ such that \begin{itemize} \item[{\bf ($A_1$)}] for each $x\in\mathbb R^N$, either $\dim(Gx)>0$ or $Gx=\{x\}$, \end{itemize} where $Gx:=\{gx\::\: g\in G\}$ is the $G$-orbit of $x$. Let $\phi:G\to {\mathbb Z}_2:=\{-1,1\}$ be a continuous homomorphism of groups (\emph{i.e.} $\phi(g\circ h)=\phi(g)\phi(h)$) and let $\Omega$ be a $G$-invariant set of $\mathbb R^N$ (\emph{i.e.}, $Gx\subset \Omega$ if $x\in \Omega$). A function $u:\Omega\to \mathbb R$ is said to be \emph{$\phi$-equivariant} if \begin{equation}\label{def:equi} u(gx)=\phi(g)u(x) \quad\textnormal{for all } g\in G\text{ and } x\in \Omega. \end{equation} Depending on $\phi,$ it could happen that \eqref{def:equi} is only satisfied by $u\equiv 0$, for instance, if $G=O(N)$ and $\phi(g)$ is the determinant of $g\in G$. To avoid this, we need to impose some condition on $\phi$, namely, that \begin{itemize} \item[{\bf ($A_2$)}] there exists $\xi\in\mathbb R^N$ such that $\{g\in G:g\xi=\xi\}\subset \ker \phi:=\{g\in G: \phi(g)=1\}$. \end{itemize} Under this condition, the space \begin{equation}\label{D0phi:def} D_0^s(\Omega)^{\phi}:=\left\{u\in D_0^{s}(\Omega):u \textnormal{ is $\phi$-equivariant}\right\} \end{equation} has infinite dimension, see~\cite[Theorem 3.1]{BCM05}. Our first result concerns bounded domains. Let $\Omega^G:=\{x\in\Omega\::\: gx=x\text{ for all }g\in G\}$ be the set of $G$-fixed points of $\Omega$ and let ${\mathbb N}_0:=\mathbb N\cup \{0\}$. \begin{theo}\label{main:thm:bdd} Assume that $G$ and $\phi$ verify assumptions \textnormal{\textbf{($A_1$)}} and \textnormal{\textbf{($A_2$)}}. Let $N\geq 1$ and let $\Omega\subset \mathbb R^N$ be a smooth bounded $G$-invariant domain such that $\Omega^G=\emptyset$. \begin{enumerate} \item (Existence) For every $s>0$ with $N>2s$ there is a $\phi$-equivariant least-energy solution $u_s$ of \begin{equation} (-\Delta)^s u_s=|u_s|^{2_s^\star-2}u_s, \qquad u_s\in D_0^s(\Omega)^\phi\backslash \{0\}.\label{Ps} \end{equation} The solution is sign-changing if $\phi:G\to\{-1,1\}$ is surjective. \item (Convergence) Let $(s_k)_{k\in\N}\subset(0,\frac{N}{2})$ such that $s_k\to s$ as $k\to\infty$ with $N>2s>0$, and let $u_{s_k}$ be a $\phi$-equivariant least-energy solution of \begin{equation*} (-\Delta)^{s_k} u_{s_k}=|u_{s_k}|^{2^\star_{s_k}-2}u_{s_k}, \qquad u_{s_k}\in D_0^{s_k}(\Omega)^\phi\backslash \{0\}. \end{equation*} Then, up to a subsequence, there is a $\phi$-equivariant least-energy solution $u_s$ of \eqref{Ps} such that \begin{align}\label{conv:bdd} u_{s_k}\to u_s\quad \text{ in }D^{t}_0(\Omega) \text{ as $k\to\infty$ for all }t\in[0,s). \end{align} \end{enumerate} \end{theo} Different choices for $G$ and $\phi$ in Theorem~\ref{main:thm:bdd} produce different kinds of solutions. For instance, if $G=O(N)$ and $\phi\equiv 1$, then Theorem~\ref{main:thm:bdd} yields a solution $u_s$ of \eqref{Ps} which is radially symmetric. On the other hand, if $G=G_i$ and $\phi=\phi_i$ are given as in \eqref{G:def} and \eqref{phi:def} below, then Theorem~\ref{main:thm:bdd} guarantees that problem \eqref{Ps} has at least $\lfloor \frac{N}{4} \rfloor$ nonradial sign-changing solutions, where $\lfloor x \rfloor$ denotes the greatest integer less than or equal to $x$; this existence result is new even in the local case for $s\in \mathbb N$ with $s\geq 3$ (the cases $s=1$ and $s=2$ are shown in~\cite{Clapp16,CS20} respectively). To prove the first part of Theorem~\ref{main:thm:bdd} (existence), we extend to the fractional setting the strategy used in~\cite{Clapp16,CLR18,CS20} for local problems, where a symmetric-concentration compactness argument is used. The main difficulty in this extension is the adaptation of a Brezis-Kato-type argument which is based on direct calculations for the Laplacian. Direct computations are much harder in nonlocal problems (specially in the higher-order regime $s>1$). We overcome this difficulty using interpolation inequalities and sharp Hardy-Littlewood-Sobolev inequalities among other tools, see Section~\ref{sec:bk}. The proof of the convergence result relies strongly on the $\phi$-equivariance of the solutions, which yields the necessary compactness to extract a convergent subsequence and to guarantee that the limit is a least-energy $\phi$-equivariant solution as well. We remark that \eqref{conv:bdd} also holds in the standard Sobolev norm $\|\cdot\|_{H^{s-\delta}}$, which is equivalent to the homogeneous norm $\|\cdot\|_{s-\delta}$ in $D^{s-\delta}_0(\Omega)$ with $\Omega$ bounded. After Theorem~\ref{main:thm:unbdd} we comment more on these results and compare our findings with previously known convergence results for subcritical problems. The assumption $\Omega^G=\emptyset$ is fundamental, since the existence of solutions of critical problems is closely related to the geometry of the domain. Indeed, a consequence of the Pohozaev identity is that, if $\Omega$ is star-shaped and $s=1$, then \eqref{Ps} only admits trivial solutions. Although for any $s\in(0,\infty)$ there are versions of the Pohozaev identity (see~\cite[Corollary 1.7]{rs15}), a general nonexistence result as in the case $s=1$ is, as far as we know, not available for \eqref{Ps} if $s\neq 1$. This is because the nonexistence proof also requires a unique continuation principle and the existence of a suitable extension of the solution to $\mathbb R^N$. Using maximum principles, one can show nonexistence of \emph{nonnegative} solutions in starshaped domains for \eqref{Ps} if $s\in(0,1)\cup\{2\}$, see \cite[Corollary 1.3]{RS14} and \cite[Theorem 7.33]{GGS03}. On balls, the nonexistence of nonnegative solutions is also known for $s\in\N$, see \cite{LS08} (see also \cite[Theorem 7.34]{GGS03}). Using the Pohozaev identities from \cite{RS14} and a fractional higher-order Hopf Lemma from \cite{AJS18_poisson}, we can extend this nonexistence result to any $s>1.$ \begin{prop}\label{prop:nonex} Let $\alpha\in (0,1)$, $s>1$, $N>2s$, and let $B:=\{x\in\mathbb R^N\::\: |x|<1\}$. The problem \begin{equation}\label{nonex:eq} (-\Delta)^su=|u|^{2_s^\star-2}u, \qquad u\in D_0^s(B)\cap C^\alpha(\overline{B}), \end{equation} does not admit nontrivial nonnegative solutions. \end{prop} Maximum principles (and in particular Hopf Lemmas) do not hold in general domains if $s>1$; for instance, positivity preserving properties fail in ellipses for $s\in(1,\frac{3}{2}+\sqrt{3})$, see \cite{AJS18_ellipse}, in dumbbell domains for $s\in (m,m+1)$ with $m$ odd, see \cite[Theorem 1.11]{AJS18_poisson}, and in two disjoint balls for $s\in (m,m+1)$ with $m$ odd, see \cite[Theorem 1.1]{AJS18_loss} (curiously, this last set has a \emph{positive} Green's function if $s\in(m,m+1)$ and $m$ is \emph{even}, see \cite[Theorem 1.10]{AJS18_poisson}). \medskip Next we present our existence and convergence results for \emph{entire solutions}, namely, when $\Omega=\mathbb R^N$. This setting is more delicate for several reasons. For the existence part, there is an inherent lack of compactness due to the scaling and translation invariance \eqref{issues}. This is controlled in our proofs using the symmetric structure of $D_0^s(\mathbb R^N)^\phi$. On the other hand, the characterization of the convergence of solutions faces a problem regarding the incompatibility of the functional spaces. To be more precise, by the Sobolev inequality, \begin{align*} D_0^s(\mathbb R^N)=D^s(\mathbb R^N):=\{u\in L^{2^\star_s}(\mathbb R^N)\::\: \|u\|_s<\infty\}, \end{align*} (see Theorem \ref{thm:sobolev} below, see also \cite{BGV18} for a survey on homogeneous Sobolev spaces). In particular, it is not true that $D^t(\mathbb R^N)\subset D^s(\mathbb R^N)$ for $t>s$, as it happens in bounded domains, and therefore it is not trivial to find a suitable norm to describe the convergence properties of solutions; for instance, a characterization such as \eqref{conv:bdd} is not possible in $\mathbb R^N$ since $u_s$ might not belong to $D^{t}(\mathbb R^N)$ for $t\neq s$. This is not a problem of local smoothness, but rather an incompatibility with the decay at infinity. In the following result we show that entire solutions converge when multiplied by an arbitrary function in $C^\infty_c(\mathbb R^N)$. \begin{theo}\label{main:thm:unbdd} Assume that $N\geq 1$ and that $G$ and $\phi$ verify assumptions \textnormal{\textbf{($A_1$)}} and \textnormal{\textbf{($A_2$)}}. \begin{enumerate} \item (Existence) For every $s>0$ with $N>2s$ there is a $\phi$-equivariant least-energy solution $w_s$ of \begin{equation} (-\Delta)^s w_s=|w_s|^{2_s^\star-2}w_s, \qquad w_s\in D^s(\mathbb R^N)^\phi\backslash \{0\}.\label{Us} \end{equation} The solution is sign-changing if $\phi:G\to\{-1,1\}$ is surjective. \item (Convergence) Let $(s_k)_{k\in\N}\in(0,\frac{N}{2})$ such that $s_k\to s$ as $k\to\infty$ with $N>2s>0$, and let $w_{s_k}$ be a $\phi$-equivariant least-energy solution of \begin{equation*} (-\Delta)^{s_k} w_{s_k}=|w_{s_k}|^{2^\star_{s_k}-2}w_{s_k}, \qquad w_{s_k}\in D^{s_k}(\mathbb R^N)^\phi\backslash \{0\}. \end{equation*} Then, up to a rescaled subsequence of $w_{s_k}$ denoted by $\widetilde w_{s_k}$, there is a $\phi$-equivariant least-energy solution $w_s$ of \eqref{Us} such that \begin{align}\label{conv:unbdd} \eta\widetilde w_{s_k}\to \eta w_s\quad \text{ in }D^{t}(\mathbb R^N) \text{ as $k\to\infty$ for all }\eta\in C^\infty_c(\mathbb R^N) \text{ and }t\in[0,s). \end{align} In particular, $\widetilde w_{s_k}\to w_s$ in $L_{loc}^q(\mathbb R^N)$ as $k\to\infty$ for all $q\in[1,2^\star_s)$. \end{enumerate} \end{theo} As in the bounded domain case, if $G=O(N)$ and $\phi\equiv 1$, then a solution $w_s$ of \eqref{Us} is a radially symmetric function, see~\cite{chen} for a study of this type of solutions. If $G=G_i$ and $\phi=\phi_i$ are those given in \eqref{G:def} and \eqref{phi:def}, then Theorem~\ref{main:thm:unbdd} yields the existence of at least $\lfloor \frac{N}{4} \rfloor$ non-radial sign-changing solutions to \eqref{Us}. For $s\in(0,1)$, this existence result was proved in the recent paper~\cite{T20}, for $s=1$ it is shown in~\cite{Clapp16}, and for $s=2$ it is a particular case of~\cite[Theorem 1.1]{CS20}. All these papers follow a strategy based on a symmetric-concentration compactness argument, but at a technical level they have important differences and none of them can be easily extended to guarantee existence of solutions in the whole higher-order range $s\in (1,\infty)$. In this sense, the method we present here is more flexible and universal. We emphasize that the solutions given by Theorem \ref{main:thm:unbdd} are different from those obtained in \cite{Ding86} for $s=1$, in \cite{BSW04} for $s\in\N$, and in \cite{fang,ABR19} for $s\in(0,1)$. These entire solutions are obtained by a suitable rescaling of a concentrating energy-minimizing sequence, see Theorem~\ref{thm:concentration}, where it is also shown that the concentration point is necessarily a $G$-fixed point. See also~\cite[Theorem 2.5]{Clapp16} for other variants of these type of results for the Laplacian. In the convergence part in Theorem~\ref{main:thm:unbdd}, the rescaling $\widetilde w_{s_k}$ of the sequence $w_{s_k}$ is needed to avoid the scaling invariance \eqref{issues} typical in critical problems. Without this rescaling it can happen that $w_{s_k}$ converges to 0 or that it diverges at every point. A particularly useful rescaling is presented in Theorem~\ref{thm:conv:entire} via the condition \eqref{rscl}, which is convenient for technical reasons. The use of cut-off functions to characterize the convergence \eqref{conv:unbdd} is one of the main methodological contributions of this work and it requires delicate uniform estimates. As far as we know, Theorems~\ref{main:thm:bdd} and~\ref{main:thm:unbdd} are the first results to consider the convergence of solutions in the critical regime (r.h.s. $|u|^{2^\star_s-2}u$) and for higher-order problems ($s\in(1,\infty)$). Previous convergence results were only available for subcritical problems (where the compactness of the embedding $D^s_0(\Omega)\hookrightarrow L^{p}(\Omega)$, $0<p<2^\star_s$, is the main tool) and only for $s_k\nearrow 1$, see~\cite{BS19,BS20,FBS20}. For linear problems, the continuity of the solution map $s\mapsto v_s$ is considered in~\cite{BHS18} as $s\nearrow 1$ and the continuity and differentiability of this map at any $s\in(0,1)$ is studied in~\cite{JSW20}. Furthermore, we mention that our convergence characterizations \eqref{conv:bdd} and \eqref{conv:unbdd} are stronger than those of~\cite{BS19,BS20,FBS20}, which are in terms of $L^2$ and $L^2_{loc}$ norms. Note that solutions of nonlinear equations with a potential (such as those considered in~\cite{BS19,BS20,FBS20}) would have $L^2$ as a common space for all solutions regardless of the value of $s$, but this is not the case for the pure critical exponent problem \eqref{Us}. \medskip The paper is organized as follows. In Section~\ref{sec:prelim} we detail our symmetry setting and functional framework and exhibit a family of symmetry groups $G_i$ and surjective homomorphism $\phi_i$ that, together with Theorems~\ref{main:thm:bdd} and~\ref{main:thm:unbdd}, yield nonradial sign changing solutions. Section~\ref{sec:bk} contains the main technical tools used to show our main existence and convergence results. In Section~\ref{sec:c} we show a concentration result using a symmetric-concentration compactness argument. Sections~\ref{sec:bdd} is devoted to the proof of Theorem~\ref{main:thm:bdd} and the nonexistence result stated in Proposition \ref{prop:nonex}. Finally, in Section \ref{sec:ubd}, we provide the proof of Theorem~\ref{main:thm:bdd}. \section{Preliminaries}\label{sec:prelim} In this section, we introduce the symmetric setting and functional framework to study the pure critical exponent problem \eqref{eq:frac_crit_exp}. We also detail the definition and some properties of the (possibly higher-order) fractional Laplacian and the homogeneous (fractional) Sobolev space. \subsection{Functional framework} For $u\in C_c^\infty(\mathbb R^N)$ the fractional Laplacian of order $2\sigma$ is given by \begin{equation*} (-\Delta)^\sigma u(x) =c_{N,\sigma}\textnormal{p.v.}\int_{\mathbb R^N}\frac{u(x)-u(y)}{|x-y|^{N+2\sigma}}\,\textnormal{d}{y} =c_{N,\sigma}\lim_{\varepsilon\to0}\int_{\{|x-y|>\varepsilon\}}\frac{u(x)-u(y)}{|x-y|^{N+2\sigma}}\,\textnormal{d}{y} \qquad \text{ for } x\in\mathbb R^N, \end{equation*} where $\textnormal{p.v.}$ means in the principal value sense, \begin{align}\label{cnsigma} c_{N,\sigma}:=4^\sigma\pi^{-N/2}\sigma(1-\sigma)\frac{\Gamma(N/2+\sigma)}{\Gamma(2-\sigma)} \end{align} is a normalization constant, and $\Gamma$ is the usual gamma function. Let $s=m+\sigma>1$ with $m\in\mathbb N$ and $\sigma\in(0,1)$. The fractional Laplacian of order $2s$ is given by \begin{equation*} (-\Delta)^su(x):= \begin{cases} \displaystyle (-\Delta)^{\frac{m}{2}}(-\Delta)^\sigma(-\Delta)^{\frac{m}{2}}u(x), & \text{for $m$ even}, \\ \sum_{i=1}^{N}(-\Delta)^{\frac{m-1}{2}}\left(\partial_i (-\Delta)^\sigma\left(\partial_i(-\Delta)^{\frac{m-1}{2}}u(x)\right)\right), &\text{for $m$ odd}. \end{cases} \end{equation*} We remark that other pointwise evaluations of $(-\Delta)^s$ are possible, see for example~\cite{AJS18,ssurvey}, and we refer to~\cite{AJS18_halfspace,AJS18_green,AJS18_poisson} for recent studies on boundary value problems involving higher-order fractional Laplacians. For $s>0$ let $H^s(\mathbb R^N):=\left\{u\in L^2(\mathbb R^N):(1+|\xi|^2)^{\frac{s}{2}}\widehat u\in L^2(\mathbb R^N)\right\}$ denote the usual fractional Sobolev space, where $\widehat{u}$ denotes the Fourier transform of $u$. For $\Omega\subset \mathbb R^N$ a smooth open set, let $D^s_0(\Omega)$ be the closure of $C^\infty_c(\Omega)$ with respect to the norm \begin{equation}\label{def:norm_s} \|u\|_s:=\left({\mathcal E}_s(u,u)\right)^{1/2}, \end{equation} where \begin{equation}\label{eq:equiv_fourier} {\mathcal E}_{s}(u,v)=\int_{\mathbb R^N}|\xi|^{2s}\widehat u(\xi)\widehat v(\xi)\,\textnormal{d}{\xi} \end{equation}% is the associated scalar product. If $\Omega=\mathbb R^N$, then we simply write $D^s(\mathbb R^N)$ instead of $D^s_0(\mathbb R^N)$. Let $\mathcal H^s_0(\Omega):=\{u\in H^s(\mathbb R^N):u=0 \text{ on } \mathbb R^N\setminus \Omega\}$ equipped with the standard $H^s$-norm. If $\Omega$ is bounded, then \begin{equation}\label{eq:norm_equiv_h0s} \ell_{1,s}\norme{u}_{\mathcal H_0^s(\Omega)}\leq \norme{u}_s\leq \norme{u}_{\mathcal H_0^s(\Omega)}, \end{equation} where $\ell_{1,s}=2^{-1}\min\{1,\lambda_{s,1}\}$, $\lambda_{1,s}=\lambda_{1,s}(\Omega)$ is the first eigenvalue of $((-\Delta)^s,{\mathcal H}_0^s(\Omega))$, see, for example,~\cite{AJS18_loss}. If $m\in \mathbb N$, $\sigma\in(0,1)$, $s=m+\sigma$, and $u,v\in D^s(\mathbb R^N)$, then the following are equivalent expressions for ${\mathcal E}_s$. \begin{align} {\mathcal E}_{\sigma}(u,v)&= \frac{c_{N,\sigma}}{2}\int_{\mathbb R^N}\int_{\mathbb R^N}\frac{(u(x)-u(y))(v(x)-v(y))}{|x-y|^{N+2\sigma}}\,\textnormal{d}{x}\,\textnormal{d}{y},\nonumber\\ {\mathcal E}_{s}(u,v)&=\begin{cases} {\mathcal E}_{\sigma}((-\Delta)^{\frac{m}{2}} u,(-\Delta)^{\frac{m}{2}} v), & \text{if $m$ is even,}\\ \sum_{k=1}^{N}{\mathcal E}_{\sigma}(\partial_k (-\Delta)^{\frac{m-1}{2}} u,\partial_k (-\Delta)^{\frac{m-1}{2}} v), & \text{if $m$ is odd.} \end{cases} \label{bilin:def} \end{align} For some results we also consider $s\in\N$, in these cases we have that \begin{align*} {\mathcal E}_{s}(u,v)&=\begin{cases} \displaystyle \int_{\mathbb R^N}(-\Delta)^{\frac{m}{2}} u(-\Delta)^{\frac{m}{2}} v, & \text{if $m$ is even,} \vspace{0.1 cm} \\ \displaystyle \int_{\mathbb R^N}\nabla (-\Delta)^{\frac{m-1}{2}} u\nabla (-\Delta)^{\frac{m-1}{2}} v, & \text{if $m$ is odd.} \end{cases} \end{align*} In any case, for $s>0$, $\int_{\mathbb R^N}(-\Delta)^su(x)v(x)\,\textnormal{d}x={\mathcal E}_s(u,v)$ for $u\in C_c^\infty(\mathbb R^N)$ and $v\in D^s(\mathbb R^N)$, see, for example,~\cite{AJS18,AJS18_loss}. Throughout the paper the $L^q$-norm is denoted by \begin{align*} |f|_q:=\left(\int_{\Omega}|f(x)|^q\,\textnormal{d}x\right)^{1/q}\qquad \text{ for }q\in[1,\infty). \end{align*} We close this section with two important results. \begin{theo}[Fractional Sobolev inequality]\label{thm:sobolev} Let $N\geq 1$, $s>0$, and $N>2s$. There is $\kappa_{N,s}>0$ such that $|u|_{2_s^\star}\leq \kappa_{N,s}\|u\|_{s}$ for all $u\in D^s(\mathbb R^N),$ where \begin{equation}\label{eq:best_constant} \kappa_{N,s}=2^{-2s}\pi^{-s}\frac{\Gamma(\frac{N-2s}{2})}{\Gamma(\frac{N+2s}{2})} \left(\frac{\Gamma(N)}{\Gamma(\frac{N}{2})}\right)^{\frac{2s}{N}}. \end{equation} \end{theo} \begin{proof} See~\cite[Theorem 1.1]{CT04}. \end{proof} \begin{theo}\label{thm:rellich_type}Let $\Omega$ be a bounded smooth domain, $s>0$, $N>2s$, $p\in[1,2_s^\star)$, and $\varepsilon\in(0,s]$. Then the embeddings $D^s_0(\Omega)\hookrightarrow D^{s-\varepsilon}_0(\Omega)$ and $D_0^s(\Omega)\hookrightarrow L^p(\Omega)$ are compact. \end{theo} \begin{proof} The compactness of the embedding $\mathcal H_0^s(\Omega)\hookrightarrow \mathcal H_0^{s-\varepsilon}(\Omega)$ follows by interpolation theory, see~\cite{T78} (the space $\mathcal H_0^t(\Omega)$ is defined in~\cite[Sec.\,4.3.2 (1a)]{T78}; that $A=\mathcal H_0^s(\Omega)$ is an interpolation space between $A_0=H^{\lceil s \rceil}_0(\Omega)$ and $A_1=L^2(\Omega)$ is a consequence of \cite[Sec.\,4.3.2 Thm 2]{T78} together with~\cite[Sec.\,2.4.2 (10)]{T78}; finally, the compactness of the embedding $\mathcal H_0^s(\Omega) \hookrightarrow \mathcal H_0^{s-\varepsilon}(\Omega)$ follows from \cite[Sec.\,1.16.4 Thm. 2 (a)]{T78} together with the compactness of the embedding $A_0\hookrightarrow A_1$, see~\cite[Sec.\,7.10]{GT01}). Then the compactness of $D^s_0(\Omega)\hookrightarrow D^{s-\varepsilon}_0(\Omega)$ holds by the equivalence of norms \eqref{eq:norm_equiv_h0s}. The embedding $D_0^s(\Omega)\hookrightarrow L^p(\Omega)$ is compact for $p\in[1,2_s^\star)$ by~\cite[Theorem 1.5]{CT04}. \end{proof} \subsection{Symmetric setting} Following~\cite{Clapp16,CLR18,CS20} we now present a series of results connecting the symmetric framework presented in the introduction and the variational structure of equation \eqref{eq:frac_crit_exp}. Let $G$ be a closed subgroup of $O(N)$ and let $\phi: G\to \mathbb{Z}_2:=\{-1,1\}$ be a continuous homomorphism of groups satisfying the properties {\bf ($A_1$)} and {\bf ($A_2$)} presented in the introduction. Let $\Omega$ be a $G$-invariant bounded smooth domain of $\mathbb R^N$ and recall the definition of $\phi$-equivariance given in \eqref{def:equi} and of the space $D_0^s(\Omega)^{\phi}$ given in \eqref{D0phi:def}. We say that $u\in D_0^s(\Omega)$ is a solution of \begin{equation}\label{eq:frac_domain} (-\Delta)^su=|u|^{2_s^\star-2}u, \qquad u\in D_0^s(\Omega), \end{equation} if $u$ is a critical point of the $C^1$-functional $J_s:D_0^s(\Omega)\to \mathbb R$ defined by \begin{equation}\label{eq:func_RN} J_s(u):=\frac{1}{2}\|u\|_s^2-\frac{1}{2_s^\star}|u|_{2_s^\star}^{2_s^\star}. \end{equation} The next lemma is a type of principle of symmetric criticality in the $\phi$-equivariant setting, and it extends \cite[Lemma 3.1]{CS20} to the fractional setting. For $\varphi\in C_c^\infty(\Omega)$ let \begin{equation}\label{eq:def_phi} \varphi_\phi(x):=\frac{1}{\mu(G)}\int_{G}\phi(g)\varphi(gx) \,\textnormal{d}{\mu}, \end{equation} where $\mu$ is the Haar measure on G. In particular, $\varphi_\phi\in C_c^\infty(\Omega)^\phi$. \begin{lem}\label{lem:deriv_func_equiv}Let $m\in\N_0$ and $\sigma\in[0,1]$ such that $s:=m+\sigma>0$. If $u\in D_0^s(\Omega)^\phi$, then \begin{equation*} J_s^\prime(u)\varphi_\phi=J_s^\prime(u)\varphi \quad\textnormal{for every } \varphi\in C_c^\infty(\Omega). \end{equation*} Moreover, if $J_s^\prime(u)\vartheta=0$ for every $\vartheta\in C_c^\infty(\Omega)^\phi$, then $J_s^\prime(u)\varphi=0$ for every $\varphi\in C_c^\infty(\Omega)$. \end{lem} \begin{proof} We show the case $m\in\N_0$ even and $\sigma\in(0,1)$. The other cases follow analogously. First, notice that $(-\Delta)^{\frac{m}{2}}(v\circ g)=(-\Delta)^{\frac{m}{2}}v\circ g$ for every $v\in D_0^s(\Omega)$ and $g\in G$. So, if $u$ is $\phi$-equivariant, we have that $(-\Delta)^{\frac{m}{2}}u$ is $\phi$-equivariant too. Also, \begin{equation}\label{eq:iden_varphi_phi} (-\Delta)^{\frac{m}{2}}(\varphi_\phi)(x)=\frac{1}{\mu(G)}\int_{G}(-\Delta)^{\frac{m}{2}}(\phi(g)\varphi\circ g)(x)\,\textnormal{d}{\mu}=\frac{1}{\mu(G)}\int_{G}\phi(g)(-\Delta)^{\frac{m}{2}}\varphi(gx)\,\textnormal{d}{\mu} \end{equation} and \begin{align} J_s^\prime(u)\varphi_{\phi} &={\mathcal E}_\sigma((-\Delta)^{\frac{m}{2}}u,(-\Delta)^{\frac{m}{2}}\varphi_\phi) -\int_{\Omega}|u(x)|^{p-2}u(x)\varphi_{\phi}(x)\,\textnormal{d}{x}=: J_1+J_2 \label{eq:deriv_phi_phi}. \end{align} For $J_2$, we use that $u$ is $\phi$-equivariant to obtain that \begin{align} J_2=\frac{1}{\mu(G)}\int_{\Omega}\int_{G}|u(x)|^{p-2}u(x)\phi(g)\varphi(gx)\,\textnormal{d}{\mu}\,\textnormal{d}{x} = \int_{\Omega}|u(y)|^{p-2}u(y)\varphi(y)\,\textnormal{d}{y}.\label{eq:J2_term} \end{align} For $J_1$ we argue as follows. Since $\varphi_\phi\in C_c^\infty(\Omega)^\phi$, we use~\eqref{eq:iden_varphi_phi} to obtain that \begin{align*} &\int_{\mathbb R^N}\int_{\mathbb R^N}\frac{[(-\Delta)^{\frac{m}{2}}u(x)-(-\Delta)^{\frac{m}{2}}u(y)] [\int_{G}\phi(g)((-\Delta)^{\frac{m}{2}}\varphi(gx)-(-\Delta)^{\frac{m}{2}}\varphi(gy))\,d\mu]}{|x-y|^{N+2\sigma}}\,\textnormal{d}{x}\,\textnormal{d}{y} \\ &=\int_{\mathbb R^N}\int_{\mathbb R^N}\int_{G}\frac{\left[(-\Delta)^{\frac{m}{2}}u(gx)-(-\Delta)^{\frac{m}{2}}u(gy)\right]\left[(-\Delta)^{\frac{m}{2}}\varphi(gx)-(-\Delta)^{\frac{m}{2}}\varphi(gy)\right]}{|x-y|^{N+2\sigma}}\,\textnormal{d}{\mu}\,\textnormal{d}{x}\,\textnormal{d}{y}. \end{align*} By setting the change of variable $\bar{x}=gx$ (resp. $\bar y=g y$) and using Fubini's theorem, we have that, for every $g\in G$, \begin{align}\notag J_1&=\frac{c_{N,\sigma}}{\mu(G)}\int_{G}\int_{\mathbb R^N}\int_{\mathbb R^N}\frac{[(-\Delta)^{\frac{m}{2}}u(\bar{x})-(-\Delta)^{\frac{m}{2}}u(\bar{y})][(-\Delta)^{\frac{m}{2}}\varphi(\bar{x})-(-\Delta)^{\frac{m}{2}}\varphi(\bar{y})]}{|g^{-1}(\bar{x}-\bar{y})|^{N+2\sigma}}\,\textnormal{d}{ x}\,\textnormal{d}{ y} \,\textnormal{d}{\mu}\\ \label{eq:J11_term} & =c_{N,\sigma} \int_{\mathbb R^N}\int_{\mathbb R^N}\frac{[(-\Delta)^{\frac{m}{2}}u(\bar{x})-(-\Delta)^{\frac{m}{2}}u(\bar{y})][(-\Delta)^{\frac{m}{2}}\varphi(\bar{x})-(-\Delta)^{\frac{m}{2}}\varphi(\bar{y})]}{|\bar{x}-\bar{y}|^{N+2\sigma}}\,\textnormal{d}{\bar x}\,\textnormal{d}{\bar y}. \end{align} To conclude, it is enough to collect identities~\eqref{eq:J2_term}--\eqref{eq:J11_term} and replace into~\eqref{eq:deriv_phi_phi} to deduce that $J_s^\prime(u)\varphi_{\phi}=J_s^\prime(u)\varphi$. The rest of the proof follows immediately. \end{proof} As a consequence of the previous results, the non-trivial $\phi$-equivariant solutions of problem~\eqref{eq:frac_domain} belong to the Nehari set \begin{equation*}\label{N:set} \mathcal N_s^\phi(\Omega):=\left\{u\in D_0^s(\Omega)^\phi: u\neq 0,\ {\|u\|_s^2=|u|^{2_s^\star}_{2_s^\star}} \right\}. \end{equation*} Let \begin{equation* c_s^{\phi}(\Omega):=\inf_{u\in \mathcal N_s^{\phi}(\Omega)} J_s(u). \end{equation*} The following result gives some properties of $\mathcal N_s^\phi(\Omega)$ and $c^\phi_s(\Omega)$. \begin{lem}\label{lem:min_max}Let $s>0$. \begin{enumerate} \item[a)] There exists $a_0>0$ such that ${\|u\|_s\geq a_0}$ for every $u\in \mathcal N_s^\phi(\Omega).$ \item[b)] $\mathcal N_s^\phi(\Omega)$ is a $C^1$-Banach sub-manifold of $D_0^s(\Omega)$ and a natural constraint for $J_s$. \item[c)] Let $\mathcal T:=\left\{\sigma\in C^0\left([0,1];D_0^{s}(\Omega)^\phi\right): \sigma(0)=0, \sigma(1)\neq 0, J_s(\sigma(1))\leq 0\right\}$. Then \begin{equation*} c_s^\phi(\Omega)=\inf_{\sigma\in\mathcal T}\max_{t\in[0,1]}J_s(\sigma(t)). \end{equation*} \end{enumerate} \end{lem} \begin{proof} The proof follows exactly as in~\cite[Lemma 2.1]{CLR18} using \Cref{thm:sobolev}. \end{proof} For a $G$-invariant domain $\Omega$, let us denote by $\Omega^G$ the set of $G$-fixed points in $\Omega$, more precisely \begin{equation*} \Omega^G:=\left\{x\in \Omega: Gx=\{x\} \right\}. \end{equation*} The next result characterizes the least-energy level on domains with $G$-fixed points. \begin{lem}\label{lem:c_infinity}Let $s>0$. If $\Omega^G\neq \emptyset$, then $c_s^\phi(\Omega)=c_s^\phi(\mathbb R^N)$. \end{lem} \begin{proof} From the inclusion $D_0^s(\Omega)\subset D^s(\mathbb R^N)$, we have that $\mathcal N_s^\phi(\Omega)\subset \mathcal N_s^\phi(\mathbb R^N)$, then \begin{align*} c_s^\phi(\mathbb R^N)=\inf_{\mathcal N_s^\phi(\mathbb R^N)} J_s \leq \inf_{\mathcal N_s^\phi(\Omega)} J_s=c_s^\phi(\Omega). \end{align*} For the converse, consider a sequence $(\varphi_k)_{k}$ in $\mathcal N_s^\phi(\mathbb \mathbb R^N)\cap C_c^\infty(\mathbb R^N)$ such that $J_s(\varphi_k)\to c_s^\phi(\mathbb R^N)$ and let $x_0\in \Omega^G$ and $\lambda_k>0$ such that $\varphi^\star_k(x):=\lambda_k^{-\frac{N}{2}+s}\varphi_k\left(\lambda_k^{-1}(x-x_0)\right)$ has support in $\Omega$. As $x_0$ is a $G$-fixed point, $\varphi_k^\star$ is $\phi$-equivariant. Thus $\varphi^\star_k\in\mathcal{N}^\phi(\Omega)$ and hence $c_s^\phi(\Omega)\leq J_s(\varphi^\star_k)=J_s(\varphi_k)$ for all $k$. Letting $k\to+\infty$ we conclude that $c_s^\phi(\Omega)\leq c_s^\phi(\mathbb R^N)$. This ends the proof. \end{proof} The following lemma can be found in~\cite[Lemma 2.4]{CLR18} or~\cite[Lemma 3.4]{CS20}. \begin{lem}\label{lem:prop_G_seq} If $G$ satisfies \textnormal{\textbf{($A_1$)}} then, for every pair of sequences $(\lambda_k)_{k\in\N}\subset(0,\infty)$ and $(x_k)_{k\in\N}\subset\mathbb R^N$, there exists $C_0>0$ and $(\xi_k)_{k\in\N}\subset\mathbb R^N$ such that, up to a subsequence, $\lambda_k^{-1}\textnormal{dist}(Gx_k,\xi_k)\leq C_0$ for all $k\in \N.$ Moreover, one of the following statements hold true: either $\xi_k\in \Omega^G$ or, for each $m\in \mathbb N$, there exist $g_1,\ldots,g_m\in G$ such that $\lambda_k^{-1}|g_i\xi_k-g_j\xi_k|\to \infty$ as $k\to\infty$ if $i\neq j.$ \end{lem} \subsection{Groups and homomorphism for sign-changing solutions}\label{subsec:Gphi} In this section we present some symmetry groups and surjective homomorphisms that can be used to obtain different sign-changing $\phi$-equivariant solutions. These groups and homomorphism were also used in~\cite[Lemma 3.2]{CLR18} and \cite[Lemma 4.2]{CS20}. Let $r_\theta:\mathbb R^2\to\mathbb R^2$ be a rotation matrix (counterclockwise through an angle $\theta\in[0,\pi)$) and for $x=(x_1,x_2,x_3,x_4)^T\in \mathbb R^4$ let $R_\theta,\rho:\mathbb R^4\to \mathbb R^4$ be given by \begin{align*} R_\theta x := \begin{pmatrix} r_\theta & 0 \\ 0 & r_\theta \end{pmatrix} x\quad \text{ and }\quad \rho x := (x_3,x_4,x_1,x_2)^T. \end{align*} Let $\Upsilon$ be the subgroup generated by $\{R_\theta,\rho\::\: \theta\in [0,2\pi)\}$ and let $\phi:\Upsilon\to{\mathbb Z}_2$ be the homomorphism given by $\phi(R_\theta):=1$ for any $\theta\in [0,2\pi)$ and $\phi(\rho)=-1$. For $N\geq 4$, let $n:=\lfloor \frac{N}{4} \rfloor\geq 1$, $\Lambda_j:=O(N-4)$ if $j=1,\ldots,n-1$, and $\Lambda_n:=\{1\}$. The $\Lambda_j$-orbit of a point $y\in \mathbb R^{N-4j}$ is an $(N-4j-1)$-dimensional sphere if $j=1,\ldots,n-1$, and it is a single point if $j=n$. Define \begin{align}\label{G:def} G_j:=(\Upsilon)^j\times \Lambda_j \end{align} acting on $\mathbb R^N=\mathbb R^{4j}\times \mathbb R^{N-4j}$ by $(\gamma_1,\ldots,\gamma_j,\eta)(x_1,\ldots,x_j,y):=(\gamma_1x_1,\ldots,\gamma_jx_j,\eta y),$ where $\gamma_i\in\Upsilon$, $\eta\in \Lambda_j$, $x_i\in \mathbb R^4$, and let \begin{align}\label{phi:def} \text{$\phi_j: G_j\to {\mathbb Z}_2$ be the homomorphism $\phi_j(\gamma_1,\ldots,\gamma_j,\eta):=\phi(\gamma_1)\cdots\phi(\gamma_j).$} \end{align} The $G_j$-orbit of $(z_1,\ldots,z_j,y)$ is the product of orbits $G_j(z_1,\ldots,z_j,y) = \Upsilon z_1 \times \cdots \times \Upsilon z_j \times \Lambda_j y.$ Note that $\phi_j$ is surjective and \textbf{($A_1$)}, \textbf{($A_2$)} are satisfied by $G_j$ and $\phi_j$ for each $j=1,\ldots,n$. Moreover, if $u$ is $\phi_i$-equivariant, $v$ is $\phi_j$-equivariant with $i<j$, and $u(x)=v(x) \neq 0$ for some $x=(z_1,\ldots,z_j,y) \in \mathbb R^N$, then, as $u(z_1,\ldots,\varrho z_j,y) = u(z_1,\ldots,z_j,y)$ and $v(z_1,\ldots,\varrho z_j,y) = -v(z_1,\ldots,z_j,y),$ we have that $u(z_1,\ldots,\varrho z_j,y) \neq v(z_1,\ldots,\varrho z_j,y)$. As a consequence, $u\neq v$, and Theorems \ref{main:thm:bdd} and \ref{main:thm:unbdd} yield the existence of at least $\lfloor \frac{N}{4} \rfloor$ nonradial sign-changing solutions, where $\lfloor x \rfloor$ denotes the greatest integer less than or equal to $x$. \medskip We refer to~\cite[Remark 4.3]{CS20} for an example of a $\phi_j$-equivariant function and for an explanation on why a similar construction is impossible for $N=1,2,3.$ \section{Uniform bounds and asymptotic estimates}\label{sec:bk} Let $\Omega\subset\mathbb R^N$ be a smooth bounded domain. \begin{lem} \label{A:l} Let $s>0$, $\delta\in(0,s)$, $s_k\in (s-\frac{\delta}{2},s+\frac{\delta}{2})$, and let $u_k\in D_0^{s_k}(\Omega)$ for $k\in\N$. There is $C>0$ depending only on $s,$ $\Omega$, and $\delta$ such that $\norme{u_k}_{s-\delta}\leq C \norme{u_k}_{s_k}$ for all $k\in\N.$ \end{lem} \begin{proof} We argue as in~\cite[Lemma 5.1]{JSW20}. By \eqref{eq:equiv_fourier}, \eqref{def:norm_s}, \begin{align*} \|u_{k}\|^2_{s-\delta}&={\mathcal E}_{s-\delta}(u_{k},u_{k})=\int_{\mathbb R^N}|\xi|^{2(s-\delta)}|\widehat{u}_{k}|^2\,\textnormal{d}{\xi}\leq \varepsilon^{2(s-\delta)}\norme{u_{k}}^2_{L^2(\mathbb R^N)}+\int_{|\xi|\geq \varepsilon}|\xi|^{2(s-\delta)}|\widehat{u}_{k}|^2\,\textnormal{d}{\xi} \end{align*} for any $\varepsilon\in(0,1]$, where $\widehat{u}_{k}$ is the Fourier transform of $u_{k}$. Then, using that $s_k<s+\frac{\delta}{2}$, \begin{align} \|u_{k}\|^2_{s-\delta}&\leq \varepsilon^{2(s-\delta)}\norme{u_{k}}^2_{L^2(\mathbb R^N)}+\epsilon^{2(s-\delta-s_k)}\int_{\mathbb R^N}|\xi|^{2s_k}|\widehat{u}_{k}|^2\,\textnormal{d}{\xi} \leq \epsilon^{2(s-\delta)}\norme{u_{k}}^2_{L^2(\mathbb R^N)}+\varepsilon^{-\delta}\norme{u_{k}}_{s_k}^2.\label{eq:est_usk:l} \end{align} Since $s_k>s-\frac{\delta}{2}$ we have, by Theorem~\ref{thm:rellich_type}, that $u_k\in D_0^{s-\delta}(\Omega)$ and, by the fractional Poincar\'e inequality (see e.g.~\cite[Proposition 3.3]{AJS18_loss}) and \eqref{eq:norm_equiv_h0s}, there exists $C_0>0$ only depending on $s$, $\delta$, and $\Omega$ such that $|u_{k}|^2_2\leq C_0 \|u_{k}\|^2_{s-\delta}$. Fix $\varepsilon=\min\{1,(\tfrac{1}{2C_0})^{\frac{1}{2(s-\delta)}}\}$, then, by \eqref{eq:est_usk:l}, $\norme{u_{k}}_{s-\delta}^2\leq C \norme{u_{k}}_{s_k}^2$, where $C=2\varepsilon^{-\delta}$ depends only on $s,$ $\Omega$, and $\delta$. \end{proof} \begin{lem}\label{aship:lem} Let $(s_k)_{k\in\N}\subset (0,\infty)$ be such that $s_k\to s=m+\sigma$ as $k\to \infty$ with $m\in\N_0$ and $\sigma\in(0,1]$. Let $w_k\in D^{s_k}(\mathbb R^N)$ be such that \begin{align}\label{bd} \|w_k\|_{s_k}<C\qquad \text{ for all $k\in\N$ and for some $C>0$}, \end{align} then, up to a subsequence, there is $w\in D^{s}(\mathbb R^N)$ such that \begin{align}\label{aship} \eta w_k\to \eta w\qquad \text{ in $D^{s-\delta}(\mathbb R^N)$ as $k\to\infty$ for all $\eta\in C^\infty_c(\mathbb R^N)$ and all $\delta\in(0,s]$.} \end{align} In particular, for $p\in[1,2^\star_s)$, \begin{align}\label{app} w_k \to w\ \textnormal{in } L^p_{loc}(\mathbb R^N),\quad w_k \to w\ \textnormal{a.e. in } \mathbb R^N, \quad w_k \to w\ \textnormal{in } H^m_{loc}(\mathbb R^N). \end{align} \end{lem} \begin{proof} Let $C$, $\delta$, $w_k$ be as in the statement, $\eta\in C^\infty_c(\mathbb R^N)$, and $K:=\operatorname{supp}\eta$. In the following $M>0$ denotes possibly different constants depending at most on $C$, $N$, $s$, $\delta$, and $\eta$. Then, by Lemmas~\ref{A:l} and \ref{lem:prod_co}, up to a subsequence, $\|\eta w_k\|_{s-\frac{\delta}{2}} \leq M\|\eta w_k\|_{s_k}\leq M$ for all $k\in\N$. By Theorem~\ref{thm:rellich_type}, up to a subsequence, $\eta w_k \to \eta w$ in $D^{s-\delta}(\mathbb R^N)$ as $k\to\infty$ and \eqref{aship} follows. Moreover, by \eqref{eq:equiv_fourier} and Fatou's Lemma, \begin{equation}\label{fatou} \|w\|^2_{s}= \int_{\mathbb R^N}|\xi|^{2s}|\widehat w(\xi)|^2\,\textnormal{d}{\xi} \leq \liminf_{k\to \infty} \int_{\mathbb R^N}|\xi|^{2{s_k}}|\widehat w_{k}(\xi)|^2\,\textnormal{d}{\xi} =\liminf_{k\to\infty}\|w_{k}\|_{{s_k}}^2 < C, \end{equation} and therefore $w\in D^s(\mathbb R^N)$. The convergence \eqref{app} follows from Theorem~\ref{thm:rellich_type}. \end{proof} \begin{lem}\label{lem:sigma} For every $k\in\N$ let $\sigma_k\in(0,1)$ and $w_k\in D^{\sigma_k}(\mathbb R^N)$ be such that $\lim_{k\to\infty}\sigma_k=:\sigma\in[0,1]$, $\|w_k\|_{\sigma_k}<C$ for all $k\in\N$ and for some $C>0$, and \begin{align}\label{l2loc} w_k\to 0\qquad \text{ in $L^2_{loc}(\mathbb R^N)$ as $k\to\infty$}. \end{align} Then, up to a subsequence, \begin{align*} \|w_k\eta\|^2_{\sigma_k}\leq {\mathcal E}_{\sigma_k}(w_k,\eta^2w_k)+o(1)\quad \text{ as }k\to\infty \text{ for all }\eta\in C^\infty_c(\mathbb R^N). \end{align*} \end{lem} \begin{proof} Let $\eta\in C^\infty_c(\mathbb R^N)$, then \begin{align}\label{part0} \|\eta w_k\|_{\sigma_k}^2-{\mathcal E}_{\sigma_k}(w_k,\eta^2w_k) =\frac{c_{N,{\sigma_k}}}{2}\int_{\mathbb R^N}\int_{\mathbb R^N}\frac{w_k(x)w_k(y)|\eta(x)-\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\ \,\textnormal{d}{x}\,\textnormal{d}{y}. \end{align} Let $K$ be the support of $\eta$ and let $U:=\{x\in\mathbb R^N:\operatorname{dist}(x,K)\leq 1\}$. In the following $C>0$ denotes possibly different constants depending at most on $N$ and $\eta$. By Fubini's theorem, Cauchy-Schwarz inequality, and \eqref{l2loc}, \begin{align} &c_{N,{\sigma_k}}\left|\int_{\mathbb R^N\setminus U}\int_{\mathbb R^N}\frac{w_k(x)w_k(y)|\eta(x)-\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{y}\,\textnormal{d}{x}\right|\leq c_{N,{\sigma_k}}\int_{K}|w_k(y)|\int_{\mathbb R^N\setminus U}\frac{|w_k(x)||\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{x}\,\textnormal{d}{y}\notag\\ &\qquad\leq c_{N,{\sigma_k}}\left(\int_{K}|w_k|^2\right)^\frac{1}{2} \left(\int_{K}\left(\int_{\mathbb R^N\setminus U}|w_k(x)|\frac{|\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{x}\right)^2\,\textnormal{d}{y}\right)^\frac{1}{2}=o(1)\quad \text{ as }k\to\infty,\label{part1} \end{align} where we used that $c_{N,{\sigma_k}}$ is uniformly bounded by \eqref{cnsigma} and that, by H\"older's inequality, Theorem \ref{thm:sobolev}, and the bound $\|w_k\|_{\sigma_k}<C$, \begin{align*} &\int_{K}\left(\int_{\mathbb R^N\setminus U}|w_k(x)|\frac{|\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{x}\right)^2\,\textnormal{d}{y}\leq C |w_k|_{2^\star_{\sigma_k}}^2 \int_{K}\left(\int_{\mathbb R^N\setminus U}|x-y|^{-2N}\,\textnormal{d}{x}\right)^\frac{N+2{\sigma_k}}{N}\,\textnormal{d}{y}<C. \end{align*} On the other hand, by Fubini's theorem, \begin{align} &\int_{U}w_k(x)\int_{\mathbb R^N}w_k(y)\frac{|\eta(x)-\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{y}\,\textnormal{d}{x} =\int_{\mathbb R^N}w_k(y)\int_{U}w_k(x)\frac{|\eta(x)-\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{x}\,\textnormal{d}{y}\notag\\ &=\int_{\mathbb R^N\backslash U}w_k(y)\int_{K}w_k(x)\frac{|\eta(x)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{x}\,\textnormal{d}{y} +\int_{U}w_k(y)\int_{U}w_k(x)\frac{|\eta(x)-\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{x}\,\textnormal{d}{y}.\label{part12} \end{align} The first summand is $o(1)$ as in \eqref{part1}. For the second summand, by the mean value theorem, \begin{align*} I&:= c_{N,{\sigma_k}}\int_{U}\int_{U}\frac{w_k(y)w_k(x)|\eta(x)-\eta(y)|^2}{|x-y|^{N+2{\sigma_k}}}\,\textnormal{d}{x}\,\textnormal{d}{y}\leq Cc_{N,{\sigma_k}}\int_{U\times U}\frac{w_k(y)w_k(x)}{|x-y|^{N-2(1-{\sigma_k})}}\,\textnormal{d}{(x,y)}. \end{align*} Using the Hardy-Littlewood-Sobolev inequality (see~\cite[Theorem 4.3]{ll01} with $\varepsilon=2(1-{\sigma_k})$, $\lambda=N-\varepsilon$, $p=r=\frac{2}{\frac{\varepsilon}{N}+1}<2$), \eqref{cnsigma}, and the boundedness of $U$, \begin{align} I&\leq Cc_{N,{\sigma_k}}\left( \pi^{\frac{N-2(1-{\sigma_k})}{2}}\frac{\Gamma(\frac{N}{2}-\frac{N-2(1-{\sigma_k})}{2})}{\Gamma(N-\frac{N-2(1-{\sigma_k})}{2})} \left(\frac{\Gamma(\frac{N}{2})}{\Gamma(N)} \right)^{\frac{N-2(1-{\sigma_k})}{N}-1} \right) \left( \int_{U} |w_k|^p \right)^{1/p}\notag\\ &\leq C\sigma_k(1-\sigma_k) \Gamma(1-{\sigma_k}) \left( \int_{U} |w_k|^p \right)^{1/p}\leq C\left(\int_{U}|w_k|^2\right)^{1/2}=o(1)\qquad \text{ as }k\to\infty.\label{part2} \end{align} The claim now follows from \eqref{part0}, \eqref{part1}, \eqref{part12}, and \eqref{part2}. \end{proof} To estimate all lower-order terms, we use the following. \begin{lem}\label{lem:alpha} Let $(\sigma_k)_{k\in\N}\subset (0,1)$, $m\in\N$, and $\sigma\in[0,1]$ such that $s_k:=m+\sigma_k\to s:=m+\sigma>0$ as $k\to \infty$. For $k\in\N$, let $w_k\in D^{s_k}(\mathbb R^N)$ be such that \eqref{bd} holds and \begin{align}\label{aship2} w_k\to 0\qquad \text{ pointwisely in $\mathbb R^N$ as $k\to\infty$.} \end{align} Let $\alpha\in \N^N_0$ be a multi-index such that $|\alpha|<m$, then, up to a subsequence, \begin{align*} \|\psi\partial^\alpha w_k \|_{\sigma_k} = o(1)\quad \text{ as }k\to\infty \text{ for all $\psi\in C^\infty_c(\mathbb R^N)$}. \end{align*} \end{lem} \begin{proof} Let $\psi\in C^\infty_c(\mathbb R^N)$, $K=\operatorname{supp}(\psi)$, and let $C>0$ denote possibly different constants depending at most on $N$, $m$, $\sigma,$ and $\psi$. By \eqref{aship2} and Lemma~\ref{aship:lem}, \begin{align}\label{c} \|w_k\|_{H^m(K)}\to 0\quad \text{ as }k\to\infty, \end{align} where $\|\cdot\|_{H^m(K)}$ denotes the usual norm in the Sobolev space $H^m(K)$. The claim now follows from the interpolation inequality (see for example~\cite[Theorem 1]{bm18} using $s_2=1,$ $s_1=0$, $p_1=p_2=p=2$, $s=\sigma_k$, $\theta=1-\sigma_k$) because \begin{align*} \|\psi\partial^\alpha w_k \|_{\sigma_k}\leq |\psi\partial^\alpha w_k |^{1-\sigma_k}_{2} \|\psi\partial^\alpha w_k \|^{\sigma_k}_{H^1(K)}=o(1)\quad \text{as $k\to\infty$}, \end{align*} since, by \eqref{c}, $|\psi\partial^\alpha w_k |^2_{2}\leq C \int_K |\partial^\alpha w_k |^2=o(1)$ as $k\to\infty$ and \begin{align*} \|\psi\partial^\alpha w_k \|^2_{H^1(K)}&= \int_K |\nabla(\partial^\alpha w_k \psi)|^2 \leq C\int_K |\nabla\partial^\alpha w_k|^2+|\partial^\alpha w_k|^2\leq C \|w_k\|_{H^m(K)}+o(1)=o(1)\ \text{as $k\to\infty$.}\qedhere \end{align*} \end{proof} \begin{lem}\label{lem:bk} For $k\in\N$, let $(s_k)_{k\in\N}\subset(0,\infty)$ bounded and $w_k\in D^{s_k}(\mathbb R^N)$ be such that \eqref{bd} and \eqref{aship2} hold. Then, for any $\varepsilon\in(0,1)$, up to a subsequence, \begin{align*} \|w_k\varphi\|^2_{s_k}\leq (1+\varepsilon){\mathcal E}_{s_k}(w_k,\varphi^2w_k)+o(1)\quad \text{ as }k\to\infty\text{ for all }\varphi\in C^\infty_c(\mathbb R^N). \end{align*} \end{lem} \begin{proof} Since $(s_k)_{k\in\N}$ is bounded, passing to a subsequence, there is $m\in\N_0$ and $(\sigma_k)_{k\in\N}\subset [0,1]$ such that $\lim_{k\to\infty}\sigma_k=:\sigma\in[0,1]$ and $s_k=m+\sigma_k\to s=m+\sigma\geq 0$ as $k\to\infty$. Assume first that $s_k\in(m,m+1)$ and $m$ is even. Observe that $\Delta^\frac{m}{2} (w_k\varphi) = \varphi \Delta^\frac{m}{2} w_k + R_k,$ where $R_k$ is a sum of products with derivatives of $w_k$ of order smaller than $m$. Then, by Cauchy's inequality, for $\varepsilon>0$ arbitrarily small there is $C(\varepsilon)>0$ such that \begin{align*} |\Delta^\frac{m}{2} (w_k\varphi)(x)-\Delta^\frac{m}{2} (w_k\varphi)(y) |^2 &=|\varphi(x) \Delta^\frac{m}{2} w_k(x) -\varphi(y) \Delta^\frac{m}{2} w_k(y) + R(x) -R(y)|^2\\ &\leq (1+\varepsilon)|\varphi(x) \Delta^\frac{m}{2}w_k(x) -\varphi(y) \Delta^\frac{m}{2} w_k(y)|^{2} + C(\varepsilon)|R(x) -R(y)|^{2} \end{align*} and therefore, by Lemma~\ref{lem:alpha}, \begin{align} \|w_k\varphi\|_{s_k}^2= \|\Delta^\frac{m}{2} (w_k\varphi)\|_{\sigma_k}^2 &\leq (1+\varepsilon)\|\varphi\Delta^\frac{m}{2}w_k\|_{\sigma_k}^2 +C(\varepsilon)\|R\|_{\sigma_k}^2 = (1+\varepsilon)\|\varphi\Delta^\frac{m}{2}w_k\|_{\sigma_k}^2 +o(1)\label{s1} \end{align} as $k\to \infty.$ Moreover, by Lemma~\ref{lem:sigma}, \begin{align} \|\varphi\Delta^\frac{m}{2}w_k\|_{\sigma_k}\leq {\mathcal E}_{\sigma_k}(\Delta^\frac{m}{2}w_k,\varphi^2\Delta^\frac{m}{2}w_k)+o(1)\quad \text{ as }k\to\infty.\label{s2} \end{align} Observe that $(-\Delta)^\frac{m}{2}(\varphi^2 w_k)=\varphi^2(-\Delta)^\frac{m}{2}w_k + \widetilde R,$ where $\widetilde R$ has derivatives of $w_k$ with order lower than $m$. Then \begin{align*} {\mathcal E}_{\sigma_k}(\Delta^\frac{m}{2}w_k,\varphi^2\Delta^\frac{m}{2}w_k)= {\mathcal E}_{\sigma_k}(\Delta^\frac{m}{2}w_k,\Delta^\frac{m}{2}(\varphi^2w_k)) -{\mathcal E}_{\sigma_k}(\Delta^\frac{m}{2}w_k,\widetilde R). \end{align*} By \eqref{bd}, Cauchy-Schwarz inequality, and Lemma~\ref{lem:alpha}, we have that $|{\mathcal E}_{\sigma_k}(\Delta^\frac{m}{2}w_k,\widetilde R)|\leq \|w_k\|_{s_k}\|\widetilde R\|_{\sigma_k}=o(1)$ as $k\to\infty,$ and therefore \begin{align}\label{s3} {\mathcal E}_{\sigma_k}(\Delta^\frac{m}{2}w_k,\varphi^2\Delta^\frac{m}{2}w_k)= {\mathcal E}_{\sigma_k}(\Delta^\frac{m}{2}w_k,\Delta^\frac{m}{2}(\varphi^2w_k)) +o(1)\quad \text{ as }k\to\infty. \end{align} But then, by \eqref{s1}, \eqref{s2}, \eqref{s3}, \begin{align*} \|w_k\varphi\|_{s_k}^2\leq (1+\varepsilon){\mathcal E}_{\sigma_k}(\Delta^\frac{m}{2}w_k,\Delta^\frac{m}{2}(\varphi^2w_k)) +o(1)\quad \text{ as }k\to\infty, \end{align*} as claimed. The case $s_k\in(m,m+1)$ with $m$ odd is analogous using the corresponding norms and scalar products, see \eqref{bilin:def}. On the other hand, if $s_k=m$ for all $k\in\N$ with $m$ even, then, by Lemma~\ref{aship:lem}, \begin{align*} \|w_k\varphi\|^2_{s_k} &=\int_{\mathbb R^N}|(-\Delta)^{\frac{m}{2}}(w_k\varphi)|^2 =\int_{\mathbb R^N}\varphi^2|(-\Delta)^{\frac{m}{2}}w_k|^2+o(1)\\ &=\int_{\mathbb R^N}(-\Delta)^{\frac{m}{2}}w_k (-\Delta)^{\frac{m}{2}}(\varphi^2w_k)+o(1)\quad \text{ as }k\to\infty. \end{align*} The case $s_k=m$ for all $k\in\N$ with $m$ odd is analogous. This ends the proof. \end{proof} \begin{lem}\label{arg:lem} Let $m\in\N_0$, $(\sigma_k)_{k\in\N}\subset [0,1]$, $\lim_{k\to\infty}\sigma_k=:\sigma\in[0,1]$, $s_k:=m+\sigma_k$, $s:=m+\sigma>0$, $N>2\max\{s,s_k\}$ for all $k\in\N$. Let $\Omega\subset\mathbb R^N$ be a smooth bounded $G-$invariant domain and $u_k\in D_0^{s_k}(\Omega)^\phi$ be such that \begin{align} &C^{-1}<|u_{k}|_{\dsa{s_k}}<C\qquad \text{ for all }k\in\N \text{ and for some }C>1,\label{lb:l}\\ &\|J'_{s_k}(u_{k})\|_{(D^{s_k}(\mathbb R^N))'}=o(1)\quad \text{ as }k\to\infty \label{addhip},\\ &u_k\to 0\qquad \text{ in $D_0^{s-\delta}(\Omega)$ as $k\to\infty$ for some $\delta\in(0,\sigma)$.}\label{eq:strong_conv_u_s_k:l} \end{align} Then there are sequences $(\lambda_k)_{k\in\N}\subset(0,\infty)$, $(\xi_k)_{k\in\N}\subset(\mathbb R^N)^G$, and a constant $C_1>0$ such that $\lambda_k\to 0$, $\xi_k\to \xi\in (\mathbb R^N)^G$, \begin{equation}\label{eq:dis_xik_Omega:2:l} \textnormal{dist}(\xi_k,\Omega)\leq C_1\lambda_k, \end{equation} and the rescaling \begin{align}\label{wkdef:l} w_k(y):=\lambda_k^{\frac{N}{2}-s} u_k(\lambda_k y+\xi_k),\qquad y\in \mathbb R^N, \end{align} satisfies that, up to a subsequence, \begin{align*} \eta w_k\to \eta w\qquad \text{ in $D^{s-\delta}(\mathbb R^N)$ as $k\to\infty$ for all $\eta\in C^\infty_c(\mathbb R^N)$, $\delta\in(0,s),$} \end{align*} and for some $w\in D^s(\mathbb R^N)^\phi\backslash\{0\}$. \end{lem} \begin{proof} Let $C>1$ as in \eqref{lb:l}, $\kappa_{N,s}$ as in \eqref{eq:best_constant}, and let $\tau>0$ be such that \begin{align}\label{tau:l} \tau<\min\{(3\kappa_{N,s_k}^2)^{-\frac{N}{2s_k}},C^{-1}\}\qquad \text{ for all }k\in\N. \end{align} By \eqref{lb:l}, there are $(\lambda_k)_{k\in\N}\subset(0,\infty)$ and $(x_k)_{k\in\N}\subset\mathbb R^N$ such that, passing to a subsequence, \begin{equation}\label{eq:delta_iden_0:2:l} \sup_{x\in \mathbb R^N}\int_{B_{\lambda_k}(x)}|u_{k}|^{\dsa{s_k}}=\int_{B_{\lambda_k}(x_k)}|u_{k}|^{\dsa{s_k}}=\tau. \end{equation} For the chosen sequences $(\lambda_k)_{k\in\N}$ and $(x_k)_{k\in\N}$, let $C_0>0$ and $(\xi_k)_{k\in\N}$ be given by Lemma~\ref{lem:prop_G_seq}. Then, $|g_kx_k-\xi_k|\leq C_0\lambda_k$ for some $g_k\in G$ and, since $|u_{k}|$ is $G$-invariant, we have that \begin{equation}\label{eq:delta_iden:2:l} \tau=\int_{B_{\lambda_k}(g_kx_k)}|u_{k}|^{\dsa{s_k}}\leq \int_{B_{C_1\lambda_k}(\xi_k)}|u_{k}|^{\dsa{s_k}}, \end{equation} where $C_1:=C_0+1$ and, in particular, \eqref{eq:dis_xik_Omega:2:l} holds. We claim that $(\xi_k)_{k\in\N}\subset(\mathbb R^N)^G$. Otherwise, by \Cref{lem:prop_G_seq}, we have, for each $m\in\mathbb{N}$, $m$ different elements $g_1,\ldots,g_m\in G$ such that $B_{C_1\lambda_k}(g_i\xi_k)\cap B_{C_1\lambda_k}(g_j\xi_k)=\emptyset$ for $k$ large enough. Therefore, from~\eqref{eq:delta_iden:2:l}, \begin{equation*} m\tau \leq \sum_{i=1}^{m}\int_{{B_{C_1\lambda_k}(g_i\xi_k)}}|u_{k}|^{\dsa{s_k}}\leq \int_{\Omega}|u_k|^{\dsa{s_k}}<C\quad \text{for every $m\in\mathbb{N}$, } \end{equation*} which yields a contradiction to \eqref{lb:l}. Thus, $(\xi_k)_{k\in\N}\subset(\mathbb R^N)^G$. Let $w_k$ be given by \eqref{wkdef:l}. Since $u_{k}$ is $\phi$-equivariant and $\xi_k$ is a $G$-fixed point, we have that $w_k$ is $\phi$-equivariant. Observe that, by \eqref{eq:delta_iden_0:2:l}, \eqref{eq:delta_iden:2:l}, and a change of variables, \begin{equation}\label{eq:delta_wk:2:l} \tau=\sup_{z\in\mathbb R^N}\int_{B_1(z)}|w_k|^{\dsa{s_k}}\leq \int_{B_{C_1}(0)}|w_k|^{\dsa{s_k}}. \end{equation} Similarly, by \eqref{lb:l} and \eqref{addhip}, $(w_k)_{k\in\N}$ is uniformly bounded in $D^{s_k}(\mathbb R^N)$. By Lemma~\ref{aship:lem}, there is $w\in D^{s}(\mathbb R^N)^\phi$ such that, passing to a subsequence, \begin{align* \eta w_k \to \eta w & \textnormal{ in }D^{s-\varepsilon}(\mathbb R^N)^\phi\text{ as }k\to\infty \text{ for all }\eta\in C^\infty_c(\mathbb R^N)\text{ and }\varepsilon\in(0,s). \end{align*} Now, we prove by contradiction that $w\neq 0$. Assume that $w=0$. Given $\varphi\in C_c^\infty(\mathbb R^N)$, we set \begin{equation*} \vartheta(x):=\frac{1}{\mu(G)}\int_{G}\varphi^2(gx)\,\textnormal{d}{\mu} \quad\text{and}\quad \vartheta_k(x)=\vartheta\left(\frac{x-\xi_k}{\lambda_k}\right). \end{equation*} Using that $w_k$ is $\phi$-equivariant and according to definition~\eqref{eq:def_phi}, a direct computation yields $(\varphi^2 w_k)_\phi=\vartheta w_k$, whence $\vartheta_ku_k$ is $\phi$-equivariant and $\|\vartheta_k u_k\|_{s_k}$ is uniformly bounded. From here, using \Cref{lem:deriv_func_equiv} and \eqref{addhip}, \begin{equation}\label{eq:asymp_func_claim:l} J_{s_k}^\prime(w_k)(\varphi^2 w_k)=J_{s_k}^\prime(w_k)\vartheta w_k=J_{s_k}^\prime(u_k)(\vartheta_k u_k)=o(1)\quad \text{as $k\to\infty$.} \end{equation} By Lemma~\ref{lem:bk}, $\|w_k\varphi\|^2_{s_k}\leq \frac{3}{2}{\mathcal E}_{s_k}(w_k,\varphi^2w_k)+o(1)$ as $k\to\infty.$ Let $\varphi\in C^\infty_c(B_1(z))$ with $z\in\mathbb R^N$. Then, by H\"older's inequality and \eqref{eq:asymp_func_claim:l}, \begin{align*} \norme{w_k\varphi}_{s_k}^2 \leq \frac{3}{2}\int_{B_1(z)}|w_k|^{\dsa{s_k}-2}|w_k\varphi|^2+o(1) &\leq \frac{3}{2}\left(\int_{B_1(z)}|w_k|^{\dsa{s_k}}\right)^{\frac{\dsa{s_k}-2}{\dsa{s_k}}}\left(\int_{\mathbb R^N}|\varphi w_k|^{\dsa{s_k}}\right)^{\frac{2}{\dsa{s_k}}}+o(1)\\ &\leq \frac{3}{2}\tau^{\frac{2s_k}{N}} |\varphi w_k|^2_{\dsa{s_k}}+o(1). \end{align*} By \Cref{thm:sobolev} and \eqref{tau:l}, \begin{align} \label{eq:bound_norm:l} \norme{\varphi w_k}_{s_k}^2 \leq \frac{3}{2}\tau^{\frac{2s_k}{N}}\kappa_{N,s}^2 \norme{\varphi w_k}^2_{s_k}+o(1) \leq \frac{1}{2}\norme{\varphi w_k}^2_{s_k}+o(1)\quad \text{as $k\to\infty$. } \end{align} By \eqref{eq:bound_norm:l}, we have that $\|\varphi w_k\|_{s_k}=o(1)$ and therefore (by Theorem~\ref{thm:sobolev}) $|\varphi w_k|_{\dsa{s_k}}=o(1)$ as $k\to\infty$ for any $\varphi\in C_c^\infty(B_1(z))$, which contradicts~\eqref{eq:delta_wk:2:l}. Therefore, \begin{align}\label{w_claim} w\neq 0\quad \text{ in }\mathbb R^N. \end{align} Then, passing to a subsequence, $\xi_k\to \xi\in (\mathbb R^N)^G$ as $k\to\infty$ and, by \eqref{eq:strong_conv_u_s_k:l}, \eqref{wkdef:l}, and \eqref{w_claim}, we conclude that $\lambda_k\to 0$ as $k\to\infty$. \end{proof} \section{A concentration result}\label{sec:c} In this section, we show a concentration result following the strategy from \cite[Theorem 2.5]{CLR18} and \cite[Theorem~3.5]{CS20} (see also~\cite[Theorem 8.13]{Will96}). Recall that $A^G$ denotes the set of $G$-fixed points of $A\subset\mathbb R^N$. \begin{theo}\label{thm:concentration} Assume that $G$ and $\phi$ satisfy $(A_1)$ and $(A_2)$. Let $s>0$, $N\geq 1$, $N>2s$, $\Omega$ be a $G$-invariant bounded smooth domain in $\mathbb R^N$, and let $u_k\in D_0^s(\Omega)^\phi$ be such that \begin{equation}\label{eq:hyp_main_teo} J_s(u_k)\to c_s^\phi(\Omega)\quad\text{ and }\quad J_s^\prime(u_k)\to 0 \quad{\textnormal{in }} (D_0^s(\Omega)^\phi)^\prime\quad \text{ as }k\to\infty. \end{equation} Then, up to a subsequence, one of the following two possibilities occurs \begin{enumerate} \item[\textnormal{(I)}] $(u_k)_{k\in\N}$ converges strongly in $D_0^s(\Omega)$ to a minimizer of $J_s$ on $\mathcal N_s^\phi(\Omega)$, or \item[\textnormal{(II)}] there exist a sequences $(\xi_k)_{k\in\N}\subset(\mathbb R^N)^G$, $(\lambda_k)_{k\in\N}\subset(0,\infty)$, and a nontrivial solution $w$ to \begin{equation}\label{eq:main_teo} (-\Delta)^s w=|w|^{2_s^\star-2}w, \quad w\in D_0^s({\mathbb{E}})^\phi \end{equation} with the following properties: \begin{enumerate} \item[\textnormal{(i)}] $\lambda_k\to 0$, $\xi_k\to \xi$, $\xi\in (\ov{\Omega})^G$, and $\lambda_k^{-1}\operatorname{dist}(\xi_k,\Omega)\to d\in[0,\infty]$. \item[\textnormal{(ii)}] If $d=\infty$, then ${\mathbb{E}}=\mathbb R^N$ and $\xi_k\in\Omega$. \item[\textnormal{(iii)}] If $d\in[0,\infty)$, then $\xi\in \partial\Omega$ and ${\mathbb{E}}=\{x\in\mathbb R^N:x\cdot \nu>\ov{d}\}$, where $\nu$ is the inward-pointing unit normal to $\partial \Omega$ at $\xi$ and $\ov{d}\in\{d,-d\}$. Moreover, ${\mathbb{E}}$ is $G$-invariant, ${\mathbb{E}}^G\neq 0$, and $\Omega^G\neq 0$. \item[\textnormal{(iv)}] $w\in \cN_s^\phi({\mathbb{E}})$ and $J_s(w)=c_s^\phi(\mathbb R^N)$. \item[\textnormal{(v)}] $\lim\limits_{k\to \infty}\norme{u_k-\lambda_k^{-\frac{N}{2}+s}w\left(\frac{\cdot-\xi_k}{\lambda_k}\right)}_s=0$. \end{enumerate} \end{enumerate} \end{theo} \begin{proof} Since $J_s^\prime(u_k)u_k=\|u_k\|_s^2-|u_k|^{2_s^\star}_{2_s^\star}$, we have, by \eqref{eq:hyp_main_teo}, that \begin{align} \frac{s}{N}\|u_k\|_s^2=J_s(u_k)-\frac{1}{2_s^\star}J_s^\prime(u_k)u_k \leq C+o(1)\|u_k\|_s. \label{eq:equiv_Juk} \end{align} Therefore, $(u_k)_{k\in\N}$ is bounded in $D_0^s(\Omega)^\phi$ and, up to a subsequence, there exists $u\in D_0^s(\Omega)^\phi$ such that \begin{equation}\label{weak} u_k \rightharpoonup u \quad\text{weakly in } D_0^s(\Omega)^\phi \text{ as }k\to\infty. \end{equation} By \Cref{thm:rellich_type}, up to a subsequence, $u_k\to u$ strongly in $L^\nu(\Omega)$ for any $\nu\in[2,2_s^\star)$. Then, \begin{equation*} \lim_{k\to\infty}\int_{\Omega}{|u_k|}^{2_s^\star-2}u_k\varphi=\int_{\Omega}|u|^{2_s^\star-2}u\varphi \quad \text{ for all } \varphi\in C_c^\infty{(\Omega)}^\phi. \end{equation*} Hence, for any $\varphi\in C_c^\infty(\Omega)^\phi$, \begin{align} J_s^\prime(u)\varphi&={\mathcal E}_s(u,\varphi)-\int_{\Omega}|u(x)|^{2_s^\star-2}u(x)\varphi(x)\,\textnormal{d}{x} \notag\\ &= \lim_{k\to\infty}\left[{\mathcal E}_s(u_k,\varphi) - \int_{\Omega}|u_k(x)|^{2_s^\star-2}u_k(x)\varphi(x)\,\textnormal{d}{x} \right]=\lim_{k\to\infty} J_s^\prime(u_k)\varphi=0.\label{eq:lim_func} \end{align} We now consider two cases: \medskip \noindent(I) If $u\neq 0$ then $u\in \mathcal N_s^\phi(\Omega)$ and, by \eqref{eq:hyp_main_teo} and~\eqref{eq:equiv_Juk}, \begin{align*} c_s^\phi(\Omega)&\leq J_s(u)=\frac{1}{2}\|u\|_s^2-\frac{1}{2_s^\star}|u|^{2_s^\star}_{2_s^\star}=\frac{s}{N}\norme{u}_s^2\leq \liminf_{k\to \infty} \frac{s}{N} \norme{u_k}_s^2=c_s^\phi(\Omega)+o(1), \end{align*} This with \eqref{weak} implies that $u_k\to u$ strongly in $D_0^s(\Omega)^\phi$ and then $J_s(u)=c_s^\phi(\Omega)$. \medskip \noindent (II) If $u=0$, then \eqref{eq:hyp_main_teo} and \eqref{eq:equiv_Juk} imply that \begin{equation*} \int_{\Omega}|u_k(x)|^{2_s^\star}\,\textnormal{d}x=\frac{N}{s}\left(J_s(u_k)-\frac{1}{2}J_s^\prime(u_k)u_k\right)\to \frac{N}{s}c_s^\phi(\Omega)\quad \text{ as }k\to\infty. \end{equation*} Note that $u_k$ satisfies the assumptions of Lemma~\ref{arg:lem} (with $s_k=s$ for all $k\in\N$). Let $\lambda_k\to 0$, $\xi_k\to \xi$, $w_k$, and $w$ as given by Lemma~\ref{arg:lem} and define $d:=\lim_{k\to\infty} \lambda_k^{-1}\operatorname{dist}(\xi_k, \partial \Omega)\in [0,\infty],$ $\Omega_k:=\{y\in\mathbb R^N\::\: \lambda_k y + \xi_k\in\Omega\}$. If $d=\infty$, then, by~\eqref{eq:dis_xik_Omega:2:l}, we have that $\xi_k\in \Omega$. Hence, for every $X\subset\subset \mathbb R^N$, there exists $k_0$ such that $X\subset \Omega_k$ for all $k\geq k_0$. Thus, for $d=\infty$ we set ${\mathbb{E}}:=\mathbb R^N$. Otherwise, if $d\in[0,\infty)$, then, as $\lambda_k\to 0$, we have that $\xi\in\partial \Omega$. If a subsequence of $(\xi_k)$ is contained in $\ov{\Omega}$, we set $\ov{d}:=-d$, otherwise we take $\ov{d}:=d$. We define $\mathbb H:=\left\{y\in \mathbb R^N:y\cdot\nu>\ov{d}\right\},$ where $\nu$ is the inward-pointing unit normal to $\partial \Omega$ at $\xi$. Since $\xi$ is a $G$-fixed point so is $\nu$. Thus $\Omega^G\neq \emptyset$, $\mathbb H$ is $G$-invariant and $\mathbb{H}^G\neq \emptyset$. If $X$ is compact and $X\subset \mathbb H$, there exists $k_0$ such that $X\subset \Omega_k$ for all $k\geq k_0$. Moreover, if $X$ is compact and $X\subset \mathbb R^N\setminus \ov{\mathbb H}$, then $X\subset\mathbb R^N\setminus \Omega_k$ for $k$ large enough. As $w_k\to w$ a.e. in $\mathbb R^N$, this implies that $w=0$ a.e. in $\mathbb R^N\setminus\mathbb{H}$. So $w\in D_0^s(\mathbb H)^\phi$. Then, for $d<\infty$, we set ${\mathbb{E}}:= \mathbb H$. For $\varphi\in C_c^\infty({\mathbb{E}})^\phi$, we define $\varphi_k(x):=\lambda_k^{-\frac{N}{2}+s}\varphi\left(\frac{x-\xi_k}{\lambda_k}\right)$. Since $\xi_k$ is a $G$-fixed point, then $\varphi_k$ is $\phi$-equivariant and there is $k_0$ large enough such that $\operatorname{supp }\varphi_k\subset\Omega$. By \eqref{issues}, $\varphi_k$ is uniformly bounded in $D_0^s(\Omega)$; hence,~\eqref{eq:lim_func}, Lemmas~\ref{lem:deriv_func_equiv} and~\ref{arg:lem}, and a direct computation yield $J_s^\prime(w_k)\varphi=J_s^\prime(u_k)\varphi_k=o(1)$ as $k\to\infty.$ Therefore $w$ is a nontrivial weak solution of~\eqref{eq:main_teo}. From Lemma~\ref{lem:c_infinity}, we conclude that $c_s^\phi(\Omega)=c_s^\phi({\mathbb{E}})=c^\phi_s(\mathbb R^N)$. Hence, \begin{equation*} c_s^\phi(\mathbb R^N)\leq J_s(w)=\frac{s}{N}\|w\|_s^2 \leq \liminf_{k\to \infty} \frac{s}{N} \|w_k\|_s^2=\frac{s}{N}\liminf_{k\to\infty}\|u_k\|_s^2=c_s^\phi(\mathbb R^N). \end{equation*} Thus, $J_s(w)=c_{\infty}^\phi$ and $w_k\to w$ strongly in $D^s(\mathbb R^N)$ as $k\to\infty$. By a change of variable, this implies that \begin{equation*} o(1)=\norme{w_k-w}_s=\norme{u_k-\lambda_k^{-\frac{N}{2}+s}w\left(\frac{\cdot-\xi_k}{\lambda_k}\right)}_s\quad \text{as $k\to\infty$}. \end{equation*} This ends the proof. \end{proof} \section{Existence, nonexistence, and convergence of solutions in symmetric bounded domains}\label{sec:bdd} We begin this section with the proof of the nonexistence result stated in the introduction. \begin{proof}[Proof of Proposition \ref{prop:nonex}] By contradiction, let $u$ be a nontrivial nonnegative solution of \eqref{nonex:eq}. Let \begin{align*} {\mathscr{D}}^s u(z):=\lim_ {\substack{x\to z \\x\in B, \frac{x}{|x|}=z}} \frac{u(x)}{(1-|x|^2)^s} =\frac{1}{2^s}\lim_ {\substack{x\to z \\x\in B, \frac{x}{|x|}=z}} \frac{u(x)}{(1-|x|)^s} =\frac{1}{2^s}\lim_ {\substack{x\to z \\x\in B, \frac{x}{|x|}=z}} \frac{u(x)}{\operatorname{dist}(x,\mathbb R^N\backslash B)^s}. \end{align*} By \cite[Corollary 1.9 and Lemma 2.1]{AJS18_poisson}, we have that \begin{align*} {\mathscr{D}}^s u(z)=\frac{\Gamma(\frac{N}{2})}{4^{s}\pi^{\frac{N}{2}}\Gamma(s)^2s}\int_B \frac{(1-|y|^2)^s}{|y-z|^N}u(y)^{2_s^\star-1}\,\textnormal{d}{y}>0\quad \text{ for }z\in \partial B. \end{align*} However, by the Pohozaev identity \cite[Corollary 1.7]{rs15}, $\int_{\partial B}|{\mathscr{D}}^s u(z)|^2\ d\sigma=0.$ This yields a contradiction, and therefore \eqref{nonex:eq} has no nontrivial nonnegative solutions. \end{proof} For bounded domains without fixed points, we have the following existence result. \begin{prop}\label{cor:nonfixed} Assume that $G$ and $\phi$ verify assumptions \textnormal{\textbf{($A_1$)}} and \textnormal{\textbf{($A_2$)}}. Let $\Omega$ be a $G$-invariant bounded smooth domain in $\mathbb R^N$ such that $\overline{\Omega}^G=\emptyset$ and let $s>0$. Then, the problem \begin{equation}\label{eq:cor-crit} \begin{cases} (-\Delta)^su=|u|^{2_s^\star-2}u, \\ u\in D_0^s(\Omega)^\phi, \end{cases} \end{equation} has a least-energy solution. The solution is sign-changing if $\phi:G\to \mathbb Z_2$ is surjective. \end{prop} \begin{proof} By a), c) of Lemma~\ref{lem:min_max} and \cite[Thm. 2.9]{Will96} there is a sequence $(u_k)$ such that~\eqref{eq:hyp_main_teo} holds. Then, by \Cref{thm:concentration}, since alternative (II) cannot hold due to the lack of fixed points in $\overline{\Omega}$, we conclude that $J_s$ attains a minimum $u\in\mathcal N_s^\phi(\Omega)$. Then there is a Lagrange multiplier $\lambda\in \mathbb R$ such that \begin{align}\label{lm} J_s'(u)\varphi = \lambda\left(2{\mathcal E}_s(u,\varphi)-2^\star_s\int_\Omega |u|^{2^\star_s-2}u\varphi \right) \qquad \text{ for all }\varphi\in D^s_0(\Omega)^\phi. \end{align} Testing with $\varphi=u$, we obtain that $0=(1-2\lambda)\|u\|_s^2+(2^\star_s\lambda-1)|u|^{2^\star_s}_{2^\star_s} =(1-2\lambda+2^\star_s\lambda-1)|u|^{2^\star_s}_{2^\star_s} =(2^\star_s-2)\lambda|u|^{2^\star_s}_{2^\star_s}.$ Since $u\neq 0$, this implies that $\lambda=0$. Then \eqref{lm} and Lemma \ref{lem:deriv_func_equiv} imply that $u$ is a weak solution of \eqref{eq:cor-crit}. \end{proof} Next, we show some convergence properties of the solutions to~\eqref{eq:cor-crit}. We begin with an auxiliary lemma. \begin{lem}\label{lem:bds} Let $G$ and $\phi$ verify \textnormal{\textbf{($A_1$)}}, \textnormal{\textbf{($A_2$)}} and let $\Omega$ be a $G$-invariant bounded smooth domain in $\mathbb R^N$ such that $\overline{\Omega}^G=\emptyset$. Let $s>0$, $N>2s,$ and $0<\delta< \min\{s,\frac{N}{2}-s\}$. For each $t\in(s-\delta,s+\delta)$, let $u_t$ be a least-energy solution to~\eqref{eq:cor-crit} given by Proposition~\ref{cor:nonfixed}. Then there is a constant $C>1$ depending only on $\delta,$ $\Omega$, and $s$ such that \begin{align}\label{ut} C^{-1}<\|u_{t}\|_{t}<C\qquad \text{ for all }t\in(s-\delta,s+\delta). \end{align} \end{lem} \begin{proof} Let $N$, $s$, $\delta,$ $t$, and $u_t$ be as in the statement and let $\varphi\in C^\infty_c(\Omega)\backslash\{0\}$. Then \begin{align*} k_t \varphi\in\cN_t,\qquad k_t:=\left(\frac{\|\varphi\|_t^2}{|\varphi|_{2^\star_t}^{2^\star_t}}\right)^\frac{1}{2^\star_t-2}. \end{align*} Then, since $\dsa{t}-2>0$ for all $t\in[s-\delta,s+\delta]$, \begin{align*} c^\phi_t(\Omega)\leq J_t(k_t\varphi)\leq \sup_{t\in(s-\delta,s+\delta)}J_t(k_t\varphi)=:C_1, \end{align*} where $C_1>0$ depends only on $\varphi$, $s$, $\delta$, and $\Omega$. Moreover, since $u_t\in\cN_t^\phi$ is a least-energy solution, \begin{align*} \|u_{t}\|^2_{t} =\frac{N}{t}c^\phi_t(\Omega) \leq \frac{N}{s-\delta}C_1=:C_2. \end{align*} This establishes the upper bound in \eqref{ut}. To obtain the lower bound, let \begin{equation*} F_t(u):=\norme{u}^2_t-|u|_{\dsa{t}}^{\dsa{t}}\geq \norme{u}_t^2-\kappa^{\dsa{t}}_{N,t}\norme{u}_t^{\dsa{t}}\quad \text{ for }u\in D_0^t(\Omega), \end{equation*} where $\kappa_{N,t}$ is explicitly given by \eqref{eq:best_constant}. In particular, by the definition of $\delta$, $N>2t$ and therefore \begin{align*} \sup_{t\in(s-\delta,s+\delta)}\kappa_{N,t} =\sup_{t\in(s-\delta,s+\delta)}2^{-2t}\pi^{-t}\frac{\Gamma(\frac{N-2t}{2})}{\Gamma(\frac{N+2t}{2})} \left(\frac{\Gamma(N)}{\Gamma(N/2)}\right)^{2t/N}=:K, \end{align*} where $K$ depends only on $N,s,$ and $\delta$. Then, for $\|u\|_t<1$, \begin{equation* F_t(u)\geq \norme{u}_t^2\left(1-K^{\dsa{t}}\norme{u}_t^{\dsa{t}-2}\right)\geq\norme{u}_t^2\left(1-(K+1)^{\dsa{s+\delta}} \norme{u}_t^{\frac{4(s-\delta)}{N-2(s-\delta)}}\right). \end{equation*} In particular, $F_t(u)>0$ for all $t\in(s-\delta,s+\delta)$ if \begin{align*} 0<\|u\|_t < (K+1)^{-\frac{N (2 \delta +N-2 s)}{2 (s-\delta ) (N-2 (\delta +s))}}=:a. \end{align*} Since $F_t(u_t)=0$ because $u_t\in \cN_t$, necessarily $\|u_t\|_t>a$ for $t\in (s-\delta,s+\delta).$ This yields the lower bound in \eqref{ut}. \end{proof} Our main convergence result is the following. \begin{theo}\label{thm:conv:bdd} Let $G$ and $\phi$ verify \textnormal{\textbf{($A_1$)}}, \textnormal{\textbf{($A_2$)}}, $\Omega$ be a $G$-invariant bounded smooth domain in $\mathbb R^N$ such that $\overline{\Omega}^G=\emptyset$, $m\in\mathbb N_0$, $(\sigma_k)_{k\in\N}\subset[0,1]$, $\lim_{k\to\infty}\sigma_k=:\sigma\in[0,1]$, $s_k:=m+\sigma_k>0$, $s:=m+\sigma>0$, and $N>2\max\{s,s_k\}$ for all $k\in\N$. Let $u_{s_k}$ be a least-energy solution of \begin{equation*} (-\Delta)^{s_k} u_{s_k}=|u_{s_k}|^{2^\star_{s_k}-2}u_{s_k}, \qquad u_{s_k}\in D_0^{s_k}(\Omega)^\phi. \end{equation*} Then, up to a subsequence, \begin{equation*} u_{s_k}\to u \quad \textnormal{strongly in $D_0^{s-\delta}(\Omega)$ as $k\to\infty$ for all $\delta\in(0,s)$,} \end{equation*} where $u$ is a least-energy solution of \begin{equation}\label{eq:crit_limit} (-\Delta)^{s} u=|u|^{2^\star_{s}-2}u, \qquad u\in D_0^s(\Omega)^\phi. \end{equation} \end{theo} \begin{proof} Let $s$, $s_k,$ $u_{s_k}$ be as in the assumptions and let $0<\delta<\min\{s,\frac{N}{2}-s,\frac{(N-2s)^2}{2(N+2s)}\}$. In the following, $C>1$ denotes possibly different constants depending at most on $s$, $\delta$, $N$, and $\Omega$. Passing to a subsequence, we may assume that $s_k\in(s-\delta,s+\delta)$ for all $k\in\N$. By Lemma~\ref{lem:bds}, \begin{align* C^{-1}<\|u_{s_k}\|^2_{s_k}=|u_{s_k}|^{\dsa{s_k}}_{\dsa{s_k}}<C\qquad \text{ for all }k\in\N. \end{align*} By Lemma~\ref{A:l}, $\norme{u_{s_k}}_{s-\frac{\delta}{2}}^2\leq C \norme{u_{s_k}}_{s_k}^2<C$. Then, by Theorem~\ref{thm:rellich_type}, there is {$u\in D_0^{s-\delta}(\Omega)$} such that \begin{align} u_{s_k}\to u \ \text{in $D^{s-\delta}_0(\Omega)$,}\qquad u_{s_k}\to u \ \text{in $L^p(\Omega)$ for $p\in[2,2^\star_{s-\delta})$}\qquad \text{as $k\to\infty$.}\label{eq:strong_conv_u_s_k} \end{align} Note that, since $\delta<\frac{(N-2s)^2}{2(N+2s)}$, then \begin{align}\label{twos} \dsa{s}-1<\dsa{s-\delta}. \end{align} Moreover, using Fatou's Lemma as in \eqref{fatou}, we have that $\|u\|^2_{s}\leq \liminf_{k\to\infty}\|u_{s_k}\|_{{s_k}}^2 < C,$ and therefore $u\in D_0^s(\Omega)$. Since $u_{s_k}$ is a least-energy solution, we have from integration by parts (see e.g.~\cite[Lemma 1.5]{AJS18}) that \begin{align*} 0=J_{s_k}^\prime(u_{s_k})\varphi&={\mathcal E}_{s_k}(u_{s_k},\varphi)-\int_{\Omega}|{s_k}|^{2^\star_{s_k}-2}u_{s_k}\varphi=\int_{\Omega}u_{s_k}(-\Delta)^{s_k}\varphi-\int_{\Omega}|u_{s_k}|^{2^\star_{s_k}-2}u_{s_k}\varphi. \end{align*} Note that, by \eqref{twos}, $2^\star_{s_k}-1=2^\star_s-1+o(1)<2^\star_{s-\delta}-\varepsilon+o(1)<2^\star_{s-\delta}$ as $k\to\infty$ with $\varepsilon=\frac{1}{2}(2^\star_{s-\delta}-2^\star_s+1)>0$; then, by \eqref{eq:strong_conv_u_s_k}, and Lemma \ref{phi:con}, \begin{align* 0 = \int_{\Omega} u(-\Delta)^{s}\varphi-\int_{\Omega}|u|^{2^\star_s-2}u\varphi \qquad \text{ for all }\varphi\in C^\infty_c(\Omega), \end{align*} that is, $u$ is a weak solution of the limit problem \eqref{eq:crit_limit}. Note that \begin{align}\label{claimu} u\neq 0 \quad \text{ in }\Omega. \end{align} Indeed, assume by contradiction that $u=0$. Then $u_{s_k}$ satisfies the assumptions of Lemma~\ref{arg:lem}. Let $\lambda_k\to 0$ and $\xi_k\to\xi$ be given by Lemma~\ref{arg:lem} and define $d:=\lim_{k\to\infty} \lambda_k^{-1}\operatorname{dist}(\xi_k, \partial \Omega)\in [0,\infty].$ If $d=\infty$, then, by~\eqref{eq:dis_xik_Omega:2:l}, $\xi_k\in \Omega$. But this cannot happen since $\overline{\Omega}^G=\emptyset$ and $\xi_k\in (\mathbb R^N)^G$. On the other hand, if $d\in[0,\infty)$, then, as $\lambda_k\to 0$, we have that $\xi\in\partial \Omega$, which also cannot happen, because $\overline{\Omega}^G=\emptyset$. We have reached a contradiction and \eqref{claimu} follows. Next, we show that $u$ is a least-energy solution, namely, that $J_{s}(u)=c_s^{\phi}(\Omega).$ By Lemma~\ref{lem:bds}, there is $C>0$ such that $C^{-1}<c_{s_k}^\phi<C$ for all $k\in\N.$ In particular, passing to a subsequence, there is $c_*$ such that $c_{s_k}^\phi\to c_*$ as $k\to\infty$. Then, using Fatou's Lemma as in \eqref{fatou}, \begin{align} c_s^\phi &\leq J_s(u) =\left(\frac{1}{2}-\frac{1}{2_s^\star}\right)\|u\|_s^2 \leq \liminf_{k\to\infty}\left(\frac{1}{2}-\frac{1}{2_{s_k}^\star}\right)\|u_{s_k}\|_{s_k}^2\notag\\ &=\liminf_{k\to\infty}J_{s_k}(u_{s_k}) =\liminf_{k\to\infty}c_{s_k}^{\phi} =c_*.\label{3} \end{align} On the other hand, by Proposition \ref{cor:nonfixed}, there is $u_s\in \cN_s$ such that $J_s(u_s)=c_s^\phi$. Then \begin{equation}\label{1} t_k:=\left(\frac{\|u_s\|_{s_k}^2}{|u_s|_{2^\star_{s_k}}^{2^\star_{s_k}}}\right)^{\frac{1}{2^\star_{s_k}-2}}= 1 + o(1)\quad \text{ as }k\to\infty \end{equation} and \begin{equation}\label{2} \|u_s\|_{s_k}=\|u_s\|_s+o(1), \quad |u_s|_{\dsa{s_k}}=|u_s|_{\dsa{s}}+o(1)\quad \text{ as }k\to\infty. \end{equation} But then, using the minimality of $u_{s_k}$, \eqref{1}, and \eqref{2}, \begin{align*} c_*^\phi+o(1)&=c_{s_k}^\phi=J_{s_k}(u_{s_k})\leq J_{s_k}(t_{k}u_s)=J_s(u_s)+o(1)=c_s^{\phi}+o(1),\qquad \text{as $k\to\infty$.} \end{align*} Therefore $c_*^\phi\leq c_s^{\phi}$ and, with \eqref{3}, we conclude that $c_*^\phi=c_s^{\phi}$ and that $J_s(u)=c_s^\phi$. \end{proof} \begin{proof}[Proof of Theorem~\ref{main:thm:bdd}] The first part (existence) follows from Proposition~\ref{cor:nonfixed} and the second part (convergence) follows from Theorem~\ref{thm:conv:bdd}. \end{proof} \section{Existence and convergence of entire solutions}\label{sec:ubd} Recall the definition of ${\cal N}_s^\phi$ given in \eqref{N:set} and of $J_s$ given in \eqref{eq:func_RN}. We begin with an existence theorem. \begin{theo}\label{thm:existence_teo} Let $N\in\N$, $s>0,$ $N>2s$, $G$ be a closed subgroup of $O(N)$, and $\phi:G\to \mathbb{Z}_2$ be a continuous homomorphism satisfying {\bf ($A_1$)} and {\bf ($A_2$)}. Then, $J_s$ attains its minimum on $\mathcal N_s^\phi(\mathbb R^N)$. Consequently, the problem \begin{equation}\label{eq6} (-\Delta)^su=|u|^{2_s^\star-2}u, \qquad u\in D^s(\mathbb R^N)^\phi, \end{equation} has a nontrivial $\phi$-equivariant solution. The solution is sign-changing if $\phi$ is surjective. \end{theo} \begin{proof} The unitary ball $B=\{x\in\mathbb R^N:|x|<1\}$ is $G$-invariant for every subgroup $G$ of $O(N)$. Since $0\in B^{G}$ then $c_s^\phi(B)=c_s^\phi(\mathbb R^N)$, by \Cref{lem:c_infinity}. By a) and c) of \Cref{lem:min_max} and~\cite[Thm. 2.9]{Will96}, we obtain the existence of a sequence $(u_k)_{k\in\N}\subset D_0^s(B)^\phi$ such that $J_s(u_k)\to c_s^\phi(\Omega)$ and $J_s^\prime(u_k)\to 0$ in $(D_0^s(B)^\phi)^\prime$ as $k\to\infty.$ Then, by \Cref{thm:concentration}, there exists $u\in \mathcal N_s^\phi(\mathbb E)\subset \mathcal N_s^\phi(\mathbb R^N)$ with $J_s(u)=c_s^\phi(\mathbb R^N)$, and therefore $J_s$ attains its minimum on $\mathcal N_s^\phi(\mathbb R)$. Arguing as in Proposition~\ref{cor:nonfixed}, we conclude that $u$ is a weak solution of \eqref{eq6}. \end{proof} Next we show some convergence properties of the solutions to~\eqref{eq:frac_crit_exp} as $s_k\to s$, where $s>0$. We begin with an auxiliary lemma. \begin{lem}\label{lem:unbd}Assume the hypothesis of Theorem \ref{thm:existence_teo}. Let $s>0$, $N>2s,$ and $0<\delta\leq \min\{s,\frac{N}{2}-s\}$. For each $t\in(s-\delta,s+\delta)$, let $u_t$ be a least-energy solution to~\eqref{eq6} given by Theorem~\ref{thm:existence_teo}. Then there is a constant $C>1$ depending only on $\delta$ and $s$ such that \begin{align*} C^{-1}<\|u_{t}\|_{t}<C\qquad \text{ for all }t\in(s-\delta,s+\delta). \end{align*} \end{lem} \begin{proof} Repeat the proof from Lemma \ref{lem:bds} with $\Omega=\mathbb R^N$. \end{proof} \begin{theo}\label{thm:conv:entire} Assume that $G$ and $\phi$ verify assumptions \textnormal{\textbf{($A_1$)}} and \textnormal{\textbf{($A_2$)}}. Let $N\in\N$, $(s_k)_{k\in\N}\subset (0,\infty)$ such that $s_k\to s=m+\sigma>0$ as $k\to \infty$ with $m\in\N_0$, $\sigma\in[0,1]$, and $N>2\max\{s,s_k\}$ for all $k\in\N$. For $\kappa_{N,s}$ as in \eqref{eq:best_constant} and $\tau>0$ such that \begin{align}\label{tau} \tau<\left(3\kappa_{N,s_k}^2\right)^{-\frac{N}{2s_k}}\qquad \text{ for all }k\in\N. \end{align} Let $w_{s_k}\in D^{s_k}(\mathbb R^N)^\phi$ be a least-energy solution of $(-\Delta)^{s_k} w_{s_k}=|w_{s_k}|^{2^\star_{s_k}-2}w_{s_k}$ satisfying that \begin{align}\label{rscl} \int_{B_1(0)} |w_{s_k}|^{2^\star_{s_k}}=\tau\qquad \text{ for all }k\in\N. \end{align} Then, there is a least-energy solution $w\in D^s(\mathbb R^N)^\phi$ of $(-\Delta)^{s} w=|w|^{2^\star_{s}-2}w$ such that, up to a subsequence, \begin{align}\label{c1} \text{$\eta w_{s_k}\to \eta w$ in $D^{s-\delta}(\mathbb R^N)$ as $k\to\infty$ for all $\eta\in C^\infty_c(\mathbb R^N)$ and $\delta\in(0,\sigma)$.} \end{align} \end{theo} \begin{proof} Let $s_k$ and $w_{s_k}$ as in the statement. In the following, $C>0$ denotes possibly different constants independent of $k$. By Lemma~\ref{lem:unbd}, there is $C>0$ such that \begin{align}\label{ab} C^{-1}<c_{s_k}^\phi(\mathbb R^N)<C\qquad \text{ for all }k\in\N. \end{align} We split the proof in steps. \medskip \emph{Step 1: Find a limit profile for $w_{s_k}$.} Let $\zeta\in C^\infty_c(\mathbb R)$ be such that \begin{align}\label{zeta} 0 \leq \zeta \leq 1\quad \text{ in }\mathbb R,\quad \zeta(r)=1\quad \text{ if }|r|\leq 1,\quad \zeta(r)=0\quad \text{ if }|r|\geq 2, \end{align} and let \begin{align}\label{zetan} w_{s_k}^n(x):=w_{s_k}(x)\zeta_n(x),\qquad \zeta_n(x):=\zeta \left( \frac{|x| }{n} \right)\qquad \text{ for }n\in\N\text{ and }x\in \mathbb R^N. \end{align} By Lemma \ref{GV} and triangle inequality, \begin{align}\label{wsknbd} \|w_{s_k}^n\|_{s_k}<C\quad \text{ for all } n,k\in\N. \end{align} By Lemma~\ref{aship:lem}, there is $w^n_s\in D^s(\mathbb R^N)^\phi$ such that, up to a subsequence, \begin{align}\label{wk} \varphi w^n_{s_k}\to \varphi w^n_s\quad \text{ in }D^{s-\delta}(\mathbb R^N)\text{ as }k\to\infty\text{ for all }n\in\N\text{ and }\varphi\in C^\infty_c(\mathbb R^N), \end{align} and, by a standard diagonalization argument, we may assume that $w^n_s = w^m_s$ in $B_n(0)$ for all $m>n,$ $m,n\in\N.$ Moreover, using Fatou's Lemma (as in \eqref{fatou}) and \eqref{wsknbd}, $\|w_s^n\|_{s}\leq \liminf\limits_{k\to\infty}\|w_{s_k}^n\|_{s_k}<C$ for all $n\in\N,$ and therefore there is $w\in D^s(\mathbb R^N)^\phi$ such that, up to a subsequence, \begin{align}\label{wk2} w^n_s \rightharpoonup w\quad \text{ weakly in }D^s(\mathbb R^N)\quad \text{ as }n\to\infty, \end{align} but then $w^n_s=w$ in $B_n(0)$ for all $n\in \N$ and, by Lemma \ref{aship:lem}, we deduce that \begin{align}\label{app2} w_{s_k}\to w\quad \text{ in }L^q_{loc}(\mathbb R^N)\quad \text{ as }k\to\infty\quad \text{ for }q\in[1,2^\star_s) \end{align} and \eqref{c1} follows from \eqref{wk} taking $n$ large enough. \medskip \emph{Step 2: Show that $w$ is a weak solution.} Let $\varphi\in C^\infty_c(\mathbb R^N)$ and $n\in\N$. Observe that, by \eqref{app2} and Lemma \ref{phi:con}, \begin{align} \lim_{k\to\infty}\int_{B_n(0)}w_{s_k}(-\Delta)^{s_k}\varphi =\int_{B_n(0)}w(-\Delta)^{s}\varphi =\int_{\mathbb R^N}w(-\Delta)^{s}\varphi \label{id1} \end{align} and, by Hölder's inequality, \eqref{wsknbd}, Lemma \ref{thm:sobolev}, and Lemma \ref{phi:con}, \begin{align} \lim_{k\to\infty}&\int_{\mathbb R^N\backslash B_n(0)}w_{s_k}(-\Delta)^{s_k}\varphi \leq \lim_{k\to\infty}|w_{s_k}|_{2^\star_{s_k}} \left(\int_{\mathbb R^N\backslash B_n(0)}|(-\Delta)^{s_k}\varphi|^{(2^\star_{s_k})'}\right)^\frac{1}{(2^\star_{s_k})'}\notag\\ &\leq C\lim_{k\to\infty}\left(\int_{\mathbb R^N\backslash B_n(0)}|(-\Delta)^{s_k}\varphi|^{{\frac{2N}{N+2s_k}}}\right)^{\frac{N+2s_k}{2N}}= C\left(\int_{\mathbb R^N\backslash B_n(0)}|(-\Delta)^{s}\varphi|^{{\frac{2N}{N+2s}}}\right)^{\frac{N+2s}{2N}}=0,\label{id2} \end{align} where $(-\Delta)^{s}\varphi\in L^\frac{2N}{N+2s}(\mathbb R^N)$ by Lemma \ref{phi:con2}. Then, \eqref{id1}, \eqref{id2}, and integration by parts (see \emph{e.g.} \cite[Lemma 1.5]{AJS18}) imply that, \begin{align*} \lim_{k\to\infty}{\mathcal E}_{s_k}(w_{s_k},\varphi) &=\lim_{n\to\infty}\lim_{k\to\infty}\int_{B_n(0)}w_{s_k}(-\Delta)^{s_k}\varphi+\int_{\mathbb R^N\backslash B_n(0)}w_{s_k}(-\Delta)^{s_k}\varphi=\int_{\mathbb R^N}w(-\Delta)^{s}\varphi ={\mathcal E}_s(w,\varphi). \end{align*} Therefore, by \eqref{app2}, \begin{align}\label{wwsol} 0=\lim_{k\to \infty}J_{s_k}^\prime(w_{s_k})\varphi ={\mathcal E}_s(w,\varphi)-\int_{\mathbb R^N}|w|^{\dsa{s}-2}w_{s}\varphi=J'_s(w)\varphi \end{align} and $w$ is a weak solution of the limit problem. \medskip \emph{Step 3: Verify that} \begin{align}\label{wne0} w\neq 0. \end{align} Assume, by contradiction, that $w=0$ and let $\varphi\in C^\infty_c(B_1(0))$; then, since $w_{s_k}$ is a weak solution and $\varphi^2 w_{s_k}\in D^{s_k}(\mathbb R^N)$ (by Lemma \ref{lem:prod_co}), \begin{equation}\label{eq:asymp_func:3} J_{s_k}^\prime(w_{s_k})(\varphi^2 w_{s_k})=0\quad \text{ for all }k\in\N. \end{equation} Then, by \eqref{wk} and Lemma~\ref{lem:bk}, \begin{align*} \|w_{s_k}\varphi\|^2_{s_k}\leq \frac{3}{2}{\mathcal E}_{s_k}(w_{s_k},\varphi^2 w_{s_k})+o(1)\quad \text{ as } k\to\infty. \end{align*} Therefore, by H\"older's inequality, \eqref{tau}, \eqref{rscl}, \eqref{eq:asymp_func:3}, and the fact that $\operatorname{supp}(\varphi)\subset B_1(0)$, \begin{align*} \norme{w_{s_k}\varphi}_{s_k}^2 &\leq \frac{3}{2}\int_{B_1(0)}|w_{s_k}|^{\dsa{s_k}-2}|w_{s_k}\varphi|^2+o(1)\\ &\leq \frac{3}{2}\left(\int_{B_1(0)}|w_{s_k}|^{\dsa{s_k}}\right)^{\frac{\dsa{s_k}-2}{\dsa{s_k}}}\left(\int_{\mathbb R^N}|\varphi w_{s_k}|^{\dsa{s_k}}\right)^{\frac{2}{\dsa{s_k}}}+o(1)\leq \frac{3}{2}\tau^{\frac{2s_k}{N}} |\varphi w_{s_k}|^2_{\dsa{s_k}}+o(1) \end{align*} as $k\to\infty$. Using \Cref{thm:sobolev} and \eqref{tau}, we have that \begin{align} \label{eq:bound_norm_claim} \norme{\varphi w_{s_k}}_{s_k}^2 \leq \frac{3}{2}\tau^{\frac{2s_k}{N}}\kappa_{N,s_k}^2 \norme{\varphi w_{s_k}}^2_{s_k}+o(1) \leq \frac{1}{2} \norme{\varphi w_{s_k}}^2_{s_k}+o(1). \end{align} Then, by~\eqref{eq:bound_norm_claim}, $\|\varphi w_{s_k}\|_{s_k}=o(1)$ and therefore, by Theorem \ref{thm:sobolev}, $|\varphi w_{s_k}|_{2^\star_{s_k}}=o(1)$ as $k\to\infty$ for any $\varphi\in C_c^\infty(B_1(z))$, which contradicts~\eqref{rscl}. Therefore \eqref{wne0} holds. \medskip \emph{Step 4: Show that $w$ is a $\phi$-equivariant least-energy solution.} Observe that, by \eqref{ab}, there is $c_*$ such that $c_{s_k}^\phi(\mathbb R^N)\to c_*$ as $k\to\infty$ up to a subsequence. Moreover, by \eqref{wwsol} and \eqref{wne0}, we have that $w\in\cN_s$. By \eqref{app2} we have that $|w_k|^{2^\star_{s_k}}\to |w|^{2^\star_{s}}$ pointwisely in $\mathbb R^N$ as $k\to\infty$; then, by Fatou's Lemma, \begin{align*} \left(\frac{1}{2}-\frac{1}{2_s^\star}\right)|w|^{2^\star_s}_{2^\star_s} \leq \liminf_{k\to\infty}\left(\frac{1}{2}-\frac{1}{2_{s_k}^\star}\right)|w_k|^{2^\star_{s_k}}_{2^\star_{s_k}} =\liminf_{k\to\infty}c_{s_k}^\phi\leq c_*, \end{align*} and then, by minimality, \begin{align} &c_s^\phi(\mathbb R^N) \leq J_s(w) =\left(\frac{1}{2}-\frac{1}{2_s^\star}\right)|w|_{2^\star_{s}}^{2^\star_{s}} \leq c_*.\label{3ubd} \end{align} On the other hand, by Theorem \ref{thm:existence_teo}, there is a $\phi$-equivariant least-energy solution $u_s\in \cN_s$ such that $J_s(u_s)=c_s^\phi(\mathbb R^N)$. By density, there is a sequence $(u_{s,n})_{n\in\N}\subset C^\infty_c(\mathbb R^N)$ such that $u_{s,n}\to u_s$ in $D^{s}(\mathbb R^N)$ as $n\to\infty$. Let \begin{equation}\label{1ubd} t_{k,n}:=\left(\frac{\|u_{s,n}\|_{s_k}^2}{|u_{s,n}|_{2^\star_{s_k}}^{2^\star_{s_k}}}\right)^{\frac{1}{2^\star_{s_k}-2}}. \end{equation} Then $\lim\limits_{n\to \infty}\lim\limits_{k\to\infty}t_{k,n}=1$. Moreover, \begin{equation}\label{2ubd} \lim_{n\to \infty}\lim_{k\to\infty}\| u_{s,n}\|_{s_k}=\| u_{s}\|_s, \quad \lim_{n\to \infty}\lim_{k\to\infty}|u_{s,n}|_{2^\star_{s_k}}=|u_s|_{2_s^\star}. \end{equation} In particular, \begin{align*} \lim_{n\to \infty}\lim_{k\to\infty} J_{s_k}(t_{k,n}u_{s,n}) = J_s(u_s)=c_s^\phi. \end{align*} But then, using the minimality of $w_{s_k}$, \eqref{1ubd}, and \eqref{2ubd}, \begin{align*} c_*^\phi+o(1)&=c_{s_k}^\phi=J_{s_k}(w_{s_k})\leq J_{s_k}(t_{k,n}u_{s,n})\qquad\text{ as }k\to\infty, \end{align*} and therefore $c_*^\phi\leq \lim\limits_{n\to \infty}\lim\limits_{k\to\infty} J_{s_k}(t_{k,n}u_{s,n}) = J_s(u_s)=c_s^\phi(\mathbb R^N)$. Together with \eqref{3ubd}, we conclude that $c_*^\phi(\mathbb R^N)=c_s^{\phi}(\mathbb R^N)$ and that $J_s(w)=c_s^\phi(\mathbb R^N)$. This establishes that $w$ is a $\phi$-equivariant least-energy solution of the limiting problem, and ends the proof. \end{proof} \begin{proof}[Proof of Theorem~\ref{main:thm:unbdd}] The first part (existence) follows from Theorem~\ref{thm:existence_teo} and the second part (convergence) follows from Theorem~\ref{thm:conv:entire}. Observe that, due to the scaling invariance \eqref{issues}, an arbitrary function $w\in D^{s_k}_0(\mathbb R^N)^\phi$ has a rescaling $\widetilde w\in D^{s_k}_0(\mathbb R^N)^\phi$ satisfying \eqref{rscl}. \end{proof}
\section{Introduction} Recently, layered transition metal dicalchogenides have sparked great interest by virtue of their exotic electronic properties, especially the possibility of realizing novel quantum states stemming from the topological non-trivial band structure as uncovered by density functional theory \cite{Soluyanov2015,Huang2016,Yan2017,Bahramy2018}. A generic coexistence of type I and type II 3-dimensional Dirac cones has been proposed to be at play in these materials \cite{Bahramy2018}. PdTe$_2$ is interesting in particular because of the appearance of superconductivity at $T_c \approx 1.6$ K \cite{Guggenheim1961,Leng2017}, as well as its classification as a type II Dirac semimetal. The latter is extracted from a combination of \textit{ab initio} electronic structure calculations and angle resolved photoemission spectroscopy \cite{Liu2015a,Fei2017,Noh2017,Bahramy2018,Clark2017}. A Dirac cone with a tilt parameter $k > 1$ breaking Lorentz invariance is the hallmark of a type II Dirac semimetal \cite{Soluyanov2015}. The Dirac point then forms the touching point of the electron and hole pockets, possibly resulting in a nearly flat band adjacent to the Fermi level. This prompts the question whether superconductivity is bolstered by the presence of the nearly flat band \cite{Rosenstein2018}. \\ The superconducting properties of PdTe$_2$ have been extensively investigated. Transport and magnetic measurements carried out on single crystals of PdTe$_2$ revealed the existence of bulk type I superconductivity, an uncommon feature for a binary compound \cite{Leng2017}. Dc magnetization data showed the appearance of the intermediate state, the hallmark of type I superconductivity in an applied magnetic field. This was further corroborated by the differential paramagnetic effect observed in ac magnetization measurements. A bulk critical field $B_c = 13.6$ mT was determined. A puzzling aspect is the detection of surface superconductivity with a critical field $B_c^{surf} = 34.9$ mT and a temperature dependence that does not follow the standard Saint James - de Gennes model \cite{Saint-James&deGennes1963}. This led the authors of Ref.~\onlinecite{Leng2017} to suggest surface superconductivity to have a topological nature. Moreover, an even higher critical field of 0.3 T was observed in resistance data. The theoretical possibility of type I superconductivity in PdTe$_2$ was analyzed within a microscopic pairing theory exploring the tilt parameter $k$ of the Dirac cone \cite{Shapiro2018}. The realization of type I superconductivity was established for $k = 2$.\\ Evidence for the weak-coupling Bardeen-Cooper-Schrieffer (BCS) nature of superconductivity in PdTe$_2$ was obtained through measurements of the specific heat \cite{Amit2018}, penetration depth \cite{Salis2018,Teknowijoyo2018}, scanning tunneling microscopy and spectroscopy (STM and STS) \cite{Clark2017,Das2018,Sirohi2019} and tunneling spectroscopy on side junctions \cite{Voerman2019}. Surprisingly, distinct and fairly large critical fields were observed in STM/STS measurements \cite{Das2018,Sirohi2019}, and their spatial distribution on the surface was attributed to a mixture of type I and type II superconductivity. This provided the motivation for further experimental work to unravel the nature of the superconducting phase. Additional evidence for type I superconductivity was inferred from the local electronic behavior necessary to properly analyze the magnetic penetration depth data \cite{Salis2018}. Evidence on the microscopic scale was obtained from transverse muon spin relaxation measurements in an applied magnetic field, that unambiguously demonstrated the presence of the intermediate state \cite{Leng2019}. Similarly, scanning squid magnetometry provided evidence for type I superconductivity on the macroscopic scale \cite{Garcia-Campos2020}. Finally it has been established that type I superconductivity is robust under pressure \cite{Leng2019p}.\\ Although the specific heat of PdTe$_2$ was reported before, the focus was on elucidating the symmetry of the gap structure \cite{Amit2018}. Heat capacity techniques can also be utilized to ascertain whether superconductors are type I or type II. Unlike type II superconductors, type I superconductors, when subjected to a magnetic field, will undergo a first order phase transition. This can be verified by measuring the heat capacity in a magnetic field, which involves the latent heat associated with the transition. In this case the latent heat appears as an extra contribution to the jump in the specific heat at $T_c$, such that the jump size exceeds the value in zero magnetic field. Furthermore, for type I superconducting samples that have a shape resulting in a nonzero demagnetization factor, the intermediate state emerges. The intermediate state contribution broadens the superconducting transition towards lower temperatures due to the gradual transformation of normal domains to superconducting domains. Hitherto, no thermodynamic evidence in favor of type I or type II superconductivity has been reported. This warrants a second specific heat study focusing on these aspects.\\ In this paper heat capacity measurements of PdTe$_2$ in zero and applied magnetic fields are reported. The data in field show the presence of latent heat associated with a first order transition and thus type I superconductivity. The temperature variation of the critical field, $B_c (T)$, follows the expected quadratic temperature variation up to 9.5 mT. The data at higher applied fields reveal the presence of a second, minority superconducting phase in the PdTe$_2$ crystal. \section{Experimental} PdTe$_2$ crystallizes in the trigonal CdI$_2$ structure (space group P$\bar{3}$m1) \cite{Thomassen1929}. The single crystal investigated in this study is taken from a batch grown with the modified Bridgman technique \cite{Lyons1976} as reported in Ref.~\onlinecite{Leng2017}. The proper 1:2 stoichiometry within the 0.5 \% experimental resolution was inferred from scanning electron microscopy (SEM) with energy dispersive X-ray (EDX) spectroscopy. Magnetization measurements showed a bulk $T_c$ of 1.64 K and $B_c = 13.6$ mT for a crystal cut from the same crystalline boule \cite{Leng2017}. The rectangular shaped single crystalline sample used in this study has sizes of $3\cdot3\cdot0.3$ mm$^3$ along the a, a$^*$ and c axes, respectively and a mass of 39.66(2)~mg. Heat capacity measurements were carried out in an Oxford Instruments Heliox $^3$He refrigerator down to 0.3~K by use of the dual slope thermal relaxation calorimetry technique \cite{Stewart1983}. In this technique the sample is kept at a stable temperature $T_1$. Heat is then applied to heat the sample from $T_1$ by $\Delta T / T $ to $T_2$, which is recorded. The data recorded represents the heating curve. Subsequently the heat is removed, and the sample cools back to a stable temperature $T_1$, which is recorded as well. This represents the cooling curve. The increase in temperature $\Delta T / T \approx 1.5$~$ \%$. Both the heating and cooling curves at each temperature point are used in the analysis. The curves together form one relaxation measurement. Each specific heat data point in this study presents the average of four relaxation measurements at the same temperature, totalling eight fitted curves. The sample was attached to the sample platform with Apiezon N grease with the c-axis parallel to the applied magnetic field. This configuration results in a demagnetizing factor N = 0.14 \cite{Chen2002}, sufficiently large to probe the intermediate state. All measurements in a magnetic field have been carried out with the sample first cooled down in field from the normal state to the base temperature. The data points are collected by step-wise heating to the desired temperature $T_1$. \section{Results} \begin{figure}[b!] \includegraphics[width = 8.6cm]{Figure_1.pdf} \caption{Reduced temperature ($T/T_c$) dependence of the electronic specific heat $C_{el}$ of PdTe$_2$ in zero field. Red dots and line: experimental data; green solid line: BCS temperature dependence according to M\"{u}hlschlegel with a small residual term $\gamma_{res} T$ added; black dashed line: extrapolation to zero of the linear electronic specific heat in the normal state. The jump in the specific heat quantified with the BCS relation $\Delta C / \gamma T_c$ is equal to 1.42. Inset: Specific heat at low temperatures compared with the low temperature BCS behavior with a small residual term $\gamma_{res} T$ (see text).}\label{fig:bcs} \end{figure} The as-measured total specific heat, consisting of the electronic and phononic contributions, is reported in the Supplementary Material file~\cite{supp}. At low temperatures, the specific heat of a simple metal in the normal state is given by $ C = \gamma T + \beta T^3 $, where $\gamma$ is the Sommerfeld coefficient and $\beta$ is the phononic coefficient. We have determined $\gamma$ and $\beta$ by the usual procedure~\cite{supp} and obtained values of 4.4 mJ/molK$^2$ and 0.70 mJ/molK$^4$, respectively. This $\gamma$ value compares reasonably well to the 6.0 mJ/molK$^2$ derived in previous work~\cite{Amit2018,Kubo2016}. The value $\beta$ = 0.70 mJ/molK$^4$ compares well to 0.66 mJ/molK$^4$ of the previous heat capacity study~\cite{Amit2018}. The Debye temperature $\Theta_D$ can be calculated using $\Theta_D = \bigg(\frac{S 12 \pi^4 R}{5\beta}\bigg)^{\frac{1}{3}}$, where $S$ is the number of atoms per formula unit and $R$ is the gas constant. We obtain $\Theta_D = 202$~K, which agrees well with the previously reported value of 207 K \cite{Kubo2016} and the calculated value of 211 K \cite{Amit2018}. After subtracting the phonon contribution the electronic specific heat, $C_{el}$, results. The overal temperature variation of the electronic specific heat is presented in figure \ref{fig:bcs} in reduced temperature ($T/T_c$) with $T_c$ = 1.54~K. Here $T_c$ is taken as the temperature where $C_{el}$ has its maximum value. \\ The jump at $T_c$ quantified with the BCS relation $\Delta C /\gamma T_c$, where $\Delta C$ is the jump in the specific heat, equals 1.42, which is close to the textbook value of 1.43, confirming the weak-coupling BCS nature of superconductivity in PdTe$_2$. The full range temperature dependence of a weak coupling BCS superconductor as tabulated by M\"{u}hlschlegel \cite{Muhlschlegel1959} is given by the green line in figure \ref{fig:bcs}. In order to better match the experimental data, a small residual linear term with $\gamma_{res} = 0.10$ mJ/molK$^2$ is added. This accounts for 2.2~$\%$ of the sample that apparently remains in the normal state. At low temperatures the superconducting specific heat is described by the relation $ C = C_n 3.5 T^{-1.5} e^{-1.76/T}$ (Ref.~\onlinecite{Muhlschlegel1959}), where $C_n$ is the specific heat of the electronic normal state at $T = T_c$. Here the BCS gap relation $\frac{\Delta}{k_B T_c} = 1.76$ is incorporated. The low temperature behavior is in full accordance with the weak coupling BCS relation as shown in the inset of figure \ref{fig:bcs}, further corroborating a conventional superconducting state in this PdTe$_2$ crystal.\\ Figure \ref{fig:ct} shows the temperature dependence of the electronic specific heat, $C_{el}(T)$, in zero field and magnetic fields ranging up to 18.5 mT. The same data plotted as $C_{el}/T$ \textit{versus} $T$ are presented in Figure S2 of the Supplemental Material file~\cite{supp}. An increase in the height of the transition peak for fields up to 4.5 mT compared to the peak at 0 mT is observed. This implies extra energy is necessary to complete the transformation into the normal phase in small fields. At higher fields, especially at 6.5 mT and 8.5 mT, a broadening of the transition temperature towards lower temperatures is visible. In the experimental configuration used, the crystal has a demagnetization factor of 0.14 causing the intermediate state to form. It is likely that the superconducting transition is considerably broadened at higher fields due to the intermediate state. The region in the $B - T$ phase diagram occupied by the intermediate phase is shown in figure \ref{fig:pd}. At even higher magnetic fields, up to 16.5~mT, the transition broadens further and is no longer observed above this field. Remarkably, for $B \geq 10.5 $ mT the step size $\Delta C$ abruptly reduces.\\ \begin{figure}[t] \includegraphics[width = 8.6cm]{Figure_2.pdf} \caption{Temperature dependence of the electronic specific heat $C_{el}$ of PdTe$_2$ in zero field and in magnetic fields up to 18.5 mT as indicated. An increase in the size of the specific heat jump at $T_c$ is observed in field. $T_c$'s are indicated by arrows.For $B \geq 10.5$ mT the jump size is strongly reduced. Inset: Zoom of the data in the low temperature range for 10.5 mT $\leq B \leq 18.5$ mT. }\label{fig:ct} \end{figure} In figure \ref{fig:pd} the $ B - T$ phase diagram is mapped out by tracing the onset temperatures of superconductivity in applied magnetic fields, indicated by the arrows in figure \ref{fig:ct}. In previous research \cite{Leng2017} the phase diagram for bulk superconductivity probed by different techniques was found to follow the textbook relation \begin{equation} B_c(T) = B_c(0) \big[1-(T/T_c)^2 \big], \label{eq:bc} \end{equation} where $B_c(0) = 13.6$ mT and $T_c = 1.64$ K. The new data are in good agreement with the previous result with $T_c = 1.60$ K (solid blue line in figure \ref{fig:pd}). For fields $B \geq 10.5$ mT, however, we observe a somewhat higher $T_c$ than expected, which presents the onset temperature of the transition with reduced specific heat step (see the inset in figure \ref{fig:ct}). We attribute the reduced $\Delta C$ to a second, minority superconducting phase (see Discussion). The Meissner-to-intermediate phase line is given by the thin blue line. Its position is calculated by assuming that a type I superconductor is in the intermediate state for $B_c ( 1 - N) < B_{app} < B_c$ where $B_{app}$ is the applied magnetic field and $N = 0.14$ is the demagnetization factor.\\ \begin{figure}[h] \includegraphics[width = 8.6cm]{Figure_3.pdf} \caption{The $B-T$ phase diagram of PdTe$_2$ obtained by plotting the onset superconducting transition temperature for different magnetic fields. Blue symbols: data points; thick solid blue line: $B_c(T) = B_c(0) \big[1-(T/T_c)^2 \big]$ with $B_c(0) = 13.6$ mT and $T_c = 1.60$ K; thin solid blue line: Meissner-to-intermediate phase (IMP) transition line $B_{IMP}(T) = B_c(T)(1-N)$ with $N = 0.14$; green symbols: $T_c$ of a second, minority phase; dashed green line: guide to the eye; red solid bar: temperature range of the intermediate state at 8.5 mT (see text).}\label{fig:pd} \end{figure} Figure \ref{fig:zfcfc} depicts the zero field cooled (ZFC) and field cooled (FC) specific heat data as a function of temperature at 4.5 mT and 8.5 mT. All measurements here have been carried out by cooling down to base temperature either in field or without field. At the base temperature the field is applied (ZFC) or kept constant (FC). Next the sample was heated to different temperatures while keeping the field constant. The measurements carried out at 4.5 mT are given in black and red symbols, respectively, and no difference between the FC and ZFC data is found. This shows the phase transformation is the same FC and ZFC at this particular field strength. In the case of 8.5 mT, however, an odd feature is observed in the ZFC data in the temperature range 0.75-0.87 K. The heating curve of the first thermal relaxation measurement results in a much larger specific heat (see the Supplemental Material file~\cite{supp}). This is shown by the blue symbols. All subsequent data points (cyan symbols), including those derived from the cooling curve of the first relaxation measurement, fall on top of the FC data set (green symbols). This effect is only observed in the temperature range of the intermediate phase. \begin{figure}[t] \includegraphics[width = 8.6cm]{Figure_4.pdf} \caption{Temperature dependence of the electronic specific heat $C_{el}$ of PdTe$_2$ measured FC and ZFC at $B$ = 4.5 and 8.5 mT. The square symbols depict FC data, whereas the round symbols depict ZFC data. No difference between FC data and ZFC data is observed at $B$ = 4.5 mT. In the ZFC data taken at 8.5 mT a large specific heat is observed, but only when derived from the heating part of the first relaxation curve (see text). No difference is observed with respect to FC data for subsequent measurements. The red bar depicts the temperature interval where the intermediate phase in 8.5 mT is expected according to figure \ref{fig:pd}.}\label{fig:zfcfc} \end{figure} \section{Discussion} The overall temperature variation of the superconducting contribution to the specific heat is in very good agreement with the tabulated M\"{u}hlschlegel values. At the same time the low temperature data $T/T_c < 0.3$ obey the exponential expression for BCS superconductivity with $\frac{\Delta}{k_B T_c} = 1.76$ \cite{Muhlschlegel1959}. The jump size $\Delta C /\gamma T_c$ = 1.42 is conform with the weak-coupling BCS expectation of 1.43. These results compare well to previous work where a weak- to moderately coupled superconducting state and a conventional isotropic gap are reported \cite{Amit2018,Salis2018,Teknowijoyo2018,Sirohi2019,Das2018,Voerman2019}. Compared to the previous specific heat study \cite{Amit2018}, the $\gamma$ value of 4.4 mJ/molK$^2$ is nearly 20~$\%$ lower. This is possibly related to a different carrier density $n$ considering the semimetallic properties of PdTe$_2$. Differences in carrier density are also inferred from penetration depth measurements. In a previous study using single crystals from the same batch, values for the penetration depth $\lambda(0)$ were obtained that ranged from 377 nm to 482 nm\cite{Salis2018}. There $\lambda(0)$ was directly related to $n$ in an extended London model used to analyze the data where the assumption $n_s = n$ was made, with $n_s$ the superfluid density. The difference in the value for $\Delta C/\gamma T_c$ between the previous heat capacity study (1.52\cite{Amit2018}) and this work (1.42) is understood as a difference in coupling strength. This is in line with the results of penetration depth studies \cite{Salis2018,Teknowijoyo2018} where similar differences in $\Delta/k_B T_c$, ranging from 1.77 to 1.83, were found. The $\gamma$ value can be related to the critical field \cite{Poole2007}: \begin{equation} \Delta C = \frac{4 B_c(0)^2}{\mu_0 T_c} = 1.43 \gamma T_c, \label{eq:ybc} \end{equation} where $\Delta C$ and $\gamma$ are per unit volume. With the values $\gamma = 4.46$ mJ/molK$^2$, $T_c = 1.62$ K, $\Delta C / \gamma T_c = 1.42$ and the molar volume $4.34 \cdot 10^{-5}$ m$^3$/mol, we calculate $B_c(0) = 10.9$ mT. This value is smaller than the measured value $B_c(0) = 13.6$ mT. Examining the previous specific heat study\cite{Amit2018}, where $\gamma = 6.01$ mJ/mol K, $T_c = 1.8$ K and $\Delta C/ \gamma T_c$ = 1.52 were reported, eq.~\ref{eq:ybc} gives $B_c(0) = 14.6$ mT, while $B_c(0) = 19.5$ mT is the measured value. Again a similar sizeable difference is observed. As such we suspect eq.~\ref{eq:ybc} does not hold precisely for PdTe$_2$.\\ The temperature dependence of the electronic specific heat $C_{el}$ in magnetic fields shown in figure \ref{fig:ct} is consistent with that of a first order phase transition. The latent heat appearing with a first order phase transition is visible as the increased peak height in the specific heat in small fields relative to zero field. Consequently, we conclude that the type I nature of PdTe$_2$ is successfully probed via the presence of latent heat near the superconducting transition in field. Further evidence for the existence of type I superconductivity can be obtained by probing the intermediate state. In this study the sample and field geometry results in a demagnetization factor $N = 0.14$. From figure \ref{fig:pd} it is clear that for $B \geq 6.5$ mT the intermediate state spans more than 0.1 K at fixed fields, a sufficiently large interval to probe the broadening of the transition towards lower temperatures. In the specific heat data in field the broadening towards lower temperatures is visible given the changes in the range 0.5 mT to 8.5 mT. Especially for $B \geq 6.5$ mT the broadening is very clear as the specific heat is raised considerably above the zero field value in a larger temperature range.\\ The $B_c(T)$ data points traced in figure \ref{fig:pd} closely follow the results probed by dc and ac magnetization measurements in previous work \cite{Leng2017} up to $B = 8.5$ mT. Here the phase line is the boundary for bulk superconductivity and is represented by eq. \ref{eq:bc} with $B_c(0)$ = 13.6 mT and $T_c$ = 1.60 K. However, above 8.5~mT, where $\Delta C$ is suddenly reduced, superconductivity is observed above the expected $B_c(T)$-curve. It is of importance to investigate whether this can be caused by the intermediate phase. The temperature dependence of the normal state volume fraction $F_N$ in the intermediate state in fixed fields for $B_c(1-N) < B_{app} < B_c$ is given by \begin{equation} F_n = \frac{1-t^2}{t_c^2 - 1} \frac{1-N}{N} + \frac{1}{N}, \label{eq:fn} \end{equation} where $t$ is the reduced temperature $T/T_c$, $t_c$ the reduced critical temperature $T_c(B_{app})/T_c(0)$ and $N = 0.14$ is the demagnetization factor \cite{Karl2019}. Eq. \ref{eq:fn} shows $F_n$ has a smooth temperature variation and cannot suddenly collapse. The reduced critical temperature $t_c$ in eq. \ref{eq:fn} can be rewritten using eq. \ref{eq:bc}: $t_c = \sqrt{1 - \frac{B_c(T)}{B_c(0)}}.$ From this, no sudden decrease in $F_n$ is possible as well. We therefore exclude the intermediate phase as a possible cause for the elevated $T_c$ and reduced specific heat step. A more likely explanation is that superconductivity survives in a small volume fraction ($\sim$ 10~\%) of the crystal with a slightly different PdTe$_{2+x}$ stoichiometry~\cite{Guggenheim1961}. We remark a similar additional phase line was obtained in a previous study \cite{Leng2017} by analyzing the screening signal in the ac-susceptibility for small driving fields. Since the screening signal persisted above $B_c$ it was attributed to superconductivity of the surface sheath with a critical field $B_c^{s} \approx 35$ mT. \\ In the heating curves of the first relaxation measurements of the ZFC data detailed in figure \ref{fig:zfcfc} an increase of the specific heat at 8.5 mT appears, whereas no such increase was found at 4.5 mT. Given the temperature range in which it appears, 0.75-0.87 K, it can be attributed to the intermediate phase. We remark this range is a little lower than the expected range 0.83-0.98 K (red bar) calculated from the phase diagram in figure \ref{fig:pd}. The spatial arrangement and size of the normal and superconducting domains will depend on the field and temperature history because of pinning effects. This may cause hysteretic behavior. Such a history dependence was also reported by probing the intermediate phase in PdTe$_2$ by scanning squid magnetometry \cite{Garcia-Campos2020}. The absence of irreversibility in the relaxation curves at 4.5 mT shows the phenomenon is much weaker at this field. Moreover, the increase in specific heat in the first measurement point is more difficult to observe at 4.5 mT due to the smaller temperature range in which the intermediate phase is present. A closer examination of the irreversibility in ZFC calorimetry should be possible with ac calorimetry, as long as the change in the specific heat does not exceed the amplitude of the ac heat pulse. \section{Conclusion} The temperature dependence of the specific heat of PdTe$_2$ in zero field and magnetic fields was measured in order to produce thermodynamic evidence of the type I nature of superconductivity. From the zero field data a weak-coupling BCS superconducting state is inferred conform with the literature. The data in small magnetic fields show the presence of latent heat at the superconducting transition, where the step in the specific heat $\Delta C$ exceeds the zero field value. The intermediate state was probed by (i) a significant broadening of the transition onto lower temperatures for $B > 6.5$ mT, and (ii) the appearance of irreversibility in the specific heat at 8.5 mT in ZFC data. The critical field for bulk superconductivity extracted from the data follows the standard temperature dependence with $B_c = 13.6$ mT and $T_c = 1.60$ K for $B \leq 8.5$ mT. In fields $B \geq 10.5$ mT the data reveal the presence of a second, minority phase, with a volume fraction of $\sim$ 10~\%, possibly due to off-stoichiometric PdTe$_{2+x}$ regions. Acknowledgement: This work is part of the Projectruimte programme with project number 680-91-109, which is financed by the Dutch Research Council (NWO).
\section{Introduction} \label{intro} The ubiquitousness of time series data implies that almost every human endeavor can benefit from time series data mining research, therefore, significant research efforts have been made in this regard over the past couple of decades. Time series classification, specifically \textit{Shapelets} based time series classification, is a key research topic in the time series data mining domain \cite{Ye2011}. In contrast to deep neural network methods for time series, shapelet based methods can explicitly list relevant patterns and pattern occurrences used for classification, and thus belong to the category of methods that give explainable predictions in the first place. Formally, shapelets are subsequences that frequently occur in a specific class of time series instances while being absent or infrequent in the instances of the other classes. Shapelet discovery is an exhaustive search process over all possible subsequences of a time series dataset, and the time required for shapelet discovery from a dataset with $N$ time series instances each of length $n$ is on the order of $O(N^2 n^4)$. The Shapelet Transform (ST) algorithm extracts multiple shapelets in a single call to the shapelet discovery process and transforms the time series classification problem into a feature-based classification problem \cite{Hills2014:ShapeletTransform}. Basically, an $N \times k$ dataset is created, where the rows and columns correspond to time series instances and shapelets, respectively, and each $(i,j)$ cell contains the minimum distance between the $i$th time series instance and the $j$th shapelet. Subsequently, any off-the-shelf classification algorithm can be used for model induction using the feature set. The evaluation step involves the calculation of $k$ distance values corresponding to the $k$ shapelets and using the induced model for classification. Shapelet based time series classification for very large datasets requires a drastic reduction in the algorithmic complexity. One way of addressing this issue is to transform the time series data into a symbolic representation. The time series community has recognized and acknowledged the benefits of discretizing time series data \cite{Lin2012,Rakthanmanon2013,Senin2013,Schafer2015,Schafer2016,LeNguyen2019MrSEQL,Raza2020AcceleratingApproach}. However, the approaches are still suffering from high computational complexity: the complexity of the Fast Shapelets (FS) \cite{Rakthanmanon2013} approach is $O(N n^2)$, the one of Bag of Patterns (BoP) \cite{Lin2012} is $O(N n^3)$, the one of Symbolic aggregate approximation - Vector Space Model (SAX-VSM) \cite{Senin2013} $O(N n^3)$, the one of Bag of SFA Symbols (BOSS) \cite{Schafer2015} $O(N^2 n^2)$, the one of Bag of SFA Symbols in Vector Space (BOSS VS) \cite{Schafer2016} is $O(N n^\frac{3}{2})$, and the complexity of Mr-SEQL \cite{LeNguyen2019MrSEQL} is $O(N n^{\frac{3}{2}} \mathrm{log}\ n)$.\footnote{Notice that another well-known algorithm, the Matrix Profile \cite{Yeh2016}, is not applicable in this setting, because it takes a single, long time series as an input.} A recent approach called MiSTiCl directly employs string mining for frequent pattern extraction from discretized time series datasets \cite{Raza2020AcceleratingApproach} and has a complexity on the order of only $O(Nnl)$. The authors of MiSTiCl noted that the pattern extraction phase consumes approximately 80\% of the total time although the string mining algorithm used as the pattern extractor has a linear time complexity in the length of all discretized time series instances concatenated \cite{Raza2020AcceleratingApproach}. This can be attributed to the pattern explosion problem when searching for frequent patterns, since the number of possible subsequences in an $m$ character long string based on an alphabet size $\alpha$ is $\frac{1-\alpha^{m+1}}{1-\alpha}$. Basic pattern mining involves enumerating all possible pattern combinations to find interesting patterns, but this results in the infamous pattern explosion problem. Different approaches have been proposed to address this phenomenon, however, these approaches have their own associated drawbacks, e.g., related and redundant patterns lacking diversity, too few or too many patterns, high computational cost, etc. Pattern sampling is an alternative to the exhaustive pattern enumeration approach, and a number of variations of pattern sampling have been proposed. Pattern sampling proposes to sample one pattern at a time proportional to a quality measure \cite{Dzyuba2017FlexibleMining}. The aim is to limit the number of patterns that are evaluated upfront, but still being able to evaluate additional patterns when the need arises or the consumer process intends to evaluate more patterns with an aim to improve the overall accuracy. In this paper, we propose the first pattern sampling approach for shapelet based time series classification. We use a discretized representation of the time series data for shapelet discovery and replace the exhaustive frequent pattern extraction step with a pattern sampler.\footnote{We refer to real-valued time series segments as ``subsequences'' and the discretized/symbolic segments as ``patterns''.} Our approach provides competitive accuracy compared to state-of-the-art pattern based time series classification approaches and has an on par computational complexity as the most efficient pattern based time series classification approaches known today. In the following, our approach will be referred to as \underline{P}attern \underline{S}ampling for \underline{S}eries \underline{C}lassification (\textit{$PS^{2}C${}}). \section{Pattern Sampling for Time Series Classification} \label{sec:algo} Our proposed algorithm stands out from other pattern based time series classification algorithms, because it employs a pattern sampler instead of evaluating all the candidate patterns for finding the most discriminative shapelets. The basic structure of our algorithm is similar to other feature/pattern based time series classification algorithms, e.g., ST \cite{Hills2014:ShapeletTransform}, MiSTiCl \cite{Raza2020AcceleratingApproach}, etc. The main steps of the algorithm are: (i) discretizing the time series data, (ii) creating a pattern sampler, (iii) creating a feature set via sampling a fixed number of patterns or until a quality threshold is met, (iv) creating a transformed dataset using the sampled patterns, and finally (v) model induction. A \textit{time series} is an ordered, real-valued sequence of $n$ observations denoted as $T=(t_1,t_2,\ldots,t_n)$. A label $y \in C$ can be assigned to a time series instance, where $C$ is the set of all class labels. A time series dataset $D$ consists of $N$ labeled time series instances $\{(T_1,y_1),(T_2,y_2),\dots,(T_N,y_N)\}$. Symbolic aggregate approximation (SAX) is a widely used time series discretization algorithm \cite{Lin2007a}. It transforms a time series $T$ of length $n$ into a string $\sax{T}=(\sax{t}_1, \sax{t}_2,\ldots,\sax{t}_p)$ of length $p=\lfloor\frac{n}{\omega}\rceil$, where $p~\ll~n$ and $\omega$ represents the averaging window size. Each non-overlapping sequence of $\omega$ observations of $T$ is averaged to provide one observation, i.e., $\paa{T} = (\paa{t}_1,\paa{t}_2,\ldots,\paa{t}_p)$. Figure \ref{fig:real-and-saxed} illustrates real-valued time series instances and their PAA versions. Next, each observation $\paa{t}_i \in \paa{T}$ is mapped to a character from an alphabet of size $\alpha \in \mathbb{Z}_{\geq 2}$ such that $\sax{t}_i = \mathnormal{alpha}_j,\ \mathrm{iff}\ \beta_{j-1} \leq \paa{t}_i < \beta_j$. The quantization blocks for the alphabet are chosen based on breakpoints $(\beta_0,\beta_1,\ldots,\beta_{\alpha})$, where $\beta_0$ and $\beta_{\alpha}$ are defined as $-\infty$ and $\infty$, respectively, and the remaining breakpoints are chosen such that area under the $\mathcal{N}(0,1)$ Gaussian curve from $\beta_i$ to $\beta_{i+1}$ equals $\frac{1}{\alpha}$. \begin{figure}[t] \centering \includegraphics[width=0.9\textwidth]{Coffee-paavalued.png} \caption[PAA version of time series instances superimposed on their real-valued counterparts] {PAA version of time series instances superimposed on their real-valued counterparts. The original time series instances (shown in light gray) have 286 data points, and the PAA versions have 40 data points based on a dimensionality reduction factor $\omega=7$. The PAA versions have been stretched (along the x-axis) to emphasize the retention of the overall shape of time series instances.} \label{fig:real-and-saxed} \end{figure} Discretizing time series data using SAX preserves the overall shape, however, it can also lead to a loss of temporal features. This is an artifact of inadvertent feature splitting due to the use of an arbitrary window size $\omega$. One effective way of dealing with this problem is to initiate multiple independent feature extraction pipelines, each based on a different combination of $\alpha$ and $\omega$, and finally merging the results of each individual feature extraction problem into one aggregate transformed dataset. This results in a diverse feature set that leads to better overall accuracy when using an ensemble classifier for model induction, because ensemble methods inherently tend to reduce variance and sometimes also bias. This multi-resolution feature extraction technique has been effectively used in a number of pattern-based time series classification approaches \cite{Schafer2015,Raza2020AcceleratingApproach,LeNguyen2019MrSEQL}. Algorithm \ref{alg:main-algo} lists the main steps of the $PS^{2}C${} algorithm. The first step is the discretization of the train and test splits corresponding to the current $(\alpha, \omega)$ parameter combination (Line~\ref{alg:main-algo:discretize-splits}). Next, the discretized training set instances are used to create suffix tree representations for fast substring searching (Line~\ref{alg:main-algo:preprocess-trainset}). The choice of suffix trees is rather superficial, since there are a number of other data structures that can be utilized to efficiently search a given string for the presence of query substrings. Next, a probabilistic pattern sampler is induced based on the discretized training data (Line~\ref{alg:main-algo:extract-freq-patts}). Next, transformed training and testing feature sets are created based on sampled patterns (Line~\ref{alg:main-algo:populate-splits}). Once all individual feature sets have been created, they are concatenated to form a single feature set, which can be used to induce a classification model (Line~\ref{alg:main-algo:optimization-step}). \begin{algorithm}[t] \caption{$PS^{2}C${}($D_{train}$, $D_{test}$, $A$, $\Omega$, $l_{max}$, $s_{min}$, $\tau$, $K$)} \label{alg:main-algo} \begin{algorithmic}[1] \State $SV_{train} \gets \{\}$, $SV_{test} \gets \{\}$ \Comment{Initialize associative arrays for feature sets} \label{alg:main-algo:initialize-feature-set-maps} \ForAll{$(\alpha,\omega) \in A \times \Omega$} \label{alg:main-algo:alpha-w-loop-start} \State $\widehat{D}_{train}, \widehat{D}_{test} \gets $\Call{Discretize}{$D_{train}$, $D_{test}$, $\alpha$, $\omega$} \label{alg:main-algo:discretize-splits} \State $\widehat{D'}_{train} \gets $\Call{CreateSuffixTrees}{$\widehat{D}_{train}$} \label{alg:main-algo:preprocess-trainset} \State $Sampler \gets $\Call{FitPatternSampler}{$\widehat{D}_{train}$, $\widehat{D'}_{train}$, $l_{max}$, $s_{min}$, $\tau$} \label{alg:main-algo:extract-freq-patts} \State $SV_{train}^{\alpha,\omega}, SV_{test}^{\alpha,\omega} \gets $\Call{CreateFeatureSet}{$D_{train}$, $D_{test}$, $\widehat{D}_{train}$, $Sampler$, $K$} \label{alg:main-algo:populate-splits} \EndFor \label{alg:main-algo:alpha-w-loop-end} \State $FS_{train}, FS_{test} \gets$ \Call{MergeFeatureSets}{$SV_{train}$, $SV_{test}$, $A$, $\Omega$, $|D_{train}|$} \label{alg:main-algo:optimization-step} \State \Return $FS_{train}, FS_{test}$ \end{algorithmic} \end{algorithm} \subsection{Creating the Pattern Sampler} \label{subsec:patt-samp} A pattern sampler can be modeled in several ways, e.g., graphs (MCMC), trees, etc. \cite{Dzyuba2017FlexibleMining}. We have envisaged the pattern sampler as a trie with weighted edges, since this allows to incorporate constraints and fast, iterative updates to the sampler. A trie is a data structure used to store strings in order to support fast pattern matching. Formally, if $S$ is a set of $s$ strings from an alphabet $\Sigma$, then a standard trie for $S$ is an ordered tree with the following properties: \begin{itemize} \item Each node of a trie, except the root, is labeled with a character of $\Sigma$. \item The children of an internal node of the trie have distinct labels. \item The trie has $s$ leaves, each associated with a string of $S$, such that the concatenation of the labels of the nodes on the path from the root to a leaf $v$ of the trie yields the string of $S$ associated with $v$. \end{itemize} Thus, a trie represents the strings of $S$ with paths from the root to the leaves. For strings sharing a common prefix, the edges are shared for the common prefixes and a split is created when the characters in the strings differ. In addition, we augment the trie with weighted edges such that inserting a string in the trie also associates a corresponding weight to all the inserted edges. An edge shared between multiple strings has a weight equal to the aggregate of the weights associated with all the strings that share the particular edge. Edge weights are based on the discriminative capability of inserted patterns. The $\chi^2$ statistic can be used to determine whether there is a statistically significant difference between the expected and observed counts for a given contingency table consisting of two or more categories. In case of a symbolic time series dataset, the categories are the different classes, while the counts are the number of instances belonging to each class in which the given pattern is present or absent. The range of values for the $\chi^2$ statistic is $(0, |D_{train}|]$. For a binary class problem, if a pattern occurs in all the instances of one class, whereas it is absent in all instances of the other class, then the $\chi^2$ statistic will be maximized, whereas if the pattern is present/absent in most of the instances, then the $\chi^2$ statistic will be close to 0. In order to simplify subsequent steps, the $\chi^2$ statistic is normalized with $|D_{train}|$ so that the effective range becomes $(0, 1]$, where the value of 1 indicates that the given pattern is a perfect discriminator, while a value close to 0 indicates otherwise. The normalized $\chi^2$ statistics can be directly used as weights for the edges, however, we can introduce a bias towards highly discriminative patterns using temperature scaling. The scaled edge weights are calculated as $q^{(1/\tau)}$, where $q$ is the normalized $\chi^2$ statistic and $\tau$ is the temperature scaling factor. During pattern sampling, the probability of selecting an edge is given as $f_{\tau}(q)_{i} = \frac{q_{i}^{(1/\tau)}}{\sum_{j} q_{j}^{(1/\tau)}}$, where $\sum_{j} q_{j}^{(1/\tau)}$ is the sum of all edge weights originating from the node. When $\tau~=~1$, the edge weights are linearly proportional to the normalized $\chi^2$ statistics. As $\tau$ decreases, the bias towards patterns with higher normalized $\chi^2$ statistics increases, e.g., a quadratic scaling is applied to the values for $\tau = 0.5$. As $\tau \to 0$, the function turns into an argmax function. Figure \ref{fig:example-trie} shows an example trie created from a set of words extracted from a discretized dataset. The figure is based on the popular \textit{Coffee} dataset that is a binary class dataset with 14 instances in each class. The scaling factor $\tau$ is set to 0.33, alphabet size $\alpha$ is set to 6, and dimensionality reduction factor $\omega$ is set to 4. The pattern \texttt{ffe} occurs in all instances of one class and has a normalized $\chi^2$ statistic of 1.0 that translates into a scaled edge weight of 1.0. Another pattern \texttt{ffc} occurs in 13 of the 14 instances of the other class, therefore, its normalized $\chi^2$ statistic is equal to 0.867 and the scaled weight is equal to 0.65. Inserting the first pattern adds the required edges with each associated edge weights. When the second pattern is inserted, the edges corresponding to substring \texttt{ff} have their weight updated to be the sum of the previous weight and the weight associated with the current pattern, while a new edge is inserted for the suffix \texttt{c} with the respective weight for the pattern. The other patterns are also inserted similarly. \begin{figure}[t] \centering \includegraphics[width=0.85\textwidth]{TrieExample.pdf} \caption{An illustration of a weighted trie. The edges are weighted using the scaled quality measures of the strings. The weight of a shared edge is equal to the aggregated weights contributed by all strings sharing that edge. The leaf nodes show the patterns added to the trie along with their quality measures.} \label{fig:example-trie} \end{figure} Algorithm \ref{alg:trie-algo} lists the steps involved in the creation of a weighted trie based on patterns up to a user specified length. The procedure extracts all patterns of a given length using the suffix trees. Next, each candidate pattern is evaluated to determine its discriminative capability using the $\chi^2$ statistic. If the normalized $\chi^2$ statistic is greater than or equal to $s_{min}$, the pattern is accepted to be inserted in the trie, otherwise it is discarded. Starting from the root node, the insertion procedure checks if an edge corresponding to the first character in the candidate pattern is present or not. If the edge is absent, the procedure adds the edge and sets the edge weight equal to the scaled quality measure for the pattern. If an edge corresponding to the character is already present, then the edge weight is updated by adding the scaled quality measure of the pattern. Similarly, the node weight is updated according to the new aggregate of edge weights. The procedure then traverses down the edge added/updated and checks for the second character in the pattern and so on, until all the characters have been inserted. \begin{algorithm}[t] \caption{FitPatternSampler ($\widehat{D}_{train}$, $\widehat{D'}_{train}$, $l_{max}$, $s_{min}$, $\tau$)} \label{alg:trie-algo} \begin{algorithmic}[1] \State Initialize an empty trie $Sampler$ \For{$l \gets 2$ to $l_{max}$} \State $S \gets $\Call{FindAllPatternsWithLength}{$l, \widehat{D'}_{train}$} \For{$s \in S$} \State $q \gets $\Call{CalculateChiSqStatistic}{$s,\widehat{D}_{train}, \widehat{D'}_{train}$} \If{$q \geq s_{min}$} \State \Call{Insert}{$s,q,\tau$} \EndIf \EndFor \EndFor \State \Return $Sampler$ \end{algorithmic} \end{algorithm} \subsection{Creating Feature Sets} \label{subsec:algo-creating-feature-sets} The next step is the creation of a feature based dataset with $K$ sampled patterns. Algorithm \ref{alg:transform} lists the pseudo-code for creating the real-valued feature datasets. After initialization of the necessary data structures, $K$ patterns are sampled from the trie. Sampling a pattern involves traversing the weighted trie from the root node to a leaf node using the fitness proportionate (roulette wheel) selection method. At any node, the probability of selecting the $i$th edge is calculated by dividing the edge weight $q_i^{1/\tau}$ by the sum of all edge weights for the current node $\sum_j q_j^{1/\tau}$. A uniformly distributed random number $r$ is drawn in the range $\left[0,\sum_j q_j^{1/\tau}\right)$. Now, the edge weights of all edges are compared with the random number $r$ in their lexical order. For each edge $i$, if $r$ is less than the edge weight $q_i^{1/\tau}$ then the $i$th edge is selected as the next edge, otherwise $q_i^{1/\tau}$ is subtracted from $r$ and the next edge weight is compared. The process continues until the last edge originating from the node. If a node has child nodes and is also a leaf node, the decision to return the string terminating at the current node or to traverse the trie further is also based on a random number. For each sampled pattern, a reverse lookup is performed to get the real-valued subsequences from the symbolic patterns. Next, $K$-column feature sets are created, for the training and test set, respectively. The rows of the feature sets correspond to the time series instances, and columns represent the $K$ shapelets discovered. The cells are populated with the distance values between the time series instances and the discovered shapelets. \begin{algorithm}[t] \caption{CreateFeatureSets ($D_{train}$, $D_{test}$, $\widehat{D}_{train}$, $Sampler$, $K$)} \label{alg:transform} \begin{algorithmic}[1] \State $SV_{train} \gets MATRIX(|D_{train}|, K)$, $SV_{test} \gets MATRIX(|D_{test}|, K)$\label{alg:transform:init-train-test-sv} \For{$k \gets 1$ to $K$} \label{alg:transform:f-loop-start} \State $f \gets $\Call{SamplePattern}{$Sampler$} \State $s \gets $\Call{PerformReverseLookup}{$D_{train}$, $\widehat{D}_{train}$, $f$} \label{alg:transform:perform-rev-lookup} \State \begin{varwidth}[t]{\linewidth} For each $T \in D_{train}$\par \hskip\algorithmicindent populate the respective row and column of $SV_{train}$ \par \hskip\algorithmicindent with the distance value between $T$ and $s$ \end{varwidth} \label{alg:transform:train-set-inst} \State \begin{varwidth}[t]{\linewidth} For each $T \in D_{test}$\par \hskip\algorithmicindent populate the respective row and column of $SV_{test}$ \par \hskip\algorithmicindent with the distance value between $T$ and $s$ \end{varwidth} \label{alg:transform:test-set-inst} \State Increment $k$ and if $k$ equals $K$ \Break{Outer loop} \EndFor \label{alg:transform:f-loop-end} \State \Return $SV_{train}, SV_{test}$ \end{algorithmic} \end{algorithm} \subsection{Merging Individual Feature Set} Combining the feature sets created for each $(\alpha, \omega) \in A \times \Omega$ parameter combination yields a feature set which can mitigate the problem of feature loss due to discretization while providing increased accuracy with the inclusion of features obtained for different levels or resolutions of discretization and quantization. Since use of multi-resolution feature sets has been inspected previously, there have also been attempts at optimizing the overall results by merging only the feature sets which can contribute the most towards improving the classification accuracy \cite{Raza2020AcceleratingApproach}. In our experiments, it was observed that creating an optimized version of the merged feature set only provides a minor improvement in accuracy, if any. In most cases, classification models created using a merged feature set without any optimization towards finding a perfect combination of individual feature sets are as accurate as the optimized feature set based classification models. \subsection{Complexity Analysis} \label{subsec:complexity} The computational complexity can be determined by investigating a single feature set creation iteration based on an arbitrary combination of $\alpha$ and $\omega$. SAX requires $O(Nn)$ operations to discretize a dataset. The time taken for creating a pattern sampler depends on: (i) the time taken to extract candidate patterns, and (ii) the time taken in finding the candidate pattern in each discretized instance of the training set. Therefore, the time required for both these steps is $O(Nm)$. Sampling $K$ patterns is proportional to the maximum pattern length in the trie $O(l_{max})$. For each feature, $N$ feature values have to be calculated, where each feature value calculation takes $O(ns)$ time, where $s$ is the length of a subsequence and $s \ll n$. Since $K$ is a constant and much smaller than $N$ and $n$, the time required for creating a feature set is on the order of $O(Nns)$. The overall time complexity of creating a feature set for a given $\alpha$ and $\omega$ parameter combination is on the order of $O(Nn)+O(N\frac{n}{w})+O(1)+O(Nns) \approx O(Nns)$. Since the quantity $|A| \times |\Omega|$ is also constant, the asymptotic time complexity of the algorithm is on the order of $O(Nns)$. \section{Empirical Evaluation} \label{sec:experiments} The UCR/UEA Time Series classifiction Repository\footnote{UCR/UEA Time Series Repository \url{https://www.timeseriesclassification.com}} has evaluated many time series classification algorithms using an extensive set of datasets and provides the classification accuracy results for comparison. These results are based on 100 evaluations of each dataset using shuffled training and testing set splits. This evaluation strategy has become a \textit{de facto} convention for reporting time series classification results. We have also evaluated $PS^{2}C${} using the same evaluation strategy. In order to compare $PS^{2}C${} against other well-known algorithms regarding classification accuracy, we have used the results provided by the UCR/UEA Repository and the repositories for the MiSTiCl and Mr-SEQL algorithms. The runtime requirements for MiSTiCl, BOSS, BoP, and SAX-VSM were taken from the MiSTiCl repository. All experiments were performed with a fixed set of parameters for all datasets. The $A$ and $\Omega$ parameters were set to $\{2, 3, \ldots, 8\}$ and $\{2, 3, \ldots, 6\}$, respectively. The maximum allowed pattern length $l_{max}$ was set to 20, the minimum acceptable discriminative power $s_{min}$ (normalized $\chi^2$ statistic) was set to be 0.05, the scaling factor $\tau$ was set to 0.5, and $K$ was set to 4. For statistical comparison of different algorithms, we employ the Friedman test followed by Nemenyi post-hoc test based on average ranks attained by the different algorithms and show the comparisons as critical difference (CD) diagrams \cite{Demsar2006}. The executable code and required scripts are available online.\footnote{Executable code and scripts available at: \url{https://drive.google.com/drive/folders/16oUBQ8ycGOwXnSgIsBRuTnl5MFuf2g4H?usp=sharing}.} \subsection{Results} \label{sec:results} In terms of classification accuracy, our algorithm performs on par with other algorithms for datasets with two to six classes, however, classification accuracy deteriorates as the number of classes in a dataset goes beyond eight. This behavior is due to the fact that we create a single pattern sampler and there is no provision for sampling class-correlated patterns. An obvious alternative is to create samplers for each class individually in an one-vs-all fashion, however, another alternative is to incorporate additional information with the patterns, which could enable class-correlated pattern sampling. The minimum acceptable discriminative power $s_{min}$ for a candidate pattern allows to adjust the acceptance threshold for candidate patterns. A high value allows to accept only the very best patterns, while a value close to zero allows to accept almost all patterns. Accepting a large number of patterns can lead to a densely populated trie, but a stringent scaling factor $\tau$ can help deal in this case by heavily weighting the useful patterns and diminishing the chances of sampling less useful patterns. Therefore, $s_{min}$ and $\tau$ are complementary parameters. The maximum allowed pattern length $l_{max}$ is basically used to limit the number of patterns inserted into the trie. In most cases, the discriminative patterns are much shorter than the length of discretized time series instances, however, many discriminative patterns can have a huge number of variants with either a prefix or a suffix. The $l_{max}$ parameter allows to restrict the inclusion of too many variant patterns in the trie, and in doing so, helps to keep the trie balanced since the inclusion of too many variants with the same discriminative power would cause the sampling procedure to return related and/or redundant patterns. Figure \ref{fig1} shows a critical differences diagram for different time series classification algorithms regarding classification accuracy. Overall, $PS^{2}C${} performs impressively and is on par with algorithms like ST and Flat.COTE. HIVE.COTE and Flat.COTE are two ensemble classifiers which base their classification on the basis of various types of classifiers, including ST, BOSS, etc. Both these algorithms have an extremely high computational cost due to their dependence on training several different types of classification algorithms. Among the pattern based time series classification algorithms, SAX-VSM and BoP perform worse, while MiSTiCl, Mr-SEQL, BOSS and $PS^{2}C${} perform similarly and are not significantly different from each other. $PS^{2}C${} is not significantly different from ST or Flat.COTE, however, it narrowly misses the group that forms the cohort of best performing time series algorithms in this comparison. \begin{figure}[t] \centering \includegraphics[width=0.75\textwidth]{Classification_accuracy_All.png} \caption{Average ranks based on classification accuracy for different time series classification algorithms. The critical difference (CD) for significantly different algorithms is 1.46.} \label{fig1} \end{figure} Figure \ref{fig2} shows the critical differences diagram for pattern-based time series classification algorithms regarding running times. MiSTiCl was a clear winner and $PS^{2}C${} was the second fastest, while BoP/BOSS and SAX-VSM were significantly slower than either of the two algorithms. A direct comparison with other algorithms was not possible due to the lack of availability of runtime performance data from the UEA and Mr-SEQL repositories. Overall, $PS^{2}C${} was 1.1 to 1.3 times slower than MiSTiCl on average, however, since MiSTiCl was shown to be significantly faster than the other algorithms, we can confidently assume that $PS^{2}C${} is also substantially faster than the remaining algorithms. This is backed up by complexity considerations (see Section 1 and Section 2.4). \begin{figure}[t] \centering \includegraphics[width=0.75\textwidth]{Runtime_All.png} \caption{Average ranks based on runtime performance for $PS^{2}C${}, MiSTiCl, BOSS, BoP, and SAX-VSM. The critical difference (CD) for significantly different algorithms is 0.6x.} \label{fig2} \end{figure} \section{Conclusion}\label{sec:conclusions} The paper introduced the first pattern sampling algorithm for time series data. The pattern sampler is used in a shapelet based classification algorithm. It was demonstrated that pattern sampling can be an effective alternative to the exhaustive shapelet/pattern discovery processes, since it enables to extract frequent patterns based on a quality measure to counteract the pattern explosion phenomenon. We used a multi-resolution feature set creation approach in our experiments, since it is proven to be highly effective. Our pattern sampling based algorithm was mostly on par with other similarly structured algorithms regarding classification accuracy. In terms of computational costs, our approach is slightly slower than MiSTiCl, however, the complexity analysis indicates the asymptotic complexity for our approach is similar to that of MiSTiCl, implying that the proposed method is faster than the other algorithms. Shapelet based time series classification gives rise to explainable classifications by construction. Therefore, the proposed pattern sampler is another option for constructing interpretable feature sets for time series. Interesting combinations with deep neural networks, especially for smaller sized datasets, remain a topic for future research \cite{Kramer2020}. There are a few optimizations that have been identified as further future avenues to be explored. We need to explore class-correlated pattern sampling in order to improve the accuracy in cases where the pattern sampler keeps providing patterns for one or a few classes rather than for the majority of classes. We can also experiment with fuzzy pattern sampling to diversify the identified feature set per pattern sampler. \bibliographystyle{splncs04}
\section{Introduction} \label{sec:intro} \IEEEPARstart{S}martphones, and mobile devices in general, play nowadays a central role in our society. We use them on a daily basis not only for communication purposes, but also to access social media and for sensitive tasks such as online banking. In order to increase the security level of those more sensitive applications, verifying the subject's identity plays a key role. To tackle this requirement, many companies are currently working towards creating applications to verify the subject's identity by comparing a selfie image with the reference face image stored in the embedded chip of an ID-Card/Passport and a selfie image using Near Field Communication (NFC) from smartphones \cite{fake-id}. This represents a user-friendly identity verification process, which can be easily embedded into numerous applications. However, this verification process also faces some challenges: for instance, that selfie image is captured in an uncontrolled scenario, where occlusions due to wearing a scarf in winter or a hygienic facial mask during a pandemic such as COVID-19 may hinder the performance of general face recognition algorithms. Therefore, there is a reinforced need to explore alternatives which can deal with those occluded images successfully, such as utilising the periocular region for recognition purposes. The aforementioned reasons have increased the interest on periocular based biometrics in the last decade in different scenarios ~\cite{Alonso-SurveyPeriocular-PRL-2016,alonso2019cross, naser, Raja2014BinarizedSF}. In particular, it has been shown that periocular images captured with mobile devices for recognition purposes are mainly acquired as selfie face images. And the number of digital photos will increase every year: in 2022, 1.5 trillion images were taken, and 90\% of them come from smartphones\footnote{\url{https://blog.mylio.com/how-many-photos-taken-in-2022/}}. In order to recognise individuals from a selfie in a remote verification system, the periocular region needs to be cropped, and the resulting periocular sample has often a very low-resolution \cite{Tapia2019}. Moreover, the subjects capture selfie images in multiple places and backgrounds, using selfie sticks, alone, or with others. This translates into a high intra-class variability which can be observed for the images, in terms of size, lighting conditions, and face pose. \begin{figure*}[t] \centering \includegraphics[width=0.80\textwidth]{images/New_images/flow_2021.png} \caption{\label{workflow} Block diagram of the verification system proposed, including a super-resolution approach. Top: Traditional approach with resizing images. SR approach with deep learning embeddings (Middle) and with handcrafted features (BSIF, Bottom).} \end{figure*} With the aim of improving the quality of such low-resolution images, several Single Image Super-Resolution (SISR) methods have been recently proposed ~\cite{wang_survey, KUMARI2019, Yang, Tian}, mainly based on convolutional neural networks (CNNs). Even though some authors have enhanced such networks to achieve more efficiently the reconstruction results of the super-resolution \cite{TimofteRG15}, most approaches still use deep models, which demand large resources and are thus not suitable for mobile or Internet-of-Things (IoT) devices. Furthermore, the loss function used in most techniques is based on structural similarity (SSIM) and Peak Signal to Noise Ratio (PSNR) metrics \cite{wang_survey}. Even though those metrics are appropriate for increasing the resolution of general purpose images (e.g., landscapes, cities, or birds) they are not that suitable for increasing the quality of iris based biometrics applications. In contrast, the ISO/IEC 29794 standard on biometric sample quality — Part 6: Iris image data describes sharpness based on the Laplacian of Gaussian (LoG) as one relevant quality. In this work, we have a twofold goal: verify a biometric claim in a verification transaction from a smartphone selfie periocular image in the visible spectrum (VIS) and propose an efficient super-resolution approach (see Fig.~\ref{workflow}). As already mentioned, this is a challenging task since there is limited control of the quality of the images taken: selfies can be captured from different distances, light conditions, and resolutions. Therefore, to tackle these issues, we present a SISR algorithm with a novel loss function based on the sharpness LoG metric and a light-weight CNN. This model takes into account the trade-off between the number of layers and filter sizes in order to achieve a light model suitable for mobile devices. Additionally, we explore pixel-shuffle and transposed convolutions in order to recover the fine details of the periocular eye images. To validate our approach, we use different databases for training and testing. In addition, we benchmark both handcrafted features and pre-trained deep learning models. Our method drastically reduces the number of parameters when compared with the state-of-the-art Deep CNNs with Skip Connection and Network (DCSCN)~\cite{yamanaka}: from 2,170,142 to 28,654 parameters when the image size is increased by a factor of 2. This paper is an extension of our previous work~\cite{tapia_wifs2020}. In that work, we focused on achieving an accurate Enhanced SISR (ESISR) algorithm for periocular eye images taken from selfie images, reporting results in terms of image similarity for the recovered images on a smaller Samsung dataset. In this paper, we evaluate this new ESISR architecture in more detail and benchmark it with two new state-of-the-art methods: WDSR-A~\cite{yu} and SRGAN~\cite{lim}. A full explanation of the reasons that led us to such architecture is discussed in this work. As an additional contribution, this manuscript includes the performance evaluation of our proposed methods on periocular verification systems using three pre-trained CNNs: FaceNet~\cite{facenet}, VGGFace~\cite{Parkhi15}, and ArcFace~\cite{deng2018arcface}. All methods have been now evaluated on the larger MobBIO~\cite{Sequeira} and NTNU~\cite{visper} databases. A benchmark with a traditional resized method such as inter-area, inter-lineal, and inter-cubic (bicubic) has been also analysed. A handcrafted feature extractor, Binary Statistical Image Filter (BSIF), was also added to evaluate and compare the results with the deep learning approach. Detection Error Trade-off (DET) curves are included to show our proposal's performance and efficiency. All these new experiments are benchmarked with those previously obtained in \cite{yamanaka, yu, ledig}. Therefore, the main contributions from this work can be summarised as follows: \begin{itemize} \item An efficient SR architecture is proposed, using only seven layers with a feature extractor and one block based on recursive learning of reconstruction. \item A recursive pixel-shuffle technique is introduced over a transposed convolution to extract and keep fine details of periocular images. \item A novel loss function that includes the LoG sharpness iris quality metric and the SR loss function was proposed. \item A significant reduction of the number of parameters in comparison with the state-of-the-art using WDSR-A, SRGAN and DCSCN algorithms (see Sect.~\ref{sec:relate}) is reported. \item A novel database for selfie periocular eye images was acquired and is available for researchers upon request. \item A periocular verification system based on an embedded vector from three pre-trained models (FaceNet, VGGFace, and ArcFace), with an SR-based pre-processing of the samples (x2, x3 and x4) was tested. \item A benchmark between deep learning approaches and a handcrafted method is reported. \item A full analysis of the influence of SR on selfie biometrics scenarios with traditional resizing methods (Interlineal, InterCubic, InterArea) was also included. \end{itemize} The rest of the article is organised as follows. Sect.\ref{sec:relate} summarises the related works on periocular recognition and super resolution. The new recognition and super-resolution method is described in Sect.~\ref{method}. The experimental framework is then presented in Sect.~\ref{experiments} and the results are discussed in Sect.~\ref{sec:results}. We conclude the article in Sect.~\ref{conclusions}. \section{Related Work} \label{sec:relate} \subsection{Super-Resolution (SR)} Super-resolution (SR) is the process of recovering a high-resolution (HR) image from a low-resolution (LR) one \cite{dong,wang_survey}. Supervised machine learning approaches learn mapping functions from LR images to HR images from a large number of examples. The mapping function learned by these models is the inverse of a downgrade function that transforms HR images into LR images. Such downgrade functions can be known or unknown. Many state-of-the-art SR models learn most of the mapping function in LR space followed by one or more upsampling layers at the end of the network. This is called post-upsampling. Earlier approaches first upsampled the LR image with a pre-defined up-sampling operation and then learned the mapping in the HR space (pre-upsampling SR). A disadvantage of this approach is that more parameters per layer are required, which in turn leads to higher computational costs and limits the construction of deeper neural networks \cite{wang_survey}. SR requires that most of the information contained in an LR image must be preserved in the SR image. SR models therefore mainly learn the residuals between LR and HR images. Residual network designs are therefore of high importance: identity information is conveyed via skip connections whereas reconstruction of high frequency content is done on the main path of the network \cite{wang_survey}. Dong \textit{et al.}~\cite{dong} proposed several SISR algorithms which can be categorized into four types: prediction models, edge-based methods, image statistical methods, and patch-based (or example-based) methods. This method uses 2 to 4 convolutional layers to prove that the learned model performs well on SISR tasks. The authors concluded that \emph{using a larger filter size is better than using deeper Convolutional Neural Networks (CNNs)}. Kim \textit{et al.}~\cite{Kim} proposed an image SR method using a Deeply-Recursive Convolutional Network (DRCN), which contains deep CNNs with up to 20 layers. Consequently, the model has a huge number of parameters. However, the CNNs share each other's weights to reduce the number of parameters to be trained, thereby being able to succeed in training the deep CNN network and achieving a significant performance. The authors conclude in their work \emph{that deeper networks are better than large filters}. Yamanaka \textit{et al.}~\cite{yamanaka} proposed a Deep CNN with a Residual Net, Skip Connection and Network (DCSCN) model achieving a state- of-the-art reconstruction performance while reducing by at least 10 times the computational cost. According to the existing literature, deep CNNs with residual blocks and skip connections are suitable to capture fine details in the reconstruction process. In the same context, \cite{shi} and \cite{long} propose the pixel-shuffle and transposed convolution algorithm in order to extract the most relevant features from the images. The transposed convolutional layer can learn up-sampling kernels. However, the process is similar to the usual convolutional layer and the reconstruction ability is limited. To obtain a better reconstruction performance, the transposed convolutional layers need to be stacked, which means the whole process needs high computational resources \cite{yamanaka}. Conversely, pixel-shuffle extracts features from the low-resolution images. The authors \cite{yamanaka} argue that batch normalisation loses scale information of images and reduces the range flexibility of activations. Removal of batch normalisation layers not only increases SR performance but also reduces GPU memory 40\%. This way, significantly larger models can be trained. Ledig \textit{et al.}~\cite{ledig} proposed a deep residual network which is able to recover photo-realistic textures from heavily downsampled images on public benchmarks. An extensive Mean-Opinion-Score (MOS) test shows significant gains in perceptual quality using SR based on Generative Adversarial Network (SRGAN). In addition, the authors present a new perceptual loss based on content loss and adversarial loss. Yu \textit{et al.}~\cite{yu} proposed the key idea of wide activation to explore efficient ways to expand features before ReLU, since simply adding more parameters is inefficient for smartphone based image SR scenarios. The authors present two new networks named Wide Activation for Efficient and Accurate Image Super-Resolution (WSDR). These networks (WDSR-A and WDSR-B) yielded better results on the large-scale DIV2K image super resolution benchmark in terms of PSNR with the same or lower computational complexity. Similar results but with a larger number of parameters are presented by Lim \textit{et al.}~\cite{lim} in a model called Enhanced Deep Residual Networks for Single Image Super Resolution (EDSR). Specifically for biometric applications, some papers have explored the use of SR in iris recognition in the visible and near-infrared spectrum. Ribeiro \textit{et al.}~\cite{ribeiro} proposed a SISR method using CNNs for iris recognition. In particular, the authors test different state- of-the-art CNN architectures and use different training databases in both the near-infrared and visible spectra. Their results are validated on a database of 1,872 near-infrared iris images and on a smartphone image database. The experiments show that using deeper architectures trained with texture databases that provide a balance between edge preservation and the smoothness of the method can lead to good results in the iris recognition process. Furthermore, the authors used PSNR and SSIM to measure the quality of the reconstruction. More recently, Alonso-Fernandez \textit{et al.}~\cite{survey} presented a comprehensive survey of iris SR approaches. They also described an Eigen-patches reconstruction method based on the principal component analysis and Eigen-transformation of local image patches. The inherent structure of the iris is reproduced by building a patch-position-dependent dictionary. The authors also used PSNR and SSIM to measure the quality of the reconstruction in the NIR spectrum and in the NTNU database in the visible spectrum \cite{raja}. \subsubsection{Metrics} Deep learning-based methods for SISR significantly outperform conventional approaches in terms of Peak Signal-to-Noise Ratio (PSNR) and Structural Similarity (SSIM) \cite{dong}. In this section, we review these two metrics. SSIM is a subjective metric used for measuring the structural similarity between images from the perspective of the human visual system. It is based on three relatively independent properties, namely: luminance, contrast, and structure. The SSIM metric can be seen as a weighted product of the comparison of luminance, contrast, and structure computed independently. Therefore, SSIM is defined as: \begin{equation} \mathrm{SSIM}(x,y) = \frac{(2\mu_x\mu_y + C_1) + (2 \sigma _{xy} + C_2)} {(\mu_x^2 + \mu_y^2+C_1) (\sigma_x^2 + \sigma_y^2+C_2)} \label{eq:SSMI} \end{equation} where $\mu$ and $\sigma$ represent the average and variance of x and y, respectively; and $C_1$ and $C_2$ are two variables to stabilise the division with a weak denominator. PSNR is a common objective metric to measure the reconstruction quality of a lossy transformation. It is inversely proportional to the logarithm of the Mean Squared Error (MSE) between the ground truth image and the generated image: \begin{equation} \mathrm{PSNR} = 10 \log_{10}\left(\frac{\max^{2}}{\mathrm{MSE}}\right) \end{equation} where max denotes the maximum pixel value, and MSE the mean of the squared of differences between the pixel values of the reconstructed super-resolution image and the ground truth image (prior to downsampling. Therefore, this metric measures pixel differences and not the quality of the images. \subsection{Periocular recognition} Periocular recognition based on traditional feature extraction methods such as intensity, shape, texture, fusion, and off-the-shelf CNN features with pre-trained models has been widely studies. However, to the best of our knowledge, only a few papers have explored the use of SR methods to improve the quality of the RGB images coming from periocular selfie captures. Chandrashekhar \textit{et al.~}\cite{Chandrashekhar} proposed a new initialization strategy for the definition of the periocular region-of-interest and the performance degradation factor for periocular biometric and the influence of Histogram of Oriented Gradient (HOG), Local Binary Pattern (LBP), Scale-Invariant Feature Transform (SIFT), Fusion at the Score Level, Effect of Reference Points of the eyes, Covariates, Occlusion Performance and Pigmentation Level Performance. Raja \textit{et al.~}\cite{kiran2015} explore multi-modal biometrics as a means for secure authentication. The proposed system employs face, periocular, and iris images, all captured with embedded smartphone cameras. As the face image is captured closely, one can always obtain periocular and iris information with fine details. This work also explores various score level fusion schemes of complementary information from all three modalities. Also, the same authors used in~\cite{visper} used in the periocular region for authentication under unconstrained acquisition in biometrics. They acquired a new database named Visible Spectrum Periocular Image (VISPI), and proposed two new feature extraction techniques to achieve robust and blur invariant biometric verification using periocular images captured by smartphones. Ahuja \textit{et al.~}\cite{AHUJA201717} proposed a hybrid convolution-based model for verifying pairs of periocular RGB images. They composed a hybrid model as a combination of an unsupervised and a supervised CNN, and augment the combination with SIFT model. Diaz \textit{et al.~}\cite{PR-Diaz} proposed a method to apply existing architectures pre-trained on the ImageNet Large Scale Visual Recognition Challenge, to the task of periocular recognition. These networks have proven to be very successful for many other computer vision tasks apart from the detection and classification tasks for which they were designed. They demonstrate that these off-the-shelf CNN features can effectively recognise individuals based on periocular images. More recently, Kumari \textit{et al.~}\cite{KUMARI2019} surveyed periocular biometrics and and provided a deep insight of various aspects, including the periocular region utility as a stand-alone modality, its fusion with iris, its application in the smartphone authentication, and its role in soft biometric classification. In their review, the authors did not mention SR approaches. \section{Proposed method} \label{method} As mentioned in Sect.~\ref{sec:intro} and depicted in Fig.~\ref{workflow}, we focus in this work on a two-stage system. First, we improve the SR approaches for periocular images. Second, we use that improved SR method to enhance the recognition performance of periocular-based biometric systems, in contrast to traditional SR methods. We describe in Sect.~\ref{sec:method:SR} the proposed ESISR technique, and in Sect.~\ref{sec:method:recog} the feature extraction and comparison methods utilised for periocular recognition. \begin{figure*}[] \centering \includegraphics[width=1.0\textwidth]{images/ESISR_proposed.png} \caption{\label{block} Proposed ESISR method.} \end{figure*} \subsection{Stage-1: Super-Resolution} \label{sec:method:SR} In this section, we present an efficient image SR network that is able to recover periocular images from selfies (ESISR). Our network includes two building blocks, as it can be observed in Fig.~\ref{block}: A feature extraction and a reconstruction stage based on DCSCN, which are described in the remaineder of this section. Since SR in general is an image-to-image translation task where the input image is highly correlated with the target image, researchers try to learn only the residuals between them (i.e. global residual learning). This process avoids learning a complicated transformation from a complete image to another. Instead, it only requires learning a residual map to restore the missing high-frequency details. Since most regions' residuals are close to zero, the model complexity and learning difficulty are thus greatly reduced. This local residual learning is similar to ResNet to alleviate the degradation problem caused by ever-increasing network depths, reduce training difficulty, and improve the learning ability. For these reasons, we are using recursive learning to learn higher-level features without introducing an overwhelming number of parameters, which means applying the same modules multiple times. In addition to choosing an appropriate network architecture, the definition of the perceptual loss function is critical for the performance of the proposed method based on the DCSCN network, as mentioned in Sects.~\ref{sec:intro} and~\ref{sec:relate}. While SR is commonly based on the MSE, PSNR, and SSMI metrics, we have designed a loss function that incorporates as well a sharpness measure with respect to perceptually relevant features. The function thus balances between reconstructing images by minimising the difference of the sharpness values and weights the results of SSIM and PSNR. \subsubsection{Pre-processing} The original RGB images captured with a smartphone represent an additive color-space where colors are obtained by a linear combination of Red, Green, and Blue values. The three channels are thus correlated by the amount of light on the surface. In order to avoid such correlations, all the images were converted from RGB to YCbCr. The YCrCb color space is derived from RGB, and separates the luminance and chrominance components into different channels. In particular, it has the following three components: i) Y, Luminance or Luma component obtained from RGB after gamma correction; ii) $Cr = R – Y$, how far is the red component from Luma; and iii) $Cb = B – Y$, how far is the blue component from Luma. We only use $Y$ component in this work because stored the high resolution luminance information. Instead of CbCr that comprises the image information. The periocular image areas were automatically cropped from faces to the size of $250\times200$ pixels. \subsubsection{Feature extraction} As mentioned above, the Y component of the converted image is used as input for our model. Several patches of $32\times32$ and $48\times48$ pixels were extracted from the image and used to grasp the features efficiently. We look for the features that achieve a better trade-off between the number and size of filters of each CNN layer. Seven blocks of $5\times5$ and $3\times3$ have been selected after several experiments. The information is extracted using small convolutional blocks with residual connections and stride convolutions in order to preserve both the global and the fine details in periocular images. Only the final features from $3\times3$ and $5\times5$ pixels are concatenated, following the recursive pixel-shuffle approach (see Fig.~\ref{pixel}). These local skip connections in residual blocks make the network easier to optimise, thereby supporting the construction of deeper networks. A model with transpose convolution instead of pixel-shuffle was trained to explore the quality of the reconstruction images \cite{wang_survey}. See Fig. ~\ref{transpose}. Transpose convolution operates conversely to normal convolution, predicting the input based on feature maps sized like convolution output. It increases image resolution by expanding the image by adding zeros and performing convolution operations. \begin{figure}[t] \centering \includegraphics[width=0.99\linewidth]{images/pixel-shuffle2.png} \caption{\label{pixel} Pixel-shuffle convolution layer that aggregates the feature maps from LR space and builds the SR image in a single step. Based on \cite{ShiCHTABRW16}.} \end{figure} \begin{figure}[t] \centering \includegraphics[width=0.99\linewidth]{images/Transpose_image.png} \caption{\label{transpose} Transpose-convolution operation representation. (a) The starting matrix represents the input image. (b) Expanding operation adds zeros to the images in order to increase the size. c) The convolution operation is performed again in a new resolution. Based on \cite{wang_survey}.} \end{figure} \subsubsection{Reconstruction} Our reconstruction stage uses only one convolutional block with 2 layers (Conv + Relu + Conv) in a recursive path. This block includes $3\times3$ convolutions and pixel-shuffle algorithm (see Fig.~\ref{pixel}) to create a high-resolution image from a low-resolution input. Batch normalisation was removed. An optimised sub-pixel convolution layer that learns a matrix of up-scaling filters to increase the final LR feature maps into the SR output was used. \subsubsection{Perceptual loss function} The ISO/IEC 29794-6\footnote{\url{https://www.iso.org/standard/54066.html}} on iris image quality introduced a set of quality metrics, that can measure the utility of a sample. Based on the NIST IREX evaluation (footnote:https://www.nist.gov/programs-projects/iris-exchange-irex-overview) a sharpness metric was identified as strongly predictive for recognition performance. We follow this finding and measure: \begin{equation} LoG(x,y)=-\frac{1}{\pi\sigma^4} \left[1- \frac{x^2+y^2}{2\sigma^2}\right]e^{-\frac{x^2+y^2}{2\sigma^2}} \label{eq:sharp} \end{equation} The Laplacian of Gaussian operator~(LoG) is thus the sharpness metric used in this work. Calculation of the sharpness of an image is determined by the power resulting from filtering the image with a Laplacian of Gaussian kernel. The standard deviation of the Gaussian is 1,4. Now, it is important to highlight that the loss function aims to improve the quality of the reconstruction. To that end, we combine the SSIM and PSNR classical SR metrics with the sharpness metric for iris images recommended, as follows: \begin{equation} \begin{split} L(I_{LR},I_{HR})&= 0.5\cdot \mathrm{LoG}\left(I_{LR}, I_{HR}\right) \cdot [0.25\cdot \mathrm{SSIM}\left(I_{LR},I_{HR}\right) \\ &+ 0.25\cdot \mathrm{PSNR}\left(I_{LR},I_{HR}\right)] \label{eq:loss} \end{split} \end{equation} where $I_{LR}$ represents a low-resolution image, $I_{HR}$ the corresponding high-resolution image recovered, and LoG the sharpness as defined in Eq.~\ref{eq:sharp}. The best values of the weights for each specific metric (i.e., 0.25, 0.25 and 0.50) were estimated in a grid search with a train dataset. \subsection{Stage-2: Periocular recognition} \label{sec:method:recog} Most traditional methods in the state-of-the-art are based on machine learning techniques with different feature extraction approaches such as HOG, LBP, and BSIF, or the fusion of some of them \cite{KUMARI2019}. However, today we have powerful pre-trained deep learning methods based on facial images. Using transfer learning techniques, the information extracted from some layers using fine-tuning techniques or embedding approaches could be suitable to perform periocular verification. This is the approach followed in this work. This task involves information from periocular images estimating an eye embedding vector for a new given eye from a selfie image. An eye embedding is a vector that represents the features extracted from the eyes periocular images. This comparison occurs using euclidean distance to verify if the distance is below a predefined threshold, often tuned for a specific dataset or application. For this paper, a VGGFace~\cite{Parkhi15}, FaceNet~\cite{facenet} and ArcFace ~\cite{deng2018arcface} models have been used as a feature extractor for periocular recognition. Also a comparison with BSIF handcrafted featured is included. \section{Experimental Setup} \label{experiments} \subsection{Experimental Protocol} In order to assess the soundness of the proposed method, we focus on a twofold objective: i) evaluate the SR approaches, and ii) analyse selfie periocular recognition systems using those SR techniques. \textbf{Super-resolution models}. First, we have trained the DCSCN, WDSR-A, and SRGAN methods as a baseline for benchmarking purposes. The main properties and default parameters of those methods are summarised in the following: \begin{itemize} \item \textit{DCSCN}: Number of CNN layers = 12, Number of first CNN filters = 196, Number of last CNN filters = 48, Decay Gamma = 1.5, Self Ensemble = 8, Batch images for training epoch = 24,000, Dropout rate = 0.8, Optimiser function = Adam, Image size for each Batch = 48, Epochs = 100, Early stopping = 10. \item \textit{WDSR-A}: Number of residual blocks = 8, Number of CNN layers in the main branch = 6, Number of expansion of residual blocks = 4, Number of filters main branch = 64, Number of filters residual blocks = 256, Activation function = Relu, Optimisation Function = Adam, Learning Rate = 1e-4 and 1-e-5, Beta = 1e-7, Size of batch images = 96, Number of steps = 60,000. \item \textit{SRGAN}: The network has two modules: \begin{itemize} \item \textit{Generator}: This stage is used for learning the inverse function for downsampling the image and to generate the LR images from their corresponding HR, based in a pre-trained VGG-54. The following parameters are used: Number of residual blocks = 16, Number of CNN layers with residual blocks = 2, activation function residual block = PRelu, Kernel size residual block = 3, CNN layers = 3, kernel size = 9, 3 and, 9. Filters numbers = 64, Optimisation function = Adam, Learning rate = 1e-4 and 1e- 5, batch image size = 96, Steps = 100,000, mini size batches = 16. \item \textit{Discriminator}: In order to evaluate the similarity between the images generated by the SR generator (VGG-54) and the HR images, the discriminator is trained with the following parameters: CNN layers = 8, Filter numbers:64, 64, 128, 128, 256, 256, 512 and 512. Kernel size = 3, activation function = Relu, Momentum batch normalisation = 0.8, Optimisation function = Adam, Learning Rate = 1e-5 and, 1e-6, Batch size = 16, Steps = 100,000. \end{itemize} \end{itemize} Subsequently, we evaluated our ESISR method using the pixel-shuffle technique \cite{pixel_shuffle}. The best parameters for our approach were: Number of CNN layers = 7, Number of first CNN filters = 32, Number of last CNN filters = 8, Decay Gamma = 1.2, Self Ensemble = 8, Batch images for training epoch = 24,000, Dropout rate = 0.5, Optimiser function = Adam, Image size for each Batch = 32, Epochs= 100, Early stopping = 10. We further improved the efficiency of our proposal by using the transpose convolution instead of pixel-shuffle. In all experiments, we assess the quality of the produced SR images using the sharpness function defined in Eq.~\ref{eq:sharp}, and the efficiency in terms of the number of features and parameters. It should be noted that the True Sharpness represents the sharpness of the original image~((prior to downsampling), and Output Sharpness represents the sharpness of the reconstructed high resolution image created by ESISR. Therefore, the goal is to achieve an Output Sharpness as close as possible to the True Sharpness. From those experiments, we selected the configuration achieving the best performance. All methods were trained using the Samsung database and tested with the SET-5E dataset. \vspace*{0.2cm} \textbf{Periocular SR verification}. We then extract the embedded information from selfie periocular images and compare the results with a handcrafted method for the periocular verification system. Afterwards, feature extraction was applied to the best super-resolved images using x2, x3, and x4 increased sizing, and it was compared with the same sizes but using traditional methods such as inter-area, lineal, and cubic. All the SR methods for periocular verification were tested using the MobBIO and NTNU datasets, which are different from the ones used to train the SR stage in order to grant unbiased results. BSIF handcrafted features were used to extract textural information. An exhaustive exploration of the 60 filters was made. The image was divided into two rows and three columns. For each patch, a histogram was estimated. The concatenation of all the histograms represents the final vector. In this case, the $5\times5$-5, $9\times9$-5 and $11\times11$-5 bits show the best performances. In more details, the FaceNet, VGGFace, and ArcFace pre-trained models were used to extract the embedding information. For FaceNet the feature vector has a size of 1,722 and input size image of $224 \times 224 \times 3$. For VGGFace, the feature vector has a size of 2,048 and input size image of $224 \times 224 \times 3$. ArcFace inputs have a size of 512 an input size of $112 \times 112 \times 3$. A PC with Intel I7, 32 GB RAM, and GPU-1080TI was used for train all the stand-alone SR model. \subsection{Databases} In order to analyse the performance of the SR algorithm, four databases were used. A new dataset was acquired in a collaborative effort with subjects from different countries with Samsung smartphones using an app specially designed for this purpose: \url{visualselfie.org}\footnote{Only available from smartphones}. This app was designed in order to capture different variations of selfie scenarios in three distances, as depicted in Fig.~\ref{selfie}. More specifically, 800 images were selected to be used for training and 100 for testing\footnote{A similar number of images are used in the state-of-the-art for general-purpose methods; e.g. the DIV2K database}. From the training dataset, 228,700 patches of $48\times48$ px.\ were created for experiment 2 and $32\times32$ for experiment 3. \begin{figure}[t] \centering \includegraphics[width=0.9\linewidth]{images/faces_examples.png} \caption{\label{selfie} Example of Samsung databases. Left: closest position. Middle: half arm extended. Right: full arm extended.} \end{figure} A second dataset, \textit{Set-5E}, was created to validate the results. This database has 100 images from different subjects acquired with different smartphones extracted from the CSIP database in the visual spectrum ~\cite{SANTOS}. It has 2004 images, stemming from 50 subjects over 10 different mobile setups. A third database MobBIO was used to super-resolved the size of the images with the best pre-trained super-resolution model~(ESISR). It was also used to measure the performance of the periocular verification system. The MobBIO dataset comprises the biometric data from 152 volunteers. Each subject provided samples of face, iris, and voice. There are on average 8 images for each subject from a NOKIA N93i mobile. Some examples are presented in Fig.~\ref{mobio}. \begin{figure}[h] \centering \includegraphics[width=0.24\linewidth]{images/modbio_1.png} \includegraphics[width=0.24\linewidth]{images/modbio_2.png} \includegraphics[width=0.24\linewidth]{images/modbio_3.png} \includegraphics[width=0.24\linewidth]{images/modbio_4.png} \caption{MOBBIO database examples.} \centering \label{mobio} \end{figure} The last database is VISPI, captured by NTNU, which was used to measure the performance of the periocular verification system~\footnote{VISPI will be denoted as NTNU database}. The NTNU dataset comprises the biometric data from 152 volunteers and 3,139 total images. Each subject provided samples of left and right iris. There are in average 11 images for each subject from a NOKIA N93i mobile. Some examples are presented in Fig.~\ref{ntu_side}. \begin{figure}[H] \centering \includegraphics[scale=0.40]{images/New_images/NTU_images/NTU_side.png} \caption{NTNU database examples.} \centering \label{ntu_side} \end{figure} \section{Results and Discussion} \label{sec:results} \begin{table*}[] \centering \caption{Summary of the results for 3 different scales (x2, x3, and x4) for our system (ESISR) with different configurations and the benchmark with DCSCN, WDSR-A, and SRGAN. True Sharpness denotes the sharpness for the original image (LR), and Output Sharpness the sharpness for reconstructed SR images.} \label{tab:table1} \begin{tabular}{lcccccccc} \toprule \textbf{Method} & \textbf{Conv.} & \textbf{\# Features} & \textbf{Scale} & \textbf{\# Param} & \textbf{PSNR} & \textbf{SSIM} & \textbf{True Sharp.} & \textbf{Output Sharp.} \\ \midrule \multirow{3}{*}{DCSCN \cite{yamanaka}}& \multirow{3}{*}{} & \multirow{3}{*}{1,301} & x2 & 1,754,942 & 37.11. & 0.95 & 17.04 & 16.85 \\%\cline{4-9} & & & x3 & 2,170,142 & 32.82 & 0.91 & 18.05 & 16.45 \\%\cline{4-9} & & & x4 & 2,087,102 & 30.52 & 0.86 & 16.90 & 12.47 \\ \midrule \multirow{3}{*}{WDSR-A \cite{yu}} & \multirow{3}{*}{}&\multirow{3}{*}{} & x2 & 597,000 & 47.87& 0.98 & 17.04 & 10.89 \\%\cline{4-9} & Pixel-shuffle & & x3 & 603,000 & 46.59 & 0.97 & 18.05 & 10.82 \\ & & & x4 & 610,000 & 43.92 & 0.94 & 16.90 & 10.72 \\ \midrule \multirow{3}{*}{SRGAN \cite{ledig}} & \multirow{3}{*}{} & \multirow{3}{*}{} & x2 & 24.864.000 & 39.66 & 0.96 & 17.04 & 10.82 \\%\cline{4-9} & Pixel-shuffle & & x3 & 25.131.000 & 38.72 & 0.94 & 18.05 & 10.95 \\ & & & x4 & 26.930.000 & 34.09 & 0.88 & 16.90 & 10.64 \\ \midrule \multirow{3}{*}{ESISR-1} & \multirow{3}{*}{Pixel-shuffle 48x48}& \multirow{3}{*}{1,000} &x2 & 27,209 & 36.49& 0.95 & 17.04& 16.70 \\ & & &x3 & 28,654 & 32.89& 0.90 & 18.05& 16.01 \\ & & &x4 & 64,201 & 29.08& 0.86 & 16.90& 12.00 \\ \midrule \multirow{3}{*}{ESISR-2} & \multirow{3}{*}{Pixel-shuffle 32x32}& \multirow{3}{*}{131} & x2& 27,209 & 38.91& 0.90 & 17.04& 15.43 \\ & & & x3& 28,654 & 36.78& 0.85 & 18.05& 15.46 \\ & & & x4& 64,201 & 35.47& 0.81 & 16.90& 16.34 \\ \midrule \multirow{3}{*}{ESISR-3} & \multirow{3}{*}{Transpose Convolution} & \multirow{3}{*}{131} & x2& 100,316 & 35.52& 0.81 & 17.04 & 14.38 \\ & & & x3& 109,564 & 36.84& 0.85 & 18.05 & 15.06 \\ & & & x4& 100,318 &35.52 & 0.81 & 16.90& 16.14 \\ \bottomrule \end{tabular} \end{table*} \subsection{Super-resolution models} \label{sec:SRmodels} First, we establish a baseline by testing the DCSCN, WSDR-A, and SR-GAN models with their default parameters. Then, we analyse our proposal (ESISR-X) using \emph{pixel-shuffle} and the new loss function including the Sharpness metric (see Eqs.~\ref{eq:sharp} and~\ref{eq:loss}). Table~\ref{tab:table1} summarises the results: Rows 1-3 show the results for traditional SR methods (DSCN with 12 layers and $96\times96$ patches, WDSR-A with 8 residual blocks and $62\times62$ patches, SR-GAN with 16 residual blocks and $96\times96$ patches); and rows 4 to 6 present the results of our proposed method: ESISR-1 using the pixel-shuffle algorithm with only 7 convolutions layers and $48\times48$ patches, ESISR-2 using the pixel-shuffle algorithm with only 7 convolutions layers and $32\times32$ patches, and ESISR-3 using the transposed convolution algorithm with only 7 convolutions layers. Observing the results, we note that all the image enlargement x2, x3, and x4 extract the same number of features for each method (i.e., 1,301 for DCSNN and 1,000 for ESISR). The more considerable difference lies on the number of parameters of each method: while DCSCN, WSDR-A, and SR-GAN methods need a large number of parameters (for images increased by x2, 1,754,942, 597,000, and 24,864,000; for images increased by x3, 2,170,142, 603,000, and 25.131.000; and for images increased for x4, 2,087,102, 610,000, and 26,939,000), these numbers are drastically reduced by the our ESISR-1 proposed method, which needs only 27.209 parameters when the image is increased by x2, 28.654 parameters when increased by x3, and 64.201 parameters when increased by x4\footnote{Sample images are shown in the Appendix, Fig. \ref{fig:sr_example}}. In addition to that gain in terms of efficiency, we may observe in Table~\ref{tab:table1} that the newly proposed loss function based on sharpness allows us to get a good reconstruction. The Output sharpness for each scale value is similar to the values obtained by DSCN (e.g. 16.85 \textit{vs}.\ 16.70 for x2), and also close to the target True Sharpness of 17.04. Therefore, we may conclude that the proposed method keeps the sharpness quality of the images, thereby making it suitable for SR applications for mobile devices. In addition to the baseline configuration of ESISR-1, we also evaluated two additional approaches. First, the most efficient implementation of ESISR with a big reduction of features (down to 131) and a number of parameters with pixel-shuffle and $32\times32$ was analysed (Table~\ref{tab:table1}, row 5). Then, we also tested the method using \emph{transposed convolution} with the same number of 131 features (Table~\ref{tab:table1}, row 6). The Transpose convolutions layer is an inverse convolutions layer that will both up-sample input and learn how to fill in details during the model training process, at the cost of increasing the number of parameters (i.e., less efficient than pixel-shuffling). As we may observe in Table~\ref{tab:table1}, the pixel-shuffle with $32\times32$ px.\ uses the same number of parameters as with $48\times48$ px. In contrast, the transposed convolution requires 100,316 parameters when the image is increased by 2 (x2), 109,564 parameters when increased by 3 (x3), and 100,318 parameters when increased by 4 (x4). In spite of this increase, the ESISR is still 10 to 20 times more efficient than the traditional DCSCN. Regarding the quality of the SR iris images, we can observe that both configurations tested in this last experiment (row 5-6) achieve a similar sharpness for the x3 and x4 scale values (14.43, 14.38, 15.46 and 16.32), but not for x2. In the latter case, the pixel-shuffle approach clearly outperforms the transpose-convolution method (15.43 \textit{vs}.\ 14.38). The lower result of reconstruction was reached for the SRGAN method with a higher number of parameters and a relevant difference of the value of output sharpness\footnote{Reconstruction examples are presented in the Appendix}. \subsection{Periocular SR verification} We now evaluate the periocular verification systems including the SR methods analysed in the previous section. In order to assess the quality of the super-resolved images, the MobBIO and NTNU datasets were used to evaluate the reconstruction performance with the best SR method proposed in Sect. \ref{sec:SRmodels}, namely ESISR with pixel-shuffle. Figs.~\ref{DETs-sr-mobio-ntu1} and \ref{DETs-sr-mobio-ntu2} show the DET curves of the periocular verification system for MobBIO and NTNU datasets with a standard resolution (Resolution x1) in comparison with SR images resized by x2, x3, and x4 using the ESISR method. The results show VGGFace, FaceNet, ArcFace and three different BSIFs filters with equal error rates for each one. An essential fact that we can see in Figures ~\ref{DETs-sr-mobio-ntu1} and \ref{DETs-sr-mobio-ntu2}, in this case, is that SR methods help maintain the recognition accuracy when selfies are captured at different distances instead of improving the eye recognition performance. \begin{figure*}[] \centering \includegraphics[width=0.43\linewidth]{images/New_images/SR_plot/MOBBIO_x1_sr_det_plot_2.png} \includegraphics[width=0.43\linewidth]{images/New_images/SR_plot/NTNU_x1_sr_det_plot_2.png} \includegraphics[width=0.43\linewidth]{images/New_images/SR_plot/MOBBIO_x2_sr_det_plot.png} \includegraphics[width=0.43\linewidth]{images/New_images/SR_plot/NTNU_x2_sr_det_plot_2.png} \caption{DET curves for MobBIO and NTNU datasets using the SR method (x1 and x2) and including periocular recognition systems based on deep learning and handcrafted features (BSIF). The EER is shown in parenthesis for each technique.} \label{DETs-sr-mobio-ntu1} \end{figure*} \begin{figure*}[] \centering \includegraphics[width=0.45\linewidth]{images/New_images/SR_plot/MOBBIO_x3_sr_det_plot_2.png} \includegraphics[width=0.45\linewidth]{images/New_images/SR_plot/NTNU_x3_sr_det_plot_2.png} \includegraphics[width=0.45\linewidth]{images/New_images/SR_plot/MOBBIO_x4_sr_det_plot_2.png} \includegraphics[width=0.45\linewidth]{images/New_images/SR_plot/NTNU_x4_sr_det_plot_2.png} \caption{DET curves for MobBIO and NTNU datasets using the SR method (x3 and x4) and including periocular recognition systems based on deep learning and handcrafted features (BSIF). The EER is shown in parenthesis.}. \label{DETs-sr-mobio-ntu2} \end{figure*} For images with a standard resolution (Resolution x1), VGGFace obtained the best results with an EER of 16.12\% using the MobBIO dataset. The best results were obtained for images from NTNU FaceNet with an EER of 8.89\%. For images with an SR x2, x3 and x4, FaceNet outperforms VGGFace and ArcFace. Obtained an 8.92\%, 8.86\% and 9.33\% for the NTNU dataset. Conversely, MobBIO reached the lowest results. SR methods x2, x3 and x4 yielded 17.93\%, 19.45\% and 22.52\% respectively. Regarding BSIF, the three proposed filters reached a lower performance with EERs over 20\%. ArcFace obtained the worse results for the deep learning method for both datasets. It is essential to highlight that the three scales keep the periocular verification quality based on the proposed perceptual sharpness loss. Thus, a weighted perceptual loss help to keep the quality of the images based on Sharpness metrics. This metric is more suitable for applying periocular iris images with SR than the traditional SNR and SSIM. Table~\ref{tab:Results_mobio_ntnu} (top) shows the results for MobBIO Dataset and present different sizes of SR images increased by a factor of x2, x3, and x4 and its benchmark with the pre-trained FaceNet VGGFace, ArcFace and BSIF filters as a feature extractor. Also, three resized operations were explored, analysed and compared when used in super-resolution techniques, Inter-lineal, Inter-cubic, or Inter-area resized. The results reach slightly change when used on the super-resolution process\footnote{A benchmark with traditional resizing methods such as InterArea, InterCubic and InterLineal was performed DET curves are shown in the Appendix}. We can observe that the features extracted from Deep learning methods (embeddings) performed better than BSIF filters. Overall, FaceNet reached the best results in all the models with x2, x3 and x4 in comparison with VGGFace in NTNU dataset. This result is interesting for high-security applications since operating points are usually defined at small FMR values. The results are related to the size of the embedded vector extracted from the pre-trained model. The features extracted from FaceNet are more representative and general-purpose than for VGGFace and ArcFace. Table~\ref{tab:Results_mobio_ntnu} (bottom) shows the results for NTNU Dataset and present different sizes of SR images increased by a factor of x2, x3, and x4 and its benchmark with the pre-trained FaceNet VGGFace, ArcFace and BSIF filters as a feature extractor. In addition, a comparison with traditional resize methods such as InterArea, InterCubic and InterLineal were performed. Column one shows the name of all techniques explored. Column 4 up to column 6 show the results of the best BSIF filters selected. The results reported show the EER and False Not Match Rate (FNMR) based on False Match Rate (FMR) at 10\%. \begin{table*}[] \centering \caption{MobBIO (top) and NTNU (bottom) Verification results with No resizing (resolution x1), interArea, interCubic, and interLineal. Both EER and FNMR are presented in \%, and FNMR is given at FMR = 10\%.} \label{tab:Results_mobio_ntnu} \begin{tabular}{|ccccccccccccc|} \toprule \multicolumn{13}{c}{MobBIO Dataset} \\ \midrule \multicolumn{1}{c}{} & \multicolumn{2}{|c|}{FaceNet} & \multicolumn{2}{c|}{VGGFace} & \multicolumn{2}{c|}{ArcFace} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}BSIF\\ 5x5\_5bits\end{tabular}} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}BSIF\\ 9x9\_5bits\end{tabular}} & \multicolumn{2}{c}{\begin{tabular}[c]{@{}c@{}}BSIF\\ 11x11\_5bits\end{tabular}} \\ \midrule \multicolumn{1}{l}{SR Method} & \multicolumn{1}{|c}{\begin{tabular}[c]{@{}c@{}}EER\end{tabular}} & \multicolumn{1}{c|}{FNMR} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}EER\end{tabular}} & \multicolumn{1}{c|}{FNMR} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}EER\end{tabular}} & \multicolumn{1}{c|}{FNMR} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}EER\end{tabular}} & \multicolumn{1}{c|}{FNMR} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}EER\end{tabular}} & \multicolumn{1}{c|}{FNMR} & \multicolumn{1}{c}{\begin{tabular}[c]{@{}c@{}}EER\end{tabular}} & \multicolumn{1}{c}{FNMR} \\ \midrule \multicolumn{1}{l|}{\textbf{No Redimension}} & \multicolumn{1}{c}{\textbf{16.52}} & \multicolumn{1}{c|}{16.83} & \multicolumn{1}{c}{\textbf{16.12}} & \multicolumn{1}{c|}{16.67} & \multicolumn{1}{c}{\textbf{22.90}} & \multicolumn{1}{c|}{23.16} & \multicolumn{1}{c}{\textbf{18.65}} & \multicolumn{1}{c|}{20.50} & \multicolumn{1}{c}{\textbf{20.00}} & \multicolumn{1}{c|}{20.50} & \multicolumn{1}{c}{\textbf{20.86}} & \multicolumn{1}{c}{21.00} \\ \midrule \multicolumn{1}{l|}{Inter-Area x2} & \multicolumn{1}{c}{16.17} & \multicolumn{1}{c|}{16.16} & \multicolumn{1}{c}{16.00} & \multicolumn{1}{c|}{15.83} & \multicolumn{1}{c}{22.62} & \multicolumn{1}{c|}{\textbf{22.50}} & \multicolumn{1}{c}{20.72} & \multicolumn{1}{c|}{20.66} & \multicolumn{1}{c}{20.68} & \multicolumn{1}{c|}{20.83} & \multicolumn{1}{c}{21.57} & \multicolumn{1}{c}{21.33} \\ \multicolumn{1}{l|}{Inter-Cubic x2} & \multicolumn{1}{c}{16.00} & \multicolumn{1}{c|}{16.16} & \multicolumn{1}{c}{16.33} & \multicolumn{1}{c|}{15.83} & \multicolumn{1}{c}{22.12} & \multicolumn{1}{c|}{22.00} & \multicolumn{1}{c}{20.97} & \multicolumn{1}{c|}{20.66} & \multicolumn{1}{c}{19.86} & \multicolumn{1}{c|}{20.83} & \multicolumn{1}{c}{21.33} & \multicolumn{1}{c}{21.33} \\ \multicolumn{1}{l|}{Inter-Lineal x2} & \multicolumn{1}{c}{17.71} & \multicolumn{1}{c|}{17.16} & \multicolumn{1}{c}{16.00} & \multicolumn{1}{c|}{15.83} & \multicolumn{1}{c}{23.67} & \multicolumn{1}{c|}{23.66} & \multicolumn{1}{c}{22.79} & \multicolumn{1}{c|}{22.83} & \multicolumn{1}{c}{20.87} & \multicolumn{1}{c|}{21.16} & \multicolumn{1}{c}{21.56} & \multicolumn{1}{c}{21.33} \\ \multicolumn{1}{l|}{\textbf{ESISR x2}} & \multicolumn{1}{c}{\textbf{17.93}} & \multicolumn{1}{c|}{17.83} & \multicolumn{1}{c}{\textbf{16.48}} & \multicolumn{1}{c|}{16.33} & \multicolumn{1}{c}{\textbf{23.41}} & \multicolumn{1}{c|}{23.33} & \multicolumn{1}{c}{\textbf{23.10}} & \multicolumn{1}{c|}{23.00} & \multicolumn{1}{c}{\textbf{22.26}} & \multicolumn{1}{c|}{22.33} & \multicolumn{1}{c}{22.50} & \multicolumn{1}{c}{22.50} \\ \midrule \multicolumn{1}{l|}{Inter-Area x3} & \multicolumn{1}{c}{20.67} & \multicolumn{1}{c|}{19.66} & \multicolumn{1}{c}{15.67} & \multicolumn{1}{c|}{15.66} & \multicolumn{1}{c}{24.75} & \multicolumn{1}{c|}{24.83} & \multicolumn{1}{c}{28.68} & \multicolumn{1}{c|}{28.66} & \multicolumn{1}{c}{20.65} & \multicolumn{1}{c|}{20.83} & \multicolumn{1}{c}{21.41} & \multicolumn{1}{c}{21.50} \\ \multicolumn{1}{l|}{Inter-Cubic x3} & \multicolumn{1}{c}{17.67} & \multicolumn{1}{c|}{18.16} & \multicolumn{1}{c}{16.00} & \multicolumn{1}{c|}{16.00} & \multicolumn{1}{c}{24.12} & \multicolumn{1}{c|}{24.16} & \multicolumn{1}{c}{23.97} & \multicolumn{1}{c|}{23.50} & \multicolumn{1}{c}{21.07} & \multicolumn{1}{c|}{20.66} & \multicolumn{1}{c}{22.04} & \multicolumn{1}{c}{22.00} \\ \multicolumn{1}{l|}{Inter-Lineal x3} & \multicolumn{1}{c}{19.00} & \multicolumn{1}{c|}{18.66} & \multicolumn{1}{c}{16.00} & \multicolumn{1}{c|}{15.50} & \multicolumn{1}{c}{25.91} & \multicolumn{1}{c|}{25.83} & \multicolumn{1}{c}{21.19} & \multicolumn{1}{c|}{26.66} & \multicolumn{1}{c}{26.65} & \multicolumn{1}{c|}{21.16} & \multicolumn{1}{c}{22.36} & \multicolumn{1}{c}{22.50} \\ \multicolumn{1}{l|}{\textbf{ESISR x3}} & \multicolumn{1}{c}{\textbf{19.45}} & \multicolumn{1}{c|}{19.50} & \multicolumn{1}{c}{\textbf{18.05}} & \multicolumn{1}{c|}{17.87} & \multicolumn{1}{c}{\textbf{24.52}} & \multicolumn{1}{c|}{24.50} & \multicolumn{1}{c}{\textbf{23.94}} & \multicolumn{1}{c|}{23.83} & \multicolumn{1}{c}{\textbf{21.54}} & \multicolumn{1}{c|}{21.50} & \multicolumn{1}{c}{\textbf{21.61}} & \multicolumn{1}{c}{21.83} \\ \midrule \multicolumn{1}{l|}{Inter Area x4} & \multicolumn{1}{c}{27.00} & \multicolumn{1}{c|}{27.66} & \multicolumn{1}{c}{19.50} & \multicolumn{1}{c|}{19.83} & \multicolumn{1}{c}{27.65} & \multicolumn{1}{c|}{27.50} & \multicolumn{1}{c}{43.48} & \multicolumn{1}{c|}{43.33} & \multicolumn{1}{c}{21.77} & \multicolumn{1}{c|}{21.83} & \multicolumn{1}{c}{22.41} & \multicolumn{1}{c}{22.50} \\ \multicolumn{1}{l|}{Inter-Cubic x4} & \multicolumn{1}{c}{22.00} & \multicolumn{1}{c|}{21.50} & \multicolumn{1}{c}{19.00} & \multicolumn{1}{c|}{18.66} & \multicolumn{1}{c}{27.67} & \multicolumn{1}{c|}{27.16} & \multicolumn{1}{c}{27.34} & \multicolumn{1}{c|}{27.33} & \multicolumn{1}{c}{21.31} & \multicolumn{1}{c|}{21.66} & \multicolumn{1}{c}{22.31} & \multicolumn{1}{c}{22.67} \\ \multicolumn{1}{l|}{Inter-Lineal x4} & \multicolumn{1}{c}{23.00} & \multicolumn{1}{c|}{23.00} & \multicolumn{1}{c}{18.00} & \multicolumn{1}{c|}{18.33} & \multicolumn{1}{c}{28.06} & \multicolumn{1}{c|}{28.33} & \multicolumn{1}{c}{29.59} & \multicolumn{1}{c|}{29.83} & \multicolumn{1}{c}{23.22} & \multicolumn{1}{c|}{23.16} & \multicolumn{1}{c}{23.13} & \multicolumn{1}{c}{23.00} \\ \multicolumn{1}{l|}{\textbf{ESISR x4}} & \multicolumn{1}{c}{\textbf{22.52}} & \multicolumn{1}{c|}{22.50} & \multicolumn{1}{c}{\textbf{18.01}} & \multicolumn{1}{c|}{18.00} & \multicolumn{1}{c}{\textbf{27.11}} & \multicolumn{1}{c|}{27.00} & \multicolumn{1}{c}{\textbf{27.82}} & \multicolumn{1}{c|}{28.00} & \multicolumn{1}{c}{\textbf{23.12}} & \multicolumn{1}{c|}{23.33} & \multicolumn{1}{c}{\textbf{22.27}} & \multicolumn{1}{c}{22.50} \\ \bottomrule \end{tabular} \vspace*{0.5cm} \begin{tabular}{l|cc|cc|cc|cc|cc|cc} \toprule \multicolumn{13}{c}{NTNU Dataset} \\ \midrule & \multicolumn{2}{c|}{FaceNet} & \multicolumn{2}{c|}{VGGFace} & \multicolumn{2}{c|}{ArcFace} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}BSIF\\ 5x5\_5bits\end{tabular}} & \multicolumn{2}{c|}{\begin{tabular}[c]{@{}c@{}}BSIF\\ 9x9\_5bits\end{tabular}} & \multicolumn{2}{c}{\begin{tabular}[c]{@{}c@{}}BSIF\\ 11x11\_5bits\end{tabular}} \\ \midrule SR Method & EER & FNMR & EER & FNMR & EER & FNMR & EER & FNMR & EER & FNMR & EER & FNMR \\ \midrule \textbf{No Redimension} & \textbf{8.89} & 8.88 & \textbf{12.14} & 12.10 & \textbf{12.81} & 12.79 & \textbf{10.61} & 10.60 & \textbf{10.84} & 10.92 & \textbf{9.94 } & \multicolumn{1}{l}{10.12} \\ \midrule Inter-Area x2 & 8.55 & 8.52 & 12.42 & 12.38 & 12.36 & 12.40 & 10.46 & 10.47 & 9.76 & 9.77 & 10.73 & 10.74 \\ Inter-Cubic x2 & 8.52 & 8.53 & 11.66 & 11.64 & 12.49 & 12.46 & 10.49 & 10.49 & 9.91 & 9.92 & 10.77 & 10.78 \\ Inter-Lineal x2 & 8.74 & 8.74 & 12.39 & 12.28 & 12.44 & 12.43 & 11.00 & 11.00 & 9.82 & 9.83 & 10.71 & 10.67 \\ \textbf{ESISR x2} & \textbf{8.92} & 8.91 & \textbf{11.46} & 11.47 & \textbf{13.07} & 13.10 & \textbf{11.50} & 11.54 & \textbf{11.11} & 11.11 & \textbf{10.69} & 10.70 \\ \midrule Inter-Area x3 & 12.06 & 12.07 & 12.51 & 12.51 & 12.94 & 12.93 & 12.29 & 12.75 & 12.69 & 12.70 & 11.72 & 11.72 \\ Inter-Cubic x3 & 12.49 & 12.38 & 12.91 & 12.90 & 13.03 & 13.04 & 12.17 & 12.28 & 12.85 & 12.84 & 12.09 & 12.12 \\ Inter-Lineal x3 & 12.86 & 12.86 & 12.49 & 12.48 & 12.88 & 12.87 & 12.19 & 21.19 & 12.30 & 12.28 & 11.28 & 11.27 \\ \textbf{ESISR x3} & \textbf{8.85} & 8.84 & \textbf{11.71} & 11.70 & \textbf{13.30} & 13.29 & \textbf{11.67} & 11.66 & \textbf{10.30} & 10.29 & \textbf{10.91} & 10.89 \\ \midrule Inter Area x4 & 16.59 & 16.58 & 13.45 & 12.51 & 14.51 & 14.54 & 13.25 & 13.24 & 12.05 & 12.06 & 11.51 & 11.52 \\ Inter-Cubic x4 & 18.31 & 18.30 & 14.68 & 14.66 & 14.49 & 14.47 & 13.94 & 13.94 & 12.60 & 12.60 & 12.06 & 12.06 \\ Inter-Lineal x4 & 18.94 & 16.92 & 13.50 & 13.51 & 14.57 & 14.57 & 15.18 & 15.16 & 11.90 & 11.89 & 10.99 & 10.98 \\ \textbf{ESISR x4} & \textbf{9.32} & 9.32 & \textbf{11.24} & 11.23 & \textbf{12.93} & 12.92 & \textbf{12.75} & 12.75 & \textbf{10.77} & 10.77 & \textbf{10.66} & 10.65 \\ \bottomrule \end{tabular} \end{table*} \section{Conclusion} \label{conclusions} In this paper, we have proposed an efficient and accurate image super resolution method focused on the generation of enhanced eyes images for periocular verification purposes using selfie images. To that end, we developed a two-stage approach based on a CNN with pixel-shuffle, a new loss function based on a sharpness metric (see Eq.~\ref{eq:sharp}), derived from the ISO/IEC 29794-6 standard for iris quality, and a selfie periocular verification proposal. In the feature extraction stage of our method, the structure of the CNN model extracts optimised features, which are subsequently sent to the reconstruction network. In this latter network, we only used a recursive convolutional block with pixel-shuffle to obtain a better reconstruction performance with reduced computational requirements. In addition, the model is designed to be capable of processing original size images. Using these techniques, our model can achieve state-of-the-art performance with a fewer number of parameters (from the state-of-the-art DSCN with 2 million parameters, we achieve a comparable quality with 27,000 parameters). The perceptual loss function based on image sharpness that we propose allows us to keep the sharpness of iris images in the reconstructed images by x2, x3, and x4. This approach to improving the quality of the reconstruction and the SR in periocular recognition systems is well suited for implementation in mobile devices. Regarding periocular verification system, as expected, the deep learning method's yielded better results than handcrafted methods. FaceNet achieved the best results in comparison to VGGFace and ArcFace. An EER of 8.7\% without SR and 9.2\% for x2, 8.9\% for x3, and 9.5\% for x4 was obtained, respectively. Conversely, a slight performance was reached when VGGFace was used. An EER of 10.05\% without SR and 9.94\% for x2, 9.92\% for x3, and 9.90\% for x4, respectively. Overall, there are marginal improvements for verification systems when only the size of the images is considered in combination with SR images. The information extracted with an embedded vector from the periocular area with a pre-trained model has a high quality of data for verification than BSIF because of the huge number of filters used during the training process. The uncontrolled conditions such as sunlight, occlusions, rotations, or the number of people in an image when a remote selfie is captured could be more challenging than the image size for RGB selfie images. This improvement to NIR iris images must be studied in a separate work. Those uncontrolled conditions need to be examined to improve the selfie periocular verification systems. In this research, SR helps maintaining the recognition accuracy when selfies are captured at different distances. That is, in realistic scenarios in contrast to fully controlled conditions. Our system was tested on images acquired at three different distances and obtained similar results to a baseline system with a unique acquisition distance, even when the selfie was resize using SR with x2, x3 and x4. In future work, we will continue to collect images to train a specific periocular verification system based on CNN from scratch and/or using transfer-domain techniques. Concerning the number of images, we believe that if we use state-of-the-art pre-trained models, the machine learning-based methods could be replaced by the CNN models. The selection of the pre-trained models should be taken into account. \section*{Acknowledgements} European Union’s Horizon 2020 research and innovation program under grant agreement 883356, the DFG-ANR RESPECT Project (406880674), and the German Federal Ministry of Education and Research and the Hessian Ministry of Higher Education, Research, Science and the Arts within their joint support of the National Research Center for Applied Cybersecurity ATHENE. \bibliographystyle{IEEEtran} \section{Introduction} \IEEEPARstart{I}ris recognition systems has been shown to be robust over time, affordable, non-invasive, and touchless; these strengths will allow it to grow in the market in the coming years. Iris recognition systems are usually based on near-infrared (NIR) lighting and sensors, and have been shown to be susceptible to Presentation Attack Instruments (PAI)~\cite{OpenSource}, where PAI refers to a biometric characteristic or object used in a presentation attack. Presentation Attack Detection (PAD) refers to the ability of a biometric system to recognize PAIs, that would otherwise fool the system into recognizing an illegitimate user as a genuine one, by means of presenting a synthetic forged version of the original biometric trait to the capture device. The biometric community, including researchers and vendors, have thrown themselves into the challenging task of proposing and developing efficient protection mechanisms against this threat~\cite{Galbally}. PAD methods have been suggested as a solution to this vulnerability. Attacks are not restricted to merely theoretical or academic scenarios anymore, as they are starting to be carried out against real-life operations. One example is the hacking of Samsung Galaxy S8 devices with the iris unlock system, using a regular printer and a contact lens. This case has been reported to the public from hacking groups attempting to get recognition for real criminal cases, including from live biometric demonstrations at conferences\footnote{\url{https://www.forbes.com/sites/ianmorris/2017/05/23/samsung-galaxy-s8-iris-scanner-hacked-in-three-simple-steps/#33f150b2ccba}}. An ideal PAD technique should be able to detect all of these attacks, along with any new or unknown PAI that may be developed in the future~\cite{Hoffman}. In order to improve PAD methods, a few competitions and databases have been created, such as the LiveDet-Iris\footnote{\url{https://livdet.org/}}. The goal of the Liveness Detection Competition (LivDet-Iris) is to compare biometric liveness detection methodologies, using a standardized testing protocol and large quantities of attack presentation (spoofed) and bona fide presentation samples. This competition has shown that there are still challenges for the detection of iris presentation attacks, mainly when unknown materials or capture devices are used to generate the attacks~\cite{livedet2020}. The results show that even with latest advances in presentation attacks, printed iris PAIs, as well as patterned contact lenses PAIs, are still difficult for software-based systems to detect according with the quality of the images. In LiveDet2017~\cite{livedet2017}, Printed iris images were easier to be differentiated from live images in comparison to patterned contact lenses, as it was also shown in the previous competitions. Some properties of the samples (images) are unknown during training, making the challenge a difficult task, as the winning algorithm did not recognize from 11\% to 38\% of the attack images, depending on the database. Therefore, the PAD techniques are still an open challenge in NIR, and it has been even less explored in VIS periocular images and multiple capture devices. The results from the LiveDet2020~\cite{livedet2020} competition indicate that iris PAD is still far from a fully solved research problem. Large differences in accuracy among baseline algorithms, which were trained with significantly different data, stress the importance of access to large and diversified training datasets, encompassing a large number of PAIs. The winning team’s (our method) also achieved the lowest Bona Fide Classification Error Rate (BPCER) of 0.46\%, out of all nine algorithms in the three categories. This aligns well with the operational goal of PAD algorithms to correctly detect bona fide presentations (i.e., and not to contribute to system’s False Alarm Rate), and capture as many attacks as possible. One of the main challenges to improve PAD systems is the quantity and quality of the data available. Printed images are easy to reproduce with different kinds of paper. Conversely, post-morten images~\cite{TROKIELEWICZ2020103866}, and PAIs such as contact lenses, cosmetic lenses, plastic lenses, all sourced from different brands, are hard to get. Therefore a subject-disjoint dataset containing different iris patterns is difficult to achieve. Alternatively, these datasets can be synthetically created using Deep Learning techniques. Some relevant techniques, such as morphing~\cite{seibold} and Generative Adversarial Network (GAN)~\cite{survey_gan}, can create very realistic images of faces. It is believed that such algorithms can develop synthetic iris images (NIR/VIS) of several PAIs in order to create challenging databases that can help improving the robustness of PAD systems~\cite{4dcyclegan}. \begin{figure*}[!htb] \centering \includegraphics[scale=0.45]{images/real-flow5.png} \caption{Proposed Two-stage serial framework for Presentation Attack Detection. AP: Attack Presentation. BP: Bona fide Presentation.} \label{fig:real-flow} \end{figure*} In this work, a serial, two-stage architecture for classification of bona fide, presentation attack, high-quality printed, and digitally displayed images of LiveDet-2020, plus three complementary databases were explored using deep learning techniques. See Figure \ref{fig:real-flow}. The main contributions of this work can be summarized a follows: \begin{itemize} \item \emph{Architecture}: A serial, two-stage architecture is proposed. This consists of a modified MobileNetV2 model (\enquote{MobileNetv2a}), trained from scratch, which is utilized to differentiate between bona fide presentation and presentation attack. A second MobileNet named \enquote{MobileNetv2b}, trained from scratch for four scenarios, which is then used to detect printed/contact-lenses/cadaver impostor attacks by identifying the physical source of the images. See Figure~\ref{fig:real-flow}. \item \emph{Network inputs}: A strong set of experiments of serial and parallel structures of DNNs was evaluated with two, three, and four classes, using NIR images. Bona fide versus contact lenses, print-out, cadavers, electronics and prosthetic displays were used as input to the network. Also, separate and exhaustive experiments were realized using one of these four types of input, and the results were analyzed. \item \emph{Weights}: Balanced class weights were used in order to correctly represent the number of images per class. Most of the spoofing databases are unbalanced according to PA scenarios. Weighted classes help to balance the dataset and to get realistic results. \item \emph{Database}: This paper presents two new databases, one database to increase the number of bona fide images (10,000), and a second database to increase the number of printed PAIs with high-quality images (1,800). Both databases will be available to other researchers upon request, for research purposes only (See Section~\ref{sec:database}). \item \emph{Data-Augmentation (DA)}: An aggressive DA technique to train the modified MobileNetV2a and MobileNetV2b networks was used. These images allow the network more challenging scenarios considering blurring, Gaussian noise, coarse occlusion, zoom, and others. \item \emph{Winning method}: Focused on the correct classification of bona fide images instead of the identification of several PAIs, the serial approach presented in this work reached first place in the LiveDet-2020 competition. Furthermore, the current proposal with three and fourth classes outperforms our results presented in the competition, featuring more challenging scenarios. \item \emph{Not self-reported}: The two-stage algorithm presented in this paper was evaluated by the organizers of the competition in an independent test on unknown data; the test data was not available for the participants. \end{itemize} \section{Related Work} \label{sec:relate} Zou et al.~\cite{4dcyclegan} have presented a novel algorithm, 4DCycle-GAN, for expanding spoofed iris image databases, by synthesizing artificial iris images wearing textured contact lenses. The proposed 4DCycle-GAN follows the Cycle Consistent Adversarial Networks (Cycle-GAN) framework, which translates between one kind of image (bona fide iris images) to another kind (textured contact lenses iris images). Despite the improvements on Conditional Generative Adversial Networks, there are still some open problems that limit its application for image generation. Therefore, the method helps to create and increase the number of images based on conditional GANs while preserving the information in the images of each PAIs in the NIR spectrum. Hu et al.~\cite{hu2016iris} investigated the use of regional features in iris PAD (RegionalPAD). Features are extracted from local neighborhoods, based on spatial pyramid (multi-level resolution) and relational measures (convolution on features with variable-size kernels). Several feature extractors, such as Local Binary Patterns (LBP)~\cite{lbp}, Local Phase Quantization (LPQ)~\cite{LPQ}, and intensity correlogram are examined. They used a three-scale LBP-based feature, since it achieves the best performance, as pointed out by the original authors. Gragnaniello et al.~\cite{gragnaniello2016using} proposes that the sclera region also contains important information about iris liveness (SIDPAD). Hence, the authors extract features from both the iris and sclera regions. The two regions are first segmented, and scale-invariant local descriptors (SID) are applied. A bag-of-feature method is then used to accumulate the features. A linear Support Vector Machine (SVM) is used to perform final prediction. Also, in~\cite{gragnaniello2016biometric}, domain-specific knowledge of iris PAD is incorporated into the design of their model (DACNN). With the domain knowledge, a compact network architecture is obtained, and regularization terms are added to the loss function to enforce high-pass/low-pass behavior. The authors demonstrate that the method can detect both face and iris presentation attacks. SpoofNets~\cite{kimura20} are based on GoogleNet, and consist of four convolutional layers and one inception module. The inception module is composed by layers of convolutional filters of dimension 1$\times$1, 3$\times$3, and 5$\times$5, executed in parallel. It has the advantage of reducing the complexity and improving the efficiency of the architecture, once the filters of dimension 1$\times$1 help reduce the number of features before executing layers of convolution with filters of higher dimensions. Boyd et al.~\cite{boyd2020deep} chose the ResNet50 architecture as a backbone to explore whether iris-specific feature extractors perform better than models trained for non-iris tasks. They demonstrated three types of networks: off-the-shelf networks, fine-tuned, and networks trained from scratch, with five different sets of weights for iris recognition. They concluded that fine-tuning an existing network to the specific iris domain performed better than training from scratch. Yadav et al.~\cite{Yadav_2018_CVPR_Workshops}, a combination of handcrafted and deep-learning-based features was used for iris PAD. They fused multi-level Haralick features with VGG16 features to encode the iris textural patterns. The VGG16 features were extracted from the last fully connected layer, with a size of 4,096, and then reduced to dimensional vector by Principal Component Analysis (PCA). Nguyen et al.~\cite{PNguyen} proposed a PAD method by combining features extracted from local and global iris regions. First, they trained multiple VGG19~\cite{simonyan2015deep} networks from scratch for different iris regions. Then, the features were separately extracted from the last fully connected layer, before the classification layer of the trained models. The experimental results showed that the PAD performance was improved by fusing the features based on both feature-level and score-level fusion rules. Kuehlkamp et al.~\cite{andrey} propose an approach for combining two techniques for iris PAD: CNNs and Ensemble Learning. Extensive experimentation was conducted using the most challenging datasets publicly available. The experiments included cross-sensor and cross-dataset evaluations. Results show a varying ability for different BSIF+CNN representations to capture different aspects of the input images. This method outperform the results presented in the LivDet-Iris 2017 competition. Our approach, presented in the LivDet-Iris 2020 competition, reached the first place with an the Average Classification Error Rate (ACER) of 29.78\%. This method achieved also the lowest Bona Fide Classification Error Rate (BPCER) of 0.46\% out of all nine algorithms in the three categories. This paper show the relevance of focusing mainly in the bona fide images as a \enquote{first-filter}. However, a broad space for improvement was detected in the identification of the PAIs scenarios, specially in cadaver and printed iris images. An Attack Presentation Classification Error Rate (APCER) of 9.87\% was reached for the electronic display PAI, which is lower than all competing algorithms (53.08\% and 83.95\%) by a large margin. Based on previous results, this current paper proposes a new framework to improve the PAIs performance per scenarios in order to get a strong PAD method. The rest of the article is organized as follows: Section~\ref{sec:relate} summarizes the related works on Presentation Attack Detection. The ISO metrics are explained in Section~\ref{sec:metric}. The database description is explained in Section~\ref{sec:database}. The experimental framework is then presented in Section~\ref{sec:metodo}, and the results are discussed in Section~\ref{sec:exp_results}. We conclude the article in Section~\ref{conclusions}. \section{Databases} \label{sec:database} For this work, the LivDet-Iris 2020 competition database was used. In addition, three sets of complementary databases of iris images were also utilized. First, a database of NIR bonafide images, captured using an Iritech TD100 iris sensor with a resolution of 640$\times$480 pixels, called \enquote{Iris-CL1}. A second database, called \enquote{iris-printed-CL1}, containing high-quality presentation attack images of printed PAIs was created. The goal of this database is to increase the challenge of the printed irises scenario, due to the noticeable visible patterns in the printed images from the LivDet-Iris 2020 database, which makes them trivial to distinguish from bona fide images. See Figure~\ref{fig:Example_images}. The iris-printed-CL1 database contains 1,800 images captured with two smartphone devices (900 images each one): a Nokia 9 PureView device, with an image resolution of 1280$\times$957 pixels, and a Motorola Moto G4 Play device, with an image resolution of 1280$\times$960 pixels. Only the red channel was used. These new datasets will be available to others researchers upon request. Figure~\ref{fig:Example_images} present new images of printed scenarios. The third database is the Warsaw-BioBase-Post-Mortem-Iris v3.0 database~\cite{TROKIELEWICZ2020103866}. This database contains a total of 1,094 NIR images (collected with an IriShield M2120U), and 785 visible-light images (obtained with Olympus TG-3), collected from 42 post-mortem subjects. This database was not fully available for the competition. \begin{figure*}[!htb] \centering \subcaptionbox{\centering Live/Real}{\includegraphics[width=0.24\textwidth]{images/real.png}} \hfill \subcaptionbox{\centering Print-out LivDet-Iris 2020}{\includegraphics[width=0.24\textwidth]{images/67873516_LG_I5_Print_L_D1_3.png}} \hfill \subcaptionbox{\centering Print-out Motorola Moto G4 Play}{\includegraphics[width=0.24\textwidth]{images/fotoMotoG4.png}} \hfill \subcaptionbox{\centering Print-out Nokia 9 PureView}{\includegraphics[width=0.24\textwidth]{images/fotoNokia9.png}} \hfill \subcaptionbox{\centering Cadaver (post-mortem subject) eye}{\includegraphics[width=0.24\textwidth]{images/death_0083_L_IG_1_4.png}} \hfill \subcaptionbox{\centering Cosmetic contact lens}{\includegraphics[width=0.24\textwidth]{images/Pattern.png}} \hfill \subcaptionbox{\centering Electronic display}{\includegraphics[width=0.24\textwidth]{images/printed2.png}} \hfill \subcaptionbox{\centering Patterned eye}{\includegraphics[width=0.24\textwidth]{images/pattern2.png}} \caption{Example images of all presentation attack instruments in the database. Images c, and d show examples of the new PAIs included.} \label{fig:Example_images} \end{figure*} The LivDet-Iris 2020 database included five different PAIs, each with a different level of challenge: printed eyes, textured contact lens, electronic display, fake/prosthetic eyes, and printed with add-ons, and a small number of cadaver eyes. The printed image dataset is of a very low resolution. No specific training dataset was prepared for the competition. A total of 11,918 images were made available. The competition was different from previous editions in regards to the training dataset. the participants were encouraged to use all the data available to them (both publicly available and proprietary) to make their solutions as effective and robust as possible. The entirety of previous LivDet-Iris benchmarks were also made publicly available~\cite{yambay2014schuckers,7947701,livedet2017}. Additionally, the competition organizers shared five examples of each PAI (samples which were not used later in evaluations) to help the competitors familiarize themselves with the test data format (pixel resolution, bits per pixel used to code the intensity, etc.). Table~\ref{table:Train_Dataset} shows a summary of the all databases available for training in LivDet-Iris 2020. The datasets of presentation attack instruments (PAIs) were specifically created for the development of PAD methods. With the evolving of PAIs, the datasets include new challenges. A detailed technical summary of the available datasets can be found in~\cite{boyd2020deep,czajka2018presentation}. \begin{table}[!htb]\def\tabularxcolumn#1{m{#1}} \centering \caption{Training Dataset Summary -- 11,918 images. Fa, PrD, Pr, represent: Fake/Prosthetic Display and Printed Add-ons. BP: Bona fide presentation. AP: Attack Presentation.} \label{table:Train_Dataset} \begin{tabularx}{\linewidth}{Xllr} \toprule \multicolumn{1}{c}{\textbf{Dataset}} & \textbf{Class} & \multicolumn{1}{c}{\textbf{PAIs}} & \textbf{Num Images}\\ \midrule LDet-Iris-2013-Clarkson & BP & --- & 516\\ LDet-Iris-2015-Clarkson & BP & --- & 541\\ LDet-Iris-2017-Clarkson & BP & --- & 3,954\\ LDet-Iris-2020-Clarkson & BP & --- & 5\\ LDet-Iris-2020-Notre Dame & BP & --- & 5\\ LDet-Iris-2013-Clarkson & AP & Cont. Lens & 840\\ LDet-Iris-2015-Clarkson & AP & Cont. Lens & 824\\ LDet-Iris-2017-Clarkson & AP & Cont. Lens & 1,887\\ LDet-Iris-2020-Notre Dame & AP & Cont. Lens & 5\\ LDet-Iris-2015-Clarkson & AP & Printouts & 1,077\\ LDet-Iris-2017-Clarkson & AP & Printouts & 2,254\\ LDet-Iris-2020-Clarkson & AP & Printouts & 1\\ LDet-Iris-2020-Clarkson & AP & Elec. Display & 1\\ LDet-Iris-2020-Clarkson & AP & Fa, PrD, Pr & 3\\ LDet-Iris-2020-Warsaw & AP & Cadaver Eyes & 5\\ \midrule \multicolumn{3}{c}{\textbf{Total}} & \textbf{11,918}\\ \bottomrule \end{tabularx} \end{table} Table~\ref{tab:my-sum2} shows a summary of all datasets available from LivDet-Iris 2020, plus Cadaver images, iris-CL1, and iris-printed-CL2. The new total count of images available is 27,964. This is more than two times the number of images shown in Table~\ref{table:Train_Dataset}. \begin{table}[!ht]\def\tabularxcolumn#1{m{#1}} \centering \caption{Summary of the new, complete database, with 27,964 images divided in train, test, and validation.} \label{tab:my-sum2} \setlength{\tabcolsep}{4.6pt} \begin{tabularx}{\linewidth}{ccrrrrc} \toprule \textbf{Class} & \textbf{PAIs} & \multicolumn{1}{c}{\textbf{Train}} & \multicolumn{1}{c}{\textbf{Val}} & \multicolumn{1}{c}{\textbf{Test}} & \multicolumn{1}{c}{\textbf{Num Im.}} & \textbf{Sensors}\\ \midrule BP & --- & 6,694 & 1,062 & 5,773 & 13,530 & \begin{tabular}[c]{@{}c@{}}LG4000\\AD 100\\iCam 700\\TD100\end{tabular}\\ \midrule AP & Cadaver & 448 & 531 & 754 & 1,773 & \begin{tabular}[c]{@{}c@{}}IriTech\\IriShield\end{tabular}\\ \midrule AP & \begin{tabular}[c]{@{}c@{}}Cont. Lenses\\Textured\end{tabular} & 3,583 & 900 & 3,244 & 7,727 & \begin{tabular}[c]{@{}c@{}}LG4000\\AD 100\\iCam 700\\TD100\\MotoG4\\Gplay\end{tabular}\\ \midrule AP & \begin{tabular}[c]{@{}c@{}}Printed\\Prosthetic\\Display\end{tabular} & 4,090 & 1,896 & 2,305 & 8,291 & \begin{tabular}[c]{@{}c@{}}Iris ID\\iCAM700\end{tabular}\\ \midrule \multicolumn{2}{c}{\textbf{Total}}& \textbf{11,810} & \textbf{4,384} & \textbf{11,770} & \textbf{27,964} & \\ \bottomrule \end{tabularx} \end{table} \subsection{Unknown Scenarios} An unknown state-of-the-art dataset of spoofed images was used to measure the performance of our proposal~\cite{bsif_bowyer}. This dataset includes 900 images of textured contact lenses produced by Cooper and J\&J (i.e. not represented in the training set of LivDet-Iris 2020) and 900 images of authentic irises. It has been shown that PAD methods do not generalize well to a brand of textured contact lenses not seen in the training data, thus the unknown dataset of spoofed images is used in the context of cross-dataset testing~\cite{bsif_bowyer}. \subsection{Data Augmentation} An aggressive data augmentation (DA) method was applied when training the modified MobileNetV2 networks. All the images were normalized using a histogram equalization algorithm, and then weighted. A large number of images, with several operations such as affine transformations, perspective transformations, contrast changes, Gaussian noise, random dropout of image regions, hue/saturation changes, cropping/padding, and blurring were included in the train dataset. These DA operations are based on the imgaug library~\cite{imgaug}, which is optimized for high performance. This improves the quality of the training results by using very challenging images. Examples of some augmented images are shown in Figure~\ref{fig:DA}. \begin{figure*}[!htb] \centering \includegraphics[scale=0.51]{images/data_aug.png} \caption{Examples of the aggressive data augmentation applied randomly to live and fake images. Left: original images, rotation, blurring, Gaussian noise filter, and Filter Edge Enhance.} \label{fig:DA} \end{figure*} \section{Metrics} \label{sec:metric} The ISO\_/IEC 30107-3 standard \footnote{\url{https://www.iso.org/standard/67381.html}} presents methodologies for the evaluation of the performance of PAD algorithms for biometric systems. The APCER metric measures the proportion of attack presentations---for each different PAI---incorrectly classified as bona fide (genuine) presentations. This metric is calculated for each PAI, where ultimately the worst-case scenario is considered. Equation~\ref{eq:apcer} details how to compute the APCER metric, in which the value of $N_{PAIS}$ corresponds to the number of attack presentation images, where $RES_{i}$ for the $i$th image is $1$ if the algorithm classifies it as an attack presentation (spoofed image), or $0$ if it is classified as a bona fide presentation (real image)~\cite{marcel2019handbook}. \begin{equation}\label{eq:apcer} APCER=\frac{1}{N_{PAIS}}\sum_{i=1}^{N_{PAIS}}(1-RES_{i}) \end{equation} Additionally, the BPCER metric measures the proportion of bona fide (live images) presentations mistakenly classified as attacks presentations to the biometric algorithm, or the ratio between false rejection to total genuine attempts. The BPCER metric is formulated according to equation~\ref{eq:bpcer}, where $N_{BF}$ corresponds to the number of bona fide (live) presentation images, and $RES_{i}$ takes identical values of those of the APCER metric. \begin{equation}\label{eq:bpcer} BPCER=\frac{\sum_{i=1}^{N_{BF}}RES_{i}}{N_{BF}} \end{equation} These metrics effectively measure to what degree the algorithm confuses presentations of spoofed images with real images, and vice versa. Furthermore, the Average Classification Error Rate (ACER) is also used. This is computed by averaging the APCER and BPCER metrics, as shown in equation~\ref{eq:acer}. This evaluates the overall system performance. \begin{equation}\label{eq:acer} ACER=\frac{APCER+BPCER}{2} \end{equation} Note that ACER has been deprecated in ISO/IEC 30.107-3. Only for the purpose of comparing with the state of the art, the ACER was computed. A Detection Error Trade-off (DET) curve is also reported for all the experiments. In the DET curve, the Equal Error Rate (EER) value represents the trade-off when the APCER is equal to the BPCER. Values in this curve are presented as percentages. \section{Methodology} \label{sec:metodo} In this section, we introduce our baseline by utilizing a fine-tuned network, and a new network trained from scratch. Then, the detailed description of the used convolutional layers is presented. \subsection{Networks} MobileNet~\cite{howard2017mobilenets} is based on a streamlined architecture to build lightweight deep neural networks. This allows for usage in environments with limited resources, such as mobile applications, while achieving with state-of-the-art performance for tasks such as classification. A modified MobileNet was used to detect live and spoofed images. For this work, ImageNet~\cite{deng2009imagenet} weights were initially used for transfer learning. However, the results of fine-tuning the network would worsen proportionally to the amount of layers that were frozen. Therefore training the networks from scratch resulted in a better classification performance overall. This is explained in more detail in Section~\ref{sec:exp_results} In addition, two different network architectures are used in this work: MobileNetV2a and a modified MobileNetV2b. MobileNetV2a was trained from scratch, based on bona fide and fake scenarios only, whereas MobileNetV2b was introduced based on live, patterned contact lenses, printed, and cadaver scenarios. \subsection{Image Pre-processing} All the images in the database were pre-processed using an adaptive histogram algorithm to improve the gray-scale intensity. Later, a weighted factor per each class was applied. Also, a higher number of filters was applied, using MobileNetV2 alpha parameter, from the standard 1.0 up to 1.4. Both methods are leveraged to create a two-stage classifier that can detect bona fide and spoofing scenarios. All the images were resized to 224$\times$224 and 448$\times$448 according to the experiments. \subsection{Contrast Limited Adaptive Histogram Equalization (CLAHE)} In order to improve the quality of the images and highlight texture-related features, the CLAHE algorithm was applied. This algorithm divides an input image into an M$\times$N grid. Afterwards, it applies equalization to each cell in the grid, enhancing global contrast and definition in the output image. All the images were divided in 8$\times$8 sized cells. \subsection{Class Weights} A weight factor was estimated for each class according to the number of images of the class, helping in balancing the database. Thus, each class is correctly represented in the error estimation. See Equation~\ref{eq1}. \begin{equation} \label{eq1} Weight_i = \frac{Nsamples}{Nclasses \times samples_i} \end{equation} Where $Weight_i$ is the weight for class $i$, $Nsamples$ is the total number of images in the database, $Nclasses$ is the total number of classes in the database, and $samples_i$ is the number of samples of class class $i$. The weight values associated to each classes are the following: \begin{itemize \item Class 0, Cadaver: 4.4162 \item Class 1, Live: 0.5787 \item Class 2, Pattern: 1.0133 \item Class 3, Printed: 0.9443 \end{itemize} \subsection{Alpha Values} The number of parameters and number of multiply-adds can be modified by using the alpha parameter, which increases/decreases the number of filters in each layer of the MobileNet network. By altering the image size and alpha parameter. This alpha value is known as the width multiplier in the original MobileNet implementation: \begin{itemize} \item If $alpha = 1.0$, the default number of filters from the original MobileNet paper are used at each layer. \item If $alpha < 1.0$, proportionally decreases the number of filters in each layer. \item If $alpha > 1.0$, proportionally increases the number of filters in each layer. \end{itemize} \section{Experiment and Results} \label{sec:exp_results} The approach presented in this work takes into account the variability of the PA images, and the number of images per class. These images present a problem for the classifier because the PAIs are not equally represented (for instance only five images of cadaver eyes were available for LivDet-Iris 2020). Considering this imbalance, our strategy is primarily focused on classifying bona fide images with high precision first, and attack presentation images second. Therefore, our first approach was training a network with only two classes. Then, a second network was trained from scratch with three and four classes, increasing the number of filters (alpha 1.4) and weighting each class according to the numbers of images per scenario. To study these limitations and improve performance for these aforementioned scenarios, five experiments were developed in order to analyze the best hyper-parameter configuration of MobileNetV2. A combination of serial and parallel DNNs was used, trained from scratch. A grid search was used to determine the learning rate, number of epochs, global pooling operation, alpha value, and input size of images. All the experiments employ the CLAHE algorithm and the class weight balancing operation. All the networks were trained with a limit of 200 epochs, using an early stopping method in case the measured performance would stop improving. The image input sizes utilized were 224$\times$224 and 448$\times$448 pixels. All the experiments used the same number of images. \subsection{Experiment 1} A traditional MobileNetv2 network was used, trained with fine-tunning techniques. Several tests were performed, sequentially freezing an additional MobileNetV2 block in each one, from the bottom of the network to the top. For this experiment the images were grouped in two classes: Live and Fake. The Fake dataset considers the images all PAIs: Contact Lenses (CL), Printout (Pr), Electronic displays (EDs), Prostetic Display (PD) and Cadaver Eyes (CE). \subsection{Experiment 2} A modified MobileNetv2a network was trained from scratch. For this experiment, the images were again grouped in two classes: BP (Bona fide presentations) and AP (Attack presentation with various PAI). The AP dataset is comprised of all PAI classes: Contact Lenses (CL), Printout (Pr), Electronic displays (EDs), Prostetic Display (PD) and Cadaver Eyes (CE). \subsection{Experiment 3} For this experiment, a modified MobileNetv2b network was trained from scratch. The images were grouped in three classes this time: Bona fide, Contact lenses (patterned) and Printouts. \subsection{Experiment 4} A modified MobileNetv2b network were trained from scratch. The images in this experiment were grouped into four classes: Bona fide, Contact lenses, Printouts, and Cadaver. \subsection{Experiment 5} This experiment evaluated the feasibility of our two-stage proposed method, trained with two classes, to detect unknown attacks presentations over traditional PAI species. In particular, we tackle the challenging scenario where the PAI species remain unknown, and is not part of the PAD algorithm training set. For this experiment, we used the unknown test dataset available from the UND database~\cite{bsif_bowyer}. \subsection{Results} In this section, we report the best results for each experiment. Adam optimization performed better than SGD and RMSprop. The best initial learning rate was $1 \times 10^{-5}$. Global max pooling performs better than global average pooling. An alpha value of 1.0 performed better with two class scenarios, with an input image size of $224 \times 224$, whereas an alpha value of 1.4 with an input image size of $448 \times 448$ performed better for three and four class scenarios. Table~\ref{tab:summary} shows an overview of the results for two class scenarios trained with fine-tuning, and two, three, and four class scenarios trained from scratch. Rows 3 to 7 show the fine-tuning results. Only the results for layers 10, 19, and 28 are included, due to the degradation in performance that was proportional to the amount of bottom layers from the network that were frozen. We infer this is probably because the pre-trained ImageNet~\cite{deng2009imagenet} weights were not trained using images of spoof NIR eyes, or anything similar. Overall, for fine-tuning, the best results were obtained when freezing only the first MobileNetV2 block (T2212), using Adam optimization, resulting in an APCER of 4.29\%, and a BPCER of 3.69\%. \begin{table}[!htb]\def\tabularxcolumn#1{m{#1}} \centering \caption{Summary of the results for two, three, and four classes. In bold are highlighted the best results. POOL: global pooling operation used. FT: fine tuning training; number of blocks frozen.} \label{tab:summary} \setlength{\tabcolsep}{5.6pt} \begin{tabularx}{\linewidth}{crrrlll} \toprule \textbf{Model} & \begin{tabular}[r]{@{}r@{}}\textbf{ACER}\\(\%)\end{tabular} & \begin{tabular}[r]{@{}r@{}}\textbf{APCER}\\(\%)\end{tabular} & \begin{tabular}[r]{@{}r@{}}\textbf{BPCER}\\(\%)\end{tabular} & \multicolumn{1}{c}{\textbf{POOL}} & \multicolumn{1}{c}{\textbf{OPT}} & \multicolumn{1}{c}{\textbf{FT}}\\ \midrule \multicolumn{7}{c}{\textbf{2 CLASSES}}\\ \midrule \textbf{T2212} & \emph{3.99} & \emph{4.29} & \emph{3.69} & \emph{AVG} & \emph{ADAM} & \emph{1\textsuperscript{st} only}\\ T0710 & 9.50 & 12.44 & 6.57 & AVG & SGD & 1\textsuperscript{st} \& 2\textsuperscript{nd}\\ T1619 & 6.51 & 7.42 & 5.60 & AVG & ADAM & 1\textsuperscript{st} \& 2\textsuperscript{nd}\\ T0123 & 10.30 & 11.59 & 5.01 & AVG & SGD & 1\textsuperscript{st} to 3\textsuperscript{rd}\\ T1022 & 6.33 & 11.05 & 16.10 & AVG & ADAM & 1\textsuperscript{st} to 3\textsuperscript{rd}\\ T1905 & 5.44 & 6.49 & 4.38 & AVG & SGD & NONE\\ T1310 & 6.55 & 5.30 & 7.81 & AVG & SGD & NONE\\ \textbf{T0730} & \emph{2.81} & \emph{3.92} & \emph{1.70} & \emph{AVG} & \emph{ADAM} & \emph{NONE}\\ \midrule \multicolumn{7}{c}{\textbf{3 CLASSES}}\\ \midrule \textbf{T2057} & \emph{0.50} & \emph{1.00} & \emph{0.00} & \emph{AVG} & \emph{ADAM} & \emph{NONE}\\ T2056 & 1.70 & 0.65 & 2.47 & AVG & ADAM & NONE\\ T1713 & 2.30 & 1.84 & 2.75 & AVG & ADAM & NONE\\ T1202 & 2.31 & 0.87 & 3.76 & AVG & ADAM & NONE\\ \midrule \multicolumn{7}{c}{\textbf{4 CLASSES}}\\ \midrule T0729 & 7.80 & 14.55 & 1.23 & AVG & ADAM & NONE\\ T2202 & 7.53 & 13.35 & 1.71 & MAX & ADAM & NONE\\ \textbf{T1721} & \emph{4.92} & \emph{8.26} & \emph{1.58} & \emph{MAX} & \emph{ADAM} & \emph{NONE}\\ T1628 & 5.38 & 8.35 & 2.41 & MAX & SGD & NONE\\ \bottomrule \end{tabularx} \end{table} Figure~\ref{fig:mc2} shows the best result for two class scenarios, trained from scratch. This allows us to focus on identifying BP images versus AP (fake) images. In this figure, a confusion matrix considering these two classes is shown. Additionally, a Detection Error Trade-off (DET) curve is presented. Several approaches were tested, where the best result reaches an EER of only 3.43\% (green curve), using an alpha value of 1.4, an initial learning rate of $1\times 10^{-5}$, and the Adam optimization algorithm. \begin{figure*}[!htb] \hfill \begin{minipage}{.5\linewidth} \centering \includegraphics[scale=0.16]{images/2class_cm.png} \end{minipage}% \hfill \begin{minipage}{.5\linewidth} \centering \includegraphics[scale=0.26]{images/2classes_det.png} \end{minipage}% \hfill \caption{Results of the PAD method with two classes for model T0730. Left: confusion matrix for two class test, PA (fake) and bona fide (live). Right: DET curve for the best results. The number in parenthesis corresponds to the EER in percentage. The lowest EER reached was 3.43\%.} \label{fig:mc2} \end{figure*} Figure~\ref{fig:mc3a} shows the best result for three class scenarios: PA, BP, and Contact Lenses. In this figure, a confusion matrix considering these three classes is shown. Furthermore, a confusion matrix showing genuine (BP), and impostor classes is presented. In this case, the impostor class encompasses both PA and Contact Lenses PAIs. Additionally, a Detection Error Trade-off (DET) curve is also shown. The best result reaches an EER of only 0.30\% (orange curve), using an alpha value of 1.4, an initial learning rate of $1\times 10^{-5}$, and the Adam optimization algorithm. \begin{figure*}[!htb]\centering \centering \includegraphics[scale=0.16]{images/3class_cm.png}% \includegraphics[scale=0.16]{images/3class_cm2.png}% \includegraphics[scale=0.26]{images/3classes_det.png}% \caption{Results of the PAD method with three classes for model T2057. Left: confusion matrix considering each PAI independently. The second confusion matrix considers the bona fide class versus the fusion of all PAIs. The number in parenthesis corresponds to the EER in percentage. The lowest EER reached was 0.30\%.} \label{fig:mc3a} \end{figure*} Figure~\ref{fig:mc4a} shows the best result for four class scenarios: BP, Printed, Contact lenses, and Cadaver. Likewise, two confusion matrices, one showing four classes, and the other grouping all PAIs under the \enquote{impostor} class, are presented. A Detection Error Trade-off (DET) curve is also shown. The best result for this experiment reaches an EER of only 4.48\% (green curve), using an alpha value of 1.4, an initial learning rate of $1\times 10^{-5}$, and the Adam optimization algorithm. \begin{figure*}[!htb] \centering \includegraphics[scale=0.17]{images/4class_cm.png}% \includegraphics[scale=0.17]{images/4class_cm2.png}% \includegraphics[scale=0.27]{images/4classes_det.png}% \caption{Results of the PAD method with four classes for model T1721. Left: confusion matrix considering each PAI independently. The second confusion matrix considers the bona fide class versus the fusion of all PAIs. The number in parenthesis corresponds to the EER in percentage. The lowest EER reached was 4.48\%.} \label{fig:mc4a} \end{figure*} Figure~\ref{fig:attack6} shows the performance for each PAI for four class scenarios: BP, Printed, Contact lenses, and Cadaver. The best result corresponds to the printed PAI, with a EER of only 0.72\% (green curve), whereas the worse PAI performance was for patterned contact lenses (ERR of 4.48\%) followed by the cadaver PAI (ERR of 3.88\%). \begin{figure}[!htb] \centering \includegraphics[scale=0.26]{images/4classes_T1721_attack_det.png} \caption{DET curve for each PAI for the four classes model.} \label{fig:attack6} \end{figure} Figure~\ref{fig:attack_unknown} shows the performance for unknown species form the UND Database~\cite{bsif_bowyer}. Our proposal was evaluated with a challenging pattern contact lenses scenario. To that end, eight experiments, according to experiment 1, were evaluated. The leave-one-out protocol was applied, using all of the models of experiment 1, and evaluated with experiment 5. The Equal Error Rates reached are in the range of 2.11\% to 12.33\%. The best results show the robustness of our method to unknown scenarios. \begin{figure}[!htb] \centering \includegraphics[scale=0.28]{images/2classes_det_unk.png} \caption{DET curves for unknown species.} \label{fig:attack_unknown} \end{figure} Table~\ref{tab:camparison} shows a comparison with the state-of-the-art methods. Our proposal improve the results of the LivDet-Iris 2020 Competition. \begin{table}[!htb]\def\tabularxcolumn#1{m{#1}} \centering \caption{Comparison with the state of the art. Results are shown in \%.} \label{tab:camparison} \setlength{\tabcolsep}{4.2pt} \begin{tabularx}{\linewidth}{rrrr} \toprule \textbf{Method} & \textbf{APCER (\%)} & \textbf{BPCER (\%)} & \textbf{ACER (\%)}\\ \midrule USACH/TOC & 59.10 & 0.46 & 29.78\\ FraunhoferIGD & 48.68 & 11.59 & 30.14\\ Competitor 3 & 57.8 & 40.31 & 49.06\\ NP PAD & 57.21 & 0.71 & 28.96\\ MSU PAD Alg1 & 4.67 & 0.56 & 2.61 \\ MSU PAD Alg 2 & 2.76 & 1.61 & 2.18 \\ DACNN & 55.2 & 16.39 & 35.8 \\ SIDPAD & 49.85 & 39.96 & 44.9 \\ Regional PAD & 62.42 & 23.80 & 43.11\\ \midrule \textbf{Our method \#1 -- 2 Classes} & 3.03 & 1.70 & 2.81\\ \textbf{Our method \#2 -- 3 Classes} & \emph{1.00} & \emph{0.00} & \emph{0.50}\\ \textbf{Our method \#3 -- 4 Classes} & 8.35 & 2.41 & 5.38\\ \bottomrule \end{tabularx} \end{table} Figure~\ref{fig:kde} shows two Kernel Density Estimation (KDE) plots, in linear and logarithmic scale for the ordinate respectively (the abscissa is shown in linear scale for both), for the best two-classes model (T2057) according to Figure~\ref{fig:mc2}, with a EER of 0.30\%. \begin{figure}[!htb] \centering \includegraphics[scale=0.32]{images/2classes_kde.png}\\ \includegraphics[scale=0.32]{images/2classes_kdelog.png}% \caption{KDE distribution of Attack Presentation Scores versus Bona fide scores. Top: linear scale. Bottom: logarithmic scale. The threshold value (shown in blue) is defined as 0.5 by default. This operating point can be adjusted depending on requirements and use case, subject to the trade-off between APCER and BPCER.} \label{fig:kde} \end{figure} \section{Conclusion} \label{conclusions} Existing studies in the iris presentation attack detection literature are based on the assumption that the system encounters a specific iris presentation attack. However, this may not be the case in real-world scenarios, where the iris recognition system may have to handle multiple kinds of presentation attacks, including unknown scenarios. To address this challenge, we propose a framework focused on detecting live images, which means optimizing the models for a lower BPCER score. For this approach, we developed the largest iris presentation attack database by combining several other databases. This database are also available to other researchers by requests. Our suggested networks, when trained from scratch, allow us to improve the results of the LivDet-Iris 2020 competition by using more challenging PAIs. When using fine tuning, model performance worsens in proportion to the amount of layers from the network that were frozen. Nonetheless, results using fine tuning are competitive with the literature. According to our results, an image input size of $224\times224$ is enough for the successful classification of bona fide images. However, for presentation attack instruments, the results were improved when using an image input size of $448\times448$. This shows that the extra detail from higher resolution images contain relevant features for PAIs classification. Overall the best result reached was with three scenarios, obtaining an APCER 1.00\%, a BPCER of 0.00\%, and an ACER of 0.50\%. These results were obtained using a threshold value of 0.5; for other use cases---for example, biometric verification systems in banking---a more strict operating point could be used, obtaining a lower APCER but higher BPCER. The best model proposed with three classes reached an EER of 0.33\%. This work outperforms the LivDet-Iris 2020 competition results, serving as the latest evaluation of iris PAD on a large spectrum of presentation attack instruments. \section*{Acknowledgment} This research work has been partially funded by the German Federal Ministry of Education and Research and the Hessian Ministry of Higher Education, Research, Science and the Arts within their joint support of the National Research Center for Applied Cybersecurity ATHENE and TOC Biometrics company. \bibliographystyle{IEEEtran}
\section{Introduction} This paper deals with Taub-NUT spacetime \cite{Taub:1951,Newman.Tamburino.Unti:1963} that is an exact solution to the matter-free (i.e. vacuum) equations of General Relativity without cosmological constant. This particular solution is known for its many surprising properties \cite{Misner:1963,Misner:1967,Misner.Taub:1969}. Also, it can be generalised in various ways and embedded into the wider Pleba{\'n}ski–Demia{\'n}ski class of solutions; see, e.g., \cite[chapter\,12,16]{Griffiths.Podolsky:2009}. Here we are not interested in these generalisations and restrict attention to strict Taub-NUT only. We prove a result that gives rise to a new group-theoretic characterisation of Taub-NUT spacetime, or rather some obvious topological generalisation of it. The main theorem will be presented and proved in Section\,\ref{sec:MainTheorem}. It states that \emph{any} \(SU(2)\times U(1)\) symmetric vacuum solution to Einstein's equations with non-null group orbits is locally isometric to \emph{some} maximally extended generalised Taub-NUT geometry, where the ``generalisation'' here consists in replacing the 3-sphere in the global \(\mathbb{R}\times S^3\) topology with that of a lens space \(L(n,1)\). In that sense we can now say that (generalised) Taub-NUT can be characterised by its isometry group, together with a mild restriction on the group orbits. This result may be seen as an (incomplete) analogue to the so-called Jebsen-Birkhoff theorem, going back in idea to \cite{Jebsen:1921,Jebsen:2006} and (without much proof) \cite{Birkhoff:RMP1923}; see \cite{Johansen.Ravndal:2006} for more on its history and multiple discovery. In a modern formulation it states that any spherically symmetric vacuum solution to Einstein's equation is locally isometric to the maximally extended Schwarzschild-Kruskal manifold. Here ``spherical symmetry'' is defined by the existence of an isometric action of $SO(3)$ with spacelike \(S^2$ or $\mathbb{R}P^2\) orbits. A modern proof can be found in \cite[Chapter 4.10.1-2]{Straumann:GR2013}. We call our result an \emph{incomplete} analogue to the Jebsen-Birkhoff theorem because in the generalised Taub-NUT case we have several inequivalent (i.e. non globally isometric) maximal extensions, the precise classification of which we currently investigate. There is another, different notion of \emph{generalised Taub-NUT} introduced in \cite{Moncrief:1984}, which relaxes the global isometry to be merely \(U(1)\) (i.e. dropping the \(SU(2)\) factor altogether) and requires the spacetime to contain a compact Cauchy horizon diffeomorphic to \(S^3\) to which the \(U(1)\) action restricts to a free action with lightlike orbits. Hence the \(S^3\) Cauchy horizon is the total space of a \(U(1)\) principal bundle with base \(S^2\) (Hopf bundle) and lightlike fibres. The set of such ``generalised Taub-NUT'' spacetimes forms an infinite-dimensional proper submanifold within the set of all \(U(1)\)-symmetric vacuum spacetimes of ``roughly half the dimensions'' \cite[p.\,108]{Moncrief:1984}. In this case there are uncountably many inequivalent maximal extensions. In order to make our paper self contained, we will review the essential geometry and topology of Taub-NUT spacetime in Section\,\ref{ref:Taub-NUT}, also providing a characterisation of the NUT-charge as ``dual'' to mass. Our main theorem concerning the group-theoretic characterisation will be stated and proved in Section\,\ref{sec:MainTheorem}. We end with a brief outlook in Section\,\ref{sec:Outlook}. \section{Main theorem} \label{sec:MainTheorem} In this section we intend to give a unique characterisation of the Taub-NUT space-time in terms of the isometry group and its orbits. In particular, the Taub-NUT space-time can be seen to be the universal cover of a family of space-times admitting \(SU(2) \times U(1)\) as an isometry group such that the group orbits of \(SU(2)\times U(1)\) and \(SU(2)\) are three-dimensional and non-null.\\ Since the metric of the Taub-NUT space-time induces a \(SU(2)_L \times U(1)_R\) invariant metric on the hypersurfaces \(r = const.\), being diffeomorphic to \(SU(2)\), we will begin by studying special metrics on \(SU(2)\). For Lorentz metrics on \(SU(2)\) we have \begin{lemma}\label{u1timelike} Let \(G = SU(2)\) and \(g\) a Lorentz metric on \(G\) such that it is \(SU(2)\) left-invariant and \(U(1)\) right-invariant, whereby \(U(1)_R\) is considered as a subgroup of the \(SU(2)_R\). Then the orbits of the \(U(1)\) right-multiplication are timelike curves. \end{lemma} \begin{proof} The left-action\footnote{The reader should be aware of the conceptual difference between left/right-multiplication on groups and left/right-action of groups on sets: A \emph{left-action} of a group $G$ on a set $S$ is simply a homomorphism $\Phi:G\rightarrow\mathrm{Bij}(S)$, from the group $G$ into the group of bijections of $S$, with group multiplication of the latter just being composition of maps. This means that $\Phi:g\mapsto\Phi_g$ is such that $\Phi_g\circ\Phi_h=\Phi_{gh}$. In contrast, a \emph{right-action} is an anti-homomorphism $\tilde\Phi:G\rightarrow\mathrm{Bij}(S)$ which satisfies $\tilde\Phi_g\circ\tilde\Phi_h=\tilde\Phi_{hg}$. A left-action can be turned into a right-action (and vice versa) if we compose it with the group inversion $I:G\rightarrow G$, $g\mapsto I(g):=g^{-1}$ which is an anti-homomorphims, i.e. $I(gh)=I(h)I(g)$. Then $\tilde\Phi:=\Phi\circ I$ is a right-action if $\Phi$ is a left-action. Now, If $S=G$, there are two natural actions of $G$ on itself, called $L$ and $R$ and given by left- and right-multiplication respectively: $L_g(p):=gp$ and $R_g(p):=pg$. Associativity of group multiplication implies that these two actions commute (as maps): $L_g\circ R_h=R_h\circ L_g$ for all $g,h\in G$. Written in this way $L$ is a left- and $R$ is a right-action which as such do not combine to any action, left or right. However, the right-multiplication can be turned into a left-action by composing $R$ with $I$. In this way we get two different and commuting left-actions of $G$ on itself, one by left-multiplication with $g\in G$ and one by right-multiplication with $g^{-1}$. Together they define a left-action of $G\times G$ on $G$, given by $\Phi_{(g,h)}:=L_g\circ R_{h^{-1}}$, that is $\Phi_{(g,h)}(p)=gph^{-1}$. In order to distinguish the group $G$ that acts by left-multiplication from the one that acts by right-multiplication (with the inverse) we distinguish them notationally and call them $G_L$ and $G_R$, respectively. Restricting this to the diagonal subgroup $G_\Delta:=\{(g,g):G\in G\}\subset G_L\times G_R$ gives the left-action of $G$ on itself that is usually referred to as ``conjugation''.} \(SU(2)_L\times U(1)_R\subset S(U)_L\times SU(2)_R\) is simply obtained by restricting the standard left-action of \(S(U)_L\times SU(2)_R\) on $SU(2)$: \begin{subequations} \begin{align} &(SU(2)_L \times U(1)_R) \times SU(2) \to SU(2)\\ &((h,h'),g) \mapsto hgh'^{-1}. \end{align} \end{subequations} Now let \(e \in G\) be the identity, then we have for \(h \in SU(2)_L\) and \(h' \in U(1)_R\) \begin{align} ((h,h'),e) \mapsto heh'^{-1} = hh'^{-1}. \end{align} Hence the isotropy group at \(e\) is the diagonal \(U(1)\) subgroup in \(SU(2)_L \times U(1)_R\), denoted by \(C_h\). Then \begin{align} (dC_h)_e : T_eG \to T_eG \end{align} induces the adjoint representation \begin{subequations} \begin{align} Ad: U(1) \to GL(T_eG)\\ Ad(h) = (dC_h)_e. \end{align} \end{subequations} Since the tangent space is three-dimensional, the action induced by this \(U(1)\) on the tangent space is given by a \(U(1)\) subgroup of the three-dimensional Lorentz group. Furthermore, because the \(U(1)\) subgroups of the three-dimensional Lorentz group consist of rotations acting by orthogonal transformations in a spacelike plane, such that the corresponding orthogonal timelike direction is invariant, the three-dimensional tangent space decomposes into an orthogonal sum of a two-dimensional spacelike subspace and a one-dimensional timelike subspace. Choosing any normed vector \(v\) in the one-dimensional timelike subspace, we define the left-invariant vector field \(X \in Lie(G)\) by \begin{align} X(g) = \left. \dv{}{t}\right|_{\scriptscriptstyle t=0}(g \, exp(tv)). \end{align} The right action on this left-invariant vector field is determined by the adjoint of \(v \in T_eG\) with respect to \(h^{-1} \in U(1)\), \begin{subequations} \begin{align} (dR_h)_g(X_g) &= \left. \dv{}{t}\right|_{\scriptscriptstyle t=0}(g \, exp(tv) \, h)\\ &= \left. \dv{}{t}\right|_{\scriptscriptstyle t=0}(gh \, C_{h^{-1}}(exp(tv)))\\ &= \left. \dv{}{t}\right|_{\scriptscriptstyle t=0}(gh \,exp(tAd(h^{-1})(v))). \end{align} \end{subequations} Since the timelike direction is invariant with respect to the adjoint representation, we obtain \begin{subequations} \begin{align} (dR_h)_g(X_g)&= \left. \dv{}{t}\right|_{\scriptscriptstyle t=0}(gh \,exp(tAd(h^{-1})(v)))\\ &= \left. \dv{}{t}\right|_{\scriptscriptstyle t=0}(gh \, exp(tv))\\ &= X(gh). \end{align} \end{subequations} Therefore the left-invariant vector field is also \(U(1)_R\)--invariant. Furthermore, because it is a left-invariant vector field, it generates a \(U(1)_R\)-action, considered as \(U(1)_R' \subset SU(2)_R\). By being also invariant under \(U(1)_R \subset SU(2)_R\), the two \(U(1)\) right actions have to commute, hence \(U(1)_R = U(1)_R'\). Therefore, the orbits of the \(U(1)\) right action coincide with the orbits of \(X\) and thus are timelike. \end{proof} Next we will prove that a \(SU(2)_L \times U(1)_R\)--invariant metric on \(SU(2)\) can be put into a canonical form: \begin{lemma}\label{canonmetric} Let \(G = SU(2)\) and \(g\) a non-degenerate, symmetric bilinear form on \(G\) which is \(SU(2)_L \times U(1)_R\)--invariant. Then \(g\) can be written as \begin{align} g = A \sigma_z^2+B(\sigma_x^2+\sigma_y^2), \end{align} where \(\sigma_x,\sigma_y,\sigma_z\) are left--invariant one-forms on \(G\). \end{lemma} \begin{proof} Let \(Z\) be a fundamental vector field associated to the \(U(1)_R\)-action and any element \(ix \in Lie(U(1)) =i\mathbb{R}\), \begin{align} Z(g) = \left. \dv{}{t}\right|_{\scriptscriptstyle t=0}(g \, exp(tix)), \quad g \in G. \end{align} Then the vector field \(Z\) is left-invariant. We will complete it to a basis for \(Lie(G)\) by choosing two linearly independent left-invariant vector fields in the orthogonal complement of \(Z\), so \(X,Y \in Lie(G)\) such that \(X,Y \bot Z\). Then, denoting the basis as \(e_1 = Z, e_2 = X, e_3 = Y\) and their dual one forms by \(\omega_1,\omega_2,\omega_3\), \(g\) can be written as \begin{align} g = \lambda (\omega^1)^2+ \mu (\omega^2)^2+ \nu (\omega^3)^2+ \kappa \omega^2\omega^3. \end{align} Now since \(g\) is \(U(1)_R\)--invariant, we have \begin{align} L_{e_1}g = 0. \end{align} If the structure constants are given by \begin{align} [e_i,e_j] = c^k_{ij} e_k \end{align} we have for their dual one-forms \begin{align} d\omega^k = - \sum_{i<j} c^k_{ij} \omega^i \wedge \omega ^j. \end{align} Thus, using Cartan's magic formula, we obtain \begin{subequations} \begin{align} L_{e_1}\omega^1 &= i_{e_1}d\sigma^1 + d(i_{e_1}\sigma^1)\\ &= -i_{e_1}\left(\sum_{i<j} c^1_{ij} \omega^i \wedge \omega ^j\right)\\ &= -\sum_{i<j} c^1_{ij} \left( (i_{e_1}\omega^i) \wedge \omega^j - \omega^i \wedge (i_{e_1}\omega^j) \right)\\ &= -\left(c^1_{12} \, \omega^2 + c^1_{13} \, \omega^3\right) \end{align} \end{subequations} and similarly \begin{subequations} \begin{align} L_{e_1}\omega^2 &= -\left(c^2_{12} \, \omega^2 + c^2_{13} \, \omega^3\right)\\ L_{e_1}\omega^3 &= -\left(c^3_{12} \, \omega^2 + c^3_{13} \, \omega^3\right). \end{align} \end{subequations} Because \begin{align} L_V(T \otimes S) = (L_VT) \otimes S + T \otimes (L_VS), \end{align} for any vector field \(V\) and tensor fields \(T,S\), we see that \begin{align} L_{e_1}g = 0 \implies c^1_{12} = c^1_{13} = 0, \end{align} by noting that terms of the form \(\omega^1\omega^2\) and \(\omega^1\omega^3\) can only be obtained by \(L_{e_1}\omega^1\). Thus we have \begin{subequations} \begin{align} &[e_1,e_2] \in span\{e_2,e_3\}\\ &[e_1,e_3] \in span\{e_2,e_3\}. \end{align} \end{subequations} Defining a vector space endomorphism \(F:Lie(SU(2)) \to Lie(SU(2))\) by \begin{align} F(e_1) = [e_2,e_3] \quad F(e_2) = [e_3,e_1] \quad F(e_3) = [e_1,e_2], \end{align} the matrix of \(F\) with respect to \(\{e_1,e_2,e_3\}\) is given by \begin{align} F = \begin{pmatrix*} c^1_{23} & 0 & 0\\ c^2_{23} & c^2_{31} & c^2_{12}\\ c^3_{23} & c^3_{31} & c^3_{12} \end{pmatrix*}. \end{align} Since \(SU(2)\) is a unimodular group, we have: \(tr \, ad(x) = 0 \quad \forall x \in Lie(SU(2))\), therefore implying \(c^2_{23} = c^3_{23} = 0\). Since we also have \(c^2_{12} = c^3_{31}\), \(F\) is self-adjoint with respect to \(g\) and hence we can find an orthogonal transformation diagonalizing \(F\). It is an orthogonal transformation keeping \(e_1\) fixed and transforming in its orthogonal complement. Thus, by the appropriate transformation, we get a new basis \(\{\tilde{e}_1,\tilde{e}_2,\tilde{e}_3\}\) with \(\tilde{e}_1 = e_1\) satisfying \begin{subequations} \begin{align} &[\tilde{e}_1,\tilde{e}_2] = \tilde{c}^3_{12} \tilde{e}_3\\ &[\tilde{e}_3,\tilde{e}_1] = \tilde{c}^2_{31} \tilde{e}_2\\ &[\tilde{e}_2,\tilde{e}_3] = \tilde{c}^1_{23} \tilde{e}_1 \end{align} \end{subequations} and by rescaling, we obtain the basis \(\{e_1',e_2',e_3'\}\) with the commutation relations \begin{subequations} \begin{align} &[e_1',e_2'] = e_3'\\ &[e_3',e_1'] = e_2'\\ &[e_2',e_3'] = e_1'. \end{align} \end{subequations} Now, denoting the dual one-forms of this basis by \(\{\sigma_z,\sigma_x,\sigma_y\}\) respectively, \(g\) can be written as \begin{align} g = A \sigma_z^2+B \sigma_x^2+ C \sigma_y^2 + D \sigma_x \sigma_y \end{align} and we obtain \begin{subequations} \begin{align} L_{e_1'}\sigma_z &= 0\\ L_{e_1'}\sigma_x &= \sigma_y\\ L_{e_1'}\sigma_y &= -\sigma_x. \end{align} \end{subequations} Then, since \(e_1'\) is just a scalar multiple of \(e_1\), the \(U(1)\) right invariance implies \begin{subequations} \begin{align} 0 &= L_{e_1'}g\\ &= B(\sigma_y \otimes \sigma_x +\sigma_x \otimes \sigma_y) + C(-\sigma_x \otimes \sigma_y -\sigma_y \otimes \sigma_x)+D(\sigma_y \otimes \sigma_y - \sigma_x \otimes \sigma_x)\\ &= (B-C)(\sigma_y \otimes \sigma_x + \sigma_x \otimes \sigma_y) + D(\sigma_y \otimes \sigma_y - \sigma_x \otimes \sigma_x). \end{align} \end{subequations} Thus, implying \(B = C, \, D = 0\), such that \begin{align} g = A \sigma_z^2+B (\sigma_x^2+\sigma_y^2) \end{align} \end{proof} Combining the results of Lemma \ref{u1timelike} and \ref{canonmetric}, we see that a \(SU(2)_L \times U(1)_R\)--invariant Riemannian/Lorentz metric \(g\) on \(SU(2)\) can always be written as \begin{align} g = \varepsilon A^2 \sigma_z^2+B^2 (\sigma_x^2+\sigma_y^2), \end{align} where \(\varepsilon = 1\) corresponds to the Riemannian and \(\varepsilon = -1\) to the Lorentzian case. Using Euler-angle coordinates the metric is given by \begin{align} g = \varepsilon A^2 (d\psi+\cos\theta d\varphi)^2 + B^2 (d\theta^2+\sin^2\theta d\varphi^2). \end{align} An essential observation regarding the orbits of the isometry group \(SU(2) \times U(1)\) of the Taub-NUT space-time is that the orbit corresponding to the \(SU(2)\)-action are three-dimensional and the orbit with respect to the \(U(1)\)-action is a subset of it. Thus simply requiring the group orbits of a general space-time with isometry group \(SU(2) \times U(1)\) to be three-dimensional, does not exclude the possibility that the action of \(SU(2)\) generates two-dimensional orbits and the action of \(U(1)\) transversal one-dimensional orbits. For that matter we will in the following study the implications of three-dimensional orbits generated by a \(SU(2)\)-action on a space-time.\\ Let \(M\) be a manifold admitting a \(SU(2)\) left-action in such a way that the group orbits are three-dimensional. Since \(SU(2)\) is a compact Lie group the action is proper and thus each group orbit is a closed subset of \(M\) and each isotropy group is compact. Let \(O(p), \, I_p\) denote the orbit and isotropy group of \(p\) respectively. Then since \(I_p\) is a closed subgroup and the action of \(SU(2)\) on its group orbits is transitive, we have \begin{align} dim \, O(p) = dim \, SU(2) - dim \, I_p. \end{align} Thus the isotropy group is a discrete subgroup of \(SU(2)\) and since it is compact it has to be finite. The orbit \(O(p)\) is a homogeneous \(SU(2)\)-space and we have \begin{align} O(p) \cong SU(2)/I_p. \end{align} Since for a connected Lie group \(G\) and a discrete subgroup \(\Gamma\) the quotient is a manifold and the quotient map is a (normal) covering map, we get a fibration with base space \(O(p) \cong SU(2)/I_p\), discrete fibers \(I_p\) and total space \(SU(2)\) \begin{center} \begin{tikzcd} I_p\arrow[r] & SU(2)\arrow[d] \\ & O(p) \cong SU(2)/I_p. \end{tikzcd} \end{center} For \(SU(2)\) is connected and simply connected it is the universal cover. By the use of the long exact sequence of homotopy groups for the fibration we obtain \begin{align} \cdots \rightarrow \pi_1(I_p) \rightarrow \pi_1(SU(2)) \rightarrow \pi_1(O(p)) \rightarrow \pi_0(I_p) \rightarrow \pi_0(SU(2)). \end{align} Noting that \(SU(2) \cong S^3\), \(\pi_1(SU(2))\) is trivial like \(\pi_0(SU(2))\). Furthermore, we have \(\pi_0(I_p) \cong I_p\) and thus obtain the short exact sequence \begin{align} 0 \rightarrow \pi_1(O(p)) \rightarrow I_p \rightarrow 0, \end{align} implying \(\pi_1(O(p)) \cong I_p\). Summarizing, we see that the group orbits are closed three-dimensional manifolds with finite fundamental group. But then by Thurston's elliptisation conjecture (now proven) the group orbits have to be elliptic 3-manifolds. These have been classified to be of the form \(M = S^3/\Gamma\), with \(\pi_1(M) = \Gamma\) being a finite subgroup of \(SO(4)\), acting freely and orthogonally on \(M\) in the standard fashion. Out of these, the only ones admitting \(SU(2) \times U(1)\) as an isometry group are the Lens spaces \(L(n,1)\) \cite{Hong.EtAl:2012}. \\ As already proven a \(SU(2)_L \times U(1)_R\)--invariant metric on \(SU(2) \cong S^3\) can be put into a canonical form. Now we want to study the case for \(L(n,1)\). Considering \(S^3 \subset \mathbb{C}^2\) the left action of \(SU(2)\) on \(S^3 \) is the natural action of \(SU(2)\) on \(\mathbb{C}^2\) and the \(\Gamma = \mathbb{Z}_n\)-action on \(S^3\) for \(L(n,1)\) is given by \begin{align} \label{zn-action} (z_0,z_1) \mapsto (e^{2\pi i/n}z_0,e^{2\pi i/n}z_1), \quad (z_0,z_1) \in S^3. \end{align} Now we can define a left action of \(SU(2)\) on \(L(n,1)\) by \begin{subequations} \begin{align} &SU(2) \times L(n,1) \to L(n,1)\\ &(A, \pi(p)) \mapsto \pi(Ap), \end{align} \end{subequations} where \(\pi: S^3 \to L(n,1)\) is the projection map, so the covering map. This induces a well-defined \(SU(2)\) left action on \(L(n,1)\). Similarly we have a well-defined induced \(U(1)\) right action.\\ Moreover, given a \(SU(2)_L \times U(1)_R\)--invariant metric it is also invariant with respect to the \(\mathbb{Z}_n\)-action \eqref{zn-action} and hence the following construction is well-defined:\\ Let \(g\) be a \(\mathbb{Z}_n\)--invariant metric on \(S^3\). We define a metric on \(L(n,1)\) pointwise by \begin{subequations} \begin{align} &g'_q :T_qL(n,1) \times T_qL(n,1) \to \mathbb{R} \\ &g'_q (X',Y') \coloneqq g_p(X,Y), \quad X',Y' \in T_qL(n,1), \, X,Y \in T_pS^3 \end{align} \end{subequations} where \(\pi(p) = q\) and \(d\pi_p(X) = X', \, d\pi_p(Y) = Y'\). The \(\mathbb{Z}_n\)-invariance of \(g\) implies the independence of the choice of a representative \(p\) and since the covering map is a local diffeomorphism its differential at any point is a linear isomorphism. Therefore this definition makes sense. The metric \(g'\) is in fact smooth, since given any smooth local section \(s:U\subset L(n,1) \to S^3\) and smooth local vector fields \(X',Y'\) on \(U\) we have on \(U\) \begin{align} g'(X',Y') = g(ds(X'),ds(Y')). \end{align} This linear map is a bijection, because conversely given any metric \(g'\) on \(L(n,1)\) we can define a metric \(g = \pi^*g'\) on \(S^3\), being just the preimage of the preceding construction. Thus, we see that the \(\mathbb{Z}_n\)--invariant metrics on \(S^3\) are in bijection to metrics on \(L(n,1)\). Since a \(SU(2)_L \times U(1)_R\)--invariant metric on \(S^3\) is also invariant with respect to the \(\mathbb{Z}_n\)-action \eqref{zn-action}, by definition of the induced action and the constructed bijection above, it is immediate that the \(SU(2)_L \times U(1)_R\)--invariant metrics on \(S^3\) are in one-to-one correspondence to the metrics on \(L(n,1)\) which are invariant under the induced \(SU(2)_L \times U(1)_R\)-action.\\ Using Euler coordinates and Lemma \ref{canonmetric}, a Lorentz or Riemannian metric on \(L(n,1)\) invariant under \(SU(2)_L \times U(1)_R\) can always be written as \begin{align} g = \varepsilon A^2(d\psi+\cos\theta d\varphi)^2 + B^2 (d\theta^2+\sin^2\theta d\varphi^2), \quad \varepsilon = \pm 1 \end{align} where \(\theta\) and \(\varphi\) ranging from \(0\) to \(\pi\) and \(0\) to \(2\pi\) respectively and \(\psi\) being \(4\pi/n\)-periodic.\\ In particular, based on the preceding results, we see that the metric \eqref{mismetric} is invariant with respect to the \(\mathbb{Z}_n\)-action \eqref{zn-action} and hence there exists a well-defined metric on any Lens space \(L(n,1)\). Thus the space-time can be generalized to \((\mathbb{R}\times L(n,1),g)\) with \begin{align} g = -4l^2f(r)(d\psi+\cos\theta d\varphi)^2+\frac{1}{f(r)}dr^2+(r^2+l^2)(d\theta^2+\sin^2\theta d\varphi^2), \end{align} which will be called the \emph{generalized Taub-NUT space-time}. The space-time \((\mathbb{R}\times L(n,1),g')\), with \begin{align} g' = -4l^2f(r)(d\psi'+\cos\theta d\varphi)^2+2(2l)(d\psi'+\cos\theta d\varphi)dr+(r^2+l^2)(d\theta^2+\sin^2\theta d\varphi^2) \end{align} will be called a \emph{maximal extension of the generalized Taub-NUT space-time}.\\ \noindent Now we can prove the following statement: \begin{theorem} Every (\(C^2\)-) solution to the vacuum Einstein field equations admitting \(SU(2) \times U(1)\) as an isometry group, such that \(SU(2)\times U(1)\) and \(SU(2)\) both have three-dimensional non-null orbits in an open subset \(U\), is locally isometric to a maximal extension of the generalized Taub-NUT space-time. \end{theorem} \begin{proof} Let \(p \in M\) be an arbitrary point of the space-time \((M,g)\) and \(O(p)\) be the three-dimensional orbit of \(p\) with respect to the action of \(SU(2)\). We define the orthogonal complement of the tangent space of the orbit to be: \(N_p \coloneqq T_pO(p)^{\perp}\). Then the induced distributions \begin{align} N \coloneqq \cup_{p \in M}N_p, \quad O \coloneqq \cup_{p \in M}T_pO(p) \end{align} are both integrable, for \(N\) is a one-dimensional distribution, which is always integrable, and \(O\) is by construction integrable, with its integral manifolds being the orbits. So we have a involutive three-dimensional distribution, spanned by Killing vector fields and the involutive one-dimensional normal bundle with \(N \cap O = {0}\), since the orbits are non-null. Thus, it is possible to introduce local coordinates \(\{x^\mu\} = \{r,x^1,x^2,x^3\}\) such that \begin{align} g = g_{rr} dr^2 + g_{ab}(x^\mu)dx^adx^b \end{align} where \(r = const.\) are the integral manifolds of \(O\), the orbits, which are homogeneous spaces. Since the three-dimensional orbits of a \(SU(2)\)-action admitting \(SU(2) \times U(1)\) as isometry group have to be topologically the Lens spaces \(L(n,1)\) and the \(SU(2)_L \times U(1)_R\)--invariant Lorentz or Riemannian metrics on \(L(n,1)\) can always be put into a canonical form, the metric can be written as \begin{align} g = -\varepsilon A^2(r) dr^2 + \varepsilon B^2(r) (d\psi+\cos\theta d\varphi)^2 + R^2(r) (d\theta^2+\sin^2\theta d\varphi^2), \end{align} where the case \(\varepsilon = 1\) represents spacelike orbits and \(\varepsilon = -1\) timelike orbits.\\ \noindent Now to solve the field equations, it is necessary to calculate the corresponding Ricci tensor. We will calculate them using an orthonormal tetrad and the Cartan structure equations.\\ \noindent First we will consider the case \(\varepsilon = 1\), so spacelike orbits. The orthonormal tetrad we will be using is \begin{subequations} \begin{align} \vartheta^0 &= A(r) dr\\ \vartheta^1 &= B(r)(d\psi+\cos\theta d\varphi)\\ \vartheta^2 &= R(r) d\theta\\ \vartheta^3 &= R(r)\sin\theta d\varphi. \end{align} \end{subequations} In the following the argument of the functions \(A,B,R\) will be omitted and a prime indicates the derivative with respect to \(r\). Then exterior differentiation and expressing the results in terms of the tetrad leads to \begin{subequations} \begin{align} d\vartheta^0 &= 0\\ d\vartheta^1 &= \frac{B'}{AB} \vartheta^0 \wedge \vartheta^1 - \frac{B}{R^2} \vartheta^2 \wedge \vartheta^3\\ d\vartheta^2 &= \frac{R'}{AR} \vartheta^0 \wedge \vartheta^2\\ d\vartheta^3 &=\frac{R'}{AR} \vartheta^0 \wedge \vartheta^3 + \frac{\cot\theta}{R} \vartheta^2 \wedge \vartheta^3. \end{align} \end{subequations} Since the tetrad is orthonormal we have \(\omega_{\mu\nu} + \omega_{\nu\mu} = 0\). Now using the first structure equation with an ansatz for every connection one-form of the form \(a_\mu\vartheta^\mu\), the unique solution is given by \begin{subequations} \begin{align} \omega^0{}_{1} &= \omega^1{}_{0} = \frac{B'}{AB} \vartheta^1\\ \omega^0{}_{2} &= \omega^2{}_{0} = \frac{R'}{AR} \vartheta^2\\ \omega^0{}_{3} &= \omega^3{}_{0} = \frac{R'}{AR} \vartheta^3\\ \omega^1{}_{2} &= -\omega^2{}_{1} = - \frac{B}{2R^2} \vartheta^3\\ \omega^1{}_{3} &= -\omega^3{}_{1} = \frac{B}{2R^2} \vartheta^2\\ \omega^2{}_{3} &= -\omega^3{}_{2} = \frac{B}{2R^2} \vartheta^1 - \frac{\cot\theta}{R} \vartheta^3. \end{align} \end{subequations} Then using the second structure equations, the curvature \(2\)-form can be calculated: \begin{subequations} \begin{align} \Omega^0{}_1 &= d\omega^0{}_1+\omega^0{}_2 \wedge \omega^2{}_1 + \omega^0{}_3 \wedge \omega^3{}_1 \nonumber\\ &= \left(\frac{B''}{AB}-\frac{B'A'}{A^2B}-\frac{B'^2}{AB^2}\right)dr \wedge \vartheta^1 + \frac{B'}{AB} d\vartheta^1 + \frac{BR'}{2AR^3} \vartheta^2 \wedge \vartheta^3 - \frac{BR'}{2AR^3} \vartheta^3 \wedge \vartheta^2 \nonumber\\ &= \left(\frac{B''}{A^2B}-\frac{B'A'}{A^3B}-\frac{B'^2}{A^2B^2}\right) \vartheta^0 \wedge \vartheta^1 + \frac{B'^2}{A^2B^2} \vartheta^0 \wedge \vartheta^1 - \frac{B'}{AR^2} \vartheta^2 \wedge \vartheta^3 + \frac{BR'}{AR^3} \vartheta^2 \wedge \vartheta^3 \nonumber\\ &= \left(\frac{B''}{A^2B}-\frac{B'A'}{A^3B}\right) \vartheta^0 \wedge \vartheta^1 + \left(\frac{BR'}{AR^3} - \frac{B'}{AR^2}\right) \vartheta^2 \wedge \vartheta^3\\ \Omega^0{}_2 &= d\omega^0{}_2+\omega^0{}_1 \wedge \omega^1{}_2 + \omega^0{}_3 \wedge \omega^3{}_2 \nonumber\\ &= \left(\frac{R''}{A^2R}-\frac{R'A'}{A^3R}-\frac{R'^2}{A^2R^2}\right) \vartheta^0 \wedge \vartheta^2+ \frac{R'^2}{A^2R^2} \vartheta^0 \wedge \vartheta^2 - \frac{B'}{2AR^2} \vartheta^1 \wedge \vartheta^3 - \frac{BR'}{2AR^3} \vartheta^3 \wedge \vartheta^1 \nonumber\\ &= \left(\frac{R''}{A^2R}-\frac{R'A'}{A^3R}\right) \vartheta^0 \wedge \vartheta^2 -\frac{1}{2}\left(\frac{B'}{AR^2} - \frac{BR'}{AR^3}\right) \vartheta^1 \wedge \vartheta^3\\ \Omega^0{}_3 &= d\omega^0{}_3+\omega^0{}_1 \wedge \omega^1{}_3 + \omega^0{}_2 \wedge \omega^2{}_3 \nonumber\\ &= \left(\frac{R''}{A^2R}-\frac{R'A'}{A^3R}-\frac{R'^2}{A^2R^2}\right) \vartheta^0 \wedge \vartheta^3+ \frac{R'^2}{A^2R^2} \vartheta^0 \wedge \vartheta^3 + \frac{R'\cot\theta}{AR^2} \vartheta^2 \wedge \vartheta^3 + \frac{B'}{2AR^2} \vartheta^1 \wedge \vartheta^2 \nonumber \\& \hspace{1em}+ \frac{BR'}{2AR^3} \vartheta^2 \wedge \vartheta^1- \frac{R'\cot\theta}{AR^2} \vartheta^2 \wedge \vartheta^3 \nonumber \\ &= \left(\frac{R''}{A^2R}-\frac{R'A'}{A^3R}\right) \vartheta^0 \wedge \vartheta^3 +\frac{1}{2}\left(\frac{B'}{AR^2} - \frac{BR'}{AR^3}\right) \vartheta^1 \wedge \vartheta^2 \end{align} \end{subequations} \begin{subequations} \begin{align} \Omega^1{}_2 &= d\omega^1{}_2+\omega^1{}_0 \wedge \omega^0{}_2 + \omega^1{}_3 \wedge \omega^3{}_2 \nonumber\\ &= \left(-\frac{B'}{2AR^2} + \frac{BR'}{AR^3}\right) \vartheta^0 \wedge \vartheta^3 - \frac{BR'}{2AR^3} \vartheta^0 \wedge \vartheta^3 - \frac{B\cot\theta}{2R^3}\vartheta^2 \wedge \vartheta^3 + \frac{B'R'}{A^2BR} \vartheta^1 \wedge \vartheta^2 \nonumber \\& \hspace{1em} - \frac{B^2}{4R^4} \vartheta^2 \wedge \vartheta^1 + \frac{B\cot\theta}{2R^3}\vartheta^2 \wedge \vartheta^3 \nonumber \\ &= \frac{1}{2}\left(\frac{BR'}{AR^3} - \frac{B'}{AR^2} \right) \vartheta^0 \wedge \vartheta^3 + \left( \frac{B'R'}{A^2BR} + \frac{B^2}{4R^4}\right) \vartheta^1 \wedge \vartheta^2\\ \Omega^1{}_3 &= d\omega^1{}_3+\omega^1{}_0 \wedge \omega^0{}_3 + \omega^1{}_2 \wedge \omega^2{}_3 \nonumber\\ &= \left(\frac{B'}{2AR^2} - \frac{BR'}{AR^3}\right) \vartheta^0 \wedge \vartheta^2 + \frac{BR'}{2AR^3} \vartheta^0 \wedge \vartheta^2 + \frac{B'R'}{A^2BR} \vartheta^1 \wedge \vartheta^3 - \frac{B^2}{4R^4} \vartheta^3 \wedge \vartheta^1 \nonumber\\ &= \frac{1}{2}\left(\frac{B'}{AR^2} - \frac{BR'}{AR^3}\right) \vartheta^0 \wedge \vartheta^2 + \left( \frac{B'R'}{A^2BR} + \frac{B^2}{4R^4}\right) \vartheta^1 \wedge \vartheta^3\\ \Omega^2{}_3 &= d\omega^2{}_3+\omega^2{}_0 \wedge \omega^0{}_3 + \omega^2{}_1 \wedge \omega^1{}_3 \nonumber\\ &= \left(\frac{B'}{2AR^2} - \frac{BR'}{AR^3}\right) \vartheta^0 \wedge \vartheta^1 + \frac{B'}{2AR^2} \vartheta^0 \wedge \vartheta^1 - \frac{B^2}{2R^4} \vartheta^2 \wedge \vartheta^3 + \frac{\csc^2\theta}{R^2} \vartheta^2 \wedge \vartheta^3 \nonumber\\ &\hspace{1em}+\frac{R'\cot\theta}{AR^2} \vartheta^0 \wedge \vartheta^3 - \frac{R'\cot\theta}{AR^2} \vartheta^0 \wedge \vartheta^3 - \frac{\cot^2\theta}{R^2} \vartheta^2 \wedge \vartheta^3 + \frac{R'^2}{A^2R^2} \vartheta^2 \wedge \vartheta^3 +\frac{B^2}{4R^4} \vartheta^3 \wedge \vartheta^2 \nonumber\\ &= \left(\frac{B'}{AR^2} - \frac{BR'}{AR^3}\right) \vartheta^0 \wedge \vartheta^1 + \left(\frac{1}{R^2}+ \frac{R'^2}{A^2R^2}-\frac{3}{4}\frac{B^2}{R^4}\right) \vartheta^2 \wedge \vartheta^3. \end{align} \end{subequations} Using \(\Omega^\mu{}_\nu = \frac{1}{2}R^{\mu}_{\nu\alpha\beta}\theta^\alpha\wedge\theta^\beta\), the non-vanishing components of the Riemann tensor, up to symmetry, are \begin{subequations} \begin{align} R^0{}_{101} &= \frac{B''}{A^2B}-\frac{B'A'}{A^3B}\\ R^0{}_{123} &= 2R^0{}_{213} = -2R^0{}_{312} = \frac{BR'}{AR^3} - \frac{B'}{AR^2}\\ R^0{}_{202} &= R^0{}_{303} = \frac{R''}{A^2R}-\frac{R'A'}{A^3R}\\ R^1{}_{212} &= R^1{}_{313} = \frac{B'R'}{A^2BR} + \frac{B^2}{4R^4}\\ R^2{}_{323} &= \frac{1}{R^2}+ \frac{R'^2}{A^2R^2}-\frac{3}{4}\frac{B^2}{R^4} \end{align} \end{subequations} The components of the Ricci tensor are \begin{subequations} \begin{align} R_{00} &= -R^0{}_{101} - 2 R^0{}_{202}\\ R_{11} &= R^0{}_{101} + 2 R^1{}_{212}\\ R_{22} &= R_{33} = R^0{}_{202} + R^1{}_{212} + R^2{}_{323}, \intertext{with all other components being zero. The Ricci scalar is then} R &= -R_{00} + R_{11} + R_{22} + R_{33}\\ &= 2\left(R^0{}_{101}+2R^1{}_{212}+2R^0{}_{202}+ R^2{}_{323}\right). \intertext{Thus, we obtain the following non-vanishing components of the Einstein tensor} G_{00} &= 2 R^1{}_{212} + R^2{}_{323}\\ G_{11} &= -2R^0{}_{202} - R^2{}_{323}\\ G_{22} &= G_{33} = -R^0{}_{202} - R^1{}_{212} - R^0{}_{101}. \end{align} \end{subequations} Now we will solve the vacuum Einstein field equations. Suppose \(\langle dR,dR\rangle = 0\) in \(U\). Then, if \(R\) is constant in \(U\), \(R = R_0 >0 \), we have \begin{subequations} \begin{align} 0 &= G_{00} = \frac{B^2}{2R^4_0}+\frac{1}{R^2_0}-\frac{3}{4}\frac{B^2}{R^4_0}\\ \iff B^2 &= 4R^2_0 = \text{const}. \end{align} \end{subequations} Inserting this condition in \(0 = G_{11}\) we arrive at the following contradiction: \begin{align} 0 = G_{11} &= -\frac{1}{R^2_0}+\frac{3}{4}\frac{B^2}{R^4_0} = \frac{2}{R^2_0}. \end{align} On the other hand, \(dR\) can not be non-zero and lightlike, since the group orbits are non-null. Therefore, considering \(\langle dR,dR\rangle \neq 0\) in \(U\), we will choose coordinates such that \(R(r) = r\). Next, to solve the field equations, we will consider \begin{subequations} \begin{align} 0 &= G_{00} + G_{11}= 2\left(R^1{}_{212}-R^0{}_{202}\right)\\ \iff 0 &= r^3(AB'+A'B)+\frac{1}{4}A^3B^3\\ &= r^3(AB)'+\frac{1}{4}(AB)^3. \end{align} \end{subequations} Defining \(D(r) = A(r)B(r)\), we get the first order ordinary differential equation for \(D\) \begin{align} r^3D'+\frac{1}{4}D^3 = 0, \end{align} which can be integrated to give \begin{align} D^2(r) = \frac{4r^2c_0}{r^2-c_0}, \end{align} with \(c_0 > 0\). Thus we need to have \(r^2 > c_0\). Now to solve \begin{align} 0 &= G_{00} = 2\frac{B'}{A^2Br} - \frac{B^2}{4r^4} + \frac{1}{r^2} + \frac{1}{A^2r^2} \end{align} we use \(D^2 = A^2B^2\) and multiply the equation by \(4c_0r^4\) to get \begin{subequations} \begin{align} 0 &= r(r^2-c_0)2BB'- c_0B^2 + 4r^2c_0 + (r^2-c_0)B^2\\ &= r(r^2-c_0)(B^2)'+(r^2-2c_0)B^2 + 4r^2c_0. \end{align} \end{subequations} Then, by introducing \(F(r) \coloneqq B^2(r)\), we obtain an inhomogeneous first order linear differential equation \begin{align} 0 = F'+\frac{r^2-2c_0}{r(r^2-c_0)}F + \frac{4rc_0}{r^2-c_0}. \end{align} To solve this differential equation, we will first solve the corresponding homogeneous equation: \begin{subequations} \begin{align} 0 &= F_h'+\frac{r^2-2c_0}{r(r^2-c_0)}F_h\\ &= F_h'+\frac{2(r^2-c_0)-r^2}{r(r^2-c_0)}F_h\\ &= F_h'+\left(\frac{2}{r}-\frac{r}{r^2-c_0}\right)F_h. \end{align} \end{subequations} Thus, by integrating, the solution is given by \begin{subequations} \begin{align} &ln(F_h) = -\left(ln(r^2)-ln\left(\sqrt{r^2-c_0}\right)\right)+c\\ \iff & F_h = c'\frac{\sqrt{r^2-c_0}}{r^2}, \quad c' = e^c. \end{align} \end{subequations} Now to obtain the general solution, we will multiply the inhomogeneous equation by \(c'/F_h\): \begin{subequations} \begin{align} 0 &= \frac{r^2}{\sqrt{r^2-c_0}}F'+\frac{r^3-2rc_0}{(r^2-c_0)^{3/2}}F + \frac{4r^3c_0}{(r^2-c_0)^{3/2}}\\ &= \left(\frac{r^2}{\sqrt{r^2-c_0}}F\right)' + \frac{4r^3c_0}{(r^2-c_0)^{3/2}}. \end{align} \end{subequations} Hence, the solution is given by \begin{subequations} \begin{align} F = c_1\frac{\sqrt{r^2-c_0}}{r^2}-\frac{\sqrt{r^2-c_0}}{r^2}\int\frac{4r^3c_0}{(r^2-c_0)^{3/2}}dr. \end{align} \end{subequations} To solve the integral we will use the substitution \(u = \sqrt{r^2-c_0}\) with \(dr = \frac{u}{\sqrt{u^2+c_0}}du\) such that \begin{subequations} \begin{align} &\int \frac{4(u^2+c_0)^{3/2}c_0}{u^3}\frac{u}{\sqrt{u^2+c_0}}du\\ = &\int 4c_0+\frac{4c_0{}^2}{u^2}du\\ = &4c_0u-\frac{4c_0{}^2}{u}. \end{align} \end{subequations} Therefore, the solution of the inhomogeneous differential equation is \begin{align} F = B^2 = \frac{-4c_0r^2+c_1\sqrt{r^2-c_0}+8c_0^2}{r^2}. \end{align} Thus, we have solved \(G_{00} = G_{11} = 0\) and obtained functions \(B^2(r)\) and \(A^2(r) = \frac{D^2(r)}{B^2(r)}\) implying \begin{subequations} \begin{align} R^1{}_{212} &= R^0{}_{202}\\ 2R^1{}_{212} &= - R^2{}_{323}. \end{align} \end{subequations} One can check that these functions satisfy \(R^0{}_{101} = R^2{}_{323}\), implying \(G_{22} = G_{33} = 0\).\\ Inserting the functions in the metric, we see that there is a singularity at \(r^2 = c_0\). To check if the space-time has a curvature singularity, we will compute the Kretschmann scalar \begin{align} K = R^{\alpha\beta\mu\nu}R_{\alpha\beta\mu\nu}. \end{align} Using the symmetry of the Riemann tensor and the implications of the field equations, the Kretschmann scalar is given by \begin{align} K &= 4(R^0{}_{101})^2-8(R^0{}_{123})^2-8(R^0{}_{231})^2-8(R^0{}_{231})^2+4(R^0{}_{202})^2 \nonumber\\ &\hspace{1em}+4(R^0{}_{303})^2+4(R^1{}_{212})^2+4(R^1{}_{313})^2+4(R^2{}_{323})^2 \nonumber\\ &= 12\left((R^0{}_{101})^2-(R^0{}_{123})^2\right) \nonumber\\ &= \frac{3}{4} c_0{}^{-2}r^{-12}\biggl(2048c_0{}^6-3072c_0{}^5r^2-18c_0c_1{}^2r^4+c_1{}^2r^6+128c_0{}^4\left(9r^4+4c_1\sqrt{r^2-c_0}\right)\\& \quad \qquad \qquad \quad +48c_0{}^2c_1r^2\left(c_1+2r^2\sqrt{r^2-c_0}\right)-32c_0{}^3\left(c_1{}^2+2r^6+16c_1r^2\sqrt{r^2-c_0}\right)\biggr), \end{align} observing that it is regular at \(r^2 = c_0\), thus indicating that the singularity is due to a poor choice of coordinates. To solve the coordinate singularity, we will use the following coordinate transformation: \begin{align} r' = \frac{1}{2\sqrt{c_0}}\int D(r)dr = \sqrt{r^2-c_0}, \quad dr' = \frac{1}{2\sqrt{c_0}}D(r)dr. \end{align} With respect to \(r'\) we have \begin{align} B^2(r') = -4c_0\frac{r'^2-\frac{c_1}{4c_0}r'-c_0}{r'^2+c_0}. \end{align} Defining \(l^2 \coloneqq c_0 > 0, \, m \coloneqq \frac{c_1}{8c_0}\), the metric takes the form \begin{subequations} \begin{align} g &= -\frac{4l^2}{B^2(r')}dr'^2+B^2(r')(d\psi+\cos\theta d\varphi)^2 + (r'^2+l^2) \, (d\theta^2+\sin^2\theta d\varphi^2)\\ &= \frac{r'^2+l^2}{r'^2-2mr-l^2}dr'^2 - 4l^2\frac{r'^2-2mr'-l^2}{r'^2+l^2} (d\psi+\cos\theta d\varphi)^2 + (r'^2+l^2) \, (d\theta^2+\sin^2\theta d\varphi^2). \end{align} \end{subequations} So we see that we obtain the generalized Taub-NUT space-time and since we assumed that the orbits are spacelike, we get in fact the Taub-region. Now if we consider the case \(\varepsilon = -1\), so timelike orbits, we have \begin{align} g = A^2(r) dr^2 - B^2(r) (d\psi+\cos\theta d\varphi)^2 + R^2(r) (d\theta^2+\sin^2\theta d\varphi^2). \end{align} Using the orthonormal tetrad \begin{subequations} \begin{align} \vartheta^0 &= B(r)(d\psi+\cos\theta d\varphi)\\ \vartheta^1 &= A(r) dr\\ \vartheta^2 &= R(r) d\theta\\ \vartheta^3 &= R(r)\sin\theta d\varphi. \end{align} \end{subequations} we obtain \begin{subequations} \begin{align} d\vartheta^0 &= \frac{B'}{AB} \vartheta^1 \wedge \vartheta^0 - \frac{B}{R^2} \vartheta^2 \wedge \vartheta^3\\ d\vartheta^1 &= 0\\ d\vartheta^2 &= \frac{R'}{AR} \vartheta^1 \wedge \vartheta^2\\ d\vartheta^3 &=\frac{R'}{AR} \vartheta^1 \wedge \vartheta^3 + \frac{\cot\theta}{R} \vartheta^2 \wedge \vartheta^3. \end{align} \end{subequations} The connection one-forms are then given by \begin{subequations} \begin{align} \omega^0{}_{1} &= \omega^1{}_{0} = \frac{B'}{AB} \vartheta^0\\ \omega^0{}_{2} &= \omega^2{}_{0} = -\frac{B}{2R^2} \vartheta^3\\ \omega^0{}_{3} &= \omega^3{}_{0} = \frac{B}{2R^2}\vartheta^2\\ \omega^1{}_{2} &= -\omega^2{}_{1} = - \frac{R'}{AR} \vartheta^2\\ \omega^1{}_{3} &= -\omega^3{}_{1} = -\frac{R'}{AR} \vartheta^3\\ \omega^2{}_{3} &= -\omega^3{}_{2} = -\frac{B}{2R^2} \vartheta^0 - \frac{\cot\theta}{R} \vartheta^3. \end{align} \end{subequations} Due to their strong resemblance to the case of spacelike orbits we will see that solving the vacuum Einstein equations is analogous. Using the second structure equations the curvature \(2\)-form can be calculated \begin{subequations} \begin{align} \Omega^0{}_1 &= -\left(\frac{B''}{A^2B}-\frac{B'A'}{A^3B}\right) \vartheta^0 \wedge \vartheta^1 + \left(\frac{BR'}{AR^3} - \frac{B'}{AR^2}\right) \vartheta^2 \wedge \vartheta^3\\ \Omega^0{}_2 &= \frac{1}{2}\left(\frac{BR'}{AR^3} - \frac{B'}{AR^2} \right) \vartheta^1 \wedge \vartheta^3 - \left( \frac{B'R'}{A^2BR} + \frac{B^2}{4R^4}\right) \vartheta^0 \wedge \vartheta^2\\ \Omega^0{}_3 &= \frac{1}{2}\left(\frac{B'}{AR^2} - \frac{BR'}{AR^3}\right) \vartheta^1 \wedge \vartheta^2 - \left( \frac{B'R'}{A^2BR} + \frac{B^2}{4R^4}\right) \vartheta^0 \wedge \vartheta^3\\ \Omega^1{}_2 &= -\left(\frac{R''}{A^2R}-\frac{R'A'}{A^3R}\right) \vartheta^1 \wedge \vartheta^2 -\frac{1}{2}\left(\frac{B'}{AR^2} - \frac{BR'}{AR^3}\right) \vartheta^0 \wedge \vartheta^3\\ \Omega^1{}_3 &= -\left(\frac{R''}{A^2R}-\frac{R'A'}{A^3R}\right) \vartheta^1 \wedge \vartheta^3 -\frac{1}{2}\left(\frac{B'}{AR^2} - \frac{BR'}{AR^3}\right) \vartheta^0 \wedge \vartheta^2\\ \Omega^2{}_3 &=\left(\frac{B'}{AR^2} - \frac{BR'}{AR^3}\right) \vartheta^0 \wedge \vartheta^1 + \left(\frac{1}{R^2}- \frac{R'^2}{A^2R^2}+\frac{3}{4}\frac{B^2}{R^4}\right) \vartheta^2 \wedge \vartheta^3. \end{align} \end{subequations} Then using \(\Omega^\mu{}_\nu = \frac{1}{2}R^{\mu}_{\nu\alpha\beta}\theta^\alpha\wedge\theta^\beta\), the non-vanishing components of the Riemann tensor, up to symmetry, are \begin{subequations} \begin{align} R^0{}_{101} &= -\frac{B''}{A^2B}+\frac{B'A'}{A^3B}\\ R^0{}_{123} &= 2R^0{}_{213} = -2R^0{}_{312} = \frac{BR'}{AR^3} - \frac{B'}{AR^2}\\ R^0{}_{202} &= R^0{}_{303} = -\frac{B'R'}{A^2BR} - \frac{B^2}{4R^4}\\ R^1{}_{212} &= R^1{}_{313} = -\frac{R''}{A^2R}+\frac{R'A'}{A^3R}\\ R^2{}_{323} &= \frac{1}{R^2}- \frac{R'^2}{A^2R^2}+\frac{3}{4}\frac{B^2}{R^4}. \end{align} \end{subequations} Analogously, we have the following non-vanishing components of the Einstein tensor \begin{subequations} \begin{align} G_{00} &= 2 R^1{}_{212} + R^2{}_{323}\\ G_{11} &= -2R^0{}_{202} - R^2{}_{323}\\ G_{22} &= G_{33} = -R^0{}_{202} - R^1{}_{212} - R^0{}_{101}. \end{align} \end{subequations} Now we will solve the vacuum Einstein field equations. Supposing \(\langle dR,dR\rangle = 0\) in \(U\) leads analogously to a contradiction. Therefore, we have \(\langle dR,dR\rangle \neq 0\) in \(U\) and we can choose coordinates such that \(R(r) = r\). Then to solve the field equations we will consider again \(0 = G_{00} + G_{11} = 2\left(R^1{}_{212}-R^0{}_{202}\right)\), but since \(R^1{}_{212}\) and \(R^0{}_{202}\) correspond to curvature components \(-R^0{}_{202}\) and \(-R^1{}_{212}\), respectively, for the case \(\varepsilon = 1\) we see that they satisfy the same differential equation. Hence defining \(D(r) = A(r)B(r)\), we have \begin{align} D^2(r) = \frac{4r^2c_0}{r^2-c_0}, \end{align} with \(c_0 > 0\) and \(r^2 > c_0\). Now we will solve \begin{align} 0 &= G_{11} = 2\frac{B'}{A^2Br} - \frac{B^2}{4r^4} - \frac{1}{r^2} + \frac{1}{A^2r^2}. \end{align} Using \(D^2 = A^2B^2\) and multiplying the equation by \(4c_0r^4\) we obtain \begin{subequations} \begin{align} 0 &= r(r^2-c_0)2BB'- c_0B^2 - 4r^2c_0 + (r^2-c_0)B^2\\ &= r(r^2-c_0)(B^2)'+(r^2-2c_0)B^2 - 4r^2c_0\,. \end{align} \end{subequations} Then again introducing \(F(r) \coloneqq B^2(r)\) we have the inhomogeneous first order linear differential equation \begin{align} 0 = F'+\frac{r^2-2c_0}{r(r^2-c_0)}F - \frac{4rc_0}{r^2-c_0}. \end{align} Hence, we see that the corresponding homogeneous equation coincides with the one for spacelike orbits. Thus, we have \begin{align} F_h = c'\frac{\sqrt{r^2-c_0}}{r^2}. \end{align} Now to obtain the general solution we will multiply the inhomogeneous equation by \(c'/F_h\): \begin{subequations} \begin{align} 0 &= \frac{r^2}{\sqrt{r^2-c_0}}F'+\frac{r^3-2rc_0}{(r^2-c_0)^{3/2}}F - \frac{4r^3c_0}{(r^2-c_0)^{3/2}}\\ &= \left(\frac{r^2}{\sqrt{r^2-c_0}}F\right)' - \frac{4r^3c_0}{(r^2-c_0)^{3/2}}. \end{align} \end{subequations} Hence, the solution is given by \begin{subequations} \begin{align} F = B^2 &= c_1\frac{\sqrt{r^2-c_0}}{r^2}+\frac{\sqrt{r^2-c_0}}{r^2}\int\frac{4r^3c_0}{(r^2-c_0)^{3/2}}dr\\ &= \frac{4c_0r^2+c_1\sqrt{r^2-c_0}-8c_0^2}{r^2} \end{align} \end{subequations} Now with the same line of argument we use the coordinate transformation \begin{align} r' = \frac{1}{2\sqrt{c_0}}\int D(r)dr = \sqrt{r^2-c_0}, \quad dr' = \frac{1}{2\sqrt{c_0}}D(r)dr. \end{align} such that \begin{align} B^2(r') = 4c_0\frac{r'^2+\frac{c_1}{4c_0}r'-c_0}{r'^2+c_0}. \end{align} Then defining \(l^2 \coloneqq c_0 > 0, \, m \coloneqq -\frac{c_1}{8c_0}\) we again obtain the generalized Taub-NUT metric \begin{subequations} \begin{align} g &= \frac{4l^2}{B^2(r')}dr'^2-B^2(r')(d\psi+\cos\theta d\varphi)^2 + (r'^2+l^2) (d\theta^2+\sin^2\theta d\varphi^2)\\ &= \frac{r'^2+l^2}{r'^2-2mr-l^2}dr'^2 - 4l^2\frac{r'^2-2mr'-l^2}{r'^2+l^2} (d\psi+\cos\theta d\varphi)^2 + (r'^2+l^2) \, (d\theta^2+\sin^2\theta d\varphi^2), \end{align} \end{subequations} however describing the NUT-regions. If the orbits are not everywhere space- or timelike, we can join them smoothly along the null hypersurfaces by an extension of the form described in the last chapter.\\ \end{proof} Thus, with respect to the constants, \(m\), \(l\) and \(n\), we have a three parameter family of vacuum space-times admitting \(SU(2) \times U(1)\) as an isometry group, such that \(SU(2)\times U(1)\) and \(SU(2)\) both have three-dimensional non-null orbits. The Taub-NUT space-time is then the unique universal cover. As in the case of the Taub-NUT space-time the generalized space-time can be considered to be a principal fibre bundle with respect to the \(U(1)\) right action with its first chern class being the constant \(n\). Furthermore, recalling the remarks in the last section, the constant \(m\) can be considered to be the Komar mass of the space-time. In particular, in this case null infinity is the Lens space \(L(n,1)\) and the NUT parameter \(l\), being the dual-Bondi-mass with respect to the infinitesimal translation induced by the Killing vector field \(-\frac{1}{2l}\partial_\psi\), is proportional to \(n\). Moreover, being a non-trivial \(S^1\) principal fibre bundle over \(S^2\) implies that the NUT parameter is non-zero. \section{Outlook} \label{sec:Outlook} Taub-NUT is a very peculiar spacetime in many respects, not only mathematically, but also concerning its possible physical interpretation. Yet it is frequently regarded for possible applications in astrophysics and cosmology, thereby suggesting that it may be taken as an adequate model for some astrophysical object. Geodesic motions, shadows, and lensing in NUT-spacetime have been investigated in detail; see, e.g., \cite{Kagramanova.EtAl:2010,Jefremov.Perlick:2016,Halla.Perlick:2020}. The question of whether and how NUT-spacetime could be regarded as the exterior geometry produced by some star made of ordinary matter, like, e.g., a perfect fluid, is an old one with partially controversial claims, in particular regarding the physical interpretation of the NUT charge. So far no compelling physical insight seems to exists as to what known properties of ordinary matter could source a non-zero NUT charge. Perfect-fluid solutions with radially pointing vorticity fields have been constructed for that end, but the solutions established in \cite{Bradley.EtAl:1999} are singular, as has been discussed in \cite{Rana:2019}. In view of this mismatch between hypothetical physical applications eventually leading to measurements of the NUT parameter on one hand, and the lacking of a proper physical understanding of what might possibly be a matter source (if any) of it on the other, it seems a viable strategy to first characterise the solution as uniquely as possible by its symmetry properties. This is what we attempted and achieved in this work. The physical problem proper clearly remains open for the time being. Also, the mathematical problem of classifying the inequivalent maximal extensions of generalised Taub-NUT should be addressed, which we plan to do in a future publication. \section{Taub-NUT space-time} \label{ref:Taub-NUT} In the following we will present some of the features of the Taub-NUT space-time with respect to the interpretation given by Misner~\cite{Misner:1963}. In this interpretation the topology of space-time is \(\mathbb{R} \times S^3\) and, using Euler coordinates, the metric is given by \begin{align} \label{mismetric} g = -4l^2f(r)(d\psi+\cos\theta d\varphi)^2+\frac{1}{f(r)}dr^2+(r^2+l^2)(d\theta^2+\sin^2\theta d\varphi^2), \end{align} with \begin{align} f(r) = \frac{r^2-2mr-l^2}{r^2+l^2}. \end{align} The constant \(m \in \mathbb{R}\) is interpreted as the mass and the constant \(l \in \mathbb{R}\setminus\{0\}\) is referred to as the NUT parameter. The four-dimensional isometry group of this space-time is \(SU(2)_L \times U(1)_R\) induced by the left-invariant vector field \(\xi_0 = \partial_\psi\) (generating right-translations) and the right-invariant vector fields \begin{subequations} \begin{align} \xi_1 &= -\sin\varphi\partial_\theta- \cot\theta\cos\varphi\partial_\varphi+\csc\theta\cos\varphi\partial_\psi\\ \xi_2 &= \cos\varphi\partial_\theta- \cot\theta\sin\varphi\partial_\varphi+\csc\theta\sin\varphi\partial_\psi\\ \xi_3 &= \partial_\varphi. \end{align} \end{subequations} (generating left-translations) on the 3-sphere, which we identify with the group manifold of \(SU(2)\). Note that the subscripts \(L\) and \(R\) on \(SU(2)\) and \(U(1)\), respectively, are meant to indicate that these groups act via left- and right-multiplication on \(SU(2)\). The vector fields \(\xi_0,\xi_1,\xi_2,\xi_3\) satisfy the commutation relations: \begin{subequations} \begin{align} [\xi_i,\xi_j] &= -\varepsilon^k_{ij}\xi_k \\ [\xi_0,\xi_i] &= 0 \quad \qquad i,j,k = 1,2,3. \end{align} \end{subequations} In terms of the left-invariant one-forms \begin{subequations} \begin{align} \sigma_x &= \sin\psi d\theta-\sin\theta\cos\psi d\varphi\\ \sigma_y &= \cos\psi d\theta+\sin\theta\sin\psi d\varphi\\ \sigma_z &= d\psi+\cos\theta d\varphi \end{align} \end{subequations} the metric can be written as \begin{align} g = -4l^2f(r)\sigma_z^2+\frac{1}{f(r)}dr^2+(r^2+l^2)(\sigma_x^2+\sigma_y^2). \end{align} The orbit generated by \(\xi_1,\xi_2,\xi_3\) is three-dimensional, namely \(S^3\), with the orbits generated by \(\xi_0\) being subsets of it.\\ In the given coordinates the analytical expressions become singular at \(r_{\pm} = m \pm \sqrt{m^2+l^2}\), whereas all components of the Riemann tensor in an orthonormal tetrad, and hence in particular the Kretschmann scalar, are regular. This indicates that these singularities are, in fact, coordinate artefacts. They correspond to the Killing horizons of the Killing vector field \(\partial_\psi\). A possible coordinate transformation removing these singularities is given by \begin{align} \psi' = \psi + \int\frac{1}{2lf(r)}dr \end{align} such that the metric in these new coordinates is given by \begin{align} \label{firstextension} g = -4l^2f(r)(d\psi'+\cos\theta d\varphi)^2+2(2l)(d\psi'+\cos\theta d\varphi)dr+(r^2+l^2)(d\theta^2+\sin^2\theta d\varphi^2). \end{align} Another coordinate transformation would be \begin{align} \psi'' = \psi - \int\frac{1}{2lf(r)}dr, \end{align} giving \begin{align} g = -4l^2f(r)(d\psi''+\cos\theta d\varphi)^2-2(2l)(d\psi''+\cos\theta d\varphi)dr+(r^2+l^2)(d\theta^2+\sin^2\theta d\varphi^2). \end{align} Written in terms of the left-invariant one-forms of \(S^3\), it is immediate that the metrics are regular on the whole manifold \(\mathbb{R} \times S^3\). Furthermore, it can be shown that both space-times are maximal \cite{Taub:1951}. In these coordinates both the stationary regions \(r<r_-\) and \(r>r_+ \, \), the so-called NUT-regions, and the region \(r_-<r<r_+\), called the Taub-region, are included. In particular, the hypersurfaces of \(r = const.\) are 3-spheres being spacelike in the Taub-region, timelike in the NUT-regions, and lightlike at \(r=r_\pm\).\\ Furthermore, with respect to the \(U(1)\) right multiplication the space-time can be considered to be a principal fibre bundle analogous to the Hopf bundle. Since the \(r = const.\) hypersurfaces are 3-spheres, there exist no equal-time hypersurfaces intersecting these 3-spheres in two-spheres along which we could evaluate the Komar integral for mass in the usual form . However, we can use the structure of \(S^3\) as \(U(1)\) principle fibre bundle over the base \(S^2\), which has a natural connection given by the distribution of orthogonal complements to the fibre in each tangent space where the generating vector field of \(U(1)\) is non-null. It is then possible to uniquely identify horizontal and right-invariant \(k\)-forms with \(k\)-forms on the base \(S^2\). Thus, considering the NUT regions, admitting the timelike Killing vector field \(\partial_\psi\) (generating the right-\(U(1)\) translation) the Komar mass of the space-time can be calculated. We will be using the orthonormal tetrad \begin{subequations} \begin{align} \vartheta^0 &= 2lf^{1/2}(r)(d\psi+\cos\theta d\varphi)\\ \vartheta^1 &= f^{-1/2}(r)dr\\ \vartheta^2 &= (r^2+l^2)^{1/2} d\theta\\ \vartheta^3 &= (r^2+l^2)^{1/2}\sin\theta d\varphi. \end{align} \end{subequations} For \(\lim\limits_{r \to \infty} f(r) = 1\), we will calculate the Komar mass with respect to the Killing vector field \(k \coloneqq -\frac{1}{2l}\partial_\psi\) which is normalised at infinity \(r \to \infty\). The metric-dual one-form of the timelike Killing vector field is then given by \begin{align} k^{\flat} = 2lf(r)(d\psi+\cos\theta d\varphi) \end{align} and hence \begin{subequations} \begin{align} dk^{\flat} &= 2lf'(r)dr \wedge (d\psi+\cos\theta d\varphi) - 2lf(r) \sin\theta d\theta \wedge d\varphi\\ &= -f'(r) \vartheta^0 \wedge \vartheta^1 -2l\frac{f(r)}{r^2+l^2} \vartheta^2 \wedge \vartheta^3\,, \end{align} \end{subequations} where we used the standard notation that denotes the one-form image of the vector \(k\) under the metric isomorphism by \(k^{\flat}=:g(k,\cdot)\). Now, picking the orientation defined by \(\omega = \vartheta^0 \wedge \vartheta^1 \wedge \vartheta^2 \wedge \vartheta^3\), we get \begin{subequations} \begin{align} *dk^{\flat} &= f'(r) \vartheta^2 \wedge \vartheta^3 - 2l\frac{f(r)}{r^2+l^2} \vartheta^0 \wedge \vartheta^1\\ &= f'(r)(r^2+l^2) \sin\theta d\theta \wedge d\varphi + 4l^2\frac{f(r)}{r^2+l^2} dr \wedge (d\psi+\cos\theta d\varphi). \end{align} \end{subequations} Then with respect to an arbitrary hypersurface \(r_0 = const.\), the two-form is given by \begin{align} *dk^{\flat} &= -f'(r_0)(r_0^2+l^2) d\sigma_z. \end{align} Since \(\frac{i}{2}\sigma_z\) is a connection one-form for the principal fibre bundle, \(*dk^{\flat}\) can be considered as a multiple of the curvature form and hence is horizontal and right-invariant, as well as closed. Thus, we can identify it with a closed two-form on the base space \(S^2\), such that using the formula for the Komar mass, we have \begin{align} -\frac{1}{8\pi}\int_{S^2_{\infty}}*dk^{\flat} = \lim_{r\to\infty}-\frac{1}{8\pi}f'(r)(r^2+l^2)\int_{S^2}\sin\theta d\theta \wedge d\varphi = -m. \end{align} Therefore \(m\) can be interpreted as the Komar mass of the space-time. Moreover, considering \(dk^{\flat}\) instead of \(*dk^{\flat}\), the same line of argument can be applied to give \begin{align} -\frac{1}{8\pi}\int_{S^2_{\infty}}dk^{\flat} = \lim_{r\to\infty}\frac{1}{8\pi}2lf(r)\int_{S^2}\sin\theta d\theta \wedge d\varphi = l. \end{align} So the constants \(m\) and \(l\) are related by Hodge duality.\\ Duality also arises in the description of the dual-Bondi-mass of space-times which are asymptotically empty and flat at null infinity and with vanishing Bondi news. It can be shown that in this case null infinity, for space-times having a non-vanishing dual-Bondi-mass, is topologically a Lens space \(L(n,1)\) and a principal fibre bundle \((L(n,1),\pi,S^2;S^1)\), with the dual-Bondi-mass being proportional to the number of twists, \(n\), in the bundle. Conversely, if null infinity is a non-trivial \(S^1\) principal fibre bundle over \(S^2\), the news tensor field vanishes and there exists an infinitesimal translation such that the dual-Bondi-mass with respect to it is non-zero. In particular, the Taub-NUT space-time can be shown to be asymptotically empty and flat at null infinity, with null infinity being a 3-sphere. The dual-Bondi-mass with respect to the infinitesimal translation induced by the Killing vector field \(-\frac{1}{2l}\partial_\psi\) can be computed to be the NUT parameter \(l\)~\cite{Ramaswamy.Sen:1981}.
\section{Introduction}\label{sec:introduction} APIs (Application Programming Interfaces) are interfaces to reusable software libraries and frameworks. The proper learning of APIs is paramount to support modern day rapid software development. To achieve this goal, APIs typically are supported by official documentation. An API documentation is a product itself, which warrants the creation and maintenance principles similar to any existing software product. A good documentation can facilitate the proper usage of an API, while a bad documentation can severely harm its adoption~\cite{Robillard-APIsHardtoLearn-IEEESoftware2009a}. Unfortunately, research shows that API official documentation can be often incomplete, incorrect, and outdated~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. We conducted an empirical study of five documentation smells in API documentation. We answer the following research questions: \begin{enumerate}[label=RQ\arabic{*}] \item How prevalent are the documentation smells in API official documentation? \item How accurate are machine learning models to automatically detect the documentation smells? \end{enumerate} \section{API Documentation Smells} Similar to code and design artifacts, software documentation can exhibit smells, if the design of the documentation has problems. Documentation smells refer to presentation issues of the documentations that do not make a documentation incorrect, rather they hinder the proper usage of the documentation. A smell in an API documentation unit can inform us of the bad design in the documentation unit. A documentation unit can be the documentation of a method, a type (e.g., a class), a package, and an API overall. Following previous works in API documentation \cite{Petrosyan-DiscoverAPITypeInformation-ICSE2015, ibm_survey_paper_uddin2015api}, we consider documentation unit as the documentation of a method/type. In this section, we present a catalog of 5 documentation smells based on previous studies \cite{ibm_survey_paper_uddin2015api} and exploratory analysis of API official documentation (i.e., JAVA API documentations), and a survey conducted on software developers to validate the found smells. \begin{figure*}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.6]{new_images/FlowChartDocSmell.png} \caption{Workflow of our study.} \label{fig:workflow_of_study} \end{figure*} \subsection{Catalog} We present 5 types of documentation smells where the first 4 types (i.e., Bloated, Excess Structural Information, Tangled, Fragmented) were cited by the IBM developers in a previous study \cite{ibm_survey_paper_uddin2015api} and the last one (i.e., Lazy) is introduced for the first time, being motivated by developers' discussion on various online forums (see Figure \ref{fig:motivating_lazy_example}). We believe that this catalog will help the developers to get a better understanding of documentation smells, and will facilitate future researches in this direction. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.18]{new_images/motivating_example_lazy.JPG} \caption{Tweet complaining about lazy documentation of code} \label{fig:motivating_lazy_example} \end{figure} \gias{describe each smell in the following format: what it is (texts + a figure), why it is chosen (mention previous research + discussion of the smell in web discussions) + what do developers in the survey think about it.} \subsubsection{Bloated} By `Bloated’ we mean those documentations whose description (of an API element type) is verbose or excessively extensive. It is difficult to understand lengthy documentations and use them properly. Moreover, they cannot be effectively handled that makes them hard to modify when needed, i.e. in case of any update in the API source codes. In our evaluation, we found many documentations that are larger than necessary. For example, the documentation shown in Figure \ref{fig:bloated_example} is so verbose and lengthy that it is hard to follow and use it. Hence, it is a bloated documentation. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/bloated_example.png} \caption{Example of Bloated Smell} \label{fig:bloated_example} \end{figure} \subsubsection{Excess Structural Information} A documentation with `Excess Structural Information’ smell contains too many structural syntax or information, e.g., the Javadoc of the java.lang.Object class Javadoc lists all the hundreds of subclasses of the class. In our study, we find this type of documentation to contain many class and package names. For instance, the documentation of Figure \ref{fig:excess_struct_example} contains many structural information (marked in red rectangle) that are unnecessary to understand and use the underlying method. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/excess_struct_example.png} \caption{Example of Excess Structural Information} \label{fig:excess_struct_example} \end{figure} \subsubsection{Tangled} We call a documentation `Tangled’ if its’ description is tangled with various information that makes it complex, reduces the readability and understandability of the description. Figure \ref{fig:tangled_example} depicts an example of tangled documentation which is hard to follow and understand. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/tangled_example.png} \caption{Example of Tangled Smell} \label{fig:tangled_example} \end{figure} \subsubsection{Fragmented} Sometimes it is seen that the information of documentation (related to an API element) is scattered over too many pages or sections. We consider them in the “Fragmented” category. In our empirical study, we found a good number of documentation that contain many URLs, and references that indicate possible fragmentation smell. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/fragmented_example.png} \caption{Example of Fragmented Smell} \label{fig:fragmented_example} \end{figure} \subsubsection{Lazy} We categorize a documentation as `Lazy’ if it contains very small information to convey to the readers. In many cases, it is seen that the documentation does not contain any extra information except what can be perceived directly from the function name. So this kind of documentation does not have much to offer to the readers. We can see a lazy documentation in Figure \ref{fig:lazy_example}. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/lazy_example.png} \caption{Example of Lazy Smell} \label{fig:lazy_example} \end{figure} \subsection{Description of the survey} How do developers feel about the smells? talk very briefly about the survey by simply motivating the detection of the smells. \section{Study Setup} \subsection{Benchmark of Documentation Smells} \subsubsection{Data Collection} talk about how data is collected, i.e., how we created the dataset for everyone to label for benchmarks. \subsubsection{Process} talk briefly about the benchmark creation process \subsection{Studied Features} \gias{put the feature summaries in a table} In this subsection, we describe the features that we used to train our SVM and \textit{k}NN-based models (see section \ref{subsubsec:ovr_svm} to \ref{subsubsec:ml_knn}) for documentation smell detection. \subsubsection{Documentation Length} We use the length of every documentation in order to capture the extensiveness of the bloated documentations. \subsubsection{Readability Metrics} We measure Flesch readability metrics for the documentations and use them as a feature to analyze the understandability of documentation. This feature might be useful to detect tangled documentations. \gias{justify using an example why this feature is chosen} \subsubsection{Number of Acronyms and Jargons} Since acronyms and jargons increase the complexity of a reading passage, we use the number of acronyms and jargon in every documentation to detect the tangled documentation by estimating the understandability. \subsubsection{Number of URLs} As URLs are hints of possible fragmentations in the documentation, we use the number of URLs to capture these smells. \subsubsection{Number of function, class and package name mentioned} We use the number of functions, classes, packages mentioned in documentation to capture excess structural information and fragmentation. \subsubsection{Edit Distance} From the definition of lazy documentation, it can be said that the edit distance of a lazy documentation and its’ unit definition (method prototype) will be comparatively small. So we calculate the edit distance between the documentation description and method prototype and use it as a feature for our machine learning models. \subsubsection{Average Cosine Similarity} We calculate the avg. cosine similarity of the documentations’ description. For this, we calculate the cosine similarities between each possible pair of that documentation and take their avg value for normalization. This feature will help to detect redundancy in the documentations. \subsection{Studied Algorithms} We applied both traditional and deep learning algorithms to detect documentation smells. We employed different decomposition approaches (i.e., One-Vs-Rest, Label Powerset, Classifier Chains)~\cite{multilabel_decomp_1_MultilabelClassificationAnOverview,multilabel_decomp_2_AReviewOnMultilabelLearning,multilabel_decomp_3_ATutorialOnMultilabelClassification,multilabel_decomp_4_LearningFromMultilabelData} with Support Vector Machine (SVM) \cite{SVM_SupportVectorNetworks} as the base estimator for multi-label classification of documentation smells. We chose SVM since it has been successfully used with these decomposition approaches for multi-label classification in previous studies \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM}. SVM has also shown great performance in text classification tasks \cite{svm_text_classification_1, svm_text_classification_2}. We also evaluated adapted approaches like ML-$k$NN \cite{MLkNN_ALazyLearningApproach}, and deep learning models like Bi-LSTM \cite{bi_lstm_BidirectionalRecurrentNeuralNetworks}, and BERT \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. \gias{group the studied algorithms into shallow vs deep maybe?} \subsubsection{OVR-SVM} \label{subsubsec:ovr_svm} One-Vs-Rest is a heuristic method that works by decomposing the multi-label classification problem into multiple independent binary classification problems (one per class) \cite{multilabel_decomp_1_MultilabelClassificationAnOverview, multilabel_decomp_3_ATutorialOnMultilabelClassification}. It trains a single classifier per class, with the samples of that class as positive samples and all other samples as negatives. All the independent classifiers then separately give individual class predictions for unseen data. We evaluated One-Vs-Rest (OVR) approach with SVM (as the base estimator) for detecting documentation smells. One-Vs-Rest support vector machine (OVR-SVM) has been successfully applied in several problems \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM, multilabel_decomp_1_MultilabelClassificationAnOverview}. We used RBF kernel for the SVM classifiers as recommended by earlier works \cite{svm_rbf_1_AComparisonStudyOfDifferentKernelFunctions, svm_rbf_2_APracticalGuideToSVM}. \subsubsection{LPS-SVM} \label{subsubsec:lps_svm} Label Power Set (LPS) treats every combination of labels as a new class and approaches in a multiclass classification manner \cite{LearningMultiLabelSceneClassification}. As a result, this method has high computational complexity. However, it is capable of taking label correlation into account. We used SVM (with RBF kernel) as the base estimator of the Label Power Set method \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM}. \subsubsection{CC-SVM} \label{subsubsec:cc_svm} Classifier Chains (CC) constructs a chain of binary classifiers, where every classifier uses the predictions of all the previous classifiers of the chain \cite{CC_1_ClassifierChainsForMultilabel, CC_2_ClassifierChainsForMultilabel}. This way the method can take label correlations into account. We constructed a Classifier Chain (CC) of SVMs and evaluated its’ performance for documentation smell detection. \subsubsection{ML-$k$NN} \label{subsubsec:ml_knn} Multi-label $k$ Nearest Neighbors (ML-$k$NN) is derived from the traditional $k$-nearest neighbor ($k$NN) algorithm \cite{MLkNN_ALazyLearningApproach}. It finds the $k$ nearest neighborhood of an input instance using $k$NN, then uses Bayesian inference to determine the label set of the instance. We studied this method because it has been reported to achieve considerable performance for different multi-label classification tasks in previous studies \cite{MLkNN_ALazyLearningApproach, mlknn_MultilabelTextClassificationUsingSemanticFeatures}. We used ML-$k$NN with the number of nearest neighbors, $K$ = 10 during our experiment as recommended by \cite{mlknn_MultilabelTextClassificationUsingSemanticFeatures}. \subsubsection{Bi-LSTM} Bidirectional LSTM is more capable of exploiting contextual information than the unidirectional LSTM \cite{bilstm_FramewisePhonemeClassificationWithBiLSTM}. Hence, the Bi-LSTM network can detect the documentation smell by capturing the information of the API documentations from both directions. We constructed a Bi-LSTM model with 300 hidden states and initialized it using the pre-trained GloVe embedding \cite{Glove_GlobalVectorsForWordRepresentation} of 100 dimensions. We used ADAM optimizer \cite{adam_optimizer} with an initial learning rate of 0.001. We trained the model with batch size 256 over 10 epochs. \subsubsection{BERT} Considering the great success of BERT (Bidirectional Encoder Representations from Transformers) in various natural language processing and text classification tasks \cite{bert_success_1,bert_success_2,bert_success_3,bert_success_4,bert_success_5,bert_success_6,bert_success_7}, we feel motivated to evaluate its’ performance in documentation smell detection. BERT is a pre-trained model which was designed to learn contextual word representations of unlabeled texts \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. We used BERT-Base for this study which has 12 layers with 12 attention heads and 110 million parameters. We trained it on our labeled dataset for 10 epochs with a mini-batch size of 32. We used early-stop to avoid overfitting \cite{early_stop_bert_1} and considered validation loss as the metric of the early-stopping \cite{early_stop_bert_2}. The maximum length of the input sequence was set to 256. We used AdamW optimizer \cite{adam_w} with the learning rate set to 4e\textsuperscript{-5}, ß1 to 0.9, ß2 to 0.999, and epsilon to 1e\textsuperscript{-8} \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers, bert_fine_tuning}. We used binary cross-entropy to calculate the loss \cite{binary_cross_AreLossFunctionSame}. \subsection{Performance Metrics} We analyze and report the performance of each of the techniques developed and experimented as part of the algorithms development steps. We used 5-fold iterative stratified cross-validation for reporting performances that has been recommended for a multilabel dataset in \cite{iterative_stratified_cross_valid}. We report the performances using standard multi-label classification metrics, i.e., Exact Match Ratio, Hamming Loss \cite{a_literature_survey_on_algorithms_for_multilabel}. We also report separate Accuracy, Precision, Recall, and F1-score for each class. \subsubsection{Iterative Stratified Cross-Validation} Traditional $k$-fold cross-validation is a statistical method of evaluating machine learning algorithms which divides data into $k$ equally sized folds and runs for $k$ iterations \cite{traditional_cross_validation_paper}. In each iteration, each of the $k$ folds is used as the held-out set for validation while the remaining $k-1$ folds are used as training sets. Stratified cross-validation is used to make sure that each fold is an appropriate representative of the original data by producing folds where the proportion of different classes is maintained \cite{stratified_cross_validation_paper}. However, stratification is not sufficient for multi-label classification problems as the number of distinct labelsets (i.e., different combinations of labels) is often quite large. For example, there can be 32 combinations of labels in our study as there are 5 types of documentation smells. In such cases, original stratified $k$-fold cross-validation is impractical since most groups might consist of just a single example. Iterative stratification, proposed by \cite{iterative_stratified_cross_valid}, solves this issue by employing a greedy approach of selecting the rarest groups first and adding them to the smallest folds while splitting. Hence, we used this iterative stratified cross-validation in our experiment. \subsubsection{Exact Match Ratio} In multi-label classification, prediction for an instance is a set of labels. Hence, it has a notion of partially correct prediction (along with fully correct and incorrect). The Exact Match Ratio ($EMR$) ignores the partially correct prediction and considers only those predictions as correct which exactly match the true label sets. \begin{equation} EMR = \frac{1}{N} \sum_{i=1}^{N} I (L_i^{pred} = L_i^{true}) \label{eq:EMR} \end{equation} {$I$ is the indicator function. Its' value is 1 if the prediction, $L_i^{pred}$ matches the actual label, $L_i^{true}$, and 0 otherwise. $N$ is the total number of data. } \subsubsection{Hamming Loss} Hamming Loss ($HL$) is the fraction of labels in labelsets that are incorrectly predicted, i.e., the fraction of the wrong labels to the total number of labels \cite{hamming_loss_paper}. It takes the notion of partially correct prediction into account. \begin{equation} HL = \frac{1}{N\cdot L} \sum_{i=1}^{N} \sum_{j=1}^{L} xor (y_{i,j}^{pred}, y_{i,j}^{true}) \label{eq:HL} \end{equation} {$N$ is the total number of data, $L$ is the total number of labels.} \subsubsection{Accuracy} Accuracy ($A$) is the number of correctly predicted instances out of all the instances. We reported accuracy separately for each class. \begin{equation} A = \frac{TP+TN}{TP+FN+TN+FP} \label{eq:acc} \end{equation} {$TP$ is the number of true positives, $FN$ is the number of false negatives, $FP$ is the number of false positives, $TN$ is the number of true negatives.} \subsubsection{Precision} Precision ($P$) is the ratio between the number of correctly predicted instances and all the predicted instances for a given class. \begin{equation} P = \frac{TP}{TP+FP} \label{eq:precision} \end{equation} \subsubsection{Recall} Recall ($R$) represents the ratio of the number of correctly predicted instances and all instances belonging to a given class. \begin{equation} R = \frac{TP}{TP+FN} \label{eq:recall} \end{equation} \subsubsection{F1-score} F1-score is the harmonic mean of precision and recall. \begin{equation} F1 = \frac{2\cdot P\cdot R}{P+R} \label{eq:f-score} \end{equation} \section{Study Results} \subsection{How prevalent are the smells in the benchmark?} give two statistics: all the documentation unit you analyzed and the percentage of which was finally considered as smells. then describe how the different documentation smells are prevalent in the benchmark. \subsection{How accurate are the smell detectors?} \begin{table}[!ht] \caption{Performance of the models on the overall smell types detection} \resizebox{\columnwidth}{!} { \begin{tabular}{|c|c|c|} \hline \textbf{Model} & \textbf{Exact Match Ratio} & \textbf{Hamming Loss} \\ \hline \textbf{OVR-SVM} & .50 & \textbf{.14} \\ \textbf{LPS-SVM} & .48 & .15 \\ \textbf{CC-SVM} & .50 & \textbf{.14} \\ \textbf{ML-$k$NN} & .47 & .15 \\ \textbf{Bi-LSTM} & .80 & .20 \\ \textbf{BERT} & \textbf{.84} & .15 \\ \hline \end{tabular} } \label{table_overall_performance} \end{table} Table \ref{table_overall_performance} represents the performance of the ML models for detecting documentation smell as a multi-label classification problem. We observe that OneVsRest (OVR) and Classifier Chain (CC) achieved equal results. CC-based models are generally superior to OVR-based models because of the capability of capturing label correlation. Since the labels (types) of the documentation smells are not correlated, the CC-based SVM could not exhibit higher performance than the OVR-based SVM. However, Label Powerset (LPS) achieved lower performance than the OVR and CC-based models. To show better results, LPS-based SVM would require sufficient instances for all 32 classes of 5 smell types. Deep learning-based models like Bi-LSTM and BERT, on the other hand, outperformed the SVM and $k$NN-based models by achieving higher exact match ratios. Although Bi-LSTM showed higher Hamming loss, BERT achieved similar to the SVM and $k$NN-based models. Therefore, in terms of Hamming loss, deep learning-based models did not show any improvement. However, considering both exact match ratio and Hamming loss as the performance metrics, we can deduce that BERT is the most suitable of all the models experimented in detecting the documentation documentation smell. \begin{table*}[!ht] \caption{Performance on different type of documentation smells} \begin{center} \scalebox{1.0} { \begin{tabular}{ccccccccccccccccccccc} & \multicolumn{20}{c}{} \\ \cline{2-21} \multicolumn{1}{c|}{} & \multicolumn{4}{c|}{\textbf{Bloated}} & \multicolumn{4}{c|}{\textbf{Lazy}} & \multicolumn{4}{c|}{\textbf{Excess Struct}} & \multicolumn{4}{c|}{\textbf{Tangled}} & \multicolumn{4}{c|}{\textbf{Fragmented}} \\ \hline \multicolumn{1}{|c|}{\textbf{Model}} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} \\ \hline \multicolumn{1}{|c|}{\textbf{OVR-SVM}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c}{.88} & \multicolumn{1}{c}{.89} & \multicolumn{1}{c|}{.89} & \multicolumn{1}{c}{.93} & \multicolumn{1}{c}{.85} & \multicolumn{1}{c}{.92} & \multicolumn{1}{c|}{.88} & \multicolumn{1}{c}{\textbf{.77}} & \multicolumn{1}{c}{.48} & \multicolumn{1}{c}{.23} & \multicolumn{1}{c|}{.31} & \multicolumn{1}{c}{\textbf{.85}} & \multicolumn{1}{c}{.72} & \multicolumn{1}{c}{.54} & \multicolumn{1}{c|}{.62} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c}{\textbf{.77}} & \multicolumn{1}{c}{.44} & \multicolumn{1}{c|}{.56} \\ \multicolumn{1}{|c|}{\textbf{LPS-SVM}} & \multicolumn{1}{c}{.96} & \multicolumn{1}{c}{.90} & \multicolumn{1}{c}{.77} & \multicolumn{1}{c|}{.83} & \multicolumn{1}{c}{.94} & \multicolumn{1}{c}{.84} & \multicolumn{1}{c}{.96} & \multicolumn{1}{c|}{.89} & \multicolumn{1}{c}{\textbf{.77}} & \multicolumn{1}{c}{.50} & \multicolumn{1}{c}{.24} & \multicolumn{1}{c|}{.33} & \multicolumn{1}{c}{.83} & \multicolumn{1}{c}{.71} & \multicolumn{1}{c}{.42} & \multicolumn{1}{c|}{.54} & \multicolumn{1}{c}{.73} & \multicolumn{1}{c}{.64} & \multicolumn{1}{c}{.49} & \multicolumn{1}{c|}{.56} \\ \multicolumn{1}{|c|}{\textbf{CC-SVM}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c}{.88} & \multicolumn{1}{c}{.90} & \multicolumn{1}{c|}{.89} & \multicolumn{1}{c}{.93} & \multicolumn{1}{c}{.83} & \multicolumn{1}{c}{.93} & \multicolumn{1}{c|}{.87} & \multicolumn{1}{c}{\textbf{.77}} & \multicolumn{1}{c}{.49} & \multicolumn{1}{c}{.21} & \multicolumn{1}{c|}{.29} & \multicolumn{1}{c}{\textbf{.85}} & \multicolumn{1}{c}{.72} & \multicolumn{1}{c}{.54} & \multicolumn{1}{c|}{.62} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c}{.75} & \multicolumn{1}{c}{.45} & \multicolumn{1}{c|}{.56} \\ \multicolumn{1}{|c|}{\textbf{ML-$k$NN}} & \multicolumn{1}{c}{.95} & \multicolumn{1}{c}{.77} & \multicolumn{1}{c}{.82} & \multicolumn{1}{c|}{.80} & \multicolumn{1}{c}{.91} & \multicolumn{1}{c}{.83} & \multicolumn{1}{c}{.84} & \multicolumn{1}{c|}{.84} & \multicolumn{1}{c}{.76} & \multicolumn{1}{c}{.46} & \multicolumn{1}{c}{.39} & \multicolumn{1}{c|}{.42} & \multicolumn{1}{c}{.82} & \multicolumn{1}{c}{.65} & \multicolumn{1}{c}{.55} & \multicolumn{1}{c|}{.60} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c}{.65} & \multicolumn{1}{c}{.64} & \multicolumn{1}{c|}{.65} \\ \multicolumn{1}{|c|}{\textbf{Bi-LSTM}} & \multicolumn{1}{c}{.92} & \multicolumn{1}{c}{.92} & \multicolumn{1}{c}{.92} & \multicolumn{1}{c|}{.91} & \multicolumn{1}{c}{.89} & \multicolumn{1}{c}{.90} & \multicolumn{1}{c}{.89} & \multicolumn{1}{c|}{.90} & \multicolumn{1}{c}{.76} & \multicolumn{1}{c}{.72} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c|}{.73} & \multicolumn{1}{c}{.78} & \multicolumn{1}{c}{.74} & \multicolumn{1}{c}{.78} & \multicolumn{1}{c|}{.74} & \multicolumn{1}{c}{.67} & \multicolumn{1}{c}{.64} & \multicolumn{1}{c}{.67} & \multicolumn{1}{c|}{.63} \\ \multicolumn{1}{|c|}{\textbf{BERT}} & \multicolumn{1}{c}{.93} & \multicolumn{1}{c}{\textbf{.93}} & \multicolumn{1}{c}{\textbf{.93}} & \multicolumn{1}{c|}{\textbf{.93}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c|}{\textbf{.97}} & \multicolumn{1}{c}{.76} & \multicolumn{1}{c}{\textbf{.75}} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c|}{\textbf{.76}} & \multicolumn{1}{c}{.83} & \multicolumn{1}{c}{\textbf{.83}} & \multicolumn{1}{c}{\textbf{.83}} & \multicolumn{1}{c|}{\textbf{.83}} & \multicolumn{1}{c}{.75} & \multicolumn{1}{c}{.75} & \multicolumn{1}{c}{\textbf{.75}} & \multicolumn{1}{c|}{\textbf{.75}} \\ \hline \end{tabular} } \label{table_individual_performance} \end{center} \end{table*} Table \ref{table_individual_performance} shows the performance of the ML models on each type of documentation smells. Although SVM and $k$NN-based models achieved slightly better accuracy than Bi-LSTM and BERT, the later models outperformed SVM and $k$NN-based models in F1-score. This behavior is due to the unequal distribution of the smell types over the dataset. SVM and $k$NN-based models produced more false-negative results because the number of positive instances for an individual smell type is significantly lower than the number of negative instances for that type. As a result, SVM and $k$NN-based models showed quite low recalls for some types (Excess Struct, Tangled, and Fragmented) and consequently resulted in low F1-scores. On the other hand, Bi-LSTM and BERT focused on capturing generalized attributes for each smell type and as a result, achieved impressive performance in all the performance metrics. Overall, BERT showed promising results among all the models in accurately detecting each of the individual documentation smells. TODO: misclassification analysis (see Review4Repair shared by Anindya. See Section 7.3 from here \url{https://arxiv.org/pdf/2010.01544.pdf}) \subsection{Ablation Study (RQ3)} BERT - epoch change SVM - feature change. \subsection{Correlation Analysis (RQ4)} move correlation analysis from Section V-A \subsection{User Feedback (RQ5)} user feedback \section{Discussions} \subsection{Correlation Analysis of Documentation Smells} In multi-label learning, the labels might be interdependent and correlated \cite{label_correlation_paper_1}.We used Phi Coefficients to determine such interdependencies and correlations between different documentation smells. The Phi Coefficient is a measure of association between two binary variables \cite{phi_coefficient_paper}. It ranges from -1 to +1, where ±1 indicates a perfect positive or negative correlation, and 0 indicates no relationship. We report the Phi Coefficients between each pair of labels in Figure \ref{fig:label_correlation}. We find that there is almost no correlation between `Fragmented’ and any other smell (except `Lazy’). By definition, the information of fragmented documentation is scattered in many sections or pages. Hence, it has little to do with smells like `Bloated’, `Excess Structural Information’, `Tangled’. We also observe that there is a weak positive correlation (+0.2 to +0.4) among the `Bloated’, `Excess Structural Information’, and `Tangled’ smells. One possible reason might be that if a documentation is filled with complex and unorganized information (Tangled), and unnecessary structural information (Excess Structural Information), it might be prone to become bloated as well. On the other hand, `Lazy’ smell has a weak negative correlation (-0.2 to -0.3) with all other groups since these kinds of documentation are often too small to contain other smells. However, none of these coefficients is high enough to imply a strong or moderate correlation between any pair of labels. Hence, it justifies our catalog by indicating that all the smells that we proposed are sufficiently unique in nature. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/label_correlation.png} \caption{Correlation of different documentation smells. Red, Blue, and Gray mean positive, negative, and no correlation respectively. Intensity of color indicates the level of correlation.} \label{fig:label_correlation} \end{figure} \subsection{Implications of Results} While the documentation smells do not necessarily make an API documentation incorrect, they can hinder the productivity of the developers, according to the survey response. Therefore, in this work, we focus on defining the catalog for the documentation smells. We show that these documentation smells are prevalent in Java official API documentation and by leveraging ML algorithms, we can detect them from the documentation texts. The catalog presented in this work can be extended to point out the documentation smells more accurately. Moreover, the documentation codes can be taken into account along with the documentation texts to find out how the detection of the documentation smells can vary depending on the documentation codes. The ultimate objective of this research requires manual curation of the defected documentations in order to build an automated system for correcting the documentation smells. \subsection{Threats to Validity} In this work, we conducted our experiments on a relatively small dataset. Since, to the best of our knowledge, detecting the documentation smells is the first of its kind, we manually labeled a small portion of the Java API documentation due to the time constraint. However, we randomly sampled the documentations for manual labeling, therefore, we expect that the actual distributions of the documentation smells will remain identical in case of adding more documentation examples. Furthermore, we performed cross-validation on our dataset to reduce the effect of any non-representative subset. The number of participants in our survey is too low to get a clear picture of how the documentation smells affect productivity on the large scale. We conducted the survey with an aim to validate the catalog we developed by the software developers. As the developers agreed with the catalog and its negative impact on the productivity, in the future extension of this study, we can include more participants to categorize the documentations into different documentation smells based on this catalog. \section{Related Work} related work \section{Conclusions} conclusions \begin{small} \bibliographystyle{abbrv} \section{Automatic Detection of The Smells} We answer the following four research questions: \begin{enumerate}[label=RQ\arabic{*}., leftmargin=25pt] \item How accurate are rule-based classifiers to automatically detect the documentation smells? \item Can the shallow machine learning models outperform the rule-based classifiers? \item Can the deep machine learning models outperform the shallow learning models? \item Can the detection of one documentation smell support the detection another smell? \end{enumerate} \subsection{Performance Metrics} We analyze and report the performance of each of the techniques developed and experimented as part of the algorithms development steps. We used 5-fold iterative stratified cross-validation for reporting performances that has been recommended for a multilabel dataset in \cite{iterative_stratified_cross_valid}. We report the performances using standard multi-label classification metrics, i.e., Exact Match Ratio, Hamming Loss \cite{a_literature_survey_on_algorithms_for_multilabel}. We also report separate Accuracy, Precision, Recall, and F1-score for each class. \begin{inparaenum}[(a)] \item\textbf{Iterative Stratified Cross-Validation} Traditional $k$-fold cross-validation is a statistical method of evaluating machine learning algorithms which divides data into $k$ equally sized folds and runs for $k$ iterations \cite{traditional_cross_validation_paper}. In each iteration, each of the $k$ folds is used as the held-out set for validation while the remaining $k-1$ folds are used as training sets. Stratified cross-validation is used to make sure that each fold is an appropriate representative of the original data by producing folds where the proportion of different classes is maintained \cite{stratified_cross_validation_paper}. However, stratification is not sufficient for multi-label classification problems as the number of distinct labelsets (i.e., different combinations of labels) is often quite large. For example, there can be 32 combinations of labels in our study as there are 5 types of documentation smells. In such cases, original stratified $k$-fold cross-validation is impractical since most groups might consist of just a single example. Iterative stratification, proposed by \cite{iterative_stratified_cross_valid}, solves this issue by employing a greedy approach of selecting the rarest groups first and adding them to the smallest folds while splitting. Hence, we used this iterative stratified cross-validation in our experiment. \item\textbf{Exact Match Ratio} In multi-label classification, prediction for an instance is a set of labels. Hence, it has a notion of partially correct prediction (along with fully correct and incorrect). The Exact Match Ratio ($EMR$) ignores the partially correct prediction and considers only those predictions as correct which exactly match the true label sets. \begin{equation} EMR = \frac{1}{N} \sum_{i=1}^{N} I (L_i^{pred} = L_i^{true}) \label{eq:EMR} \end{equation} {$I$ is the indicator function. Its' value is 1 if the prediction, $L_i^{pred}$ matches the actual label, $L_i^{true}$, and 0 otherwise. $N$ is the total number of data. } \item\textbf{Hamming Loss} Hamming Loss ($HL$) is the fraction of labels in labelsets that are incorrectly predicted, i.e., the fraction of the wrong labels to the total number of labels \cite{hamming_loss_paper}. It takes the notion of partially correct prediction into account. \begin{equation} HL = \frac{1}{N\cdot L} \sum_{i=1}^{N} \sum_{j=1}^{L} xor (y_{i,j}^{pred}, y_{i,j}^{true}) \label{eq:HL} \end{equation} {$N$ is the total number of data, $L$ is the total number of labels.} \item\textbf{Accuracy} Accuracy ($A$) is the number of correctly predicted instances out of all the instances. We reported accuracy separately for each class. \begin{equation} A = \frac{TP+TN}{TP+FN+TN+FP} \label{eq:acc} \end{equation} {$TP$ is the number of true positives, $FN$ is the number of false negatives, $FP$ is the number of false positives, $TN$ is the number of true negatives.} \item\textbf{Precision} Precision ($P$) is the ratio between the number of correctly predicted instances and all the predicted instances for a given class. \begin{equation} P = \frac{TP}{TP+FP} \label{eq:precision} \end{equation} \item\textbf{Recall} Recall ($R$) represents the ratio of the number of correctly predicted instances and all instances belonging to a given class. \begin{equation} R = \frac{TP}{TP+FN} \label{eq:recall} \end{equation} \item\textbf{F1-score} F1-score is the harmonic mean of precision and recall. \begin{equation} F1 = \frac{2\cdot P\cdot R}{P+R} \label{eq:f-score} \end{equation} \end{inparaenum} \subsection{ How accurate are rule-based classifiers to automatically detect the documentation smells? (RQ1)} \subsubsection{Rule-based Metrics} \begin{inparaenum}[(a)] \item\textbf{Documentation Length.} We use the length of every documentation in order to capture the extensiveness of the bloated documentations. \item\textbf{Readability Metrics.} We measure Flesch readability metrics for the documentations and use them as a feature to analyze the understandability of documentation. This feature might be useful to detect tangled documentations. \item\textbf{Number of Acronyms and Jargons.} Since acronyms and jargons increase the complexity of a reading passage, we use the number of acronyms and jargon in every documentation to detect the tangled documentation by estimating the understandability. \item\textbf{Number of URLs.} As URLs are hints of possible fragmentations in the documentation, we use the number of URLs to capture these smells. \item\textbf{Number of function, class and package name mentioned.} We use the number of functions, classes, packages mentioned in documentation to capture excess structural information and fragmentation. \item\textbf{Edit Distance.} From the definition of lazy documentation, it can be said that the edit distance of a lazy documentation and its’ unit definition (method prototype) will be comparatively small. So we calculate the edit distance between the documentation description and method prototype and use it as a feature for our machine learning models. \item\textbf{Average Cosine Similarity.} We calculate the avg. cosine similarity of the documentations’ description. For this, we calculate the cosine similarities between each possible pair of that documentation and take their avg value for normalization. This feature will help to detect redundancy in the documentations. \end{inparaenum} \subsubsection{Results} discuss the results by varying the metric thresholds \subsection{How accurate are shallow machine learning models to automatically detect the documentation smells? (RQ2)} \subsubsection{Shallow Learning Models} We applied both traditional and deep learning algorithms to detect documentation smells. We employed different decomposition approaches (i.e., One-Vs-Rest, Label Powerset, Classifier Chains)~\cite{multilabel_decomp_1_MultilabelClassificationAnOverview,multilabel_decomp_2_AReviewOnMultilabelLearning,multilabel_decomp_3_ATutorialOnMultilabelClassification,multilabel_decomp_4_LearningFromMultilabelData} with Support Vector Machine (SVM) \cite{SVM_SupportVectorNetworks} as the base estimator for multi-label classification of documentation smells. We chose SVM since it has been successfully used with these decomposition approaches for multi-label classification in previous studies \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM}. SVM has also shown great performance in text classification tasks \cite{svm_text_classification_1, svm_text_classification_2}. We also evaluated adapted approaches like ML-$k$NN \cite{MLkNN_ALazyLearningApproach}, and deep learning models like Bi-LSTM \cite{bi_lstm_BidirectionalRecurrentNeuralNetworks}, and BERT \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. \begin{inparaenum}[(a)] \item\textbf{One-Vs-Rest} is a heuristic method that works by decomposing the multi-label classification problem into multiple independent binary classification problems (one per class) \cite{multilabel_decomp_1_MultilabelClassificationAnOverview, multilabel_decomp_3_ATutorialOnMultilabelClassification}. It trains a single classifier per class, with the samples of that class as positive samples and all other samples as negatives. All the independent classifiers then separately give individual class predictions for unseen data. We evaluated One-Vs-Rest (OVR) approach with SVM (as the base estimator) for detecting documentation smells. One-Vs-Rest support vector machine (OVR-SVM) has been successfully applied in several problems \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM, multilabel_decomp_1_MultilabelClassificationAnOverview}. We used RBF kernel for the SVM classifiers as recommended by earlier works \cite{svm_rbf_1_AComparisonStudyOfDifferentKernelFunctions, svm_rbf_2_APracticalGuideToSVM}. \item\textbf{Label Power Set (LPS)} treats every combination of labels as a new class and approaches in a multiclass classification manner \cite{LearningMultiLabelSceneClassification}. As a result, this method has high computational complexity. However, it is capable of taking label correlation into account. We used SVM (with RBF kernel) as the base estimator of the Label Power Set method \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM}. \item\textbf{Classifier Chains (CC)} constructs a chain of binary classifiers, where every classifier uses the predictions of all the previous classifiers of the chain \cite{CC_1_ClassifierChainsForMultilabel, CC_2_ClassifierChainsForMultilabel}. This way the method can take label correlations into account. We constructed a Classifier Chain (CC) of SVMs and evaluated its’ performance for documentation smell detection. \item\textbf{Multi-label $k$ Nearest Neighbors (ML-$k$NN)} is derived from the traditional $k$-nearest neighbor ($k$NN) algorithm \cite{MLkNN_ALazyLearningApproach}. It finds the $k$ nearest neighborhood of an input instance using $k$NN, then uses Bayesian inference to determine the label set of the instance. We studied this method because it has been reported to achieve considerable performance for different multi-label classification tasks in previous studies \cite{MLkNN_ALazyLearningApproach, mlknn_MultilabelTextClassificationUsingSemanticFeatures}. We used ML-$k$NN with the number of nearest neighbors, $K$ = 10 during our experiment as recommended by \cite{mlknn_MultilabelTextClassificationUsingSemanticFeatures}. \end{inparaenum} \subsubsection{Studied Features} In this subsection, we describe the features that we used to train our SVM and \textit{k}NN-based models (see section \ref{subsubsec:ovr_svm} to \ref{subsubsec:ml_knn}) for documentation smell detection. use two types of features: the rule-based metrics, bag-of-words (as a proxy of word embeddings which will be used in BERT/LSTM - you need to ensure that reviewers are convinced that you have looked at each option before claiming BERT is a the best classifier) \subsubsection{Results} Table \ref{table_overall_performance} represents the performance of the ML models for detecting documentation smell as a multi-label classification problem. We observe that OneVsRest (OVR) and Classifier Chain (CC) achieved equal results. CC-based models are generally superior to OVR-based models because of the capability of capturing label correlation. Since the labels (types) of the documentation smells are not correlated, the CC-based SVM could not exhibit higher performance than the OVR-based SVM. However, Label Powerset (LPS) achieved lower performance than the OVR and CC-based models. To show better results, LPS-based SVM would require sufficient instances for all 32 classes of 5 smell types. Deep learning-based models like Bi-LSTM and BERT, on the other hand, outperformed the SVM and $k$NN-based models by achieving higher exact match ratios. Although Bi-LSTM showed higher Hamming loss, BERT achieved similar to the SVM and $k$NN-based models. Therefore, in terms of Hamming loss, deep learning-based models did not show any improvement. However, considering both exact match ratio and Hamming loss as the performance metrics, we can deduce that BERT is the most suitable of all the models experimented in detecting the documentation documentation smell. \begin{table}[t] \caption{Shallow models on the overall smell types detection} \centering \begin{tabular}{lrr} \toprule \textbf{Model} & \textbf{Exact Match Ratio} & \textbf{Hamming Loss} \\ \midrule \textbf{Rule-based} & .17 & .35 \\ \textbf{OVR-SVM} & .50 & \textbf{.14} \\ \textbf{LPS-SVM} & .48 & .15 \\ \textbf{CC-SVM} & .50 & \textbf{.14} \\ \textbf{ML-$k$NN} & .47 & .15 \\ \bottomrule \end{tabular} \label{table_overall_performance} \end{table} \begin{table*}[t] \caption{Performance on different type of documentation smells} \begin{tabular}{lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Model}} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule {\textbf{Rule-based}} & {.76} & {.67} & {.86} &{.75} & {.57} & {.69} & {.70} &{.69} & {.74} & {.68} & {.74} &{.71} & {.51} & {.40} & {.38} &{.39} & {.61} & {.57} & {.58} &{.58} \\ {\textbf{OVR-SVM}} & {\textbf{.97}} & {.88} & {.89} &{.89} & {.93} & {.85} & {.92} &{.88} & {\textbf{.77}} & {.48} & {.23} &{.31} & {\textbf{.85}} & {.72} & {.54} &{.62} & {\textbf{.76}} & {\textbf{.77}} & {.44} &{.56} \\ {\textbf{LPS-SVM}} & {.96} & {.90} & {.77} &{.83} & {.94} & {.84} & {.96} &{.89} & {\textbf{.77}} & {.50} & {.24} &{.33} & {.83} & {.71} & {.42} &{.54} & {.73} & {.64} & {.49} &{.56} \\ {\textbf{CC-SVM}} & {\textbf{.97}} & {.88} & {.90} &{.89} & {.93} & {.83} & {.93} &{.87} & {\textbf{.77}} & {.49} & {.21} &{.29} & {\textbf{.85}} & {.72} & {.54} &{.62} & {\textbf{.76}} & {.75} & {.45} &{.56} \\ {\textbf{ML-$k$NN}} & {.95} & {.77} & {.82} &{.80} & {.91} & {.83} & {.84} &{.84} & {.76} & {.46} & {.39} &{.42} & {.82} & {.65} & {.55} &{.60} & {\textbf{.76}} & {.65} & {.64} &{.65} \\ \bottomrule \end{tabular} \label{table_individual_performance} \end{table*} \subsubsection{Results} Table \ref{table_individual_performance} shows the performance of the ML models on each type of documentation smells. Although SVM and $k$NN-based models achieved slightly better accuracy than Bi-LSTM and BERT, the later models outperformed SVM and $k$NN-based models in F1-score. This behavior is due to the unequal distribution of the smell types over the dataset. SVM and $k$NN-based models produced more false-negative results because the number of positive instances for an individual smell type is significantly lower than the number of negative instances for that type. As a result, SVM and $k$NN-based models showed quite low recalls for some types (Excess Struct, Tangled, and Fragmented) and consequently resulted in low F1-scores. \gias{TODO: do the feature-based analysis here, i.e., ablation study on the shallow learning models as discussed} \subsection{Can the deep machine learning models outperform the shallow learning models? (RQ3)} \subsubsection{Deep Learning Models} Bidirectional LSTM is more capable of exploiting contextual information than the unidirectional LSTM \cite{bilstm_FramewisePhonemeClassificationWithBiLSTM}. Hence, the Bi-LSTM network can detect the documentation smell by capturing the information of the API documentations from both directions. We constructed a Bi-LSTM model with 300 hidden states and initialized it using the pre-trained GloVe embedding \cite{Glove_GlobalVectorsForWordRepresentation} of 100 dimensions. We used ADAM optimizer \cite{adam_optimizer} with an initial learning rate of 0.001. We trained the model with batch size 256 over 10 epochs. Considering the great success of BERT (Bidirectional Encoder Representations from Transformers) in various natural language processing and text classification tasks \cite{bert_success_1,bert_success_2,bert_success_3,bert_success_4,bert_success_5,bert_success_6,bert_success_7}, we feel motivated to evaluate its’ performance in documentation smell detection. BERT is a pre-trained model which was designed to learn contextual word representations of unlabeled texts \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. We used BERT-Base for this study which has 12 layers with 12 attention heads and 110 million parameters. We trained it on our labeled dataset for 10 epochs with a mini-batch size of 32. We used early-stop to avoid overfitting \cite{early_stop_bert_1} and considered validation loss as the metric of the early-stopping \cite{early_stop_bert_2}. The maximum length of the input sequence was set to 256. We used AdamW optimizer \cite{adam_w} with the learning rate set to 4e\textsuperscript{-5}, ß1 to 0.9, ß2 to 0.999, and epsilon to 1e\textsuperscript{-8} \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers, bert_fine_tuning}. We used binary cross-entropy to calculate the loss \cite{binary_cross_AreLossFunctionSame}. \subsubsection{Studied Features} talk about word-embeddings \subsubsection{Results} On the other hand, Bi-LSTM and BERT focused on capturing generalized attributes for each smell type and as a result, achieved impressive performance in all the performance metrics. Overall, BERT showed promising results among all the models in accurately detecting each of the individual documentation smells. \begin{table} \begin{tabular}{lrr} \toprule \textbf{Model} & \textbf{Exact Match Ratio} & \textbf{Hamming Loss} \\ \midrule \textbf{Bi-LSTM} & .80 & .20 \\ \textbf{BERT} & \textbf{.84} & .15 \\ \bottomrule \end{tabular} \label{table_overall_performance} \end{table} \begin{table*}[t] \caption{Performance on different type of documentation smells} \begin{tabular}{lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Model}} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule {\textbf{Bi-LSTM}} & {.92} & {.92} & {.92} &{.91} & {.89} & {.90} & {.89} &{.90} & {.76} & {.72} & {\textbf{.76}} &{.73} & {.78} & {.74} & {.78} &{.74} & {.67} & {.64} & {.67} &{.63} \\ {\textbf{BERT}} & {.93} & {\textbf{.93}} & {\textbf{.93}} &{\textbf{.93}} & {\textbf{.97}} & {\textbf{.97}} & {\textbf{.97}} &{\textbf{.97}} & {.76} & {\textbf{.75}} & {\textbf{.76}} &{\textbf{.76}} & {.83} & {\textbf{.83}} & {\textbf{.83}} &{\textbf{.83}} & {.75} & {.75} & {\textbf{.75}} &{\textbf{.75}} \\ \bottomrule \end{tabular} \label{table_individual_performance} \end{table*} \gias{TODO. Now report some misclassified cases of BERT per documentation smell and explain why the misclassification occurred.} \subsection{Can the detection of one documentation smell support the detection another smell? (RQ4)} In multi-label learning, the labels might be interdependent and correlated \cite{label_correlation_paper_1}. We used Phi Coefficients to determine such interdependencies and correlations between different documentation smells. The Phi Coefficient is a measure of association between two binary variables \cite{phi_coefficient_paper}. It ranges from -1 to +1, where ±1 indicates a perfect positive or negative correlation, and 0 indicates no relationship. We report the Phi Coefficients between each pair of labels in Figure \ref{fig:label_correlation}. We find that there is almost no correlation between `Fragmented’ and any other smell (except `Lazy’). By definition, the information of fragmented documentation is scattered in many sections or pages. Hence, it has little to do with smells like `Bloated’, `Excess Structural Information’, `Tangled’. We also observe that there is a weak positive correlation (+0.2 to +0.4) among the `Bloated’, `Excess Structural Information’, and `Tangled’ smells. One possible reason might be that if a documentation is filled with complex and unorganized information (Tangled), and unnecessary structural information (Excess Structural Information), it might be prone to become bloated as well. On the other hand, `Lazy’ smell has a weak negative correlation (-0.2 to -0.3) with all other groups since these kinds of documentation are often too small to contain other smells. However, none of these coefficients is high enough to imply a strong or moderate correlation between any pair of labels. Hence, it justifies our catalog by indicating that all the smells that we proposed are sufficiently unique in nature. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/label_correlation.png} \caption{Correlation of different documentation smells. Red, Blue, and Gray mean positive, negative, and no correlation respectively. Intensity of color indicates the level of correlation.} \label{fig:label_correlation} \end{figure} \section{A Benchmark of API Documentation Smells}\label{sec:benchmark} We describe the methodology to create our benchmark of API documentation smells (Section~\ref{sec:benchmark_method}) and then present the benchmark with real-world examples (Sections~\ref{sec:five_doc_smells} - \ref{sec:benchmark-details}). \subsection{Benchmark Creation Methodology}\label{sec:benchmark_method} \begin{figure}[t] \centering \centering \includegraphics[scale=.85]{images/workflow_mod4} \caption{The three major steps in benchmark creation process.} \label{fig:MethodologyOverallBenchmark} \vspace{-5mm} \end{figure} Code and design smells are relatively well studied fields of software engineering. However, to the best of our knowledge, this is the first research on API documentation smells. As such, we needed to investigate both the literature on API documentation~\cite{Aghajani-SoftwareDocPractitioner-ICSE2020,Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Uddin-HowAPIDocumentationFails-IEEESW2015,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a} and the diverse API documentation resources (e.g., Java SE docs) during the creation of our catalog of API documentation smells. We followed a three-step process, which closely mimics the standard approaches followed in code/design smell formulation studies~\cite{Abidi-AntiPatternMultiLanguage-EuroPLoP2019,Abidi-CodeSmellsMultiLanguage-EuroPLoP2019}. The three steps are outlined in Fig.~\ref{fig:MethodologyOverallBenchmark} and are explained below. \vspace{1mm}\noindent\textbf{Knowledge Acquisition.} Similar to code and design smells that do not directly introduce a defect or a bug into a software system, documentation smells refer to presentation issues that do not make a documentation incorrect, rather they hinder its proper usage due to the lack of quality in the design of the documented contents. As such, we studied extensively the API documentation literature that reported issues related to API documentation presentation and usability~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019}. For example, the most recent paper on this topic was by Aghajani et al.~\cite{Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Aghajani-SoftwareDocPractitioner-ICSE2020}, who divided the `how' problems in API documentation into four categories: maintainability (e.g., lengthy files), readability (e.g., clarity), usability (e.g., information organization like dependency structure), and usefulness (e.g., content not useful in practice). Previously, Uddin and Robillard~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015} studied 10 common problems in API documentation by surveying 323 IBM developers. They observed four common problems related to presentation, i.e., bloated (i.e., too long description), tangled (complicated documentation), fragmented (i.e., scattered description), and excessive structural information (i.e., information organization like dependency structure). Given that the four problems appeared in both studies, we included each as a documentation smell in our study. In addition, we added lack of proper description of an API method as a `lazy' documentation smell, because incomplete documentation problems are discussed in literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocPractitioner-ICSE2020} as well as in online developer discussions (see Fig.~\ref{fig:motivating_lazy_example}). \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.16]{images/lazy.JPG} \caption{Tweet complaining about lazy documentation of API method.} \label{fig:motivating_lazy_example} \vspace{-2mm} \end{figure} \vspace{1mm}\noindent\textbf{Feasibility Analysis.} Once we decided on the five smells, we conducted a feasibility study by looking for real-world examples of the smells in official and instructional API documentation. This was important to ensure that the smells are prevalent in API documentation and that we can find those with reasonable confidence, because otherwise there is no way we can design automated techniques to detect those automatically. We combined our knowledge of the five smells gained from API documentation literature with active exploration of the five smells in the API official documentation. We conducted multiple focus group discussions where all the four authors discussed together by analyzing potential examples of the five smells in API documentation and by mapping the characteristics of such API documentation with the description of the smells in the literature/developer discussions. Before every such focus group meeting, the first two authors created a list of 50 API documentation units with their labels of the five smells in the units. The four authors discussed those labels together, refined the labels, and identified/filtered the labeling criteria. This iterative process led to increased understanding among the group members on the specific characteristics of the five documentation smells. From multiple discussion sessions, the final output was a list of 50 labeled datapoints. \vspace{1mm}\noindent\textbf{Benchmark Creation.} In the last step of the benchmark creation process, we expanded our initial list of 50 API documentation units with smell labels as follows. We collected documentations of over 29K methods belonging to over 4K classes of 217 different packages. We extracted these documentations from the online JAVA API Documentation website~\cite{website:javadocse7} through web crawling and text parsing techniques. Since a documentation can contain multiple smells at the same time, this is a multi-labeled dataset. We produced the benchmark as follows. First, all the authors mutually discussed the documentation smells. Then, we randomly selected 950 documentations from a total of 29K that we extracted. Then the first two authors labeled the first 50 documentations separately. When they finished, they consulted other co-authors and resolved the disagreement based on the discussion. Then they continued with the next 50 documentations and repeated the same process. Their agreement of labeling has been recorded using Cohen's Kappa Coefficient \cite{cohen_kappa_paper} for each iteration, i.e., labeling 50 documentations (Table \ref{cohen_kappa_table}). After the third iteration, both the authors reached a perfect agreement level with Cohen’s Kappa Coefficient of $0.83$. Then they prepared a coding guideline for the labeling task which was later presented to 17 computer science undergraduate students. The students labeled the remaining 800 documentation units. During the entire coding sessions by the 17 coders, the first two authors remained available to them via Skype/Slack. Each coder consulted their labels with the two authors. This ensured quality and mitigated subjective bias in the manual labeling of the benchmark. \begin{table} \centering \caption{Measure of agreement between two labelers} \begin{tabular}{ccc} \toprule \textbf{Iteration ID} & \textbf{Documentation Unit \#} & \textbf{Cohen $\kappa$} \\ \midrule 1 & 50 & .49 \\ 2 & 50 & .67 \\ 3 & 50 & .83 \\ \bottomrule \end{tabular} \label{cohen_kappa_table} \end{table} \subsection{The Five Documentation Smells in the Benchmark} \label{sec:five_doc_smells} \vspace{1mm}\noindent\textbf{Bloated Documentation Smell.} By `Bloated’ we mean the documentation whose description (of an API element type) is verbose or excessively elaborate. It is difficult to understand or follow a lengthy documentation~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. Moreover, it cannot be effectively managed that makes it hard to modify when needed, e.g., in case of any update in the API source code. In our benchmark, we found many documentations that are larger than necessary. For example, the documentation shown in Fig.~\ref{fig:bloated_example} is so verbose and lengthy that it is hard to follow and use it. Hence, it is a bloated documentation. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/bloated_example.png} \caption{Example of Bloated Smell.} \label{fig:bloated_example} \end{figure} \vspace{1mm}\noindent\textbf{Excess Structural Information Smell.} Such a description of a documentation unit (e.g., method) contains too many structural syntax or information, e.g., the Javadoc of the java.lang.Object class. Javadoc lists all the hundreds of subclasses of the class. In our study, we find this type of documentation to contain many class and package names. For instance, the documentation of Fig.~\ref{fig:excess_struct_example} contains many structural information (marked in red rectangle) that are quite unnecessary for the purpose of understanding and using the underlying method. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/excess_struct_example.png} \caption{Example of Excess Structural Information.} \label{fig:excess_struct_example} \end{figure} \vspace{1mm}\noindent\textbf{Tangled Documentation Smell.} A documentation of an API element (method) is `Tangled’ if it's description is \textit{tangled} with various information (e.g., from other methods). This makes it complex and thereby reduces the readability and understandability of the description. Fig.~\ref{fig:tangled_example} depicts an example of tangled documentation which is hard to follow and understand. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/tangled_example.png} \caption{Example of Tangled Smell.} \label{fig:tangled_example} \end{figure} \vspace{1mm}\noindent\textbf{Fragmented Documentation Smell.} Sometimes it is seen that the information of documentation (related to an API element) is scattered (i.e., fragmented) over too many pages or sections. In our empirical study, we found a good number of documentation that contain many URLs and references that indicate possible fragmentation smell. For example, the documentation of Fig.~\ref{fig:fragmented_example} is fragmented as it refers the readers to other pages or sections for details. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/fragmented_example.png} \caption{Example of Fragmented Smell.} \label{fig:fragmented_example} \end{figure} \vspace{1mm}\noindent\textbf{Lazy Documentation Smell.} We categorize a documentation as `Lazy’ if it contains very small information to convey to the readers. In many cases, it is seen that the documentation does not contain any extra information except what can be perceived directly from the function name. Hence, this kind of documentation does not have much to offer to the readers. We see a lazy documentation in Fig.~\ref{fig:lazy_example} where the documentation says nothing more about the underlying method than what is suggested by the prototype itself. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/lazy_example.png} \caption{Example of Lazy Smell.} \label{fig:lazy_example} \end{figure} \subsection{Distribution of API Documentation Smells in Benchmark}\label{sec:benchmark-details} We calculated the total number of smells in our dataset (Fig.~\ref{fig:amount_of_multismell_in_dataset}). We found that 778 documentations (almost 78\%) of our dataset contain at least one smell. While most (524) of the smelly documentations contain only one type of smell, a small number (19) of documentations show as high as four smells at the same time. We also determined the distribution of different smells in our dataset (Fig.~\ref{fig:distribution_of_smell_in_dataset}). It shows that all the five types of smells discussed occur in the dataset with a considerable frequency where the most frequent smell in our dataset is `Lazy’ with 275 occurrences and the least frequent smell is `Bloated’ with 141 occurrences. \begin{figure}[t \centering \includegraphics[scale=.19]{new_images/amount_of_mulitsmell_in_dataset.png} \caption{Smell distribution by \# of documentation units.} \label{fig:amount_of_multismell_in_dataset} \end{figure} \begin{figure}[t \centering \includegraphics[scale=.19]{new_images/distribution_of_smell_in_dataset.png} \caption{Distribution of different smells in our dataset.} \label{fig:distribution_of_smell_in_dataset} \vspace{-4mm} \end{figure} In multi-label learning, the labels might be interdependent and correlated \cite{label_correlation_paper_1}. We used Phi Coefficients to determine such interdependencies and correlations between different documentation smells. The Phi Coefficient is a measure of association between two binary variables \cite{phi_coefficient_paper}. It ranges from -1 to +1, where ±1 indicates a perfect positive or negative correlation and 0 indicates no relationship. We report the Phi Coefficients between each pair of labels in Fig.~\ref{fig:label_correlation}. We find that there is almost no correlation between `Fragmented’ and any other smell (except `Lazy’). By definition, the information of fragmented documentation is scattered in many sections or pages. Hence, it has little to do with smells like `Bloated’, `Excess Structural Information’, or `Tangled’. We also observe that there is a weak positive correlation (+0.2 to +0.4) among the `Bloated’, `Excess Structural Information’, and `Tangled’ smells. One possible reason might be that if a documentation is filled with complex and unorganized information (Tangled) or unnecessary structural information (Excess Structural Information), it might be prone to become bloated as well. On the other hand, `Lazy’ smell has a weak negative correlation (-0.2 to -0.3) with all other groups since these kinds of documentation are often too small to contain other smells. However, none of these coefficients is high enough to imply a strong or moderate correlation between any pair of labels. Hence, all types of smells in our study are more or less unique in nature. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/label_correlation.png} \caption{Correlation between different documentation smells in our benchmark. Red, Blue, and Gray mean positive, negative, and no correlation. Intensity of color indicates the level of correlation.} \label{fig:label_correlation} \vspace{-5mm} \end{figure} \section{Conclusions} The learning of an API is challenging when the official documentation resources are of low quality. We identify five API documentation smells by consulting API documentation literature on API documentation design and presentation issues. We present a benchmark of 1,000 API documentation units with five smells in API official documentation. Feedback from 21 industrial software developers shows that the smells can negatively impact the productivity of the developers during API documentation usage. We develop a suite of machine learning classifiers to automatically detect the smells. The best performing classifier BERT, a deep learning model, achieves F1-scores of 0.75 - 0.97. The techniques can help automatically monitor and warn about API documentation quality. \section{Discussions}\label{sec:discussions} \vspace{1mm}\noindent\textbf{Implications of Findings.} Thanks to the significant research efforts to understand API documentation problems using empirical and user studies, we now know with empirical evidence that the quality of API official documentation is a concern both for open source and industrial APIs~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Garousi-UsageUsefulnessSoftwareDoc-IST2015,Forward-RelevanceSoftwareDocumentationTools-DocEng2002}. The five API documentation smells we studied in this paper are frequently referred to as documentation presentation/design problems in the literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019}. Our comprehensive benchmark of 1,000 API official documentation units has 778 units each exhibiting one or more of the smells. The validity of the smells by professional software developers proves that this benchmark can be used to foster a new area of research in software engineering on the automatic detection of API documentation quality - which is now an absolute must due to the growing importance of APIs and software in our daily lives~\cite{Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Ponzanelli-PrompterRecommender-EMSE2014}. The superior performance of our machine learning classifiers, in particular the deep learning model BERT, offers promise that we can now use such tools to automatically monitor and warn about API documentation quality in real-time. Software companies and open source community can leverage our developed model to analyze the quality of their API documentation. Software developers could save time by focusing on good quality API documentation instead of the bad ones as detected by our model. Based on such real-time feedback, tools can be developed to improve the documentation quality by fixing the smells. Indeed, when we asked our survey participants (Section~\ref{sec:survey}) whether the five smells need to be fixed, more than 90\% responded with a `Yes', 9.5\% with a `Maybe', 0\% with a `No' (see Fig.~\ref{fig:smell-fix}). \begin{figure}[t] \centering\begin{tikzpicture}[scale=0.25]- \pie[ /tikz/every pin/.style={align=center}, text=pin, number in legend, explode=0.0, rotate = -15, color={black!10, black!0}, ] { 9.5/9.5\% Maybe, 90.5/\textbf{90.5\% Yes}\\ smells should be\\ fixed in API\\ documentation } \end{tikzpicture} \caption{Survey responses on whether the five documentation smells should be fixed to improve API documentation quality.} \vspace{-5mm} \label{fig:smell-fix} \end{figure} \vspace{1mm}\noindent\textbf{Threats to Validity.} \textit{Internal validity} threats relate to authors' bias while conducting the analysis. We mitigated the bias in our benchmark creation process by taking agreement from 17 coders and co-authors and by consulting API documentation literature. The machine learning models are trained, tested, and reported using standard practices. There was no common data between the training and test set. \textit{Construct validity} threats relate to the difficulty in finding data to create our catalog of smells. Our benchmark creation process was exhaustive, as we processed more than 29K unit examples from official documentation. \textit{External validity} threats relate to the generalizability of our findings. We mitigated this threat by corroborating the five smells in our study with findings from state-of-the-art research in API documentation presentation and design problems. Our analysis focused on the validation and detection of five API documentation smells. Similar to code smell literature, additional documentation smells can be added into our catalog as we continue to research on this area. \section{Introduction}\label{sec:introduction} APIs (Application Programming Interfaces) are interfaces to reusable software libraries and frameworks. Proper learning of APIs is paramount to support modern day rapid software development. To support this, APIs typically are supported by official documentation. An API documentation is a product itself, which warrants the creation and maintenance principles similar to any existing software product. A good documentation can facilitate the proper usage of an API, while a bad documentation can severely harm its adoption~\cite{Robillard-APIsHardtoLearn-IEEESoftware2009a,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Aghajani-SoftwareDocPractitioner-ICSE2020}. A significant body of API documentation research has focused on studying API documentation problems based on surveys and interviews of software developers~\cite{Robillard-APIsHardtoLearn-IEEESoftware2009a,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Aghajani-SoftwareDocPractitioner-ICSE2020,Cai-FrameworkDocumentation-PhDThesis2000,Carroll-MinimalManual-JournalHCI1987a, Rossen-SmallTalkMinimalistInstruction-CHI1990a,Meij-AssessmentMinimalistApproachDocumentation-SIGDOC1992,Zhia-CostBenefitSoftwareDoc-JSS2015,Garousi-UsageUsefulnessSoftwareDoc-IST2015,Forward-RelevanceSoftwareDocumentationTools-DocEng2002}. Broadly, API documentation problems are divided into two types, what (i.e., what is documented) and how (i.e., how it is documented)~\cite{Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Uddin-HowAPIDocumentationFails-IEEESW2015}. Tools and techniques are developed to address the `what' problems in API documentation, such as detection of code comment inconsistency~\cite{rabbi2020detecting,Wen-CodeCommentInconsistencyEmpirical-ICPC2019,Tan-tCommentCodeCommentInconsistency-ICSTVV2012,Zhou-DocumentationCodeToDetectDirectiveDefects-ICSE2017}, natural language summary generation of source code~\cite{McBurney-DocumentationSourceCodeSummarization-ICPC2014,Sridhara-SummaryCommentsJavaClasses-ASE2010,Haiduc:Summarization,Moreno-NLPJavaClasses-ICPC2013}, adding description of API methods by consulting external resources (e.g., online forums)~\cite{Aghajani-AndroidDocumentation-TSE2019}, detecting obsolete API documentation by comparing API version~\cite{Dagenais-DeveloperLearningResources-PhDThesis2012,Dagenais-TraceabilityLinksRecommendDocumentationEvolution-TSE2014}, and complementing official documentation by incorporating insights and code examples from developer forums~\cite{Treude-APIInsight-ICSE2016,Subramanian-LiveAPIDocumentation-ICSE2014}. In contrast, not much research has focused on the automatic detection of `how' problems, e.g., bad design in API documentation that can make the reuse of API features difficult due to lack of usability~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. Recently, Treude et al.~\cite{Treude-DocumentationQuality-FSE2020} find that not all API documentation units are equally readable. This finding reinforces the needs to automatically detect API documentation presentation issues as `documentation smells', as previously highlighted by Aghajani et al.~\cite{Aghajani-SoftwareDocPractitioner-ICSE2020}. Unfortunately, we are not aware of any research on the automatic detection of such API documentation smells. \begin{figure}[t] \centering \centering \includegraphics[scale=.7]{images/workflow_mod2} \caption{The three major phases used in this study.} \label{fig:MethodologyOverall} \vspace{-5mm} \end{figure} As a first step towards developing techniques to detect smells in API documentation, in this paper, we follow three phases (see Fig.~\ref{fig:MethodologyOverall}). First, we identify five API documentation smells by consulting API documentation literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019} (Section~\ref{sec:benchmark}). Four of the smells (bloated, fragmented and tangled description of API documentation unit, and excess structural info in the description) are reported as presentation problems by Uddin and Robillard~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. The other smell is called `Lazy documentation' and it refers to inadequate description of an API documentation unit (e.g., no explanation of method parameters). Such incomplete documentation is reported in literature~\cite{Aghajani-SoftwareDocIssueUnveiled-ICSE2019} and in online discussions. We exhaustively explore official API documentation to find the occurrences of the five smells. The focus was to develop a benchmark of \textit{smelly} API documentation units. A total of 19 human coders participated in this exercise. This phase resulted in a benchmark of 1,000 API documentation units, where 778 units have at least one of the five smells. {To the best of our knowledge, this is the first benchmark with real-world examples of the five documentation smells.} \begin{figure}[t] \centering\begin{tikzpicture}[scale=0.35]- \pie[ /tikz/every pin/.style={align=center}, text=pin, number in legend, explode=0.0, rotate = -10, color={black!10, black!0}, ] { 4.8/4.8\% Maybe, 95.2/\textbf{95.2\% Yes}\\ documentation\\ smells hinder\\developer producivity } \end{tikzpicture} \caption{Survey responses from professional developers on whether the presence of the smells in API documentation hinders productivity.} \vspace{-5mm} \label{fig:smell-productivity} \end{figure} In the second phase (Section~\ref{sec:survey}), we conducted a survey of 21 professional software developers to validate our catalog of API documentation smells. All the participants reported that they frequently encounter the five API documentation smells. More than 95\% of the participants (20 out of 21) reported that the presence of the five smells in API documentation negatively impacts their productivity (see Fig.~\ref{fig:smell-productivity}). The participants asked for tool support to automatically detect and fix the smells in API official documentation. These findings corroborate previous research that design and presentation issues in API documentation can hinder API usage~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocPractitioner-ICSE2020}. In the third phase (Section~\ref{sec:model}), we investigate a suite of rule-based, shallow and deep machine learning models using the benchmark to investigate the feasbility of automatically detecting the five smells. The best performing classifer BERT, a deep learning model, achieves F1-scores of 0.75 - 0.97. {To the best of our knowledge, ours are the first techniques to automatically detect the five API documentation smells}. {The machine learning models can be used to monitor and warn about API documentation quality by automatically detecting the smells in real-time with high accuracy.} \vspace{1mm}\noindent\textbf{Replication Package} with benchmark, code, and survey is shared at \url{https://github.com/disa-lab/SANER2021-DocSmell} \section{Methodology} \begin{figure*}[t] \centering \centering \includegraphics[scale=.85]{images/workflow_mod3} \caption{The five major steps used in this study} \label{fig:MethodologyOverall} \vspace{-5mm} \end{figure*} While research is devoted to understand code and design smells, we are aware of no previous research on API documentation smells. Similar to code and design smells that do not directly introduce a defect or a bug into a software system, documentation smells refer to presentation issues that do not make a documentation incorrect, rather they hinder its proper usage due to the lack of quality in the design and presentation of the documented contents. As such, we studied extensively the API documentation literature that reported issues related to API documentation presentation and usability~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019}. For example, the most recent paper on this topic was by Aghajani et al.~\cite{Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Aghajani-SoftwareDocPractitioner-ICSE2020}, who divided the `how' problems in API documentation into four categories: maintainability (e.g., lenghty files), readability (e.g., clarity), usability (e.g., information organization), and usefulness (e.g., content not useful in practice). Previously, Uddin and Robillard~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015} studied 10 common problems in API documentation by surveying 323 IBM developers. They observed four common presentation problems: bloated (i.e., too long description), tangled (complicated documentation), fragmented (i.e., scattered description), and excess structural info (i.e., content not useful in practice). Given that the four problems appeared in both studies, we included each as a documentation smell in our study. In addition, we added lack of proper description of an API method as a type of `lazy' smell in the documentation, because incomplete documentation problems are discussed in both papers~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocPractitioner-ICSE2020} as well as in online developer discussions. Once we decided on the five smells, in the That this catalog of five smells provides a good starting point to investigate the focus of this paper, i.e., determining the feasbility of automatically detecting the smells using automated techniques. To investigate the techniques, we created our benchmark as follows. \section{Related Work}\label{sec:related-work} Related work is divided into \textbf{studies} on understanding (1) documentation problems and (2) how developers learn APIs using documentation, and developing \textbf{techniques} (3) to detect errors in documentation and (4) to create documentation. \vspace{1mm}\noindent\textbf{Studies.} Research shows that traditional Javadoc-type approaches to API official documentation are less useful than example-based documentation (e.g., minimal manual~\cite{Carroll-MinimalManual-JournalHCI1987a})~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000} Both code examples and textual description are required for better quality API documentation~\cite{Forward-RelevanceSoftwareDocumentationTools-DocEng2002,DeSouza-DocumentationEssentialForSoftwareMaintenance-SIGDOC2005,Nykaza-ProgrammersNeedsAssessmentSDKDoc-SIGDOC2002}. Depending of the types of API documentation, reability and understandability of the documentation can vary~\cite{Treude-DocumentationQuality-FSE2020}. Broadly, problems in API official documentation can be about `what' contents are documented and `how' the contents are presented~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Robillard-APIsHardtoLearn-IEEESoftware2009a,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Aghajani-SoftwareDocPractitioner-ICSE2020}. Literature in API documentation quality discussed four desired attributes of API documentation: completeness, consistency, usability and accessibility \cite{Zhia-CostBenefitSoftwareDoc-JSS2015,Treude-DocumentationQuality-FSE2020}. Several studies show that external informal resources can be consulted to improve API official documentation~\cite{Yang-QueryToUsableCode-MSR2016,Kavaler-APIsUsedinAndroidMarket-SOCINFO2013,Wang-APIsUsageObstacles-MSR2013,Sunshine-APIProtocolUsability-ICPC2015,Parnin-MeasuringAPIDocumentationWeb-Web2SE2011,Delfim-RedocummentingAPIsCrowdKnowledge-JournalBrazilian2016,Jiau-FacingInequalityCrowdSourcedDocumentation-SENOTE2012} The five documentation smells studied in this paper are taken from five commonly discussed API documentation design and presentation issues in literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocPractitioner-ICSE2020}. In contrast to the above papers that aim to understand API documentation problems, we focus on the development of techniques to automatically detect documentation smells. \vspace{1mm}\noindent\textbf{Techniques.} Tools and techniques are proposed to automatically add code examples and insights from external resources (e.g., online forums) into API official documentation~\cite{Subramanian-LiveAPIDocumentation-ICSE2014,Treude-APIInsight-ICSE2016,Aghajani-AndroidDocumentation-TSE2019}. Topic modeling is used to develop code books and to detect deficient documentation~\cite{Souza-CookbookAPI-BSSE2014,Souza-BootstrapAPICodeBookSO-IST2019,Campbell-DeficientDocumentationDetection-MSR2013}. API official documentation and online forum data are analyzed together to recommend fixes API misuse scenarios~\cite{Ren-DemystifyOfficialAPIUsageDirectivesWithCorwdExample-ICSE2020}. The documentation of an API method can become obsolete/inconsistent due to evolution in source code~\cite{Wen-CodeCommentInconsistencyEmpirical-ICPC2019,Dagenais-DeveloperLearningResources-PhDThesis2012}. Several techniques are proposed to automatically detect code comment inconsistency~\cite{rabbi2020detecting,Tan-tCommentCodeCommentInconsistency-ICSTVV2012,Zhou-DocumentationCodeToDetectDirectiveDefects-ICSE2017}. A large body of research is devoted to automatically produce natural lanugage summary description of source code method~\cite{McBurney-DocumentationSourceCodeSummarization-ICPC2014,Sridhara-SummaryCommentsJavaClasses-ASE2010,Haiduc:Summarization,Moreno-NLPJavaClasses-ICPC2013}. Unlike previous research, we focus on the detection of five API documentation smells that do not make a documentation inconsistent/incorrect, but nevertheless make the learning of the documentation difficult due to the underlying design/presentation issues. We advance state-of-the-art research on API documentation quality analysis by offering a benchmark of real-world examples of five documentation smells and a suite of techniques to automatically detect the smells. \section{Automatic Detection of The Smells}\label{sec:model} The responses from the survey validate our catalog of API documentation smells. The perceived negative impact of the smells on developers' productivity, as evidenced by the responses from our survey participants, necessitates the needs to fix API documentation by removing the smells. To do that, we first need to detect the smells automatically in the API documentation. The automatic detection offers two benefits: (1) we can use the techniques to automatically monitor and warn about bad documentation quality and (2) we can design techniques to fix the smells based on the detection. In addition, manual effort can also be made for improving detected examples. With a view to determine the feasibility of techniques to detect API documentation smells using our benchmark, we answer three research questions: \begin{enumerate}[label=RQ\arabic{*}., start = 3, leftmargin=25pt] \item How accurate are rule-based classifiers to automatically detect the documentation smells? \item Can the shallow machine learning models outperform the rule-based classifiers? \item Can the deep machine learning models outperform the other models? \end{enumerate} The shallow and deep learning models are supervised, for which we used 5-fold iterative stratified cross-validation as recommended for a multilabel dataset in \cite{iterative_stratified_cross_valid}. Traditional $k$-fold cross-validation is a statistical method of evaluating machine learning algorithms which divides data into $k$ equally sized folds and runs for $k$ iterations \cite{traditional_cross_validation_paper}. In each iteration, each of the $k$ folds is used as the held-out set for validation while the remaining $k-1$ folds are used as training sets. Stratified cross-validation is used to make sure that each fold is an appropriate representative of the original data by producing folds where the proportion of different classes is maintained \cite{stratified_cross_validation_paper}. However, stratification is not sufficient for multi-label classification problems as the number of distinct labelsets (i.e., different combinations of labels) is often quite large. For example, there can be 32 combinations of labels in our study as there are 5 types of documentation smells. In such cases, original stratified $k$-fold cross-validation is impractical since most groups might consist of just a single example. Iterative stratification, proposed by \cite{iterative_stratified_cross_valid}, solves this issue by employing a greedy approach of selecting the rarest groups first and adding them to the smallest folds while splitting. We report the performances using four standard metrics in information retrieval~\cite{Manning-IRIntroBook-Cambridge2009}. Accuracy ($A$) is the ratio of correctly predicted instances out of all the instances. Precision ($P$) is the ratio between the number of correctly predicted instances and all the predicted instances for a given smell. Recall ($R$) represents the ratio of the number of correctly predicted instances and all instances belonging to a given class. F1-score ($F1$) is the harmonic mean of precision and recall. {\scriptsize \begin{eqnarray*} P = \frac{TP}{TP+FP},~ R = \frac{TP}{TP+FN},~ F1 = 2*\frac{P*R}{P+R},~ A = \frac{TP+TN}{TP+FP+TN+FN} \end{eqnarray*}} TP = Correctly classified as a smell, FP = Incorrectly classified as a smell, TN = Correctly classified as not a smell, FN = Incorrectly classified as not a smell. \subsection{Performance of Rule-Based Classifiers (RQ3)}\label{sec:rule-based} Based on manual analysis of a statistically significant random sample of our benchmark dataset (95\% confidence interval and 5 levels), we designed six metrics to establish five rule-based classifiers as described below. \subsubsection{Rule-based Metrics} \label{subsubsec:rule-based-metrics} \begin{inparaenum}[(a)] \item\textit{Documentation Length.} We use the length of every documentation in order to capture the extensiveness of the bloated documentations. \item\textit{Readability Metrics.} We measure Flesch readability metrics \cite{flesch_readability_paper} for the documentations to analyze the understandability of documentation. This feature might be useful to detect tangled documentations. \item\textit{Number of Acronyms and Jargons.} Since acronyms and jargons increase the complexity of a reading passage \cite{jargon_paper_1}, we use the number of acronyms and jargons in every documentation to detect the tangled documentation. \item\textit{Number of URLs} is computed because URLs are hints of possible fragmentation in the documentation. \item\textit{Number of function, class, and package name mentioned} in documentation is computed to capture excess structural information smell. \item\textit{Edit Distance.} The edit distance (i.e., measure of dissimilarity) between the description of a lazy documentation and its' corresponding unit definition (i.e., method prototype) can be smaller than non-lazy documentations. We calculate the Levenshtein distance \cite{edit_distance_levenshtein_paper} between the documentation description and method prototype. \end{inparaenum} \subsubsection{Rule-based Classifiers} Fig.~\ref{fig:rule_based_classification_flowchart} shows flowchart of the rule-based classification approach. For each metric, we study average, $25^{th}$, $50^{th}$, $75^{th}$, and $90^{th}$ percentiles as thresholds. \begin{figure}[t \centering \hspace*{-.3cm}% \includegraphics[scale=.55]{new_images/Rulebased_Flowchart.png} \caption{Flowchart of rule-based classification approach.} \label{fig:rule_based_classification_flowchart} \vspace{-4mm} \end{figure} \subsubsection{Results} \label{subsec:results_of_rulebased_baselines} \begin{table*}[t] \caption{Class-wise performance of rule-based baseline models by the metric thresholds (P stands for percentile)} \begin{tabular}{p{.6cm}|lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Model}} & \textbf{Threshold} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule \multirow{5}{=}{\textbf{Rule Based}} & {\textbf{AVG}} & {.77} & {.38} & {.86} &{.52} & {.58} & {.39} & {.71} &{.51} & {.68} & {.35} & {.34} &{.34} & {.49} & {.13} & {.18} &{.15} & {.65} & {.33} & {.52} & {.40} \\ & {\textbf{25P}} & {.39} & {.18} & {.64} &{.29} & {.96} & {.96} & {.93} & \textbf{.95} & {.67} & {.38} & {.30} &{.34} & {.54} & {.09} & {.09} &{.09} & {.52} & {.31} & {.90} &\textbf{.47} \\ & {\textbf{50P}} & {.64} & {.28} & {.79} &{.41} & {.77} & {.55} & {.84} &{.66} & {.75} & {.37} & {.50} & \textbf{.42} & {.45} & {.20} & {.40} &{.26} & {.61} & {.34} & {.71} &{.46} \\ & {\textbf{75P}} & {.89} & {.56} & {.93} &{.70} & {.52} & {.36} & {.67} &{.47} & {.65} & {.32} & {.31} &{.31} & {.37} & {.25} & {.75} &{.37} & {.67} & {.29} & {.27} &{.28} \\ & {\textbf{90P}} & {.95} & {.97} & {.85} & \textbf{.90} & {.37} & {.30} & {.56} &{.39} & {.75} & {.50} & {.17} &{.25} & {.33} & {.26} & {.96} & \textbf{.41} & {.72} & {.27} & {.10} &{.15} \\ \bottomrule \end{tabular} \label{table_individual_performance_baseline} \end{table*} In Table \ref{table_individual_performance_baseline}, we reported the performances of the baseline models for each documentation smell. Different thresholds of features achieved higher performance for different documentation smells. For example, taking 90\textsuperscript{th} percentiles of the features’ values, baseline model achieved the higher performance for bloated documentation detection, while lazy and excess structural information smell detection required 25\textsuperscript{th} percentile and 50\textsuperscript{th} percentile, respectively. Notably, the performance of the baseline models in detecting bloated (.90 F1-score) and lazy (F1 = .95) documentation were higher than detecting excess structural info (F1 = .42), tangled (F1 = .41), and fragmented (F1 = .47) documentations. \subsection{Performance of Shallow Learning Models (RQ4)}\label{sec:shallow-learning} \subsubsection{Shallow Learning Models} Since documentation smell detection is multi-label classification problem, we employed different decomposition approaches: One-Vs-Rest (OVR), Label Powerset (LPS), and Classifier Chains (CC)~\cite{multilabel_decomp_1_MultilabelClassificationAnOverview,multilabel_decomp_2_AReviewOnMultilabelLearning,multilabel_decomp_3_ATutorialOnMultilabelClassification,multilabel_decomp_4_LearningFromMultilabelData} with Support Vector Machine (SVM) \cite{SVM_SupportVectorNetworks} as the base estimator. We chose SVM and OVR-SVM since those are successfully used for multi-label text classification \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM,svm_text_classification_1, svm_text_classification_2,multilabel_decomp_1_MultilabelClassificationAnOverview}. Each model trains a single classifier per class, with the samples of that class as positive samples and all other samples as negatives. Each individual classifier then separately gives predictions for unseen data. We used linear kernel for the SVM classifiers as recommended by earlier works \cite{svm_linear_kernel_paper_1, svm_linear_kernel_paper_2}. \cite{svm_rbf_1_AComparisonStudyOfDifferentKernelFunctions, svm_rbf_2_APracticalGuideToSVM}. We also evaluated adapted approaches like Multi label (ML) $k$NN \cite{MLkNN_ALazyLearningApproach} in this study. It finds the $k$ nearest neighborhood of an input instance using $k$NN, then uses Bayesian inference to determine the label set of the instance. We studied this method because it has been reported to achieve considerable performance for different multi-label classification tasks in previous studies \cite{MLkNN_ALazyLearningApproach, mlknn_MultilabelTextClassificationUsingSemanticFeatures}. For each algorithm, we picked the best model using standard practices, e.g., hyper parameter tuning in SVM as recommended by Hsu~\cite{Hsu-PracticalSVM-Misc2010}, choice of K in ML-kNN as recommended by \cite{mlknn_MultilabelTextClassificationUsingSemanticFeatures}. \subsubsection{Studied Features} We used two types of features: (1) rule-based metrics (described in Section \ref{subsubsec:rule-based-metrics}) and (2) bag of words (BoW) \cite{bag_of_words_paper_1}. Bag of words (BoW) is a common feature extraction procedure for text data and has been successfully used for text classification problems \cite{bag_of_words_for_text_1,bag_of_words_for_text_2}. \subsubsection{Results} \begin{table*}[t] \caption{Class-wise performance of shallow machine learning models} \begin{tabular}{p{.75cm}|lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Feature}} & {\textbf{Model}} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule \multirow{5}{=}{\textbf{Rule Based Feats}} & {\textbf{OVR-SVM}} & {.96} & {.88} & {.89} & \textbf{.88} & {.94} & {.86} & {.94} &{.90} & {.74} & {.45} & {.23} &{.31} & {.82} & {.67} & {.56} &\textbf{.61} & {.80} & {.69} & {.25} &{.37} \\ & {\textbf{LPS-SVM}} & {.94} & {.86} & {.70} &{.77} & {.91} & {.77} & {.97} &{.86} & {.74} & {.44} & {.21} &{.28} & {.80} & {.70} & {.40} &{.51} & {.81} & {.73} & {.32} &{.45} \\ & {\textbf{CC-SVM}} & {.96} & {.88} & {.87} &\textbf{.88} & {.92} & {.79} & {.97} &{.87} & {.75} & {.47} & {.24} &{.32} & {.82} & {.68} & {.54} &{.60} & {.80} & {.71} & {.27} &{.39} \\ & {\textbf{ML-$k$NN}} & {.93} & {.73} & {.89} &{.80} & {.91} & {.86} & {.80} &{.83} & {.75} & {.49} & {.31} &{.38} & {.80} & {.63} & {.54} &{.58} & {.79} & {.57} & {.50} &{.53} \\ \midrule \multirow{4}{=}{\textbf{BoW Feats}} & {\textbf{OVR-SVM}} & {.93} & {.84} & {.66} &{.74} & {.95} & {.87} & {.96} &\textbf{.91} & {.75} & {.49} & {.47} &{.48} & {.78} & {.57} & {.54} &{.56} & {.79} & {.55} & {.54} &{.55} \\%\hline & {\textbf{LPS-SVM}} & {.93} & {.89} & {.63} &{.74} & {.94} & {.83} & {.97} &{.89} & {.75} & {.50} & {.49} &\textbf{.50} & {.79} & {.59} & {.58} &{.58} & {.80} & {.59} & {.58} &\textbf{.58} \\ & {\textbf{CC-SVM}} & {.93} & {.85} & {.67} &{.75} & {.94} & {.85} & {.96} &{.90} & {.74} & {.48} & {.47} &{.48} & {.78} & {.57} & {.54} &{.56} & {.78} & {.54} & {.54} &{.54} \\ & {\textbf{ML-$k$NN}} & {.93} & {.86} & {.60} &{.71} & {.88} & {.75} & {.83} &{.79} & {.73} & {.44} & {.29} &{.35} & {.79} & {.59} & {.53} &{.56} & {.80} & {.63} & {.41} &{.50} \\ \bottomrule \end{tabular} \label{table_individual_performance_shallow} \end{table*} Table \ref{table_individual_performance_shallow} presents the performance of the shallow learning models. The best performer is OVR-SVM, followed closely by CC-SVM. CC-based models are generally superior to OVR-based models because of the capability of capturing label correlation \cite{CC_2_ClassifierChainsForMultilabel}. Since the labels (types) of the presentation smells are not correlated (see Section~\ref{sec:benchmark-details}), the CC-based SVM could not exhibit higher performance than the OVR-based SVM. Using rule-based features, OVR-SVM achieved a higher F1-score (0.88) than the other models for bloated documentation detection. Because documentation length (a rule-based) was more effective in detecting bloated documentation than bag of words. On the other hand, LPS-SVM achieved a higher F1-score (0.58) for fragmented documentation detection using bag of words, as bag of words more successfully determined whether the documentation was referring to other documentation than any rule-based features. Overall, the shallow models outperformed the rule-based classifiers for four smell types (except for lazy documentation smell). Therefore, the documentation smell detection does not normally depend on a single rule-based metric, rather, it depends on a combination of different metrics and their thresholds. The shallow learning models attempted to capture this combination of thresholds, and therefore, achieved better performances than the baseline models. \subsubsection{Feature Importance Analysis} We verified the importance of our rule-based features by applying permutation feature importance technique \cite{permutation_feature_importance_paper_1, permutation_feature_importance_paper_2} in the best performing shallow model, i.e., OVR-SVM. We first train OVR-SVM with all the features. While testing, we randomly shuffle the values of one feature at a time while keeping other feature values unchanged. A feature is important if shuffling its values affects the model performance. We calculate the change in performance in two ways. First, we measure the change in the average F1-score of the OVR-SVM model for the permutation of a feature. Second, we report the change of the specific class that the feature was intended for (i.e., `Documentation Length' for `Bloated'). We observe that the permutation of any of our rule-based features degrades the model performance (see Table \ref{table:permutation_feature_importance}). For example, after permutation of the values of the `Documentation Length' of test data, the average F1-score decreases by 0.17 (from 0.62 to 0.45) and the F1-score of the desired class (i.e., `Bloated') decreases by 0.46 (from 0.88 to 0.42). This analysis confirms the importance of combining rule-based metrics as features in the models. \begin{table} \centering \caption{OVR-SVM performance decrease in feature permutation} \begin{tabular}{llrr} \toprule \textbf{Permuted} & \textbf{Desired} & \multicolumn{2}{c}{\textbf{Decrease in F1}}\\ \cline{3-4} \textbf{Feature} & \textbf{Class C} & \textbf{Overall} & \textbf{Desired C} \\ \midrule Doc Length & {Bloated} & {.17} & {.46} \\ Readability & {Tangled} & {.06} & {.11} \\ \#Acronym\&Jargon & {Tangled} & {.05} & {.07} \\ {\#URLs } & {Fragmented} & {.03} & {.11} \\ \#Method, Class, Package & {Excess Struct} & {.17} & {.08} \\ Edit Distance & {Lazy} & {.09} & {.37} \\ \bottomrule \end{tabular} \label{table:permutation_feature_importance} \vspace{-.5cm} \end{table} \begin{table*}[t] \caption{Class-wise performance of deep learning models} \begin{tabular}{p{.75cm}|lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{}& \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Feature}} & {\textbf{Model}} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}\ \textbf{Word} \\ \textbf{Embed}\end{tabular}} &{\textbf{Bi-LSTM}} & {.92} & {.92} & {.92} &{.91} & {.89} & {.90} & {.89} &{.90} & {.76} & {.72} & {{.76}} &{.73} & {.78} & {.74} & {.78} &{.74} & {.67} & {.64} & {.67} &{.63} \\ &{\textbf{BERT}} & {.93} & {{.93}} & {{.93}} &{\textbf{.93}} & {{.97}} & {{.97}} & {{.97}} &{\textbf{.97}} & {.76} & {{.75}} & {{.76}} &{\textbf{.76}} & {.83} & {{.83}} & {{.83}} &{\textbf{.83}} & {.75} & {.75} & {{.75}} &{\textbf{.75}} \\ \bottomrule \end{tabular} \label{table_individual_performance_deep} \end{table*} \subsection{Performance of Deep Learning Models (RQ5)}\label{sec:deep-learning} \subsubsection{Deep Learning Models} We evaluated two deep learning models, Bidirectional LSTM (Bi-LSTM) and Bidirectional Encoder Representations from Transformers (BERT). We picked {Bi-LSTM}, because it is more capable of exploiting contextual information than the unidirectional LSTM \cite{bilstm_FramewisePhonemeClassificationWithBiLSTM}. Hence, the Bi-LSTM network can detect the documentation smell by capturing the information of the API documentations from both directions. BERT is a pre-trained model which was designed to learn contextual word representations of unlabeled texts \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. We picked BERT, because it is found to significantly outperform other models in various natural language processing and text classification tasks \cite{bert_success_1,bert_success_2,bert_success_3,bert_success_4,bert_success_5,bert_success_6,bert_success_7}. We constructed a Bi-LSTM model with 300 hidden states. We used ADAM optimizer \cite{adam_optimizer} with an initial learning rate of 0.001. We trained the model with batch size 256 over 10 epochs. We used BERT-Base for this study which has 12 layers with 12 attention heads and 110 million parameters. We trained it on benchmark for 10 epochs with a mini-batch size of 32. We used early-stop to avoid overfitting \cite{early_stop_bert_1} and considered validation loss as the metric of the early-stopping \cite{early_stop_bert_2}. The maximum length of the input sequence was set to 256. We used AdamW optimizer \cite{adam_w} with the learning rate set to 4e\textsuperscript{-5}, $\beta1$ to 0.9, $\beta2$ to 0.999, and $\epsilon$ to 1e\textsuperscript{-8} \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers, bert_fine_tuning}. We used binary cross-entropy to calculate the loss \cite{binary_cross_AreLossFunctionSame}. \subsubsection{Studied Features} We used word embedding as feature which is a form of word representation that is capable of capturing the context of a word in a document by mapping words with similar meaning to a similar representation. For Bi-LSTM, we used 100-dimensional pre-trained GloVe embedding which was trained on a dataset of one billion tokens (words) with a vocabulary of four hundred thousand words \cite{Glove_GlobalVectorsForWordRepresentation}. We used the pre-trained embedding in BERT model \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. \subsubsection{Results} Table \ref{table_individual_performance_deep} shows the performance of the deep learning models. BERT outperformed Bi-LSTM, the shallow, and rule-based classifiers to detect each smell (F1-score). {The increase in F1-score in BERT compared to the best performing shallow learning model per smell is as follows: bloated (5.7\% over OVR-SVM Rule), lazy (6.6\% over OVR-SVM BoW), Excess Structural Information (52\% over ML-kNN BoW), tangled (36.1\% over OVR-SVM Rule), and fragmented (36.4\% over OVR-SVM BoW).} SVM and kNN-based models produced more false-negative results because the number of positive instances for an individual smell type is lower than the number of negative instances for that type. As a result, SVM and kNN-based models showed low recalls for some types (Excess structural information, Tangled, and Fragmented) and consequently resulted in low F1-scores. On the other hand, Bi-LSTM and BERT achieved better performance because they focused on capturing generalized attributes for each smell type. We manually analyzed the misclassified examples of Excess Structural Information and fragmented documentation where BERT achieved below 0.8 accuracy. For the Excess Structural Information smell detection, BERT falsely considered some java objects and methods as structural information; therefore, the model produced some false positive cases. In some examples, BERT could not identify whether the information of documentation was referring to other documentation. As a result, the model misclassified the fragmented documentation. \section{Benchmark Study of the Five API Documentation Smells} We answer the following three research questions: \begin{enumerate}[label=RQ\arabic{*}, leftmargin=25pt] \item How accurate are shallow machine learning models to automatically detect the documentation smells? \item Can the deep machine learning models outperform the shallow learning models to detect the documentation smells? \item Can the detection of one documentation smell support the detection another smell? \end{enumerate} We analyze and report the performance of each of the techniques developed and experimented as part of the algorithms development steps. We used 5-fold iterative stratified cross-validation for reporting performances that has been recommended for a multilabel dataset in \cite{iterative_stratified_cross_valid}. We report the performances using standard multi-label classification metrics, i.e., Exact Match Ratio, Hamming Loss \cite{a_literature_survey_on_algorithms_for_multilabel}. We also report separate Accuracy, Precision, Recall, and F1-score for each class. \vspace{1mm}\noindent\textbf{Iterative Stratified Cross-Validation} Traditional $k$-fold cross-validation is a statistical method of evaluating machine learning algorithms which divides data into $k$ equally sized folds and runs for $k$ iterations \cite{traditional_cross_validation_paper}. In each iteration, each of the $k$ folds is used as the held-out set for validation while the remaining $k-1$ folds are used as training sets. Stratified cross-validation is used to make sure that each fold is an appropriate representative of the original data by producing folds where the proportion of different classes is maintained \cite{stratified_cross_validation_paper}. However, stratification is not sufficient for multi-label classification problems as the number of distinct labelsets (i.e., different combinations of labels) is often quite large. For example, there can be 32 combinations of labels in our study as there are 5 types of documentation smells. In such cases, original stratified $k$-fold cross-validation is impractical since most groups might consist of just a single example. Iterative stratification, proposed by \cite{iterative_stratified_cross_valid}, solves this issue by employing a greedy approach of selecting the rarest groups first and adding them to the smallest folds while splitting. Hence, we used this iterative stratified cross-validation in our experiment. \vspace{1mm}\noindent\textbf{Exact Match Ratio} In multi-label classification, prediction for an instance is a set of labels. Hence, it has a notion of partially correct prediction (along with fully correct and incorrect). The Exact Match Ratio ($EMR$) ignores the partially correct prediction and considers only those predictions as correct which exactly match the true label sets. \begin{equation} EMR = \frac{1}{N} \sum_{i=1}^{N} I (L_i^{pred} = L_i^{true}) \label{eq:EMR} \end{equation} {$I$ is the indicator function. Its' value is 1 if the prediction, $L_i^{pred}$ matches the actual label, $L_i^{true}$, and 0 otherwise. $N$ is the total number of data. } \vspace{1mm}\noindent\textbf{Hamming Loss} Hamming Loss ($HL$) is the fraction of labels in labelsets that are incorrectly predicted, i.e., the fraction of the wrong labels to the total number of labels \cite{hamming_loss_paper}. It takes the notion of partially correct prediction into account. \begin{equation} HL = \frac{1}{N\cdot L} \sum_{i=1}^{N} \sum_{j=1}^{L} xor (y_{i,j}^{pred}, y_{i,j}^{true}) \label{eq:HL} \end{equation} {$N$ is the total number of data, $L$ is the total number of labels.} \vspace{1mm}\noindent\textbf{Accuracy} Accuracy ($A$) is the number of correctly predicted instances out of all the instances. We reported accuracy separately for each class. \begin{equation} A = \frac{TP+TN}{TP+FN+TN+FP} \label{eq:acc} \end{equation} {$TP$ is the number of true positives, $FN$ is the number of false negatives, $FP$ is the number of false positives, $TN$ is the number of true negatives.} \vspace{1mm}\noindent\textbf{Precision} Precision ($P$) is the ratio between the number of correctly predicted instances and all the predicted instances for a given class. \begin{equation} P = \frac{TP}{TP+FP} \label{eq:precision} \end{equation} \vspace{1mm}\noindent\textbf{Recall} Recall ($R$) represents the ratio of the number of correctly predicted instances and all instances belonging to a given class. \begin{equation} R = \frac{TP}{TP+FN} \label{eq:recall} \end{equation} \vspace{1mm}\noindent\textbf{F1-score} F1-score is the harmonic mean of precision and recall. \begin{equation} F1 = \frac{2\cdot P\cdot R}{P+R} \label{eq:f-score} \end{equation} \section{Developers' Survey of Documentation Smells}\label{sec:survey} Four out of the five API documentation smells in our study were previously reported as commonly observed by IBM developers~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. The other smell (lazy documentation) is reported as a problem in API documentation in multiple studies~\cite{Aghajani-SoftwareDocPractitioner-ICSE2020,Robillard-APIsHardtoLearn-IEEESoftware2009a}. Given that we extended previous studies by creating a benchmark of the smells with real-world examples, we needed to further ensure that our collected examples of smelly documentation units do resonate with software developers. We, therefore, conducted a survey of professional software developers (1) to validate our catalog of the five API documentation smells and (2) to understand whether, similar to previous research, developers agree with the negative impact of the documentation smells. In particular, we explore the following two research questions: \begin{enumerate}[label=RQ\arabic{*}., leftmargin=25pt] \item How do software developers agree with our catalog and examples of the five API documentation smells? \item How do software developers perceive the impact of the detected documentation smells? \end{enumerate}\subsection{Survey Setup} We recruited 21 professional software developers who are working in the software industry. We ensured that each developer is actively involved in daily software development activities like API reuse and documentation consultation. The participants were collected through personal contacts. First, each participant had to answer two demographic questions: current profession and years of experience in software development. We then presented each participant two Javadoc examples of each smell and asked him/her whether they agreed that this documentation example belonged to that particular smell. Then, we asked them about how frequently they faced these documentation smells. Finally, we inquired them of the negative impact of the documentation smells on their overall productivity during software development. Out of the 21 participants, 14 participants had experience less than 5 years and the rest had more than 5 years. Majority of the participants had experience less than 5 years because they are likely to be more engaged in studying API documentation as part of their software programming responsibility. Developers with experience more than five years are more engaged in design of the software and its architecture. \begin{figure}[t \centering \includegraphics[scale=.4]{new_images/survey_examples.png} \caption{Survey response on whether the software developers agreed with our labeled documentation smell examples.} \label{fig:survey_examples} \end{figure} \begin{figure}[t] \centering \includegraphics[scale=.4]{new_images/survey_frequency.png} \caption{Survey response on how frequently the participants faced the documentation smells in the last three months.} \label{fig:survey_frequency} \end{figure} \subsection{How do software developers agree with our catalog and examples of the five API documentation smells? (RQ1)} We showed each participant two examples of each smell, i.e., 10 examples in total. For each example, we asked two questions: (1) Do you think the documentation mentioned above is [smell, e.g., lazy]? The options are in Likert scale, i.e., strongly agree, agree, neutral, disagree, and strongly disagree. and (2) Based on your experience of the last three months, how frequently did you observe this [smell, e.g., lazy] in documentation? The options are: never, once or twice, occasionally, frequently, and no opinion. The options are picked from literature \cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. Two examples per smell ensure increased confidence on the feedback we get from each participant. Fig.~\ref{fig:survey_examples} shows the responses of the participants to the first question. More than 75\% participants agreed to the examples of three smells: bloated, tangled, and excess structural info. At least 50\% of the participants agreed to the examples of the other two smells. Only 5-25\% of the participants disagreed to the examples. Overall, each example of the API documentation smell was agreed by at least 50\% of the participants. This validates out catalog of API documentation smells based on feedback from the professional developers. Fig.~\ref{fig:survey_frequency} shows the frequency of the documentation smells the developers observed in the last three months (second question). We found that 50\% of the participants had faced all the smells and lazy smell was the most frequently encountered. On the other hand, half of the participants did not face bloated documentation smells in the last three months, while 60\%-65\% of the participants faced tangled, excess structural info, and fragmented API documentation. This study reveals that API documentation is becoming less explicable, more complex, and unnecessarily structured to keep the documentation short. To solve this problem, API documentation needs to be more understandable and elaborated to explain the API functionality. \subsection{How do software developers perceive the impact of the detected documentation smells? (RQ2)} We asked the participants how severely the documentation smells impact their development tasks. The responses were taken on a scale of five degrees: "Blocker", "Severe", "Moderate", "Not a Problem", and "No opinion". The options were picked from similar questions on API documentation presentation problems from literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. \begin{figure}[!htb] \centering \includegraphics[scale=.5]{new_images/survey_severity_2.png} \caption{The perceived impact of the five documentation smells by severity and frequency. Circle size indicates the percentage of participants who strongly agreed or agreed to the smells.} \label{fig:survey_severity} \end{figure} We analyzed the impact of the documentation smells with respect to the frequency of the smells the participants had observed over the past three months (see Fig.~\ref{fig:survey_severity}). For each smell, we compute the frequency scale (x-axis) as the percentage of response "Frequently", "Occasionally", and "Once or twice". For example, regarding whether the participants had observed lazy documentation in the past three months, 25\% answered "Frequently", 35\% answered "Occasionally", and 30\% answered "Once or twice", leading to a total 90\% in the frequency scale. We constructed the severity scale (y-axis) by combining the percentage of the participants responded with "Blocker", "Severe", and "Moderate". For example, due to fragmented documentation smells, 5\% of the participants could not use that particular API and picked another API ("Blocker"), 20\% of the participants believed that they wasted a lot of time figuring out the API functionality ("Severe"), and 25\% of the participants felt irritated ("Moderate") with the fragmented documentation. The circle size indicates the percentage of the participants "Strongly Agree" or "Agree" with the examples containing documentation smells. From Fig.~\ref{fig:survey_severity}, we observed that lazy documentation had the most frequent and the most negative impact (90\%). Tangled documentation was identified as the second most severe smell (85\%). Although bloated documentation was considered more severe (65\%) than excess structural info (55\% severity) and fragmented (50\% severity) documentation, bloated occurred less frequently than the later two. The most important finding of this survey is that the coordinates of all the circles (referring to documentation smells) in Fig.~\ref{fig:survey_severity} were above or equal to 50. This indicates that according to the majority of the participants, these documentations smells are occurring frequently and hindering the productivity of the development tasks. \section{Threats to Validity} In this work, we conducted our experiments on a relatively small dataset. Since, to the best of our knowledge, detecting the documentation smells is the first of its kind, we manually labeled a small portion of the Java API documentation due to the time constraint. However, we randomly sampled the documentations for manual labeling, therefore, we expect that the actual distributions of the documentation smells will remain identical in case of adding more documentation examples. Furthermore, we performed cross-validation on our dataset to reduce the effect of any non-representative subset. The number of participants in our survey is too low to get a clear picture of how the documentation smells affect productivity on the large scale. We conducted the survey with an aim to validate the catalog we developed by the software developers. As the developers agreed with the catalog and its negative impact on the productivity, in the future extension of this study, we can include more participants to categorize the documentations into different documentation smells based on this catalog. \section{Introduction}\label{sec:introduction} APIs (Application Programming Interfaces) are interfaces to reusable software libraries and frameworks. The proper learning of APIs is paramount to support modern day rapid software development. To achieve this goal, APIs typically are supported by official documentation. An API documentation is a product itself, which warrants the creation and maintenance principles similar to any existing software product. A good documentation can facilitate the proper usage of an API, while a bad documentation can severely harm its adoption~\cite{Robillard-APIsHardtoLearn-IEEESoftware2009a}. Unfortunately, research shows that API official documentation can be often incomplete, incorrect, and outdated~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. We conducted an empirical study of five documentation smells in API documentation. We answer the following research questions: \begin{enumerate}[label=RQ\arabic{*}] \item How prevalent are the documentation smells in API official documentation? \item How accurate are machine learning models to automatically detect the documentation smells? \end{enumerate} \section{API Documentation Smells} Similar to code and design artifacts, software documentation can exhibit smells, if the design of the documentation has problems. Documentation smells refer to presentation issues of the documentations that do not make a documentation incorrect, rather they hinder the proper usage of the documentation. A smell in an API documentation unit can inform us of the bad design in the documentation unit. A documentation unit can be the documentation of a method, a type (e.g., a class), a package, and an API overall. Following previous works in API documentation \cite{Petrosyan-DiscoverAPITypeInformation-ICSE2015, ibm_survey_paper_uddin2015api}, we consider documentation unit as the documentation of a method/type. In this section, we present a catalog of 5 documentation smells based on previous studies \cite{ibm_survey_paper_uddin2015api} and exploratory analysis of API official documentation (i.e., JAVA API documentations), and a survey conducted on software developers to validate the found smells. \begin{figure*}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.6]{new_images/FlowChartDocSmell.png} \caption{Workflow of our study.} \label{fig:workflow_of_study} \end{figure*} \subsection{Catalog} We present 5 types of documentation smells where the first 4 types (i.e., Bloated, Excess Structural Information, Tangled, Fragmented) were cited by the IBM developers in a previous study \cite{ibm_survey_paper_uddin2015api} and the last one (i.e., Lazy) is introduced for the first time, being motivated by developers' discussion on various online forums (see Figure \ref{fig:motivating_lazy_example}). We believe that this catalog will help the developers to get a better understanding of documentation smells, and will facilitate future researches in this direction. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.18]{new_images/motivating_example_lazy.JPG} \caption{Tweet complaining about lazy documentation of code} \label{fig:motivating_lazy_example} \end{figure} \gias{describe each smell in the following format: what it is (texts + a figure), why it is chosen (mention previous research + discussion of the smell in web discussions) + what do developers in the survey think about it.} \subsubsection{Bloated} By `Bloated’ we mean those documentations whose description (of an API element type) is verbose or excessively extensive. It is difficult to understand lengthy documentations and use them properly. Moreover, they cannot be effectively handled that makes them hard to modify when needed, i.e. in case of any update in the API source codes. In our evaluation, we found many documentations that are larger than necessary. For example, the documentation shown in Figure \ref{fig:bloated_example} is so verbose and lengthy that it is hard to follow and use it. Hence, it is a bloated documentation. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/bloated_example.png} \caption{Example of Bloated Smell} \label{fig:bloated_example} \end{figure} \subsubsection{Excess Structural Information} A documentation with `Excess Structural Information’ smell contains too many structural syntax or information, e.g., the Javadoc of the java.lang.Object class Javadoc lists all the hundreds of subclasses of the class. In our study, we find this type of documentation to contain many class and package names. For instance, the documentation of Figure \ref{fig:excess_struct_example} contains many structural information (marked in red rectangle) that are unnecessary to understand and use the underlying method. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/excess_struct_example.png} \caption{Example of Excess Structural Information} \label{fig:excess_struct_example} \end{figure} \subsubsection{Tangled} We call a documentation `Tangled’ if its’ description is tangled with various information that makes it complex, reduces the readability and understandability of the description. Figure \ref{fig:tangled_example} depicts an example of tangled documentation which is hard to follow and understand. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/tangled_example.png} \caption{Example of Tangled Smell} \label{fig:tangled_example} \end{figure} \subsubsection{Fragmented} Sometimes it is seen that the information of documentation (related to an API element) is scattered over too many pages or sections. We consider them in the “Fragmented” category. In our empirical study, we found a good number of documentation that contain many URLs, and references that indicate possible fragmentation smell. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/fragmented_example.png} \caption{Example of Fragmented Smell} \label{fig:fragmented_example} \end{figure} \subsubsection{Lazy} We categorize a documentation as `Lazy’ if it contains very small information to convey to the readers. In many cases, it is seen that the documentation does not contain any extra information except what can be perceived directly from the function name. So this kind of documentation does not have much to offer to the readers. We can see a lazy documentation in Figure \ref{fig:lazy_example}. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/lazy_example.png} \caption{Example of Lazy Smell} \label{fig:lazy_example} \end{figure} \subsection{Description of the survey} How do developers feel about the smells? talk very briefly about the survey by simply motivating the detection of the smells. \section{Study Setup} \subsection{Benchmark of Documentation Smells} \subsubsection{Data Collection} talk about how data is collected, i.e., how we created the dataset for everyone to label for benchmarks. \subsubsection{Process} talk briefly about the benchmark creation process \subsection{Studied Features} \gias{put the feature summaries in a table} In this subsection, we describe the features that we used to train our SVM and \textit{k}NN-based models (see section \ref{subsubsec:ovr_svm} to \ref{subsubsec:ml_knn}) for documentation smell detection. \subsubsection{Documentation Length} We use the length of every documentation in order to capture the extensiveness of the bloated documentations. \subsubsection{Readability Metrics} We measure Flesch readability metrics for the documentations and use them as a feature to analyze the understandability of documentation. This feature might be useful to detect tangled documentations. \gias{justify using an example why this feature is chosen} \subsubsection{Number of Acronyms and Jargons} Since acronyms and jargons increase the complexity of a reading passage, we use the number of acronyms and jargon in every documentation to detect the tangled documentation by estimating the understandability. \subsubsection{Number of URLs} As URLs are hints of possible fragmentations in the documentation, we use the number of URLs to capture these smells. \subsubsection{Number of function, class and package name mentioned} We use the number of functions, classes, packages mentioned in documentation to capture excess structural information and fragmentation. \subsubsection{Edit Distance} From the definition of lazy documentation, it can be said that the edit distance of a lazy documentation and its’ unit definition (method prototype) will be comparatively small. So we calculate the edit distance between the documentation description and method prototype and use it as a feature for our machine learning models. \subsubsection{Average Cosine Similarity} We calculate the avg. cosine similarity of the documentations’ description. For this, we calculate the cosine similarities between each possible pair of that documentation and take their avg value for normalization. This feature will help to detect redundancy in the documentations. \subsection{Studied Algorithms} We applied both traditional and deep learning algorithms to detect documentation smells. We employed different decomposition approaches (i.e., One-Vs-Rest, Label Powerset, Classifier Chains)~\cite{multilabel_decomp_1_MultilabelClassificationAnOverview,multilabel_decomp_2_AReviewOnMultilabelLearning,multilabel_decomp_3_ATutorialOnMultilabelClassification,multilabel_decomp_4_LearningFromMultilabelData} with Support Vector Machine (SVM) \cite{SVM_SupportVectorNetworks} as the base estimator for multi-label classification of documentation smells. We chose SVM since it has been successfully used with these decomposition approaches for multi-label classification in previous studies \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM}. SVM has also shown great performance in text classification tasks \cite{svm_text_classification_1, svm_text_classification_2}. We also evaluated adapted approaches like ML-$k$NN \cite{MLkNN_ALazyLearningApproach}, and deep learning models like Bi-LSTM \cite{bi_lstm_BidirectionalRecurrentNeuralNetworks}, and BERT \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. \gias{group the studied algorithms into shallow vs deep maybe?} \subsubsection{OVR-SVM} \label{subsubsec:ovr_svm} One-Vs-Rest is a heuristic method that works by decomposing the multi-label classification problem into multiple independent binary classification problems (one per class) \cite{multilabel_decomp_1_MultilabelClassificationAnOverview, multilabel_decomp_3_ATutorialOnMultilabelClassification}. It trains a single classifier per class, with the samples of that class as positive samples and all other samples as negatives. All the independent classifiers then separately give individual class predictions for unseen data. We evaluated One-Vs-Rest (OVR) approach with SVM (as the base estimator) for detecting documentation smells. One-Vs-Rest support vector machine (OVR-SVM) has been successfully applied in several problems \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM, multilabel_decomp_1_MultilabelClassificationAnOverview}. We used RBF kernel for the SVM classifiers as recommended by earlier works \cite{svm_rbf_1_AComparisonStudyOfDifferentKernelFunctions, svm_rbf_2_APracticalGuideToSVM}. \subsubsection{LPS-SVM} \label{subsubsec:lps_svm} Label Power Set (LPS) treats every combination of labels as a new class and approaches in a multiclass classification manner \cite{LearningMultiLabelSceneClassification}. As a result, this method has high computational complexity. However, it is capable of taking label correlation into account. We used SVM (with RBF kernel) as the base estimator of the Label Power Set method \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM}. \subsubsection{CC-SVM} \label{subsubsec:cc_svm} Classifier Chains (CC) constructs a chain of binary classifiers, where every classifier uses the predictions of all the previous classifiers of the chain \cite{CC_1_ClassifierChainsForMultilabel, CC_2_ClassifierChainsForMultilabel}. This way the method can take label correlations into account. We constructed a Classifier Chain (CC) of SVMs and evaluated its’ performance for documentation smell detection. \subsubsection{ML-$k$NN} \label{subsubsec:ml_knn} Multi-label $k$ Nearest Neighbors (ML-$k$NN) is derived from the traditional $k$-nearest neighbor ($k$NN) algorithm \cite{MLkNN_ALazyLearningApproach}. It finds the $k$ nearest neighborhood of an input instance using $k$NN, then uses Bayesian inference to determine the label set of the instance. We studied this method because it has been reported to achieve considerable performance for different multi-label classification tasks in previous studies \cite{MLkNN_ALazyLearningApproach, mlknn_MultilabelTextClassificationUsingSemanticFeatures}. We used ML-$k$NN with the number of nearest neighbors, $K$ = 10 during our experiment as recommended by \cite{mlknn_MultilabelTextClassificationUsingSemanticFeatures}. \subsubsection{Bi-LSTM} Bidirectional LSTM is more capable of exploiting contextual information than the unidirectional LSTM \cite{bilstm_FramewisePhonemeClassificationWithBiLSTM}. Hence, the Bi-LSTM network can detect the documentation smell by capturing the information of the API documentations from both directions. We constructed a Bi-LSTM model with 300 hidden states and initialized it using the pre-trained GloVe embedding \cite{Glove_GlobalVectorsForWordRepresentation} of 100 dimensions. We used ADAM optimizer \cite{adam_optimizer} with an initial learning rate of 0.001. We trained the model with batch size 256 over 10 epochs. \subsubsection{BERT} Considering the great success of BERT (Bidirectional Encoder Representations from Transformers) in various natural language processing and text classification tasks \cite{bert_success_1,bert_success_2,bert_success_3,bert_success_4,bert_success_5,bert_success_6,bert_success_7}, we feel motivated to evaluate its’ performance in documentation smell detection. BERT is a pre-trained model which was designed to learn contextual word representations of unlabeled texts \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. We used BERT-Base for this study which has 12 layers with 12 attention heads and 110 million parameters. We trained it on our labeled dataset for 10 epochs with a mini-batch size of 32. We used early-stop to avoid overfitting \cite{early_stop_bert_1} and considered validation loss as the metric of the early-stopping \cite{early_stop_bert_2}. The maximum length of the input sequence was set to 256. We used AdamW optimizer \cite{adam_w} with the learning rate set to 4e\textsuperscript{-5}, ß1 to 0.9, ß2 to 0.999, and epsilon to 1e\textsuperscript{-8} \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers, bert_fine_tuning}. We used binary cross-entropy to calculate the loss \cite{binary_cross_AreLossFunctionSame}. \subsection{Performance Metrics} We analyze and report the performance of each of the techniques developed and experimented as part of the algorithms development steps. We used 5-fold iterative stratified cross-validation for reporting performances that has been recommended for a multilabel dataset in \cite{iterative_stratified_cross_valid}. We report the performances using standard multi-label classification metrics, i.e., Exact Match Ratio, Hamming Loss \cite{a_literature_survey_on_algorithms_for_multilabel}. We also report separate Accuracy, Precision, Recall, and F1-score for each class. \subsubsection{Iterative Stratified Cross-Validation} Traditional $k$-fold cross-validation is a statistical method of evaluating machine learning algorithms which divides data into $k$ equally sized folds and runs for $k$ iterations \cite{traditional_cross_validation_paper}. In each iteration, each of the $k$ folds is used as the held-out set for validation while the remaining $k-1$ folds are used as training sets. Stratified cross-validation is used to make sure that each fold is an appropriate representative of the original data by producing folds where the proportion of different classes is maintained \cite{stratified_cross_validation_paper}. However, stratification is not sufficient for multi-label classification problems as the number of distinct labelsets (i.e., different combinations of labels) is often quite large. For example, there can be 32 combinations of labels in our study as there are 5 types of documentation smells. In such cases, original stratified $k$-fold cross-validation is impractical since most groups might consist of just a single example. Iterative stratification, proposed by \cite{iterative_stratified_cross_valid}, solves this issue by employing a greedy approach of selecting the rarest groups first and adding them to the smallest folds while splitting. Hence, we used this iterative stratified cross-validation in our experiment. \subsubsection{Exact Match Ratio} In multi-label classification, prediction for an instance is a set of labels. Hence, it has a notion of partially correct prediction (along with fully correct and incorrect). The Exact Match Ratio ($EMR$) ignores the partially correct prediction and considers only those predictions as correct which exactly match the true label sets. \begin{equation} EMR = \frac{1}{N} \sum_{i=1}^{N} I (L_i^{pred} = L_i^{true}) \label{eq:EMR} \end{equation} {$I$ is the indicator function. Its' value is 1 if the prediction, $L_i^{pred}$ matches the actual label, $L_i^{true}$, and 0 otherwise. $N$ is the total number of data. } \subsubsection{Hamming Loss} Hamming Loss ($HL$) is the fraction of labels in labelsets that are incorrectly predicted, i.e., the fraction of the wrong labels to the total number of labels \cite{hamming_loss_paper}. It takes the notion of partially correct prediction into account. \begin{equation} HL = \frac{1}{N\cdot L} \sum_{i=1}^{N} \sum_{j=1}^{L} xor (y_{i,j}^{pred}, y_{i,j}^{true}) \label{eq:HL} \end{equation} {$N$ is the total number of data, $L$ is the total number of labels.} \subsubsection{Accuracy} Accuracy ($A$) is the number of correctly predicted instances out of all the instances. We reported accuracy separately for each class. \begin{equation} A = \frac{TP+TN}{TP+FN+TN+FP} \label{eq:acc} \end{equation} {$TP$ is the number of true positives, $FN$ is the number of false negatives, $FP$ is the number of false positives, $TN$ is the number of true negatives.} \subsubsection{Precision} Precision ($P$) is the ratio between the number of correctly predicted instances and all the predicted instances for a given class. \begin{equation} P = \frac{TP}{TP+FP} \label{eq:precision} \end{equation} \subsubsection{Recall} Recall ($R$) represents the ratio of the number of correctly predicted instances and all instances belonging to a given class. \begin{equation} R = \frac{TP}{TP+FN} \label{eq:recall} \end{equation} \subsubsection{F1-score} F1-score is the harmonic mean of precision and recall. \begin{equation} F1 = \frac{2\cdot P\cdot R}{P+R} \label{eq:f-score} \end{equation} \section{Study Results} \subsection{How prevalent are the smells in the benchmark?} give two statistics: all the documentation unit you analyzed and the percentage of which was finally considered as smells. then describe how the different documentation smells are prevalent in the benchmark. \subsection{How accurate are the smell detectors?} \begin{table}[!ht] \caption{Performance of the models on the overall smell types detection} \resizebox{\columnwidth}{!} { \begin{tabular}{|c|c|c|} \hline \textbf{Model} & \textbf{Exact Match Ratio} & \textbf{Hamming Loss} \\ \hline \textbf{OVR-SVM} & .50 & \textbf{.14} \\ \textbf{LPS-SVM} & .48 & .15 \\ \textbf{CC-SVM} & .50 & \textbf{.14} \\ \textbf{ML-$k$NN} & .47 & .15 \\ \textbf{Bi-LSTM} & .80 & .20 \\ \textbf{BERT} & \textbf{.84} & .15 \\ \hline \end{tabular} } \label{table_overall_performance} \end{table} Table \ref{table_overall_performance} represents the performance of the ML models for detecting documentation smell as a multi-label classification problem. We observe that OneVsRest (OVR) and Classifier Chain (CC) achieved equal results. CC-based models are generally superior to OVR-based models because of the capability of capturing label correlation. Since the labels (types) of the documentation smells are not correlated, the CC-based SVM could not exhibit higher performance than the OVR-based SVM. However, Label Powerset (LPS) achieved lower performance than the OVR and CC-based models. To show better results, LPS-based SVM would require sufficient instances for all 32 classes of 5 smell types. Deep learning-based models like Bi-LSTM and BERT, on the other hand, outperformed the SVM and $k$NN-based models by achieving higher exact match ratios. Although Bi-LSTM showed higher Hamming loss, BERT achieved similar to the SVM and $k$NN-based models. Therefore, in terms of Hamming loss, deep learning-based models did not show any improvement. However, considering both exact match ratio and Hamming loss as the performance metrics, we can deduce that BERT is the most suitable of all the models experimented in detecting the documentation documentation smell. \begin{table*}[!ht] \caption{Performance on different type of documentation smells} \begin{center} \scalebox{1.0} { \begin{tabular}{ccccccccccccccccccccc} & \multicolumn{20}{c}{} \\ \cline{2-21} \multicolumn{1}{c|}{} & \multicolumn{4}{c|}{\textbf{Bloated}} & \multicolumn{4}{c|}{\textbf{Lazy}} & \multicolumn{4}{c|}{\textbf{Excess Struct}} & \multicolumn{4}{c|}{\textbf{Tangled}} & \multicolumn{4}{c|}{\textbf{Fragmented}} \\ \hline \multicolumn{1}{|c|}{\textbf{Model}} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} & \multicolumn{1}{c}{A} & \multicolumn{1}{c}{P} & \multicolumn{1}{c}{R} & \multicolumn{1}{c|}{F1} \\ \hline \multicolumn{1}{|c|}{\textbf{OVR-SVM}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c}{.88} & \multicolumn{1}{c}{.89} & \multicolumn{1}{c|}{.89} & \multicolumn{1}{c}{.93} & \multicolumn{1}{c}{.85} & \multicolumn{1}{c}{.92} & \multicolumn{1}{c|}{.88} & \multicolumn{1}{c}{\textbf{.77}} & \multicolumn{1}{c}{.48} & \multicolumn{1}{c}{.23} & \multicolumn{1}{c|}{.31} & \multicolumn{1}{c}{\textbf{.85}} & \multicolumn{1}{c}{.72} & \multicolumn{1}{c}{.54} & \multicolumn{1}{c|}{.62} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c}{\textbf{.77}} & \multicolumn{1}{c}{.44} & \multicolumn{1}{c|}{.56} \\ \multicolumn{1}{|c|}{\textbf{LPS-SVM}} & \multicolumn{1}{c}{.96} & \multicolumn{1}{c}{.90} & \multicolumn{1}{c}{.77} & \multicolumn{1}{c|}{.83} & \multicolumn{1}{c}{.94} & \multicolumn{1}{c}{.84} & \multicolumn{1}{c}{.96} & \multicolumn{1}{c|}{.89} & \multicolumn{1}{c}{\textbf{.77}} & \multicolumn{1}{c}{.50} & \multicolumn{1}{c}{.24} & \multicolumn{1}{c|}{.33} & \multicolumn{1}{c}{.83} & \multicolumn{1}{c}{.71} & \multicolumn{1}{c}{.42} & \multicolumn{1}{c|}{.54} & \multicolumn{1}{c}{.73} & \multicolumn{1}{c}{.64} & \multicolumn{1}{c}{.49} & \multicolumn{1}{c|}{.56} \\ \multicolumn{1}{|c|}{\textbf{CC-SVM}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c}{.88} & \multicolumn{1}{c}{.90} & \multicolumn{1}{c|}{.89} & \multicolumn{1}{c}{.93} & \multicolumn{1}{c}{.83} & \multicolumn{1}{c}{.93} & \multicolumn{1}{c|}{.87} & \multicolumn{1}{c}{\textbf{.77}} & \multicolumn{1}{c}{.49} & \multicolumn{1}{c}{.21} & \multicolumn{1}{c|}{.29} & \multicolumn{1}{c}{\textbf{.85}} & \multicolumn{1}{c}{.72} & \multicolumn{1}{c}{.54} & \multicolumn{1}{c|}{.62} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c}{.75} & \multicolumn{1}{c}{.45} & \multicolumn{1}{c|}{.56} \\ \multicolumn{1}{|c|}{\textbf{ML-$k$NN}} & \multicolumn{1}{c}{.95} & \multicolumn{1}{c}{.77} & \multicolumn{1}{c}{.82} & \multicolumn{1}{c|}{.80} & \multicolumn{1}{c}{.91} & \multicolumn{1}{c}{.83} & \multicolumn{1}{c}{.84} & \multicolumn{1}{c|}{.84} & \multicolumn{1}{c}{.76} & \multicolumn{1}{c}{.46} & \multicolumn{1}{c}{.39} & \multicolumn{1}{c|}{.42} & \multicolumn{1}{c}{.82} & \multicolumn{1}{c}{.65} & \multicolumn{1}{c}{.55} & \multicolumn{1}{c|}{.60} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c}{.65} & \multicolumn{1}{c}{.64} & \multicolumn{1}{c|}{.65} \\ \multicolumn{1}{|c|}{\textbf{Bi-LSTM}} & \multicolumn{1}{c}{.92} & \multicolumn{1}{c}{.92} & \multicolumn{1}{c}{.92} & \multicolumn{1}{c|}{.91} & \multicolumn{1}{c}{.89} & \multicolumn{1}{c}{.90} & \multicolumn{1}{c}{.89} & \multicolumn{1}{c|}{.90} & \multicolumn{1}{c}{.76} & \multicolumn{1}{c}{.72} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c|}{.73} & \multicolumn{1}{c}{.78} & \multicolumn{1}{c}{.74} & \multicolumn{1}{c}{.78} & \multicolumn{1}{c|}{.74} & \multicolumn{1}{c}{.67} & \multicolumn{1}{c}{.64} & \multicolumn{1}{c}{.67} & \multicolumn{1}{c|}{.63} \\ \multicolumn{1}{|c|}{\textbf{BERT}} & \multicolumn{1}{c}{.93} & \multicolumn{1}{c}{\textbf{.93}} & \multicolumn{1}{c}{\textbf{.93}} & \multicolumn{1}{c|}{\textbf{.93}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c}{\textbf{.97}} & \multicolumn{1}{c|}{\textbf{.97}} & \multicolumn{1}{c}{.76} & \multicolumn{1}{c}{\textbf{.75}} & \multicolumn{1}{c}{\textbf{.76}} & \multicolumn{1}{c|}{\textbf{.76}} & \multicolumn{1}{c}{.83} & \multicolumn{1}{c}{\textbf{.83}} & \multicolumn{1}{c}{\textbf{.83}} & \multicolumn{1}{c|}{\textbf{.83}} & \multicolumn{1}{c}{.75} & \multicolumn{1}{c}{.75} & \multicolumn{1}{c}{\textbf{.75}} & \multicolumn{1}{c|}{\textbf{.75}} \\ \hline \end{tabular} } \label{table_individual_performance} \end{center} \end{table*} Table \ref{table_individual_performance} shows the performance of the ML models on each type of documentation smells. Although SVM and $k$NN-based models achieved slightly better accuracy than Bi-LSTM and BERT, the later models outperformed SVM and $k$NN-based models in F1-score. This behavior is due to the unequal distribution of the smell types over the dataset. SVM and $k$NN-based models produced more false-negative results because the number of positive instances for an individual smell type is significantly lower than the number of negative instances for that type. As a result, SVM and $k$NN-based models showed quite low recalls for some types (Excess Struct, Tangled, and Fragmented) and consequently resulted in low F1-scores. On the other hand, Bi-LSTM and BERT focused on capturing generalized attributes for each smell type and as a result, achieved impressive performance in all the performance metrics. Overall, BERT showed promising results among all the models in accurately detecting each of the individual documentation smells. TODO: misclassification analysis (see Review4Repair shared by Anindya. See Section 7.3 from here \url{https://arxiv.org/pdf/2010.01544.pdf}) \subsection{Ablation Study (RQ3)} BERT - epoch change SVM - feature change. \subsection{Correlation Analysis (RQ4)} move correlation analysis from Section V-A \subsection{User Feedback (RQ5)} user feedback \section{Discussions} \subsection{Correlation Analysis of Documentation Smells} In multi-label learning, the labels might be interdependent and correlated \cite{label_correlation_paper_1}.We used Phi Coefficients to determine such interdependencies and correlations between different documentation smells. The Phi Coefficient is a measure of association between two binary variables \cite{phi_coefficient_paper}. It ranges from -1 to +1, where ±1 indicates a perfect positive or negative correlation, and 0 indicates no relationship. We report the Phi Coefficients between each pair of labels in Figure \ref{fig:label_correlation}. We find that there is almost no correlation between `Fragmented’ and any other smell (except `Lazy’). By definition, the information of fragmented documentation is scattered in many sections or pages. Hence, it has little to do with smells like `Bloated’, `Excess Structural Information’, `Tangled’. We also observe that there is a weak positive correlation (+0.2 to +0.4) among the `Bloated’, `Excess Structural Information’, and `Tangled’ smells. One possible reason might be that if a documentation is filled with complex and unorganized information (Tangled), and unnecessary structural information (Excess Structural Information), it might be prone to become bloated as well. On the other hand, `Lazy’ smell has a weak negative correlation (-0.2 to -0.3) with all other groups since these kinds of documentation are often too small to contain other smells. However, none of these coefficients is high enough to imply a strong or moderate correlation between any pair of labels. Hence, it justifies our catalog by indicating that all the smells that we proposed are sufficiently unique in nature. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/label_correlation.png} \caption{Correlation of different documentation smells. Red, Blue, and Gray mean positive, negative, and no correlation respectively. Intensity of color indicates the level of correlation.} \label{fig:label_correlation} \end{figure} \subsection{Implications of Results} While the documentation smells do not necessarily make an API documentation incorrect, they can hinder the productivity of the developers, according to the survey response. Therefore, in this work, we focus on defining the catalog for the documentation smells. We show that these documentation smells are prevalent in Java official API documentation and by leveraging ML algorithms, we can detect them from the documentation texts. The catalog presented in this work can be extended to point out the documentation smells more accurately. Moreover, the documentation codes can be taken into account along with the documentation texts to find out how the detection of the documentation smells can vary depending on the documentation codes. The ultimate objective of this research requires manual curation of the defected documentations in order to build an automated system for correcting the documentation smells. \subsection{Threats to Validity} In this work, we conducted our experiments on a relatively small dataset. Since, to the best of our knowledge, detecting the documentation smells is the first of its kind, we manually labeled a small portion of the Java API documentation due to the time constraint. However, we randomly sampled the documentations for manual labeling, therefore, we expect that the actual distributions of the documentation smells will remain identical in case of adding more documentation examples. Furthermore, we performed cross-validation on our dataset to reduce the effect of any non-representative subset. The number of participants in our survey is too low to get a clear picture of how the documentation smells affect productivity on the large scale. We conducted the survey with an aim to validate the catalog we developed by the software developers. As the developers agreed with the catalog and its negative impact on the productivity, in the future extension of this study, we can include more participants to categorize the documentations into different documentation smells based on this catalog. \section{Related Work} related work \section{Conclusions} conclusions \begin{small} \bibliographystyle{abbrv} \section{Automatic Detection of The Smells} We answer the following four research questions: \begin{enumerate}[label=RQ\arabic{*}., leftmargin=25pt] \item How accurate are rule-based classifiers to automatically detect the documentation smells? \item Can the shallow machine learning models outperform the rule-based classifiers? \item Can the deep machine learning models outperform the shallow learning models? \item Can the detection of one documentation smell support the detection another smell? \end{enumerate} \subsection{Performance Metrics} We analyze and report the performance of each of the techniques developed and experimented as part of the algorithms development steps. We used 5-fold iterative stratified cross-validation for reporting performances that has been recommended for a multilabel dataset in \cite{iterative_stratified_cross_valid}. We report the performances using standard multi-label classification metrics, i.e., Exact Match Ratio, Hamming Loss \cite{a_literature_survey_on_algorithms_for_multilabel}. We also report separate Accuracy, Precision, Recall, and F1-score for each class. \begin{inparaenum}[(a)] \item\textbf{Iterative Stratified Cross-Validation} Traditional $k$-fold cross-validation is a statistical method of evaluating machine learning algorithms which divides data into $k$ equally sized folds and runs for $k$ iterations \cite{traditional_cross_validation_paper}. In each iteration, each of the $k$ folds is used as the held-out set for validation while the remaining $k-1$ folds are used as training sets. Stratified cross-validation is used to make sure that each fold is an appropriate representative of the original data by producing folds where the proportion of different classes is maintained \cite{stratified_cross_validation_paper}. However, stratification is not sufficient for multi-label classification problems as the number of distinct labelsets (i.e., different combinations of labels) is often quite large. For example, there can be 32 combinations of labels in our study as there are 5 types of documentation smells. In such cases, original stratified $k$-fold cross-validation is impractical since most groups might consist of just a single example. Iterative stratification, proposed by \cite{iterative_stratified_cross_valid}, solves this issue by employing a greedy approach of selecting the rarest groups first and adding them to the smallest folds while splitting. Hence, we used this iterative stratified cross-validation in our experiment. \item\textbf{Exact Match Ratio} In multi-label classification, prediction for an instance is a set of labels. Hence, it has a notion of partially correct prediction (along with fully correct and incorrect). The Exact Match Ratio ($EMR$) ignores the partially correct prediction and considers only those predictions as correct which exactly match the true label sets. \begin{equation} EMR = \frac{1}{N} \sum_{i=1}^{N} I (L_i^{pred} = L_i^{true}) \label{eq:EMR} \end{equation} {$I$ is the indicator function. Its' value is 1 if the prediction, $L_i^{pred}$ matches the actual label, $L_i^{true}$, and 0 otherwise. $N$ is the total number of data. } \item\textbf{Hamming Loss} Hamming Loss ($HL$) is the fraction of labels in labelsets that are incorrectly predicted, i.e., the fraction of the wrong labels to the total number of labels \cite{hamming_loss_paper}. It takes the notion of partially correct prediction into account. \begin{equation} HL = \frac{1}{N\cdot L} \sum_{i=1}^{N} \sum_{j=1}^{L} xor (y_{i,j}^{pred}, y_{i,j}^{true}) \label{eq:HL} \end{equation} {$N$ is the total number of data, $L$ is the total number of labels.} \item\textbf{Accuracy} Accuracy ($A$) is the number of correctly predicted instances out of all the instances. We reported accuracy separately for each class. \begin{equation} A = \frac{TP+TN}{TP+FN+TN+FP} \label{eq:acc} \end{equation} {$TP$ is the number of true positives, $FN$ is the number of false negatives, $FP$ is the number of false positives, $TN$ is the number of true negatives.} \item\textbf{Precision} Precision ($P$) is the ratio between the number of correctly predicted instances and all the predicted instances for a given class. \begin{equation} P = \frac{TP}{TP+FP} \label{eq:precision} \end{equation} \item\textbf{Recall} Recall ($R$) represents the ratio of the number of correctly predicted instances and all instances belonging to a given class. \begin{equation} R = \frac{TP}{TP+FN} \label{eq:recall} \end{equation} \item\textbf{F1-score} F1-score is the harmonic mean of precision and recall. \begin{equation} F1 = \frac{2\cdot P\cdot R}{P+R} \label{eq:f-score} \end{equation} \end{inparaenum} \subsection{ How accurate are rule-based classifiers to automatically detect the documentation smells? (RQ1)} \subsubsection{Rule-based Metrics} \begin{inparaenum}[(a)] \item\textbf{Documentation Length.} We use the length of every documentation in order to capture the extensiveness of the bloated documentations. \item\textbf{Readability Metrics.} We measure Flesch readability metrics for the documentations and use them as a feature to analyze the understandability of documentation. This feature might be useful to detect tangled documentations. \item\textbf{Number of Acronyms and Jargons.} Since acronyms and jargons increase the complexity of a reading passage, we use the number of acronyms and jargon in every documentation to detect the tangled documentation by estimating the understandability. \item\textbf{Number of URLs.} As URLs are hints of possible fragmentations in the documentation, we use the number of URLs to capture these smells. \item\textbf{Number of function, class and package name mentioned.} We use the number of functions, classes, packages mentioned in documentation to capture excess structural information and fragmentation. \item\textbf{Edit Distance.} From the definition of lazy documentation, it can be said that the edit distance of a lazy documentation and its’ unit definition (method prototype) will be comparatively small. So we calculate the edit distance between the documentation description and method prototype and use it as a feature for our machine learning models. \item\textbf{Average Cosine Similarity.} We calculate the avg. cosine similarity of the documentations’ description. For this, we calculate the cosine similarities between each possible pair of that documentation and take their avg value for normalization. This feature will help to detect redundancy in the documentations. \end{inparaenum} \subsubsection{Results} discuss the results by varying the metric thresholds \subsection{How accurate are shallow machine learning models to automatically detect the documentation smells? (RQ2)} \subsubsection{Shallow Learning Models} We applied both traditional and deep learning algorithms to detect documentation smells. We employed different decomposition approaches (i.e., One-Vs-Rest, Label Powerset, Classifier Chains)~\cite{multilabel_decomp_1_MultilabelClassificationAnOverview,multilabel_decomp_2_AReviewOnMultilabelLearning,multilabel_decomp_3_ATutorialOnMultilabelClassification,multilabel_decomp_4_LearningFromMultilabelData} with Support Vector Machine (SVM) \cite{SVM_SupportVectorNetworks} as the base estimator for multi-label classification of documentation smells. We chose SVM since it has been successfully used with these decomposition approaches for multi-label classification in previous studies \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM}. SVM has also shown great performance in text classification tasks \cite{svm_text_classification_1, svm_text_classification_2}. We also evaluated adapted approaches like ML-$k$NN \cite{MLkNN_ALazyLearningApproach}, and deep learning models like Bi-LSTM \cite{bi_lstm_BidirectionalRecurrentNeuralNetworks}, and BERT \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. \begin{inparaenum}[(a)] \item\textbf{One-Vs-Rest} is a heuristic method that works by decomposing the multi-label classification problem into multiple independent binary classification problems (one per class) \cite{multilabel_decomp_1_MultilabelClassificationAnOverview, multilabel_decomp_3_ATutorialOnMultilabelClassification}. It trains a single classifier per class, with the samples of that class as positive samples and all other samples as negatives. All the independent classifiers then separately give individual class predictions for unseen data. We evaluated One-Vs-Rest (OVR) approach with SVM (as the base estimator) for detecting documentation smells. One-Vs-Rest support vector machine (OVR-SVM) has been successfully applied in several problems \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM, multilabel_decomp_1_MultilabelClassificationAnOverview}. We used RBF kernel for the SVM classifiers as recommended by earlier works \cite{svm_rbf_1_AComparisonStudyOfDifferentKernelFunctions, svm_rbf_2_APracticalGuideToSVM}. \item\textbf{Label Power Set (LPS)} treats every combination of labels as a new class and approaches in a multiclass classification manner \cite{LearningMultiLabelSceneClassification}. As a result, this method has high computational complexity. However, it is capable of taking label correlation into account. We used SVM (with RBF kernel) as the base estimator of the Label Power Set method \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM}. \item\textbf{Classifier Chains (CC)} constructs a chain of binary classifiers, where every classifier uses the predictions of all the previous classifiers of the chain \cite{CC_1_ClassifierChainsForMultilabel, CC_2_ClassifierChainsForMultilabel}. This way the method can take label correlations into account. We constructed a Classifier Chain (CC) of SVMs and evaluated its’ performance for documentation smell detection. \item\textbf{Multi-label $k$ Nearest Neighbors (ML-$k$NN)} is derived from the traditional $k$-nearest neighbor ($k$NN) algorithm \cite{MLkNN_ALazyLearningApproach}. It finds the $k$ nearest neighborhood of an input instance using $k$NN, then uses Bayesian inference to determine the label set of the instance. We studied this method because it has been reported to achieve considerable performance for different multi-label classification tasks in previous studies \cite{MLkNN_ALazyLearningApproach, mlknn_MultilabelTextClassificationUsingSemanticFeatures}. We used ML-$k$NN with the number of nearest neighbors, $K$ = 10 during our experiment as recommended by \cite{mlknn_MultilabelTextClassificationUsingSemanticFeatures}. \end{inparaenum} \subsubsection{Studied Features} In this subsection, we describe the features that we used to train our SVM and \textit{k}NN-based models (see section \ref{subsubsec:ovr_svm} to \ref{subsubsec:ml_knn}) for documentation smell detection. use two types of features: the rule-based metrics, bag-of-words (as a proxy of word embeddings which will be used in BERT/LSTM - you need to ensure that reviewers are convinced that you have looked at each option before claiming BERT is a the best classifier) \subsubsection{Results} Table \ref{table_overall_performance} represents the performance of the ML models for detecting documentation smell as a multi-label classification problem. We observe that OneVsRest (OVR) and Classifier Chain (CC) achieved equal results. CC-based models are generally superior to OVR-based models because of the capability of capturing label correlation. Since the labels (types) of the documentation smells are not correlated, the CC-based SVM could not exhibit higher performance than the OVR-based SVM. However, Label Powerset (LPS) achieved lower performance than the OVR and CC-based models. To show better results, LPS-based SVM would require sufficient instances for all 32 classes of 5 smell types. Deep learning-based models like Bi-LSTM and BERT, on the other hand, outperformed the SVM and $k$NN-based models by achieving higher exact match ratios. Although Bi-LSTM showed higher Hamming loss, BERT achieved similar to the SVM and $k$NN-based models. Therefore, in terms of Hamming loss, deep learning-based models did not show any improvement. However, considering both exact match ratio and Hamming loss as the performance metrics, we can deduce that BERT is the most suitable of all the models experimented in detecting the documentation documentation smell. \begin{table}[t] \caption{Shallow models on the overall smell types detection} \centering \begin{tabular}{lrr} \toprule \textbf{Model} & \textbf{Exact Match Ratio} & \textbf{Hamming Loss} \\ \midrule \textbf{Rule-based} & .17 & .35 \\ \textbf{OVR-SVM} & .50 & \textbf{.14} \\ \textbf{LPS-SVM} & .48 & .15 \\ \textbf{CC-SVM} & .50 & \textbf{.14} \\ \textbf{ML-$k$NN} & .47 & .15 \\ \bottomrule \end{tabular} \label{table_overall_performance} \end{table} \begin{table*}[t] \caption{Performance on different type of documentation smells} \begin{tabular}{lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Model}} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule {\textbf{Rule-based}} & {.76} & {.67} & {.86} &{.75} & {.57} & {.69} & {.70} &{.69} & {.74} & {.68} & {.74} &{.71} & {.51} & {.40} & {.38} &{.39} & {.61} & {.57} & {.58} &{.58} \\ {\textbf{OVR-SVM}} & {\textbf{.97}} & {.88} & {.89} &{.89} & {.93} & {.85} & {.92} &{.88} & {\textbf{.77}} & {.48} & {.23} &{.31} & {\textbf{.85}} & {.72} & {.54} &{.62} & {\textbf{.76}} & {\textbf{.77}} & {.44} &{.56} \\ {\textbf{LPS-SVM}} & {.96} & {.90} & {.77} &{.83} & {.94} & {.84} & {.96} &{.89} & {\textbf{.77}} & {.50} & {.24} &{.33} & {.83} & {.71} & {.42} &{.54} & {.73} & {.64} & {.49} &{.56} \\ {\textbf{CC-SVM}} & {\textbf{.97}} & {.88} & {.90} &{.89} & {.93} & {.83} & {.93} &{.87} & {\textbf{.77}} & {.49} & {.21} &{.29} & {\textbf{.85}} & {.72} & {.54} &{.62} & {\textbf{.76}} & {.75} & {.45} &{.56} \\ {\textbf{ML-$k$NN}} & {.95} & {.77} & {.82} &{.80} & {.91} & {.83} & {.84} &{.84} & {.76} & {.46} & {.39} &{.42} & {.82} & {.65} & {.55} &{.60} & {\textbf{.76}} & {.65} & {.64} &{.65} \\ \bottomrule \end{tabular} \label{table_individual_performance} \end{table*} \subsubsection{Results} Table \ref{table_individual_performance} shows the performance of the ML models on each type of documentation smells. Although SVM and $k$NN-based models achieved slightly better accuracy than Bi-LSTM and BERT, the later models outperformed SVM and $k$NN-based models in F1-score. This behavior is due to the unequal distribution of the smell types over the dataset. SVM and $k$NN-based models produced more false-negative results because the number of positive instances for an individual smell type is significantly lower than the number of negative instances for that type. As a result, SVM and $k$NN-based models showed quite low recalls for some types (Excess Struct, Tangled, and Fragmented) and consequently resulted in low F1-scores. \gias{TODO: do the feature-based analysis here, i.e., ablation study on the shallow learning models as discussed} \subsection{Can the deep machine learning models outperform the shallow learning models? (RQ3)} \subsubsection{Deep Learning Models} Bidirectional LSTM is more capable of exploiting contextual information than the unidirectional LSTM \cite{bilstm_FramewisePhonemeClassificationWithBiLSTM}. Hence, the Bi-LSTM network can detect the documentation smell by capturing the information of the API documentations from both directions. We constructed a Bi-LSTM model with 300 hidden states and initialized it using the pre-trained GloVe embedding \cite{Glove_GlobalVectorsForWordRepresentation} of 100 dimensions. We used ADAM optimizer \cite{adam_optimizer} with an initial learning rate of 0.001. We trained the model with batch size 256 over 10 epochs. Considering the great success of BERT (Bidirectional Encoder Representations from Transformers) in various natural language processing and text classification tasks \cite{bert_success_1,bert_success_2,bert_success_3,bert_success_4,bert_success_5,bert_success_6,bert_success_7}, we feel motivated to evaluate its’ performance in documentation smell detection. BERT is a pre-trained model which was designed to learn contextual word representations of unlabeled texts \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. We used BERT-Base for this study which has 12 layers with 12 attention heads and 110 million parameters. We trained it on our labeled dataset for 10 epochs with a mini-batch size of 32. We used early-stop to avoid overfitting \cite{early_stop_bert_1} and considered validation loss as the metric of the early-stopping \cite{early_stop_bert_2}. The maximum length of the input sequence was set to 256. We used AdamW optimizer \cite{adam_w} with the learning rate set to 4e\textsuperscript{-5}, ß1 to 0.9, ß2 to 0.999, and epsilon to 1e\textsuperscript{-8} \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers, bert_fine_tuning}. We used binary cross-entropy to calculate the loss \cite{binary_cross_AreLossFunctionSame}. \subsubsection{Studied Features} talk about word-embeddings \subsubsection{Results} On the other hand, Bi-LSTM and BERT focused on capturing generalized attributes for each smell type and as a result, achieved impressive performance in all the performance metrics. Overall, BERT showed promising results among all the models in accurately detecting each of the individual documentation smells. \begin{table} \begin{tabular}{lrr} \toprule \textbf{Model} & \textbf{Exact Match Ratio} & \textbf{Hamming Loss} \\ \midrule \textbf{Bi-LSTM} & .80 & .20 \\ \textbf{BERT} & \textbf{.84} & .15 \\ \bottomrule \end{tabular} \label{table_overall_performance} \end{table} \begin{table*}[t] \caption{Performance on different type of documentation smells} \begin{tabular}{lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Model}} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule {\textbf{Bi-LSTM}} & {.92} & {.92} & {.92} &{.91} & {.89} & {.90} & {.89} &{.90} & {.76} & {.72} & {\textbf{.76}} &{.73} & {.78} & {.74} & {.78} &{.74} & {.67} & {.64} & {.67} &{.63} \\ {\textbf{BERT}} & {.93} & {\textbf{.93}} & {\textbf{.93}} &{\textbf{.93}} & {\textbf{.97}} & {\textbf{.97}} & {\textbf{.97}} &{\textbf{.97}} & {.76} & {\textbf{.75}} & {\textbf{.76}} &{\textbf{.76}} & {.83} & {\textbf{.83}} & {\textbf{.83}} &{\textbf{.83}} & {.75} & {.75} & {\textbf{.75}} &{\textbf{.75}} \\ \bottomrule \end{tabular} \label{table_individual_performance} \end{table*} \gias{TODO. Now report some misclassified cases of BERT per documentation smell and explain why the misclassification occurred.} \subsection{Can the detection of one documentation smell support the detection another smell? (RQ4)} In multi-label learning, the labels might be interdependent and correlated \cite{label_correlation_paper_1}. We used Phi Coefficients to determine such interdependencies and correlations between different documentation smells. The Phi Coefficient is a measure of association between two binary variables \cite{phi_coefficient_paper}. It ranges from -1 to +1, where ±1 indicates a perfect positive or negative correlation, and 0 indicates no relationship. We report the Phi Coefficients between each pair of labels in Figure \ref{fig:label_correlation}. We find that there is almost no correlation between `Fragmented’ and any other smell (except `Lazy’). By definition, the information of fragmented documentation is scattered in many sections or pages. Hence, it has little to do with smells like `Bloated’, `Excess Structural Information’, `Tangled’. We also observe that there is a weak positive correlation (+0.2 to +0.4) among the `Bloated’, `Excess Structural Information’, and `Tangled’ smells. One possible reason might be that if a documentation is filled with complex and unorganized information (Tangled), and unnecessary structural information (Excess Structural Information), it might be prone to become bloated as well. On the other hand, `Lazy’ smell has a weak negative correlation (-0.2 to -0.3) with all other groups since these kinds of documentation are often too small to contain other smells. However, none of these coefficients is high enough to imply a strong or moderate correlation between any pair of labels. Hence, it justifies our catalog by indicating that all the smells that we proposed are sufficiently unique in nature. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/label_correlation.png} \caption{Correlation of different documentation smells. Red, Blue, and Gray mean positive, negative, and no correlation respectively. Intensity of color indicates the level of correlation.} \label{fig:label_correlation} \end{figure} \section{A Benchmark of API Documentation Smells}\label{sec:benchmark} We describe the methodology to create our benchmark of API documentation smells (Section~\ref{sec:benchmark_method}) and then present the benchmark with real-world examples (Sections~\ref{sec:five_doc_smells} - \ref{sec:benchmark-details}). \subsection{Benchmark Creation Methodology}\label{sec:benchmark_method} \begin{figure}[t] \centering \centering \includegraphics[scale=.85]{images/workflow_mod4} \caption{The three major steps in benchmark creation process.} \label{fig:MethodologyOverallBenchmark} \vspace{-5mm} \end{figure} Code and design smells are relatively well studied fields of software engineering. However, to the best of our knowledge, this is the first research on API documentation smells. As such, we needed to investigate both the literature on API documentation~\cite{Aghajani-SoftwareDocPractitioner-ICSE2020,Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Uddin-HowAPIDocumentationFails-IEEESW2015,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a} and the diverse API documentation resources (e.g., Java SE docs) during the creation of our catalog of API documentation smells. We followed a three-step process, which closely mimics the standard approaches followed in code/design smell formulation studies~\cite{Abidi-AntiPatternMultiLanguage-EuroPLoP2019,Abidi-CodeSmellsMultiLanguage-EuroPLoP2019}. The three steps are outlined in Fig.~\ref{fig:MethodologyOverallBenchmark} and are explained below. \vspace{1mm}\noindent\textbf{Knowledge Acquisition.} Similar to code and design smells that do not directly introduce a defect or a bug into a software system, documentation smells refer to presentation issues that do not make a documentation incorrect, rather they hinder its proper usage due to the lack of quality in the design of the documented contents. As such, we studied extensively the API documentation literature that reported issues related to API documentation presentation and usability~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019}. For example, the most recent paper on this topic was by Aghajani et al.~\cite{Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Aghajani-SoftwareDocPractitioner-ICSE2020}, who divided the `how' problems in API documentation into four categories: maintainability (e.g., lengthy files), readability (e.g., clarity), usability (e.g., information organization like dependency structure), and usefulness (e.g., content not useful in practice). Previously, Uddin and Robillard~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015} studied 10 common problems in API documentation by surveying 323 IBM developers. They observed four common problems related to presentation, i.e., bloated (i.e., too long description), tangled (complicated documentation), fragmented (i.e., scattered description), and excessive structural information (i.e., information organization like dependency structure). Given that the four problems appeared in both studies, we included each as a documentation smell in our study. In addition, we added lack of proper description of an API method as a `lazy' documentation smell, because incomplete documentation problems are discussed in literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocPractitioner-ICSE2020} as well as in online developer discussions (see Fig.~\ref{fig:motivating_lazy_example}). \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.16]{images/lazy.JPG} \caption{Tweet complaining about lazy documentation of API method.} \label{fig:motivating_lazy_example} \vspace{-2mm} \end{figure} \vspace{1mm}\noindent\textbf{Feasibility Analysis.} Once we decided on the five smells, we conducted a feasibility study by looking for real-world examples of the smells in official and instructional API documentation. This was important to ensure that the smells are prevalent in API documentation and that we can find those with reasonable confidence, because otherwise there is no way we can design automated techniques to detect those automatically. We combined our knowledge of the five smells gained from API documentation literature with active exploration of the five smells in the API official documentation. We conducted multiple focus group discussions where all the four authors discussed together by analyzing potential examples of the five smells in API documentation and by mapping the characteristics of such API documentation with the description of the smells in the literature/developer discussions. Before every such focus group meeting, the first two authors created a list of 50 API documentation units with their labels of the five smells in the units. The four authors discussed those labels together, refined the labels, and identified/filtered the labeling criteria. This iterative process led to increased understanding among the group members on the specific characteristics of the five documentation smells. From multiple discussion sessions, the final output was a list of 50 labeled datapoints. \vspace{1mm}\noindent\textbf{Benchmark Creation.} In the last step of the benchmark creation process, we expanded our initial list of 50 API documentation units with smell labels as follows. We collected documentations of over 29K methods belonging to over 4K classes of 217 different packages. We extracted these documentations from the online JAVA API Documentation website~\cite{website:javadocse7} through web crawling and text parsing techniques. Since a documentation can contain multiple smells at the same time, this is a multi-labeled dataset. We produced the benchmark as follows. First, all the authors mutually discussed the documentation smells. Then, we randomly selected 950 documentations from a total of 29K that we extracted. Then the first two authors labeled the first 50 documentations separately. When they finished, they consulted other co-authors and resolved the disagreement based on the discussion. Then they continued with the next 50 documentations and repeated the same process. Their agreement of labeling has been recorded using Cohen's Kappa Coefficient \cite{cohen_kappa_paper} for each iteration, i.e., labeling 50 documentations (Table \ref{cohen_kappa_table}). After the third iteration, both the authors reached a perfect agreement level with Cohen’s Kappa Coefficient of $0.83$. Then they prepared a coding guideline for the labeling task which was later presented to 17 computer science undergraduate students. The students labeled the remaining 800 documentation units. During the entire coding sessions by the 17 coders, the first two authors remained available to them via Skype/Slack. Each coder consulted their labels with the two authors. This ensured quality and mitigated subjective bias in the manual labeling of the benchmark. \begin{table} \centering \caption{Measure of agreement between two labelers} \begin{tabular}{ccc} \toprule \textbf{Iteration ID} & \textbf{Documentation Unit \#} & \textbf{Cohen $\kappa$} \\ \midrule 1 & 50 & .49 \\ 2 & 50 & .67 \\ 3 & 50 & .83 \\ \bottomrule \end{tabular} \label{cohen_kappa_table} \end{table} \subsection{The Five Documentation Smells in the Benchmark} \label{sec:five_doc_smells} \vspace{1mm}\noindent\textbf{Bloated Documentation Smell.} By `Bloated’ we mean the documentation whose description (of an API element type) is verbose or excessively elaborate. It is difficult to understand or follow a lengthy documentation~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. Moreover, it cannot be effectively managed that makes it hard to modify when needed, e.g., in case of any update in the API source code. In our benchmark, we found many documentations that are larger than necessary. For example, the documentation shown in Fig.~\ref{fig:bloated_example} is so verbose and lengthy that it is hard to follow and use it. Hence, it is a bloated documentation. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/bloated_example.png} \caption{Example of Bloated Smell.} \label{fig:bloated_example} \end{figure} \vspace{1mm}\noindent\textbf{Excess Structural Information Smell.} Such a description of a documentation unit (e.g., method) contains too many structural syntax or information, e.g., the Javadoc of the java.lang.Object class. Javadoc lists all the hundreds of subclasses of the class. In our study, we find this type of documentation to contain many class and package names. For instance, the documentation of Fig.~\ref{fig:excess_struct_example} contains many structural information (marked in red rectangle) that are quite unnecessary for the purpose of understanding and using the underlying method. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/excess_struct_example.png} \caption{Example of Excess Structural Information.} \label{fig:excess_struct_example} \end{figure} \vspace{1mm}\noindent\textbf{Tangled Documentation Smell.} A documentation of an API element (method) is `Tangled’ if it's description is \textit{tangled} with various information (e.g., from other methods). This makes it complex and thereby reduces the readability and understandability of the description. Fig.~\ref{fig:tangled_example} depicts an example of tangled documentation which is hard to follow and understand. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/tangled_example.png} \caption{Example of Tangled Smell.} \label{fig:tangled_example} \end{figure} \vspace{1mm}\noindent\textbf{Fragmented Documentation Smell.} Sometimes it is seen that the information of documentation (related to an API element) is scattered (i.e., fragmented) over too many pages or sections. In our empirical study, we found a good number of documentation that contain many URLs and references that indicate possible fragmentation smell. For example, the documentation of Fig.~\ref{fig:fragmented_example} is fragmented as it refers the readers to other pages or sections for details. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/fragmented_example.png} \caption{Example of Fragmented Smell.} \label{fig:fragmented_example} \end{figure} \vspace{1mm}\noindent\textbf{Lazy Documentation Smell.} We categorize a documentation as `Lazy’ if it contains very small information to convey to the readers. In many cases, it is seen that the documentation does not contain any extra information except what can be perceived directly from the function name. Hence, this kind of documentation does not have much to offer to the readers. We see a lazy documentation in Fig.~\ref{fig:lazy_example} where the documentation says nothing more about the underlying method than what is suggested by the prototype itself. \begin{figure}[h \centering \includegraphics[scale=.48]{new_images/lazy_example.png} \caption{Example of Lazy Smell.} \label{fig:lazy_example} \end{figure} \subsection{Distribution of API Documentation Smells in Benchmark}\label{sec:benchmark-details} We calculated the total number of smells in our dataset (Fig.~\ref{fig:amount_of_multismell_in_dataset}). We found that 778 documentations (almost 78\%) of our dataset contain at least one smell. While most (524) of the smelly documentations contain only one type of smell, a small number (19) of documentations show as high as four smells at the same time. We also determined the distribution of different smells in our dataset (Fig.~\ref{fig:distribution_of_smell_in_dataset}). It shows that all the five types of smells discussed occur in the dataset with a considerable frequency where the most frequent smell in our dataset is `Lazy’ with 275 occurrences and the least frequent smell is `Bloated’ with 141 occurrences. \begin{figure}[t \centering \includegraphics[scale=.19]{new_images/amount_of_mulitsmell_in_dataset.png} \caption{Smell distribution by \# of documentation units.} \label{fig:amount_of_multismell_in_dataset} \end{figure} \begin{figure}[t \centering \includegraphics[scale=.19]{new_images/distribution_of_smell_in_dataset.png} \caption{Distribution of different smells in our dataset.} \label{fig:distribution_of_smell_in_dataset} \vspace{-4mm} \end{figure} In multi-label learning, the labels might be interdependent and correlated \cite{label_correlation_paper_1}. We used Phi Coefficients to determine such interdependencies and correlations between different documentation smells. The Phi Coefficient is a measure of association between two binary variables \cite{phi_coefficient_paper}. It ranges from -1 to +1, where ±1 indicates a perfect positive or negative correlation and 0 indicates no relationship. We report the Phi Coefficients between each pair of labels in Fig.~\ref{fig:label_correlation}. We find that there is almost no correlation between `Fragmented’ and any other smell (except `Lazy’). By definition, the information of fragmented documentation is scattered in many sections or pages. Hence, it has little to do with smells like `Bloated’, `Excess Structural Information’, or `Tangled’. We also observe that there is a weak positive correlation (+0.2 to +0.4) among the `Bloated’, `Excess Structural Information’, and `Tangled’ smells. One possible reason might be that if a documentation is filled with complex and unorganized information (Tangled) or unnecessary structural information (Excess Structural Information), it might be prone to become bloated as well. On the other hand, `Lazy’ smell has a weak negative correlation (-0.2 to -0.3) with all other groups since these kinds of documentation are often too small to contain other smells. However, none of these coefficients is high enough to imply a strong or moderate correlation between any pair of labels. Hence, all types of smells in our study are more or less unique in nature. \begin{figure}[t \centering \hspace*{-.7cm}% \includegraphics[scale=.5]{new_images/label_correlation.png} \caption{Correlation between different documentation smells in our benchmark. Red, Blue, and Gray mean positive, negative, and no correlation. Intensity of color indicates the level of correlation.} \label{fig:label_correlation} \vspace{-5mm} \end{figure} \section{Conclusions} The learning of an API is challenging when the official documentation resources are of low quality. We identify five API documentation smells by consulting API documentation literature on API documentation design and presentation issues. We present a benchmark of 1,000 API documentation units with five smells in API official documentation. Feedback from 21 industrial software developers shows that the smells can negatively impact the productivity of the developers during API documentation usage. We develop a suite of machine learning classifiers to automatically detect the smells. The best performing classifier BERT, a deep learning model, achieves F1-scores of 0.75 - 0.97. The techniques can help automatically monitor and warn about API documentation quality. \section{Discussions}\label{sec:discussions} \vspace{1mm}\noindent\textbf{Implications of Findings.} Thanks to the significant research efforts to understand API documentation problems using empirical and user studies, we now know with empirical evidence that the quality of API official documentation is a concern both for open source and industrial APIs~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Garousi-UsageUsefulnessSoftwareDoc-IST2015,Forward-RelevanceSoftwareDocumentationTools-DocEng2002}. The five API documentation smells we studied in this paper are frequently referred to as documentation presentation/design problems in the literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019}. Our comprehensive benchmark of 1,000 API official documentation units has 778 units each exhibiting one or more of the smells. The validity of the smells by professional software developers proves that this benchmark can be used to foster a new area of research in software engineering on the automatic detection of API documentation quality - which is now an absolute must due to the growing importance of APIs and software in our daily lives~\cite{Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Ponzanelli-PrompterRecommender-EMSE2014}. The superior performance of our machine learning classifiers, in particular the deep learning model BERT, offers promise that we can now use such tools to automatically monitor and warn about API documentation quality in real-time. Software companies and open source community can leverage our developed model to analyze the quality of their API documentation. Software developers could save time by focusing on good quality API documentation instead of the bad ones as detected by our model. Based on such real-time feedback, tools can be developed to improve the documentation quality by fixing the smells. Indeed, when we asked our survey participants (Section~\ref{sec:survey}) whether the five smells need to be fixed, more than 90\% responded with a `Yes', 9.5\% with a `Maybe', 0\% with a `No' (see Fig.~\ref{fig:smell-fix}). \begin{figure}[t] \centering\begin{tikzpicture}[scale=0.25]- \pie[ /tikz/every pin/.style={align=center}, text=pin, number in legend, explode=0.0, rotate = -15, color={black!10, black!0}, ] { 9.5/9.5\% Maybe, 90.5/\textbf{90.5\% Yes}\\ smells should be\\ fixed in API\\ documentation } \end{tikzpicture} \caption{Survey responses on whether the five documentation smells should be fixed to improve API documentation quality.} \vspace{-5mm} \label{fig:smell-fix} \end{figure} \vspace{1mm}\noindent\textbf{Threats to Validity.} \textit{Internal validity} threats relate to authors' bias while conducting the analysis. We mitigated the bias in our benchmark creation process by taking agreement from 17 coders and co-authors and by consulting API documentation literature. The machine learning models are trained, tested, and reported using standard practices. There was no common data between the training and test set. \textit{Construct validity} threats relate to the difficulty in finding data to create our catalog of smells. Our benchmark creation process was exhaustive, as we processed more than 29K unit examples from official documentation. \textit{External validity} threats relate to the generalizability of our findings. We mitigated this threat by corroborating the five smells in our study with findings from state-of-the-art research in API documentation presentation and design problems. Our analysis focused on the validation and detection of five API documentation smells. Similar to code smell literature, additional documentation smells can be added into our catalog as we continue to research on this area. \section{Introduction}\label{sec:introduction} APIs (Application Programming Interfaces) are interfaces to reusable software libraries and frameworks. Proper learning of APIs is paramount to support modern day rapid software development. To support this, APIs typically are supported by official documentation. An API documentation is a product itself, which warrants the creation and maintenance principles similar to any existing software product. A good documentation can facilitate the proper usage of an API, while a bad documentation can severely harm its adoption~\cite{Robillard-APIsHardtoLearn-IEEESoftware2009a,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Aghajani-SoftwareDocPractitioner-ICSE2020}. A significant body of API documentation research has focused on studying API documentation problems based on surveys and interviews of software developers~\cite{Robillard-APIsHardtoLearn-IEEESoftware2009a,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Aghajani-SoftwareDocPractitioner-ICSE2020,Cai-FrameworkDocumentation-PhDThesis2000,Carroll-MinimalManual-JournalHCI1987a, Rossen-SmallTalkMinimalistInstruction-CHI1990a,Meij-AssessmentMinimalistApproachDocumentation-SIGDOC1992,Zhia-CostBenefitSoftwareDoc-JSS2015,Garousi-UsageUsefulnessSoftwareDoc-IST2015,Forward-RelevanceSoftwareDocumentationTools-DocEng2002}. Broadly, API documentation problems are divided into two types, what (i.e., what is documented) and how (i.e., how it is documented)~\cite{Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Uddin-HowAPIDocumentationFails-IEEESW2015}. Tools and techniques are developed to address the `what' problems in API documentation, such as detection of code comment inconsistency~\cite{rabbi2020detecting,Wen-CodeCommentInconsistencyEmpirical-ICPC2019,Tan-tCommentCodeCommentInconsistency-ICSTVV2012,Zhou-DocumentationCodeToDetectDirectiveDefects-ICSE2017}, natural language summary generation of source code~\cite{McBurney-DocumentationSourceCodeSummarization-ICPC2014,Sridhara-SummaryCommentsJavaClasses-ASE2010,Haiduc:Summarization,Moreno-NLPJavaClasses-ICPC2013}, adding description of API methods by consulting external resources (e.g., online forums)~\cite{Aghajani-AndroidDocumentation-TSE2019}, detecting obsolete API documentation by comparing API version~\cite{Dagenais-DeveloperLearningResources-PhDThesis2012,Dagenais-TraceabilityLinksRecommendDocumentationEvolution-TSE2014}, and complementing official documentation by incorporating insights and code examples from developer forums~\cite{Treude-APIInsight-ICSE2016,Subramanian-LiveAPIDocumentation-ICSE2014}. In contrast, not much research has focused on the automatic detection of `how' problems, e.g., bad design in API documentation that can make the reuse of API features difficult due to lack of usability~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. Recently, Treude et al.~\cite{Treude-DocumentationQuality-FSE2020} find that not all API documentation units are equally readable. This finding reinforces the needs to automatically detect API documentation presentation issues as `documentation smells', as previously highlighted by Aghajani et al.~\cite{Aghajani-SoftwareDocPractitioner-ICSE2020}. Unfortunately, we are not aware of any research on the automatic detection of such API documentation smells. \begin{figure}[t] \centering \centering \includegraphics[scale=.7]{images/workflow_mod2} \caption{The three major phases used in this study.} \label{fig:MethodologyOverall} \vspace{-5mm} \end{figure} As a first step towards developing techniques to detect smells in API documentation, in this paper, we follow three phases (see Fig.~\ref{fig:MethodologyOverall}). First, we identify five API documentation smells by consulting API documentation literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019} (Section~\ref{sec:benchmark}). Four of the smells (bloated, fragmented and tangled description of API documentation unit, and excess structural info in the description) are reported as presentation problems by Uddin and Robillard~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. The other smell is called `Lazy documentation' and it refers to inadequate description of an API documentation unit (e.g., no explanation of method parameters). Such incomplete documentation is reported in literature~\cite{Aghajani-SoftwareDocIssueUnveiled-ICSE2019} and in online discussions. We exhaustively explore official API documentation to find the occurrences of the five smells. The focus was to develop a benchmark of \textit{smelly} API documentation units. A total of 19 human coders participated in this exercise. This phase resulted in a benchmark of 1,000 API documentation units, where 778 units have at least one of the five smells. {To the best of our knowledge, this is the first benchmark with real-world examples of the five documentation smells.} \begin{figure}[t] \centering\begin{tikzpicture}[scale=0.35]- \pie[ /tikz/every pin/.style={align=center}, text=pin, number in legend, explode=0.0, rotate = -10, color={black!10, black!0}, ] { 4.8/4.8\% Maybe, 95.2/\textbf{95.2\% Yes}\\ documentation\\ smells hinder\\developer producivity } \end{tikzpicture} \caption{Survey responses from professional developers on whether the presence of the smells in API documentation hinders productivity.} \vspace{-5mm} \label{fig:smell-productivity} \end{figure} In the second phase (Section~\ref{sec:survey}), we conducted a survey of 21 professional software developers to validate our catalog of API documentation smells. All the participants reported that they frequently encounter the five API documentation smells. More than 95\% of the participants (20 out of 21) reported that the presence of the five smells in API documentation negatively impacts their productivity (see Fig.~\ref{fig:smell-productivity}). The participants asked for tool support to automatically detect and fix the smells in API official documentation. These findings corroborate previous research that design and presentation issues in API documentation can hinder API usage~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocPractitioner-ICSE2020}. In the third phase (Section~\ref{sec:model}), we investigate a suite of rule-based, shallow and deep machine learning models using the benchmark to investigate the feasbility of automatically detecting the five smells. The best performing classifer BERT, a deep learning model, achieves F1-scores of 0.75 - 0.97. {To the best of our knowledge, ours are the first techniques to automatically detect the five API documentation smells}. {The machine learning models can be used to monitor and warn about API documentation quality by automatically detecting the smells in real-time with high accuracy.} \vspace{1mm}\noindent\textbf{Replication Package} with benchmark, code, and survey is shared at \url{https://github.com/disa-lab/SANER2021-DocSmell} \section{Methodology} \begin{figure*}[t] \centering \centering \includegraphics[scale=.85]{images/workflow_mod3} \caption{The five major steps used in this study} \label{fig:MethodologyOverall} \vspace{-5mm} \end{figure*} While research is devoted to understand code and design smells, we are aware of no previous research on API documentation smells. Similar to code and design smells that do not directly introduce a defect or a bug into a software system, documentation smells refer to presentation issues that do not make a documentation incorrect, rather they hinder its proper usage due to the lack of quality in the design and presentation of the documented contents. As such, we studied extensively the API documentation literature that reported issues related to API documentation presentation and usability~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019}. For example, the most recent paper on this topic was by Aghajani et al.~\cite{Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Aghajani-SoftwareDocPractitioner-ICSE2020}, who divided the `how' problems in API documentation into four categories: maintainability (e.g., lenghty files), readability (e.g., clarity), usability (e.g., information organization), and usefulness (e.g., content not useful in practice). Previously, Uddin and Robillard~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015} studied 10 common problems in API documentation by surveying 323 IBM developers. They observed four common presentation problems: bloated (i.e., too long description), tangled (complicated documentation), fragmented (i.e., scattered description), and excess structural info (i.e., content not useful in practice). Given that the four problems appeared in both studies, we included each as a documentation smell in our study. In addition, we added lack of proper description of an API method as a type of `lazy' smell in the documentation, because incomplete documentation problems are discussed in both papers~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocPractitioner-ICSE2020} as well as in online developer discussions. Once we decided on the five smells, in the That this catalog of five smells provides a good starting point to investigate the focus of this paper, i.e., determining the feasbility of automatically detecting the smells using automated techniques. To investigate the techniques, we created our benchmark as follows. \section{Related Work}\label{sec:related-work} Related work is divided into \textbf{studies} on understanding (1) documentation problems and (2) how developers learn APIs using documentation, and developing \textbf{techniques} (3) to detect errors in documentation and (4) to create documentation. \vspace{1mm}\noindent\textbf{Studies.} Research shows that traditional Javadoc-type approaches to API official documentation are less useful than example-based documentation (e.g., minimal manual~\cite{Carroll-MinimalManual-JournalHCI1987a})~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000} Both code examples and textual description are required for better quality API documentation~\cite{Forward-RelevanceSoftwareDocumentationTools-DocEng2002,DeSouza-DocumentationEssentialForSoftwareMaintenance-SIGDOC2005,Nykaza-ProgrammersNeedsAssessmentSDKDoc-SIGDOC2002}. Depending of the types of API documentation, reability and understandability of the documentation can vary~\cite{Treude-DocumentationQuality-FSE2020}. Broadly, problems in API official documentation can be about `what' contents are documented and `how' the contents are presented~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocIssueUnveiled-ICSE2019,Robillard-APIsHardtoLearn-IEEESoftware2009a,Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Aghajani-SoftwareDocPractitioner-ICSE2020}. Literature in API documentation quality discussed four desired attributes of API documentation: completeness, consistency, usability and accessibility \cite{Zhia-CostBenefitSoftwareDoc-JSS2015,Treude-DocumentationQuality-FSE2020}. Several studies show that external informal resources can be consulted to improve API official documentation~\cite{Yang-QueryToUsableCode-MSR2016,Kavaler-APIsUsedinAndroidMarket-SOCINFO2013,Wang-APIsUsageObstacles-MSR2013,Sunshine-APIProtocolUsability-ICPC2015,Parnin-MeasuringAPIDocumentationWeb-Web2SE2011,Delfim-RedocummentingAPIsCrowdKnowledge-JournalBrazilian2016,Jiau-FacingInequalityCrowdSourcedDocumentation-SENOTE2012} The five documentation smells studied in this paper are taken from five commonly discussed API documentation design and presentation issues in literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015,Aghajani-SoftwareDocPractitioner-ICSE2020}. In contrast to the above papers that aim to understand API documentation problems, we focus on the development of techniques to automatically detect documentation smells. \vspace{1mm}\noindent\textbf{Techniques.} Tools and techniques are proposed to automatically add code examples and insights from external resources (e.g., online forums) into API official documentation~\cite{Subramanian-LiveAPIDocumentation-ICSE2014,Treude-APIInsight-ICSE2016,Aghajani-AndroidDocumentation-TSE2019}. Topic modeling is used to develop code books and to detect deficient documentation~\cite{Souza-CookbookAPI-BSSE2014,Souza-BootstrapAPICodeBookSO-IST2019,Campbell-DeficientDocumentationDetection-MSR2013}. API official documentation and online forum data are analyzed together to recommend fixes API misuse scenarios~\cite{Ren-DemystifyOfficialAPIUsageDirectivesWithCorwdExample-ICSE2020}. The documentation of an API method can become obsolete/inconsistent due to evolution in source code~\cite{Wen-CodeCommentInconsistencyEmpirical-ICPC2019,Dagenais-DeveloperLearningResources-PhDThesis2012}. Several techniques are proposed to automatically detect code comment inconsistency~\cite{rabbi2020detecting,Tan-tCommentCodeCommentInconsistency-ICSTVV2012,Zhou-DocumentationCodeToDetectDirectiveDefects-ICSE2017}. A large body of research is devoted to automatically produce natural lanugage summary description of source code method~\cite{McBurney-DocumentationSourceCodeSummarization-ICPC2014,Sridhara-SummaryCommentsJavaClasses-ASE2010,Haiduc:Summarization,Moreno-NLPJavaClasses-ICPC2013}. Unlike previous research, we focus on the detection of five API documentation smells that do not make a documentation inconsistent/incorrect, but nevertheless make the learning of the documentation difficult due to the underlying design/presentation issues. We advance state-of-the-art research on API documentation quality analysis by offering a benchmark of real-world examples of five documentation smells and a suite of techniques to automatically detect the smells. \section{Automatic Detection of The Smells}\label{sec:model} The responses from the survey validate our catalog of API documentation smells. The perceived negative impact of the smells on developers' productivity, as evidenced by the responses from our survey participants, necessitates the needs to fix API documentation by removing the smells. To do that, we first need to detect the smells automatically in the API documentation. The automatic detection offers two benefits: (1) we can use the techniques to automatically monitor and warn about bad documentation quality and (2) we can design techniques to fix the smells based on the detection. In addition, manual effort can also be made for improving detected examples. With a view to determine the feasibility of techniques to detect API documentation smells using our benchmark, we answer three research questions: \begin{enumerate}[label=RQ\arabic{*}., start = 3, leftmargin=25pt] \item How accurate are rule-based classifiers to automatically detect the documentation smells? \item Can the shallow machine learning models outperform the rule-based classifiers? \item Can the deep machine learning models outperform the other models? \end{enumerate} The shallow and deep learning models are supervised, for which we used 5-fold iterative stratified cross-validation as recommended for a multilabel dataset in \cite{iterative_stratified_cross_valid}. Traditional $k$-fold cross-validation is a statistical method of evaluating machine learning algorithms which divides data into $k$ equally sized folds and runs for $k$ iterations \cite{traditional_cross_validation_paper}. In each iteration, each of the $k$ folds is used as the held-out set for validation while the remaining $k-1$ folds are used as training sets. Stratified cross-validation is used to make sure that each fold is an appropriate representative of the original data by producing folds where the proportion of different classes is maintained \cite{stratified_cross_validation_paper}. However, stratification is not sufficient for multi-label classification problems as the number of distinct labelsets (i.e., different combinations of labels) is often quite large. For example, there can be 32 combinations of labels in our study as there are 5 types of documentation smells. In such cases, original stratified $k$-fold cross-validation is impractical since most groups might consist of just a single example. Iterative stratification, proposed by \cite{iterative_stratified_cross_valid}, solves this issue by employing a greedy approach of selecting the rarest groups first and adding them to the smallest folds while splitting. We report the performances using four standard metrics in information retrieval~\cite{Manning-IRIntroBook-Cambridge2009}. Accuracy ($A$) is the ratio of correctly predicted instances out of all the instances. Precision ($P$) is the ratio between the number of correctly predicted instances and all the predicted instances for a given smell. Recall ($R$) represents the ratio of the number of correctly predicted instances and all instances belonging to a given class. F1-score ($F1$) is the harmonic mean of precision and recall. {\scriptsize \begin{eqnarray*} P = \frac{TP}{TP+FP},~ R = \frac{TP}{TP+FN},~ F1 = 2*\frac{P*R}{P+R},~ A = \frac{TP+TN}{TP+FP+TN+FN} \end{eqnarray*}} TP = Correctly classified as a smell, FP = Incorrectly classified as a smell, TN = Correctly classified as not a smell, FN = Incorrectly classified as not a smell. \subsection{Performance of Rule-Based Classifiers (RQ3)}\label{sec:rule-based} Based on manual analysis of a statistically significant random sample of our benchmark dataset (95\% confidence interval and 5 levels), we designed six metrics to establish five rule-based classifiers as described below. \subsubsection{Rule-based Metrics} \label{subsubsec:rule-based-metrics} \begin{inparaenum}[(a)] \item\textit{Documentation Length.} We use the length of every documentation in order to capture the extensiveness of the bloated documentations. \item\textit{Readability Metrics.} We measure Flesch readability metrics \cite{flesch_readability_paper} for the documentations to analyze the understandability of documentation. This feature might be useful to detect tangled documentations. \item\textit{Number of Acronyms and Jargons.} Since acronyms and jargons increase the complexity of a reading passage \cite{jargon_paper_1}, we use the number of acronyms and jargons in every documentation to detect the tangled documentation. \item\textit{Number of URLs} is computed because URLs are hints of possible fragmentation in the documentation. \item\textit{Number of function, class, and package name mentioned} in documentation is computed to capture excess structural information smell. \item\textit{Edit Distance.} The edit distance (i.e., measure of dissimilarity) between the description of a lazy documentation and its' corresponding unit definition (i.e., method prototype) can be smaller than non-lazy documentations. We calculate the Levenshtein distance \cite{edit_distance_levenshtein_paper} between the documentation description and method prototype. \end{inparaenum} \subsubsection{Rule-based Classifiers} Fig.~\ref{fig:rule_based_classification_flowchart} shows flowchart of the rule-based classification approach. For each metric, we study average, $25^{th}$, $50^{th}$, $75^{th}$, and $90^{th}$ percentiles as thresholds. \begin{figure}[t \centering \hspace*{-.3cm}% \includegraphics[scale=.55]{new_images/Rulebased_Flowchart.png} \caption{Flowchart of rule-based classification approach.} \label{fig:rule_based_classification_flowchart} \vspace{-4mm} \end{figure} \subsubsection{Results} \label{subsec:results_of_rulebased_baselines} \begin{table*}[t] \caption{Class-wise performance of rule-based baseline models by the metric thresholds (P stands for percentile)} \begin{tabular}{p{.6cm}|lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Model}} & \textbf{Threshold} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule \multirow{5}{=}{\textbf{Rule Based}} & {\textbf{AVG}} & {.77} & {.38} & {.86} &{.52} & {.58} & {.39} & {.71} &{.51} & {.68} & {.35} & {.34} &{.34} & {.49} & {.13} & {.18} &{.15} & {.65} & {.33} & {.52} & {.40} \\ & {\textbf{25P}} & {.39} & {.18} & {.64} &{.29} & {.96} & {.96} & {.93} & \textbf{.95} & {.67} & {.38} & {.30} &{.34} & {.54} & {.09} & {.09} &{.09} & {.52} & {.31} & {.90} &\textbf{.47} \\ & {\textbf{50P}} & {.64} & {.28} & {.79} &{.41} & {.77} & {.55} & {.84} &{.66} & {.75} & {.37} & {.50} & \textbf{.42} & {.45} & {.20} & {.40} &{.26} & {.61} & {.34} & {.71} &{.46} \\ & {\textbf{75P}} & {.89} & {.56} & {.93} &{.70} & {.52} & {.36} & {.67} &{.47} & {.65} & {.32} & {.31} &{.31} & {.37} & {.25} & {.75} &{.37} & {.67} & {.29} & {.27} &{.28} \\ & {\textbf{90P}} & {.95} & {.97} & {.85} & \textbf{.90} & {.37} & {.30} & {.56} &{.39} & {.75} & {.50} & {.17} &{.25} & {.33} & {.26} & {.96} & \textbf{.41} & {.72} & {.27} & {.10} &{.15} \\ \bottomrule \end{tabular} \label{table_individual_performance_baseline} \end{table*} In Table \ref{table_individual_performance_baseline}, we reported the performances of the baseline models for each documentation smell. Different thresholds of features achieved higher performance for different documentation smells. For example, taking 90\textsuperscript{th} percentiles of the features’ values, baseline model achieved the higher performance for bloated documentation detection, while lazy and excess structural information smell detection required 25\textsuperscript{th} percentile and 50\textsuperscript{th} percentile, respectively. Notably, the performance of the baseline models in detecting bloated (.90 F1-score) and lazy (F1 = .95) documentation were higher than detecting excess structural info (F1 = .42), tangled (F1 = .41), and fragmented (F1 = .47) documentations. \subsection{Performance of Shallow Learning Models (RQ4)}\label{sec:shallow-learning} \subsubsection{Shallow Learning Models} Since documentation smell detection is multi-label classification problem, we employed different decomposition approaches: One-Vs-Rest (OVR), Label Powerset (LPS), and Classifier Chains (CC)~\cite{multilabel_decomp_1_MultilabelClassificationAnOverview,multilabel_decomp_2_AReviewOnMultilabelLearning,multilabel_decomp_3_ATutorialOnMultilabelClassification,multilabel_decomp_4_LearningFromMultilabelData} with Support Vector Machine (SVM) \cite{SVM_SupportVectorNetworks} as the base estimator. We chose SVM and OVR-SVM since those are successfully used for multi-label text classification \cite{SVM_multi_1_AKernelMethodForMultilabelled, SVM_multi_2_TextCategorizationWithSVM,svm_text_classification_1, svm_text_classification_2,multilabel_decomp_1_MultilabelClassificationAnOverview}. Each model trains a single classifier per class, with the samples of that class as positive samples and all other samples as negatives. Each individual classifier then separately gives predictions for unseen data. We used linear kernel for the SVM classifiers as recommended by earlier works \cite{svm_linear_kernel_paper_1, svm_linear_kernel_paper_2}. \cite{svm_rbf_1_AComparisonStudyOfDifferentKernelFunctions, svm_rbf_2_APracticalGuideToSVM}. We also evaluated adapted approaches like Multi label (ML) $k$NN \cite{MLkNN_ALazyLearningApproach} in this study. It finds the $k$ nearest neighborhood of an input instance using $k$NN, then uses Bayesian inference to determine the label set of the instance. We studied this method because it has been reported to achieve considerable performance for different multi-label classification tasks in previous studies \cite{MLkNN_ALazyLearningApproach, mlknn_MultilabelTextClassificationUsingSemanticFeatures}. For each algorithm, we picked the best model using standard practices, e.g., hyper parameter tuning in SVM as recommended by Hsu~\cite{Hsu-PracticalSVM-Misc2010}, choice of K in ML-kNN as recommended by \cite{mlknn_MultilabelTextClassificationUsingSemanticFeatures}. \subsubsection{Studied Features} We used two types of features: (1) rule-based metrics (described in Section \ref{subsubsec:rule-based-metrics}) and (2) bag of words (BoW) \cite{bag_of_words_paper_1}. Bag of words (BoW) is a common feature extraction procedure for text data and has been successfully used for text classification problems \cite{bag_of_words_for_text_1,bag_of_words_for_text_2}. \subsubsection{Results} \begin{table*}[t] \caption{Class-wise performance of shallow machine learning models} \begin{tabular}{p{.75cm}|lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{} & \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Feature}} & {\textbf{Model}} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule \multirow{5}{=}{\textbf{Rule Based Feats}} & {\textbf{OVR-SVM}} & {.96} & {.88} & {.89} & \textbf{.88} & {.94} & {.86} & {.94} &{.90} & {.74} & {.45} & {.23} &{.31} & {.82} & {.67} & {.56} &\textbf{.61} & {.80} & {.69} & {.25} &{.37} \\ & {\textbf{LPS-SVM}} & {.94} & {.86} & {.70} &{.77} & {.91} & {.77} & {.97} &{.86} & {.74} & {.44} & {.21} &{.28} & {.80} & {.70} & {.40} &{.51} & {.81} & {.73} & {.32} &{.45} \\ & {\textbf{CC-SVM}} & {.96} & {.88} & {.87} &\textbf{.88} & {.92} & {.79} & {.97} &{.87} & {.75} & {.47} & {.24} &{.32} & {.82} & {.68} & {.54} &{.60} & {.80} & {.71} & {.27} &{.39} \\ & {\textbf{ML-$k$NN}} & {.93} & {.73} & {.89} &{.80} & {.91} & {.86} & {.80} &{.83} & {.75} & {.49} & {.31} &{.38} & {.80} & {.63} & {.54} &{.58} & {.79} & {.57} & {.50} &{.53} \\ \midrule \multirow{4}{=}{\textbf{BoW Feats}} & {\textbf{OVR-SVM}} & {.93} & {.84} & {.66} &{.74} & {.95} & {.87} & {.96} &\textbf{.91} & {.75} & {.49} & {.47} &{.48} & {.78} & {.57} & {.54} &{.56} & {.79} & {.55} & {.54} &{.55} \\%\hline & {\textbf{LPS-SVM}} & {.93} & {.89} & {.63} &{.74} & {.94} & {.83} & {.97} &{.89} & {.75} & {.50} & {.49} &\textbf{.50} & {.79} & {.59} & {.58} &{.58} & {.80} & {.59} & {.58} &\textbf{.58} \\ & {\textbf{CC-SVM}} & {.93} & {.85} & {.67} &{.75} & {.94} & {.85} & {.96} &{.90} & {.74} & {.48} & {.47} &{.48} & {.78} & {.57} & {.54} &{.56} & {.78} & {.54} & {.54} &{.54} \\ & {\textbf{ML-$k$NN}} & {.93} & {.86} & {.60} &{.71} & {.88} & {.75} & {.83} &{.79} & {.73} & {.44} & {.29} &{.35} & {.79} & {.59} & {.53} &{.56} & {.80} & {.63} & {.41} &{.50} \\ \bottomrule \end{tabular} \label{table_individual_performance_shallow} \end{table*} Table \ref{table_individual_performance_shallow} presents the performance of the shallow learning models. The best performer is OVR-SVM, followed closely by CC-SVM. CC-based models are generally superior to OVR-based models because of the capability of capturing label correlation \cite{CC_2_ClassifierChainsForMultilabel}. Since the labels (types) of the presentation smells are not correlated (see Section~\ref{sec:benchmark-details}), the CC-based SVM could not exhibit higher performance than the OVR-based SVM. Using rule-based features, OVR-SVM achieved a higher F1-score (0.88) than the other models for bloated documentation detection. Because documentation length (a rule-based) was more effective in detecting bloated documentation than bag of words. On the other hand, LPS-SVM achieved a higher F1-score (0.58) for fragmented documentation detection using bag of words, as bag of words more successfully determined whether the documentation was referring to other documentation than any rule-based features. Overall, the shallow models outperformed the rule-based classifiers for four smell types (except for lazy documentation smell). Therefore, the documentation smell detection does not normally depend on a single rule-based metric, rather, it depends on a combination of different metrics and their thresholds. The shallow learning models attempted to capture this combination of thresholds, and therefore, achieved better performances than the baseline models. \subsubsection{Feature Importance Analysis} We verified the importance of our rule-based features by applying permutation feature importance technique \cite{permutation_feature_importance_paper_1, permutation_feature_importance_paper_2} in the best performing shallow model, i.e., OVR-SVM. We first train OVR-SVM with all the features. While testing, we randomly shuffle the values of one feature at a time while keeping other feature values unchanged. A feature is important if shuffling its values affects the model performance. We calculate the change in performance in two ways. First, we measure the change in the average F1-score of the OVR-SVM model for the permutation of a feature. Second, we report the change of the specific class that the feature was intended for (i.e., `Documentation Length' for `Bloated'). We observe that the permutation of any of our rule-based features degrades the model performance (see Table \ref{table:permutation_feature_importance}). For example, after permutation of the values of the `Documentation Length' of test data, the average F1-score decreases by 0.17 (from 0.62 to 0.45) and the F1-score of the desired class (i.e., `Bloated') decreases by 0.46 (from 0.88 to 0.42). This analysis confirms the importance of combining rule-based metrics as features in the models. \begin{table} \centering \caption{OVR-SVM performance decrease in feature permutation} \begin{tabular}{llrr} \toprule \textbf{Permuted} & \textbf{Desired} & \multicolumn{2}{c}{\textbf{Decrease in F1}}\\ \cline{3-4} \textbf{Feature} & \textbf{Class C} & \textbf{Overall} & \textbf{Desired C} \\ \midrule Doc Length & {Bloated} & {.17} & {.46} \\ Readability & {Tangled} & {.06} & {.11} \\ \#Acronym\&Jargon & {Tangled} & {.05} & {.07} \\ {\#URLs } & {Fragmented} & {.03} & {.11} \\ \#Method, Class, Package & {Excess Struct} & {.17} & {.08} \\ Edit Distance & {Lazy} & {.09} & {.37} \\ \bottomrule \end{tabular} \label{table:permutation_feature_importance} \vspace{-.5cm} \end{table} \begin{table*}[t] \caption{Class-wise performance of deep learning models} \begin{tabular}{p{.75cm}|lrrrr|rrrr|rrrr|rrrr|rrrr} \multicolumn{1}{l}{}& \multicolumn{1}{l}{} & \multicolumn{4}{c}{\textbf{Bloated}} & \multicolumn{4}{c}{\textbf{Lazy}} & \multicolumn{4}{c}{\textbf{Excess Struct}} & \multicolumn{4}{c}{\textbf{Tangled}} & \multicolumn{4}{c}{\textbf{Fragmented}} \\ \midrule {\textbf{Feature}} & {\textbf{Model}} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} & {A} & {P} & {R} &{F1} \\ \midrule \multirow{2}{*}{\begin{tabular}[c]{@{}c@{}}\ \textbf{Word} \\ \textbf{Embed}\end{tabular}} &{\textbf{Bi-LSTM}} & {.92} & {.92} & {.92} &{.91} & {.89} & {.90} & {.89} &{.90} & {.76} & {.72} & {{.76}} &{.73} & {.78} & {.74} & {.78} &{.74} & {.67} & {.64} & {.67} &{.63} \\ &{\textbf{BERT}} & {.93} & {{.93}} & {{.93}} &{\textbf{.93}} & {{.97}} & {{.97}} & {{.97}} &{\textbf{.97}} & {.76} & {{.75}} & {{.76}} &{\textbf{.76}} & {.83} & {{.83}} & {{.83}} &{\textbf{.83}} & {.75} & {.75} & {{.75}} &{\textbf{.75}} \\ \bottomrule \end{tabular} \label{table_individual_performance_deep} \end{table*} \subsection{Performance of Deep Learning Models (RQ5)}\label{sec:deep-learning} \subsubsection{Deep Learning Models} We evaluated two deep learning models, Bidirectional LSTM (Bi-LSTM) and Bidirectional Encoder Representations from Transformers (BERT). We picked {Bi-LSTM}, because it is more capable of exploiting contextual information than the unidirectional LSTM \cite{bilstm_FramewisePhonemeClassificationWithBiLSTM}. Hence, the Bi-LSTM network can detect the documentation smell by capturing the information of the API documentations from both directions. BERT is a pre-trained model which was designed to learn contextual word representations of unlabeled texts \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. We picked BERT, because it is found to significantly outperform other models in various natural language processing and text classification tasks \cite{bert_success_1,bert_success_2,bert_success_3,bert_success_4,bert_success_5,bert_success_6,bert_success_7}. We constructed a Bi-LSTM model with 300 hidden states. We used ADAM optimizer \cite{adam_optimizer} with an initial learning rate of 0.001. We trained the model with batch size 256 over 10 epochs. We used BERT-Base for this study which has 12 layers with 12 attention heads and 110 million parameters. We trained it on benchmark for 10 epochs with a mini-batch size of 32. We used early-stop to avoid overfitting \cite{early_stop_bert_1} and considered validation loss as the metric of the early-stopping \cite{early_stop_bert_2}. The maximum length of the input sequence was set to 256. We used AdamW optimizer \cite{adam_w} with the learning rate set to 4e\textsuperscript{-5}, $\beta1$ to 0.9, $\beta2$ to 0.999, and $\epsilon$ to 1e\textsuperscript{-8} \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers, bert_fine_tuning}. We used binary cross-entropy to calculate the loss \cite{binary_cross_AreLossFunctionSame}. \subsubsection{Studied Features} We used word embedding as feature which is a form of word representation that is capable of capturing the context of a word in a document by mapping words with similar meaning to a similar representation. For Bi-LSTM, we used 100-dimensional pre-trained GloVe embedding which was trained on a dataset of one billion tokens (words) with a vocabulary of four hundred thousand words \cite{Glove_GlobalVectorsForWordRepresentation}. We used the pre-trained embedding in BERT model \cite{bert_base_BertPretrainingOfDeepBidirectionalTransformers}. \subsubsection{Results} Table \ref{table_individual_performance_deep} shows the performance of the deep learning models. BERT outperformed Bi-LSTM, the shallow, and rule-based classifiers to detect each smell (F1-score). {The increase in F1-score in BERT compared to the best performing shallow learning model per smell is as follows: bloated (5.7\% over OVR-SVM Rule), lazy (6.6\% over OVR-SVM BoW), Excess Structural Information (52\% over ML-kNN BoW), tangled (36.1\% over OVR-SVM Rule), and fragmented (36.4\% over OVR-SVM BoW).} SVM and kNN-based models produced more false-negative results because the number of positive instances for an individual smell type is lower than the number of negative instances for that type. As a result, SVM and kNN-based models showed low recalls for some types (Excess structural information, Tangled, and Fragmented) and consequently resulted in low F1-scores. On the other hand, Bi-LSTM and BERT achieved better performance because they focused on capturing generalized attributes for each smell type. We manually analyzed the misclassified examples of Excess Structural Information and fragmented documentation where BERT achieved below 0.8 accuracy. For the Excess Structural Information smell detection, BERT falsely considered some java objects and methods as structural information; therefore, the model produced some false positive cases. In some examples, BERT could not identify whether the information of documentation was referring to other documentation. As a result, the model misclassified the fragmented documentation. \section{Benchmark Study of the Five API Documentation Smells} We answer the following three research questions: \begin{enumerate}[label=RQ\arabic{*}, leftmargin=25pt] \item How accurate are shallow machine learning models to automatically detect the documentation smells? \item Can the deep machine learning models outperform the shallow learning models to detect the documentation smells? \item Can the detection of one documentation smell support the detection another smell? \end{enumerate} We analyze and report the performance of each of the techniques developed and experimented as part of the algorithms development steps. We used 5-fold iterative stratified cross-validation for reporting performances that has been recommended for a multilabel dataset in \cite{iterative_stratified_cross_valid}. We report the performances using standard multi-label classification metrics, i.e., Exact Match Ratio, Hamming Loss \cite{a_literature_survey_on_algorithms_for_multilabel}. We also report separate Accuracy, Precision, Recall, and F1-score for each class. \vspace{1mm}\noindent\textbf{Iterative Stratified Cross-Validation} Traditional $k$-fold cross-validation is a statistical method of evaluating machine learning algorithms which divides data into $k$ equally sized folds and runs for $k$ iterations \cite{traditional_cross_validation_paper}. In each iteration, each of the $k$ folds is used as the held-out set for validation while the remaining $k-1$ folds are used as training sets. Stratified cross-validation is used to make sure that each fold is an appropriate representative of the original data by producing folds where the proportion of different classes is maintained \cite{stratified_cross_validation_paper}. However, stratification is not sufficient for multi-label classification problems as the number of distinct labelsets (i.e., different combinations of labels) is often quite large. For example, there can be 32 combinations of labels in our study as there are 5 types of documentation smells. In such cases, original stratified $k$-fold cross-validation is impractical since most groups might consist of just a single example. Iterative stratification, proposed by \cite{iterative_stratified_cross_valid}, solves this issue by employing a greedy approach of selecting the rarest groups first and adding them to the smallest folds while splitting. Hence, we used this iterative stratified cross-validation in our experiment. \vspace{1mm}\noindent\textbf{Exact Match Ratio} In multi-label classification, prediction for an instance is a set of labels. Hence, it has a notion of partially correct prediction (along with fully correct and incorrect). The Exact Match Ratio ($EMR$) ignores the partially correct prediction and considers only those predictions as correct which exactly match the true label sets. \begin{equation} EMR = \frac{1}{N} \sum_{i=1}^{N} I (L_i^{pred} = L_i^{true}) \label{eq:EMR} \end{equation} {$I$ is the indicator function. Its' value is 1 if the prediction, $L_i^{pred}$ matches the actual label, $L_i^{true}$, and 0 otherwise. $N$ is the total number of data. } \vspace{1mm}\noindent\textbf{Hamming Loss} Hamming Loss ($HL$) is the fraction of labels in labelsets that are incorrectly predicted, i.e., the fraction of the wrong labels to the total number of labels \cite{hamming_loss_paper}. It takes the notion of partially correct prediction into account. \begin{equation} HL = \frac{1}{N\cdot L} \sum_{i=1}^{N} \sum_{j=1}^{L} xor (y_{i,j}^{pred}, y_{i,j}^{true}) \label{eq:HL} \end{equation} {$N$ is the total number of data, $L$ is the total number of labels.} \vspace{1mm}\noindent\textbf{Accuracy} Accuracy ($A$) is the number of correctly predicted instances out of all the instances. We reported accuracy separately for each class. \begin{equation} A = \frac{TP+TN}{TP+FN+TN+FP} \label{eq:acc} \end{equation} {$TP$ is the number of true positives, $FN$ is the number of false negatives, $FP$ is the number of false positives, $TN$ is the number of true negatives.} \vspace{1mm}\noindent\textbf{Precision} Precision ($P$) is the ratio between the number of correctly predicted instances and all the predicted instances for a given class. \begin{equation} P = \frac{TP}{TP+FP} \label{eq:precision} \end{equation} \vspace{1mm}\noindent\textbf{Recall} Recall ($R$) represents the ratio of the number of correctly predicted instances and all instances belonging to a given class. \begin{equation} R = \frac{TP}{TP+FN} \label{eq:recall} \end{equation} \vspace{1mm}\noindent\textbf{F1-score} F1-score is the harmonic mean of precision and recall. \begin{equation} F1 = \frac{2\cdot P\cdot R}{P+R} \label{eq:f-score} \end{equation} \section{Developers' Survey of Documentation Smells}\label{sec:survey} Four out of the five API documentation smells in our study were previously reported as commonly observed by IBM developers~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. The other smell (lazy documentation) is reported as a problem in API documentation in multiple studies~\cite{Aghajani-SoftwareDocPractitioner-ICSE2020,Robillard-APIsHardtoLearn-IEEESoftware2009a}. Given that we extended previous studies by creating a benchmark of the smells with real-world examples, we needed to further ensure that our collected examples of smelly documentation units do resonate with software developers. We, therefore, conducted a survey of professional software developers (1) to validate our catalog of the five API documentation smells and (2) to understand whether, similar to previous research, developers agree with the negative impact of the documentation smells. In particular, we explore the following two research questions: \begin{enumerate}[label=RQ\arabic{*}., leftmargin=25pt] \item How do software developers agree with our catalog and examples of the five API documentation smells? \item How do software developers perceive the impact of the detected documentation smells? \end{enumerate}\subsection{Survey Setup} We recruited 21 professional software developers who are working in the software industry. We ensured that each developer is actively involved in daily software development activities like API reuse and documentation consultation. The participants were collected through personal contacts. First, each participant had to answer two demographic questions: current profession and years of experience in software development. We then presented each participant two Javadoc examples of each smell and asked him/her whether they agreed that this documentation example belonged to that particular smell. Then, we asked them about how frequently they faced these documentation smells. Finally, we inquired them of the negative impact of the documentation smells on their overall productivity during software development. Out of the 21 participants, 14 participants had experience less than 5 years and the rest had more than 5 years. Majority of the participants had experience less than 5 years because they are likely to be more engaged in studying API documentation as part of their software programming responsibility. Developers with experience more than five years are more engaged in design of the software and its architecture. \begin{figure}[t \centering \includegraphics[scale=.4]{new_images/survey_examples.png} \caption{Survey response on whether the software developers agreed with our labeled documentation smell examples.} \label{fig:survey_examples} \end{figure} \begin{figure}[t] \centering \includegraphics[scale=.4]{new_images/survey_frequency.png} \caption{Survey response on how frequently the participants faced the documentation smells in the last three months.} \label{fig:survey_frequency} \end{figure} \subsection{How do software developers agree with our catalog and examples of the five API documentation smells? (RQ1)} We showed each participant two examples of each smell, i.e., 10 examples in total. For each example, we asked two questions: (1) Do you think the documentation mentioned above is [smell, e.g., lazy]? The options are in Likert scale, i.e., strongly agree, agree, neutral, disagree, and strongly disagree. and (2) Based on your experience of the last three months, how frequently did you observe this [smell, e.g., lazy] in documentation? The options are: never, once or twice, occasionally, frequently, and no opinion. The options are picked from literature \cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. Two examples per smell ensure increased confidence on the feedback we get from each participant. Fig.~\ref{fig:survey_examples} shows the responses of the participants to the first question. More than 75\% participants agreed to the examples of three smells: bloated, tangled, and excess structural info. At least 50\% of the participants agreed to the examples of the other two smells. Only 5-25\% of the participants disagreed to the examples. Overall, each example of the API documentation smell was agreed by at least 50\% of the participants. This validates out catalog of API documentation smells based on feedback from the professional developers. Fig.~\ref{fig:survey_frequency} shows the frequency of the documentation smells the developers observed in the last three months (second question). We found that 50\% of the participants had faced all the smells and lazy smell was the most frequently encountered. On the other hand, half of the participants did not face bloated documentation smells in the last three months, while 60\%-65\% of the participants faced tangled, excess structural info, and fragmented API documentation. This study reveals that API documentation is becoming less explicable, more complex, and unnecessarily structured to keep the documentation short. To solve this problem, API documentation needs to be more understandable and elaborated to explain the API functionality. \subsection{How do software developers perceive the impact of the detected documentation smells? (RQ2)} We asked the participants how severely the documentation smells impact their development tasks. The responses were taken on a scale of five degrees: "Blocker", "Severe", "Moderate", "Not a Problem", and "No opinion". The options were picked from similar questions on API documentation presentation problems from literature~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. \begin{figure}[!htb] \centering \includegraphics[scale=.5]{new_images/survey_severity_2.png} \caption{The perceived impact of the five documentation smells by severity and frequency. Circle size indicates the percentage of participants who strongly agreed or agreed to the smells.} \label{fig:survey_severity} \end{figure} We analyzed the impact of the documentation smells with respect to the frequency of the smells the participants had observed over the past three months (see Fig.~\ref{fig:survey_severity}). For each smell, we compute the frequency scale (x-axis) as the percentage of response "Frequently", "Occasionally", and "Once or twice". For example, regarding whether the participants had observed lazy documentation in the past three months, 25\% answered "Frequently", 35\% answered "Occasionally", and 30\% answered "Once or twice", leading to a total 90\% in the frequency scale. We constructed the severity scale (y-axis) by combining the percentage of the participants responded with "Blocker", "Severe", and "Moderate". For example, due to fragmented documentation smells, 5\% of the participants could not use that particular API and picked another API ("Blocker"), 20\% of the participants believed that they wasted a lot of time figuring out the API functionality ("Severe"), and 25\% of the participants felt irritated ("Moderate") with the fragmented documentation. The circle size indicates the percentage of the participants "Strongly Agree" or "Agree" with the examples containing documentation smells. From Fig.~\ref{fig:survey_severity}, we observed that lazy documentation had the most frequent and the most negative impact (90\%). Tangled documentation was identified as the second most severe smell (85\%). Although bloated documentation was considered more severe (65\%) than excess structural info (55\% severity) and fragmented (50\% severity) documentation, bloated occurred less frequently than the later two. The most important finding of this survey is that the coordinates of all the circles (referring to documentation smells) in Fig.~\ref{fig:survey_severity} were above or equal to 50. This indicates that according to the majority of the participants, these documentations smells are occurring frequently and hindering the productivity of the development tasks. \section{Threats to Validity} In this work, we conducted our experiments on a relatively small dataset. Since, to the best of our knowledge, detecting the documentation smells is the first of its kind, we manually labeled a small portion of the Java API documentation due to the time constraint. However, we randomly sampled the documentations for manual labeling, therefore, we expect that the actual distributions of the documentation smells will remain identical in case of adding more documentation examples. Furthermore, we performed cross-validation on our dataset to reduce the effect of any non-representative subset. The number of participants in our survey is too low to get a clear picture of how the documentation smells affect productivity on the large scale. We conducted the survey with an aim to validate the catalog we developed by the software developers. As the developers agreed with the catalog and its negative impact on the productivity, in the future extension of this study, we can include more participants to categorize the documentations into different documentation smells based on this catalog.
\section{Introduction: a tale of three anharmonic oscillators} \noindent Classical Yang--Mills fields play a central role in various areas of theoretical physics, from QCD confinement to spin-orbit interactions in condensed matter theory and early-universe cosmology. Concerning the latter, scenarios have been proposed and analyzed for isotropic inflation driven by non-Abelian gauge fields, such as gauge-flation or chromo-natural inflation, by employing a homogeneous and isotropic Yang--Mills background in a spatially flat Friedmann--Lema\^{i}tre--Robertson--Walker (FLRW) universe (for a review, see~\cite{gaugeflation}. More minimalistically, Friedan has recently put forward an evolution of the electroweak epoch based on the Standard Model and general relativity alone, where an oscillating isotropic SU(2) gauge field stabilizes the symmetric Higgs vacuum in a spatially closed FLRW spacetime~\cite{Friedan}. It is therefore of natural interest to establish the stability features of such ``cosmic Yang--Mills fields'' against classical and quantum perturbations. While this has been done using cosmological perturbation theory in the context of gauge-flation, the issue remains unclear in the pre-inflation scenario of Friedan, despite some early partial analysis of Hosotani~\cite{Hosotani}. Here, we address this matter by performing a complete stability analysis of the only known family of analytic SU(2) Yang--Mills solutions in a closed FLRW universe. The situation differs from that of gauge-flation, since we do not break conformal invariance, and our homogeneous and isotropic gauge background would conformally map to an inhomogeneous Yang--Mills configuration in spatially flat FLRW spacetime. Our analysis, however, is partial in that we investigate only gauge-field fluctuations while keeping the metric fixed, for two reasons. Firstly, the background FLRW dynamics does not influence the gauge field, since the gauge sector is conformally invariant and we conformally map to a static metric. Secondly, the time scale of the gauge-field dynamics in the electroweak epoch is supposed to be hugely shorter than that of the spacetime geometry, thus we do not expect (non-conformal) metric fluctuations to exert a sizeable influence on the stability of the gauge-field configuration. Our results should therefore be relevant to Friedan's scenario. Nevertheless, a full cosmological perturbation theory of the combined Einstein--Yang--Mills system requires turning on also metric perturbations, something we reserve for a future task. Even without coupling to gravity and independent of potential cosmological applications, the perturbation theory around any analytic classical field configuration is of general interest for assessing its relevance for quantum properties, since the determinant of the second variation of the action yields the leading quantum correction to a saddle point in the semiclassical analysis of the path integral. This aspect has been investigated for many classical Yang--Mills solutions but not yet for the ones studied here, to our knowledge. It is generally impossible to find analytic solutions to the coupled Einstein--Yang--Mills system of equations, in part because they are coupled both ways. However, in a homogeneous and isotropic universe, where the metric is conformally flat, the Yang--Mills equations decouple due to their conformal invariance in four spacetime dimensions. Thus, if one can find isotropic Yang--Mills solutions on Minkowski, de Sitter, or anti de Sitter space, then their energy-momentum tensor will be compatible with any FLRW metric (of the same topology) and allow for an analytic computation of the scale factor from the Friedmann equation. Fortunately, for the de Sitter case and a gauge group SU(2), such Yang--Mills configurations with finite energy and action are available \cite{AFF,Luescher,Schechter}. They are most easily constructed on the cylinder $(0,\pi)\times S^3$, which is related to de Sitter space by a purely temporal reparametrization and Weyl rescaling~\cite{Hosotani,Volkov,ILP1,Friedan}, \begin{equation} \label{deSittermetric} \mathrm{d} s_{\textrm{dS}_4}^2 \= -\mathrm{d} t^2 + \ell^2\cosh^2\!\sfrac{t}{\ell}\,\mathrm{d}\Omega_3^2 \= \sfrac{\ell^2}{\sin^2\!\tau} \bigl(-\mathrm{d}\tau^2 + \mathrm{d}\Omega_3^2\bigr) \qquad\textrm{for}\quad t\in(-\infty,+\infty)\ \Leftrightarrow\ \tau \in (0,\pi)\ , \end{equation} where $\mathrm{d}\Omega_3^{\ 2}$ is the round metric on $S^3$, and $\ell$ is the de Sitter radius. This provides an explicit relation between co-moving time~$t$ and conformal time~$\tau$, and it fixes the cosmological constant to~$\Lambda=3/\ell^2$. One employs the identification SU$(2)\simeq S^3$ to write an $S^3$-symmetric ansatz for the SU(2) gauge potential~$A_\mu$, which produces a solvable ODE for a parameter function~$\psi(\tau)$ of conformal time. This ODE has the form of Newton's equation for a mass point in a double-well potential \begin{equation} \label{Vpot} V(\psi) \= \sfrac12 (\psi^2-1)^2\ , \end{equation} yielding a first anharmonic oscillator. A two-parameter family of (in general time-dependent) solutions can be given in terms of Jacobi elliptic functions and describe SO(4) invariant Yang--Mills fields on the Lorentzian cylinder over~$S^3$. These Yang--Mills solutions then exist (at least locally) in any conformally related spacetime, but the conformal transformation will ruin isotropy unless we restrict ourselves to spatially closed FLRW metrics, \begin{equation} \label{FLRW} \mathrm{d} s^2 \= -\mathrm{d} t^2 + a(t)^2\,\mathrm{d}\Omega_3^{\ 2} \= a(\tau)^2\bigl(-\mathrm{d}\tau^2 + \mathrm{d}\Omega_3^{\ 2}\bigr) \qquad\textrm{for}\quad t\in(0,t_{\textrm{max}})\ \Leftrightarrow\ \tau \in {\cal I} \equiv (0,T')\ , \end{equation} where we impose a big-bang initial condition~$a(0){=}0$, so that \begin{equation} \mathrm{d}\tau \= \frac{\mathrm{d} t}{a(t)} \qquad\textrm{with}\qquad \tau(t{=}0) = 0 \quad\quad\textrm{and}\quad\quad \tau(t{=}t_{\textrm{max}}) =: T'<\infty\ . \end{equation} The lifetime $t_{\textrm{max}}$ of the universe can be infinite (big rip, $a(t_{\textrm{max}}){=}\infty$) or finite (big crunch, $a(t_{\textrm{max}}){=}0$). Bouncing cosmologies as in (\ref{deSittermetric}) are also allowed but will not be pursued here. Since the energy-momentum tensor of our Yang--Mills configurations is SO(4) symmetric, their gravitational backreaction will keep us inside the FLRW framework and merely modify the cosmic scale factor~$a(\tau)$. The latter is fully determined by the Friedmann equation in the presence of the Yang--Mills energy-momentum and a cosmological constant~$\Lambda$, whose value may be dialed. It is well known that the Friedmann equation takes the form of another Newton equation. Its (cosmological) potential for the case at hand reads \begin{equation} \label{Wpot} W(a) \= \sfrac12 a^2 - \sfrac{\Lambda}{6} a^4\ , \end{equation} which is our second anharmonic oscillator (although inverted). Each pair $(\psi,a)$ of solutions to the two systems (\ref{Vpot}) and~(\ref{Wpot}) yields an exact classical Einstein--Yang--Mills configuration. One parameter in $\psi$ is the conserved mechanical energy $E$ in the potential~$V$, which in turn determines the mechanical energy~$\tilde{E}$ for $a$ in the potential~$W$. This one-way coupling is the only relation between the two anharmonic oscillators. For a physical embodiment of the cosmological constant, we may add a third player, for instance a complex scalar Higgs field~$\phi$ in the fundamental SU(2) representation. The standard-model Higgs potential \begin{equation} U(\phi) \= \sfrac12\,\lambda^2\,\bigl(\phi^\+\phi-\sfrac12 v^2\bigr)^2\ , \end{equation} where $v/\sqrt{2}$ is the Higgs vev and $\lambda v$ is the Higgs mass, gives us a third anharmonic oscillator. The dictate of SO(4) invariance, however, allows only the zero solution, $\phi\equiv0$, which provides us with a definite positive cosmological constant of \begin{equation} \Lambda \= \kappa\,U(0) \= \sfrac18\,\kappa\,\lambda^2 v^4\ , \end{equation} where $\kappa$ is the gravitational coupling. The full Einstein--Yang--Mills--Higgs action (in standard notation), \begin{equation} S \= \int\!\mathrm{d}^4 x\ \sqrt{-g}\ \Bigl\{ \sfrac{1}{2\kappa} R + \sfrac{1}{8g^2} \mathrm{tr} F_{\mu\nu}F^{\mu\nu} -D_\mu\phi^\+ D^\mu\phi - U(\phi) \Bigr\}\ , \end{equation} reduces in the SO(4)-invariant sector to \begin{equation} S[a,\psi,\Lambda] \= 12\pi^2 \int_0^{T'}\!\!\mathrm{d}\tau\ \Bigl\{ \sfrac{1}{\kappa} \bigl(-\sfrac12\dot{a}^2+W(a)\bigr) + \sfrac{1}{2g^2} \bigl(\sfrac12\dot{\psi}^2-V(\psi)\bigr) \Bigr\}\ , \end{equation} where $g$ is the gauge coupling, and the overdot denotes a derivative with respect to conformal time. For large enough ``gauge energy''~$E$, the universe undergoes an eternal expansion, which is accompanied by rapid fluctuations of the gauge field. The latter's coupling to the Higgs field stabilizes the symmetric vacuum $\phi\equiv0$ at the local maximum of~$U$ as a parametric resonance effect, as long as $a$ is not too large. Eventually, when $a$ exceeds a critical value $a_{\textrm{EW}}$, the Higgs field will begin to roll down towards a minimum of~$U$, breaking the SO(4) symmetry. The corresponding time $t_{\textrm{EW}}$ signifies the electroweak phase transition in the early universe. This scenario was put forward recently by D.~Friedan~\cite{Friedan}. The goal of the current paper is a stability analysis of these classical oscillating ``cosmic'' Yang--Mills fields. To begin with, Section~2 describes the geometry of $S^3$ and reviews the classical configurations~$(A_\mu,g_{\mu\nu})$ in terms of Newtonian solutions~$(\psi,a)$ for the anharmonic oscillator pair~$(V,W)$. To investigate arbitrary small perturbations of the gauge field departing from the time-dependent background~$A_\mu$ parametrized by the ``gauge energy''~$E$, Section~3 linearizes the Yang--Mills equation around it and diagonalizes the fluctuation operator to obtain a spectrum of time-dependent natural frequencies. To decide about the linear stability of the cosmic Yang--Mills configurations we have to analyze the long-time behavior of the solutions to Hill's equation for all these normal modes. In Section~4 we employ Floquet theory to learn that their growth rate is determined by the stroboscopic map or monodromy, which is easily computed numerically for any given mode. We do so for a number of low-frequency normal modes and find, when varying~$E$, an alternating sequence of stable (bounded) and unstable (exponentially growing) fluctuations. The unstable bands roughly correspond to the parametric resonance frequencies. With growing ``gauge energy'' the runaway perturbation modes become more prominent, and some of them persist in the infinite-energy limit, where we detect universal natural frequencies and monodromies. A special role is played by the SO(4)-invariant fluctuation, which merely shifts the parameter~$E$ of the background. We treat it exactly and beyond the linear regime in Section~5. This ``singlet'' mode turns out to be marginally stable, i.e.~it has a vanishing Lyapunov exponent. Its linear growth, however, gets limited by nonlinear effects of the full fluctuation equation, whose analytic solutions exhibit wave beat behavior. Finally, some explicit data for the first few natural frequencies are collected in an Appendix. \section{Cosmic Yang--Mills solutions} \noindent In order to describe the classical Yang--Mills solutions we need to develop some elements of the spatial $S^3$ geometry. Taking advantage of the fact that \begin{equation} S^3 \simeq \textrm{SU}(2) \quad\quad\textrm{and}\quad\quad so(4) \simeq su(2)_L\oplus su(2)_R \end{equation} we introduce a basis $\{L_a\}$ for $a=1,2,3$ of left-invariant vector fields on~$S^3$ generating the right multiplication on~SU(2) and forming the $su(2)_L$ algebra \begin{equation}\label{vecfields} \[ L_a , L_b \] \= 2\,\varepsilon_{ab}^{\ \ c}\,L_c \ . \end{equation} It is dual to a basis $\{e^a\}$ of left-invariant one-forms on~$S^3$, i.e.~$e^a(L_b)=\delta^a_{\ b}$, subject to \begin{equation} \mathrm{d} e^a + \varepsilon^a_{\ bc}\,e^b\wedge e^c \=0 \quad\quad\textrm{and}\quad\quad e^a e^a \= \mathrm{d}\Omega_3^{\ 2}\ . \end{equation} One may obtain this basis by expanding the left Cartan one-form \begin{equation} \Omega_{_L}(g) \= g^{-1}\, \mathrm{d} g \= e^a\,L_a \ . \end{equation} Here, the group element~$g$ provides the identification map \begin{equation} g: \ S^3 \rightarrow \textrm{SU}(2) \qquad\textrm{via}\quad (\alpha,\beta) \mapsto -\mathrm{i} \begin{pmatrix} \beta & \alpha^* \\ \alpha & -\beta^* \end{pmatrix} \quad\quad\textrm{with}\quad |\alpha|^2+|\beta|^2=1\ , \end{equation} which sends the $S^3$ north pole $(0,\mathrm{i})$ to the group identity $\mathds{1}_2$. We shall coordinatize $S^3$ by an SU(2) group element~$g$. The $su(2)_R$ half of the three-sphere's $so(4)$ isometry is provided by right-invariant vector fields~$R_a$ belonging to the left multiplication on the group manifold and obeying \begin{equation} \[ R_a , R_b \] \= 2\,\varepsilon_{ab}^{\ \ c}\,R_c\ . \end{equation} The differential of a function~$f$ on~${\cal I}\times S^3$ is then conveniently taken as \begin{equation} \mathrm{d} f \= \mathrm{d}\tau\,\mbox{$\partial$}_\tau f\,+\,e^a L_a f\ . \end{equation} Functions on $S^3$ can be expanded in a basis of harmonics~$Y_j(g)$ with $2j\in\mathds N_0$, which are eigenfunctions of the scalar Laplacian,\footnote{ The SO(4) spin of these functions is actually $2j$, but we label them with half their spin, for reasons to be clear below.} \begin{equation} -\mathop{}\!\mathbin\bigtriangleup_3 Y_j \= 2j(2j{+}2)\,Y_j \= 4j(j{+}1)\,Y_j \= -\sfrac12(L^2+R^2)\,Y_j \ , \end{equation} where $L^2=L_a L_a$ and $R^2=R_a R_a$ are (minus four times) the Casimirs of $su(2)_L$ and $su(2)_R$, respectively, \begin{equation} -\sfrac14 L^2\,Y_j \= -\sfrac14 R^2\,Y_j \= -\sfrac14\mathop{}\!\mathbin\bigtriangleup_3 Y_j \= j(j{+}1)\,Y_j\ . \end{equation} The left-right (or toroidal) harmonics~$Y_{j;m,n}$ are eigenfunctions of $L^2=R^2$, $L_3$ and~$R_3$, \begin{equation} \label{Y-action1} \sfrac{\mathrm{i}}{2}\,L_3\,Y_{j;m,n} \= m\,Y_{j;m,n} \quad\quad\textrm{and}\quad\quad \sfrac{\mathrm{i}}{2}\,R_3\,Y_{j;m,n} \= n\,Y_{j;m,n} \end{equation} for $m,n=-j,-j{+}1,\ldots,{+}j$, and hence the corresponding ladder operators \begin{equation} L_\pm \= (L_1\pm\mathrm{i} L_2)/\sqrt{2} \quad\quad\textrm{and}\quad\quad R_\pm \= (R_1\pm\mathrm{i} R_2)/\sqrt{2} \end{equation} act as \begin{equation} \label{Y-action2} \sfrac{\mathrm{i}}{2}\,L_\pm\,Y_{j;m,n} \= \sqrt{(j{\mp}m)(j{\pm}m{+}1)/2}\,Y_{j;m\pm1,n} \quad\!\quad\textrm{and}\quad\!\quad \sfrac{\mathrm{i}}{2}\,R_\pm\,Y_{j;m,n} \= \sqrt{(j{\mp}n)(j{\pm}n{+}1)/2}\,Y_{j;m,n\pm1}\ . \end{equation} The gauge potential is an $su(2)$-valued one-form on our spacetime. We use the ${\cal I}\times S^3$ parametrization and write \begin{equation} \label{Acalfull} {\cal A} \= {\cal A}_\tau(\tau,g)\,\mathrm{d}\tau\ +\ \sum_{a=1}^3 {\cal A}_a(\tau,g)\,e^a(g) \quad\quad\textrm{with}\quad g \in \textrm{SU}(2)\ . \end{equation} It has been shown~\cite{Luescher, Friedan} that the requirement of SO(4) equivariance enforces the form \begin{equation}\label{Aansatz} {\cal A}_\tau(\tau,g) \= 0 \quad\quad\textrm{and}\quad\quad {\cal A}_a(\tau,g) \= \sfrac12\bigl(1+\psi(\tau)\bigr)\,T_a \end{equation} with some function $\psi: {\cal I}\to\mathds R$, where $T_a$ denotes the $su(2)$ generators subject to \begin{equation} \[ T_a , T_b \] \= 2\,\varepsilon_{ab}^{\ \ c}\,T_c\ , \end{equation} so that the adjoint representation produces $\mathrm{tr}(T_a T_b)=-8\,\delta_{ab}$. The corresponding field strength reads \begin{equation}\label{2-form} \begin{aligned} {\cal F} &\= \mathrm{d}{\cal A} + {\cal A}\wedge{\cal A} \= \partial_\tau{\cal A}_a\,\mathrm{d}\tau{\wedge}e^a + \sfrac12\bigl( R_{[b}{\cal A}_{c]} - 2\varepsilon_{bc}^{\ \ a}{\cal A}_a + [{\cal A}_b,{\cal A}_c]\bigr)e^b{\wedge}\,e^c\\[4pt] &\= \sfrac12\dot\psi\,T_a\,\mathrm{d}\tau{\wedge}e^a \ +\ \sfrac14\varepsilon^a_{\ bc} (\psi^2{-}1)\,T_a\,e^b{\wedge}e^c \end{aligned} \end{equation} where $\dot{\psi}\equiv\partial_\tau\psi$. The Yang--Mills action on this ansatz simplifies to \begin{equation}\label{YMaction} S \= \frac{-1}{4g^2}\int_{{\cal I}\times S^3} \!\!\! \mathrm{tr}\ {\cal F}\wedge *{\cal F} \= \frac{6\pi^2}{g^2} \int_{\cal I} \!\mathrm{d}\tau\ \bigl[ \sfrac12\dot\psi^2 - V(\psi) \bigr] \qquad\textrm{with}\quad V(\psi)\=\sfrac12(\psi^2{-}1)^2\ , \end{equation} where ${\cal I}=[0,T']$ and $g$ here denotes the gauge coupling. Due to the principle of symmetric criticality~\cite{Palais}, solutions to the mechanical problem \begin{equation} \label{Newton} \ddot{\psi} + V'(\psi) \= 0 \end{equation} will, via (\ref{Aansatz}), provide Yang--Mills configurations which extremize the action. Conservation of energy implies that \begin{equation} \label{energylaw} \sfrac12\dot{\psi}^2 +V(\psi) \= E \= \textrm{constant}\ , \end{equation} and the generic solution in the double-well potential~$V$ is periodic in~$\tau$ with a period~$T(E)$. Hence, fixing a value for~$E$ and employing time translation invariance to set $\dot{\psi}(0)=0$ uniquely determines the classical solution~$\psi(\tau)$ up to half-period shifts. Its explicit form is \begin{equation} \label{backgrounds} \psi(\tau) \= \begin{cases} \ \sfrac{k}{\epsilon}\,\mathrm{cn}\bigl(\sfrac{\tau}{\epsilon},k\bigr) \qquad\qquad\ \ \,\textrm{with}\quad T=4\,\epsilon\,K(k) & \textrm{for}\quad \sfrac12<E<\infty \\[4pt] \ 0 \qquad\qquad\qquad\qquad\quad\! \textrm{with}\quad T=\infty & \textrm{for}\quad E=\sfrac12 \\[4pt] \ \pm\sqrt{2}\,\mathrm{sech}\bigl(\sqrt{2}\,\tau\bigr) \qquad\ \textrm{with}\quad T=\infty & \textrm{for}\quad E=\sfrac12 \\[4pt] \ \pm\sfrac{k}{\epsilon}\,\mathrm{dn}\bigl(\sfrac{k\,\tau}{\epsilon},\sfrac1k\bigr) \qquad\quad\ \textrm{with}\quad T=2\,\sfrac{\epsilon}{k}\,K(\sfrac1k) \quad & \textrm{for}\quad 0<E< \sfrac12 \\[4pt] \ \pm 1 \qquad\qquad\qquad\qquad \textrm{with}\quad T=\pi & \textrm{for}\quad E=0 \end{cases}\ , \end{equation} where cn and dn denote Jacobi elliptic functions, $K$ is the complete elliptic integral of the first kind, and \begin{equation} 2\,\epsilon^2 \= 2k^2{-}1 \= 1/\sqrt{2E} \qquad\textrm{with}\quad k=\sfrac{1}{\sqrt{2}},1,\infty \quad\Leftrightarrow\quad E=\infty,\sfrac12,0\ . \end{equation} For $E{\gg}\frac12$, we have $k^2{\to}\frac12$, and the solution is well approximated by $\frac{2}{\epsilon}\cos\bigl(\frac{2\sqrt{\pi^3}}{\Gamma(1/4)^2}\frac{\tau}{\epsilon}\bigr)$. At the critical value of $E{=}\sfrac12$ ($k{=}1$), the unstable constant solution coexists with the celebrated bounce solution, and below it the solution bifurcates into oscillations in the left or right well of the double-well potential, which halfens the oscillation period. The two constant minima $\psi=\pm1$ correspond to the vacua ${\cal A}=0$ and ${\cal A}=g^{-1}\mathrm{d} g$. Actually, the time translation freedom is broken by the finite range of~${\cal I}$, so that time-shifted solutions differ in their boundary values $\psi(0)$ and $\psi(T')$ and also in their value for the action. \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{psi_large.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{psi_medium+.pdf} \\[12pt] \includegraphics[width = 0.35\paperwidth]{psi_medium-.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{psi_small.pdf} \caption{Plots of $\psi(\tau)$ over one period, for different values of $k^2$: \newline \indent\qquad\qquad\ $0.500001$ (top left), $0.9999999$ (top right), $1.0000001$ (bottom left) and $2$ (bottom right).} \end{figure} The corresponding color-electric and -magnetic field strengths read \begin{equation} {\cal E}_a \= {\cal F}_{0a} \= \sfrac12\dot\psi\,T_a \quad\quad\textrm{and}\quad\quad {\cal B}_a \= \sfrac12\varepsilon_a^{\ bc}{\cal F}_{bc} \= \sfrac12(\psi^2{-}1)\,T_a\ , \end{equation} which yields a finite total energy (on the cylinder) of $6\pi^2 E/g^2$ and a finite action~\cite{ILP1,ILP2} \begin{equation} g^2 S[\psi] \= 6\pi^2\int_{\cal I} \!\mathrm{d}\tau\ \bigl[E-(\psi^2{-}1)^2\bigr] \=6\pi^2\int_{\cal I} \!\mathrm{d}\tau\ \bigl[\dot{\psi}^2-E\bigr]\ \ge\ -3\pi^2 T'\ . \end{equation} The energy-momentum tensor of our SO(4)-symmetric Yang--Mills solutions is readily found as \begin{equation} T \= \frac{3\,E}{g^2 a^2} \bigl( \mathrm{d}\tau^2 + \sfrac13\,\mathrm{d}\Omega_3^2 \bigr)\ , \end{equation} which is traceless as expected. The Einstein equations for a closed FLRW universe with cosmological constant~$\Lambda$ reduce to two independent relations, which can be taken to be its trace and its time-time component. In conformal time one gets, respectively, \begin{equation} \label{friedmann} \left.\begin{cases} \quad -R+4\,\Lambda \= 0 \\[4pt] \quad R_{\tau\tau}+\sfrac12R\,a^2-\Lambda\,a^2\= \kappa\,T_{\tau\tau} \end{cases} \right\} \qquad\Leftrightarrow\qquad \left.\begin{cases} \quad \ddot{a}+W'(a)\=0 \\[4pt] \quad \sfrac12\dot{a}^2+W(a) \= \frac{\kappa}{2g^2}E \ =:\ E' \end{cases} \right\} \end{equation} with a gravitational coupling $\kappa=8\pi G$, a gravitational energy $E'$ and a cosmological potential \begin{equation} \label{gravpot} W(a) \= \sfrac12 a^2 - \sfrac{\Lambda}{6} a^4\ . \end{equation} The two anharmonic oscillators, with potential~$V$ for the gauge field and potential~$W$ for gravity, are coupled only via the balance of their conserved energies, \begin{equation} \frac1\kappa \bigl[ \sfrac12\dot{a}^2+W(a)\bigr] \= \frac1{2g^2} \bigl[ \sfrac12\dot{\psi}^2+V(\psi)\bigr]\ , \end{equation} which is nothing but the Wheeler--DeWitt constraint~$H=0$. \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{Wplot.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{Vplot.pdf} \caption{Plots of the cosmological potential $W(a)$ for $\Lambda{=}1$ and the double-well potential $V$.} \end{figure} The Friedmann equation~(\ref{friedmann}), being a mechanical system with an inverted anharmonic potential~(\ref{gravpot}), is again easily solved analytically, \begin{equation} \label{universalscale} a(\tau) \= \begin{cases} \ \sqrt{\sfrac{3}{\Lambda}}\,\sfrac{1}{2\epsilon'}\, \sqrt{\frac{1-\mathrm{cn}\bigl(\sfrac{\tau}{\epsilon'},k'\bigr)}{1+\mathrm{cn}\bigl(\sfrac{\tau}{\epsilon'},k'\bigr)}} \qquad\qquad \textrm{with}\quad T'=2\,\epsilon'K(k') & \textrm{for}\quad \sfrac{3}{8\Lambda}<E'<\infty \\[4pt] \ \sqrt{\sfrac{3}{2\Lambda}}\,\tanh\bigl(\tau/\sqrt{2}\bigr) \qquad\qquad\quad\ \textrm{with}\quad T'=\infty & \textrm{for}\quad E'=\sfrac{3}{8\Lambda} \\[4pt] \ \sqrt{\sfrac{3}{\Lambda}}\,\sfrac{1}{2\epsilon'}\, \sqrt{\frac{1-\mathrm{dn}\bigl(\sfrac{k'\tau}{\epsilon'},\sfrac{1}{k'}\bigr)} {1+\mathrm{dn}\bigl(\sfrac{k'\tau}{\epsilon'},\sfrac{1}{k'}\bigr)}} \qquad\quad \textrm{with}\quad T'=2\,\sfrac{\epsilon'}{k'}K(\sfrac{1}{k'}) \quad & \textrm{for}\quad 0<E'< \sfrac{3}{8\Lambda} \\[10pt] \ 0 \qquad\qquad\qquad\qquad\qquad\qquad\ \; \textrm{with}\quad T'=\pi & \textrm{for}\quad E'=0 \end{cases}\ , \end{equation} where we abbreviated~\footnote{ Our ${k'}^2$ should not be confused with the dual modulus $1{-}k^2$, which is often denoted this way.} \begin{equation} 2\,{\epsilon'}^2 \= 2{k'}^2{-}1 \= 1/\sqrt{\smash{\sfrac{8\Lambda}{3}}\, E'} \qquad\textrm{so that}\quad k'=\sfrac{1}{\sqrt{2}},1,\infty \quad\Leftrightarrow\quad E'=\infty,\sfrac{3}{8\Lambda},0\ . \end{equation} \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{a_small.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{a_medium+.pdf} \\[12pt] \includegraphics[width = 0.35\paperwidth]{a_medium-.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{a_large.pdf} \caption{Plots of $a(\tau)$ over one lifetime, for $\Lambda{=}1$ and different values of ${k'}^2$: \newline \indent\qquad\qquad\ $0.505$ (top left), $0.9999999$ (top right), $1.0000001$ (bottom left) and $1.1$ (bottom right).} \end{figure} For $E'{\gg}\frac{3}{8\Lambda}$, we have ${k'}^2{\to}\frac12$, and the solution is well approximmated by $\sqrt{\frac{3}{\Lambda}}\frac{1}{2\epsilon'}\tan\bigl(\frac{\sqrt{\pi^3}}{\Gamma(1/4)^2}\frac{\tau}{\epsilon'}\bigr)$. We only listed solutions with initial value $a(0)=0$ (big bang). There exist also (for $E'<\sfrac{3}{8\Lambda}$) bouncing solutions, where the universe attains a minimal radius $a_{\textrm{min}}=\bigl[\frac{3}{2\Lambda}(1+\sqrt{1-\smash{\sfrac{8\Lambda}{3}}E'})\bigr]^{1/2}$ between infinite extension in the far past ($t{=}{-}\infty\leftrightarrow\tau{=}0$) and the far future ($t{=}{+}\infty\leftrightarrow\tau{=}T'$). For $E'{>}0$ they are obtained by sending $\mathrm{dn}\to-\mathrm{dn}$ in~(\ref{universalscale}) above. The quantity~$T'$ listed there is the (conformal) lifetime of the universe, from the big bang until either the big rip (for $E'>\frac{3}{8\Lambda}$) or the big crunch of an oscillating universe (for $E'<\frac{3}{8\Lambda}$). The solution relevant to our Einstein--Yang--Mills system is entirely determined by the Newtonian energy~$E$ characterizing the cosmic Yang--Mills field: above the critical value of \begin{equation} E_{\textrm{crit}} \= \frac{2\,g^2}{\kappa}\,\frac{3}{8\,\Lambda} \end{equation} the universe expands forever (until $t_{\textrm{max}}{=}\infty$), while below this value it recollapses (at $t_{\textrm{max}}{=}\int_0^{T'}\!\mathrm{d}\tau\,a(\tau)$). It demonstrates the necessity of a cosmological constant (whose role may be played by the Higgs expectation value) as well as the nonperturbative nature of the cosmic Yang--Mills field, whose contribution to the energy-momentum tensor is of~$O(g^{-2})$. \section{Natural perturbation frequencies} \noindent Our main task in this paper is an investigation of the stability of the cosmic Yang--Mills solutions reviewed in the previous section. For this, we should distinguish between global and local stability. The former is difficult to assess in a nonlinear dynamics but clear from the outset in case of a compact phase space. The latter refers to short-time behavior induced by linear perturbations around the reference configuration. We shall look at this firstly, in the present section and the following one. Here, we set out to diagonalize the fluctuation operator for our time-dependent Yang--Mills backgrounds and find the natural frequencies. Even though our cosmic gauge-field configurations are SO(4)-invariant, we must allow for all kinds of fluctuations on top of it, SO(4)-symmetric perturbations being a very special subclass of them. A generic gauge potential ``nearby'' a classical solution~${\cal A}$ on ${\cal I}\times S^3$ can be expanded as \begin{equation} {\cal A}+\Phi \= {\cal A}(\tau,g)\ +\ \sum_{p=1}^3 \Phi_0^p(\tau,g)\,T_p\,\mathrm{d}\tau\ +\ \sum_{a=1}^3\sum_{p=1}^3 \Phi_a^p(\tau,g)\,T_p\,e^a(g) \end{equation} with, using $(\mu)=(0,a)$, \begin{equation} \Phi_\mu^p(\tau,g) \= \sum_{j,m,n} \Phi_{\mu|j;m,n}^p(\tau)\,Y_{j;m,n}(g)\ , \end{equation} on which we notice the following actions (supressing the $\tau$ and $g$ arguments), \begin{equation} (L_a \Phi_\mu^p)_{j;m,n} = \Phi_{\mu|j;m',n}^p \bigl(L_a)^{m'}_{\ m}\ ,\quad (S_a \Phi)_0^p = 0\ ,\quad (S_a \Phi)_b^p = -2\varepsilon_{abc}\,\Phi_c^p \ ,\quad (T_a \Phi)_\mu^p = -2\varepsilon_{apq}\,\Phi_\mu^q \ , \end{equation} where the $L_a$ matrix elements are determined from (\ref{Y-action1}) and~(\ref{Y-action2}), and $S_a$ are the components of the spin operator. The (metric and gauge) background-covariant derivative reads \begin{equation} D_\tau \Phi \= \partial_\tau \Phi \qquad\quad\textrm{and}\quad\qquad D_a \Phi \= L_a \Phi + [ {\cal A}_a,\Phi ] \qquad\textrm{with}\qquad {\cal A}_a \= \sfrac12\bigl(1+\psi(\tau)\bigr)\,T_a\ , \end{equation} which is equivalent to \begin{equation} D_a\Phi_b^p \= L_a\Phi_b^p - \varepsilon_{abc}\Phi_c^p + [ {\cal A}_a,\Phi_b]^p \qquad\textrm{since}\qquad D_a\,e^b \= L_a\,e^b - \varepsilon_{abc}\,e^c \= \varepsilon_{abc}\,e^c \ . \end{equation} The background ${\cal A}$ obeys the Coulomb gauge condition, \begin{equation} {\cal A}_\tau =0 \qquad\quad\textrm{and}\quad\qquad L_a{\cal A}_a = 0\ , \end{equation} but we cannot enforce these equations on the fluctuation~$\Phi$. However, we may impose the Lorenz gauge condition, \begin{equation} \label{gauge} D^\mu \Phi^p_\mu \= 0 \qquad\Rightarrow\qquad \partial_\tau \Phi_0^p - L_a\Phi^p_a - \sfrac12(1{+}\psi)(T_a\Phi_a)^p \= 0\ , \end{equation} which is seen to couple the temporal and spatial components of~$\Phi$ in general. We then linearize the Yang--Mills equations around ${\cal A}$ and obtain \begin{equation} D^\nu D_\nu \Phi_\mu - R_{\mu\nu}\Phi^\nu + 2[{\cal F}_{\mu\nu},\Phi^\nu] \= 0 \end{equation} with the Ricci tensor \begin{equation} R_{\mu 0} \= 0 \qquad\quad\textrm{and}\quad\qquad R_{ab} \= 2\delta_{ab}\ . \end{equation} After a careful evaluation, the $\mu{=}0$ equation yields \begin{equation} \label{temporal} \bigl[\partial_\tau^2 - L_b L_b + 2(1{+}\psi)^2\bigr] \Phi_0^p - (1{+}\psi)L_b(T_b\Phi_0)^p - \dot{\psi}(T_b\Phi_b)^p \= 0\ , \end{equation} while the $\mu{=}a$ equations read \begin{equation} \label{spatial} \bigl[\partial_\tau^2 - L_b L_b + 2(1{+}\psi)^2{+}4\bigr]\Phi_a^p -(1{+}\psi)L_b(T_b\Phi)_a^p - L_b(S_b\Phi)_a^p - \sfrac12(1{+}\psi)(2{-}\psi)(S_bT_b\Phi)_a^p - \dot{\psi}(T_a\Phi_0)^p \= 0\ . \end{equation} It is convenient to package the orbital, spin, isospin, and fluctuation triplets into formal vectors, \begin{equation} \vec{L}=(L_a)\ ,\qquad \vec{S}=(S_a)\ ,\qquad \vec{T}=(T_a)\ ,\qquad \vec{\Phi}=(\Phi_a)\ , \end{equation} respectively, but they act in different spaces, hence on different indices, such that $\vec{S}^2=\vec{T}^2=-8$ on~$\Phi$. In this notation, (\ref{gauge}), (\ref{temporal}) and~(\ref{spatial}) take the compact form (suppressing the color index~$p$) \begin{eqnarray} \partial_\tau\Phi_0 - \vec{L}{\cdot}\vec{\Phi} - \sfrac12(1{+}\psi)\vec{T}{\cdot}\vec{\Phi} \= 0\ , \label{gauge2} \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\ \ \\[4pt] \bigl[\partial_\tau^2{-}\vec{L}^2+2(1{+}\psi)^2\bigr] {\Phi}_0 - (1{+}\psi)\vec{L}{\cdot}\vec{T}\,\Phi_0 - \dot{\psi}\,\vec{T}{\cdot}\vec{\Phi} \= 0 \ , \label{mu=0}\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\quad\ \ \\[6pt] \bigl[\partial_\tau^2{-}\vec{L}^2{-}\sfrac12\vec{S}^2{+}2(1{+}\psi)^2\bigr] {\Phi}_a - (1{+}\psi)\vec{L}{\cdot}\vec{T}\,\Phi_a - \vec{L}{\cdot}(\vec{S}\,\Phi)_a - \sfrac12(1{+}\psi)(2{-}\psi)\vec{T}{\cdot}(\vec{S}\,\Phi)_a - \dot{\psi}\,T_a\Phi_0 \= 0\ . \quad \label{mu=a} \end{eqnarray} A few remarks are in order. First, except for the last term, (\ref{mu=0}) is obtained from (\ref{mu=a}) by setting $\vec{S}=0$, since $\Phi_0$ carries no spin index. Second, both equations can be recast as \begin{equation} \label{2spins} {}\!\!\! \bigl[ \partial_\tau^2 - \sfrac{1{-}\psi}{2}\vec{L}^2 - \sfrac{1{+}\psi}{2}(\vec{L}{+}\vec{T})^2 - 2(1{+}\psi)(1{-}\psi) \bigr] \Phi_0 \= \dot{\psi}\,\vec{T}\cdot\vec{\Phi}\ , \qquad\qquad\qquad\qquad\qquad\qquad\qquad\qquad\ \ \end{equation} \begin{equation} \label{3spins} \bigl[ \partial_\tau^2 - \sfrac{(1{-}\psi)(2{+}\psi)}{4}\vec{L}^2 - \sfrac{\psi(1{+}\psi)}{4}(\vec{L}{+}\vec{T})^2 + \sfrac{\psi(1{-}\psi)}{4}(\vec{L}{+}\vec{S})^2 - \sfrac{(1{+}\psi)(2{-}\psi)}{4}(\vec{L}{+}\vec{T}{+}\vec{S})^2 - 2(1{+}\psi)(1{-}\psi) \bigr] \vec{\Phi} = \dot{\psi}\vec{T}\Phi_0, \end{equation} which reveals a problem of addition of three spins and a corresponding symmetry under \begin{equation} \label{symmetry} \psi\ \leftrightarrow\ -\psi\ ,\qquad \vec{L}\ \leftrightarrow\ \vec{L}{+}\vec{T}{+}\vec{S} \quad\quad\textrm{and}\quad\quad \vec{L}{+}\vec{S}\ \leftrightarrow\ \vec{L}{+}\vec{T}\ . \end{equation} Third, for constant backgrounds $(\dot{\psi}{=}0)$ the temporal fluctuation $\Phi_0$ decouples and may be gauged away. Still, the fluctuation operator in~(\ref{3spins}) is easily diagonalized only when the coefficient of one of the first three spin-squares vanishes, i.e.~for $\vec{L}{=}0$ ($j{=}0$), for the two vacua $\psi{=}{\pm}1$, or for the ``meron'' (or ``sphaleron'') $\psi{=}0$. The latter case has been analyzed by Hosotani and by Volkov~\cite{Hosotani,Volkov}. Let us decompose the fluctuation problem (\ref{gauge2})--(\ref{mu=a}) into finite-dimensional blocks according to a fixed value of the spin~$j\in\sfrac12\mathds N$, \begin{equation} \vec{L}^2\, \Phi^p_{\mu|j} \= -4\,j(j{+}1)\,\Phi^p_{\mu|j} \end{equation} and suppress the $j$ subscript. We employ the following coupling scheme,\footnote{ Another (less convenient) scheme couples $\vec{L}{+}\vec{S}$, then $(\vec{L}{+}\vec{S}){+}\vec{T}=:\vec{V}$.} \begin{equation} \vec{L}{+}\vec{T}=:\vec{U} \qquad\textrm{then}\qquad \vec{U}{+}\vec{S}=(\vec{L}{+}\vec{T}){+}\vec{S}=:\vec{V}\ . \end{equation} Clearly, $\vec{U}$ and $\vec{V}$ act on $\vec{\Phi}$ in $su(2)$ representations $j\otimes 1$ and $j\otimes 1\otimes 1$, respectively. On $\Phi_0$, we must put~$\vec{S}{=}0$ and have just $\vec{V}{=}\vec{U}$ act in a $j\otimes 1$ representation. Combining the coupled equations (\ref{mu=0}) and (\ref{mu=a}) to a single linear system for $(\Phi^p_\mu)=(\Phi^p_0,\Phi^p_a)$, we get a $12(2j{+}1)\times 12(2j{+}1)$ fluctuation matrix~$\Omega^2_{(j)}$, \begin{equation} \label{fluctop} \bigl[ \delta_{\mu\nu}^{pq}\,\partial_\tau^2\ +\ (\Omega^2_{(j)})_{\mu\nu}^{pq} \bigr]\,\Phi_\nu^q \= 0\ . \end{equation} Actually, there is an additional overall $(2j{+}1)$-fold degeneracy present due to the trivial action of the $su(2)_{\textrm{R}}$ generators~$R_a$, which plays no role here and will be suppressed. Roughly speaking, the $3(2j{+}1)$ modes of $\Phi_0$ are related to gauge modes,\footnote{ Strictly, they are gauge modes only when $\dot\psi{=}0$. Otherwise, the gauge modes are mixtures with the $\Phi_a$ modes.} and we still must impose the gauge condition~(\ref{gauge2}), which also has $3(2j{+}1)$ components. Therefore, a subspace of dimension $6(2j{+}1)$ inside the space of all fluctuations will represent the physical gauge-equivalence classes in the end. Our goal is to diagonalize the fluctuation operator~(\ref{fluctop}) for a given fixed value of~$j$. It has a block structure, \begin{equation} \label{block} \Omega^2_{(j)} \= \begin{pmatrix} \bar{N} & -\dot{\psi}\,T^\top \\[6pt] -\dot{\psi}\,T & N \end{pmatrix}\ , \end{equation} where $\bar{N}$ and $N$ are given by the left-hand sides of (\ref{2spins}) and~(\ref{3spins}), respectively. We introduce a basis where $\vec{U}^2$, $\vec{V}^2$ and $V_3$ are diagonal, i.e. \begin{equation} \vec{U}^2\,|uvm\> \= -4\,u(u{+}1)\,|uvm\> \quad\quad\textrm{and}\quad\quad \vec{V}^2\,|uvm\> \= -4\,v(v{+}1)\,|uvm\> \qquad\textrm{with}\quad m=-v,\ldots,v\ , \end{equation} and denote the irreducible $su(2)_v$ representations with those quantum numbers as $\rep{v}{u}$. On the $\Phi_0$ subspace, $u$ is redundant since $u{=}v$ as $\vec{S}{=}0$. Working out the tensor products, we encounter the values \begin{equation} \label{uvreps} \begin{aligned} \rep{v}{u} &\= \rep{j{-}2}{j{-}1}\ ;\!\!\!&\rep{j{-}1}{j{-}1}&\ ,\ \rep{j{-}1}{j}\ ;\ \rep{j}{j{-}1}\ , \!\!\!&\rep{j}{j}&\ ,\ \rep{j}{j{+}1}\ ;\ \rep{j{+}1}{j}\ ,\!\!\!&\rep{j{+}1}{j{+}1}&\ ;\ \rep{j{+}2}{j{+}1} &\quad\textrm{on}\ \vec{\Phi}\ ,& \\ \rep{v}{u} &\= &\rep{j{-}1}{j{-}1}&\ ; &\rep{j}{j}&\ ; &\rep{j{+}1}{j{+}1}& &\quad\textrm{on} \ \Phi_0&\ , \end{aligned} \end{equation} with some representations obviously missing for $j{<}2$. Let us treat the $\dot{\psi}\,T$ term in~(\ref{block}) as a perturbation and momentarily put it to zero, so that $\Omega^2_{(j)}$ is block-diagonal for the time being. Then, it is easy to see from (\ref{2spins}) and (\ref{3spins}) that $[\vec{V},\bar{N}]=[\vec{U},\bar{N}]=0$ and $[\vec{V},N]=0$, even though $[\vec{U},N]\neq0$ because $(\vec{L}{+}\vec{S})^2$ is not diagonal in our basis. Therefore, we have a degeneracy in~$m$. Furthermore, both $\bar{N}$ and $N$ decompose into at most three respectively five blocks with fixed values of~$v$ ranging from $j{-}2$ to~$j{+}2$ and separated by semicolons in~(\ref{uvreps}). Moreover, the $\bar{N}$~blocks are irreducible and trivially also carry a value of~$u{=}v$. In contrast, $N$ is not {\it simply\/} reducible; its $\vec{V}$ representations have multiplicity one, two or three. Only the $N$~blocks with extremal $v$~values in~(\ref{uvreps}) are irreducible. The other ones are reducible and contain more than one $\vec{U}$~representation, hence the $u$-spin distinguishes between their (two or three) irreducible $v$~subblocks. The only non-diagonal term in~$N$ is the $(\vec{L}{+}\vec{S})^2$ contribution, which couples different copies of the same $v$-spin to each other, but of course not to any $u{=}v$ block of~$\bar{N}$, and does not lift the $V_3{=}m$~degeneracy. As a consequence, the unperturbed fluctuation equations for $\Phi_0{=}\Phi_{(\bar{v})}$ and $\vec{\Phi}{=}\Phi_{(v,\alpha)}$ take the form (suppressing the $m$ index) \begin{equation} \begin{aligned} &\mathbbm{1}_{(\bar{v})}\bigl[ \partial_\tau^2\ +\ \bar\omega^2_{(\bar{v})}\bigr]\,\Phi_{(\bar{v})} \= 0 \qquad\quad\textrm{and}\quad\qquad \mathbbm{1}_{(v)}\bigl[ \partial_\tau^2\ +\ \omega^2_{(v,\alpha)}\bigr]\,\Phi_{(v,\alpha)} \= 0 \qquad\textrm{for}\quad \dot{\psi}=0\\[4pt] &\textrm{with}\qquad \bar{v} \in \{ j{-}1,\ j,\ j{+}1\} \qquad\quad\textrm{and}\quad\qquad v \in \{ j{-}2,\ j{-}1,\ j,\ j{+}1,\ j{+}2 \} \ , \end{aligned} \end{equation} where $\mathbbm{1}_{(v)}$ denotes a unit matrix of size~$2v{+}1$, and $\alpha$ counts the multiplicity of the $v$-spin representation in~$N$ (between one and three). According to~(\ref{2spins}) the unperturbed frequency-squares for $\bar{N}$ are the eigenvalues \begin{equation} \bar{\omega}^2_{(\bar{v})} \= 2(1{-}\psi)\,j(j{+}1) + 2(1{+}\psi)\,\bar{v}(\bar{v}{+}1) - 2(1{+}\psi)(1{-}\psi) \end{equation} with multiplicity $2\bar{v}{+}1$, hence we get \begin{equation} \begin{aligned} \bar{\omega}^2_{(j-1)} &\= 2\,\psi^2-4j\,\psi+2(2j^2{-}1)\ ,\\ \bar{\omega}^2_{(j)} &\= 2\,\psi^2+2(2j^2{+}2j{-}1)\,\\ \bar{\omega}^2_{(j+1)} &\= 2\,\psi^2+4(j{+}1)\,\psi +2(2j^2{+}4j{+}1)\ . \end{aligned} \end{equation} Considering $N$ in (\ref{3spins}), we can read off the eigenvalues at $v=j{\pm}2$ because in these two extremal cases $(\vec{L}{+}\vec{S})^2=\vec{U}^2$ is already diagonal in the $\bigl\{ |uvm\>\bigr\}$ basis. For the other $v$-values we must diagonalize a $2{\times}2$ or $3{\times}3$ matrix to find \begin{equation} \begin{aligned} \omega^2_{(j-2)} &\= \textrm{root of}\ Q_{j-2}(\lambda) \= -2(2j{-}1)\,\psi + 2(2j^2{-}2j{+}1)\ ,\\ \omega^2_{(j-1,\alpha)} &\= \textrm{two roots of}\ Q_{j-1}(\lambda)\ ,\\ \omega^2_{(j,\alpha)} &\= \textrm{three roots of}\ Q_j(\lambda)\ ,\\ \omega^2_{(j+1,\alpha)} &\= \textrm{two roots of}\ Q_{j+1}(\lambda)\ ,\\ \omega^2_{(j+2)} &\= \textrm{root of}\ Q_{j+2}(\lambda) \= 2(2j{+}3)\,\psi + 2(2j^2{+}6j{+}5)\ , \end{aligned} \end{equation} each with multiplicity $2v{+}1$, where $Q_v$ denotes a linear, quadratic or cubic polynomial.\footnote{ For $j{<}2$ some obvious modifications occur due to the missing of $v{<}0$ representations.} Let us now turn on the perturbation $\dot{\psi}\,T$, which couples $N$ with~$\bar{N}$, and consider the characteristic polynomial~${\cal P}_j(\lambda)$ of our fluctuation problem, \begin{equation} \begin{aligned} {\cal P}_j(\lambda) &\ :=\ \det\,\Bigl(\begin{smallmatrix} \bar{N}{-}\lambda & -\dot{\psi}T^\top \\[4pt] -\dot{\psi}T & N{-}\lambda \end{smallmatrix} \Bigr) \= \det (N{-}\lambda) \cdot \det\bigl[ (\bar{N}{-}\lambda) - \dot{\psi}^2\,T^\top (N{-}\lambda)^{-1} T \bigr] \\[4pt] &\= \bigl[{\textstyle\prod}_v \det (N_{(v)}{-}\lambda)\bigr] \cdot \det\bigl[ (\bar{N}{-}\lambda) - \dot{\psi}^2\, T^\top \{{\textstyle\bigoplus}_{v} (N_{(v)}{-}\lambda)^{-1}\}\,T\bigr] \ , \end{aligned} \end{equation} where we made use of \begin{equation} \< u\,v\,m|\,N\,|u'v'm'> \= \bigl(N_{(v)}\bigr)_{uu'}\,\delta_{vv'}\delta_{mm'}\ . \end{equation} Since $T$ furnishes an $su(2)$ representation (and not an intertwiner) it must be represented by square matrices and thus cannot connect different $v$ representations. Hence the perturbation does not couple different $v$ sectors but only links $N$ and $\bar{N}$ in a common $\bar{v}{=}v$~sector. Therefore, it does not affect the extremal sectors $v=j{\pm}2$. Moreover, switching to a diagonal basis $\{|\alpha vm\>\}$ for $N$ we can simplify to \begin{equation} T^\top \{{\textstyle\bigoplus}_{v} (N_{(v)}{-}\lambda)^{-1}\}\,T\bigr] \= {\textstyle\bigoplus}_{\bar{v}}\{T^\top (N{-}\lambda)^{-1} T\}_{(\bar{v})} \={\textstyle\bigoplus}_{\bar{v}}\Bigl\{ {\textstyle\sum}_\alpha (\omega^2_{(\bar{v},\alpha)}{-}\lambda)^{-1} \bigl(T^\top|\alpha\>\!\<\alpha|\,T\bigr)_{(\bar{v})}\Bigr\}\ . \end{equation} Observing that $\bigl(T^\top|\alpha\>\!\<\alpha|\,T\bigr)_{(\bar{v})}= -t_{\bar{v},\alpha}\bigl(\vec{T}^2\bigr)_{(\bar{v})}=8\,t_{\bar{v},\alpha}\mathbbm{1}_{(\bar{v})}$ with some coefficient functions $t_{\bar{v},\alpha}(\psi)$, with $\sum_\alpha t_{\bar{v},\alpha}=1$, we learn that the $V_3$ degeneracy remains intact and arrive at ($\bar{v}\in\{j{-}1,j,j{+}1\}$) \begin{equation} \label{charP} \begin{aligned} {\cal P}_j(\lambda) &\= \bigl[{\textstyle\prod}_v Q_v(\lambda)^{2v+1}\bigr] \cdot {\textstyle\prod}_{\bar{v}} \bigl\{(\bar{\omega}^2_{(\bar{v})}{-}\lambda) - 8\dot{\psi}^2 {\textstyle\sum}_\alpha t_{\bar{v},\alpha} (\omega^2_{(\bar{v},\alpha)}{-}\lambda)^{-1} \bigr\}^{2\bar{v}+1}\\[4pt] &\= (\omega^2_{(j-2)}{-}\lambda)^{2j-3}\cdot(\omega^2_{(j+2)}{-}\lambda)^{2j+5}\cdot {\textstyle\prod}_{\bar{v}} \bigl\{ (\bar{\omega}^2_{(\bar{v})}{-}\lambda)\,Q_{\bar{v}}(\lambda) - 8\dot{\psi}^2 P_{\bar{v}}(\lambda) \bigr\}^{2\bar{v}+1} \\[4pt] &\= (\omega^2_{(j-2)}{-}\lambda)^{2j-3}\cdot(\omega^2_{(j+2)}{-}\lambda)^{2j+5}\cdot {\textstyle\prod}_{\bar{v}} R_{\bar{v}}(\lambda)^{2\bar{v}+1}\ , \end{aligned} \end{equation} where $P_{\bar{v}}=Q_{\bar{v}}\sum_\alpha t_{\bar{v},\alpha} (\omega^2_{(\bar{v},\alpha)}{-}\lambda)^{-1}$ is a polynomial of degree one less than $Q_{\bar{v}}$ since all poles cancel, and $R_{\bar{v}}$ is a polynomial of one degree more. We list the polynomials $Q_v$, $P_{\bar{v}}$ and $R_{\bar{v}}$ for $j{\le}2$ in the Appendix. To summarize, by a successive basis change ($m'=-j,\ldots,j$ and $m=-v,\ldots,v$) \begin{equation} \bigl\{ |\mu\,p\,m'\> \bigr\} \quad\Rightarrow\quad \bigl\{ |\bar{v} m\>, |u v m\> \bigr\} \quad\Rightarrow\quad \bigl\{ |\bar{v} m\>, |\alpha v m\> \bigr\} \quad\Rightarrow\quad \bigl\{ |\beta v m\> \bigr\} \end{equation} we have diagonalized~(\ref{fluctop}) to \begin{equation} \label{diagonalized} \bigl[ \partial_\tau^2 - \Omega^2_{(j,v,\beta)} \bigr] \, \Phi_{(v,\beta)} \= 0 \qquad\textrm{with}\quad v\in\{j{-}2,j{-}1,j,j{+}1,j{+}2\} \ , \end{equation} where $\Omega^2_{(j,v,\beta)}$ are the distinct roots of the characteristic polynomial~${\cal P}_j$ in~(\ref{charP}), and (for $j{\ge}2$) the multiplicity label $\beta$ takes $1,3,4,3,1$ values, respectively: \begin{equation} \Omega^2_{(j,j\pm2)} = \omega^2_{(j\pm2)}\ ,\quad \Omega^2_{(j,j\pm1,\beta)} = \textrm{three roots of}\ R_{j\pm1}(\lambda)\ ,\quad \Omega^2_{(j,j,\beta)} = \textrm{four roots of}\ R_{j}(\lambda)\ . \end{equation} The reflection symmetry~(\ref{symmetry}) implies that $\Omega^2_{(v,j,\cdot)}(\psi)=\Omega^2_{(j,v,\cdot)}(-\psi)$. For $j{<}2$, obvious modifications occur due to the absence of some $v$~representations. We still have to discuss the gauge condition~(\ref{gauge2}), which can be cast into the form \begin{equation} 0 \= \mbox{$\partial$}_\tau\Phi_0 - \bigl[ \sfrac12(1{-}\psi)\vec{L}+\sfrac12(1{+}\psi)\vec{U}\bigr]\cdot\vec\Phi \= \mbox{$\partial$}_\tau\Phi_{(\bar{v},\bar{m})} - K_{\bar{v},\bar{m}}^{\ v,m,\alpha}(\psi)\,\Phi_{(v,m,\alpha)} \end{equation} with a $3(2j{+}1){\times}7(2j{+}1)$ linear (in~$\psi$) matrix function~$K$.\footnote{ We have to bring back the $m$ indices because the gauge condition is not diagonal in them.} Here the $v$~sum runs over $(j{-}1,j,j{+}1)$ only, since the gauge condition~(\ref{gauge2}) has components only in the middle three $v$~sectors, like the gauge-mode equation~(\ref{mu=0}). It does not restrict the extremal $v$~sectors~$v=j{\pm}2$, since these fluctuations do not couple to the gauge sector~$\Phi_0$ and are entirely physical. For the middle three $v$~sectors (labelled by~$\bar{v}$), the $\dot{\psi}\,T$ perturbation leads to a mixing of the $N$ modes with the $\bar{N}$ gauge modes, so their levels will avoid crossing. Performing the corresponding final basis change, the gauge condition takes the form \begin{equation} \label{gauge4} \bigl[ L_{\bar{v},\bar{m}}^{\ \bar{v}'\!,\bar{m}'\!,\beta}(\psi)\,\mbox{$\partial$}_\tau - M_{\bar{v},\bar{m}}^{\ \bar{v}'\!,\bar{m}'\!,\beta}(\psi) \bigr]\,\Phi_{(\bar{v}'\!,\bar{m}'\!,\beta)}\=0 \end{equation} with certain $3(2j{+}1){\times}10(2j{+}1)$ matrix functions $L$ and~$M$. This linear equation represents conditions on the normal mode functions $\Phi_{(\bar{v},\bar{m},\beta)}$ and defines a $7(2j{+}1)$-dimensional subspace of physical fluctuations, which of course still contains a $3(2j{+}1)$-dimensional subspace of gauge modes. For $j{<}1$, these numbers are systematically smaller. Together with the two extremal $v$~sectors, we end up with $(7-3+2)(2j{+}1)=6(2j{+}1)$ physical degrees of freedom for any given value of~$j({\ge}2)$, as advertized earlier. We conclude this section with more details for the simplest examples, which are constant backgrounds and $j{=}0$ backgrounds. For the vacuum background, say $\psi=-1$, which is isospin degenerate, one gets \begin{equation} \bigl( \partial_\tau^2 -\sfrac12\vec{L}^2 -\sfrac12(\vec{L}{+}\vec{S})^2 \bigr)\,\vec{\Phi} \=0, \qquad \vec{L}{\cdot}\vec{\Phi} = 0\ ,\qquad \Phi_0 =0\ . \end{equation} It yields the positive eigenfrequency-squares \begin{equation} \omega^2_{(j,u')} \= 2j(j{+}1) + 2u'(u'{+}1) \= \begin{cases} \ 4j^2 \ \textrm{at}\ j{{\ge}1} & \quad\textrm{for}\quad u'=j{-}1 \\ \ 4j(j{+}1) & \quad\textrm{for}\quad u'=j \\ \ 4(j{+}1)^2 & \quad\textrm{for}\quad u'=j{+}1 \end{cases} \end{equation} for $j=0,\sfrac12,1,\ldots$, but the $\vec{L}{\cdot}\vec{\Phi}=0$ constraint removes the $u'{=}j$ modes. Clearly, all (constant) eigenfrequency-squares are positive, hence the vacuum is stable. For the ``meron/sphaleron'' background, $\psi\equiv0$, one has \begin{equation} \bigl( \partial_\tau^2 -\sfrac12\vec{L}^2 -\sfrac12(\vec{L}{+}\vec{T}{+}\vec{S})^2 -2 \bigr)\,\vec{\Phi} \=0, \qquad \bigl(\vec{L}+\sfrac12\vec{T}\bigr)\cdot\vec{\Phi} = 0\ ,\qquad \Phi_0 =0\ . \end{equation} In this case, we read off \begin{equation} \omega^2_{(j,v)} +2 \= 2j(j{+}1) + 2v(v{+}1) \= \begin{cases} \ 4(j^2{-}j{+}1) & \quad\textrm{for}\quad v=j{-}2 \qquad (0\ \textrm{to}\ 1\ \textrm{times}) \\ \ 4j^2 & \quad\textrm{for}\quad v=j{-}1 \qquad (0\ \textrm{to}\ 2\ \textrm{times}) \\ \ 4j(j{+}1) & \quad\textrm{for}\quad v=j \qquad\quad\ (1\ \textrm{to}\ 3\ \textrm{times}) \\ \ 4(j{+}1)^2 & \quad\textrm{for}\quad v=j{+}1 \qquad (1\ \textrm{to}\ 2\ \textrm{times}) \\ \ 4(j^2{+}3j{+}3) & \quad\textrm{for}\quad v=j{+}2 \qquad (1\ \textrm{times}) \end{cases}\ , \end{equation} but the constraint removes one copy from each of the three middle cases (and less when $j{<}1$). We end up with a spectrum $\{\omega^2\}=\{-2,1,6,7,10,\ldots\}$ with certain degeneracies~\cite{Hosotani,Volkov}. The single non-degenerate negative mode $\omega^2_{(0,0)}{=}{-}2$ is a singlet, $\Phi_a^p=\delta_a^p\phi(\tau)$, and it corresponds to rolling down the local maximum of the double-well potential. The meron is stable against all other perturbations. For a time-varying background, the natural frequencies $\Omega_{(j,v,\beta)}$ inherit a $\tau$ dependence from the background~$\psi(\tau)$. Direct diagonalization is still possible for $j{=}0$, where we should solve \begin{equation} \begin{aligned} & \partial_\tau\Phi_0 - \sfrac12(1{+}\psi)\vec{T}{\cdot}\vec{\Phi} \= 0 \ ,\\[4pt] & \bigl[\partial_\tau^2+2(1{+}\psi)^2\bigr] {\Phi}_0 - \dot{\psi}\,\vec{T}{\cdot}\vec{\Phi} \= 0\ ,\\[4pt] & \bigl[ \partial_\tau^2 +2(3\psi^2{-}1) -\sfrac14(1{+}\psi)(2{-}\psi)(\vec{S}{+}\vec{T})^2 \bigr]\ \vec\Phi - \dot{\psi}\,\vec{T}\,\Phi_0 \= 0\ , \end{aligned} \end{equation} with \begin{equation} (\vec{S}{+}\vec{T})^2\=\vec{V}^2\=-4\,v(v{+}1)\=0,-8,-24 \qquad\textrm{for}\quad v=0,1,2\ . \end{equation} It implies the unperturbed frequencies (suppressing the $j$ index) \begin{equation} \label{unperturbed} \bar\omega_{(1)}^2 = 2(\psi{+}1)^2\ \ (3\times)\ ,\quad \omega_{(0)}^2 = 2(3\psi^2{-}1)\ \ (1\times)\ ,\quad \omega_{(1)}^2 = 2(2\psi^2{+}\psi{+}1)\ \ (3\times) ,\quad \omega_{(2)}^2 = 2(3\psi{+}5)\ \ (5\times) \end{equation} for \begin{equation} \begin{aligned} (\Phi_0)^p &\equiv \bigl(\Phi_{(\bar{v}=1)}\bigr)^p\ =:\ \delta^{pb}\bar\phi_b \ ,\\ (\vec\Phi)_a^p \ &\equiv \bigl(\Phi_{(0)}+\Phi_{(1)}+\Phi_{(2)}\bigr)^p_a\ =:\ \phi\,\delta_a^p + \epsilon^p_{\ ab}\,\phi_b + (\phi_{(ab)}{-}\delta_{ab}\phi)\delta^{bp}\ , \end{aligned} \end{equation} as long as $\dot{\psi}$ is ignored. There are no $v$-spin multiplicities (larger than one) here. Turning on $\dot{\psi}$ and observing that $(\vec{T}{\cdot}\vec\Phi)^p\sim\delta^{pb}\phi_b$, the characteristic polynomial of the coupled $12{\times}12$ system in the $|uvm\>$ basis reads \begin{equation} {\cal P}_0(\lambda) \= \det \begin{pmatrix} (\bar{\omega}_{(1)}^2{-}\lambda)\mathbbm{1}_3 & 0 & -\dot{\psi}\,T_{(1)}^\top & 0 \\[4pt] 0 & (\omega_{(0)}^2{-}\lambda)\mathbbm{1}_1 & 0 & 0 \\[4pt] -\dot{\psi}\,T_{(1)} & 0 & (\omega_{(1)}^2{-}\lambda)\mathbbm{1}_3 & 0 \\[4pt] 0 & 0 & 0 & (\omega_{(2)}^2{-}\lambda)\mathbbm{1}_5 \end{pmatrix}\ . \end{equation} Specializing the general discussion above to $j{=}0$, we find just $t_1{=}1$ so that $P_1{=}1$ and arrive at \begin{equation} \begin{aligned} {\cal P}_0(\lambda) &\= (\omega_{(0)}^2{-}\lambda)^1 (\omega_{(1)}^2{-}\lambda)^3 (\omega_{(2)}^2{-}\lambda)^5 \bigl[(\bar{\omega}_{(1)}^2{-}\lambda) - 8\dot{\psi}^2(\omega_{(1)}^2{-}\lambda)^{-1} \bigr]^3 \\ &\= (\omega_{(0)}^2{-}\lambda) (\omega_{(2)}^2{-}\lambda)^5 \bigl\{ (\bar{\omega}_{(\bar{1})}^2{-}\lambda)(\omega_{(1)}^2{-}\lambda) - 8\dot{\psi}^2 \bigr\}^3 \ . \end{aligned} \end{equation} We see that the frequencies $\Omega_{(0)}^2{=}\omega_{(0)}^2$ and $\Omega_{(2)}^2{=}\omega_{(2)}^2$ are unchanged and given by~(\ref{unperturbed}), while the gauge mode $\bar{\omega}_{(\bar{1})}^2$ gets entangled with the (unphysical) $v{=}1$ mode to produce the pair \begin{equation} \Omega^2_{(1,\pm)} \= \sfrac12(\bar\omega_{(\bar{1})}^2{+}\omega_{(1)}^2) \,\pm\sqrt{\sfrac14(\bar\omega_{(\bar{1})}^2{+}\omega_{(1)}^2)^2-\bar\omega_{(\bar{1})}^2\omega_{(1)}^2+8\dot{\psi}^2} \= 3\psi^2{+}3\psi{+}2\, \pm\sqrt{\psi^2(\psi{-}1)^2+8\dot{\psi}^2} \end{equation} with a triple degeneracy. There are avoided crossings at $\psi{=}0$ and $\psi{=}1$. Removing the unphysical and gauge modes in pairs, we remain with the singlet mode $\Omega_{(0,0)}^2$ and the fivefold-degenerate $\Omega_{(0,2)}^2$. For all higher spins $j{>}0$, analytic expressions for the natural frequencies $\Omega_{(j,v,\beta)}$ now require merely solving a few polynomial equations of order four at worst. We have done so up to $j{=}2$ and list them in the Appendix but refrain from giving further explicit examples here. Below we display the cases of $j{=}0$ and $j{=}2$, with similar coloring for like $v$~values, whose curves avoid crossing each other. One can see that some of the normal modes dip into the negative regime, i.e.~their frequency-squares become negative, for a certain fraction of the time~$\tau$. Because of this and, quite generally, due to the $\tau$ variability of the natural frequencies, it is not easy to predict the long-term evolution of the fluctuation modes. Clearly, the stability of the zero solution $\Phi{\equiv}0$, equivalent to the linear stability of the background Yang--Mills configuration, is not simply decided by the sign of the $\tau$-average of the corresponding frequency-square. \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{om2zero_51.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{om2zero_99.pdf} \\[12pt] \includegraphics[width = 0.35\paperwidth]{om2zero_01.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{om2zero_50.pdf} \caption{Plots of $\Omega^2_{(0,v,\beta)}(\tau)$ over one period, for different values of $k^2$: \newline \indent\qquad\qquad\ $0.51$ (top left), $0.99$ (top right), $1.01$ (bottom left) and $5$ (bottom right).} \end{figure} \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{om2two_505.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{om2two_550.pdf} \\[12pt] \includegraphics[width = 0.35\paperwidth]{om2two_999.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{om2two_001.pdf} \caption{Plots of $\Omega^2_{(2,v,\beta)}(\tau)$ over one period, for different values of $k^2$: \newline \indent\qquad\qquad\ $0.505$ (top left), $0.550$ (top right), $0.999$ (bottom left) and $1.001$ (bottom right).} \end{figure} \section{Stability analysis: stroboscopic map and Floquet theory} \noindent The diagonalized linear fluctuation equation~(\ref{diagonalized}) represents a bunch of Hill's equations, where the frequency-squared is a root of a polynomial of order up to four with coefficients given by a polynomial of twice that order in Jacobi elliptic functions. A unique solution requires fixing two initial conditions, and so for each fluctuation~$\Phi_{(j,v,\beta)}$ there is a two-dimensional solution space. It is well known that Hill's equation, e.g.~in the limit of Mathieu's equation, displays parametric resonance phenomena, which can stabilize otherwise unstable systems or destabilize otherwise stable ones. For oscillating dynamical systems with periodically varying frequency, there exist some general tools to analyze linear stability. Switching to a Hamiltonian picture and to phase space, it is convenient to transform the second-order differential equation into a system of two coupled first-order equations (suppressing all quantum numbers), \begin{equation} \label{first-order} \bigl[\partial^2_\tau-\Omega^2(\tau)\bigr] \Phi(\tau) \= 0 \qquad\Leftrightarrow\qquad \partial_\tau \begin{pmatrix} \Phi \\[4pt] \dot\Phi \end{pmatrix} \= \begin{pmatrix} 0 & 1 \\[4pt] -\Omega^2 & 0 \ \end{pmatrix} \begin{pmatrix} \Phi \\[4pt] \dot\Phi \end{pmatrix} \ =:\ \mathrm{i}\,\widehat\Omega(\tau)\,\begin{pmatrix} \Phi \\[4pt] \dot\Phi \end{pmatrix}\ , \end{equation} where the frequency~$\Omega(\tau)$ is $T$-periodic (sometimes $\frac{T}{2}$-periodic) in~$\tau$. The solution to this first-order system is formally given by \begin{equation} \begin{pmatrix} \Phi \\[4pt] \dot\Phi \end{pmatrix}(\tau) \= {\cal T} \exp\,\Bigl\{ \int_0^\tau \!\mathrm{d}\tau'\ \mathrm{i}\,\widehat\Omega(\tau') \Bigr\} \, \begin{pmatrix} \Phi \\[4pt] \dot\Phi \end{pmatrix}(0) \ , \end{equation} where ${\cal T}$ denotes time ordering. Because of the time dependence of $\Omega$, the time evolution operator above is not homogeneous thus does not constitute a one-parameter group, except when the propagation interval is an integer multiple of the period~$T$. For $\tau{=}T$, one speaks of the stroboscopic map~\cite{Arnold} \begin{equation} M\ :=\ {\cal T} \exp\,\Bigl\{ \int_0^T \!\mathrm{d}\tau\ \mathrm{i}\,\widehat\Omega(\tau) \Bigr\} \qquad\Rightarrow\qquad \begin{pmatrix} \Phi \\[4pt] \dot\Phi \end{pmatrix}(nT) \= M^n \begin{pmatrix} \Phi \\[4pt] \dot\Phi \end{pmatrix}(0)\ . \end{equation} The linear map~$M$ is a functional of the chosen background solution~$\psi$ and hence depends on its parameter~$E$ or~$k$. This background is Lyapunov stable if the trivial solution $\Phi{\equiv}0$ is, which is decided by the two eigenvalues $\mu_1$ and $\mu_2$ of~$M$. Since the system is Hamiltonian, $\det M{=}1$, and we have three cases: \begin{equation} \begin{aligned} |\mathrm{tr}\,M| > 2 &\quad\Leftrightarrow\quad \mu_i\in\mathds R &\quad\;\Leftrightarrow\quad& \textrm{hyperbolic/boost} &\quad\Leftrightarrow\quad& \textrm{strongly unstable} \ ,\\ |\mathrm{tr}\,M| = 2 &\quad\Leftrightarrow\quad \mu_i=\pm1 &\quad\Leftrightarrow\quad& \textrm{parabolic/translation} &\quad\Leftrightarrow\quad& \textrm{marginally stable}\ , \\ |\mathrm{tr}\,M| < 2 &\quad\Leftrightarrow\quad \mu_i\in\textrm{U}(1) &\quad\Leftrightarrow\quad& \textrm{elliptic/rotation} &\quad\Leftrightarrow\quad&\textrm{strongly stable}\ . \end{aligned} \end{equation} Clearly, $|\mathrm{tr}\,M|$ determines the linear stability of our classical solution. Let us thus try to evaluate the trace of the stroboscopic map~$M$, making use of the special form of the matrix~$\widehat\Omega$, \begin{equation} \begin{aligned} \mathrm{tr}\,M &\= \sum_{n=0}^\infty \mathrm{i}^n \int_0^T\!\!\mathrm{d}\tau_1\int_0^{\tau_1}\!\!\!\mathrm{d}\tau_2\ \ldots\int_0^{\tau_{n-1}}\!\!\!\!\mathrm{d}\tau_n\ \mathrm{tr}\,\bigl[ \widehat\Omega(\tau_1)\,\widehat\Omega(\tau_2)\cdots\widehat\Omega(\tau_n)\bigr] \\[4pt] &\= 2\ +\ \sum_{n=1}^\infty(-1)^n \int_0^T\!\!\mathrm{d}\tau_1\int_0^{\tau_1}\!\!\!\mathrm{d}\tau_2\ \ldots\int_0^{\tau_{n-1}}\!\!\!\!\mathrm{d}\tau_n\ H_n(\tau_1,\tau_2,\ldots,\tau_n)\,\Omega^2(\tau_1)\,\Omega^2(\tau_2)\,\cdots\Omega^2(\tau_n) \\[4pt] \textrm{with}& \quad H_n(\tau_1,\tau_2,\ldots,\tau_n) \= (\tau_1{-}\tau_2)(\tau_2{-}\tau_3)\cdots(\tau_{n-1}{-}\tau_n)(\tau_n{-}\tau_1{+}1) \quad\textrm{and}\quad H_1(\tau_1)=1\ . \end{aligned} \end{equation} It is convenient to scale the time variable such as to normalize the period to unity, \begin{equation} \tau = T\, x \qquad\quad\textrm{and}\quad\qquad \Omega^2(Tx) =: \omega^2(x)\ ,\quad H(\{Tx\})=:h(\{x\}) \ , \end{equation} hence \begin{equation} \label{Ansum} \begin{aligned} \mathrm{tr}\,M &\= 2\ +\ \sum_{n=1}^\infty \bigl(-T^2\bigr)^n \int_0^1\!\!\mathrm{d} x_1\int_0^{x_1}\!\!\!\mathrm{d} x_2\ \ldots\int_0^{x_{n-1}}\!\!\!\!\mathrm{d} x_n\ h_n(x_1,x_2,\ldots,x_n)\,\omega^2(x_1)\,\omega^2(x_2)\,\cdots\omega^2(x_n) \\[4pt] &\= \sum_{n=0}^\infty \frac{2}{(2n)!}\,M_n\,\bigl(-T^2\bigr)^n \ =:\ 2 - M_1 T^2 + \sfrac{1}{12}M_2 T^4 - \sfrac{1}{360}M_3 T^6 + \sfrac{1}{20160}M_4 T^8 - \ldots\ . \end{aligned} \end{equation} It is impossible to evaluate the integrals $M_n$ without explicit knowledge of~$\omega^2(x)$. As a crude guess, we replace the weight function by its (constant) average value \begin{equation} \<h_n\> \ :=\ \frac{1}{n!} \int_0^1\!\!\mathrm{d} x_1\int_0^{x_1}\!\!\!\mathrm{d} x_2\ \ldots\int_0^{x_{n-1}}\!\!\!\!\mathrm{d} x_n\ h_n(x_1,x_2,\ldots,x_n) \= \frac{2\,n!}{(2n)!} \end{equation} and obtain \begin{equation} M_n \= \frac{(2n)!}{2}\,\<h_n\> \int_0^1\!\!\mathrm{d} x_1\int_0^{x_1}\!\!\!\mathrm{d} x_2\ \ldots\int_0^{x_{n-1}}\!\!\!\!\mathrm{d} x_n\ \prod_{i=1}^n \omega^2(x_i) \= \Bigl( \int_0^1\!\!\mathrm{d} x\ \omega^2(x) \Bigr)^n \ =:\ \< \,\omega^2\>^n\ , \end{equation} which yields \begin{equation} \mathrm{tr}\,M \= 2\,\sum_{n=0}^\infty \frac{(-1)^n}{(2n)!}\,\<\,\omega^2\>^n\,T^{2n} \= 2\,\cos\bigl(\sqrt{\<\,\omega^2\>}\,T\bigr)\ . \end{equation} This expression indicates stability as long as $\<\omega^2\>>0$. However, the result for the $j{=}0$ singlet mode $\omega^2=\Omega^2_{(0,0)}$ in (\ref{j0average}) below already shows that the averaged frequency-squared may turn negative in certain domains thus changing the cos into a cosh there. To do better, let us look at the individual terms~$M_n$ in~(\ref{Ansum}) for the simplest case of the SO(4) singlet fluctuation, i.e.~$\Omega^2_{(0,0)}=6\psi^2{-}2$ in~(\ref{unperturbed}). Its average frequency-square is easily computed to be \begin{equation} \label{j0average} \<\,\Omega_{(0,0)}^2 \> \= \frac{1}{\epsilon^2}\Bigl(6 \frac{E(k)}{K(k)}+4k^2-5\Bigr)\ , \end{equation} where $E(k)$ and $K(k)$ denote the second and first complete elliptic integrals, respectively. Plotting this expression as a function of the modulus~$k$, we see that it becomes negative only in a very narrow range around $k{=}1$, namely for $|k{-}1|\lesssim0.00005$. \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{om2zeroavg1.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{om2zeroavg2.pdf} \caption{Plot of $\<\Omega^2_{(0,0)}\>$ as a function of~$k$, with detail on the right.} \end{figure} We have only been able to analytically evaluate (with $k{<}1$ for simplicity) \begin{equation} M_1 \= \<\,\Omega_{(0,0)}^2 \> \qquad\quad\textrm{and}\quad\qquad M_2 \= \<\,\Omega_{(0,0)}^2 \> ^2\ -\ \frac{1}{\epsilon^4}\Bigl( 9\frac{2{-}k^2}{K(k)^2} - 27\frac{E(k)}{K(k)^3} + \frac{9\,\pi^2}{4\,K(k)^4} \Bigr)\ , \end{equation} which does not suffice to rule out instability. Indeed, numerical studies show that $M_n$ as a function of~$k$ looses its positivity in a range around $k{=}1$ which increases with~$n$, where the series~(\ref{Ansum}) ceases to be alternating. Moreover, even in the limit of a very large background amplitude, $k^2\to\frac12$, we find that \begin{equation} \<\,\Omega_{(0,0)}^2 \>\ \to\ \frac{24\,\pi^2}{\epsilon^2\,\Gamma(\frac14)^4}\ \approx\ \frac{1.37}{\epsilon^2} \qquad\Rightarrow\qquad \sqrt{\<\,\Omega^2\>}\,T\ \to\ \sqrt{24\,\pi}\ \approx\ 8.68\ , \end{equation} implying that we must push the series in~(\ref{Ansum}) at least to $O(M_{10}T^{20})$, even though it turns out that $M_n<\<\,\Omega^2_{(0,0)}\>^n$ at $k^2=\frac12$ for $n>1$. For a more complete analysis of linear stability in an oscillating system with time-dependent frequency we can take recourse to Floquet theory. It tells us that a general fundamental matrix solution \begin{equation} \widehat\Phi(\tau) \= \begin{pmatrix} \Phi_1 & \Phi_2 \\[4pt] \dot\Phi_1 & \dot\Phi_2 \end{pmatrix}(\tau) \qquad\Rightarrow\qquad \partial_\tau \widehat\Phi(\tau) \= \mathrm{i}\,\widehat\Omega(\tau)\,\widehat\Phi(\tau) \end{equation} of our system~(\ref{first-order}) with some initial condition $\widehat\Phi(0)=\widehat\Phi_0$ can be expressed in so-called Floquet normal form as \begin{equation} \widehat\Phi(\tau) \= Q(\tau)\;\mathrm{e}^{\tau R} \qquad\textrm{with}\qquad Q(\tau{+}2T) \= Q(\tau)\ , \end{equation} where $Q(\tau)$ and $R$ are real $2{\times}2$ matrices, so that the time dependence of the frequency can be transformed away by a change of coordinates, \begin{equation} \Psi(\tau) \ :=\ Q(\tau)^{-1} \widehat\Phi(\tau) \qquad\Rightarrow\qquad \partial_\tau \Psi(\tau) \= R\,\Psi(\tau)\ . \end{equation} Due to the identity \begin{equation} \widehat\Phi(\tau{+}T) \= \widehat\Phi(\tau)\,\widehat\Phi(0)^{-1}\,\widehat\Phi(T) \= \widehat\Phi(T)\,\widehat\Phi(0)^{-1}\,\widehat\Phi(\tau) \= M\,\widehat\Phi(\tau) \end{equation} we see that our stroboscopic map~$M$ is nothing but the monodromy, and \begin{equation} M^2 \= \widehat\Phi(2T)\,\widehat\Phi(0)^{-1} \= Q(0)\,\widehat\Phi(0)^{-1}\,\widehat\Phi(2T)\,Q(0)^{-1} \= Q(0)\,\mathrm{e}^{2 R T}\,Q(0)^{-1}\ , \end{equation} so that its eigenvalues (or characteristic multipliers) \begin{equation} \mu_i = \mathrm{e}^{\rho_i T} \qquad\textrm{for}\quad i=1,2 \end{equation} define a pair of (complex) Floquet exponents $\rho_i$ whose real parts are the Lyapunov exponents. Since $\mu_1\mu_2=1$ implies that $\rho_1{+}\rho_2=0$, our system is linearly stable if and only if both eigenvalues~$\rho_i$ of~$R$ are purely imaginary (or zero). Generally it is impossible to find analytically the monodromy pertaining to a normal mode~$\Phi_{(j,v,\beta)}$.\footnote{ An exception is the SO(4) singlet perturbation~$\Phi_{(0,0)}$, to be treated in the following section.} However, we can evaluate it numerically for a number of examples. Before doing so, let us estimate at which energies~$E$ or, rather, moduli~$k$, possible resonance frequencies might occur. To this end, we determine the period-average of the natural frequency $\Omega_{(j,v,\beta)}$ and compare it to its modulation frequency~$\sfrac{2\pi}{T}$. If we model \begin{equation} \Omega^2(\tau) \ \approx\ \<\,\Omega^2\> \,\bigl(1+h(\tau)\bigr) \qquad\textrm{with}\qquad \<\,\Omega^2\> = \sfrac{1}{T}\smallint_0^T \!\mathrm{d}\tau\ \Omega^2(\tau) \quad\quad\textrm{and}\quad\quad h(\tau) \ \propto\ \cos(2\pi\tau/T) \ , \end{equation} where $T=4\,\epsilon\,K(k)$, then the resonance condition is met for \begin{equation} \sqrt{\<\Omega^2\>} \= \ell\,\frac{\pi}{T} \qquad\Rightarrow\qquad k=k_\ell(j,v,\beta)\qquad\textrm{for}\quad \ell=1,2,3,\ldots\ . \end{equation} Since this model reproduces only the rough features of $\Omega^2(\tau)$, we expect potential instability due to parametric resonance effects in a band around or near the values~$k_\ell$. Our expectation is confirmed by precise numerical evaluation of various monodromies as a function of~$k$. Below we display, together with the would-be resonant values~$k_\ell$, the function $\mathrm{tr} M(k)$ for the sample cases of $(j,v)=(2,0)$ and $(2,2)$. \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{trM20a.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{trM20b.pdf} \caption{Plot of $\mathrm{tr}\,M(k)$ for $(j,v)=(2,0)$, with detail on the right. Would-be resonances marked in red.} \end{figure} \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{trM22_1.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{trM22_2.pdf} \\[8pt] \includegraphics[width = 0.35\paperwidth]{trM22_3.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{trM22_4.pdf} \caption{Plots of $\mathrm{tr}\,M(k)$ for $(j,v)=(2,2)$ and $\beta=1,2,3,4$. Would-be resonances marked in red.} \end{figure} One sees that, on both sides of the critical value of $E{=}\sfrac12$ (or $k{=}1$), corresponding to the double-well local maximum, the $k_\ell$ values accumulate at the critical point. But while for $k{>}1$ (energy below the critical point) $\mathrm{tr} M(k)$ oscillates between values close to $2$ in magnitude and thus exponential growth is rare and mild, for $k{<}1$ (energy above the critical point) the oscillatory behavior of $\mathrm{tr} M(k)$ comes with an amplitude exceeding~2 and growing with energy. Hence, in this latter regime stable and unstable bands alternate. This is supported by long-term numerical integration, as we demonstrate in Figure~9 by plotting $\Phi(\tau)$ for $(j,v,\beta)=(2,2,1)$ with initial values $\Phi(0){=}1$ and $\dot\Phi(0){=}0$ on both sides of the first transition from instability to stability for $\mathrm{tr}\,M_{(2,2,1)}$ shown in Figure~8 (at the highest value of~$E$ or the lowest value of~$k$). \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{phi_22_k073198.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{phi_22_k073199.pdf} \caption{Plot of $\Phi(\tau)$ for $(j,v,\beta)=(2,2,1)$ and $k{=}0.73198$ (left) and $k{=}0.73199$ (right).} \end{figure} Most relevant for the cosmological application is the regime of very large energies, $E\to\infty$ (or $k\to 1/\sqrt{2}$). In this limit, we observe the following universal behavior. Because the period~$T$ collapses with $\epsilon{=}\sqrt{k^2{-}1/2}$, we rescale \begin{equation} \sfrac{\tau}{\epsilon} = z \in [0,4K(\sfrac12)]\quad ,\qquad \epsilon\,\psi = \tilde\psi\quad,\qquad \epsilon^2\dot\psi = \partial_z\tilde\psi\quad,\qquad \epsilon^2\Omega^2 = \tilde\Omega^2\quad,\qquad \epsilon^2\lambda = \tilde\lambda \end{equation} so that the tilded quantities remain finite in the limit, and find, with $\bar\omega^2_{(\bar{v})}\to 2\psi^2$,\footnote{ For the cases $(j,v)=(0,1)$ and $(1,0)$, the factor $\tilde\lambda$ is missing; for $(j,v)=(0,0)$, one only has $R=Q\sim(\tilde\lambda{-}6\tilde\psi^2)$.} \begin{equation} \begin{aligned} &Q_{(v\pm2)}\ \sim\ \tilde\lambda\ , & \\ &Q_{(v\pm1)}\ \sim\ \tilde\lambda\,(\tilde\lambda-4\tilde\psi^2)\ , & &R_{(v\pm1)}\ \sim\ \tilde\lambda\,\bigl[(\tilde\lambda-2\tilde\psi^2)(\tilde\lambda-4\tilde\psi^2)-8(\mbox{$\partial$}_z\tilde\psi)^2\bigr]\ ,\\ &Q_{(v)}\ \quad\sim\ \tilde\lambda\,(\tilde\lambda-4\tilde\psi^2)(\tilde\lambda-6\tilde\psi^2)\ ,\!\quad& &R_{(v)}\ \quad\sim\ \tilde\lambda\,\bigl[(\tilde\lambda-2\tilde\psi^2)(\tilde\lambda-4\tilde\psi^2)-8(\mbox{$\partial$}_z\tilde\psi)^2\bigr](\tilde\lambda-6\tilde\psi^2)\ , \end{aligned} \end{equation} because all $j$-dependent terms in the polynomials are subleading and drop out in the limit. Factorizing the $R$~polynomials, we find the four universal natural frequency-squares \begin{equation} \tilde\Omega^2_1 = 0\ ,\qquad \tilde\Omega^2_2 = 3\,\tilde\psi^2-\sqrt{\tilde\psi^4+8(\mbox{$\partial$}_z\tilde\psi)^2}\ ,\qquad \tilde\Omega^2_3 = 3\,\tilde\psi^2+\sqrt{\tilde\psi^4+8(\mbox{$\partial$}_z\tilde\psi)^2}\ ,\qquad \tilde\Omega^2_4 = 6\,\tilde\psi^2\ . \end{equation} One must pay attention, however, to the fact that the avoided crossings disappear in the $\epsilon\to0$ limit. Therefore, the correct limiting frequencies to input into \begin{equation} \bigl[ \mbox{$\partial$}_z - \tilde\Omega^2_{(j,v,\beta)} \bigr]\,\tilde\Phi_{(j,v,\beta)} \= 0 \end{equation} are \begin{equation} \begin{aligned} &\tilde\Omega^2_{(j,j\pm2)}\ \ = 0\ ,\\ &\tilde\Omega^2_{(j,j\pm1,\beta)} \in \bigl\{ \textrm{min}(\tilde\Omega^2_1,\tilde\Omega^2_2),\ \textrm{max}(\tilde\Omega^2_1,\tilde\Omega^2_2),\ \tilde\Omega^2_3 \bigr\}\ ,\\ &\tilde\Omega^2_{(j,j,\beta)} \ \ \ \in \bigl\{ \textrm{min}(\tilde\Omega^2_1,\tilde\Omega^2_2),\ \textrm{max}(\tilde\Omega^2_1,\tilde\Omega^2_2),\ \textrm{min}(\tilde\Omega^2_3,\tilde\Omega^2_4),\ \textrm{max}(\tilde\Omega^2_3,\tilde\Omega^2_4) \bigr\}\ , \end{aligned} \end{equation} of which we show below the last list as a function of~$z$. \begin{figure}[h!] \centering \includegraphics[width = 0.5\paperwidth]{om2universal.pdf} \caption{Plot of the universal limiting natural frequency-squares $\tilde\Omega^2_{(j,v,\beta)}$ for $v{=}j$ and $\beta=1,2,3,4$.} \end{figure} The monodromies are easily computed numerically,\footnote{ For the cases $(j,v)=(0,1)$ and $(1,0)$ one gets $\{56.769,\ -1.659\}$; for $(j,v)=(0,0)$ we have $\mathrm{tr}\,M=2$.} \begin{equation} \begin{aligned} &\mathrm{tr}\,M_{(j,j\pm2)}(E{\to}\infty)\ \ \ = 2\ ,\\ &\mathrm{tr}\,M_{(j,j\pm1,\beta)}(E{\to}\infty)\ \in \bigl\{ 306.704,\ -1.842,\ -1.659 \bigr\}\ ,\\ &\mathrm{tr}\,M_{(j,j,\beta)}(E{\to}\infty) \ \ \ \ \in \bigl\{ 306.704,\ -1.842,\ 2.462,\ -1.067 \bigr\}\ , \end{aligned} \end{equation} in agreement with the figures above. In particular, the extremal $v$-values become marginally stable, while part of the non-extremal cases are unstable for high energies. Of course, for each non-extremal value of~$v$ we still have to project out unphysical modes by imposing the gauge condition~(\ref{gauge4}). However, in the $12(2j{+}1)$-dimensional fluctuation space the gauge condition has rank~$3(2j{+}1)$ while we see that (for $j{\ge}2$) in total $4(2j{+}1)$ normal modes are unstable at high energy. Therefore, the projection to physical modes cannot remove all instabilities. We must conclude that, for sufficiently high energy~$E$, some fluctuations grow exponentially, implying that the solution $\Phi{\equiv}0$ is linearly unstable, and thus is the Yang--Mills background. \section{Singlet perturbation: exact treatment} \noindent Even though the Floquet representation helped to reduce the long-time behavior of the perturbations to the analysis of a single period~$T$, it normally does not give us an exact solution to Hill's equation. However, for the SO(4) singlet fluctuation around $\psi(\tau)$, we can employ the fact that $\dot{\psi}$ trivially solves the fluctuation equation, \begin{equation} \label{timeshift} (\dot\psi)^{\cdot\cdot} = (\ddot\psi)^{\cdot} = -\bigl(V'(\psi)\bigr)^{\cdot} = -V''(\psi)\,\dot{\psi} \= -(6\psi^2{-}2)\,\dot\psi \= -\Omega^2_{(0,0)}(\tau)\,\dot\psi\ , \end{equation} with a frequency function which is $\frac{T}{2}$-periodic. This implies that all fluctuation modes are $T$-periodic. With the knowledge of an explicit solution to the fluctuation equation we can reduce the latter to a first-order equation and solve that one to find a second solution. The normalizations are arbitrary, so we choose \begin{equation} \Phi_1(\tau)\=-\sfrac{\epsilon^3}{k}\,\dot{\psi}(\tau) \qquad\quad\textrm{and}\quad\qquad \Phi_2(\tau) \= \Phi_1(\tau)\,\int^\tau\frac{\mathrm{d}\sigma}{\Phi_1(\sigma)^2} \= -\sfrac{k}{\epsilon^3}\,\dot{\psi}(\tau)\,\int^\tau \frac{\mathrm{d}\sigma}{\dot{\psi}^2(\sigma)}\ , \end{equation} which are linearly independent since \begin{equation} W(\Phi_1,\Phi_2)\ \equiv\ \Phi_1\dot\Phi_2-\Phi_2\dot\Phi_1 \= 1\ . \end{equation} For simplicity, we restrict ourselves to the energy range $\sfrac12{<}E{<}\infty$, i.e.~$1{>}k^2{>}\sfrac12$. Explicitly, we have \begin{equation} \begin{aligned} \!\!\!\Phi_1(\tau) &\= \epsilon\,{\mathrm{sn}\bigl(\sfrac{\tau}{\epsilon},k\bigr)}\,{\mathrm{dn}\bigl(\sfrac{\tau}{\epsilon},k\bigr)} \ , \\[4pt] \!\!\!\Phi_2(\tau) &\= \sfrac{1}{1-k^2}\,{\mathrm{cn}\bigl(\sfrac{\tau}{\epsilon},k\bigr)} \bigl[ (2k^2{-}1)\,\textrm{dn}^2\bigl(\sfrac{\tau}{\epsilon},k\bigr) -k^2 \bigr] + {\mathrm{sn}\bigl(\sfrac{\tau}{\epsilon},k\bigr)}\,{\mathrm{dn}\bigl(\sfrac{\tau}{\epsilon},k\bigr)} \bigl[ \sfrac{\tau}{\epsilon} + \sfrac{2k^2{-}1}{1{-}k^2}\,E\bigl(\textrm{am}(\sfrac{\tau}{\epsilon},k),k\bigr)\bigr]\;, \end{aligned} \end{equation} where $\textrm{am}(z,k)$ denotes the Jacobi amplitude and $E(z,k)$ is the elliptic integral of the second kind. \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{phi1.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{phi2.pdf} \caption{Plot of the SO(4) singlet fluctuation modes $\Phi_1$ and $\Phi_2$ over eight periods for $k^2{=}0.81$.} \end{figure} As can be checked, the initial conditions are \begin{equation} \Phi_1(0)=0\ ,\quad \dot\Phi_1(0)=1 \qquad\quad\textrm{and}\quad\qquad \Phi_2(0)=-1\ ,\quad \dot\Phi_2(0)=0\ , \end{equation} which fixes the ambiguity of adding to $\Phi_2$ a piece proportional to~$\Phi_1$. Hence, \begin{equation} \widehat\Phi(0) \= \Bigl(\begin{smallmatrix} 0 & \!{-}1 \\[4pt] 1 & 0 \end{smallmatrix} \Bigr) \qquad\Rightarrow\qquad M\= \widehat\Phi(T)\, \Bigl(\begin{smallmatrix} 0 & 1 \\[4pt] {-}1 & 0 \end{smallmatrix} \Bigr)\ . \end{equation} We know that $\Phi_1\sim\dot\psi$ is $T$-periodic, and so is $\dot\Phi_1$, but not the second solution, \begin{equation} \Phi_2(\tau{+}T) \= \Phi_2(\tau) + \gamma\,T\,\Phi_1(\tau) \qquad\textrm{with}\quad \gamma \= \frac{1}{T}\int_0^T\frac{\mathrm{d}\sigma}{\Phi_1(\sigma)^2}\bigg|_{\textrm{reg}} \ =:\ \sfrac{k^2}{\epsilon^6}\, \bigl\langle \dot\psi^{-2}\bigr\rangle_{\textrm{reg}}\ , \end{equation} where the integral diverges at the turning points and must be regularized by subtracting the Weierstra\ss\ $\wp$~function with the appropriate half-periods. Since $\Phi_1$ has periodic zeros, $\Phi_2$ does return to~${-}1$ at integer multiples of~$T$. It follows that the $\Phi_2$ oscillation linearly grows in amplitude with a rate (per period) of \begin{equation} \gamma \= \frac{1}{\epsilon^2}\,\Bigl[\,1 + \frac{2k^2{-}1}{1{-}k^2}\,\frac{E(k)}{K(k)} \,\Bigr]\ , \end{equation} which is always larger than 7.629, attained at $k\approx0.882$. \begin{figure}[h!] \centering \includegraphics[width = 0.5\paperwidth]{gamma.pdf} \caption{Plot of the linear growth rate~$\gamma$ as a function of~$k$.} \end{figure} In essence, we have managed to compute the monodromy \begin{equation} M \= \begin{pmatrix} {-}\Phi_2(T) & \Phi_1(T) \\[4pt] {-}\dot\Phi_2(T) & \dot\Phi_1(T) \ \end{pmatrix} \= \begin{pmatrix} \ 1 & 0 \\[4pt] \ \!\!{-}\gamma\,T & 1 \ \end{pmatrix} \= \exp \Bigl\{ {-}\gamma\,T\,\bigl(\begin{smallmatrix} 0 & 0 \\[4pt] 1 & 0 \end{smallmatrix}\bigr) \Bigr\} \end{equation} and thus easily obtain the Floquet representation, \begin{equation} R \= \begin{pmatrix} 0 & \gamma \\[4pt] 0 & 0 \end{pmatrix} \qquad\Rightarrow\qquad \mathrm{e}^{\tau R} \= \begin{pmatrix} 1 & \gamma\,\tau \\[4pt] 0 & 1 \end{pmatrix} \qquad\quad\textrm{and}\quad\qquad Q(\tau)\ = \begin{pmatrix} \Phi_1 & \Phi_2{-}\Phi_1\gamma\,\tau \\[4pt] \dot\Phi_1 & \dot\Phi_2{-}\dot\Phi_1\gamma\,\tau \end{pmatrix}\ . \end{equation} Obviously, we have encountered a marginally stable situation, since $M$ is of parabolic type. There is no exponential growth, and $\Phi_1$ is periodic thus bounded, but $\Phi_2$ grows without bound as long as one stays in the linear regime. Note that we never made use of the form of our Newtonian potential. In fact, this behavior is typical for a conservative mechanical system with oscillatory motion. What to make of this linear growth? It can be (and actually is) easily overturned by nonlinear effects. Going beyond the linear regime, though, requires expanding the Yang--Mills equation to higher orders about our classical Yang--Mills solution~(\ref{Aansatz}). While this is a formidable task in general, it can actually be done to all orders for the singlet perturbation! The reason is that a singlet perturbation leaves us in the SO(4)-symmetric subsector, thus connecting only to a neighboring ``cosmic background'', $\psi\to\tilde\psi$. Since (\ref{backgrounds}) gives us analytic control over all solutions~$\psi(\tau)$, the full effect of such a shift can be computed exactly. Splitting an exact solution~$\tilde{\psi}$ into a background part and its (full) deviation, \begin{equation} \tilde{\psi}(\tau) \= \psi(\tau)\ +\ \eta(\tau)\ , \end{equation} inserting $\tilde{\psi}$ into the equation of motion~(\ref{Newton}) and remembering that $V$ is of fourth order, we obtain \begin{equation} \label{nonlinear} 0 \= \ddot\eta + V''(\psi)\,\eta + \sfrac12 V'''(\psi)\,\eta^2 + \sfrac16 V''''(\psi)\,\eta^3 \= \ddot\eta + (6\psi^2{-}2)\,\eta + 6\psi\,\eta^2 + 2\,\eta^3\ , \end{equation} extending the linear equation~(\ref{timeshift}) by two nonlinear contributions. Perturbation theory introduces a small parameter~$\epsilon$ and formally expands \begin{equation} \eta \= \epsilon\eta_{(1)} + \epsilon^2\eta_{(2)} + \epsilon^3\eta_{(3)} + \ldots\ , \end{equation} which yields the infinite coupled system \begin{equation} \begin{aligned} & \bigl[\mbox{$\partial$}_\tau^2+(6\psi^2{-}2)\bigr]\,\eta_{(1)} \= 0 \ ,\\ & \bigl[\mbox{$\partial$}_\tau^2+(6\psi^2{-}2)\bigr]\,\eta_{(2)} \= -6\psi\,\eta_{(1)}^2 \ ,\\ & \bigl[\mbox{$\partial$}_\tau^2+(6\psi^2{-}2)\bigr]\,\eta_{(3)} \= -12\psi\,\eta_{(1)}\eta_{(2)} -2\,\eta_{(1)}^3\ ,\\ & \ldots \ , \end{aligned} \end{equation} which could be iterated with a seed solution~$\eta_{(1)}$ of the linear system. However, we know that the exact solutions to the full nonlinear equation~(\ref{nonlinear}) is simply given by the difference \begin{equation} \eta(\tau) \= \tilde\psi(\tau) - \psi(\tau) \end{equation} of two analytically known backgrounds. The SO(4)-singlet background moduli space is parametrized by two coordinates, e.g.~the energy~$E$ (or elliptic modulus~$k$) and the choice of an initial condition which fixes the origin~$\tau{=}0$ of the time variable. In~(\ref{backgrounds}), we selected $\dot\psi(0)=0$, but relaxing this we can reintroduce this collective coordinate by allowing shifts in~$\tau$. We may then parametrize the SO(4)-invariant Yang--Mills solutions as \begin{equation} \psi_{k,\ell}(\tau) \= \psi(\tau{-}\ell) \qquad\textrm{with}\qquad 2E=1/(2k^2{-}1)^2 \quad\quad\textrm{and}\quad\quad \ell\in\mathds R \end{equation} where $\psi$ is taken from~(\ref{backgrounds}). Note that $\dot\psi_{k,\ell}$ solves the background equation~(\ref{timeshift}) with a frequency-squared $\omega_{k,\ell}^2=6\psi_{k,\ell}^2{-}2$. Without loss of generality we assign $\psi=\psi_{k,0}$ and $\tilde\psi=\psi_{k{+}\delta k,\delta\ell}$, hence \begin{equation} \begin{aligned} \eta(\tau) &\= \delta k\,\mbox{$\partial$}_k\psi(\tau) - \delta\ell\,\dot\psi(\tau) + \sfrac12(\delta k)^2\,\mbox{$\partial$}_k^2\psi(\tau) - \delta k \delta\ell\,\mbox{$\partial$}_k\dot\psi(\tau) + \sfrac12(\delta\ell)^2\,\ddot\psi(\tau) + \ldots \\[4pt] &\= \delta k\,\mbox{$\partial$}_k\psi(\tau{-}\delta\ell) + \sfrac12(\delta k)^2\,\mbox{$\partial$}_k^2\psi(\tau{-}\delta\ell) + \sfrac16(\delta k)^3\,\mbox{$\partial$}_k^3\psi(\tau{-}\delta\ell) + \ldots\ , \end{aligned} \end{equation} because $\mbox{$\partial$}_\ell\psi=-\dot\psi$. Clearly, a shift in~$\ell$ only shifts the time dependence of the frequency and does not alter the energy~$E$, which is not very interesting. Its linear part corresponds to the mode $\Phi_1\sim\dot\psi$ of the previous section. A change in~$k$, in contract, will lead to a solution with an altered frequency and energy. Its linear part is given by $\Phi_2$, which grows linearly in time. However, due to the boundedness of the full motion, the nonlinear corrections have to limit this growth and ultimately must bring the fluctuation back close to zero. This is the familiar wave beat phenomenon: the difference of two oscillating functions, $\tilde\psi$ and $\psi$, with slightly different frequencies, will display an amplitude oscillation with a beat frequency given by the difference. This is borne out in the following plots. \begin{figure}[h!] \centering \includegraphics[width = 0.35\paperwidth]{eta_linear.pdf} \qquad\quad \includegraphics[width = 0.35\paperwidth]{eta_nonlinear.pdf} \caption{Plots of the full perturbation $\eta$ at $k{=}0.95$ for $\eta(0){=}0.02$, $\dot{\eta}(0){=}0$, giving a beat ratio of ${\sim}19$.} \end{figure} As a result, we can assert a long-term stability of the cosmic Yang--Mills fields against the SO(4) singlet perturbation, even though on shorter time scales an excursion to a nearby solution is not met with a linear backreaction. \section{Conclusions} \noindent We have revisited a cosmological scenario recently put forward by Friedan~\cite{Friedan} and based on the Standard Model plus gravity alone. An SO(4) symmetric sector is analytically solvable and reduces to three coupled anharmonic oscillators (for the metric, an SU(2) Yang--Mills field and the Higgs field, the latter being frozen to its vacuum state). We have presented a complete analysis of the linear gauge-field perturbations of the time-dependent Yang--Mills solution, by diagonalizing the fluctuation operator and studying the long-time behavior of the ensuing Hill's equations using the stroboscopic map and Floquet theory. For parametrically large gauge-field energy (as is required in Friedan's setup) the natural frequencies and monodromies become universal, and some unstable perturbation modes survive even in this limit. This provides strong evidence that such oscillating cosmic Yang--Mills fields are unstable against small perturbations, although we have not yet included metric fluctuations here. Their influence will be analyzed in follow-up work. \subsection*{Acknowledgments} \noindent K.K.~is grateful to Deutscher Akademischer Austauschdienst (DAAD) for the doctoral research grant~57381412. \newpage \section*{Appendix} \begin{center} \begin{tabular}{| p{10mm} | p{25mm} | p{45mm} | p{80mm} |} \hline $j\ ,\ v $ & P($\lambda$) & Q($\lambda$) & R($\lambda$) \\ [0.5ex] \hline\hline $0\ ,\ 0$ \phantom{\Big|} & N/A & $(-2 + 6 \psi^2) - \lambda$ & $-(2 - 6 \psi^2) + \lambda$ \\ \hline $0\ ,\ 1$ \phantom{\Big|} & 1 & $(2 + 2 \psi + 4 \psi^2) - \lambda$ & $(4 + 12\psi + 20 \psi^2 + 20 \psi^3 + 8 \psi^4 - 8 \dot{\psi}^2) - (4 + 6 \psi + 6 \psi^2) \lambda + \lambda^2$ \\ \hline $0\ ,\ 2$ \phantom{\Big|} & N/A & $(10 + 6 \psi) - \lambda$ & N/A \\ \hline $\sfrac12\ ,\ \sfrac12$ \phantom{\Big|} & $-(1 + 6 \psi^2) + \lambda$ & $-(1 + 2 \psi^2 + 24 \psi^4) + (2 + 10 \psi^2) \lambda - \lambda^2$ & $-(1 + 4 \psi^2 + 28 \psi^4 + 48 \psi^6 - 8 \dot{\psi}^2 - 48 \psi^2 \dot{\psi}^2) + (3 + 16 \psi^2 + 44 \psi^4 - 8 \dot{\psi}^2) \lambda - (3 + 12 \psi^2) \lambda^2 + \lambda^3$ \\ \hline $\sfrac12\ ,\ \sfrac32$ \phantom{\Big|} & $-(7 + 3 \psi) + \lambda$ & $-(49 + 42 \psi + 32 \psi^2 + 12 \psi^3) + (14 + 6 \psi + 4 \psi^2) \lambda - \lambda^2$ & $-(343 + 588 \psi + 574 \psi^2 + 360 \psi^3 + 136 \psi^4 + 24 \psi^5 - 56 \dot{\psi}^2 - 24 \psi \dot{\psi}^2) + (147 + 168 \psi + 124 \psi^2 + 48 \psi^3 + 8 \psi^4 - 8 \dot{\psi}^2) \lambda - (21 + 12 \psi + 6 \psi^2) \lambda^2 + \lambda^3$ \\ \hline $\sfrac12\ ,\ \sfrac52$ \phantom{\Big|} & N/A & $(17 + 8 \psi) - \lambda$ & N/A \\ \hline $1\ ,\ 0$ \phantom{\Big|} & $1$ & $(2 - 2 \psi + 4 \psi^2) - \lambda$ & $( 4 - 12 \psi + 20 \psi^2 - 20 \psi^3 + 8 \psi^4 - 8 \dot{\psi}^2) - (4 - 6 \psi + 6 \psi^2) \lambda + \lambda^2$ \\ \hline $1\ ,\ 1$ \phantom{\Big|} & $(36 + 36 \psi^2) - (12 + 6\psi^2) \lambda + \lambda^2$ & $(216 + 192 \psi^2 + 104 \psi^4) - (108 + 92 \psi^2 + 24 \psi^4) \lambda + (18 + 10 \psi^2) \lambda^2 - \lambda^3$ & $(1296 + 1584 \psi^2 + 1008 \psi^4 + 208 \psi^6 - 288 \dot{\psi}^2 - 288 \psi^2 \dot{\psi}^2) - (864 + 960 \psi^2 + 432 \psi^4 + 48 \psi^6 - 96 \dot{\psi}^2 - 48 \psi^2 \dot{\psi}^2) \lambda + (216 + 188 \psi^2 + 44 \psi^4 - 8 \dot{\psi}^2) \lambda^2 - (24 + 12\psi^2) \lambda^3 + \lambda^4$ \\ \hline $1\ ,\ 2$ \phantom{\Big|} & $-(14 + 4 \psi) + \lambda$ & $-(196 + 112 \psi + 60 \psi^2 + 16 \psi^3) + (28 + 8 \psi + 4 \psi^2) \lambda - \lambda^2$ & $-(2744 + 3136 \psi + 2128 \psi^2 + 928 \psi^3 + 248 \psi^4 + 32 \psi^5 - 112 \dot{\psi}^2 - 32 \psi \dot{\psi}^2) + (588 + 448 \psi + 236 \psi^2 + 64 \psi^3 + 8 \psi^4 - 8 \dot{\psi}^2) \lambda - (42 + 16 \psi + 6 \psi^2) \lambda^2 + \lambda^3$ \\ \hline $1\ ,\ 3$ \phantom{\Big|} & N/A & $(26 + 10 \psi) - \lambda$ & N/A \\ \hline $\sfrac32\ ,\ \sfrac12$ \phantom{\Big|} & $-(7 - 3 \psi ) + \lambda$ & $-(49 - 42 \psi + 32 \psi^2 - 12 \psi^3) + (14 - 6 \psi+ 4 \psi^2) \lambda - \lambda^2$ & $-(343 - 588 \psi + 574 \psi^2 - 360 \psi^3 + 136 \psi^4 - 24 \psi^5 - 56 \dot{\psi}^2 + 24 \psi \dot{\psi}^2) + (147 - 168 \psi + 124 \psi^2 - 48 \psi^3 + 8 \psi^4 - 8 \dot{\psi}^2) \lambda - (21 - 12 \psi + 6 \psi^2) \lambda^2 + \lambda^3$ \\ \hline $\sfrac32\ ,\ \sfrac32$ \phantom{\Big|} & $(169 + 78 \psi^2) - (26 + 6 \psi^2) \lambda + \lambda^2$ & $(2197 + 962 \psi^2 + 216 \psi^4) - (507 + 204 \psi^2 + 24 \psi^4) \lambda + (39 + 10 \psi^2) \lambda^2 - \lambda^3$ & $(28561 + 16900 \psi^2 + 4732 \psi^4 + 432 \psi^6 - 1352 \dot{\psi}^2 - 624 \psi^2 \dot{\psi}^2) + (-8788 - 4628 \psi^2 - 936 \psi^4 - 48 \psi^6 + 208 \dot{\psi}^2 + 48 \psi^2 \dot{\psi}^2) \lambda + (1014 + 412 \psi^2 + 44 \psi^4 - 8 \dot{\psi}^2) \lambda^2 - (52 + 12 \psi^2) \lambda^3 + \lambda^4$ \\ \hline $\sfrac32\ ,\ \sfrac52$ \phantom{\Big|} & $-(23 + 5 \psi) + \lambda$ & $-(529 + 230 \psi + 96 \psi^2 + 20 \psi^3) + (46 + 10 \psi + 4 \psi^2) \lambda - \lambda^2$ & $-(12167 + 10580 \psi + 5566 \psi^2 + 1880 \psi^3 + 392 \psi^4 + 40 \psi^5 - 184 \dot{\psi}^2 + 40 \psi\dot{\psi}^2) + (1587 + 920 \psi + 380 \psi^2 + 80 \psi^3 + 8 \psi^4 - 8 \dot{\psi}^2) \lambda + (-69 - 20 \psi - 6 \psi^2) \lambda^2 + \lambda^3$ \\ \hline $\sfrac32\ ,\ \sfrac72$ \phantom{\Big|} & N/A & $(37 + 12 \psi) - \lambda$ & N/A \\ \hline $2\ ,\ 0$ \phantom{\Big|} & N/A & $(10- 6 \psi) - \lambda$ & N/A \\ \hline $2\ ,\ 1$ \phantom{\Big|} & $-(14 - 4 \psi) + \lambda$ & $-(196 - 112 \psi + 60 \psi^2 - 16 \psi^3) + (28 - 8 \psi + 4 \psi^2) \lambda - \lambda^2$ & $-(2744 - 3136 \psi + 2128 \psi^2 - 928 \psi^3 + 248 \psi^4 - 32 \psi^5 - 112 \dot{\psi}^2 + 32 \psi \dot{\psi}^2) + (588 - 448 \psi + 236 \psi^2 - 64 \psi^3 + 8 \psi^4 - 8 \dot{\psi}^2) \lambda - (42 - 16 \psi + 6 \psi^2) \lambda^2 + \lambda^3$ \\ \hline $2\ ,\ 2$ \phantom{\Big|} & $(484 + 132 \psi^2) - (44 + 6 \psi^2) \lambda + \lambda^2$ & $(10648 + 2816 \psi^2 + 360 \psi^4) - (1452 + 348 \psi^2 + 24 \psi^4) \lambda + (66 + 10 \psi^2) \lambda^2 - \lambda^3$ & $(234256 + 83248 \psi^2 + 13552 \psi^4 + 720 \psi^6 - 3872 \dot{\psi}^2 - 1056 \psi^2 \dot{\psi}^2) - (42592 + 13376 \psi^2 + 1584 \psi^4 + 48 \psi^6 - 352 \dot{\psi}^2 - 48 \psi^2 \dot{\psi}^2) \lambda + (2904 + 700 \psi^2 + 44 \psi^4 - 8 \dot{\psi}^2) \lambda^2 - (88 + 12 \psi^2) \lambda^3 + \lambda^4$ \\ \hline $2\ ,\ 3$ \phantom{\Big|} & $-(34 + 6 \psi) + \lambda$ & $-(1156 + 408 \psi + 140 \psi^2 + 24 \psi^3) + (68 + 12 \psi + 4 \psi^2) \lambda - \lambda^2$ & $-(39304 + 27744 \psi + 11968 \psi^2 + 3312 \psi^3 + 568 \psi^4 + 48 \psi^5 - 272 \dot{\psi}^2 - 48 \psi \dot{\psi}^2) + (3468 + 1632 \psi + 556 \psi^2 + 96 \psi^3 + 8 \psi^4 - 8 \dot{\psi}^2) \lambda - (102 + 24 \psi + 6\psi^2) \lambda^2 + \lambda^3$ \\ \hline $2\ ,\ 4$ \phantom{\Big|} & N/A & $(50 + 14 \psi) - \lambda$ & N/A \\ \hline \end{tabular} \end{center} \pagebreak
\section{Introduction}\label{sec:intro} \input{Sections/Introduction} \section{Methods}\label{sec:methods} \input{Sections/Methods} \section{Results}\label{sec:results} \input{Sections/Results} \section{Discussion}\label{sec:discussion} \input{Sections/Discussion} \section{Conclusions}\label{sec:conclusion} \input{Sections/Conclusions} \section{Acknowledgements}\label{sec:acknowledgements} \input{Sections/Acknowledgements} \bibliographystyle{asmejour} \subsection{Inference Verification with Synthetic Strain Measurements} We used a set of synthetic strain measurements that resulted from a known load configuration to verify that the inference framework works as expected and provides a reasonable characterization of the applied pressures. The load configuration used for the verification was composed of 3 rectangular patches that were located with respect to the $x$-coordinate axis, which is aligned with the $\theta=0$ and $180^\circ$ direction, as seen in Fig. \ref{fig:Synthetic}. On the front side we applied a normal pressure of 4 MPa in a rectangular patch with dimensions 69.9 cm x 20.0 cm and on the back applied normal pressures of 2 MPa in two rectangular patches with dimensions 34.4 cm x 20.0 cm, placed an equal distance on either side of the $x$-axis. Fig. \ref{fig:Synthetic} shows the posterior mean of the normal load configurations. The inferred load pattern shows a region of elevated pressure centered at $\theta=0^\circ$ with a maximum pressure of 3.47 MPa. The pressures on the rear side of the buoy reach a maximum of 1.65 MPa. The spatial extents of both front and rear regions of high pressure compare well to the known applied load pattern. The spatial pattern of the variances is indicative of the added information that the strain gauges provide and the differences in the length scales for the horizontal and vertical directions in \reviewchange{the} Gaussian process used to represent the inferred load fields. The variance tends to be high as one moves farther away from a strain gauge with the decay in information being stronger in the vertical direction. Interestingly, the prior lengthscale is actually shorter in the horizontal direction. The slower increase of the posterior covariance in the horizontal direction is therefore an indication that this \reviewchange{strain} gauge configuration is more informative about horizontal variations in the applied pressures. Figure \ref{fig:Rose_synthetic} provides a more detailed look at the inferred load configuration for horizontal slices at vertical locations of 28.0 and 35.25 cm below the buoy flange. There were aberrant negative loads, but these negative excursions are very small and do not exceed 0.87 MPa. The peak loads for the fore side of the buoy are 3.31 MPa and located at $\theta=357^\circ$ and on the aft side of the buoy are 1.56 MPa and located at $\theta=184^\circ$ with the load configuration exhibiting a very slight asymmetry. There were small lobes at $\theta=100^\circ$ and $260^\circ$, but these are relatively small in extent and magnitude. \begin{figure*}[t] \centering \includegraphics[width=\textwidth]{SyntheticLoads} \caption{Synthetic load configuration and inference results.} \label{fig:Synthetic} \end{figure*} \begin{figure}[t] \centering \includegraphics[width=3.25in]{Rose_Plot_Synthetic} \caption{Detail of inferred normal load configuration at 28.0 and 36.25 cm below the flange.} \label{fig:Rose_synthetic} \end{figure} \subsection{Experimental Strain Measurements} As described in Section \ref{subsec:experiment}, we monitored the buoy's strain using foil gauges that were affixed to the interior surface of the buoy as an ice sheet was compressively loaded using a hydraulic ram. Figure \ref{fig:Strain_Gauges}, shows how both the vertically and horizontally aligned strain measured at 18 locations on the buoy varied through the 300 second long experiment. As the ice was initially loaded, the strains quickly rise while the hydraulic ram applied approximately 7 MPa to the ice until the 73 second mark. During this initial period, the vertical strains measured at the locations normal to the direction of loading, $\theta=0$ and $180^\circ$, were all tensile as one would expect for a hollow body pinched in the middle. In contrast, the horizontal strains were mostly compressive. For time period between 73-251 seconds, the hydraulic ram was set to its maximum output of 14 MPa through the duration of the experiment. During this timeframe, we observed a dramatic increase in strain rate for all the locations, and most locations reached a maximum value between 115 and 143 seconds. There were, however, a few exceptions to this strain trend. For example, the horizontal strains for the $\theta=120$ and $300^\circ$ locations, which face away and towards the hydraulic ram, respectively, continued to increase after 115 seconds, but still exhibited a reduction in strain rate when the other locations reached their maximum strain values. In general, the strains were either purely tensile or compressive through the duration of the experiment. However, at the $\theta=0$ and $240^\circ$ locations, the vertical strains transitioned from compression to tension, or vice versa, with the transitions occurring between 135 and 161 seconds. In addition, the horizontal gauge at $\theta=240^\circ$ transitioned from compression to tension at 124 seconds. The bottom horizontal strain gauge at \ang{0} stopped collecting data around 10 seconds, therefore was removed from the dataset used for the load inversion. \begin{figure*} \centering \includegraphics[width=\textwidth]{Horizontal_Vertical_Strain} \caption{Horizontal and vertical strain gauge measurements from the compression experiment through time. Each plot shows the top, middle, and bottom gauges for one orientation on the buoy (dashed lines are vertical strain gauges, and solid lines are the horizontal gauges). Note the scale difference for the \ang{0} and \ang{180} plots versus the others.} \label{fig:Strain_Gauges} \end{figure*} \subsection{Inferred Loads} With the Bayesian inference framework introduced in Section \ref{subsec:bayes_method}, we used the measured strains of the buoy interior wall to infer the loads on the buoy's exterior surface. We performed this inference on a subregion of the buoy surface, $\Gamma_p$, that bounded the region that the ice was expected to be in contact with the buoy. We independently processed each observation to obtain a time series of applied pressures, as shown in Figure \ref{fig:loads} and Figure \ref{fig:buoyLoads}. The inference results are presented as stress fields in the buoy coordinate system, with surface normal direction (positive pointing towards the buoy interior), the horizontal direction (positive pointing clockwise) and the vertical direction (positive pointing up). \begin{figure}[t] \centering \includegraphics[width=3.25in]{Rose_Plot} \caption{Rose plot showing the inferred normal load magnitudes (solid blue line) at times (a) 100, (b) 120, (c) 160, and (d) 220 seconds. The standard deviations associated with these loads is shown by the blue shaded region. The thick black line is 0.0 MPa} \label{fig:loads} \end{figure} For the initial 73 seconds, the stress levels on the buoy are very low, which is to be expected since the strains were also small during this time interval. When the hydraulic ram output is increased from 7 MPa to 14 MPa, the magnitude of the inferred stresses begin to increase until the horizontal, vertical, and normal stresses reach maxima of 2.7, 1.1, and 20.8 MPa, respectively, near a time of 125 seconds into the experiment. The posterior mean stress fields at 100 and 125 seconds exhibit lobes near \ang{0} that are consistent with the ice squeezing the buoy at this location and the formation of a crack at \ang{0}. The horizontally aligned stress shows a line of zero stress at $\theta=0^\circ$ with a positive and negative region on either side of this zero stress line. This stress divergent pattern about the $0^\circ$ line on the buoy is further evidence that a crack had formed at this location. In contrast, the vertical stress pattern shows a zero stress line aligned horizontally with a negative stress (pushing down) above and a positive stress (pushing up) below this line, i.e., tangential stresses that are converging toward this line. The largest vertical stresses are found along the bottom of the buoy's flange, as shown at time 120s in Figure \ref{fig:verticalDetail}. Between 100 and 125 seconds, the vertical stresses on the flange near \ang{0} are positive indicating that ice was pushing up on flange during these times. As Figure \ref{fig:Experiment_Pics} illustrates, this pressure on the flange agrees with visible observations of the buoy being lifted by the flange during the experiment. \begin{figure*}[t] \centering \includegraphics[width=\textwidth]{Buoy_Loads} \caption{Inferred loads across the buoy looking down the direction of loading (\ang{0}) at times 100, 120, 160, and 220 seconds, respectively. The first column shows the horizontal loads, the middle column shows the normal loads, and the last column the vertical loads. The color bar units are MPa.} \label{fig:buoyLoads} \end{figure*} Figure \ref{fig:loads} provides a more detailed look at the inferred normal stresses along the middle ring of strain gauges (51.2 cm from the top of the buoy) at 100, 120, 160, and 220 seconds. We see the large magnitude lobes pressure on either side of \ang{0} and how the asymmetry increases with time favoring the sextant between \ang{0} and \ang{60}. There are region of negative stress throughout the experiment that we attribute to an unloading from a prestress in the buoy due to the freezing in process, therefore we suspect that there is an unknown biases in the strain measurements that we were unable to determine. The maximum inferred pressure in the lobe located in the sextant between \ang{0} and \ang{60} was 20.5 MPa and the maximum inferred pressure in the lobe located in the sextant located between \ang{320} and \ang{0} was 13.2 MPa . \begin{figure} \centering \includegraphics[width=2.5in]{VerticalDetail.png} \caption{Detailed view of vertical pressure on the flange at 120s looking from below. Positive quantities are pointing into the page. There is a clear lift corresponding to the visible flange-ice contact in image B of Figure \ref{fig:Experiment_Pics}. Units are in MPa.} \label{fig:verticalDetail} \end{figure} \subsection{Posterior predictive strains and displacement} As a sanity check, we calculate the posterior predictive mean strain at the observation locations, i.e., the strain $\varepsilon_{post}$, by using the posterior mean pressures as the boundary conditions for the FEM forward model. We compared these strain values against the actual observed strain values, $\varepsilon_{obs}$, as a verification that the posterior loads were matching the observations. The largest difference between the mean posterior predictive and the observed strains was $3.03\times10^{-11}$, and occurred at 145 seconds, which corresponds to shortly after the time of highest observed strain. The inferred loads were also used to calculate the expected posterior displacement of the buoy surface. The largest displacements were at 175 seconds, along the \ang{0} axis ($17$ mm), where the buoy deformed inward. In addition to displacement in the direction of loading, the buoy bowed outward along the \ang{90} and \ang{270} axes ($12$ mm and $14$ mm, respectively) in response to axial compression. The displacement fields align well with the distribution of the normal loads, where highly compressive loads are found in the same areas on the buoy where inward deformation occurred. The displacement results at 200 seconds are shown in Figure \ref{fig:fullField} to illustrate the final deformation state of the buoy. These results help to shape our understanding of the complex loading scenario that caused the observed strains. \begin{figure} \centering \includegraphics[width=3.25in]{Full_Field} \caption{Calculated displacements at 200 seconds using the inferred load results. The buoy is warped by a scaling factor of 2.0, and is show oriented along the \ang{0} and \ang{270} axes} \label{fig:fullField} \end{figure} \subsection{Visual observations of experiment} \begin{figure*}[t] \centering \includegraphics[width=\textwidth]{ExperimentPics} \caption{ Images from the physical experiment showing features from varying viewing angles, relative to the \ang{0} direction of loading. Red arrows indicate features highlighted for comparison with inferred loads. A) Initial setup before any deformation; B) When ice begins to catch on the flange and raise the buoy; C) Ice and buoy are out of contact on the backside of the buoy after large chunk of ice falls away; D) Large gaps between the buoy and original ice contact surfaces.} \label{fig:Experiment_Pics} \end{figure*} To evaluate how well the inference framework worked for this experiment, we qualitatively correlate the inferred load configurations with key events during the physical experiment. Initially, the buoy was frozen into the ice and had full contact between the buoy and the ice through the ice thickness. As the ice was compressively loaded, the buoy acted as an inclusion in the ice and induced localized ice cracking and deformation around the buoy. In some locations, the buoy decoupled from the ice and transferred the load to highly localized regions on the buoy. At approximately 100 seconds, a large crack formed in front of the buoy along the direction of loading along with two cracks off the backside of the buoy; one along the \ang{180} axis and another emanating from the edge of the buoy near \ang{240}. These two cracks on the backside separated a small segment of ice from the rest of the ice sheet, as observed in images C and D of Figure \ref{fig:Experiment_Pics}. The normal loads on the front of the buoy presented in Fig. \ref{fig:buoyLoads} showing compression in two lobes corroborates the presence of a crack in the loading direction. The divergent horizontal loads in the \ang{0} direction also indicate that the two sides of this crack were spreading apart as they pressed against the buoy. This is supported by observations that the crack became wider as the experiment progressed. The ice did not remain planar throughout the experiment and started to buckle at 83 seconds, with some sections pushing up nearly 1 meter above the initial elevation. As it buckled, the ice sheet lifted the buoy unevenly. The uneven lifting action was partly a result of the major crack that formed through the middle (at \ang{0}) of the ice sheet. Wlipping between the ice and buoy was also observed until the ice engaged with the buoy flange (see image B in Fig \ref{fig:Experiment_Pics}). The inferred load configurations show large vertical loads on the flange and are highest upward load on the flange at 120 seconds in Figures \ref{fig:buoyLoads} and \ref{fig:verticalDetail} consistent with the observations. As described previously, the ice load is higher in the sextant between \ang{0} and \ang{60} matching the visual observations in the experiment where ice exhibiting more engagement with this sextant. Another key observation from the experiment was that the small separated section of ice on the back edge of the buoy \reviewchange{rose} with the rest of the ice sheet as it buckled, which is an indicator that the a significant portion of the buoy's back side, i.e., between \ang{90} and \ang{270}, was not in contact with ice for a large portion of the test (image C in Figure \ref{fig:Experiment_Pics}), which may explain why the normal loads were inferred to be either small or even negative (see Fig. \ref{fig:loads}). \reviewchange{Note that by inferring the loads acting on the buoy, we are not explicitly modeling the ice-buoy contact forces. A loss of contact manifests as a decrease in the load from the initial state of the buoy (i.e., negative load in Fig. \ref{fig:loads}). The posterior probability of a non-negative load could therefore be used to characterize the probability of ice-buoy contact at any location on the buoy.} These results and corresponding observations illustrate how our inference framework could qualitatively capture the dynamic and complex loading conditions within the ice sheet that evolved during the experiment. \subsection{Methods Overview} To test the concept of using a buoy instrumented with strain gauges to estimate sea ice internal stresses, we subjected a thin-walled steel buoy to compression within a laboratory grown saline ice sheet. Computationally, we used a CAD representation of the buoy, provided by the University of Washington Applied Physics Laboratory, to develop a structural finite element model of the buoy. This model allowed us to describe the connection between applied traction fields and observed strain and to ultimately define an inverse problem for characterizing the traction field given actual observations. Section \ref{subsec:experiment} describes the experimental facility and setup in more detail. Section \ref{subsec:FE} then describes the specifics of our finite element forward model. Finally, Section \ref{subsec:bayes_method} formulates a Bayesian inference problem for connecting this model with experimental data in order to characterize the distribution over various loading scenarios. \subsection{Physical experiment} \label{subsec:experiment} The ice compression experiment was conducted in the Geophysical Research Facility located at the Cold Regions Research and Engineering Laboratory in Hanover, NH. The facility is composed of a large outdoor tank (dimensions: width 6.7 m, length 18.3 m, depth 2.3 m) and a retractable roof fitted with a refrigeration system designed to facilitate the growth of ice for subsequent mechanical testing. A compressive load was applied to the ice using a hydraulic ram composed of a set of three hydraulic pistons that can together apply a maximum load of 14 MPa. As shown in Figure \ref{fig:gauge_locations}, the buoy was constructed from a cylindrical pressure tank with an outer diameter measuring 76.2 cm and vertical length of 116.8 cm. The pressure vessel was laterally sliced 23.5 cm from the top of the buoy and outfitted with a bolted flange to provide access to the strain measurement system on the interior of the buoy. The buoy was instrumented with 36 strain gauges arranged in pairs that measured vertical and horizontal strain at 18 locations. The strain gauges were placed in three rings around the buoy and vertically spaced 16.5 cm apart, beginning with the top ring of 12 gauges located 34.7 cm from the buoy top (11.2 cm below the bottom of the buoy cap flange), a middle ring located at 51.2 cm from the top (27.7 cm below the bottom of the buoy cap flange), and the bottom ring located 67.7 cm from the top (44.2 cm below the bottom of the buoy cap flange). The gauges were uniformly distributed radially in $\ang{60}$ intervals (see Figure \ref{fig:gauge_locations}). \begin{figure}[t] \centering \includegraphics[width=3.25in]{Strain_Gauge_Diagram} \caption{Dimensions of the buoy and strain gauge locations from the compression experiment. Strain gauges are placed in three rows (top, middle, and bottom) around the circumference of the buoy at \ang{60} intervals. Each point location has both a vertical and horizontal strain gauge. The colors correspond to the strain results in Section \ref{sec:results}.} \label{fig:gauge_locations} \end{figure} To simulate sea ice, the initial tank salinity was set to 27 ppt, which is slightly lower than typical Arctic sea surface salinity ($\sim$29-32 ppt) \citep{brucker2015}. This salinity level was selected to account for the brine rejection that typically occurs during sea ice formation. The ice growth began on December 19, 2017, and continued until February 12, 2018, reaching a thickness of 23 cm. At this stage of ice growth, the buoy was placed within a square section that was cut into the ice. The ice growing process resumed until reaching the target thickness of 50 cm. During the \reviewchange{ ice-growing} process, the test basin was covered and refrigerated until the experiment took place to promote accelerated ice growth and to limit melting during warm, sunny periods. The ice compression experiment was conducted on April 11, 2018, which was a partly cloudy day with an outdoor temperature of \ang{9}C. The configuration and load condition resembles a uniaxial compression test, illustrated in Figure \ref{fig:setup}. The sides of the ice sheet parallel to the loading direction were free of any confinement. The side adjacent to the hydraulic press had a free slip boundary condition, but the opposite side was fixed. For the test, the hydraulic ram load was gradually increased throughout the experiment until reaching a peak value of approximately 14 MPa. The experiment lasted approximately 4 minutes with strain measurements recorded every 0.5 seconds. \begin{figure}[t] \centering \includegraphics[width=3.25in]{ExperimentalSetup} \caption{Schematic diagram of the setup for the buoy compression experiment. The thick black lines indicate the test basin boundary and the red line indicates the boundary where the ice was frozen to the test basin wall.} \label{fig:setup} \end{figure} \subsection{Finite element model} \label{subsec:FE} For each strain gauge location in Figure \ref{fig:gauge_locations} in the horizontal (i.e., in the x-y plane tangent to the buoy surface) and vertical strain was observed on the interior of the buoy. To relate this to the tractions acting on the exterior of the buoy, we define a model predicting the buoy's deformation given a particular traction field. This is done by solving the balance of linear momentum equation with the assumption that inertial effects are negligible. This is a reasonable assumption since the loading rate of the ice on the buoy in the experiment is small. With this assumption, the balance of linear momentum is given by \begin{linenomath*} \begin{equation} \nabla \cdot \sigma(x) + b(x) = 0, \label{eq:stress_mod} \end{equation} \end{linenomath*} where $\sigma(x)$ is the Cauchy stress tensor and $b(x)$ is the body force vector on the buoy. Assuming a linear elastic constitutive model, the stress-strain response follows Hooke's law \begin{linenomath*} \begin{equation} \sigma(x) = 2 \mu \varepsilon_{mod}(x) + \lambda \tr(\varepsilon_{mod}(x)) I, \label{eq:constitutive_law} \end{equation} \end{linenomath*} where $\mu$ and $\lambda$ are Lam\'e parameters and $\varepsilon_{mod}$ is the model strain, which is defined as (assuming small strain) \begin{linenomath*} \begin{equation} \varepsilon_{mod}(x) = \frac{1}{2} \big(\nabla u(x) + (\nabla u(x))^\intercal \big), \label{eq:strain_mod} \end{equation} \end{linenomath*} where $u$ is displacement. We prescribe a Young's modulus of 200 GPa and a Poisson's ratio of 0.3, which correspond to the material properties of the steel buoy used in the experiment. We then derive the Galerkin weak form of Eq.\eqref{eq:stress_mod} and arrive at the discretized finite element matrix equations \begin{linenomath*} \begin{equation} Kd=f, \label{eq:FEM_matrix_eq} \end{equation} \end{linenomath*} where $K$ is the stiffness matrix, $d$ is the nodal displacement vector, and $f$ is the external nodal force vector acting on the buoy surface $\Gamma$. For the purposes of inference, we only need to know predicted values of strain at the physical strain gauge locations on the buoy. Using the finite element basis functions that define the displacement $u$ with the definition of strain in Eq.\eqref{eq:strain_mod}, we are able to write the strain at the observation locations as \begin{linenomath*} \begin{equation} \varepsilon_{mod} = BK^{-1}f, \label{eq:strain} \end{equation} \end{linenomath*} where $B$ is a matrix that contains the derivatives of the finite element shape functions. The size of the B matrix is constructed such that only the shape functions for the finite elements containing the location of the physical strain gauges are included. It is a sparse matrix with $33$ rows, one for each strain gauge, and $203,661$ columns, one for each degree of freedom in the finite element mesh. The nodal force vector $f$ can be further broken down into \begin{linenomath*} \begin{equation} f = DAp \label{eq:strain2} \end{equation} \end{linenomath*} where $D$ is a matrix of shape function products integrated over the external surface $\Gamma$, similar to a mass matrix, $p$ is a nodal pressure vector, and $A$ is a matrix that rotates and stamps the pressure vector from the buoy coordinate system, shown in Figure \ref{fig:force_diagram}, into the global coordinate system. The matrix $A$ has $203,661$ rows, one for each displacement degree of freedom in the mesh, and $35,073$ columns, one for each degree of freedom we wish to infer. The pressure vector $p$ is composed of normal, $p_{N}$, and tangential components in the horizontal and vertical directions, $p_{H}$ and $p_{V}$, respectively. \begin{figure}[t] \centering \includegraphics[width=3.25in]{Force_Diagram.pdf} \caption{Schematic diagram of the unit vectors (horizontal: $\hat{t}_{H}$, vertical: $\hat{t}_{V}$, and normal: $\hat{n}$) used to project the pressure results between Cartesian coordinates and the buoy reference coordinates. The left image is a cross-sectional view looking from the top of the buoy down, such that $\hat{t}_{V}$ is directed out of the page toward the reader. The right image is a cross-sectional view of the buoy rotated \ang{90} about the dashed line. $\vec{r}$ is the radius of the buoy.} \label{fig:force_diagram} \end{figure} The matrix $A$ transforms the results between Cartesian global coordinates and the buoy coordinates through the expression \begin{linenomath*} \begin{equation} \begin{bmatrix} p_{x}^{(i)} \\ p_{y}^{(i)} \\ p_{z}^{(i)} \\ \end{bmatrix} = \begin{bmatrix*}[c] A^{(i)}_{n} & A^{(i)}_{H} & A^{(i)}_{V} \\ \end{bmatrix*} \begin{bmatrix} p_{N}^{(i)} \\ p_{H}^{(i)} \\3 p_{V}^{(i)} \\ \end{bmatrix}, \label{eq:f_vec_A_1} \end{equation} \end{linenomath*} where \begin{linenomath*} \begin{equation} A_{n} = \begin{bmatrix*}[c] -\hat{n}_{1}^{\,(i)} \\ -\hat{n}_{2}^{\,(i)} \\ 0 \\ \end{bmatrix*}, \qquad A_{H} = \begin{bmatrix*}[c] \hat{t}_{H1}^{\,(i)} \\ \hat{t}_{H2}^{\,(i)} \\ 0 \\ \end{bmatrix*}, \qquad A_{V} = \begin{bmatrix*}[c] 0 \\ 0 \\ \hat{t}_{V3}^{\,(i)} \\ \end{bmatrix*}. \label{eq:f_vec_A_2} \end{equation} \end{linenomath*} This linear elastic finite element model was implemented in FEniCS \citep{Fenics2015} using a tetrahedral mesh that was generated with the CUBIT software, using a CAD geometry of the buoy used in the experiment (Figure \ref{fig:gauge_locations}). The CAD files were provided by the University of Washington Applied Physics Laboratory. \subsection{Bayesian inference} \label{subsec:bayes_method} We adopt a Bayesian approach to indirectly characterize the ice pressures $p_N(x), p_H(x), p_V(x)$ applied to a defined region on the exterior surface of the buoy from strain gauge measurements on the interior of the buoy. Bayesian inference is a probabilistic framework that allows us to not only estimate the value of the pressures, but also to rigorously quantify uncertainty stemming from noisy observations and the inability of a few observations to completely constrain the pressures over the entire surface of the buoy. Let $\Gamma_p\subset \Gamma$ denote the portion of buoy's exterior surface that lies between 23.5 and 83.5 cm from the top of the buoy. Over this region, we want to infer the pressure function $p(x)$. We start by treating the external pressures applied to the buoy and the observed strains as random variables, denoted by $p(x)=\left[p_N(x), p_H(x), p_V(x)\right]^T$ and $\varepsilon_{obs}$, respectively. The components $p_N(x)$, $p_H(x)$ and $p_V(x)$ denote the stresses in the normal, horizontal, and vertical directions, as defined in Figure \ref{fig:force_diagram}. Our goal is to determine the conditional distribution of the pressures $p(x)$ given the strain observations $\varepsilon_{obs}$. In general however, $p(x)$ lies in an infinite dimensional function space, which makes inference more challenging. To overcome this, we instead look for pressure functions $p(x)$ that lie within the span of a linear finite element basis; the same basis used above to represent the load vector $f$. This restriction allows us to characterize the pressure function $p(x)$ with a finite number of coefficients and thus apply standard Bayesian techniques. \cite{stuart2010inverse} provides more information about working directly in the infinite dimensional setting. Let $p$ (without the $(x)$) denote a vector containing nodal pressures. Our goal is then to characterize the posterior density $\pi(p | \varepsilon_{obs})$. Bayes' rule allows us to write this density as the product of a prior density $\pi(p)$ and a likelihood function $\pi(\varepsilon_{obs} | p)$ \begin{equation} \pi(p | \varepsilon_{obs}) \propto \pi( \varepsilon_{obs} | p) \pi(p), \end{equation} where the prior density models information known about the pressures before any observations are available, and the likelihood function provides a way of comparing model predictions with the observations. More information is provided on each of these components below. \subsubsection{Prior distribution} To obtain a prior distribution over the finite dimensional vector $p$, we first consider the continuous pressure function $p(x)$, which is spatially varying field. It is natural to probabilistically describe the load function $p(x)$ as a random field. In particular, we describe the prior distribution over the components $p_N(x),$ $p_H(x)$, and $p_V(x)$ with independent Gaussian processes (see e.g., \citep{GPML2005}). A Gaussian process defines a probability distribution over functions and can be interpreted as the infinite-dimensional analog of the more common multivariate Gaussian distribution. Like a multivariate Gaussian distribution, which is completely defined by its mean vector and covariance matrix, a Gaussian process is completely defined by a mean function and a covariance kernel. The covariance kernel describes the correlation between loads at two points $x$ and $x^\prime$ while the mean function describes the average pressure at a single point. We use $\mu_N(x)$, $\mu_H(x)$, and $\mu_V(x)$ to denote the mean functions for each component and $k_N(x,x^\prime)$, $k_H(x,x^\prime)$, and $k_V(x,x^\prime)$ to denote the corresponding covariance kernels. Together, these functions define Gaussian process distributions over each component \begin{linenomath*} \begin{eqnarray} p_N(x) &\sim& GP\left(\mu_N(x), k_N(x,x^\prime) \right) \\ p_H(x) &\sim& GP\left(\mu_H(x), k_H(x,x^\prime) \right) \\ p_V(x) &\sim& GP\left(\mu_V(x), k_V(x,x^\prime) \right). \end{eqnarray} \end{linenomath*} We further assume that all of the covariance kernels take the form \begin{linenomath*} \begin{equation} k(x,x^\prime) = k_{12}\left(\tan^{-1}\left[\frac{x_2}{x_1}\right],\tan^{-1}\left[\frac{x^\prime_2}{x^\prime_1}\right]\right)k_3\left(x_3, x^\prime_3\right), \end{equation} \end{linenomath*} where $x_i$ denotes component $i$ of the location $x$, $\tan^{-1}\left[\frac{x_2}{x_1}\right]$ is the angle around the buoy, $k_{12}$ is a 1d periodic covariance kernel defining the meridional (horizontal) correlation of $p(x)$, and $k_3$ is a Matern kernel with $\nu=3/2$ defining the vertical correlation. The standard deviation (i.e., $\sqrt{k(x,x)}$) is set to $4.0$ MPa for $k_N$ and $0.5$ MPa for both $k_H$ and $k_V$. These standard deviations were chosen to reflect \reviewchange{the} low probability that pressures would three times these values due to the mechanical properties of the ice. The lengthscale used in all meridional kernels is $\frac{\pi}{20}$ while the lengthscale used in all vertical kernels is $50$ cm. These were chosen based on the anticipated smoothness of the pressure fields. As mentioned above, in order to use these Gaussian process descriptions with the finite element discretization described above, we need to discretize the pressure function $p(x)$. To do this with our Gaussian process prior distribution, we evaluate the mean function at every FEM degree of freedom in $\Gamma_p$ and evaluate the covariance kernel for every pair of locations. The result is a finite dimensional Gaussian distribution that is more convenient to work with than the infinite dimensional Gaussian process. The density over the vector of nodal pressures $p$ is then given by \begin{linenomath*} \begin{equation} \pi(p) = N(\mu_p,\Sigma_p) = \frac{1}{\sqrt{\left|2\pi \Sigma_p\right| }} \exp\left[-\frac{1}{2} \left(p-\mu_p\right)^T \Sigma_p^{-1} \left(p-\mu_p\right)\right], \label{eq:prior} \end{equation} \end{linenomath*} where \begin{linenomath*} \begin{equation} p = \left[\begin{array}{c}p_N\\p_H\\p_V \end{array}\right], \qquad \mu_p = \left[\begin{array}{c} \mu_N\\ \mu_H\\ \mu_V \end{array}\right], \qquad \Sigma_p = \left[\begin{array}{ccc} \Sigma_{N} & 0 & 0\\ 0 & \Sigma_{H} & 0\\ 0 & 0 & \Sigma_{V}\end{array}\right], \end{equation} \end{linenomath*} and $\mu_{N,i} = \mu_N(x^{(i)})$, $\Sigma_{N,ij} = k(x^{(i)}, x^{(j)})$, and $x^{(i)}$ denotes the location of mesh node $i$ in $\Omega_p$. The Gaussian density $\pi(p)$ denotes the prior distribution over the external pressures. \subsubsection{Likelihood function} The likelihood function describes the distribution of anticipated observations for a particular load $p$, i.e., What strains are likely to be observed for a particular load? Our finite element model is a relatively accurate representation of the buoy. We would therefore expect the modeled strain $\varepsilon_{mod}$, given by Eq.\eqref{eq:strain}--\eqref{eq:strain2}, to be close to the observed strain $\varepsilon_{obs}$ if the true pressures were used in the model. With an accurate model, the difference between $\varepsilon_{mod}$ and $\varepsilon_{obs}$ is then mostly a result of noise in the observations. We model this noise with a Gaussian random variable $z\sim N(0,\sigma_z^2 I)$ and assume the additive form \begin{linenomath*} \begin{equation} \varepsilon_{obs} = \varepsilon_{mod} + z . \label{eq:strain_model} \end{equation} \end{linenomath*} The likelihood function $\pi(\varepsilon_{obs} | p)$ is then a Gaussian density over the difference $\varepsilon_{obs} -\varepsilon_{mod}$. In particular, \begin{linenomath*} \begin{equation} \pi(\varepsilon_{obs} | p) = \left(2\pi\sigma_z^2\right)^{-N_z/2}\exp\left[-\frac{1}{\sigma_z^2} \left\|\varepsilon_{obs}- BK^{-1}DAp\right\|^2\right], \label{eq:likelihood} \end{equation} \end{linenomath*} where the finite element model defined in Eq.\eqref{eq:strain} and \eqref{eq:strain2} has been introduced to make the dependence on $p$ explicit. \subsubsection{Posterior distribution} Multiplying the Gaussian prior in Eq.\eqref{eq:prior} with the Gaussian likelihood in Eq.\eqref{eq:likelihood} yields the Bayesian posterior $\pi(p | \varepsilon_{obs})\propto \pi(\varepsilon_{obs} | p)\pi(p)$, which is also Gaussian and defined by a mean vector $\mu_{p|\varepsilon}$ and a covariance matrix $\Sigma_{p|\varepsilon}$. To simplify notation, consider the prior predictive covariance \begin{linenomath*} \begin{equation} \Sigma_{\varepsilon} = \left(BK^{-1}DA\right) \Sigma_p \left(BK^{-1}DA\right)^T + \sigma_z^2 I, \end{equation} \end{linenomath*} and the Kalman gain \begin{linenomath*} \begin{equation} G = \Sigma_p \left(BK^{-1}DA\right)^T \Sigma_{\varepsilon}^{-1}. \end{equation} \end{linenomath*} The posterior mean and covariance are then given by \begin{linenomath*} \begin{eqnarray} \mu_{p | \varepsilon} &= &\mu_p + G\left( \varepsilon_{obs} - \left(BK^{-1}DA\right)p\right)\\ \Sigma_{p|\varepsilon} &=& \Sigma_{p} - G \left(BK^{-1}DA\right) \Sigma_p. \end{eqnarray} \end{linenomath*} The posterior mean $\mu_{p|\varepsilon}$ describes the most likely pressures while the posterior covariance $\Sigma_{p|\varepsilon}$ characterizes the remaining uncertainty. Note that the block structure in $\Sigma_p$ and $A$ enable the posterior mean and covariance to be efficiently constructed without explicitly building or storing the full covariance $\Sigma_p$. The Gaussianity of the prior and likelihood, combined with the use of a linear model, allows us to compute the posterior analytically rather than having to use computationally expensive sampling methods like Markov chain Monte Carlo. \tikzstyle{block} = [rectangle, draw, text width=5em, text centered, minimum height=4em] \tikzstyle{line} = [draw, -latex']
\section{Introduction} Mosquito population control is a vital public-health practice throughout the world and especially in the tropics because mosquitoes spread many diseases, such as malaria and various viruses. Today several kind of mathematical models of mosquito population are known (see \cite{B}, \cite{J}, \cite{RV}, \cite{Rpd} and references therein). A mathematical model of mosquito dispersal in continuous time was investigated in \cite{LP}. Recently, in \cite{RV} a discrete-time dynamical system, generated by an evolution operator of this mosquito population is studied. It is known that during a lifetime mosquitoes undergo complete metamorphosis going through four distinct stages of development: egg, larva, pupa and adult \cite{B}, \cite{Mosquito}. In \cite{J.Li} continuous-time model of mosquito population with Allee effects is studied, here we consider a discrete-time dynamical system of this model. Consider a wild mosquito population without the presence of sterile mosquitoes and in a simplified stage-structured population, one groups the three aquatic stages into the larvae class by $x$, and divide the mosquito population into the larvae class and the adults, denoted by $y$. Moreover, assume that the density dependence exists only in the larvae stage \cite{J.Li}. Denote the birth rate, i.e., the oviposition rate of adults by $\beta(t)$; the rate of emergence from larvae to adults by a function of the larvae with the form of $\alpha(1-k(x))$, where $\alpha>0$ is the maximum emergence rate, $0\leq k(x)\leq 1$, with $k(0)=0, k'(x)>0$, and $\lim\limits_{x\rightarrow \infty}k(x)=1$, is the functional response due to the intraspecific competition \cite{J}. Moreover, we assume the death rate of larvae be a linear function, denoted by $d_{0}+d_{1}x$, and the death rate of adults be constant, denoted by $\mu$. Then, in the absence of sterile mosquitoes, we get the following system of equations: \begin{equation}\label{sys} \left\{% \begin{array}{ll} \frac{dx}{dt}=\beta(t) y-\alpha(1-k(x))x-(d_{0}+d_{1}x)x,\\[3mm] \frac{dy}{dt}=\alpha(1-k(x))x-\mu y. \\ \end{array}% \right.\end{equation} We further assume a functional response for $k(x)$, as in \cite{J}, in the form $$k(x)=\frac{x}{1+x}.$$ In \cite{J}, \cite{J.Li} the dynamical system (\ref{sys}) was studied for $\beta(t)=\beta=const$ (i.e. when mosquito adults have no difficulty to find their mates such that no Allee effects are concerned) and the discrete-time version of this model was considered in \cite{BR1} and \cite{BR2}. A component Allee effect is defined as a decrease in any component of fitness with decreasing population size or density. A decrease in the probability of a female mating with decreasing male density is therefore a component Allee effect, and is generally referred to as a "mate-finding Allee effect" \cite{XF}. In the case where adult mosquitoes have difficulty in finding their mates, Allee effects are included and the adult birth rate is given by $$\beta(t)=\frac{\beta y(t)}{\gamma+y(t)},$$ where $\gamma$ is the Allee effect constant. Then stage-structured wild mosquito population model is given by \cite{J.Li}: \begin{equation}\label{system} \left\{% \begin{array}{ll} \frac{dx}{dt}=\frac{\beta y^2}{\gamma+y}-\frac{\alpha x}{1+x}-(d_{0}+d_{1}x)x,\\[3mm] \frac{dy}{dt}=\frac{\alpha x}{1+x}-\mu y. \\ \end{array}% \right.\end{equation} In this paper (as in \cite{JU} -\cite{MS}, \cite{MPR} -\cite{RS}) we study the discrete time dynamical systems associated to the system (\ref{system}). Define the operator $W:{\mathbb{R}^2}\rightarrow {\mathbb{R}^2}$ by \begin{equation}\label{systema} \left\{% \begin{array}{ll} x'=\frac{\beta y^2}{\gamma+y}-\frac{\alpha x}{1+x}-(d_{0}+d_{1}x)x+x,\\[3mm] y'=\frac{\alpha x}{1+x}-\mu y+y, \\ \end{array}% \right.\end{equation} where $\alpha >0, \beta >0, \gamma>0, \mu >0, \ d_{0}\geq0,\ d_{1}\geq0.$ In this paper we consider the operator $W$ (defined by (\ref{systema})) for the case $d_{0}=d_{1}=0$ and our aim is to study trajectories $z^{(n)}=W(z^{(n-1)})$, $n\geq 1$ of any initial point $z^{(0)}=(x^{(0)}, y^{(0)})$. Note that this system (\ref{systema}), for the case when $d_{0}\ne 0$ or $d_{1}\ne 0$ is not studied yet. \section{Dynamical system generated by the operator (\ref{systema})} We assume \begin{equation}\label{par} d_{0}=d_{1}=0 \end{equation} then (\ref{systema}) has the following form \begin{equation}\label{systemacase} W_{0}:\left\{% \begin{array}{ll} x'=\frac{\beta y^2}{\gamma+y}-\frac{\alpha x}{1+x}+x,\\[3mm] y'=\frac{\alpha x}{1+x}-\mu y+y. \\ \end{array}% \right.\end{equation} It is easy to see that if \begin{equation}\label{parametr} 0<\alpha\leq1, \ \beta >0, \ \gamma>0,\ 0<\mu\leq1 \end{equation} then operator (\ref{systemacase}) maps $\mathbb{R}_{+}^{2}=\{(x,y)\in\mathbb{R}^{2}: x\geq0, y\geq0\}$ to itself. \subsection{Fixed points.}\ A point $z\in\mathbb{R}_{+}^{2}$ is called a fixed point of $W_{0}$ if $W_{0}(z)=z$. For fixed point of $W_{0}$ the following holds. \begin{pro}\label{fixed} The fixed points for (\ref{systemacase}) are as follows: \begin{itemize} \item If $\beta\leq\mu(1+\frac{\gamma\mu}{\alpha})$ then the operator (\ref{systemacase}) has a unique fixed point $z=(0,0).$ \item If $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ then mapping (\ref{systemacase}) has two fixed points $$z_{1}=(0,0), \ \ z_{2}=\left(\frac{\gamma\mu^2}{\alpha(\beta-\mu)-\gamma\mu^2},\frac{\gamma\mu}{\beta-\mu}\right).$$ \end{itemize} \end{pro} \begin{proof} We need to solve \begin{equation}\label{Fsystema} \left\{% \begin{array}{ll} x=\frac{\beta y^2}{\gamma+y}-\frac{\alpha x}{1+x}+x,\\[3mm] y=\frac{\alpha x}{1+x}-\mu y+y \\ \end{array}% \right.\end{equation} It is easy to see that $x_{1}=0,\ y_{1}=0$ and $x_{2}=\frac{\gamma\mu^2}{\alpha(\beta-\mu)-\gamma\mu^2},\ y_{2}=\frac{\gamma\mu}{\beta-\mu}$ are solution to (\ref{Fsystema}). If $\beta\leq\mu(1+\frac{\gamma\mu}{\alpha})$ then $x_{2}\notin\mathbb{R}_{+},$ otherwise $x_{2}\in\mathbb{R}_{+}.$ \end{proof} \subsection{The type of the fixed point.}\ Now we shall examine the type of the fixed point. \begin{defn}\label{d1} (see \cite{D}) A fixed point $z$ of an operator $W$ is called \texttt{hyperbolic} if its Jacobian $J$ at $z$ has no eigenvalues on the unit circle. \end{defn} \begin{defn}\label{d2} (see \cite{D}) A hyperbolic fixed point $z$ is called: \begin{itemize} \item[1)] \texttt{attracting} if all the eigenvalues of the Jacobian matrix $J(z)$ are less than 1 in absolute value; \item[2)] \texttt{repelling} if all the eigenvalues of the Jacobian matrix $J(z)$ are greater than 1 in absolute value; \item[3)] a \texttt{saddle} otherwise. \end{itemize} \end{defn} To find the type of a fixed point of the operator (\ref{systemacase}) we write the Jacobian matrix: $$J(z)=J_{W_{0}}=\left(% \begin{array}{cc} 1-\frac{\alpha}{(1+x)^2} & \frac{\beta y(2\gamma+y)}{(\gamma+y)^2} \\ \frac{\alpha}{(1+x)^2} & 1-\mu \\ \end{array}% \right).$$ The eigenvalues of the Jacobian matrix at the fixed point $(0.0)$ are as follows $$\lambda_{1}=1-\alpha,\ \lambda_{2}=1-\mu.$$ By (\ref{parametr}) we have $0\leq\lambda_{1,2}<1$. Let \begin{equation}\label{x^*y^*}x^*=\frac{\gamma\mu^2}{\alpha(\beta-\mu)-\gamma\mu^2},\ y^*=\frac{\gamma\mu}{\beta-\mu}. \end{equation} We calculate eigenvalues of Jacobian matrix at the fixed point ($x^*,y^*)$. If we denote $1-\lambda=\Lambda$ then we obtain $$\Lambda^2-(\mu+A)\Lambda+A(\mu-B)=0,$$ where $A=\frac{\alpha}{(1+x^*)^2},\ B=\frac{\beta y^*(2\gamma+y^*)}{(\gamma+y^*)^2}.$ \begin{equation}\label{l12} \Lambda_{1}=1-\lambda_{1}=\frac{1}{2}\left(\mu+A+\sqrt{(\mu-A)^2+4AB}\right), \ \Lambda_{2}=1-\lambda_{2}=\frac{1}{2}\left(\mu+A-\sqrt{(\mu-A)^2+4AB}\right). \end{equation} The inequality $|\lambda_{1,2}|<1$ is equivalent to $0<\Lambda_{1,2}<2.$ Since $\mu+A<2$ (see \ref{parametr}), the inequality $0<\Lambda_{1,2}<2$ is equivalent to the following: $$\left\{% \begin{array}{ll} \mu+A-\sqrt{(\mu-A)^2+4AB}>0 \\[2mm] \mu+A+\sqrt{(\mu-A)^2+4AB}<4. \end{array}% \right.$$ From the first inequality $\mu+A-\sqrt{(\mu-A)^2+4AB}>0$ of the system we have $\mu>B$. If we consider $$B=\frac{\beta y^*(2\gamma+y^*)}{(\gamma+y^*)^2}=\beta(1-\frac{\gamma^2}{(\gamma+y^*)^2})=\beta-\frac{1}{\beta}(\beta-\mu)^2, \ \ \beta>\mu(1+\frac{\gamma\mu}{\alpha})$$ then $\mu>\beta-\frac{1}{\beta}(\beta-\mu)^2.$ From this $$\frac{1}{\beta}(\beta-\mu)^2>\beta-\mu \ \Rightarrow \ \mu<0.$$. It is a contradiction for (\ref{parametr}). Therefore, the fixed point ($x^*,y^*)$ is not attracting. The inequality $|\lambda_{1,2}|>1$ is equivalent to $\Lambda_1<0$ \ or \ $\Lambda_2>2$ \ or \ $\Lambda_2<0,\ \Lambda_1>2$. For the values of parameters given in (\ref{parametr}) the inequalities $$\Lambda_1=\frac{1}{2}\left(\mu+A+\sqrt{(\mu-A)^2+4AB}\right)<0,\ \ \Lambda_2=\frac{1}{2}\left(\mu+A-\sqrt{(\mu-A)^2+4AB}\right)>2$$ do not hold. Next we check the case $\Lambda_2<0,\ \Lambda_1>2:$ \begin{equation}\label{l1l2}\left\{% \begin{array}{ll} \Lambda_2=\frac{1}{2}\left(\mu+A-\sqrt{(\mu-A)^2+4AB}\right)<0 \\[2mm] \Lambda_1=\frac{1}{2}\left(\mu+A+\sqrt{(\mu-A)^2+4AB}\right)>2. \end{array}% \right. \end{equation} From the first inequality in the system (\ref{l1l2}) one has $\mu>0,$ i.e., the first inequality is always true under condition (\ref{parametr}). The second inequality of the system derives: \begin{equation} \alpha^2-2\left(\frac{\gamma\mu^2}{\beta-\mu}+\frac{\beta(2-\mu)}{2\beta+\mu(\beta-\mu)}\right)\alpha+\left(\frac{\gamma\mu^2}{\beta-\mu}\right)^2>0. \end{equation} Let \begin{equation}\label{alpha12} \begin{split} \alpha_1&=\frac{\gamma\mu^2}{\beta-\mu}+\frac{\beta(2-\mu)}{2\beta+\mu(\beta-\mu)}+\sqrt{\frac{\beta(2-\mu)}{2\beta+\mu(\beta-\mu)}\left(\frac{2\gamma\mu^2}{\beta-\mu}+\frac{\beta(2-\mu)}{2\beta+\mu(\beta-\mu)}\right)},\\ \alpha_2&=\frac{\gamma\mu^2}{\beta-\mu}+\frac{\beta(2-\mu)}{2\beta+\mu(\beta-\mu)}-\sqrt{\frac{\beta(2-\mu)}{2\beta+\mu(\beta-\mu)}\left(\frac{2\gamma\mu^2}{\beta-\mu}+\frac{\beta(2-\mu)}{2\beta+\mu(\beta-\mu)}\right)}. \end{split} \end{equation} It is obvious that the second inequality in (\ref{l1l2}) is not true under condition $\frac{\gamma\mu^2}{\beta-\mu}<\alpha<\alpha_1\leq1$ . Hence, the fixed point $(x^*,y^*)$ is not repelling. If $\alpha_1<\alpha$, then the fixed point $(x^*,y^*)$ is repelling. Thus for the type of fixed points the following proposition holds. \begin{pro}\label{type} Let $\alpha_1, \ \alpha_2$ are defined in (\ref{alpha12}). The type of the fixed points for (\ref{systemacase}) are as follows: \begin{itemize} \item[i)] if $\beta\leq\mu(1+\frac{\gamma\mu}{\alpha})$, then the operator (\ref{systemacase}) has unique fixed point $(0,0)$ which is attracting. \item[ii)]if \ $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$, then the operator has two fixed points $(0,0)$, $(x^*,y^*)$, and the point $(0,0)$ is attracting, the point $$(x^*,y^*)=\left\{\begin{array}{lll} repelling, \ \ \mbox{if} \ \ \alpha >\alpha_1 \\[2mm] saddle, \ \ \mbox{if} \ \ \alpha<\alpha_1\leq1 \\[2mm] non-hyperbolic, \ \ \mbox{if} \ \ \alpha=\alpha_{1},\alpha_{2}. \end{array}\right.$$ \end{itemize} \end{pro} \subsection{The limits of trajectories}\ The following theorem describes the trajectory of any initial point $(x^{(0)}, y^{(0)})$ in $\mathbb{R}^2_{+}$. \begin{thm}\label{pr} For the operator $W_{0}$ given by (\ref{systemacase}) for any initial point $(x^{(0)}, y^{(0)})\in \mathbb R^2_+$ the following hold: \begin{itemize} \item[(i)] If $y^{(n)}>\frac{\alpha}{\mu}$ for any natural number $n$ then $\lim\limits_{n\to \infty}x^{(n)}=+\infty, \ \lim\limits_{n\to \infty}y^{(n)}=\frac{\alpha}{\mu};$ \item[(ii)] If there exists $n_{0}$ number such that $y^{(n_{0})}\leq\frac{\alpha}{\mu}$ and $\beta\leq\mu(1+\frac{\gamma\mu}{\alpha})$ then $\lim\limits_{n\to \infty}x^{(n)}=0, \ \lim\limits_{n\to \infty}y^{(n)}=0;$ \end{itemize} where $(x^{(n)}, y^{(n)})=W_0^n(x^{(0)}, y^{(0)})$, with $W_{0}^n$ is $n$-th iteration of $W_{0}$. \end{thm} \begin{proof} First, we prove the assertion $(i)$. Let all values of $y^{(n)}$ are greater than $\frac{\alpha}{\mu}$. Then $$y^{(n+1)}-y^{(n)}=\frac{\alpha x^{(n)}}{1+x^{(n)}}-\mu y^{(n)}<\alpha-\mu y^{(n)}=\mu(\frac{\alpha}{\mu}-y^{(n)})<0.$$ So $y^{(n)}$ is a decreasing sequence. Since $y^{(n)}$ is decreasing and bounded from below we have: \begin{equation}\label{y[n]>a} \lim_{n\to \infty}y^{(n)}\geq\frac{\alpha}{\mu}. \end{equation} We estimate $y^{(n)}$ by the following: $$y^{(n)}=\frac{\alpha x^{(n-1)}}{1+x^{(n-1)}}+(1-\mu)y^{(n-1)}<\alpha+(1-\mu)y^{(n-1)}<\alpha+(1-\mu)(\alpha+(1-\mu)y^{(n-2)})$$ $$<\alpha+\alpha(1-\mu)+(1-\mu)^2(\alpha+(1-\mu)y^{(n-3)})< ...<\alpha+\alpha(1-\mu)+\alpha(1-\mu)^2+...+\alpha(1-\mu)^{n-1}$$ $$+(1-\mu)^{n}y^{(0)}=\frac{\alpha}{\mu}+(1-\mu)^{n}(y^{(0)}-\frac{\alpha}{\mu}).$$ Thus $y^{(n)}<\frac{\alpha}{\mu}+(1-\mu)^{n}(y^{(0)}-\frac{\alpha}{\mu})$. Consequently \begin{equation}\label{y[n]<a} \lim_{n\to \infty}y^{(n)}\leq\frac{\alpha}{\mu}. \end{equation} By (\ref{y[n]>a}) and (\ref{y[n]<a}) we have \begin{equation}\label{y[n]=a} \lim\limits_{n\to \infty}y^{(n)}=\frac{\alpha}{\mu}. \end{equation} From (\ref{y[n]=a}) and $y^{(n)}=\frac{\alpha x^{(n-1)}}{1+x^{(n-1)}}-\mu y^{(n-1)}+y^{(n-1)}$ it follows $\lim\limits_{n\to \infty}x^{(n)}=+\infty.$ Let's prove the assertion $(ii)$. If $y^{(n-1)}\leq\frac{\alpha}{\mu}$ then $y^{(n)}<\frac{\alpha}{\mu}$. Indeed, $$y^{(n)}=(1-\mu)y^{(n-1)}+\frac{\alpha x^{(n-1)}}{1+x^{(n-1)}}\leq(1-\mu)\frac{\alpha}{\mu}+\frac{\alpha x^{(n-1)}}{1+x^{(n-1)}}$$ $$=\frac{\alpha}{\mu}-\alpha(1-\frac{x^{(n-1)}}{1+x^{(n-1)}})<\frac{\alpha}{\mu}.$$ Let \begin{equation}\label{beta} \beta<\mu(1+\frac{\gamma\mu}{\alpha}). \end{equation} If $\beta<\mu(1+\frac{\gamma\mu}{\alpha})$ then there exists $k>1$ such that $\beta\cdot k=\mu(1+\frac{\gamma\mu}{\alpha})$. Denote $c^{(n)}=x^{(n)}+y^{(n)}$ and $c^{(n)}_{0}=k\cdot x^{(n)}+y^{(n)}$, where $x^{(n)}, y^{(n)}$ defined by the following \begin{equation}\label{recc}\begin{array}{ll} x^{(n)}=\frac{\beta (y^{(n-1)})^2}{\gamma+y^{(n-1)}}-\frac{\alpha x^{(n-1)}}{1+x^{(n-1)}}+x^{(n-1)},\\[3mm] y^{(n)}=\frac{\alpha x^{(n-1)}}{1+x^{(n-1)}}-\mu y^{(n-1)}+y^{(n-1)},\ \ n=1,2,3,...\ . \end{array}\end{equation} By $y^{(n-1)}\leq\frac{\alpha}{\mu}$ and $\beta<\mu(1+\frac{\gamma\mu}{\alpha})$ we have \begin{equation}\label{x+y} (\beta-\mu)y^{(n-1)}-\gamma\mu<0,\ \ (1+\frac{\gamma\mu}{\alpha})\frac{y^{(n-1)}}{\gamma+y^{(n-1)}}-1<0. \end{equation} By using (\ref{x+y}) to the equalities $c^{(n)}$ and $c_{0}^{(n)}$ we obtain the followings. $$c^{(n)}=x^{(n)}+y^{(n)}=x^{(n-1)}+y^{(n-1)}+$$ $$+\frac{y^{(n-1)}}{\gamma+y^{(n-1)}}((\beta-\mu)y^{(n-1)}-\gamma\mu)< x^{(n-1)}+y^{(n-1)}=c^{(n-1)},$$ $$c_{0}^{(n)}=k\cdot x^{(n)}+y^{(n)}=k\cdot x^{(n-1)}+y^{(n-1)} +(1-k)\frac{\alpha x^{(n-1)}}{1+x^{(n-1)}}+$$ $$ +\mu y^{(n-1)}((1+\frac{\gamma\mu}{\alpha})\frac{y^{(n-1)}}{\gamma+y^{(n-1)}}-1)<k\cdot x^{(n-1)}+y^{(n-1)}=c_{0}^{(n-1)}.$$ Hence both sequences $\{c^{(n)}\}$ and $\{c^{(n)}_{0}\}$ are monotone and bounded, i.e., $$0<...< c^{(n)}< c^{(n-1)}<...< c^{(0)},$$ $$ 0<...< c^{(n)}_{0}< c^{(n-1)}_{0}<...< c^{(0)}_{0}.$$ Thus $\{c^{(n)}\}$ and $\{c^{(n)}_{0}\}$ have limit points, denote the limits by $c^*$ and $c^*_{0}$ respectively. Consequently, the following limits exist $$\tilde{x}=\lim_{n\to \infty}x^{(n)}=\frac{1}{1-k}\lim_{n\to \infty}(c^{(n)}-c^{(n)}_{0})=\frac{1}{1-k}(c^*-c^*_{0}),$$ $$\tilde{y}=\lim_{n\to \infty}y^{(n)}=c^*-\tilde{x}.$$ and by (\ref{recc}) we have $$\tilde{x}=\frac{\beta \tilde{y}^2}{\gamma+\tilde{y}}-\frac{\alpha \tilde{x}}{1+\tilde{x}}+\tilde{x},\ \ \tilde{y}=\frac{\alpha \tilde{x}}{1+\tilde{x}}-\mu \tilde{y}+\tilde{y},$$ i.e., $\tilde{x}=0, \tilde{y}=0.$ In the case $\beta=\mu(1+\frac{\gamma\mu}{\alpha})$ also the monotone decreasing sequence $c^{(n)}$ is bounded from below. From the existence of the limit of $c^{(n)}$ and by (\ref{recc}) we have $\lim\limits_{n\to \infty}x^{(n)}=0, \ \lim\limits_{n\to \infty}y^{(n)}=0.$ \end{proof} \subsection{Dynamics on invariant sets.}\ A set $A$ is called invariant with respect to $W_{0}$ if $W_{0}(A)\subset A$. Denote $$\Omega_1=\{(x,y)\in\mathbb{R}_+^{2}, \ \ 0\leq x\leq x^*, \ \ 0\leq y\leq y^*\}\setminus\{(x^*,y^*)\}$$ $$\Omega_2=\{(x,y)\in\mathbb{R}_+^{2}, \ \ x^*\leq x, y^*\leq y\}\setminus\{(x^*,y^*)\}$$ where $(x^*,y^*)$ is the fixed point defined by $(\ref{x^*y^*})$. Let us consider the dynamics of the operator $W_{0}$ given by (\ref{systemacase}) in the sets $\Omega_1,\ \Omega_2$ under condition $\beta>\mu(1+\frac{\gamma\mu}{\alpha}).$ \begin{lemma} The sets $\Omega_1$ and $\Omega_2$ are invariant with respect to $W_{0}.$ \end{lemma} \begin{proof} \textbf{1)} Let $0\leq x\leq x^*, 0\leq y\leq y^*.$ Then $$x'-x^*=\frac{\beta y^2}{\gamma+y}+x(1-\frac{\alpha}{1+x})-x^*\leq\frac{\beta y^{*2}}{\gamma+y^*}+x^*(1-\frac{\alpha}{1+x})-x^*$$ $$=\frac{\beta y^{*2}}{\gamma+\frac{\gamma\mu}{\beta-\mu}}-\frac{\alpha x^*}{1+x}\leq\frac{\beta-\mu}{\gamma}y^{*2}-\frac{\alpha x^*}{1+x^*}$$ $$=\frac{\beta-\mu}{\gamma}y^{*2}-\mu y^*=y^*(\frac{\beta-\mu}{\gamma}\cdot\frac{\gamma\mu}{\beta-\mu}-\mu)=0.$$ $y^*-y'=y^*-(1-\mu)y-\frac{\alpha x}{1+x}\geq y^*-(1-\mu)y^*-\frac{\alpha x^*}{1+x^*}=\mu y^*-\frac{\alpha x^*}{1+x^*}=0.$\\ Thus $(x',y')\in W_0(\Omega_1)\subset\Omega_1$ \textbf{2)} Let $x\geq x^*, y\geq y^*.$ Then $$x^*-x'=x^*-\frac{\beta y^2}{\gamma+y}-x(1-\frac{\alpha}{1+x})\leq x^*-\frac{\beta y*^2}{\gamma+y^*}-x^*(1-\frac{\alpha}{1+x})$$ $$=\frac{\alpha x^*}{1+x}-\frac{\beta-\mu}{\gamma}y^{*^2}\leq\frac{\alpha x^*}{1+x^*}-\frac{\beta-\mu}{\gamma}y^{*^2}$$ $$=y^*(\mu-\frac{\beta-\mu}{\gamma}\frac{\gamma\mu}{\beta-\mu})=0.$$ $$y'-y^*=\frac{\alpha x}{1+x}+(1-\mu)y-y^*\geq\frac{\alpha x^*}{1+x^*}+(1-\mu)y^*-y^*=0.$$ Thus $(x',y')\in W_0(\Omega_2)\subset\Omega_2.$ \end{proof} The following theorem describes the trajectory of any point $(x^{(0)}, y^{(0)})$ in invariant sets. \begin{thm}\label{pr1} For the operator $W_{0}$ given by (\ref{systemacase}) (i.e. under condition (\ref{parametr})), if $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ then for any initial point $(x^{(0)}, y^{(0)})$, the following hold $$\lim_{n\to \infty}x^{(n)}=\left\{\begin{array}{ll} 0, \ \ \ \ \ \ \mbox{if} \ \ (x^{(0)}, y^{(0)})\in\Omega_1, \\[2mm] +\infty, \ \ \mbox{if} \ \ (x^{(0)}, y^{(0)})\in\Omega_2 \end{array}\right.$$ $$\lim_{n\to \infty}y^{(n)}=\left\{\begin{array}{ll} 0, \ \ \ \ \ \ \mbox{if} \ \ (x^{(0)}, y^{(0)})\in\Omega_1, \\[2mm] \frac{\alpha}{\mu}, \ \ \ \ \ \mbox{if} \ \ (x^{(0)}, y^{(0)})\in\Omega_2 \end{array}\right.$$ where $(x^{(n)}, y^{(n)})=W_0^n(x^{(0)}, y^{(0)})$. \end{thm} \begin{proof} Adding $x^{(n)}$ and $y^{(n)}$ we get (see (\ref{x^*y^*})) \begin{equation}\label{xn+yn} x^{(n)}+y^{(n)}=x^{(n-1)}+y^{(n-1)}-\frac{(\beta-\mu)y^{(n-1)}}{\gamma+y^{(n-1)}}(y^*-y^{(n-1)}). \end{equation} We need to the following lemmas. \begin{lemma}\label{border} For any parameters satisfying (\ref{parametr}) and for arbitrary initial point $(x^{(0)}, y^{(0)})$ in $\mathbb{R}^2_{+}$ the sequence $y^{(n)}$ (defined in (\ref{recc})) is bounded: $$0\leq y^{(n)}\leq \left\{\begin{array}{ll} y^{(0)}, \ \ \mbox{if} \ \ y^{(0)}>\frac{\alpha}{\mu}\\[2mm] \frac{\alpha}{\mu}, \ \ \mbox{if} \ \ y^{(0)}<\frac{\alpha}{\mu}. \end{array}\right.$$ \end{lemma} \begin{proof} Note that on the set $\mathbb{R}_{+}$ the function $y(x)=\frac{x}{1+x}$ is increasing and bounded by 1. Therefore $$y^{(n)}=\frac{\alpha x^{(n-1)}}{1+x^{(n-1)}}+(1-\mu)y^{(n-1)}\leq\alpha+(1-\mu)y^{(n-1)}\leq\alpha+(1-\mu)(\alpha+(1-\mu)y^{(n-2)})\leq$$ $$\alpha+\alpha(1-\mu)+(1-\mu)^2(\alpha+(1-\mu)y^{(n-3)})\leq ...\leq\alpha+\alpha(1-\mu)+\alpha(1-\mu)^2+...+\alpha(1-\mu)^{n-1}$$ $$+(1-\mu)^{n}y^{(0)}=\frac{\alpha}{\mu}+(1-\mu)^{n}(y^{(0)}-\frac{\alpha}{\mu}).$$ Thus if the initial point $y^{(0)}>\frac{\alpha}{\mu}$ then for any $m\in\mathbb{N}$ we have $0\leq y^{(m)}\leq y^{(0)}$. Moreover, if $y^{(0)}<\frac{\alpha}{\mu}$ then for any $m\in\mathbb{N}$ we have $0\leq y^{(m)}\leq \frac{\alpha}{\mu}.$ \end{proof} \begin{lemma}\label{Theta1} For sequences $x^{(n)}$ and $y^{(n)}$ in the set $\Omega_1$ the following statements hold: \begin{itemize} \item[1)] For any $n\in\mathbb{N}$ the inequalities $x^{(n)}<x^{(n+1)}$ and $y^{(n)}<y^{(n+1)}$ can not be satisfied at the same time. \item[2)] If $x^{(m-1)}>x^{(m)}$, $y^{(m-1)}>y^{(m)}$ for some $m\in\mathbb{N}$ then $x^{(m)}>x^{(m+1)}$, $y^{(m)}>y^{(m+1)}$. \item[3)] If $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ then $x^{(m-1)}>x^{(m)}$, $y^{(m-1)}<y^{(m)}$ can not be satisfied for any $m\in\mathbb{N}.$ \item[4)] If $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ then $x^{(m-1)}<x^{(m)}$, $y^{(m-1)}>y^{(m)}$ can not be satisfied for any $m\in\mathbb{N}.$ \end{itemize} \end{lemma} \begin{proof} Let $(x^{(0)}, y^{(0)})\in\Omega_1.$ For each $n\in\mathbb{N}$, $x^{(n)}\leq x^*$ and $y^{(n)}\leq y^*.$ \begin{itemize} \item[1)] From (\ref{xn+yn}) we get $(x^{(n)}-x^{(n-1)})+(y^{(n)}-y^{(n-1)})<0.$ Consequently, $x^{(n)}<x^{(n+1)}$ and $y^{(n)}<y^{(n+1)}$ can not be satisfied at the same time. \item[2)] Since the functions $u(x)=x(1-\frac{\alpha}{1+x}), v(y)=\frac{y^2}{\gamma+y}$ are monotonically increasing and by $x^{(m-1)}-x^{(m)}>0$,\ $y^{(m-1)}-y^{(m)}>0$ we have $$x^{(m-1)}(1-\frac{\alpha}{1+x^{(m-1)}})-x^{(m)}(1-\frac{\alpha}{1+x^{(m)}})>0, \ \frac{x^{(m-1)}}{1+x^{(m-1)}}>\frac{x^{(m)}}{1+x^{(m)}}$$ and $$\frac{y^{(m-1)^2}}{\gamma+y^{(m-1)}}>\frac{y^{(m)^2}}{\gamma+y^{(m)}}.$$ Then $$x^{(m)}-x^{(m+1)}=\beta(\frac{y^{(m-1)^2}}{\gamma+y^{(m-1)}}-\frac{y^{(m)^2}}{\gamma+y^{(m)}})+x^{(m-1)}(1-\frac{\alpha}{1+x^{(m-1)}})-x^{(m)}(1-\frac{\alpha}{1+x^{(m)}})>0,$$ $$y^{(m)}-y^{(m+1)}=\alpha(\frac{x^{(m-1)}}{1+x^{(m-1)}}-\frac{x^{(m)}}{1+x^{(m)}})+(1-\mu)(y^{(m-1)}-y^{(m)})>0.$$ \item[3)] Let $\beta>\mu(1+\frac{\gamma\mu}{\alpha}).$ Assume $x^{(m-1)}>x^{(m)}$, $y^{(m-1)}<y^{(m)}$ hold for any $m\in\mathbb{N}.$ Then since $x^{(n)}$ is decreasing and bounded; $y^{(n)}$ is increasing and bounded (see Lemma \ref{border}) there exist their limits $\tilde{x}$, $\tilde{y}\neq0$ respectively. By (\ref{recc}) we obtain $$\left\{ \begin{array}{ll} \frac{\beta \tilde{y}^2}{\gamma+\tilde{y}} =\frac{\alpha \tilde{x}}{1+\tilde{x}}\\[2mm] \frac{\alpha \tilde{x}}{1+\tilde{x}}=\mu \tilde{y}\\ \end{array} \right.$$ i.e. $\tilde{x}=0, \tilde{y}=0.$ This contradiction shows that if $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ then $x^{(m-1)}>x^{(m)}$, $y^{(m-1)}<y^{(m)}$ can not be satisfied for any $m\in\mathbb{N}.$ \item[4)] Let $\beta>\mu(1+\frac{\gamma\mu}{\alpha}).$ Assume $x^{(m-1)}<x^{(m)}$, $y^{(m-1)}>y^{(m)}$ hold for any $m\in\mathbb{N}.$ $(x^{(m)},y^{(m)})\in\Omega_1.$ Then since $x^{(n)}$ is increasing and bounded; $y^{(n)}$ is decreasing and bounded there exist their limits $\tilde{x}\neq0$, $\tilde{y}$ respectively. But by (\ref{recc}) we obtain $\tilde{x}=\lim\limits_{m\rightarrow\infty}x^{(m)}=0.$ This completes proof of part 4. \end{itemize} \end{proof} \begin{lemma}\label{Theta2} For sequences $x^{(n)}$ and $y^{(n)}$ in the set $\Omega_2$ the following statements hold: \begin{itemize} \item[1)] For any $n\in\mathbb{N}$ the inequalities $x^{(n)}>x^{(n+1)}$ and $y^{(n)}>y^{(n+1)}$ can not be satisfied at the same time. \item[2)] If $x^{(m-1)}<x^{(m)}$, $y^{(m-1)}<y^{(m)}$ for some $m\in\mathbb{N}$ then $x^{(m)}<x^{(m+1)}$, $y^{(m)}<y^{(m+1)}$. \item[3)] If $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ then $x^{(m-1)}>x^{(m)}$, $y^{(m-1)}<y^{(m)}$ can not be satisfied for any $m\in\mathbb{N}.$ \item[4)] If $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ then $x^{(m-1)}<x^{(m)}$, $y^{(m-1)}>y^{(m)}$ can not be satisfied for any $m\in\mathbb{N}.$ \end{itemize} \end{lemma} \begin{proof} Let $(x^{(0)}, y^{(0)})\in\Omega_2.$ For each $n\in\mathbb{N}$, $x^{(n)}\geq x^*$ and $y^{(n)}\geq y^*.$ \begin{itemize} \item[1)] From (\ref{xn+yn}) we get $(x^{(n)}-x^{(n-1)})+(y^{(n)}-y^{(n-1)})>0.$ Consequently, $x^{(n)}>x^{(n+1)}$ and $y^{(n)}>y^{(n+1)}$ can not be satisfied at the same time. \item[2)] By $x^{(m)}-x^{(m-1)}>0$, $y^{(m)}-y^{(m-1)}>0$ we have $$x^{(m)}(1-\frac{\alpha}{1+x^{(m)}})-x^{(m-1)}(1-\frac{\alpha}{1+x^{(m-1)}})>0, \ \frac{x^{(m)}}{1+x^{(m)}}>\frac{x^{(m-1)}}{1+x^{(m-1)}}$$ and $$\frac{y^{(m)^2}}{\gamma+y^{(m)}}>\frac{y^{(m-1)^2}}{\gamma+y^{(m-1)}}.$$ Then $$x^{(m+1)}-x^{(m)}=\frac{\beta y^{(m)^2}}{\gamma+y^{(m)}}-\frac{\beta y^{(m-1)^2}}{\gamma+y^{(m-1)}}+x^{(m)}(1-\frac{\alpha}{1+x^{(m)}})-x^{(m-1)}(1-\frac{\alpha}{1+x^{(m-1)}})>0,$$ $$y^{(m+1)}-y^{(m)}=\alpha(\frac{x^{(m)}}{1+x^{(m)}}-\frac{x^{(m-1)}}{1+x^{(m-1)}})+(1-\mu)(y^{(m)}-y^{(m-1)})>0.$$ \item[3)] Similarly to the proof of part $3$ of Lemma \ref{Theta1}. \item[4)] Let $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$. Assume if for any $m\in\mathbb{N}$ the inequalities $x^{(m-1)}<x^{(m)}$, $y^{(m-1)}>y^{(m)}$ are satisfied at the same time, i.e. $x^{(m)}$ is increasing and $y^{(m)}$ is decreasing. Let $$\Delta^{(m)}=(x^{(m+1)}-x^{(m)})+(y^{(m+1)}-y^{(m)})=\frac{(\beta-\mu)y^{(m)}}{\gamma+y^{(m)}}(y^{(m)}-y^*).$$ Since $\{y^{(m)}\}$ is decreasing, $\Delta^{(m)}>0$ for $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ we conclude that the sequence $\{\Delta^{(m)}\}$ is decreasing and bounded from below. Thus $\{\Delta^{(m)}\}$ has a limit and since $y^{(m)}$ has limit we conclude that $x^{(m)}$ has a finite limit. By (\ref{recc}) we have $$\lim_{m\rightarrow\infty}x^{(m)}=0, \ \ \lim_{m\rightarrow\infty}y^{(m)}=0.$$ But this is a contradiction to $\lim\limits_{m\rightarrow\infty}x^{(m)}\neq0$. This completes proof of part 4. \end{itemize} \end{proof} \begin{lemma}\label{Theta12} If $x^{(n)}$ and $y^{(n)}$ in $\Omega_1,$ then there exists $n_0\in\mathbb{N}$ such that $x^{(n)}$ and $y^{(n)}$ are decreasing for $n\geq n_0$, if $x^{(n)}$ and $y^{(n)}$ in $\Omega_2,$ then there exists $m_0\in\mathbb{N}$ such that $x^{(n)}$ and $y^{(n)}$ are increasing for $n\geq m_0$. \end{lemma} \begin{proof} Monotonicity of $x^{(n)}$ and $y^{(n)}$ follow from Lemma \ref{Theta1} and Lemma \ref{Theta2}. \end{proof} \begin{lemma} If $x^{(n)}$ in the set $\Omega_2$ then $x^{(n)}$ is unbounded from above. \end{lemma} \begin{proof} There exists $n_0$ such that the sequences $x^{(n)}$ is increasing for $n\geq n_0.$ Consider \begin{equation}\label{xsys} \left\{ \begin{array}{ll} (x^{(n_{0}+1)}-x^{(n_{0})})+(y^{(n_{0}+1)}-y^{(n_{0})})=\frac{(\beta-\mu)y^{(n_{0})}}{\gamma+y^{(n_{0})}}(y^{(n_{0})}-y^*) \\[2mm] (x^{(n_{0}+2)}-x^{(n_{0}+1)})+(y^{(n_{0}+2)}-y^{(n_{0}+1)})=\frac{(\beta-\mu)y^{(n_{0}+1)}}{\gamma+y^{(n_{0}+1)}}(y^{(n_{0}+1)}-y^*) \\ ... \\ (x^{(n-1)}-x^{(n-2)})+(y^{(n-1)}-y^{(n-2)})=\frac{(\beta-\mu)y^{(n-2)}}{\gamma+y^{(n-2)}}(y^{(n-2)}-y^*)\\[2mm] (x^{(n)}-x^{(n-1)})+(y^{(n)}-y^{(n-1)})=\frac{(\beta-\mu)y^{(n-1)}}{\gamma+y^{(n-1)}}(y^{(n-1)}-y^*) \end{array} \right. \end{equation} Adding equations of (\ref{xsys}) we get $$(x^{(n)}-x^{(n_{0})})+(y^{(n)}-y^{(n_{0})})$$ \begin{equation}\label{xsyst} =(\beta-\mu)\left(\frac{y^{(n_{0})}}{\gamma+y^{(n_{0})}}(y^{(n_{0})}-y^*)+...+\frac{y^{(n-1)}}{\gamma+y^{(n-1)}}(y^{(n-1)}-y^*)\right). \end{equation} Let $y^{(n)}$ (see Lemma \ref{border}) is bounded from above by $\theta$. By (\ref{xsyst}) we have $$x^{(n)}>x^{(n_{0})}+y^{(n_{0})}-\theta+(\beta- \mu)(n-n_{0})(y^{(n_{0})}-y^*)\cdot\frac{y^{(n_{0})}}{\gamma+y^{(n_{0})}}.$$ For $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ from $$\lim_{n\rightarrow\infty}\left(x^{(n_{0})}+y^{(n_{0})}-\theta+(\beta- \mu)(n-n_{0})(y^{(n_{0})}-y^*)\cdot\frac{y^{(n_{0})}}{\gamma+y^{(n_{0})}}\right)=+\infty$$ it follows that $x^{(n)}$ is not bounded from above. \end{proof} Now we continue the proof of theorem. If $(x^{(0)}, y^{(0)})\in\Omega_1$ then by Lemma \ref{Theta12} there exist their limits $\tilde{x}$, $\tilde{y}$ respectively. By (\ref{recc}) we have $$\lim_{n\rightarrow\infty}x^{(n)}=0, \ \ \lim_{n\rightarrow\infty}y^{(n)}=0.$$ If $(x^{(0)}, y^{(0)})\in\Omega_2$ then for $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$ the sequence $y^{(n)}$ has limit $\tilde{y}$ (see Lemma \ref{border}). Consequently, by (\ref{recc}) and $\lim\limits_{n\rightarrow\infty}x^{(n)}=+\infty $ we get $\tilde{y}=\frac{\alpha}{\mu}$. Theorem is proved. \end{proof} \subsection{On the set $\mathbb{R}^2_+\setminus(\Omega_1\bigcup\Omega_2)$}\ In the following examples, we show trajectories of initial points from the set $\mathbb{R}^2_+\setminus(\Omega_1\bigcup\Omega_2)$. Let us consider the operator with parameter values $\alpha=0.8, \beta=0.9, \gamma=2, \mu=0.4$ satisfying the condition $\beta>\mu(1+\frac{\gamma\mu}{\alpha})$. Then by (\ref{x^*y^*}), we get $x^*=4$, $y^* = 1.6$. \begin{ex} If the initial point is $x^{(0)}=0.2, y^{(0)}=4$ then the trajectory of system (\ref{systemacase}) is shown in the Fig.\ref{Fig.1}, i.e., $$\lim_{n\to \infty}x^{(n)}=0, \ \lim_{n\to \infty}y^{(n)}=0.$$ If the initial point is $x^{(0)}=0.2, y^{(0)}=5$ then the trajectory of system (\ref{systemacase}) is shown in the Fig.\ref{Fig.1}. In this case the first coordinate of the trajectory goes to infinite and the second coordinate has limit point $2$, i.e., $$\lim_{n\to \infty}x^{(n)}=+\infty, \ \lim_{n\to \infty}y^{(n)}=\frac{\alpha}{\mu}=2.$$ \end{ex} \begin{ex} If the initial point is $x^{(0)}=5.6$, $y^{(0)}=0.2$ then the trajectory of system (\ref{systemacase}) is shown in the Fig.\ref{Fig.2}, i.e., it converges to $(0,0)$. If the initial point is $x^{(0)}=7$, $y^{(0)}=0.2$ then the trajectory of system (\ref{systemacase}) is shown in the Fig.\ref{Fig.2}. In this case the first coordinate of the trajectory goes to infinite and the second coordinate has limit point $2$. \end{ex} \begin{figure}[h!] \begin{multicols}{2} \hfill \includegraphics[width=0.52\textwidth]{Fig1.jpg}\\ \hfill \caption{$x^{(0)}=0.2,\ y^{(0)}=4$ and $x^{(0)}=0.2,\ y^{(0)}=5$}\label{Fig.1} \hfill \includegraphics[width=0.52\textwidth]{Fig2.jpg}\\ \hfill \caption{$x^{(0)}=5.6,\ y^{(0)}=0.2$ and $x^{(0)}=7,\ y^{(0)}=0.2$}\label{Fig.2} \hfill \end{multicols} \end{figure} \begin{rk} We note that for continuous time system (2) the following results are known (see \cite{J.Li}): All fixed (equilibrium) points are found and their types are determined. Moreover, local behavior of the dynamical system in the neighborhood of the fixed point $(0,0)$ is studied. In our discrete-time case, for $d_0=d_1=0$ we also determined types of all fixed points. Besides this we have been able to study global behavior of the system in neighborhood of $(0,0)$. Also we have found invariant sets and studied the dynamical system on the sets. The last results are not known for the continuous time. \end{rk} \section{Biological interpretations} Each point (vector) $z=(x;y)\in \mathbb{R}^{2}_{+}$ can be considered as a state (a measure) of the mosquito population. Let us give some interpretations of our main results: \begin{itemize} \item[(a)] (Case Theorem \ref{pr}) By (\ref{beta}) we have $\gamma\geq\frac{\alpha(\beta-\mu)}{\mu^2}.$ Under this condition on $\gamma$ (i.e. on Allee effects), the mosquito population dies; \item[(b)] (Case Theorem \ref{pr1}) If the inequality $\gamma<\frac{\alpha(\beta-\mu)}{\mu^2}$ holds for Allee effects $\gamma$, then extinction or survival of the mosquito population depends on their initial state. \end{itemize}
\section{Introduction} \label{sec:intro} The discovery and characterization of exoplanets has been accompanied by an increased interest in the properties of M dwarf stars as potential hosts for habitable planets. M dwarf planetary systems are abundant, not only because M dwarfs are $\gtrsim 70 \%$ of all stars in the Milky Way \citep{Henry2006, Winters2015}, but also because M dwarfs also have an intrinsically high planet occurrence rate compared to their hotter and more massive siblings \citep{Dressing2015}. Moreover, these systems' physical properties benefit their detection and characterization: once for their abundance, twice for the large transit depths of terrestrial planets projected against small stellar radii, and thrice for the short orbital periods of planets with Earth-comparable instellation. The \emph{Transiting Exoplanet Survey Satellite} (\emph{TESS}) is predicted to find 1300 planets orbiting M dwarfs \citep{Ballard2019}, roughly 10 of which will be terrestrial worlds suitable for atmospheric characterization with the \emph{James Webb Space Telescope} \citep{Barclay2018}. These M dwarf planetary systems provide a useful sample for study, but some caution that the ``habitability" potential of these systems may be poor or non-existent \citep{Scalo2007, Shields2016}. An M dwarf is a tempestuous host, prone to flaring \citep{Hawley1993, Kowalski2009, Loyd2018a, Loyd2018b}, particularly when young, where a mid-to-late M dwarf's definition of ``young" lasts for billions of years \citep{West2008}. Compared to the Sun, M dwarfs emit a much higher fraction of their bolometric flux in the ultraviolet regime \citep{West2004, Jones2016}. The extreme ultraviolet region (EUV, defined here as 100 - 912 $\textrm{\AA}$) is particularly responsible for heating and ionizing the upper atmosphere of planets, dumping energy into the system and potentially driving atmospheric escape \citep[e.g.][]{Sekiya1980, SanzForcada2010, OwenJackson2012, TianIda2015, ZahleCatling2017}. Any attempt to study an exoplanet atmosphere's evolution must be informed by the radiation field it is subject to over the entirety of its lifetime \citep{PenzMicela2008, Claire2012, Peacock2020}. But directly measuring the EUV flux is impeded by the same mechanism that makes it important for planet atmospheres: its interactions with atomic hydrogen and helium mean that the interstellar medium blocks some of the flux from this spectral region for most stars \citep{CoxReynolds1987, France2019}. This problem is exacerbated for M dwarfs since the closest M dwarfs with observable EUV flux either have noisy data from the \emph{Extreme Ultraviolet Explorer} (\emph{EUVE}) or no data at all \citep{Craig1997, Linsky2014, France2016}, and there is no presently available dedicated EUV observatory to remedy the situation \citep{France2019}. In the absence of direct observation, we must turn to theoretical inference. \citet{Peacock2019a} and \citet{Peacock2019b} use the \texttt{PHOENIX} 1D stellar atmosphere code \citep{Hauschildt1993, HauschildtBaron2006, BaronHauschildt2007} to model the non-LTE radiative transfer through the chromospheres and transition regions of M dwarfs but do not include a corona. \citet{Fontenla2016} adjusts the temperature and pressure profiles of a 1D stellar atmosphere until the model agrees with the available spectral data, but this takes time to do well and has to be specific to each star. These semi-empirical methods require quasi-simultaneous observations from optical to X-ray wavelengths. All known atomic and molecular processes and species have to be taken into account in each layer, solving the NLTE coupled system to match observations of many lines and continua across the spectral range. This requires a reliable atomic database and laborious fine-tuning to be successful. Taking a more empirical approach, \citet{Linsky2014} identifies correlations between Lyman-$\alpha$ and EUV flux, while \cite{Youngblood2017} identifies correlations between far-ultraviolet (FUV, 912 to 1700 $\textrm{\AA}$) lines and the Lyman-$\alpha$ flux, chaining these correlations to the \citet{Linsky2014} relations to predict the EUV flux in turn. A drawback of this method is that the uncertainty on each correlation introduces scatter into the predicted EUV flux while the sample is insufficiently large to investigate the effects of both effective temperature $T_{\textrm{eff}}$ and stellar activity. \citet{France2018} correlates certain FUV lines with the EUV flux between 90 and 360 $\textrm{\AA}$ directly, leading to much less scatter in the predicted flux and accounting for both $T_{\textrm{eff}}$ and stellar activity in their sample, but this still leaves us with $\sim 600$ $\textrm{\AA}$ of EUV flux to estimate. These limitations of existing methods lead us to use the differential emission measure (DEM), a technique for EUV spectral synthesis adapted from an earlier technique called the emission measure distribution. \citet{Pottasch1963} defined the emission measure distribution $\equiv \frac{n_{\textrm{O}}}{n_{\textrm{H}}}\int n_e^2 \, ds$ as the integral of the electron number density squared ($n_e^2$) along the line of sight $s$ weighted by the relative abundance of oxygen to hydrogen ($\frac{n_\textrm{O}}{n_\textrm{H}}$), to describe the plasma environment of the upper layers of the Sun's atmosphere. This assumed that the Sun's upper atmosphere could be approximated as a series of spherical shells of increasing temperature, and all emission lines were produced by collisional excitation and spontaneous radiative decay within restricted spatial regions. As this picture of spherical symmetry broke down, the differential emission measure was developed to keep the same 1-dimensional simplification to temperature but account for the spatial ambiguity of a photon's origin (see \citealt{Mariska1992} for a detailed overview of the method's history). The differential emission measure uses a similar integral expression over a limited temperature range to estimate the density and temperature environment of ions emitting an observed line, allowing one to then use those environmental conditions to estimate the flux from emission lines that cannot be observed but should be emitted by the same parcel of plasma. When UV detector technology was in its infancy and instruments had poor flux calibration, differing by factors of $\gtrsim 2$ in different wavelength regimes, the DEM could be used to estimate the subset of solar emission line fluxes with poor data from other lines that were thought to have more accurate and precise data \citep{Warren1998}. While the state of solar EUV data has improved, the opacity of the interstellar medium and low sensitivities of previous and current EUV-capable observatories present a similar spectral synthesis problem for distant stars. Variations of the DEM have been applied to other stars like AU Mic by \citet{Pagano2000}, $\alpha$ Centauri A and B by \cite{Ayres2014}, and HD 209458 by \citet{Louden2017} to infer the EUV flux from these stars. \citet{SanzForcada2011} developed scaling relations between X-ray and EUV fluxes by applying the DEM method to a large sample of stars, but the paper's sample had few M dwarfs and lacked enough UV data to constrain the lower temperature end of the DEM for most of their stars. In this paper we characterize our uncertainties in fitting the DEM and propagate them to our predictions of the EUV flux from M dwarfs. Our physical assumptions and setup are similar to the method described and used by \citet{Warren1998} to model the EUV irradiance of the Sun, described in Section \S\ref{sec:dem}. The specifics of our implementation are described in Section \S\ref{sec:implementation} and we test our method against data from the Sun in Section \S\ref{sec:sun}. In Section \S\ref{sec:au_mic} we apply our method to AU Mic, a $\sim 10 - 20$ Myr old M1 star at a distance of 9.979 pc \citep{MacGregor2013, Plavchan2020}. We compare our DEMs of the Sun and AU Mic to previous DEMs published in the literature and available in the \texttt{CHIANTI} atomic database \citep{Dere1997, DelZanna2015} in Section \S\ref{sec:literature_comparison}. We compare our predicted spectra for the Sun and AU Mic to data in detail in Section \S\ref{sec:final_model_spectra} and in Section \S\ref{sec:case_studies} we apply our method to different case studies: GJ 832, a planet-hosting M2 V that has predicted EUV fluxes from \citet{Linsky2014} and semi-empirical models from both \citet{Fontenla2016} and \citet{Peacock2019b}; Barnard's Star, a $\sim 10$ Gyr old M4 with a candidate planet \citep{Ribas2018}, with contemporaneous X-ray and FUV data during quiescence and a flare \citep{France2020}; and TRAPPIST-1, an ultracool dwarf which hosts at least seven planets \citep{Gillon2017} and tests our ability to fit the DEM in an extremely low S/N regime (Wilson et al. submitted ). Our work shows that with \emph{Hubble Space Telescope} (\emph{Hubble} or \emph{HST}) measurements of a few FUV emission line fluxes and a coarse X-ray spectrum from \emph{Chandra} or \emph{XMM-Newton}, we can estimate the EUV spectrum with meaningful uncertainties for any star whose EUV flux is dominated by emission lines from the optically thin regions of the star's upper atmosphere. \section{Differential Emission Measure}\label{sec:dem} The following description of the DEM is adapted from \citet{Warren1998}. Many other formulations of the DEM and similar techniques exist, and \citet{Mariska1992} explains them in more detail. Given an optically thin plasma in a collisionally dominated time-independent equilibrium with negligible collisional de-excitation, the radiance of a wavelength transition is given by \begin{align}\label{eq:radiance} I_{ul} &= \frac{1}{4\pi} \int_{\mathrm{line-of-sight}} n_u A_{ul} \frac{hc}{\lambda_{ul}} \, ds \; [\mathrm{erg} \, \mathrm{s}^{-1} \, \mathrm{cm}^{-2} \, \mathrm{sr}^{-1}], \end{align} \noindent where $ul$ signifies a transition from an upper state $u$ to a lower state $l$, $A_{ul}$ is the Einstein rate coefficient of the transition, $\lambda_{ul}$ is the wavelength of the transition, $h$ is Planck's constant, and $c$ is the speed of light in a vacuum. This quantity is not a spectral density because it captures all of the emission from the spontaneous radiative decay without describing a line profile. We can rewrite this integral as \begin{align}\label{eq:radiance_dem} I_{ul} &= \int_T G_{ul}(T) \cdot \Psi (T)\, dT \; [\mathrm{erg} \, \mathrm{s}^{-1} \, \mathrm{cm}^{-2} \, \mathrm{sr}^{-1}], \end{align} \noindent where \begin{align}\label{eq:gofnt} G_{ul}(T) &= \frac{n_u}{n_{\mathrm{ion}}} \frac{n_{\mathrm{ion}}}{n_{\mathrm{element}}}\frac{n_{\mathrm{element}}}{n_{\mathrm{H}}} \frac{1}{n_e} \frac{A_{ul}hc}{4\pi \lambda_{ul}} \; [\mathrm{erg} \, \mathrm{s}^{-1} \, \mathrm{cm}^{3} \, \mathrm{sr}^{-1}] \end{align} \noindent is the transition's emissivity contribution function and the differential emission measure is \begin{equation}\label{eq:dem} \Psi (T) = n_e n_{\mathrm{H}} \frac{ds}{dT} \; [\mathrm{cm}^{-5} \, \mathrm{K}^{-1}]. \end{equation} $G_{ul}(T)$, the emissivity contribution function, describes the volume integrated power of a parcel of gas as a function of temperature. The function can be computed with a few ingredients: a stellar abundance to give us the ratio of the number density of any particular element's atoms to the number density of hydrogen atoms $\frac{n_{\mathrm{element}}}{n_{\mathrm{H}}}$, the assumption of collisionally dominated equilibrium (i.e. coronal equilibrium) and \texttt{CHIANTI} to give us the population fraction of any particular upper state of an ion $\frac{n_u}{n_{\mathrm{ion}}}$ and the population fraction of each ion per element $\frac{n_{\mathrm{ion}}}{n_{\mathrm{element}}}$, an assumed local density $n_e$, and laboratory measurements or theoretical calculations of the atomic data $A_{ul}$ and $\lambda_{ul}$. We follow \citet{DelZanna2002} in using a constant electron pressure $P_e$ to define $n_e (T) = \frac{P_e}{k_B T}$, where $k_B$ is the Boltzmann constant. This single pressure will not be applicable to the entire temperature domain, but errors in the $G(T)$ function can be partially compensated for by the $\Psi(T)$ function as long as the errors are largely a function of temperature and do not vary significantly across lines formed at the same temperature. The differential emission measure, $\Psi(T)$, describes the density and temperature structure along the line of sight, common to all transitions we observe from the chromosphere, transition region, and corona. Under our assumptions that the ions are predominantly populated by collisions and depopulated by spontaneous emission, the flux observed is proportional to the collision rate. The differential emission measure resembles a reaction rate, $n_e \cdot n_{\textrm{H}}$, weighted by $\frac{ds}{dT}$ which measures how much of the path length $s$ is at a temperature $T$. In emission measure studies of other stars, a volume emission measure is commonly employed that predicts a flux and includes factors of the stellar radius and solid angle filling factor of the emitting plasma. We adopt the line-of-sight approach to be able to compare the DEMs of very different stars to each other and to solar surface features. For each emission line there is a formation temperature $T_f$ that maximizes the product $G_{{ul}}(T)\cdot \Psi(T)$, and since the emissivity function $G_{ul}(T)$ tends to be very narrowly peaked, the bulk of of the observed line flux is emitted by plasma at $\approx T_f$. By measuring the observed line intensities of transitions with a known $G_{ul}(T)$, we can constrain the value of $\Psi(T)$ within the vicinity of the lines' formation temperatures $T_f$. Amassing a list of observable transitions over a sufficiently wide range of $T_f$ allows us to fit for the parameters of an assumed functional form describing $\Psi(T)$ across the temperature domain of the upper stellar atmosphere. With $\Psi(T)$ in hand and atomic data to construct $G_{ul}(T)$ for the transitions we have not observed but seek to estimate, we can reconstruct the optically thin emission of the chromosphere, transition region, and corona. With the exception of the recombination continua addressed in Section \S\ref{sec:euv_fitting}, optically thin emission lines contribute the majority of the EUV flux from an M dwarf. \section{Implementation}\label{sec:implementation} \begin{figure} \centering \includegraphics[width=\textwidth]{gofnt_heatmap.pdf} \caption{The left panel is a heatmap where the shading represents the value of the emissivity contribution function $G_{\lambda}(T)$ as a function of temperature along the horizontal axis and as a function of wavelength along the vertical axis. This matrix is generated from the \texttt{CHIANTI} atomic database by specifying the atomic abundances and the electron density as a function of temperature $n_{e}(T)$. The right panel multiplies the $G_{\lambda} (T)$ matrix by the DEM, $\Psi(T)$, of the Sun shown as a blue line in Figure \ref{fig:sun_euv_dem}. The colorbars of both panels are cut off at the 60$^{\textrm{th}}$ and 95$^{\textrm{th}}$ percentiles to highlight the strongest lines. While the $G_{\lambda}(T)$ matrix shows the atomic data, the right panel represents the temperature integrand for which lines are actually emitted by stars. EUV lines are largely formed at temperatures between $10^5$ and $10^{6.5}$ K, requiring FUV measurements to constrain the low temperature end and X-ray measurements and/or coronal FUV semi-forbidden transitions of highly ionized iron to constrain the high temperature end.} \label{fig:gofnt_heatmap} \end{figure} \begin{sidewaysfigure} \centering \includegraphics[width=1.0\textwidth]{gofnt_all.pdf} \caption{A sample of the emissivity functions $G_{ul}(T)$ and $G_{\lambda}(T)$ described in Sections \S\ref{sec:dem} and \S\ref{sec:implementation}. The solid lines show the summed emissivity functions for some of the strongest transitions of the labeled ion observable by \emph{Hubble} with STIS and COS. The dotted lines show the summed emissivity functions $G_{\lambda} (T)$ for typical wavelength bins in a \emph{Chandra} spectrum of an M dwarf, adding up the $G_{ul}(T)$ functions of all emission lines that fall within the wavelength bin. The ion emissivities are constructed by adding together the emissivities of all lines emitted by that ion, for example both lines of the N V 1239/1243 doublet. The X-ray wavelength bin emissivities are constructed similarly by adding together the emissivities of lines from multiple ions that are emitted at similar wavelengths. This lets us use coarser resolution X-ray spectra for fainter stars but weakens the temperature specificity of individual flux measurements. Note the contribution function for a semi-forbidden transition of \ion{Fe}{21} at 1354 $\textrm{\AA}$ with a formation temperature at $\sim 10^{7}$ K. Its emissivity peaks at a factor of $10^3$ times less than other typically observable FUV lines, making it unobservable for most quiescent M dwarfs. Observing or obtaining an upper limit for the flux of this line provides an additional constraint on $\Psi(T)$ at high temperatures.} \label{fig:gofnt_all} \end{sidewaysfigure} We use \texttt{CHIANTI 8.0.7} \citep{Dere1997, DelZanna2015} to calculate the $G_{ul}(T)$ functions for all the transitions in the database assuming the elements have a solar coronal abundance \citep{Schmelz2012}. We calculate these emissivity contribution functions across a temperature range from $10^4$ to $10^8$ K for multiple assumed electron pressures ranging from $P_e= 10^{12}$ to $10^{25}$ $k_B$ cm$^{-3}$ K. The majority of coronal emission lines are not strongly sensitive to density, but we test the variation in the predicted flux as a function of the $P_e$ used to calculate $G_{ul} (T)$ in Section \S\ref{sec:pressure_sensitivity}. We assume that $\Psi(T)$ is well-described by \begin{equation}\label{eq:dem_cheby} \log_{10}\Psi(T) = \sum_{n=0}^5 c_n \mathbf{T_n} \left(\frac{\log_{10}T - 6}{2}\right) \end{equation} \noindent where $\mathbf{T_n} (x)$ are the Chebyshev polynomials of the first kind, and their argument is shifted and scaled to transform the domain to the interval $[-1, 1]$. We use the Chebyshev polynomials following the previous work of \citet{Louden2017} and because they form an orthonormal basis. Given the coefficients $c_n$, and the list of emissivity contribution functions $G_{ul} (T)$, we can generate a full spectrum by summing the contribution functions of all emission lines within a wavelength bin centered on a wavelength $\lambda$ with a width $\Delta \lambda$ to get a wavelength-specific contribution function \begin{equation}\label{eq:wavelength} G_\lambda (T) = \sum_{\mathrm{transitions}} G_{ul} (T) \ \mathbf{if} \left[\lvert\lambda_{ul} - \lambda\rvert \leq \Delta \lambda \right]. \end{equation} \noindent We then scale the temperature integral of Equation \ref{eq:radiance_dem} to predict the observed flux density in each wavelength bin, assuming the bin is wide enough to contain the entire line profile \begin{equation} F_{\lambda} = \frac{\pi}{\Delta \lambda} \left(\frac{R^2_\star}{d^2}\right) \int_T G_{\lambda} (T) \cdot \Psi(T) \, dT \; [\mathrm{erg} \, \mathrm{s}^{-1} \, \mathrm{cm}^{-2} \, \text{\AA}]. \end{equation} The scaling factor assumes that the solid angle emitting the flux is $\approx \pi \left(\frac{R_\star}{d}\right)^2 $ steradians, which is approximate because the corona extends beyond the stellar radius. We create a matrix of $G_\lambda (T)$ with the wavelength axis at a constant resolving power $R = \frac{\lambda}{\Delta \lambda} = 500$ between 1 and 2000 $\textrm{\AA}$, and the temperature axis as 2000 logarithmically spaced points between $10^4$ and $10^8$ K (see Figure \ref{fig:gofnt_heatmap}). Fitting for the coefficients $c_n$ and combining the $\Psi(T)$ model with this matrix allows us to generate a high-resolution spectrum, but since the DEM makes no prescription for line shape, the line profiles are all Dirac-$\delta$ functions, which is why we then divide by the wavelength bin width $\Delta \lambda$ to get the observed flux density. Comparing this model to a real stellar spectrum is only reasonable at a low enough resolution such that the entirety of the line profile is contained within each resolution element. The $R= \frac{\Delta \lambda}{\lambda}=500$ $G_\lambda(T)$ matrix can be downsampled to whatever resolution is required to contain the line widths of any spectral data used for comparison. By combining either the $G_{ul}(T)$ functions or the $G_{\lambda}(T)$ matrix with the polynomial coefficients $c_n$, we have a generative model for a list of integrated line fluxes or a low-resolution spectrum respectively. To get a usefully constrained model, we need data that covers the full temperature domain. Figure \ref{fig:gofnt_all} shows the $G_{\lambda}(T)$ functions for the wavelength bins of a typical \emph{Chandra} spectrum, where each bin peaks at a slightly different temperature but spans $10^{6}$ and $10^{7.5}$ K, and the $G_{ul}(T)$ functions for the strongest optically thin FUV lines accessible in a \emph{Space Telescope Imaging Spectrograph} (STIS) and \emph{Cosmic Origins Spectrograph} (COS) spectrum from \emph{Hubble}. There is significant overlap in the contribution functions of these transitions near $10^5$ K, but they spread out far enough to constrain $\Psi(T)$ between $10^4$ and $10^{5.5}$ K. Each line flux measurement can be used to derive an average value of $\Psi(T)$ near the formation temperature $T_f$ of the transition \begin{equation} \overline{\Psi} (T_f) = \frac{F_{\textrm{line}}}{\pi \left(\frac{R^2_\star}{d^2}\right) \int_T G_{ul}(T) dT} \end{equation} \noindent and any individual wavelength bin's flux density can provide a similar constraint by substituting $G_{\lambda} (T)$ in for $G_{ul} (T)$ and dividing by the wavelength bin width $\Delta \lambda$. We do not fit to these averages because we can directly compare our predicted fluxes to the data, but the averages are useful for visualizing how an individual flux measurement constrains the DEM. Using the affine-invariant Markov Chain Monte Carlo sampler implemented in the Python package \texttt{emcee} \citep{ForemanMackey2013}, we fit the coefficients $c_n$ (see Equation \ref{eq:dem_cheby}) using a combination of the available X-ray data and integrated FUV line fluxes. Since the uncertainties on the emissivities are unknown and we have little a priori information on how to characterize the systematic uncertainties associated with this method, we assume that the variance is boosted by a scaled multiple of the predicted flux, making our log-likelihood \begin{equation} \ln{\mathcal{L}} = \sum_i \ln\left(\frac{1}{\sqrt{2\pi \left(\sigma_{y_i}^2 + \left(s\cdot f(x_i)\right)^2\right)}}\right) - \left(\frac{y_i - f(x_i)}{2\sqrt{\sigma_{y_i}^2 + \left(s\cdot f(x_i)\right)^2}}\right)^2 \label{eq:likelihood} \end{equation} \noindent where $f(x_i)$ is the model prediction, $y_i$ is the data, $\sigma_{y_i}$ is the Gaussian uncertainty of the data, and $s$ is the free parameter that characterizes these unknown systematic uncertainties (which are assumed to be independent of the data and temperature). Some contributions to $s$ are likely to be errors in stellar parameters like the stellar abundance, deviations of level populations from true collisional equilibrium or variations in the relative abundances along the line of sight, the departure from being perfectly optically thin $\tau = 0$, and the spatial inhomogeneity of the emitting plasma. This form of the likelihood is independent of the two types of data described above, allowing us to mix together combinations of line fluxes and spectra in different wavelength regimes, so long as we ensure that these do not overlap to count the same data twice. We incorporate Bayesian priors on individual parameters to modify the likelihood evaluated in Equation \ref{eq:likelihood}. We sample $\log_{10}(s)$ uniformly between $-2$ and $2$. The mean value of the DEM is set by $c_0$, which is sampled uniformly between 20 to 26 and then exponentially cut off beyond those bounds. These boundary values were chosen to limit the DEM to physical expectations for $10^5 \lesssim n_e \lesssim 10 ^{17}$ cm$^{-3}$, and path-length $10^8 \lesssim ds \lesssim 10^{11}$ cm. The remaining coefficients $c_n$ are sampled uniformly within the bounds $\pm 100$, and then we also require that the base-10 logarithm of the final polynomial be positive at $\log_{10} T = 6$ to prevent unphysically small DEMs and that the derivative be negative at the lower bound $T = 10^4$ K to reflect the higher amount of material in the photosphere compared to the chromosphere. These priors extend generously beyond physically realistic DEM shapes, for example they do not require the DEM to go to 0 at high temperatures, allowing for an infinitely extended corona. Data constrain the parameter distributions to factors of a few at most, with the $s-$factor systematic uncertainty typically restricted to the interval $0.1 < s < 1$. \section{Testing the DEM Method Against the Sun}\label{sec:sun} To test our implementation of the DEM on solar data, we use the Solar Irradiance Reference Spectra (SIRS) published by \citet{Woods2009}. This is a disk-integrated spectrum of the quiescent Sun assembled from measurements collected during the 2008 minimum of the solar activity cycle at 1 $\textrm{\AA}$ resolution. Referring to a list of the lines used for the DEM fitting in \citet{Warren1998}, and making a point to select the FUV lines most likely to be detected in \emph{Hubble} observations of M dwarfs, listed in Table \ref{table:sun_lines}, we measure their fluxes in this spectrum by subtracting the continuum and integrating line profiles. Then we selected the X-ray data between $5$ and $50$ $\textrm{\AA}$, comparable to the regions observed by the \emph{Chandra}-\emph{X-ray} \emph{Observatory} and \emph{XMM}-\emph{Newton}, and left the spectrum at its original resolution of 1 $\textrm{\AA}$ wavelength bins, $R =\frac{\lambda}{\Delta \lambda} \leq 50$. This combination of line fluxes and an X-ray spectrum is the same type of data we use for M dwarfs discussed later in this work. Table \ref{table:sun_lines} also lists the integrated fluxes of EUV lines measured from the \citet{Woods2009} spectrum, used in the test described in Section \S\ref{sec:euv_fitting}. The SIRS did not provide error bars, but we assigned errors such that we had three versions of the data with S/N $=$ 1, 10, and 100 to test the sensitivity of the fitting to S/N. The true errors vary across the observations from different instruments and wavelength ranges assembled by \citet{Woods2009}, but never exceed 10\% at instrument native resolutions which are much finer than the 1 $\textrm{\AA}$ bins used here. \begin{deluxetable*}{cccccc} \tablecaption{Integrated fluxes of optically thin lines measured in the Solar Irradiance Reference Spectrum \citep{Woods2009} compared to the DEM predictions. \label{table:sun_lines}} \tablehead{ \colhead{Ion} & \colhead{Wavelengths} & \colhead{$\log_{10} T_f$} & \colhead{Observed Flux} & {FUV/X-ray DEM} & {W/o Anomalous Ions DEM}\\ \colhead{} & \colhead{[$\textrm{\AA}$]} & \colhead{$\log_{10}(\textrm{[K]})$} & \colhead{[$10^{-2}$ erg\,s$^{-1}$\,cm$^{-2}$]} & \colhead{[$10^{-2}$ erg\,s$^{-1}$\,cm$^{-2}$]} & \colhead{[$10^{-2}$ erg\,s$^{-1}$\,cm$^{-2}$]}} \startdata \ion{C}{2} & 1335.7 & 4.4 & 14.9 & 11.0 & 11.9\\ \ion{C}{3} & 1175.7 & 4.8 & 4.73 & 7.78 & 3.36\\ \ion{C}{4} \tablenotemark{a}& 1548.2, 1550.7 & 5.0 & 12.0 & 7.95 & 2.17\\ \ion{N}{5} \tablenotemark{a}& 1238.8, 1242.8 & 5.3 & 1.56 & 1.56 & 0.419\\ \ion{Ne}{7}\tablenotemark{b} & 465.2 & 5.7 & 1.47 & 3.07 & 1.60\\ \ion{Ne}{8}\tablenotemark{b} & 770.4, 780.3 & 5.8 & 1.80 & 2.83 & 1.92\\ \ion{O}{3}\tablenotemark{b} & 508.2, 525.8, 599.6, 703.9 & 4.9 & 2.71 & 6.63 & 2.09\\ \ion{O}{4}\tablenotemark{b} & 554.5, 787.7, 790.2 & 5.2 & 5.85 & 19.9 & 4.95\\ \ion{O}{5}\tablenotemark{b} & 629.7, 760.4 & 5.4 & 6.47 & 21.4 & 5.77\\ \ion{Si}{3} & 1206.5 & 4.5 & 6.83 & 22.6 & 18.4\\ \ion{Si}{4}\tablenotemark{a} & 1393.8 & 4.9 & 3.72 & 2.24 & 0.827\\ \ion{Si}{12}\tablenotemark{b} & 499.4 & 6.3 & 0.699 & 0.921 & 1.03\\ \enddata \tablecomments{In cases where multiple transitions are listed for the same ion, the reported flux is the summed flux across all listed transitions.} \tablenotetext{a}{These FUV transitions were not used to fit the ``Fit with EUV Lines and without Anomalous Ions" model shown in Figure \ref{fig:sun_euv_dem} as a red solid line.} \tablenotetext{b}{These EUV transitions were used to fit the ```Fit with EUV Lines and without Anomalous Ions" model shown in Figure \ref{fig:sun_euv_dem} as a red solid line.} \end{deluxetable*} \subsection{Pressure Sensitivity}\label{sec:pressure_sensitivity} Across this broad range of temperatures, no single electron density or pressure will accurately describe the environmental conditions of the plasma emitting the observed flux we are using to fit the DEM or the unobserved EUV flux we are trying to predict. However we must assume some function for the electron density $n_e (T)$ to calculate emissivities if we want to fit the DEM at all. Updating the emissivity calculation iteratively would be computationally prohibitive and still fail to accurately describe detailed non-equilibrium physics. By generating multiple emissivity matrices across a broad range of electron pressures, $P_{e} = 10^{12}$ to $10^{25}$ $k_B$ cm$^{-3}$ K, and fitting a DEM to the solar data with each matrix, we test the sensitivity of the DEM shape and calculate the variation in the predicted EUV flux as a function of assumed pressure. Figure \ref{fig:sun_press_dem} shows a representative sample of these DEMs, which vary only slightly for pressures lower than $10^{20}$ $k_B$ cm$^{-3}$ K and are consistent with each other to within 1$\sigma$ variations of the DEM shape. The horizontal lines are the average $\overline{\Psi} (T_f)$ values. To test if any particular model is a statistically significant improvement over the others, we compare the models' values of the Bayesian Information Criterion (BIC, \citealt{Schwarz1978}). \citet{Kass1995} demonstrates that the BIC is related to the natural logarithm of the Bayes factor, such that a $\Delta BIC = 1$ implies the more negative model is $e$ times more likely than the higher one. The BIC is evaluated with the equation \begin{equation} \textrm{BIC} = k \ln(n) - 2 \ln(\hat{\mathcal{L}}) \end{equation} where $k$ is the number of model parameters, $n$ is the number of datapoints, and $\hat{\mathcal{L}}$ is the maximum-likelihood of the model. This criterion penalizes a higher number of parameters, and the model significance increases as the BIC decreases. All models in this comparison have the same number of parameters, but we also use the BIC later in Section \S\ref{sec:poly_choice} to test our method's sensitivity to polynomial degree. Table \ref{table:model_significance_pressure} compares each pressure model's BIC, estimated systematic uncertainty characterized by the $s$-factor, and EUV flux integrated from 100 to 912 $\textrm{\AA}$. In the middle of our pressure range, from $10^{17}$ to $10^{20}$ $k_B$ cm$^{-3}$ K, the predicted integrated fluxes are consistent with each other to within 1$\sigma$, but the BIC clearly favors the $10^{19}$ model. We adopt the $P_e = 10^{19}$ $k_B$ cm$^{-3}$ K emissivity matrix for other tests of the Sun DEM model moving forward. At pressures higher than $10^{21} \ k_B $ cm$^{-3}$ K, the DEM shape and predicted fluxes change drastically, likely because the plasma is optically thick and collisional de-excitation can no longer be ignored. The base of the solar chromosphere is at a pressure of $\sim 10^{20}$ $k_B$ cm$^{-3}$ K \citep{Mariska1992}, so a model DEM that assumes the entire upper atmosphere is at photospheric pressure is bound to be unphysical. For all other stars, we adopt the same approach of fitting the star's DEM with each pressure separately and choosing the model with the best likelihood. We caution that it is unphysical to interpret these ``best" pressures as representative of a specific region in the stellar atmosphere, and that they should be seen as the most useful average for implementing the DEM and nothing more. Future work could involve testing the DEM with temperature-pressure profiles from stellar atmosphere models to see if this improves the accuracy and precision of the estimated spectrum. \begin{figure} \centering \includegraphics[width=\textwidth]{sun_press_dem.pdf} \caption{The DEMs of the Sun fit to the same data, a combination of FUV emission lines and X-ray spectra, but with emissivity functions calculated at different electron pressures $P_e$. The horizontal bars represent constraints on the average DEM value $\overline{\Psi}(T_f)$ in the vicinity imposed by the emissivity functions $G(T)$ for ion line fluxes or wavelength bins as described in Section \S\ref{sec:implementation}, with the horizontal extent of the lines representing the full width at half maximum for the emissivity function. These constraints transformed from a flux to an average DEM value are only approximately illustrative of the fit quality. For a true comparison of the DEM prediction to the data used to fit the model, see plots of the predicted line fluxes and X-ray spectra in Figures \ref{fig:sun_euv_lines} and \ref{fig:sun_euv_xray} respectively. The solid lines represent the median DEM value as a function of temperature from the posterior samples for $\Psi(T)$ while the shaded region encloses the 16$^{\textrm{th}}$ to 84$^{\textrm{th}}$ percentile values of the DEM. The red, blue, and brown models correspond to DEM models with emissivities evaluted at electron pressures $P_e = $ $10^{13}$, $10^{19}$, and $10^{25}$ $k_B$ cm$^{-3}$ K respectively. The green dashed bars and black solid bars represent the flux constraints from the FUV lines and X-ray spectra used to fit these models, while the dotted purple bars represent the flux constraints from EUV lines listed in Table \ref{table:sun_lines} but were not used to fit these models. For visualizing these constraints we use the emissivities calculated by assuming the electron pressure $P_e = 10^{19} \, k_B$ cm$^{-3}$.} \label{fig:sun_press_dem} \end{figure} \begin{deluxetable}{ccccc} \tablecaption{The Bayesian Information Criterion (BIC) for each pressure evaluated against the FUV line fluxes and the X-ray spectrum used to fit the model.\label{table:model_significance_pressure}} \tablehead{ \colhead{Log Electron Pressure $\log_{10} P_e$ } & \colhead{BIC} & \colhead{Integrated EUV Flux } & \colhead{$\log_{10} s_{\mathcal{L}_{\mathrm{max}}}$} & \colhead{$\log_{10} s$} \\ \colhead{$\log_{10}\left([ k_B \ \mathrm{cm}^{-3} \ \mathrm{K}] \right)$} & --- & \colhead{[ergs s$^{-1}$ cm$^{-2}$]} & --- & ---} \startdata $12$ & $-447.8$ & $4.9^{+4.2}_{3.4}$ & $-0.2090$ & $-0.1671^{+0.0739}_{-0.0632}$ \\ $13$ & $-448.6$ & $4.6^{+4.3}_{-3.1}$ & $-0.1852$ & $-0.1699^{+0.0731}_{-0.0626}$ \\ $14$ & $-450.1$ & $4.3^{+4.5}_{-2.8}$ & $-0.1929$ & $-0.1757^{+0.0735}_{-0.0619}$ \\ $15$ & $-449.8$ & $4.5^{+4.2}_{-3.1}$ & $-0.2166$ & $-0.1741^{+0.0726}_{-0.0624}$ \\ $16$ & $-452.3$ & $4.1^{+3.6}_{-2.8}$ & $-0.2249$ & $-0.1783^{+0.0733}_{-0.0631}$ \\ $17$ & $-456.2$ & $3.6^{+3.5}_{-2.3}$ & $-0.2137$ & $-0.1909^{+0.0720}_{-0.0619}$ \\ $18$ & $-460.7$ & $3.5^{+3.3}_{-2.1}$ & $-0.2311$ & $-0.2019^{+0.0697}_{-0.0615}$ \\ $19$ & $-464.7$ & $3.5^{+3.1}_{-2.1}$ & $-0.2424$ & $-0.2178^{+0.0692} _{-0.0596}$ \\ $20$ & $-463.3$ & $3.8^{+3.3}_{-2.4}$ & $-0.2515$ & $-0.2125^{+0.0709}_{-0.0603}$ \\ $21$ & $-455.1$ & $6.2^{+6.1}_{-4.1}$ & $-0.2108$ & $-0.1804^{+0.0729}_{-0.0623}$ \\ $22$ & $-426.2$ & $20^{+20}_{-17}$ & $-0.0881$ & $-0.0591^{+0.0873}_{-0.0725}$ \\ $23$ & $-376.7$ & $59^{+94}_{-59}$ & $0.0828$ & $0.1254^{+0.1199}_{-0.0962}$ \\ $24$ & $-367.6$ & $140^{+220}_{-140}$ & $-0.0113$ & $0.0413^{+0.1069}_{-0.0826}$ \\ $25$ & $-364.1$ & $200^{+370}_{-200}$ & $0.0244$ & $0.0473^{+0.1067}_{-0.0809}$\\ \enddata \tablecomments{The BIC penalizes model parameters by $k\ln(n)$ where $k$ is the number of parameters being fit and $n$ is the number of data points being fit to. An increasingly negative BIC indicates a better fit. In this case, the most preferred models are the $P_e = 10^{19}$ and $10^{20}$ $k_B$ cm$^{-3}$ K models respectively. We also show the value of $\log_{10} s$ for the maximum likelihood sample from the posterior and the median $\pm 1\sigma$ confidence interval for $\log_{10} s$.} \end{deluxetable} \subsection{Sensitivity to S/N}\label{sec:S/N_sensitivity} \begin{figure} \centering \includegraphics[width=1.0\textwidth]{sun_snr_dem.pdf} \caption{A comparison of fitting the DEM to the same data, a combination of FUV line fluxes and X-ray spectra from the \protect\citet{Woods2009} quiescent Sun spectrum, but with different errors assigned to vary the signal-to-noise ratio (S/N). As shown before in Figure \ref{fig:sun_press_dem}, the solid lines and shaded regions represent the different DEM models while the horizontal bars represent constraints imposed by the flux measurements. The red, green, and blue models represent fitting the DEM at S/N values of 1, 10, and 100 respectively. As shown previously in Figure \ref{fig:sun_press_dem}, the green dashed bars and black solid bars represent the flux constraints from the FUV lines and X-ray spectra used to fit these models. The dotted purple bars represent the flux constraints from EUV lines listed in Table \ref{table:sun_lines} and which were not used to fit these models.} \label{fig:sun_S/N} \end{figure} \begin{figure} \centering \includegraphics[width=\textwidth]{corner_sun_fuv.pdf} \caption{The corner plot for the parameter distributions when fitting the Sun at S/N = 100 shows the median value of $\log_{10} s $ to be $-0.22^{+0.07}_{-0.06}$ which translates to a model uncertainty of $60 \%$ for the predicted flux. This uncertainty dominates the fitting over the uncertainty associated with the data itself.} \label{fig:sun_corner} \end{figure} Figure \ref{fig:sun_S/N} compares our DEMs fit to the Sun's data with S/N = 1, 10, and 100. For the higher S/N models, the variance is dominated by the uncertainty on the predicted flux, parameterized by the $s-$factor and independent of the shape of the DEM, so changing the S/N of the data used to fit the DEM has little consequence. At S/N = 1, the data uncertainty dominates and the model percentile ranges shift dramatically, with no overlap with the higher S/N models until the higher temperature regimes constrained by many X-ray spectrum fluxes. The low DEM values at FUV temperatures are likely a consequence of the prior requiring a negative derivative at the start of the temperature domain. As mentioned earlier, $s$ is a measure of our average temperature-independent systematic uncertainty that combines the uncertainties on the emissivities with anything else intrinsic to our method's assumptions and approximations. Figure \ref{fig:sun_corner} shows us that $s = 0.63$ in the solar case with S/N$=100$. This indicates that we should assume the systematic uncertainty on any predicted line flux is roughly 60\% of the predicted value. Some of the systematic uncertainty may be attributed to fact that the \citet{Woods2009} spectrum combines observations of quiescence from different instruments taken at different times, which is a problem that will affect most stellar observations and needs to be accounted for in modelling uncertainties. \subsection{Including EUV Data in the Fitting and Excluding Anomalous Ions}\label{sec:euv_fitting} With the Sun, we can refer to the EUV lines observed by \citet{Woods2009} in the SIRS, allowing us to see how much information we are losing about the DEM in the stellar case where EUV data is not available. Including the EUV lines gives us more temperature coverage and allows us to exclude three ions from the Na-like and Li-like isolectronic sequences: \ion{N}{5}, \ion{C}{4}, and \ion{Si}{4}. \citet{DelZanna2002} showed that a DEM informed by these ions significantly overpredicts the flux of other transitions because of an anomaly in the \texttt{CHIANTI} ionization equilibrium calculations for these isoelectronic sequences compared to other ions for the same plasma environmental conditions. The factor of discrepancy is not constant across all transitions and densities, so it cannot be corrected for by a consistent known number. This discrepancy constitutes a significant systematic uncertainty that cannot be avoided when fitting the DEM to faint stars with few strong measurable lines that are not from these anomalous ions. Including line fluxes from multiple transitions of other ions can help mitigate the influence of the anomalous ions, but upper limits can still help if the star is too faint to measure these lines. To help characterize the magnitude of these discrepancies, we include EUV lines from 7 ions that are currently unobservable for our M dwarf sample of interest, listed in Table \ref{table:sun_lines}, and drop the anomalous ions (retaining some of the FUV lines and the X-ray spectrum) when fitting the model labeled ``Fit with EUV Lines and without Anomalous Ions" in Figures \ref{fig:sun_euv_dem}, \ref{fig:sun_euv_lines}, \ref{fig:sun_euv_xray}, and \ref{fig:sun_euv_euv}. This new DEM model shifts down by a factor of $\sim 5$ in between $10^5$ and $10^6$ K (see Figure \ref{fig:sun_euv_dem}) to match the EUV line fluxes (see Figure \ref{fig:sun_euv_lines}) that are not informing our stellar-analogous DEM. The DEMs agree with each other at the higher temperatures constrained by the X-ray spectra resulting in nearly identical predictions in that spectral regime (see Figures \ref{fig:sun_euv_dem} and \ref{fig:sun_euv_xray}). The predicted line fluxes from both models are compared to the data in Table \ref{table:sun_lines} and Figure \ref{fig:sun_euv_lines}, and highlight the problem of the anomalous ions. The model without EUV lines and including the anomalous ions predicts the FUV fluxes reasonably well, adopting a compromise position between FUV lines formed at similar temperatures that have discrepant DEM constraints (see Figure \ref{fig:sun_euv_dem}), but this compromise still overestimates the flux of the EUV lines by up to a factor of 5. When applying the DEM to M dwarfs without EUV data, we include the ions with anomalous \texttt{CHIANTI} emissivities because these are the strongest lines available and we cannot afford to simply exclude them. Measuring upper limits for the fluxes of other transitions formed at similar temperatures can mitigate the influence of the anomalous ions when combined with the $s-$factor uncertainty, as demonstrated in our modeling of AU Mic in section \ref{sec:au_mic}. In Figure \ref{fig:sun_euv_lines}, the error bars associated with the plotted data point incorporate both the posterior distributions of the DEM shape and the $s-$factor uncertainty of the ``Fit with EUV Lines and without Anomalous Ions" model. We do this by drawing randomly from the posterior sample of the MCMC fitting to generate a sample $\Psi(T)$ using the Chebyshev coefficients $c_n$ (see Equation \ref{eq:dem_cheby}) with an associated $s-$factor. The $\Psi(T)$ is combined with $G(T)$ to predict the flux of an observed data point, $y_i$, giving a model flux $f(x_i)$. Multiple sample draws in this fashion would only represent the uncertainty associated with the DEM shape and exclude the $s-$factor. To include the model-intrinsic uncertainty, we draw randomly from the Gaussian distribution $\mathcal{N}(\mu=f(x_i), \sigma={s\cdot f(x_i)})$ and record the prediction from the flux distribution parameterized by a single MCMC posterior sample. This process is executed with $N = 5 \times 10^4$ draws from the model parameters' posterior distribution to describe the full range of the model's predicted flux. The errorbar for a particular datapoint represents the width of the 16$^{\textrm{th}}$ to 84$^{\textrm{th}}$ percentile interval for this distribution built up of random draws. Figures \ref{fig:sun_euv_xray} and \ref{fig:sun_euv_euv} show the uncertainties of both models as errorbars on the models' respective predicted spectra using the same method. The $s-$factor dominating the uncertainty results in errorbars that scale according to the magnitude of the flux predicted by the model. \begin{figure} \centering \includegraphics[width=1.0\textwidth]{sun_crude_dem.pdf} \caption{A comparison of the DEM fit using FUV lines and the X-ray spectrum to a new DEM that excludes \ion{N}{5}, \ion{C}{4}, \ion{Si}{4} from the FUV data and includes a number of EUV lines listed in Table \ref{table:sun_lines}. As in Figures \ref{fig:sun_press_dem} and \ref{fig:sun_S/N}, the solid lines and regions represent the median DEM and 1$\sigma$ confidence intervals while the horizontal bars represent constraints imposed by the measured fluxes.} \label{fig:sun_euv_dem} \end{figure} \begin{sidewaysfigure} \centering \includegraphics[width=1.0\textwidth]{sun_crude_lines_log.pdf} \caption{A comparison of the predicted line fluxes from the DEM models shown in Figure \ref{fig:sun_euv_dem} to the lines listed in Table \ref{table:sun_lines}. The color scheme is the same as Figure \ref{fig:sun_euv_dem}, with the red pentagons marking predictions from the model including EUV lines and the blue triangles marking predictions from the model excluding EUV lines. The black points represent the line flux measurements with errorbars for their measurement uncertainties while the model predictions have errorbars for the $s$-factor model intrinsic uncertainty. The high S/N assigned to the \protect\citet{Woods2009} data makes the errorbars nearly invisible. Note how the red model accurately predicts the fluxes of \ion{O}{3}, \ion{O}{4}, \ion{O}{5} formed at roughly the same temperatures as \ion{N}{5}, \ion{C}{4}, \ion{Si}{4} but drastically underestimates the flux of these anomalous ions. Conversely, the blue model is caught in a compromise that slightly underestimates the flux of these ions and overestimates the flux of other FUV ions, but this compromise results in significantly overestimating the flux of EUV ions.} \label{fig:sun_euv_lines} \end{sidewaysfigure} \begin{figure} \centering \includegraphics[width=\textwidth]{sun_crude_xray_log.pdf} \caption{The predicted X-ray spectra from both models discussed in Section \S\ref{sec:euv_fitting} compared to each other and the \protect\citet{Woods2009} SIRS data used to fit the DEM. The solid lines represent models according to the same color scheme as Figure \ref{fig:sun_euv_dem}, blue for the model without EUV lines and red for the model with EUV lines and without the anomalous FUV ions. The errorbars on each model incorporate both the uncertainty in DEM shape and the $s-$factor uncertainty of their respective models in the manner described in Section \S\ref{sec:euv_fitting}. The DEMs do not differ significantly in the temperature regime associated with emitting at X-ray wavelengths, so the spectra for both models are nearly identical. A more complete look at the X-ray spectral data, including data not used to fit the DEM, and our DEM prediction is shown in the top-left panel of Figure \ref{fig:euv_panel}.} \label{fig:sun_euv_xray} \end{figure} When we compare the predicted EUV flux of the Sun from both fits to the observed spectrum itself, the DEM prediction fit without EUV lines overestimates the data by 80\% (see Figure \ref{fig:sun_euv_euv} and Table \ref{table:all_euv_fluxes}). The $s-$factor uncertainty for this model estimates that each line's predicted flux has an uncertainty $60\%$ of the predicted value, so the 1$\sigma$ confidence interval of the model still encompasses the observed data. The DEM prediction including EUV lines and excluding anomalous ions underestimates the integrated flux by only $0.01\%$, but does have a significant $57\%$ $s-$factor uncertainty. Within the EUV regime, there are 3 different recombination continuum regions that form from excess kinetic energy emitted when an ion captures a free electron into a bound state. Only one of them, the \ion{H}{1} 912 $\textrm{\AA}$ continuum, is a significant contributor to the total EUV flux integrated from 100 to 912 $\textrm{\AA}$, accounting for 15\% in the \citet{Woods2009} spectrum of the Sun. The other two regions, \ion{He}{2} 229 $\textrm{\AA}$ and \ion{He}{1} 504 $\textrm{\AA}$, contribute 3\% and 2 \% respectively. This falls within our uncertainties on the predicted flux, but it would be worth investigating if it is possible to incorporate these recombination continua in the DEM model without added parameters. The reconstruction of the EUV spectrum only used the emissivities of optically thin emission lines in the $G_{\lambda} (T)$ emissivity matrices and does not account for any contribution from continuum processes. The data required to incorporate free-bound, free-free, and two-photon continua exist in \texttt{CHIANTI}, but as of this work we have not included these sources of emissivity in the $G_{\lambda} (T)$ emissivity matrices. In future work we hope to include these processes for both fitting the DEM to X-ray spectra and reconstructing the EUV spectrum. \begin{figure} \centering \includegraphics[width=\textwidth]{sun_euv_euv_log_high_res.pdf} \caption{The predicted EUV spectra of both DEM models discussed in Section \S\ref{sec:euv_fitting} with errorbars representing the uncertainties derived in the manner described in that section. The color scheme follows that of Figures \ref{fig:sun_euv_dem} and \ref{fig:sun_euv_xray}, with the solid blue line representing the predicted spectrum and uncertainty of the model fit without EUV lines and the solid red line representing the predicted spectrum and uncertainty of the model fit with EUV lines and without the anomalous ions. The black points are the data from \protect\citet{Woods2009}. Both model spectra show nearly the same spectral shape as the data, excepting the ramp feature at wavelengths between 800 and 912 $\textrm{\AA}$, discussed in Section \S\ref{sec:euv_fitting}. The blue model consistently overestimates the spectrum although the 1$\sigma$ errorbars usually include the data.} \label{fig:sun_euv_euv} \end{figure} \subsection{Abundance Sensitivity}\label{sec:abundance_sensitivity} We use the solar coronal abundances from \citet{Schmelz2012} stored in \texttt{CHIANTI} and an ionization equilibrium calculated at those abundances to get the $G_{ul}(T)$ functions for each emission line. Then for every $G_{ul}(T)$ function, we multiply by the stellar abundance if the ion's atomic number $Z > 2$. A higher metal abundance should shift the ionization equilibrium, which would have some effect on the self-consistency of the emissivity calculations. To verify whether or not this effect would be significant, we tested how the DEM fitting was sensitive to abundance in this crude framework. When we fit to stars other than the Sun we can refer to the literature and use the best abundance available, but we should not expect to always have an accurate and precise abundance measurement for the stars we are fitting the DEM to. Fitting the Sun with emissivity matrices generated using a super-solar [Fe/H] $= 1$ and a sub-solar [Fe/H] $= -1$ abundance resulted in the overall DEM shifting up or down to compensate. The predicted EUV fluxes obtained by combining each model DEM with their respective emissivity matrix differed by $< 15\%$. This makes sense since the $G_{ul}(T)$ of an emission line from any metal is linearly proportional to the abundance. In fact, this harks back to the original implementation of the emission measure distribution in \citet{Pottasch1963}, where the author determined the relative abundances of elements by shifting them around to minimize the scatter in the emission measure distribution. This abundance adjustment is contingent on the assumption of the relative abundances being constant throughout the optically thin plasma, but everything else about this implementation of the DEM hinges on this assumption as well. This will also let us compare the DEM shapes of stars with different abundances by modifying the temperature independent coefficient $c_0$ to shift the overall DEM shape, marginalizing over the stellar abundance for any future study of the DEMs of a population of stars. However, if the relative abundances of an M dwarf corona differ from the Sun, the ions of an affected element will be consistently discrepant from the final DEM fit, and this is likely our greatest source of systematic uncertainty for stars other than the Sun. In the Sun, heavy elements with a first ionization potential $< 9$ keV tend to be enhanced in the corona relative to the photosphere \citep{Drake1995}. There is evidence to suggest that this first ionization potential effect varies with spectral type and may even be reversed in M dwarfs \citep{Drake1995, Wood2012,Laming2015}. A single line from a species constrains the DEM near its ionization temperature, but many lines from an element across multiple ionization stages can constrain the element's relative abundance by fitting an element-specific DEM and shifting it to match the DEM fit without that element. This will only be possible for the brightest stars and the C, O, or Si species, since this requires bright lines from at least three ionization stages formed at conditions valid for the DEM method. Fitting DEMs for as many nearby main-sequence stars as possible may allow us to generate this stellar coronal abundance library. A future and intermediate improvement would be to use the sample of stars for which \emph{EUVE} allowed papers like \citet{Drake1995} to determine coronal abundances and select the most appropriate analog for a target we are fitting the DEM to. We intend to use this approach for future work. \subsection{Polynomial Degree}\label{sec:poly_choice} Higher polynomial degrees allow more flexibility between the well-constrained temperatures. The spread of FUV and X-ray formation temperatures constrains the slopes in their respective regimes ($2 \times 10^4$ K $<$ FUV $< 2 \times 10^5$ K, $10^6$ K $<$ X-ray $< 2 \times 10^7$ K), and this rigidly constrains lower order polynomials. The models show the most agreement with each other around $T = 10^5$ K, where there are a number of FUV lines with overlapping emissivities to anchor the fit (see Figures \ref{fig:gofnt_all} and \ref{fig:sun_poly_dem}), while there are significant discrepancies at temperatures lower than the constraints imposed by the FUV lines and higher than the constraints imposed by the X-ray spectrum. Table \ref{table:model_significance_polynomial} compares the BIC values for the different polynomial order and since the Sun's DEM shows very little curvature, the BIC prefers the 3$^\textrm{rd}$ order model and penalizes the complexity of higher order polynomials. Table \ref{table:model_significance_polynomial} also shows that the models predict values consistent within 1 $\sigma$ for the EUV flux integrated between 100 to 912 $\textrm{\AA}$, and the $s-$factor uncertainty decreases slightly for higher order polynomials. This consistency is a product of both the low curvature of the Sun's DEM and the fact that the FUV and X-ray data constrain either end of the temperature interval responsible for EUV emission lines. When we ran a similar test with AU Mic, we found that orders below 5 were unable to match the complexity of the data, so we move forward with the 5$^\textrm{th}$ order as our standard approach for fitting other stars. Most targets will have too few data points to merit a model with many more parameters than a 5$^{\textrm{th}}$ order polynomial. \begin{figure} \centering \includegraphics[width=1.0\textwidth]{sun_poly_dem.pdf} \caption{This plot compares the Sun's DEMs fit with different polynomial orders to each other and the flux constraints imposed by the observed FUV lines and X-ray spectrum used to fit the data according to the same scheme described in the caption of Figure \ref{fig:sun_press_dem}. The red model is a 3$^{\rm{rd}}$ order polynomial, the blue model is the 5$^{\textrm{th}}$ order polynomial we adopt as our standard approach, and the green is a 7$^{\rm{th}}$ order polynomial. The spread in FUV line formation temperatures sets a slope for the DEM to match between $2 \times 10^4$ and $2 \times 10^5$ K, while the X-ray spectrum sets the slope between $10^6$ and $2 \times 10^7$ K. Table \ref{table:model_significance_polynomial} compares the different order models to show that the different models predict consistent EUV fluxes.} \label{fig:sun_poly_dem} \end{figure} \begin{deluxetable}{ccccc} \tablecaption{The Bayesian Information Criterion (BIC) for each polynomial model.\label{table:model_significance_polynomial}} \tablehead{ \colhead{Chebyshev Polynomial Order} & \colhead{BIC} & \colhead{Integrated EUV Flux } & \colhead{$\log_{10} s_{\mathcal{L}_{\mathrm{max}}}$} & \colhead{$\log_{10} s$}\\ --- & --- & \colhead{[ergs s$^{-1}$ cm$^{-2}$]} & --- & ---} \startdata $3$ & $-472.0$ & $3.8^{+2.6}_{-2.3}$ & $-0.2438$ & $-0.2182^{+0.0696}_{-0.0600}$ \\ $4$ & $-468.4$ & $3.7^{+2.7}_{-2.3}$ & $-0.2516$ & $-0.2173^{+0.0690}_{-0.0610}$ \\ $5$ & $-464.7$ & $3.5^{+3.1}_{-2.1}$ & $-0.2515$ & $-0.2177^{+0.0696}_{-0.0603}$ \\ $6$ & $-464.7$ & $3.4^{+2.9}_{-2.1}$ & $-0.2372$ & $-0.2208^{+0.0692}_{-0.0597}$ \\ $7$ & $-464.9$ & $3.0^{+2.4}_{-1.8}$ & $-0.2662$ & $-0.2348^{+0.0706}_{-0.0599}$ \\ $8$ & $-461.1$ & $2.9^{+2.4}_{-1.8}$ & $-0.2852$ & $-0.2350^{+0.0698}_{-0.0600}$ \\ $9$ & $-457.1$ & $2.9^{+2.5}_{-1.8}$ & $-0.2709$ & $-0.2337^{+0.0709}_{-0.0593}$ \\ $10$ & $-454.0$ & $3.1^{+3.0}_{-1.9}$ & $-0.2858$ & $-0.2307^{+0.0717}_{-0.0616}$ \\ \enddata \tablecomments{The Sun's DEM shows very little complexity, so the 3$^{\textrm{rd}}$ order polynomial model is most preferred, with each subsequent order scoring a worse BIC. This was not true for the AU Mic test for which orders below 5 were too inflexible to match the constraints of the prior and the data.} \end{deluxetable} \section{Applying Our DEM Method to AU Mic}\label{sec:au_mic} AU Mic is a nearby young and active M dwarf with an observable debris disk, $9.979 \pm 0.04$ pc away and $22 \pm 3$ Myr old \citep{MacGregor2013, Bustos2019, Plavchan2020}. The system also hosts at least one confirmed planet and possibly a second planet candidate \citep{Plavchan2020}, making it a rare case of an M dwarf planetary system with a precisely known young age. Despite being nearby, and having been observed multiple times with \emph{EUVE}, the quiescent EUV spectrum of AU Mic is poorly constrained (see Section \ref{sec:final_model_spectra} and Figure \ref{fig:euv_panel}), so some method of reconstructing the EUV spectrum is required to study this planetary system in detail. On the other hand, the X-ray and FUV data for this star are extremely precise considering how intrinsically faint the star is, allowing us to fit a very well-constrained DEM and compare our implementation to earlier work published in \citet{DelZanna2002}. \citet{Pagano2000} published a very thorough list of emission line fluxes measured from spectra taken during quiescence, a subset of which we use to fit the DEM for AU Mic and list in Table \ref{table:fuv_lines}. \citet{Redfield2002} published separate quiescent and flare FUSE measurements of FUV lines and \citet{Redfield2003} reported the quiescent coronal line fluxes listed in Table \ref{table:fuv_lines}. The bandpass for \emph{FUSE} overlaps with that of COS, so we fit separate DEMs including and excluding the \emph{FUSE} measurements to demonstrate the usefulness of transitions observed between $900$ and $1100$ $\textrm{\AA}$ in constraining the high-temperature end of the DEM, motivating future COS observations of cool dwarfs. The majority of the lines listed in Table \ref{table:fuv_lines} will be unobservable for other fainter cool dwarfs, but having the ground truth of which lines are emitted from the upper atmospheres of cool dwarfs is immensely useful for future DEM fitting. If a line is observed for AU Mic, we can place upper limits on the flux from that line for another star, constraining the DEM near that line's formation temperature. We fit the DEM assuming solar coronal abundances from \citet{Schmelz2012}, using the FUV lines listed in Table \ref{table:fuv_lines} and an X-ray spectrum from the Reflection Grating Spectrometer (RGS, \citealt{denHerder:2001}) on \emph{XMM-Newton}, observed in October 2018 \citep{Kowalski2019AAS}. The spectrum was resampled at 1 $\textrm{\AA}$ resolution before fitting. The lightcurve for this observation showed multiple flares and we use the quiescent X-ray spectrum from the work of Kowalski et al. (in prep) and Tristan et al. (in prep). This observation was not concurrent with the data obtained by \citet{Pagano2000} and \citet{Redfield2003}, so it is possible that the X-ray and FUV data are not from identical levels of quiescence. Very few targets will be likely to have concurrent X-ray and FUV observations, so this issue will plague most of the stars needing EUV reconstruction. We compare our fit using FUV lines and an X-ray spectrum to another fit using the same FUV lines and X-ray line flux measurements reported by \citet{Wood:2018}. We also note that whenever possible, a line flux measurement is more useful than a spectral bin, and if high temperature emission line strengths can be measured, these should be favored over the use of spectral bins. \begin{figure} \centering \includegraphics[width=1.0\textwidth]{au_mic_dem.pdf} \caption{Comparing the DEM of AU Mic fit to a combination of FUV line fluxes from STIS (published in \protect\citealt{Pagano2000}) and \emph{FUSE} (published in \protect\citealt{Redfield2002} and \protect\citealt{Redfield2003}) and either a coarsely sampled X-ray spectrum or a list of X-ray line fluxes reported in \protect\citet{Wood:2018}. The red line and region correspond to the median DEM value and 1$\sigma$ confidence intervals for AU Mic fit using only line flux measurements, while the blue line and region are the model for AU Mic constrained by the X-ray spectrum instead of line fluxes. The horizontal bars represent constraints from the FUV lines listed in Table \ref{table:fuv_lines} and from the \emph{XMM-Newton} X-ray spectrum. The dotted purple bars correspond to the STIS lines published in \protect\cite{Pagano2000} while the dashed red bars correspond to \emph{FUSE} lines published in \protect\citet{Redfield2003} and the black solid bars are from the quiescent \emph{XMM-Newton} spectrum presented in \protect\citet{Kowalski2019AAS} (to be published in Kowalski et al. in prep, and Tristan et al. in prep). There were too many X-ray lines listed in \protect\citet{Wood:2018} to represent in this figure.} \label{fig:au_mic_dem} \end{figure} In Figure \ref{fig:au_mic_dem} we compare two fits for AU Mic to the constraints imposed by the data, with the red model using only line flux measurements and the blue model using the combination of FUV lines and an X-ray spectrum that will be applicable to fainter M dwarfs. AU Mic has a higher DEM than the Sun across the entire temperature domain, and significantly higher at temperatures greater than $2 \times 10^6$ K, corresponding to the corona. The presence of detectable coronal iron lines, formed at $T > 10^6$ K, places a strong constraint that lifts AU Mic's DEM far higher than the Sun's which had many X-ray spectrum points depressing the DEM in the vicinity of this temperature. The iron emission lines are not solely responsible for the differences, as the constraints from the X-ray spectra set a slope at these high temperatures leading toward the iron lines. The shape of AU Mic's DEM beyond $T = 2 \times 10^5$ K demonstrates the importance of including a corona in calculating the total EUV flux. \citet{Peacock2019b} finds significant differences in the total flux and spectral shape between the \texttt{PHOENIX} models without a corona and the semi-empirical SRPM model from \citet{Fontenla2016}. \citet{Peacock2019b} also simulates the addition of a corona to their models by using the DEM of AU Mic available in \texttt{CHIANTI} from \citet{DelZanna2002}, showing potential opportunities for supplementing stellar atmosphere models with DEMs fit to observations of specific stars. Figure \ref{fig:au_mic_xray} compares the predicted X-ray spectra to the observed spectrum and Figure \ref{fig:au_mic_lines} compares the predicted line fluxes to the FUV line profile measurements listed in Table \ref{table:fuv_lines}. Both figures incorporate the $s-$factor uncertainties and DEM shape variation (Section \S\ref{sec:euv_fitting}) and show that the model predictions are typically consistent with the data to 1$\sigma$. Figure \ref{fig:au_mic_line_fit_corner} shows the parameter distributions for the DEM fit to line fluxes, and we find that the $s-$factor for AU Mic is 0.4, comparable to that of the Sun. At lower wavelengths the red model, which was not fit to the spectrum itself, significantly underestimates the flux. This may be a consequence of the higher energy emission including flux from free-free or free-bound continuum sources, creating the discrepancies between both these DEMs. To reproduce the flux in these bins without accounting for this extra emissivity, the DEM fit to the spectrum must enhance the amount of material at these high temperatures. Including free-free and free-bound continuum emissivities in the $G_{\lambda} (T)$ matrices should mitigate or eliminate these discrepancies. \begin{figure} \centering \includegraphics[width=\textwidth]{au_mic_xray_log.pdf} \caption{The X-ray data used to fit the DEM compared to the predicted spectra for the DEM models of AU Mic shown in Figure \ref{fig:au_mic_dem}. The black points represent the downsampled RGS X-ray spectrum at a 1 $\textrm{\AA}$ wavelength resolution while the red and blue lines show the DEM prediction for the flux density in the same wavelength bins, incorporating the $s-$factor uncertainty in their error bars, for the models fit with X-ray lines and the X-ray spectrum respectively. They are consistent with each other, although the median prediction of the DEM fit to the spectrum is consistently above the DEM fit to X-ray line fluxes.} \label{fig:au_mic_xray} \end{figure} \begin{sidewaysfigure} \centering \includegraphics[width=1.0\textwidth]{au_mic_lines_log.pdf} \caption{The FUV line fluxes predicted by the AU Mic DEM models shown in Figure \ref{fig:au_mic_dem} compared to the data from \protect\citet{Pagano2000} and \protect\citet{Redfield2003}. Following the color scheme of Figures \ref{fig:au_mic_dem} and \ref{fig:au_mic_xray}, the red triangles represent the predictions from the DEM model fit using only line fluxes while the blue pentagons represent the predictions from the DEM model using the X-ray spectrum. The black points represent the combined fluxes of lines emitted by the ion annotating the point, with errorbars for the measurement uncertainty while the model predictions have errorbars representing the $s-$factor model intrinsic uncertainty.} \label{fig:au_mic_lines} \end{sidewaysfigure} \begin{deluxetable}{cccccc} \tablecaption{Ion fluxes of AU Mic compared to the predictions from the red DEM model shown in Figure \ref{fig:au_mic_dem}.\label{table:fuv_lines}} \tablehead{ \colhead{Ion} & \colhead{Wavelengths} & \colhead{$\log_{10} T_f$} & \colhead{Observed Flux} & \colhead{DEM Prediction}\\ \colhead{} & \colhead{[$\textrm{\AA}$]} & \colhead{$\log_{10}(\textrm{[K]})$} &\colhead{[$10^{-15}$ erg\,s$^{-1}$\,cm$^{-2}$]} & \colhead{[$10^{-15}$ erg\,s$^{-1}$\,cm$^{-2}$]}} \startdata \ion{C}{2} & 1324, 1336\tablenotemark{a} & 4.6 & $214 \pm 16.0$ & $149^{+71.7}_{-96.2}$\\ \ion{C}{3} & 977, 1176\tablenotemark{a} & 4.9 & $280 \pm 16.0$ & $681^{+309}_{344}$\\ \ion{C}{4} & 1548, 1551 & 5.0 & $327 \pm 24.2$ & $208^{+164}_{-174}$\\ \ion{N}{2} & 1086 & 4.6 & $10.0 \pm 2.00$ & $6.94^{+3.33}_{-4.21}$\\ \ion{N}{3} & 990, 992 & 4.9 & $29.0 \pm 2.24$ & $68.6^{+30.9}_{-33.3}$\\ \ion{N}{4} & 1487 & 5.1 & $0.90 \pm 0.09$ & $0.747^{+0.337}_{-0.366}$\\ \ion{N}{5} & 1238.8, 1242.8 & 5.3 & $66.3 \pm 4.99$ & $41.6^{+19.1}_{-22.5}$\\ \ion{O}{3} & 1666 & 4.9 & $1.30 \pm 0.13$ & $1.00^{+0.448}_{-0.489}$\\ \ion{O}{4} & 1400, 1401, 1407 & 5.1 & $5.90 \pm 0.423$ & $12.3^{+5.55}_{-6.17}$\\ \ion{O}{5} & 1218, 1371 & 5.3 & $21.8 \pm 1.86$ & $21.4^{+9.84}_{-12.2}$ \\ \ion{O}{6} & 1032, 1038 & 5.5 & $315 \pm 26.4$ & $183^{+89.7}_{-121}$ \\ \ion{Ne}{5} & 1146 & 5.4 & $2.00 \pm 1.00$ & $1.30^{+0.599}_{-0.784}$\\ \ion{Si}{2} & 1260, 1265, 1304, 1527, 1533 & 4.3 & $22.0 \pm 1.06$ & $23.3^{+12.3}_{-20.7}$\\ \ion{Si}{3} & 1108, 1110, 1113, 1206, 1295, 1297, 1299, 1301, 1303 & 4.8 & $101 \pm 8.11$ & $624^{+289}_{-340}$\\ \ion{Si}{4} & 1394, 1403 & 4.9 & $78.5 \pm 5.73$ & $126^{+57.3}_{-62.8}$\\ \ion{S}{2} & 1253.8, 1259.5 & 4.4 & $2.60 \pm 0.18$ & $2.78^{+1.45}_{-2.16}$\\ \ion{S}{3} & 1016, 1021, & 4.8 & $7.00 \pm 2.24$ & $7.11^{+3.29}_{-3.75}$\\ \ion{S}{4} & 1063, 1073 & 5.0 & $6.00 \pm 1.41$ & $28.2^{+12.6}_{-13.7}$\\ \ion{Fe}{18} & 975 & 6.9 & $6.00 \pm 2.00$ & $8.75^{+4.10}_{-5.08}$\\ \ion{Fe}{19} & 1118 & 7.0 & $7.00 \pm 1.00$ & $4.51^{+2.05}_{-2.42}$\\ \ion{Fe}{21}& 1354 & 7.0 & $7.70 \pm 0.77$ & $3.73^{+1.91}_{-2.93}$\\ \enddata \tablecomments{All entries are from STIS line fluxes reported in \citet{Pagano2000} and/or \emph{FUSE} measurements reported in \citet{Redfield2002} and \citet{Redfield2003}.} \tablenotetext{a}{multiplet} \end{deluxetable} \begin{figure} \centering \includegraphics[width=\textwidth]{corner_au_mic_p5.pdf} \caption{The corner plot showing the parameter distributions when fitting AU Mic with a 5$^{\textrm{th}}$ order polynomial to FUV lines and the X-ray spectrum. The model uncertainty for AU Mic is slightly better than that of the Sun, with $s = 0.4$ instead of 0.6.} \label{fig:au_mic_line_fit_corner} \end{figure} \section{Our DEMs Compared to Published Literature}\label{sec:literature_comparison} Differential emission measure techniques are primarily applied in the solar context to resolved regions, highlighting individual structures like coronal holes or flare loops. \citet{Vernazza1978} fit DEMs to many such structures, including ``quiet regions" with minimal observed activity during the 9-month interval from 1973 May to 1974 August, shortly before the solar minimum of Cycle 21. This is not perfectly analogous to our quiescent Sun DEM fit to data integrated over the entire solar disk, but it is the best comparison for which we had access to a published DEM via \texttt{CHIANTI} \citep{Dere1997, DelZanna2015}. The left panel of Figure \ref{fig:lit_dem} compares the \citet{Vernazza1978} quiet region DEM to our disk-integrated quiescent Sun DEM, fit under the assumptions applicable to observing the Sun as a star (albeit with much higher signal-to-noise): the few FUV lines listed in Table \ref{table:sun_lines} and the X-ray spectrum at a low resolution of $R \leq 50$. We also include the solar DEM fit excluding anomalous ions and including EUV lines. Similarly, the right panel of Figure \ref{fig:lit_dem} compares our DEM for AU Mic to the DEM published by \citet{DelZanna2002}, which combined \emph{FUSE}, STIS, and \emph{EUVE} observations. \texttt{CHIANTI} has a volume differential emission measure version of the \citet{DelZanna2002} DEM which needed to be divided by $\frac{4\pi R_{\star}^2}{d^2}$ to match our formulation of a column differential emission measure, and we use the stellar radius and distance assumed by \citet{DelZanna2002}, $R_{\star} = 0.68 R_{\odot}$ and $d = 9.94$ pc, for consistency in the scaling factor. Like our dataset, they did not have access to simultaneous observations from these different instruments. Unlike our dataset, they included the integrated fluxes of lines observed with \emph{EUVE}, but we believe the \emph{EUVE} observations they used were flare contaminated for reasons discussed later in Section \S\ref{sec:final_model_spectra}. We also compare our AU Mic DEM to the active solar region DEM of \citet{Vernazza1978}, demonstrating a small resemblance between the active region and the active star AU Mic. The active region DEM seems to shift the shape of the quiet sun DEM to a higher temperature and dramatically enhance the DEM near $10^6$ K. AU Mic, a star more active than the Sun, has more material at nearly all temperatures. \begin{figure} \centering \begin{minipage}{.48\textwidth} \includegraphics[width=\textwidth]{lit_sun.pdf} \end{minipage} \begin{minipage}{.48\textwidth} \includegraphics[width=\textwidth]{lit_au_mic.pdf} \end{minipage} \caption{The left panel compares both of our DEMs for the quiescent disk-integrated Sun described in Section \S\ref{sec:euv_fitting} to the ``quiet Sun" DEM derived by \protect\citet{Vernazza1978} from observations of quiet regions of the Sun, while the right panel compares our DEM for AU Mic to the AU Mic DEM published by \protect\citet{DelZanna2002} and the DEM of an active region published by \protect\citet{Vernazza1978}. These DEMs used for comparison were available in the CHIANTI database \protect\citep{Dere1997, DelZanna2015}.} \label{fig:lit_dem} \end{figure} Both panels show that our DEMs are significantly higher than their literature counterparts at temperatures near $10^5$ K, roughly corresponding to the transition region. For the AU Mic panel on the right, the \citet{DelZanna2002} DEM is significantly lower than ours between $3 \times 10^4$ and $3 \times 10^5$ K. \citet{Monsignori1996} published the time-evolution of the AU Mic DEM during a flare observed by \emph{EUVE} in July 1992, and while they use a slightly different formulation of the DEM $= n_{e}^2 \frac{dV}{dT}$, the shape of our DEM strongly resembles theirs published in panels a and g of their Figure 9, which correspond to quiescent phases, while multiplying our DEM by $4\pi R_{\star}^2 \approx 3\times 10^{22}$ cm$^2$ scales to the approximately the same order of magnitude as their DEM. Unfortunately, their DEM was not available in \texttt{CHIANTI} for direct comparison. The discrepancy at temperatures below $10^6$ K is largely driven by the line list we are using to fit the DEM, where our strongest lines are from Na-like and Li-like species \ion{N}{5}, \ion{Si}{4}, and \ion{C}{4}, and the solar DEM excluding these ions is much closer to the \citet{Vernazza1978} quiet region DEM. \citet{DelZanna2002} fits the DEM of AU Mic without these lines and has enough individual lines to constrain the DEM in this temperature regime without them. We will not be able to afford this luxury for nearly every other M dwarf unless we are observing a strong flare. Instead we fit our DEM including these lines and use the $s-$parameter boost to our variance to account for the systematic uncertainties involved. As long as some other ions formed in the same region are included in the line list, even with just upper limits on their fluxes, the DEM will shift down to accommodate these lines. In the future, we plan to test dividing the observed fluxes of these lines by a corrective factor $\sim 5$ before fitting the DEM to see how this improves the fit and affects the predicted EUV spectrum. Working in a data-limited regime is also why we fit for the DEM using an assumed functional form instead of interpolating between the emission measure loci estimated from individual lines \citep{Pagano2000}, or fitting for the value of the DEM in discrete temperature bins \citep{DelZanna2002, DelZanna2015}. Without measured lines in the temperature regime corresponding to most EUV lines, we must use our assumption of a continuous function anchored on both ends of the inaccessible temperature/wavelength regime. The DEM for AU Mic derived by \citet{DelZanna2002} is poorly constrained between $10^{6} < T < 10^{6.7} K$ because they do not use X-ray line fluxes or a coarse spectrum, but our DEMs agree on the position and magnitude of the coronal peak DEM ($T=10^7$ K), if not the shape of the decline. Other contributions to the discrepancies between DEMs are differences in the atomic data and calculations for abundances and the ionization equilibrium and level populations. While the DEMs created by \citet{SanzForcada2011} were not available in \texttt{CHIANTI}, we expect significant discrepancies at the lower temperature end of the DEM because the majority of their cool dwarfs did not have UV data available. \section{Comparing Model EUV Spectra to Data}\label{sec:final_model_spectra} With our implementation of the DEM well-characterized, we can move on to the main objective of this project: generating EUV spectra in a format useful to the astronomical community with errorbars that self-consistently account for both statistical and systematic uncertainties. Our model spectra range from 1 to 2000 $\textrm{\AA}$ at a constant $R= \frac{\Delta \lambda}{\lambda} = 500$, but we advise using data instead of our model in the regimes where that is possible. The model spectrum files include uncertainties derived according to the method described in Section \S\ref{sec:euv_fitting}. Figure \ref{fig:euv_panel} compares our model spectrum of the Sun to the \citet{Woods2009} data and our model spectrum of AU Mic to an \emph{EUVE} observation from July 1992 and quiescent \emph{FUSE} data from a different time described in \citet{Redfield2002, Redfield2003}. This \emph{EUVE} observation was during the calibration phase of the mission and happened to catch a flare, first reported by \citet{Cully1993} and later studied in more detail in \citet{Monsignori1996}. We compare our DEM-generated spectrum to data from the quiescent time segment before the flare, extracted using standard \emph{EUVE} Guest Observer Center IRAF procedures. Useful data were obtained with the short wavelength (70 to 190 $\textrm{\AA}$) and medium wavelength (140 to 380 $\textrm{\AA}$) detectors, but no useful signal was present in the long wavelength (280 to 760 $\textrm{\AA}$) region. The spectral resolution of the 3 spectrometers is $\sim$ 0.5, 1.0, and 2 $\textrm{\AA}$ , which corresponds to 7 pixels per resolution element on the detectors. The photon event data were screened to eliminate high background times and times when the detectors were switched off. The IRAF routine ``\texttt{apall}" was used for the spectral extraction with a 14 pixel wide spectral region and two 85 pixel wide background regions measured above and below the stellar spectrum. The count rate spectra were converted to flux densities using the effective areas established by the \emph{EUVE} mission and the oversampled spectra were smoothed to the intrinsic spectrometer resolution. The large background area sampled allowed precise monitoring of the time dependent background. \citet{DelZanna2002} used a 1993 \emph{EUVE} observation which has no published lightcurve to verify the absence of flares and the time-averaged 1993 spectrum shows more flux than the quiescent 1992 data at all wavelengths indicating possible flare contamination. \begin{figure} \centering \includegraphics[width=\textwidth]{figures/euv_fig_r2.pdf} \caption{The individual rows of this figure show 250 $\textrm{\AA}$ chunks of the X-ray, extreme ultraviolet, and a portion of the far ultraviolet regimes. The left side compares to the \protect\citet{Woods2009} spectrum shown as black points to the DEM-generated model spectrum for the Sun in blue, where the DEM was fit to EUV lines, FUV lines excluding anomalous ions, and X-ray data. The right side shows the DEM-generated model spectrum for AU Mic in red, compared to both \emph{EUVE} data shown as black points and \emph{FUSE} data shown as purple squares. The model spectrum for the Sun is largely consistent with the data, except for a recombination continuum associated with the \ion{H}{1} 912 $\textrm{\AA}$ line spanning $\sim 800$ to $912$ $\textrm{\AA}$. The AU Mic \emph{EUVE} data is almost entirely consistent with zero, but our model does not predict flux significantly higher than these upper limits, while roughly matching some of the clearly detected emission lines.} \label{fig:euv_panel} \end{figure} Our DEM prediction for the EUV luminosity of AU Mic is $L_{\mathrm{EUV}} = 9.0^{+6.1}_{-4.6} \times 10^{28}$ erg s$^{-1}$, while the \citet{Linsky2014} relations give $1.2 \times 10^{29}$ erg s$^{-1}$, \citet{SanzForcada2011} relation gives $1.4 \times 10^{30}$ erg s$^{-1}$, and \citet{Chadney2015} finds $L_{\mathrm{EUV}} = 8.4 \times 10^{28}$ erg s$^{-1}$ using a coronal emission measure distribution model. We use the Lyman-$\alpha$ flux reported by \citet{Wood2005} for the \citet{Linsky2014} relations, and the X-ray luminosity obtained by multiplying the integrated flux of our EPIC-MOS spectrum with $4 \pi d^2$, $L_{\textrm{X-ray}} = 3.0 \times 10^{29}$ erg s$^{-1}$, for the \citet{SanzForcada2011} relation. To convert the surface EUV flux reported by \citet{Chadney2015} to luminosity we use their assumed radius for AU Mic $= 0.68 R_{\odot}$. The major advantages of our DEM approach are a well-characterized uncertainty and a balance between ease of implementation and specificity to each star. Using Equation 3 of \citet{SanzForcada2011} has a minimum uncertainty of 1.99 dex in predicting the EUV flux, but our method can do significantly better than this empirical relation even for very faint targets like TRAPPIST-1, with only a few FUV line measurements and an integrated X-ray flux or coarse spectrum. The DEM method also provides a low-resolution spectral shape in addition to a total flux, which may be useful for those who wish to model more detailed effects of high energy stellar radiation on a planet, disk, or the local interstellar medium. \section{Case Studies}\label{sec:case_studies} Thus far, we have demonstrated our method on targets with extremely good data, which are not representative of the majority of stars for which the astronomical community needs reconstructed EUV spectra to enable other science. In this section we apply our method to three M dwarfs of interest to the exoplanet community, all fainter and less active than AU Mic, and show that their coronae are hotter than the Sun and will seriously affect the atmospheric evolution of planets orbiting in their respective habitable zones. \subsection{GJ 832}\label{sec:gj832} GJ 832 was included in the original MUSCLES survey \citep{France2016} with its EUV flux estimated by the \citet{Linsky2014} correlations and semi-empiricaly modeled by both \citet{Fontenla2016} and \citet{Peacock2019b}. We fit our DEM model to the line fluxes published in \citet{Youngblood2016} and X-ray data hosted on \emph{MAST} as part of the MUSCLES data products. The line fluxes were measured using STIS data while the X-ray spectrum is from \emph{XMM-Newton} EPIC \citep{France2016}. Comparing our model spectra to the semi-empirical models and the EUV fluxes predicted by the Linsky relations in Figure \ref{fig:gj832_euv} shows that the different models agree with each other in different wavelength regimes. The data we used to fit GJ 832 was not perfectly quiescent, so some of the model discrepancy may be due to flare contamination \citep{Youngblood2016}. The DEM inferred from fitting the data is shown in Figure \ref{fig:gj832_dem}. \begin{figure} \centering \includegraphics[width=0.5\textwidth]{panel_dem_gj832_p17.pdf} \caption{Comparing the DEM of GJ 832 fit to a quiescent X-ray spectrum from \emph{XMM-Newton} EPIC and line fluxes from STIS, with $\overline{\Psi}(T)$ constraints shown as horizontal dotted blue and solid black bars respectively.} \label{fig:gj832_dem} \end{figure} The DEM model tends to predict higher fluxes than the other three models at wavelengths shorter than 600 $\textrm{\AA}$. Below 400 $\textrm{\AA}$ all models except for the \citet{Peacock2019b} \texttt{PHOENIX} model coincide quite closely, with the outlier lacking a coronal contribution. Between 400 to 600 $\textrm{\AA}$ both the DEM and semi-empirical models predict higher fluxes than the Lyman-$\alpha$ correlations. The biggest discrepancies between models are between 800 to 1100 $\textrm{\AA}$ where the semi-empirical models include the recombination continuum at the \ion{H}{1} 912 $\textrm{\AA}$ line and the blue wing of the Lyman-$\alpha$ 1216 $\textrm{\AA}$ line, both of which are unaccounted for by the DEM model and which the Lyman-$\alpha$ correlation fluxes seem to underestimate. \citet{Tilipman2020} updates the \citet{Fontenla2016} SSRPM model of GJ 832, and when all these EUV reconstruction methods have been applied to a larger sample of stars we may have more insight into the conditions under which each is more likely to be accurate. \begin{figure} \centering \includegraphics[width=\textwidth]{gj832_euv_log.pdf} \caption{Comparing four methods of reconstructing the EUV spectrum of GJ 832. The green line and errorbars represent the spectrum predicted by our DEM model with the errors enclosing the $16^{\textrm{th}}$ to $84^{\textrm{th}}$ percentile intervals for the predicted flux according to the method described in Section \S\ref{sec:euv_fitting}. The red lines show the predicted EUV flux in 100 $\textrm{\AA}$ bandpasses according to the Lyman-$\alpha$ correlations published in \protect\citet{Linsky2014}, available in the MUSCLES dataset. The blue points represent the semi-empirical model published by \protect\citet{Fontenla2016}, also available in the MUSCLES dataset. The purple triangles show the \texttt{PHOENIX} model published in \protect\citet{Peacock2019b} and hosted on \emph{MAST}. These four methods of predicting the EUV spectrum appear to have different regions of mutual agreement, discussed in Section \ref{sec:gj832}.} \label{fig:gj832_euv} \end{figure} \subsection{Barnard's Star}\label{sec:gj699} Barnard's Star is old and inactive compared to most M dwarfs \citep{Ribas2018}, but it still flares occasionally \citep{Paulson2006}. \citet{France2020} obtained X-ray (\emph{Chandra} ACIS-S) and FUV (\emph{HST} STIS/COS) data of this star both during quiescence and during a flare. We used these data to prepare both a quiescent DEM and a flare DEM, under the assumptions that the system is still in a collisionally dominated equilibrium and with solar coronal abundances scaled by the stellar metallicity [Fe/H] $= -0.32$. This is a very low S/N regime in the quiescent data but not nearly as low as TRAPPIST-1, discussed in Section \ref{sec:trappist_1}. A more physically accurate flare DEM would require adjusting the emissivity matrix to account for the magnetic reconnection's influence on the level populations. In the current framework, we see that the flaring state has more material than quiescence at temperatures between $\sim 10^5$ to $10^7$ K, but both the flare and quiescent DEMs agree beyond $3 \times 10^7$ K (see Figure \ref{fig:gj699_dem}). \citet{France2020} uses our quiescent and flaring model EUV spectra to investigate the influence of EUV variability on a hypothetical planet orbiting in the habitable zone of Barnard's star, demonstrating the applicability of our low-resolution spectra to models of atmospheric escape more complicated than simple energy-limited photoevaporation. We note that this DEM shape is very unusual compared to past published DEMs, but emphasize that the wide error intervals are likely to encompass the true DEM shape. If more data become available, perhaps the model constraints will narrow to something more familiar. \begin{figure} \centering \begin{minipage}{0.45\textwidth} \includegraphics[width=1.0\textwidth]{panel_dem_gj699_quiet_p17.pdf} \end{minipage} \begin{minipage}{0.45\textwidth} \includegraphics[width=1.0\textwidth]{panel_dem_gj699_flare_p16.pdf} \end{minipage} \caption{The left panel compares the DEM of Barnard's Star fit to a coarse X-ray spectrum from \emph{Chandra} ACIS-S and line fluxes measured from \emph{HST} STIS. The right panel compares the DEM of Barnard's Star fit to an integrated X-ray flux from \emph{Chandra} ACIS-S and line fluxes from STIS/COS during a flare. For both panels, the dotted blue and solid black bars represent the $\overline{\Psi}(T)$ constraints for the X-ray and FUV data respectively.} \label{fig:gj699_dem} \end{figure} \subsection{TRAPPIST-1}\label{sec:trappist_1} TRAPPIST-1 is an ultracool dwarf with a gaggle of seven planets discovered through transits \citep{Gillon2017}. It is included in the Mega-MUSCLES survey, an extension of the original MUSCLES survey from \citet{France2016}, and the measured FUV line fluxes (\emph{HST} STIS) and X-ray spectrum (\emph{XMM-Newton} EPIC) will be published shortly in Wilson et al. (submitted), where we discuss the implementation of our DEM method for this specific target. Wilson et al. (submitted) also compares the MegaMUSCLES spectral energy distribution of TRAPPIST-1 to the \texttt{PHOENIX} model published in \citet{Peacock2019a}. TRAPPIST-1 tests the fitting in a very low S/N regime constrained by a few FUV lines and a very faint X-ray spectrum, but we still get meaningful fits and constraints on the EUV flux (see Figures \ref{fig:trappist-one_dem} and \ref{fig:all_spectra}). \begin{figure} \centering \includegraphics[width=0.5\textwidth]{panel_dem_trappist_one_p17.pdf} \caption{Comparing the DEM of TRAPPIST-1 fit to a quiescent X-ray spectrum from \emph{XMM-Newton} EPIC and line fluxes from STIS, with $\overline{\Psi}(T)$ constraints shown as horizontal dotted blue and solid black bars respectively.} \label{fig:trappist-one_dem} \end{figure} \subsection{Comparing the Entire Sample} Figure \ref{fig:all_dem} shows the DEMs of all the stars considered within this work and shows some preliminary trends with activity and spectral type: more active stars have a higher mean DEM while the decline in the DEM associated with the move from the transition region to the corona appears to shift to higher temperatures at cooler spectral types. With a more complete sample, we could go a step further to interpolate the EUV flux of cool dwarfs that lack observed FUV and X-ray data by relating the DEM to the more accessible stellar parameters $T_{\textrm{eff}}$ and age, as traced by rotation and/or activity indicators from optical spectra. Determining the best method for this interpolation and testing its accuracy and precision is left to future work. \begin{figure} \centering \includegraphics[width=\textwidth]{all_dem.pdf} \caption{The DEMs of all stars considered in this work are plotted here with the solid line representing the median predicted value of $\Psi(T)$ and shaded intervals enclosing the 16$^{\textrm{th}}$ to 84$^{\textrm{th}}$ percentile intervals. Filling out this plot with more stars across a grid of effective temperature and stellar activity will allow us to investigate trends in the DEM and EUV spectra of cool dwarfs across the entire population.} \label{fig:all_dem} \end{figure} We summarize the data products of this paper by plotting all of our DEM-generated EUV spectra scaled to the flux density observed at a distance of 1 AU from the host star in Figure \ref{fig:all_spectra}. The slope of the spectra across the EUV seems to vary as a function of both spectral type and activity. The hotter stars seem to have more EUV flux between 800 to 900 $\textrm{\AA}$ while the more active stars have more EUV flux between 100 to 600 $\textrm{\AA}$. These wavelength regions correspond to lines formed roughly at temperatures $2\times 10^5$ and $3\times 10^{6}$ K respectively (see Figure \ref{fig:gofnt_heatmap}). AU Mic, which is one of the more active stars and also one of the hotter stars in this sample, has a roughly flat EUV spectrum. TRAPPIST-1, which is also very active but much cooler, shows a strong negative slope from 100 to 1000 $\textrm{\AA}$. The spectral shape of the EUV is controlled by the relative strengths of the corona and chromosphere, and these preliminary observations of our EUV spectra conceptually agree with the findings of \citet{Linsky2020}. \citet{Linsky2020} measured the relationship between X-ray and Lyman-$\alpha$ flux for a large sample of FGKM dwarfs and found that for older and relatively inactive stars, the inverse relationship between coronal emission and effective temperature is much stronger than the inverse relationship between chromospheric emission and effective temperature. Trends in the shape of the EUV spectrum generated by the DEM should be investigated along with trends in the DEM and the data used to inform the fitting, and our current sample is simply too small to make stronger claims than these extremely tentative observations. Furthermore, the overall shape of the EUV spectrum may be significantly altered by the inclusion of continuum processes and an analysis of trends without this source of emissivity is premature. Table \ref{table:all_euv_fluxes} lists the integrated EUV flux at 1 AU, median $s-$factor, effective temperature, stellar radius, and distance for each star considered in this work. \begin{figure} \centering \includegraphics[width=\textwidth]{all_euv_one_au.pdf} \caption{A comparison of all of our model spectra generated for the stars considered in this work, downsampled from a resolution of $R= \frac{\Delta \lambda}{\lambda}= 500$ to 100 $\textrm{\AA}$ wavelength bins, scaled to the flux received at 1 AU. The distance and radius assumed for each star is listed in Table \ref{table:all_euv_fluxes}, and can be scaled to surface flux or habitable zone distances by multiplying with the appropriate factor. On the left panel, we have the hotter stars of the sample: the Sun (spectrum generated from the DEM model without anomalous ions discussed in Section \S\ref{sec:euv_fitting}) in blue, AU Mic in red, and GJ 832 in green. On the right panel we have Barnard's Star in quiescence represented by the brown line, Barnard's Star while flaring shown in pink, and TRAPPIST-1 in dark purple. All the spectra shown have errorbars determined by the method described in Section \S\ref{sec:euv_fitting}.} \label{fig:all_spectra} \end{figure} \section{Conclusions and Future Work}\label{sec:conclusion} Our tests with the Sun show that with a low-resolution X-ray spectrum and the strongest FUV emission lines, we can predict the EUV flux to within a factor of 2 across the entire EUV region. Furthermore, our characterization of the uncertainties in our method show that our predicted EUV spectra are consistent with the data for the Sun, with meaningful error bars to support that statement. We have demonstrated that our choice of functional form is able to describe the DEM within the temperature region relevant to predicting EUV flux, and that uncertainties in the abundance and average electron pressure can be accounted for and propagated to the final output spectra. While our approach to fitting the DEM has serious limitations discussed in Sections \S\ref{sec:euv_fitting} and \S\ref{sec:literature_comparison}, our tradeoff exchanging precision for simplicity allows us to fit DEMs and estimate EUV spectra for many more stars than more sophisticated methods which require EUV data or laborious iterations, both manual and computational. The method can be refined in the future to handle different stellar abundances more carefully, to use temperature-pressure profiles from stellar atmosphere models incorporating more physics, and to find a better way to handle the discrepant \texttt{CHIANTI} ionization equilibrium of the Na-like and Li-like isoelectronic sequences. Including the free-free and free-bound emission of hydrogen and helium species is possible with existing \texttt{CHIANTI} data and these emissivity sources will be accounted for in future DEM fits and EUV spectral reconstructions. The greatest problem with our current approach is the lack of elemental abundances tailored to individual stars based on their effective temperature and age. Updating the abundances we use and refitting the DEM may dramatically improve our precision, but this is left to future work. \emph{Hubble} is the only observatory with FUV spectroscopy and the capability to observe a large sample of M dwarfs, but its lifetime is limited and there will be no replacement in the next few decades. Given the interest in M dwarf planetary systems, a number of survey programs have proposed using \emph{Hubble} to build up a spectral atlas of M dwarfs across the broad range of effective temperature and activity level represented within the spectral type. MUSCLES \citep{France2016}, HAZMAT \citep{Shkolnik2014}, FUMES (Pineda et al., in prep), and Mega-MUSCLES \citep{Froning2019} are completed programs with available data while observations for MEATS, a \emph{Hubble} survey targeting cool dwarf exoplanet hosts scheduled to be observed by \emph{Webb} (HST-GO-16166, PI-France), are forthcoming. Between all these surveys and archival data, we will have enough FUV and X-ray data of cool dwarfs to start characterizing them as a population: fitting DEMs to all nearby cool dwarf stars with sufficiently available data and estimating their EUV flux. With a sufficiently comprehensive DEM library, it may be possible to interpolate DEMs for stars too faint for FUV or X-ray observations, and build on the work of \citet{SanzForcada2011} to calculate the EUV luminosities of all known planet-hosting main-sequence stars. Until stellar atmosphere models become sophisticated enough to have a grid of models varying both effective temperature and stellar activity across the entire cool dwarf regime, or an EUV observatory \citep[e.g.]{France2019} is able to provide directly observed EUV spectra of nearby stars, differential emission measure techniques can satisfy the need for stellar EUV spectra which are physically informed and empirically calibrated. \begin{splitdeluxetable*}{cccBcccc} \tablehead{ \colhead{Star} & \colhead{Integrated 100 - 912 $\textrm{\AA}$ EUV Flux at 1 AU} & \colhead{Median $s$} & \colhead{Star} & \colhead{Effective Temperature} & \colhead{Stellar Radius} & \colhead{Distance}\\ \colhead{---} & \colhead{[erg s$^{-1}$ cm$^{-2}$]} & \colhead{---} & \colhead{---} & \colhead{[K]} & \colhead{[$R_\odot$]} & \colhead{[pc]}} \startdata \tablecaption{The DEM predictions for the integrated EUV flux at 1 AU and median $s-$factor uncertainty for each star considered in this work.\label{table:all_euv_fluxes}} Sun (Woods et al. 2009) & $1.99$ & --- & Sun (Woods et al. 2009) & 5772 \tablenotemark{[1]} & 1 & $4.848 \times 10^{-6}$ \\ Sun (DEM fit to FUV + X-ray)\tablenotemark{a} & $3.54^{+3.12}_{-2.12}$ & $0.60$ & Sun (DEM fit to FUV + X-ray)\tablenotemark{a} & 5772\tablenotemark{[1]}& 1 & $4.848 \times 10^{-6}$\\ Sun (DEM fit without anomalous ions)\tablenotemark{b} & $1.99^{+1.28}_{-1.15}$ & $0.57$ & Sun (DEM fit without anomalous ions)\tablenotemark{b} & 5772\tablenotemark{[1]} & 1 & $4.848 \times 10^{-6}$\\ AU Mic & $31.9^{+21.8}_{-16.2}$ & $0.42$ & AU Mic & 3700\tablenotemark{[2]} & 0.75\tablenotemark{[2]} & 9.979\tablenotemark{[2]}\\ GJ 832 & $1.66^{+1.30}_{-1.06}$ & $0.62$ & GJ 832 & 3657\tablenotemark{[3]} & 0.499\tablenotemark{[4]} & 4.965\tablenotemark{[5]}\\ TRAPPIST-1 & $0.762^{+1.30}_{-0.744}$ & $0.74$ & TRAPPIST-1 & 2516\tablenotemark{[6]} & 0.121\tablenotemark{[6]}& 12.43\tablenotemark{[6]}\\ Barnard's Star (Quiescent) & $0.0183^{+0.109}_{-0.00860}$ & $0.43$ & Barnard's Star (Quiescent) & 3278\tablenotemark{[7]} & 0.178\tablenotemark{[7]} & 1.83\tablenotemark{[5]}\\ Barnard's Star (Flaring) & $0.146^{+0.112}_{-0.0965}$ & $0.45$ & Barnard's Star (Flaring) & 3278\tablenotemark{[7]}& 0.178\tablenotemark{[7]} & 1.83\tablenotemark{[5]}\\ \enddata \tablecomments{To enable scaling the spectrum to other quantities, we also list the stellar effective temperature, radius, and distance assumed in this work.} \tablenotetext{a}{This integrated flux is from the DEM fit to the Sun using the X-ray spectrum and FUV lines.} \tablenotetext{b}{This integrated flux is from the DEM fit to the Sun using the X-ray spectrum, EUV lines, and FUV lines excluding the anomalous ions \ion{N}{5}, \ion{C}{4}, and \ion{Si}{4}.} \tablerefs{[1] \protect\citet{Mamajek2015}, [2] \protect\citet{Plavchan2020}, [3] \protect\citet{Bailey2009}, [4] \protect\citet{Houdebine2010}, [5] \protect\citet{Gaia2018}, [6] \protect\citet{VanGrootel2018}, [7] \protect\citet{Ribas2018}} \end{splitdeluxetable*} \acknowledgments The authors thank the the referee for their constructive comments which improved the quality of this paper. G.M.D. acknowledges the contributions of conversations with Steve Cranmer in the initial stages of this project. This work was funded in part by grants HST-GO-14640, HST-GO-15071, and HST-GO-15264, which were provided by NASA through a grant from the Space Telescope Science Institute, which is operated by the Association of Universities for Research in Astronomy, Incorporated, under NASA contract NAS5-26555. ZKBT acknowledges funding for this work by the National Science Foundation under Grant No. 1945633. This research is based on observations made with the \emph{Far Ultraviolet Spectroscopic Explorer} and \emph{Extreme Ultraviolet Explorer}, obtained from the MAST data archive at the Space Telescope Science Institute, which is operated by the Association of Universities for Research in Astronomy, Inc., under NASA contract NAS 5–26555. We also used observations obtained with \emph{XMM-Newton}, an ESA science mission with instruments and contributions directly funded by ESA Member States and NASA. The analysis of these observations was supported by NASA/\emph{XMM-Newton} AO-17 grant number 82274, "A Unified Understanding of Flare Heating". \vspace{5mm} \facilities{HST(STIS, COS), FUSE, XMM-Newton, Chandra, EUVE.} \software{astropy \citep{2013A&A...558A..33A}, CHIANTI \& ChiantiPy \citep{Dere1997, DelZanna2015}, emcee \citep{ForemanMackey2013}, matplotlib \citep{matplotlib}, numpy \citep{numpy}.}
\section*{Introduction} Direct-to-consumer DNA‌ testing has made it possible for people to gain information about their ancestry, traits and susceptibility to various health conditions and diseases. The simplicity of testing services by companies like 23andMe, AncestryDNA and FamilyTree DNA has drawn a consumer base of tens of millions of individuals. These sequenced genomes are of great use to the medical research community, providing more data for genome-phenome association studies‌, aiding in early disease diagnoses, and personalized medicine. While genome sequencing data gathered in medical settings is anonymized and its use often restricted, individuals may also choose to share their sequenced genomes in the public domain via services like OpenSNP\citemain{greshake2014opensnp} and Personal Genome Project \citemain{ball2014harvard}. Moreover, even the sharing of de-identified data for medical research typically faces tension between open sharing within the research community and exposure to privacy risks. These risks generally stem from the ability of some data recipients to link the genomic data to the identities of the corresponding individuals. One particularly acute concern raised in recent literature is in the ability to link a genome to the photograph of an individual's face~\citemain{lippert2017identification, crouch2018genetics, qiao2016detecting, caliebe2016more}. Specifically, these studies have shown that one can effectively match high-quality three-dimensional face maps of individuals with their associated low-noise sequencing data. However, for a number of reasons, it is unclear whether these demonstrations translate into practical privacy concerns. First, these studies to date have relied on high-quality, and often proprietary data that is not publicly available. This is a concern because such high-quality data is in fact, quite difficult to obtain in practice. While many people post images of their face in public, these are generally two-dimensional, with varying degrees of quality. In addition, observed phenotypes in real photographs need not match actual phenotypes thereby making it challenging to correctly infer one's genotype and vice versa. For example, people may color their hair, or eyes (through contact lenses). Finally, increasing population size poses a considerable challenge to the performance of genome-photograph linkage. Given a targeted individual and a fixed feature-space (namely the predicted phenotypes in our case), the chances of encountering an individual that are similar to the target individual in this feature-space increase with population size. Another related study by Humbert et al. \citemain{humbert2015anonymizing} investigates the re-identification risk of OpenSNP data, but assumes accurate knowledge of a collection of phenotypes, including many that are not observable from photographs, such as asthma and lactose intolerance. We consider this approach to be a theoretical upper-bound in our study, that is, matching performance when ground-truth phenotypes are known apriori, as opposed to when predicted from face images. Given these potential confounders in the real world, in this paper we study the risk of re-identification of shared genomic data when it can potentially be linked to publicly posted face images. To this end, we use the OpenSNP~\citemain{greshake2014opensnp} database, along with a new dataset of face images collected from an online setting and paired with a select subset of 126 genomes. We develop a re-identification method that integrates deep neural networks for face-to-phenotype prediction (e.g., eye color) with probabilistic information about the relationship between these phenotypes and SNPs to score potential image-genome matches. The first purpose of our study is to assess how significant the \emph{average} risk is, as a function of population size, given the nature of available data as well as current technology. Our second purpose is to introduce a practical tool to manage \emph{individual} risk that enables either those who post face images online, or social media platforms that manage this data, to trade off risk and utility from posted images according to their preferences. We find that the overall effectiveness of re-identification and, thus, privacy risk is substantially lower than suggested by the current literature that relies upon high-quality single nucleotide polymorphisms (SNP) and three-dimensional face map data. While some of this discrepancy can be attributed to the difficulty of inferring certain phenotypes---eye color, in particular---from images, we also observe that the risk is relatively low, especially in larger populations, even when we \emph{know} the true phenotypes that can be observed from commonly posted face images. Indeed, even using synthetically generated data that makes optimistic assumptions about the nature of SNP to phenotype relationships, we find that the average re-identification success rate is relatively low. For our second contribution, we propose a method based on adding adversarial perturbations to face images prior to posting them that aims to minimize the score of the correct match. This framework is tunable in the sense that the user can specify the amount of noise they can tolerate, with greater noise added having greater deliterious effect on re-identification success. We show that even using imperceptible noise we can often successfully reduce privacy risk, even if we specifically train deep neural networks to be robust to such noise. Furthermore, adding noise that is mildly perceptible further reduces success rate of re-identification to no better than random guessing. \section*{Results} We investigate the risk of re-identification in genomic datasets "in the wild" based on linkage with publicly posted photos. Using the public OpenSNP dataset, we identified 126 individual genotypes for which we were able to successfully find publicly posted photographs (e.g., some were posted along with genomic data on OpenSNP itself). We used a holistic approach to associate genomes to images as follows. If a user's picture was posted on OpenSNP, higher-quality pictures could often be found under the same username on a different website. When no picture was posted for a certain user on OpenSNP, we found pictures posted on different websites under the same username, and used self-reported phenotypes on OpenSNP to ensure with a reasonable degree of certainty that the image corresponds to the genome. This resulted in a dataset of SNPs with the corresponding photos of individuals, which we refer to as the \emph{Real} dataset. To characterize the error rate in phenotype prediction from images, we constructed two synthetic datasets, leveraging a subset of the CelebA face image dataset~\citemain{liu2015faceattributes}, and OpenSNP. We created artificial genotypes for each image (here, genotype refers only to the small subset of SNPs we are interested in - we refer the reader to Supplementary Table~\ref{snps} for a full list) using all available data from OpenSNP where self-reported phenotypes are present. First, we consider an ideal setting where for each individual, we select a genotype from the OpenSNP dataset that corresponds to an individual with the same phenotypes, such that the probability of the selected phenotypes is maximized, given the genotype. In other words, we pick the genotype from the OpenSNP data that is most representative of an individual with a given set of phenotypes. We refer to this dataset as \emph{Synthetic-Ideal}. Second, we consider a more realistic scenario where for each individual we select a genotype from the OpenSNP dataset that also corresponds to an individual with the same phenotypes, but this time at random according to the empirical distribution of phenotypes for particular SNPs in our data. Since CelebA does not have labels for all considered phenotypes, 1000 images from this dataset were manually labeled by one of the authors, the results of which were confirmed by another of the authors. After cleaning and removing ambiguous cases, the resulting dataset consisted of 456 records. We refer to this dataset as \emph{Synthetic-Realistic}. Our re-identification method works as follows. First, we learned deep neural network models to predict visible phenotypes from face images, leveraging the CelebA public face image dataset, in the form of 1) sex, 2) hair color, 3) eye color, and 4) skin color. We learned a model separately for each phenotype by fine-tuning the VGGFace architecture for face classification \citemain{parkhi2015deep}. The result of each such model is a predicted probability distribution over phenotypes for an input face image. Second, for each input face image $x_i$, and for each phenotype $p$, we use the associated deep neural network to predict the phenotype $z_{i,p}$, that is the most likely phenotype in the predicted distribution. Third, we assign a score, based on the log-likelihood, to each genotype-image pair, $(x_i,y_j)$ as follows: \begin{equation} \label{E:pred} p_{i,j} = \sum_{z_{i,p}}^{p \in \{sex,hair,skin,eye\}} \log P(z_{i,p} | y_j ) \end{equation} This approach is similar to the one introduced by Humbert et al.~\citemain{humbert2015anonymizing}, but differs in that we predict phenotypes from face images as opposed to assuming complete knowledge. Finally, armed with the predicted log-likelihood scores $p_{i,j}$ for genotype-image pairs, we select the top-$k$-scored genotypes for each face image, where $k$ is a tunable parameter that allows for a trade-off in theprecision and recall of predictions. The effectiveness of re-identification is strongly related to both the choice of $k$ above, as well as the size of the population that one is trying to match against. More specifically, as we increase $k$, one would naturally expect recall (and, thus, the number of successful re-identifications) to increase. On the other hand, a larger population raises the difficulty of the task by increasing the likelihood of spurious matches. We therefore evaluate the impact of both of these factors empirically. \subsection*{Average Re-identification Risk is Low in Practice} We evaluate the effectiveness of re-identification attacks using two complementary measures: 1) the fraction of successful matches and 2) the area under the receiver operating characteristic (ROC) curve (AUC). The former enables us to study re-identification success (while focusing on recall) as a function of population size, while the latter paints a more complete picture of the tradeoff between precision and recall. First, we consider the proportion of successful matches as a function of the population size; i.e.,the number of individuals in the genomic database. To do this, we consider several fixed values of $k$, where a match from a face image $x_i$ to a genome $y_j$ is considered successful if the associated log-likelihood score $p_{i,j}$ is among the top-$k$ for the image $x_i$. \begin{figure}[ht!] \centering \begin{subfigure}[t]{0.35\textwidth} \includegraphics[width=6.5cm]{Vanilla_Top1_svg-tex.pdf} \caption{} \end{subfigure} \begin{subfigure}[t]{0.35\textwidth} \includegraphics[width=6.5cm]{Vanilla_Top5_svg-tex.pdf} \caption{} \end{subfigure} \begin{subfigure}[t]{0.35\textwidth} \includegraphics[width=6.5cm]{synthetic/ideal_swapeye_1_svg-tex.pdf} \caption{Ideal} \end{subfigure} \begin{subfigure}[t]{0.35\textwidth} \includegraphics[width=6.5cm]{topk_auc_curves/topks_126_svg-tex.pdf} \caption{} \end{subfigure} \caption{\textbf{Effectiveness of matching individuals' photos to their DNA sequences in OpenSNP.} (a) Success rate for top-1 matching for the \emph{Real} dataset; (b) success rate for top-5 matching for the \emph{Real} dataset; (c) Success rate for top-1 matching in the \emph{Synthetic-Ideal} dataset; (d) ROC curve for 126 individuals. (a), (b), and (c) present matching success results as a function of the population size (the number of individual genomes to match a face image to) for a fixed $k$. } \label{fig:matching} \end{figure} The results for the \emph{Real} dataset for $k=1$ and $k=5$ are shown in Fig.~\ref{fig:matching} (a) and \ref{fig:matching} (b) respectively. We compare the success of our re-identification approach to two baselines: 1) when matches are made randomly (a lower bound) and 2) when matches use \emph{actual}, rather than predicted, phenotypes (an upper bound). Based on Fig.~\ref{fig:matching} (a), it can be seen that the matching success (where we solely take the top-scoring match) is relatively low \emph{even for the upper bound}, where we actually know the phenotypes (and, consequently, do not need the images). However, the top-1 matching success rate is close to the upper bound (which assumes perfect knowledge of phenotypes) and is considerably better than random. As expected \citemain{lippert2017identification}, prediction efficacy reduces as the population size grows. Fig.~\ref{fig:matching} (c) shows that in an idealized setting, re-identification accuracy can be considerably higher; however, effectively predicting eye color is crucial, and this is also a major limitation of existing techniques. Fig.~\ref{fig:matching} (d) shows that when we treat matching as a binary prediction problem, the effectiveness is well above that achieved by randomly guessing. Nevertheless, re-identification risk "in the wild" does not appear to be especially high. While we observe success rate as high as 25\%, this is only achieved when the genomic dataset is extremely small - on the order of 10 individuals. By contrast, the success rate for top-1 matching drops quickly and is negligible for populations of over 100 individuals. And, it should be kept in mind that this result assumes we can predict the phenotypes perfectly. The overall pattern does not substantially change when $k=5$. However, in this case the matching success rates naturally increase, approaching 80\% for small populations, and slightly below 20\% for populations above 100 individuals. In this case, we do observe that our re-identification approach, while significantly better than random, is also considerably below the theoretical upper bound. This suggests that, when more than a single re-identification claim is permitted for each image, the error in phenotype prediction from face images has a greater influence. Next, we delve more deeply into the nature of re-identification risk using the larger synthetic datasets. We present the results for \emph{Synthetic-Ideal} in Fig.~\ref{fig:matching} (c). Additional results for both the \emph{Synthetic-Ideal} and \emph{Synthetic-Real} datasets when the top $1, 3$, and $5$ matches are predicted to be true matches are provided in Supplementary Fig.~\ref{fig:adv_synth} (a)-(f). These results offer two insights. First, if an attacker has access to particularly high-quality data, re-identification risk can be relatively high for small populations. For example, the upper bound is now over 60\% in some cases. However, it can also be seen that of the phenotypes we aim to predict, eye color is both the most difficult and highly influential in matching. If we assume that we \emph{know} this phenotype, and only have to predict the others, re-identification risk is near its upper bound (which assumes that we know the true phenotypes). This is even more striking in the case of the \emph{Synthetic-Real} data, as shown in Supplementary Fig.~\ref{fig:swapeye} (a)-(d). To determine if this result was an artifact of the specific method we selected for eye color prediction, we considered several alternative methods\citemain{7553523} for eye color prediction, ranging from conventional computer vision techniques to deep learning (see Supplementary Fig.~\ref{fig:eyecomp} (e)-(g)). None of these methods were particularly efficacious. \subsection*{Precision-Recall Tradeoff} We then turned our attention to a different evaluation of prediction efficacy: the tradeoff between false positives and false negatives that obtains as we vary $k$. The results, shown in Fig.~\ref{fig:matching} (d) for a population size of 126 individuals, suggest that the overall re-identification method is relatively effective (AUC $>$70\%), particularly when compared to random matching when viewed as a binary predictor (match vs.~non-match) for given genome-image pairs. ROC curves when thresholding on $k$ for various population sizes are presented in Supplementary Fig.~\ref{fig:indeps_roc} (a)-(l). In Supplementary Fig.~\ref{fig:indeps_roc} (m)-(x), we also consider a common alternative where we use a tunable threshold $\theta$ on the predicted log-likelihood to claim when a match occurs. Overall, our results suggest that there is some relationship between face images and public genomic data, but the success rates are well below what other prior literature appears to suggest, even in idealized settings. We believe there are several contributing factors behind this observation. First, the quality of face images in the wild is much lower than the high-definition 3D images obtained in highly controlled settings in prior studies~\citemain{lippert2017identification, crouch2018genetics, qiao2016detecting, caliebe2016more}. Second, there is a relative scarcity of high-quality training and validation data for this particular task. While there are large, well-labeled datasets for face classification~\citemain{parkhi2015deep, panetta2018comprehensive, kazemi2014one, grgic2011scface, GeBeKr01, weyrauch2004component}, the data required for re-identification requires paired instances of genomes and images, which is far more challenging to obtain at scale. Third, visible phenotypes are influenced by factors other than just the SNPs that are known to have a relationship with them, particularly when you add artificial factors, such as by dying one's hair or wearing tinted contact lenses, introducing considerable noise in the matching. Finally, our analysisassumed (as did all prior studies) that we already know that there is, in fact, a match in the genomic dataset corresponding to each face. In reality, success rates would be even lower, since a malicious actor is unlikely to be certain about this~\citemain{10.1145/2806416.2806580}. \subsection*{Achieving Privacy through Adversarial Image Perturbations} While our assessment of re-identification risk above suggests that the risk to an average individual exhibited in prior literature are likely somewhat inflated in prior literature, we are, indeed, able to successfully re-identify a subset of individuals. Moreover, some of the settings, such as situations where there is sufficient prior knowledge that can narrow down the size of the population to which a face can be matched, are indeed quite risky. This led us to investigate the natural question: how can we most effectively mitigate re-identification risks associated with the joint public release of both genomic data and face images. Our specific goal is to provide tools that can reduce re-identification risks \emph{to individuals} who publicly post their photos. Such tools can then be used either directly by individuals to manage their own risks, or by platforms where photos are posted to manage risks to their subscribers. In particular, we show that this can be accomplished by adding small adversarial image perturbations (via adversarial examples) to reduce the effectiveness of genomic linkage attacks. The idea behind adversarial examples is to inject a small amount of noise into an image, where ``small'' is quantified using an $l_p$ norm, in order to cause a misprediction. In our case, however, we do not have a single deep neural network making predictions, but rather a collection of independent phenotype predictors \emph{using the same image as input}. One direct application of adversarial examples in our setting would be to arbitrarily choose a phenotype (say, sex, which is the most informative) and target this phenotype for misprediction, with the anticipation that this would cause re-identification attacks to fail. However, we can actually do much better at protecting privacy by tailoring adversarial examples to our specific task. This is because our ultimate goal is not to cause mispredictions of phenotypes per se, but rather to cause an attacker to fail to link the image with the correct genome. Leveraging the scoring function in Equation~\eqref{E:pred}, we aim to minimize the score $p_{ij}$ for image $x_i$ and the correct corresponding genome $y_j$. However, this is a non-trivial task because the scoring function has a discontinuous dependence on predicted phenotypes (since we use only the most likely phenotype given image in computing it). To address this issue, we augment the score with the log of the predicted probabilities. More precisely, let $g_p(v_p, x_i)$ denote the probability that the neural network predicts a variant $v_p$ for a phenotype $p$ (e.g., eye color) given the input face image $x_i$. The problem we aim to solve is to find adversarial perturbation to the input image $\delta^*$ that solves the following problem \[ \min_{-\epsilon \le \delta \le \epsilon} \sum_{p}^{p \in \{sex,hair,skin,eye\}} \sum_{v_p} \log g_p(v_p, x_i+\delta) \log P(v_p | y_j). \] Since this expression is differentiable with respect to the adversarial noise $\delta$, we can solve it using standard gradient-based methods (see Materials and Methods for further details). \begin{figure}[h!] \centering \begin{tabular}{p{0.35\textwidth}c} \begin{subfigure}[t]{0.35\textwidth} \includegraphics[width=6.5cm]{univ_noise/univ_noise_1_svg-tex.pdf} \caption{} \end{subfigure} \begin{subfigure}[t]{0.35\textwidth} \includegraphics[width=6.5cm]{sex_plots/sex_nonrobust_attacked_1_svg-tex.pdf} \caption{} \end{subfigure} & \begin{tabular}{c} \\ \\ $\epsilon=0.001$\\ \includegraphics[height=1.8cm, width=4.9cm]{adv_ex/0001_0_partial.png}\\ $\epsilon=0.005$\\ \includegraphics[height=1.8cm, width=4.9cm]{adv_ex/0005_0_partial.png}\\ $\epsilon=0.01$\\ \includegraphics[height=1.8cm, width=4.9cm]{adv_ex/001_0_partial.png}\\ $\epsilon=0.025$\\ \includegraphics[height=1.8cm, width=4.9cm]{adv_ex/0025_0_partial.png} \end{tabular} \end{tabular} \caption{\textbf{Evaluating adversarial perturbations as a defense.} (a) Effectiveness of adversarial perturbation as a defense against re-identification for $k=1$ (i.e., the attacker considers only the top match). Pixel values are normalized to a $[0,1]$ interval, and perturbation strengths $\epsilon$ are with respect to these normalized pixel values. It can be seen that prediction accuracy is near zero at a perturbation strength $\epsilon \geq 0.01$. Moreover, even for very small amounts of adversarial noise, such as $\epsilon = 0.001$, matching success is nearly indistinguishable from random matching if we have at least 20 individuals in a consideration pool. (b) Effectiveness of perturbations that only target sex prediction from a face image. The effect of larger perturbations ($\epsilon \ge 0.01$ is similar to Fig.~\ref{fig:nonrobust_attacked} (a). However, smaller perturbations are considerably less effective. Example images on the right (drawn from the public celebrity face image dataset) illustrate the extent of visible effect of introduced adversarial perturbations to images. The perturbations are essentially imperceptible to a human until $\epsilon > 0.01$, when the effect becomes clearly visible.} \label{fig:nonrobust_attacked} \end{figure} Our first evaluation, shown in Fig.~\ref{fig:nonrobust_attacked}, presents the effectiveness of our method for preserving privacy in public face images. Fig.~\ref{fig:nonrobust_attacked}(a), in particular, demonstrates that when we take deep neural networks for phenotype prediction as a given, the effectiveness of the re-identification attack described above declines significantly even for very small levels of noise added to images. For sufficiently large noise (e.g., $\epsilon=0.01$), the success rate is close to zero, which is considerably lower than random matching. Moreover, by comparing Fig.~\ref{fig:nonrobust_attacked} (a) to Fig.~\ref{fig:nonrobust_attacked} (b), it can be seen that our approach is also more effective than designing adversarial perturbations that target a single sex phenotype. The effectiveness of targeting other phenotypes is provided in Supplementary Fig.~\ref{fig:hair_eye_skin_1} (d)-(f), where it can be seen that attacking only hair color, eye color or skin color alone is insufficient to induce a significant level of misclassification. While the presented results are only for $k=1$ (i.e., the attacker only considers the top-scoring match), results for $k=3$ and $k=5$ offer similar qualitative insights (as shown in Supplementary Fig.~\ref{fig:nonrobust_attacked_5}). The visual effect of the designed image perturbations is illustrated on the right in Fig.~\ref{fig:nonrobust_attacked} using images drawn from the public celebrity face image dataset. As can be seen, most of the levels of added noise have negligible visual impact. It is only when we add noise at $\epsilon=0.025$ that we begin to clearly discern the perturbations. However, to address the re-identification problem, it appears sufficient for privacy to use levels of noise of $\epsilon = 0.01$ or smaller, which leads to near-zero matching-score. While introducing adversarial noise appears to be sufficiently reduce the risk of re-identification introduced by publicly shared photographs, this still supposes that re-identification makes use of deep neural network models trained in the regular fashion, such as on the CelebA dataset. However, there are various techniques for enabling the training of such models that yield significantly better resistance to adversarial noise, the most effective of which is adversarial training~\citemain{madry2017towards,Vorobeychik18book}. The adversarial training approach learns a model by augmenting each iteration with training images that are adversarially perturbed, using the model from the previous iteration as a reference. The main limitation of adversarial training is that it also results in lower accuracy on data that is not adversarially perturbed. Given the relatively limited effectiveness of the re-identification approach above and all of the practical limitations of that exercise, we now investigate whether, in practice, adversarial training sufficiently handicaps re-identification, such that its increasing robustness to added perturbations offers little value. \begin{figure}[h!] \centering \begin{subfigure}[t]{0.45\textwidth} \centering \includegraphics[width=6.5cm]{univ_retrained/baseline_top_1_svg-tex.pdf} \caption{} \end{subfigure} \begin{subfigure}[t]{0.45\textwidth} \centering \includegraphics[width=6.5cm]{univ_retrained/tr01_top_1_svg-tex.pdf} \caption{} \end{subfigure} \caption{\textbf{Evaluation of models that are trained to increase robustness to perturbations through adversarial training when only the top match is considered in re-identification.} a) Matching accuracy of ``robust'' models trained by adding adversaries with varying adversarial noise levels $\epsilon$ when unperturbed face images are used as inputs. Using $\epsilon > 0.01$ causes matching accuracy to be effectively equivalent to random. b) Matching accuracy of ``robust'' models trained by adding adversaries with $\epsilon = 0.01$ when input face images are perturbed with varying levels of adversarial noise. Using $\epsilon > 0.01$ is sufficient to cause sub-random matching accuracy. For noise with $\epsilon = 0.01$, matching accuracy degrades from original, but remains higher than random.} \label{fig:robust_noattack} \end{figure} To evaluate the effect of adversarial training on re-identification, we run further training iterations on the phenotype-prediction models with adversarial examples generated over subsets of the original training sets. We make five passes over adversarial examples, each time using the model from the previous iteration to generate these examples. Since the match score depends on images as well as corresponding genomes, we use paired genome-image datasets for adversarial training (the most optimistic setting from the re-identification perspective). Specifically. we use a random subset of 77 image-DNA pairs (approximately $60\%$) from our OpenSNP dataset for training, and the remaining 49 for testing the matching accuracy. We construct five sets of adversarially robust phenotype prediction models using this procedure, each set adversarially trained using a different amount of added adversarial noise, from $\epsilon = 0.001$ to $\epsilon = 0.05$. As expected, Fig.~\ref{fig:robust_noattack} (a) illustrates that baseline prediction accuracy (i.e., using original face images without perturbations) reduces as strength of the perturbation used for adversarial training increases. Indeed, once $\epsilon > 0.01$, the effectiveness of matching is essentially equivalent to random, suggesting that the most robust model that holds any utility is the one with $\epsilon = 0.01$. Next, we consider how robust this model is to images that now have adversarial perturbations of varying magnitudes. The results are shown in Fig.~\ref{fig:robust_noattack}(b). Notably, adversarial noise with $\epsilon = 0.025$ again yields near zero matching success. A smaller amount of noise that preserves imperceptibility, such as $\epsilon = 0.01$, is still effective in reducing the accuracy of the robust model, although the resulting re-identification success rate is still above random matching. Nevertheless, re-identification success even in this case is now $\sim$ 20\% even in the most optimistic case. Moreover, our framework is sufficiently flexible that a particularly risk-averse individual may simply raise the noise level to 0.025, accepting some visible corruption to the image, but effectively eliminating privacy risk. \section*{Discussion} Our findings suggest that the concerns about privacy risks to shared genomic data stemming from the attacks matching genomes to publicly published face photographs are low, and relatively easy to manage to allay even the diverse privacy concerns of individuals. Of course, our results do not imply that shared genomic data is free of concern. There are certainly other potential privacy risks, such as membership attacks on genomic summary statistics~\citemain{hagestedt2020membership, liu2018detecting, Chen2020.08.03.235416, wan2017controlling, wan2017expanding, zerhouni2008protecting, raisaro2017addressing, shringarpure2015privacy, craig2011assessing}, which would allow the receipient of the data to determine the presence of an individual in the underlying dataset. This type of attack is of concern because it would allow an attacker to associate the targeted individual with the semantics inherent in the dataset. For instance, if the dataset was solely composed of individuals diagnosed with a sexually transmitted disease, then membership detection would permit the attacker to learn that the target had the disease in question. Moreover, we emphasize that our results are based on \emph{current} technology; it is possible that improvements in either the quality of data, such as broad availability of high-definition 3D photography, or the quality of AI, such as highly effective approaches for inferring eye color from images, will indeed significantly elevate risks or re-identification. However, through several studies which include synthetic variants controlling for the quality of data, as well as evaluations that assume we can infer observable face phenotypes with perfect accuracy (see, for example, the results in Fig.~\ref{fig:matching}, as well as in the Supplementary Figures~\ref{fig:adv_synth} and~\ref{fig:swapeye}), we show that even with advances in technology the risk is likely to remain limited. \section*{Materials and Methods} \subsection*{Re-Identification Attack with Public Face Images} In our attack, we consider the following phenotypes to be readily visible in face images: eye color, hair color, sex, and skin color. To this end, we first collected genomes uploaded to OpenSNP that were sequenced by 23andMe. We then filtered the users who have self-reported all four phenotypes we are interested in. Some of these users also uploaded their face images directly on OpenSNP. For others, we found their faces through a Google reverse search using their OpenSNP usernames, which we then manually verified these using the self-reported phenotypes. This process yielded 126 pairs of face images and DNA profiles of individuals that were carefully curated. The full study was approved by the Washington University in St.~Louis Institutional Review Board, with the condition that we will not publicly release this curated dataset (in order to mitigate any possible harm to these individuals). However, we are able to share it privately with other researchers for validation purposes, subject to an agreement preventing public release. \subsubsection*{Predicting Phenotypes from Images} To predict phenotypes from facial images, we leveraged the VGGFace \citemain{parkhi2015deep} convolutional neural network architecture. Due to the relative scarcity of labeled training data for phenotypes of interest, we employed transfer learning~\citemain{pratt1993discriminability}, which has been extensively and successfully used for various classification tasks where labeled data is scarce \citemain{Cao_2013_ICCV,10.1145/2818346.2830593,rajagopal2014exploring,7378076,7139098,xia2011kinship,dornaika2019age, Rossler_2019_ICCV}. Specifically, we started with a model previously trained on a the CelebA dataset~\citemain{liu2015faceattributes} for a face recognition task. We then fine-tuned these models on subsets of the CelebA dataset. For sex and hair color, the CelebA dataset already contains labels for all $\sim 200,000$ images, and we thus used the entire dataset to fine-tune the sex prediction classifier. For hair color, we find that fine-tuning on a subset of 10000 images with equal number of blonde, brown, and black hair color images outperforms a model trained on the entire dataset; we thus use the latter. For skin color, 1000 images were labeled on a 5-point scale by Amazon Mechanical Turk (AMT) workers, and then manually sorted into 3 classes. For eye color prediction, 1000 images were labeled by AMT workers; however, after manual verification of these labels, we retained $\sim$ 850 images, dropping the rest because the eye color was indeterminate. \subsubsection*{Matching Faces to DNA} Once we learned phenotype classifiers for each visible phenotype, we then for each face image in test data predicted the most likely variant (i.e., the one with the largest predicted probability) for each face image in test data. We then used this prediction for matching the face image to a DNA record as follows. Let an image be denoted by $x_i$ and a genome by $y_j$. We use the following matching score, where phenotype variant $z_{i,p}$ is the most likely predicted variant: \[P_{ij} = \prod_{p}^{p \in \{sex,hair,skin,eye\}} P(z_{i,p}|y_j). \] To ensure numerical stability, we transform it into log-space, resulting in \[ \log P_{ij} = \sum_{p}^{p \in \{sex,hair,skin,eye\}} \log P(z_{i,p}|y_j) \] The variant $z_{i,p}$ is predicted from \{F, M\} for sex, \{blue, brown, intermediate\} for eye color, \{black, blonde, brown\} for hair color and \{pale, intermediate, dark\} for skin color. The probability of each phenotype variant given a genome, $P(z_{i,p}|y_j)$, is in turn expressed as a product of probabilities over relevant SNPs (see Supplementary Table~\ref{snps} for these lists). The probability of a specific phenotypic variant given a certain SNP is calculated empirically from the available data, with priors of the phenotypic variant used where SNPs are missing. Having calculated the likelihood of a match between image $X_i$ and DNA sequence $y_j$ for all images, for all DNA sequences, we rank the DNA sequences in decreasing order of matching likelihood for each image. The presented results correspond to when the correct match resides in the top scored $1, 3$ or $5$ entries in this sorted list. \subsection*{Protecting Privacy by Adding Noise to Face Images} Recall that our goal is to minimize the score $p_{ij}$ where $x_i$ is the image and $y_j$ the correct corresponding genome. Since the score function has a discontinuous dependence on phenotype predictions, we augment the score with the log of the predicted phenotype probabilities. Specifically, let $g_p(v_p, x_i)$ denote the probability that the neural network predicts a variant $v_p$ for a phenotype $p$ (e.g., eye color) given the input face image $x_i$; these are just the outputs of the corresponding softmax layers of the neural networks. The problem we aim to solve is to find adversarial perturbation to the input image $\delta^*$ that solves the following problem: \[ \min_{-\epsilon \le \delta \le \epsilon} \sum_{p}^{p \in \{sex,hair,skin,eye\}} \sum_{v_p} \log g_p(v_p, x_i+\delta) \log P(v_p | y_j). \] We use \emph{projected gradient descent} to solve this problem, invoking a combination of automated differentiation in pytorch~\citemain{NEURIPS2019_9015}, and the Adam optimizer~\citemain{kingma2014adam}. After each gradient descent step, we simply clip the noise to be in the $[-\epsilon, \epsilon]$ range, and to ensure that the resulting pixel values are valid. We use the original image as the starting point in this procedure (i.e., initializing $\delta = 0$). \subsubsection*{Training Robust Phenotype Classification Models} While the idea of adding noise as privacy-protection works well when we use regularly trained phenotype prediction models, one can make such models more robust, albeit at a cost to accuracy on noise-free data. As such, we investigate how effective adversarial training, a state-of-the-art approach for making predictions robust to adversarial noise, is at overcoming our noise injection approach. The main premise of adversarial training is as follows. The broad goal is to solve the following optimization problem: \[ \min_\theta \sum_{x,y \in \mathcal{D}} L(\theta, x+\delta^*, y), \] where $\delta^*$ is adversarially induced noise and $L(\cdot)$ is the loss function. In practice, computing an optimal noise to add is difficult, and we instead use the approaches such as gradient descent described above. However, adversarial training proceeds like regular training (using gradient descent), except that each training input is $x+\delta^*$ rather than $x$, that is, we use adversarially perturbed inputs in place of regular inputs. where $||\delta|| \leq \epsilon$. A standard way of achieving empirically robust models is to simply augment training data with adversarial examples generated over a subset of the training data. In generating these instances, we use random starting points for generating adversarial examples. The downside of adversarial training, however, is that robustness to adversarial images often comes at the cost of accuracy on unaltered images, and a careful balance must be achieved between adversarial robustness and baseline accuracy. \bibliographystylemain{naturemag-doi} \bibliographymain{sample} \section*{Acknowledgements} We acknowledge support of this work by the National Human Genome Research Institute, National Institutes of Health under grant number RM1HG009034. \section*{Author Contributions Statement} R.V., B.A.M. and Y.V. jointly designed the study. R.V. implemented the study, and all authors analysed the results. B.A.M. and Y.V. jointly supervised this work. All authors contributed to writing, editing and reviewing the manuscript. \section*{Competing Interests} The authors declare no competing interests. \section*{Data Availability} The \emph{Synthetic-Real} and \emph{Synthetic-Ideal} datasets generated as part of the study are available along with our code in a publicly available GitHub repository. As this study was approved by Washington University in St. Louis Institutional Review Board under the condition that the \emph{Real} dataset will not be publicly released to protect the identity of the individuals involved, this dataset is made available privately upon reasonable request to \href{mailto:<EMAIL>}{<EMAIL>}, subject to a data-sharing agreement prohibiting public release. \section*{Code Availability} The code used in this work, the synthetic data generated in the study, and instructions to set up a similar Python environment are available in a publicly accessible GitHub repository: \url{https://github.com/rajagopalvenkat/GenomicReID}. \clearpage
\section{Introduction} \label{sec:intro} Acoustic Echo Cancellation (AEC) plays an essential part in full-duplex speech communication systems. The goal of AEC is no echo leakage when there is loudspeaker signal (far end) and no speech distortion when the users talk (near end). It has been a challenging problem since the earlier days of telecommunication~\cite{benesty2001advances}. A practical acoustic echo cancellation solution, e.g. the one in the WebRTC project~\cite{webrtc}, usually consists of three modules: Time Delay Compensation (TDC), linear adaptive filtering and Non-Linear Processing (NLP). Time delay compensation is necessary, especially in real systems where microphone signal capturing and loudspeaker signal rendering are handled by different threads and the sample clocks may not be synchronized. Typical delays between the far end and near end signals range from 10 ms to 500 ms. Though in theory, the linear adaptive filter can handle any delay by having a sufficient number of filter taps. TDC could benefit the performance by avoiding over-parameterization and speeding up convergence. Time delay estimation methods include the Generalized Cross-Correlation with PHAse Transform (GCC-PHAT) algorithm~\cite{knapp1976generalized} and audio fingerprinting technology~\cite{voelcker2012robust}. \begin{figure}[thb] \centering \centerline{\includegraphics[width=0.9\columnwidth]{fig1.pdf}} \caption{A typical acoustic echo cancellation solution.} \label{fig1} \end{figure} Linear adaptive filters, such as Normalized Least Mean Square (NLMS) filters~\cite{haykin2008adaptive} and Kalman filters~\cite{wu2016robust}, can be designed either in the time domain or in the frequency domain. For the best performance possible, the filter length should be long enough to cover the whole echo path, which could be thousands of taps in the time domain. Frequency Domain Adaptive Filter (FDAF)~\cite{shynk1992frequency} are more often chosen for computational savings and better modeling statistics. NLP is introduced as a complement to linear filtering to suppress residual echos. The methods are generally adapted from noise reduction techniques, e.g. the multi-frame Wiener filter~\cite{huang2016multiframe}. Many recent studies also adopt deep learning methods for residual echo suppression~\cite{carbajal2018multiple,fazel2019deep,zhang2019deep,fazel2020cad} and report reasonable objective scores on synthetic datasets. One concern is that the neural network models may degrade significantly in real applications. The AEC-Challenge~\cite{Sridar2020} is thus organized to stimulate research in this area by providing recordings from more than 2,500 real audio devices and human speakers in real environments. The evaluation is based on the average P.808 Mean Opinion Score (MOS)~\cite{naderi2020open} achieved across all different single talk and double talk scenarios. This paper describes our submission to the AEC-Challenge, which consists of three cascading modules: GCC-PHAT for time delay compensation, weighted Recursive Least Square (wRLS) for linear filtering, and a Deep Feedforward Sequential Memory Network (Deep-FSMN)~\cite{zhang2018deep} for residual echo suppression. The wRLS filter is derived from a novel semi-blind source separation perspective and is shown to be double talk friendly. The algorithm proved its efficacy in the Challenge and it is described in the following section. \section{The proposed algorithm} \label{sec3} As in Figure~\ref{fig1}, the captured signal at time $t$ is expressed as: \begin{equation} d(t) = x(t)*a(t) + s(t) + v(t) \end{equation} where $x(t), s(t)$ and $v(t)$ are respectively the the far end signal, the near end speech signal and the signal modeling error. $a(t)$ denotes the echo path and $*$ denotes convolution. It is assumed $v(t)=0$ in the following for simplicity. The frequency representations of $d, x, a, s$ are respectively denoted as $D, X, A, S$. \subsection{Time Delay Compensation} The GCC-PHAT algorithm is applied first to align the far end and near end signals. The generalized cross correlation is defined as $\Phi_{t,f} = E[X_{t,f}D^{*}_{t,f}]$ with $E[\cdot]$ denoting expectation, $f$ the frequency index and $(\cdot)^*$ the conjugate of a variable. The online implementation is given by: \begin{equation} \label{eq:gcc} \Phi_{t,f} = \alpha \Phi_{t-1,f} + (1 - \alpha) X_{t,f}D^{*}_{t,f} \end{equation} where $\alpha$ is a smoothing parameter. The relative delay $\tau$ is obtained by performing Inverse Fast Fourier Transform (IFFT) and finding the index of the maximum: \begin{equation} \label{eq:delay} \tau = \underset{\tau}{\text{argmax}} ~\text{IFFT}(\frac{\Phi_{t,f}}{|\Phi_{t,f}|}) \end{equation} \subsection{wRLS Filtering} Linear filtering is performed in the frequency domain on the time-aligned signals $x(t')$ and $d(t)$. Suppose an echo path of $L$ taps, the signal model is reformulated as: \begin{equation} \begin{bmatrix} D_{t,f} \\ {\bf x}_{L,f} \end{bmatrix} = \begin{bmatrix} 1 & {\bf a}^H_{L,f}\\ {\bf 0} & {\bf I} \end{bmatrix} \begin{bmatrix} S_{t,f} \\ {\bf x}_{L,f} \end{bmatrix} \end{equation} where ${\bf x}_{L,f} = [X(t',f), X(t'-1, f), ..., X(t'-L+1,f)]^T$ and ${\bf a}_{L,f} = [A(t,f), A(t-1, f), ..., A(t-L+1,f)]^T$ with $(\cdot)^T$ denoting transpose and $(\cdot)^H$ Hermitian transpose. $\bf I$ is a unitary matrix of order $L$. The near end speech can be separated by: \begin{equation} \label{eq:unmix} \begin{bmatrix} \hat{S}_{t,f} \\ {\bf x}_{L,f} \end{bmatrix} = {\bf B}_f \begin{bmatrix} D_{t,f} \\ {\bf x}_{L,f} \end{bmatrix} \end{equation} where $\hat{(\cdot)}$ denotes the estimate of a variable and ${\bf B}_f$ is termed the unmixing matrix. Equation~(\ref{eq:unmix}) clearly defines a semi-blind source separation problem. Assuming independence of $\{D_{t,f}, {\bf x}_{L,f} \}$, the unmixing matrix has this unique form as: \begin{equation} {\bf B}_f = \begin{bmatrix} 1 & {\bf w}^H_{L,f}\\ {\bf 0} & {\bf I} \end{bmatrix} \end{equation} which can be solved by the well established source source separation algorithms, such as the Independent Component Analysis (ICA) and auxiliary-function based (Aux-)ICA algorithms~\cite{ono2010auxiliary}. The Aux-ICA solution is briefly described as follows and a detailed derivation can be found in~\cite{wangsemi}. The Kullback-Leibler divergence is introduced as the independence measure \begin{equation} J({\bf B}_f) = \int_{S_{t,f}} \int_{{\bf x}_{L,f} } p(S_{t,f},{\bf x}_{L,f}) \log \frac{p(S_{t,f},{\bf x}_{L,f})}{q(S_{t,f},{\bf x}_{L,f})} \end{equation} where $p(\cdot)$ represents the source Probability Density Function (PDF) and $q(\cdot)$ the product of approximated PDF of individual sources. The loss is upper bounded by the auxiliary loss function \begin{equation} \label{eq:aux} Q({\bf B}_f, {\bf C}_f) = \sum_{i=1}^{L+1} {\bf b}_{i,f}^H {\bf C}_{i,f} {\bf b}_{i,f} + const. \end{equation} where ${\bf b}_{i,f}^H$ is the $i$-th row vector of ${\bf B}_f$ and the auxiliary variable \begin{equation} {\bf C}_{i,f} = E[\frac{G'(r_{i,t,f})}{r_{i,t,f}}{\bf x}_{t,f}{\bf x}_{t,f}^H] \end{equation} with ${\bf x}_{t,f} = [D_{t,f}, {\bf x}^T_{L,f}]^T$ and $r_{i,t,f}$ the $i$-th separated source. $G(r)$ is called the contrast function and has a relationship $G(r) = -\log p(r)$. Equation~(\ref{eq:aux}) can be minimized in terms of ${\bf b}_{1,f}$ as: \begin{align} \nonumber {\bf b}_{1,f} &= [{\bf B}_f{\bf C}_{1,f}]^{-1}{\bf i}_1 \\ &= {\bf C}_{1,f}^{-1}{\bf i}_1 . \end{align} with ${\bf i}_1 = [1,0,...,0]^T$ a $L+1$ dimensional vector. Further by applying block matrix inversion of ${\bf C}_{1,f}$, the unmixing filter coefficients are given by \begin{align} \label{eq:rls} {\bf w}_{L, f} &= -{\bf R}_{L, f}^{-1}{\bf r}_{L,f} \end{align} where \begin{align} \nonumber {\bf R}_{L,f} &= E[\frac{G'(r)}{r}{\bf x}_{L,f}{\bf x}_{L,f}^H], \\ {\bf r}_{L,f} &= E[\frac{G'(r)}{r}{\bf x}_{L,f}D_{t,f}^*] . \end{align} The separated near end speech is obtained as: \begin{equation} \hat{S}_{t,f} = D_{t,f} + {\bf w}^H_f {\bf x}_{L,f}. \end{equation} Equation~(\ref{eq:rls}) stands for a weighted RLS filter, in which the correlation weighting factor is determined by the underlying near end source PDF. In literature, a general super-Gaussian source PDF has the form of \begin{equation} \label{eq:pdf} G(D_{t,f}) = (\frac{D_{t,f}}{\eta})^{\beta}, \quad 0 < \beta \leq 2 \end{equation} where a shape parameter of $\beta \in [0.2, 0.4]$ is suggested. \begin{figure*}[th] \centering \includegraphics[width=15cm]{fig2.pdf} \caption{The Deep-FSMN model for residual echo suppression.} \label{fig2} \end{figure*} \subsection{Residual Echo Suppression} The Deep-FSMN model for residual echo suppression is illustrated in figure~\ref{fig2}. Logarithm filter bank energies (fbank) of the time aligned far end and wRLS filter output signals are used as input to the neural network. The computation flow is given by: \begin{align} \label{eq:nnres} \nonumber {\bf f}_{in} & = [\text{fbank}(\hat{S}_t), \text{fbank}(X_{t'})] \\ \nonumber {\bf p}^1 & = \text{ReLU}({\bf U^0}{\bf f}_{in} + {\bf v^0}) \\ \nonumber {\bf p}^{j+1} & = \text{FSMN}({\bf p}^{j}), \quad j\in[1,2,...,J-1] \\ {\bf f}_{out} & = \text{Sigmoid}({\bf U}^{J+1}{\bf p}^{J} +{\bf v}^{J+1}) \end{align} where ${\bf U}^j$ and ${\bf v}^j$ are respectively the weight matrix and bias vector in the $j$-th layer. Each FSMN block has one hidden layer, one projection layer and one memory block. The realization is given by: \begin{align} \nonumber {\bf h}^j_t &= \text{ReLU}({\bf U}_1^j{\bf p}^j_t + {\bf v}^j) \\ \nonumber {\bf \bar{p}}_t &= {\bf U}_2^{j} {\bf h}^j_t \\ {\bf p}^{j+1}_t & = {\bf p}^j_t + {\bf \bar{p}}_t + \sum_{i=0}^{N} {\bf m}^j_i\odot {\bf \bar{p}}_{t-i} \end{align} where ${\bf m}^j_i$ is a memory parameter weighting the history information ${\bf \bar{p}}_{t-i}$ and $\odot$ denotes element-wise multiplication. $N$ is the look-back order. Skip connections are added between the memory blocks to alleviate the gradient vanishing problem in the training phase. The training target is a modified version of the vanilla Phase Sensitive Mask (PSM) and is clipped to the range of [0,1] \begin{equation} \text{PSM} = \frac{|S_{t,f} |}{|\hat{S}_{t,f}|}\cdot \text{Re}(\frac{S_{t,f}}{\hat{S}_{t,f}}). \end{equation} Though complex masks as applied in the recent DNS-Challenge~\cite{reddy2020interspeech} have potentially better performance, no significant gains are observed in our preliminary experiments. \section{Relation to Prior work} \label{sec4} Addressing AEC from the source separation perspective has been investigated in~\cite{nesta2010batch,takeda2012efficient}, and ICA based solutions are discussed therein. Here, an Aux-ICA based solution is derived and results in a novel weighted RLS filter. Exploiting deep neural networks for residual echo suppression is a trending practice in literature. Here we consider the capability of the causal Deep-FSMN architecture jointly with TDC and wRLS filter in a systematic view. \section{Experiments} The AEC-Challenge dataset\footnote{https://aec-challenge.azurewebsites.net/} covers the following scenarios: far end (FE) single talk (ST), with and without echo path change; near end (NE) single talk, no echo path change; double talk (DT), with and without echo path change. Both far and near end speech can be either clean or noisy. The evaluation is based on the P.808 Mean Opinion Score (MOS)~\cite{naderi2020open} on a blind test set. The top 3 results are given in Table~\ref{tab1}. \subsection{Algorithm Details} The wRLS adaptive filter is computed based on 20 ms frames with a hop size of 10 ms, and a 320-point discrete Fourier transform. A filter tap of $L=5$ in Equation~(4) is used, and the filter coefficients are updated as in Equation~(\ref{eq:rls}), with the correlation matrix $\bf R$ and correlation vector $\bf r$ estimated recursively using a smooth parameter of $0.8$ and a source PDF shape parameter of $\beta=0.2$ in Equation~(\ref{eq:pdf}). The TDC part is configured to cover a relative delay of up to 500 ms, which requires a 16384-point discrete Fourier transform. To reduce the computational complexity, the estimation is updated every 250 ms by Equation~(\ref{eq:delay}) and the calculation of $\Phi_{t,f}$ in different frequencies are spread evenly in this period. For the residual echo suppression neural network, the inference process is computed as in Equation~(\ref{eq:nnres}). The output ${\bf f}_{out}$ is point-wise multiplied with $\hat{S}_{t,f}$ for signal reconstruction. There are $J=9$ FSMN blocks each with 256 hidden units, 256 projection units and a look-back order of $N=20$. The input feature is a spliced by one frame in the past and one frame in the future, which leads to a vector dimension of 240, and then mean and variance normalized. There are 1.4M trainable parameters in the model. The average time it takes to infer one frame is 0.61 ms (0.19 ms for TDC, wRLS and 0.42 ms for RES) on a Surface Laptop with Intel Core i5-8350U clocked at 1.9 GHz, based on an internal C++/SSE2 implementation. \begin{table}[t] \begin{center} \caption{MOS across different test scenarios.} \label{tab1} \begin{tabular}{c|c|c|c|c} \hline \begin{tabular}{@{}c@{}}Team \\ Id\end{tabular} & \begin{tabular}{@{}c@{}}ST NE \\ MOS\end{tabular} & \begin{tabular}{@{}c@{}}ST FE Echo \\ DMOS\end{tabular} & \begin{tabular}{@{}c@{}}DT Echo \\ DMOS\end{tabular} & \begin{tabular}{@{}c@{}}DT Other \\ DMOS\end{tabular} \\ \hline 21 & 3.85 & 4.19 & 4.34 & 4.07 \\ \hline Ours & 3.84 & 4.19 & 4.26 & 3.71 \\ \hline 9 & 3.76 & 4.20 & 4.30 & 3.74 \\ \hline Baseline & 3.79 & 3.84 & 3.84 & 3.28 \\ \hline \end{tabular} \end{center} \end{table} \subsection{Training Setup} For training the neural network, the first 500 clips in the official synthetic dataset are used as the validation set and the rest 9,500 utterances are used for training. Besides, the training data is augmented as follows: 1. Randomly remix the echo and near end speech in the official synthetic dataset (19,000 utterances). 2. Select far end single talk utterances in the real dataset and randomly remix with the near end speech (28,998 utterances). 3. Use sweep signals in the real dataset to estimate the echo paths and regenerate double talk data using utterances from the LibriSpeech corpus~\cite{panayotov2015librispeech} with Signal-to-Echo Ratio (SER) uniformly distributed in [-6, 10] dB (25,540 utterances). 4. Regenerate 24,000 random room impulse responses in simulated rooms and selectively add audio effects [clipping, band-limiting, equalization, sigmoid-like transformation] to the echo signal (24,000 utterances). The Deep-FSMN model is optimized using the Adam optimizer with a learning rate of 0.0003, under the mean squared error loss function. The model is first trained for 10 epochs on the 9,500 utterances, and then fine tuned on the augmented training set. The learning rate is decayed by 0.6 if the loss improvement is less than 0.001. The best model is selected based on the ITU-T recommendation P.862 Perceptual Evaluation of Speech Quality (PESQ) scores evaluated on the validation set. \subsection{Analysis} In Table~\ref{tab1}, the baseline is a recurrent neural network that takes concatenated log power spectral features of the microphone signal and far end signal as input, and outputs a spectral suppression mask~\cite{Sridar2020}. It performs reasonably well in the ST NE scenario, but lacks behind the top systems when echo exists. Informal listening indicates that our proposed algorithm sometimes over-suppresses the near end speech in double talk, which may explain the DT Other DMOS gap with the 1st system. In Table~\ref{tab2}, the proposed wRLS filter is compared with the linear filter in WebRTC-AEC3~\cite{webrtc} in terms of PESQ and Short-Time Objective Intelligibility (STOI)~\cite{falk2010non} on 500 clips of the validation set, and in terms of Echo Return Loss Enhancement (ERLE) on the ST FE in the test set. ERLE is defined as: \begin{equation} \text{ERLE} = 10\log_{10}\frac{E[s^2(t)]}{E[\hat{s}^2(t)]} \end{equation} \begin{table}[htb] \begin{center} \caption{PESQ and STOI are evaluated on the synthetic validation set. ERLE is evaluated on the ST FE in the test set.} \label{tab2} \begin{tabular}{c|c|c||c} \hline & PESQ & STOI & ERLE (dB) \\ \hline Orig & 1.24 & 0.79 & - \\ \hline WebRTC-AEC3 & 1.28 & 0.82 & 6.29 \\ \hline wRLS, $\beta=0$ & 1.41 & 0.85 & 5.58 \\ \hline wRLS, $\beta=0.2$ & 1.43 & 0.85 & 6.56 \\ \hline wRLS, $\beta=0.4$ & 1.40 & 0.85 & 5.99 \\ \hline wRLS, $\beta=1.0$ & 1.38 & 0.84 & 6.41\\ \hline \begin{tabular}{@{}c@{}}wRLS, $\beta=0.2$ \\ +Deep-FSMN\end{tabular} & 2.07 & 0.91 & 49.39 \\ \hline \end{tabular} \end{center} \end{table} The performance of the wRLS filter varies with different source PDF shape parameters. A value of $\beta=0.2$ is finally chosen, which outperforms AEC3 by 0.15 in PESQ, 0.03 in STOI and 0.27 dB in ERLE. The Deep-FSMN model greatly boost the overall performance, achieving a PESQ score of 2.07 and nearly complete echo reduction when echo exists. \section{Conclusion} This paper presents our submission to the AEC-Challenge. The algorithm achieves satisfactory subjective scores on real recordings by systematically combing time delay compensation, a novel wRLS linear filter and a Deep-FSMN model for residual echo suppression. The wRLS filter is derived from the semi-blind source separation reformulation of the acoustic echo cancellation problem and simplification of the Aux-ICA solution. One end-to-end neural network model that takes the raw near end mic signal and far end signal as input and outputs the near end speech is more appealing, which will be future direction of this work. \vfill\pagebreak \bibliographystyle{IEEEbib}
\section{Introduction} In detail studies of the phenomenological aspects of jet quenching in RHIC and LHC have provided a better understanding of the dynamical processes involved in parton energy loss in recent years \cite{Baier:1994bd,Baier:1996sk,Zakharov:1996fv,Salgado:2003gb,Spousta:2015fca,Mehtar-Tani:2019ygg}. In fact, understanding the universal scaling features of radiative energy loss enables us to study the medium properties and scattering processes occurring at the partonic level. It has been well established that there is a scaling of the gluon spectra with average transport coefficient in an expanding medium as highlighted in \cite{Salgado:2003gb}. Furthermore, the single gluon brehmsstrahlung has been studied in detail for the case of time- dependent plasmas \cite{Arnold:2009mr}. On the other hand, medium modified gluon spectra have been solved analytically as well as numerically for the case of static plasmas \cite{Mehtar-Tani:2019ygg,Mehtar-Tani:2018zba}. Motivated with these results, we investigate the scaling properties for the re- summed gluon spectra in the expanding media through the kinetic rate equation. In this paper, we calculate the splitting rates for the formation of gluons inside expanding media from the single gluon emission spectrum. Next, we study the medium evolved spectra from the kinetic rate equation inside the medium \cite{Mehtar-Tani:2014yea,Blaizot:2013vha,Blaizot:2013hx} . In order to study the multiple scattering processes within the media, we use the "harmonic oscillator" approximation \cite{Baier:1994bd}. We aim to quantify the scaling features with respect to different expansion profiles by evaluating the medium induced gluon spectra. Finally, we study the impact of the scaling features on the suppression factor of the jets for the case of expanding media. In this work, we report the differences in the scaling of the suppression from the average and optimal values of the quenching parameter for the expanding profiles. In a contemporary work \cite{Adhya:2019qse}, we have found that there is no universal way of scaling for the spectra over the full kinematical regime for the expanding profiles. The paper is organized as follows. In the next section, we highlight the important steps for the calculation of the gluon splitting rates from the single gluon emission spectra. Next, we numerically solve the kinetic rate equation using the gluon splitting rates derived from the spectra for different media as input kernels. Next, we present the quenching factor $Q_{AA}$ for different types of the media and discuss characteristic features seen in the spectra. Finally, we derive a scaling in the quenching parameter and emphasize the impact of the medium evolution on the quenching factor. \section{Formalism} First, let us briefly review the BDMPS-Z formalism for the medium induced gluon radiation from a static medium. This serves as a starting point for the discussion of the formalism which we will extend to the case of medium induced gluon radiation for expanding media. \subsection{In medium gluon spectra} The transport coefficient for the static medium is constant in time; $\hat q(t) = \hat q_0 $. In the multiple soft scattering approximation, the single gluon emission spectrum is given by \cite{Baier:1998yf,Salgado:2002cd, Arnold:2008iy}, \begin{eqnarray} \frac{{\mathrm d} I}{{\mathrm d} z}^{static} = \frac{\alpha_s}{\pi} P(z)\, \mathrm{Re} \ln \cos \Omega_0 L \,, \\ \end{eqnarray} where \begin{eqnarray} \label{eq:omega-static} \Omega_0 L = \sqrt{\frac{-i}{2}\frac{\hat q_0}{p}}\kappa(z) L = \frac{1-i}{2} \kappa(z) \tau \,, \end{eqnarray} and $\kappa(z) = \sqrt{[1-z(1-z)]\big/[z (1-z)]}$. $L$ is the length of the medium at which the parton emerges into the vacuum. In terms of the evolution variable $\tau \equiv L \sqrt{\hat{q_0}/p}$, the splitting rate is given by \cite{Adhya:2019qse}, \begin{eqnarray} \mathcal{K}(z,\tau)^{static}=\frac{dI}{dzd\tau} = \frac{\alpha_s}{2\pi} P(z) \kappa(z)\, \mathrm{Re} \left[(i-1) \tan \big((1-i)\kappa(z) \tau/2 \big) \right]\,. \label{staticfullrate} \end{eqnarray} We have only included the gluon splitting with the relevant Altarelli- Parisi splitting function. Next, let us model the rapidly expanding medium as an exponentially evolving medium. In this case, we can write the dynamically evolving transport coefficient as, \begin{eqnarray} \hat q(t) = \hat q_0 {\rm e}^{-t/L} \end{eqnarray} Using the above definition, the spectrum is given by \cite{Arnold:2008iy}, \begin{eqnarray} \frac{{\mathrm d} I}{{\mathrm d} z} ^{expo}= \frac{\alpha_s}{\pi} P(z)\, \mathrm{Re} \ln J_0( 2\Omega_0 L ) \,, \end{eqnarray} where $\Omega_0$ is defined in Eq.[\ref{eq:omega-static}]. Using the single gluon spectra, we arrive at the expression for the splitting rate in the exponential medium as \cite{Adhya:2019qse}, \begin{eqnarray} \mathcal{K}(z,\tau)^{expo} = \frac{\alpha_s}{\pi} P(z) \kappa(z) \,\mathrm{Re} \left[ (i-1) \frac{J_1\big((1-i)\kappa(z) \tau \big)}{J_0\big((1-i)\kappa(z) \tau \big)} \right] \label{exporate} \end{eqnarray} Finally, we consider an uniformly expanding homogeneous quark gluon plasma formed in central nucleus nucleus collisions at time $t=0$. At the formation time, characterised by $t_0$, the highly energetic parton radiates after leaving a hard collision occurring inside the medium at its highest density \cite{Arnold:2008iy,Salgado:2002cd}. Due to longitudinal expansion, the plasma cools down gradually following a Bjorken expansion power law \cite{Bjorken:1982qr}. This expansion enables to write the time dependent transport coefficient as, \begin{eqnarray} \hat q(t) = \hat q_0 (t_0/t)^\alpha \end{eqnarray} for $t_0 <t < t_0 +L$. The power $\alpha$, for an ideal fluid, is chosen to be unity to model a simplistic hydro-dynamically expanding medium assuming no additional transverse expansion. On the other hand, setting $\alpha = 0$ gives us back the static case result characterized by a constant quenching. Using the above expansion profile for the medium, the gluon emission spectrum is given by \cite{Arnold:2008iy}, \begin{eqnarray} \frac{{\mathrm d} I}{{\mathrm d} z}^{BJ}&=& \frac{2\alpha_s}{\pi} P(z)\mathrm{Re} \ln\left[ \left(\frac{t_0}{L+t_0} \right)^{1/2} \frac{J_{\nu}(z_0)Y_{\nu-1}(z_L)-Y_{\nu}(z_0) J_{\nu-1}(z_L)}{J_\nu(z_L)Y_{\nu-1}(z_L) - Y_{\nu}(z_L) J_{\nu - 1}(z_L)} \right]\nonumber \end{eqnarray} with $\nu \equiv 1/(2-\alpha)$ and \begin{eqnarray} z_0 &\equiv 2\nu \,\frac{1-i}{2} \kappa(z)\sqrt{\frac{\hat q_0}{p}} t_0 = \nu\, (1-i) \kappa(z) \tau_0 \,, \\ z_L &\equiv 2\nu\, \frac{1-i}{2} \kappa(z)\sqrt{\frac{\hat q_0}{p}} \sqrt{t_0 \,(L+t_0)} = \nu\, (1-i) \kappa(z) \sqrt{\tau_0 (\tau + \tau_0)} \,, \end{eqnarray} where $\tau_0 = \sqrt{\hat q_0/p} t_0$. For the concrete case of $\alpha = 1$ (and $\nu = 1$) \cite{Adhya:2019qse}, \begin{eqnarray} \frac{{\mathrm d} I}{{\mathrm d} z}^{BJ} = \frac{2\alpha_s}{\pi} P(z) \mathrm{Re} \ln\left[ \left(\frac{t_0}{L+t_0} \right)^{1/2} \frac{J_1(z_0)Y_0(z_L) - Y_1(z_0) J_0(z_L)}{J_1(z_L)Y_0(z_L) - Y_1(z_L) J_0(z_L)} \right]\, \end{eqnarray} Using the above equation, we derive the gluon splitting rate for the Bjorken expanding medium as, \begin{eqnarray} \mathcal{K}(z,\tau)^{Bjorken} &=& \frac{\alpha_s}{\pi} P(z) \kappa(z)\sqrt{\frac{\tau_0}{\tau + \tau_0}} \mathrm{Re} \nonumber\\ &&\times\left[ (1-i) \frac{J_1(z_L) Y_1(z_0) - J_1(z_0) Y_1(z_L) }{J_1(z_0) Y_0(z_L) - J_0(z_L) Y_1(z_0)} \right] \label{bjorkenrate} \end{eqnarray} Since we have a constant (independent of time) quenching factor for the static medium, we obtain a constant rate for the same. The exponentially expanding medium has a rate that saturates to a constant at a later timescale. It should be noted that at large timescales, the factor containing the Bessel's arguments approaches unity, thereby saturating the rate to a constant value for the exponential profile. However, for the Bjorken expanding medium, although the factor containing the Bessel's arguments approaches unity at large timescales, the prefactor containing $\tau$ decreases the rate substantially at such timescales. The factor $P(z)\kappa(z)$ is a symmetric function in $z$ and remains common to all the profiles. The parton cascade is implemented by the iteration of the single gluon emission spectra inside the kinetic rate equation which is given by, \begin{eqnarray} \label{eq:RateEquation-expanding-2} \frac{\partial D(x, \tau)}{\partial \tau} &= \int {\mathrm d} z \,\mathcal{K}(z,\tau | p) \left[\sqrt{\frac{z}{x}} D\left(\frac{x}{z},\tau \right) - \frac{z}{\sqrt{x}} D(x,\tau) \right] \,, \end{eqnarray} where \begin{eqnarray} \mathcal{K}(z,\tau|p) \equiv \sqrt{\frac{p}{\hat q_0}} \mathcal{K}(z,L|p) = \sqrt{\frac{p}{\hat q_0}} \frac{{\mathrm d} I}{{\mathrm d} z {\mathrm d} L} \,. \end{eqnarray} The initial value of the $D(x,\tau)$ is a $\delta$-function in $x$ with a maximum for $x=1$ which characterizes the initial single color charge propagating trough the medium. \begin{figure}[h] \begin{center} \begin{subfigure}[b]{1.0\textwidth} \includegraphics[width=0.5\textwidth]{plottau0p1a.pdf}\includegraphics[width=0.5\textwidth]{plottau0p1b.pdf} \caption{ } \end{subfigure} \begin{subfigure}[b]{1.0\textwidth} \includegraphics[width=0.5\textwidth]{plottau0p5a.pdf}% \includegraphics[width=0.5\textwidth]{plottau0p5b.pdf} \caption{ } \end{subfigure} \end{center} \caption{The medium induced gluon spectra $D(x,\tau)$ as a function of the momentum fraction $x$ (with high $x$ region zoomed for figures on the right for both the panels) for $\tau = 0.1$ (panel (a)) and $\tau = 0.5$ (panel (b)) respectively. The static media has been plotted for soft approximation (black) and full kernel (blue) compared with the analytic soft static result (dashed black). The expanding cases have been plotted for exponential (red) and Bjorken (green) media respectively. } \label{fig:spectrum-allx} \end{figure} In fig. \ref{fig:spectrum-allx}, we present the results for the medium evolved gluon spectra for the three kinds of media. In addition, we plot the analytic case of the "soft" part of the static spectra \cite{Mehtar-Tani:2013pia} and find that they agree with the numerical "soft" spectra. In this figure, for the evolution of the in- medium gluon cascade over $\tau$ (from 0.1 to 0.5), the $1/\sqrt{x}$ behavior of the spectrum occurs due to depletion of the energy flux at large $x \sim 1$ to small $x$ region of the spectra at different rates for different media. This depletes the original peak around $x \sim 1$ for different profiles at different timescales. In addition, the splitting rate for Bjorken profile is smallest for $x \rightarrow 1$ at any particular $\tau$ leading to slower quenching in comparison to all other profiles. \subsection{Moments of the distribution and the nuclear modification factor} \label{sec:moments} \begin{figure} \centering \includegraphics[width=0.5\textwidth]{raa1_1120_1.pdf}% \includegraphics[width=0.5\textwidth]{raa2_1120_1.pdf} \caption{The comparison of the jet suppression factor of the static media ( with full kernel (blue), soft kernel (black) and analytic soft result (dashed black)) with the expanding media (exponential (orange) and Bjorken (red)). The left and right figures corresponds to medium comparison at $\omega_c=60$~GeV and $\omega_c=100$~GeV respectively compared with the ATLAS data \cite{Aaboud:2018twu}. } \label{fig:raa1} \end{figure} \begin{figure} \centering \includegraphics[width=0.49\textwidth]{raa4_1126_1.pdf} \includegraphics[width=0.49\textwidth]{raa5_1126_1.pdf} \caption{A similar comparison of the different media profiles as that in fig.(\ref{fig:raa1}) at $\omega_c= 100$ $GeV$ with scaled average ($\hat{q}_{0,scaled}$) (left) and optimal ($\hat{q}_{0,optimal}$) (right) scaling in the quenching parameter $\hat{q}$. } \label{fig:raa2} \end{figure} The inclusive jet suppression in medium can be expressed in the form of convolution of the medium evolved gluon spectra $D(x,\tau)$ with the initial gluon spectra as, \begin{eqnarray} \frac{{\mathrm d} \sigma_{AA}}{{\mathrm d} p_{_T}} = \int {\mathrm d} p_{_T}' \int_0^1 \frac{{\mathrm d} x}{x} \,\delta(p_{_T}- x p_{_T}') D\left(x, \tau \equiv L \sqrt{\hat q / p_{_T}'} \right) \frac{{\mathrm d} \sigma_0}{{\mathrm d} p_{_T}'} \,. \end{eqnarray} The jet suppression factor $R(p_{_T}) = {\mathrm d} \sigma_{\rm AA}/{\mathrm d} p_{_T} \Big/ {\mathrm d} \sigma_0/{\mathrm d} p_{_T}$, is given by, \begin{eqnarray} R(p_{_T}) = \int_0^1 {\mathrm d} x \, x^{N-1} D(x, \sqrt{x} \tau) \, \end{eqnarray} where we have assumed a power law approximation of the initial parton spectra given by ${\mathrm d} \sigma_0/{\mathrm d} p_{_T} \propto p_{_T}^{-N}$ with $N=5.6$. In our calculations, we limit to gluons as the only parton species. Therefore, $R$ calculated here can be related to; although not equal to $R_{AA}$ as measured in experiments. In the case of the Bjorken model, the distribution has additionally a dependence on the initial evolution parameter $\tau_0$, $D(x,\tau_0,\tau)$, that is also rescaled by the (unknown) initial $p_{_T}$, hence we obtain \begin{eqnarray} R(p_{_T}) = \int_0^1 {\mathrm d} x \, x^{N-1} D(x,\sqrt{x} \tau_0, \sqrt{x} \tau) \,. \end{eqnarray} Fig.\ref{fig:raa1} shows the resulting $Q_{AA}$ distributions for different types of the expansion for two choices of $\omega_c$; $60$~GeV and $100$~GeV respectively. Here, $\omega_c (=\hat{q}L^2/2)$ is the characteristic gluon frequency for a hard parton traversing the finite medium of length $L$. We observe a large difference for different kinds of media. It was shown in Ref.~\cite{Salgado:2003gb}, that the impact of the difference in the type of the medium expansion on the ${\mathrm d} I/ {\mathrm d} z$ can be scaled out by replacing the $\hat{q}$ parameter by the average, $\langle \hat q \rangle$. Left panel of Fig.\ref{fig:raa2} shows this configuration ($\omega_c \rightarrow \bar{\omega_c} = \omega_c/\langle \hat q \rangle$) with scaling of the expanding quenching factors to the static one defined by $\hat{q}_{0,scaled}$ (average scaling) and determined to be approximately $0.2$, $0.1$, and $4$ $GeV^3$ for the static, exponential, and Bjorken type of the expansion, respectively. We observe that the difference among the different medium profiles arises due to the difference of the dependencies of the single gluon emission emission spectra ${\mathrm d} I/ {\mathrm d} z$ on $\tau$. However, medium evolution of the spectra has considerable effects as a consequence of which the average quenching parameter $\langle \hat q \rangle$ cannot account for the different types of the expansion. Finally, we are able to derive an optimal quenching parameter, $\hat{q}_{0,optimal}$, which minimizes the difference between the data and theoretical estimation. The result of this minimization is shown in the right panel of fig.(\ref{fig:raa2}) with $\hat{q}_{0,optimal}$ being approximately $0.2$, $0.05$, and $8$ $GeV^3$ for static, exponential and Bjorken type of the expansion respectively. This large difference among the quenching parameter implies that the appropriate modeling of the medium expansion is an important component of the effort to understand the jet quenching mechanism. \section{Conclusions} \label{sec:conclusions} In this work, we have studied the effect of the expanding QGP media on the gluon spectra in multiple soft approximation. We have considered models of the static, exponential and Bjorken expanding media. Rates of gluon emission were evaluated from single gluon spectra and medium evolved spectra were calculated by means of numerical solutions of the evolution equation for the gluon radiation. Further, medium evolved gluon spectra are used to calculate the quenching factor of jets. We find that the impact of the medium expansion cannot be scaled out only by the average quenching parameter of $\hat q$. Values of quenching parameter which minimize the difference between the data and theoretical estimates are derived for different types of medium expansion. Large difference between these values implies that use of realistic parameterization (such as inclusion of flavor dependent cascades) of the medium expansion is needed to improve on the precision of modeling of the jet quenching phenomenon. \section*{Acknowledgments} KT is supported by a Starting Grant from Trond Mohn Foundation (BFS2018REK01) and the University of Bergen. CAS is supported by Ministerio de Ciencia e Innovaci\'on of Spain under project FPA2017-83814-P; Unidad de Excelencia Mar\'ia de Maetzu under project MDM-2016-0692; ERC-2018-ADG-835105 YoctoLHC; and Xunta de Galicia (Conseller\'ia de Educaci\'on) and FEDER. SPA and MS are supported by Grant Agency of the Czech Republic under grant 18-12859Y, by the Ministry of Education, Youth and Sports of the Czech Republic under grant LTT~17018, and by Charles University grant UNCE/SCI/013. \section*{References} \bibliographystyle{unsrt}
\section{Introduction} \label{sec:Introduction} Collinear fluorescence and resonance-ionization laser spectroscopy (CLS) are well-established techniques for the measurement of molecular, atomic, and nuclear observables \cite{Otten.1989, Campbell.2016, Neugart.2017, Garcia.2020}. With widely tunable lasers, optical transitions in stable and short-lived isotopes can be accessed in flight at beam energies of typically $10-60$\,keV. The acceleration to this beam energy leads to a strong compression of the velocity width and enables Doppler-broadening-free measurements with a resonance-peak width at the level of the natural linewidth \cite{Kaufman.1976}. Furthermore, the fast beam velocity and in-flight detection make this technique, almost exclusively, the method of choice to access short-lived exotic isotopes. Measurements of hyperfine spectra of these isotopes are of high interest due to the direct link to the nuclear charge radius and electromagnetic moments, leading to investigations of, e.g., the nuclear shell structure \cite{Otten.1989, Campbell.2016}, the nuclear superfluidity \cite{Miller.2019}, the odd-even staggering in charge radii \cite{deGroote.2020}, the halo nuclei \cite{Geithner.2008, Noertershaueser.2009, Krieger.2012}, and the nuclear equation of state \cite{Yang.2018,Brown.2020}. Due to the collinear geometry, the fast atoms experience a Doppler-shifted laser frequency. Hence, it is of critical importance to accurately determine the kinetic beam energy to correctly transform the observed resonance spectra into the rest frame of the atomic beam, where the nuclear information can be extracted from the isotope shifts and from the hyperfine splitting. Even though the impact of systematic uncertainties largely cancels in these relative measurements, the beam-energy uncertainty remains a dominant contribution. Under typical conditions, it is of the same order of magnitude as the statistical uncertainty that is limited by low production rates of radioactive isotopes (a few 10’s ion/s for the rarest isotopes that were investigated with CLS so far \cite{Miller.2019, deGroote.2020}). The beam energy is usually determined by a direct measurement of the acceleration potential or indirectly by measuring an isotope shift that is well known from literature, allowing for a correction of the beam energy in the analysis. Both approaches, however, are intrinsically limited in achievable accuracy. Alternatively, beam-energy-independent CLS measurements can be realized by performing spectroscopy in collinear and anticollinear geometry. This has been successfully demonstrated at on-line facilities \cite{Geithner.2000, Krieger.2011, Novotny.2009} but is not generally applied for rare isotope beams due to the twice as long measurement time. In a CLS measurement, a high voltage is applied to an ion source. This potential defines the beam energy and can be directly measured using a voltage divider. The obtained accuracy depends on uncertainties of the divider ratio (typically $10^{-4}$ relative accuracy), contact voltages, potential gradients and field penetrations in the ion source, leading to an uncertainty of approximately $\pm\, 3-5$ eV. The achievable accuracy of the beam-energy determination based on an isotope-shift measurement is also limited since its sensitivity is relatively low. The beam-energy dependence is chiefly caused by the relative mass difference between the isotopes. Furthermore, it depends on the transition frequency and the beam energy itself and typically achieves values between $0.1-0.5$\,MHz/eV, e.g., 0.25\,MHz/eV for $^{58,60}$Ni in the case of the $3d^9 4s\;^3\mathrm{D}_3 \rightarrow 3d^9 4p\;^3\mathrm{P}_2$ transition at 353\,nm and a beam energy of 30\,keV. Contrarily, the rest-fame transition frequency is approximately two orders of magnitude more sensitive to an energy change (15\,MHz/eV for $^{58}$Ni) than the isotope shift, and hence, is the preferable reference for the energy determination. For this reason, CLS-based high-voltage-metrology measurements have been proposed \cite{Poulsen.1982} to accurately measure the acceleration potential, and were realized with a relative accuracy of up to a few ppm for well-known transitions \cite{Poulsen.1988, Goette.2004, Kraemer.2018}. In general, however, rest-frame transition frequencies are known to a few 100\,MHz in comparison to a required uncertainty of a few MHz for the determination of the beam energy at the 1-eV level, which makes this approach practically inapplicable. In this paper we introduce an all-optical approach to determine the kinetic beam energy, which combines the advantages of the collinear-anticollinear approach and the high sensitivity of the rest-frame transition frequency on the beam energy. It does not require special equipment like a frequency comb or a precision high-voltage divider, precise literature values nor a longer measurement time. Proof-of-principle experiments were preformed on a 30-keV Ni beam reaching $10^{-5}$ relative accuracy, which corresponds to an improvement of at least one order of magnitude compared to the conventional approaches based on a high-voltage divider or an isotope-shift measurement. In particular, collinear fluorescence and resonance-ionization spectroscopy experiments at on-line facilities can strongly benefit from the presented method. Due to the low production rates of exotic isotopes, beam-energy independent measurements via collinear and anticollinear spectroscopy directly on these isotopes are generally not feasible due to the limited measurement time, in contrast to off-line facilities where tremendous accuracy has been demonstrated with that technique \cite{Imgram.2019, Mueller.2020}. The procedure described here, however, can be realized with an off-line beam in preparation of the on-line experiment and then allows for \textit{in situ} beam-energy measurements during the on-line runs. Since the beam-energy uncertainty is the dominant contribution as descriptively illustrated in \cite{Heylen.2021, Lochmann.2014}, this approach can lift on-line CLS measurements on a new level of accuracy. \section{Setup} \label{sec:Setup} A detailed description of the BEam COoling and LAser spectroscopy (BECOLA) facility at the National Superconducting Cyclotron Laboratory (NSCL) at Michigan State University can be found in \cite{Minamisono.2013, Rossi.2014}. The parts that are essential for the proposed approach are briefly presented in this section and visualized in the schematic overview shown in Fig.\,\ref{fig:setup}. Ion beams at an energy of 30\,keV are available from either the Coupled Cyclotron Facility at NSCL (radioactive isotope beams) or from an off-line Penning-ionization-gauge (PIG) ion source \cite{Ryder.2015} at BECOLA, which is a discharge plasma sputtering source and produces stable isotope beams of predominantly singly-charged ions. The ion beams are first transported to the helium-buffer-gas-filled radio-frequency quadrupole ion trap (RFQ) \cite{Barquest.2017}, where the beams are cooled and can be accumulated and extracted as a compressed ion bunch. The bunched beam is required to perform time-resolved resonant fluorescence measurements to suppress the constant laser-induced background \cite{Nieminen.2002, Campbell.2002}. The laser beam is introduced in the 30$^\circ$ bender and overlaps with the ion/atom beam over the following 5-m long straight section. The beamline includes several ion optics to ensure a good alignment between laser light and ion beam, which can be checked by placing two 3-mm-diameter apertures into the beamline at a distance of 2.1\,m. Between the apertures a Na-loaded charge-exchange cell (CEC) \cite{Klose.2012} and three mirror-system-based fluorescence-detection units (FDU) \cite{Minamisono.2013, Maass.2020} are installed. The CEC was heated to 410\,$^\circ$C to create a Na vapor leading to a 50\,\% neutralization efficiency of the incoming singly-charged ion beam through electron donation from the Na vapor. The FDUs collect a large fraction of the fluorescence light and guide it to photo-multiplier tubes that count single photon events with a time resolution of up to 16\,ns \cite{Rossi.2014}. The CEC is floated from the ground potential and a scanning potential is applied to perform Doppler tuning. Instead of scanning the laser frequency across the resonance, the beam velocity is adjusted by applying a small voltage $U_\mathrm{scan}$ with a full scanning width of $40$\,V that alters the beam energy ($E_\mathrm{kin} = E_\mathrm{kin,0}+eU_\mathrm{scan}$) and leads to different Doppler shifts. When the Doppler-shifted transition frequency matches the laser frequency, the atoms are resonantly excited and emit photons, which are collected by the FDUs and counted with attached photomultiplier tubes. Compared to scanning the laser frequency, Doppler-tuning enables a faster and more precise scanning procedure, chiefly because a higher stability of the laser system is achieved when operating it at a fixed frequency. For the presented measurements, a Ni$^+$ ion beam was generated in the PIG source from natural nickel and injected into the RFQ. The Ni$^+$ beam was extracted from the RFQ at an approximate energy of 29.85\,keV in two modes. One was the bunch mode as described above, and the other was a direct current (DC) mode just passing through the RFQ without trapping and bunching. Since Ni$^+$ ions are not accessible by laser spectroscopy due to the lack of transitions in the optical regime, the ions were neutralized by collisions with sodium vapor inside the CEC. Through this non-resonant process, various electronic states are populated including the metastable $3d^9 4s\;^3\mathrm{D}_3$ state \cite{Ryder.2015}, from which the atoms were excited to the $3d^9 4p\;^3\mathrm{P}_2$ state with laser light at 353\,nm. \begin{figure} \centering \includegraphics[width=0.4800\textwidth]{BECOLA.eps} \caption{Schematic of the BECOLA beamline. The ion beam is produced in a Penning-ionization-gauge (PIG) source. In the radio-frequency-quadrupole trap (RFQ) the beam is cooled and can be extracted continuously or as bunches. Laser and ion beams are superimposed and aligned through two 3-mm apertures in 2.1\,m distance. Fluorescence light is collected by three mirror-based detection units. Further ion optics for beam deflection and collimation are not shown. } \label{fig:setup} \end{figure} The laser light was transported via two fibers to both ends of the beamline so that the ion beam could be irradiated in collinear and anticollinear geometry. A laser power of 300\,$\upmu$W was used and the laser light had a diameter of 1\,mm at the FDUs. The primary laser was a continuous-wave Ti-Sapphire laser (Matisse TS, Sirah Lasertechnik) operated at 705\,nm and pumped by a frequency-doubled Nd-YAG laser (Millennia eV, Spectra Physics). The Ti-Sapphire laser's short-term stabilization was realized by the side-of-fringe locking to a reference cavity. For long-term stabilization, the cavity length was regulated to a wavelength-meter reading (WSU30, HighFinesse), which has a specified $3\sigma$ accuracy of 30\,MHz and was calibrated every minute to a frequency-stabilized helium-neon laser (SL 03, SIOS Meßtechnik). The 705-nm light was sent to a cavity-based frequency doubler (Wavetrain, Spectra Physics) creating the 353-nm light that was coupled into the optical fibers and transported to the CLS beamline. \section{Method} In collinear (c) or anticollinear (a) laser spectroscopy measurements the resonant laser frequencies $\nu_\mathrm{c/a}$ are correlated with the beam energy $E_\mathrm{kin}$ due to the Doppler effect \begin{equation} \label{eq:DopplerFormula} \nu_\mathrm{c/a} = \nu_0 \gamma (1 \pm \beta) \approx \nu_0 \left(1 \pm \sqrt{2E_\mathrm{kin}/mc^2}\right) \end{equation} where $\nu_0$ is the rest-frame transition frequency, $\beta$ is the beam velocity relative to the speed of light $c$, $\gamma=1/\sqrt{1-\beta^2}$ is the time dilation factor, and $m$ the mass of the atom. This correlation becomes more intuitive in the non-relativistic approximation. The sensitivity of the transition frequency on the beam energy is \begin{equation} \label{eq:diffDoppler} \begin{split} \frac{\partial \nu_\mathrm{c/a}}{\partial E_\mathrm{kin}} &= \frac{2 \nu_0}{mc^2} \frac{\nu_\mathrm{c/a}^2} {\nu_\mathrm{c/a}^2-\nu_0^2} \approx \frac{\nu_0}{\sqrt{2eUmc^2}} \\ &\approx 5-30\,\mathrm{MHz/eV} \end{split} \end{equation} with the total acceleration potential $U$ and the electric charge $e$. For typical experimental conditions ($10-60$\,keV, visible optical transition, medium mass atoms), a 1-eV change leads to a Doppler shift of the resonance frequency of approximately $5-30$\,MHz. This is of the order of the natural linewidth and enables a precise determination of the beam energy. Contrarily, in the case of the isotope shift $\delta\nu^{A,A'}=\nu^A-\nu^{A'}$, the sensitivity on the beam energy $\partial\delta\nu^{A,A'}/\partial E_\mathrm{kin}$ is approximately two orders of magnitude smaller than $\partial\nu^{A}/\partial E_\mathrm{kin}$ and mainly originates from the mass difference of both isotopes. Our approach to determine the beam energy is to make use of the rest-frame transition frequency $\nu_0$ that was separately obtained from the collinear and anticollinear laser frequencies at resonance $\nu_\mathrm{c}$ and $\nu_\mathrm{a}$, respectively. The multiplication of $\nu_\mathrm{c}$ and $\nu_\mathrm{a}$ from Eq.\ref{eq:DopplerFormula} yields the velocity- or beam-energy-independent rest-frame transition frequency \begin{equation} \nu_\textnormal{c} \cdot \nu_\textnormal{a} = \nu_0^2 \gamma^2 (1+\beta) (1-\beta) = \nu_0^2 ~. \label{Eq:ColAcol} \end{equation} Once the rest-frame transition frequency is determined, it can be used to extract the beam energy in combination with any collinear or anticollinear measurement performed at later times \begin{equation} \label{eq:Ekin} E_\mathrm{kin} = \frac{mc^2}{2} \frac{(\nu_0-\nu_\mathrm{c/a})^2}{\nu_0 \nu_\mathrm{c/a}} ~. \end{equation} For example, in a typical one week long experiment on exotic isotopes, reference spectra from a stable isotope are frequently measured to determine the isotope shift. The resonance frequency of the stable isotope can then be combined with the pre-determined rest-frame transition frequency to deduce and track the drift of the beam energy. In the present measurement, Doppler tuning was applied and the beam velocity was varied to scan across the resonance with fixed laser frequencies separately for collinear and anticollinear measurements. A small scanning potential (40\,V) was applied to the CEC to vary the otherwise constant beam energy of approximately 29.85\,keV. The scanning voltage was measured using a precision voltage divider with a relative accuracy of $6\cdot 10^{-5}$, which is negligible compared to the total beam-energy uncertainty. Although the collinear and anticollinear laser frequencies were chosen to be in resonance at the same scanning beam energy, a small energy difference remained. To compensate this energy difference, Eq.\,\ref{eq:Ekin} is modified, correcting one of the resonance frequencies to account for the differential Doppler shift derived in Eq.\,\ref{Eq:ColAcol}. The corrected rest-frame transition frequency is now given by \begin{equation} \nu_0 = \sqrt{ \left( \nu_\textnormal{c} - \frac{\partial \nu_\textnormal{c}}{\partial E_\mathrm{kin}} \cdot e \cdot \Delta U_\textnormal{scan} \right) \cdot \nu_\textnormal{a} } \label{Eq:ColAcol2} \end{equation} where $\Delta U_\mathrm{scan}$ is the difference of the scanning energies at resonance, which is typically less than 5\,eV. In the analysis, $\nu_0$ was determined iteratively starting with inserting the literature value \cite{Litzen.1993} in Eq.\,\ref{eq:diffDoppler}. If no precise literature value is available, the beam energy estimated from the set voltage can be chosen as initial guess. Sufficient convergence was already achieved by applying Eq.\,\ref{Eq:ColAcol2} to deduce a first value for $\nu_0$, inserting it in Eq.\,\ref{eq:diffDoppler} and extracting the final $\nu_0$ from Eq.\,\ref{Eq:ColAcol2}. \begin{figure*} \centering \includegraphics[width=0.9800\textwidth]{ColAcol_combined.eps} \caption{Typical resonance spectra of $^{60}$Ni measured in bunched mode (a) or DC mode (b). The abscissa is relative to the deduced rest-frame transition frequency of 850\,344\,183.2\,MHz. In the bunched mode the background rate is strongly suppressed but also signal strength is reduced compared to the DC mode since the ion beam current is limited by the capacity of the RFQ ion trap. Spectra taken in collinear or anticollinear geometry yielded a similar quality.\newline (c) Combining a collinear and an anticollinear measurement, the rest-frame frequency was determined. The inner error bars correspond to the fit uncertainty while the outer error bars include possible voltage drifts between the measurements, which were also considered as statistical contribution. } \label{fig:spectra} \end{figure*} \section{Rest-frame transition frequency determination} \label{sec:ColAcolUnc} The rest-frame frequencies $\nu_0$ of the $3d^9 4s\;^3\mathrm{D}_3 \rightarrow 3d^9 4p\;^3\mathrm{P}_2$ transitions in the stable $^{58}$Ni and $^{60}$Ni were determined from four collinear and anticollinear CLS measurements of each isotope. Thereof, two DC mode and two bunch mode measurements were performed. In Fig.\,\ref{fig:spectra} (a) and (b) typical spectra are depicted. Each measurement of $\nu_0$ agreed within their statistical uncertainty as shown in Fig.\,\ref{fig:spectra} (c) for $^{60}$Ni. The averaged values are summarized in Tab.\,\ref{tab:RestFrameFreq} and are in excellent agreement with measurements from hollow cathode discharges \cite{Litzen.1993}. The largest contribution to the present 20-MHz uncertainty originates from the frequency measurement with the wavelength meter, which will mainly cancel for the beam-energy determination. Hence, also smaller contributions are discussed in detail. The statistically-acting uncertainties given in the first parentheses in Tab.\,\ref{tab:RestFrameFreq} consist of: \begin{itemize} \item \textit{Fit uncertainty:} $\leq 0.6 / \sqrt{2}$\,MHz: For each measurement, the photon counts of all three FDU were summed before fitting. By combining corresponding collinear and anticollinear measurements, the rest-frame frequency was extracted. The total fit uncertainty is calculated through Gaussian error propagation. \item \textit{Voltage drifts:} 2.2\,MHz: The relative drift between the collinear and the anticollinear measurement ($\leq 1$\,h to adjust laser and frequency doubler) of the 30-kV acceleration voltage was monitored with a high-voltage divider to be below 0.3\,V. By performing the measurements in alternating order (collinear-anticollinear-anticollinear-collinear), the impact of linear drifts of the acceleration voltage (mainly temperature drifts) could be compensated and thus the uncertainty due to residual voltage fluctuations was treated statistically. \end{itemize} Both contributions were added in quadrature for each of the four measurements before taking the weighted mean and applying Gaussian error propagation to calculate the statistical uncertainty. This uncertainty matches well with the standard deviation of the mean, which validates the applied procedure. The considered systematic uncertainties were: \begin{itemize} \item \textit{Frequency measurement:} 20\,MHz / 1.4\,MHz: The WSU30 wavelength meter used in the present study has a 1$\sigma$ uncertainty of 10\,MHz, resulting in 20\,MHz after frequency doubling. In \cite{Verlinde.2020, Koenig.2020} this uncertainty has been investigated in more detail and it was found that it can be separated into two parts. The specified uncertainty is caused by a frequency offset that is constant over time for measurements at the same wavelength if regularly calibrated with the same reference laser. On top of this offset only relatively small variations have been observed. A 3-MHz amplitude of these local variations is quoted for a similar wavelength meter in \cite{Koenig.2020}, which is interpreted as a 1$\sigma$ uncertainty of 1\,MHz. A constant offset $\delta \nu$ in a collinear-anticollinear frequency measurement leads to an identical shift of the rest-frame transition frequency \begin{equation} \label{eq:colAcol-FreqOffset} \begin{split} (\nu_\mathrm{c}+ \delta \nu) (\nu_\mathrm{a}+ \delta \nu) &= \nu_\mathrm{c}\nu_\mathrm{a} + \delta \nu (\nu_\mathrm{c}+\nu_\mathrm{a})+ \delta \nu^2 \\ &\approx (\nu_0 + \delta \nu)^2 \end{split} \end{equation} with an approximation of $\nu_\mathrm{c}+\nu_\mathrm{a}\approx 2 \nu_0$. In the later discussion of the beam-energy determination the offset contribution cancels, transferring the frequency-measurement uncertainty to be caused by the local variations of the wavelength meter. They affect collinear and anticollinear measurements independently and hence, the uncertainty was determined by Gaussian error propagation \begin{equation} \Delta \nu_\mathrm{0,var}= \frac{1}{\sqrt{2}} \Delta \nu_\mathrm{WM- var} \cdot 2 = 1.4\,\mathrm{MHz}~. \end{equation} To account for the frequency doubling, it was multiplied by a factor of two. \begin{table} \centering \caption{Rest-frame transition frequencies of the $3d^9 4s\;^3\mathrm{D}_3 \rightarrow 3d^9 4p\;^3\mathrm{P}_2$ transition in the naturally most abundant neutral nickel isotopes $^{58,60}$Ni. The transition has been measured before from hollow cathode discharges but only the average over all stable isotopes is given \cite{Litzen.1993}. Isotope-separated values have been calculated according to the natural abundance and the isotope shift from \cite{Steudel.1980}, which agree closely with our results when interpreting the uncertainty in \cite{Litzen.1993} of a few mK to be about 100\,MHz. Our statistical uncertainty is given in the first parentheses while the systematic uncertainty is listed in the second parentheses.} \begin{tabularx}{0.41\textwidth}{c c c} \addlinespace[.6em] \hline \addlinespace[.2em] \multicolumn{1}{c}{Isotope} & \multicolumn{1}{c}{This work} & \multicolumn{1}{c}{Literature \cite{Litzen.1993}} \\ \multicolumn{1}{c}{} & \multicolumn{1}{c}{MHz} & \multicolumn{1}{c}{MHz} \\ \addlinespace[.2em] \hline \addlinespace[.2em] $^{58}$Ni & 850\,343\,677.6\,(1.2)\,(20.0)~~ & 850\,343\,600\,(100) \\ $^{60}$Ni & 850\,344\,183.2\,(1.1)\,(20.0)~~ & 850\,344\,110\,(100) \\ \addlinespace[.2em] \hline \end{tabularx} \label{tab:RestFrameFreq} \end{table} \item \textit{Line shape:} 1\,MHz: The resonance line shape becomes asymmetric since the atoms experience an energy loss in inelastic collisions with sodium atoms in the CEC. Non-matching fit functions can lead to shifts of the extracted resonance centroid frequencies, which however, appear in opposite directions in the collinear and anticollinear measurements and cancel in the extraction of $\nu_0$. Data fitting was done by using a symmetric Voigt function, a Voigt with an additional satellite Voigt, and a Voigt with an exponential function \cite{Stancik.2008}. The observed discrepancies of $\nu_0$ are below 1\,MHz and can still have statistical origin but conservatively the largest deviation between the different fit models was considered. \item \textit{Beam alignment:} 0.8\,MHz: The laser light paths were checked in 5\,m distance at the entrance and exit of the CLS windows. The misalignment between the collinear and anticollinear laser light was estimated to be smaller 1\,mrad. The laser light and ion beam alignment was checked with two 3-mm apertures in 2.1\,m distance leading to a maximal angular deviation of 2\,mrad. Including the angular dependence, Eq.\,\ref{Eq:ColAcol} yields \begin{equation} \nu_0'^2= \nu_\mathrm{a}\nu_\mathrm{c} \gamma^2 \,(1 + \beta \cos\alpha_\mathrm{a})\,(1 - \beta \cos\alpha_\mathrm{c}) \end{equation} with $\alpha_\mathrm{c}$ and $\alpha_\mathrm{a}$ being the angles between atomic beam and collinear or anticollinear laser light, respectively. Calculating the maximum frequency deviation for the available parameter space that is limited by $\alpha_\mathrm{c},\,\alpha_\mathrm{a}<2$\,mrad and $|\alpha_\mathrm{c}-\alpha_\mathrm{a}|<1$\,mrad, the largest deviation is 0.8\,MHz while the mean deviation over the whole parameter space would be 0.25\,MHz. \item \textit{Other:} 0\,MHz: At the current level of precision, further uncertainty contributions are neglected. \newline \textit{Bunch structure:} The rest-frame frequencies obtained from measurements in bunch and DC mode agree well within their fit uncertainties, and hence do not indicate any systematic discrepancy.\newline \textit{Scan voltage:} All measurements were performed at a similar scanning potential and hence, do not have significant contributions due to deflecting or focusing the beam, due to the voltage measurement, nor due to the linear approximation in Eq.\,\ref{Eq:ColAcol2}.\newline \textit{Beam overlap:} If the laser beams differ in position or diameter, they can interact with different parts of the atomic beam. Due to the beam cooling in the RFQ and the resulting homogeneous atomic beam, the estimated impact is negligible. \newlin \textit{Photon recoil:} With each laser-atom interaction, a directed moment is transferred to the atom while the emittance of fluorescence light is undirected. This leads to an acceleration of the atoms if the atomic and the laser beam are parallel and to a deceleration if both beams have opposite direction, which contradicts to the requirement of a constant beam energy of Eq.\,\ref{Eq:ColAcol}. Comparing the ratios of the different detection units for both cases did not show any systematic trend at our current resolution.\newline \textit{Optical population transfer:} The applied transition is not a two-level system and 10\,\% of the excited atoms will decay into a dark state. Hence, multiple interactions in front of the optical detection regions will depopulate the ground state, especially for the resonance condition. We assume that we cover this effect within the line shape contribution. \end{itemize} The total 20-MHz uncertainty of the rest-frame frequency determination is dominated by the uncertainty of the laser-frequency measurement with the wavelength meter. The smaller contributions will become significant for the beam-energy determination, where the frequency-measurement uncertainly can be mostly eliminated. \section{Beam-energy determination} \label{sec:CalibrationUnc} Again, the specified wavelength meter uncertainty is separated into a constant offset and local variations. Including a frequency offset $\delta \nu$, Eq.\,\ref{eq:Ekin} yields \begin{equation} \label{eq:EkinOffsetUnc} \begin{split} E_\mathrm{kin} &= \frac{mc^2}{2} \frac{((\nu_0+\delta \nu)-(\nu_\mathrm{c/a}+\delta \nu))^2}{(\nu_0+\delta \nu) (\nu_\mathrm{c/a}+\delta \nu)} \\ &= \frac{mc^2}{2} \frac{(\nu_0-\nu_\mathrm{c/a})^2}{\nu_0 \nu_\mathrm{c/a}+\delta \nu(\nu_0 + \nu_\mathrm{c/a}) + \delta \nu^2} \end{split} \end{equation} where the contribution from $\delta \nu$ mostly cancels and falls below the $10^{-7}$ level, and hence, is not the dominant factor for the precise determination of the beam energy. The elimination of $\delta \nu$, is based on the use of the same wavelength meter for the determination of $\nu_0$ and the independent measurements of $\nu_\mathrm{a/c}$. If a literature value is to be used, the wavelength-meter-offset contribution does not cancel, leading to significantly larger uncertainties in the energy determination. The uncertainty in the frequency difference $(\nu_0-\nu_\mathrm{c/a})$ in the numerator of Eq.\,\ref{eq:Ekin} becomes now the dominant contribution for the beam-energy determination. Since the uncertainties of $\nu_0$ have been discussed in detail in the previous section, we will now focus on $\nu_\mathrm{c/a}$: \begin{itemize} \item \textit{Fit uncertainty:} $\leq 0.6$\,MHz: Uncertainty given by the fit of the function that is best suited for describing the data. In our case, this was the asymmetric Voigt function that contains an exponential function to describe the slightly asymmetric resonance line shape \item \textit{Line shape:} 1.5\,MHz: Comparing the resonance frequencies obtained with the three fit functions discussed above, deviations $<1.5$\,MHz between asymmetric fit functions and $<5$\,MHz between symmetric and asymmetric fit functions were observed. Since the measured spectra were clearly asymmetric, the deviation between the asymmetric fit functions was considered. \item \textit{Local wavelength-meter variations:} 2\,MHz: As discussed in section\,\ref{sec:ColAcolUnc}, a 1-MHz uncertainty of the wavelength-meter reading was considered. To account for frequency doubling, this value was multiplied by a factor of two. \item \textit{He:Ne drift:} 2\,MHz: Day-to-day drifts of the Helium-Neon laser frequency used for calibrating the wavelength meter may vary. \item \textit{Beam alignment:} 0\,MHz: This method is directly extracting the velocity component along the laser direction. Therefore, no misalignment has to be considered. \end{itemize} As for the uncertainties of $\nu_0$, all contributions discussed in section\,\ref{sec:ColAcolUnc} except the wavelength-meter offset were included. Adding these contributions in quadrature, a total uncertainty of $\Delta (\nu_0-\nu_{c/a}) =4.0$\,MHz was obtained, which corresponds to a kinetic-energy uncertainty of 0.27\,eV and hence, enabled a $9 \cdot 10^{-6}$ measurement of the Ni beam energy at 29.85\,keV. \begin{figure} \centering \includegraphics[width=0.4800\textwidth]{energyCal4.eps} \caption{Kinetic beam energy deduced by three different approaches relative to the set point of the power supply employed for beam acceleration (29850\,V). The uncertainty of the present method is more than one order of magnitude smaller, and hence, the results for measurements based on transitions in $^{58}$Ni and $^{60}$Ni are also shown in higher resolution in the upper part of the figure. The results based on the isotope shift rely on the same experimental data but yield a higher uncertainty due to the lower sensitivity of this approach. Due to an overdue calibration of the high-voltage divider, only the nominal uncertainty of this approach is plotted. } \label{fig:Results} \end{figure} \section{Discussion} In Fig.\,\ref{fig:Results}, our approach is compared to the conventional methods. For demonstration purposes, four $^{58}$Ni and four $^{60}$Ni measurements were performed in alternating order in collinear geometry. As depicted in the upper part of the Fig.\,\ref{fig:Results}, the present approach shows consistent results for both isotopes. The deviation between both isotopes varies between 0.02\,eV and 0.2\,eV, which is caused by statistical uncertainties and chiefly voltage drifts between the measurements. After measurement set (2) was a 1-h time break explaining the larger step. In the lower part of the Fig.\,\ref{fig:Results}, all methods are compared yielding an excellent agreement. However, the uncertainties of the conventional methods are significantly larger than those of the present approach. To demonstrate the isotope-shift-based approach, the isotope shift between $^{58,60}$Ni of the same set of measurements was evaluated and the beam energy was adjusted in the analysis until the isotope shift matched the literature value of $\delta \nu (^{60,58}\mathrm{Ni})=507.8\,(0.9)$\,MHz \cite{Steudel.1980}. The beam energies, for which an agreement between the measured isotope shifts and the literature value was achieved, are plotted in Fig.\,\ref{fig:Results}. Adding the fit uncertainty ($\leq 0.6$\,MHz $\cdot \sqrt{2}$), the contributions related to the local wavelength-meter variations (2\,MHz $\cdot \sqrt{2}$) and the line shape (1\,MHz) in quadrature to the uncertainty of the literature value, yields a combined uncertainty of $\Delta \delta\nu^{AA'}=3.2$\,MHz corresponding to $\Delta E_\mathrm{kin}=13$\,eV due to the much lower sensitivity of the isotope shift on the beam energy. Furthermore, this method critically depends on a stable beam energy between the measurements of both isotopes, which explains the scatter in Fig.\,\ref{fig:Results}. The beam-energy differences observed between both isotopes with the transition-frequency-based approach were in the range of 0.18\,eV, which seems to be minor but this is amplified by $\partial \nu^A / \partial E_\mathrm{kin} \cdot (\partial \delta\nu^{AA'} / \partial E_\mathrm{kin})^{-1}\approx 60$ and causes fluctuations of 11\,eV in the isotope-shift-based approach in the case of $^{58,60}$Ni. Using a high-voltage divider to measure the acceleration potential that defines the beam energy, is limited by the uncertainty of the divider ratio (Ohmlabs HVS-100, originally specified relative accuracy $8\cdot 10^{-5}$) and of the voltmeter (Keysight 34465A, $6\cdot 10^{-5}$). The trapping potential well in the RFQ had a nominal depth of -4\,V and a release potential of -15\,V was applied. Since the field penetration during the extraction of the trapped ions is not exactly known, a 3-V uncertainty was considered. In addition, a 2-V uncertainty was included to regard contact and thermal potentials at the RFQ and the hot CEC, leading to a total uncertainty of 4.7\,V. The calibration of the available high-voltage divider is long outdated and a significant change of the divider ratio has been observed by comparing it to the set voltage. Hence, the absolute voltage values could not be accurately evaluated with this device while relative values were still valid and used to estimate the voltage fluctuation over the measurement period. Therefore, only the size of the uncertainty based on a valid calibration is shown in Fig.\,\ref{fig:Results} and the center value is defined by the set voltage. \section{Conclusion} An approach to determine the kinetic energy of an atom, ion or molecule beam for collinear laser spectroscopy measurements was demonstrated using a 30-keV Ni beam. The rest-frame transition frequencies of $^{58,60}$Ni were determined by collinear and anticollinear laser spectroscopy and used as a reference to deduce the beam energy. This method has several advantages compared to conventional approaches: \begin{itemize} \item \textit{High accuracy} at the $10^{-5}$ level, corresponding to an increase by more than one order of magnitude. \item \textit{No special equipment} like a precision voltage divider or a frequency comb are required. \item \textit{No assumptions} on energy shifts due to field penetrations, or due to contact and thermal potentials. \item \textit{No dependence} on literature values. \item \textit{No additional on-line measurement time} as required for the beam-energy-independent measurements, e.g., in \cite{Geithner.2008, Noertershaueser.2009, Krieger.2012}. \end{itemize} The application of the presented method to determine the kinetic beam energy will significantly improve the accuracy of collinear fluorescence and resonance-ionization-spectroscopy measurements on rare isotope beams by transforming the formerly largest systematic uncertainty into a minor contribution. \section{Acknowledgements} We acknowledge support by the National Science Foundation grant No. PHY-15-65546. \bibliographystyle{aipnum4-1}
\section{Introduction} Estimating species distributions across a landscape is a fundamental problem in ecology. Species distribution models (SDMs) learn the relationship between the species of interest and a set of environmental features (e.g., elevation, land cover) from data collected at points on the landscape \cite{Elith2009,Franklin2010}. The species data may come from historical records~\cite{Elith2006}, professional surveys~\cite{Betts2008}, or volunteers in community science projects \footnote{Also referred to as ``citizen science" projects/data.}~\cite{Fink2010}. The environmental data may be collected \textit{in situ} or linked to the observation points post hoc (e.g., via remote sensing~\cite{Shirley2013}). SDMs are critical tools for both scientific inquiry and natural resource management, as they are employed to investigate how environmental features define species habitat and predict where species can persist successfully~\cite{Araujo2012}. At first glance, species distribution modeling may appear to be a straightforward machine learning (ML) problem, but the complex nature of ecological systems and the noise-prone data acquisition process entail unique challenges that are not addressed in conventional ML frameworks. First, data on species distributions are persistently plagued by \textit{imperfect detection}, in which some individuals of the species are missing from the data because of poor observation conditions, species behavioral traits, and/or limited survey efforts. Second, species respond to their environment in complex ways, so models of this process must handle many input variables and represent nonlinear relationships. Third, models must be as interpretable as possible in order to translate their conclusions to meaningful scientific insights and effective management policies. Finally, SDMs are often built from smaller datasets than some other ML domains, with hundreds rather than thousands or millions of examples. Classic approaches like regression models fail to capture systematic imperfect detection~\cite{Guillera-Arroita2014,Lahoz-monfort2014}. Instead, a family of latent variable models has been developed in statistical ecology to account for error in the observation process~\cite{Royle08,MacKenzie18}. This family originated with \textit{occupancy models}, in which the species \textit{occupancy} (occurrence) at a set of sites is represented with binary latent variables, and the species observations depend on occupancy status as well as a \textit{detection probability}~\cite{mackenzie2002estimating}. In these models, the latent variables are of great scientific interest. Understanding how the environment determines occupancy may not only advance ecological research, but also assist policy decisions---e.g., making conservation policies for threatened species. Various extensions to this latent variable modeling framework have been introduced (e.g., with count-valued latent variables~\cite{royle2004n}), but this paper focuses on the occupancy model as a representative example. These models are often used within a classic statistical paradigm, where the probabilities of occupancy and detection are linked to features with regression functions, and models are selected with criteria like AIC. This framework provides an effective approach to imperfect detection. However, it has limited modeling capacity due to the use of the linear regression model and thus struggles to model complex (i.e., highly nonlinear) relationships in high-dimensional feature spaces. To handle the challenge of complexity in species' environmental responses, many ecologists have turned to machine learning~\cite{Elith2006}. In particular, boosted regression trees (BRT) and random forests (RF) are popular for their flexibility and predictive power~\cite{elith2008working,Cutler2015}; neural networks (NN) are an obvious alternative but have been explored less in this domain. Tree-based methods incorporate mechanisms for interpreting the model, such as feature importance metrics and partial dependence plots. However, these models treat species distribution modeling as a standard supervised classification problem without regard to the effects of imperfect detection; ignoring imperfect detection can cause systematic underestimation of species distributions. Furthermore, the effects of the features cannot be clearly separated into occupancy and detection components. \subsubsection{Contributions.} This work puts forth a statistical ecology-inspired neural network model to address the above challenges. Our specific contributions are as follows. First, we propose a {\it statistical ecology-based neural network model} (\texttt{StatEcoNet}). The framework combines the statistical occupancy modeling approach that captures imperfect detection with neural networks that capture nonlinear relationships between the environment and species. We also introduce an easy-to-implement regularization strategy for selecting relevant features for the occupancy and detection sub-models, instead of requiring the user to specify these assignments. Specifically, we propose to use a group-sparsity regularization in the first layers of the NNs in \texttt{StatEcoNet}, thereby clearly indicating importance of the features to the two sub-models of the occupancy framework. Note that group-sparse predictors are often considered in linear regression and compressive sensing \cite{jenatton2011structured}, but have not been considered in interpretable ecological system neural modeling. We show advantages of \texttt{StatEcoNet} over alternative approaches on simulated data as well as a case study modeling five bird species. \subsubsection{Prior Work.} Two pieces of prior work have attempted to address combinations of these challenges. First, nonlinear models have been incorporated into occupancy models using boosted regression trees (called \texttt{OD-BRT})~\cite{hutchinson2011incorporating}. That approach jointly fits two tree ensembles which are linked through an objective function that corresponds to the occupancy model likelihood. This addresses imperfect detection while automatically representing complex relationships to the features, but our experiments with this method indicate that it is difficult to tune properly and that it does not scale well to large datasets. Other recent work has also found that algorithms for learning BRT models are computationally intensive and can experience numerical instability~\cite{NIPS2017_6907}. Second, recent work incorporates nonlinear models into occupancy models with neural networks instead of BRTs~\cite{joseph2020neural}. However, it combines the features into a single network to model occupancy and detection, which limits interpretability. \section{Problem Statement} Consider a typical SDM setting where we are given binary observations (i.e., species detection or non-detection) made by observers at different sites. More formally, we define the following notation. The $t$th (where $t\in[T]$) observation at site $i$ (where $i\in[M]$) is denoted by $y_{it}$. Note that $y_{it}\in\{0,1\}$, where $y_{it}=1$ means that the target species was observed at site $i$ in the $t$th observation made, and $y_{it}=0$ otherwise. For every observation, survey-specific features (e.g., temperature, time of day of the observation) are recorded and collected in ${\bf w}_{it}\in\mathbb{R}^K$. Every site is characterized by a number of site-specific features (e.g., elevation, forest type), which are collected in ${\bf x}_i\in\mathbb{R}^{J}$. The objective is to determine the occurrence pattern of the species from the observations and the site and survey features. After the relationship is learned, the model can be used to predict species observations for new sites. In many studies, it is also critical to interpret how site features affect the species---i.e., to identify the environmental drivers of its distribution. \subsubsection{Conventional Machine Learning Solution.} From an ML viewpoint, it is tempting to treat the $y_{it}$ as binary labels and concatenate the features to form ${\bf u}_{it}=[{\bf w}_{it}^\top,{\bf x}_i^\top]^\top \in\mathbb{R}^{J+K}$. Then, an {\it empirical risk minimization} (ERM)-type formulation could be employed: \begin{equation}\label{eq:ML} \min_{\bm \theta}~\sum_{i=1}^M\sum_{t=1}^T{\cal L}(y_{it}||f_{\bm \theta}({\bf u}_{it})), \end{equation} where $f_{\bm \theta}(\cdot):\mathbb{R}^{K+J}\rightarrow \mathbb{R}$ is any established model in ML (e.g., logistic regression, neural networks), $\bm \theta$ collects the model parameters (e.g., neural network weights), and ${\cal L}(x||y)$ is a loss function (e.g., least squares, cross entropy). \subsubsection{Challenges.} The ML solutions summarized in \eqref{eq:ML} seem reasonable, but the unique challenges of SDM may hinder performance. First, imperfect detection implies that some reports do not reflect the true status of the species at the site (e.g., when they are silent, hiding, or camouflaged), so these data contain structured noise. The probability of detecting a species varies across sites and surveys and is affected by numerous factors when conducting field surveys. Second, unlike classic applications of ML to `big data,' many ecological datasets are collected under substantial resource constraints. It is common to analyze hundreds of sites, in contrast to millions of images. Hence, exclusively data-driven ML models, e.g., deep neural networks, may not be applicable. To summarize, a completely data-driven complex ML model like deep neural networks may not be a viable solution for SDM. Nonetheless, neural networks offer appealing learning capacity in the presence of complex nonlinear transformations in the data generation process---and their companion algorithms balance modeling complexity, computational efficiency/stability, and generalization performance. These nice properties should be capitalized upon in SDM (e.g., for modeling the complex relations between site features and species distributions as well as the survey features and species detectability) with special attention paid to the ubiquity of missed detections and data scarcity challenges---this is the starting point of our work. \section{Proposed Framework} To address the challenges of applying advanced neural network-based learning techniques in SDM, we propose to integrate neural network-based nonlinear modeling with classic graphical generative models in statistical ecology. In a nutshell, the statistical model captures the effect of imperfect detection. The neural networks overcome model discrepancies that are often over-simplified in classic ecology models. This way, the neural networks are only responsible for handling the most challenging parts in the statistical model, while leaving the `well-understood' part to the classic model based approach. This reduces the complexity of the network and makes the learning process more efficient. \subsection{Preliminaries: The Occupancy Model} The backbone of our proposed \texttt{StatEcoNet} is a widely accepted model in statistical ecology called the occupancy model~\cite{mackenzie2002estimating,MacKenzie18}. The graphical representation of the latent variable model is shown in Fig.~\ref{fig:latent_variable_model}. For each site $i = 1,...,M$, the biological model connects the true species occupancy status, $z_i \in \{0,1\}$ to site features $\mathbf{x}_{i}$ through an occupancy probability $o_i$. The key advance of the occupancy model over the approach of \eqref{eq:ML} is the introduction of the latent variable $z_i$ to capture the \textit{true occupancy status} of the species at site $i$. The acquired data $y_{it}$'s are treated as noisy observations of $z_i$, since they are influenced by imperfect detection. Letting each site contain $t = 1,...,T_i$ replicate surveys, the observation model links survey features $\mathbf{w}_{it}$ to a detection probability $p_{it}$. Note that introducing a detection probability that is associated with each observation is critical for SDM, since it explicitly models systematic under-counting. This model is intuitively and scientifically appealing, since it separates the causes for occupancy and detection; interpreting these effects separately is valuable in many ecological studies. \begin{figure}[ht] \centering \includegraphics[width=.45\linewidth]{images/latent_variable_model.pdf} \caption{Graphical occupancy model. $z_i \in \{0,1\}$ denotes latent species occupancy at site $i$ (of $M$ total) and $y_{it}\in \{0,1\}$ denotes the $t$th observation (of $T_i$ total). $\mathbf{x}_i$ and $\mathbf{w}_{it}$ are site and survey features, respectively.} \label{fig:latent_variable_model} \end{figure} In the generative model, the observed data ${y}_{it}$ are produced by drawing from the occupancy Bernoulli and multiplying the result by the detection probability, i.e., \[ y_{it} \sim {\rm Bernoulli}(z_id_{it}). \] This encodes the assumption that unoccupied sites are always observed to be unoccupied, but that occupied sites might also be observed to be unoccupied. However, while it is clear that each observation $y_{it}$ is affected by both the true occupancy $z_i$ and the detection probability $d_{it}$, it is less clear how the site features ${\bf x}_i$ (resp. survey features ${\bf w}_{it}$) affect $z_i$ (resp. $d_{it}$). In classical applications of occupancy models, linear models map ${\bf x}_i$ and ${\bf w}_{it}$ to occupancy probability $o_i$ and detection probability $d_{it}$, respectively, through a linear logit modeling strategy~\cite{MacKenzie18}; i.e., \begin{align}\label{eq:linear} o_i &= \frac{\exp({\bf x}_i^\top\bm \alpha)}{1+\exp({\bf x}_i^\top\bm \alpha)},\quad d_{it} = \frac{\exp({\bf w}_{it}^\top\bm \beta)}{1+\exp({\bf w}_{it}^\top\bm \beta)}, \end{align} where $\bm \alpha\in\mathbb{R}^K$ and $\bm \beta\in\mathbb{R}^{J}$ are model parameters to be estimated. The true occupancy has probability $o_i$, i.e., \[ z_i \sim {\rm Bernoulli}(o_i). \] This framework makes sense, but the linear models are over-simplified for complex ecological systems. \subsection{Integrating Neural Networks into the Framework} In this work, we propose to use {\it two} neural networks to model the relations between ${\bf x}_{i}$ and $o_i$ as well as ${\bf w}_{it}$ and $d_{it}$ in \eqref{eq:linear}. Our motivation is not to replace the well established graphical model in Fig.~\ref{fig:latent_variable_model} by a completely data-driven neural network (as in \eqref{eq:ML}), but to leverage the power of neural networks to fill the `modeling gap' of the graphical model. For statistical ecologists, this is perhaps the most natural way of integrating neural networks into SDM. Specifically, we introduce two neural networks \[F(\cdot):\mathbb{R}^K\rightarrow \mathbb{R},~ G(\cdot):\mathbb{R}^{J}\rightarrow \mathbb{R}\] as shown in Fig.~\ref{fig:proposed_model}. The first neural network $F(\mathbf{x}_i)$ predicts the occupancy probability from the given site features $\mathbf{x}_i$. The second neural network predicts the detection probability from given survey features $\mathbf{w}_{it}$. \begin{figure}[ht] \centering \includegraphics[width=0.85\linewidth]{images/StatEcoNet2.pdf} \caption{Proposed model (\texttt{StatEcoNet}) framework.} \label{fig:proposed_model} \end{figure} We employ fully connected networks to express $F$ and $G$: \begin{subequations} \begin{align} F({\bf x}_i;{\bm \theta}_F)&={\bf u}_L^\top \bm \sigma({\bf U}_{L-1}\bm \sigma(\cdots \bm \sigma({\bf U}_1{\bf x}_i) )) , \label{eq:F} \\ G({\bf w}_{it};\bm \theta_G)&={\bf v}_L^\top \bm \sigma({\bf V}_{L-1}\bm \sigma(\cdots \bm \sigma({\bf V}_1{\bf w}_{it}) )). \label{eq:G} \end{align} \end{subequations} In \eqref{eq:F}, ${\bf U}_{\ell}\in\mathbb{R}^{K_{\ell}\times K_{\ell-1}}$ is the network weight in the $\ell$th layer where $K_{\ell}$ is the number of neurons of the $\ell$th layer (and we define $K_0=K$). The output layer has a combining vector ${\bf u}_L\in\mathbb{R}^{K_{L-1}}$ that maps the output to a scalar. The weights in \eqref{eq:G} are defined in the same way. We also define $\bm \theta_F$ and $\bm \theta_G$ as the collections of the network parameters of $F$ and $G$, respectively. The function $\bm \sigma(\cdot)$ applies onto every element of its input individually. We employ the popular rectified linear unit (ReLU) function as our activation function. With the neural networks defined, the occupancy and detection probabilities can be re-expressed as follows: \begin{subequations} \begin{align} & ~o_i = \frac{\exp(F({\bf x}_i;\bm \theta_F))}{1+\exp(F({\bf x}_i;\bm \theta_F))} \label{eq:occupancy},\\ & ~d_{it} =\frac{\exp(G({\bf w}_{it};\bm \theta_G))}{1+\exp(G({\bf w}_{it};\bm \theta_G))}. \label{eq:detection} \end{align} \end{subequations} With the above construction and the overall graphical model, we define a maximum likelihood estimation problem whose log-likelihood function can be expressed as: \begin{equation} \begin{aligned} &\log{\cal L}= \sum_{i=1}^M \log{\cal L}_i \\ =&\sum_{i=1}^M \log\left( o_i \prod_{t=1}^{T_i} \left[d_{it}^{y_{it}} (1-d_{it})^{1-y_{it}}\right] + (1-o_i)\kappa_i \right), \end{aligned} \end{equation} where $\kappa_i$ is an indicator function defined as $\mathds{1} \left(\sum_{t=1}^{T_i} y_{it} = 0 \right)$, in which $\mathds{1}(\cdot)$ is 1 if the observations at a site were all zero and 0 otherwise. In the above, we have followed the derivation of \cite{hutchinson2011incorporating} to reach the expression of ${\cal L}_i$ from ${\cal L}_i =\sum_{z\in\{0,1\}} {\sf Pr}(z_i = z)\prod_{t=1}^{T_i}{\sf Pr}(y_{it} \vert z_i =z) =\sum_{z\in\{0,1\}} o_i^z(1-o_i)^{1-z}\prod_{t=1}^{T_i} (zd_{it})^{y_{it}}(1-zd_{it})^{1-y_{it}}$. \subsection{Feature Selection via the $\ell_{2,1}$-Norm} On top of this structure, we incorporate regularization terms into our model in order to identify features that significantly impact each of the model probabilities. There has been little work on incorporating the feature selection process into neural network models. Instead, most prior work selects relevant features as a preprocessing before learning the neural network model~\cite{cheng2020spatio}. Here, we add the $\ell_{2,1}$-norm into our \texttt{StatEcoNet} to reveal which features impact the occupancy and detection probabilities. The mixed $\ell_{2,1}$-norm (also denoted as $\ell_2/\ell_1$-norm) is a matrix norm used for robust optimization problems that promotes sparsity of the matrix columns. It thus has widely been used in signal and image processing to handle noise and outliers~\cite{steffens2018compact}. Accordingly, the $\ell_{2,1}$-norm has been considered an approach for feature selection~\cite{jenatton2011structured}. The $\ell_{2,1}$-norm of ${\bf U}_{\ell}\in\mathbb{R}^{K_{\ell}\times K_{\ell-1}}$ is defined as \begin{align} \Vert {\bf U}_{\ell} \Vert_{2,1} &= \sum_{j=1}^{K_{\ell-1}} ( \sum_{i=1}^{K_{\ell}} \vert u_{ij} \vert^{2})^{1/2} = \sum_{j=1}^{K_{\ell-1}} \Vert {\bf U}_{\ell}(:,j) \Vert_2. \end{align} The $\ell_{2,1}$-norm behaves like an $\ell_{1}$-norm on a vector for providing a sparse solution to the columns of a matrix. That is, the parameter matrix is regularized with the $\ell_{2,1}$-norm minimization in order to discover important features. We introduce this mixed $\ell_{2,1}$-norm into the first input layer of both neural networks, where the parameter matrix is connected to the input features as shown in Fig.~\ref{fig:proposed_model}. Our regularized loss function is given by \begin{align} -\sum_{i=1}^{M} \log{\cal L}_i + \lambda_F \Vert {\bf U}_1 \Vert_{2,1} + \lambda_G \Vert {\bf V}_1 \Vert_{2,1}, \label{eq:regLoss} \end{align} where $\lambda_F$ and $\lambda_G$ are regularization weights for the occupancy and detection features, respectively. Thus, the goal of the learning algorithm is to minimize the negative log-likelihood of our occupancy model as well as the $\ell_{2,1}$-norms. \subsection{Training via Subgradient} A benefit of using neural network based modeling is that the computational tools for neural network-related optimization problems are well-developed. In particular, using a subgradient-based framework and leveraging effective backpropagation-based subgradient computation, the per-iteration complexity of the algorithm is appealing. The maximum likelihood estimation problem is unconstrained, and thus a simple subgradient descent algorithm can be naturally employed. Since the three terms in \eqref{eq:regLoss} are all non-differentiable (since the neural networks use the ReLU activation function), subgradient should be used, instead of gradient. More algorithmic details are in the supplement. \section{Experiment Design} We evaluated our model with both simulated and avian point count data. We compared our models with three other approaches, each tuned individually for a peak-to-peak comparison. The code and supplementary material are available at https://github.com/Hutchinson-Lab/StatEcoNet-AAAI21. \subsection{Synthetic Data} We simulated data to evaluate the models' ability to predict probabilities and observations as well as discover important features under the assumed model. We constructed ten features each for the occupancy and detection components, but only the first five features had non-zero coefficients (i.e., each sub-model had five irrelevant features). This setting is for testing the effectiveness of the feature selection layer in \texttt{StatEcoNet}. We generated data with both linear and nonlinear effects of the features on the occupancy and detection probabilities. In total, we simulated training and validation sets from the eight combinations of $M \in \{100, 1000\}$, $T \in \{3, 10\}$, and feature-occupancy/detection model $\in\{\text{linear,~nonlinear}\}$. Testing sets always had $M=1000$ for more robust performance estimates. More detailed simulation settings can be seen in the supplemental material. \subsection{Avian Point Count Data} We also analyzed data on bird distributions to evaluate the proposed method on real-world datasets. We analyzed 10,845 5-minute point count bird surveys extracted from the Oregon 2020 dataset collected in Oregon, United States \cite{oregon2020}. Surveys were conducted during the bird breeding season (May 15-July 10) by trained field ornithologists from 2011 to 2019. We selected five common Oregon species for this analysis. Common Yellowthroat (\textit{Geothlypis trichas}), Eurasian Collared-Dove (\textit{Streptopelia decaocto}), Pacific Wren (\textit{Troglodytes pacificus}), Song Sparrow (\textit{Melospiza melodia}), and Western Meadowlark (\textit{Sturnella neglecta}) vocalize frequently during the breeding season and have conspicuous, easily identifiable vocalizations. These species have very different habitat preferences (see supplement for more details). Tab.~\ref{tab:species_stat_percentage} shows statistics of our datasets (i.e., the percentage of the sites and surveys with positive observations of the species). \begin{table}[ht] \centering \begin{tabular}{ |c|c|c| } \hline Species & \multicolumn{2}{c|}{Percent observed} \\ & sites & surveys \\ \hline \hline Common Yellowthroat (COYE) & 19.5\% & 10.7\% \\ Eurasian Collared-Dove (EUCD) & 14.0\% & 8.2\% \\ Pacific Wren (PAWR) & 24.3\% & 14.5\% \\ Song Sparrow (SOSP) & 45.8\% & 27.8\% \\ Western Meadowlark (WEME) & 15.5\% & 12.2\% \\ \hline \end{tabular} \caption{Species analyzed and the percent of sites (of 942 total) and surveys (of 942 sites $\times$ 3 visits per site $=$ 2,826 total) with positive observations of the species.} \label{tab:species_stat_percentage} \end{table} Before fitting models, we acquired site and survey features, grouped observations into sites, and divided the data for cross-validation. We constructed 28 environmental features describing the sites from Landsat satellite image composites (details in supplement). The observation-related features were year, day, and time of observation, to capture time-varying detectability. For bird datasets, we consider both environmental and observation-related features as detection features because the site-specific information can affect species detectability. Though Oregon 2020 did not explicitly pre-define sites with multiple visits, its clustered sampling design simplified survey-to-site-assignment. We pre-processed the data by excluding sites that were only surveyed one or two times, and for sites visited more than three times, we randomly selected three surveys. This resulted in a total of 942 sites. We divided these data into three spatially distinct cross-validation folds \cite{Valavi2018}. The site distribution and fold assignments are shown in Fig.~\ref{fig:real_sites_folds}. \begin{figure}[ht] \centering \includegraphics[width=0.9\linewidth]{images/OR_folds.pdf} \caption{Map of the survey sites over Oregon, United States. Each site had at least three surveys. Colors indicate assignment of sites into three folds (training, validation, test) for Western Meadowlark.} \label{fig:real_sites_folds} \end{figure} \subsection{Performance Metrics} We evaluated model quality along several dimensions. We measured the Pearson correlation coefficient between the true and estimated model probabilities for the simulated datasets. For predicting held-out observations, we measured both the area under the Receiver Operating Characteristic Curve (AUROC) and the area under the Precision-Recall Curve (AUPRC). Note that the probability of a positive observation is the product of the occupancy and detection probabilities. In this case, AUPRC may be preferred over AUROC since AUPRC is better suited to class-imbalanced data~\cite{davis2006relationship} (Tab.~\ref{tab:species_stat_percentage}). With synthetic datasets, we compared the features that each model selects based on its own relative influence scores against the truly relevant features in the data-generation procedure. When applying \texttt{StatEcoNet} to the avian datasets, we present the $\ell_{2}$-norms of ${\bf U}_1(:,j)$ and ${\bf V}_1(:,k)$ as the indicators of the importance of the features $[{\bf x}_i]_j$ and $[{\bf w}_{it}]_k$, respectively. In \texttt{OD-BRT}, we present the number of times that each feature was selected as a split variable as the indicator of feature importance. Finally, we compare the performance of the models by measuring training time. We repeated experiments 5 times for synthetic datasets and 10 times for avian point count datasets, and summarized the performance evaluation metrics with mean and standard deviation values. \begin{table*}[t] \centering \begin{tabular}{ |c|c|c|c|c|c| } \hline Method & Training Time & Occ.Prob.Corr. & Det.Prob.Corr. & AUPRC & AUROC \\ \hline \hline \texttt{OD-LR} & \textbf{3.66} $\pm$ 3.11 s & 0.05 $\pm$ 0.001 & 0.01 $\pm$ 0.001 & 0.32 $\pm$ 0.002 & 0.51 $\pm$ 0.001\\ \texttt{OD-1NN} & 30.3 $\pm$ 5.15 s & \textbf{0.84} $\pm$ 0.01 & 0.004 $\pm$ 0.003 & 0.39 $\pm$ 0.004 & 0.61 $\pm$ 0.01 \\ \texttt{OD-BRT} & 320 $\pm$ 60.6 s & 0.83 $\pm$ 0.01 & \textbf{0.97} $\pm$ 0.002 & \textbf{0.53} $\pm$ 0.003 & 0.72 $\pm$ 0.002\\ \texttt{StatEcoNet} & 94.2 $\pm$ 17.5 s & \textbf{0.84} $\pm$ 0.01 & \textbf{0.97} $\pm$ 0.003 & \textbf{0.53} $\pm$ 0.001 & \textbf{0.73} $\pm$ 0.003\\ \hline \end{tabular} \caption{Performance metrics (mean $\pm$ st. dev.) on simulated data with $M=1000$, $T=10$, and nonlinear relationships. } \label{tab:syn_data_res} \end{table*} \begin{table*}[t] \centering \begin{tabular}{ |c|c|c|c|c|c|c|c|c|c|c| } \hline & \multicolumn{2}{c|}{COYE} & \multicolumn{2}{c|}{EUCD} & \multicolumn{2}{c|}{PAWR} & \multicolumn{2}{c|}{SOSP} & \multicolumn{2}{c|}{WEME} \\ Method & mean & st.dev & mean & st.dev & mean & st.dev & mean & st.dev & mean & st.dev \\ \hline \hline \texttt{OD-LR} & 0.375 & 0.0614 & 0.208 & 0.0462 & 0.474 & 0.0382 & 0.563 & 0.0230 & 0.559 & 0.1320 \\ \texttt{OD-1NN} & 0.376 & 0.0495 & 0.272 & 0.0462 & 0.461 & 0.0311 & 0.567 & 0.0311 & 0.545 & 0.1269\\ \texttt{OD-BRT} & 0.369 & 0.0458 & 0.183 & 0.0453 & 0.473 & 0.0348 & 0.558 & 0.0322 & \textbf{0.634} & 0.0665\\ \texttt{StatEcoNet} & \textbf{0.383} & 0.0519 & \textbf{0.283} & 0.0610 & \textbf{0.496} & 0.0314 & \textbf{0.571} & 0.0210 & 0.593 & 0.1049\\ \hline \end{tabular} \caption{AUPRC for the five species on predicting held-out observations. This quantity is what we can measure on these data, since we do not have ground truth for occupancy, but it is not as scientifically interesting. Performance differences are minor. } \label{tab:OR2020_data_res} \end{table*} \subsection{Baselines and Parameter Tuning} We compared the proposed method to three baselines: \texttt{OD-LR}~\cite{mackenzie2002estimating}, \texttt{OD-BRT}~\cite{hutchinson2011incorporating}, and \texttt{OD-1NN}~\cite{joseph2020neural}. Note that the superior performance of latent variable models compared to standard ML methods (e.g., logistic regression and ensembles of trees) has been demonstrated in the prior work ~\cite{hutchinson2011incorporating}. In addition, the latent variable structure of the occupancy model is critical for scientific inference in ecology. Hence, we focus on comparing our proposed method against two non-NN latent variable models (\texttt{OD-LR} for linear model and \texttt{OD-BRT} for tree-based nonlinear model) and one alternative of NN-based latent variable model (\texttt{OD-1NN}). The parameter tuning strategies for the methods under comparison are as follows. For \texttt{StatEcoNet}, we selected the key parameters, i.e., learning rate, batch size, number of neurons per layer, and number of layers, from $\{0.01,0.001,0.0001\}$, $\{32,all\}$, $\{8,16,32,64\}$, and $\{1,3\}$, respectively, to maximize the AUPRC performance on the validation set. Similarly, we tuned all parameters for the baselines. For \texttt{OD-BRT}, we used Bayesian optimization~\cite{Snoek2012,rBayesOptPkg} to tune the shrinkage, bag fraction, tree depth, and number of trees since this method was computationally intensive. The input features of bird species data were normalized for all methods except \texttt{OD-BRT}, as trees based methods do not require this procedure. More details are in the supplemental material. \section{Results} \subsection{Simulation Study} Overall, \texttt{StatEcoNet} was more effective than the baseline methods on simulated data. The estimated occupancy and detection probabilities from \texttt{StatEcoNet} were more correlated with the true probabilities than estimates from the other methods. Tab.~\ref{tab:syn_data_res} shows results for a case where the relationships between features and the occupancy/detection probability are nonlinear, $M=1000$, and $T=10$; results for a variety of other settings are in the supplemental material. \texttt{OD-LR}'s performance suffers since it does not fit nonlinear relationships. \texttt{OD-1NN} estimated detection probabilities poorly, since the occupancy and detection sub-models were confounded in the single network, which may have made the network size unnecessarily large and the model hard to learn. \texttt{OD-BRT} estimated the target probabilities well on nonlinear data, but its training time was more than three times of that used for \texttt{StatEcoNet}. In addition, a perhaps unexpected observation is that \texttt{OD-BRT} struggled to learn the models when the feature-occupancy/detection probability models were linear (see details in the supplemental material). This may reflect difficulties with approximating lines by a `staircase' of axis-parallel splits. Fig.~\ref{fig:syn_feature_all_methods} shows the parameters learned by \texttt{StatEcoNet}: $\|{\bf U}_1(:,j)\|_2$ and $\|{\bf V}_1(:,k)\|_2$. \texttt{StatEcoNet} successfully identified most of the truly relevant features, as evidenced by the larger norms of the ${\bf U}_1(:,j)$ and ${\bf V}_1(:,k)$ corresponding to the relevant features (see more in supplement). This indicates the efficacy of the $\ell_{2,1}$-norm based regularization. \begin{figure}[ht] \centering \includegraphics[width=0.9\linewidth]{images/feature_3000x10x1_StatEcoNet.pdf} \caption{ Selected features by $\texttt{StatEcoNet}$ for the synthetic dataset with $M$=1000, $T$=10, and nonlinear relationships. The dark red bars correspond to relevant features, and the blue bars irrelevant features. } \label{fig:syn_feature_all_methods} \end{figure} \subsection{Avian Point Count Study} Performance evaluation in this study is challenging because ground truth for the model probabilities and feature importances are unknown. We can compare the methods' abilities to predict held-out observations ($y_{it}$), but it is important to note that \textit{occupancy}, not \textit{observation}, is of primary scientific interest in the model---precisely what we cannot evaluate directly. \texttt{StatEcoNet} outperforms the baseline methods on four of the five species tested (Tab.~\ref{tab:OR2020_data_res}). \begin{figure*} \centering \includegraphics[width=0.83\textwidth]{images/PacificWren_hist.pdf} \caption{Histograms for Pacific Wren. \texttt{OD-BRT} shows excessive clumping near 0.5. Ground truth is unknown, but \texttt{StatEcoNet} shows more realistic variability than \texttt{OD-LR} and \texttt{OD-1NN}. } \label{fig:PAWR_densities} \end{figure*} While impossible to validate exactly, it is illustrative to examine the occupancy and detection probabilities estimated by the different methods on these data. Recall that the predictions are a product of these probabilities (i.e., $\widehat{y}_{it} = \widehat{o}_i \widehat{d}_{it}$). Intuitively, if $\widehat{o}_i$ and $\widehat{d}_{it}$ are estimated correctly, the product $\widehat{o}_i \widehat{d}_{it}$ should be close to the observed events $y_{it}=1$ (detection) and $y_{it}=0$ (non-detection) on the test set. To use this intuition for evaluation, consider the Pacific Wren as an example. Fig.~\ref{fig:PAWR_densities} shows two-dimensional histograms of the learned occupancy probabilities $\widehat{o}_i$ and detection probabilities $\widehat{d}_{it}$ for each method, separated for the cases of positive and negative observations. The histogram is color coded, where brighter grids mean the corresponding events happen with higher frequencies. Ideally, a good model and learning algorithm would `light up' the upper right corner of the histogram for $y_{it}=1$ (first row in Fig.~\ref{fig:PAWR_densities}), which means that the estimated occupancy probability $\widehat{o}_i$ and detection probability $\widehat{d}_{it}$ can reproduce the held-out detected events. Similarly, for the $y_{it}=0$ events, an ideal method will make the bottom left corner `brighter' (second row in Fig.~\ref{fig:PAWR_densities}). In Fig.~\ref{fig:PAWR_densities}, many of the \texttt{OD-BRT} model probability estimates are highly clustered around 0.5. This seems to indicate underfitting and is biologically unrealistic. The \texttt{OD-LR} and \texttt{OD-1NN} histograms did exhibit high frequencies at the upper right and lower left corners for the detection and non-detection events, respectively. However, the events and the learned models are concentrated in a relatively small number of grid cells, making the histograms spiky. This may be pathological since it models the observations with a small number of $\widehat{o}_{i}$ and $\widehat{d}_{it}$---but different sites and surveys may admit a large variety of $\widehat{o}_{i}$ and $\widehat{d}_{it}$ in reality. Hence, although these models could have good estimates for the product $\widehat{o}_i\widehat{d}_{it}$ (and thus similar AUPRCs to \texttt{StatEcoNet}), the individual estimates $\widehat{o}_{i}$ and $\widehat{d}_{it}$ may not be insightful for ecologists. Encouragingly, the histograms from \texttt{StatEcoNet} show more variability---the probabilities concentrate in the desired regions but also gracefully spread out. Finally, we examined feature importances on the bird datasets. Continuing with the Pacific Wren, Fig.~\ref{fig:real_feature_all_methods} shows the top five site and survey features selected by \texttt{OD-BRT} and \texttt{StatEcoNet}. Interestingly, \texttt{OD-BRT} emphasizes time almost exclusively in the detection model, while \texttt{StatEcoNet} blends the influence of the time-varying features with site-specific environmental features. For both methods, the most important feature was the mean of the land cover index, Tasseled Cap Angle (TCA) at the 75 meter scale. Since this species is found in wet forests with rich undergrowth on the forest floor, this feature may make intuitive sense because TCA is the land cover index that captures the information of both brightness and greenness of land cover, and thus it can indicate dense vegetation \cite{white2011history}. Even more promisingly, \texttt{StatEcoNet} selected another land cover index, Tasseled Cap Wetness (TCW) which represents wetness of area. The results for the other four species can be found in the supplemental material. \begin{figure}[ht] \centering \includegraphics[width=\linewidth]{images/PacificWren_occ_det_features.pdf} \caption{Comparison of feature importances from \texttt{OD-BRT} and \texttt{StatEcoNet} for Pacific Wren (fold 1). The plots on the left (right) show the important site (survey) features selected by each method.} \label{fig:real_feature_all_methods} \end{figure} \section{Conclusion} This paper contributes \texttt{StatEcoNet}, an interpretable computational framework to integrate the power of neural networks into statistical ecology models that account for the critical challenge of imperfect detection in species distribution modeling. Experiments on simulated datasets showed that \texttt{StatEcoNet} outperforms alternative approaches under various metrics for SDM. In particular, the examination of the learned probabilities and the selected features using real community science data on bird species exhibits intuitively pleasing and encouraging results. Since species distribution models are critical for science and conservation, and imperfect detection and model complexity are pervasive challenges for building these models, \texttt{StatEcoNet}'s ability to meet both of these challenges simultaneously has the potential for broad application and impact. In future work, we will aim to maximize this impact by analyzing more species datasets in collaboration with ecologists, improving the optimization procedure for sites with variable numbers of observations, and extending this framework beyond binary characterizations of species distributions. \section{Acknowledgements} We thank Laurel Hopkins, Jing Wang, and Mark Roth for helpful discussions and the anonymous reviewers for their valuable comments. This work was supported in part by the National Science Foundation under projects NSF IIS-1910118 and NSF ECCS 1808159. \section{Ethics Statement} This work has broad positive societal implications. Species distribution models are widely used to develop conservation and management policies for threatened species. In the midst of the sixth global mass extinction, effective actions for slowing biodiversity loss are critical for preserving our fellow inhabitants of Earth, as well as the ecosystem services they may provide to humans. The method contributed in this paper, \texttt{StatEcoNet}, offers new capacity in this area by simultaneously fitting nonlinear models for species occupancy and detection probabilities and identifying the features most important to each of those components. Our contributions capitalize on recent advances in neural networks to build more powerful SDMs. Our effort may lead to enhanced understanding of highly complex ecosystems and facilitate more effective conservation policies. This may be particularly critical in an age of drastic climate change, devastating hurricanes, and raging wildfire---the effects of which compound to threaten species persistence globally. \section{Introduction} This document includes explanations and descriptions of our model training algorithm, generation of the synthetic data, parameter tuning process, and setup of our real-data experiments. In particular, the avian point count datasets of 5 bird species, including the full descriptions of the site and survey features, are detailed in this document. Additional simulation results and real-data experiments on four more bird species can also be found in this document. Sec.~\ref{sec:realdata} also presents discussions on the real-data experiments and insights revealed by the outputs of the algorithms from an ecological study viewpoint. \section{Subgradient Algorithm} Recall that the maximum likelihood estimation problem is as follows: \begin{equation} \begin{aligned} \log{\cal L}= \sum_{i=1}^M \log{\cal L}_i =\sum_{i=1}^M \log\left( o_i \prod_{t=1}^{T_i} \left[d_{it}^{y_{it}} (1-d_{it})^{1-y_{it}}\right] + (1-o_i)\kappa_i \right) \end{aligned} \end{equation} where $\kappa_i$ is a constant defined as $\kappa_i = \mathbbm{1} \left(\sum_{t=1}^{T_i} y_{it} = 0 \right)$. The regularized version of our cost function is given by \begin{align} -\frac{1}{M}\sum_{i=1}^{M} \log{\cal L}_i + \lambda_F \Vert {\bf U}_1 \Vert_{2,1} + \lambda_G, \Vert {\bf V}_1 \Vert_{2,1} \label{eq:regLoss} \end{align} where the $\ell_2/\ell_1$ mixed norm for ${\bf Z}\in\mathbb{R}^{m\times n}$ is expressed as follows: \[ \| {\bf Z} \|_{2,1}= \sum_{j=1}^n\| {\bf Z}(:,j)\|_2 .\] As we mentioned, the mixed norm is often used in the literature for feature selection. To put together, our optimization criteria can be summarized as \begin{equation}\label{eq:ERM} \min_{\bm \theta_G,\bm \theta_F}~-\frac{1}{M}\sum_{i=1}^M \tilde{\cal L}_i(\bm \theta_G,\bm \theta_F) + \lambda_F\phi(\bm \theta_F) + \lambda_G\phi(\bm \theta_G), \end{equation} where \begin{align*} \tilde{\cal L}_i(\bm \theta_G,\bm \theta_F)& = \log {\cal L}_i,\quad \phi(\bm \theta_F) = \|{\bf U}_1\|_{2,1},\quad \phi(\bm \theta_G)= \Vert {\bf V}_1 \Vert_{2,1}. \end{align*} The maximum likelihood estimation problem is unconstrained, and thus a simple subgradient descent algorithm can be naturally employed. Since the three terms in \eqref{eq:regLoss} are all non-differentiable (as the neural networks in our construction use the rectified linear unit (ReLU) activation functions), subgradient should be used in optimization, instead of gradient. In iteration $k$, the update rule is as follows: \begin{equation*} \bm \theta^{(k+1)}\leftarrow \bm \theta^{(k)} -\alpha^{(k)}\left( -\partial \tilde{\cal L}(\bm \theta^{(k)}) + \partial \phi(\bm \theta^{(k)})\right) \end{equation*} where $\bm \theta =[\bm \theta_G^\top,\bm \theta_F^\top]^\top$, $\phi(\bm \theta)=\lambda_F\phi(\bm \theta_F) + \lambda_G\phi(\bm \theta_G)$ and the subgradient $\partial \tilde{\cal L} = \sum_{i=1}^M \partial \tilde{\cal L}_i$ is computed via the chain rule and backpropagation. To reduce complexity, $\partial\Tilde{\cal L}$ can be approximated by sample averaging: \[ \partial \tilde{\cal L}(\bm \theta^{(k)}) \approx \frac{1}{|{\cal B}^{(k)}|}\sum_{i\in{\cal B}^{(k)}} \partial \tilde{\cal L}_i(\bm \theta^{(k)}),\] where ${\cal B}^{(k)}$ is a randomly sampled batch of sites such that ${\cal B}^{(k)}\subseteq [M]$. \section{Data Simulation Details} We simulated data to evaluate the models' ability to predict probabilities and observations as well as discover important features. Our data generation formula is a mixture of linear and nonlinear components. The equations below show how we generate synthetic data for each site $i$ and survey $t$. In this simulation setting, we define 10 features for both sites and surveys, and only the first five features are used to generate the responses. That is, there are five irrelevant features in each sub-model. \begin{subequations} \begin{align} \mathbf{x}_{i} &\sim \mathcal{N}( {\bm 0},\sigma^{2}{\bf I}),\\ \mathbf{w}_{it} &\sim \mathcal{N}({\bm 0},\sigma^{2}{\bf I}),\\ [\mathbf{\boldsymbol\alpha}]_k &\sim \mathcal{U}(-1,1) \mbox{ if } k = 1, \dots, 5,~[\mathbf{\boldsymbol\alpha}]_k =0,~\forall k>5,\\ [\mathbf{\boldsymbol\beta}]_{j} &\sim \mathcal{U}(-1,1) \mbox{ if } j = 1, \dots, 5,~[\mathbf{\boldsymbol\beta}]_{j}=0,~\forall j>5,\\ o_i &= \frac{\exp({(1-\rho) \cdot \boldsymbol\alpha^{T} \mathbf{x}_i + \rho \cdot \mathbf{x}_i^{T} \mathbf{A} \mathbf{x}_i})}{1+\exp({(1-\rho) \cdot \boldsymbol\alpha^{T} \mathbf{x}_i + \rho \cdot \mathbf{x}_i^{T} \mathbf{A} \mathbf{x}_i})},\\ d_{it} &= \frac{\exp( (1-\rho) \cdot \boldsymbol\beta^{T} \mathbf{w}_{it} + \rho \cdot \mathbf{w}_{it}^{T} \mathbf{B} \mathbf{w}_{it} )} {1+\exp( (1-\rho) \cdot \boldsymbol\beta^{T} \mathbf{w}_{it} + \rho \cdot \mathbf{w}_{it}^{T} \mathbf{B} \mathbf{w}_{it} )}, \end{align} \end{subequations} Here, $\boldsymbol\alpha$ is a coefficient vector on site features ($\mathbf{x}_{i}$) and $\boldsymbol\beta$ is a coefficient vector on survey features ($\mathbf{w}_{it}$), $\mathbf{A}$ and $\mathbf{B}$ are diagonal matrices of $\boldsymbol\alpha$ and $\boldsymbol\beta$, respectively. The value of $\rho = [0,1]$ indicates the contribution of linear and nonlinear terms in generating synthetic data. When $\rho = 0$, the latent generative models for $o_i$ and $d_{it}$ are linear models, while $\rho = 1$ corresponds to nonlinear models. We sample covariates from the normal distribution to ensure that we have well-balanced probabilities. We sampled the coefficients from the uniform distribution to avoid unbounded values. We generated training, validation, and test sets from the same formula. We generate different types of datasets with the size of sites ($M$) and visits ($T$) and $\rho$ value. We use $M \in \{100, 1000\}$ and $T \in \{3, 10\}$ for training and validation sets and fix the site size for test sets with $M=1000$ and the corresponding value of $T$. We also generate datasets using $\rho \in \{0,1\}$. In total, we have 8 different types of datasets as described in Table ~\ref{tab:synthetic_datasets}. \begin{table}[ht] \centering \small \begin{tabular}{ |c||c|c|c| } \hline idx & nSites & nVisits & $\rho$\\ \hline \hline 1 & 100 & 3 & 0\\ 2 & 100 & 3 & 1\\ 3 & 100 & 10 & 0\\ 4 & 100 & 10 & 1\\ 5 & 1000 & 3 & 0\\ 6 & 1000 & 3 & 1\\ 7 & 1000 & 10 & 0\\ 8 & 1000 & 10 & 1\\ \hline \end{tabular} \caption{Synthetic datasets} \label{tab:synthetic_datasets} \end{table} \section{Avian Point Count Dataset Details} We also analyzed data on bird distributions to evaluate the proposed method on a real dataset. We used 10,845 5-minute point count bird surveys from the Oregon 2020 database \citep{oregon2020}. Surveys were conducted during the bird breeding season (May 15-July 10) by trained field ornithologists from 2011 to 2019. The survey locations were selected according to a stratified random design to distribute observations across Oregon. Within this design, 3-8 surveys were clustered within one randomly selected 1-square-mile section of each of Oregon's 36-square-mile township. During each survey, all birds were counted and identified to species. We selected five common Oregon species for this analysis. Common Yellowthroat (\textit{Geothlypis trichas}), Eurasian Collared-Dove (\textit{Streptopelia decaocto}), Song Sparrow (\textit{Melospiza melodia}), Western Meadowlark (\textit{Sturnella neglecta}), and Pacific Wren (\textit{Troglodytes pacificus}), vocalize frequently during the breeding season and have conspicuous, easily identifiable vocalizations. These species have very different habitat preferences. Common Yellowthroat is found in extremely wet vegetation with little canopy cover. Eurasian Collared-Dove is found in human-dominated habitats. Song Sparrow is more of a generalist, and is found in most habitats with rich ground-level vegetation. Western Meadowlark is found in grasslands. Pacific Wren is found in wet forests with rich undergrowth on the forest floor. \subsection{Environmental Features} We compiled features for the models representing both the surrounding environment and the observation conditions. We constructed environmental features from a time series of radiometrically consistent, gap-free Landsat satellite image composites. We aggregated all summertime (Julian days 183 - 243) Landsat Collection 1 Tier 1 surface reflectance images with less than 85\% cloud cover and which intersected our study area for processing. We harmonized the Landsat Operational Land Imager data with the Landsat Thematic Mapper and the Landsat Enhanced Thematic Mapper plus data using the reduced major axis regression coefficients from Roy et al. \citeyear{roy2016characterization}. We removed clouds and cloud shadows from the imagery using the quality assessment band produced by the FMask algorithm \citep{zhu2012object,zhu2015improvement}. We composited each year's worth of satellite imagery into a single image using the medoid method \citep{flood2013seasonal}. We computed a time series of normalized burn ratio (NBR) images from the annual composites \citep{key1999normalized}. The LandTrendr algorithm, with the NBR time series as input, derived a time series of gap-free, fitted imagery (see \citeauthor{kennedy2015attribution} 2015 for details). We used Google Earth Engine \citep{gorelick2017google} for all image processing. From the time-series of fitted images 34 spectral indices were computed. Specifically, we used three components (brightness, greenness, wetness) of Tasseled Cap - TCB, TCG, TCW - and Tasseled Cap Angle (TCA) which captures the angle between the TCG and TCB values. \begin{table}[H] \centering \small \begin{tabular}{ |l|l||l|l| } \hline ID & \multicolumn{1}{c||}{Environmental Features} & ID & \multicolumn{1}{c|}{Environmental Features}\\ \hline \hline 1 & aspect mean 75 & 15 & aspect stdDev 300\\ 2 & aspect stdDev 75 & 16 & TCA stdDev 300\\ 3 & elevation mean 75 & 17 & TCB stdDev 300\\ 4 & elevation stdDev 75 & 18 & TCW stdDev 300\\ 5 & slope stdDev 75 & 19 & aspect mean 600\\ 6 & TCA mean 75 & 20 & aspect stdDev 600\\ 7 & TCA stdDev 75 & 21 & TCB stdDev 600\\ 8 & TCB mean 75 & 22 & TCW stdDev 600\\ 9 & TCB stdDev 75 & 23 & aspect mean 1200\\ 10 & TCG stdDev 75 & 24 & aspect stdDev 1200\\ 11 & TCW stdDev 75 & 25 & TCB stdDev 1200\\ 12 & aspect stdDev 150 & 26 & TCW stdDev 1200\\ 13 & TCB stdDev 150 & 27 & aspect mean 2400\\ 14 & TCW stdDev 150 & 28 & aspect stdDev 2400\\ \hline \end{tabular} \caption{28 environmental features used in this paper's experiments. The feature name indicates the land cover index, statistics (mean/stdDev), and radius scale.} \label{tab:bird_features} \end{table} \subsection{Observation Features} The observation-related features were year, day, and time of observation, to capture time-varying detectability. In the real data experiments, the detection model had both the observation-related features and the environmental features as inputs. Even though the environmental features did not vary across surveys, they could affect detectability (e.g., vegetation affects how the sound of bird calls carries through forest). The feature selection layer of the neural networks provided a mechanism for choosing a sparser set of features. \section{Parameter Tuning Details} The hyper-parameters used for each model and the number and range of values tried per hyper-parameter are described in Tab.~\ref{tab:tuning_parameter_values}. The optimal values are selected based on AUPRC performance on the validation set. In this work, we assumed that the regularization weights $\lambda_F$ (for occupancy component) and $\lambda_G$ (for detection component) in \texttt{StatEcoNet} share the same value ($\lambda_F$ = $\lambda_G$ = $\lambda$). \begin{table}[ht!] \centering \begin{tabular}{ |l|l|l|l| } \hline Tuning Parameter & \multicolumn{1}{c|}{\texttt{OD-LR}} & \multicolumn{1}{c|}{\texttt{OD-1NN}} & \multicolumn{1}{c|}{\texttt{StatEcoNet}}\\ \hline \hline $learningRate$ & \multicolumn{3}{l|}{ $\{0.0001, 0.001, 0.01\}$ } \\ \hline $nEpoch$ & \multicolumn{3}{l|}{ $[1-2000]$ for synthetic datasets,} \\ & \multicolumn{3}{l|}{ $[1-1000]$ for bird datasets}\\ \hline $batchSize$ & & \multicolumn{2}{l|}{ $\{32, all\}$ }\\ \hline $nNeurons$ & & \multicolumn{2}{l|}{ $\{8, 16, 32\}$ for synthetic datasets,} \\ & & \multicolumn{2}{l|}{ $\{16, 32, 64\}$ for bird datasets}\\ \hline $nLayers$ & & & $\{1, 3\}$\\ \hline $\ell_{2,1}$-norm weight ($\lambda$) & & & $\{0, 0.001, 0.01\}$\\ \hline \hline \hline Tuning Parameter & \multicolumn{3}{c|}{ \texttt{OD-BRT} } \\ \hline \hline $shrinkage$ & \multicolumn{3}{l|}{ $[0.1-1]$ }\\ \hline $bagFraction$ & \multicolumn{3}{l|}{ $[0.1-1]$ }\\ \hline $nTrees$ & \multicolumn{3}{l|}{ $[1-1000]$ }\\ \hline $treeDepth$ & \multicolumn{3}{l|}{ $[2-10]$ }\\ \hline \end{tabular} \caption{Tuning parameter values. For the first five rows, we explored combinations of these discrete values in a grid search. For the \texttt{OD-BRT} parameters in the bottom three rows, we explored these ranges with Bayesian optimization.} \label{tab:tuning_parameter_values} \end{table} We found that tuning the \texttt{OD-BRT} parameters was computationally intensive, so we selected parameters via Bayesian optimization~\citep{Snoek2012}, as implemented in the R package \texttt{rBayesianOptimization}~\citep{rBayesOptPkg}. Since grid search evaluates every combination of the set of tuning parameters, it surely finds the best combination of those values; however, it can be inefficient to evaluate all possible combinations. In contrast, Bayesian optimization searches for parameter values in a range, potentially evaluating parameter values beyond the fixed values used in grid search. This allows for the possibility of finding better combinations of parameter values than those specified by grid search, though it may not always find the optimal values among all possibilities. We found that the Bayesian optimization method found tuning parameter values with higher AUPRC than grid search in less time. \section{Simulation Results} \subsection{Linear Latent Model ($\rho=0$)} \subsubsection{Optimal parameters} \begin{table}[H] \centering \begin{tabular}{ |c|c|c|c|c|c| } \hline \multirow{2}{*}{Model} & \multirow{2}{*}{Hyper-parameter} & \multicolumn{4}{c|}{Optimal Values} \\ \cline{3-6} & & 100x3 & 100x10 & 1000x3 & 1000x10\\ \hline \texttt{OD-LR} & $learningRate$ & 0.01 & 0.01 & 0.01 & 0.01 \\ \hline \texttt{OD-1NN} & $learningRate$ & 0.001 & 0.001 & 0.001 & 0.001\\ & $batchSize$ & 32 & 32 & 32 & 32\\ & $nNeurons$ & 16 & 16 & 16 & 32\\ \hline \texttt{StatEcoNet} & $learningRate$ & 0.001 & 0.001 & 0.001 & 0.001\\ & $batchSize$ & $all$ & 32 & 32 & 32\\ & $nNeurons$ & 8 & 8 & 8 & 8\\ & $nLayers$ & 1 & 3 & 1 & 3\\ & $\lambda$ & 0 & 0.01 & 0.01 & 0.01\\ \hline \texttt{OD-BRT} & $shrinkage$ & 0.2399 & 0.3629 & 0.1407 & 0.123\\ & $bagFraction$ & 0.6279 & 0.5107 & 0.8759 & 0.4817\\ & $treeDepth$ & 2 & 2 & 4 & 6\\ \hline \end{tabular} \caption{Optimal parameters for linear latent models.} \label{tab:opt_parameters_linear} \end{table} \subsubsection{Predictive performance} Our model comparisons on simulated data with linear feature combinations indicates that the linear model, \texttt{OD-LR}, performs best on linear data, as expected. However, it is rare that all feature relationships would be linear \textit{and} that the modeler would know this in advance. Considering the more general case with unknown feature relationships, the results show that \texttt{StatEcoNet} performs similarly to \texttt{OD-LR} for recovering the true model probabilities (Tab.~\ref{tab:linear_test_performance} correlation columns), predicting new data (Tab.~\ref{tab:linear_test_performance} AUPRC and AUROC columns), and selecting the correct features (Fig.~\ref{fig:fig_3000x3x0x1}). The \texttt{OD-1NN} and \texttt{OD-BRT} models exhibit problems on some datasets, notably with detection probability correlations (Tab.~\ref{tab:linear_test_performance}) and occupancy feature selection (Fig.~\ref{fig:fig_1200x10x0x1}). \begin{table}[ht!] \centering \footnotesize \begin{tabular}{ |c|c|c|c|c|c|c| } \hline Data size & Method & Training Time & Occ.Prob.Corr. & Det.Prob.Corr. & AUPRC & AUROC \\ \hline \hline & \texttt{OD-LR} & 4.58 $\pm$ 3.62 &\textbf{0.91} $\pm$ 0.03 & \textbf{0.96} $\pm$ 0.02 & \textbf{0.63} $\pm$ 0.004 & \textbf{0.84} $\pm$ 0.002 \\ $M=100$ & \texttt{OD-1NN} & 9.87 $\pm$ 2.54 & 0.86 $\pm$ 0.03 & 0.82 $\pm$ 0.02 & 0.59 $\pm$ 0.01 & 0.81 $\pm$ 0.004 \\ $T=3$ & \texttt{OD-BRT} & \textbf{3.44} $\pm$ 2.47 & 0.78 $\pm$ 0.02 & 0.84 $\pm$ 0.02 & 0.57 $\pm$ 0.01 & 0.80 $\pm$ 0.01 \\ & \texttt{StatEcoNet} & 11.29 $\pm$ 3.62 & 0.87 $\pm$ 0.02 & 0.95 $\pm$ 0.01 & 0.62 $\pm$ 0.01 & 0.83 $\pm$ 0.01 \\ \hline \hline & \texttt{OD-LR} & 6.16 $\pm$ 3.53 & \textbf{0.93} $\pm$ 0.01 & \textbf{0.98} $\pm$ 0.01 & \textbf{0.71} $\pm$ 0.003 & \textbf{0.87} $\pm$ 0.002 \\ $M=100$ & \texttt{OD-1NN} & 10.10 $\pm$ 5.78 & 0.92 $\pm$ 0.03 & 0.93 $\pm$ 0.01 & 0.67 $\pm$ 0.01 & 0.85 $\pm$ 0.01 \\ $T=10$& \texttt{OD-BRT} & \textbf{2.66} $\pm$ 4.07 & 0.81 $\pm$ 0.03 & 0.88 $\pm$ 0.05 & 0.62 $\pm$ 0.03 & 0.81 $\pm$ 0.02 \\ & \texttt{StatEcoNet} & 3.51 $\pm$ 0.85 & \textbf{0.93} $\pm$ 0.02 & 0.97 $\pm$ 0.01 & 0.70 $\pm$ 0.01 & \textbf{0.87} $\pm$ 0.004 \\ \hline \hline & \texttt{OD-LR} & 20.65 $\pm$ 7.60 & \textbf{0.99} $\pm$ 0.0001 & \textbf{1.00} $\pm$ 0.0002 & \textbf{0.68} $\pm$ 0.0003 & \textbf{0.86} $\pm$ 0.0001 \\ $M=1000$& \texttt{OD-1NN} & 6.75 $\pm$ 0.67 & 0.98 $\pm$ 0.002 & 0.98 $\pm$ 0.004 & 0.66 $\pm$ 0.004 & \textbf{0.86} $\pm$ 0.001 \\ $T=3$ & \texttt{OD-BRT} & \textbf{1.19} $\pm$ 0.85 & 0.77 $\pm$ 0.05 & 0.75 $\pm$ 0.02 & 0.53 $\pm$ 0.03 & 0.76 $\pm$ 0.02 \\ & \texttt{StatEcoNet} & 9.79 $\pm$ 5.57 & 0.98 $\pm$ 0.002 & \textbf{1.00} $\pm$ 0.001 & \textbf{0.68} $\pm$ 0.001 & \textbf{0.86} $\pm$ 0.001 \\ \hline \hline &\texttt{OD-LR} & 12.82 $\pm$ 8.33 & \textbf{0.99} $\pm$ 0.003 & \textbf{1.00} $\pm$ 0.0004 & \textbf{0.68} $\pm$ 0.001 & \textbf{0.87} $\pm$ 0.001 \\ $M=1000$ &\texttt{OD-1NN} & 6.06 $\pm$ 1.21 & 0.99 $\pm$ 0.002 & 0.99 $\pm$ 0.001 & 0.67 $\pm$ 0.001 & 0.86 $\pm$ 0.001 \\ $T=10$ &\texttt{OD-BRT} & 5.88 $\pm$ 1.23 & 0.86 $\pm$ 0.02 & 0.79 $\pm$ 0.01 & 0.53 $\pm$ 0.01 & 0.78 $\pm$ 0.01 \\ &\texttt{StatEcoNet} & \textbf{5.04} $\pm$ 2.34 & \textbf{0.99} $\pm$ 0.003 & 0.99 $\pm$ 0.001 & \textbf{0.68} $\pm$ 0.002 & 0.86 $\pm$ 0.001 \\ \hline \end{tabular} \caption{Performance metrics (mean $\pm$ st. dev.) on simulated data with linear relationships.} \label{tab:linear_test_performance} \end{table} \clearpage \begin{figure}[H] \centering \begin{subfigure}[t]{.4\textwidth} \centering \includegraphics[width=\linewidth]{figures/feature_100x3x0.pdf} \caption{$M$=100, $T$=3 ($\lambda$=0)}\label{fig:fig_1200x3x0x1} \end{subfigure} \qquad \begin{subfigure}[t]{.4\textwidth} \centering \includegraphics[width=\linewidth]{figures/feature_100x10x0.pdf} \caption{$M$=100, $T$=10 ($\lambda$=0.01)}\label{fig:fig_1200x10x0x1} \end{subfigure} \medskip \begin{subfigure}[t]{.4\textwidth} \centering \includegraphics[width=\linewidth]{figures/feature_1000x3x0.pdf} \caption{$M$=1000, $T$=3 ($\lambda$=0.01)}\label{fig:fig_3000x3x0x1} \end{subfigure} \qquad \begin{subfigure}[t]{.4\textwidth} \centering \includegraphics[width=\linewidth]{figures/feature_1000x10x0.pdf} \caption{$M$=1000, $T$=10 ($\lambda$=0.01)}\label{fig:fig_3000x10x0x1} \end{subfigure} \caption{Selected features by each method for the synthetic dataset with linear relationships. The red bars correspond to relevant features, and the blue bars irrelevant features. $M$ is the number of training sites and $T$ is the number of visits per site. $\lambda$ is the optimal regularization weights for $\lambda_F$ and $\lambda_G$. The second plot of \texttt{OD-1NN} is not available here because survey features are combined with outputs of a hidden layer from that method. The horizontal black line indicates the top 5 features according to the importance scores (y-axis).} \label{fig:syn_feature_linear} \end{figure} \subsection{Nonlinear Latent Model ($\rho=1$)} \subsubsection{Optimal parameters} \begin{table}[H] \centering \begin{tabular}{ |c|c|c|c|c|c| } \hline \multirow{2}{*}{Model} & \multirow{2}{*}{Hyper-parameter} & \multicolumn{4}{c|}{Optimal Values} \\ \cline{3-6} & & 100x3 & 100x10 & 1000x3 & 1000x10\\ \hline \texttt{OD-LR} & $learningRate$ & 0.01 & 0.01 & 0.01 & 0.01 \\ \hline \texttt{OD-1NN} & $learningRate$ & 0.001 & 0.001 & 0.001 & 0.001\\ & $batchSize$ & $all$ & $all$ & 32 & 32\\ & $nNeurons$ & 16 & 16 & 32 & 8\\ \hline \texttt{StatEcoNet} & $learningRate$ & 0.001 & 0.001 & 0.001 & 0.001\\ & $batchSize$ & 32 & 32 & $all$ & $all$\\ & $nNeurons$ & 32 & 8 & 16 & 16\\ & $nLayers$ & 3 & 1 & 3 & 3\\ & $\lambda$ & 0.001 & 0.001 & 0.01 & 0.01\\ \hline \texttt{OD-BRT} & $shrinkage$ & 0.9440 & 0.3320 & 0.5149 & 0.4040\\ & $bagFraction$ & 0.1435 & 0.6444 & 0.7826 & 0.7499\\ & $treeDepth$ & 5 & 9 & 2 & 3\\ \hline \end{tabular} \caption{Optimal parameters for nonlinear latent models.} \label{tab:opt_parameters_nonlinear} \end{table} \subsubsection{Predictive performance} On the simulation experiments where the data generation uses nonlinear feature combinations, \texttt{StatEcoNet} performs well. On only the smallest datasets ($M=100$), it is outperformed by \texttt{OD-BRT} in terms of recovering the occupancy and detection probabilities as well as predicting new data (Tab.~\ref{tab:nonlinear_test_performance}). On the larger datasets ($M=1000$), \texttt{StatEcoNet} performs as well or better than \texttt{OD-BRT}, and the training time starts to favor \texttt{StatEcoNet} heavily as dataset sizes increase. On these larger datasets, \texttt{StatEcoNet} also has an advantage for feature selection. \begin{table}[ht!] \centering \footnotesize \begin{tabular}{ |c|c|c|c|c|c|c| } \hline Data size & Method & Training Time & Occ.Prob.Corr. & Det.Prob.Corr. & AUPRC & AUROC \\ \hline \hline & \texttt{OD-LR} & \textbf{0.40} $\pm$ 0.50 & -0.002 $\pm$ 0.02 & 0.003 $\pm$ 0.01 & 0.29 $\pm$ 0.004 & 0.50 $\pm$ 0.004 \\ $M=100$ &\texttt{OD-1NN} & 5.77 $\pm$ 12.33 & 0.05 $\pm$ 0.07 & -0.01 $\pm$ 0.02 & 0.29 $\pm$ 0.01 & 0.50 $\pm$ 0.02\\ $T=3$ &\texttt{OD-BRT} & 1.48 $\pm$ 1.07 & \textbf{0.38} $\pm$0.11 & \textbf{0.55} $\pm$0.15 & \textbf{0.37} $\pm$ 0.03 & \textbf{0.60} $\pm$ 0.02\\ &\texttt{StatEcoNet} & 4.91 $\pm$ 6.85 & 0.1 $\pm$ 0.12 & 0.16 $\pm$ 0.21 & 0.31 $\pm$ 0.03 & 0.53 $\pm$ 0.04\\ \hline \hline & \texttt{OD-LR} & \textbf{0.90} $\pm$ 0.52 & -0.003 $\pm$ 0.02 & 0.01 $\pm$ 0.004 & 0.39 $\pm$ 0.01 & 0.51 $\pm$ 0.01 \\ $M=100$ & \texttt{OD-1NN} & 16.13 $\pm$ 16.08 & 0.11 $\pm$ 0.15 & 0. $\pm$ 0.01 & 0.39 $\pm$ 0.01 & 0.52 $\pm$ 0.01 \\ $T=10$ & \texttt{OD-BRT} & 8.07 $\pm$ 0.88 & \textbf{0.59} $\pm$ 0.01 & \textbf{0.80} $\pm$ 0.01 & \textbf{0.53} $\pm$ 0.002 & \textbf{0.66} $\pm$ 0.01 \\ & \texttt{StatEcoNet} & 39.57 $\pm$ 50.71 & 0.03 $\pm$ 0.08 & 0.31 $\pm$ 0.38 & 0.42 $\pm$ 0.06 & 0.55 $\pm$ 0.07 \\ \hline \hline & \texttt{OD-LR} & \textbf{1.21} $\pm$ 1.21 & -0.02 $\pm$ 0.04 & -0.01 $\pm$ 0.03 & 0.35 $\pm$ 0.01 & 0.50 $\pm$ 0.01 \\ $M=1000$ & \texttt{OD-1NN} & 18.96 $\pm$ 2.47 & 0.73 $\pm$ 0.02 & -0.02 $\pm$ 0.01 & 0.42 $\pm$ 0.01 & 0.59 $\pm$ 0.01 \\ $T=3$ & \texttt{OD-BRT} & 28.77 $\pm$ 22.9 & \textbf{0.79} $\pm$ 0.03 & 0.88 $\pm$ 0.04 & \textbf{0.55} $\pm$ 0.01 & \textbf{0.70} $\pm$ 0.01 \\ & \texttt{StatEcoNet} & 25.85 $\pm$ 14.16 & 0.54 $\pm$ 0.04 & \textbf{0.90} $\pm$ 0.03 & 0.53 $\pm$ 0.02 & \textbf{0.70} $\pm$ 0.01 \\ \hline \hline & \texttt{OD-LR} & \textbf{3.66} $\pm$ 3.11 s & 0.05 $\pm$ 0.001 & 0.01 $\pm$ 0.001 & 0.32 $\pm$ 0.002 & 0.51 $\pm$ 0.001\\ $M=1000$ & \texttt{OD-1NN} & 30.3 $\pm$ 5.15 s & \textbf{0.84} $\pm$ 0.01 & 0.004 $\pm$ 0.003 & 0.39 $\pm$ 0.004 & 0.61 $\pm$ 0.01 \\ $T=10$ & \texttt{OD-BRT} & 320 $\pm$ 60.6 s & 0.83 $\pm$ 0.01 & \textbf{0.97} $\pm$ 0.002 & \textbf{0.53} $\pm$ 0.003 & 0.72 $\pm$ 0.002\\ & \texttt{StatEcoNet} & 94.2 $\pm$ 17.5 s & \textbf{0.84} $\pm$ 0.01 & \textbf{0.97} $\pm$ 0.003 & \textbf{0.53} $\pm$ 0.001 & \textbf{0.73} $\pm$ 0.003\\ \hline \end{tabular} \caption{Performance metrics (mean $\pm$ st. dev.) on simulated data with nonlinear relationships.} \label{tab:nonlinear_test_performance} \end{table} \clearpage \begin{figure} \centering \begin{subfigure}[t]{.4\textwidth} \centering \includegraphics[width=\linewidth]{figures/feature_100x3x1.pdf} \caption{$M$=100, $T$=3 ($\lambda$=0.001)}\label{fig:fig_1200x3x1x1} \end{subfigure} \qquad \begin{subfigure}[t]{.4\textwidth} \centering \includegraphics[width=\linewidth]{figures/feature_100x10x1.pdf} \caption{$M$=100, $T$=10 ($\lambda$=0.001)}\label{fig:fig_1200x10x1x1} \end{subfigure} \medskip \begin{subfigure}[t]{.4\textwidth} \centering \includegraphics[width=\linewidth]{figures/feature_1000x3x1.pdf} \caption{$M$=1000, $T$=3 ($\lambda$=0.01)}\label{fig:fig_3000x3x1x1} \end{subfigure} \qquad \begin{subfigure}[t]{.4\textwidth} \centering \includegraphics[width=\linewidth]{figures/feature_1000x10x1.pdf} \caption{$M$=1000, $T$=10 ($\lambda$=0.01)}\label{fig:fig_3000x10x1x1} \end{subfigure} \caption{Selected features by each method for the synthetic dataset with nonlinear relationships. The red bars correspond to relevant features, and the blue bars irrelevant features. $M$ is the number of training sites and $T$ is the number of visits per site. $\lambda$ is the optimal regularization weights for $\lambda_F$ and $\lambda_G$. The second plot of \texttt{OD-1NN} is not available here because survey features are combined with outputs of a hidden layer from that method. The horizontal black line indicates the top 5 features according to the importance scores.} \label{fig:syn_feature_nonlinear} \end{figure} \clearpage \section{Avian Point Count Results}\label{sec:realdata} Each subsection below reports more detailed results for each of the five species. Each section gives a histogram of the learned occupancy and detection probabilities, feature importances for the occupancy and detection models across methods, and the optimal hyperparameters that resulted from the tuning process. There are a few overall trends in the avian point count study results to point out. First, the differences between methods in terms of AUPRC and AUROC are minor (Table \ref{tab:AUCs}), even though the interpretations of the learned models vary substantially (visualizations in species-specific subsections below). (The results of \texttt{OD-1NN} and \texttt{StatEcoNet} have been updated from the main paper with some small changes to the parameter tuning; the main trends are unchanged.) Second, \texttt{OD-BRT} sometimes produces probability histograms that are concentrated around 0.5. These seem unrealistic and appear underfit, despite careful parameter tuning. Third, note that the detection feature importance plots are missing for \texttt{OD-1NN} for all species because this inference is not available from that method due to the architecture of the neural network. There are also a few things to consider when viewing the probability histograms below. First, the upper left corners should be interpreted loosely. As the occupancy probability for a given point approaches zero, the contribution of the detection model for that point gets less influence in the likelihood function. Second, variation in detection probability is often biologically plausible (with some exceptions). Finally, for specialists, a low or bimodal distribution of occupancy probabilities for the non-detections makes sense, since sites will be obviously suitable or unsuitable, and some suitable sites may have non-detections. \begin{table}[H] \centering \begin{tabular}{ |c|c|c|c|c|c| } \hline Species & Metric & \texttt{OD-LR} & \texttt{OD-1NN} & \texttt{OD-BRT} & \texttt{StatEcoNet}\\ \hline \hline COYE & AUPRC & 0.375 $\pm$ 0.0614 & 0.376 $\pm$ 0.0495 & 0.369 $\pm$ 0.0458 & \textbf{0.383} $\pm$ 0.0519\\ \hline EUCD & AUPRC &0.208 $\pm$ 0.0462 & 0.272 $\pm$ 0.0462 & 0.183 $\pm$ 0.0453 & \textbf{0.283} $\pm$ 0.0610\\ \hline SOSP & AUPRC & 0.563 $\pm$ 0.0230 & 0.567 $\pm$ 0.0311 & 0.558 $\pm$ 0.0322 & \textbf{0.571} $\pm$ 0.021\\ \hline WEME & AUPRC & 0.559 $\pm$ 0.132 & 0.545 $\pm$ 0.1269 & \textbf{0.634} $\pm$ 0.0665 & 0.593$\pm$0.1049\\ \hline PAWR & AUPRC & 0.474 $\pm$ 0.0382 & 0.461 $\pm$ 0.0311 & 0.473 $\pm$ 0.0348 & \textbf{0.496} $\pm$ 0.0314\\ \hline \hline COYE & AUROC & 0.834 $\pm$ 0.0355 & \textbf{0.836} $\pm$ 0.0229 & 0.834 $\pm$ 0.0404 & 0.828 $\pm$ 0.0375\\ \hline EUCD & AUROC & 0.756 $\pm$ 0.0325 & \textbf{0.809} $\pm$ 0.03 & 0.72 $\pm$ 0.0709 & \textbf{0.809} $\pm$ 0.021\\ \hline SOSP & AUROC & 0.797 $\pm$ 0.0175 & 0.801 $\pm$ 0.0192 & 0.802 $\pm$ 0.0185 & \textbf{0.803} $\pm$ 0.0152\\ \hline WEME & AUROC & 0.881 $\pm$ 0.0516 & 0.891 $\pm$ 0.0416 & \textbf{0.912} $\pm$ 0.0283 & 0.910 $\pm$ 0.0292\\ \hline PAWR & AUROC & 0.858 $\pm$ 0.0178 & 0.865 $\pm$ 0.0218 & 0.868 $\pm$ 0.0309 & \textbf{0.875} $\pm$ 0.026 \\ \hline \end{tabular} \caption{Predictive performance of methods for five bird species.} \label{tab:AUCs} \end{table} \clearpage \subsection{Common Yellowthroat (COYE)} Common Yellowthroat (COYE) is found in extremely wet vegetation with little canopy cover. Like all songbirds, it sings more in the early morning than later in the day, so it is more frequently detected on early surveys. Figure~\ref{fig:COYE_densities} shows two-dimensional histograms of the occupancy and detection probabilities for all positive species reports (detections, $y=1$) in the top row, and all negative species reports (non-detections, $y=0$) in the bottom row. The concentration of negatives in the lower left corner of the histograms of \texttt{StatEcoNet} and \texttt{OD-1NN} may reflect the fact that much of the surveyed points are not suitable habitat for this species, so many occupancy probabilities should be low. In contrast, \texttt{OD-LR} is less believable, with many negatives having high occupancy probability, implying that the species was missed more frequently than is realistic. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{figures/CommonYellowthroat_hist.pdf} \caption{Histograms for Common Yellowthroat. The top row shows the occupancy and detection probability histograms for positives (detections, $y=1$), and the bottom row shows the same for negatives (non-detections, $y=0$). } \label{fig:COYE_densities} \end{figure} \clearpage Figures~\ref{fig:COYE_occ_feature} and \ref{fig:COYE_det_feature} show the top five most important variables learned by each method for COYE. Mean elevation was consistently among the top site features, which fits with field observations that this species utilizes wetland and riparian habitats. Such habitats of sufficient size for this species are often found at lower elevations. Inclusion of standard deviations of TCA and TCW probably relate to the contrast between reflectance of water versus adjacent wetland habitats. \begin{figure}[H] \centering \includegraphics[width=\linewidth]{figures/CommonYellowthroat_occ_features.pdf} \caption{Occupancy feature importances for Common Yellowthroat. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the mean elevation at the 75 m scale (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods.} \label{fig:COYE_occ_feature} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\linewidth]{figures/CommonYellowthroat_det_features.pdf} \caption{Detection feature importances for Common Yellowthroat. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the mean elevation at the 75 m scale (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods. \texttt{OD-1NN} is not included here because the importance of environmental features to the detection model is not available from that method.} \label{fig:COYE_det_feature} \end{figure} \begin{table}[H] \centering \begin{tabular}{ |c|c|c|c|c| } \hline \multirow{2}{*}{Model} & \multirow{2}{*}{Hyper-parameter} & \multicolumn{3}{c|}{Optimal Values} \\ \cline{3-5} & & Fold 1 & Fold 2 & Fold 3\\ \hline \texttt{OD-LR} & $learningRate$ & 0.01 & 0.01 & 0.01 \\ \hline \texttt{OD-1NN} & $learningRate$ & 0.001 & 0.001 & 0.001 \\ & $batchSize$ & 32 & 32 & 32 \\ & $nNeurons$ & 32 & 64 & 16\\ \hline \texttt{StatEcoNet} & $learningRate$ & 0.001 & 0.001 & 0.001\\ & $batchSize$ & 32 & 32 & 32\\ & $nNeurons$ & 32 & 64 & 32\\ & $nLayers$ & 1 & 3 & 1\\ & $\lambda$ & 0 & 0.001 & 0.001\\ \hline \texttt{OD-BRT} & $shrinkage$ & 0.7274 & 0.4756 & 0.2038\\ & $bagFraction$ & 0.4633 & 0.9526 & 0.9429\\ & $treeDepth$ & 3 & 10 & 10\\ \hline \end{tabular} \caption{Optimal parameters per fold for Common Yellowthroat} \label{tab:opt_parameters_COYE} \end{table} \clearpage \subsection{Eurasian Collared-Dove (EUCD)} Eurasian Collared-Dove (EUCD) is found in human-dominated habitats. When present, it is usually easy to identify both visually and aurally. However, in noisy urban areas, its calls may be drowned out by other sounds. Figure \ref{fig:EUCD_densities} shows two-dimensional histograms of the occupancy and detection probabilities for all positive species reports (detections, $y=1$) in the top row, and all negative species reports (non-detections, $y=0$) in the bottom row. Here, the bimodality of the occupancy probabilities (\texttt{OD-LR}, \texttt{OD-1NN}, \texttt{StatEcoNet}) makes sense, as human-dominated habitats are relatively easy to distinguish. \texttt{StatEcoNet} shows most detections as having high occupancy and detection probabilities, most non-detections with low occupancy and detection probabilities; this makes sense for a highly-detectable bird with an easily distinguishable habitat. The secondary concentration of sites that are highly likely to be occupied but with very low detection probabilities could be sites where noise pollution impedes detection. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/EurasianCollared-Dove_hist.pdf} \caption{Histograms for Eurasian Collared-Dove.} \label{fig:EUCD_densities} \end{figure} \clearpage Figures~\ref{fig:EUCD_occ_feature} and \ref{fig:EUCD_det_feature} show the top five most important variables learned by each method for EUCD. Eurasian Collared-Doves tend to be most numerous around small homesteads (barns, homes) surrounded by agricultural habitats, which is reflected in the identification of TCW standard deviations as important site features. They also are numerous in suburbanized settings, which are captured well by TCA and TCB. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/EurasianCollared-Dove_occ_features.pdf} \caption{Occupancy feature importances for Eurasian Collared-Dove. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the mean TCA at the 75 m scale (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods.} \label{fig:EUCD_occ_feature} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/EurasianCollared-Dove_det_features.pdf} \caption{Detection feature importances for Eurasian Collared-Dove. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the year (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods. \texttt{OD-1NN} is not included here because the importance of environmental features to the detection model is not available from that method.} \label{fig:EUCD_det_feature} \end{figure} \begin{table}[H] \centering \begin{tabular}{ |c|c|c|c|c| } \hline \multirow{2}{*}{Model} & \multirow{2}{*}{Hyper-parameter} & \multicolumn{3}{c|}{Optimal Values} \\ \cline{3-5} & & Fold 1 & Fold 2 & Fold 3\\ \hline \texttt{OD-LR} & $learningRate$ & 0.01 & 0.01 & 0.01 \\ \hline \texttt{OD-1NN} & $learningRate$ & 0.001 & 0.001 & 0.001 \\ & $batchSize$ & $all$ & 32 & 32 \\ & $nNeurons$ & 64 & 64 & 16\\ \hline \texttt{StatEcoNet} & $learningRate$ & 0.001 & 0.001 & 0.001\\ & $batchSize$ & 32 & 32 & 32\\ & $nNeurons$ & 64 & 32 & 16\\ & $nLayers$ & 3 & 3 & 3\\ & $\lambda$ & 0.001 & 0 & 0.001\\ \hline \texttt{OD-BRT} & $shrinkage$ & 0.8073 & 0.4250 & 0.8064\\ & $bagFraction$ & 0.7758 & 0.7055 & 0.9508\\ & $treeDepth$ & 10 & 7 & 8\\ \hline \end{tabular} \caption{Optimal parameters per fold for Eurasian Collared-Dove} \label{tab:opt_parameters_EUCD} \end{table} \clearpage \subsection{Song Sparrow (SOSP)} Song Sparrow (SOSP) is found in most habitats with rich ground-level vegetation. It is usually in wet areas, occasionally restricted to riparian zones, but also found in residential areas with lush vegetation. It can be quite prevalent in some habitats. Figure \ref{fig:SOSP_densities} shows two-dimensional histograms of the occupancy and detection probabilities for all positive species reports (detections, $y=1$) in the top row, and all negative species reports (non-detections, $y=0$) in the bottom row. Here, the \texttt{OD-BRT} histogram of non-detections concentrating on very low occupancy probabilities seems to imply that almost all of the occupied sites had detections; this is improbable. For the other models, the bimodality of the non-detection occupancy probabilities indicates that the models are finding good separation between habitat and non-habitat and explaining non-detections in good habitat with low detection probabilities. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/SongSparrow_hist} \caption{Histograms for Song Sparrow.} \label{fig:SOSP_densities} \end{figure} \clearpage Figures~\ref{fig:SOSP_occ_feature} and \ref{fig:SOSP_det_feature} show the top five most important variables learned by each method for SOSP. Song Sparrows are widely distributed common species associated with riparian habitats, suburban habitats and early successional habitats. Most approaches accurately detected that Song Sparrows most often occur at lower elevations. Because they occupy a wide variety of habitats, specific habitat reflectance features did not consistently emerge across the four analytical approaches, although consistency across the 3 folds was better for \texttt{StatEcoNet}. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/SongSparrow_occ_features.pdf} \caption{Occupancy feature importances for Song Sparrow. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the mean elevation at the 75 m scale (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods.} \label{fig:SOSP_occ_feature} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/SongSparrow_det_features.pdf} \caption{Detection feature importances for Song Sparrow. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the mean elevation (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods. \texttt{OD-1NN} is not included here because the importance of environmental features to the detection model is not available from that method.} \label{fig:SOSP_det_feature} \end{figure} \begin{table}[H] \centering \begin{tabular}{ |c|c|c|c|c| } \hline \multirow{2}{*}{Model} & \multirow{2}{*}{Hyper-parameter} & \multicolumn{3}{c|}{Optimal Values} \\ \cline{3-5} & & Fold 1 & Fold 2 & Fold 3\\ \hline \texttt{OD-LR} & $learningRate$ & 0.01 & 0.01 & 0.01 \\ \hline \texttt{OD-1NN} & $learningRate$ & 0.001 & 0.001 & 0.001 \\ & $batchSize$ & 32 & $all$ & 32 \\ & $nNeurons$ & 16 & 32 & 16\\ \hline \texttt{StatEcoNet} & $learningRate$ & 0.001 & 0.001 & 0.001\\ & $batchSize$ & 32 & 32 & 32\\ & $nNeurons$ & 64 & 16 & 16\\ & $nLayers$ & 1 & 3 & 3\\ & $\lambda$ & 0.01 & 0.01 & 0.01\\ \hline \texttt{OD-BRT} & $shrinkage$ & 0.6779 & 0.6801 & 0.8664\\ & $bagFraction$ & 0.9158 & 0.2259 & 0.7236\\ & $treeDepth$ & 3 & 4 & 5\\ \hline \end{tabular} \caption{Optimal parameters per fold for Song Sparrow} \label{tab:opt_parameters_SOSP} \end{table} \clearpage \subsection{Western Meadowlark (WEME)} Western Meadowlark (WEME) strongly specializes on grasslands. Grassland habitat should be more easily distinguishable from our remotely sensed features than some other habitat types (e.g., different types of forest). WEME is one of the most available species for detection in the early morning and can be heard from 1 km away. Since all counts in this dataset were conducted in the morning, high detection probabilities for positive observations make sense. Figure \ref{fig:WEME_densities} shows two-dimensional histograms of the occupancy and detection probabilities for all positive species reports (detections, $y=1$) in the top row, and all negative species reports (non-detections, $y=0$) in the bottom row. The \texttt{StatEcoNet} histograms here are quite concentrated, but this may reflect the high detectability of this species and the ease with which its habitat is distinguished by the remote sensing features. The non-detections with high occupancy probability and low detection probability (lower right corner) may be areas of the Willamette valley that do have grassland habitat, but that do not host WEME because they are only small patches of grassland; these would appear to the model as highly likely to be occupied but with low detection probability. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/WesternMeadowlark_hist} \caption{Histograms for Western Meadowlark.} \label{fig:WEME_densities} \end{figure} \clearpage Figures~\ref{fig:WEME_occ_feature} and \ref{fig:WEME_det_feature} show the top five most important variables learned by each method for WEME. Western Meadowlarks inhabit grasslands and sagebrush of large extent, avoiding smaller patches or tracts composed largely of agricultural grasslands. Emergence of mean TCA at small buffers (75 m) possibly is related to habitat quality as greenness (moist, productive grasslands) is an important contributor to TCA. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/WesternMeadowlark_occ_features.pdf} \caption{Occupancy feature importances for Western Meadowlark. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the mean TCA at the 75 m scale (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods.} \label{fig:WEME_occ_feature} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/WesternMeadowlark_det_features.pdf} \caption{Detection feature importances for Western Meadowlark. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the day (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods. \texttt{OD-1NN} is not included here because the importance of environmental features to the detection model is not available from that method.} \label{fig:WEME_det_feature} \end{figure} \begin{table}[H] \centering \begin{tabular}{ |c|c|c|c|c| } \hline \multirow{2}{*}{Model} & \multirow{2}{*}{Hyper-parameter} & \multicolumn{3}{c|}{Optimal Values} \\ \cline{3-5} & & Fold 1 & Fold 2 & Fold 3\\ \hline \texttt{OD-LR} & $learningRate$ & 0.01 & 0.01 & 0.01 \\ \hline \texttt{OD-1NN} & $learningRate$ & 0.001 & 0.001 & 0.001 \\ & $batchSize$ & $all$ & 32 & 32 \\ & $nNeurons$ & 16 & 64 & 64\\ \hline \texttt{StatEcoNet} & $learningRate$ & 0.001 & 0.001 & 0.001\\ & $batchSize$ & 32 & 32 & 32\\ & $nNeurons$ & 32 & 64 & 32\\ & $nLayers$ & 3 & 1 & 1\\ & $\lambda$ & 0.01 & 0.01 & 0.01\\ \hline \texttt{OD-BRT} & $shrinkage$ & 0.2121 & 0.7199 & 0.4600\\ & $bagFraction$ & 0.8853 & 0.7763 & 0.2401\\ & $treeDepth$ & 2 & 6 & 10\\ \hline \end{tabular} \caption{Optimal parameters per fold for Western Meadowlark} \label{tab:opt_parameters_WEME} \end{table} \clearpage \subsection{Pacific Wren (PAWR)} This is the example from the main text, repeated here for completeness. In Fig.~\ref{fig:PAWR_densities}, the \texttt{OD-BRT} plots show that many of the model probabilities are highly clustered around 0.5. This seems to indicate underfitting and is biologically unrealistic. The \texttt{OD-LR} and \texttt{OD-1NN} histograms did exhibit high frequencies at the upper right and lower left corners for the detection and non-detection events, respectively. However, the events and the learned models are concentrated in a relatively small number of grid cells, making the histograms spiky. This may be pathological since it ties the detected/undetected events with a small number of $\widehat{o}_{i}$ and $\widehat{d}_{it}$---but different sites and surveys may admit a large variety of $\widehat{o}_{i}$ and $\widehat{d}_{it}$ in reality. Hence, although these models could have good estimates for the product $\widehat{o}_i\widehat{d}_{it}$ (and thus similar AUPRCs to \texttt{StatEcoNet}), the individual estimates $\widehat{o}_{i}$ and $\widehat{d}_{it}$ may not be insightful for ecologists. Encouragingly, the histograms from \texttt{StatEcoNet} show more variability---the probabilities concentrate in the desired regions but also gracefully spread out. This is more likely to be the case in practice. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/PacificWren_hist} \caption{Histograms for Pacific Wren.} \label{fig:PAWR_densities} \end{figure} \clearpage Figures~\ref{fig:PAWR_occ_feature} and \ref{fig:PAWR_det_feature} show the top five most important variables learned by each method for PAWR. Inhabiting moist forests, often near riparian zones, Pacific Wrens occupy north-facing slopes that retain moisture later into the dry Pacific Northwest summers. The inclusion of TCA, which captures greenness and brightness, and TCW, capturing correlates of moisture, fits well. The occurrence of aspect also suggests non-random selection of locations in mountainous landscapes by Pacific Wrens. \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/PacificWren_occ_features.pdf} \caption{Occupancy feature importances for Pacific Wren. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the mean TCA at the 75 m scale (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods.} \label{fig:PAWR_occ_feature} \end{figure} \begin{figure}[H] \centering \includegraphics[width=\textwidth]{figures/PacificWren_det_features.pdf} \caption{Detection feature importances for Pacific Wren. The top five features per method per fold are plotted. Note that the x-axes differ across methods. The feature corresponding to the time (chosen as an example feature that is important for \texttt{StatEcoNet}) is shaded red to highlight differences across methods. \texttt{OD-1NN} is not included here because the importance of environmental features to the detection model is not available from that method.} \label{fig:PAWR_det_feature} \end{figure} \begin{table}[H] \centering \begin{tabular}{ |c|c|c|c|c| } \hline \multirow{2}{*}{Model} & \multirow{2}{*}{Hyper-parameter} & \multicolumn{3}{c|}{Optimal Values} \\ \cline{3-5} & & Fold 1 & Fold 2 & Fold 3\\ \hline \texttt{OD-LR} & $learningRate$ & 0.01 & 0.01 & 0.01 \\ \hline \texttt{OD-1NN} & $learningRate$ & 0.001 & 0.001 & 0.001 \\ & $batchSize$ & $all$ & $all$ & $all$ \\ & $nNeurons$ & 64 & 64 & 32\\ \hline \texttt{StatEcoNet} & $learningRate$ & 0.001 & 0.001 & 0.001\\ & $batchSize$ & 32 & $all$ & 32\\ & $nNeurons$ & 64 & 16 & 16\\ & $nLayers$ & 3 & 1 & 1\\ & $\lambda$ & 0.01 & 0 & 0.001\\ \hline \texttt{OD-BRT} & $shrinkage$ & 0.100 & 0.100 & 0.4628\\ & $bagFraction$ & 1.0000 & 0.4268 & 0.3946\\ & $treeDepth$ & 4 & 2 & 3\\ \hline \end{tabular} \caption{Optimal parameters per fold for Pacific Wren} \label{tab:opt_parameters_PAWR} \end{table} \clearpage \section{Computing Infrastructure} \begin{table}[H] \centering \begin{tabular}{ |c|l|l|l| } \hline \multirow{5}{*}{Hardware} & \multirow{3}{*}{CPU} & \# of Cores & 4\\ \cline{3-4} & & \# of Threads & 8 \\ \cline{3-4} & & Model & Intel(R) Xeon(R) CPU E3-1230 v5 @ 3.40GHz \\ \cline{2-4} & Memory & \multicolumn{2}{l|}{16 GB} \\ \cline{2-4} & Operating System & \multicolumn{2}{l|}{CentOS Linux 7} \\ \hline \hline \hline \multirow{24}{*}{Software} & \multicolumn{2}{l|}{Python} & 3.8.3 \\ \cline{2-4} & \multirow{9}{*}{Python libraries} & torch & 1.5.1 \\ & & numpy & 1.19.1 \\ & & pandas & 1.0.5 \\ & & matplotlib & 3.3.0 \\ & & tqdm & 4.48.0 \\ & & scikit-learn & 0.23.1 \\ & & scipy & 1.5.2 \\ & & jupyterlab & 2.2.1 \\ & & import-ipynb & 0.1.3 \\ \cline{2-4} & \multicolumn{2}{l|}{R} & 4.0.2 \\ \cline{2-4} & \multirow{13}{*}{R libraries} & grt & 0.2.1 \\ & & reshape2 & 1.4.4 \\ & & PRROC & 1.3.1 \\ & & Metrics & 0.1.4 \\ & & paramtest & 0.1.0 \\ & & Rcpp & 1.0.5 \\ & & scales & 1.1.1 \\ & & dplyr & 1.0.1 \\ & & ggplot2 & 3.3.2\\ & & patchwork & 1.0.1 \\ & & blockCV & 2.1.1 \\ & & raster & 3.3-13 \\ & & sf & 0.9-5\\ \hline \end{tabular} \caption{Computing infrastructure specification.} \label{tab:computing_infrastructure} \end{table} \clearpage
\section{Introduction} The quantum many body problem is both complex and difficult. ``Difficulty" refers to the combination of the exponential growth of Hilbert space with system size and quantum entanglement (in particular the Fermion sign problem) which render standard methods for dealing with large interacting problems ineffective. ``Complexity" refers to the issues involved in formulating the many-body problem, in particular defining and computing the large number of basis functions and interaction parameters required to capture the chemical and structural effects that distinguish e.g. aluminum, a low transition temperature superconductor well described by conventional Migdal-Eliashberg theory, from e.g. La$_{2-x}$Sr$_x$CuO$_4$, a high transition temperature superconductor believed to have properties inconsistent with conventional Migdal-Eliashberg theory. Some methods, such as Density Functional Theory, map the correlation problem onto a one body problem with a self-consistently determined potential. While in principle exact, these methods fail in practice for materials with strong electronic correlations. Other approaches, such as the coupled cluster theories of quantum chemistry \cite{bartlett2007coupled}, treat the full complexity of molecular systems but work well only for relatively small, relatively weakly correlated systems where the level of quantum mechanical difficulty is not large. Conversely, Bethe ansatz approaches \cite{Bethe1931} provide an exact solution for model systems, thus fully taking into account the quantum mechanical difficulty while omitting the complexity needed to describe real materials. A complete treatment of the full quantum many-body problem in all its difficulty and complexity is not currently feasible. For most systems of interest, progress has come from the combination of reducing the complexity by ``downfolding" the full problem to a much smaller and therefore more tractable one and managing the difficulty via an approximate solution of the quantum many body problem as defined in the downfolded subspace. Downfolding typically involves the identification of a subset of single particle states which are then used to construct the many-particle Fock space in which the quantum many body physics is to be solved and the projection of the Hamiltonian into this basis. A widely studied example of downfolding is the single band Hubbard model \cite{hubbard1963electron} in which the single-electron electronic structure is approximated as a one band tight binding model defined on a simple lattice and only the onsite term in the electron-electron interaction is retained. Interest in downfolding has been renewed by the recent discovery \cite{Hwang2019} of superconductivity in infinite layer rare earth nickelates such as hole doped \ce{NdNiO2}{}. This family of materials has been of long-standing interest as a potential analog of the layered copper oxide (cuprate) superconductors \cite{Crespin1983reduced,hayward1999sodium, Anisimov99, Lee04} and is currently the subject of intense theoretical and experimental research. Electronic structure calculations \cite{Lee04, karp2020manybody, botana2019, nomura2019, hepting2019, wu2019, sakakibara2020model, gao2019electronic, zhang2019effective, jiang2019electronic, hirayama2019materials, Gu2020substantial, si2020topotactic, choi2019role, Liu2020electronic, olevano2020abinitio, leonov2020lifshitz, Kitatani2020nickelate} performed on \ce{NdNiO2}{} reveal some similarities to the cuprates, including a similar nominal $d^9$ valence and a band of transition metal $d_{x^2-y^2}$ character crossing the Fermi level, but also some differences including the importance of Nd-derived bands, a rather different charge transfer energy, and potential relevance of other $d$-multiplet states. The similarities and differences raise the question: can one use essentially the same downfolded model to study superconductivity and other properties of the two compounds? The combination of Density Functional Theory and Dynamical Mean Field Theory (DFT+DMFT) \cite{Georges1996,Georges04,Kotliar06,Held06} has emerged as a powerful and widely used method for studying quantum materials, materials whose properties are determined by quantum many-body effects, because it combines a downfolding based on density functional theory that produces a reasonably realistic description of particular ``correlated" orbitals in the structural and chemical environment defined by the rest of the material with a many-body method that focuses on the solution of a local correlation problem. The DFT+DMFT methodology has been broadly successful in describing the physics of many quantum materials \cite{Georges04,Kotliar06,Held06,Paul18}. Motivated by this success, many authors have performed DFT+DMFT calculations on the infinite layer nickelates \cite{karp2020manybody, karp2020comparative, lechermann2019late, wang2020hunds, kang2020infinitelayer, kang2020optical, leonov2020lifshitz, ryee2019induced, werner2019nickelate, petocchi2020normal, si2020topotactic, Kitatani2020nickelate, Gu2020substantial, liu2020doping}, but with different and sometimes conflicting results. Some papers find that multiorbital physics is crucial to the correlation effects in \ce{NdNiO2}{} \cite{lechermann2019late, lechermann2020multiorbital, wang2020hunds, kang2020infinitelayer, kang2020optical, petocchi2020normal}, while others \cite{karp2020manybody, Kitatani2020nickelate} claim that the important correlation physics lies in a single self-doped band. Some papers state that \ce{NdNiO2}{} is in the Mott-Hubbard regime with little influence of charge transfer effects \cite{Kitatani2020nickelate, karp2020comparative}, while others claim that, as in the cuprates, charge transfer physics is important \cite{karp2020manybody}. Some of the differences arise from different choices of Coulomb interaction parameters, but it now appears that some of the differences arise from choices made in the downfolding procedure. In the DFT+DMFT context, discussion of downfolding issues has centered on topics related to the appropriate treatment of interactions. Important questions have included the limits of applicability of the single-site dynamical mean field approximation, the question of which Coulomb matrix elements are treated dynamically and which via a mean field or one-loop theory \cite{biermann2003first, Werner_2016, Honerkamp2018, Nilsson2017} and the ``double counting" problem of how the portion of the interactions included in the underlying density functional theory are accounted for ~\cite{liechtenstein1995fll, aichhorn2011importance, Held2007Electronic, czyzyk1994amf, park2014computing, Haule2015exact}. The issue of abstracting a one electron basis for the correlated subspace out of a more chemically realistic background electronic structure has been assumed to be less problematic. In this paper we show, using NdNiO$_2$ as an example, that the aspect of downfolding involving the choice of basis set requires more attention than has heretofore been assumed. Different methods of downfolding, all of which reproduce the underlying band structure, are shown to lead to markedly different results for many body properties of interest. We trace the origin of the differences back to different partitioning of the band theory electronic states into correlated and uncorrelated orbitals. The results suggest that the accuracy of different downfolding approximations should be revisited. Our specific results are derived in the context of the layered nickelates but the conclusions should be more generally valid. The rest of this paper is organized as follows. In section ~\ref{Methods} we review the DFT+DMFT method, describe the different downfolding methods, and provide details on the calculations performed in this paper. In section \ref{sec:orb_cont} we compare the physical content of the localized orbitals constructed in the different downfolding methods. Section \ref{sec:dmft_results} presents our results from DFT+DMFT calculations with the different downfolding methods. Finally, we offer further analysis and concluding thoughts in section \ref{sec:discussion}. \section{Methods \label{Methods}} \subsection{Theoretical Overview} In DFT+DMFT the main object of interest is the one electron Green's function \begin{equation} \hat G(r,r^\prime;\omega)=\left(\omega \mathds{1} - \hat H_{ref}- \hat \Sigma(r,r^\prime;\omega)\right)^{-1} \label{Gdef} \end{equation} with non-interacting reference Hamiltonian $\hat H_{ref}$ taken to be the Kohn-Sham Hamiltonian resulting from the solution of the equations of density functional theory and the self energy $\hat{\Sigma}$ constructed by identifying (on physical grounds) particular correlated orbitals with wave functions $\phi_\alpha^m(r-R^\alpha)$ corresponding to orbitals $m$ and localized near sites $R^\alpha$. The Green's function is calculated by making the single site DMFT approximation in which only the site-local matrix elements of the self energy between correlated orbitals are retained. For example, in a transition metal oxide the $\phi_\alpha^m$ might be chosen to represent the orbitals in the 3$d$ shell of the transition metal ion with nucleus at site $R^\alpha$. The site-local self energy $\hat\Sigma^\alpha_{QI}$ is obtained from the solution of a quantum impurity model, a $0$ space $+1$ time dimensional quantum field theory describing $m$ correlated orbitals coupled to a non-interacting bath. The interactions of the quantum impurity model are chosen to represent the matrix elements of the screened Coulomb interaction among the correlated orbitals $\phi_\alpha^m$. The one-electron parameters of the quantum impurity model are determined from a self-consistency equation relating the Green's function of the quantum impurity model $\hat G_{QI}$ to the projection onto site $\alpha$ of the full lattice Green's function. The specification of the correlated orbitals and of their coupling to the other degrees of freedom in the solid is thus fundamental to the DFT+DMFT method. Two closely related methods, referred to in the literature as ``projector" and ``Wannier" methods, are widely used for this purpose. In the projector methodology \cite{anisimov2005full, amadon2008plane}, outlined in \cite{aichhorn2009}, one predefines a set of atomic-like correlated orbitals $\ket{\tilde \phi_m^{\alpha}}$, typically chosen to be centered on positions $R^\alpha$ of particular atoms of interest with the symmetry appropriate to the correlated orbital of interest (e.g. transition metal $d$), and vanishing for $|r-R^\alpha|$ greater than some pre-set value. One then represents $\Sigma$ in the ``Kohn-Sham'' basis of eigenstates $\psi_{\nu k}(r)$ of $H_{ref}$. All practical calculations retain only a finite set of bands within a window $\mathcal{W}$ (which may depend on $k$) so the orbitals are defined as \begin{equation} \ket{\tilde{\phi}^{m}_\alpha} =\sum_{\nu,k\in \mathcal{W}(k)} \tilde P_{\nu,k}^{\alpha, m}\ket{\psi_{\nu,k}} \label{eq:Pdef1} \end{equation} with \begin{equation} \tilde P_{\nu,k}^{\alpha, m}=\braket{\tilde{\phi}^{m}_\alpha | \psi_{\nu,k}} \end{equation} The $\ket{\tilde{\phi}^{m}_\alpha}$ defined in Eq.~\ref{eq:Pdef1} are a sum over an incomplete basis and must be orthonormalized. The result after orthonomalization is a set of states $\ket{\phi^m_\alpha}$ that deviate to some degree from the originally defined atomic like states $\ket{\tilde{\phi}_m^\alpha}$, and in particular have tails that extend outside the originally defined state radius. This consideration suggests that it is often advantageous to formulate the problem in as wide an energy range as feasible, to make the $\ket{\phi_m^\alpha}$ as similar as possible to the $\ket{\tilde\phi_m^{\alpha}}$. With the $\ket{\phi_\alpha^m}$ in hand one ``upfolds'' the self energy to the Kohn Sham basis via \begin{equation} \Sigma_{\nu\nu^\prime}(k,\omega)= \sum_{\alpha m m'} P_{\nu m}^{\alpha k} \left[\Sigma_{\text{QI}}^\alpha (\omega) \right]_{mm'}\left(P_{m' \nu^\prime }^{\alpha k}\right)^\star \label{sigmaupfold} \end{equation} where the $P$ are the coefficients in an expansion of $\ket{\phi^{m}_\alpha}$ in the $\ket{\psi_{\nu,k}}$: \begin{equation} P_{\nu m}^{\alpha k}=\braket{\psi_{\nu,k}|\phi^{m}_\alpha} \label{eq:Pdef} \end{equation} so that full Green's function, Eq.~\ref{Gdef} is written \begin{equation} \left[G^{latt}(k,\omega)\right]_{\nu\nu^\prime} =\left[\omega \mathds{1}- \hat H_{ref}(k)- \hat \Sigma(k,\omega)\right]^{-1}_{\nu \nu'} \label{eq:Glatt} \end{equation} The same basis transformation may be used to ``downfold" the lattice Green's function to the basis of correlated orbitals, yielding the self-consistency equation relating the quantum impurity model Green's function $G_{QI}$ to the downfolded lattice Green's function: \begin{eqnarray} G^{mm^\prime}_{QI;\alpha}(\omega)=\sum_{\nu,\nu^\prime,k}\left(P_{m \nu }^{\alpha k}\right)^\star G_{\nu,\nu^\prime}(k,\omega)P_{\nu^\prime m'}^{\alpha k } \label{eq:SCE1} \end{eqnarray} Eq.~\ref{eq:SCE1} can be rearranged to determine the one-electron parameters of the quantum impurity model. It is important to note that the equation is formulated directly in terms of the projection of the lattice Green's function onto the pre-specified correlated orbitals and the upfolding of the impurity model self energy to the Kohn-Sham basis. While it is possible to define the projection of the Kohn-Sham Hamiltonian onto the correlated orbitals, this Hamiltonian is not used in the formalism; in particular it is not what enters the impurity model. In the Wannier methodology one first identifies a set of $N$ Kohn Sham bands that are not significantly entangled with other energy bands. If the $N$ bands are contained within an energy window that does not contain any other bands, the identification is straightforward. In the more common case in which there is no energy window that fully isolates a relevant set of bands, a disentanglement procedure ~\cite{MLWF2} is performed in which an energy window $\mathcal{W}$ containing more than $N$ bands is defined and then at each $k$ point $N$ optimized bands are constructed as linear combinations of bands inside the entanglement window via \begin{align} \ket{\psi_{\mu k}^\text{opt}} = \sum_{\nu \in \mathcal{W}} T_{\mu\nu}^{\text{dis}(k)} \ket{\psi_{\nu k}} \end{align} Following Ref. ~\cite{MLWF2} the disentangling transformation $T_{\mu\nu}^{\text{dis}(k)} $ (which may be non-unitary) is chosen to minimize a spread function that ensures $k$-point connectivity, or ``global smoothness of connection''~\cite{MLWF2} in the optimized states and also includes an orthonormalization step. Finally, $N$ Wannier states $\phi_a^I(r)$ localized at positions $R_a^I$ in unit cell $I$ are defined as \cite{MLWF2}. \begin{equation} \phi_a^I(r)=\sum_{k,\nu}U_k^{a\nu}\ket{\psi_{\nu,k}^\text{opt}(r)} e^{-ik(r-R_a^I)} \label{Wannier} \end{equation} and a number $N_c\leq N$ of these are designated as correlated orbitals. The unitary operators ${U}^{m \nu}_k$ are chosen to optimize some desired property of the Wannier functions, typically localization about the Wannier centers $R_a =\braket{\phi_a|r|\phi_a}$. In the Maximally Localized Wannier Function (MLWF) procedure \cite{MLWF1,MLWF2} one minimizes the average over all Wannier functions of the mean square positional uncertainty $\sum_a\delta R_a^2\equiv \sum_a \braket{\phi_a(r)|(r-R_a)^2|\phi_a}$ (the unit cell index is suppressed here since the localization is the same for each cell). In the Selectively Localized Wannier Function (SLWF) procedure \cite{Wang14} one minimizes the spread only of the designated correlated orbitals, and also optimizes the center position and symmetry of these states, but the procedure is otherwise the same. The projection of the Kohn-Sham Hamiltonian onto the Wannier orbitals defines an $N$ orbital tight binding model with Hamiltonian $H^{ab}_{IJ}=\braket{\phi_a^I|H_{KS}|\phi_b^J}$. An important test of the Wannierization procedure is that the eigenvalues of $H^{ab}_{IJ}$ reproduce the Kohn-Sham bands with high precision: failure to reproduce the DFT band structure means that the Kohn-Sham Hamiltonian has matrix elements between the $\ket{\phi_a}$ and Bloch functions $\ket{\psi_{n k}}$ not included in Eq.~\ref{Wannier}, so that the Wannier basis is not a complete expression of the single particle physics in the relevant energy range. In the Wannier method the dynamical mean field self consistency is expressed in terms of the Wannier Green's function \begin{equation} G^{ab}_{IJ}(\omega)=\left[\omega \mathds{1}-\hat H-\hat{\Sigma}(\omega)\delta_{IJ}\right]^{-1}_{IJab} \label{GWannier} \end{equation} where the self energy matrix has nonzero elements only in the $N_c\times N_c$ correlated orbital subspace, with these matrix elements being precisely equal to the quantum impurity model self energy. The Wannier analog of Eq. ~\ref{eq:SCE1} is then given by equating the quantum impurity model Green's function to the sub-block of the onsite $G$: \begin{equation} G_{QI}^{\tilde{a}\tilde{b}}(\omega)=G^{\tilde{a}\in N_c\tilde{b}\in N_c}_{II}(\omega) \label{SCE2} \end{equation} In the Wannier method the self consistency is thus carried out directly in the Wannier basis, with ``upfolding" to the Kohn Sham basis only required for reasons outside the scope of this paper such as computing the charge density required for the ``full charge self consistency" step of the DFT+DMFT procedure. The Wannier procedure requires construction of $H_{IJ}^{ab}$, which makes it in a sense less elegant than the projector method, but as will be seen, the form of $H_{IJ}^{ab}$ provides physical insight, and the orbitals and energies permit the use of cRPA methods for computing the interactions. Advantages of the projector method include the ability to specify in an intuitively or chemical reasonable manner the shape and location of the correlated orbitals (subject to the orthonormalization issues discussed above) and the avoidance of the multiparameter optimization required to construct the Wannier functions. Advantages of the Wannier procedure include a flexibility in determining the correlated orbital wave function (which the Wannier method will adapt, for example, to changes in lattice constant). Additionally, analysis of the intermediate tight-binding model can provide physical insight and permits the use of cRPA methods for computing the interactions. Both the Wannier and the projector methods involve a specification of the correlated orbital wave function, imposed {\em a priori} in the projector method and computed as part of the process in the Wannier approaches. The importance of the specification for the correlation physics may be seen by consideration of a simple two-site model of a $d$ orbital of energy $\varepsilon_d$, a ligand (``$p$'') orbital of energy $\varepsilon_p$, a hybridization $t_{pd}$, and a correlation term $Ud^\dagger_\uparrow d_\uparrow d^\dagger_\downarrow d_\downarrow$. The strength of the correlation effects depends on both $U$ and $(\varepsilon_d-\varepsilon_p)/t_{pd}$. On the noninteracting ($U=0$) level, the model has two levels with energy difference $\Delta E=\sqrt{\left(\varepsilon_d-\varepsilon_p\right)^2+4t_{pd}^2}$. We see that a range of $t_{pd}$ and $\varepsilon_d-\varepsilon_p$ can fit the same energy difference; pinning down the parameters requires additional information such as the $d$ content of the states. In close analogy, in the solid state case the Kohn-Sham eigenvalues and eigenfunctions do not by themselves determine the energies of the correlated orbitals or their relation to the uncorrelated orbitals. The values of the analogs of $\varepsilon_p$, $\varepsilon_d$, and $t_{pd}$ can be read off directly from the Wannier Hamiltonian, and they can be inferred from the projector results. The crucial finding of our paper is that different projector and Wannier methods which have identical bands on a DFT level produce different results for these parameters, leading to strikingly different correlation physics. \subsection{Computational details} We perform one-shot DFT+DMFT calculations for NdNiO$_2$ using different combinations of downfolding approach and energy window. The four cases we consider are: \begin{enumerate} \item MLWF: We construct 13 Wannier functions, corresponding to the Ni-$3d$, O-$2p$, Nd-$5d_{z^2}$ and Nd-$5d_{xy}$ orbitals. We use a disentanglement energy window of $\SI{-9.5}{eV}$ to $\SI{6.1}{eV}$ and a frozen window from $\SI{-9.5}{eV}$ to $\SI{1.4}{eV}$ and maximally localize the total spread of all 13 Wannier functions. \item SLWF: We construct 13 Wannier functions, corresponding to the same orbitals as the MLWF case with the same disentanglement and frozen windows. However, in this case we only minimize the spread of the 5 Ni-$3d$ Wannier functions and ignore the spread of the rest. \item Projectors in an energy window from $-\SI{10}{eV}$ to $\SI{10}{eV}$ around the Fermi energy. This guarantees that all relevant low energy states are included in the window, and projectors are quite localized. \item Projectors in an energy window from $-\SI{10}{eV}$ to $\SI{3}{eV}$ around the Fermi energy, going high enough in energy to include the self-doping band but not the tail of the Nd-$5d_{z^2}$ and Nd-$5d_{xy}$ densities of states. \end{enumerate} For comparison we also used the two Wannier function methodologies to perform calculations for the ``infinite layer" high-T$_c$ cuprate CaCuO$_2$, retaining in this case only 11 bands because the Ca-$d$ states are far above the Fermi level. For the projector cases, we perform DFT calculations using WIEN2k~\cite{Blaha2018} and the standard PBE GGA functional~\cite{PBE}. We use the experimental crystal structure with $a = b = \SI{3.92}{\textup{\AA}}$ and $c = \SI{3.31}{\textup{\AA}}$~\cite{Hwang2019} (\ce{NdNiO2}{}) and $a = b = \SI{3.86}{\textup{\AA}}$ and $c = \SI{3.20}{\textup{\AA}}$ (\ce{CaCuO2}{}). We treat the Nd-$4f$ bands as core states. The DFT calculations are converged with an $RK_{max}=7$ and with a $k$-point grid of $40 \times 40 \times 40$. We use the dmftproj software~\cite{TRIQS/DFTTOOLS} to create the projectors. For the MLWF and SLWF cases we perform the DFT calculations with Quantum Espresso \cite{QE}. We use the same structure parameters and PBE functional as with Wien2k. We use PAW pseudopotentials with the the Nd-$f$ states in the core. We use a $k$-point mesh of $16 \times 16 \times 16$, an energy cutoff of $\SI{70}{Ry}$ for the wave functions, and an energy cutoff of $\SI{280}{Ry}$ for the density and potential. We use Wannier90 \cite{wannier90_v3} to create the Wannier functions. We find that wannierization results do not depend on the DFT code; Wien2k (using the wien2wannier program \cite{wien2wannier}) and Quantum Espresso give the same results. We perform single-site DMFT calculations using the TRIQS software library~\cite{TRIQS, TRIQS/DFTTOOLS}. For \ce{NdNiO2}{} we consider two cases: a ``two orbital" theory treating the dynamical correlations among the two Ni-$e_g$ orbitals and a ``one orbital" theory treating only the $d_{x^2-y^2}$ orbital as correlated; for \ce{CaCuO2}{} we perform a ``two orbital" calculation. The calculations are one-shot in the sense that the DFT density is not further updated. For the projector cases we also run calculations with full charge self consistency, finding that imposing full charge self consistency does not alter the results significantly. For the impurity problem, we choose the interactions to be of the Kanamori form \cite{Kanamori1963}: \begin{multline} H = U \sum_m n_{m \uparrow}n_{m \downarrow} + \sum_{m<m', \sigma}[U'n_{m\sigma}n_{m'\Bar \sigma} \\ + (U' - J)n_{m\sigma}n_{m'\sigma} - Jc^\dagger_{m\sigma} c_{m\Bar \sigma} c^\dagger_{m' \Bar \sigma} c_{m' \sigma}] \\ - J \sum_{m<m'} [c^\dagger_{m\uparrow}c^\dagger_{m\downarrow}c_{m'\uparrow}c_{m'\downarrow} + H.c.] \end{multline} with $U' = U - 2J$ and $\sigma \in \{\uparrow, \downarrow \}$ refers to the spin projection. Unless otherwise noted, we use an onsite Hubbard interaction of $U = \SI{7}{eV}$ and a Hund's coupling of $J = \SI{0.7}{eV}$, considered reasonable values for nickelates \cite{Nowadnick15}, and we use a temperature of $T = \SI{290}{K}$. We solve the impurity problem using CTHYB \cite{TRIQS/CTHYB}. We use Held's double counting formula~\cite{Held2007Electronic}: \begin{equation} \Sigma_{dc} = \frac{U + (D-1)(U-2J) + (D-1)(U-3J)}{2D-1} (n - 0.5), \end{equation} where $D$ is the number of correlated orbitals and $n$ is the density of the correlated orbitals obtained from their local non-interacting Green's function. We employ the maximum entropy method \cite{TRIQS/maxent} to analytically continue the self energy. For the MLWF and SLWF cases, we also perform DMFT calculations using $U$ and $J$ values fitted from constrained random phase approximation (cRPA) calculations as implemented in VASP~\cite{Kaltak2015}. We use the Wannier orbitals as described above for the construction of the bare Coulomb interaction, and to evaluate the screening by splitting the polarization as $P = P_{\text{sub}} + P_{\text{rest}}$ where $P_{\text{sub}}$ is the polarizability for the correlated subspace (in our case, the Ni $3d$ orbitals) and $P_{\text{rest}}$ is for the rest of the system. From this, the screened interaction tensor can be calculated in a local basis from the bare Coulomb interaction tensor $\hat{V}$, as $\hat{U}(\omega) = \hat{V}/[1 - \hat{V}P_{\text{rest}}(\omega)]$. Here, we limit ourselves to the static limit $\hat{U}(\omega = 0)$ of the screened interaction. For the cRPA calculation we use a $k$-point grid of $9 \times 9 \times 9$, with an energy cutoff of 500~eV, and $\sim300$ empty bands (plus 21 occupied bands). To extract symmetrized interaction parameters we average the full four index interaction tensor assuming cubic symmetry, obtaining the parameters for the Hubbard-Kanamori Hamiltonian used for the Ni-$e_g$ orbitals~\cite{vaugier2012}. \section{Orbital content \label{sec:orb_cont}} \begin{figure}[t] \centering \includegraphics[width = \linewidth]{wanband_dx2y2_char.pdf} \caption{Energy bands obtained from diagonalizing the Wannier $H^{ab}(k)$ in the MLWF and SLWF methods. The color of the bands at each energy eigenvalue represents the amount of the $d_{x^2-y^2}$ Wannier function in the corresponding eigenvectors.} \label{fig:wanband_dx2y2} \end{figure} In this section, we examine the physical content of the Wannier and projector representations of the band theory. The Wannier methods produce an explicit representation of the Kohn-Sham bands and eigenfunctions within a given energy window and the correlated orbitals are defined as particular linear combinations of these states, permitting a straightforward analysis. Figure \ref{fig:wanband_dx2y2} shows the bands obtained from the MLWF and SLWF Hamiltonians along a high symmetry path in $k$ space, along with the $d_{x^2-y^2}$ content, indicated in pseudocolor. The energy dispersions produced in the two methods are essentially identical and are indistinguishable from the Kohn-Sham bands (not shown), but the orbital content of the bands is different in the different Wannierization schemes. The most relevant bands are the one crossing the Fermi level between $\Gamma-X-M$ and $Z-R-A$, and the weakly dispersing band at $\sim \SI{-6}{eV}$. In the MLWF case, the Ni-$d_{x^2-y^2}$ content is more concentrated in the band that crosses the Fermi level, with less weight in the $\SI{-6}{eV}$ band, while the proportions are more equal in the SLWF method. \begin{table}[b] \begin{tabular}{|l|l|l|} \hline M-point $d_{x^2-y^2}$ content & Band at $\sim 2$ eV & Band at $\sim -6$ eV\\ \hline MLWF & 0.64 & 0.36 \\ \hline SLWF & 0.49 & 0.51 \\ \hline Wien2k & 0.64 & 0.36 \\ \hline QE & 0.58 & 0.42 \\ \hline \end{tabular} \caption{$d_{x^2-y^2}$ content of the two bands with significant $d_{x^2-y^2}$ content at the $M$ point. In the MLWF and SLWF cases the orbital content is the modulus squared of the overlap of the band basis state with the $d_{x^2-y^2}$ Wannier function. In the Wien2k case, the orbital content is obtained from the projection of the band on the $3d_{x^2-y^2}$ basis state inside the Ni muffin tin. In the Quantum Espresso (QE) case, the projection is onto orthogonalized atomic wavefunctions. } \label{tab:dx2y2_content} \end{table} Table \ref{tab:dx2y2_content} quantifies the difference, showing the Ni-$d_{x^2-y^2}$ content of relevant bands at the Brillouin zone $M$ point. We compare the orbital content obtained from the MLWF and SLWF methods to that provided by the Quantum Espresso and Wien2k codes, which use a projector method. We see that the different methods, while exactly reproducing the energy dispersions, lead to quite different orbital contents. The difference arises because (as qualitatively seen in the two site model discussed in the previous section), the same dispersion may be fit by different tight binding parameters, which in turn lead to different orbital content of bands. Table \ref{tab:comb2-3} presents the $p$-$d$ energy difference (obtained from the orbital and site-diagonal terms of the Wannier Hamiltonian) and hybridization (the first neighbor $p$-$d$ hopping term in the Wannier Hamiltonian). We see as expected that the SLWF and MLWF methods trade off the values of $\varepsilon_d-\varepsilon_p$ and $t_{pd}$ to obtain comparable fits to the band structure. \begin{table}[t] \begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hline & $\varepsilon_d - \varepsilon_p$ & $t_{pd}$ & & $d_{x^2-y^2}$ & $d_{z^2}$ & $d_{xz/yz}$ & $d_{xy}$ & total \\ \hline MLWF & 4.32 & 1.28 & & 1.19 & 1.83 & 1.94 & 1.97 & 8.89 \\ \hline SLWF & 3.38 & 1.41 & & 1.32 & 1.88 & 1.96 & 1.98 & 9.11 \\ \hline Proj -10 to 10 & 2.66 & - & & 1.19 & 1.58 & 1.89 & 1.95 & 8.50 \\ \hline Proj -10 to 3 & 4.18 & - & & 1.21 & 1.71 & 1.95 & 1.99 & 8.82 \\ \hline \end{tabular} \caption{Left: Difference between the onsite energies of the Ni-$d_{x^2-y^2}$ and O-$p_\sigma$ Wannier functions ($\varepsilon_d - \varepsilon_p$) and hopping between them ($t_{pd}$). In the Wannier cases the parameters are read off directly from the appropiate entries in the real space Wannier Hamiltonian $H_{IJ}^{ab})$. In the projector cases, $\varepsilon_d - \varepsilon_p$ is determined by downfolding the Kohn-Sham Hamiltonian, but $t_{pd}$ is not defined. Right: Orbital occupancies of Ni-$d$ defined as the square of the projection of the occupied k-states as obtained from DFT onto the local orbitals summed over spin.} \label{tab:comb2-3} \end{table} \begin{figure}[b] \centering \includegraphics[width = \linewidth]{uncorrdos.pdf} \caption{Uncorrelated DOS (per spin), obtained from the imaginary part of the local Green's function in the Wannier basis without self energy.} \label{fig:uncorrdos} \end{figure} Figure \ref{fig:uncorrdos} shows the orbitally projected density of states obtained using Wannier and projector methods. The upper left panel shows the projection onto the $d_{x^2-y^2}$ orbital. Two peaks are observed, reflecting the strong hybridization of Ni-$d_{x^2-y^2}$ and O-$p_{\sigma}$ states which divides the $d$ density of states into bonding (low energy) and antibonding (near Fermi energy) portions. The different methods predict different $d$ weights in the bonding (low energy) region. Fig.~\ref{fig:uncorrdos}(b) shows the $d_{z^2}$ density of states. Around $\sim \SI{-2.5}{eV}$ a large difference between the MLWF/SLWF DOS and the projector DOS is evident, with the projector method leading to a much smaller Ni-$d_{z^2}$ density of states. Here the hybridization is not with the oxygen but with the Nd-$d$ states, as there are no oxygen states at this energy (see Fig.~\ref{fig:uncorrdos}(d)). We also see clearly that at higher energies the $d_{z^2}$ orbital is hybridized with orbitals of Nd character (not shown here) lying above the Fermi level. The different methods treat the hybridization to the higher lying states differently, and this affects the final results. Fig.~ \ref{fig:uncorrdos} (c) shows the $d_{x^2-y^2}$ DOS in a narrow frequency range around the Fermi level. In this energy range the MLWF $d_{x^2-y^2}$ DOS is slightly greater because it has more content from the Ni-derived band that crosses the Fermi level. However, the differences are minimal, indicating that in this case the choice of downfolding is important primarily in affecting the character of the states farther from the Fermi level. \begin{figure}[b] \centering \includegraphics[width = \linewidth]{delta0_w_eg.pdf} \caption{Negative imaginary part of the real frequency hybridization of the a) $d_{x^2-y^2}$ and b) $d_{z^2}$ orbitals. The inset of a) shows the $d_{x^2-y^2}$ hybridization zoomed in on the window of $-7$ to $\SI{-2}{eV}$ and with a larger y axis to show the large hybridization to O-$p_\sigma$. } \label{fig:delta0_eg} \end{figure} The differences are quantified in Table \ref{tab:comb2-3}, which shows the occupancy of the $d$ orbitals as obtained from each method. In all cases, the $t_{2g}$ orbitals are almost full, justifying the use of a two-orbital model that neglects correlations in these orbitals. All methods produce a greater than half filled $d_{x^2-y^2}$ orbital due to charge transfer from the ligand orbitals. However, the different methods lead to quantitatively different results. The $d_{x^2-y^2}$ filling is roughly the same in the MLWF and projector cases, but it is significantly greater in the SLWF case. The $d_{z^2}$ orbital is less filled in the projector than in the Wannier cases, especially the case with the larger energy window, reflecting the difference in the feature at $\sim - \SI{2.5}{eV}$ in the DOS. The projector methods do not provide an explicit definition of $t_{pd}$, but the physics is revealed by a comparison of the orbitally projected density of states shown in Figure \ref{fig:uncorrdos} to the bare hybridization function, shown in Figure~\ref{fig:delta0_eg} and defined as $\hat \Delta_0(\omega) = \omega \mathds{1} - \hat \varepsilon_0 - \hat G_{loc,0}^{-1}(\omega)$, where $\hat G_{loc,0}(\omega)$ is the uncorrelated site local Green's function projected onto the basis of correlated orbitals and $\hat \varepsilon_0$ is the onsite energy obtained from $lim_{\omega\rightarrow\infty}\left(\omega \mathds{1} - \hat G_{loc,0}^{-1}(\omega)\right)$. In the simple two level model considered above, the bare hybridization function would be $t_{pd}^2/(\omega-\varepsilon_p)$. In the general case $\hat \Delta_0(\omega)$ has poles at the energies of the levels with which the correlated orbitals are hybridized, while the integrated weight ($\int Im \Delta_0(\omega)$) gives the total hybridization strength. Examination of the hybridization function reveals pronounced differences between the methods. In particular, Fig.~\ref{fig:delta0_eg}(a), inset shows that the SLWF method yields an intrinsically less dispersive but more strongly hybridized O-$p_\sigma$ state at a noticeably lower (less negative) energy than the other methods. For these reasons the SLWF method has a substantially larger Ni-$d$-admixture in the DOS in the bonding energy range, reflecting the larger $t_{pd}$ and smaller $\varepsilon_d-\varepsilon_p$ found in this method. Conversely, looking at the O-$p_\sigma$ DOS (d), we see that the MLWF O-$p_\sigma$ DOS is smaller at the Fermi level but larger in the $\SI{-6}{eV}$ range of the oxygen band energies, again reflecting that the SLWF method assigns more from the oxygen bands to the $d_{x^2-y^2}$ Wannier function. The projector method produces results in between the SLWF and MLWF methods, although closer to MLWF, indicating a smaller effective $t_{pd}$ and larger $\varepsilon_d-\varepsilon_p$ than in the SLWF method, but not quite as small (large) as in the MLWF method. \begin{table}[h] \begin{tabular}{|c|c|c|} \hline & DOS, & $-\text{Im} \Delta_0(\omega)$ \\ \hline MLWF & 0.204 & 16.86 \\ \hline SLWF & 0.288 & 21.41 \\ \hline Proj -10 to 10 & 0.213 & 17.92 \\ \hline Proj -10 to 3 & 0.218 & 17.98 \\ \hline \end{tabular} \caption{Integral of the DOS over the energy range $-8$ to $\SI{-3}{eV}$ and hybridization function of the $d_{x^2-y^2}$ over regions of significant overlap with oxygen. } \label{tab:integrals} \end{table} The differences in hybridization strength are quantified in Table ~\ref{tab:integrals}. The integral of the $d_{x^2-y^2}$ DOS over the energy region with oxygen-derived bands from $-8$ to $\SI{3}{eV}$ is greater for the SLWF case than the MLWF case, indicating a smaller effective $\varepsilon_d - \varepsilon_p$ and larger effective $t_{pd}$ in the SLWF case, in agreement with the values in table \ref{tab:comb2-3}. Likewise, the integral of $-\text{Im} \Delta_0(\omega)$ in the region of dominant peaks from $-6$ to $\SI{-3}{eV}$ is greater for the SLWF case, also indicative of a larger effective $t_{pd}$. For both of these quantities, the values in the projector cases are in between those for the MLWF and SLWF cases but closer to the MLWF case, indicating an effective $\varepsilon_d - \varepsilon_p$ slightly smaller than the MLWF case and an effective $t_{pd}$ slight larger than the MLWF case. Thus in summary we see that the selectively localized Wannier function leads to the smallest $p$-$d$ energy difference and strongest $p$-$d$ hybridization; the MLWF leads to the largest $p$-$d$ hybridization, with the projector method intermediate, but closer to the MLWF method. The differences in mapping from orbital to band basis in the different downfolding methods also imply a difference in interaction strengths. In the DMFT approach, the interaction parameters are chosen to represent the on-site terms in the screened Coulomb interaction. They are sometimes chosen phenomenologically or to obtain agreement with experiment (for the case of perovskite nickel oxides see \cite{Nowadnick15}), and in most of the calculations reported in this paper these phenomenologically determined parameters are used. \section{DMFT Results \label{sec:dmft_results}} This section investigates the ways in which the different downfoldings lead to different results in the interacting theory. Unless otherwise specified this section presents DMFT calculations for a "two orbital" model of \ce{NdNiO2}{} in which the $d_{x^2-y^2}$ and $d_{z^2}$ orbitals are considered to be dynamically correlated and the phenomenologically determined $U = \SI{7}{eV}$ and $J = \SI{0.7}{eV}$ interaction parameters discussed above are used. For comparison, we also present ``one orbital" results for the nickelates in which only the $d_{x^2-y^2}$ orbital is considered to be correlated and a brief discussion of the analogous cuprate materials, where a one band description is more widely accepted. \subsection{Self Energy and Mass Enhancement \label{sec:dmft_sigma}} \begin{figure}[b] \centering \includegraphics[width = \linewidth]{Sigma_iw.pdf} \caption{Imaginary part of the Matsubara self energy obtained from a DMFT solution for a two orbital Ni-$e_g$ model with a Kanamori Hamiltonian with $U = \SI{7}{eV}$ and $J = \SI{0.7}{eV}$ using the downfolding methods shown in the legends.} \label{fig:Sigma_iw_comp} \end{figure} Figure \ref{fig:Sigma_iw_comp} compares the imaginary part of the Matsubara self energy of the different models for both the $d_{x^2-y^2}$ and $d_{z^2}$ orbitals. The difference in self energy corresponds to a difference in predicted correlation strength. We quantify the strength of electronic correlations by the inverse quasiparticle renormalization $Z^{-1}=1-\partial Re\Sigma(\omega\rightarrow 0)/\partial \omega$ related, in the single-site DMFT approximation, to the quasiparticle mass enhancement as $m^\star/m=Z^{-1}$. At low $T$ in a Fermi liquid regime, $Z^{-1}$ can be expressed in terms of the Matsubara self energy as $Z^{-1} = 1 - \partial \text{Im}\Sigma(i \omega_n \rightarrow 0)/\partial \omega_n$. We estimate the derivative by fitting a 4th order polynomial to the first 6 Matsubara points and taking the linear term, following ~\cite{Mravlje2011,Zingl2019}. The resulting mass enhancements are shown in Table \ref{tab:mass_and_Ueff}. \begin{table}[h] \begin{tabular}{|c|c|c|c|c|c|} \hline & $\frac{m^\star}{m}d_{x^2-y^2}$ & $\frac{m^\star}{m}d_{z^2}$ & $\frac{m^\star}{m}X$ && $U_{\text{eff}}$ $d_{x^2-y^2}$ \\ \hline MLWF & 7.6 & 1.2 &6.7 & & 3.6 \\ \hline SLWF & 3.9 & 1.3 &3.3 & & 2.8 \\ \hline Proj -10 to 10 & 4.6 & 1.3 &3.8 & & 2.5 \\ \hline Proj -10 to 3 & 5.6 & 1.3 &4.7 & & 2.5 \\ \hline \end{tabular} \caption{Left: Orbital basis mass enhancements for the $d_{x^2-y^2}$ and $d_{z^2}$ orbitals, obtained by fitting a 4th order polynomial to the first 6 Matsubara points of the imaginary part of the self energy along with the band basis mass enhancement obtained from the quasiparticle band nearest the Fermi level at the $X$ point of the band structure. Right: Effective $U$ values for the $d_{x^2-y^2}$, defined as the distance between the Hubbard peaks of the $d_{x^2-y^2}$ momentum integrated spectral function.} \label{tab:mass_and_Ueff} \end{table} Figure \ref{fig:Sigma_iw_comp} and Table ~\ref{tab:mass_and_Ueff} show that for the $d_{x^2-y^2}$ orbital the self energy at all frequencies as well as the mass enhancement is much larger in the MLWF case than the SLWF case, with projector cases being intermediate. The $d_{z^2}$ orbital mass enhancement is small in all cases. We attribute the differences in $d_{x^2-y^2}$ self energy and mass enhancement to the differences in $p$-$d$ energy splitting and $p$-$d$ hybridization strength discussed in the previous section, consistent with previous literature on the charge-transfer to Mott insulator crossover \cite{Zaanen1985band,Dang14}. Note, however, that in contrast to the situations considered in previous literature, where only hybridization to oxygen bands is relevant, for \ce{NdNiO2}{} the mass enhancements also depend on the hybridized $d_{z^2}$/Nd bands, which depend on the projection window. \begin{figure}[t] \centering \includegraphics[width = \linewidth]{bands_mass_enhancement.pdf} \caption{Pseudocolor plot of the quasiparticle mass enhancements in the band basis along a high symmetry $k$ path. In the Wannier cases the bands plotted are the same in Figure \ref{fig:wanband_dx2y2} and in the projector cases they are the Wien2k DFT bands. The color corresponds to the mass enhancement of the DFT band determined from upfolding the self energy to the band basis. The self energy is obtained from a DMFT solution for a two orbital Ni-$e_g$ model with a Kanamori Hamiltonian with $U = \SI{7}{eV}$ and $J = \SI{0.7}{eV}$} \label{fig:mass_band_basis} \end{figure} One important caveat is that that the values reported in Table \ref{tab:comb2-3} are ``orbital basis'' mass enhancements, determined from the diagonal elements of the projection of the self energy operator onto the correlated orbitals. A quantity of more direct relevance to the low energy physics is the ``band basis" mass enhancement, which is proportional to the admixture of the uncorrelated orbitals in the band of interest and gives the renormalization of the quasiparticle bands with respect to the DFT bands. For the MLWF and SLWF methods, we obtain the band basis mass enhancement by transforming the self energy to the band basis using the eigenvectors of the uncorrelated Wannier Hamiltonian $H(k)$. For the projector methods, we use the projectors to upfold the self energy back to the Kohn-Sham basis (Eq. \ref{sigmaupfold}). Figure \ref{fig:mass_band_basis} shows the band basis mass enhancement along the same high symmetry path on which the bands are plotted in Figure \ref{fig:wanband_dx2y2}, and Table~\ref{tab:comb2-3} gives the value of the band basis mass enhancement for the near Fermi surface state at the X point. In the band basis, the difference between the MLWF and SLWF cases is even greater than in the orbital basis, for the same reason-- in the MLWF case there is less admixture of oxygen in the near Fermi surface band so the $d$ self energy has a greater effect on the dispersion. Another potential caveat is that different choices for downfolding may lead to different interaction parameters. To investigate the basis dependence of the interaction parameters we have used the ``constrained Random Phase Approximation" (cRPA) approach to estimate the Coulomb parameters corresponding to the two Wannier downfoldings. This approximation is believed to underestimate the true interactions, but gives trends correctly. Symmetrizing our compouted screened Coulomb tensor over the two active orbitals gives parameters $U \approx \SI{3.6}{eV}$ and $J \approx \SI{0.7}{eV}$ for MLWF and $U \approx \SI{2.9}{eV}$ and $J \approx \SI{0.7}{eV}$ for SLWF. We observe that although the SLWF correlated orbitals are smaller (less spatial extent) than the MLWF orbitals, the SLWF approach yields smaller interaction parameters than does the MLWF approach, because the dominant effect on the interaction parameters is from screening, which is stronger for the smaller $\varepsilon_d-\varepsilon_p$ found in the SLWF method. Use of the cRPA interaction parameters (smaller for SLWF and for MLWF) yields a Ni-$d_{x^2-y^2}$ orbital mass enhancement of $2.1$ for MLWF and $1.4$ for SLWF, corresponding to a factor of almost $3$ in correlation contributions $m^\star/m-1$. Thus the difference in interaction parameters arsising from differences in downfold amplify, rather than decrease, the downfolding-induced differences in self energy. \subsection{Spectral function \label{sec:dmft_spectral}} \begin{figure}[h] \centering \includegraphics[width = \linewidth]{Aw.pdf} \caption{Momentum integrated spectral functions per spin obtained from DMFT solutions for a two orbital Ni-$e_g$ model with a Kanamori Hamiltonian with $U = \SI{7}{eV}$ and $J = \SI{0.7}{eV}$ using the downfolding methods shown in the legends.} \label{fig:Aw} \end{figure} Figure \ref{fig:Aw} shows the orbitally resolved momentum integrated spectral function ${\hat A}(\omega) = i\left[{\hat G}(\omega) - {\hat G}(\omega)^\dag\right]/2\pi$ for the $d_{x^2-y^2}$ and $d_{z^2}$ orbitals for a range of energies not too far from the chemical potential. The $d_{x^2-y^2}$ orbital (left panel) exhibits a three peak structure similar to that found in the single-band Hubbard model at moderate correlation strength. Interpreting the structure in terms of a low energy effective model, we identify the electron removal peak at $\omega\approx \SI{-1.5}{eV}$ with the lower Hubbard band, the broader peak at $\sim \SI{2}{eV}$ with the upper Hubbard band, and the central peak near $\omega=0$ with the quasiparticle band. The energy separation between the lower and upper ``Hubbard peaks", shown in Table \ref{tab:mass_and_Ueff} then provides an estimate for the effective interaction $U_{eff}$ characterizing an effective low energy model. While all methods provide qualitatively similar spectral functions, in the MLWF case the Hubbard peaks are further away from each other, indicating a greater effective Hubbard repulsion due to the greater $\varepsilon_d-\varepsilon_p$ and smaller $t_{pd}$ and consistent with the larger mass enhancement found in the previous subsection. The spectral function for the $d_{z^2}$ orbital shows a weak tail at energies above the chemical potential, a sharp peak at $\sim \SI{-1}{eV}$ and a broad feature in the range $\sim -2$ to $\sim \SI{-4}{eV}$. Again all methods produce the same qualitative behavior, but differ quantitatively. In the projector cases the peaks are closer to the chemical potential and there is more weight above the Fermi level than in the Wannier cases. \begin{figure}[h] \centering \includegraphics[width = \linewidth]{Akw.png} \caption{Pseudocolor plots of the momentum resolved spectral functions $A(k,\omega)$ obtained from DMFT solutions for a two orbital Ni-$e_g$ model with a Kanamori Hamiltonian with $U = \SI{7}{eV}$ and $J = \SI{0.7}{eV}$.} \label{fig:Akw} \end{figure} Figure \ref{fig:Akw} shows the momentum resolved spectral function $A(k,\omega)= -\text{Tr}\left[\text{Im }\hat{G}(k,\omega)\right]/\pi$ along a high symmetry path in the Brillouin zone. The bands with significant correlation effects appear more diffuse because of the larger imaginary part of the self energy. Comparison to Fig ~\ref{fig:Aw} shows that the correlated band crossing the Fermi level (e.g. between X and M) arises from the $d_{x^2-y^2}$ orbital. Corresponding to the different mass enhancements, this band is renormalized the most in the MLWF case (see e.g. the distance below the Fermi level of the band at the Z point), then the projector cases, and then the SLWF case. The sharp peak visible in the $d_{z^2}$ density of states in Fig. ~\ref{fig:Aw} arises from the almost dispersionless correlated band visible from Z to A, while the features in the $-\SI{2}{eV}$ to $\SI{-4}{eV}$ range arise from the more diffuse features seen between $\Gamma$ and M in the momentum-resolved figures. The energy position and relative sharpness of these features depends on the downfolding method, providing the possibility of experimental tests of different downfoldings. \subsection{Orbital Occupancies \label{sec:dmft_orb_occ}} The occupancy of the different orbitals has been viewed as an important diagnostic of correlation physics. For example, in a model with a single relevant orbital, the orbital is more Mott-Hubbard like as it gets closer to half filling, while an occupancy noticeably greater than half filling implies important charge transfer effects. Conversely, a significant probability of occupation (by holes) of more than one orbital is a necessary condition for Hund's metal physics. Here we consider how the calculated orbital occupancies depend on the downfolding methodology. \begin{table}[t] \begin{tabular}{|c|c|c|c|c|c|c|c|} \hline & $d_{x^2-y^2}$ & $d_{z^2}$ && LS N=2 & HS N=2 & N=3 & N=4 \\ \hline MLWF & 1.13 & 1.91 && 0.04 & 0.05 & 0.78 & 0.13 \\ \hline SLWF & 1.27 & 1.93 && 0.03 & 0.02 & 0.69 & 0.26 \\ \hline Proj -10 to 10 & 1.14 & 1.65 && 0.11 & 0.15 & 0.64 & 0.09 \\ \hline Proj -10 to 3 & 1.15 & 1.81 && 0.07 & 0.08 & 0.72 & 0.12 \\ \hline \end{tabular} \caption{Left: Orbital occupancies of the correlated orbitals, obtained from the Matsubara Green's function. Right: Occurrence probabilities of multiplet configurations obtained from the impurity density matrix. LS stands for low spin ($s = 0$) and HS stands for high spin ($s = 1$).} \label{tab:dmft_occ} \end{table} The left side of Table \ref{tab:dmft_occ} shows the orbital occupancies, obtained directly from the impurity Green's function $\hat G_{QI}(i\omega_n$) without analytic continuation. Comparison to Table \ref{tab:comb2-3} shows that in all methods the main effect of adding correlations is to drive the $d_{x^2-y^2}$ orbital closer to half filling while the $d_{z^2}$ orbital gets more full. However, the $d_{z^2}$ orbital is significantly less full in the projector cases than in the Wannier cases, with the filling depending on the energy window employed and being smallest for the wider window extending to $\SI{10}{eV}$. This demonstrates the importance of the hybridization to the Nd orbitals at positive energy. The right side of Table \ref{tab:dmft_occ} shows the probabilities of different multiplet configurations of the correlated states obtained from the impurity density matrices determined from the CTHYB solver. Important quantitative differences are evident. In all cases the $N=3$ configuration is dominant, but in the Wannier cases the fluctuation into $N=4$ (fully occupied $e_g$, spin singlet) are larger than the fluctuations into $N=2$ (2 holes in the $e_g$; potential high spin state), whereas in the projector methods the situation is opposite. These differences have been used to argue for and against the relative importance of Hund's and charge-transfer physics. \cite{karp2020manybody, karp2020comparative, wang2020hunds, kang2020optical, petocchi2020normal, liu2020doping} \subsection{One vs. Two Orbital Results \label{sec:dmft_one_orb}} One way to approach the physics of a complicated material such as the multilayer nickelates is to attempt to define a ``minimal model" of the correlation effects. The much larger value of the $d_{x^2-y^2}$ self energy than the $d_{z^2}$ self energy suggests that a minimal model might involve only one correlated orbital. Insight into this possibility may be obtained by comparing results obtained from a model with multiple correlated orbitals to those obtained from a model with only one correlated orbital. \begin{figure}[h] \centering \includegraphics[width = .8 \linewidth]{1_vs_2_sigma_iw.pdf} \caption{Comparison of imaginary part of the Matsubara self energy of the $d_{x^2-y^2}$ orbital obtained from two orbital DMFT calculations (solid lines) to self energy obtained from one orbital DMFT calculation (dashed lines) with downfolding methods unchanged. } \label{fig:1v2} \end{figure} We use exactly the same downfolding, definition of correlated orbitals, and interaction $U$ as in our previous two orbital DMFT calculations to perform ``one orbital" DMFT calculations in which only the $d_{x^2-y^2}$ orbital is treated as correlated. Figure ~\ref{fig:1v2} compares the resulting $d_{x^2-y^2}$ self energies, and Table~\ref{tab:1vs2mass} compares the mass enhancements. In the SLWF case, the $d_{x^2-y^2}$ self energy and mass enhancement are not changed considerably by including the $d_{z^2}$ orbital, presumably because the $d_{z^2}$ orbital is almost completely full. In the MLWF and projector cases, there is a significant difference in the self energies and mass enhancements between the one and two orbital results. Referring to Tables ~\ref{tab:dmft_occ} and ~\ref{tab:1vs2mass} we attribute the differences to a combination of the difference from half filling of the $d_{x^2-y^2}$ orbital (with the larger occupancy in the SLWF case indicating a greater relevance of charge transfer physics) and (especially in the projector cases) greater number of holes in the $d_{z^2}$ orbital. The SLWF results imply that correlation physics related to the $d_{z^2}$ orbital may be neglected without adversely affecting the accuracy of the results; the other methods would suggest that this is not the case. \begin{table}[b] \begin{tabular}{|l|l|l|l|l|} \hline & $\frac{m^\star}{m}$ 1 orb & $\frac{m^\star}{m}$ 2 orb& $n_{x^2-y^2}$ 1 orb& $n_{x^2-y^2}$ 2 orb\\ \hline MLWF & 11.0 & 7.6 &1.14 &1.19 \\ \hline SLWF & 3.8 & 3.9 &1.29 &1.32 \\ \hline proj -10 to 10 & 9.7 & 4.6 &1.14 &1.19 \\ \hline proj -10 to 3 & 9.7 & 5.6 &1.16 &1.21 \\ \hline \end{tabular} \caption{Comparison of the mass enhancement and filling of $d_{x^2-y^2}$ orbital in the one and two orbital DMFT calculations on \ce{NdNiO2}{}.} \label{tab:1vs2mass} \end{table} \subsection{Cuprate results \label{sec:dmft_cuprate}} The layered $d^9$ nickelates of primary interest in this paper have a potentially rich physics associated with multiple bands at the Fermi surface and important ligand states lying both above and below the strongly correlated $d$ states. In this subsection we examine the extent to which our qualitative considerations apply also to the electronically simpler cuprate system, where only the $d_{x^2-y^2}$ is correlated (the $d_{z^2}$ orbital is to good approximation completely full) but charge transfer to oxygen is also relevant. In this examination, a difficulty immediately arises. A straightforward application of the DFT+DMFT methodology outlined above predicts a rather weakly correlated system, essentially because $\varepsilon_d-\varepsilon_p$ is so small in magnitude that the $d$-$d$ interaction $U$ is irrelevant. Previous work has argued that straightforward application of the DFT+DMFT method is not appropriate, essentially because the DFT approximation predicts that the oxygen levels are about $\SI{1}{eV}$ closer to the Fermi level than they are in practice. Adjusting the $p$-level energy ``by hand" to match photoemission experiments \cite{Wang12} provides cuprate correlation physics in better agreement with experiment and we follow this route here. \begin{table}[] \begin{tabular}{|c|c|c|c|c|c|c|} \hline & $\frac{m^\star}{m}$ $d_{x^2-y^2}$ & & $n$ $d_{x^2-y^2}$ & & N=3 & N=4 \\ \hline MLWF & 1.9 & & 1.41 & & 0.56 & 0.42 \\ \hline SLWF & 1.5 & & 1.52 & & 0.45 & 0.54 \\ \hline \end{tabular} \caption{Results for the $d_{x^2-y^2}$ orbital from a two orbital calculation on \ce{CaCuO2}{} where $\varepsilon_p$ is reduced by \SI{1}{eV}. Left: Mass enhancement Middle: Orbital occupancy. Right: Occurrence probabilities of multiplet configurations.} \label{tab:cuprate_epdown_dx2y2} \end{table} Table ~\ref{tab:cuprate_epdown_dx2y2} shows that the phenomenon found in theories of the nickelate materials occurs also in theories of cuprates: the MLWF method yields substantially larger $d_{x^2-y^2}$ mass enhancements than does the SLWF method. Examination of the Wannier fits (not shown) reveals that origin is the same--the MLWF parametrization corresponds to a larger $\varepsilon_d-\varepsilon_p$ and smaller $t_{pd}$ and hence to stronger correlations. The occupancy analysis shown in Table ~\ref{tab:cuprate_epdown_dx2y2} confirms this conclusion, revealing a larger covalence (more $N=4$ weight) for SLWF than for MLWF. It is important to note, however, that in contrast to the nickelate case, where the different methods point towards different underlying physics, in the cuprate case both the MLWF and the SLWF methods paint the same picture of a charge transfer material, different only in quantitative aspects. \section{Discussion \label{sec:discussion}} Quantum embedding methods approach the correlated electron problem by defining a subset of ``correlated orbitals" whose contributions to the physics are determined by the use of a high level many body method and are self-consistently embedded into a more complex electronic structure specified by an inexpensive, lower-level method. In the DFT+DMFT approach the correlated orbitals are identified as partly filled, atomic-like orbitals relatively tightly localized to particular ions. Implementation of this appealing idea encounters the difficulty that the intuitively clear idea of a ``transition metal $d$ orbital" cannot be defined unambiguously because an atomic-like state is not an eigenstate of any reasonable single particles approximation to the electronic Hamiltonian. What must be done, in effect, is to define a single particle basis that includes atomic-like states with the desired spatial structure and enough other states so that the projection of the Kohn-Sham Hamiltonian onto this basis reproduces the DFT band structure. Different methods have been used to define the correlated orbitals and select the additional states; see Sec.~\ref{Methods} for a discussion of the principal techniques. While the issue seems not to have been extensively investigated (see \cite{park2014computing} for an exception), the consensus in the field has been that all methods that produce correlated states with approximately the desired spatial structure and reproduce the DFT bands accurately are approximately equally good. This paper investigates the issue carefully and finds that this is not at all the case, because the different methods in effect lead to different partitioning of the band states into correlated and uncorrelated components, and these differences in partitioning have a substantial effect on the computed correlation physics. Focusing on one system of intense current interest, the layered nickelate \ce{NdNiO2}{}, this paper performs a comparative study of the implications for the many body physics of the methodology used to construct the correlated orbitals. In the layered nickelates the important correlation physics is believed to relate to states arising from the Ni $d_{x^2-y^2}$ and perhaps also from $d_{z^2}$ orbitals. Straightforward quantum chemical considerations suggest that the primary valence configuration of the Ni is $d^9$ with one hole in the $d_{x^2-y^2}$ orbital, but other configurations may also be important. Currently debated questions include the relevance of ``Hund's metal" physics arising from high-spin $d^8$ (two holes, one in $d_{x^2-y^2}$ and one in $d_{z^2}$), the importance of correlation physics in the Ni/Nd hybrid bands crossing the Fermi level, and the relevance of valence fluctuations involving the O-${p}$. In addressing these questions, the definition of the Ni-$d$ states and their hybridization to other orbitals is evidently crucial. We use different variants of the two most widely used techniques, the projector and Wannier methods discussed in detail in Sec.~\ref{Methods}, to compute various physical quantities, while keeping everything else the same. In Sec.~\ref{sec:dmft_sigma} we show that different methods lead to almost factor-of-two differences in the predicted renormalization factor (``mass enhancement"). In Sec. ~\ref{sec:dmft_orb_occ} we show that the different methods also give quite different predictions for the relevance of multiorbital (high spin, ``Hund's metal") physics, and this conclusion is reinforced in Sec. ~\ref{sec:dmft_one_orb} which shows that the different methods give also very different results for the changes in many body properties between models with two and one correlated orbitals. The issues are not specific to the \ce{NdNiO2}{}: Sec. ~\ref{sec:dmft_cuprate} shows that similar results are obtained in a model of the copper-oxide superconductor \ce{CaCuO2}{}, where only one correlated orbital is relevant and charge transfer physics plays a larger role. Before proceeding to the discussion of origin and implications of the results, we dispose of two side issues. First, the results mentioned in the previous paragraph all pertain to properties of the correlated orbitals as defined in the different methodologies. The correlated orbitals themselves are only auxiliary quantities used in intermediate stages of computations of experimental observables. Physically meaningful results are experimental observables such as the mass enhancement, relative to the underlying DFT mass, of the theoretically derived quasiparticle bands (see Fig.~\ref{fig:Akw}), which are measurable in angle-resolved photoemission. Table ~\ref{tab:mass_and_Ueff} shows that the differences between these ``band basis'' mass enhancements are actually greater than the orbital basis self energy renormalizations. One may similarly consider the many-body density of states (local spectral function) measurable in angle-integrated photoemission and analyzed in Sec. ~\ref{sec:dmft_spectral}. We find that large differences between methods also appear in the local spectral function. Of special interest are the upper Hubbard feature around $\SI{2}{eV}$ and the strong shift of the as Ni-$d_{z^2}$ characterized band between the different methods (see Fig.~\ref{fig:Aw}). Second, most of our calculations investigate variations at fixed values of the interaction parameters, while different specifications of the correlated orbitals also imply differences in the interaction parameters governing the physics of these orbitals, which might compensate to some degree for the differences in orbital specification. We examine this issue in Sec. ~\ref{sec:dmft_sigma}, which presents results of cRPA calculations of effective interaction parameters for different downfolding schemes. We find that the differences in interaction parameters arising from differences in specification of correlated orbitals are such as to enhance the differences between methods. In summary, different prescriptions for defining correlated orbitals lead to different results for physically measurable quantities. We now discuss the interpretation and implications of our results. Sec.~\ref{sec:orb_cont} shows that the different parameterizations lead to quite different fillings of the correlated orbitals, already on the DFT level. Orbital filling is an important determinant of correlation physics; for example, Hund's metal physics requires at least two partially filled orbitals while Mott physics is most pronounced if there is one nearly half filled correlated orbital. We find that the MLWF Ni-$d_{x^2-y^2}$ occupation is much closer to half-filling than the SLWF Ni-$d_{x^2-y^2}$ occupation, and is thus more likely to be found more correlated. Both projector approaches have very similar Ni-$d_{x^2-y^2}$ occupation compared to MLWF. However, the Ni-$d_{z^2}$ content is lower for projectors, depending on the energy window, which could be an indicator that projectors fail to capture interstitial contributions in strongly hybridized systems. This is observed both with Wien2k and VASP projectors. The differences arise because different constructions of the correlated orbitals correspond to different embeddings of the correlated orbital in the underlying band theory, or in other words to different overlaps of correlated orbitals with Kohn-Sham eigenfunctions. To be explicit, for transition metal oxides such as \ce{NdNiO2}{}, important parameters include the energy level difference between oxygen $p$ and transition metal $d$ orbitals $\varepsilon_d-\varepsilon_p$, and the $p$-$d$ hybridization $t_{pd}$ (see Tab.~\ref{tab:comb2-3}) and (see Tab.~\ref{tab:integrals}). Different constructions of the correlated orbitals lead to equally accurate parametrizations of the calculated band structures but with drastically different values of $\varepsilon_d-\varepsilon_p$ and $t_{pd}$. Furthermore, we find that the hybridization to the Nd-$d$ orbitals right above the Fermi level is strongly method dependent (see Fig.~\ref{fig:delta0_eg}). We emphasize that this behavior is found both for VASP and Wien2K band theory codes. Section ~\ref{sec:dmft_orb_occ} shows that the different methods lead to differences in the multiplet occurrence probabilities in the interacting theory. The multiplet occurrence probabilities are often used to gauge the nature of correlations. In a typical one orbital Mott-Hubbard system we expect a dominance of $N = 3$ with roughly equal amounts of $N = 4$ and low spin $N = 2$. In a charge transfer material, we expect more $N = 4$ than $N = 2$. This is seen in the MLWF case and to a much greater extent in the SLWF case, but not in the projector cases. Conversely, a large amount of high spin $N = 2$, seen in the projector cases but not the Wannier cases, points to an importance of Hund's correlations. Using these results to classify the material will therefore lead to different conclusions based on the downfolding method employed, and may explain the differences in classification found in the literature. Likewise, our results in Section \ref{sec:dmft_one_orb} show that comparing one and two orbital calculations using the different methods leads to different results on the importance of multiorbital effects. The results presented in this paper, along with the existing discussions in the literature around the issues of value and frequency dependence of interaction parameters and the double counting correction, underscore the fact that the DFT+DMFT methodology requires choices at various points in the calculation. As noted in other contexts \cite{Nowadnick15}, experiment can to some degree help to guide the required choices. Experimental probes involving form factors that can distinguish between $d$ and $p$ orbitals can help pin down orbital content of different bands. Further, differences in e.g. the position of the $d_{z^2}$ orbital relative to the chemical potential (see Fig. ~\ref{fig:Aw}) and broadening of the $\SI{-3}{eV}$ band (Fig.~\ref{fig:Akw}) also distinguish the methods. On the theoretical side, our work highlights the importance of the development of methods \cite{Lan16,Zhu20} which treat more of the orbitals as correlated and include more of the matrix elements of the Coulomb interaction. While not all of these calculations are yet in a position to treat the strong correlation problem, comparison even in a more weakly correlated limit will provide insight. Further, as a simple benchmark, in new situations the robustness of the results with respect to different downfolding methods should be verified. It is important to emphasize that the differences we highlight are in many cases quantitative rather than qualitative. For example, all methods place the cuprate materials firmly in the class of charge transfer compounds, whereas the nickelate materials are closer to the Mott-Hubbard regime. Further, the results presented here are important only for ``wide window" calculations involving both correlated and uncorrelated orbitals, and are more significant for materials such as the layered nickelates that exhibit a rich interplay between strongly and weakly correlated orbitals and between single band and multiband effect. In cases such as Sr/Ca$_2$RuO$_4$ where the correlated bands are to good approximation disentangled from the other bands and a low energy theory involving only the correlated bands may be constructed, the physics is independent of the method used to construct the correlated orbitals. The success of DFT+DMFT in many contexts motivates further research to determine the optimal downfolding approach for different physical contexts. Identification of experimental observables that will distinguish different downfoldings will also be valuable, as would be the determination of quantities that are robust with respect to choice of downfolding. \section{Acknowledgements} J.K. and A.J.M. acknowledge funding from the Materials Sciences and Engineering Division, Basic Energy Sciences, Office of Science, US DOE. We thank F. Lechermann, S. Beck, M. Zingl, A. Botana, and A. Georges for very helpful discussions. The Flatiron Institute is a division of the Simons Foundation.
\section{Introduction} Pretrained language models (PLMs) have reshaped the way AI systems process natural language~\citep{devlin2019bert, peters2018deep, radford2019language, raffel2019t5}. Before task-specific training, it is now a common practice to first pretrain the deep neural networks, often Transformers~\cite{vaswani2017attention}, via a self-supervised token-level language modeling task~\cite{lewis2019bart,liu2019roberta,raffel2019t5}. Whether it is autoregressive~\cite{radford2019language}, permutational~\cite{yang2019xlnet}, or masked language modeling (MLM)~\cite{devlin2019bert}, the Transformer networks are pretrained to recover some omitted tokens using the rest of input texts. Then the language semantics captured during pretraining are conveyed to downstream tasks via the pretrained Transformer parameters~\cite{ clark-etal-2019-bert, clark2020transformers, roberts2020much}. Recent research~\cite{gao2019representation, gao2021simcse,kaplan2020scaling, reimers-2019-sentence-bert} observed several challenges in this self-supervised learning framework. One challenge is its efficiency. After pretrained for a while with the standard token-level language modeling, the networks have already captured the basic language patterns, making a large fraction of pretraining signals no longer informative. Linear improvement in the model effectiveness often requires exponentially more pretraining compute and parameters~\cite{kaplan2020scaling}, which is unsustainable. Another challenge is the anisotropy of text representations from pretrained models. The sequence representations from many pretrained models are quite irregular~\cite{li2020bertflow,reimers-2019-sentence-bert} and require dedicated fine-tuning approaches to be useful in sequence-level applications~\cite{luan2020sparsedense, xiong2020approximate}. Clark et al.~\cite{clark2020electra} proposed a new pretraining strategy, ELECTRA, that uses an auxiliary language model (``generator'') to replace tokens in input texts and pretrains the main Transformer (``discriminator'') to detect replaced tokens. This improves the pretraining efficiency and effectiveness, but pretraining via binary classification hinders the model's usage on applications requiring language modeling capability (\emph{e.g.}, prompt-based learning~\cite{gao2021making,le2021many,schick2020small}). It could further distort the representation space as the Transformers are pretrained to output the same ``non-replacement'' label for all actual tokens. In this paper, we present a new self-supervised learning approach, {COCO-LM}\xspace, that pretrains Language Models by COrrecting and COntrasting corrupted text sequences. Following ELECTRA-style pretraining, {COCO-LM}\xspace employs an auxiliary model to corrupt the input texts, upon which it introduces two new pretraining tasks for the main Transformer, one at token level and one at sequence level. The token-level task, corrective language modeling ({CLM}\xspace), pretrains the main Transformer to detect and correct the tokens in the corrupted sequences. It uses a multi-task setup to combine the benefits of replaced token detection and language modeling. The sequence-level task, sequence contrastive learning ({SCL}\xspace), pretrains the model to align text sequences originated from the same source sequence and enforce uniformity of the representation space. In our experiments on GLUE~\citep{wang2018glue} and SQuAD~\cite{rajpurkar2016squad} benchmarks, {COCO-LM}\xspace not only outperforms state-of-the-art pretraining approaches in effectiveness, but also significantly improves the pretraining efficiency. Under the same setting, {COCO-LM}\xspace matches the MNLI accuracy of RoBERTa and ELECTRA with $60\%$ and $50\%$ of their GPU hours in pretraining, respectively. When pretrained with the same number of steps, {COCO-LM}\xspace outperforms the previous best models by $1+$ GLUE average points under the standard base/large-sized model evaluations. With $367$ million parameters, {COCO-LM}\xspace{}$_\text{Large++}$ reaches the MNLI accuracy of Megatron$_\text{3.9B}$~\cite{shoeybi2019megatron}, one of the largest BERT-style model with $3.9$ billion parameters. Our analyses provide further insights on the advantage of {CLM}\xspace in learning token representations and its effectiveness in prompted-based fine-tuning, as well as the benefit of {SCL}\xspace in ensuring alignment and uniformity in the representation space for better generalization\footnote{Code and pretrained models can be found at \url{https://github.com/microsoft/COCO-LM}.}. \section{Related Work} Various token-level tasks have been used to pretrain language models. The most classic auto-regressive language modeling is to predict a token given all the previous tokens, or all subsequent ones~\cite{peters2018deep,radford2019language}. BERT uses masked language modeling (MLM) that recovers randomly masked tokens using the rest input. XLNet proposes permutation language modeling that conducts MLM in an autoregressive manner~\citep{yang2019xlnet}. UniLM uses pseudo MLM which unifies autoregressive and MLM tasks~\citep{unilmv2,dong2019unified}. Sequence-level tasks are also explored, which often pretrain the model to predict certain co-occurrences of sequence pairs. For example, next sentence prediction~\citep{devlin2019bert}, sentence ordering~\citep{lan2019albert} and previous sentence prediction~\citep{wang2019structbert} concatenate two sentences (either correlated or random), and train the Transformer to classify the pair. Empirically, MLM is still among the most effective tasks to pretrain encoders~\cite{lewis2019bart, liu2019roberta, raffel2019t5}. RoBERTa~\cite{liu2019roberta} found the sentence-level task in BERT not benefitial and discarded it. BART~\cite{lewis2019bart} and T5~\cite{raffel2019t5} both observed that MLM is often the most effective task. The empirical advantages of other pretraining tasks are more task-specific, for example, entity related masks for knowledge intensive applications~\cite{ guu2020realm,joshi2019spanbert}, and sequence-level tasks for long form text modeling~\cite{ravula2020etc}. Instead of randomly altering texts, ELECTRA~\cite{clark2020electra} uses a smaller auxiliary Transformer pretrained by MLM to replace some tokens in the text sequences using its language modeling probability, and pretrains the main Transformer to detect the replaced tokens. ELECTRA achieves state-of-the-art accuracy in many language tasks~\cite{clark2020electra}. Later, Clark et el.~\citep{clark2020pre} developed ELECTRIC, which pretrains encoders by contrasting original tokens against negatives sampled from a cloze model. ELECTRIC re-enables the language modeling capability but underperforms ELECTRA in downstream tasks. Our work is also related to contrastive learning which has shown great success in visual representation learning~\cite{chen2020simple,he2019momentum,oord2018representation}. Its effectiveness of in language is more observed in the fine-tuning stage, for example, in sentence representation~\cite{gao2021simcse}, dense retrieval~\cite{xiong2020approximate}, and GLUE fine-tuning~\cite{gunel2020supervised}. \section{Method} We present the preliminaries of PLMs, their challenges, and the new {COCO-LM}\xspace framework. \subsection{Preliminary on Language Model Pretraining} In this work we focus on pretraining BERT-style bidirectional Transformer encoders~\cite{devlin2019bert} that are widely used in language representation tasks. We first recap the masked language modeling (MLM) task introduced by BERT~\cite{devlin2019bert} and then discuss the pretraining framework of ELECTRA~\cite{clark2020electra}. \textbf{BERT Pretraining} uses the masked language modeling task (MLM)~\cite{devlin2019bert}, which is to take an input sequence $X^\text{orig}=[x^\text{orig}_1,\dots,x^\text{orig}_i,\dots,x^\text{orig}_n]$, with $15\%$ random tokens replaced by $\texttt{[MASK]}$ symbols (\textit{e.g.}, the $i$-th token), and train the model to predict the original tokens at the masked positions: \begin{align*} \left[ x^\text{orig}_1, \dots, \texttt{[MASK]}_i, \dots, x^\text{orig}_n \right] \xrightarrow{\text{Transformer}} \bs{H} \xrightarrow{\text{MLM Head}} p_{\text{MLM}} (x | \bs{h}_i), \end{align*} where the Transformer generates contextualized representations $\bs{H} = \{\bs{h}_i\}_{i=1}^n$. The MLM Head predicts the masked token from the vocabulary $V$ using the hidden representation $\bs{h}_i$ and token embeddings $\bs{x}$. The pretraining minimizes the MLM loss on the set of masked positions $\mathcal{M}$. Specifically, \begin{align*} p_{\text{MLM}} (x | \bs{h}_i) = \frac{\exp(\bs{x}^\top \bs{h}_i)}{\sum_{x_t \in V} \exp(\bs{x}_t^\top \bs{h}_i)}; \quad \mathcal{L}_\text{MLM} = \mathbb{E} \left( - \sum_{i\in \mathcal{M}} \log p_{\text{MLM}} \left( x_i^\text{orig} \big| \bs{h}_i \right) \right). \end{align*} \textbf{ELECTRA Pretraining} uses two Transformers, a ``generator'' pretrained by MLM, and a ``discriminator'' pretrained using the generator's outputs. We refer them as \textit{auxiliary} and \textit{main} Transformers, as the former is discarded after pretraining and the latter may be trained by ``generative'' tasks too. The auxiliary model outputs a corrupted sequence $X^\text{MLM}$ by sampling from its predicted probability: \begin{align} x_i^\text{MLM} \sim p_{\text{MLM}} \left(x | \bs{h}_i \right),\, \text{if $i \in \mathcal{M}$ }; \quad x_i^\text{MLM} = x_i^\text{orig},\, \text{else.} \label{eq:corrupt} \end{align} The masked positions are replaced by sampled tokens considered plausible in context by the auxiliary Transformer, which are more deceiving than random replacements. ELECTRA uses a skinnier auxiliary network (\textit{e.g.}, hidden dimension is $1/3$ of the main model) to control the signal difficulty. The main Transformer takes $X^\text{MLM}$ and classifies the replaced tokens: \begin{align*} X^\text{MLM} \xrightarrow{\text{Main Transformer}} \bs{H} \xrightarrow{\text{RTD Head}} p_\text{RTD}\left( \mathbbm{1}(x_i^\text{MLM} = x_i^\text{orig}) \big| \bs{h}_i \right), \end{align*} where $\mathbbm{1}(\cdot)$ is the indicator function. The Replaced Token Detection (RTD) head uses a sigmoid linear layer to output the binary probability, and the main Transformer is trained with binary cross entropy loss. The RTD task is trained on all tokens instead of masked ones and improves efficiency. The two Transformers are pretrained jointly. The auxiliary model gradually generates more realistic replacement tokens and the main model learns to better detect them. This forms a natural learning curriculum and significantly improves ELECTRA's accuracy in downstream tasks~\cite{clark2020electra}. \subsection{Challenges of ELECTRA-Style Pretraining} \input{Figures/scl_motivate} \textbf{Missing Language Modeling Benefits.} The classification task in ELECTRA is simpler and more stable~\cite{xu2020mc}, but raises two challenges. The first is the lack of language modeling capability which is a necessity in some tasks~\cite{clark2020pre}. For example, prompt-based learning requires a language model to generate labels~\cite{gao2021making, Meng2020TextCU, schick2020exploiting, schick2020small}. The second is that the binary classification task may not be sufficient to capture certain word-level semantics that are critical for token-level tasks. \textbf{Squeezing Representation Space.} Another challenge is that the representations from Transformer-based language models often reside in a narrow cone, where two random sentences have high similarity scores (lack of uniformity), and closely related sentences may have more different representations (lack of alignment)~\cite{gao2019representation, gao2021simcse, li2020bertflow}. Figure~\ref{fig:scl_motivate} illustrates such behaviors with random sentence pairs (from pretraining corpus) and semantically similar pairs (those annotated with maximum similarity from STS-B~\cite{STS-B}). With RoBERTa, the cosine similarities of most random sentence pairs are near $0.8$, bigger than many semantically similar pairs. The representation space from ELECTRA is even more squeezed. Nearly all sentence pairs, both random and similar ones, have around $0.9$ cosine similarity. This may not be surprising as ELECTRA is pretrained to predict the same output (``non-replacement'') for all tokens in these sequences. The irregular representation space raises the risk of degeneration~\cite{purushwalkam2020demystifying, wang2020understanding} and often necessitates sophisticated post-adjustment or fine-tuning to improve the sequence representations~\cite{gao2021simcse, li2020bertflow, luan2020sparsedense, xiong2020approximate}. \input{Figures/overview} \subsection{{COCO-LM}\xspace Pretraining} {COCO-LM}\xspace also employs an auxiliary Transformer to construct the corrupted text sequence, as in Eqn.~\eqref{eq:corrupt}, but it introduces two new pretraining tasks upon the corrupted sequences to address the challenges previously described. In the rest of this section, we present these two tasks and then the detailed configurations of {COCO-LM}\xspace. Its framework is illustrated in Figure~\ref{fig:overview}. \textbf{Corrective Language Modeling} ({CLM}\xspace) trains the main Transformer to recover the original tokens, given the corrupted text sequence $X^\text{MLM}$: \begin{align*} & X^\text{MLM} \xrightarrow{\text{Main Transformer}} \bs{H} \xrightarrow{\text{{CLM}\xspace Head}} p_\text{CLM}(x | \bs{h}_i). \end{align*} The CLM Head uses the hidden representations $\bs{H}$ to output a language modeling probability, instead of a binary classification score. The forward pass of the CLM Head is the same as All-Token MLM, a variation of ELECTRA~\cite{clark2020electra} that consists of a language modeling layer and a binary classification layer for the copy mechanism: \begin{align*} p_\text{LM}(x_i | \bs{h}_i) &= \mathbbm{1}\left(x_i = x^\text{MLM}_i \right) p_\text{copy} (1 | \bs{h}_i) + p_\text{copy} (0 | \bs{h}_i) \frac{\exp(\bs{x}_i^\top \bs{h}_i)}{\sum_{x_t \in V}\exp(\bs{x}_t^\top \bs{h}_i)}, \\ p_\text{copy} (y_i | \bs{h}_i) &= {\exp(y_i \cdot \bs{w}_\text{copy}^\top \bs{h}_i)} / \left( {\exp(\bs{w}_\text{copy}^\top \bs{h}_i) + 1} \right), \end{align*} where $\bs{w}_\text{copy}$ is a learnable weight and $ p_\text{copy} (y_i | \bs{h}_i)$ is the copy mechanism ($y_i = 1$ when the input token is original and can be directly copied to the output; $y_i = 0$ when the input token needs to be corrected to another token from the vocabulary). In ELECTRA, All-Token MLM performs worse than RTD~\cite{clark2020electra}. Language modeling on the corrupted text sequence $X^\text{MLM}$ is hard as the replaced tokens from the auxiliary model are more deceiving than \texttt{[MASK]}. To improve the language model learning, different from All-Token MLM, {CLM}\xspace employs a multi-task setup that combines the RTD task to explicitly train the copy mechanism $p_\text{copy}(\cdot)$: \begin{align} \mathcal{L}_\text{copy} =& -\mathbb{E} \left( \sum_{i=1}^n \mathbbm{1}\left( x_i^\text{MLM}=x_i^\text{orig} \right) \log p_\text{copy}(1|\bs{h}_i) +\mathbbm{1} \left(x_i^\text{MLM} \neq x_i^\text{orig} \right) \log p_\text{copy}(0|\bs{h}_i) \right), \label{eq:multitask} \\ \mathcal{L}_\text{LM} =& -\mathbb{E} \left( \sum_{i\in \mathcal{M}} \log p_\text{LM} \left( x_i^\text{orig} \big| \bs{h}_i \right) \right) \nonumber \\ =& -\mathbb{E} \left(\sum_{i\in \mathcal{M}} \log \left( \mathbbm{1} \left(x_i^\text{MLM}=x_i^\text{orig} \right) p_\text{copy}^{\texttt{sg}} (1 | \bs{h}_i) + p_\text{copy}^{\texttt{sg}} (0 | \bs{h}_i) \frac{\exp(\bs{x}_i^\top \bs{h}_i)}{\sum_{x_t \in V}\exp(\bs{x}_t^\top \bs{h}_i)} \right) \right), \nonumber \\ \mathcal{L}_\text{CLM} =& \lambda_{\text{copy}}\mathcal{L}_\text{copy} + \mathcal{L}_\text{LM}. \nonumber \end{align} The hyperparameter $\lambda_{\text{copy}}$ balances the weights of the two tasks. The binary cross entropy loss in Eqn.~\eqref{eq:multitask} explicitly trains the copy probability. We also use stop gradient ($\texttt{sg}$) to decouple the gradient backpropagation to $p_\text{copy}(\cdot)$ from the LM task. This way, the main Transformer first learns the easier classification task and then uses it to help learn the harder LM task. The binary classification task is trained on all tokens while the language modeling task is trained only on masked positions. {CLM}\xspace combines the advantages of MLM and ELECTRA: The main Transformer is trained on all tokens with the help of the binary classification task while also being able to predict words, thus enjoying the efficiency benefits of ELECTRA and preserving the language modeling benefits. \textbf{Sequence Contrastive Learning} ({SCL}\xspace) forms a contrastive learning objective upon the sequence embeddings to learn more robust representations. Broadly, contrastive learning is to align a positive pair of instances, often different views of the same information~\cite{chen2020simple, oord2018representation}, in contrast to unrelated negative instances~\cite{he2019momentum, xiong2020approximate}. The different views are often obtained by applying data augmentations on the same input, for example, rotation, cropping, and blurring on visual representations~\cite{chen2020simple, oord2018representation}, so that the neural networks can learn representations robust to these data alterations. In {COCO-LM}\xspace, the corrupted sequence $X^\text{MLM}$ already provides a form of data augmentation. We pair it with another augmentation, $X^\text{crop}$, a randomly cropped contiguous span of $X^\text{orig}$ (the length of $X^\text{crop}$ is $90\%$ of $X^\text{orig}$ so that the major sequence meaning is preserved), to construct the positive pair and to contrast with random negatives. Specifically, a training batch $B$ in {SCL}\xspace includes a random set of corrupted and cropped sequences: $B=\{(X_1^\text{MLM}, X_1^\text{crop}), \dots, (X_N^\text{MLM}, X_N^\text{crop})\}$, with $X_k^\text{MLM}$ and $ X_k^\text{crop}$ originated from $X_k^\text{orig}$. A positive contrastive pair $(X, X^+)$ consists of either $(X_k^\text{MLM}, X_k^\text{crop})$ or $(X_k^\text{crop}, X_k^\text{MLM})$ (symmetrical contrast). The negative instances are all the remaining sequences in the batch $B^- = B\setminus \{(X, X^+)\}$. The contrastive loss is formulated as: \begin{align} \mathcal{L}_\text{{SCL}\xspace} &= -\mathbb{E}\left( \log \frac{\exp(\text{cos}(\bs{s}, \bs{s}^+)/\tau)}{\exp(\text{cos}(\bs{s}, \bs{s}^+)/\tau) + \sum_{X^-\in B^- } \exp(\text{cos}(\bs{s}, \bs{s}^-)/\tau)} \right),\nonumber \\ &= -\mathbb{E} \left( \text{cos}(\bs{s}, \bs{s}^+)/\tau - \log \left(\exp(\text{cos}(\bs{s}, \bs{s}^+)/\tau) + \sum_{X^-\in B^-} \exp\left(\text{cos}(\bs{s}, \bs{s}^-)/\tau \right) \right) \right), \label{eq:scl} \end{align} where $\bs{s}, \bs{s^+}, \bs{s^-}$ are the representations of $X, X^+, X^-$, respectively, from the main Transformer (\textit{i.e.}, $\bs{h}_{\texttt{[CLS]}}$). The similarity metric is cosine similarity (cos) and the temperature $\tau$ is set to $1$. As shown in Wang et al.~\cite{wang2020understanding}, the first term in Eqn.~\eqref{eq:scl} ($\text{cos}(\bs{s}, \bs{s}^+)$) improves \textit{alignment} of the space. It encourages representations to be robust to the corruptions and the alterations on the original text. The second term in Eqn.~\eqref{eq:scl} promotes \textit{uniformity}. It pushes unrelated sequences apart in the representation space and ensures low cosine similarity between random data points. Several studies have observed improved generalization ability from better alignment and uniformity~\cite{gao2021simcse, purushwalkam2020demystifying,wang2020understanding}. Aligning $X^\text{MLM}$ with $X^\text{crop}$ requires the main Transformer to produce sequence representations robust to both token-level (\textit{i.e.}, MLM replacements) and sequence-level (\textit{i.e.}, cropping) alterations. The model is thus encouraged to reason more using partially altered sequences to recover the original information. \textbf{Overall Training.} {COCO-LM}\xspace uses the following loss function: \begin{align} \mathcal{L}_\text{{COCO-LM}\xspace} = \mathcal{L}^\text{Aux.}_\text{MLM} + \mathcal{L}^\text{Main}_\text{CLM} + \mathcal{L}^\text{Main}_\text{SCL}. \label{eq.final_loss} \end{align} The auxiliary Transformer is pretrained by masked language modeling (MLM) and generates corrupted sequences. The main Transformer is pretrained to correct the corruption ({CLM}\xspace) and to contrast the corrupted sequences with the cropped sequences ({SCL}\xspace). The two Transformers are pretrained jointly with the loss in Eqn.~\eqref{eq.final_loss}. The main Transformer is used in downstream applications. \textbf{Network Configurations.} Similar to ELECTRA, the auxiliary Transformer is smaller than the main model, but we use different configurations in the auxiliary model: (1) We reduce the number of layers to $1/3$ or $1/4$ (under \textit{base} or \textit{large} model setup, respectively) but keep its hidden dimension the same with the main model, instead of shrinking its hidden dimensions; (2) We disable dropout in it when sampling replacement tokens. We find such configurations empirically more effective and use them as the backbone of {COCO-LM}\xspace. The main Transformer follows the standard architecture of BERT/ELECTRA and can be easily adopted by downstream application pipelines with almost no changes. \section{Experimental Setup} \label{sec:setup} \textbf{Pretraining Settings.} We employ three standard settings, \textit{base}, \textit{base++}, and \textit{large++}. \textit{Base} is the BERT$_\text{Base}$ training configuration~\cite{devlin2019bert}: Pretraining on Wikipedia and BookCorpus~\cite{zhu2015aligning} ($16$ GB of texts) for $256$ million samples on $512$ token sequences ($125$K batches with $2048$ batch size). We use the same corpus and $32,768$ uncased BPE vocabulary~\cite{sennrich2015neural} as with TUPE~\cite{ke2020tupe}. \textit{Base++} trains the base size model with larger corpora and/or more training steps. Following recent research~\cite{unilmv2,liu2019roberta, yang2019xlnet}, we add in OpenWebText~\cite{Gokaslan2019OpenWeb}, CC-News~\cite{liu2019roberta}, and STORIES~\cite{trinh2018simple}, to a total of $160$ GB texts, and train for $4$ billion (with $2048$ batch size) samples~\cite{liu2019roberta}. We follow the prepossessing of UniLMV2~\cite{unilmv2} and use $64,000$ cased BPE vocabulary. \textit{Large++} uses the same training corpora as \textit{base++} and pretrains for $4$ billion samples ($2048$ batch size). Its Transformer configuration is the same with BERT$_\text{Large}$~\cite{devlin2019bert}. \textbf{Model Architecture.} Our \textit{base}/\textit{base++} model uses the BERT$_\text{Base}$ architecture~\cite{devlin2019bert}: $12$ layer Transformer, $768$ hidden size, plus T5 relative position encoding~\cite{raffel2019t5}. Our \textit{large++} model is the same with BERT$_\text{Large}$, $24$ layer and $1024$ hidden size, plus T5 relative position encoding~\cite{raffel2019t5}. Our auxiliary network uses the same hidden size but a shallow $4$-layer Transformer in \textit{base}/\textit{base++} and a $6$-layer one in \textit{large++}. When generating $X^\text{MLM}$ we disable dropout in the auxiliary model. \textbf{Downstream Tasks.} We use the tasks included in GLUE~\cite{wang2018glue} and SQuAD 2.0 reading compression~\cite{rajpurkar2016squad}. Please refer to Appendix~\ref{app:glue} for more details about GLUE tasks. Standard hyperparameter search in fine-tuning is performed, and the search space can be found in Appendix~\ref{app:hyperstudy}. The fine-tuning protocols use the open-source implementation of TUPE~\cite{ke2020tupe}. The reported results are the median of five random seeds on GLUE and SQuAD. \input{Tables/main_res} \textbf{Baselines.} We compare with various pretrained models in each setting. To reduce the variance in data processing/environments, we also pretrain and fine-tune RoBERTa and ELECTRA under exactly the same setting with {COCO-LM}\xspace, marked with ``(Ours)''. All numbers unless marked by ``(Ours)'' are from reported results in recent research (more details in Appendix~\ref{app:baseline}). \textbf{Implementation Details.} Our implementation builds upon the open-source implementation from MC-BERT~\cite{xu2020mc} and fairseq~\cite{ott2019fairseq}. More implementation details are mentioned in Appendix~\ref{app:implementation}. \section{Evaluation Results} \label{sec:eval} Three groups of experiments are conducted to evaluate {COCO-LM}\xspace and its two new pretraining tasks. \input{Tables/glue_test} \subsection{Overall Results and Ablations} \label{sec:ablation} \textbf{Overall Results} are listed in Table~\ref{tab:main_res}. Under all three settings, {COCO-LM}\xspace outperforms all recent state-of-the-art pretraining models on GLUE average and SQuAD. It improves the state-of-the-art GLUE score by about one point under all three settings. {COCO-LM}\xspace also enjoys better parameter efficiency. Using less than $10\%$ of Megatron's parameters, {COCO-LM}\xspace{}$_\text{Large++}$ matches the MNLI accuracy of Megatron$_\text{3.9B}$, one of the largest pretrained BERT-style encoders. Table~\ref{tab:glue_test} shows GLUE test set results which further confirm the advantages of {COCO-LM}\xspace over previous methods. \textbf{Efficiency.} In downstream tasks, the efficiency of {COCO-LM}\xspace is the same with BERT. In pretraining, the auxiliary model and {SCL}\xspace introduce extra cost. However, as shown in Figure~\ref{fig:efficiency}, {COCO-LM}\xspace is more efficient in GPU hours. It outperforms RoBERTa \& ELECTRA by $1+$ points on MNLI with the same GPU hours and reaches their accuracy with around $60\%$ \& $50\%$ GPU hours, respectively. \input{Tables/ablation} \input{Figures/self_learn} \textbf{Ablation Studies.} Table~\ref{tab:ablation} shows the ablations of {COCO-LM}\xspace under the \textit{base} setting on GLUE DEV. \textit{Pretraining Task.} With only RTD, our backbone model with the shallow auxiliary Transformer is quite effective. {CLM}\xspace and {SCL}\xspace both provide additional improvements on MNLI and GLUE average. Their advantages are better observed on different tasks, for example, {CLM}\xspace on MNLI-mm and {SCL}\xspace on RTE and MRPC. Combining the two in {COCO-LM}\xspace provides better overall effectiveness. In later experiments, we further analyze the benefits of these two tasks. \textit{Architecture.} Removing relative position encoding (Rel-Pos) leads to better numbers on some tasks but significantly hurts MNLI. Using a shallow auxiliary network and keeping the same hidden dimension ($768$) is more effective than ELECTRA's $12$-layer but $256$-hidden dimension generator. \textit{Pretraining Signal Construction.} Using randomly replaced tokens to corrupt text sequence hurts significantly. Using a converged auxiliary network to pretrain the main model also hurts. It is better to pretrain the two Transformers together, as the auxiliary model gradually increases the difficulty of the corrupted sequences and provides a natural learning curriculum for the main Transformer. \textit{CLM Setup.} Disabling the multi-task learning and using All-Token MLM~\citep{clark2020electra} reduces model accuracy. The copy mechanism is effective. The benefits of the stop gradient operation are more on stability (preventing training divergence). \subsection{Analyses of Contrastive Learning with {SCL}\xspace{}} \label{sec:sclexp} This group of experiments analyzes the behavior of {SCL}\xspace. All experiments use the \textit{base} setting. \textbf{Ablation on Data Augmentation.} Figure~\ref{fig:scl_ablation} shows the effects of the cropping operation when forming positive {SCL}\xspace pairs with the corrupted sequence. Using the original sequence results in worse GLUE accuracy. It is less informative as the model no longer needs to learn representations robust to sequence-level alteration. Cropping too much (\textit{e.g.}, only keeping $70\%$ of the original sequence), may hurt as it can alter the semantics too much. Empirically a simple alteration works the best, similar to the observations in recent research~\cite{chen2020simple,gao2021simcse, he2019momentum}. \textbf{Alignment and Uniformity.} Figure~\ref{fig:scl_dist} plots the distribution of cosine similarities between random sequence pairs and similar ones using representations pretrained by {COCO-LM}\xspace. The representation space from {COCO-LM}\xspace is drastically different from those in Figure~\ref{fig:scl_motivate}. With {COCO-LM}\xspace, similar pairs are more \textit{aligned} and random pairs are distributed more \textit{uniformly}. Many similar pairs have near $1$ cosine similarity and are clearly separated from random pairs which center around $0$. The t-SNE~\citep{coenen2019visualizing} plot in Figure~\ref{fig:scl_tsne} further demonstrates the benefits of {SCL}\xspace. The similar sentence pairs (marked by same shapes) are \textit{aligned} closer when pretrained with {SCL}\xspace. Their average cosine similarity is $0.925$ when pretrained with {SCL}\xspace, while is $0.863$ without {SCL}\xspace. This better alignment and uniformity is achieved by {COCO-LM}\xspace with {SCL}\xspace via pretraining, without using task-specific data nor supervised labels. \textbf{Regularizing the Representation Learning for Better Few-Shot Ability.} One would expect any pretrained Transformers to easily align a pair of corrupted sequence and cropped sequence as the two share about $80\%$ tokens. However, as shown in Figure~\ref{fig:noscl_curve}, that is not the case: Without {SCL}\xspace, the cosine similarity of the positive pairs is even lower than random negatives. {SCL}\xspace is necessary to regularize the representation space and to reduce the risk of degeneration (Figure~\ref{fig:scl_curve}). Similar to empirical observations and theoretical analyses in recent research~\cite{gao2019representation, gao2021simcse, wang2020understanding}, a more regularized representation space results in better generalization ability in scenarios with limited labels. Figure~\ref{fig:few_shot_m} and \ref{fig:few_shot_mm} show the results when {COCO-LM}\xspace are trained (via standard fine-tuning) with only a fraction of MNLI labels. The improvements brought by {SCL}\xspace are more significant when fewer fine-tuning labels are available. With $1\%$ MNLI labels, pretraining with {SCL}\xspace improves MNLI-m/mm accuracy by $0.8/0.5$ compared to that without {SCL}\xspace. Using only $10\%$/$20\%$ labels, {COCO-LM}\xspace with {SCL}\xspace reaches similar MNLI accuracy with RoBERTa (Ours)/ELECTRA (Ours) fine-tuned with all labels, respectively. \input{Figures/tsne_enp} \input{Figures/cls_ana} \subsection{Analyses of Language Modeling with {CLM}\xspace{}} \label{sec:clmexp} The last group of experiments studies the effectiveness and benefits of {CLM}\xspace. \input{Figures/clm_study} \textbf{Ablations on Training Configurations.} Figure~\ref{fig:clm_study} illustrates pretraining process with {CLM}\xspace and All-Token MLM. The plots demonstrate the difficulty of language modeling upon corrupted text sequences. It is quite an unbalanced task. For the majority of the tokens (Original) the task is simply to copy its input at the same position. For the replaced tokens ($7-8\%$ total), however, the model needs to detect the abnormality brought by the auxiliary model and recover the original token. Implicitly training the copy mechanism as part of the hard LM task is not effective: The copy accuracy of All-Token MLM is much lower, and thus the LM head may confuse original tokens with replaced ones. As shown in Table~\ref{tab:ablation} and ELECTRA~\cite{clark2020electra}, pretraining with All-Token MLM performs worse than using the RTD task, though the latter is equivalent to only training the copy mechanism. The multi-task learning of {CLM}\xspace is necessary for the main Transformer to stably learn the language modeling task upon the corrupted text sequence. \input{Tables/prompt} \textbf{Prompt-Based Fine-Tuning with CLM.} Table~\ref{tab:prompt} includes the prompt-based fine-tuning experiments on MNLI for RoBERTa and {COCO-LM}\xspace under \textit{base++} and \textit{large++} sizes, following the same few-shot manual prompt fine-tuning with demonstration setup in LM-BFF~\cite{gao2021making}. We use $\{3e-6, 4e-6, 5e-6\}$ for the learning rate search of {COCO-LM}\xspace \textit{base++}/\textit{large++} model, with everything else kept same as described in LM-BFF. With exactly the same pipeline, {COCO-LM}\xspace outperforms RoBERTa under both \textit{base++} and \textit{large++} sizes by significant margins on MNLI-m/mm. Such observations are interesting as {COCO-LM}\xspace's main Transformer does not even see any \texttt{[MASK]} tokens during pretraining but still performs well on predicting masked tokens for prompt-based learning. Note that ELECTRA and {COCO-LM}\xspace variants without the CLM task are not applicable: Their main Transformers are not pretrained by language modeling tasks (thus no language modeling capability is learned to generate prompt label words). This points out the importance, if not necessity, of {COCO-LM}\xspace in the family of ELECTRA-style pretraining models. With the benefits and rapid developments of prompt-based approaches, the lack of language modeling capability is going to limit the potential of ELECTRA’s self-supervised learning framework in many real-world scenarios. {COCO-LM}\xspace not only addresses this limitation but also provides better prompt-based learning results. \section{Conclusions and Future Work} \label{sec:conclusion} In this paper, we present {COCO-LM}\xspace, which pretrains language models using Corrective Language Modeling and Sequence Contrastive Learning upon corrupted text sequences. With standard pretraining data and Transformer architectures, {COCO-LM}\xspace improves the accuracy on the GLUE and SQuAD benchmarks, while also being more efficient in utilizing pretraining computing resources and network parameters. One limitation of this work is that the contrastive pairs are constructed by simple cropping and MLM replacements. Recent studies have shown the effectiveness of advanced data augmentation techniques in fine-tuning language models~\cite{gao2021simcse, qu2020coda, thakur-2020-AugSBERT}. A future research direction is to explore better ways to construct contrastive pairs in language model pretraining. Despite the empirical advantage of this auxiliary-main dual model framework, the auxiliary Transformer training is not influenced by the main Transformer nor learns to generate the optimal pretraining signals for the main model. To better understand and tailor the training of the auxiliary model to the main model is another important future research direction. \section{Results on GLUE Testing Data} \section{GLUE Tasks} \label{app:glue} We provide more details of the tasks included in the GLUE benchmark. Their statistics are listed in Table~\ref{tab:glue}. \textbf{MNLI:} Multi-genre Natural Language Inference~\cite{MNLI} contains $393$K train examples obtained via crowdsourcing. The task is to predict whether a given premise sentence entails, contradicts or neutral with respect to a given hypothesis sentence. \textbf{QQP:} Question Pairs~\cite{QQP} contains $364$K train examples from the Quora question-answering website. The task is to determine whether a pair of questions asked are semantically equivalent. \textbf{QNLI:} Question Natural Language Inference contains $108$K train examples derived from the Stanford Question Answering Dataset (SQuAD)~\cite{rajpurkar2016squad}. The task is to predict whether a given sentence contains the answer to a given question sentence. \textbf{SST-2:} Stanford Sentiment Treebank~\cite{SST-2} contains $67$K train examples extracted from movie reviews with human-annotated sentiment scores. The tasks is to determine if the sentence has positive or negative sentiment. \textbf{CoLA:} Corpus of Linguistic Acceptability~\cite{COLA} contains $8.5$K train examples from books and journal articles on linguistic theory. The task is to determine whether a given sentence is linguistically acceptable or not. \textbf{RTE:} Recognizing Textual Entailment~\cite{RTE-5,RTE-1,RTE-2,RTE-3} contains $2.5$K train examples from textual entailment challenges. The task is to predict whether a given premise sentence entails a given hypothesis sentence or not. \textbf{MRPC:} Microsoft Research Paraphrase Corpus~\cite{MRPC} contains $3.7$K train examples from online news sources. The task is to predict whether two sentences are semantically equivalent or not. \textbf{STS-B:} Semantic Textual Similarity~\cite{STS-B} contains $5.8$K train examples drawn from multiple sources with human annotations on sentence pair semantic similarity. The task is to predict how semantically similar two sentences are on a $1$ to $5$ scoring scale. \section{Hyperparameter Settings} \label{app:hyperstudy} Tuning hyperparameter of pretraining is often too costly and we keep most hyperparameters as default. The auxiliary MLM pretraining uses the standard $15\%$ \texttt{[MASK]} ratio. The crop transformation in the {SCL}\xspace task uses $10\%$ crop ratio, resulting in a sub-sequence that is $90\%$ long of the original sequence. The softmax temperature in the {SCL}\xspace task is $1$. All pretraining tasks in {COCO-LM}\xspace have equal weights except $\lambda_{\text{copy}} = 50$ since the loss of the binary classification task is much lower than those of the LM tasks, which are over $30,000$-way classification tasks. All token embeddings (used in the input embedding layer and the language modeling head) are shared between the auxiliary Transformer and the main Transformer. The detailed hyperparameters used are listed in Table~\ref{tab:hp_pretrain} for pretraining, and Tables~\ref{tab:hp_finetune_glue} and \ref{tab:hp_finetune_squad} for GLUE and SQuAD fine-tuning, respectively. All reported methods use exactly the same (or equivalent) set of hyperparameters for pretraining and fine-tuning for fair comparison. For {COCO-LM}\xspace and all the baselines implemented under our setting, all fine-tuning hyperparameters are searched per task; the median results of five runs with the same set of five different random seeds are reported on GLUE and SQuAD. \section{The Origins of Reported Baseline Scores} \label{app:baseline} The baseline results listed in Table~\ref{tab:main_res} are obtained from their original papers except the following: BERT from Bao et al.~\cite{unilmv2}, RoBERTa \textit{base}/\textit{base++} GLUE from and SQuAD from Bao et al.~\cite{unilmv2}, ELECTRA \textit{base}/\textit{base++} GLUE from Xu et al.~\cite{xu2020mc}, XLNet \textit{base++} from Bao et al.~\cite{unilmv2}, RoBERTa \textit{base++} SQuAD from Bao et al.~\cite{unilmv2}. When multiple papers report different scores for the same method, we use the highest of them in our comparisons. \section{More Implementation Details} \label{app:implementation} \textbf{Pretraining and Fine-tuning Costs.} The \textit{pretraining cost} of {COCO-LM}\xspace's {CLM}\xspace task is similar to ELECTRA, which is BERT plus the auxiliary network whose size is $1/3$ of the main network. The addition of {SCL}\xspace task requires one more forward and backward pass on the cropped sequence $X^\text{crop}$. With $256$ V100 ($32$ GB Memory), one pretraining run takes about $20$ hours in \textit{base} setting, about two-three weeks in \textit{base++} setting, and about three-four weeks in \textit{large++} setting. The \textit{fine-tuning costs} are the same with BERT plus relative positive encodings as the same Transformer model is used. \input{Tables/glue_stat} \input{Tables/hyperpara} \textbf{MLM Mode for Corrective Language Modeling.} When creating the MLM replaced sequence $X^\text{MLM}$, we find it slightly improves the downstream task performance to disable dropout (\emph{i.e.}, set the auxiliary MLM in inference mode) for computing the auxiliary network's output distribution where plausible replacing tokens are sampled. We hypothesize that this leads to more stable generation of challenging replaced tokens to be corrected by the main Transformer and thus improves downstream task results. \textbf{Projection Heads.} For the auxiliary model trained with MLM, we follow the standard MLM head setup in BERT/RoBERTa that includes a linear layer to project the contextualized embeddings from the encoder to same-dimensional vectors before feeding to the final linear layer that outputs the MLM probability. However, we do not include the projection layer for the main model trained with the CLM task (\emph{i.e.}, only having the final linear layer). We find this improves the training stability. \textbf{Masking Special Tokens for Auxiliary Model Training.} BERT only masks real tokens (other than artificial symbols like \texttt{[SEP]} and \texttt{[CLS]}) for MLM training, while RoBERTa also masks special tokens. We follow the RoBERTa setting which results in slightly improved performance for some tasks. \section{More Discussions on PLM Research} \label{app:discussions} Currently, the biggest challenge with PLM research is perhaps its prohibitive computation cost. On one hand, PLMs have influenced a wide range of tasks, and any further technical improvement matters a lot for downstream applications. On the other hand, its expensive computing cost and long experimental cycles pose great challenges for careful and thorough studies of the problem space, as any test of new designs comes with a considerable computing cost---pretraining a new language model can easily consume thousands of dollars, or even millions for extra large models. Such challenges call for more systematic evaluation pipelines that can accurately and reliably judge whether or not a new PLM is really better than previous ones. Currently, the evaluation of PLMs largely relies on GLUE-style benchmark which contains a set of different tasks that are weighed equally for PLM evaluations---usually the average performance over these tasks is treated as a final measure for the effectiveness of a PLM. However, we find that the small tasks in GLUE have very high variances which may provide unreliable indications for a PLM's performance. For example, on CoLA and RTE, fine-tuning with different random seeds from the same pretrained checkpoint can easily result in a $5$-point difference between the best and the worst seed. In contrast, large tasks like MNLI give relatively stable and consistent results for the same model pretrained/fine-tuned with different random seeds, and thus serve as better indicators for PLMs' effectiveness. In this paper, we try to improve the robustness of our observations, for example, by reporting the downstream performance with different training time for future comparisons under limited computing budget, and also by making our code and models publicly available for the reproducibility of our study. We hope our efforts will facilitate more future research to improve the community's understanding and development of this important problem space. \section{Notes} Sec 1 seq-level corrective? concise: abbreviation of i abs: distracting? challenging? compare with Electra's all mlm name convention: base++ or more training data? Sec 3 notation vector/scalar/matrix X$_mlm$ Cor-LM? Mask-LM? Seq-CL? SCL? Stop grad for all mlm copy Sec 4 model architecture shallow but same-width equal training weight {COCO-LM}\xspace{} \cx{Motivation: We want go beyond token-level language model pretraining, why? \begin{enumerate} \item No explicit guidance to learn sequence level representations, although many downstream tasks care more about representing the full sequence (sentence, passage, documents, etc.) \item A large amount Mask-LM or Auto-regresive LM is less informative: simple words, language synthetic, may limit the full potential of pretraining, as shown by the logarithmic scaling of model size versus effectiveness. \item Minnor: mismatch in pretraining input with [mask] and never full sentence, versus when applied. \end{enumerate} } \cx{What we contribute in {COCO-LM}\xspace{}: Contrastive language REpresentation Pretraining by correcting text Sequences \begin{enumerate} \item Built upon Electra's generator-style pretraining construction, leverage a PLM to provide corrupt sequences (PLM-Corruption) as pretraining data: thus elevate pretraining by focusing on PLMs' mistakes and also close the gap between pretraining input and application input. \item Bringing in the Contrastive Learning framework to enforce both sequence and token level denoising task: closely align the LM-corrupt sequence with transformed origin, while also efficient token level denoising pretraining task as replace token correction. \item Thorough study to show the effect of sequence level denoising and token level denoising. Sequence: uniformity in the representation space? Token: stronger training signal that guides transformers to learn more global/contextualized attention/representation? \end{enumerate} } \cx{what experiments to show: \begin{enumerate} \item Overall GLUE with Base and Base++, hopefully also GLUE Test \item Ablation study: Electra+rel-pos, shallow-gen-rel-pos, +Seq Contrast, +Token-Correction \item Influence of Token Level Denoising: different attention pattern? show learned replace token correction accuracy and replace acc? \item Influence of seq level denoising: the meaningfulness of [cls] with seq-contrast, the distribution/uniformity of learned [cls] in the representation space of pretraining data and on GLUE data? attention pattern to and from CLS? \end{enumerate}} \cx{What are the advantage of CREPES? What are the experiments to demonstrate its advantage? \begin{enumerate} \item More Robust Pretraining: the contrast provides sequence level regularization that makes the pretraining more robust \item More global attention: push model leverage more contextual information. both correction tasks push the pretraining model learn more global information? \end{enumerate} How to demonstrate we have those advantages beyond overall effectiveness? \begin{enumerate} \item {Robustness:} better few-shot performance on GLUE? better zero-shot performance in STS tasks? Show SVD/t-SNE of [CLS] on STS to show that the learned representation is more regularized? \item {More global attention:} visualize attention pattern? statistics of max attention path/how attention matrix scatters? Edge probing (maybe not) \end{enumerate} } \cx{Experimental plan: \begin{enumerate} \item Finish overall table (with base for now) (Chenyan), + SQuAd \item start ablation table and fill in (Yu design the table) \item (robustness) Few-shot glue (MNLI only?) (Yu code/script) (chenyan check preprocessing) \item (robustness) [CLS] space visualization (STS) \item (More contextualized) word's h self-similarity (pretrain data and downsteam, STS? MNLI?) (without stopword) https://arxiv.org/abs/1909.00512 self-sim, fig 2. \end{enumerate} } \cx{Intro Outline, one bullet one paragraph: \begin{enumerate} \item Language model is great and includes various different variations of token level LM pretraining tasks: MLM, Auto-regressive LM, the combination of the two, and other variations (rotation, permutation, etc.) \item Those tasks are great by not without limitations: 1) no explicit guidance of full sequence level---previous attempts often yield ambivalent empirical results in representation tasks. 2) Token level tasks are not all informative, while previous attempts to reweight/filter also show no general simple fix (salience span.. 3) mismatch between input seems in pretraining and those in applications. (Leave the more detailed discussion of previous attemtps in related work) \item This work presents our model. general idea, and describes each component \item more detail of our model \item experiments on GLUE, ablation study \item more insights on influences of seq level denoising and token level denoising \end{enumerate}} \section*{Checklist} \begin{enumerate} \item For all authors... \begin{enumerate} \item Do the main claims made in the abstract and introduction accurately reflect the paper's contributions and scope? \answerYes{We provide comprehensive evaluation results and comparison with prior work in Section~\ref{sec:eval} to validate the effectiveness of our proposed methods.} \item Did you describe the limitations of your work? \answerYes{See Section~\ref{sec:conclusion}.} \item Did you discuss any potential negative societal impacts of your work? \answerYes{We provide discussions about the long training cycle and expensive costs of pretraining in Appendix~\ref{app:discussions}.} \item Have you read the ethics review guidelines and ensured that your paper conforms to them? \answerYes{} \end{enumerate} \item If you are including theoretical results... \begin{enumerate} \item Did you state the full set of assumptions of all theoretical results? \answerNA{} \item Did you include complete proofs of all theoretical results? \answerNA{} \end{enumerate} \item If you ran experiments... \begin{enumerate} \item Did you include the code, data, and instructions needed to reproduce the main experimental results (either in the supplemental material or as a URL)? \answerYes{} \item Did you specify all the training details (e.g., data splits, hyperparameters, how they were chosen)? \answerYes{See Appendices~\ref{app:glue} and \ref{app:hyperstudy}.} \item Did you report error bars (e.g., with respect to the random seed after running experiments multiple times)? \answerNo{We report the median/average results of multiple random seeds, following previous studies. See Section~\ref{sec:setup}.} \item Did you include the total amount of compute and the type of resources used (e.g., type of GPUs, internal cluster, or cloud provider)? \answerYes{See Figure~\ref{fig:efficiency} and Appendix~\ref{app:hyper}} \end{enumerate} \item If you are using existing assets (e.g., code, data, models) or curating/releasing new assets... \begin{enumerate} \item If your work uses existing assets, did you cite the creators? \answerYes{See Section~\ref{sec:setup} and Appendix~\ref{app:glue}.} \item Did you mention the license of the assets? \answerNo{The license can be found in the original source of the assets.} \item Did you include any new assets either in the supplemental material or as a URL? \answerNA{} \item Did you discuss whether and how consent was obtained from people whose data you're using/curating? \answerNA{} \item Did you discuss whether the data you are using/curating contains personally identifiable information or offensive content? \answerNA{} \end{enumerate} \item If you used crowdsourcing or conducted research with human subjects... \begin{enumerate} \item Did you include the full text of instructions given to participants and screenshots, if applicable? \answerNA{} \item Did you describe any potential participant risks, with links to Institutional Review Board (IRB) approvals, if applicable? \answerNA{} \item Did you include the estimated hourly wage paid to participants and the total amount spent on participant compensation? \answerNA{} \end{enumerate} \end{enumerate} \section*{Acknowledgments} We sincerely thank Guolin Ke for discussions and advice on model implementation. We also thank anonymous reviewers for valuable and insightful feedback, especially the suggestion of adding prompt-based fine-tuning experiments. \balance {\small
\section{Background} \label{sec:background} \subsection{Quantum Computing Basics} The most basic object in quantum computing is the quantum bit (qubit). Unlike a classical bit which is either 0 or 1, the qubit has two basis states $\ket{0}$ and $\ket{1}$ and can exist as a linear superposition over these two states, i.e. for a quantum state $\ket{\psi} = \alpha\ket{0} + \beta\ket{1}$ with $\alpha, \beta \in \mathbb{C}$ and $\|\alpha\|^2 + \|\beta\|^2 = 1$. In general, a quantum system consisting of $n$ qubits can exist in a linear superposition of $2^n$ basis states in contrast to a classical system of $n$ bits which can exist as exactly a single of these states. An important feature which gives quantum computing its power is the ability to \textit{entangle} qubits via two qubit operations like the CNOT. This, along with quantum interference between the complex amplitudes, allows quantum programs to solve certain problems faster than classical computers. While a qubit system can exist in these superpositions during computation, at the end of the computation, the qubits are measured producing a classical binary outcome. The probability of each outcome depends on the amplitude of each basis state (the values of $\alpha, \beta, \gamma, \dots$). Consequently, since the outcome of a quantum program is a classical bitstring and because quantum systems are inherently noisy, programs are usually run thousands of times to obtain a distribution over possible answers. A comprehensive background can be found in \cite{mikeike}. \subsection{Quantum Circuits} Quantum programs are typically represented as a circuit which, like a classical program, is an ordered list of instructions. Here the instructions are quantum logic gates applied to qubits. The input circuit may not be expressed in the instruction set supported by the underlying hardware or it might even be structured as hierarchical modules. Quantum circuits have a single line for each qubit, with time flowing from left to right. Gates in a quantum circuits have the same number of inputs and outputs and gates on disjoint sets of lines can be executed in parallel. Single qubit gates are represented as a box labeled with the indicated operation and controlled operations, like the CNOT and Toffoli, have one or two controls respectively indicated by $\bullet$ and target given by $\oplus$. Currently available superconducting quantum hardware, like that of IBM and Rigetti, only supports one-qubit gates and two-qubit gates on specific pairs. Therefore, more complex instructions must be decomposed into multiple simpler, supported operations. For example, many quantum algorithms and subroutines make use of the Toffoli gate, a three-input gate which performs the logical AND between two controls bits and writes the output onto the target bit. This gate cannot be executed directly on available hardware and instead is decomposed into an equivalent sequence of one- and two-qubit operations. Two such popular decompositions are given in Figures \ref{fig:6-cnot-decomp}, \ref{fig:8-cnot-decomp}. There are two key distinctions in these decompositions illustrating a more general trade off. The first \cite{mikeike} is the most popular decomposition using only 6 CNOT gates but requires CNOTs between all three pairs of qubits. This would require inserted SWAPs or a device connectivity containing a triangle. The second \cite{craig8} uses a total of 8 CNOT gates and requires all three inputs be only linearly connected (only two of the three qubit pairs are required to be connected). While the first is apparently more efficient, this is not true if the connectivity of the underlying hardware does not directly support it. It is more efficient to use the 8-CNOT version than use the 6-CNOT version with added SWAPs. For superconducting qubits, current quantum computers supports gates only between adjacent hardware qubits. In order to use qubits which are currently mapped far apart on the hardware, extra SWAP operations must be inserted, each of these SWAPs is usually decomposed as a series of 3 CNOT gates (equivalent to a classical memory in-place swap using 3 alternating XORs). In the case of the 6-CNOT Toffoli decomposition above, when mapped to a device with linear or square grid connectivity, no triangles exist so extra SWAPs will need to be inserted, resulting in a greater total number of CNOTs due to the mismatch with hardware details. \begin{figure} \centering \begin{minipage}[][][b]{\columnwidth} \centering \scalebox{1}{% \input{figs/6cnot-decomp}% }% \caption{A 6-CNOT decomposition of the Toffoli gate.} \label{fig:6-cnot-decomp} \end{minipage}\\%\hfill \end{figure} \begin{figure} \begin{minipage}[][][b]{\columnwidth} \centering% \scalebox{1}{% \input{figs/8cnot-decomp}% }% \caption{An 8-CNOT decomposition of the Toffoli gate.} \label{fig:8-cnot-decomp} \end{minipage} \end{figure} \subsection{Current Quantum Devices} \begin{figure*} \centering \hfill% \begin{minipage}[][][b]{0.3333\textwidth} \centering \input{figs/johannesburg-diagram}% \end{minipage}\hfill% \begin{minipage}[][][b]{0.3333\textwidth} \centering \input{figs/5x4grid}% \end{minipage}\hfill% \begin{minipage}[][][b]{0.3333\textwidth} \centering \input{figs/4-5-clusters}% \end{minipage}\hfill% \vspace{0.75em}\\ \begin{minipage}[][][b]{0.3333\textwidth} \centering (a) IBM Johannesburg \end{minipage}\hfill% \begin{minipage}[][][b]{0.3333\textwidth} \centering (b) 2D Grid \end{minipage}\hfill% \begin{minipage}[][][b]{0.3333\textwidth} \centering (c) 4, 5 qubit fully connected clusters \end{minipage}\hfill% \vspace{1.5em}\\ \begin{minipage}[][][b]{\textwidth} \centering \vspace{1em} \input{figs/20-qubit-line}% \end{minipage} \vspace{0.25em}\\ \begin{minipage}[][][b]{\textwidth} \centering \vspace{0.5em} (d) Linear \vspace{0.5em} \end{minipage} \caption{Example topologies of near-term quantum devices. Orange (a): IBM Johannesburg. Yellow (b): 2D Grid. Purple (c): four groups of five fully connected clusters. Green (d) Linear. Our real experiments run on Johannesburg and our simulations explore all of these topologies. Colors correspond with the bars in Figures \ref{fig:benchmark-success}, \ref{fig:benchmark-gate-ratio}, \ref{fig:benchmark-success-norm}.} \label{fig:device-diagrams} \end{figure*} \label{background:devices} In this paper we focus primarily on currently available superconducting quantum devices. This type of hardware is the primary focus of many industry players like IBM, Rigetti, and Google \cite{rigetti, ibmq, bristlecone}. We show some representative topologies for superconducting devices in Figure \ref{fig:device-diagrams}abd. For completeness, we include a clustered device shown in Figure \ref{fig:device-diagrams}c representative of a QCCD ion trap device such as \cite{honeywell}. These systems exhibit all of the properties previously discussed. They have a small universal supported gate set which all programs must be transformed into and only support local two-qubit operations. The connectivity of these devices is given as a \textit{coupling graph} specifying which pairs of qubits can execute CNOTs. Furthermore, these systems are subject to a wide variety of noise which cause programs to fail. Some noise is due to manufacturing imperfections or calibration error. Some is inherent to quantum program execution resulting from the imperfect physical isolation of the qubits from the environment required to manipulate the quantum state \cite{sc_errors}. In IBM machines, the experimental devices of this work, single qubit gate errors are small, occurring on average 1 in 2000 operations. CNOT gate errors are more significant occurring on roughly 1 in 100 gates. Measurement error is also significant, with errors on the same order of magnitude as CNOT gates. Finally, qubit lifetimes (coherence times) are relatively short, allowing on the order of 50 CNOT gate durations before the qubit state is lost \cite{ibm_errors} (but gates can often run in parallel while imposing additional crosstalk error). Therefore, quantum compilation is essential to reduce both of these sources of error: add as few extra gates as possible and minimize total execution time. \subsection{The Compilation Problem} \label{background:compilation} In the NISQ era, quantum programs are highly optimized in order to reduce the effect on errors and maximize the probability the correct answer is observed. Similar to many classical programs, compilation uses a pass structure, where a set of transformation and optimizations are applied in a fixed order resulting in the compilation of an input quantum program to an executable for the target hardware \cite{scaffcc, cancel}. For the most part, these optimizations take place at the circuit-gate level. Some optimizations are hardware independent, for example, reducing total number of gates via commutativity-aware gate cancellation or find and replace with circuit identities. Other passes are focused on decomposing gates into the hardware's ISA \cite{opt1, opt2, opt3}. One of the most important parts of this compilation process is mapping and routing the optimized program to one executable on the target hardware, typically done post-decomposition. Quantum mechanics imposes new constraints on these than classical compilation or logic synthesis. By the no cloning theorem, quantum states cannot be copied, only entangled, which prevents fan-out or fan-in. Instead, the data must be routed sequentially (i.e. swapped with SWAP gates) to each place it is needed. Compilation involves three main steps. First, mapping program qubits to hardware qubits in order to minimize the total distance between qubits that will need to be close by in the future \cite{map1, map2, map3}. Second, routing pairs of CNOT inputs to be adjacent by inserting SWAPs \cite{routing1, routing2}. Finally, scheduling operations to minimize total execution time \cite{scheduling1, xtalk}. In general, the compilation problem is computationally hard and while some attempts at optimal solutions have been pursued \cite{tan2020optimal, siraichi2018qubit, wille2014optimal} the dominant approach is heuristics. In this work we focus on two pieces of this compilation problem: decomposition and routing. IBM's Qiskit compiler, the standard for compiling programs to execute on an IBM device, has a default sequence of passes. First, all high level optimization and analysis passes are performed and all gates are unrolled and decomposed to the target gate set. Then single passes of mapping, routing, and scheduling are performed \cite{qiskit}. \subsection{Evaluation Metrics} \label{background:metrics} When evaluating compiler methods, we use a few metrics to compare our results. Our primary metric is program success rate, the fraction of circuit executions that result in the correct output. Others use fidelity which can stand-in for success rate when evaluating sub-circuits where the output is not measured. When executing a quantum algorithm, the corresponding quantum circuit is typically executed thousands of times to gather output statistics or identify the error-free result. Program success rate is highly dependent to the noise characteristics of the quantum computer the program runs on. The rates of these device errors can fluctuate day-to-day so we also use the simpler metric of two-qubit gate count. The number of two-qubit operations in the final compiled circuit is inversely correlated with the success rate because they are usually the largest source of noise. \subsection{Simulation} \label{background:simulation} Simulating general quantum systems is exponentially expensive in the size of the system and therefore it is difficult to realistically model all of the errors during the execution of a quantum program. We use a simplified model for simulation to predict, specifically obtain a close upper bound on, the success rate of a program with specified gate error rates and qubit coherence times. In our simplified model, we compute the probability of a program succeeding as the probability that no gate errors occur $(p_{gate})^{n_{gates}}$ times the probability no coherence errors occur $p_{coherence}$, where the latter is computed as $e^{\Delta / T_1 + \Delta / T_2}$, where $\Delta$ is the total program duration and $T_1$ and $T_2$ are the relaxation and dephasing times, collectively decoherence. Current error rates, while rapidly improving, are still insufficient to obtain high probabilities of success, making it difficult to compare our mid-size benchmarks that are large enough to need many SWAPs. For our simulations we use error rates 20x improved over current IBM Johannesburg error rates to obtain reasonable success rates and we study sensitivity to this choice later. \section{Introduction} \begin{figure} \centering \begin{minipage}[][][b]{\columnwidth} \centering \scalebox{1.5}{\input{figs/qiskit-default}}% \vspace{-0.25em}\\ (a) Expensive Qiskit routing\vspace{0.25em} \\ \scalebox{1.5}{\input{figs/craig-pre-swap}}% \vspace{-1em}\\ (b) Efficient Trios routing \end{minipage} \caption {Example routing from Qiskit (a) vs. Trios (b) for a single Toffoli operation. Circles represent qubits and lines indicate two qubits are connected. Input qubits are highlighted in red. SWAP arrows are labeled by timestep. The routed locations for Trios routing are highlighted in green while Qiskit moves them several times. Qiskit adds 16 SWAPs (=48 CNOTs), some during the Toffoli, while Trios adds only 7 SWAPs (=21 CNOTs) all before the Toffoli. Performing multiple passes of decomposition allows direct routing and enables this huge reduction in communication, increasing the probability of program success. } \label{fig:swap_example} \end{figure} \label{sec:introduction} In recent years, quantum hardware has improved dramatically in terms of number of accessible quantum bits (qubits), device error rates, and qubit lifetimes. However, we are still years away from obtaining fully error corrected devices which are required to run important algorithms like Grover's \cite{grover} and Shor's \cite{shor}. In the current Noisy-Intermediate Scale Quantum (NISQ) \cite{NISQ} era, where despite recent substantial improvements, error rates on current devices are still prohibitive, requiring programs to be highly optimized to have a good chance at succeeding. Quantum program compilation involves many passes of transformations and optimizations similar in many ways to classical compilers. Some optimizations occur at the abstract circuit level, independent of the underlying hardware, such as gate cancellation \cite{cancel}. One of the first steps usually taken is to convert an input program into a gate set (ISA) supported by the target hardware. For example, on IBM devices, gates are typically rewritten using only gates in the set $\{u1, u2, u3, cx\}$ \cite{ibmq} (single-qubit gates and the common CNOT gate described later). One critical limitation of many current available architectures is the inability to execute more complex multi-qubit operations, like the Toffoli, directly; instead, these gates must be decomposed into the supported one- and two-qubit gates. Furthermore, many current superconducting architectures only support two qubit operations on adjacent hardware qubits wired together with a coupler. This requires the insertion of additional operations called SWAPs to move the data onto adjacent (and connected) qubits. The process of transforming an optimized and decomposed program to the desired target is typically broken down into three distinct steps: decomposing the program into basic gates, mapping the logical qubits of a program to hardware qubits and routing interacting qubits so that they are adjacent on hardware when they interact, and scheduling operations in order to minimize total program run time (depth) or to minimize errors due to crosstalk \cite{xtalk}. Each of these steps is critical to the success of the input program. A well-mapped and well-routed program will reduce the total number of communication operations added and subsequently reduce the compiled program's depth, both of which will increase the chance of success. Conventionally, these three steps occurs sequentially. By doing so, current strategies are unable to account for structure in the input program, resulting in inefficient routing of qubits. An optimal compiler could find the best routing despite the lack of structure but at the cost of much slower compilation. Consider the SWAP paths inserted by IBM's Qiskit compiler for a single Toffoli compiled to IBM's Johannesburg device in Figure \ref{fig:swap_example}a. This baseline strategy adds a large number of unnecessary SWAPs as it individually routes each CNOT composing the Toffoli, dramatically reducing the probability of successful execution. Our approach, Orchestrated Trios (Trios) decomposes and routes qubits in multiple stages, as seen in Figure \ref{fig:tool-flow}b. For example, first decompose an input program to one- two-, \textit{and} three-qubit gates (e.g. do not decompose Toffoli gates) and route as before except for three-qubits, route all three to a common location with minimal SWAPs. This new program can then undergo a second round of decomposition to produce a circuit containing only hardware permitted one- and two-qubit gates. The second round may use the now known mapping (locations of data qubits on the device) to generate fine-tuned decompositions for the architecture. This layered approach has a major advantage over current routing techniques: we are better able to capture program structure by inspecting intermediate complex operations for routing. This better informs how qubits should be moved around the device during program execution. In Figure \ref{fig:swap_example}, the Trios strategy reduces the total number of SWAPs added to 21: fewer than half compared to Qiskit. This was an extreme example we selected to present the issue, not an average case. \begin{figure} \centering \begin{minipage}[][][b]{0.5\columnwidth} \centering \scalebox{0.8}{\input{figs/default-flow}}% \end{minipage}% \begin{minipage}[][][b]{0.5\columnwidth} \centering \scalebox{0.8}{\input{figs/proposed-flow}}% \end{minipage} \vspace{1em} \begin{minipage}[][][b]{0.5\columnwidth} \centering (a) Conventional compilation \end{minipage}% \begin{minipage}[][][b]{0.5\columnwidth} \centering (b) Trios compilation \end{minipage} \caption{(a) Typical compilation passes used by Qiskit (simplified). (b) Trios compilation passes.} \label{fig:tool-flow} \end{figure} We specifically propose a two-pass approach to circuit decomposition. We will focus on superconducting hardware systems like IBM's cloud accessible devices, but our strategy can easily be adapted to other systems. An overview of our compilation structure is found in Figure \ref{fig:tool-flow}b. This strategy has a substantial benefit on the overall success rate of programs. We demonstrate these improvements by executing Toffoli gates on a real IBM quantum computer and estimating success probability of a suite of benchmarks via simulation. Our contributions are as follows: \begin{itemize} \item A new compiler structure, Trios, with two passes for decomposition with a modified routing pass in between which greatly improves qubit routing. \item A simple method for architecture-tuned Toffoli decompositions during the second decompose pass that allows for a new kind of location-aware optimization. \item On Toffoli-only experiments, Trios reduces the total number of gates by 35\% geomean (geometric mean) resulting in 23\% geomean increase in success rate when run on real IBM hardware as compared to Qiskit. \item On near-term algorithms shown in Figure \ref{fig:benchmark-success-norm} (4 to 20 qubit benchmarks), Trios reduces total gate count by 37\% geomean resulting in 344\% geomean increase in (or 4.44x) simulated success rate on IBM Johannesburg with noise rates of near-future hardware as compared to programs compiled without Trios. A sensitivity analysis over four architecture types shows the benefit range from 133\% to 3020\% increase in success rate. \end{itemize} \section{Motivation: Conventional Compilation} In this section we motivate the need for a split decomposition pass with routing in between. We look closely at the Qiskit compiler which does not effectively account for the structure in programs. It often produces circuits with an excessive number of swaps suggesting room for improvement.% \hide{ } The default compilation framework in Qiskit used to transform input circuits to be executed on their hardware ensures a fully decomposed circuit before mapping, routing, and scheduling occur. As a simple example, consider three qubits placed fairly distant on IBM's Johannesburg device but for which we need to execute a Toffoli gate on them; as in Figure \ref{fig:swap_example}a. Qiskit decomposes this Toffoli as in Figure \ref{fig:6-cnot-decomp} with 6 CNOTs. Each CNOT acts on distant qubits so the many SWAPs inserted for all 6 CNOTs gets expensive quickly. When routing, we first SWAP the first interacting pair together (usually by adding SWAPs from control to target or the reverse, but a meet-in-the-middle strategy is also possible) and the qubit mapping is updated. The next CNOT is also distant so we add SWAPs to move them together and there is an even chance that the SWAPs for the second CNOT separate the two qubits that were just brought together. Ideally, we move the third qubit to the already adjacent pair, but Qiskit cannot recognize this situation and could just as well move the other way. This is clearly sub-optimal and could continue on for the other four SWAPs. Even in the case where it makes the correct decision to move the distant third qubit, there are problems. Because pair of qubits needs to interact we may need single additional SWAPs as the qubits compete to be neighbors. This causes the 6-CNOT Toffoli decomposition to use many more than 6 CNOTs when there is not a triangle in the qubit connectivity graph. The core idea is that the routing strategy fails to take advantage of two things. First, it has effectively forgotten the desired operation is a Toffoli which will require all three qubits be adjacent and second that a more efficient Toffoli decomposition could be chosen which is more suitable for the underlying device architecture. In the example, inefficient compilation adds a total of 16 SWAPS or 48 CNOTs in total. Some approaches in the past have attempted to solve the first of these problems, for example by using lookahead when choosing routing strategies \cite{look1, look2} and while this helps to treat the symptoms of pre-decomposing all operations it does not remedy the underlying problem. \section{Orchestrated Trios} \label{orechestra} In this section we describe our proposed compilation structure compared to the conventional one as outlined in Figure \ref{fig:tool-flow}. Specifically, we focus on improving the routing and decomposition stages of compilation. Previously, we identified a key problem in current methods: decomposing the program to one- and two-qubit gates up front hinders the ability of heuristic-based compilers to effectively minimize the communication cost, i.e. the number of SWAPs added, and eliminates the possibility of location-aware decompositions. We propose a new pass structure. Rather than performing a single round of decomposition and routing, we propose a split approach. Any program processing prior to decomposition stays the same. The decomposition pass is then divided so the majority of decomposition occurs next but any Toffoli gates are left as-is before moving on to mapping and routing. The mapping and routing passes come next like normal but must be modified slightly to handle three-qubit gates. The mapper can simply treat the non-decomposed Toffoli as it would the equivalent 6 CNOTs for the purposes of determining which qubits most need to be placed nearby. We then do the modified routing pass, moving \textit{groups} of qubits together instead of only pairs where all or all-but-one of the group are moved into a single neighborhood via SWAPs. This greatly improves the effectiveness of the routing heuristics when applied to this modified routing pass. There are some subtleties when coordinating the routing of multiple qubits to the same place to ensure the paths don't overlap. For the purposes of our evaluations we do the following but many similar heuristic strategies are possible. Taking the next operation to apply, we first find the shortest paths (using any shortest path algorithm on a graph) between all the pairs of qubits. We choose the qubit with the shortest sum of paths to the other two qubits as the destination. SWAPS following these two paths are then inserted into the circuit. The two shortest paths are checked for overlap. If the ending points overlap, the second is only routed to the penultimate hardware location along the swap path and the first becomes the middle qubit adjacent to both others. This can save one valuable SWAP but doesn't affect the correctness. Once they are adjacent, the Toffoli gate is now on adjacent qubits and routing can continue to the next operation. Finally, the second decomposition pass is run. This is different from normal decomposition as there are only Toffoli gates to decompose and they are already mapped to neighboring qubits. We could use the default 6-CNOT decomposition and still get the above benefit of improved routing but now that we have more information, this can be exploited to further reduce SWAPs due to a mismatch between the decomposition and the hardware connectivity. If all three pairs of qubits are connected, then the 6-CNOT Toffoli of Figure \ref{fig:6-cnot-decomp} is best, otherwise use the 8-CNOT Toffoli of Figure \ref{fig:8-cnot-decomp}, ensuring the middle qubit is used for the middle of the decomposition (Any of the three qubits can be the target by simply moving the two H gates to that qubit). When routing complex operations like the Toffoli, we recognize the underlying hardware does not usually support triangles in the connectivity graph but linear connectivity is sufficient for a decent decomposition. Since we are creating operations on three qubits, the qubits must be routed into a valid linear connectivity. That is, a configuration where each qubit is connected with at least one of the other qubits. This method can be easily extended to be noise-aware like previous work \cite{map1, map2} by using a noise-aware mapper with the simple modification described earlier where the path-finding graph has weighed edges with the $\text{--}\log$ value of the CNOT success rate. The path distance represents the $\text{--}\log$ probability of success of that particular path where lower values indicate a higher success rate and the shortest path can be found just as before and the routing steps are unchanged. Any routing strategy designed for one and two-qubit gates can be modified to work for one, two, and three-qubit gates and used as the first routing step of Trios. In programs where there are no three qubit gates as in the typical NISQ benchmark, Bernstein-Vazirani \cite{bv}, which is specified directly as CNOT gates, our strategy will have no effect. Many benchmarks, however, are written using Toffoli gates because they are the quantum analog the AND gate ubiquitous in arithmetics and other common subroutines. Trios can naturally be extended to any multi-qubit operation of three or more qubits but this introduces the challenges of simultaneously routing many qubits and of designing decompositions that are efficient with whichever grouping the simultaneous router can achieve. It is not obvious how to route more than three qubits into a line or other desired shape. As many NISQ benchmarks are not typically written with more complex structures and usually phrase them in terms of one-, two-, and three-qubit gates, this extension may only be desirable for larger-scale quantum computing. \section{Evaluation} \label{sec:evaluation} \subsection{Toffoli Only Circuits} We first evaluate the effect of our new compilation strategy by studying simple circuits containing only a single Toffoli gate. In these experiments, we place the three input qubits at random locations on the target hardware to emulate the potential locations of the qubits at some intermediate point in the execution of a more complex circuit. We study these circuits on a real IBM device, namely IBM Johannesburg, a 20-qubit device with limited connectivity in Figure \ref{fig:device-diagrams}a. We use the default Qiskit compiler which decomposes the Toffoli gates before doing shortest path routing compared to our proposed method where we do shortest path routing first and then decompose the Toffoli. We study the use of two different Toffoli implementations, a 6 CNOT decomposition with full qubit connectivity and an 8 CNOT decomposition with linear qubit connectivity. In all four configurations, we compare the total compiled CNOT counts which correlates with the total success probability of a program. For execution on Johannesburg, we prepare the qubits in the states $\ket{110}$, perform the compiled Toffoli, then measure the three qubits of interest and compute the success rate as the probability of obtaining the correct answer (here the $\ket{111}$ state), where each experiment is performed with 8192 trials. \subsection{NISQ Benchmarks and Quantum Subroutines} We also study Trios on real quantum benchmarks of moderate size using simulation only. The error rates of current devices are still too high to run benchmarks of these sizes but are expected to run on current devices as errors improve in the near future. We choose error rates 20x better than Johannesburg rates as this make the estimated success probabilities within a reasonable range and is a realistic near-term estimate. We discuss sensitivity to this choice later. We study four implementations of the many-controlled-NOT (CnX) gate. This subroutine has many use cases from Grover's algorithm to various arithmetics. The implementations take advantage of differing numbers of ancilla and are chosen based on the number of available qubits on hardware. We study three adder implementations: Cuccaro, Takahashi, and QFT. The first two have many uses of the Toffoli gate while the latter has no such gates, for comparison. We study a small version of Grover's algorithm as well which makes use of the \verb|cnx_logancilla| subroutine. Finally, we compile two common NISQ benchmarks: QAOA for Max-Cut and Bernstein Vazirani (BV). We expect no gain on these benchmarks since they do not contain any Toffoli gates. A summary of our benchmarks is found in Table \ref{tab:benchmark_details} using implementations found in \cite{ourbenchmarks}. \begin{table}[!b] \centering \begin{tabular}{cccc} \toprule Benchmark & Qubits & Toffolis & CNOTs* \\ \midrule \verb|cnx_dirty| \cite{toff_any} & 11 & 16 & 128 \\ \verb|cnx_halfborrowed| \cite{gidney_toff} & 19 & 32 & 256 \\ \verb|cnx_logancilla| \cite{barenco} & 19 & 17 & 136 \\ \verb|cnx_inplace| \cite{gidney_toff} & 4 & 54 & 490 \\ \verb|cuccaro_adder| \cite{cuccaro} & 20 & 18 & 190 \\ \verb|takahashi_adder| \cite{takahashi} & 20 & 18 & 188 \\ \verb|incrementer_borrowedbit| \cite{gidney_toff} & 5 & 50 & 448 \\ \verb|grovers|\cite{grover} & 9 & 84 & 672 \\ \verb|qft_adder| \cite{qft} & 16 & 0 & 92 \\ \verb|bv| \cite{bv} & 20 & 0 & 19 \\ \verb|qaoa_complete| \cite{qaoa} & 10 & 0 & 90 \\ \bottomrule \\ \end{tabular} \caption{Details about our benchmarks both NISQ programs and other quantum subroutines. We consider circuits with and without Toffoli gates where we expect advantage only for circuits containing Toffoli gates. For BV we assume the all 1-bit string. The different CnX (many-controlled-NOT) gates use various numbers of ancilla. *The total number of CNOT gates is after decomposition with the 8-CNOT Toffoli but does not including any SWAPs for routing.} \label{tab:benchmark_details} \end{table} As noted previously, the connectivity of the underlying hardware has a significant impact on the number of required SWAPs. For example, on a completely connected set of qubits, no SWAPs are ever needed. In architectures with greater connectivity, we may opt for a more efficient Toffoli decomposition using 6 CNOTs. With simulation we study the effect of connectivity on the overall expected success rates and gate counts. We study four different connectivity models, all shown in Figure \ref{fig:device-diagrams}, each with 20 qubits, the topology of IBM's Johannesburg device containing four connected rings, a 2D mesh, a line, and a small clustered architecture representative of a QCCD ion trap. We use error rates reported by IBM obtained via randomized benchmarking on a daily basis; for simulations we use error numbers obtained from Johannesburg obtained on 8/19/2020 with an average T1 time of $70.87\mu s$, T2 time of $72.72\mu s$, two qubit gate time of $0.559 \mu s$, a one qubit gate time of $0.07\mu s$, two qubit gate error of 0.0147, one qubit gate error of 0.0004. Source code for all experiments is available at \cite{sourcecode}. Experiments using IBM are tested with version 0.14.0 through their Python API. When compiling with Qiskit for the single Toffoli experiments, we use the default settings for the \verb|transpile| function while specifying the Johannesburg backend. This means light optimization is performed: a stochastic routing policy is chosen, and some simple optimizations such as single qubit gate consolidation is performed. We fix the initial mapping to force routing to occur. \section{Conclusion} \label{sec:conclusion} We present a new quantum compilation structure, Trios, with a split decomposition pass to greatly reduce compiled communication cost and enable architecture-tuned decompositions. We specifically target the three-qubit Toffoli operation to capture program structure enabling more optimal compiled circuits. Because current quantum computers are especially error prone, they require high levels of optimization to reduce gate counts and maximize the probability the compiled program will succeed. Orchestrated Trios both greatly improves the effectiveness of qubit routing given newly exposed program structure and improves decompositions with connectivity-awareness. These both greatly benefit the program success rate, a critical metric for today's error-prone and resource-constrained quantum computers. We hope this inspires more hierarchically designed NISQ algorithms now that we have shown breaking the abstractions of discrete compilation passes can help bridge the gap between these noisy quantum hardware and practical applications. \section{Results and Discussion} \label{sec:results} \subsection{Trios Reduces Total Number of Gates} In both sets of experiments, the total number of gates required to make the input programs executable is much less than when using the default Qiskit compiler. When compiling our simple programs consisting of a single Toffoli gate with qubits mapped in random locations, we reduce the average number of gates by 35\% geomean. In Figure \ref{fig:ibm-toffoli-gates} we show 35 different triplets of hardware qubits for each of the four strategies. For each triplet, we note the total distance between the qubits on the hardware, given by the shortest path distance in the underlying topology. Even when the distance is relatively small, Trios outperforms reducing overall gate count and as the distance increases, the margin tends to increase. In the small distance cases, this can be attributed to Trios choosing the better Toffoli decomposition for a linearly connected topology. This is significant for two reasons. First, the fewer the gates, the less likely an error occurs due to qubit manipulation. Second, fewer gates, especially long sequential chains of SWAPs, often means lower circuit depth, meaning fewer chances for decoherence errors. Together this translates into faster and more successful programs. This advantage extends to our NISQ benchmarks which contain various numbers of Toffoli gates. In Figure \ref{fig:benchmark-gate-ratio} we note substantial reductions in total gates across all benchmarks containing Toffoli gates across all underlying topologies. The only exception is the two smallest benchmarks (on 4 and 5 qubits) for the clustered topology because they could be compiled with zero SWAPs. An extreme of the clustered topology is a single cluster with all-to-all connected qubits. On this device, Orchestrated Trios would have no benefit as operations can be performed between any pair of qubits so no SWAPs are needed and routing is trivial. However, as quantum technologies scale to more than a few qubits, fully-connected architectures hits physical limitations and must be re-engineered. As trapped ion qubit chains get longer, for example, gate operations become slower and lower fidelity. \cite{trapsize} showed that the optimal trap size is 15-25 ions interconnected similar to our cluster model with cluster sizes of 15-25 where Trios does benefit. On average, for Toffoli-containing programs we reduce gate count 37\%, 36\%, 48\%, 26\% for Johannesburg, Grid, Line, and Cluster topologies respectively with the maximum gain obtained for linear devices. \subsection{Trios Improves Overall Success Rate} In general, we expect programs with fewer total two-qubit gates, to succeed with higher probability. In devices with limited connectivity, the addition of routing operations like SWAPs, usually decomposed to 3 CNOTs, can severely reduce the chance an input program can succeed. While success rate is inversely correlated with number of gates, gate error is not the only reason a program can fail and reducing gate counts does not \textit{guarantee} improved success rates. In Figure \ref{fig:ibm-toffoli-success} we show the success rates of our Toffoli-only experiments when the two controls are initialized to $\ket{1}$ and the target is initialized to $\ket{0}$ so we measure the probability of obtaining $\ket{111}$. These results are obtained from Johannesburg on 8/19/2020. The x-axes of both Figures \ref{fig:ibm-toffoli-success} and \ref{fig:ibm-toffoli-gates} line up to compare gate counts and resulting success rate. In general, experimentally, fewer gates results in substantial improvements to success rates. For example, a Toffoli on (6-17-3) compiled with Trios improves success rate from around 30\% to over 50\%. On average, we improve success rates by 23 \% geomean with max of 286\%. In Figure \ref{fig:ibm-toffoli-success-norm}, we show improvements compiled with Trios normalized to baseline for 99 different triplets of varying total distance on Johannesburg. Trios on average improves the probability of success for these circuits. However, there are a small number of cases where Trios performs worse despite having a smaller number of total gates. This can be attributed to several different factors. For example, the chosen edges for SWAP paths may be more noisy, or on pairs of edges with greater crosstalk, or the final qubits which are measured have worse readout error. Regardless, reducing the overall gate count of a program is an important contributing factor to improving expected success rate. For our simulated NISQ benchmarks, we see even larger gains. The reduced gate counts in Figure \ref{fig:benchmark-gate-ratio} translate to major improvements in simulated success rate in Figure \ref{fig:benchmark-success} (normalized success rates in Figure \ref{fig:benchmark-success-norm}). For example, in \verb|cnx_logancilla-19|, Trios more than doubles the expected success rates when compiled to each of the architectures. In many cases, the expected success rate of programs compiled with Qiskit is effectively zero while Trios has a realistic chance of obtaining the correct answer. As expected, on programs containing no Toffoli gates, Trios has no effect on success showing that it introduces no excessive overhead. This suggests Trios can easily be added to other quantum compilation toolflows. \subsection{Trios Routes Complex Interactions Better} Trios improves gate counts, and consequently improves success rates, by routing more efficiently and choosing more appropriate Toffoli decompositions based on the underlying architecture's connectivity. Current compilers, like Qiskit, perform routing on fully decomposed and unrolled programs, and while this must eventually be done, it leads to less efficient routing policies and relies on assumptions that a theoretically good decomposition (fewer CNOTs) is the best decomposition for the hardware. Trios eliminates this by choosing a context-dependent Toffoli decomposition and routing multiqubit gates as single units. Trios greatly improves effectiveness compared to a \textit{heuristic-based} compiler by applying similar heuristics to the higher abstraction level Toffoli gates. An optimal routing of the decomposed circuit would be better except it cannot select the best architecture location-specific decomposition. This makes a huge difference specifically with Toffolis on any square-grid-based device. One might choose to improve the solution found by an optimal compiler by always decomposing Toffolis to the 8-CNOT version before optimally routing, but this will still limit the solution. There are multiple possible qubit orders for the decomposition and the best can only be selected after the routing pass. \balance \subsection{Simulation Sensitivity to Error Rates} For our simulations we use an error model (20x better than current errors on Johannesburg) which is forward looking. As errors improve, we expect Trios to have a reduced impact on program success rates since gate errors will contribute less and less to program failure though Trios will never perform worse than the baseline. In Figure \ref{fig:benchmark-error-sensitivity} we study the sensitivity of simulation results to two qubit error rates beginning with current IBM error rates. For poor error rates, the benefit of Trios is extremely large, owed to the fact that programs compiled with the baseline have probabilities of success very close to 0. In our simplified simulation framework, as error rates improve we expect an exponential drop off in improvement with the most advantage obtained with current error rates.
\section{Introduction} A thermodynamic phase transition is characterized by the non-analyticity of thermodynamic observables with respect to temperature across two or more different phases. These phase transitions were systematically classified by Ehrenfest \cite{Ehrenfest, articlegj}. Ehrenfest's classification is based on the \textit{order} of the phase transition, i.e. a $r$th order phase transition is characterized by the $r$th derivative of the partition function (or free energy) becoming discontinuous at the temperature where the phase transition takes place. A thermodynamic function that takes different values across different phases is called an order parameter. With regards to second order phase transitions, Landau put forward a phenomenological Hamiltonian which captures essential aspects of the transition in the infrared limit of the system \cite{Landau:1937obd}. His formalism suggests that near the critical temperature $T_C$ (the temperature at which phase transition takes place), the Hamiltonian can be expanded in terms of a \textit{local} order parameter $\phi (x)$ on the basis of appropriate symmetries. For example, if a system has a $Z_2$ symmetry i.e. it is symmetric under $\phi(x) \to -\phi(x)$; then for $T \approx T_C$ and a small external coupling field $h$, the Hamiltonian $H(\phi)$ can be expressed as follows: \begin{equation} \beta H =\int d^dx\left( \frac{K}{2}(\grad \phi)^2 + t \phi^2(x) + u \phi^4(x) + \dots - h.\phi(x) \right) \eeq where $t$ and $u$ are couplings which are functions of the temperature. Here we have restricted ourselves to only the lowest order terms. It can be readily demonstrated that the partition function computed using this Hamiltonian gives rise to different values of the order parameter for $t<0$ and $t>0$ using the saddle point approximation. The divergences of observables near the critical point are captured using \textit{critical exponents}. To obtain the correct picture of fluctuations away from the saddle point, we need to incorporate the field-theoretic machinery of the renormalization group (RG) flows of couplings in the theory. We can use the behavior of couplings under RG flow to determine how thermodynamic observables scale in the vicinity of the critical surface. Consequently, we can derive various scaling relations between the theory's critical exponents, which are robust under fluctuations away from the saddle point. In order to understand the RG flows in the coupling space, we start by finding out fixed points of the flow and then expand the couplings about the fixed points. This leads to a classification of the couplings into relevant, marginal, and irrelevant depending on their behavior in the infrared (IR). In the IR, relevant couplings diverge away from the IR fixed points as we integrate out degrees of freedom while irrelevant couplings converge towards the IR fixed point. The subspace of relevant couplings is usually finite-dimensional, and hence theories in the IR are characterized by only a finite number of relevant couplings. Such IR behaviour defines the notion of \textit{universality classes} \cite{Hollowood:2009eh, Peskin:1995ev, kardarcourse, kardar_2007}. The set of relevant couplings can be used to determine some of the critical exponents, and scaling relations between them further allows us to determine all the critical exponents \cite{doi:10.1063/1.1734338, JOSEPHSON1966608,doi:10.1063/1.1696618, kardarcourse, kardar_2007}. \begin{center} \begin{figure} \begin{tikzpicture}[node distance= 2cm, every node/.style={fill=white, font=\sffamily}, align=center] \node (start) [base] {\textbf{Higher order Phase transitions}}; \node (lop) [base, below of=start] {\textit{Local order parameter}}; \node (nlop) [base, xshift= 6cm] {\textit{Non-local order parameter:}\\ (To be discussed in\\ forthcoming work)}; \node (dimension1) [base, below of=lop, xshift= -4.5cm] {$d > 2r$}; \node (dimension2) [base, below of=lop, xshift= 4.5cm] {$d \leq 2r$}; \node (saddle1) [base, below of=dimension1, yshift= -2.5cm] {Saddle Point approximation \\valid, critical exponents\\ given in Table \ref{table1}}; \node (saddle2) [base, below of=dimension2, xshift= -2.5cm, yshift= -2.5cm] {Saddle Point valid,\\ critical exponents are \\ given in Table \ref{table1}}; \node (saddle3) [base, below of=dimension2, xshift= 3cm, yshift= -2.5cm] {Fluctuations dominate over saddle\\ point, Scaling relations found \\ using RG flow in \S\ref{secscaling} (Table \ref{table2}),\\ Critical exponents given in Table \ref{table5}}; \draw[->] (start) -- (lop); \draw[->] (start) -- (nlop); \draw[->] (lop) -| (dimension1); \draw[->] (lop) -| (dimension2); \draw[->] (dimension1)-- (saddle1); \draw[->] (dimension2)-| node[yshift = -1.5cm]{Follows \\ Ginzburg Criteria (\S\ref{Ginzburg})} (saddle2); \draw[->] (dimension2)-| node[yshift = -1.5cm]{Does not follow \\Ginzburg criteria} (saddle3); \end{tikzpicture} \caption{A flowchart describing the general outline of the paper.} \label{flowchart} \end{figure} \end{center} We will now briefly describe our work, a summary of which is given in Fig. \ref{flowchart}. In the first part of our work, we apply various aspects of our above discussion to the study of higher order phase transitions described by local order parameters. In \S \ref{Landauth} we generalize Landau's phenomenological Hamiltonian for higher-order phase transitions using a local order parameter such that physical observables derived from the partition function have analytic properties in the $h-t$ plane apart from a branch cut ending at the critical point. Next, we define critical exponents for higher order phase transitions in \S \ref{seccrit} and calculate them using saddle point approximation to get the leading order predictions. We treat fluctuations over the saddle point in \S \ref{fluctuations}, and show that saddle point analysis is valid above the upper critical dimension $d_u = 2r$ for higher order transitions. Afterwards, we formulate the Ginzburg criteria to classify when saddle point results are valid and when critical exponents are modified due to fluctuations below the upper critical dimension. The argument for the lower critical dimension remains unchanged as compared to the second order case. In \S \ref{secscaling} we obtain scaling forms of physical observables for higher order phase transitions from the renormalization group analysis of the system. We use this to derive scaling relations between critical exponents beyond the saddle point. We show that the imposition of analyticity in the phenomenological Hamiltonian combined with the scaling implies that critical exponents are the same above or below $T= T_C$ and $h=0$ (Appendix \ref{exponentspm}). We also show that the divergence of the correlation length naturally leads to the hyperscaling relation. We then proceed onto computing corrections to the critical exponents using the one-loop beta functions in \S \ref{crrg}. We use this to calculate the critical exponents corresponding to $r=3$ and $r=4$ phase transitions below the upper critical dimension. We show that there are no relevant couplings in the vicinity of the non-trivial fixed point, and consequently, the sole corrections arise due to flows near the Gaussian fixed point. For $r \geq 5$, the one-loop corrections to the beta function vanish, and hence we need to go beyond one-loop calculations to find corrections to the critical exponents for such cases. In general, there also exist phase transitions which are described by non-local order parameters. An important class of such phase transitions include transitions characterized by a gap in the eigenvalue spectrum. These include the Gross-Witten-Wadia (GWW) model \cite{Gross:1980he, WADIA1980403, wadia2012study}, Douglas-Kazakov model \cite{Douglas:1993iia}, Brownian walk models which map onto two-dimensional continuum Yang-Mills with different gauge groups \cite{FORRESTER2011500}, constrained Coulomb gas \cite{Cunden_2017}, bipartite entanglement \cite{PhysRevA.81.052324, PhysRevLett.101.050502, PhysRevLett.104.110501} and various other examples \cite{PhysRevLett.119.060601, PhysRevLett.107.177206, PhysRevE.88.042125, PhysRevLett.109.167203, 5730574, PhysRevLett.101.216809}. Further examples of third order phase transitions are given in the review \cite{Majumdar_2014}. Such phase transitions are outside the scope of our present work and will be dealt with in a forthcoming work. Fourth order phase transitions with local order parameter have been proposed as the nature of superconducting transition in certain materials in \cite{pardeep97, articlePK99,articlePK00, articlePK02, doi:10.1080/14786430802585158, doi:10.1080/13642810208223158, PhysRevB.71.104509}\footnote{We feel \cite{pardeep97, articlePK02, doi:10.1080/13642810208223158} have not received significant attention in the literature regarding higher order phase transitions, and in particular, we found their work only after we had independently rederived some of their results, and consequently there is overlap between parts of \S \ref{Landauth}, \S \ref{sad} and \S \ref{scalerg} of our work with theirs, which we have clearly outlined.}. Another example of fourth order phase transition is the Ising model on the Cayley tree proposed in \cite{STOSIC20091074}. Divergences using zeroes of the partition function in higher order phase transitions were analyzed in \cite{JANKE2006319}. Apart from thermodynamic phase transitions, higher order phase transitions also occur in the context of topological phase transitions. An example of this is the phase transition between 2D Chern insulators, in which the third derivative of the free energy has a discontinuity. However, there are no local order parameters for such topological phase transitions, and consequently, Landau theory cannot be formulated to describe them. Consequently, we will not be looking at such phase transitions in our work. \section{Higher order phase transitions with local order parameters: Landau theory}\label{sec1} In this section, we will study a class of $r$th order phase transitions, which are described using local order parameters. We argue that the phenomenological theory describing these phase transitions in the infrared (IR) can be described using the Landau formalism. We will also introduce critical exponents corresponding to $r$th order phase transitions and calculate them using the saddle point approximation. \subsection{The Landau Hamiltonian for higher order phase transitions} \label{Landauth} We work in $d$ spatial dimensions, which can be understood both as the non-relativistic spatial limit of a $d+1$ dimensional relativistic theory or as an analytic continuation of the Lorentzian theory to a Euclidean theory via Wick rotation. Let us now write down the most general Hamiltonian, which obeys the following assumptions: \begin{enumerate} \item \textbf{Analyticity assumption}: We assume that the critical exponents are analytic everywhere apart from a singular line which terminates at the critical point in the plane spanned by the external field $h^i$ and temperature difference $t$ (where $t = \frac{T- T_C}{T_C}$), with the line given by $h^i=0$ and $t<0$ as shown in Figure \ref{fig:ht}. In other words, the free energy is analytic everywhere in the plane apart from this line. Thus the free energy term containing the external field in the phenomenological Hamiltonian should be chosen such that the associated critical exponents are analytic, i.e., the critical exponents have the same values when the critical point is approached from different directions in the $(h,t)$ plane. \begin{figure}[h] \begin{center} \begin{tikzpicture} \draw[black, thick , <->] (0,-3) -- (0,3); \draw[black, thick , ->] (0,0) -- (4,0); \draw[black, thick, decorate, decoration={snake, amplitude= 0.75mm}] (-3.5,0) -- (0,0); \draw[black, thick , ->] (-3.5,0) -- (-4,0); \node at (-0.5,2.5) {$h $}; \node at (4,-0.5) {$t $}; \end{tikzpicture} \end{center} \caption{The order parameter $\phi$ is analytic everywhere except on the branch cut in $(h-t)$ plane shown above.} \label{fig:ht} \end{figure} \item \textbf{Assumption regarding higher order terms}: We assume a small external field $h$ such that only the leading order term in $h$ contributes and higher order terms are suppressed. We also demand that terms involving higher derivatives of the order parameter are suppressed. These conditions are weaker than the first condition and serve to simplify our calculations and to clearly demonstrate the physics of the problem at hand. \item \textbf{Fine tuning assumption}: Let $\phi_i(x)$ denote the order parameter of the phase transition. In hindsight, for $r$th order phase transitions, we assume that the terms $\abs{\phi_i}^{2(k-1)}, \, k < r$ either do not appear in the Hamiltonian, or their coefficients have a very small magnitude and do not change signs at the critical temperature of the phase transition. We enforce this requirement so that these terms do not alter the order of the phase transitions, as a significant contribution from such terms can potentially change the order. Similarly, we also demand that the terms of the form $\abs{\phi_i}^{2k}, \, k > r$ die off for a $r$th order phase transition. \item \textbf{Rotational symmetry}: We further assume that our system possesses rotational symmetry and hence the Hamiltonian is invariant under O($N$) transformation ($N\geq 1$) given by \begin{equation} \phi_i \to \phi_i' = R_i^j \, \phi_j, \quad R \in O(N) \eeq where the rotation matrices $R$ belong to the matrix representation of $O(N)$. \end{enumerate} The most general phenomenological IR Hamiltonian obeying above assumptions which describes $r$th order phase transition is given by: \begin{equation} \beta H = \int d^dx \left[\frac{K}{2} \abs{\grad \phi_i}^2 + t_r \,|\phi_i (x)|^{2(r-1)} + u_r \, |\phi_i (x)|^{2r} - (h_i\phi^i) \, |\phi_i (x)|^{2(r-2)}\right], \label{LG1} \end{equation} where we are using Einstein summation notation to sum over the index $i$ i.e. $|\phi_i|^2 = \sum_{i=1}^{n} \phi^i \phi_i$. Here $K$ is the coefficient of the kinetic term and the couplings $t_r$ and $u_r$ are expressed as functions of temperature as follows: \begin{equation}\label{2.3} \begin{split} t_r (T) &= c(T- T_C) + \text{O}(T- T_C)^2 = c't + \text{O}(t^2) \\ u_r (T) &= u_0 + u_1(T- T_C) + \text{O}(T- T_C)^2 = u_0 + u_1' t + \text{O}(t^2) \end{split} \eeq where $T_C$ is the temperature at which the transition takes place, $c, c', u_1, u_1'$ and $u_0$ are undetermined constants, and $t = \frac{T- T_C}{T_C}$ as defined previously. The constant $u_0$ must be positive in order to ensure that our Hamiltonian is positive-definite while $c$ must be positive in order to obtain the correct description of phases above and below the critical temperature. The exact values of these constants depend on the details of the system. The Hamiltonian in \eqref{LG1} was also discussed for the specific case of third and fourth order superconducting phase transitions in \cite{pardeep97, articlePK99,articlePK00, articlePK02, doi:10.1080/14786430802585158, doi:10.1080/13642810208223158, PhysRevB.71.104509}. The mass dimensions of the couplings appearing in \eqref{LG1} are given by: \begin{equation}\label{couplingdimensions} \begin{split} [t_{r}] &= 2(r + d-1) - dr\\ [u_{r}] &= r(2 - d) +d\\ [h] &= d + (2r-3)\left( 1 - \frac{d}{2}\right) . \end{split} \eeq Notice that the couplings in the above Hamiltonian can be non-renormalizable depending on the dimension $d$, and hence the physical observables can potentially be plagued by UV divergences untameable by a finite number of counterterms. However our Hamiltonian is only defined in the IR, and we can impose a UV cutoff upto which the Hamiltonian description is valid. Thus we are not bothered by non-renormalizable interactions, analogous to the standard treatment of second order phase transitions in $d>4$. The (Gibbs) partition function of the system described by the Hamiltonian \eqref{LG1} is given by: \begin{equation} Z = \int [D\phi(x)] \, \exp\left[ - \beta H(\phi(x), \, h)\right]. \label{LG2} \end{equation} The (Gibbs) free energy is given by $\beta F = - \log Z \approx V_d \, \text{ min} \left[ V(\phi) \right]_{\phi_0}$ where $V_d$ is the $d$-dimensional volume and the potential $V(\phi)$ is evaluated at the minima $\phi_0$. \subsection{Critical exponents} \label{seccrit} In this subsection, we define various critical exponents and compute them using saddle point approximation. We will drop the index $i$ in $\phi_i$ for notational convenience at various places in the text. \subsubsection{Definition} Let us introduce the critical exponents corresponding to these phase transitions. These exponents are generalizations of the exponents which characterize the second order phase transitions. \begin{enumerate} \item The exponent\footnote{The critical exponent $\beta$ should not be confused with $\beta$ appearing in the partition function, which is given by $\beta = \frac{1}{k_B T}$. To avoid confusion, whenever we talk about the critical exponent $\beta$, we mention it explicitly.} $\beta$ is defined as the divergence of the order parameter at zero external field: \begin{equation} \label{critbeta} \phi(t, h =0) \propto \begin{cases} 0, &\quad T>T_C; \\ \abs{t}^{\beta}, &\quad T < T_C.\\ \end{cases} \eeq \item The exponent $\delta$ is defined as the divergence of the order parameter at the critical temperature: \begin{equation} \label{eqnofstate} \phi(T = T_C, h) \propto h^{\frac{1}{\delta}}. \eeq \item Denoting $\Phi$ as the integral of the order parameter over the full space i.e. $\Phi = \int d^dx \, \phi(x)$, we define the generalized susceptibility (response function) as \begin{equation} \chi = \frac{\partial \braket{\Phi}}{\partial h} \Big|_{h=0}, \label{susceptibility} \eeq where $\braket{\Phi}$ is the one-point function defined as: \begin{equation} \braket{\Phi} = \frac{1}{Z}\int [D\phi(x)] \, \int d^dx \, \phi(x)\, \exp\left[ - \beta H(\phi(x), \, h)\right] \eeq and where $Z$ is given in \eqref{LG2}. The divergence of the susceptibility is given by \begin{equation} \label{critgamma} \chi(T, h=0) \propto \abs{t}^{-\gamma}. \eeq Using the definition of susceptibility in equation \eqref{susceptibility}, we obtain it's expression in terms of the order parameter by differentiating the partition function w.r.t $h$. \begin{equation} \label{meqn} \begin{split} \chi &\equiv \beta \braket{\Phi (x) \, \Phi^{2r-3}(y)}_c = \beta\left(\braket{\Phi (x) \, \Phi^{2r-3}(y)} - \braket{\Phi (x)} \, \braket{\Phi^{2r-3}(y)}\right) \\ &\equiv \beta \int d^dx \, d^dy \braket{\phi (x) \, \phi^{2r-3}(y)}_c =\beta \int d^dx\, d^dy \left( \braket{\phi (x) \, \phi^{2r-3}(y)} - \braket{\phi (x)} \, \braket{\phi^{2r-3}(y)} \right) \end{split} \eeq where $\braket{\Phi (x) \, \Phi^{2r-3}(y)}_c$ and $\braket{\phi (x) \, \phi^{2r-3}(y)}_c$ are the connected correlators. Note that setting a UV cuttoff removes divergences associated with the evaluation of product of fields coinciding at a point $y$ in $\braket{\phi^{2r-3}(y)}$, thus making it a well-defined quantity. \item The (Gibbs) free energy is given by $\beta F = - \log Z$. Let us denote the $n$th derivative of the free energy as $C_n = \frac{\partial^{n}}{\partial t^n} \left( \frac{\beta F}{V}\right)$. Since we are interested in a $r$th order phase transition, we expect the $r$th derivative of the free energy to diverge at $t = 0$. We define the exponent $\alpha$, which characterizes this divergence, as follows: \begin{equation} \label{gap1} C_r \propto \abs{t}^{-\alpha}. \eeq Note here that the specific heat is given by the second derivative of free energy i.e. $ C_V = -C_2 \propto \frac{\partial^{2}}{\partial t^2} \left( \frac{\beta F}{V}\right)$. Hence for a second order phase transition, $C_V$ diverges. For $r$th order phase transition, the specific heat is given by: \begin{equation} \label{gap2} C_V(T, h=0) \propto \abs{t}^{r-\alpha -2}. \eeq \item We also define a two-point connected correlator given by \begin{equation} \label{gfeqn} G^{r}_c(x,y) = \braket{\phi (x) \, \phi^{2r-3}(y)}_c = \braket{\phi (x) \, \phi^{2r-3}(y)} - \braket{\phi (x)} \, \braket{\phi^{2r-3}(y)} \eeq Note that $G^{r}_c(x,y)$ only depends on the separation between the operator insertions. This is because we are working in Euclidean space which has translations and rotations as a part of its isometry group. If the separation is taken to be very large than the corelation length $\zeta$ i.e. $\abs{x-y} \gg \zeta$, then $G^{r}_c(x,y)$ roughly decays as $G^{r}_c(x,y) \sim \exp{-\frac{\abs{x-y}}{\zeta}}$. We can also write $\chi$ as given in equation \eqref{meqn} as an integral over the connected Green function as defined in equation \eqref{gfeqn} \begin{equation} \label{gap3} \chi = \beta \int d^d x \, d^d y \, G^{r}_c(x,y) = \beta V \int d^d\rho \, G^{r}_c(\rho,0), \eeq where we have defined $\rho = \abs{x-y}$. Let the largest value of $G^{r}_c(\rho,0)$ be given by $G_0$ when $\rho < \zeta$, where $G_0$ is always finite. Using the mean value theorem, we have the following inequality, where $V$ is the system's volume (where $V \geq \zeta^d$): \begin{equation} \label{divergg} \frac{\chi}{\beta V} < G_0\, \zeta^d. \eeq Here we have assumed that the contributions from $\rho \gg \zeta$ are negligible since the correlator dies off exponentially. Thus when $\chi$ diverges, the above inequality ensures that $\zeta$ necessarily diverges as well. This gives rise to the critical exponent $\nu$ defined by \begin{equation} \zeta (T, h=0) \propto \abs{t}^{-\nu}. \eeq \end{enumerate} Note that here we have not labelled two different exponents $\gamma_{\pm}, \, \alpha_{\pm}$ etc. while approaching from the $t<0$ and $t>0$ directions. This is because we have already imposed analyticity in the $(h,t)$ plane while writing the phenomenological Hamiltonian, and consequently, we have $\gamma = \gamma_{\pm}, \, \alpha = \alpha_{\pm}$ and so on. It can be shown that even for deviations away from the saddle point, we still get single-valued exponents in the $(h,t)$ plane. We will prove this statement in Appendix \ref{exponentspm}. \subsubsection{Dilatation symmetry at critical temperature} \label{dilatation} In the previous subsection, we discussed that at critical temperature, the correlation length $\zeta$ diverges as a consequence of the divergence of susceptibility, which follows from equation \eqref{divergg}. At the critical temperature, the correlation length becomes infinite (or more precisely, it becomes of the order of system size). Since there are no other length scales in the problem, $G^r_c(x,y)$ should decay as a power law. This implies that there is an emergent dilatation symmetry at the critical temperature, and the connected Green function transforms as follows \begin{equation} G_c^r \left( t =0, \lambda x \right) = \lambda^{\kappa} \, G_c^r \left( t =0, x \right). \eeq Here $\kappa$ is the scaling dimension under the scaling transformation. Thus the system at criticality exhibits self-similarity at all intermediate scales between system size and the UV cutoff. \subsection{Critical exponents from saddle point approximation}\label{sad} In this subsection, we will compute the critical exponents defined above, using saddle point approximation. The saddle points can be found by minimizing the potential appearing in the Hamiltonian \eqref{LG1}. The potential is given by (as mentioned before, we have dropped the index $i$ for notational convenience): \begin{equation} V\left[ \phi\equiv \phi(x)\rs = t_r \, \phi^{2(r-1)} + u_r \, \phi^{2r} - (h.\phi) \, \phi^{2(r-2)}. \label{LG4} \end{equation} \begin{enumerate} \item Working in the saddle point approximation, we impose $\frac{\partial V}{\partial \phi} = 0$ to get the values for the order parameter above and below the critical temperature, \begin{equation} \label{msaddle} \phi = \begin{cases}\sqrt{\dfrac{-t(r-1)}{ru}}, \quad &t<0\\ 0, \quad &t>0. \end{cases} \eeq This reduces to the familiar value $\phi^2 = \frac{-t}{2u}$ for second order phase transitions. For the special case of $r=3, 4$, equation \eqref{msaddle} matches with the expressions derived in \cite{pardeep97}. Comparing this with \eqref{critbeta}, we obtain $\beta = 1/2$. \item Upon substituting the value of $\phi$ from eqn \eqref{msaddle}, the free energy $\frac{\beta F}{V} = \text{min} \left[ V(\phi)\rs $ is given by \begin{equation} \frac{\beta F}{V} = \begin{cases} - \left( \dfrac{u}{r-1}\right)\left(\dfrac{-t(r-1)}{ru}\right)^{r}, \quad &t<0\\ 0, \quad &t>0.\\ \end{cases} \eeq For the special case of $r = 3,4$; this matches with the expression of free energy derived in \cite{pardeep97}. Thus the $r$th derivative of the free energy with respect to the temperature is discontinuous at $T=T_C$, which is given by \begin{equation} \label{CR} C_r(T, h=0) \propto \begin{cases}(-1)^{r+1}\left(\dfrac{r! \, u\, (r-1)^{r-1}}{(ur)^{r}}\right) , \quad &t<0\\ 0, \quad &t>0\\ \end{cases} \eeq For $r=2$, this reduces to the familiar value for the specific heat, i.e. $C_2 = - C_V \propto \frac{1}{2u}$. Thus using \eqref{CR} we conclude that $\alpha = 0$. \item Let us now look at the critical exponent associated with susceptibility. Using our Hamiltonian and the definition of susceptibility from \eqref{susceptibility}, we obtain the following expression. \begin{equation} \frac{1}{\chi} = \begin{cases} -\dfrac{4(r-1)t}{(2r-3)}, \quad &t<0\\ -\dfrac{2(r-1)t}{(2r-3)}, \quad &t>0 \end{cases} \eeq This gives us $\gamma = 1$. \item The critical exponent $\delta$ can be obtained from setting $t=0$ in the saddle point equation of state: \begin{equation} h(\phi)= \frac{2\phi^3ru}{(2r-3)}. \eeq Using \eqref{eqnofstate}, we obtain $\delta = 3$. \end{enumerate} \begin{table}[h!] \begin{center} \begin{tabular}{|l|l|l|l|l|l|l|} \hline Critical Exponents & $\alpha$ & $\beta$ & $\gamma$ & $\delta$ & $\nu$ (See \S\ref{secscaling}) & $\Delta$ (See \S \ref{secscaling} ) \\ \hline & & & && & \\ Landau Theory & 0 & $\dfrac{1}{2}$ &1 &3& $\dfrac{1}{y_t} = \dfrac{1}{2(r + d-1) - dr}$; &$\dfrac{y_h}{y_t} = \dfrac{d + (2r-3)\left( 1 - \frac{d}{2}\right)}{2(r + d-1) - dr}$; \\ (Saddle point) & & & &&if \, $y_t$ is relevant & if \, $y_t$ is relevant \\ \hline \end{tabular} \caption{Critical exponents from the saddle point expansion in Landau theory.} \label{table1} \end{center} \end{table} We will introduce another exponent $\Delta$ and $\nu$ in \S \ref{secscaling}. The critical exponents from Landau theory are displayed in Table \ref{table1} for convenience. \section{Fluctuations over saddle point approximation} \label{fluctuations} In this section, we will venture beyond the saddle point analysis by considering small fluctuations about the saddle point and taking their effects into account. Readers who are not interested in the calculational aspects of fluctuations can read the following introductory discussion of this section where we have stated the main results and skip directly to \S \ref{Ginzburg}. We will show that incorporating fluctuations about the saddle point into the analysis of $r$th order phase transitions leads to the following features: \begin{enumerate} \item Fluctuations which lead to powers of the order parameter in the Hamiltonian of the order ${2(k-1)}, \, k < r$ destroy the delicate analytic properties of the critical exponents. We will show this by looking at the case of quadratic fluctuations, where we find such fluctuations destroy analyticity for $r>2$. \item In $d< 2r$, saddle point analysis does not always hold. The Ginzburg criteria as defined in \S \ref{Ginzburg} tells us when saddle point analysis holds in $d< 2r$, and when fluctuations contribute significantly. In case fluctuations dominate, critical exponents are modified. \item Saddle point analysis is valid above the upper critical dimension given by $d>d_u = 2r$. Hence the critical exponents corresponding to observables like $C_r$ do not change for $d> 2r$. \item Fluctuations destroy all order in the system for $d \leq d_l$ for second order phase transitions, where $d_l$ is the lower critical dimension \cite{PhysRevLett.17.1133, Coleman:1973ci}. This argument remains unchanged for $r$th order phase transition as shown in Appendix \ref{kf}, where we show that $d_l = 2$ for systems with continuous symmetry (in the phenomenological Lagrangian) and $d_l =1$ for systems with discrete symmetry. \end{enumerate} We begin by looking at the effect of fluctuations on two-point correlators. Afterwards, we analyze the effects of fluctuations on $C_r$. Specifically, we study how these observables' divergences near critical temperature are modified due to fluctuations. The computations in Appendix \ref{kf} also stress the importance of fluctuations, as we show that fluctuations lead to partial or complete destruction of order depending on the dimension of the system. \subsection{Two point correlator and exponents} We are interested in fluctuations of the form: \begin{equation} \phi(x) = \left( \phi_0 + \phi_{\parallel}(x), \phi_{\bot,2}(x), \, \dots \, , \phi_{\bot,n}(x) \right) \eeq where $\phi_{\parallel}(x)$ and $\phi_{\bot,i}$ denote the longitudinal and transverse fluctuations respectively. The kinetic term goes as \begin{equation} \label{derivative} \left( \grad \phi \right)^2 = \left( \grad \phi_{\parallel} \right)^2 + \left( \grad \phi_{\bot} \right)^2, \eeq and the square of the order parameter goes as \begin{equation} \label{sq} \phi^2 = \phi_0^2 + 2 \phi_0 \phi_{\parallel} + \phi_{\parallel}^2 + \sum_{i = 2}^{n}\phi_{\bot,i}^2 \eeq By using \eqref{derivative} and \eqref{sq} in \eqref{LG1} and keeping upto only quadratic terms in the fluctuations, we obtain: \begin{equation} \begin{split} \beta H =& \int d^d x\left( t_r \phi_0^{2(r-1)} + u_r \phi_0^{2r}\right) + \int d^d x\left[ \frac{K}{2} \left( \grad \phi_{\parallel} \right)^2 + \left( \frac{2K}{2\xi_{\parallel}^2} \right) \phi_{\parallel}^2\rs\\ & + \sum_{i = 2}^{n} \int d^d x\left[ \frac{K}{2} \left( \grad \phi_{\bot,i} \right)^2 + \left( \frac{2K}{2\xi_{\bot,i}^2} \right) \phi_{\bot,i}^2\rs + \text{O}\left( \phi_{\parallel}^3 , \phi_{\bot}^3 \right) \\ \end{split} \eeq where $\xi_{\parallel}$ and $\xi_{\bot,i}$ are correlation scales of the fluctuations and the first term is the potential evaluated at the saddle point. The correlation lengths $\xi_{\parallel}$ and $\xi_{\bot,i}$ corresponding to the two point correlator are explicitly given by: \begin{equation} \label{xi0} \begin{split} \frac{\partial^2 V}{\partial \phi_{\parallel}^2} \bigg|_{\phi_0} &= \dfrac{2K}{\xi_{\parallel}^2} = \begin{cases} 2ru_r \, \left( \dfrac{t-rt}{ru}\right)^{r-1} , \quad &t< 0 \\ t(r-1)(2r-3) \, \delta_{r,2}\quad &t> 0 \\\end{cases} \\ \frac{\partial^2 V}{\partial \phi_{\bot,i}^2} \bigg|_{\phi_0} &= \frac{2K}{\xi_{\bot,i}^2} = \begin{cases} 0 , \quad &t< 0 \\ t(r-1) \, \delta_{r,2}\quad &t> 0 \\\end{cases} \end{split} \eeq Note that the lengths $\xi_{\parallel}$ and $\xi_{\bot,i}$ corresponding to the two point correlator display a different analytic behaviour as compared to $\zeta$. The two point correlators $\xi$ which were zero in the saddle point approximation acquire a non-zero value due to fluctuations. It can be seen from the nature of the longitudinal polarization that the two point correlator $\xi$ is not an analytic function, since quadratic terms in the Hamiltonian characterizing the fluctuations destroy the delicate analytic features. As a result we have the scalings: \begin{equation} \label{xi} \begin{split} \xi_{\parallel}^+ \sim \abs{t}^{-\frac{1}{2}} \delta_{r,2}, \quad \quad & \xi_{\parallel}^- \sim \abs{t}^{\frac{1-r}{2}} \\ \xi_{\bot,i}^+ \sim \abs{t}^{-\frac{1}{2}} \delta_{r,2}, \quad \quad & \xi_{\bot,i}^- \sim 0\\ \end{split} \eeq We note from equation \eqref{xi} that only in the case of second order phase transitions with $r=2$ we have $\xi_{\parallel}^+ = \xi_{\parallel}^- \equiv \xi_{\parallel} = \abs{t}^{-\frac{1}{2}}$. This is because such fluctuations give rise to analytic terms in the Hamiltonian corresponding to the second order phase transitions. Here we have shown that quadratic fluctuations destroy the analyticity of the physical observables in the $h-t$ plane. The same argument can be extended to fluctuations of the order ${2(k-1)}, \, k < r$. \subsection{Fluctuation corrections to the saddle point} Let us now evaluate the effect of fluctuations on the full partition function. By including the quadratic fluctuations in the partition function we obtain: \begin{equation} \begin{split} Z \approx \exp &\left[ -V_d V(\phi_0)\rs \int \left[ D\phi_{\parallel}\rs \exp \left[ -\frac{K}{2} \int d^dx \left[\left( \grad \phi_{\parallel}\right)^2 + \frac{2 \phi_{\parallel}^2}{\xi_{\parallel}^2} \rs\rs\\ \times & \int \left[ \prod_{i} D\phi_{\bot,i}\rs \exp \left[ -\frac{K}{2} \int d^dx \left[\left( \grad \phi_{\bot,i}\right)^2 + \frac{2 \phi_{\bot,i}^2}{\xi_{\bot,i}^2} \rs\rs \end{split} \eeq where $V_d$ is the volume of the system. The free energy of the system is given as follows (where we have removed the label $i$ indicating the transverse directions for convenience): \begin{equation}\label{freeen} f = -\frac{\ln Z}{V_d} = V(\phi_0) + \frac{1}{2} \int \frac{d^dq}{(2\pi)^d} \ln \left[ K \left( q^2 + 2 \left( \xi_{\parallel}\right)^{-2}\right)\rs + \, \frac{n-1}{2} \int \frac{d^dq}{(2\pi)^d} \ln \left[ K \left( q^2 + 2 \left( \xi_{\bot}\right)^{-2}\right)\rs, \eeq where $q$ is the momentum associated with the fluctuations. We will now look at the effect of fluctuations on the singularity structure of the $r$th derivative of the free energy which is given by $C_r \equiv \frac{d^r f}{dt^r}$. Using \eqref{xi} and \eqref{freeen} we obtain the following corrections to $C_r$: \begin{equation} C_r \propto \begin{cases} C_r^+ + \bigintss \dfrac{d^dq}{(2\pi)^d} \dfrac{(-2)^{r-1}(r-1)! \delta_{r,2}}{\left( q^2 + 2 (\xi_{\parallel}^+)^{-2}\right)^r} + (n-1) \bigintss \dfrac{d^dq}{(2\pi)^d} \dfrac{(-2)^{r-1}(r-1)!\delta_{r,2}}{\left( q^2 + 2 (\xi_{\bot}^+)^{-2}\right)^r} ; \quad \quad & t>0 \\ C_r^- + \bigintss \dfrac{d^dq}{(2\pi)^d} \left( \dfrac{(-2)^{r-1}(r-1)! (r-1)^r (\xi_{\parallel}^-)^{\frac{2r(2-r)}{r-1}}}{\left( q^2 + 2 (\xi_{\parallel}^-)^{-2}\right)^r} + O\left(\frac{1}{q^{2r-1}}\right)\rc; \quad \quad &t<0 \end{cases} \eeq where we have only written the most divergent correction to $C_r^-$ explicitly and $O\left(\frac{1}{q^{2r-1}}\right)$ denotes the subleading corrections. Notice that the following momentum-integral appears in the correction terms: \begin{equation} I = \int \dfrac{d^dq}{(2\pi)^d} \left( \dfrac{1}{q^2 + 2 (\xi)^{-2}}\right)^r \eeq where we have suppressed the labels indicating longitudinal or transverse, and whether $t$ is greater or less than 0. The integral $I$ has mass dimension $d-2r$, and thus diverges for $d \geq 2r$. Introduction of a UV regulator $\Lambda = \frac{1}{a}$ cuts these divergences off. We can perform a similar analysis for the integrals at $t<0$. We can thus write $C_r$ in $d> 2r$ as \begin{equation} \label{dgcr1} C_r \propto \begin{cases} C_r^+ + A_1 \, n \, a^{2r-d}\, \delta_{r,2} &t>0\\ C_r^- + A_2 \, a^{2r-d} + O(a^{2r-d-1})\quad &t<0 \end{cases} \eeq while $C_r$ in $d< 2r$ takes the following form upon rescaling $q$ by $ \xi^{-1}$ \begin{equation} \label{dgcr2} C_r \propto \begin{cases} C_r^+ + A_3 \left( \left( \xi^+_{\parallel} \right)^{2r-d} + (n-1)\left( \xi^+_{\bot} \right)^{2r-d} \right) \delta_{r,2} & t>0 \\ C_r^- + A_4 \left( \xi^-_{\parallel} \right)^{2r-d + \frac{2r(2-r)}{r-1}} \quad &t<0 \end{cases} \eeq Note that in the equations above, $A_1, A_2, A_3$ and $A_4$ are constants, which do not influence the discontinuity.\\ \medskip \textbf{Physical aspects of fluctuations:} We will now analyze the physical aspects of these computations. As shown in equation \eqref{dgcr1}, for $d>2r$, $C_r$ gets an additive constant correction proportional to $a^{2r-d}$ which does not introduce any new singularity in the expression. However, we see from \eqref{dgcr2} that in $d<2r$, there are corrections that have associated singular parts, as the correlation lengths diverge near critical points. The calculation above is done by taking into account the first order corrections; inclusion of higher order terms can potentially introduce more singular terms to $C_r$. Thus the saddle point analysis does not work correctly in $d< 2r$ because fluctuation contributions tamper with the predicted singularity structure. Therefore we denote $d= 2r$ as the upper critical dimension above which the saddle point approximation holds, and fluctuations do not modify the critical exponents. The following question naturally arises: Under what conditions does saddle point analysis robustly hold below the upper critical dimension where fluctuations modify the singularities? We discuss this in the next subsection \S \ref{Ginzburg}. The predicted corrections to $C_V$ match with the values for second order phase transitions with $r=2$. By substituting the expressions for $\xi$'s from equations \eqref{xi0} and \eqref{xi} into \eqref{dgcr2}, we also see that corrections to the saddle point critical exponent $\alpha$ of $C_r$ do not have the similar scaling for $t>0$ and $t<0$. As stated earlier, this arises due to the fact that quadratic contribution to the action destroys the analyticity of physical observables in the $h-t$ plane. Note that fluctuations for third order phase transitions were also studied in \cite{pardeep97} for a different Hamiltonian as compared to \eqref{LG1}, for which they concluded the upper critical dimension is given by $d=2$. \subsection{The Ginzburg criterion for $r$th order phase transitions} \label{Ginzburg} In this subsection, we quantify when the effects of fluctuations dominate over the saddle point expectations. We do this by generalizing the Ginzburg criteria to understand when saddle point calculations accurately predict critical exponents in the presence of fluctuations. In order that the saddle point prediction is the dominant contribution, we demand that the saddle point discontinuity $\Delta C_r \equiv C_r^+ - C_r^-$ is larger as compared to the contributions from fluctuations. Only in such situations, we can trust the saddle point computation. Using \eqref{xi} in \eqref{dgcr2}, we see that the the condition for saddle point analysis to dominate over fluctuations is given by: \begin{equation} \label{GC1} \begin{split} \Delta C_r \gg \Delta C_r^{\text{fluc.}} &= A_3 \left( \left( \xi^+_\parallel \right)^{2r-d} + (n-1)\left( \xi^+_\bot \right)^{2r-d} \right) \delta_{r,2} - \left( A_4 \left( \xi^-_{\parallel} \right)^{2r-d + \frac{2r(2-r)}{r-1}} \right) \\ &= A' \, \delta_{r,2} \, t^{-\left(\frac{2r-d}{2}\right)} + A'' t^{\left(\frac{d}{2}-r\right)(r-1) + r(r-2)} \end{split} \eeq where $A'$ and $A''$ are linear combinations of proportionality constants $A_3$ and $A_4$. Notice that the term $A'$ drops out for higher order phase transitions ($r>2$), whereas for $r=2$ both the terms have the same order of magnitude. Thus the requirement for saddle point singularities to dominate over the fluctuations is given by \begin{equation} \abs{t} \gg t_G \sim \left( \frac{A''}{\Delta C_r}\right)^{-\frac{2}{\left( d-2r\right)(r-1) + 2r(r-2)}}. \eeq For the case of $r=2$, we recover the standard Ginzburg criteria from equation \eqref{GC1} which is given by \begin{equation} \abs{t} \gg t_G \sim \left( -\frac{A'+A''}{\Delta C_V}\right)^{\frac{2}{4 -d}}. \eeq where we have used the fact that $C_2 = - C_V$. The interpretation of this temperature scale is that it is possible to recover the saddle point critical exponents if the system does not go within a distance $t_G$ near the critical temperature $T_C$. \section{Scaling relations among critical exponents} \label{secscaling} In the previous section, we saw that critical exponents obtain corrections due to fluctuations. We now address the following question: Given that fluctuations modify the saddle-point calculated values of the critical exponents, can we still find some robust relations between the critical exponents that are valid beyond the saddle point? As we already know, there exist scaling relations between the exponents for second-order phase transitions. Can we generalize them for $r$th order phase transitions? Let us begin by looking at the free energy obtained using saddle point description. It is given by \begin{equation} f (t,h) \propto \begin{cases} \dfrac{t^r}{u^{r-1}}, \quad &h = 0; t< 0\\ \dfrac{h^{\frac{2r}{3}}}{u^{\frac{2r}{3}-1}} \quad &h \neq 0; t = 0. \end{cases} \eeq Thus we can now write the above free energy (at saddle point) as a homogenous function of $t$ and $h$. \begin{equation} \label{scalingfe1} \begin{split} f(t,h) &= \abs{t}^{r} g\left( \frac{h}{t^{\Delta}}\right)=\abs{t}^{r} g(x), \quad \text{where} \quad x \equiv \frac{h}{\abs{t}^{\Delta}} \end{split} \eeq Here $\Delta$ is the generalization of the familiar gap exponent which appears for the case of second order phase transitions. The generalization of gap exponent for higher order phase transition was also discussed in \cite{JANKE2006319}. Let us now look at the $h \to 0$ and the $t \to 0$ limits of the function $g(x)$ such that the power of $h$ is kept intact. These go as \begin{equation} \label{scalingfe2} \lim_{x \to 0} g(x) \sim \frac{1}{u^{r-1}}, \quad \text{and} \quad \lim_{x \to \infty} g(x) \sim \frac{x^{\frac{2r}{3}}}{u^{\frac{2r}{3}-1}}. \eeq Equation \eqref{scalingfe2} implies that the free energy takes the following form near $h \neq 0$ and $t=0$: \begin{equation} f \sim \abs{t}^r \frac{h^{\frac{2r}{3}}}{t^{\frac{2r \Delta}{3}}\left( u^{\frac{2r \Delta}{3}-1}\right)}. \eeq Since $f$ remains finite at $t = 0$, the gap exponent is given by setting the coefficient of $\abs{t}$ to 0, and we obtain $\Delta = \frac{3}{2}$. \subsection{Scaling form of observables from RG}\label{scalerg} In this subsection, we will argue that beyond the saddle point, the singular part of the free energy has the following homogenous form: \begin{equation} \label{fescaling} f_{\text{sing}} (t, h) = \abs{t}^{r-\alpha} g\left( \frac{h}{t^{\Delta}}\right) \eeq This form can be understood using Wilsonian Renormalization Group (RG) flow. Under the RG transformations, the partition function remains unchanged and hence the corresponding free energies are related by: \begin{equation} Vf(t ,h) = V' f(t_{b},h_b) \eeq where $t_b$ and $h_b$ are the rescaled couplings obtained by rescaling $x \rightarrow x/b$, where $b > 1$. Notice that we have suppressed the subscript $r$ in $t_r$, which we will keep doing for the rest of this section as well. Hence, in $d$- dimensions, the rescaled volume gets smaller by a factor of $b^d$ and we obtain: \begin{equation} f(t,h) = b^{-d}f (b^{y_{t}} t, b^{y_h} h) \eeq where $y_t$ and $y_h$ are the mass dimensions of the couplings $t_r$ and $h$ as given in \eqref{couplingdimensions}. In case the coupling $t$ is relevant i.e. $y_t > 0$, we can choose $b = t^{-1/y_{t}}$, such that $b>1$. Notice that if the Lagrangian does not contain any relevant coupling, this choice of $b$ is not possible and hence we cannot write down the scaling relations derived below. With above choice of $b$, the free energy takes the following form: \begin{equation}\label{rgsc} f(t, h) = t^{d/y_{t}}f \left( 1, \frac{h}{t^{y_h/y_{t}}}\right) \equiv t^{d/y_{t}} g_f \left(\frac{h}{t^{y_h/y_{t}}}\right) \eeq Thus we obtain the same form as \eqref{fescaling} with $r - \alpha = d/y_t$ and $\Delta = y_h/y_t$. Notice that the above scaling is valid only when the coupling $t$ is relevant. Within the context of third and fourth order phase transition, a similar scaling relation for the free energy was discussed in \cite{doi:10.1080/13642810208223158, JANKE2006319}. We derive the above scaling using renormalization group and as described previously, the expression is valid only if the coupling $t_r$ in \eqref{LG1} is a relevant coupling within Wilsonian RG. We can obtain similar homogeneous scaling forms for the specific heat and $C_r$ by differentiating $f$ w.r.t. $t$. We have: \begin{equation} \begin{split} \frac{df}{dt} &= (r - \alpha) \abs{t}^{r-\alpha -1} g\left( \frac{h}{t^{\Delta}}\right) - \Delta h \abs{t}^{r- \alpha - \Delta- 1} g\left( \frac{h}{t^{\Delta}}\right)\\ &= \abs{t}^{r-\alpha -1}\left[ (r - \alpha) g\left( \frac{h}{t^{\Delta}}\right) - \Delta\frac{h}{t^{\Delta}} g\left( \frac{h}{t^{\Delta}}\right)\rs\\ &= \abs{t}^{r-\alpha -1} \tilde{g} \left( \frac{h}{\abs{t}^{\Delta}} \right) \end{split} \eeq where $\tilde{g} \left( \frac{h}{\abs{t}^{\Delta}} \right) = (r - \alpha) g\left( \frac{h}{t^{\Delta}}\right) - \Delta\frac{h}{t^{\Delta}} g\left( \frac{h}{t^{\Delta}}\right)$. Hence the specific heat takes the form \begin{equation} \label{kekek} C^{\text{sing}}_V \sim -\frac{\partial^2 f}{\partial t^2} \sim \abs{t}^{r-\alpha -2} \widehat{g}\left( \frac{h}{t^{\Delta}}\right), \eeq while the $r$th derivative of the free energy takes the form \begin{equation} C^{\text{sing}}_r \sim -\frac{\partial^r f}{\partial t^r} \sim \abs{t}^{-\alpha} \bar{g}\left( \frac{h}{t^{\Delta}}\right). \eeq \subsection{Identities satisfied by critical exponents}\label{relac} In this subsection, we write down similar homogeneous forms for other physical observables near the critical point. We will use these scaling forms to obtain relations between various critical exponents. \begin{enumerate} \item Using the scaling of the free energy from eqn \eqref{fescaling} and the relation between the order parameter and the free energy, we conclude that $\phi$ scales as \begin{equation} \label{mscaling} \phi^{2r - 3} \sim |t|^{r-\alpha - \Delta} g_\phi \left( \frac{h}{t^{\Delta}}\right), \eeq using which we can conclude from equation \eqref{critbeta} that $\beta$ is given by: \begin{equation} \label{betarelation} \beta = \frac{r-\alpha -\Delta}{2r-3}. \eeq \item When $x \to \infty$, the dominant contribution in $g_\phi$ scales as $g_\phi \sim x^p$ where $p$ is the leading power in the expansion, and therefore $\phi^{2r-3} \sim \abs{t}^{r-\alpha -\Delta} \left( \frac{h}{t^{\Delta}}\right)^p$. As this limit is $t$-independent, we have the following relation between the exponents \begin{equation} \Delta p = r-\alpha-\Delta, \quad \implies \quad \phi^{2r-3}(t=0, h) \sim h^{\frac{r-\alpha-\Delta}{\Delta}}. \eeq Using equation \eqref{eqnofstate} the above identity implies the following relation \begin{equation} \label{deltarelation} \delta = \frac{(2r-3)\Delta }{r - \alpha -\Delta} = \frac{\Delta}{\beta}. \eeq \item Using the definition of generalized susceptibility as $\chi = \frac{d \braket{\Phi}}{dh}$, and using the scaling of $\phi$ from eqn \eqref{mscaling}, we see that $\chi$ scales as \begin{equation} \chi(t,h) = \frac{d \braket{\Phi}}{dh} \sim \abs{t}^{\frac{r-\alpha -\Delta}{2r-3} -\Delta} g_{\chi} \left( \frac{h}{t^{\Delta}}\right). \eeq Using equation \eqref{critgamma} we obtain: \begin{equation} \label{gammarelation} \gamma = \Delta - \left( \frac{r-\alpha - \Delta}{2r-3}\right). \eeq \end{enumerate} Thus we see that all the critical exponents $\left( \alpha, \beta, \gamma, \delta, \Delta\right)$ can be derived from two independent critical exponents (say from $\Delta$ and $\alpha$ in the case of second order phase transition). Using equations \eqref{betarelation}, \eqref{deltarelation} and \eqref{gammarelation}, we obtain the following higher-order generalizations of the Rushbrooke identity \cite{doi:10.1063/1.1734338} (the saturation of the Rushbrooke inequality), and the Widom scaling law \cite{doi:10.1063/1.1696618} for higher order phase transitions: \begin{equation} \alpha + 2(r-1)\beta + \gamma = r \qquad \& \qquad \delta -1 = \frac{\gamma}{\beta} \eeq Notice that the above identities are different from the identities derived in \cite{doi:10.1080/13642810208223158, JANKE2006319}. This is because \cite{doi:10.1080/13642810208223158} obtained their scaling relations by considering a different magnetic field coupling as compared to our coupling in the Hamiltonian given in \eqref{LG1}. As a consistency check for our above relations, we can set $r=2$ to obtain \begin{equation} \alpha + 2\beta + \gamma = 2 \qquad \& \qquad \delta -1 = \frac{\gamma}{\beta} \eeq which are the Rushbrooke's identity \cite{doi:10.1063/1.1734338} and Widom's scaling law \cite{doi:10.1063/1.1696618} respectively for the second order phase transitions. \subsection{Scaling relation from the divergence of correlation length} In this subsection, we will use the two-point correlator given in equation \eqref{gfeqn} to understand it's divergence near the critical point. We hereby derive the generalized Josephson identity for $r$th order phase transitions. Following the main argument from our previous section, the correlation length $\zeta(t,h)$ has the following form: \begin{equation} \label{23} \zeta (t,h) \sim \abs{t}^{-\nu} g_{\zeta} \left( \frac{h}{\abs{t}^{\Delta}}\right) \eeq In the vicinity of the critical point, the most important length scale is $\zeta$, and the singular contribution to observables arise solely due to $\zeta$'s singularity. A similar singular behaviour was demonstrated in the case of quadratic fluctuations in \S \ref{fluctuations}, where the correlation length $\xi$ dictated the singular contributions in $d<2r$, with the only significant difference being that the corrections led to non-analytic behaviour. Hence the singular part of the free energy in terms of the correlation length $\zeta$ is given by: \begin{equation} \label{eqn24} V_d f(t,h) \sim \ln Z = B_1 \left( \frac{L}{\zeta}\right)^d + B_2 \left( \frac{L}{a}\right)^d , \eeq where $B_1$ and $B_2$ denote non-singular quantities, $L$ denotes the system size, and $\Lambda = \frac{1}{a}$ is the UV cutoff. Since the singular part of the free energy arises from the first term in the above equation, we have \begin{equation} \label{Json} f (t,h) \sim \frac{\ln Z}{L^d} \sim \zeta^{-d} \sim \abs{t}^{d\nu} g \left( \frac{h}{t^{\Delta}}\right) \eeq This is the same scaling form as given in \eqref{rgsc} with \begin{equation} \label{nurel} \nu = \frac{1}{y_{t}}\, , \qquad \qquad \Delta =\frac{y_h}{y_{t}}. \eeq The scaling form in \eqref{Json} has the following important properties: \begin{enumerate} \item From \eqref{eqn24}, we observe that the free energy grows as $\left( \frac{L}{\zeta}\right)^d$ near the critical point. It can be interpreted as a measure of the system size divided by the correlation length $\zeta$, such that the system is divided into many small blocks. Each small block can be thought of as an independent degree of freedom which contributes a constant factor to the overall free energy. We also naturally obtain the homogeneity of the singular part of the free energy. \item We arrive at the generalized Josephson's identity by comparing \eqref{Json} with the homogenous form of free energy given in \eqref{fescaling}. The identity is given by \begin{equation} r - \alpha = d \nu. \eeq Josephson's identity is basically a hyperscaling relation that holds below and at the upper critical dimension, but it does not hold above the upper critical dimension. This is because the scaling form for $\zeta$ as given in equations \eqref{23} and \eqref{eqn24} does not hold above the upper critical dimension. Above the upper critical dimension $g_{\zeta}(x)$ is singular in $x$ \cite{363515} and can be shown to grow as $g_{\zeta} (x)\sim \frac{1}{x}$ using mean-field theory, which is singular when $x \to 0$. \end{enumerate} We have summarized the four independent relations between the critical exponents $\alpha, \beta, \gamma, \delta, \Delta$ and $\nu$ in Table \ref{table2}. Thus all the critical exponents can be written in terms of two independent ones, say in terms of $\gamma$ and $\Delta$. \begin{table}[h!] \begin{center} \begin{tabular}{|l|l|l|} \hline Serial No. & Exponents & Relation \\ \hline 1. & $\beta, \alpha, \Delta$ & $\beta = \dfrac{r-\alpha -\Delta}{2r-3} $ \vspace{2pt}\\ \hline 2. & $\delta, \alpha, \Delta$ & $\delta = \dfrac{(2r-3)\Delta }{r - \alpha -\Delta}$ \vspace{2pt}\\ \hline 3. & $\gamma, \alpha, \Delta$ & $ \gamma = \Delta - \left( \dfrac{r-\alpha - \Delta}{2r-3}\right)$ \vspace{2pt}\\ \hline 4. & $ \alpha, \nu$ & $ r-\alpha = d\nu$ \vspace{2pt}\\ \hline \end{tabular} \caption{Independent relations between different critical exponents} \label{table2} \end{center} \end{table} \section{Critical exponents about fixed points of RG flow}\label{crrg} In the previous sections, we calculated the critical exponents using the saddle point approximation and derived relations between critical exponents away from the saddle point. In this section, we will use perturbative RG flow to find fixed points of the theory and use them to calculate the critical exponents. Specifically, we will be looking at the case when fluctuations dominate over saddle point contributions as quantified by the generalized Ginzburg criteria in $d \leq 2r$. In that case, the critical exponents are captured by relevant couplings about fixed points. We will perform linear stability analysis near these fixed points to calculate the critical exponents in their vicinity. Let us denote the full coupling space of our theory by $S (t_r, u_r, \dots)$. A particular Hamiltonian ($H$) is described by couplings at a point in this space. RG flow involves rescaling the couplings and renormalizing the order parameter, thereby taking us from one point in this parameter space to another, i.e., $S_b \rightarrow R_b S$. Here we have denoted the action of RG flow by $R_b$, with $b$ being the rescaling parameter defined in \S \ref{scalerg}. The fixed points of these flows are defined as $R_b S^* = S^*$. Since we rescale the couplings in the RG procedure, the correlation length $\zeta^*$ should either go to zero or infinity at the fixed point. When $\zeta^* = 0$, the system is in a completely disordered phase, and when $\zeta^* \rightarrow \infty$, the system is in the ordered phase. We can now study the stability of the fixed points by linearizing the beta function near them. The subspace of irrelevant couplings is known as the basin of attraction since the flow in this subspace converges towards the fixed point. Since the correlation length diverges at the fixed point, it diverges at each point in the basin of attraction. This basin of attraction is basically the critical surface at which the phase transition takes place. The behavior of critical exponents near the phase transition is hence determined only by the set of relevant couplings. We will use them to compute the value of critical exponents beyond the saddle point approximation. \subsection{One-loop beta function} In this subsection, we compute the one-loop beta functions for the couplings appearing in the Hamiltonian \eqref{LG1}. We follow the procedure described in \cite{skinner, Hollowood:2009eh}. The Euclidean action for $r$th order phase transition at zero external magnetic field is given by: \begin{equation} S_{\Lambda}[\phi_i, h = 0] = \int d^dx \, \left[\frac{1}{2}(\partial_\mu \phi^i \partial^\mu \phi_i) + V(\phi_i)\right] \eeq where $\Lambda$ is the UV cutoff and the potential is given by: \begin{equation} V(\phi_i) = t_r(\phi^2)^{r-1} + u_r (\phi^2)^r \eeq with $\phi^2 = \sum_{i= 1}^{N} \phi_i \phi^i$. We work with dimensionless couplings which are defined as follows: \begin{equation} t_r = \frac{g_{2(r-1)}}{(2r-2)!}\Lambda^{d-(r-1)(d-2)} \, , \qquad \qquad u_r= \frac{g_{2r}}{2r!}\Lambda^{d-r(d-2)}\, . \eeq In terms of these dimensionless couplings, the potential is given by: \begin{equation}\label{pot1} V(\phi_i) = \frac{g_{2(r-1)}}{(2r-2)!}\Lambda^{d-(r-1)(d-2)}(\phi^2)^{r-1} + \frac{g_{2r}}{2r!}\Lambda^{d-r(d-2)} (\phi^2)^r \eeq We will now use this potential to study RG flows using the Wilsonian formalism. This involves splitting the scalar field in terms of high energy and low energy modes and the subsequent procedure of systematically integrating out the high energy modes. Therefore we split the field $\phi^i$ into the low energy modes $\varphi^i$ and the high energy modes $\chi^i$ i.e. $\phi^i = \varphi^i + \chi^i$. Hence the action can be expanded as: \begin{equation} S[\phi^i] = S[\varphi^i] + \int d^d x \, \left[\frac{1}{2}(\partial_\mu \chi^i \partial^\mu\chi_i) + \frac{1}{2}\chi^i\frac{\partial^2V (\varphi^k)}{\partial\varphi^i\partial\varphi^j}\chi^j + .. \right] \eeq where we have chosen $\varphi^i$ such that it minimises the potential i.e. $V'(\varphi^i) = 0$. We will now integrate out the high energy modes $\chi^i$ in the partition function, by lowering the scale infinitesimally i.e. setting $\Lambda'$ = $\Lambda - \delta \Lambda$. We will focus on the first order terms in $\delta \Lambda$, which is similar to computing one-loop effects only. It can be argued that at this order, only the quadratic terms in $\chi^i$ contribute to the effective action \cite{skinner}. Upon integrating out the high energy modes, the one-loop correction to the effective action is given by: \begin{equation}\label{effac} \delta_\Lambda S[\phi] = \frac{\Lambda^{d-1} \delta\Lambda}{(4 \pi)^{d/2}\Gamma(d/2)} \int d^d x \, \textrm{ln} \bigg[\textrm{det}\left(\Lambda^2 \delta_{ij} + \frac{\partial^2V (\varphi^i)}{\partial\varphi^i\partial\varphi^j}\right)\bigg] \eeq This process of integrating out the high energy modes changes the effective couplings depending on the UV scale at hand. The change in the $k$th coupling is captured by the beta function $\left( \beta_k = dg_k/d \log\Lambda\right)$. We can use \eqref{effac} to compute the beta functions of the couplings $g_{2(r-1)}$ and $g_{2r}$ appearing in the potential \eqref{pot1}, which are given by: \begin{eqnarray}\label{beta} \Lambda \frac{d g_{2(r-1)}}{d \Lambda} &=& [(r-1)(d-2)-d] g_{2(r-1)} - a \Lambda^{(r-1)(d-2)}\frac{\partial^{2(r-1)}}{\partial \varphi_i^{2(r-1)}}\bigg[ \textrm{ln} \bigg[\textrm{det}\left(\Lambda^2 \delta_{ij} + \frac{\partial^2V (\varphi^i)}{\partial\varphi^i\partial\varphi^j}\right)\bigg]\bigg]\bigg|_{\varphi^i = 0}\nonumber\\ \Lambda \frac{d g_{2r}}{d \Lambda} &=& [r(d-2)-d] g_{2r} - a\Lambda^{r(d-2)} \frac{\partial^{2r}}{\partial \varphi_i^{2r}}\bigg[ \textrm{ln} \bigg[\textrm{det}\left(\Lambda^2 \delta_{ij} + \frac{\partial^2V (\varphi^i)}{\partial\varphi^i\partial\varphi^j}\right)\bigg]\bigg]\bigg|_{\varphi^i = 0} \end{eqnarray} where we have defined $a$ as follows \begin{equation}\label{a} a = \frac{1}{(4 \pi)^{d/2}\Gamma(d/2)}. \eeq Using \eqref{pot1} we compute the first derivative of potential which is given by: \begin{eqnarray*} \frac{\partial V}{\partial \varphi^i} &=& \frac{g_{2(r-1)}}{(2r-3)!}\Lambda^{d-(r-1)(d-2)}\left(\sum_m\varphi_m^2\right)^{r-2}\varphi_k \delta^{ik} + \frac{g_{2r}}{(2r-1)!}\Lambda^{d-r(d-2)} \left(\sum_m\varphi_m^2\right)^{r-1}\varphi_k \delta^{ik}, \end{eqnarray*} while the second derivative is given by: \begin{eqnarray*} \frac{\partial^2 V}{\partial \varphi^i \varphi^j} &=& \frac{g_{2(r-1)}}{(2r-3)!}\Lambda^{d-(r-1)(d-2)}\left(\sum_m\varphi_m^2\right)^{r-2}\delta^{ij} +\frac{g_{2r}}{(2r-1)!}\Lambda^{d-r(d-2)} \left(\sum_m\varphi_m^2\right)^{r-1}\delta^{ij}\\ && + 2(r-1)\frac{g_{2r}}{(2r-1)!}\Lambda^{d-r(d-2)} \left(\sum_m\varphi_m^2\right)^{r-2}\varphi_k\varphi_l\delta^{ik}\delta^{jl}\\ && + 2(r-2) \frac{g_{2(r-1)}}{(2r-3)!}\Lambda^{d-(r-1)(d-2)}\left(\sum_m\varphi_m^2\right)^{r-3}\varphi_k\varphi_l\delta^{ik}\delta^{jl}. \end{eqnarray*} We can now compute the determinant appearing in the expression for beta function \eqref{beta} which takes the following form: \begin{eqnarray}\label{determinant} \textrm{det}\left(\Lambda^2 \delta_{ij} + \frac{\partial^2V (\varphi^i)}{\partial\varphi^i\partial\varphi^j}\right) &=& \left[\Lambda^2 + \left(\sum_m\varphi_m^2\right)^{r-2}\left(\frac{g_{2(r-1)}\Lambda^{d-(r-1)(d-2)}}{(2r-3)!} + \frac{g_{2r}\Lambda^{d-r(d-2)}}{(2r-1)!}\sum_m\varphi_m^2\right)\right]^{N-1} \nonumber\\ \times && \left[\Lambda^2 + \left(\sum_m\varphi_m^2\right)^{r-2}\left(\frac{g_{2(r-1)}\Lambda^{d-(r-1)(d-2)}}{(2r-4)!} + \frac{g_{2r}\Lambda^{d-r(d-2)}}{(2r-2)!}\sum_m\varphi_m^2\right)\right]\nonumber\\ \end{eqnarray} Substituting the expression for the determinant given by \eqref{determinant} in the beta function \eqref{beta}, we can calculate the one-loop beta functions for various $r$. In the rest of this section, we compute the critical exponents for phase transitions of different orders. \subsection{Critical exponents for second order phase transitions $(r=2)$} \label{r2d2} In this subsection, we focus on second order phase transitions ($r =2$). We can see that for $r =2$ the couplings $g_2$ and $g_4$ appear in the Hamiltonian \eqref{LG1}. We use \eqref{beta} to compute the one-loop beta-functions for these couplings and then evaluate the critical exponents for this case. The results in this subsection are a review of previously known results for second order phase transitions. Using \eqref{beta} and \eqref{determinant}, we find the following one-loop beta functions for the couplings $g_2$ and $g_4$: \begin{eqnarray} \Lambda \frac{d g_{2}}{d \Lambda} &=& -2 g_{2} - \frac{(N + 2)}{(4 \pi)^{d/2}\Gamma(d/2)}\frac{g_{4}}{3(1 + g_2)}\\ \Lambda \frac{d g_{4}}{d \Lambda} &=& (d- 4) g_{4} + \frac{(N+ 8)}{3(4 \pi)^{d/2}\Gamma(d/2)}\frac{g_{4}^2}{(1 + g_2)^2} \end{eqnarray} The fixed points of the RG flow can be found by setting $\beta(g_2)$ and $\beta(g_4)$ to zero. There are two fixed points. The first one is a trivial fixed point known as the Gaussian fixed point and it is given by: \begin{equation} g_2^* = 0\, , \qquad \qquad g_4^* = 0 \end{equation} Near the Gaussian fixed point, the coupling $g_2$ is relevant and $g_4$ is marginal and their mass dimensions are given in \eqref{couplingdimensions}. There also exists a non-trivial Wilson-Fisher (WF) fixed point \cite{wf} given by: \begin{equation} g_2^* = -\frac{(d-4) (N+2)}{d (N+2)-6 (N+4)}\, , \qquad \qquad g_4^* = -\frac{12 (d-4) (N+8)}{a (d (N+2)-6 (N+4))^2} \end{equation} where $a$ is defined in \eqref{a}. We will now study flows about this fixed point, which appears "just below" four dimensions. Defining $\epsilon \equiv 4-d$, the Wilson-Fisher fixed point is given by: \begin{equation} g_2^* = -\frac{\epsilon (N+2)}{2 (N+8)} + O(\epsilon^2)\, , \qquad \qquad g_4^* = \frac{3 \epsilon}{a (N+8)} + O(\epsilon^2) \end{equation} We can now perform $\epsilon$-expansion of the beta functions near these fixed points: \begin{eqnarray*} \beta(g_2^* + \delta g_2) = \beta(\delta g_2) &=& -2 (g_2^* + \delta g_2) - \frac{(N + 2)}{3a}\frac{(g_4^* + \delta g_4)}{(1 + g_2^* + \delta g_2)}\\ &=& -2 \delta g_2 + \frac{\epsilon (N+2)}{(N+8)}\delta g_2 - \frac{a (N+2)}{3} \delta g_4 \left(1 +\frac{\epsilon (N+2)}{2(N+8)} \right) + O(\epsilon^2) \\ \beta(g_4^* + \delta g_4) = \beta(\delta g_4) &=& -\epsilon(g_4^* + \delta g_4) + \frac{a(N+ 8)}{3}\frac{(g_4^* + \delta g_4)^2}{(1 + g_2^* + \delta g_2)^2}\\ &=& \epsilon \delta g_4 + O(\epsilon^2) \end{eqnarray*} Hence we obtain the following matrix of the linearized beta functions about the Wilson-Fisher fixed point: \begin{equation} \begin{pmatrix} \beta(\delta g_2)\\ \beta(\delta g_4) \end{pmatrix} = \begin{pmatrix} -2 + \frac{\epsilon (N+2)}{(N+8)} \qquad & - \frac{a (N+2)}{3} \left(1 +\frac{\epsilon (N+2)}{2(N+8)} \right) \\ 0 \qquad & \epsilon \end{pmatrix}\begin{pmatrix} \delta g_2\\ \delta g_4 \end{pmatrix} \eeq The eigenvalues\footnote{Note that our beta functions are negative as compared to \cite{kardar_2007, kardarcourse}, who perform renormalization by studying the variation of couplings with respect to length scale, as opposed to momentum scale in our case.} are $ -2 + \frac{\epsilon (N+2)}{(N+8)}$ and $\epsilon$. The first eigenvalue is negative and hence the coupling $g_2$ is relevant around the WF fixed point and the scaling dimension $y_t$ is given by: \begin{equation} y_t = 2 - \frac{\epsilon (N+2)}{(N+8)} \eeq On the other hand, the eigenvalue corresponding to the coupling $g_4$ is positive for $d<4$. Hence the coupling $g_4$ is irrelevant (making the WF fixed point stable along the corresponding eigenvector) for $d <4$. We can use $y_t$ to calculate the critical exponent $\nu$ using the relation \eqref{nurel} and it is given by: \begin{equation} \nu = \frac{1}{y_t} = \left( 2\left( 1 - \frac{\epsilon (N+2)}{2(N+8)}\right)\rc ^{-1} = \frac{1}{2} + \frac{\epsilon}{4} \frac{ (N+2)}{(N+8)} + O(\epsilon^2) \eeq For $r =2$, the scaling dimension of the coupling $h_i$ is still given by \eqref{couplingdimensions}. This is because in the Lagrangian $h_i$ couples to the zero momentum mode $\int d^dx \, \phi_i(x) = \tilde{\phi}_i(k= 0)$, and hence integrating out high energy modes using Wilsonian RG leaves $h_i$ unchanged. Therefore for the special case of second order phase transition ($r = 2$) the scaling dimension of $h_i$ just below four dimensions is given by: \begin{equation} y_h = 3 - \frac{\epsilon}{2} + O(\epsilon^2) \eeq We can now calculate the gap exponent $\Delta$ from \eqref{nurel} which is given by: \begin{equation} \Delta = \frac{y_h}{y_t} = \frac{3}{2} + \frac{ \epsilon}{4} \left(\frac{3(N+2)}{N+8} - 1 \right) + O(\epsilon^2) \eeq We can use the exponents $\nu$ and $\Delta$ to compute all other critical exponents using relations derived in \S\ref{relac}. These exponents are given by: \begin{equation} \begin{split} \alpha &= \epsilon \left(\frac{1}{2} - \frac{N+2}{N+8}\right) + O(\epsilon^2)\\ \beta &= \frac{1}{2} - \frac{\epsilon}{4} \lc1 - \frac{N+2}{N+8}\right) + O(\epsilon^2)\\ \gamma &= 1 + \frac{\epsilon}{2}\left(\frac{N+2}{N+8}\right) + O(\epsilon^2)\\ \delta &= 3 + \epsilon\left( \frac{N+2}{N+8}\right) + O(\epsilon^2) \end{split} \eeq The above results match with the standard results for second order phase transitions as given in \cite{kardar_2007, kardarcourse, Peskin:1995ev}. \subsection{Critical exponents for third order phase transitions $(r=3)$} In this subsection, we calculate the critical exponents for $r=3$. The calculation of exponents for $r>2$ is exactly the same as for $r =2$ with an important distinction. For $r=2$, integrating out high energy modes does not renormalize the coupling $h_i$ because the term $h_i \phi_i$ is a zero momentum mode. Hence the mass dimension of the coupling $h_i$ does not receive any quantum corrections under Wilsonian renormalization. However we can see from going to the Fourier space that $h_i \phi_i^{2r-3}$ no longer has only zero-momentum contribution. This term can potentially become relevant in the IR and give large contributions. In order to simplify the detailed calculation and qualitatively understand the underlying physics of the problem, we work in the limit when $h_i \phi_i^{2r-3}$ is extremely small as compared to the other terms. In other words, even though the coupling may be relevant, we will restrict ourselves to integrating out modes with an IR cutoff such that quantum corrections to $h_i$ do not blow out of proportion and consequently change the nature of the fixed points. In the first order approximation, the scaling dimension of $h_i$ can thus be taken to be its classical mass dimension. Such a restriction of the coupling $h_i$ to simplify our calculation essentially means that we are looking at the phase transitions at a tunable mesoscopic limit, rather than in the exact thermodynamic limit (i.e. the IR cutoff $(l^*)$ can be taken large enough provided we appropriately fine-tune the contribution $h_i \phi_i^{2r-3}$). This assumption is reasonable because we want to capture details of higher order transitions very close to the critical point, i.e., $h_i \to 0$, and also, the physics of different phase transitions really depends on moving in the $t$ direction. Note that in the special case where $h_i =0$, the effective Hamiltonian in \eqref{LG1} for $r=3$ describes third order phase transitions in the exact thermodynamic limit, since $l^*$ can now go all the way up to $l^* \to \infty$, with the only exception being that critical exponents involving $h_i$ are not defined. Here we will compute the critical exponents solely below four dimensions even though the upper critical dimension for $r=3$ is $d_u =6$. This is because the couplings $g_4$ and $g_6$ appearing in the phenomenological Hamiltonian for $r=3$ become irrelevant for $d>4$. Hence we cannot obtain critical exponents using linear stability analysis as done previously in \S \ref{r2d2} for $d>4$. With these subtleties in mind, the stage is clear to calculate the critical exponents of $r=3$. We start with writing the beta functions of the couplings $g_4$ and $g_6$ which appear in \eqref{LG1} for $r =3$. The beta functions are given by: \begin{eqnarray} \Lambda \frac{d g_{4}}{d \Lambda} &=& [d- 4] g_{4} + \frac{a(N+ 8)}{3}g_{4}^2 \label{bet3}\\ \Lambda \frac{d g_{6}}{d \Lambda} &=& [2d- 6] g_{6} + a(N+ 14) g_4g_6 - \frac{10 a (N+ 26)}{9}g_4^3 \label{bet31} \end{eqnarray} where $a$ is given in \eqref{a}. As in the case of $r =2$, we obtain two fixed points in this case as well. The trivial Gaussian fixed point is given by: \begin{equation} g_4^* = 0 \, , \qquad \qquad g_6^* = 0 \eeq We now perform linear stability analysis about this fixed point by expanding the beta function near the same. We again look at RG flows in the vicinity of this fixed point just below four dimensions, where we have defined $\epsilon = 4- d$. We obtain the following linearized beta functions: \begin{equation} \begin{pmatrix} \beta(\delta g_4)\\ \beta(\delta g_6) \end{pmatrix} = \begin{pmatrix} -\epsilon \qquad & 0 \\ 0 \qquad & 2(1- \epsilon) \end{pmatrix}\begin{pmatrix} \delta g_4\\ \delta g_6 \end{pmatrix} \eeq Since $0< \epsilon \ll 1$, the coupling $g_4$ is relevant while $g_6$ is irrelevant near this fixed point. We use the relevant coupling to compute the critical exponents which are given below: \begin{equation} \begin{split} \nu = \frac{1}{\epsilon} \, &, \qquad \qquad \Delta = \frac{1}{2} + \frac{1}{\epsilon}\\ \alpha = 4 \left( 1-\frac{1}{\epsilon}\right) \, &, \qquad \qquad \beta = -\frac{1}{2} + \frac{1}{\epsilon} \\ \gamma = 1 \, &, \qquad \qquad \delta = \frac{2+\epsilon}{2- \epsilon} \end{split} \eeq Notice that for $d =3$ i.e. $\epsilon = 1$, the above values of critical exponents match the ones computed via saddle point approximation in Table \ref{table1}. This is because the one-loop corrections near the Gaussian fixed point do not change the scaling dimensions of the couplings. Hence we do not get any corrections to the saddle point result at this order. Notice that there is no $N$-dependence in the critical exponents near the Gaussian fixed point. This is because about the Gaussian fixed point, the terms in \eqref{bet3} and \eqref{bet31} proportional to $N$ are quadratic or higher order in $\delta g_4$ and $\delta g_6$. However since we are only considering linear terms in our analysis, these terms do not contribute and hence we do not get any $N$ dependence. For $d<4$, there exists another non-trivial fixed point of the beta functions in \eqref{bet3}, which is given by: \begin{equation} g_4^* = -\frac{3 (d-4)}{a (N+8)} \, , \qquad \qquad g_6^* = -\frac{30 (d-4)^3 (N+26)}{a^2 (N+8)^2 (6 (N+20) - d (N+26))} \eeq The fixed point takes the following form in $d = 4-\epsilon$ dimensions: \begin{equation} g_4^* = \frac{3 \epsilon}{a (N+8)} \, , \qquad \qquad g_6^* = \frac{15 \epsilon^3 (N+26)}{a^2 (N+8)^3} \eeq Linearizing the beta functions about this fixed point, we obtain: \begin{equation} \begin{pmatrix} \beta(\delta g_4)\\ \beta(\delta g_6) \end{pmatrix} = \begin{pmatrix} \epsilon \qquad & 0 \\ O(\epsilon^2) \qquad & 2 + \epsilon \frac{N+26}{N+8} \end{pmatrix}\begin{pmatrix} \delta g_4\\ \delta g_6 \end{pmatrix} \eeq Notice that near this fixed point both the couplings are irrelevant. Hence the whole $g_4 -g_6$ plane is a basin of attraction. As we change the temperature i.e. vary the coupling $g_4$, the theory always flows to the above non-trivial fixed point. As stressed in \S\ref{scalerg}, we need at least one relevant coupling to write down the scaling relations, hence we cannot use the RG flow to obtain critical exponents near this fixed point. Hence the critical exponents for $r=3$ are determined by RG flows near the Gaussian fixed point. \subsection{Critical exponents for fourth order phase transitions $(r=4)$} We will now compute the critical exponents for fourth order phase transitions. The beta functions for the couplings $g_6$ and $g_8$ appearing in \eqref{LG1} for $r=4$ are given by: \begin{eqnarray} \label{beta4} \Lambda \frac{d g_{6}}{d \Lambda} &=& [2d- 6] g_{6} - \frac{a(N+ 6)}{7}g_8 \\ \Lambda \frac{d g_{8}}{d \Lambda} &=& [3d- 8] g_{8} + \frac{7a}{5}(N+ 24)g_6^2 \end{eqnarray} Again we have a trivial Gaussian fixed point, i.e. \begin{equation} g_6^* = 0 \, , \qquad \qquad g_8^* = 0\, . \eeq We perform the linear stability analysis about the Gaussian fixed point just below three dimensions, since by naive power-counting we know that these couplings are irrelevant for $d\geq 4$. Defining $\lambda \equiv 3 - d$, the linearized expansion of beta functions near the Gaussian fixed point is given by: \begin{equation} \begin{pmatrix} \beta(\delta g_6)\\ \beta(\delta g_8) \end{pmatrix} = \begin{pmatrix} - 2\lambda \qquad & -\frac{a}{7}(N+6)\\ 0 \qquad & 1-3\lambda \end{pmatrix}\begin{pmatrix} \delta g_6\\ \delta g_8 \end{pmatrix} \eeq We see that the coupling $g_6$ is relevant while the coupling $g_8$ can either be relevant, irrelevant or marginal depending on $\lambda$. For small $\lambda$, only $g_6$ is relevant, which we use to determine the critical exponents: \begin{equation} \begin{split} \nu = \frac{1}{2\lambda} \, &, \qquad \qquad \Delta = \frac{1 + 3\lambda}{4\lambda} \\ \alpha = \frac{3}{2} \left( 3-\frac{1}{\lambda}\right) \, &, \qquad \qquad \beta = \frac{1 - \lambda}{4\lambda}\\ \gamma = 1 \, &, \qquad \qquad \delta = \frac{1 + 3\lambda}{1-\lambda} \end{split} \eeq The beta functions given by \eqref{beta4} also admit a non-trivial fixed point which is given by: \begin{equation} g_6^* = -\frac{10 \left(3 d^2-17 d+24\right)}{a^2 \left(N^2+30 N+144\right)} \, , \qquad \qquad g_8^* = -\frac{140 (d-3)^2 (3 d-8)}{a^3 (N+6)^2 (N+24)}, \eeq Notice that this fixed point exists only for $d<3$. For $d>3$, $g^*_8$ becomes negative, thereby making the Hamiltonian unbounded. Just below three dimensions, the fixed point is given by: \begin{equation} g_6^* = \frac{10 (1-3 \lambda ) \lambda }{a^2 \left(N^2+30 N+144\right)} \qquad \qquad g_8^* = \frac{140 \lambda ^2 (3 \lambda -1)}{a^3 (N+6)^2 (N+24)} \eeq Expanding the beta-function near the fixed point in $3- \lambda$ dimensions, we obtain the following linearized form: \begin{equation} \begin{pmatrix} \beta(\delta g_6)\\ \beta(\delta g_8) \end{pmatrix} = \begin{pmatrix} -2\lambda \qquad & -\frac{a}{7}(N+6)\\ \frac{28 \lambda}{a (N+6)} \qquad & 1-3\lambda \end{pmatrix}\begin{pmatrix} \delta g_6\\ \delta g_8 \end{pmatrix} \eeq The eigenvalues of above matrix are given by: $$\frac{1}{2} \left(1 - 5\lambda -\sqrt{\lambda ^2-18 \lambda +1)}\right) \, \qquad \text{and} \qquad \frac{1}{2} \left(1 -5 \lambda + \sqrt{\lambda ^2-18 \lambda +1}\right).$$ Since $\lambda$ is small, we can linearly expand the above eigenvalues while ignoring higher order terms in $\lambda$. At the first order in $\lambda$, the eigenvalues are given by: $$2\lambda + O(\lambda^2) \, , \qquad \qquad 1 - 2 \lambda + O(\lambda^2)$$ We find that both the eigenvalues are positive i.e. both the couplings $g_6$ and $g_8$ are irrelevant near the non-trivial fixed point. Hence the critical exponents are given by the values obtained near the Gaussian fixed point, similar to our discussion for $r=3$. Notice that just like the case for $r=3$, the critical exponents are independent of $N$ here as well. For $r> 4$, the one-loop corrections to the beta functions of the corresponding couplings vanish. Hence we need to look at higher loop corrections to the beta function in order to obtain the values of critical exponents beyond saddle point. The main results of this section are summarized in Table \ref{table5}. \begin{table}[h!] \begin{center} \begin{tabular}{|l| l| l| l| l| l| l|} \hline r & $\alpha$ & $\beta$ & $\gamma$ & $\delta$ & $\nu$ & $\Delta$ \\ \hline & & & && & \\ 2 & $\epsilon \left(\frac{1}{2} - \frac{N+2}{N+8}\right) $ & $\frac{1}{2} - \frac{\epsilon}{4} \lc1 - \frac{N+2}{N+8}\right) $ & $1 + \frac{\epsilon}{2}\left(\frac{N+2}{N+8}\right) $ &$ 3 + \epsilon\left( \frac{N+2}{N+8}\right) $& $\frac{1}{2} + \frac{\epsilon}{4} \frac{ (N+2)}{(N+8)} $&$ \frac{3}{2} + \frac{ \epsilon}{4} \left(\frac{3(N+2)}{N+8} - 1 \right) $\\ & & & && & \\ \hline & & & && & \\ 3 &$ 4 \left( 1-\frac{1}{\epsilon}\right)$ &$-\frac{1}{2} + \frac{1}{\epsilon}$& 1& $\frac{2+\epsilon}{2- \epsilon}$& $\frac{1}{\epsilon} $&$\frac{1}{2} + \frac{1}{\epsilon}$\\ & & & && & \\ & & & && & \\ \hline & & & && & \\ 4 &$\frac{3}{2} \left( 3-\frac{1}{\lambda}\right)$&$\frac{1 - \lambda}{4\lambda}$&1&$\frac{1 + 3\lambda}{1-\lambda}$& $\frac{1}{2\lambda}$& $\frac{1 + 3\lambda}{4\lambda} $\\ & & & && & \\ \hline \end{tabular} \caption{One-loop corrections to the critical exponents. Here $\epsilon = 4-d$ and $\lambda = 3-d$. Note that the critical exponents for $r=2$ are calculated about the Wilson-Fisher fixed point, whereas the critical exponents for $r=3$ and $r=4$ are calculated about the Gaussian fixed point. This is due to the fact that for phase transitions of order $r=3,4$, there exists a relevant coupling only about the Gaussian fixed point.} \label{table5} \end{center} \end{table} \subsection{Discussion of results for $r = 3,4$} We now give a summary of results regarding critical exponents in various dimensions\footnote{We thank anonymous referee 2 for their insightful questions, which have been instrumental for the analysis in this subsection.}. As we pointed out in \S \ref{fluctuations}, saddle point calculations dominate over fluctuation contributions above $d=2r$. Below this upper critical dimension, saddle point dominates over fluctuations only if the generalized Ginzburg criteria is satisfied. If this is not the case, we need to take fluctuation contributions into account by venturing away from the saddle point, which gives rise to various scaling relations as derived in \S \ref{secscaling}. In order to calculate all possible critical exponents using these scaling relations, we need to estimate the values of two of them. In this section, we have evaluated the values of $\nu$ and $\Delta$, and consequently evaluate all of the critical exponents. In order to calculate all critical exponents using the scaling relations, we need to work within the regime where the coupling $t_r$ is relevant, which is always true for $r =2$, and conditionally true for $r=3$ and $4$ provided we work in $d \leq 4$ and $d \leq 3$ respectively. In this section, we have calculated $\nu$ and $\Delta$ using the one-loop beta functions for certain higher order phase transitions, i.e., for $r=2,3$ and $4$. We find that there exist two fixed points: one of them being the trivial Gaussian fixed point, i.e., the free theory limit, while the other point for $r=3,4$ below $d=4,3$ respectively is analogous to the Wilson-Fisher (WF) fixed point for $r=2$. We observe that within the $\epsilon$-expansion, there exist no relevant couplings about the WF fixed point for $r =3,4$ cases, in contrast to the $r =2$ case. Since there are no relevant directions, the scalings and scaling relations of physical observables derived in Section 4 are not valid near WF fixed point. Consequently we perform our analysis about the Gaussian fixed point for $r =3,4$. \begin{comment} \textcolor{purple}{ On the other hand, there exists a relevant coupling for both $r=3,4$ near the Gaussian fixed point just below $d=4,3$. The couplings which are marginal at tree level, i.e., the $g_4$ coupling for $r = 3$ in $d =4$ and $g_6$ coupling for $r =4$ in $d = 3$, become marginally relevant at the one-loop level. The corrections to the beta-functions at one-loop are proportional to the couplings. Hence when we expand the beta-function near the Gaussian fixed point, their mass dimensions at one-loop become proportional to $\epsilon$, which is why $d=4$ is special for $r=3$ and $d=3$ for $r=4$.} \end{comment} Note that $\epsilon$ is not the parameter characterizing our perturbative expansion for the $r=3,4$ cases as compared to the $\epsilon$-expansion performed for $r=2$. This is because the values of couplings at Gaussian fixed point are independent of $\epsilon$ (i.e., the couplings are zero), in contrast to the WF fixed point where the couplings depend on $\epsilon$. Consequently the critical exponents computed about the Gaussian fixed points are exact in $\epsilon$, in contrast to the computation of critical exponents in the expansion about WF point. Hence perturbation theory remains valid even when we take $\epsilon$ large enough, since expanding about the Gaussian fixed point is a perturbative expansion in the couplings, and not in terms of $\epsilon$ since the couplings are independent of $\epsilon$. Our analysis about the Gaussian point for $r =3,4$ shows that some critical exponents diverge in the $\epsilon \, ( \text{or} \, \lambda) \to 0$ limit, as given in Table \ref{table5}. This is because the couplings become marginal when this limit is imposed, and consequently our scaling relations in \S \ref{secscaling} become ill-defined, since they are valid only under the assumption that the coupling $t_r$ is relevant. This suggests us to go to finite non-zero values of $\epsilon(\lambda)$ to ensure the relevance of couplings and the subsequent validity of scaling relations in \S \ref{secscaling}. The results given in Table \ref{table5} therefore make sense when $\epsilon (\lambda)$ is finitely non-zero, and not when $\epsilon (\lambda) \to 0$. Coincidentally, for $\epsilon = 1$, the one-loop results for $r=3$ match the expected saddle point results for third order phase transitions in $d=3$, and similarly for $\lambda = \frac{1}{3}$ for $r=4$. In short, the "divergence" of the critical exponents neither invalidates perturbation theory and nor the $\frac{1}{\epsilon}$ factor appearing in Table \ref{table5} suggests anything dramatic, but are essential features of the phase transition. Since perturbation theory remains valid, we strongly expect other perturbative methods, such as dimensional regularization to give us same results about the Gaussian fixed point. We also note that our results in this subsection are not entirely unexpected, given the classical mass dimensions of the couplings obtained in \eqref{couplingdimensions}. Further, the absence of $N$-dependence in Table \ref{table5} is a standard feature of expansion about the Gaussian fixed point. It should be noted that the expansion about the Gaussian fixed point for $r=2$ does not lead to any $N$-dependence in the critical exponents as well. We also notice from Table \ref{table5} that if $\epsilon(\lambda)$ is close enough to zero, the critical exponent $\alpha$ can become drastically different from the saddle point expectation $\alpha =0$. In particular, an interesting case arises when $\abs{\alpha} \geq 1$, which basically implies that the order of the phase transition can potentially get changed under RG flows. Note that the changing of order of phase transition in this fashion is different from explicitly introducing lower order terms into \eqref{LG1}. \section{Summary and Discussion} We briefly summarize our work and discuss our conclusions here. In our work, we look at higher order thermodynamic phase transitions. For phase transitions involving a local order parameter, we write a generalized phenomenological Landau Hamiltonian, which describes $r$th order phase transitions. Near criticality, these phase transitions are characterized by divergences in the physical observables. We capture such divergences by introducing critical exponents. As a first step, we calculate these critical exponents by using the saddle point approximation. Next, we investigate the role of fluctuations. We consider fluctuations giving rise to polynomials in the local field whose order is smaller than the order of terms in the Lagrangian. We show that such fluctuations lead to non-analyticity in the critical exponents. We also show that there is a generalization of the notion of upper and lower critical dimensions, which is a straightforward extension of the $r=2$ case. Above the upper critical dimension $d= 2r$, the saddle point calculation is valid since fluctuations do not introduce new singularities. Below the upper critical dimension, we generalize the Ginzburg criteria to precisely quantify when fluctuations dominate over the saddle point calculation. Next, we introduce scaling forms for physical observables derived from the partition function. These scaling forms can be conveniently derived using Wilsonian renormalization. We use these forms to obtain scaling relations between the critical exponents, which continue to hold beyond the saddle point approximation. We show that given relevant couplings $t$ and $h$, one can use their mass dimensions and these scaling relations to determine all the critical exponents for these transitions. We further use the renormalization group to compute corrections to the critical exponents by calculating the one-loop beta functions. The one-loop beta functions are used to identify fixed points of the RG flow. We calculate the scaling dimensions of the couplings about these fixed points and use them to write the corrections to the critical exponents beyond the saddle point. For $r =3$ and $r=4$, we determine the corrected critical exponents of the couplings near the Gaussian fixed point. We also find a non-trivial fixed point in both cases. However, there are no relevant couplings in the vicinity of the non-trivial fixed point, and consequently, the sole corrections arise due to flows near the Gaussian fixed point. For $r \geq 5$, the one-loop beta function vanishes, and hence we need to go beyond one-loop calculations to find corrections to the critical exponents. We now briefly discuss why we rarely observe higher order local phase transitions in physical systems. Higher order phase transitions with a local order parameter require a delicate fine-tuning which sets lower order terms in the Hamiltonian to zero. Such a fine-tuning is uncommon in most systems of physical interest, where such terms can arise due to fluctuations. These lower order terms can be avoided due to the existence of a symmetry, however we presently do not know any symmetry argument which explicitly rules out such terms. A conceptual feature we wish to convey through our work is that the one-loop method used in our of calculation of critical exponents in \S \ref{crrg} is possibly more convenient than using Feynman diagrammatics to do the same, as performed for $r=2$ in \cite{Peskin:1995ev, kardar_2007}. One important question which remains to be answered is to estimate the contribution of higher loop corrections to the critical exponents. We will list out possible avenues that branch out from our work. An immediate direction is to construct a guiding principle that classifies higher order non-local phase transitions. Using such a principle, we hope to write a phenomenological Hamiltonian describing higher-order non-local phase transitions. An important class of non-local third order phase transitions arise in Gross-Witten-Wadia type models. In a forthcoming work, we will investigate such phase transitions and calculate critical exponents for the same. In general, one can investigate such phase transitions in the context of finite-range Coulomb gas models. We visualize our present work to be a starting basis for looking at these problems and hope to uncover some of the above mysteries in future works. \section*{Acknowledgements} We thank Abhishek Dhar and Akhil Sivakumar, and especially anonymous referee for their comments on the draft. We are also grateful to Spenta Wadia for going through the earlier version of the draft meticulously and for suggesting corrections. The authors acknowledge gratitude to the people of India for their steady and generous support to research in basic sciences.
\section{Introduction} \label{sec:S_Intro} The classical incompressible Navier--Stokes constitutive equation and its usual generalisations, the constitutive relations for the incompressible Stokesian fluid, are explicit expressions for the Cauchy stress in terms of the symmetric part of the velocity gradient. The Stokesian fluid is defined by the constitutive expression \begin{equation} \label{eq:Stokesian} {\boldsymbol{T}} = -p\boldsymbol{I} + \mathbf{f}(\boldsymbol{D}), \end{equation} where ${\boldsymbol{T}}$ is the Cauchy stress, $-p\boldsymbol{I}$ is the indeterminate part of the stress due to the constraint of incompressibility and $\boldsymbol{D}$ is the symmetric part of the velocity gradient, $\boldsymbol{D}= \frac{1}{2}(\nabla \mathbf{u} + (\nabla \mathbf{u})^{t})$. The incompressible Navier--Stokes fluid is a special sub-class of \eqref{eq:Stokesian} that is linear in the symmetric part of the velocity gradient and is defined through: \begin{equation} \label{eq:Navier--Stokes} {\boldsymbol{T}} = -p\boldsymbol{I} + 2\mu \boldsymbol{D}, \end{equation} where $\mu$ is the viscosity of the fluid. Power-law fluids are another popular sub-class of \eqref{eq:Stokesian}, the power-law fluid being defined through the constitutive equation \begin{equation} \label{eq:power-law} {\boldsymbol{T}} = -p\boldsymbol{I} + 2\mu_0 \big(1+\alpha{\rm tr}(\boldsymbol{D}^2)\big)^m \boldsymbol{D}, \end{equation} where $\mu_0$ and $\alpha$ are positive constants and $m$ is a constant; if $m$ is zero we recover the Navier--Stokes fluid model, if it is negative we have a shear-thinning fluid model and if it is positive we have a shear-thickening fluid model. There are however many fluids that cannot be described by constitutive equations of the form \eqref{eq:Stokesian} but require ``relations", in the true mathematical sense of the term, between the Cauchy stress and the symmetric part of the velocity gradient. Implicit constitutive relations that involve higher time derivatives of the stress and the symmetric part of the velocity gradient have been proposed to describe the response of non-Newtonian fluids that exhibit viscoelastic response\footnote{While the Maxwell fluid (see Maxwell (1866)~\cite{ref:Maxwell1866}) is defined through a constitutive relation involving the derivative of the stress, it is not an implicit model in that the symmetric part of the velocity gradient can be explicitly defined in terms of the stress and the time derivative of the stress.} (see Burgers (1939)~\cite{ref:Burgers39}, Oldroyd (1950)~\cite{ref:Oldroyd50}); that is fluids that exhibit phenomena like stress relaxation. However, purely implicit algebraic relationship between the stress and the symmetric part of the velocity gradient were not considered to describe non-Newtonian fluids until recently. Such models are critical if one is interested in describing the response of fluids which do not exhibit viscoelasticity but whose material properties depend on the mean value of the stress and the shear rate, a characteristic exhibited by many fluids and colloids, as borne out by numerous experiments. Consider for example an incompressible fluid whose viscosity depends on the mechanical pressure\footnote{The terminology ``pressure" is often misused, especially in nonlinear fluids; for a detailed discussion of the same see Rajagopal (2015)~\cite{ref:Raj15}.} (mean value of the stress) and is shear-thinning, whose constitutive relation takes the form \begin{equation} \label{eq:NLconst_rel} {\boldsymbol{T}}=-p\boldsymbol{I}+2\mu\big(p,{\rm tr}(\boldsymbol{D}^2)\big)\boldsymbol{D}. \end{equation} Since ${\rm tr}(\boldsymbol{D}) = \di(\mathbf{u}) =0$, \begin{equation} \label{eq:tr_T=p/3} {\rm tr} ({\boldsymbol{T}}) = - 3p, \quad \mbox{i.e.,} \quad p=-\frac{1}{3}{\rm tr} ({\boldsymbol{T}}), \end{equation} the above equation takes the form \begin{equation} \label{eq:tr_T=p/3.bis} {\boldsymbol{T}} =\frac{1}{3}({\rm tr} ({\boldsymbol{T}})) \boldsymbol{I}+ 2\mu\big(\frac{1}{3} {\rm tr} ({\boldsymbol{T}}),{\rm tr}(\boldsymbol{D}^2 )\big)\boldsymbol{D}. \end{equation} (The factor 1/3 is related to the number of space dimensions $d=3$; in two dimensions it would be replaced by 1/2.) The above expression is of the form \begin{equation} \label{eq:implicit1} \mathbf{f}({\boldsymbol{T}},\boldsymbol{D})={\bf 0}, \end{equation} which is an implicit relationship between the stress and the symmetric part of the velocity gradient. Rajagopal (2003)~\cite{Raj2003}, (2006)~\cite{ref:Raj2006} introduced the implicit relationship of the above form (and also the much more general implicit relationship between the history of the stress and the history of the deformation gradient) to describe materials whose properties depend upon the pressure and the shear rate. In fact, the properties of all fluids depend upon the pressure: it is just a matter of how large the variation of the pressure is in order for one to take the variation of the properties into account. The book by Bridgman (1931)~\cite{ref:Bridgman31} entitled ``Physics of High Pressures" provides copious references to the experimental literature before 1931 on the variation of the viscosity of fluids with pressure, and one can find recent references to the experimental literature on the dependence of viscosity on pressure in M\'alek and Rajagopal (2006)~\cite{ref:Malek_Raj06}. Stokes (1845)~\cite{ref:Stokes1845} recognised that the viscosity of fluids varies with pressure, but in the case of sufficiently slow flows in channels and pipes he assumed that the viscosity could be considered a constant. Suffice to say, constitutive relations of the class \eqref{eq:implicit1} are necessary to describe the response of fluids whose viscosity depends on the pressure. Also as mentioned earlier, the implicit constitutive relation \eqref{eq:implicit1} is useful to describe the behaviour of colloids. Recently, Perl\'acov\'a and Pr\v{u}\v{s}a (2015)~\cite{ref:PerlacPrus15} (see also LeRoux and Rajagopal (2013)~\cite{ref:LeRou_Raj13}) used an implicit model belonging to a sub-class of \eqref{eq:implicit1} to describe the response of colloidal solutions as presented in the experimental work of Boltenhagen {\it et al.} (1997)~\cite{ref:Bol_Hu_Mat_Pi97}, Hu {\it et al.} (1998)~\cite{ref:Hu_Bolt_Mat_Pin98}, Lopez-Diaz {\it et al.} (2010)~\cite{ref:Lop_Sar_Gar_Cas10} among others. Notice that while one always expresses the incompressible Navier--Stokes fluid by the representation \eqref{eq:Navier--Stokes}, it is perfectly reasonable to describe it as \begin{equation} \label{eq:NS2} \boldsymbol{D}=\varphi \boldsymbol{I} + \frac{1}{2\mu} {\boldsymbol{T}}, \quad \mbox{where}\ \varphi=\frac{p}{2\mu}. \end{equation} In fact, it is the representation \eqref{eq:NS2} that is in keeping with causality as the stress is the cause and the velocity and hence its gradient is the effect, and this fact cannot be overemphasised. Such a representation would imply that the Stokes assumption that is often appealed to is incorrect (see Rajagopal (2013)~\cite{ref:Raj13} for a detailed discussion of the same). M\'alek {et al.} (2010)~\cite{ref:Mal_Pru_Raj} generalised \eqref{eq:NS2} to stress power-law fluids, namely constitutive relations of the form: \begin{equation} \label{eq:powerlaw2} \begin{split} {\boldsymbol{T}} &= -p\boldsymbol{I} + {\boldsymbol{T}}^\bd,\\ \boldsymbol{D} &= \gamma \big[1+\beta {\rm tr}(({\boldsymbol{T}}^\bd)^2 )\big]^n {\boldsymbol{T}}^\bd, \end{split} \end{equation} where ${\boldsymbol{T}}^\bd$ is the deviatoric part of the Cauchy stress, $\gamma$ and $\beta$ are positive constants, and $n$ is a constant that can be positive, negative or zero. The constitutive relation \eqref{eq:powerlaw2} is capable of describing phenomena that the classical power-law models are incapable of describing. For instance, the constitutive models \eqref{eq:powerlaw2} can describe limiting strain rate as well as fluids which allow the possibility of the strain rate initially increasing with stress and later decreasing with stress; both such responses cannot be described by the classical power-law fluid model \eqref{eq:power-law} (see the discussion in M\'alek {\it et al.} (2010)~\cite{ref:Mal_Pru_Raj} with regard to the difference in the response characteristics of the stress power-law fluid and the classical power-law fluid). We are interested in a further generalization of the constitutive relation of the form \eqref{eq:powerlaw2} that is appropriate for describing the response of colloidal solutions. This constitutive relation takes the form: \begin{equation} \label{eq:powerlaw3} \boldsymbol{D} = \Big\{\gamma\big[1+\beta {\rm tr}(({\boldsymbol{T}}^\bd)^2 )\big]^n + \alpha \Big\} {\boldsymbol{T}}^\bd, \end{equation} where $\alpha$, $\beta$, and $\gamma$ are positive constants, $n$ is a real number, and ${\boldsymbol{T}}^\bd$ is the deviatoric part of the Cauchy stress. The shear stress in a fluid undergoing simple shear flow, that is described by the constitutive relation given above, increases from zero to a maximum, then decreases to a local minimum, and then increases monotonically as the shear stress increases from zero. As discussed by Le Roux and Rajagopal~\cite{ref:LeRou_Raj13}, and Perl\'acov\'a and Pr\v{u}\v{s}a~\cite{ref:PerlacPrus15}, many colloids exhibit such behavior. The constitutive relation that we introduce first in \eqref{pb:S_ENL2} and next in \eqref{pb:NS_EL} includes \eqref{eq:powerlaw3} as a special sub-class. It can be posed within a Hilbert space setting owing to the presence of the coefficient $ \alpha$ in \eqref{eq:powerlaw3}, but nevertheless, it is a challenging problem as it involves two nonlinearities: the monotone part in the constitutive relation and the inertial (convective) term. The problem without the inertial term, see Subsection \ref{sec:S_ENL} below, has already been analysed in \cite{ref:BGS18}, while the analysis of the steady-state incompressible Navier--Stokes equations is well-established, see for instance \cite{Tem,ref:GiR}. With both nonlinearities present in the model, proving the existence of a weak solution, for instance, to the best of our knowledge cannot be done by simply coupling the techniques used for these two problems, namely the Browder--Minty theorem and the Galerkin method combined with Brouwer's fixed point theorem and a weak compactness argument. More refined arguments are needed; they are crucial to the proofs of Lemmas \ref{lem:conv_product} and \ref{lem:T_to_G(u)} below. This work is organised as follows. The notation and the functional-analytic setting are recalled in the next subsection. In Section \ref{sec:S_EL}, both linear and fully nonlinear versions of the formulation are briefly analysed for the Stokes system, i.e., without the inertial (convective) term. The theoretical analysis of the complete nonlinear system is carried out in Section \ref{sec:NS_ENL}. The main results of this section are Theorem~\ref{thm:existence1} for the existence of a solution and Proposition~\ref{lem:uniqueness} for the uniqueness of a solution under additional assumptions on the input data. In Section~\ref{sec:NS_ENL_App}, conforming finite element approximations of these models are proposed and error estimates are derived. The cases of both simplicial and hexahedral elements are discussed. The analysis of the latter is less satisfactory as it requires subdivisions consisting of parallelepipeds and suffers from a higher computational cost. This motivates the introduction of nonconforming approximations in Section \ref{sec:NS_ENL_AppNC}. In Section \ref{sec:numerics}, two decoupling algorithms are presented and compared: a Lions--Mercier algorithm adapted to a system with a monotone part and an elliptic part, and a classical fixed-point algorithm alternating between the approximation of a Navier-Stokes system and the nonlinear constitutive relation for the stress. Numerical experiments are performed with conforming finite elements on a square mesh in two dimensions. The theoretically established convergence of the scheme is confirmed and convergence of both decoupled algorithms is observed. \subsection{Notation and preliminaries} \label{subsec:notation} Let $\Omega\subset\mathbb{R}^d$, $d\in\{2,3\}$, be a bounded, open, simply connected Lipschitz domain. We consider the function spaces \begin{equation} \label{def:spaces} Q:=L_0^2(\Omega), \quad V:=H_0^1(\Omega)^d \quad \mbox{and} \quad M:=\{\boldsymbol{S}\in L^2(\Omega)_{{\rm sym}}^{d\times d}: \, \tr(\boldsymbol{S})=0\}, \end{equation} for the pressure, the velocity, and the deviatoric stress tensor, respectively. As usual, \[L^2_0(\Omega) = \left\{q \in L^2(\Omega):\, \int_\Omega q = 0\right\},\] the zero mean value constraint being introduced to fix the undetermined additive constant in the mechanical pressure. Here the subscript sym indicates that the $d \times d$ tensors under consideration are assumed to be symmetric. Henceforth, the symmetric gradient of the velocity field $\mathbf{v}$ (or, briefly, symmetric velocity gradient) will be denoted by \begin{equation} \label{def:strain} \boldsymbol{D}(\mathbf{v}) :=\frac{1}{2}(\nabla\mathbf{v}+(\nabla\mathbf{v})^t) \end{equation} and the deviatoric part of a $d \times d$ tensor $\boldsymbol{S}$ is defined by \begin{equation} \label{def:deviator} \boldsymbol{S}^{\bd}:=\boldsymbol{S}-\frac{1}{d}\tr(\boldsymbol{S})\boldsymbol{I} \end{equation} with $\boldsymbol{I}$ the $d\times d$ identity tensor; thus the trace of $\boldsymbol{S}^{ \bd}$ is zero. We denote by $\mathcal{V}}% {V_{\di}$ the subspace of $V$ consisting of all divergence-free functions contained in $V$; that is, \begin{equation} \label{def:space_Vdiv} \mathcal{V}}% {V_{\di}:=\{\mathbf{v}\in V: \, \di(\mathbf{v})=0\}. \end{equation} For vector-valued functions $\mathbf{v}:\Omega\rightarrow\mathbb{R}^d$, we write $$\|\mathbf{v}\|_{L^2(\Omega)}:=\|\, |\mathbf{v}| \,\|_{L^2(\Omega)} \quad \mbox{and} \quad \|\mathbf{v}\|_{L^{\infty}(\Omega)}:=\|\, |\mathbf{v}| \,\|_{L^{\infty}(\Omega)}$$ with $|\cdot |$ signifying the Euclidean norm on $\mathbb{R}^d$, while for tensor-valued functions $\boldsymbol{S}:\Omega\rightarrow\mathbb{R}^{d\times d}$, we define $$\|\boldsymbol{S}\|_{L^2(\Omega)}:=\| \, |\boldsymbol{S}| \, \|_{L^2(\Omega)},$$ where now $$|\boldsymbol{S}|:=\sqrt{\boldsymbol{S}:\boldsymbol{S}}$$ is the Frobenius norm of $\boldsymbol{S}$. Clearly, $M$ is a Hilbert space with this norm. We recall the Poincar\'e and Korn inequalities, which are, respectively, the following: there exist positive constants $C_P$ and $C_K$ such that \begin{equation} \label{def:poincare} \|v\|_{L^2(\Omega)}\leq C_P\|\nabla v\|_{L^2(\Omega)} \quad \forall\, v\in H_0^1(\Omega) \end{equation} and \begin{equation} \label{def:korn} \|\nabla \mathbf{v}\|_{L^2(\Omega)}\leq C_K\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)} \quad \forall\, \mathbf{v}\in V. \end{equation} We endow $V$ (and $\mathcal{V}}% {V_{\di}$) with the norm \begin{equation} \label{def:equivnorm} \|\cdot\|_V:=\|\boldsymbol{D}(\cdot)\|_{L^2(\Omega)}. \end{equation} Both $V$ and $\mathcal{V}}% {V_{\di}$ are Hilbert spaces with this norm, because $\|\cdot\|_V$ is equivalent to both the $H^1(\Omega)^{d\times d}$ norm and the $H^1(\Omega)^{d \times d}$ semi-norm, thanks to \eqref{def:poincare}, \eqref{def:korn} and the trivial relation $\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)}\leq \|\nabla\mathbf{v}\|_{L^2(\Omega)}$. \section{Stokes system with linear and nonlinear constitutive relations} \label{sec:S_EL} In this section we study two preliminary model problems without the inertial term; the first one simply reduces to the Stokes system, while the second model problem involves a monotone nonlinearity treated by the Browder--Minty approach. \subsection{The Stokes system} \label{subsec:Stokes} Let us consider the problem \begin{equation} \label{pb:S_EL} \left\{\begin{array}{rcll} -\di({\boldsymbol{T}}) & =& \mathbf{f} &\quad \mbox{in } \Omega, \\ \boldsymbol{D}(\mathbf{u}) & =& \alpha{\boldsymbol{T}}^\bd & \quad \mbox{in } \Omega, \\ \di(\mathbf{u}) & =& 0 &\quad \mbox{in } \Omega, \\ \mathbf{u} & =& \mathbf{0} &\quad \mbox{on } \partial\Omega, \end{array} \right. \end{equation} where $\mathbf{f}:\Omega\rightarrow\mathbb{R}^d$ is a prescribed external force, $\boldsymbol{D}(\mathbf{u})$ is defined by \eqref{def:strain}, the unknown tensor ${\boldsymbol{T}}$ is symmetric, and $\alpha$ is a given positive constant, the reciprocal of the viscosity coefficient. Here, we assume that $\mathbf{f}\in L^2(\Omega)^d$ for simplicity, but a similar analysis holds for the general case $\mathbf{f}\in V'=H^{-1}(\Omega)^d$; see for instance Remark \ref{rem:1} in Section \ref{sec:NS_ENL}. By decomposing the Cauchy stress ${\boldsymbol{T}}$ as ${\boldsymbol{T}}={\boldsymbol{T}}^{\bd} + \frac{1}{d} \tr({\boldsymbol{T}}) \boldsymbol{I}$ and inserting this in the first equation of \eqref{pb:S_EL} we arrive at the following equivalent problem: \begin{equation} \label{pb:S_EL2} \left\{\begin{array}{rcll} -\di({\boldsymbol{T}}^\bd)-\frac{1}{d}\nabla\tr({\boldsymbol{T}}) & = & \mathbf{f} & \mbox{in } \Omega, \\ \boldsymbol{D}(\mathbf{u}) & = & \alpha{\boldsymbol{T}}^\bd & \mbox{in } \Omega, \\ \di(\mathbf{u}) & = & 0 & \mbox{in } \Omega, \\ \mathbf{u} & = & \mathbf{0} & \mbox{on } \partial\Omega, \end{array}\right. \end{equation} which we recognise to be the Stokes system where the mechanical pressure (mean normal stress) is $p:=-\frac{1}{d}\tr({\boldsymbol{T}})$. Recalling the spaces $M,V,Q$ defined in \eqref{def:spaces} and using the relation $$\boldsymbol{D}(\mathbf{v}):\boldsymbol{S}=\nabla\mathbf{v}:\boldsymbol{S},$$ which holds\footnote{For any $\boldsymbol{R},\boldsymbol{S}\in\mathbb{R}^{d\times d}$, with $\boldsymbol{S}$ symmetric, we have that $\boldsymbol{S}:\boldsymbol{R}=\left(\frac{\boldsymbol{S}+\boldsymbol{S}^{t}}{2}\right):\boldsymbol{R}=\frac{1}{2}\boldsymbol{S}:\boldsymbol{R}+\frac{1}{2}\boldsymbol{S}^{t}:\boldsymbol{R}=\frac{1}{2}\boldsymbol{S}:\boldsymbol{R}+\frac{1}{2}\boldsymbol{S}:\boldsymbol{R}^{t}=\boldsymbol{S}:\left(\frac{\boldsymbol{R}+\boldsymbol{R}^{t}}{2}\right)$.} for any symmetric tensor $\boldsymbol{S}$, the weak formulation of problem \eqref{pb:S_EL2} can be written as follows: find a triple $({\boldsymbol{T}}^\bd,\mathbf{u},p)\in M\times V\times Q$ such that \begin{alignat}{2} \label{pb:S_EL2_weak} \begin{aligned} \int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{v}) - \int_{\Omega}p\di(\mathbf{v}) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v} && \quad\forall\, \mathbf{v}\in V, \\ \alpha\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{S} - \int_{\Omega}\boldsymbol{S}:\boldsymbol{D}(\mathbf{u}) & = 0 && \quad \forall\, \boldsymbol{S}\in M, \\ -\int_{\Omega}q\di(\mathbf{u}) & = 0 && \quad \forall\, q\in Q. \end{aligned} \end{alignat} For any $\boldsymbol{S}\in M$, $\mathbf{v}\in V$, and $q\in Q$, we set \begin{align*} b_1(\boldsymbol{S},\mathbf{v}) & := \int_{\Omega}\boldsymbol{S}:\boldsymbol{D}(\mathbf{v}), \\ b_2(\mathbf{v},q) & := -\int_{\Omega}q\di(\mathbf{v}). \end{align*} As is usual for the Stokes problem, the unknown pressure can be eliminated from \eqref{pb:S_EL2_weak} by restricting the test functions $\mathbf{v}$ to $\mathcal{V}}% {V_{\di}$. In addition, the variable $\mathbf{u}$ can also be eliminated by treating the first line of \eqref{pb:S_EL2_weak} as a constraint, thus leading to an equivalent (reduced) problem for which the two variables $p$ and $\mathbf{u}$ are eliminated. The equivalence is based on the following (inf-sup) conditions \begin{equation} \label{infsup:b1} \inf_{\mathbf{v}\in \mathcal{V}}% {V_{\di}}\sup_{\boldsymbol{S}\in M}\frac{b_1(\boldsymbol{S},\mathbf{v})}{\|\boldsymbol{S}\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)}}\geq 1 \end{equation} and \begin{equation} \label{infsup:b2} \exists\beta>0: \quad \inf_{q\in Q}\sup_{\mathbf{v}\in V}\frac{b_2(\mathbf{v},q)}{\|q\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)}}\geq\inf_{q\in Q}\sup_{\mathbf{v}\in V}\frac{b_2(\mathbf{v},q)}{\|q\|_{L^2(\Omega)}\|\nabla\mathbf{v}\|_{L^2(\Omega)}}\geq \beta, \end{equation} where we have used that $\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)}\leq \|\nabla\mathbf{v}\|_{L^2(\Omega)}$. It is well-known that the spaces $V$ and $Q$ defined in \eqref{def:spaces} satisfy the inf-sup condition \eqref{infsup:b2}, see for instance~\cite{ref:GiR}, while the relation \eqref{infsup:b1} can be easily shown by observing that, for a given $\mathbf{v}\in \mathcal{V}}% {V_{\di}$, we have $\boldsymbol{R}:=\boldsymbol{D}(\mathbf{v})\in M$ since $\tr(\boldsymbol{R})=\tr(\boldsymbol{D}(\mathbf{v}))=\di(\mathbf{v})=0$ and $\boldsymbol{D}(\mathbf{v})$ is symmetric. Therefore, $b_1(\boldsymbol{R},\mathbf{v})=\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)}^2$ and thus \begin{align*} \sup_{\boldsymbol{S}\in M}\frac{b_1(\boldsymbol{S},\mathbf{v})}{\|\boldsymbol{S}\|_{L^2(\Omega)}}\geq \frac{b_1(\boldsymbol{R},\mathbf{v})}{\|\boldsymbol{R}\|_{L^2(\Omega)}}=\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)}. \end{align*} We can then eliminate the incompressibility constraint by seeking $\mathbf{u}\in \mathcal{V}}% {V_{\di}$, yielding the (partially reduced) problem: find $({\boldsymbol{T}}^\bd,\mathbf{u})\in M\times \mathcal{V}}% {V_{\di}$ such that \begin{alignat}{2} \label{pb:S_EL2_weak2} \begin{aligned} \int_{\Omega} {\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{v}) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v} && \quad \forall\, \mathbf{v}\in \mathcal{V}}% {V_{\di}, \\[0.25cm] \alpha\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{S} - \int_{\Omega}\boldsymbol{S}:\boldsymbol{D}(\mathbf{u}) & = 0 &&\quad \forall\, \boldsymbol{S}\in M. \end{aligned} \end{alignat} Clearly, each solution of \eqref{pb:S_EL2_weak} satisfies \eqref{pb:S_EL2_weak2}. Conversely, it follows from the inf-sup condition (\ref{infsup:b2}) that for any solution $({\boldsymbol{T}}^\bd,\mathbf{u})$ of \eqref{pb:S_EL2_weak2} there exists a unique $p\in Q$ such that $({\boldsymbol{T}}^\bd,\mathbf{u},p)$ is the solution of \eqref{pb:S_EL2_weak}; see~\cite{ref:GiR}. Hence these two problems are equivalent. Furthermore, we can eliminate the unknown $\mathbf{u}$ by proceeding as follows; see~\cite{ref:BGS18}. First, we introduce the decomposition $M=\mathcal{M}\oplus\mathcal{M}^{\perp}$ with \begin{equation} \label{eq:calM} \mathcal{M}:=\{\boldsymbol{S}\in M \,: \, b_1(\boldsymbol{S},\mathbf{v})=0 \quad \forall\, \mathbf{v}\in\mathcal{V}}% {V_{\di}\}, \end{equation} the kernel of $b_1$, and \begin{equation*} \mathcal{M}^{\perp}:=\{\boldsymbol{S}\in M \,: \, \int_{\Omega}\boldsymbol{S}:\boldsymbol{R}=0 \quad \forall\, \boldsymbol{R}\in\mathcal{M}\} \end{equation*} its orthogonal complement in $M$, and we write ${\boldsymbol{T}}^\bd={\boldsymbol{T}}_0^\bd+{\boldsymbol{T}}_\mathbf{f}^\bd$ with ${\boldsymbol{T}}_0^\bd\in\mathcal{M}$ and ${\boldsymbol{T}}_\mathbf{f}^\bd\in\mathcal{M}^{\perp}$. The condition \eqref{infsup:b1} ensures the existence and uniqueness of ${\boldsymbol{T}}_\mathbf{f}^\bd\in\mathcal{M}^{\perp}$ satisfying \begin{equation} \label{eq:Tf} b_1({\boldsymbol{T}}_\mathbf{f}^\bd,\mathbf{v}) = \int_{\Omega}\mathbf{f}\cdot\mathbf{v} \quad \forall\, \mathbf{v}\in\mathcal{V}}% {V_{\di} \quad \mbox{and} \quad \|{\boldsymbol{T}}_\mathbf{f}^\bd\|_{L^2(\Omega)}\leq C_PC_K\|\mathbf{f}\|_{L^2(\Omega)} \end{equation} with $C_P$ and $C_K$ the constants in Poincar\'e's and Korn's inequalities \eqref{def:poincare} and \eqref{def:korn}, respectively. We finally get the (fully reduced) problem: find ${\boldsymbol{T}}_0^\bd\in\mathcal{M}$ such that \begin{equation} \label{pb:S_EL2_weak3} \begin{array}{rcll} \alpha\int_{\Omega}{\boldsymbol{T}}_0^\bd:\boldsymbol{S} = -\alpha\int_{\Omega}{\boldsymbol{T}}_\mathbf{f}^\bd:\boldsymbol{S} & \forall\, \boldsymbol{S}\in \mathcal{M}. \end{array} \end{equation} The well-posedness of problem \eqref{pb:S_EL2_weak3} follows from the Lax--Milgram lemma, while its equivalence to the original problem \eqref{pb:S_EL2_weak} is guaranteed by \eqref{infsup:b1} and \eqref{infsup:b2}. Of course, in this simple model with a linear constitutive relation, ${\boldsymbol{T}}_0^d=\mathbf{0}$ since the right-hand side of \eqref{pb:S_EL2_weak3} vanishes and $\alpha(\cdot,\cdot)_\Omega $ is an inner product on $\mathcal{M}$. However, the framework developed here will be used in the sequel in a more general setting. \subsection{Stokes model with a nonlinear constitutive relation} \label{sec:S_ENL} Next, we consider the following Stokes-like system with a nonlinear relation between the stress and the symmetric velocity gradient: \begin{equation} \label{pb:S_ENL2} \left\{\begin{array}{rcll} -\di({\boldsymbol{T}}^\bd)-\frac{1}{d}\nabla\tr({\boldsymbol{T}}) & = & \mathbf{f} & \mbox{in } \Omega, \\ \boldsymbol{D}(\mathbf{u}) & = & \alpha{\boldsymbol{T}}^\bd+\gamma\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd & \mbox{in } \Omega, \\ \di(\mathbf{u}) & = & 0 & \mbox{in } \Omega, \\ \mathbf{u} & = & \mathbf{0} & \mbox{on } \partial\Omega \end{array}\right. \end{equation} with $\gamma$ a given positive constant, and where $\mu\in\mathcal{C}^1((0,+\infty))\cap\mathcal{C}^0([0,+\infty))$ is a given function satisfying \begin{equation} \label{eqn:mu_diff} \frac{{\rm d}}{{\rm d}a}(\mu(a)a)>0 \quad \forall\, a\in\mathbb{R}_{> 0} \end{equation} and \begin{equation} \label{eqn:mu_pos_C1} \mu(a) > 0 \quad \mbox{and} \quad \mu(a)a\leq C_1 \quad \forall\, a \in \mathbb{R}_{\geq 0} \end{equation} for some positive constant $C_1$. Since $\mu$ is continuous on any subinterval of $\mathbb{R}_{\geq 0}$, the second part of \eqref{eqn:mu_pos_C1} implies that $\mu$ is bounded above and we denote its maximum by $\mu_{\rm max}$, \begin{equation} \label{eq:mumax} 0 < \mu(a) \le \mu_{\rm max}\quad \forall \, a \in \mathbb{R}_{\geq 0}. \end{equation} Moreover, proceeding as in the proof of \cite[Lemma 4.1]{BMRS14}, we deduce from \eqref{eqn:mu_diff} and \eqref{eqn:mu_pos_C1} that for any $\boldsymbol{R},\boldsymbol{S}\in\mathbb{R}^{d\times d}$, the following monotonicity property hold: \begin{eqnarray} \label{eqn:mu_mon} (\mu(|\boldsymbol{R}|)\boldsymbol{R}-\mu(|\boldsymbol{S}|)\boldsymbol{S}):(\boldsymbol{R}-\boldsymbol{S}) \geq 0, \end{eqnarray} with equality if and only if $\boldsymbol{R}=\boldsymbol{S}$. Introducing again $p:=-\frac{1}{d}\tr({\boldsymbol{T}})$, the weak formulation of problem \eqref{pb:S_ENL2} reads as follows: find a triple $({\boldsymbol{T}}^\bd,\mathbf{u},p)\in M\times V\times Q$ such that \begin{alignat}{2} \label{pb:S_ENL2_weak} \begin{aligned} \int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{v}) - \int_{\Omega}p\di(\mathbf{v})& = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v} &&\quad \forall\, \mathbf{v}\in V, \\[0.25cm] \alpha\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{S} + \gamma\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{S} - \int_{\Omega}\boldsymbol{S}:\boldsymbol{D}(\mathbf{u}) & = 0 &&\quad \forall\, \boldsymbol{S}\in M, \\[0.25cm] -\int_{\Omega}q\di(\mathbf{u}) & = 0 &&\quad \forall\, q\in Q. \end{aligned} \end{alignat} Proceeding exactly as in Section \ref{subsec:Stokes}, we first eliminate the pressure, and we thus deduce that problem \eqref{pb:S_ENL2_weak} is equivalent to the following problem: find $({\boldsymbol{T}}^\bd,\mathbf{u})\in M\times \mathcal{V}}% {V_{\di}$ such that \begin{alignat}{2} \label{pb:S_ENL2_weak2} \begin{aligned} \int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{v}) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v} &&\quad \forall\, \mathbf{v}\in \mathcal{V}}% {V_{\di}, \\[0.25cm] \alpha\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{S} + \gamma\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{S} - \int_{\Omega}\boldsymbol{S}:\boldsymbol{D}(\mathbf{u}) & = 0 &&\quad \forall\, \boldsymbol{S}\in M, \end{aligned} \end{alignat} which is further equivalent to the following problem: find ${\boldsymbol{T}}_0^\bd\in\mathcal{M}$ such that \begin{equation} \label{pb:S_ENL2_weak3} \begin{array}{rcll} \alpha\int_{\Omega}({\boldsymbol{T}}_0^\bd+{\boldsymbol{T}}_\mathbf{f}^\bd):\boldsymbol{S} + \gamma\int_{\Omega}\mu(|{\boldsymbol{T}}_0^\bd+{\boldsymbol{T}}_\mathbf{f}^\bd|) ({\boldsymbol{T}}_0^\bd+{\boldsymbol{T}}_\mathbf{f}^\bd):\boldsymbol{S} = 0 & \forall\, \boldsymbol{S}\in \mathcal{M}, \end{array} \end{equation} with ${\boldsymbol{T}}_\mathbf{f}^\bd\in\mathcal{M}^{\perp}$ the solution of \eqref{eq:Tf}. The Browder--Minty theorem, see for instance~\cite{ref:Minty}, guarantees the existence of a solution to problem \eqref{pb:S_ENL2_weak3}. Indeed, let $\mathcal{A}:M\rightarrow M'$ be defined for $\boldsymbol{R},\boldsymbol{S}\in M$ by \begin{equation} \label{def:mapA} \langle \mathcal{A}(\boldsymbol{R}), \boldsymbol{S}\rangle_M:= \alpha\int_{\Omega}\boldsymbol{R}:\boldsymbol{S} + \gamma\int_{\Omega}\mu(|\boldsymbol{R}|)\boldsymbol{R}:\boldsymbol{S}, \end{equation} where $\langle \cdot,\cdot \rangle_M$ denotes the duality pairing between $M$ and its dual space, $M'$. It then easily follows that the mapping ${\boldsymbol{T}}_0^\bd\mapsto\mathcal{A}({\boldsymbol{T}}_0^\bd+{\boldsymbol{T}}_\mathbf{f}^\bd)$ is bounded, monotone, coercive and hemi-continuous. By the Browder--Minty theorem these imply surjectivity of $\mathcal{A}$ and thereby existence of a solution, while its uniqueness follows from the strict monotonicity of $\mathcal{A}$. \section{Navier--Stokes with nonlinear constitutive relation} \label{sec:NS_ENL} Now, we focus on our problem of interest, where a convective term is added to the first equation of \eqref{pb:S_ENL2}, i.e., we consider the problem \begin{equation} \label{pb:NS_EL} \left\{\begin{array}{rcll} (\mathbf{u}\cdot\nabla)\mathbf{u}-\di({\boldsymbol{T}}) & = & \mathbf{f} & \mbox{in } \Omega, \\ \boldsymbol{D}(\mathbf{u}) & = & \alpha{\boldsymbol{T}}^\bd+\gamma\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd & \mbox{in } \Omega, \\ \di(\mathbf{u}) & = & 0 & \mbox{in } \Omega, \\ \mathbf{u} & = & \mathbf{0} & \mbox{on } \partial\Omega. \end{array}\right. \end{equation} We prove a priori estimates, construct a solution, and give sufficient conditions for global uniqueness. \subsection{Reformulation} \label{subsec:forms} By introducing the pressure $p:=-\frac{1}{d}\tr({\boldsymbol{T}})$, problem \eqref{pb:NS_EL} can be rewritten as follows: \begin{equation} \label{pb:NS_EL_v2} \left\{\begin{array}{rcll} (\mathbf{u}\cdot\nabla)\mathbf{u}-\di({\boldsymbol{T}}^{\bd})+\nabla p & = & \mathbf{f} & \mbox{in } \Omega, \\ \boldsymbol{D}(\mathbf{u}) & = & \alpha{\boldsymbol{T}}^\bd+\gamma\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd & \mbox{in } \Omega, \\ \di(\mathbf{u}) & = & 0 & \mbox{in } \Omega, \\ \mathbf{u} & = & \mathbf{0} & \mbox{on } \partial\Omega. \end{array}\right. \end{equation} In order to bring forth an elliptic term on the left-hand side of the first equation of \eqref{pb:NS_EL_v2}, we rewrite the second equation in \eqref{pb:NS_EL_v2} as \begin{equation} \label{eqn:constitutive_rel} {\boldsymbol{T}}^\bd=\frac{1}{\alpha}\boldsymbol{D}(\mathbf{u})-\frac{\gamma}{\alpha}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd, \end{equation} and thus by substituting this relation into the first equation of \eqref{pb:NS_EL_v2} we get \begin{equation} \label{pb:NS_EL_v3} \left\{\begin{array}{rcll} (\mathbf{u}\cdot\nabla)\mathbf{u}-\frac{1}{\alpha}\di(\boldsymbol{D}(\mathbf{u}))+\nabla p & = & \mathbf{f}-\frac{\gamma}{\alpha}\di(\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd) & \mbox{in } \Omega, \\[\smallskipamount] \alpha{\boldsymbol{T}}^\bd+\gamma\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd & = & \boldsymbol{D}(\mathbf{u}) & \mbox{in } \Omega, \\[\smallskipamount] \di(\mathbf{u}) & = & 0 & \mbox{in } \Omega, \\ \mathbf{u} & = & \mathbf{0} & \mbox{on } \partial\Omega. \end{array}\right. \end{equation} The weak formulation of \eqref{pb:NS_EL_v3} reads: find $({\boldsymbol{T}}^\bd,\mathbf{u},p)\in M\times V\times Q$ such that \begin{align} \label{pb:weak_epsu} \begin{aligned} \int_{\Omega}[(\mathbf{u}\cdot\nabla)\mathbf{u}]\cdot\mathbf{v} + \frac{1}{\alpha}\int_{\Omega}\boldsymbol{D}(\mathbf{u}):\boldsymbol{D}(\mathbf{v})-\int_{\Omega}p\di(\mathbf{v}) & = \int_{\Omega}\mathbf{f}\cdot\mathbf{v}+\frac{\gamma}{\alpha}\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{v}), \\ \alpha\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{S}+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{S} & = \int_{\Omega}\boldsymbol{D}(\mathbf{u}):\boldsymbol{S}, \\ \int_{\Omega}q\di(\mathbf{u}) & = 0 \end{aligned} \end{align} for all $(\boldsymbol{S},\mathbf{v},q)\in M\times V\times Q$. As previously, we eliminate the pressure by restricting the test functions to $\mathcal{V}}% {V_{\di}$, and we thus obtain the following equivalent reduced problem: find $({\boldsymbol{T}}^\bd,\mathbf{u})\in M\times \mathcal{V}}% {V_{\di}$ such that \begin{align} \int_{\Omega}[(\mathbf{u}\cdot\nabla)\mathbf{u}]\cdot\mathbf{v} + \frac{1}{\alpha}\int_{\Omega}\boldsymbol{D}(\mathbf{u}):\boldsymbol{D}(\mathbf{v}) & = \int_{\Omega}\mathbf{f}\cdot\mathbf{v}+\frac{\gamma}{\alpha}\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{v}), \label{pb:NS_EL_weakR1} \\ \alpha\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{S}+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{S} & = \int_{\Omega}\boldsymbol{D}(\mathbf{u}):\boldsymbol{S} \label{pb:NS_EL_weakR2} \end{align} for all $(\boldsymbol{S},\mathbf{v})\in M\times \mathcal{V}}% {V_{\di}$. Interestingly, \eqref{pb:NS_EL_weakR1}, \eqref{pb:NS_EL_weakR2} can be further reduced by observing that, given $\mathbf{u}$, \eqref{pb:NS_EL_weakR2} uniquely determines ${\boldsymbol{T}}^d$ thanks to the Browder--Minty theorem; see the end of Section \ref{sec:S_ENL}. Thus, we define the mapping $\mathcal{G}:\mathcal{V}}% {V_{\di}\rightarrow M$ by $\mathbf{u}\mapsto {\boldsymbol{T}}^\bd$ with ${\boldsymbol{T}}^\bd\in M$ being the unique solution of \begin{equation} \label{eqn:def_map_G} \langle \mathcal{A}( {\boldsymbol{T}}^\bd ), \boldsymbol{S}\rangle_M =\int_{\Omega}\boldsymbol{D}(\mathbf{u}):\boldsymbol{S}\quad \forall\, \boldsymbol{S}\in M, \end{equation} where we recall that $\mathcal{A}$ is defined in \eqref{def:mapA}. With this mapping, \eqref{pb:NS_EL_weakR1}, \eqref{pb:NS_EL_weakR2} is equivalent to the following problem: find $\mathbf{u} \in \mathcal{V}}% {V_{\di}$ such that \begin{equation} \label{eq:reduced3} \begin{split} \int_{\Omega}[(\mathbf{u}\cdot\nabla)\mathbf{u}]\cdot\mathbf{v} + \frac{1}{\alpha}\int_{\Omega}\boldsymbol{D}(\mathbf{u}):\boldsymbol{D}(\mathbf{v}) &= \int_{\Omega}\mathbf{f}\cdot\mathbf{v} +\frac{\gamma}{\alpha}\int_{\Omega}\mu(|\mathcal{G}(\mathbf{u})|)\mathcal{G}(\mathbf{u}):\boldsymbol{D}(\mathbf{v}). \end{split} \end{equation} Before embarking on the proof of existence of a solution to problem \eqref{pb:NS_EL_weakR1}, \eqref{pb:NS_EL_weakR2} we establish a series of \emph{a priori} estimates under the assumption that a solution exists. \subsection{\emph{A priori} estimates} \label{subsec:aprioribdd} Assuming that problem \eqref{pb:NS_EL_weakR1}, \eqref{pb:NS_EL_weakR2} has a solution, the following \emph{a priori} estimates hold for any solution $({\boldsymbol{T}}^\bd,\mathbf{u}) \in M \times \mathcal{V}$. \begin{lem}(First \emph{a priori} estimates) \label{lem:apriori} Let $|\Omega|$ denote the measure of $\Omega$. Then, \begin{equation} \label{apriori_est:u} \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)} \leq \alpha C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}+\gamma C_1 |\Omega|^{\frac{1}{2}} \end{equation} and \begin{equation} \label{apriori_est:Td} \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)} \leq C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}+\frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}} \end{equation} with $C_P$ and $C_K$ signifying the constants in Poincar\'e's and Korn's inequality, respectively, and $C_1$ the constant in \eqref{eqn:mu_pos_C1}. \end{lem} \begin{proof} Taking $\boldsymbol{S}={\boldsymbol{T}}^\bd$ in \eqref{pb:NS_EL_weakR2} yields \begin{equation*} \alpha\|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}^2+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|)|{\boldsymbol{T}}^\bd|^2 = \int_{\Omega}\boldsymbol{D}(\mathbf{u}):{\boldsymbol{T}}^\bd\leq \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}\|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}. \end{equation*} Using then the positivity of $\mu$, see \eqref{eqn:mu_pos_C1}, we get \begin{equation} \label{eqn:apriori_step1} \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)} \leq \frac{1}{\alpha}\|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}. \end{equation} To obtain a bound for $\mathbf{u}$, we recall the well-known relation \begin{equation} \label{eqn:conv_zero} \int_{\Omega}[(\mathbf{u}\cdot\nabla)\mathbf{v}]\cdot\mathbf{v}=0 \quad \forall\, \mathbf{u}\in \mathcal{V}}% {V_{\di}, \,\, \forall\, \mathbf{v}\in V, \end{equation} which is easily obtained by integration by parts, as follows: \begin{equation*} \int_{\Omega}[(\mathbf{u}\cdot\nabla)\mathbf{v}]\cdot\mathbf{v}=\frac{1}{2}\int_{\Omega}\mathbf{u}\cdot\nabla(|\mathbf{v}|^2)=-\frac{1}{2}\int_{\Omega}\di(\mathbf{u})|\mathbf{v}|^2=0. \end{equation*} Therefore, taking $\mathbf{v}=\mathbf{u}$ in \eqref{pb:NS_EL_weakR1} and using \eqref{eqn:mu_pos_C1} we obtain \begin{align*} \frac{1}{\alpha}\|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}^2 & = \int_{\Omega}\mathbf{f}\cdot\mathbf{u}+\frac{\gamma}{\alpha}\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u}) \\ & \leq \left(C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}+\frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}}\right)\|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}, \end{align*} from which we directly deduce \eqref{apriori_est:u}; \eqref{apriori_est:Td} follows by applying \eqref{apriori_est:u} to \eqref{eqn:apriori_step1}. \end{proof} \begin{lem}(Second \emph{a priori} estimates) \label{lem:apriori2} Recall that $\mu_{\max}:=\sup_{s\in [0,\infty)}\mu(s)$. We also have \begin{equation} \label{apriori_est:u2} \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)} \leq (\alpha+\gamma\mu_{\max})C_PC_K\|\mathbf{f}\|_{L^2(\Omega)} \end{equation} and \begin{equation} \label{apriori_est:Td2} \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)} \leq \frac{1}{\alpha}(\alpha+\gamma\mu_{\max})C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}. \end{equation} \end{lem} The advantage of the estimates \eqref{apriori_est:u2} and \eqref{apriori_est:Td2} is that if $\mathbf{f}=\mathbf{0}$, then we can directly deduce that $\mathbf{u}=\mathbf{0}$ and ${\boldsymbol{T}}^\bd=\mathbf{0}$ (and consequently $p=0$). \begin{proof} The ingredients of the proof are similar to those used in the proof of Lemma \ref{lem:apriori} and only the derivation of the bound for $\boldsymbol{D}(\mathbf{u})$ is different. First notice that combining \eqref{pb:NS_EL_weakR1} and \eqref{pb:NS_EL_weakR2} we have \begin{equation} \label{pb:NS_EL_weakR12} \int_{\Omega}[(\mathbf{u}\cdot\nabla)\mathbf{u}]\cdot\mathbf{v} + \int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{v}) = \int_{\Omega}\mathbf{f}\cdot\mathbf{v} \quad \forall\, \mathbf{v}\in\mathcal{V}}% {V_{\di}. \end{equation} Taking $\mathbf{v}=\mathbf{u}$ in \eqref{pb:NS_EL_weakR12} we then find that \begin{equation} \label{bound_Td_eu} \int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u})\leq C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}. \end{equation} Notice that ${\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u})\geq 0$ a.e. in $\Omega$. Indeed, from \eqref{pb:NS_EL_weakR2} we have that \begin{equation} \label{eq:symgrad=T} \left(\alpha+\gamma\mu(|{\boldsymbol{T}}^\bd|)\right) {\boldsymbol{T}}^\bd = \boldsymbol{D}(\mathbf{u}) \quad \mbox{in } M' \end{equation} and thus \begin{equation*} \underbrace{\left(\alpha+\gamma\mu(|{\boldsymbol{T}}^\bd|)\right)}_{> 0} {\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u}) = |\boldsymbol{D}(\mathbf{u})|^2\geq 0 \quad \mbox{a.e. in } \Omega. \end{equation*} Therefore, taking $\boldsymbol{S}=\boldsymbol{D}(\mathbf{u})$ in \eqref{pb:NS_EL_weakR2} and using the upper bound $\mu_{\max}$ for $\mu$ and the bound \eqref{bound_Td_eu} we have \begin{align*} \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}^2 & = \alpha\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u})+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u}) \\ & \leq (\alpha+\gamma\mu_{\max})\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u}) \\ & \leq (\alpha+\gamma\mu_{\max})C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}, \end{align*} which yields \eqref{apriori_est:u2}. Finally, the bound \eqref{apriori_est:Td2} for ${\boldsymbol{T}}^\bd$ is obtained by substituting \eqref{apriori_est:u2} in \eqref{eqn:apriori_step1}. \end{proof} \begin{remark} \label{rem:1} {\rm Similar \emph{a priori} estimates can be derived in the case when $\mathbf{f}\in V'$ (with $V' = H^{-1}(\Omega)^d$). More precisely, all occurrences of $C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}$ can be replaced by $\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'}$, where \begin{equation} \label{def:f_in_Vprime} \|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'}:=\sup_{\mathbf{v}\in\mathcal{V}}% {V_{\di}}\frac{\langle\mathbf{f},\mathbf{v}\rangle_{ V }}{\|\mathbf{v}\|_V}=\sup_{\mathbf{v}\in\mathcal{V}}% {V_{\di}}\frac{\langle\mathbf{f},\mathbf{v}\rangle_{ V }}{\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)}}, \end{equation} and $\langle\cdot,\cdot\rangle_{ V }$ denotes the duality pairing between $V'$ and $V$. The same observation holds for all that follows.} \end{remark} \begin{remark} \label{rem:otherapriori} {\rm By a direct argument we can also prove that \begin{equation} \label{apriori_est:u3bis} \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}\leq \frac{1}{\alpha}(\alpha+\gamma \mu_{\rm max})^2C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}. \end{equation} This leads to the same \emph{a priori} bound \eqref{apriori_est:Td2} for ${\boldsymbol{T}}^\bd$, $$ \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}\leq \frac{1}{\alpha}(\alpha+\gamma \mu_{\rm max})C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}. $$ Indeed, the choice $\boldsymbol{S}=\boldsymbol{D}(\mathbf{u})$ in \eqref{pb:NS_EL_weakR2} gives directly (without invoking \eqref{eq:symgrad=T}) $$ \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}^2= \alpha\int_{\Omega}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u})+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{u}) \le (\alpha+\gamma\mu_{\max}) \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)} \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}. $$ Hence $$\|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)} \le (\alpha+\gamma\mu_{\max}) \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}$$ and $$\|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}^2 \le (\alpha+\gamma\mu_{\max})^2 \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}^2.$$ Then \eqref{apriori_est:u3bis} follows by substituting the bound $$\alpha\|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}^2 \le \int_{\Omega}\boldsymbol{D}(\mathbf{u}):{\boldsymbol{T}}^\bd = \int_{\Omega} \mathbf{f}\cdot \mathbf{u} \le C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}$$ into the preceding inequality. This also yields \eqref{apriori_est:Td2}.} \end{remark} \subsection{Construction of a solution} \label{subsec:existence} In this subsection we prove the existence of a solution in a bounded Lipschitz domain without any restrictions on the data, other than those stated at the beginning of Section \ref{sec:S_ENL}. The first part of the construction is fairly standard: a suitable sequence of (finite-dimensional) Galerkin approximations to the infinite-dimensional problem is constructed, followed by Brouwer's fixed point theorem to prove that each finite-dimensional problem in the sequence has a solution; uniform \emph{a priori} estimates, similar to those derived in Lemma \ref{lem:apriori}, are established for the Galerkin solutions, which are then used for passing to the (weak) limit, via a weak compactness argument. However, because of the combined effect of the nonlinearities, identifying the limit as a solution to the infinite-dimensional problem requires a more refined argument. For the sake of clarity, the argument is split into several steps. \textbf{Step 1} (Finite-dimensional approximation). Formulation \eqref{eq:reduced3} lends itself readily to a Galerkin discretisation. Since the only unknown is $\mathbf{u}$ in $\mathcal{V}}% {V_{\di}$, a separable Hilbert space, we introduce a countably infinite basis $\left\{\mathbf{w}_1,\mathbf{w}_2,\ldots\right\}$ of orthonormal functions of $\mathcal{V}}% {V_{\di}$ with respect to the inner product \begin{equation} \label{def:inner_prod_D} (\mathbf{u},\mathbf{v}):=\int_{\Omega}\boldsymbol{D}(\mathbf{u}):\boldsymbol{D}(\mathbf{v}), \end{equation} whose span is dense in $\mathcal{V}}% {V_{\di}$. Next, we truncate this basis, i.e., for each $m\geq 1$ we define $$\mathcal{V}}% {V_{\di}_m:=\mbox{span}\{\mathbf{w}_1,\ldots,\mathbf{w}_m\},$$ and for $\mathbf{u}_m\in\mathcal{V}}% {V_{\di}_m$ we denote by $\hat{\mathbf{u}}_m\in\mathbb{R}^m$ its representation with respect to this basis. Finally, we fix $m\geq 1$ and consider the following finite-dimensional problem: find $\mathbf{u}_m\in\mathcal{V}}% {V_{\di}_m$ such that, for all $1\leq j\leq m$, \begin{equation} \label{pb:um} \int_{\Omega}[(\mathbf{u}_m\cdot\nabla)\mathbf{u}_m]\cdot\mathbf{w}_j + \frac{1}{\alpha}\int_{\Omega}\boldsymbol{D}(\mathbf{u}_m):\boldsymbol{D}(\mathbf{w}_j)=\int_{\Omega}\mathbf{f}\cdot\mathbf{w}_j+\frac{\gamma}{\alpha}\int_{\Omega}\mu(|{\boldsymbol{T}}_m^\bd|){\boldsymbol{T}}_m^\bd:\boldsymbol{D}(\mathbf{w}_j) \end{equation} with ${\boldsymbol{T}}_m^\bd:=\mathcal{G}(\mathbf{u}_m)$. In other words, ${\boldsymbol{T}}_m^\bd\in M$ solves \begin{equation} \label{pb:Tmd} \alpha\int_{\Omega}{\boldsymbol{T}}_m^\bd:\boldsymbol{S}+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}_m^\bd|){\boldsymbol{T}}_m^\bd:\boldsymbol{S}=\int_{\Omega}\boldsymbol{D}(\mathbf{u}_m):\boldsymbol{S} \quad \forall\, \boldsymbol{S}\in M. \end{equation} Problem \eqref{pb:um}, which can be seen as the \emph{projection} of \eqref{eq:reduced3} onto $\mathcal{V}}% {V_{\di}_m$, is equivalent to the following: find $\hat{\mathbf{u}}_m\in\mathbb{R}^m$ such that \begin{equation*} \mathbf{F}(\hat{\mathbf{u}}_m)= \mathbf{0}, \end{equation*} where $\mathbf{F}=(F_1,\ldots,F_m)^{t}:\mathbb{R}^m\rightarrow\mathbb{R}^m$ is the continuous function defined, for $j=1,\ldots,m$, by \begin{equation*} F_j(\hat{\mathbf{u}}_m):=\int_{\Omega}[(\mathbf{u}_m\cdot\nabla)\mathbf{u}_m]\cdot\mathbf{w}_j + \frac{1}{\alpha}\int_{\Omega}\boldsymbol{D}(\mathbf{u}_m):\boldsymbol{D}(\mathbf{w}_j)-\int_{\Omega}\mathbf{f}\cdot\mathbf{w}_j-\frac{\gamma}{\alpha}\int_{\Omega}\mu(|{\boldsymbol{T}}_m^\bd|){\boldsymbol{T}}_m^\bd:\boldsymbol{D}(\mathbf{w}_j). \end{equation*} \textbf{Step 2} (Existence of a discrete solution). Problem \eqref{pb:um} is a system of $m$ nonlinear equations in $m$ unknowns. The existence of a solution to this problem can be established by the following variant of Brouwer's fixed point theorem (see e.g.~\cite{Evans,ref:GiR}). \begin{lem} \label{lem:zero_in_ball} Let $\mathbf{F}:\mathbb{R}^m\rightarrow\mathbb{R}^m$ be a continuous function that satisfies \begin{equation*} \mathbf{F}(\mathbf{x})\cdot\mathbf{x}\geq 0 \quad \mbox{if} \quad |\mathbf{x}|=r \end{equation*} for some $r>0$. Then, there exists a point $\mathbf{x}\in B_m(\mathbf{0},r):=\{\mathbf{x}\in\mathbb{R}^m:\,\, |\mathbf{x}|\le r\}$ such that \begin{equation*} \mathbf{F}(\mathbf{x})=\mathbf{0}. \end{equation*} \end{lem} \begin{prop} \label{pro:exist_um} Problem \eqref{pb:um} has at least one solution $\mathbf{u}_m\in\mathcal{V}}% {V_{\di}_m$ that satisfies the uniform bound \begin{equation} \label{apriori_um} \|\boldsymbol{D}(\mathbf{u}_m)\|_{L^2(\Omega)} \leq \alpha C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}+\gamma C_1 |\Omega|^{\frac{1}{2}}. \end{equation} Moreover, ${\boldsymbol{T}}_m^\bd=\mathcal{G}(\mathbf{u}_m)$ satisfies the uniform bound \begin{equation} \label{apriori_Tmd} \|{\boldsymbol{T}}_m^\bd\|_{L^2(\Omega)} \leq \frac{1}{\alpha} \|\boldsymbol{D}(\mathbf{u}_m)\|_{L^2(\Omega)}\leq C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}+\frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}}. \end{equation} \end{prop} \begin{proof} We infer from Lemma \ref{lem:zero_in_ball} that $\mathbf{F}$ has a zero in the ball $B_m(\mathbf{0},r)$ with \begin{equation*} r:=\alpha C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}+\gamma C_1 |\Omega|^{\frac{1}{2}}. \end{equation*} Indeed, using the antisymmetry property \eqref{eqn:conv_zero}, which holds because $\mathbf{u}_m \in \mathcal{V}}% {V_{\di}_m \subset \mathcal{V}}% {V_{\di}$, we get \begin{align*} \mathbf{F}(\hat{\mathbf{u}}_m)\cdot\hat{\mathbf{u}}_m & = \frac{1}{\alpha}\int_{\Omega}|\boldsymbol{D}(\mathbf{u}_m)|^2-\int_{\Omega}\mathbf{f}\cdot\mathbf{u}_m-\frac{\gamma}{\alpha}\int_{\Omega}\mu(|{\boldsymbol{T}}_m^\bd|){\boldsymbol{T}}_m^\bd:\boldsymbol{D}(\mathbf{u}_m) \\ & \geq \left(\frac{1}{\alpha}\|\boldsymbol{D}(\mathbf{u}_m)\|_{L^2(\Omega)}-C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}-\frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}}\right)\|\boldsymbol{D}(\mathbf{u}_m)\|_{L^2(\Omega)}, \end{align*} where we have used Poincar\'e's and Korn's inequalities \eqref{def:poincare} and \eqref{def:korn}, respectively, to bound the second term and the relation \eqref{eqn:mu_pos_C1} for the third one. As $\|\boldsymbol{D}(\mathbf{u}_m)\|_{L^2(\Omega)}=|\hat{\mathbf{u}}_m|$, we deduce from the last inequality that if $|\hat{\mathbf{u}}_m|=r$ with $r$ as defined above, then \begin{equation*} \mathbf{F}(\hat{\mathbf{u}}_m)\cdot\hat{\mathbf{u}}_m\geq \left(\frac{1}{\alpha}|\hat{\mathbf{u}}_m|-C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}-\frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}}\right)|\hat{\mathbf{u}}_m|=0. \end{equation*} Thanks to Lemma \ref{lem:zero_in_ball}, there exists a point $\hat{\mathbf{u}}_m\in B_m(\mathbf{0},r)$ such that $\mathbf{F}(\hat{\mathbf{u}}_m)= {\bf 0}$, i.e., problem \eqref{pb:um} has a solution $\mathbf{u}_m\in\mathcal{V}}% {V_{\di}_m$ that satisfies the uniform bound \eqref{apriori_um}. Finally, it is easily shown that ${\boldsymbol{T}}_m^\bd:=\mathcal{G}(\mathbf{u}_m)$ satisfies the bound \eqref{apriori_Tmd}. \end{proof} \textbf{Step 3} (Passage to the limit $m\rightarrow\infty$ and identification of the limit). We consider the sequences $(\mathbf{u}_m)_{m\geq 1}$ and $({\boldsymbol{T}}_m^\bd)_{m\geq 1}$ with $\mathbf{u}_m\in\mathcal{V}}% {V_{\di}_m$ and ${\boldsymbol{T}}_m^\bd=\mathcal{G}(\mathbf{u}_m)\in M$. Thanks to the uniform estimates \eqref{apriori_um} and \eqref{apriori_Tmd} there exist two subsequences (not relabelled) such that \begin{alignat*}{2} \lim_{m \to \infty} \mathbf{u}_m & =\bar{\mathbf{u}} & & \quad\mbox{weakly in } H_0^1(\Omega)^d \,\, (\mbox{and thus also in }\mathcal{V}}% {V_{\di}), \\ \lim_{m \to \infty} \mathbf{u}_m & =\bar{\mathbf{u}} & & \quad\mbox{strongly in } L^q(\Omega)^d\,\, \mbox{with }1\leq q < \infty\; \mbox{ if }\, d=2, \mbox{ and }1 \leq q < 6\; \mbox{ if }\, d=3, \\ \lim_{m \to \infty} {\boldsymbol{T}}_m^\bd & =\bar{{\boldsymbol{T}}}^\bd & & \quad \mbox{weakly in } L^2(\Omega)^{d\times d} \,\, (\mbox{and thus also in }M), \end{alignat*} for some $\bar{\mathbf{u}}\in\mathcal{V}}% {V_{\di}$ and $\bar{{\boldsymbol{T}}}^\bd\in M$. Our objective is to show that the pair $(\bar{{\boldsymbol{T}}}^\bd,\bar{\mathbf{u}}) \in M\times \mathcal{V}}% {V_{\di}$ is a solution to the problem under consideration by passing to the limit in \eqref{pb:um}, \eqref{pb:Tmd}. Passing to the limit in \eqref{pb:um}, \eqref{pb:Tmd} is however not straightforward because of the lack of strong convergence of ${\boldsymbol{T}}_m^\bd$ in $M$. Identifying the pair $(\bar{{\boldsymbol{T}}}^\bd,\bar{\mathbf{u}}) \in M\times \mathcal{V}}% {V_{\di}$ as a solution will be achieved by means of the following two lemmas, the first of which (Lemma \ref{lem:conv_product}) relies on the equations and the strong convergence of the sequence $(\mathbf{u}_m)_{m\geq 1}$ in $L^q(\Omega)^d$ shown above, and the second lemma (Lemma \ref{lem:T_to_G(u)}) follows from the monotonicity property \eqref{eqn:mu_mon}. The proof, included below, that the pair $(\bar{{\boldsymbol{T}}}^\bd,\bar{\mathbf{u}})$ satisfies \eqref{pb:NS_EL_weakR2} is inspired by the arguments in \cite{BGMRS12}, where a more general constitutive relation than \eqref{eqn:constitutive_rel} was considered. Specifically, the conclusion of Lemma \ref{lem:T_to_G(u)} follows from \cite[Lemma 2.4.1]{BGMRS12}, the hypothesis (2.12) of \cite[Lemma 2.4.1]{BGMRS12} being fulfilled thanks to Lemma \ref{lem:conv_product}; however we provide a proof here that is directly tailored to our problem. \begin{lem} \label{lem:conv_product} The following limit holds: \begin{equation} \label{eqn:lim_sup} \lim_{m\rightarrow\infty}\int_{\Omega}{\boldsymbol{T}}_m^\bd:\boldsymbol{D}(\mathbf{u}_m)= \int_{\Omega}\bar{{\boldsymbol{T}}}^\bd:\boldsymbol{D}(\bar{\mathbf{u}}). \end{equation} \end{lem} \begin{proof} By testing equation \eqref{pb:Tmd} with $\boldsymbol{S}=\boldsymbol{D}(\mathbf{w}_j)$ and substituting into \eqref{pb:um} we deduce that \begin{equation} \label{eqn:um_wj} \int_{\Omega}[(\mathbf{u}_m\cdot\nabla)\mathbf{u}_m]\cdot\mathbf{w}_j + \int_{\Omega}{\boldsymbol{T}}_m^\bd:\boldsymbol{D}(\mathbf{w}_j) =\int_{\Omega}\mathbf{f}\cdot\mathbf{w}_j \quad \forall\, 1\leq j\leq m. \end{equation} Multiplying \eqref{eqn:um_wj} by $(\hat{\mathbf{u}}_m)_j$, summing over $j$, and applying \eqref{eqn:conv_zero}, we derive \begin{equation} \label{eqn:Tmd_um} \int_{\Omega}{\boldsymbol{T}}_m^\bd:\boldsymbol{D}(\mathbf{u}_m) =\int_{\Omega}\mathbf{f}\cdot\mathbf{u}_m. \end{equation} Thus we obtain on the one hand \begin{equation} \label{eq:lim_product1} \lim_{m\rightarrow\infty}\int_{\Omega}{\boldsymbol{T}}_m^\bd:\boldsymbol{D}(\mathbf{u}_m) = \lim_{m\rightarrow\infty}\int_{\Omega}\mathbf{f}\cdot\mathbf{u}_m = \int_{\Omega}\mathbf{f}\cdot\bar{\mathbf{u}}. \end{equation} On the other hand, letting $m$ tend to infinity in \eqref{eqn:um_wj} for fixed $j$ and considering the strong convergence of $\mathbf{u}_m$, we infer that \begin{equation*} \int_{\Omega}[(\bar{\mathbf{u}}\cdot\nabla)\bar{\mathbf{u}}]\cdot\mathbf{w}_j + \int_{\Omega}\bar{{\boldsymbol{T}}}^\bd:\boldsymbol{D}(\mathbf{w}_j) =\int_{\Omega}\mathbf{f}\cdot\mathbf{w}_j \quad \forall\, j\geq 1, \end{equation*} and the density of $\bigcup_{m \geq 1}\mathcal{V}}% {V_{\di}_m$ in $\mathcal{V}}% {V_{\di}$ therefore implies that \begin{equation} \label{eqn:Td_u} \int_{\Omega}[(\bar{\mathbf{u}}\cdot\nabla)\bar{\mathbf{u}}]\cdot\mathbf{v} + \int_{\Omega}\bar{{\boldsymbol{T}}}^\bd:\boldsymbol{D}(\mathbf{v}) =\int_{\Omega}\mathbf{f}\cdot\mathbf{v} \quad \forall\, \mathbf{v}\in\mathcal{V}}% {V_{\di}. \end{equation} In view of \eqref{eqn:conv_zero}, the choice $\mathbf{v} = \bar{\mathbf{u}}$ in \eqref{eqn:Td_u} yields \begin{equation} \label{eq:product2} \int_{\Omega}\bar{{\boldsymbol{T}}}^\bd:\boldsymbol{D}(\bar{\mathbf{u}}) =\int_{\Omega}\mathbf{f}\cdot\bar{\mathbf{u}}, \end{equation} and \eqref{eqn:lim_sup} then follows from \eqref{eq:lim_product1} and \eqref{eq:product2}. \end{proof} \begin{lem} \label{lem:T_to_G(u)} We have that \begin{equation} \label{eqn:barT_G(baru)} \bar{\boldsymbol{T}}^\bd= \mathcal{G}(\bar{\mathbf{u}}). \end{equation} \end{lem} \begin{proof} Let $\tilde{{\boldsymbol{T}}}^\bd:=\mathcal{G}(\bar{\mathbf{u}})$; since ${\boldsymbol{T}}_m^\bd:=\mathcal{G}(\mathbf{u}_m)$, we have by definition \begin{equation*} \alpha\int_{\Omega}({\boldsymbol{T}}_m^\bd-\tilde{{\boldsymbol{T}}}^\bd):\boldsymbol{S}+\gamma\int_{\Omega}(\mu(|{\boldsymbol{T}}_m^\bd|){\boldsymbol{T}}_m^\bd-\mu(|{\tilde {\boldsymbol{T}}}^{\bd}|)\tilde{{\boldsymbol{T}}}^\bd):\boldsymbol{S}=\int_{\Omega}(\boldsymbol{D}(\mathbf{u}_m-\bar{\mathbf{u}})):\boldsymbol{S} \end{equation*} for all $\boldsymbol{S}\in M$. Taking then $\boldsymbol{S}={\boldsymbol{T}}_m^\bd-\tilde{{\boldsymbol{T}}}^\bd$ and using the monotonicity property \eqref{eqn:mu_mon} we get \begin{align*} \alpha\int_{\Omega}|{\boldsymbol{T}}_m^\bd-\tilde{{\boldsymbol{T}}}^\bd|^2 & \leq \int_{\Omega}(\boldsymbol{D}(\mathbf{u}_m-\bar{\mathbf{u}})):({\boldsymbol{T}}_m^\bd-\tilde{{\boldsymbol{T}}}^\bd) \\ & = \int_{\Omega}\left[\boldsymbol{D}(\mathbf{u}_m):{\boldsymbol{T}}_m^\bd-\boldsymbol{D}(\mathbf{u}_m):\tilde{{\boldsymbol{T}}}^\bd-\boldsymbol{D}(\bar{\mathbf{u}}):({\boldsymbol{T}}_m^\bd-\tilde{{\boldsymbol{T}}}^\bd)\right]. \end{align*} Finally, we take the limit $m\rightarrow\infty$ of both sides and apply \eqref{eqn:lim_sup} to obtain \begin{equation*} \alpha\lim_{m\rightarrow\infty}\int_{\Omega}|{\boldsymbol{T}}_m^\bd-\tilde{{\boldsymbol{T}}}^\bd|^2 \leq \int_{\Omega}\left[\boldsymbol{D}(\bar{\mathbf{u}}):\bar{{\boldsymbol{T}}}^\bd-\boldsymbol{D}(\bar{\mathbf{u}}):\tilde{{\boldsymbol{T}}}^\bd-\boldsymbol{D}(\bar{\mathbf{u}}):(\bar{{\boldsymbol{T}}}^\bd-\tilde{{\boldsymbol{T}}}^\bd)\right]=0, \end{equation*} which implies \eqref{eqn:barT_G(baru)} as well as the \emph{strong} convergence in $M$ of ${\boldsymbol{T}}_m^\bd$ to $\bar{{\boldsymbol{T}}}^\bd$. \end{proof} \begin{thm}(Existence of a solution) \label{thm:existence1} The pair $(\bar{\boldsymbol{T}}^\bd,\bar\mathbf{u})\in M\times\mathcal{V}}% {V_{\di}$ solves \eqref{pb:NS_EL_weakR1}, \eqref{pb:NS_EL_weakR2}. \end{thm} \begin{proof} It follows from Lemma \ref{lem:T_to_G(u)} that on the one hand $(\bar{\boldsymbol{T}}^\bd,\bar\mathbf{u})$ solves \eqref{pb:NS_EL_weakR2} and on the other hand, $$ \lim_{m \to \infty}\mu(|{\boldsymbol{T}}_m^\bd|){\boldsymbol{T}}_m^\bd = \mu(|\bar{{\boldsymbol{T}}}^\bd|)\bar{{\boldsymbol{T}}}^\bd\ \mbox{weakly in } M. $$ Indeed, passing to the limit in \eqref{pb:Tmd} gives, for any $\boldsymbol{S}\in M$, \begin{align*} \lim_{m\rightarrow\infty}\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}_m^\bd|){\boldsymbol{T}}_m^\bd:\boldsymbol{S} & = \lim_{m\rightarrow\infty}\left( \int_{\Omega}\boldsymbol{D}(\mathbf{u}_m):\boldsymbol{S}-\alpha\int_{\Omega}{\boldsymbol{T}}_m^\bd:\boldsymbol{S} \right) \\ & = \int_{\Omega}\boldsymbol{D}(\bar{\mathbf{u}}):\boldsymbol{S}-\alpha\int_{\Omega}\bar{{\boldsymbol{T}}}^\bd:\boldsymbol{S} \\ & = \gamma\int_{\Omega}\mu(|\bar{{\boldsymbol{T}}}^\bd|)\bar{{\boldsymbol{T}}}^\bd:\boldsymbol{S}. \end{align*} Therefore, taking the limit as $m\rightarrow\infty$ in \eqref{pb:um} we get \begin{equation*} \int_{\Omega}[(\bar{\mathbf{u}}\cdot\nabla)\bar{\mathbf{u}}]\cdot\mathbf{w}_j + \frac{1}{\alpha}\int_{\Omega}\boldsymbol{D}(\bar{\mathbf{u}}):\boldsymbol{D}(\mathbf{w}_j)=\int_{\Omega}\mathbf{f}\cdot\mathbf{w}_j+\frac{\gamma}{\alpha}\int_{\Omega}\mu(|\bar{{\boldsymbol{T}}}^\bd|)\bar{{\boldsymbol{T}}}^\bd:\boldsymbol{D}(\mathbf{w}_j) \end{equation*} for each $j=1,2,\ldots$, and thus the density of $\bigcup_{m \geq 1}\mathcal{V}}% {V_{\di}_m$ in $\mathcal{V}}% {V_{\di}$ implies that \begin{equation*} \int_{\Omega}[(\bar{\mathbf{u}}\cdot\nabla)\bar{\mathbf{u}}]\cdot\mathbf{v} + \frac{1}{\alpha}\int_{\Omega}\boldsymbol{D}(\bar{\mathbf{u}}):\boldsymbol{D}(\mathbf{v})=\int_{\Omega}\mathbf{f}\cdot\mathbf{v}+\frac{\gamma}{\alpha}\int_{\Omega}\mu(|\bar{{\boldsymbol{T}}}^\bd|)\bar{{\boldsymbol{T}}}^\bd:\boldsymbol{D}(\mathbf{v}) \quad \forall\, \mathbf{v}\in \mathcal{V}}% {V_{\di}, \end{equation*} which is precisely \eqref{pb:NS_EL_weakR1}. \end{proof} \subsection{Global conditional uniqueness} \label{subsec:globaluniqu} We now prove global uniqueness of the solution under additional assumptions on the function $\mu$ and the input data. The notion of uniqueness we establish is global and conditional in the sense that it holds under suitable restrictions on the data, but it is also global because no other solution exists. Let $\mathbb{R}_{\rm{sym},0}^{d\times d}$ denote the space of symmetric $d \times d$ matrices with vanishing trace and let $C_S$ be the smallest positive constant in the following Sobolev embedding: \begin{equation} \label{def:SobolevL4} \|\mathbf{v}\|_{L^4(\Omega)}\leq C_S \|\nabla \mathbf{v}\|_{L^2(\Omega)} \quad \forall\, \mathbf{v}\in V. \end{equation} \begin{prop}(Uniqueness) \label{lem:uniqueness} Assume that the function ${\boldsymbol{T}}^\bd\mapsto\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd$ is Lipschitz continuous in $\mathbb{R}_{\rm{sym},0}^{d\times d}$, i.e., there exists a positive constant $\Lambda$ such that \begin{equation} \label{eqn:mu_Lip} |\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd-\mu(\boldsymbol{S}^\bd)\boldsymbol{S}^\bd|\leq \Lambda |{\boldsymbol{T}}^\bd-\boldsymbol{S}^\bd| \quad \forall\, {\boldsymbol{T}}^\bd,\boldsymbol{S}^\bd\in\mathbb{R}_{\rm{sym},0}^{d\times d}. \end{equation} If the input data satisfy \begin{equation} \label{hyp:input_data} \frac{\gamma}{\alpha}\Lambda+\alpha^2C_S^2C_PC_K^4\|\mathbf{f}\|_{L^2(\Omega)}+\alpha\gamma C_S^2C_K^3 C_1 |\Omega|^{\frac{1}{2}}<1 \end{equation} then the solution of problem \eqref{pb:NS_EL_weakR1}, \eqref{pb:NS_EL_weakR2} is unique. \end{prop} \begin{proof} We use a variational argument. Suppose that $({\boldsymbol{T}}_1^\bd,\mathbf{u}_1),({\boldsymbol{T}}^\bd_2,\mathbf{u}_2)\in M\times \mathcal{V}}% {V_{\di}$ are solutions of \eqref{pb:NS_EL_weakR1}, \eqref{pb:NS_EL_weakR2}. Let us write $\delta{\boldsymbol{T}}^\bd:={\boldsymbol{T}}_1^\bd-{\boldsymbol{T}}_2^\bd$ and $\delta\mathbf{u}:=\mathbf{u}_1-\mathbf{u}_2$. Subtracting the equations solved by $({\boldsymbol{T}}^\bd_2,\mathbf{u}_2)$ from those solved by $({\boldsymbol{T}}^\bd_1,\mathbf{u}_1)$ we get for all $(\boldsymbol{S},\mathbf{v})\in M\times\mathcal{V}}% {V_{\di}$ the following pair of equalities: \begin{align} \int_{\Omega}\left[(\mathbf{u}_1\cdot\nabla)\mathbf{u}_1-(\mathbf{u}_2\cdot\nabla)\mathbf{u}_2\right]\cdot\mathbf{v}+\frac{1}{\alpha}\int_{\Omega}\boldsymbol{D}(\delta\mathbf{u}):\boldsymbol{D}(\mathbf{v}) & = \frac{\gamma}{\alpha}\int_{\Omega}\big(\mu(|{\boldsymbol{T}}_1^\bd|){\boldsymbol{T}}_1^\bd-\mu(|{\boldsymbol{T}}_2^\bd|){\boldsymbol{T}}_2^\bd\big):\boldsymbol{D}(\mathbf{v}),\label{eqn:deltau} \\ \alpha\int_{\Omega}\delta{\boldsymbol{T}}^\bd:\boldsymbol{S}+\gamma\int_{\Omega}\big(\mu(|{\boldsymbol{T}}_1^\bd|){\boldsymbol{T}}_1^\bd-\mu(|{\boldsymbol{T}}_2^\bd|){\boldsymbol{T}}_2^\bd\big):\boldsymbol{S} & = \int_{\Omega}\boldsymbol{D}(\delta\mathbf{u}):\boldsymbol{S}. \label{eqn:deltaT} \end{align} The choice $\boldsymbol{S}=\delta{\boldsymbol{T}}^\bd$ in \eqref{eqn:deltaT}, thanks to the monotonicity property \eqref{eqn:mu_mon}, leads to \begin{equation} \label{eqn:bound_deltaT} \|\delta{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}\leq \frac{1}{\alpha}\|\boldsymbol{D}(\delta\mathbf{u})\|_{L^2(\Omega)}. \end{equation} Then, by noting that \begin{equation*} \int_{\Omega}\left[(\mathbf{u}_1\cdot\nabla)\mathbf{u}_1-(\mathbf{u}_2\cdot\nabla)\mathbf{u}_2\right]\cdot\mathbf{v} = \int_{\Omega}\left[(\delta\mathbf{u}\cdot\nabla)\mathbf{u}_1\right]\cdot\mathbf{v}+\int_{\Omega}\left[(\mathbf{u}_2\cdot\nabla)\delta\mathbf{u}\right]\cdot\mathbf{v}, \end{equation*} by testing \eqref{eqn:deltau} with $\mathbf{v}=\delta\mathbf{u}$, and recalling \eqref{eqn:conv_zero} we obtain \begin{eqnarray*} \frac{1}{\alpha}\|\boldsymbol{D}(\delta\mathbf{u})\|_{L^2(\Omega)}^2 & = & \frac{\gamma}{\alpha}\int_{\Omega}\big(\mu(|{\boldsymbol{T}}_1^\bd|){\boldsymbol{T}}_1^\bd-\mu(|{\boldsymbol{T}}_2^\bd|){\boldsymbol{T}}_2^\bd\big):\boldsymbol{D}(\delta\mathbf{u})-\int_{\Omega}[(\delta\mathbf{u}\cdot\nabla)\mathbf{u}_1]\cdot\delta\mathbf{u} \\ & \stackrel{\eqref{eqn:mu_Lip}}{\leq} & \frac{\gamma}{\alpha}\Lambda\|\delta{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}\|\boldsymbol{D}(\delta\mathbf{u})\|_{L^2(\Omega)}+\|\delta\mathbf{u}\|_{L^4(\Omega)}^2\|\nabla\mathbf{u}_1\|_{L^2(\Omega)} \\ & \stackrel{\eqref{def:SobolevL4},\!~\eqref{def:korn}}{\leq} & \frac{\gamma}{\alpha}\Lambda\|\delta{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}\|\boldsymbol{D}(\delta\mathbf{u})\|_{L^2(\Omega)}+C_S^2C_K^3\|\boldsymbol{D}(\mathbf{u}_1)\|_{L^2(\Omega)}\|\boldsymbol{D}(\delta\mathbf{u})\|_{L^2(\Omega)}^2 \\ & \stackrel{\eqref{eqn:bound_deltaT},\!~\eqref{apriori_est:u}}{\leq} & \left[\frac{\gamma}{\alpha^2}\Lambda+C_S^2C_K^3\left(\alpha C_PC_K\|\mathbf{f}\|_{L^2(\Omega)}+\gamma C_1 |\Omega|^{\frac{1}{2}}\right)\right]\|\boldsymbol{D}(\delta\mathbf{u})\|_{L^2(\Omega)}^2. \\ \end{eqnarray*} The assumption \eqref{hyp:input_data} on the data guarantees that the factor on the right-hand side of the last inequality is strictly smaller than $\frac{1}{\alpha}$, thus implying that $\|\boldsymbol{D}(\delta\mathbf{u})\|_{L^2(\Omega)}=0$, i.e., $\mathbf{u}_1=\mathbf{u}_2$. Finally, applying this result to \eqref{eqn:bound_deltaT} yields ${\boldsymbol{T}}_1^\bd={\boldsymbol{T}}_2^\bd$. \end{proof} \begin{remark} \label{rem:rem3} {\rm The strategy used in deriving the second \emph{a priori} estimate stated in Lemma \ref{lem:apriori2} leads to uniqueness when \eqref{hyp:input_data} is replaced by \begin{equation} \label{hyp:input_data2} \frac{\gamma}{\alpha}\Lambda+\alpha C_S^2C_PC_K^4(\alpha+\gamma\mu_{\max})\|\mathbf{f}\|_{L^2(\Omega)}<1. \end{equation} In fact both strategies lead to the same condition \eqref{hyp:input_data2}; namely, we also get \eqref{hyp:input_data2} by using \eqref{apriori_est:u2} instead of \eqref{apriori_est:u} to bound $\|\boldsymbol{D}(\mathbf{u}_1)\|_{L^2(\Omega)}$ in the proof of Proposition \ref{lem:uniqueness}.} \end{remark} Note that both \eqref{hyp:input_data} and \eqref{hyp:input_data2} hold when $\gamma$ and $\mathbf{f}$ are sufficiently small. \begin{remark} \label{rem:rem3bis} {\rm Under the Lipschitz condition \eqref{eqn:mu_Lip}, the proof of \eqref{apriori_est:u3bis} and \eqref{apriori_est:Td2} is valid with $\mu_{{\rm \max}}$ replaced by $\Lambda$, and the $L^2(\Omega)^d$ norm of $\mathbf{f}$ (multiplied by $C_P C_K$) replaced by its norm in $\mathcal{V}}% {V_{\di}'$, see Remark \ref{rem:1}. More precisely, \begin{equation} \label{apriori_est:u3} \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}\leq \frac{1}{\alpha}(\alpha+\gamma\Lambda)^2\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'}, \end{equation} \begin{equation} \label{apriori_est:Td3} \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)}\leq \frac{1}{\alpha}(\alpha+\gamma\Lambda)\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'}. \end{equation}} \end{remark} \subsection{Comparison of the \emph{a priori} estimates} \label{subsec:comp-apriori} At this stage, it is useful to compare the \emph{a priori} estimates derived in the previous sections. We have \begin{equation} \label{eq:C_u} \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)} \leq C_{\mathbf{u}}:=\min\left\{(\alpha+\gamma\mu_{\max})\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'},\alpha\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'}+\gamma C_1 |\Omega|^{\frac{1}{2}},\frac{1}{\alpha}(\alpha+\gamma\Lambda)^2\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'}\right\}, \end{equation} \begin{equation} \label{eq:C_T} \|{\boldsymbol{T}}^\bd\|_{L^2(\Omega)} \leq C_{{\boldsymbol{T}}^\bd}:=\min\left\{\frac{1}{\alpha}(\alpha+\gamma\mu_{ \max})\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'},\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'}+\frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}},\frac{1}{\alpha}(\alpha+\gamma\Lambda)\|\mathbf{f}\|_{\mathcal{V}}% {V_{\di}'}\right\}, \end{equation} where $\Lambda$ is replaced by $\mu_{ \max}$ if we do not make the Lipschitz assumption \eqref{eqn:mu_Lip}. For $p$ we have \begin{equation*} \|p\|_{L^2(\Omega)} \leq \frac{1}{\beta}\left(C_S^2C_K^2C_{\mathbf{u}}^2+\|\mathbf{f}\|_{(\mathcal{V}}% {V_{\di}^{\perp})'}+\min\left\{\min\left(1,\frac{\gamma\mu_{\max}}{\alpha},\frac{\gamma\Lambda}{\alpha}\right)C_{{\boldsymbol{T}}^\bd},\frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}}\right\}\right), \end{equation*} where $\mathcal{V}}% {V_{\di}^{\perp}$ denotes the orthogonal complement of $\mathcal{V}}% {V_{\di}$ in $V$ with respect to the inner product \eqref{def:inner_prod_D}. \begin{remark} \label{rem:5} {\rm We can replace $C_S^2$ by the product $C_pC_r$ of the smallest constants $C_p$ and $C_r$ from the Sobolev embedding of $H^1(\Omega)^d$ into $L^p(\Omega)^d$ and $L^r(\Omega)^d$, respectively, with $p=6$ and $r=3$. We could also use the best constant $\hat{C}$ such that $$\int_{\Omega}[(\mathbf{u}\cdot\nabla)\mathbf{v}]\cdot\mathbf{w}\leq \hat{C} \|\nabla\mathbf{u}\|_{L^2(\Omega)}\|\nabla\mathbf{v}\|_{L^2(\Omega)}\|\nabla\mathbf{w}\|_{L^2(\Omega)},$$ or even $$\int_{\Omega}[(\mathbf{u}\cdot\nabla)\mathbf{v}]\cdot\mathbf{w}\leq \hat{C} \|\boldsymbol{D}(\mathbf{u})\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{v})\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{w})\|_{L^2(\Omega)}.$$ In the former case, $\hat{C}\leq C_pC_r$ while in the latter case, $\hat{C}\leq C_K^3C_pC_r$.} \end{remark} \section{ Conforming finite element approximation} \label{sec:NS_ENL_App} In this section, we study conforming finite element approximations of problem \eqref{pb:NS_EL_v2}, where conformity refers to the discrete velocity space. To facilitate the implementation, it is useful to relax the zero trace restriction on the discrete tensor space, but this is not quite a nonconformity because the theoretical analysis of the preceding sections holds without this condition. In particular, the inf-sup condition \eqref{infsup:b1} is still valid (supremum over a larger space). We start with the numerical analysis of general conforming approximations, including existence of discrete solutions, convergence, and error estimates, and give specific examples further on. \subsection{General conforming approximation} \label{subsec:Gen_conf_app} As stated above, here $M=L^2(\Omega)_{{\rm sym}}^{d\times d}$. Up to this modification, we propose to discretise the formulation derived from \eqref{pb:NS_EL_v2}: find $({\boldsymbol{T}}^\bd,\mathbf{u},p)\in M\times V \times Q$ such that \begin{alignat}{2} \label{pb:weak_cont} \begin{aligned} \displaystyle{\int_{\Omega}}\left[(\mathbf{u}\cdot\nabla)\mathbf{u}\right]\cdot\mathbf{v}+\displaystyle{\int_{\Omega}}{\boldsymbol{T}}^\bd:\boldsymbol{D}(\mathbf{v})+b_2(\mathbf{v},p) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v} &&\quad \forall\, \mathbf{v}\in V, \\ \alpha\displaystyle{\int_{\Omega}}{\boldsymbol{T}}^\bd:\boldsymbol{S}+\gamma\displaystyle{\int_{\Omega}}\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd:\boldsymbol{S} & = \displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}):\boldsymbol{S} &&\quad \forall\, \boldsymbol{S}\in M, \\ b_2(\mathbf{u},q) & = 0 &&\quad \forall\, q\in Q. \end{aligned} \end{alignat} Note that, since ${\rm div}(\mathbf{u}) =0$, by taking $\boldsymbol{S} = \boldsymbol{I}$ the second line of \eqref{pb:weak_cont} implies that the solution ${\boldsymbol{T}}^\bd$ of \eqref{pb:weak_cont} satisfies $\tr({\boldsymbol{T}}^\bd)=0$ a.e. in $\Omega$, even though this condition was not explicitly imposed on elements of $M$. Let $h >0$ be a discretisation parameter that will tend to zero and, for each $h$, let $V_h\subset V$, $Q_h\subset Q$ and $M_h\subset M$ be three finite-dimensional spaces satisfying the following basic approximation properties, for all $\boldsymbol{S} \in M$, $\mathbf{v} \in V$ and $q \in Q$: $$\lim_{h \to 0} \inf_{\boldsymbol{S}_h \in M_h}\|\boldsymbol{S}_h-\boldsymbol{S}\|_{L^2(\Omega)} = 0,\quad \lim_{h \to 0} \inf_{\mathbf{v}_h \in V_h}\|\boldsymbol{D}(\mathbf{v}_h-\mathbf{v})\|_{L^2(\Omega)} =0, \quad \lim_{h \to 0} \inf_{q_h \in Q_h}\|q_h-q\|_{L^2(\Omega)} =0. $$ Moreover, let \begin{equation} \label{def:Vh0} V_{h,0}:=\{\mathbf{v}_h\in V_h: \quad b_2(\mathbf{v}_h,q_h)=0 \quad \forall\, q_h\in Q_h\}. \end{equation} We assume on the one hand that the pair $(V_h,Q_h)$ is uniformly stable for the divergence, i.e., \begin{equation} \label{infsup:b1h} \inf_{q_h\in Q_h}\sup_{\mathbf{v}_h\in V_h}\frac{b_2(\mathbf{v}_h,q_h)}{\|\boldsymbol{D}(\mathbf{v}_h)\|_{L^2(\Omega)}\|q_h\|_{L^2(\Omega)}}\geq \beta^{*} \end{equation} for some constant $\beta^{*} >0$, independent of $h$, and on the other hand that $M_h$ and $V_{h,0}$ are compatible in the sense that \begin{equation} \label{eqn:eps_in_Mh} \boldsymbol{D}(\mathbf{v}_h)\in M_h \quad \forall\, \mathbf{v}_h\in V_{h,0}. \end{equation} Note that the latter assumption may be prohibitive when considering conforming finite elements on quadrilateral ($d=2$) or hexahedral ($d=3$) meshes, see Subsection \ref{subsec:Ex_conf_app}; this motivates the study of non-conforming finite elements considered in Section \ref{sec:NS_ENL_AppNC}. The inf-sup condition \eqref{infsup:b1h} guarantees that \begin{equation} \label{eq:appVh0} \lim_{h \to 0} \inf_{\mathbf{v}_h \in V_{h,0}}\|\boldsymbol{D}(\mathbf{v}_h-\mathbf{u})\|_{L^2(\Omega)} =0. \end{equation} Indeed, \eqref{infsup:b1h} implies the relation \begin{equation} \label{eq:bdd_vh0} \inf_{\mathbf{v}_{h,0}\in V_{h,0}}\| \boldsymbol{D}(\mathbf{u}-\mathbf{v}_{h,0})\|_{ L^2(\Omega)} \leq \left(1+\frac{c_b}{\beta^*}\right)\inf_{\mathbf{v}_h\in V_h}\| \boldsymbol{D}(\mathbf{u}-\mathbf{v}_h)\|_{ L^2(\Omega)}, \end{equation} which can be shown using a standard argument; see for instance~\cite{ref:GiR}. Here, $c_b$ denotes the continuity constant of $b_2(\cdot,\cdot)$ on $V\times Q$. As the divergence of functions of $V_{h,0}$ is not necessarily zero, the antisymmetry property \eqref{eqn:conv_zero} does not hold in the discrete spaces. Since this property is a crucial ingredient in the analysis of our problem, it is standard (see for instance~\cite{Tem,ref:GiR}) to introduce the trilinear form $d:V\times V\times V\rightarrow\mathbb{R}$ defined by \begin{equation} \label{def:form_d} d(\mathbf{u};\mathbf{v},\mathbf{w}):= \frac{1}{2}\int_{\Omega}\left[(\mathbf{u}\cdot\nabla)\mathbf{v}\right]\cdot\mathbf{w}-\frac{1}{2}\int_{\Omega}\left[(\mathbf{u}\cdot\nabla)\mathbf{w}\right]\cdot\mathbf{v}. \end{equation} The trilinear form $d$ is obviously antisymmetric and it is consistent thanks to the fact that \begin{equation*} d(\mathbf{u};\mathbf{v},\mathbf{w})=\int_{\Omega}\left[(\mathbf{u}\cdot\nabla)\mathbf{v}\right]\cdot\mathbf{w} \quad \forall\, \mathbf{u}\in \mathcal{V}}% {V_{\di},\; \forall\, \mathbf{v},\mathbf{w}\in V. \end{equation*} Moreover, a standard computation shows that there exists a constant $\hat{D}\leq \min(C_S^2,C_3C_6)C_K^3$ such that \begin{equation} \label{bound:form_d} d(\mathbf{u};\mathbf{v},\mathbf{w})\leq \hat{D}\| \boldsymbol{D}(\mathbf{u})\|_{ L^2(\Omega)}\| \boldsymbol{D}(\mathbf{v})\|_{ L^2(\Omega)}\| \boldsymbol{D}(\mathbf{w})\|_{ L^2(\Omega)} \quad \forall\, \mathbf{u},\mathbf{v},\mathbf{w}\in V. \end{equation} We then consider the following approximation of problem \eqref{pb:weak_cont}: find $({\boldsymbol{T}}_h,\mathbf{u}_h,p_h)\in M_h\times V_h\times Q_h$ such that \begin{alignat}{2} \label{pb:weak_disc} \begin{aligned} d(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h)+\displaystyle{\int_{\Omega}}{\boldsymbol{T}}_h:\boldsymbol{D}(\mathbf{v}_h)+b_2(\mathbf{v}_h,p_h) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v}_h &&\quad \forall\, \mathbf{v}_h\in V_h, \\ \alpha\displaystyle{\int_{\Omega}}{\boldsymbol{T}}_h:\boldsymbol{S}_h+\gamma\displaystyle{\int_{\Omega}}\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h:\boldsymbol{S}_h & = \displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}_h):\boldsymbol{S}_h &&\quad \forall\, \boldsymbol{S}_h\in M_h, \\ b_2(\mathbf{u}_h,q_h) & = 0 &&\quad \forall\, q_h\in Q_h. \end{aligned} \end{alignat} \subsubsection{Existence of a discrete solution} Existence of a solution to problem \eqref{pb:weak_disc} without restrictions on the data is established by Brouwer's fixed point theorem, as in Section \ref{subsec:existence}. To begin with, for any function $\mathbf{v} \in V$, we define the discrete analogue of the mapping $\mathcal{G}$, see \eqref{eqn:def_map_G}; namely, $\mathcal{G}_h(\mathbf{v}) \in M_h$ is the unique solution of \begin{equation} \label{eqn:def_map_Gh} \alpha\int_{\Omega}\mathcal{G}_h(\mathbf{v}):\boldsymbol{S}_h+\gamma\int_{\Omega}\mu(|\mathcal{G}_h(\mathbf{v})|)\mathcal{G}_h(\mathbf{v}):\boldsymbol{S}_h =\int_{\Omega}\boldsymbol{D}(\mathbf{v}):\boldsymbol{S}_h\quad \forall\, \boldsymbol{S}_h\in M_h. \end{equation} This finite-dimensional square system has one and only one solution $\mathcal{G}_h(\mathbf{v})$ thanks to the properties of the left-hand side: the first term is elliptic and the second term is monotone. As in Section \ref{subsec:existence}, in view of the inf-sup condition \eqref{infsup:b1h}, problem \eqref{pb:weak_disc} is equivalent to finding $\mathbf{u}_h \in V_{h,0}$ solution of \begin{equation} \label{eq:reduce-discrete} d(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h) + \int_{\Omega}{\boldsymbol{T}}_h: \boldsymbol{D}({\mathbf{v}_h}) = \int_{\Omega}\mathbf{f}\cdot\mathbf{v}_h\quad \forall\, \mathbf{v}_h\in V_{h,0}, \end{equation} where ${\boldsymbol{T}}_h:=\mathcal{G}_h(\mathbf{u}_h)$. By proceeding as in Proposition \ref{pro:exist_um}, it is easy to prove that problem \eqref{eq:reduce-discrete} has at least one solution $\mathbf{u}_h \in V_{h,0}$, and by the above equivalence, each solution $\mathbf{u}_h$ determines a pair $({\boldsymbol{T}}_h,p_h) \in M_h\times Q_h$ so that $({\boldsymbol{T}}_h,\mathbf{u}_h,p_h)$ solves problem \eqref{pb:weak_disc}. Moreover, each solution of problem \eqref{pb:weak_disc} satisfies the same estimates as in \eqref{apriori_est:u} and \eqref{apriori_est:Td}. For the sake of simplicity, since the approximation is conforming, we state them in terms of the norm of $\mathbf{f}$ in $H^{-1}(\Omega)^d$, \begin{equation} \label{apriori_est:uh} \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(\Omega)} \leq \alpha \|\mathbf{f}\|_{H^{-1}(\Omega)}+\gamma C_1 |\Omega|^{\frac{1}{2}} \end{equation} and \begin{equation} \label{apriori_est:Tdh} \|{\boldsymbol{T}}_h\|_{L^2(\Omega)} \leq \|\mathbf{f}\|_{H^{-1}(\Omega)}+\frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}}. \end{equation} Regarding the other \emph{a priori} bounds, \eqref{apriori_est:u3bis} and \eqref{apriori_est:Td2} are satisfied by $\mathbf{u}_h$ and ${\boldsymbol{T}}_h$ and, if \eqref{eqn:mu_Lip} holds, so are \eqref{apriori_est:Td3} and \eqref{apriori_est:u3}, all up to the above norm for $\mathbf{f}$. In contrast, however, we do not have enough information to claim that \eqref{apriori_est:u2} is valid because it relies on the nonnegativity of ${\boldsymbol{T}}_h: \boldsymbol{D}(\mathbf{u}_h)$ almost everywhere in $\Omega$; the integral average is positive but this does not always guarantee pointwise nonnegativity. Thus we replace the constant $C_{\mathbf{u}}$ of \eqref{eq:C_u} by the constant $\widetilde{C_{\mathbf{u}}}$ in the following inequality: \begin{equation} \label{eq:C_uh} \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(\Omega)} \leq \widetilde{C_{\mathbf{u}}} : = \min\left\{\frac{1}{\alpha}(\alpha+\gamma\mu_{\max})^2\|\mathbf{f}\|_{H^{-1}(\Omega)},\alpha\|\mathbf{f}\|_{H^{-1}(\Omega)}+\gamma C_1 |\Omega|^{\frac{1}{2}},\frac{1}{\alpha}(\alpha+\gamma\Lambda)^2\|\mathbf{f}\|_{H^{-1}(\Omega)}\right\}, \end{equation} where the last term is included when \eqref{eqn:mu_Lip} holds. Because $C_{\mathbf{u}} \le \widetilde{C_{\mathbf{u}}}$, we shall use $\widetilde{C_{\mathbf{u}}}$ to bound both $\mathbf{u}$ and $\mathbf{u}_h$ in order to simplify the constants in the computations that will now follow. Finally, let us establish the convergence of the sequence of discrete solutions in the limit of $h \rightarrow 0$. The above uniform \emph{a priori} estimates imply that, up to a subsequence of the discretisation parameter $h$, \begin{alignat*}{2} \lim_{h \to 0} \mathbf{u}_h & =\bar{\mathbf{u}} & & \quad\mbox{weakly in } H_0^1(\Omega)^d ,\\ \lim_{h \to 0} \mathbf{u}_h & =\bar{\mathbf{u}} & & \quad\mbox{strongly in } L^q(\Omega)^d\,\, \mbox{with }1\leq q < \infty\; \mbox{ if }\, d=2, \mbox{ and }1 \leq q < 6\; \mbox{ if }\, d=3, \\ \lim_{h \to 0} {\boldsymbol{T}}_h & =\bar{{\boldsymbol{T}}} & & \quad \mbox{weakly in } L^2(\Omega)^{d \times d}, \end{alignat*} for some $\bar{\mathbf{u}}\in H_0^1(\Omega)^d$ and $\bar{{\boldsymbol{T}}}\in L^2(\Omega)^{d \times d}$. Clearly, the symmetry of ${\boldsymbol{T}}_h$ implies that of $\bar{{\boldsymbol{T}}}$ and ${\rm div}(\bar\mathbf{u}) = 0 $ follows from the fact that $\mathbf{u}_h$ belongs to $V_{h,0}$. Then the approximation properties of the discrete spaces and \eqref{eq:appVh0} permit to replicate the steps of the proof of Lemma \ref{lem:conv_product} and yield \begin{equation} \label{eqn:lim_suph} \lim_{h\rightarrow 0}\int_{\Omega}{\boldsymbol{T}}_h:\boldsymbol{D}(\mathbf{u}_h)= \int_{\Omega}\bar{{\boldsymbol{T}}}:\boldsymbol{D}(\bar{\mathbf{u}}). \end{equation} To fully identify the limit, in addition to $\tilde{\boldsymbol{T}}^\bd := \mathcal{G}(\bar{\mathbf{u}})$, which has trace zero since $\di(\bar \mathbf{u})=0$, we introduce the auxiliary tensor $\tilde{\boldsymbol{T}}_h := \mathcal{G}_h(\bar{\mathbf{u}})$. On the one hand $$\alpha \int_\Omega (\tilde{\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}^\bd):\boldsymbol{S}_h + \gamma\int_{\Omega}\big(\mu(|\tilde{\boldsymbol{T}}_h|)\tilde{\boldsymbol{T}}_h -\mu(|\tilde{\boldsymbol{T}}^\bd|)\tilde{\boldsymbol{T}}^\bd\big) :\boldsymbol{S}_h = 0 \quad \forall\, \boldsymbol{S}_h \in M_h, $$ thus implying that, for all $\boldsymbol{S}_h$ in $M_h$, \begin{align*} \alpha\|\tilde{\boldsymbol{T}}_h-&\tilde{\boldsymbol{T}}^\bd\|^2_{ L^2(\Omega)} + \gamma\int_{\Omega}\big(\mu(|\tilde{\boldsymbol{T}}_h|)\tilde{\boldsymbol{T}}_h -\mu(|\tilde{\boldsymbol{T}}^\bd|)\tilde{\boldsymbol{T}}^\bd\big): (\tilde{\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}^\bd)\\ & = \alpha \int_\Omega (\tilde{\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}^\bd):(\boldsymbol{S}_h-\tilde{\boldsymbol{T}}^\bd) + \gamma\int_{\Omega}\big(\mu(|\tilde{\boldsymbol{T}}_h|)\tilde{\boldsymbol{T}}_h -\mu(|\tilde{\boldsymbol{T}}^\bd|)\tilde{\boldsymbol{T}}^\bd\big): (\boldsymbol{S}_h-\tilde{\boldsymbol{T}}^\bd). \end{align*} Since both $\tilde{\boldsymbol{T}}_h$ and $\tilde{\boldsymbol{T}}^\bd$ are bounded in $M$ uniformly with respect to $h$, and $$\|\mu(|\tilde{\boldsymbol{T}}_h|)\tilde{\boldsymbol{T}}_h -\mu(|\tilde{\boldsymbol{T}}^\bd|)\tilde{\boldsymbol{T}}^\bd\|_{ L^2(\Omega)} \le 2 C_1 |\Omega|^{\frac{1}{2}},$$ again a uniform bound, then the approximation properties of $M_h$ and the monotonicity property \eqref{eqn:mu_mon} imply that \begin{equation} \label{eq:tildeTh-tildeT} \lim_{h \to 0} \|\tilde{\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}^\bd\|_{ L^2(\Omega)} =0. \end{equation} On the other hand, the auxiliary tensor $\tilde{\boldsymbol{T}}_h$ permits us to argue as in the proof of Lemma \ref{lem:T_to_G(u)}. Indeed, the monotonicity property \eqref{eqn:mu_mon} yields \begin{align*} \alpha \|{\boldsymbol{T}}_h- \tilde{\boldsymbol{T}}_h\|^2_{ L^2(\Omega)} &\le \int_{\Omega}\boldsymbol{D}(\mathbf{u}_h) :({\boldsymbol{T}}_h - \tilde{\boldsymbol{T}}_h) - \int_{\Omega}\boldsymbol{D}(\bar \mathbf{u}) :({\boldsymbol{T}}_h - \tilde{\boldsymbol{T}}_h)\\ & = \int_{\Omega}\boldsymbol{D}(\mathbf{u}_h) :{\boldsymbol{T}}_h - \int_{\Omega}\boldsymbol{D}(\mathbf{u}_h) :\tilde{\boldsymbol{T}}_h - \int_{\Omega}\boldsymbol{D}(\bar \mathbf{u}) :({\boldsymbol{T}}_h - \tilde{\boldsymbol{T}}_h). \end{align*} From \eqref{eqn:lim_suph} and \eqref{eq:tildeTh-tildeT}, we easily derive that the above right-hand side tends to zero. Hence $$\lim_{h \to 0} \|{\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}_h\|_{ L^2(\Omega)} =0, $$ and then combining this with \eqref{eq:tildeTh-tildeT} we infer that \begin{equation} \label{eq:Th-tildeT} \lim_{h \to 0} \|{\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}^\bd\|_{ L^2(\Omega)} =0. \end{equation} Hence uniqueness of the limit implies that $\bar {\boldsymbol{T}} = \tilde{\boldsymbol{T}}^\bd = \mathcal{G}(\bar \mathbf{u})$. This, and \eqref{infsup:b1h}, permit to identify the limit as in Lemma \ref{lem:T_to_G(u)} and Theorem \ref{thm:existence1}, and proves convergence to a weak solution without restrictions on the data. Thus we have proved the following result. \begin{thm}(Convergence for all data) \label{thm:uncondconvh} Under the above approximation properties and compatibility of the discrete spaces, up to a subsequence, \begin{alignat*}{2} \lim_{h \to 0} \mathbf{u}_h &= \mathbf{u} &&\quad\mbox{weakly in } H_0^1(\Omega)^d, \, \\ \lim_{h \to 0}\mathbf{u}_h &= \mathbf{u} &&\quad\mbox{strongly in } L^q(\Omega)^d\,\, \mbox{with }1\leq q < \infty\; \mbox{ if }\, d=2, \mbox{ and }1 \leq q < 6\; \mbox{ if }\, d=3, \\ \lim_{h \to 0}{\boldsymbol{T}}_h &= {\boldsymbol{T}}^\bd &&\quad \mbox{strongly in } L^2(\Omega)^{d \times d},\\ \lim_{h \to 0} p_h &= p &&\quad\mbox{weakly in } L^2(\Omega), \end{alignat*} where $({\boldsymbol{T}}^\bd,\mathbf{u},p)$ is a solution of \eqref{pb:NS_EL_weakR1}, \eqref{pb:NS_EL_weakR2}. \end{thm} \subsubsection{Error estimate} \label{subsec:error_estimate} We now prove an \emph{a priori} error estimate between $({\boldsymbol{T}}^\bd,\mathbf{u},p)$ and $({\boldsymbol{T}}_h,\mathbf{u}_h,p_h)$, under the assumption \eqref{eqn:mu_Lip} that has not been used so far, and the small data condition \eqref{eq:smalldata} below. Note that this small data condition is in fact the same as the uniqueness condition \eqref{hyp:input_data}, upon replacing $C_{\mathbf{u}}$ by $\widetilde{C_{\mathbf{u}}}$. To simplify the notation and compress some of the long displayed lines of mathematics, we shall write $\|\cdot\|_V$, $\|\cdot\|_M$ and $\|\cdot\|_Q$ instead of $\|D(\cdot)\|_{L^2(\Omega)}$ (as a norm on $V$), $\|\cdot\|_{L^2(\Omega)}$ (as a norm on $M$) and $\|\cdot\|_{L^2(\Omega)}$ (as a norm on $Q$), respectively. \begin{thm} \label{thm:apriorierror} In addition to \eqref{eqn:mu_Lip}, let the input data satisfy \begin{equation} \label{eq:smalldata} \frac{\gamma}{\alpha}\Lambda +\alpha\hat{D}\widetilde{C_{\mathbf{u}}}\leq\theta<1, \end{equation} where $0<\theta <1$ and $\hat{D}$ is the constant from \eqref{bound:form_d}. Then, there exists a constant $C>0$ independent of $h$ such that the difference between the solution $({\boldsymbol{T}}_h,\mathbf{u}_h,p_h)$ of \eqref{pb:weak_disc} and $({\boldsymbol{T}}^\bd,\mathbf{u},p)$ of \eqref{pb:weak_cont} satisfies \begin{equation} \label{eqn:error_a_priori} \|\mathbf{u}-\mathbf{u}_h\|_V+\|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_M+\|p-p_h\|_Q \leq C\left[\inf_{\mathbf{v}_h\in V_h}\|\mathbf{u}-\mathbf{v}_h\|_V+\inf_{\boldsymbol{S}_h\in M_h}\|{\boldsymbol{T}}^\bd-\boldsymbol{S}_h\|_M+\inf_{q_h\in Q_h}\|p-q_h\|_Q\right]. \end{equation} \end{thm} \begin{proof} Since we are using conforming finite element spaces, taking $(\boldsymbol{S},\mathbf{v},q)=(\boldsymbol{S}_h,\mathbf{v}_h,q_h)$ in \eqref{pb:weak_cont} and subtracting the equations of \eqref{pb:weak_disc} we easily get \begin{alignat}{2} \label{pb:weak_Galerkin} \hspace{-0.3cm} d(\mathbf{u};\mathbf{u},\mathbf{v}_h)-d(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h)+\displaystyle{\int_{\Omega}}({\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h):\boldsymbol{D}(\mathbf{v}_h)+b_2(\mathbf{v}_h,p-p_h) & = 0 &&\;\, \forall\, \mathbf{v}_h\in V_h, \nonumber\\ \hspace{-0.3cm} \alpha\displaystyle{\int_{\Omega}}({\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h):\boldsymbol{S}_h+\gamma\displaystyle{\int_{\Omega}}(\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd-\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h):\boldsymbol{S}_h & = \displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}-\mathbf{u}_h):\boldsymbol{S}_h &&\;\, \forall\, \boldsymbol{S}_h\in M_h, \\ \hspace{-0.3cm} b_2(\mathbf{u}-\mathbf{u}_h,q_h) & = 0 &&\;\, \forall\, q_h\in Q_h.\nonumber \end{alignat} The rest of the proof is divided into three steps. \textbf{Step 1} ({E}rror bound for the pressure). By the triangle inequality we have, for any $q_h \in Q_h$, \begin{equation*} \|p-p_h\|_Q\leq \|p-q_h\|_Q+\|q_h-p_h\|_Q, \end{equation*} and it therefore suffices to derive a bound on $\|q_h-p_h\|_Q$. From the (discrete) inf-sup condition we have \begin{equation*} \beta^*\|p_h-q_h\|_Q\leq \sup_{\mathbf{v}_h\in V_h}\frac{b_2(\mathbf{v}_h,p_h-q_h)}{\|\mathbf{v}_h\|_V}. \end{equation*} Again, using the first equation of \eqref{pb:weak_Galerkin} we have \begin{align*} b_2(\mathbf{v}_h,p_h-q_h) & = b_2(\mathbf{v}_h,p_h-p)+b_2(\mathbf{v}_h,p-q_h) \\ & = d(\mathbf{u};\mathbf{u},\mathbf{v}_h)-d(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h)+\int_{\Omega}({\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h):\boldsymbol{D}(\mathbf{v}_h)+b_2(\mathbf{v}_h,p-q_h) \\ & \leq \left[(\hat{D}\|\mathbf{u}\|_V+\hat{D}\|\mathbf{u}_h\|_V)\|\mathbf{u}-\mathbf{u}_h\|_V+\|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_M+c_b\|p-q_h\|_Q\right]\|\mathbf{v}_h\|_V \\ & \leq \left[2\hat{D} \widetilde{C_{\mathbf{u}}} \|\mathbf{u}-\mathbf{u}_h\|_V+\|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_M+c_b\|p-q_h\|_Q\right]\|\mathbf{v}_h\|_V, \end{align*} where we can take $c_b=C_K$ using the relation $\|\di(\mathbf{v})\|_{L^2(\Omega)}^2+\|\rot(\mathbf{v})\|_{L^2(\Omega)}^2=\| \nabla \mathbf{v} \|_{L^2(\Omega)}^2$ that holds because we have homogeneous Dirichlet boundary conditions (otherwise take $c_b=\sqrt{d}C_K$). Thus, we obtain \begin{equation} \label{errest_step1_p} \|p-p_h\|_Q \leq \frac{2\hat{D} \widetilde{C_{\mathbf{u}}}}{\beta^*}\|\mathbf{u}-\mathbf{u}_h\|_V+\frac{1}{\beta^*}\|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_M+\left(1+\frac{c_b}{\beta^*}\right)\|p-q_h\|_Q \end{equation} for any $q_h\in Q_h$. \textbf{Step 2} ({E}rror bound for the stress tensor). Again, we start with the triangle inequality; for any $\boldsymbol{S}_h \in M_h$ we have that \begin{equation*} \|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_M \leq \|{\boldsymbol{T}}^\bd-\boldsymbol{S}_h\|_M+\|\boldsymbol{S}_h-{\boldsymbol{T}}_h\|_M, \end{equation*} and we then bound $\|{\boldsymbol{T}}_h-\boldsymbol{S}_h\|_M$. Thanks to the monotonicity property \eqref{eqn:mu_mon} and the second equation of \eqref{pb:weak_Galerkin}, we have \begin{align*} \alpha\|{\boldsymbol{T}}_h-\boldsymbol{S}_h\|_M^2 & \leq \alpha\int_{\Omega}|{\boldsymbol{T}}_h-\boldsymbol{S}_h|^2+\gamma\int_{\Omega}(\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h-\mu(|\boldsymbol{S}_h|)\boldsymbol{S}_h):({\boldsymbol{T}}_h-\boldsymbol{S}_h) \\ & \hspace*{-2.1cm}=\alpha\int_{\Omega}({\boldsymbol{T}}_h-{\boldsymbol{T}}^\bd+{\boldsymbol{T}}^\bd-\boldsymbol{S}_h):({\boldsymbol{T}}_h-\boldsymbol{S}_h)+\gamma\int_{\Omega}(\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h-\mu(|\boldsymbol{S}_h|)\boldsymbol{S}_h):({\boldsymbol{T}}_h-\boldsymbol{S}_h) \\ & \hspace*{-2.1cm}=\int_{\Omega}\boldsymbol{D}(\mathbf{u}_h-\mathbf{u}):({\boldsymbol{T}}_h-\boldsymbol{S}_h)+\gamma\int_{\Omega}(\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd-\mu(|\boldsymbol{S}_h|)\boldsymbol{S}_h):({\boldsymbol{T}}_h-\boldsymbol{S}_h)+\alpha\int_{\Omega}({\boldsymbol{T}}^\bd-\boldsymbol{S}_h):({\boldsymbol{T}}_h-\boldsymbol{S}_h) \\ & \hspace*{-2.1cm} \leq \left[\|\mathbf{u}-\mathbf{u}_h\|_V+\alpha\|{\boldsymbol{T}}^\bd-\boldsymbol{S}_h\|_M+\gamma\Lambda\|{\boldsymbol{T}}^\bd-\boldsymbol{S}_h\|_M\right] \|{\boldsymbol{T}}_h-\boldsymbol{S}_h\|_M, \end{align*} and thus \begin{equation} \label{errest_step2_Td} \|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_M \leq \frac{1}{\alpha}\|\mathbf{u}-\mathbf{u}_h\|_V+\left(2+\frac{\gamma\Lambda}{\alpha}\right)\|{\boldsymbol{T}}^\bd-\boldsymbol{S}_h\|_M \end{equation} for any $\boldsymbol{S}_h\in M_h$. \textbf{Step 3} ({E}rror bound for the velocity). Recalling the definition of $V_{h,0}$ in \eqref{def:Vh0}, let $\mathbf{v}_{h,0}\in V_{h,0}$ and let $\mathbf{v}_h:=\mathbf{v}_{h,0}-\mathbf{u}_h\in V_{h,0}$. We will first show the relation \eqref{eqn:error_a_priori} by taking the infimum over $V_{h,0}$ instead of $V_h$. As before, we use the triangle inequality to get \begin{equation*} \|\mathbf{u}-\mathbf{u}_h\|_V \leq \|\mathbf{u}-\mathbf{v}_{h,0}\|_V + \|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V. \end{equation*} Thanks to the assumption \eqref{eqn:eps_in_Mh}, we can take $\boldsymbol{S}_h=\boldsymbol{D}(\mathbf{v}_h)$ in the second equation of \eqref{pb:weak_Galerkin} yielding \begin{equation*} \int_{\Omega}\boldsymbol{D}(\mathbf{u}-\mathbf{u}_h):\boldsymbol{D}(\mathbf{v}_h) = \alpha\int_{\Omega}({\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h):\boldsymbol{D}(\mathbf{v}_h)+\gamma\int_{\Omega}\big(\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd-\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h\big):\boldsymbol{D}(\mathbf{v}_h). \end{equation*} Using the first equation of \eqref{pb:weak_Galerkin}, we can easily derive the equality \begin{align*} \| \mathbf{v}_{h,0}-\mathbf{u}_h \|_{V}^2 =\int_{\Omega}\boldsymbol{D}(\mathbf{v}_{h,0}-\mathbf{u}_h):\boldsymbol{D}(\mathbf{v}_h) & = \int_{\Omega}\boldsymbol{D}(\mathbf{v}_{h,0}-\mathbf{u}):\boldsymbol{D}(\mathbf{v}_h)-\alpha(d(\mathbf{u};\mathbf{u},\mathbf{v}_h)-d(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h)) \\ &\quad -\alpha b_2(\mathbf{v}_h,p-q_h) +\gamma\int_{\Omega}(\mu(|{\boldsymbol{T}}^\bd|){\boldsymbol{T}}^\bd-\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h):\boldsymbol{D}(\mathbf{v}_h), \end{align*} thanks to the fact that $b_2(\mathbf{v}_h,q_h-p_h) = 0$. To bound the convective term, we use \begin{align*} d(\mathbf{u};\mathbf{u},\mathbf{v}_h)-d(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h) & = d(\mathbf{u}-\mathbf{u}_h;\mathbf{u},\mathbf{v}_h)+d(\mathbf{u}_h;\mathbf{u}-\mathbf{u}_h,\mathbf{v}_h) \\ & = d(\mathbf{u}-\mathbf{v}_{h,0};\mathbf{u},\mathbf{v}_h)+d(\mathbf{v}_{h,0}-\mathbf{u}_h;\mathbf{u},\mathbf{v}_h) \\ & \quad +d(\mathbf{u}_h;\mathbf{u}-\mathbf{v}_{h,0},\mathbf{v}_h)+\underbrace{d(\mathbf{u}_h;\mathbf{v}_{h,0}-\mathbf{u}_h,\mathbf{v}_h)}_{=0} \\ & \hspace*{-4cm} \leq \left[\hat{D}\|\mathbf{u}\|_V\|\mathbf{u}-\mathbf{v}_{h,0}\|_V+\hat{D}\|\mathbf{u}\|_V\|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V+\hat{D}\|\mathbf{u}_h\|_V\|\mathbf{u}-\mathbf{v}_{h,0}\|_V\right]\|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V \\ & \hspace*{-4cm} \leq \left[2\hat{D} \widetilde{C_{\mathbf{u}}} \|\mathbf{u}-\mathbf{v}_{h,0}\|_V+\hat{D} \widetilde{C_{\mathbf{u}}}\|\mathbf{v}_{h,0}- \mathbf{u}_h \|_V\right]\|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V, \end{align*} from which we get \begin{align*} \|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V & \leq \|\mathbf{u}-\mathbf{v}_{h,0}\|_V+2\alpha\hat{D} \widetilde{C_{\mathbf{u}}}\|\mathbf{u}-\mathbf{v}_{h,0}\|_V \\ & \quad +\alpha c_b\|p-q_h\|_Q+\gamma\Lambda\|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_M+\alpha\hat{D} \widetilde{C_{\mathbf{u}}}\|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V. \end{align*} Now using \eqref{errest_step2_Td} we arrive at \begin{align*} \|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V & \leq (1+2\alpha\hat{D} \widetilde{C_{\mathbf{u}}} )\|\mathbf{u}-\mathbf{v}_{h,0}\|_V+\alpha c_b\|p-q_h\|_Q+\frac{\gamma\Lambda}{\alpha}\|\mathbf{u}-\mathbf{u}_h\|_V \\ & \quad + \gamma\Lambda\left(2+\frac{\gamma\Lambda}{\alpha}\right)\|{\boldsymbol{T}}^\bd- \boldsymbol{S}_h \|_M+\alpha\hat{D} \widetilde{C_{\mathbf{u}}} \|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V \\ & \leq \left(1+2\alpha\hat{D} \widetilde{C_{\mathbf{u}}} +\frac{\gamma\Lambda}{\alpha}\right)\|\mathbf{u}-\mathbf{v}_{h,0}\|_V+\gamma\Lambda\left(2+\frac{\gamma\Lambda}{\alpha}\right)\|{\boldsymbol{T}}^d- \boldsymbol{S}_h \|_M \\ & \quad +\alpha c_b\|p-q_h\|_Q+\left(\frac{\gamma\Lambda}{\alpha}+\alpha\hat{D} \widetilde{C_{\mathbf{u}}}\right)\| \mathbf{v}_{h,0}-\mathbf{u}_h\|_V. \end{align*} Therefore, using the assumption \eqref{eq:smalldata} on the input data, we obtain \begin{equation*} \|\mathbf{v}_{h,0}-\mathbf{u}_h\|_V \leq \frac{1}{1-\theta}\left[\left(1+2\alpha\hat{D} \widetilde{C_{\mathbf{u}}} +\frac{\gamma\Lambda}{\alpha}\right)\|\mathbf{u}-\mathbf{v}_{h,0}\|_V+\gamma\Lambda\left(2+\frac{\gamma\Lambda}{\alpha}\right)\|{\boldsymbol{T}}^\bd- \boldsymbol{S}_h \|_M+\alpha c_b\|p-q_h\|_Q\right] \end{equation*} and thus \begin{equation} \label{errest_step3_u} \|\mathbf{u}-\mathbf{u}_h\|_V \leq \left(1+\frac{1+2\alpha\hat{D}\widetilde{C_{\mathbf{u}}}+\frac{\gamma\Lambda}{\alpha}}{1-\theta}\right)\|\mathbf{u}-\mathbf{v}_{h,0}\|_V+\frac{\gamma\Lambda\left(2+\frac{\gamma\Lambda}{\alpha}\right)}{1-\theta}\|{\boldsymbol{T}}^\bd- \boldsymbol{S}_h \|_M+\frac{\alpha c_b}{1-\theta}\|p-q_h\|_Q \end{equation} for any $\mathbf{v}_{h,0}\in V_{h,0}$. Finally, combining \eqref{errest_step1_p}, \eqref{errest_step2_Td} and \eqref{errest_step3_u} we obtain \begin{equation*} \|\mathbf{u}-\mathbf{u}_h\|_V+\|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_M+\|p-p_h\|_Q \leq c_1\inf_{\mathbf{v}_{h,0}\in V_{h,0}}\|\mathbf{u}-\mathbf{v}_{h,0}\|_V+c_2\inf_{\boldsymbol{S}_h\in M_h}\|{\boldsymbol{T}}^\bd-\boldsymbol{S}_h\|_M+c_3\inf_{q_h\in Q_h}\|p-q_h\|_Q \end{equation*} with \begin{align*} c_1 & := \left[1+\frac{2\hat{D} \widetilde{C_{\mathbf{u}}} }{\beta^*}+\frac{1}{\alpha}\left(1+\frac{1}{\beta^*}\right)\right]\left(1+\frac{1+2\alpha\hat{D} \widetilde{C_{\mathbf{u}}} +\frac{\gamma\Lambda}{\alpha}}{1-\theta}\right), \\ c_2 & := \left(1+\frac{1}{\beta^*}\right)\left(2+\frac{\gamma\Lambda}{\alpha}\right)+\left[1+\frac{2\hat{D} \widetilde{C_{\mathbf{u}}} }{\beta^*}+\frac{1}{\alpha}\left(1+\frac{1}{\beta^*}\right)\right]\frac{\gamma\Lambda\left(2+\frac{\gamma\Lambda}{\alpha}\right)}{1-\theta} ,\\ c_3 & := \left(1+\frac{c_b}{\beta^*}\right)+\left[1+\frac{2\hat{D} \widetilde{C_{\mathbf{u}}} }{\beta^*}+\frac{1}{\alpha}\left(1+\frac{1}{\beta^*}\right)\right]\left(\frac{\alpha c_b}{1-\theta}\right). \end{align*} We can then conclude the proof using \eqref{eq:bdd_vh0}. \end{proof} \subsection{Examples of conforming approximation} \label{subsec:Ex_conf_app} From now on, we assume that the boundary of the Lipschitz domain $\Omega \subset \mathbb{R}^d$ is a polygonal line (when $d=2$) or a polyhedral surface (when $d=3$), so that it can be exactly meshed. For each $h$, let $\Th$ be a conforming mesh on $\overline\Omega$ consisting of elements $E$, triangles or quadrilaterals in two dimensions, tetrahedra or hexahedra (all planar-faced) in three dimensions, conforming in the sense that the mesh has no hanging nodes. As usual, the diameter of $E$ is denoted by $h_E$, $$h = \sup_{E \in \Th} h_E, $$ and $\varrho_E$ is the diameter of the largest ball inscribed in $E$. \subsubsection{The simplicial case} In the case of simplices, the family of meshes $\Th$ is assumed to be {\em regular} in the sense of Ciarlet~\cite{Cia}: i.e., it is assumed that there exists a constant $\sigma >0$, independent of $h$, such that \begin{equation} \label{eq:reg_mesh} \frac{h_E}{\varrho_E} \le \sigma\quad \forall\, E \in \Th. \end{equation} This condition guarantees that there is an invertible affine mapping $\mathcal F_E$ that maps the unit reference simplex onto $E$. For any integer $k \ge 0$, let $\polP_k$ denote the space of polynomials in $d$ variables of degree at most $k$. In each element $E$, the functions will be approximated in the spaces $\polP_k$. The specific choice of finite element spaces is dictated by two considerations. First, conditions \eqref{infsup:b1h} and \eqref{eqn:eps_in_Mh} must be satisfied. Next, since the number of unknowns in \eqref{pb:weak_disc} is large, the degree $k$ of the finite element functions should be small. It is well-known that the lowest degree of conforming approximation of $(\mathbf{u},p)$ satisfying \eqref{infsup:b1h}, without modification of the bilinear forms, is the Taylor-Hood $\polP_2^d$--$\polP_1$ element, see~\cite{ref:GiR,ref:Boffi97}, provided each element has at least one interior vertex. In view of \eqref{eqn:eps_in_Mh}, this implies that ${\boldsymbol{T}}^{\bd}$ is approximated by $\polP_1^{d\times d}$. Thus the corresponding finite element spaces are \begin{align*} V_h &:=\{ \mathbf{v}_h \in H^1_0(\Omega)^d: \quad \restriction{\mathbf{v}_h}{E} \in \polP_2^d \quad \forall\, E \in \Th\}, \\ Q_h &:=\{ q_h \in H^1(\Omega)\cap L^2_0(\Omega): \quad \restriction{q_h}{E} \in \polP_1 \quad \forall\, E \in \Th\}, \\ M_h &:=\{ \boldsymbol{S}_h \in L^2(\Omega)_{{ \rm sym}}^{d\times d}: \quad \restriction{\boldsymbol{S}_h}{E} \in (\polP_1)_{{ \rm sym}}^{d\times d} \quad \forall\, E \in \Th\}. \end{align*} It is easy to check that with these spaces on a simplicial mesh, under condition \eqref{eq:reg_mesh}, problem \eqref{pb:weak_disc} has at least one solution. Furthermore, if the data satisfy \eqref{eq:smalldata}, then Theorem \ref{thm:apriorierror} yields \begin{equation} \label{eqn:errorTH2} \| \boldsymbol{D}( \mathbf{u}-\mathbf{u}_h)\|_{ L^2(\Omega)} +\|{\boldsymbol{T}}^\bd-{\boldsymbol{T}}_h\|_{ L^2(\Omega)}+\|p-p_h\|_{ L^2(\Omega)} \leq C\,h^2, \end{equation} provided that the solution is sufficiently smooth, namely $\mathbf{u} \in H^3(\Omega)^d\cap H^1_0(\Omega)^d$, ${\boldsymbol{T}}^{\bd} \in H^2(\Omega)^{d\times d}$, and $p \in H^2(\Omega)\cap L^2_0(\Omega)$. Therefore the scheme has order two for an optimal number of degrees of freedom, i.e., this order of convergence cannot be achieved with fewer degrees of freedom. \subsubsection{The quadrilateral/hexahedral case} \label{ss:quad} The notion of regularity is more complex for quadrilateral and much more complex for hexahedral elements. In the case of quadrilaterals~\cite{ref:GiR}, the family of meshes is regular if the elements are convex and, moreover, the subtriangles associated to each vertex (there is one per vertex) all satisfy \eqref{eq:reg_mesh}. In the case of hexahedra with plane faces, convexity and the validity of \eqref{eq:reg_mesh} for the subtetrahedra associated to each vertex are necessary but not sufficient. This difficulty has been investigated by many authors, see for instance~\cite{ref:Zhang2005,ref:Knabner2003}; the most relevant publication concerning hexahedra with plane faces is however~\cite{ref:Johnen17}, where the minimum of the Jacobian in the reference cube $\hat E$ is bounded below by the minimum of the coefficients of its B\'ezier expansion and this minimum is determined by an efficient algorithm. The details of this are beyond the scope of this work, and we shall simply assume here that the minimum of these B\'ezier coefficients is strictly positive and that furthermore, denoting by ${\mathcal J}_E$ the Jacobian determinant of $\mathcal F_E$, \begin{equation} \label{eq:reg_hexa} {\mathcal J}_E(\hat \mathbf{x}) \ge \hat c \varrho_E^3\quad \forall\,\hat \mathbf{x} \in \hat E \end{equation} with a constant $\hat c$ independent of $E$ and $h$. If these conditions hold, there is an invertible bi-affine mapping $\mathcal F_E$ in two dimensions or tri-affine in three dimensions that maps the unit reference square or cube onto $E$. We let $\polQ_k$ be the space of polynomials in $d$ variables of degree at most $k$ in {\em each} variable. In contrast to the case of simplicial meshes, the space $\polQ_k$ is not invariant under the composition with $\mathcal F_E$, which makes the compatibility condition \eqref{eqn:eps_in_Mh} between $\boldsymbol{D}(V_h)$ and $M_h$ problematic. To circumvent this issue, we restrict ourselves to affine maps $\mathcal F_E$, thereby allowing subdivisions consisting of parallelograms/parallelepipeds. In addition, the situation is less satisfactory when a quadrilateral or hexahedral mesh is used, because although the Taylor-Hood $\polQ_2^d$--$\polQ_1$ element satisfies \eqref{infsup:b1h}, the second condition \eqref{eqn:eps_in_Mh} does not hold if ${\boldsymbol{T}}^{\bd}$ is approximated by $ {\polQ}_1^{d\times d}$ since the components of the gradient of $\polQ_2$ functions belong to a space, intermediate between $\polQ_2$ and $\polQ_1 $, that is strictly larger than both $\polQ_1$ and $\polP_2$. Therefore, in order to satisfy \eqref{eqn:eps_in_Mh}, the simplest option is to discretise each component of ${\boldsymbol{T}}^{\bd}$ by ${\polQ}_2$. The corresponding finite element spaces are \begin{align*} V_h &:=\{ \mathbf{v}_h \in H^1_0(\Omega)^d: \quad \restriction{\mathbf{v}_h}{E} \in \polQ_2^d \quad \forall\, E \in \Th\}, \\ Q_h &:=\{ q_h \in H^1(\Omega)\cap L^2_0(\Omega): \quad \restriction{q_h}{E} \in \polQ_1 \quad \forall\, E \in \Th\}, \\ M_h &:=\{ \boldsymbol{S}_h \in L^2(\Omega)_{{ \rm sym}}^{d\times d}: \quad \restriction{\boldsymbol{S}_h}{E} \in (\polQ_2)_{{ \rm sym}}^{d\times d} \quad \forall\, E \in \Th\}. \end{align*} With these spaces and under the above regularity conditions, problem \eqref{pb:weak_disc} has at least one solution and the error estimate \eqref{eqn:errorTH2} holds if the data satisfy \eqref{eq:smalldata}. However, this triple of spaces is no longer optimal, because the degree two approximation of ${\boldsymbol{T}}^{\bd}$ now requires far too many degrees of freedom with no gain in accuracy. For instance, when $d=3$, its approximation by $({\polQ}_2)_{{ \rm sym}}^{3\times 3}$ requires $27 \times 6 =162$ unknowns inside each element instead of $8\times 6 =48$ unknowns for $({\polQ}_1)_{{ \rm sym}}^{3\times 3}$. The nonconforming finite element approximations discussed in Section~\ref{sec:NS_ENL_AppNC} do not require an affine mapping $\mathcal F_E$ and, by considering $\polP$-type approximations on the physical element $E$, do not suffer from the computational cost overhead mentioned above. \section{ Nonconforming finite element approximation} \label{sec:NS_ENL_AppNC} The nonconforming approximations developed here will not only allow the use of elements of degree one for $\mathbf{u}$, but will also lead to locally mass-conserving schemes. Because of the discontinuity of the finite element functions, the proofs are in some cases more complex; this is true in particular for the proof of the inf-sup condition for the discrete divergence. \subsection{The quadrilateral/planar-faced hexahedral case} \label{subsec:quads} Here we consider quadrilateral/hexahedral grids $\Th$ with planar faces, satisfying the regularity assumptions stated in Section \ref{subsec:Ex_conf_app}. There is a wide choice of possible approximations with nonconforming finite elements. Here we propose globally discontinuous velocities in $\polP^d_{ k}$, ${ k}\ge 1$, in each cell associated with globally discontinuous pressures and stresses both of degree at most $k-1$. Thus we consider $V_h \subset L^2(\Omega)^d$, $Q_h \subset L^2_0(\Omega)$ and $M_h \subset L^2(\Omega)_{{\rm sym}}^{d\times d}$ defined by \begin{align} \label{eq:Vhnon-k} V_h &:=\{ \mathbf{v}_h \in L^2(\Omega)^d: \quad \restriction{\mathbf{v}_h}{E} \in \polP^d_{ k }\quad \forall\,E\in \Th\}, \\ \label{eq:Qhnon-k} Q_h &:=\{ q_h \in L^2_0(\Omega): \quad \restriction{q_h}{E} \in \polP_{{ k }-1} \quad \forall\, E \in \Th\}, \\ \label{eq:Mhnon-k} M_h &:=\{ \boldsymbol{S}_h \in L^2(\Omega)_{{\rm sym}}^{d\times d}: \quad \restriction{\boldsymbol{S}_h}{E} \in (\polP_{{ k }-1})_{{\rm sym}}^{d\times d} \quad \forall\, E\in \Th\}. \end{align} As usual, the full nonconformity of $V_h$ is compensated by adding to the forms consistent jumps and averages on edges when $d=2$ or faces when $d=3$; see for instance~\cite{Riviere2008}. Let $\Gamma_h = \Gamma_h^i\cup\Gamma_h^b$ denote the set of all edges when $d=2$ or all faces when $d=3$ with $\Gamma_h^i$ and $\Gamma_h^b$ signifying the set of all interior and the set of all boundary edges ($d=2$) or faces ($d=3$), respectively. A unit normal vector $\mathbf{n}_e$ is attributed to each $e \in \Gamma_h$; its direction can be freely chosen. Here, the following rule is applied: if $e\in \Gamma_h^b$, then $\mathbf{n}_e = \mathbf{n}_\Omega$, the exterior unit normal to $\Omega$; if $e \in\Gamma_h^i$, then $\mathbf{n}_e$ points from $E_i$ to $E_j$, where $E_i$ and $E_j$ are the two elements of $\Th$ adjacent to $e$ and the number $i$ of $E_i$ is smaller than that of $E_j$. The jumps and averages of any function $f$ on $e$ (smooth enough to have a trace) are defined by $$[f(x)]_e := \restriction{f(x)}{E_i} - \restriction{f(x)}{E_j},\quad \mbox{when}\ \mathbf{n}_e\ \mbox{points from}\ E_i\ \mbox{to}\ E_j, $$ $$\{f(x)\}_e := \frac{1}{2} \big(\restriction{f(x)}{E_i} + \restriction{f(x)}{E_j}\big). $$ When $e\in\Gamma_h^b$, the jump and average are defined to coincide with the trace on $e$. The terms involving jumps and averages that are added to each form are not unique; here we make the following fairly standard choice: \begin{equation} \label{eq:epshnon} \int_\Omega \boldsymbol{S} :\boldsymbol{D}(\mathbf{v}) \simeq b_{1h}(\boldsymbol{S}_h,\mathbf{v}_h) := \sum_{E \in \Th} \int_E \boldsymbol{S}_h:\boldsymbol{D}(\mathbf{v}_h) - \sum_{e \in \Gamma_h} \int_e \{\boldsymbol{S}_h\}_e\mathbf{n}_e \cdot [\mathbf{v}_h]_e. \end{equation} The trilinear form $d$ is approximated by a centred discretisation, as follows: \begin{equation} \label{eq:dhnon} \begin{split} d_h(\mathbf{u}_h;\mathbf{v}_h,\mathbf{w}_h) : =& \sum_{E \in \Th} \int_E \left[ (\mathbf{u}_h\cdot\nabla)\mathbf{v}_h \right]\cdot \mathbf{w}_h + \frac{1}{2}\sum_{E \in \Th} \int_E \di(\mathbf{u}_h) (\mathbf{v}_h \cdot \mathbf{w}_h)\\ & - \frac{1}{2}\sum_{e \in \Gamma_h}\int_e [\mathbf{u}_h]_e\cdot \mathbf{n}_e \{\mathbf{v}_h \cdot \mathbf{w}_h\}_e - \sum_{e \in \Gamma_h^i} \int_e\{\mathbf{u}_h\}_e\cdot \mathbf{n}_e [\mathbf{v}_h]_e\cdot\{ \mathbf{w}_h\}_e. \end{split} \end{equation} The divergence form $b_2$ is approximated by \begin{equation} \label{eq:b2hnon} b_{2h}(\mathbf{v}_h,q_h) := -\sum_{E \in \Th} \int_E q_h \di(\mathbf{v}_h)+ \sum_{e \in \Gamma_h}\int_e [\mathbf{v}_h]_e\cdot \mathbf{n}_e \{q_h\}_e. \end{equation} Clearly, the jump terms in \eqref{eq:epshnon} and \eqref{eq:b2hnon} vanish when $\mathbf{v}_h$ belongs to $H^1_0(\Omega)^d$. Likewise, the jump and divergence terms in \eqref{eq:dhnon} vanish when $\mathbf{u}_h$ and $\mathbf{v}_h$ belong to $H^1_0(\Omega)^d$ and $\di(\mathbf{u}_h) = 0$. Moreover, \eqref{eq:dhnon} is constructed so that $d_h$ is antisymmetric, \begin{equation} \label{eq:antisym-non} d_h(\mathbf{u}_h;\mathbf{v}_h,\mathbf{w}_h) = - d_h(\mathbf{u}_h;\mathbf{w}_h,\mathbf{v}_h) \quad \forall\, \mathbf{u}_h,\mathbf{v}_h,\mathbf{w}_h \in V_h. \end{equation} Finally, the following positive definite form acts as a penalty to compensate the nonconformity of $\mathbf{u}_h$: \begin{equation} \label{eq:Jh} J_h(\mathbf{u}_h,\mathbf{v}_h) := \sum_{e \in \Gamma_h}\frac{\sigma_e}{h_e} \int_e [\mathbf{u}_h]_e \cdot [\mathbf{v}_h]_e, \end{equation} where $h_e$ is the average of the diameter of the two elements adjacent to $e$, if $e \in\Gamma_h^i$, or the diameter of the element adjacent to $e$ otherwise. The parameters $\sigma_e > 0$ will be chosen below to guarantee stability of the scheme, see \eqref{eqn:sigma.e} and \eqref{eqn:bdd.C1}. This form is also used to define the norm on $V_h$ by \begin{equation} \label{eq:normVh} \|\mathbf{v}_h\|_{V_h}:= \Big(\|\boldsymbol{D}(\mathbf{v}_h)\|^2_h + J_h(\mathbf{v}_h,\mathbf{v}_h) \Big)^{\frac{1}{2}}, \end{equation} where \begin{equation} \label{eq:seminormVh} \|\boldsymbol{D}(\mathbf{v}_h)\|_h:= \Big(\sum_{E \in \Th} \|\boldsymbol{D}(\mathbf{v}_h)\|^2_{L^2(E)}\Big)^{\frac{1}{2}} \end{equation} denotes the associated semi-norm. Also, in view of \eqref{eq:b2hnon}, we define the space of discretely divergence-free functions, \begin{equation} \label{eq:V0hnon.conf} V_{h,0} := \{ \mathbf{v}_h \in V_h: \quad b_{2h}(\mathbf{v}_h,q_h) = 0 \quad \forall\, q_h\in Q_h\}. \end{equation} The discrete scheme reads: find $({\boldsymbol{T}}_h,\mathbf{u}_h,p_h) \in M_h \times V_h \times Q_h$ solution of \begin{alignat}{2} \label{pb:nonconfscheme} \begin{aligned} d_h(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h) + b_{1h}({\boldsymbol{T}}_h,\mathbf{v}_h) + b_{2h}(\mathbf{v}_h,p_h)+ J_h(\mathbf{u}_h,\mathbf{v}_h) & = \int_{\Omega}\mathbf{f}\cdot\mathbf{v}_h &&\quad \forall\, \mathbf{v}_h\in V_h, \\ \alpha\int_{\Omega}{\boldsymbol{T}}_h:\boldsymbol{S}_h+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h:\boldsymbol{S}_h & = b_{1h}(\boldsymbol{S}_h,\mathbf{u}_h) &&\quad \forall\, \boldsymbol{S}_h\in M_h, \\ b_{2h}(\mathbf{u}_h,q_h) & = 0 &&\quad \forall\, q_h\in Q_h. \end{aligned} \end{alignat} As expected, $b_{2h}(\mathbf{v}_h,1) = 0$, and therefore the system \eqref{pb:nonconfscheme} is unchanged when the zero mean value constraint is lifted from the functions of $Q_h$. \subsubsection{Properties of the norm and forms} \label{subsec:Nonconf-forms} All constants below depend on the regularity of the mesh but are independent of $h$. In particular, we shall use $C$ to denote such generic constant independent of $h$. In addition, we shall use the following ``edge to interior" inequality. There exists a constant $\hat C$, depending only on the dimension $d$ and the degree of the polynomials, such that for all $\mathbf{v}_h \in V_h$, all $e \in \Gamma_h$ and any element $E$, adjacent to $e$, \begin{equation} \label{eq:e.to.E} \|\mathbf{v}_h\|_{L^2(e)} \le \hat C \bigg(\frac{|e|}{|E|}\bigg)^{\frac{1}{2}} \|\mathbf{v}_h\|_{L^2(E)}. \end{equation} It is easy to check that \eqref{eq:normVh} defines a norm on $V_h$. Next, the results in~\cite{ref:SB03,ref:SB04} yield the following consequences of a discrete Korn inequality: \begin{equation} \label{eq:disc-Korn} \|\mathbf{v}_h\|_{L^2(\Omega)} \le C \|\mathbf{v}_h\|_{V_h} \quad \forall\, \mathbf{v}_h \in V_h, \end{equation} and \begin{equation} \label{eq:disc-Kornbis} \|\nabla_h \mathbf{v}_h\|_{L^2(\Omega)} \le C \|\mathbf{v}_h\|_{V_h} \quad \forall\, \mathbf{v}_h \in V_h, \end{equation} where $\nabla_h\mathbf{v}_h$ is the broken gradient (i.e., the local gradient in each element). Moreover, by following the work in~\cite{girRivLi2016-2,ref:lasisSulli03,buffa-ortner}, this can be generalised for all finite $p\ge 1$ when $d=2$ and all $p \in [1,6]$ when $d=3$, to \begin{equation} \label{eq:Lpbd} \|\mathbf{v}_h\|_{L^p(\Omega)} \le C(p) \|\mathbf{v}_h\|_{V_h} \quad \forall\, \mathbf{v}_h \in V_h. \end{equation} With this norm, the following compactness result holds for any sequence $\mathbf{v}_h$ in $V_h$, see~\cite{buffa-ortner,girRivLi2016-2,ref:BartelsJensenMuller}: if there exists a constant $C$ independent of $h$ such that $$\|\mathbf{v}_h\|_{V_h} \le C,$$ then there exists a function $\bar \mathbf{v} \in H^1_0(\Omega)^d$ such that for all finite $p\ge 1$ when $d=2$ and all $p \in [1,6)$ when $d=3$, \begin{equation} \label{eq:strng.lim} \lim_{h \to 0} \|\mathbf{v}_h - \bar \mathbf{v}\|_{L^p(\Omega)} = 0. \end{equation} Regarding the forms, a straightforward finite-dimensional argument shows that, for all $\mathbf{u}_h,\mathbf{v}_h,\mathbf{w}_h \in V_h$, \begin{equation} \label{eq:bdd.dh3} \Big| \sum_{e \in \Gamma_h}\int_e [\mathbf{u}_h]_e\cdot \mathbf{n}_e \{\mathbf{v}_h \cdot \mathbf{w}_h\}_e\Big| \le C \big(J_h(\mathbf{u}_h,\mathbf{u}_h)\big)^{\frac{1}{2} } \|\mathbf{v}_h\|_{L^4(\Omega)} \|\mathbf{w}_h\|_{L^4(\Omega)}, \end{equation} \begin{equation} \label{eq:bdd.dh4} \Big|\sum_{e \in \Gamma_h^i} \int_e\{\mathbf{u}_h\}_e\cdot \mathbf{n}_e [\mathbf{v}_h]_e \cdot \{\mathbf{w}_h\}_e \Big| \le C \|\mathbf{u}_h\|_{L^4(\Omega)}\big(J_h(\mathbf{v}_h,\mathbf{v}_h)\big)^{\frac{1}{2}}\|\mathbf{w}_h\|_{L^4(\Omega)}. \end{equation} Hence we have, for all $\mathbf{u}_h,\mathbf{v}_h,\mathbf{w}_h \in V_h$, \begin{align} \label{eq:bdd.dh} \begin{aligned} &\big|d_h(\mathbf{u}_h;\mathbf{v}_h,\mathbf{w}_h)\big| \le C \|\mathbf{u}_h\|_{L^4(\Omega)}\big(J_h(\mathbf{v}_h,\mathbf{v}_h)\big)^{\frac{1}{2}} \|\mathbf{w}_h\|_{L^4(\Omega)}\\ &+\Big[\|\nabla_h\mathbf{v}_h\|_{L^2(\Omega)} \|\mathbf{u}_h\|_{L^4(\Omega)} + \frac{1}{2} \big(\big(\sum_{E \in \Th} \|\di(\mathbf{u}_h)\|^2_{L^2(E)}\big)^{\frac{1}{2} } + C \big(J_h(\mathbf{u}_h,\mathbf{u}_h)\big)^{\frac{1}{2} }\Big) \|\mathbf{v}_h\|_{L^4(\Omega)}\Big] \|\mathbf{w}_h\|_{L^4(\Omega)}. \end{aligned} \end{align} Similarly, \begin{alignat}{2} \label{eq:bdd.b2h} \Big|b_{2h}(\mathbf{v}_h,q_h)\Big| &\le \Big(\big(\sum_{E \in \Th} \|\di(\mathbf{v}_h)\|^2_{L^2(E)}\big)^{\frac{1}{2} } + C \big(J_h(\mathbf{v}_h,\mathbf{v}_h)\big)^{\frac{1}{2} } \Big)\|q_h\|_{L^2(\Omega)} &&\quad \forall\, \mathbf{v}_h \in V_h, q_h \in Q_h, \\ \label{eq:bdd.ah} \Big|b_{1h}(\boldsymbol{S}_h,\mathbf{v}_h)\Big| &\le \Big(\|\boldsymbol{D}(\mathbf{v}_h)\|_h + C \big(J_h(\mathbf{v}_h,\mathbf{v}_h)\big)^{\frac{1}{2} }\Big) \|\boldsymbol{S}_h\|_{L^2(\Omega)} && \quad \forall\, \mathbf{v}_h \in V_h, \boldsymbol{S}_h \in M_h. \end{alignat} Finally, the inequality below is used in choosing $\sigma_e$. Its proof is fairly straightforward, but it is included here for the reader's convenience. \begin{prop} \label{prop:balance} For any $\mathbf{u}_h \in V_h$, any choice of $\sigma_e >0$ and any real number $\delta >0$, we have \begin{equation} \label{eqn:balance1} \Big|\sum_{e \in \Gamma_h} \int_e \{\boldsymbol{D}(\mathbf{u}_h)\}_e\mathbf{n}_e \cdot [\mathbf{u}_h]_e \Big| \le \frac{1}{2} \Big( \frac{1}{ \delta} J_h(\mathbf{u}_h,\mathbf{u}_h) + \delta \frac{C_h}{{\rm min}_{e \in \Gamma_h}\sigma_e} \|\boldsymbol{D}(\mathbf{u}_h)\|_h^2\Big), \end{equation} where \begin{equation} \label{eqn:bdd.C1} C_h:= 2d\, \hat C^2 \max\left(\max_{e \in \Gamma_h^i} \bigg(h_e \max_{j=1,2}\frac{|e|}{|E_j|}\bigg), \max_{e \in \Gamma_h^b}\left(h_e\frac{|e|}{|E|}\right)\right), \end{equation} $E_1$ and $E_2$ are the elements that share the face $e\in \Gamma_h^i$, $E$ is the element that has face $e \in \Gamma_h^b$, and $\hat C$ is the constant appearing in inequality \eqref{eq:e.to.E} solely depending on $d$ and the polynomial degree. \end{prop} \begin{proof} For a face $e\in\Gamma_h^i$, which is shared by elements $E_1$ and $E_2$, we have \begin{align*} \Big| \int_e \{\boldsymbol{D}(\mathbf{u}_h)\}_e\mathbf{n}_e \cdot [\mathbf{u}_h]_e \Big| &\le \bigg(\frac{\sigma_e}{h_e}\bigg)^{\frac{1}{2}} \|[\mathbf{u}_h]_e\|_{L^2(e)} \bigg(\frac{h_e}{\sigma_e}\bigg)^{\frac{1}{2}} \frac{\hat C}{2} \sum_{j=1}^2 \bigg(\frac{|e|}{|E_j|}\bigg)^{\frac{1}{2}} \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E_i)} \\ & \le \frac{1}{2}\bigg(\frac{1}{\delta}\frac{\sigma_e}{h_e} \|[\mathbf{u}_h]_e\|^2_{L^2(e)}+\delta\frac{h_e}{2\sigma_e} \hat C^2\max_{j=1,2}\frac{|e|}{|E_j|}\big( \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E_1)}^2 + \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E_2)}^2 \big)\bigg). \end{align*} Similarly, for $e\in\Gamma_h^b$, which is the face of an element $E$ adjacent to $\partial \Omega$, we have \begin{equation*} \Big| \int_e \{\boldsymbol{D}(\mathbf{u}_h)\}_e\mathbf{n}_e \cdot [\mathbf{u}_h]_e \Big| \le \frac{1}{2}\left(\frac{1}{\delta}\frac{\sigma_e}{h_e} \|[\mathbf{u}_h]_e\|^2_{L^2(e)}+\delta\frac{h_e}{\sigma_e} \hat C^2\frac{|e|}{|E|}\|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E)}^2\right). \end{equation*} By using the last two inequalities in \begin{equation*} \Big|\sum_{e \in \Gamma_h} \int_e \{\boldsymbol{D}(\mathbf{u}_h)\}_e\mathbf{n}_e \cdot [\mathbf{u}_h]_e \Big| \le \sum_{e\in\Gamma_h}\Big| \int_e \{\boldsymbol{D}(\mathbf{u}_h)\}_e\mathbf{n}_e \cdot [\mathbf{u}_h]_e \Big| \end{equation*} and splitting the sum on the right-hand side into sums over the disjoint sets $\Gamma_h^b$ and $\Gamma_h^i$, we have that \begin{align*} &\Big|\sum_{e \in \Gamma_h} \int_e \{\boldsymbol{D}(\mathbf{u}_h)\}_e\mathbf{n}_e \cdot [\mathbf{u}_h]_e \Big| \le \frac{1}{2}\bigg(\frac{1}{\delta}\sum_{e \in \Gamma_h^b}\frac{\sigma_e}{h_e} \|[\mathbf{u}_h]_e\|^2_{L^2(e)}+\delta\sum_{e\in \Gamma_h^b}\frac{h_e}{\sigma_e} \hat C^2\frac{|e|}{|E|}\|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E)}^2\bigg)\\ &\quad+ \frac{1}{2}\bigg(\frac{1}{\delta}\sum_{e \in \Gamma_h^i}\frac{\sigma_e}{h_e} \|[\mathbf{u}_h]_e\|^2_{L^2(e)}+\delta\sum_{e \in \Gamma_h^i}\frac{h_e}{2\sigma_e} \hat C^2\max_{j=1,2}\frac{|e|}{|E_j|}\big( \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E_1)}^2 + \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E_2)}^2 \big)\bigg) \end{align*} with the notational convention that when summing over $e \in \Gamma_h^b$ the element $E$ under the summation sign is the element adjacent to $\partial\Omega$ with face $e$, and when summing over $e \in \Gamma_h^i$ the elements $E_1$ and $E_2$ under the summation sign are the ones that share the face $e$. Hence, \begin{align*} &\Big|\sum_{e \in \Gamma_h} \int_e \{\boldsymbol{D}(\mathbf{u}_h)\}_e\mathbf{n}_e \cdot [\mathbf{u}_h]_e \Big| \le \frac{1}{2}\left(\frac{1}{\delta} J_h(\mathbf{u}_h,\mathbf{u}_h) +\frac{\delta}{\min_{e \in \Gamma_h^b}\sigma_e} \hat C^2 \max_{e \in \Gamma_h^b}\left(h_e\frac{|e|}{|E|}\right) \sum_{e\in \Gamma_h^b} \|\boldsymbol{D}(\mathbf{u}_h) \|_{L^2(E)}^2\right)\\ &\quad+ \frac{1}{2}\bigg(\frac{\delta}{\min_{e \in \Gamma_h^i}\sigma_e} \hat C^2{\rm max}_{e \in \Gamma_h^i} \bigg(h_e \max_{j=1,2}\frac{|e|}{|E_j|}\bigg)\sum_{e \in \Gamma_h^i}\frac{1}{2} \big( \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E_1)}^2 + \|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E_2)}^2 \big)\bigg). \end{align*} The asserted result \eqref{eqn:balance1} follows from the last inequality by noting that, for each $E\in\Th$, the factor $\|\boldsymbol{D}(\mathbf{u}_h)\|_{L^2(E)}^2$ appears at most $2d$ times. \end{proof} Concerning the expression appearing in \eqref{eqn:bdd.C1} we note that, thanks to the regularity assumption on the family of meshes, we have that $h_e \frac{|e|}{|E|} \le C$ and so \begin{equation} \label{e:Ch} C_h \le C. \end{equation} \subsubsection{First \emph{a priori} estimates} \label{subsec:1staprioriDG} By testing the first equation of \eqref{pb:nonconfscheme} with $\mathbf{v}_h = \mathbf{u}_h$, applying the third equation and the antisymmmetry \eqref{eq:antisym-non} of $d_h$, we obtain $$ b_{1h}({\boldsymbol{T}}_h,\mathbf{u}_h) + J_h(\mathbf{u}_h,\mathbf{u}_h) = \int_\Omega \mathbf{f} \cdot \mathbf{u}_h. $$ Next, by testing the second equation of \eqref{pb:nonconfscheme} with $\boldsymbol{S}_h = {\boldsymbol{T}}_h$ and substituting the above equality, we deduce that $$ \alpha \|{\boldsymbol{T}}_h\|^2_{L^2(\Omega)} + J_h(\mathbf{u}_h,\mathbf{u}_h) \le \int_\Omega \mathbf{f} \cdot \mathbf{u}_h. $$ Thus, in view of \eqref{eq:disc-Korn}, we have our first bound: \begin{equation} \label{eqn:1stbdd} \alpha \|{\boldsymbol{T}}_h\|^2_{L^2(\Omega)} + J_h(\mathbf{u}_h,\mathbf{u}_h) \le C\|\mathbf{f}\|_{L^2(\Omega)}\|\mathbf{u}_h\|_{V_h}. \end{equation} A further bound is arrived at by testing the second equation of \eqref{pb:nonconfscheme} with $\boldsymbol{S}_h = \boldsymbol{D}(\mathbf{u}_h)$; hence, $$\alpha\int_{\Omega}{\boldsymbol{T}}_h:\boldsymbol{D}(\mathbf{u}_h)+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h:\boldsymbol{D}(\mathbf{u}_h) = \|\boldsymbol{D}(\mathbf{u}_h)\|^2_h - \sum_{e \in \Gamma_h} \int_e \{\boldsymbol{D}(\mathbf{u}_h)\}_e\mathbf{n}_e \cdot [\mathbf{u}_h]_e. $$ Then Proposition \ref{prop:balance} gives, for any $\delta >0$, \begin{equation} \label{eqn:2ndbdd} \|\boldsymbol{D}(\mathbf{u}_h)\|^2_h \le \alpha\|{\boldsymbol{T}}_h\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{u}_h)\|_h + \gamma C_1 |\Omega|^{\frac{1}{2}}\|\boldsymbol{D}(\mathbf{u}_h)\|_h + \frac{1}{2} \Big( \frac{1}{ \delta} J_h(\mathbf{u}_h,\mathbf{u}_h) + \delta \frac{C_h}{{\rm min}_{e \in \Gamma_h}\sigma_e} \|\boldsymbol{D}(\mathbf{u}_h)\|_h^2\Big). \end{equation} We choose $\delta=1$ and, upon recalling \eqref{e:Ch}, assume that $\sigma_e$ is chosen so that \begin{equation} \label{eqn:sigma.e} {\rm min}_{e \in \Gamma_h}\sigma_e \ge C_h. \end{equation} Next, by adding $J_h(\mathbf{u}_h,\mathbf{u}_h)$ to both sides of \eqref{eqn:2ndbdd}, applying \eqref{eqn:1stbdd} to bound this term, and using the norm of $V_h$, we infer that $$ \|\mathbf{u}_h\|^2_{V_h} \le \alpha\|{\boldsymbol{T}}_h\|_{L^2(\Omega)}\|\boldsymbol{D}(\mathbf{u}_h)\|_h + \gamma C_1 |\Omega|^{\frac{1}{2}}\|\boldsymbol{D}(\mathbf{u}_h)\|_h + C\|\mathbf{f}\|_{L^2(\Omega)}\|\mathbf{u}_h\|_{V_h} + \frac{1}{2} \|\mathbf{u}_h\|^2_{V_h} $$ and thus \begin{equation} \label{eqn:3rdbdd} \frac{1}{2}\|\mathbf{u}_h\|_{V_h} \le \alpha\|{\boldsymbol{T}}_h\|_{L^2(\Omega)} + \gamma C_1 |\Omega|^{\frac{1}{2}} + C \|\mathbf{f}\|_{L^2(\Omega)}. \end{equation} To close the estimates, we return to \eqref{eqn:1stbdd} and get $$ \alpha \|{\boldsymbol{T}}_h\|^2_{L^2(\Omega)} + J_h(\mathbf{u}_h,\mathbf{u}_h) \le \frac{1}{2}\bigg(\delta_2 \|\mathbf{u}_h\|_{V_h}^2 + \frac{C^2}{\delta_2} \|\mathbf{f}\|_{L^2(\Omega)}^2\bigg) $$ for any $\delta_2 >0$. Thus $$ \alpha \|{\boldsymbol{T}}_h\|_{L^2(\Omega)} \le \frac{\sqrt{\alpha}}{\sqrt{2 \delta_2}}C\|\mathbf{f}\|_{L^2(\Omega)} + \frac{\sqrt{\alpha \delta_2}}{\sqrt{2}} \|\mathbf{u}_h\|_{V_h}, $$ and the choice $\delta_2 = \frac{1}{8\alpha}$ yields $$ \alpha \|{\boldsymbol{T}}_h\|_{L^2(\Omega)} \le 2 \alpha C \|\mathbf{f}\|_{L^2(\Omega)} + \frac{1}{4}\|\mathbf{u}_h\|_{V_h}. $$ Thus we have shown the following uniform and unconditional bounds: \begin{equation} \label{eqn:4rthbdd} \|\mathbf{u}_h\|_{V_h} \le 4 C (1+2 \alpha) \|\mathbf{f}\|_{L^2(\Omega)} + 4 \gamma C_1 |\Omega|^{\frac{1}{2}},\quad \|{\boldsymbol{T}}_h\|_{L^2(\Omega)} \le \frac{C}{\alpha}(4\alpha +1) \| \mathbf{f}\|_{L^2(\Omega)} + \frac{\gamma}{\alpha} C_1 |\Omega|^{\frac{1}{2}}. \end{equation} An \emph{a priori} estimate for the pressure requires an inf-sup condition. This is the subject of the next subsection. \subsubsection{An inf-sup condition} \label{subsec:inf-sup DG} In the nonconforming case considered here, the analogue of \eqref{infsup:b1h} reads \begin{equation} \label{infsup:b2h} \inf_{q_h\in Q_h}\sup_{\mathbf{v}_h\in V_h}\frac{b_{2h}(\mathbf{v}_h,q_h)}{\|\mathbf{v}_h\|_{V_h}\|q_h\|_{L^2(\Omega)}}\geq \beta^{*} \end{equation} with a constant $\beta^*>0$ independent of $h$. To check this condition, recall Fortin's lemma; see for instance~\cite{ref:GiR}. \begin{lem} \label{thm:lemFort} The discrete condition \eqref{infsup:b2h} holds uniformly with respect to $h$ if, and only if, there exists an approximation operator $\Pi_h \in {\mathcal L}( H^1_0(\Omega)^d ;V_h)$ such that, for all $\mathbf{v} \in H^1_0(\Omega)^d$, \begin{equation} \label{eqn:Fort1} b_{2h}(\Pi_h(\mathbf{v}) -\mathbf{v},q_h) = 0 \quad \forall\, q_h \in Q_h, \end{equation} and \begin{equation} \label{eqn:Fort2} \|\Pi_h(\mathbf{v})\|_{V_h} \le C |\mathbf{v}|_{H^1(\Omega)} \end{equation} with a constant $C$ independent of $h$. \end{lem} Originally, Fortin's lemma was stated for discrete functions in subspaces of $H^1_0(\Omega)^d$, but the extension to spaces of discontinuous functions is straightforward, as long as the form $b_{2h}(\cdot,\cdot)$ is consistent with the divergence, which is the case here. As the proof of \eqref{eqn:Fort1}, \eqref{eqn:Fort2} is fairly technical, we restrict the discussion to the first order case, i.e., $k=1$, in hexahedra. The quadrilateral case is much simpler. \subsubsection{The inf-sup condition in planar-faced hexahedra for $k=1$} \label{subsubsec:hexainf-sup} The construction of a suitable operator $\Pi_h$ is usually done by correcting a good approximation operator $R_h$. For instance, we can use the $L^2$ projection onto the space of polynomials of degree one defined locally in each element, so that $R_h(\mathbf{v})$ belongs to $V_h$ and satisfies optimal approximation properties; see for instance~\cite{BreSco}. Then $R_h(\mathbf{v})$ is corrected by constructing $\mathbf{c}_h \in V_h$ such that \begin{equation} \label{eqn:corrct1} b_{2h}(\mathbf{c}_h,q_h) = b_{2h}(R_h(\mathbf{v}) -\mathbf{v},q_h)\quad \forall\, q_h \in Q_h. \end{equation} By expanding $b_{2h}$ and denoting by $q_E$ the value of $q_h$ in $E$, \eqref{eqn:corrct1} reads $$ -\sum_{E \in \Th} q_E \int_E \di(\mathbf{c}_h) + \sum_{e \in \Gamma_h} \int_e [\mathbf{c}_h]_e\cdot \mathbf{n}_e \{q_h\}_e = -\sum_{E \in \Th} q_E \int_E \di(R_h(\mathbf{v}) -\mathbf{v}) + \sum_{e \in \Gamma_h} \int_e [R_h(\mathbf{v}) -\mathbf{v}]_e\cdot \mathbf{n}_e \{q_h\}_e. $$ Green's formula in each element yields \begin{equation} \label{eqn:corrct2} -\sum_{E \in \Th} q_E \int_{\partial E} \mathbf{c}_h\cdot \mathbf{n}_E + \sum_{e \in \Gamma_h} \int_e [\mathbf{c}_h]_e\cdot \mathbf{n}_e \{q_h\}_e = -\sum_{E \in \Th} q_E \int_{\partial E} (R_h(\mathbf{v}) -\mathbf{v})\cdot \mathbf{n}_E + \sum_{e \in \Gamma_h} \int_e [R_h(\mathbf{v}) -\mathbf{v}]_e\cdot \mathbf{n}_e \{q_h\}_e \end{equation} with $\mathbf{n}_E$ the unit exterior normal to $E$. Consider now an interior face $e$ shared by $E_1$ and $E_2$, so that $\mathbf{n}_e$ is interior to $E_2$; the contribution of $e$ to the left-hand side of \eqref{eqn:corrct2} is $$ -q_{E_1} \int_e \restriction{\mathbf{c}_h}{E_1}\cdot \mathbf{n}_e + q_{E_2} \int_e \restriction{\mathbf{c}_h}{E_2}\cdot \mathbf{n}_e + \int_e \frac{1}{2} (q_{E_1} + q_{E_2}) (\restriction{\mathbf{c}_h}{E_1}-\restriction{\mathbf{c}_h}{E_2})\cdot \mathbf{n}_e = - \int_e [q_h]_e\{\mathbf{c}_h\}_e \cdot \mathbf{n}_e $$ with a similar contribution to the right-hand side. Notice also that the contribution of a boundary face $e\in\Gamma_h^b$ is equal to zero on both sides of \eqref{eqn:corrct2}. Therefore a sufficient condition for \eqref{eqn:corrct2} is that \begin{equation} \label{eqn:corrct3} \int_e \restriction{\mathbf{c}_h}{E} \cdot \mathbf{n}_e = \int_e \restriction{(R_h(\mathbf{v}) - \mathbf{v})}{E} \cdot \mathbf{n}_e. \end{equation} We will thus construct $\mathbf{c}_h\in V_h$ by imposing \eqref{eqn:corrct3} for each element $E\in\Th$ and each face $e\in\partial E$. To simplify the notation, we will write from now on $\mathbf{c}_h$ and $(R_h(\mathbf{v})-\mathbf{v})$ instead of $\restriction{\mathbf{c}_h}{E}$ and $\restriction{(R_h(\mathbf{v}) - \mathbf{v})}{E}$, respectively. Let $E$ be an arbitrary hexahedral element of $\Th$ with faces $e_i$, centre of face $\mathbf{b}_i$, and exterior unit normal $\mathbf{n}_i$, $1 \le i \le 6$. To be specific, let $\mathbf{a}_i$, $i=1,2,3,4$, be the vertices of $e_1$, $\mathbf{a}_i$, $i=1,3,5,6$, the vertices of $e_2$, $\mathbf{a}_i$, $i=1,2,5,7$, the vertices of $e_3$, $\mathbf{a}_i$, $i=5,6,7,8$, the vertices of $e_4$, $\mathbf{a}_i$, $i=2,4,7,8$, the vertices of $e_5$, and $\mathbf{a}_i$, $i=3,4,6,8$, the vertices of $e_6$. The ordering of the nodes is illustrated in Figure \ref{fig:3D_reference}. Note that for $i=1,2,3$, $e_{i+3}$ is the face opposite to $e_i$, opposite in the sense that its intersection with $e_i$ is empty. Without loss of generality, we assume that the vertex $\mathbf{a}_1$ is located at the origin and that the face $e_1$ lies on the $x_3=0$ plane. Indeed, this situation can be obtained via a rigid motion (translation plus rotation), which preserves all normal vectors. Therefore, the normal to the face $e_1$ is parallel to the $x_3$ axis. Now, the idea is to transform $E$ onto a ``reference'' element $\hat E$ by an affine mapping ${\mathcal F}_E$ so that the subtetrahedron $S_1$ of $E$ based on $e_1$ and containing the origin $\mathbf{a}_1$ is mapped onto the unit tetrahedron $\hat S_1$. More precisely, as $e_2$ and $e_3$ are both adjacent to $e_1$, $S_1$ is the subtetrahedron with vertices $\mathbf{a}_1$, $\mathbf{a}_2$, $\mathbf{a}_3$, and $\mathbf{a}_5$, and $\hat S_1$ has vertices $\hat \mathbf{a}_1 = (0,0,0)$, $\hat \mathbf{a}_2 = (0,1,0)$, $\hat \mathbf{a}_3 = (1,0,0)$, $\hat \mathbf{a}_5 = (0,0,1)$, see Figure \ref{fig:3D_reference} for an illustration and some notation. This transformation and notation will be used till the end of this subsection. It stems from the regularity of the family of triangulations that there exists a constant $M$, independent of $E$ and $h$, such that \begin{equation} \label{eqn:diam} \mbox{diameter} (\hat E) \le M. \end{equation} \begin{figure}[htbp] \begin{center} \begin{tikzpicture} \draw [fill,gray] (0,0) circle [radius=0.05]; \draw (0.2,0) node[below,gray]{$\hat \mathbf{a}_1$}; \draw [fill] (2,0) circle [radius=0.05]; \draw (2.2,0) node[below]{$\hat \mathbf{a}_2$}; \draw [fill] (-1.41421,-1.41421) circle [radius=0.05]; \draw (-1.31421,-1.41421) node[below]{$\hat \mathbf{a}_3$}; \draw [fill] (1.2,-1.8) circle [radius=0.05]; \draw (1.3,-1.8) node[below]{$\hat \mathbf{a}_4$}; \draw [fill] (0,2) circle [radius=0.05]; \draw (0,2.1) node[left]{$\hat \mathbf{a}_5$}; \draw [fill] (-2.0,1.0) circle [radius=0.05]; \draw (-2.0,1.0) node[left]{$\hat \mathbf{a}_6$}; \draw [fill] (2.2,2.0) circle [radius=0.05]; \draw (2.2,2.0) node[right]{$\hat \mathbf{a}_7$}; \draw [fill] (1.2,0.8) circle [radius=0.05]; \draw (1.2,0.8) node[right]{$\hat \mathbf{a}_8$}; \draw (-1.41421,-1.41421) -- (1.2,-1.8) -- (2,0); \draw[dashed,gray] (2,0) -- (0,0) -- (-1.41421,-1.41421); \draw (0.2,-0.9) node[right,gray]{$\hat e_1$}; \draw (-1.41421,-1.41421) -- (-2.0,1.0) -- (0,2); \draw[dashed,gray] (0,2) -- (0,0); \draw (-0.8,-0.4) node[above,gray]{$\hat e_2$}; \draw (0,2) -- (2.2,2.0) -- (2,0); \draw (0.7,0.2) node[above,gray]{$\hat e_3$}; \draw (-2.0,1.0) -- (1.2,0.8) -- (2.2,2.0); \draw (1.2,-1.8) -- (1.2,0.8); \draw (0.2,1.4) node[right]{$\hat e_4$}; \draw (1.5,-0.6) node[above]{$\hat e_5$}; \draw (-0.2,-1.0) node[above]{$\hat e_6$}; \draw[->] (-1.41421,-1.41421) -- (-2.12132,-2.12132); \draw (-1.95,-2.3) node[left]{$\hat x_1$}; \draw[->] (2,0) -- (3,0); \draw (3,0) node[right]{$\hat x_2$}; \draw[->] (0,2) -- (0,3); \draw (0,3) node[above]{$\hat x_3$}; \end{tikzpicture} \caption{Some notation for the ``reference" element $\hat E$.} \label{fig:3D_reference} \end{center} \end{figure} The affine mapping ${\cal F}_E$ has the expression $$ \mathbf{x} = {\cal F}_E(\hat \mathbf{x}) = \boldsymbol{B} \hat \mathbf{x}, $$ where the constant term is zero since $\mathbf{a}_1$ is the origin, and the matrix $\boldsymbol{B}$ is nonsingular; its columns are respectively $\mathbf{a}_3=(a_3^1,a_3^2,0)^t$, $\mathbf{a}_2=(a_2^1,a_2^2,0)^t$ and $\mathbf{a}_5 = (a_5^1,a_5^2,a_5^3)^t$. The image of the remaining vertices of $E$ are $\hat \mathbf{a}_i = {\cal F}^{-1}_E(\mathbf{a}_i)$, $i=4, 6, 7, 8$. As ${\cal F}_E$ is an affine transformation, it transforms faces onto faces, edges onto edges, and vertices onto vertices. Thus, since $\mathbf{a}_4$ is in the plane $x_3 = 0$, then $\hat\mathbf{a}_4$ is in the plane $\hat x_3 = 0$. Likewise, $\hat \mathbf{a}_6$ is in the plane $\hat x_2 = 0$, $\hat \mathbf{a}_7$ in the plane $\hat x_1 = 0$, and $\hat \mathbf{a}_8$ in the plane determined by $\hat \mathbf{a}_4$, $\hat \mathbf{a}_2$, $\hat \mathbf{a}_7$, as well as the plane determined by $\hat \mathbf{a}_7$, $\hat \mathbf{a}_5$, $\hat \mathbf{a}_6$, and the plane determined by $\hat \mathbf{a}_6$, $\hat \mathbf{a}_3$, $\hat \mathbf{a}_4$, hence in the intersection of these three planes. Therefore $\hat E$ is located in the first octant of $\mathbb{R}^3$. Let $\hat\mathbf{n}_i$ denote the unit exterior normal vector to $\hat e_i$. It is related to $\mathbf{n}_i$ by the general formula \begin{equation} \label{eqn:def_hat_n_3D} \hat \mathbf{n}_i = \frac{ \boldsymbol{B}^t \mathbf{n}_i }{|\boldsymbol{B}^t \mathbf{n}_i|}. \end{equation} \noindent The advantage of having $e_1$ on the plane $x_3 =0$ is that $\hat \mathbf{n}_1 =\mathbf{n}_1=(0,0,-1)^t$. We also have $\hat \mathbf{n}_2=(0,-1,0)^t$, and $\hat \mathbf{n}_3=(-1,0,0)^t$. Thus \begin{equation} \label{eq:nu03D1} |\hat n_1^3| = |\hat n_2^2|= |\hat n_3^1| =1, \end{equation} and the regularity of the family $\Th$ implies that there exists a constant $\nu_0$, independent of $h$ and $E$, such that \begin{equation} \label{eq:nu03D} |\hat n_4^3|, |\hat n_5^2|, |\hat n_6^1| \ge \nu_0. \end{equation} With this transformation, and after cancelling $| {\rm det} \boldsymbol{B}|$ on both sides, \eqref{eqn:corrct3} reads locally $$ \int_{\hat e} \hat \mathbf{c}_{ h } \cdot (\boldsymbol{B}^t)^{-1}\hat \mathbf{n}_{\hat e} = \int_{\hat e} (\widehat{R_h}(\hat \mathbf{v}) - \hat \mathbf{v}) \cdot (\boldsymbol{B}^t)^{-1}\hat \mathbf{n}_{\hat e} , $$ where the hat denotes composition with ${\cal F}_E$. Thus, by performing the change of variable $$\hat \mathbf{d}_h = \boldsymbol{B}^{-1}\hat \mathbf{c}_{ h } $$ and defining the face moment $$ m_{\hat e} (f) := \frac{1}{|\hat e|} \int_{\hat e} f, $$ \eqref{eqn:corrct3} is equivalent to \begin{equation} \label{eqn:corrct43D} m_{\hat e_i}(\hat \mathbf{d}_{ h }) \cdot \hat \mathbf{n}_i = \hat g_i : = \frac{1}{|\hat e_i|} \int_{\hat e_i} \boldsymbol{B}^{-1}(\widehat{R_h}(\hat \mathbf{v}) - \hat \mathbf{v}) \cdot \hat \mathbf{n}_i,\quad 1 \le i \le 6. \end{equation} This is a linear system of six equations in twelve unknowns, the coefficients of $\hat \mathbf{d}_{ h }$. Therefore, we can freely choose six coefficients and we have the following existence lemma. \begin{lem} \label{lem:const-correction} There exists exactly one polynomial vector $\hat \mathbf{d}_h = (\hat d_1,\hat d_2,\hat d_3)^{ t }$ that satisfies \eqref{eqn:corrct43D} and the following six conditions: \begin{equation} \label{eq:zero.d_h} m_{\hat e_1} (\hat d_1) = m_{\hat e_5} (\hat d_1)= m_{\hat e_1} (\hat d_2)= m_{\hat e_6} (\hat d_2)=m_{\hat e_5} (\hat d_3)=m_{\hat e_6} ( \hat d_3) =0. \end{equation} \end{lem} \begin{proof} Once the six conditions \eqref{eq:zero.d_h} are prescribed, we are left with a square linear system of six equations in six unknowns. Therefore it suffices to prove that the only solution of the corresponding homogeneous system is the zero solution. To begin with, we consider the lines $i=5$ and $i=6$ in \eqref{eqn:corrct43D}. In view of \eqref{eq:nu03D1} and \eqref{eq:nu03D}, the strategy for the choice \eqref{eq:zero.d_h} is to set to zero the coefficients of $\hat n_6^2$ and $\hat n_6^3$ and those of $\hat n_5^1$ and $\hat n_5^3$, i.e., prescribe $m_{\hat e_5} (\hat d_1)= m_{\hat e_6} (\hat d_2)=m_{\hat e_5} (\hat d_3)=m_{\hat e_6} ( \hat d_3) =0$. With this assumption, the lines $i=6$ and $i=5$ reduce respectively to \begin{equation} \label{eq:i=6-5} m_{\hat e_6}(\hat d_1) = 0,\quad m_{\hat e_5}(\hat d_2) = 0. \end{equation} Next, we consider the line $i=1$. As $\hat n_1^3 = - 1$ is the only nonzero component, it reduces to \begin{equation} \label{eq:i=1} m_{\hat e_1}(\hat d_3) = 0. \end{equation} Similarly, when $i=2$ and $i=3$ we have, respectively \begin{equation} \label{eq:i=2} m_{\hat e_2}(\hat d_2) = 0, \quad m_{\hat e_3}(\hat d_1) = 0. \end{equation} Collecting these results and the two extra assumptions $m_{\hat e_1} (\hat d_1) = m_{\hat e_1} (\hat d_2)=0$ in \eqref{eq:zero.d_h}, we find that $$m_{\hat e_1}(\hat d_1) = m_{\hat e_5}(\hat d_1) = m_{\hat e_6}(\hat d_1) = m_{\hat e_3}(\hat d_1) = 0$$ $$m_{\hat e_1}(\hat d_2) = m_{\hat e_5}(\hat d_2) = m_{\hat e_6}(\hat d_2) = m_{\hat e_2}(\hat d_2) =0. $$ The three faces $\hat e_1$, $\hat e_5$, $\hat e_6$ share the vertex $\hat\mathbf{a}_4$, and the regularity of the hexahedron implies that the three vectors along the segments $[\hat\mathbf{a}_4,\hat\mathbf{a}_3]$, $[\hat\mathbf{a}_4,\hat\mathbf{a}_8]$, and $[\hat\mathbf{a}_4,\hat\mathbf{a}_2]$ is a set of three linearly independent vectors of $\polR^3$. Then the regularity of the hexahedron implies that a polynomial of degree one is uniquely determined by its moments on the four faces $\hat e_1$, $\hat e_5$, $\hat e_6$, $\hat e_i$ for any $i$ in the set $\{2,3,4\}$. Hence, as $\hat d_1$ (respectively, $\hat d_2$) is a polynomial of degree one, the first set (respectively, second set) of equalities and the regularity of the hexahedron imply that $\hat d_1 = 0$, respectively, $\hat d_2=0$. When $i=4$, this leads to $m_{\hat e_4}(\hat d_3) = 0$. Consequently, $$m_{\hat e_1}(\hat d_3) = m_{\hat e_5}(\hat d_3) = m_{\hat e_6}(\hat d_3) = m_{\hat e_4}(\hat d_3) =0, $$ and $\hat d_3=0$. Thus $\hat \mathbf{d}_h = { \bf 0}$ and the system has a unique solution. \end{proof} Let $\boldsymbol{M}_{\hat E}$ be the $6 \times 6$ matrix of the system \eqref{eqn:corrct43D} under the restriction \eqref{eq:zero.d_h}. It stems from Lemma \ref{lem:const-correction} that $\boldsymbol{M}_{\hat E}$ is nonsingular. Furthermore, the regularity of the hexahedron implies that $\boldsymbol{M}_{\hat E}$ is a continuous function of $\hat E$, thus continuous in a compact set of $\polR^3$. Hence the norm of its inverse is bounded by a constant $\hat C$, independent of $\hat E$, \begin{equation} \label{eqn:norm.invM} |\boldsymbol{M}^{-1}_{\hat E} | \le \hat C. \end{equation} The stability of the correction follows now easily. \begin{lem} \label{lem:stab-correction} There exists a constant $\hat C$, independent of $h$ and $E$, such that for all $E$ in $\Th$ and all $e$ in $\Gamma_h$, \begin{equation} \label{eq:localhat_c} \|\mathbf{c}_{ h }\|_{L^2(E)} \le \hat C\,h_E\, |\mathbf{v}|_{H^1(E)},\quad | \mathbf{c}_{ h }|_{H^1(E)}\le \hat C |\mathbf{v}|_{H^1(E)}, \quad \bigg( \frac{\sigma_e}{h_e} \bigg)^{\frac{1}{2}} \|[\mathbf{c}_{ h }]_e\|_{L^2(e)} \le \hat C \big(|\mathbf{v}|_{H^1(E_1)} + |\mathbf{v}|_{H^1(E_2)}\big), \end{equation} where $E_1$ and $E_2$ are the two elements sharing $e$, when $e$ is an interior face, and the sum is reduced to one term, namely the element $E$ adjacent to $e$, when $e$ is a boundary face. \end{lem} \begin{proof} The notation $\hat C$ below refers to different constants that are all independent of $h$ and $E$. Recalling \eqref{eqn:corrct43D}, \eqref{eqn:diam} and the transformation from $\hat S_1$ onto $S_1$, we observe that, for any $i$, $$|\hat g_i| \le \frac{\hat C}{\varrho_{S_1}} \|\widehat{R_h}(\hat \mathbf{v}) - \hat \mathbf{v}\|_{L^1(\hat e_i)}\le \frac{\hat C}{\varrho_{S_1}} \|\widehat{R_h}(\hat \mathbf{v}) - \hat \mathbf{v}\|_{L^2(\hat e_i)}. $$ By a trace inequality in $\hat E$ and the approximation property of $\widehat{R_h}$ in $\hat E$, we have $$ \sum_{i=1}^6 \|\widehat{R_h}(\hat \mathbf{v}) - \hat \mathbf{v}\|_{L^2(\hat e_i)} \le \hat C \|\widehat{R_h}(\hat \mathbf{v}) - \hat \mathbf{v}\|_{H^1(\hat E)} \le \hat C |\hat \mathbf{v}|_{H^1(\hat E)}. $$ Then, by reverting to $E$, $$\sum_{i=1}^6 \|\widehat{R_h}(\hat \mathbf{v}) - \hat \mathbf{v}\|_{L^2(\hat e_i)} \le \hat C\frac{h_{S_1}}{|E|^{\frac{1}{2}}} |\mathbf{v}|_{H^1( E)}. $$ In view of \eqref{eqn:norm.invM} and the regularity of the family $\Th$, the above relations lead to the following bound on $\hat \mathbf{d}_h$: $$ \|\hat \mathbf{d}_h\|_{L^\infty( \hat E)} \le \frac{\hat C}{|E|^{\frac{1}{2}}}\frac{h_{S_1}}{\varrho_{S_1}} |\mathbf{v}|_{H^1( E)} \le \frac{\hat C}{|E|^{\frac{1}{2}}} |\mathbf{v}|_{H^1( E)}; $$ with $\hat \mathbf{c}_{ h } = \boldsymbol{B}\hat \mathbf{d}_h$, this yields \begin{equation} \label{eq:bddhatc} \|\mathbf{c}_h\|_{L^\infty(E)} = \|\hat \mathbf{c}_h\|_{L^\infty(\hat E)} \le \hat C\frac{h_{S_1}}{|E|^{\frac{1}{2}}} |\mathbf{v}|_{H^1( E)}. \end{equation} Since $h_{S_1} < h_E$, we immediately deduce from \eqref{eq:bddhatc} the first two inequalities in \eqref{eq:localhat_c}. Finally, the third inequality follows from \eqref{eq:bddhatc} and $$ \bigg( \frac{\sigma_e}{h_e} \bigg)^{\frac{1}{2}} \|\mathbf{c}_{ h }\|_{L^2(e)} \le \bigg( \frac{\sigma_e}{h_e} \bigg)^{\frac{1}{2}} |e|^{\frac{1}{2}} \|\mathbf{c}_h\|_{L^\infty(E)}. $$ That completes the proof of the lemma. \end{proof} As a consequence of Lemma \ref{lem:stab-correction} we have the following bounds: \begin{equation} \label{eq:globalhat_c} \|\mathbf{c}_{ h }\|_{L^2(\Omega)} \le \hat C\,h\, |\mathbf{v}|_{H^1(\Omega)},\quad \| \mathbf{c}_{h }\|_{V_h}\le \hat C|\mathbf{v}|_{H^1(\Omega)}. \end{equation} Finally, since the construction of Lemma \ref{lem:const-correction} yields a unique correction, it is easy to check that the mapping $\mathbf{v} \mapsto \mathbf{c}_{ h }$ defines a linear operator from $V_{ h }$ into itself, i.e., $\mathbf{c}_{ h } = \mathbf{c}_{ h }(\mathbf{v})$. On the other hand, we infer from standard approximation properties of $R_h$ and the regularity of the mesh, that \begin{align} \label{eq:localRh} \begin{aligned} \| \mathbf{v} - R_h(\mathbf{v})\|_{L^2(E)} \le \hat C\,h_E\, &|\mathbf{v}|_{H^1(E)},\quad |R_h(\mathbf{v})|_{H^1(E)}\le \hat C|\mathbf{v}|_{H^1(E)},\\ \bigg(\frac{\sigma_e}{h_e} \bigg)^{\frac{1}{2}}\|[R_h(\mathbf{v})]_e\|_{L^2(e)} &\le \hat C \big(|\mathbf{v}|_{H^1(E_1)} + |\mathbf{v}|_{H^1(E_2)}\big) \end{aligned} \end{align} and \begin{equation} \label{eq:globalRh} \| \mathbf{v}- R_h(\mathbf{v})\|_{L^2(\Omega)} \le \hat C\,h\, |\mathbf{v}|_{H^1(\Omega)},\quad \| R_h(\mathbf{v})\|_{V_h}\le \hat C|\mathbf{v}|_{H^1(\Omega)}. \end{equation} Thus $\Pi_h(\mathbf{v}) = R_h(\mathbf{v}) - \mathbf{c}_h(\mathbf{v})$ satisfies the conditions \eqref{eqn:Fort1} and \eqref{eqn:Fort2} of Lemma \ref{thm:lemFort}. This proves the inf-sup condition as stated in the next theorem. \begin{thm} \label{thm:inf-sup3D} Let the family of hexahedra $\Th$ be regular in the sense defined above. Then the form $b_{2h}$ defined in \eqref{eq:b2hnon} with the pair spaces $V_h$ and $Q_h$ for $k=1$, see \eqref{eq:Vhnon-k} and \eqref{eq:Qhnon-k}, satisfies the inf-sup condition \eqref{infsup:b2h} with a constant $\beta^*>0$ independent of $h$. \end{thm} \subsubsection{A bound on the pressure} \label{subsubsec:DG-pressurebound} As usual, the inf-sup condition \eqref{infsup:b2h} yields a bound on the pressure. Indeed, it follows from the first equation of \eqref{pb:nonconfscheme} together with \eqref{eq:bdd.ah}, \eqref{eq:bdd.dh}, \eqref{eq:disc-Kornbis} and \eqref{eq:Lpbd} that $$ |b_{2h}(\mathbf{v}_h,p_h)| \le C\big(\|{\boldsymbol{T}}_h\|_{L^2(\Omega)} + \|\mathbf{u}_h\|_{V_h}+ \|\mathbf{u}_h\|_{V_h}^2 + \|\mathbf{f} \|_{L^2(\Omega)}\big) \|\mathbf{v}_h\|_{V_h}. $$ Then \eqref{eqn:4rthbdd} implies, with a constant $C$ independent of $h$ (but depending on $\alpha$), that $$ |b_{2h}(\mathbf{v}_h,p_h)| \le C\, \|\mathbf{v}_h\|_{V_h} \quad \forall\, \mathbf{v}_h \in V_h. $$ With the inf-sup condition \eqref{infsup:b2h}, this implies that \begin{equation} \label{eq:bddpDG} \|p_h\|_{L^2(\Omega)} \le C, \end{equation} for another constant $C$ independent of $h$. \subsubsection{Existence and convergence} \label{subsec:conv_DG} The proof of existence of a solution of \eqref{pb:nonconfscheme} is the same as in the conforming case. Recall that the case of interest is $k=1$, which is assumed for the remainder of this subsection, but all of what follows can be straightforwardly extended to a general polynomial degree $k\ge 1$ as long as the inf-sup condition \eqref{infsup:b2h} holds. First, the problem is reduced to one equation by testing the first equation of \eqref{pb:nonconfscheme} with $\mathbf{v}_h \in V_{h,0}$ and by observing that the second equation determines for each $\mathbf{u}_h \in V_h$ a unique ${\boldsymbol{T}}_h$ in $M_h$. This is expressed by writing ${\boldsymbol{T}}_h = {\mathcal G}_{h,DG}(\mathbf{u}_h)$. Then, \eqref{pb:nonconfscheme} is equivalent to finding a $\mathbf{u}_h \in V_{h,0}$ such that \begin{equation} \label{eq:reducedDG} d_h(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h) + b_{1h}({\mathcal G}_{h,DG}(\mathbf{u}_h),\mathbf{v}_h) + J_h(\mathbf{u}_h,\mathbf{v}_h) = \int_{\Omega}\mathbf{f}\cdot\mathbf{v}_h\quad \forall\, \mathbf{v}_h\in V_{h,0}. \end{equation} By means of the \emph{a priori} estimates \eqref{eqn:4rthbdd}, existence of a solution is deduced by Brouwer's fixed point theorem. Regarding convergence, the \emph{a priori} estimates \eqref{eqn:4rthbdd} and \eqref{eq:bddpDG} together with \eqref{eq:strng.lim} imply that there exist functions $\bar {\boldsymbol{T}} \in L^2(\Omega)_{{\rm sym}}^{d\times d}$, $\bar \mathbf{u} \in H^1_0(\Omega)^d$, and $\bar p \in L^2_0(\Omega)$ such that, up to subsequences, $$ \lim_{h \to 0} \|\mathbf{u}_h - \bar \mathbf{u}\|_{L^q(\Omega)} = 0\quad \mbox{with }1\leq q < \infty\; \mbox{ if }\, d=2, \mbox{ and }1 \leq q < 6\; \mbox{ if }\, d=3,$$ $$ \lim_{h \to 0}{\boldsymbol{T}}_h = \bar {\boldsymbol{T}} \quad \mbox{weakly in } L^2(\Omega)^{d \times d}, $$ and $$ \lim_{h \to 0} p_h = \bar p \quad \mbox{weakly in } L^2(\Omega). $$ However, in order to pass to the limit in the equations of the scheme, following~\cite{ref:DipietroErn}, we need to introduce discrete differential operators related to distributional differential operators. These are $G_h^{\rm sym}(\mathbf{v}_h)\in M_h$ and $G_h^{\rm div}(\mathbf{v}_h) \in \Theta_h$, defined for all $\mathbf{v}_h \in V_h$ by, respectively, \begin{equation} \label{eq:Ghsym} \int_\Omega G_h^{\rm sym}(\mathbf{v}_h) : \boldsymbol{R}_h = b_{1h}(\boldsymbol{R}_h,\mathbf{v}_h) = \sum_{E\in \Th}\int_E \boldsymbol{D}(\mathbf{v}_h):\boldsymbol{R}_h - \sum_{e \in \Gamma_h} \int_e [\mathbf{v}_h]_e\cdot\{ \boldsymbol{R}_h \}_e \mathbf{n}_e \quad \forall\, \boldsymbol{R}_h \in M_h, \end{equation} \begin{equation} \label{eq:Ghdiv} \int_\Omega G_h^{\rm div}(\mathbf{v}_h)\, r_h = b_{2h}(\mathbf{v}_h, r_h) = - \sum_{E\in \Th}\int_E r_h \di(\mathbf{v}_h) + \sum_{e \in \Gamma_h} \int_e [\mathbf{v}_h]_e \cdot \mathbf{n}_e \{ r_h \}_e \quad \forall\, r_h \in \Theta_h, \end{equation} where $$ \Theta_h =\{ \theta_h \in L^2(\Omega): \, \restriction{ \theta_h }{E} \in \polP_1\quad \forall\, E \in \Th\}. $$ The polynomial degree one in this space is convenient for proving the convergence of the nonlinear term; see \eqref{eq:Gh.deg1}. The straightforward scaling argument used in proving Proposition \ref{prop:balance} shows that \begin{equation} \label{eq:bddGhsym} \|G_h^{\rm sym}(\mathbf{v}_h)\|_{L^2(\Omega)} \le C\,\|\mathbf{v}_h\|_{V_h}\quad \forall\, \mathbf{v}_h \in V_h, \end{equation} and $$ \|G_h^{\rm div}(\mathbf{v}_h)\|_{L^2(\Omega)} \le \Big(\sum_{E\in \Th} \|\di(\mathbf{v}_h)\|^2_{L^2( E )}\Big)^{\frac{1}{2}} + C\, J_h(\mathbf{v}_h,\mathbf{v}_h)^{\frac{1}{2}}, $$ and thus by \eqref{eq:disc-Kornbis} \begin{equation} \label{eq:bddGhdiv} \|G_h^{\rm div}(\mathbf{v}_h)\|_{L^2(\Omega)} \le C\|\mathbf{v}_h\|_{V_h}\quad \forall\, \mathbf{v}_h \in V_h \end{equation} with different constants $C$ independent of $h$. At the same time, this gives existence of these two operators. The next proposition relates $G_h^{\rm sym}(\mathbf{u}_h)$ and $\boldsymbol{D}(\bar\mathbf{u})$. The proof is an easy extension of that written in~\cite{ref:DipietroErn}, but we include it below for the reader's convenience. \begin{prop} \label{prop: Ghsym-eps(u)} Up to a subsequence, we have \begin{equation} \label{eq:convGhsym} \lim_{h \to 0}G_h^{\rm sym}(\mathbf{u}_h) = \boldsymbol{D}(\bar\mathbf{u}) \quad \emph{weakly in } L^2(\Omega)^{d \times d}. \end{equation} \end{prop} \begin{proof} On the one hand, the bounds \eqref{eq:bddGhsym} and \eqref{eqn:4rthbdd} imply that there exists a function $\bar \mathbf{w} \in L^2(\Omega)_{\rm sym}^{ d\times d}$ such that, up to a subsequence, \begin{equation} \label{eq:vw} \lim_{h \to 0}G_h^{\rm sym}(\mathbf{u}_h) = \bar\mathbf{w} \quad \mbox{weakly in } L^2(\Omega)^{d \times d}. \end{equation} On the other hand, take any tensor $\boldsymbol{F}$ in $H^1(\Omega)^{d \times d}_{\rm sym}$ and let $P_h^0(\boldsymbol{F})$ be its orthogonal $L^2(\Omega)^{d \times d}$ projection on constants in each $E$. We have $$ \Big| \int_\Omega G_h^{\rm sym}(\mathbf{u}_h): \big(\boldsymbol{F} - P_h^0(\boldsymbol{F})\big) \Big| \le C \|\mathbf{u}_h\|_{V_h} \|\boldsymbol{F} - P_h^0(\boldsymbol{F})\|_{L^2(\Omega)}, $$ that tends to zero with $h$. Therefore, the definition \eqref{eq:Ghsym} of $G_h^{\rm sym}(\mathbf{u}_h)$ implies that $$ \lim_{h \to 0} \int_\Omega G_h^{\rm sym}(\mathbf{u}_h): \boldsymbol{F} = \lim_{h \to 0} b_{1h}(P_h^0(\boldsymbol{F}),\mathbf{u}_h) = \lim_{h \to 0}\big(b_{1h}(P_h^0(\boldsymbol{F})- \boldsymbol{F},\mathbf{u}_h) + b_{1h}(\boldsymbol{F},\mathbf{u}_h)\big) $$ and a straightforward argument yields that the first term tends to zero. Hence $$ \lim_{h \to 0} \int_\Omega G_h^{\rm sym}(\mathbf{u}_h): \boldsymbol{F} = \lim_{h \to 0} b_{1h}(\boldsymbol{F},\mathbf{u}_h) \quad \forall\, \boldsymbol{F} \in H^1(\Omega)^{d \times d}_{\rm sym}. $$ Now, an application of Green's formula in each $E$ gives $$ b_{1h}(\boldsymbol{F},\mathbf{u}_h) = - \sum_{E\in \Th}\int_E \mathbf{u}_h \cdot \di(\boldsymbol{F}). $$ Therefore $$ \lim_{h \to 0} \int_\Omega G_h^{\rm sym}(\mathbf{u}_h): \boldsymbol{F} = -\int_\Omega \bar \mathbf{u} \cdot \di(\boldsymbol{F}) = \int_{\Omega} \boldsymbol{D}(\bar\mathbf{u}) : \boldsymbol{F}\quad \forall\, \boldsymbol{F} \in H^1_0(\Omega)^{d \times d}_{\rm sym}. $$ A comparison with \eqref{eq:vw} and uniqueness of the limit yield $$ \boldsymbol{D}(\bar\mathbf{u}) = \bar \mathbf{w}, $$ thus proving \eqref{eq:convGhsym}. \end{proof} \begin{remark} \label{rem:baruH10} {\rm The fact that $ \bar \mathbf{u} $ belongs to $H^1_0(\Omega)^d$ is an easy consequence of the above proof.} \end{remark} A similar argument to the one in Proposition \ref{prop: Ghsym-eps(u)} gives that \begin{equation} \label{eq:limGhdiv} \lim_{h \to 0}G_h^{\rm div}(\mathbf{u}_h) = \di(\bar\mathbf{u}) \quad \mbox{weakly in } L^2(\Omega). \end{equation} Hence, by passing to the limit in the last equation of \eqref{pb:nonconfscheme}, we immediately deduce that $\di( \bar \mathbf{u} ) = 0$; thus $ \bar \mathbf{u} $ belongs to $\mathcal{V}}% {V_{\di}$ and satisfies the third equation of \eqref{pb:weak_cont}. In the next theorem, these results are used to show that the limit satisfies the remaining equations of \eqref{pb:weak_cont}. \begin{thm} \label{thm:identification} Let the family of hexahedra $\Th$ be regular in the sense defined above. Then the triple $( \bar {\boldsymbol{T}}, \bar \mathbf{u} , \bar p)$ solves \eqref{pb:weak_cont}. \end{thm} \begin{proof} The proof proceeds in two steps. \textbf{Step 1}. Let us start with the first equation of \eqref{pb:nonconfscheme}. Take a function $\mathbf{v} \in \calD(\Omega)^d$ and let $\mathbf{v}_h \in V_h$ be the $L^2(\Omega)^d$ orthogonal projection of $\mathbf{v}$ on $\polP_1^d$ in each element. It is easy to check that $$ \lim_{h \to 0}G_h^{\rm sym}(\mathbf{v}_h) = \boldsymbol{D}(\mathbf{v}) \quad \mbox{strongly in } L^2(\Omega)^{d\times d}. $$ Therefore the weak convergence of ${\boldsymbol{T}}_h$ and the definition of $G_h^{\rm sym}(\mathbf{v}_h)$ imply that $$ \lim_{h \to 0} b_{1h}({\boldsymbol{T}}_h,\mathbf{v}_h) = \int_{\Omega} \boldsymbol{D}(\mathbf{v}):\bar {\boldsymbol{T}}. $$ Similarly, $$ \lim_{h \to 0}b_{2h}(\mathbf{v}_h,p_h) = -\int_\Omega \bar p \di(\mathbf{v}). $$ Also $$ \lim_{h \to 0} J_h(\mathbf{u}_h,\mathbf{v}_h) = 0. $$ As the right-hand side tends to $\int_{\Omega}\mathbf{f}\cdot\mathbf{v}$, it remains to examine $d_h(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h)$. Recall that $$ d_h(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h) = \sum_{E \in \Th} \int_E \left[ (\mathbf{u}_h\cdot\nabla)\mathbf{u}_h \right] \cdot \mathbf{v}_h - \frac{1}{2} b_{2h}(\mathbf{u}_h, \mathbf{u}_h \cdot \mathbf{v}_h)- \sum_{e \in \Gamma_h^i} \int_e\{\mathbf{u}_h\}_e\cdot \mathbf{n}_e [\mathbf{u}_h]_e \cdot \{\mathbf{v}_h\}_e. $$ Thanks to the antisymmetry of $d_h$, we have \begin{equation} \label{eq:dh.deg1} d_h(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h) = -\sum_{E \in \Th} \int_E [ (\mathbf{u}_h\cdot\nabla)\mathbf{v}_h ] \cdot \mathbf{u}_h + \frac{1}{2} b_{2h}(\mathbf{u}_h, \mathbf{u}_h \cdot \mathbf{v}_h)+ \sum_{e \in \Gamma_h^i } \int_e\{\mathbf{u}_h\}_e\cdot \mathbf{n}_e [\mathbf{v}_h]_e \cdot \{\mathbf{u}_h\}_e. \end{equation} For the first term, the strong convergence of $\mathbf{u}_h$ in $L^4(\Omega)^d$ and the strong convergence of the broken gradient $\nabla_h\mathbf{v}_h$ in $L^2(\Omega)^{ d\times d }$ imply that $$ -\lim_{h \to 0} \sum_{E \in \Th} \int_E [ (\mathbf{u}_h\cdot\nabla)\mathbf{v}_h ] \cdot \mathbf{u}_h = -\int_\Omega [ (\bar \mathbf{u}\cdot\nabla)\mathbf{v} ] \cdot \bar \mathbf{u} = \int_\Omega [ (\bar \mathbf{u}\cdot\nabla) \bar \mathbf{u} ] \cdot \mathbf{v} , $$ since $\bar \mathbf{u} \in \mathcal{V}}% {V_{\di}$. For the second term, take any piecewise constant approximation $\bar \mathbf{v}_h$ of $\mathbf{v}$. Then $$ b_{2h}(\mathbf{u}_h, \mathbf{u}_h \cdot \mathbf{v}_h) = b_{2h}(\mathbf{u}_h, \mathbf{u}_h \cdot (\mathbf{v}_h-\bar \mathbf{v}_h)) + b_{2h}(\mathbf{u}_h, \mathbf{u}_h \cdot \bar \mathbf{v}_h). $$ The boundedness of $\mathbf{u}_h$ in $V_h$ and the convergence to zero of $\mathbf{v}_h-\bar \mathbf{v}_h$ in $L^\infty (\Omega)^d$ imply that the first term tends to zero. For the second term, we deduce from the definition of $G_h^{\rm div}(\mathbf{u}_h)$ that \begin{equation} \label{eq:Gh.deg1} b_{2h}(\mathbf{u}_h, \mathbf{u}_h \cdot \bar \mathbf{v}_h) = \int_\Omega G_h^{\rm div}(\mathbf{u}_h) (\mathbf{u}_h \cdot \bar \mathbf{v}_h). \end{equation} As $\di(\bar \mathbf{u}) = 0$, $G_h^{\rm div}(\mathbf{u}_h)$ tends to zero weakly in $L^2(\Omega)$. Then the strong convergence of $\mathbf{u}_h$ in $L^2(\Omega)^d$ and that of $\bar \mathbf{v}_h$ in $L^\infty (\Omega)^d$ show that this second term tends to zero. It remains to examine the last term of \eqref{eq:dh.deg1}. Here we use the fact that, for any $\mathbf{v} \in W^{2,\infty}(\Omega)^d$, $$ \|\mathbf{v}_h -\mathbf{v}\|_{L^\infty(e)} \le C h_e^2 | \mathbf{v}|_{W^{2,\infty}(\Omega)}. $$ This, with the boundedness of $\mathbf{u}_h$ in $V_h$, gives that this last term tends to zero. Thus, we conclude that $$ \lim_{h \to 0}d_h(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h) = \int_\Omega [(\bar \mathbf{u}\cdot\nabla)\bar \mathbf{u}]\cdot \mathbf{v} \quad \forall\, \mathbf{v} \in W^{2,\infty}(\Omega)^d\cap H^1_0(\Omega)^d. $$ The conclusion of these limits and a density argument is that the triple $(\bar {\boldsymbol{T}},\bar \mathbf{u},\bar p)$ satisfies the first equation of \eqref{pb:weak_cont} \begin{equation} \label{eq:limit.balance} \int_\Omega [ (\bar \mathbf{u}\cdot\nabla)\bar \mathbf{u} ] \cdot \mathbf{v} + \int_{\Omega} \bar {\boldsymbol{T}}:\boldsymbol{D}(\mathbf{v}) -\int_\Omega \bar p \di(\mathbf{v}) = \int_{\Omega}\mathbf{f}\cdot\mathbf{v} \quad \forall\, \mathbf{v} \in H^1_0(\Omega)^d. \end{equation} \textbf{Step 2}. The argument for recovering the constitutive relation $\bar {\boldsymbol{T}} = {\cal G}(\bar \mathbf{u})$ is close to that for the conforming case, up to some changes. On the one hand, we observe that $$ \lim_{h \to 0} \big( b_{1h}({\boldsymbol{T}}_h,\mathbf{u}_h) + J_h(\mathbf{u}_h, \mathbf{u}_h) \big) = \int_\Omega \mathbf{f} \cdot \bar \mathbf{u} $$ and, since $J_h(\mathbf{u}_h, \mathbf{u}_h)$ is positive and bounded, this implies that $$ \lim_{h \to 0} b_{1h}({\boldsymbol{T}}_h,\mathbf{u}_h) \le \int_\Omega \mathbf{f} \cdot \bar \mathbf{u}. $$ On the other hand, we infer from \eqref{eq:limit.balance} that $$ \int_{\Omega} \bar {\boldsymbol{T}}:\boldsymbol{D}(\bar \mathbf{u}) = \int_{\Omega}\mathbf{f}\cdot \bar \mathbf{u}. $$ Hence \begin{equation} \label{eq:limit.ah} \lim_{h \to 0} b_{1h}({\boldsymbol{T}}_h,\mathbf{u}_h) \le \int_{\Omega} \boldsymbol{D}(\bar\mathbf{u}) : \bar {\boldsymbol{T}}. \end{equation} Next, we set $$ \tilde {\boldsymbol{T}}^\bd = {\cal G}(\bar \mathbf{u}) $$ and define $\tilde {\boldsymbol{T}}_h = {\cal G}_{h,DG}(\bar \mathbf{u})$, i.e., $$ \alpha\int_{\Omega}\tilde {\boldsymbol{T}}_h:\boldsymbol{S}_h+\gamma\int_{\Omega}\mu(|\tilde {\boldsymbol{T}}_h|)\tilde {\boldsymbol{T}}_h:\boldsymbol{S}_h = b_{1h}(\boldsymbol{S}_h,\bar\mathbf{u}) = \int_{\Omega} \boldsymbol{D}(\bar \mathbf{u}) : \boldsymbol{S}_h \quad \forall\, \boldsymbol{S}_h\in M_h, $$ where the second equality holds thanks to the fact that $\bar \mathbf{u}$ belongs to $H^1_0(\Omega)^d$. The fact that $\di(\bar \mathbf{u}) = 0$ implies that the trace of $\tilde {\boldsymbol{T}}^{\bd}$ is zero and justifies the above superscript. Therefore $$ \alpha \int_\Omega (\tilde{\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}^\bd):\boldsymbol{S}_h + \gamma\int_{\Omega}\big(\mu(|\tilde{\boldsymbol{T}}_h|)\tilde{\boldsymbol{T}}_h -\mu(|\tilde{\boldsymbol{T}}^\bd|)\tilde{\boldsymbol{T}}^\bd\big) :\boldsymbol{S}_h = 0\quad \forall\, \boldsymbol{S}_h \in M_h, $$ and, as in the conforming case, we conclude that \begin{equation} \label{eq:limit.Th-tildTh} \lim_{h \to 0} \|\tilde{\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}^\bd\|_{L^2(\Omega)} =0. \end{equation} Finally, the difference between the equations satisfied by ${\boldsymbol{T}}_h$ and $\tilde{\boldsymbol{T}}_h$ yields $$ \alpha \int_\Omega ({\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}_h):\boldsymbol{S}_h + \gamma\int_{\Omega}\big(\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h - \mu(|\tilde{\boldsymbol{T}}_h|)\tilde{\boldsymbol{T}}_h\big) :\boldsymbol{S}_h = b_{1h}(\boldsymbol{S}_h,\mathbf{u}_h) - \int_{\Omega} \boldsymbol{D}(\bar \mathbf{u}) : \boldsymbol{S}_h\quad \forall\, \boldsymbol{S}_h \in M_h. $$ By testing this equation with $\boldsymbol{S}_h = {\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}_h$ and using the monotonicity property \eqref{eqn:mu_mon}, we deduce that \begin{equation} \label{eq:Th-tildTh} \alpha \| {\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}_h\|^2_{L^2(\Omega)} \le b_{1h}({\boldsymbol{T}}_h,\mathbf{u}_h)- b_{1h}(\tilde{\boldsymbol{T}}_h,\mathbf{u}_h) - \int_{\Omega} \boldsymbol{D}(\bar \mathbf{u}) :({\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}_h). \end{equation} However, by \eqref{eq:Ghsym}, $$ b_{1h}(\tilde{\boldsymbol{T}}_h,\mathbf{u}_h) = \int_\Omega G_h^{\rm sym}(\mathbf{u}_h) : \tilde{\boldsymbol{T}}_h, $$ and it follows from Proposition \ref{prop: Ghsym-eps(u)} and \eqref{eq:limit.Th-tildTh} that $$ \lim_{h \to 0} b_{1h}(\tilde{\boldsymbol{T}}_h,\mathbf{u}_h) = \int_{\Omega} \boldsymbol{D}(\bar \mathbf{u}) :\tilde{\boldsymbol{T}}^\bd. $$ Then, by passing to the limit in \eqref{eq:Th-tildTh}, we obtain in view of \eqref{eq:limit.ah} the inequality $$ \alpha \lim_{h \to 0} \| {\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}_h\|^2_{L^2(\Omega)} \le \int_{\Omega} \boldsymbol{D}(\bar \mathbf{u}) :\bar{\boldsymbol{T}} - \int_{\Omega} \boldsymbol{D}(\bar \mathbf{u}) :\tilde{\boldsymbol{T}}^\bd - \int_{\Omega} \boldsymbol{D}(\bar \mathbf{u}) :(\bar {\boldsymbol{T}}-\tilde{\boldsymbol{T}}^\bd) =0, $$ whence $$ \lim_{h \to 0} \| {\boldsymbol{T}}_h-\tilde{\boldsymbol{T}}_h\|_{L^2(\Omega)} =0, $$ and uniqueness of the limit yields $$ \bar{\boldsymbol{T}} = \tilde{\boldsymbol{T}}^\bd = {\cal G}(\bar \mathbf{u}). $$ This proves that $(\bar{\boldsymbol{T}}, \bar \mathbf{u})$ satisfies the second equation of \eqref{pb:weak_cont}. \end{proof} \subsection{The tetrahedral case} \label{subsec:tetra} Here we study briefly two examples of finite element discretisations on tetrahedral meshes, the triangular case being simpler. Many of the details are skipped because they follow closely those in the previous subsection. The family of meshes $\Th$ is assumed to be regular as in \eqref{eq:reg_mesh}. Let us start with the same spaces $V_h$, $Q_h$, and $M_h$ defined on $\Th$ by \eqref{eq:Vhnon-k}, \eqref{eq:Qhnon-k}, and \eqref{eq:Mhnon-k}, respectively, and the same bilinear forms $b_{1h}(\boldsymbol{S}_h,\mathbf{v}_h)$, $d_h(\mathbf{u}_h;\mathbf{v}_h,\mathbf{w}_h)$, and $b_{2h}(\mathbf{v}_h,q_h)$ defined by \eqref{eq:epshnon}, \eqref{eq:dhnon}, and \eqref{eq:b2hnon}, respectively. Then the scheme is again given by \eqref{pb:nonconfscheme} and, under assumption \eqref{eq:reg_mesh}, all proofs from the previous subsections are valid in this case, except possibly the proof of the inf-sup condition. In fact, Theorem \ref{thm:inf-sup3D} holds with a much simpler proof. Indeed, take any tetrahedron $E$. Recalling that the case of interest is $k =1$, a polynomial of $\polP_1$ is uniquely determined in $E$ by its values at the centre points $\mathbf{b}_e$ of its four faces $e$. Then, instead of \eqref{eqn:corrct3}, we can use the sufficient condition \begin{equation} \label{eqn:corrct3tetra} \restriction{\mathbf{c}_h(\mathbf{b}_e)}{E}= \frac{1}{|e|} \int_e \restriction{(R_h(\mathbf{v}) - \mathbf{v})}{E} \quad \forall\, E \in \Th, \quad \forall\, e \in \partial E, \end{equation} and this defines uniquely the correction $\mathbf{c}_h$. Furthermore, thanks to \eqref{eq:reg_mesh}, the stability of this correction follows from the fact that $E$ is the image of the unit tetrahedron $\hat E$ by an invertible affine mapping whose matrix satisfies the same properties as the matrix $\boldsymbol{B}$ used above. Thus the conclusion of Theorem \ref{thm:inf-sup3D} is valid in this case. \medskip As a second example, it would be tempting to use the Crouzeix--Raviart element of degree one on tetrahedra; see~\cite{CroRa}. This would be possible if the analysis did not invoke Korn's inequality (with respect to the broken symmetric gradient), because it is not satisfied by the Crouzeix--Raviart element; cf~\cite{ref:falk91}. Thus, the simplest way to bypass this difficulty is to introduce the jump penalty term $J_h(\mathbf{u}_h,\mathbf{v}_h)$ defined in \eqref{eq:Jh}. Let us describe this discretisation. Again, we suppose that \eqref{eq:reg_mesh} holds. The discrete spaces $Q_h$ and $M_h$ are the same, with $k=1$, as in \eqref{eq:Qhnon-k} and \eqref{eq:Mhnon-k}, respectively. However, instead of $V_h$, we now use the space $V_{h}^{CR}$ whose elements are also piecewise polynomials of degree one in each element, but in contrast with \eqref{eq:Vhnon-k}, they are continuous at the centre points of all interior faces $e \in \Gamma_h^i$, and are set to zero at the centre points of all boundary faces $e \in \Gamma_h^b$. Thanks to this pointwise continuity and boundary condition, the scheme now involves the following bilinear/trilinear forms, compare with \eqref{eq:epshnon}, \eqref{eq:dhnon}, \eqref{eq:b2hnon}: \begin{equation} \label{eq:epshnonCR} \int_\Omega \boldsymbol{D}(\mathbf{v}) : \boldsymbol{S} \simeq b_{1h}^{CR}(\boldsymbol{S}_h,\mathbf{v}_h) := \sum_{E \in \Th} \int_E \boldsymbol{D}(\mathbf{v}_h) : \boldsymbol{S}_h , \end{equation} \begin{equation} \label{eq:dhnonCR} d_{h}^{CR}(\mathbf{u}_h;\mathbf{v}_h,\mathbf{w}_h) : = \frac{1}{2}\Big[ \sum_{E \in \Th} \int_E \left[ (\mathbf{u}_h\cdot\nabla)\mathbf{v}_h \right] \cdot \mathbf{w}_h - \sum_{E \in \Th} \int_E \left[ (\mathbf{u}_h\cdot\nabla)\mathbf{w}_h \right] \cdot \mathbf{v}_h \Big], \end{equation} \begin{equation} \label{eq:b2hnonCR} b_{2h}^{CR}(\mathbf{v}_h,q_h) : = -\sum_{E \in \Th} \int_E q_h \di(\mathbf{v}_h). \end{equation} With these new forms, analogously to \eqref{pb:nonconfscheme}, the finite element approximation of the problem reads as follows: find a triple $({\boldsymbol{T}}_h,\mathbf{u}_h,p_h) \in M_h \times V_{h}^{CR} \times Q_h$ such that \begin{alignat}{2} \label{pb:nonconfschemeCR} \begin{aligned} d_{h}^{CR}(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h) + b_{1h}^{CR}({\boldsymbol{T}}_h,\mathbf{v}_h) + b_{2h}^{CR}(\mathbf{v}_h,p_h) + J_h(\mathbf{u}_h,\mathbf{v}_h) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v}_h &&\quad \forall\, \mathbf{v}_h\in V_{h}^{CR}, \\ \alpha\displaystyle{\int_{\Omega}}{\boldsymbol{T}}_h:\boldsymbol{S}_h+\gamma\displaystyle{\int_{\Omega}}\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h:\boldsymbol{S}_h & = b_{1h}^{CR}(\boldsymbol{S}_h,\mathbf{u}_h) &&\quad \forall\, \boldsymbol{S}_h\in M_h, \\ b_{2h}^{CR}(\mathbf{u}_h,q_h) & = 0 &&\quad \forall\, q_h\in Q_h. \end{aligned} \end{alignat} Note that $b_{1h}^{CR}(\boldsymbol{S}_h,\mathbf{v}_h)$ coincides with $b_{1h}(\boldsymbol{S}_h,\mathbf{v}_h)$ and $b_{2h}^{CR}(\mathbf{v}_h,q_h)$ coincides with $b_{2h}(\mathbf{v}_h,q_h)$ because the additional face terms vanish for elements of the space $V_{h}^{CR}$. This is not necessarily the case with $d_{h}^{CR}$ and $d_h$, but $d_{h}^{CR}$ is obviously antisymmetric and is simpler. Although the norm of the broken gradient is a norm on $V_{h}^{CR}$, the mapping $\mathbf{v}_h \mapsto \|\boldsymbol{D}(\mathbf{v}_h)\|_h$ is not a norm on $V_{h}^{CR}$. According to~\cite{ref:SB03,ref:SB04}, we have instead \eqref{eq:disc-Korn} and \eqref{eq:disc-Kornbis}. That is why we use again the norm $\|\mathbf{v}_h\|_{V_h}$ defined in \eqref{eq:normVh} and keep the term $J_h(\mathbf{u}_h,\mathbf{v}_h)$ in the first line of \eqref{pb:nonconfschemeCR}. Note however that the parameters $\sigma_e$ need not be tuned by Proposition \ref{prop:balance} since there are no surface terms in $b_{1h}^{CR}({\boldsymbol{T}}_h,\mathbf{v}_h)$; thus it suffices for instance to take $\sigma_e = 1$ for each face $e$. Moreover, the analysis used for the general discontinuous elements substantially simplifies here. First, as there are no surface terms in the bilinear forms, the bounds are simpler. Next, the operator $\Pi_h$ satisfying the statement of Lemma \ref{thm:lemFort} is constructed directly by setting, for $\mathbf{v}$ in $H^1_0(\Omega)^d$, \begin{equation} \label{eqn:CRFortin} \restriction{\Pi_h(\mathbf{v})(\mathbf{b}_e)}{E}= \frac{1}{|e|} \int_e \mathbf{v} \quad \forall\, E \in \Th,\; \forall\,e \in \partial E, \end{equation} see~\cite{CroRa}. Clearly, as $\mathbf{v} \in H^1_0(\Omega)^d$, \eqref{eqn:CRFortin} defines a piecewise polynomial function of degree one in $V_{h}^{CR}$. Finally, convergence of the scheme is derived without the discrete differential operators $G_h^{\rm sym}$ and $G_h^{\rm div}$. Indeed, property \eqref{eq:strng.lim} can be extended as is asserted in the proposition. \begin{prop} \label{prop:weakconvH1} Let the family $\Th$ satisfy \eqref{eq:reg_mesh}. If $\mathbf{v}_h$ is a sequence in $V_{h}^{CR}$ such that $$ \|\mathbf{v}_h\|_{V_h} \le C $$ with a constant $C$ independent of $h$, then there exists a function $\bar \mathbf{v} \in H^1_0(\Omega)^d$ satisfying \eqref{eq:strng.lim} and \begin{equation} \label{eq:weak.limCR} \lim_{h \to 0} \boldsymbol{D}_h(\mathbf{v}_h)= \boldsymbol{D}(\bar \mathbf{v}) \quad \mbox{weakly in}\ L^2(\Omega)^{d\times d}, \end{equation} where $\boldsymbol{D}_h$ stands for the broken symmetric gradient. \end{prop} The proof, contained in~\cite{CroRa}, relies on the fact that the integral average of the jump $[\mathbf{v}_h]_e$ vanishes on any face $e$ and hence, for any tensor $\boldsymbol{F}$ in $H^1(\Omega)^{d\times d}$, $$ \int_e \boldsymbol{F} \mathbf{n}_e\cdot [\mathbf{v}_h]_e = \int_e (\boldsymbol{F}-\boldsymbol{C}) \mathbf{n}_e\cdot [\mathbf{v}_h]_e \quad \forall\, \boldsymbol{C} \in \polR^{d\times d}. $$ Thus, there is no need for $G_h^{\rm sym}$; the same is true for $G_h^{\rm div}$. This permits to pass directly to the limit in \eqref{pb:nonconfschemeCR}. \section{Numerical illustrations} \label{sec:numerics} We introduce two decoupled iterative algorithms. The first one is based on a Lions--Mercier decoupling strategy while the second one is a fixed point algorithm. All the algorithms are implemented using the \textit{deall.ii} library \cite{bangerth2007deal}. For simplicity, we focus on conforming finite element approximations for which an a priori error estimate has been derived in Subsection \ref{subsec:error_estimate}. Performing numerical experiments in the case of the nonconforming approximation scheme will be the subject of future work. The general setup is the following: \begin{itemize} \item Dirichlet boundary conditions are imposed on the entire domain boundary (not necessarily homogeneous); \item A sequence of uniformly refined meshes with square elements of diameter $h=\sqrt{2}/2^{n}$, $n=2,\ldots,6$ (level of refinement) are considered for the mesh refinement analysis; \item The finite element spaces $M_h$, $V_h$, and $Q_h$ consist, respectively, of discontinuous piecewise polynomials of degree 2, continuous piecewise polynomials of degree 2, and continuous piecewise polynomials of degree 1 (see Subsection \ref{ss:quad}). \end{itemize} \noindent Following \cite{ref:BGS18}, we replace the constitutive relation \begin{equation*} \alpha{\boldsymbol{T}}^d+\gamma\mu(|{\boldsymbol{T}}^d|){\boldsymbol{T}}^d-\boldsymbol{D}(\mathbf{u}) = \mathbf{0} \end{equation*} by \begin{equation*} \alpha{\boldsymbol{T}}^d+\gamma\mu(|{\boldsymbol{T}}^d|){\boldsymbol{T}}^d-\boldsymbol{D}(\mathbf{u}) = \mathbf{g} \end{equation*} to design an exact solution. Then, given ${\boldsymbol{T}}^d$, $\mathbf{u}$ and $p$, we compute the corresponding right-hand sides $\mathbf{g}$ and $\mathbf{f}$ (forcing term), where we recall that \begin{equation*} \mathbf{f}=(\mathbf{u}\cdot\nabla)\mathbf{u}-\frac{1}{\alpha}\di(\boldsymbol{D}(\mathbf{u}))+\nabla p+\frac{\gamma}{\alpha}\di(\mu(|{\boldsymbol{T}}^d|){\boldsymbol{T}}^d). \end{equation*} Finally, we choose $\mu(s)=\frac{1}{\sqrt{1+s^2}}$ which corresponds to \eqref{eq:powerlaw3} with $\beta=1$ and $n=-1/2$. \subsection{Lions--Mercier decoupled iterative algorithm} \label{subsec:L-M.Alg} We present here an iterative algorithm to compute approximately the solution to problem \eqref{pb:weak_epsu}, which is based on the formulation \eqref{pb:NS_EL_v3}: find $({\boldsymbol{T}}_h,\mathbf{u}_h,p_h)\in M_h\times V_h\times Q_h$ such that \begin{align} \label{pb:weak_disc_epsu} \begin{aligned} d(\mathbf{u}_h;\mathbf{u}_h,\mathbf{v}_h)+\frac{1}{\alpha}\displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}_h):\boldsymbol{D}(\mathbf{v}_h)-\displaystyle{\int_{\Omega}}p_h\di(\mathbf{v}_h) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v}_h+\frac{\gamma}{\alpha}\displaystyle{\int_{\Omega}}\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h:\boldsymbol{D}(\mathbf{v}_h), \\ \alpha\displaystyle{\int_{\Omega}}{\boldsymbol{T}}_h:\boldsymbol{S}_h+\gamma\displaystyle{\int_{\Omega}}\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h:\boldsymbol{S}_h & = \displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}_h):\boldsymbol{S}_h, \\ \displaystyle{\int_{\Omega}}q_h\di(\mathbf{u}_h) & = 0 \end{aligned} \end{align} for all $(\boldsymbol{S}_h,\mathbf{v}_h,q_h)\in M_h\times V_h\times Q_h$, where $d:V\times V\times V\rightarrow\mathbb{R}$ is defined in \eqref{def:form_d}. Note that problem \eqref{pb:weak_disc_epsu} is equivalent to problem \eqref{pb:weak_disc} analysed in Section \ref{sec:NS_ENL_App}. To compute the solution to problem \eqref{pb:weak_disc_epsu}, we propose a decoupled algorithm based on a Lions--Mercier splitting algorithm \cite{LM79} (alternating-direction method of the Peaceman--Rachford type \cite{ref:PR55}) applied to the unknown ${\boldsymbol{T}}_h$. Following the discussion in \cite[Section 7]{ref:BGS18}, the algorithm reads, for a pseudo-time step $\tau>0$: \vspace*{0.2cm} \noindent \emph{Initialisation}: find $({\boldsymbol{T}}_h^{(0)},\mathbf{u}_h^{(0)},p_h^{(0)})\in M_h\times V_h\times Q_h$ such that \begin{alignat}{2} \label{pb:init} \begin{aligned} d(\mathbf{u}_h^{(0)};\mathbf{u}_h^{(0)},\mathbf{v}_h)+\frac{1}{\alpha}\displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}_h^{(0)}):\boldsymbol{D}(\mathbf{v}_h)-\displaystyle{\int_{\Omega}}p_h^{(0)}\di(\mathbf{v}_h) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v}_h &&\quad \forall\, \mathbf{v}_h\in V_h, \\ \alpha\displaystyle{\int_{\Omega}}{\boldsymbol{T}}_h^{(0)}:\boldsymbol{S}_h & = \displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}_h^{(0)}):\boldsymbol{S}_h &&\quad \forall\, \boldsymbol{S}_h\in M_h, \\ \displaystyle{\int_{\Omega}}q_h\di(\mathbf{u}_h^{(0)}) & = 0 &&\quad \forall\, q_h\in Q_h. \end{aligned} \end{alignat} \vspace*{0.2cm} \noindent Then, for $k=0,1,\ldots,$ perform the following two steps: \vspace*{0.2cm} \noindent \emph{Step 1:} Find ${\boldsymbol{T}}_h^{(k+\frac{1}{2})}\in M_h$ such that \begin{equation*} \frac{1}{\tau}\int_{\Omega}({\boldsymbol{T}}_h^{(k+\frac{1}{2})}-{\boldsymbol{T}}_h^{(k)}):\boldsymbol{S}_h+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}_h^{(k+\frac{1}{2})}|){\boldsymbol{T}}_h^{(k+\frac{1}{2})}:\boldsymbol{S}_h = \int_{\Omega}\boldsymbol{D}(\mathbf{u}_h^{(k)}):\boldsymbol{S}_h-\alpha\int_{\Omega}{\boldsymbol{T}}_h^{(k)}:\boldsymbol{S}_h \quad \forall\, \boldsymbol{S}_h\in M_h. \end{equation*} \vspace*{0.2cm} \noindent \emph{Step 2:} Find $({\boldsymbol{T}}_h^{(k+1)},\mathbf{u}_h^{(k+1)},p_h^{(k+1)})\in M_h\times V_h\times Q_h$ such that \begin{alignat}{2} \label{pb:step2} \begin{aligned} &d(\mathbf{u}_h^{(k+1)};\mathbf{u}_h^{(k+1)},\mathbf{v}_h)+\frac{1}{\alpha}\displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}_h^{(k+1)}):\boldsymbol{D}(\mathbf{v}_h)-\displaystyle{\int_{\Omega}}p_h^{(k+1)}\di(\mathbf{v}_h)\\ & \hspace{7.1cm} = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v}_h +\frac{\gamma}{\alpha}\displaystyle{\int_{\Omega}}\mu(|{\boldsymbol{T}}_h^{(k+\frac{1}{2})}|){\boldsymbol{T}}_h^{(k+\frac{1}{2})}:\boldsymbol{D}(\mathbf{v}_h), \\ &\frac{1}{\tau}\displaystyle{\int_{\Omega}}({\boldsymbol{T}}_h^{(k+1)}-{\boldsymbol{T}}_h^{(k+\frac{1}{2})}):\boldsymbol{S}_h+\alpha\displaystyle{\int_{\Omega}}{\boldsymbol{T}}_h^{(k+1)}:\boldsymbol{S}_h = \displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}_h^{(k+1)}):\boldsymbol{S}_h-\gamma\displaystyle{\int_{\Omega}}\mu(|{\boldsymbol{T}}_h^{(k+\frac{1}{2})}|){\boldsymbol{T}}_h^{(k+\frac{1}{2})}:\boldsymbol{S}_h, \\ &\hspace{4.55cm}\displaystyle{\int_{\Omega}}q_h\di(\mathbf{u}_h^{(k+1)}) = 0 \end{aligned} \end{alignat} for all $(\boldsymbol{S}_h,\mathbf{v}_h,q_h)\in M_h\times V_h\times Q_h$. \vspace*{0.2cm} The solution to \eqref{pb:init} is obtained by first determining $\mathbf{u}_h^{(0)}$ and $p_h^{(0)}$ as the solution to a standard steady-state Navier--Stokes equation (first and third equations in \eqref{pb:init}) and then by setting ${\boldsymbol{T}}_h^{(0)}=\frac{1}{\alpha}\boldsymbol{D}(\mathbf{u}_h^{(0)})$. Similarly, the solution to problem \eqref{pb:step2} can be obtained by first solving the first and third equations for $\mathbf{u}_h^{(k+1)}$ and $p_h^{(k+1)}$ and then solving the second equation for ${\boldsymbol{T}}_h^{(k+1)}$. A standard argument shows that the above algorithm generates uniformly bounded sequences. Thus they converge up to subsequences. However, the identification of a unique limit for the entire sequence is currently unclear. Regarding the implementation, we make the following comments: \begin{itemize} \item \emph{Stopping criterion}: For the main loop (Lions--Mercier algorithm), the stopping criterion is \begin{equation} \label{eqn:stopLM} \frac{\|{\boldsymbol{T}}_h^{(k+1)}-{\boldsymbol{T}}_h^{(k)}\|_{L^2(\Omega)}+\|\nabla(\mathbf{u}_h^{(k+1)}-\mathbf{u}_h^{(k)})\|_{L^2(\Omega)}+\|p_h^{(k+1)}-p_h^{(k)}\|_{L^2(\Omega)}}{\|{\boldsymbol{T}}_h^{(k+1)}\|_{L^2(\Omega)}+\|\nabla\mathbf{u}_h^{(k+1)}\|_{L^2(\Omega)}+\|p_h^{(k+1)}\|_{L^2(\Omega)}} \leq 10^{-5}; \end{equation} \item \emph{Initialisation}: We solve the Navier--Stokes system associated to problem \eqref{pb:init} using Newton's method (the iterates are indexed by $m$) until the following stopping criterion is met: \begin{equation*} \frac{\|\nabla(\mathbf{u}_h^{(m+1)}-\mathbf{u}_h^{(m)})\|_{L^2(\Omega)}+\|p_h^{(m+1)}-p_h^{(m)}\|_{L^2(\Omega)}}{\|\nabla\mathbf{u}_h^{(m+1)}\|_{L^2(\Omega)}+\|p_h^{(m+1)}\|_{L^2(\Omega)}} \leq 10^{-6}. \end{equation*} As an initial guess, we take the solution of the associated Stokes system without the convective term. The solution to each saddle-point system of the form \begin{equation*} \left(\begin{array}{cc} A & B^T \\ B & 0 \end{array}\right)\left(\begin{array}{c} \mathbf{U} \\ \mathbf{P} \end{array}\right) = \left(\begin{array}{c} \mathbf{F} \\ \mathbf{G} \end{array}\right) \end{equation*} is obtained using a Schur complement formulation $$ BA^{-1}B^T \mathbf{P} = BA^{-1} \mathbf{F} - \mathbf{G}, \qquad A\mathbf{U} = \mathbf{F}-B^T \mathbf{P}. $$ To solve for $\mathbf P$, we use the conjugate gradient algorithm in the case of the Stokes problem and GMRES for the (linearised) Navier--Stokes problems. In both cases, the pressure mass matrix is used as preconditioner and the tolerance for the iterative algorithm is set to $10^{-6}\|BA^{-1}\mathbf{F}-\mathbf{G}\|_{\ell_2}$. A direct method is advocated for every occurrence of $A^{-1}$ and also to obtain ${\boldsymbol{T}}^{(0)}$. \item \emph{Step 1 (monotone part)}: ${\boldsymbol{T}}_h^{(k+\frac{1}{2})}$ is the zero of the functional \begin{equation*} F({\boldsymbol{T}}_h) := {\boldsymbol{T}}_h + \tau\gamma\mu(|{\boldsymbol{T}}_h|){\boldsymbol{T}}_h-\tau\boldsymbol{D}(\mathbf{u}_h^{(k)})-(1-\alpha\tau){\boldsymbol{T}}_h^{(k)}. \end{equation*} Recall that discontinuous piecewise polynomial approximations are used for the stress and so ${\boldsymbol{T}}_h$ is determined locally on each element $E\in\Th$ as the solution to \begin{equation*} \int_{E} F({\boldsymbol{T}}_h):\boldsymbol{S}_h = 0 \quad \forall\, \boldsymbol{S}_h\in\mathbb{Q}_2. \end{equation*} We again employ Newton's method starting with ${\boldsymbol{T}}_h^{(0)}=\restriction{{\boldsymbol{T}}_h^{(k)}}{E}$ and use the stopping criterion \begin{equation*} \|F({\boldsymbol{T}}_h^{(m)})\|_{L^2(E)} \leq 10^{-6}\frac{\sqrt{|E|}}{\sqrt{|\Omega|}} \end{equation*} so that the global residual is less than $10^{-6}$. Note that in this case, it might happen that no iteration is needed (e.g. when $\gamma=0$), in which case $\restriction{{\boldsymbol{T}}_h^{(k+\frac{1}{2})}}{E}=\restriction{{\boldsymbol{T}}_h^{(k)}}{E}$. \item \emph{Step 2}: This step is similar to the initialisation step except that we take $(\mathbf{u}_h^{(k)},p_h^{(k)})$ as our initial guess for Newton's method for solving the finite element approximation of the Navier--Stokes system. \end{itemize} \subsubsection{Case 1: smooth solution} We consider the case $\Omega=(0,1)^2$ and \begin{equation*} {\boldsymbol{T}}^d=\left(\begin{array}{cc} \frac{\cos(2\pi x)-\cos(2\pi y)}{4} & 0 \\ 0 & \frac{\cos(2\pi y)-\cos(2\pi x)}{4} \end{array}\right), \quad \mathbf{u}=\left(\begin{array}{r} -\cos(\pi x)\sin(\pi y) \\ \sin(\pi x)\cos(\pi y) \end{array}\right), \quad p=-\frac{\cos(2\pi x)+\cos(2\pi y)}{4}. \end{equation*} Note that ${\boldsymbol{T}}^d$ is the deviatoric part of ${\boldsymbol{T}}$ defined by \begin{equation*} {\boldsymbol{T}}=\left(\begin{array}{cc} \frac{\cos(2\pi x)}{2} & 0 \\ 0 & \frac{\cos(2\pi y)}{2} \end{array}\right), \end{equation*} and in particular it has vanishing trace. We observe that $\mathbf{u}$ is divergence-free. Moreover, the pressure satisfies $p=-\frac{1}{2}\tr({\boldsymbol{T}})$ and has zero mean. We report in Table \ref{tab:case1_gamma0} the error for each component of the solution for the case $\alpha=1$ and $\gamma=0$, while Table \ref{tab:case1_gamma1_001} contains the results for $\alpha=\gamma=1$. Note that we use the $H^1$ semi-norm for the velocity and not the (equivalent) $L^2(\Omega)^{2\times 2}$ norm of the symmetric gradient. \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 6.04199$\times 10^{-2}$ & 7.51266$\times 10^{-2}$ & 3.02263$\times 10^{-2}$ & 1 \\ 3 & 0.177 & 1.44750$\times 10^{-2}$ & 1.82293$\times 10^{-2}$ & 6.18331$\times 10^{-3}$ & 1 \\ 4 & 0.088 & 3.58096$\times 10^{-3}$ & 4.52460$\times 10^{-3}$ & 1.46371$\times 10^{-3}$ & 1 \\ 5 & 0.044 & 8.92901$\times 10^{-4}$ & 1.12913$\times 10^{-3}$ & 3.60874$\times 10^{-4}$ & 1 \\ 6 & 0.022 & 2.23079$\times 10^{-4}$ & 2.82155$\times 10^{-4}$ & 8.99041$\times 10^{-5}$ & 1 \\ \hline \end{tabular} \caption{Case 1, $\alpha=1$, $\gamma=0$, $\delta=10^{-5}$, $\tau=0.01$.} \label{tab:case1_gamma0} \end{center} \end{table} \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 3.57579$\times 10^{-2}$ & 8.21275$\times 10^{-2}$ & 3.01953$\times 10^{-2}$ & 183 \\ 3 & 0.177 & 7.78829$\times 10^{-3}$ & 1.86706$\times 10^{-2}$ & 6.18695$\times 10^{-3}$ & 182 \\ 4 & 0.088 & 2.00882$\times 10^{-3}$ & 4.55378$\times 10^{-3}$ & 1.50017$\times 10^{-3}$ & 182 \\ 5 & 0.044 & 8.86597$\times 10^{-4}$ & 1.13687$\times 10^{-3}$ & 4.91418$\times 10^{-4}$ & 182 \\ 6 & 0.022 & 7.66438$\times 10^{-4}$ & 3.05389$\times 10^{-4}$ & 3.45733$\times10^{-4}$ & 182 \\ \hline \end{tabular} \caption{Case 1, $\alpha=\gamma=1$, $\delta=10^{-5}$, $\tau=0.01$.} \label{tab:case1_gamma1_001} \end{center} \end{table} We observe in Table \ref{tab:case1_gamma1_001} that all three errors are $\mathcal{O}(h^2)$. The deterioration of the convergence rate we observe for ${\boldsymbol{T}}^d$ and $p$ in Table \ref{tab:case1_gamma1_001} is due to the stopping criterion. Indeed, if we use $10^{-6}$ instead of $10^{-5}$ in the stopping criterion \eqref{eqn:stopLM} for the main loop, then for $h=0.044$ ($n=5$) we need 250 iterations and we get $$ \|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}=4.66898\times 10^{-4}, \quad \|\mathbf{u}-\mathbf{u}_h\|_{L^2(\Omega)}=1.13118\times 10^{-3} \quad \mbox{and} \quad \|p-p_h\|_{L^2(\Omega)}=3.62581\times 10^{-4}, $$ compare with the fourth row of Table \ref{tab:case1_gamma1_001}. We give in Tables \ref{tab:case1_gamma1_005}, \ref{tab:case1_gamma1_01} and \ref{tab:case1_gamma1_05} the results obtained when a larger pseudo-time step is used. \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 3.57161$\times 10^{-2}$ & 8.21200$\times 10^{-2}$ & 3.02043$\times 10^{-2}$ & 47 \\ 3 & 0.177 & 7.74372$\times 10^{-3}$ & 1.86697$\times 10^{-2}$ & 6.18194$\times 10^{-3}$ & 47 \\ 4 & 0.088 & 1.86276$\times 10^{-3}$ & 4.55240$\times 10^{-3}$ & 1.46465$\times 10^{-3}$ & 47 \\ 5 & 0.044 & 4.77556$\times 10^{-4}$ & 1.13167$\times 10^{-3}$ & 3.65463$\times 10^{-4}$ & 47 \\ 6 & 0.022 & 1.72916$\times 10^{-4}$ & 2.85469$\times 10^{-4}$ & 1.06995$\times 10^{-4}$ & 47 \\ \hline \end{tabular} \caption{Case 1, $\alpha=\gamma=1$, $\delta=10^{-5}$, $\tau=0.05$.} \label{tab:case1_gamma1_005} \end{center} \end{table} \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 3.57060$\times 10^{-2}$ & 8.21133$\times 10^{-2}$ & 3.02054$\times 10^{-2}$ & 26 \\ 3 & 0.177 & 7.74150$\times 10^{-3}$ & 1.86693$\times 10^{-2}$ & 6.18213$\times 10^{-3}$ & 26 \\ 4 & 0.088 & 1.85887$\times 10^{-3}$ & 4.55234$\times 10^{-3}$ & 1.46384$\times 10^{-3}$ & 26 \\ 5 & 0.044 & 4.63124$\times 10^{-4}$ & 1.13153$\times 10^{-3}$ & 3.61829$\times 10^{-4}$ & 26 \\ 6 & 0.022 & 1.27963$\times 10^{-4}$ & 2.84928$\times 10^{-4}$ & 9.37426$\times 10^{-5}$ & 26 \\ \hline \end{tabular} \caption{Case 1, $\alpha=\gamma=1$, $\delta=10^{-5}$, $\tau=0.1$.} \label{tab:case1_gamma1_01} \end{center} \end{table} \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 3.57028$\times 10^{-2}$ & 8.21057$\times 10^{-2}$ & 3.02063$\times 10^{-2}$ & 10 \\ 3 & 0.177 & 7.73342$\times 10^{-3}$ & 1.86606$\times 10^{-2}$ & 6.18238$\times 10^{-3}$ & 7 \\ 4 & 0.088 & 1.85742$\times 10^{-3}$ & 4.55172$\times 10^{-3}$ & 1.46368$\times 10^{-3}$ & 7 \\ 5 & 0.044 & 4.59753$\times 10^{-4}$ & 1.13121$\times 10^{-3}$ & 3.60876$\times 10^{-4}$ & 7 \\ 6 & 0.022 & 1.15437$\times 10^{-4}$ & 2.83829$\times 10^{-4}$ & 8.99203$\times 10^{-5}$ & 7 \\ \hline \end{tabular} \caption{Case 1, $\alpha=\gamma=1$, $\delta=10^{-5}$, $\tau=0.5$.} \label{tab:case1_gamma1_05} \end{center} \end{table} We see that the larger the pseudo-time step, the fewer the number of iterations. Moreover, for all cases $\tau=0.05$, $\tau=0.1$ and $\tau=0.5$, there is no deterioration of the convergence rate in contrast to what we observed in Table \ref{tab:case1_gamma1_001} (due to the stopping criterion). \subsubsection{Case 2: non-smooth velocity} We consider now the $L$-shaped domain $\Omega=(-1,1)^2\setminus [0,1)^2$; we take ${\boldsymbol{T}}^d$ and $p$ as above, but here \begin{equation*} \mathbf{u}=\left(\begin{array}{r} y(x^2+y^2)^{\frac{1}{3}} \\ -x(x^2+y^2)^{\frac{1}{3}} \end{array}\right), \end{equation*} which is divergence-free. The results when $\alpha=1$ and $\gamma=0$ are given in Table \ref{tab:case2_gamma0} while Tables \ref{tab:case2_gamma1_001} and \ref{tab:case2_gamma1_05} contain the results for the case $\alpha=\gamma=1$ with $\tau=0.01$ and $\tau=0.5$, respectively. \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 3.65187$\times 10^{-2}$ & 3.80529$\times 10^{-2}$ & 5.22497$\times 10^{-2}$ & 1 \\ 3 & 0.177 & 5.61550$\times 10^{-3}$ & 6.85310$\times 10^{-3}$ & 1.07102$\times 10^{-2}$ & 1 \\ 4 & 0.088 & 1.32332$\times 10^{-3}$ & 1.86233$\times 10^{-3}$ & 2.53671$\times 10^{-3}$ & 1 \\ 5 & 0.044 & 3.95496$\times 10^{-4}$ & 5.79343$\times 10^{-4}$ & 6.25652$\times 10^{-4}$ & 1 \\ 6 & 0.022 & 1.24435$\times 10^{-4}$ & 1.83765$\times 10^{-4}$ & 1.55951$\times 10^{-4}$ & 1 \\ \hline \end{tabular} \caption{Case 2, $\alpha=1$, $\gamma=0$, $\delta=10^{-5}$, $\tau=0.5$.} \label{tab:case2_gamma0} \end{center} \end{table} \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 3.51269$\times 10^{-2}$ & 6.79039$\times 10^{-2}$ & 5.22609$\times 10^{-2}$ & 198 \\ 3 & 0.177 & 4.65311$\times 10^{-3}$ & 9.59150$\times 10^{-3}$ & 1.07129$\times 10^{-2}$ & 198 \\ 4 & 0.088 & 1.10623$\times 10^{-3}$ & 2.04375$\times 10^{-3}$ & 2.55916$\times 10^{-3}$ & 198 \\ 5 & 0.044 & 7.88026$\times 10^{-4}$ & 6.03974$\times 10^{-4}$ & 7.14457$\times 10^{-4}$ & 198 \\ 6 & 0.022 & 7.63053$\times 10^{-4}$ & 2.28218$\times 10^{-4}$ & 3.79151$\times 10^{-4}$ & 198 \\ \hline \end{tabular} \caption{Case 2, $\alpha=\gamma=1$, $\delta=10^{-5}$, $\tau=0.01$.} \label{tab:case2_gamma1_001} \end{center} \end{table} \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 3.50999$\times 10^{-2}$ & 6.78690$\times 10^{-2}$ & 5.22585$\times 10^{-2}$ & 11 \\ 3 & 0.177 & 4.56878$\times 10^{-3}$ & 9.56288$\times 10^{-3}$ & 1.07075$\times 10^{-2}$ & 8 \\ 4 & 0.088 & 8.00090$\times 10^{-4}$ & 2.03639$\times 10^{-3}$ & 2.53571$\times 10^{-3}$ & 7 \\ 5 & 0.044 & 2.08125$\times 10^{-4}$ & 5.91247$\times 10^{-4}$ & 6.25280$\times 10^{-4}$ & 7 \\ 6 & 0.022 & 6.85220$\times 10^{-5}$ & 1.92531$\times 10^{-4}$ & 1.55842$\times 10^{-4}$ & 7 \\ \hline \end{tabular} \caption{Case 2, $\alpha=\gamma=1$, $\delta=10^{-5}$, $\tau=0.5$.} \label{tab:case2_gamma1_05} \end{center} \end{table} \subsection{A fixed-point algorithm} \label{subsec:alt_algo} Instead of the Lions--Mercier type algorithm introduced in Subsection \ref{subsec:L-M.Alg}, we explore the following fixed-point strategy. \vspace*{0.2cm} \noindent \emph{Initialisation}: $({\boldsymbol{T}}_h^{(0)},\mathbf{u}_h^{(0)},p_h^{(0)})=\mathbf{0}$. \vspace*{0.2cm} \noindent Then for $k=0,1,\ldots$, do the following two steps. \vspace*{0.2cm} \noindent \emph{Step 1:} Find $(\mathbf{u}_h^{(k+1)},p_h^{(k+1)})\in V_h\times Q_h$ such that \begin{align*} d(\mathbf{u}_h^{(k+1)};\mathbf{u}_h^{(k+1)},\mathbf{v}_h)+\frac{1}{\alpha}\displaystyle{\int_{\Omega}}\boldsymbol{D}(\mathbf{u}_h^{(k+1)}):\boldsymbol{D}(\mathbf{v}_h)-\displaystyle{\int_{\Omega}}p_h^{(k+1)}\di(\mathbf{v}_h) & = \displaystyle{\int_{\Omega}}\mathbf{f}\cdot\mathbf{v}_h+\frac{\gamma}{\alpha}\displaystyle{\int_{\Omega}}\mu(|{\boldsymbol{T}}_h^{(k)}|){\boldsymbol{T}}_h^{(k)}:\boldsymbol{D}(\mathbf{v}_h), \\ \displaystyle{\int_{\Omega}}q_h\di(\mathbf{u}_h^{(k+1)}) & = 0 \end{align*} for all $(\mathbf{u}_h,q_h) \in V_h \times Q_h$. \vspace*{0.2cm} \noindent \emph{Step 2:} Find ${\boldsymbol{T}}_h^{(k+1)}\in M_h$ such that \begin{equation*} \alpha\int_{\Omega}{\boldsymbol{T}}_h^{(k+1)}:\boldsymbol{S}_h+\gamma\int_{\Omega}\mu(|{\boldsymbol{T}}_h^{(k+1)}|){\boldsymbol{T}}_h^{(k+1)}:\boldsymbol{S}_h = \int_{\Omega}\boldsymbol{D}(\mathbf{u}_h^{(k+1)}):\boldsymbol{S}_h \quad \forall\, \boldsymbol{S}_h\in M_h. \end{equation*} It is easy to show that this algorithm produces uniformly bounded sequences. The solvers used for these two steps are similar to those described in Subsection \ref{subsec:L-M.Alg}. In particular, we take $(\mathbf{u}_h^{(k)},p_h^{(k)})$ as initial guess for Newton's method for the finite element approximation of the Navier--Stokes system, except when $k=0$, in which case we use the solution of the associated Stokes problem. The results obtained using the stopping criterion \eqref{eqn:stopLM} are given in Table \ref{tab:case1_alt_algo}. There are similar to those obtained in Table \ref{tab:case1_gamma1_05}. \begin{table}[htbp] \begin{center} \begin{tabular}{|c|c|c|c|c|c|} \hline $n$ & $h$ & $\|{\boldsymbol{T}}^d-{\boldsymbol{T}}_h\|_{L^2(\Omega)}$ & $\|\nabla(\mathbf{u}-\mathbf{u}_h)\|_{L^2(\Omega)}$ & $\|p-p_h\|_{L^2(\Omega)}$ & iter \\ \hline \hline 2 & 0.354 & 3.57082$\times 10^{-2}$ & 8.21052$\times 10^{-2}$ & 3.02063$\times 10^{-2}$ & 10 \\ 3 & 0.177 & 7.73745$\times 10^{-3}$ & 1.86629$\times 10^{-2}$ & 6.18241$\times 10^{-3}$ & 8 \\ 4 & 0.088 & 1.85777$\times 10^{-3}$ & 4.55234$\times 10^{-3}$ & 1.46369$\times 10^{-3}$ & 8 \\ 5 & 0.044 & 4.60268$\times 10^{-4}$ & 1.13344$\times 10^{-3}$ & 3.60885$\times 10^{-4}$ & 8 \\ 6 & 0.022 & 1.17442$\times 10^{-4}$ & 2.92590$\times 10^{-4}$ & 8.99455$\times 10^{-5}$ & 8 \\ \hline \end{tabular} \caption{Case 1, $\alpha=\gamma=1$, $\delta=10^{-5}$.} \label{tab:case1_alt_algo} \end{center} \end{table} Concerning the computational cost when similar results are obtained, i.e., when $\tau=0.5$ for the Lions--Mercier type algorithm, we note that the latter requires the solution of one more equation per iteration, namely the linear equation for ${\boldsymbol{T}}_h^{(k+1)}$ in Step 2. \begin{table}[htbp] \begin{center} \begin{tabular}{|c|r|r|r|r|r|r|} \cline{2-7} \multicolumn{1}{c}{ } & \multicolumn{3}{|c|}{Lions--Mercier, $\tau=0.5$} & \multicolumn{3}{c|}{Alt. Algo} \\ \hline $h$ & iter & CPU time $[s]$ & wall time $[s]$ & iter & CPU time $[s]$ & wall time $[s]$ \\ \hline 0.354 & 10 & 10.33 & 14.76 & 10 & 7.30 & 10.22 \\ 0.177 & 7 & 32.56 & 39.92 & 8 & 25.57 & 32.70 \\ 0.088 & 7 & 134.28 & 162.05 & 8 & 94.76 & 111.77 \\ 0.044 & 7 & 474.41 & 565.44 & 8 & 364.79 & 414.95 \\ 0.022 & 7 & 1542.63 & 1695.55 & 8 & 1307.07 & 1539.07 \\ \hline \end{tabular} \caption{Time (in seconds) needed to meet the stopping criteria \eqref{eqn:stopLM} for the Lions--Mercier type algorithm (setup of Table \ref{tab:case1_gamma1_05}) and the algorithm of Section \ref{subsec:alt_algo}.} \label{tab:comp_cost} \end{center} \end{table} \bibliographystyle{siam}
\section{Introduction} \label{sec:Introduction} Advances in computer technology, electronic medical records, and cost-efficient biomedical data acquisition, from sensors to genetic tests, allow healthcare organizations and biomedical research studies to collect increasing amounts of data. Analysis of these vast datasets using machine learning approaches promises novel discoveries. Unfortunately, privacy, security, and regulatory constraints make sharing datasets across studies or organizations extremely difficult, so that this promise is largely unfulfilled since joint analyses are limited. To address these challenges, Federated Learning \cite{mcmahan2017communication,yang2019federated} has emerged as a novel privacy-preserving distributed machine learning paradigm that enables large-scale cross-institutional analysis without the need to move the data out of its original location. Federated Learning allows institutions to collaboratively train a machine learning model (e.g., a neural network) by aggregating the parameters (e.g., gradients) of local models trained on local data. Since subject data is not shared, and parameters can be protected through encryption, privacy concerns are ameliorated. Even though Federated Learning was originally developed for mobile and edge devices, it is being increasingly applied in biomedical and healthcare domains \cite{lee2018privacy,sheller2018multi,silva2019federated,rieke2020future,silva2020fed}. We developed a Federated Learning architecture and training policies resilient to data and computational heterogeneity, where different sites may have different data amounts, target distributions, and computational capabilities \cite{stripelis2020semisynchronous,stripelis2020accelerating}, which are often characteristic of biomedical studies. Brain age prediction from brain structural MRIs is a challenging biomedical task. The difference between the predicted and chronological brain age values is a phenotype related to aging and brain disease. Recent work \cite{cole2017predicting,jonsson2019brain} has shown that deep learning methods can accurately predict an individual's brain age. However, data scarcity limits the power of these methods, since privacy requirements make data sharing difficult. The Federated Learning paradigm is a natural fit for these challenging learning environments. Here, we present our Federated Learning (FL) architecture and an empirical evaluation of brain age prediction under homogeneous, and heterogeneous environments with different amounts of data, and with data not independently and identically distributed (Non-IID) across sites \cite{yang2019federated,stripelis2020semisynchronous,stripelis2020accelerating,li2018federated}. We compare the effectiveness of the federated model to its centralized counterpart. We show that in heterogeneous environments, our communication-efficient Semi-Synchronous training policy \cite{stripelis2020semisynchronous} provides faster convergence. \section{Related Work} \label{sec:RelatedWork} Federated Learning holds much promise in healthcare domains \cite{rieke2020future}. Silva et al. \cite{silva2020fed} present an open-source FL framework for healthcare, supporting different models and optimization methods. FL has been used for phenotype discovery \cite{liu2019two}, for patient representation learning \cite{kim2017federated}, and for identifying similar patients across institutions \cite{lee2018privacy}. In biomedical imaging, Federated Learning has been applied to multiple tasks, including whole-brain segmentation of MRI T1 scans \cite{roy2019braintorrent}, brain tumor segmentation \cite{sheller2018multi,li2019privacy}, multi-site fMRI classification and identification of disease biomarkers \cite{li2020multi}, and for identification of brain structural relationships across diseases and clinical cohorts using (federated) dimensionality reduction from shape features \cite{silva2019federated}. COINSTAC \cite{plis2016} provides a privacy-preserving distributed data processing framework for brain imaging. Depending on the requirements and computational characteristics of the federated learning environment, the participating sites (learners) can be organized under different topologies \cite{yang2019federated,rieke2020future}. In a star topology (Figure~\ref{fig:FederatedLearningEnvironmentArchitecture}), the learners communicate through a head server that is responsible for coordinating the federation training (e.g., our work and \cite{sheller2018multi,li2019privacy,li2020multi}). In a peer-to-peer topology \cite{roy2019braintorrent}, learners can communicate directly with each other without a distinguished coordinator. Most current FL approaches \cite{mcmahan2017communication,li2018federated,bonawitz2019towards} compute the global model through a synchronous communication protocol. However, in heterogeneous environments, stragglers may slow down convergence. Our Semi-Synchronous protocol \cite{stripelis2020semisynchronous} counters this inefficiency by assigning more local computation to the underutilized learners to accelerate convergence. Preserving data privacy is critical in Federated Learning environments. Common methods for privacy protection are differential privacy \cite{abadi2016deep} and homomorphic encryption \cite{zhang2020batchcrypt}. For example, the federated learning system for brain tumor segmentation in \cite{li2019privacy} used differential privacy techniques. We are developing a homomorphic encryption approach in our architecture, but it is out of the scope of this paper. Finally, our deep learning model for estimating brain age from structural MRI scans is closely related (albeit different) to \cite{cole2017predicting,jonsson2019brain,PENG2020101871}. However, we use Federated Learning to learn the joint model, as opposed to using majority voting and linear regression data blending to combine CNN brain age predictions from different data sources as in \cite{jonsson2019brain}. \section{Federated Learning} Federated Learning operates over sites that do not share data, so the joint model is obtained through parameter sharing and mixing \cite{yang2019federated,rieke2020future}. Figure \ref{fig:FederatedLearningEnvironmentArchitecture} shows the typical Federated Learning architecture. Here, we consider that a single neural network, known to all the sites, is being optimized. Each site (learner) trains the neural network on its own local private dataset and shares only the locally-learned parameters with a head server, the Federation controller, which is responsible for aggregating the local parameters to generate a community neural network, which is in turn sent back to the learners. \textbf{Federated Optimization.} The primary goal in Federated Learning is to jointly learn a global/community model across a federation of N learners, with non-co-located data, by optimizing the global objective $f(w)$: \begin{equation}\label{eq:FederatedFunction} w^*=\underset{w}{\mathrm{argmin}} f(w) \:\: \text{with} \:\: f(w)=\sum_{k=1}^{N}\frac{p_k}{\sum p_k}F_k(w) \end{equation} \noindent where $p_k$ is the contribution value of a learner $k$ to the federation and $F_k(w)$ its local objective function. The contribution value $p_k$ can be static, or dynamically defined at run time~\cite{stripelis2020accelerating}. In much recent work \cite{mcmahan2017communication, bonawitz2019towards}, the learners are weighted based on the number of local training examples ($p_k=|D_{k}^T|$), since this is a good proxy for the value of a local model, but other methods that directly measure performance are possible~\cite{stripelis2020accelerating}. \begin{figure}[htpb] \centering \includegraphics[width=\linewidth]{brainage_plots/BrainAgeFederationArchitecture.png} \captionsetup{justification=centering} \caption{Federated Learning Architecture} \label{fig:FederatedLearningEnvironmentArchitecture} \end{figure} \textbf{Synchronous Training.} In the original Federated Learning algorithm \cite{mcmahan2017communication,bonawitz2019towards}, every learner performs a predefined number of local updates (batches or epochs) before reaching a synchronization point where it shares its local model with the federation. This computational approach, which we refer to as Synchronous Federated Average (\textit{SyncFedAvg}), has been extensively explored \cite{mcmahan2017communication,li2018federated,bonawitz2019towards}. \textbf{Semi-Synchronous Training.} We introduced a Semi-Synchronous training protocol (\textit{SemiSync}) \cite{stripelis2020semisynchronous} where each learner trains for a given amount of time before synchronization. Each learner processes a variable number of data batches between synchronization points depending on its computational power and amount of data. SemiSync parameterizes the synchronization period based on the time that it takes for the slowest learner in the federation to perform a single epoch. The number of local updates (batches) $\mathcal{B}_k$ a learner $k$ performs between synchronization points is computed as: \begin{equation}\label{eq:SemiSynchronousScheduling} \begin{gathered} t_{max}(\lambda) = \lambda * \max \limits_{k \in N} {\{\frac{|D_k^T|}{\beta_k} * t_{\beta_k}\}}, \lambda, \beta_k,t_{\beta_k} >0 \\ \mathcal{B}_k = \dfrac{t_{max}}{t_{\beta_{k}}}, \quad \forall k \in N \end{gathered} \end{equation} \noindent where $|D_k^T|$ is the number of local training examples, $\beta_k$ is the learner's local batch size defined at global model initialization and $t_{\beta_k}$ is the time it takes to perform a local batch (i.e., an update). The hyperparameter $\lambda$ controls the communication frequency of the learners by adjusting the number of local updates per learner based on the time it takes for the slowest learner to perform $\lambda$ local epochs. This training policy is particularly effective in federated learning settings where learners have homogeneous computational power, but heterogeneous amounts of data, as well as in settings where learners have heterogeneous computational power and/or heterogeneous amounts of data \cite{stripelis2020semisynchronous}. \section{Federated Brain Age Prediction} \label{sec:BrainAgeModel} The learning task we investigate here is brain age prediction. Deep 3D convolutional regression networks have been used for brain age prediction \cite{cole2017predicting,jonsson2019brain}. These networks extend the VGG and ResNet architectures to 3D images by replacing 2D convolution/maxpool operations with their 3D counterparts. \textbf{Neural Architecture.} Figure~\ref{fig:brainage_cnn} shows the convolutional encoding network we trained for the brain age prediction task. The model architecture is similar to that in \cite{PENG2020101871} with the main difference being the replacement of the batch normalization (BatchNorm) layer with an instance normalization (InstanceNorm) layer. Collectively, the network consists of seven blocks, with the first five composed of a 3x3x3 3D convolutional layer (stride=1, padding=1), followed by an instance norm, a 2x2x2 max-pool (stride=2), with ReLU activation functions. The number of filters in the first block is 32 (and doubles until 256) with both layers 4 and 5 having 256 filters. The sixth block contains a 1x1x1 3D convolutional layer (stride=1, filters=64), followed by an instance norm and ReLU activation. The final, seventh, block contains an average pooling layer, a dropout layer (set to p=0.5 during training), and a 1x1x1 3D convolutional layer (stride=1). To train the model we used Mean Squared Error as loss function and Vanilla SGD as the network's optimizer. \vspace{-1mm} \begin{figure}[htb] \centering \includegraphics[width=\linewidth]{brainage_plots/BrainAgeCNN_v2.png} \caption{BrainAgeCNN} \label{fig:brainage_cnn} \end{figure} \vspace{-1mm} \textbf{Federated Model.} During federated training all learners train on their local data using the same neural architecture and hyperparameters (e.g., learning rate, batch size). Once a learner finishes its local training, it sends its local model parameters to the controller. \section{Experiments} \label{sec:Experiments} Our goal is to apply Federated Learning to hospital consortia, and to large research studies like Enigma (enigma.ini.usc.edu). As an initial step in a controlled environment, we analyzed brain MRI data from the UK Biobank \cite{miller2016multimodal}, a large epidemiological study of 500,000 people residing in the United Kingdom, some with neuroimaging. We explored several heterogeneous federated learning scenarios with different data distributions and amounts of data per learner and evaluated the performance and convergence rate of the federation. \textbf{NeuroImaging Data.} From the original UKBB dataset of 16,356 individuals with neuroimaging, we selected 10,446 who had no indication of neurological pathology, and no psychiatric diagnosis as defined by the ICD-10 criteria. The age range was 45-81 years (mean: 62.64; SD: 7.41; 47\% women, 53\% men). All image scans were evaluated with a manual quality control procedure, where scans with severe artifacts were discarded. The remaining scans were processed using a standard preprocessing pipeline with non-parametric intensity normalization for bias field correction1 and brain extraction using FreeSurfer and linear registration to a (2 mm)$^3$ UKBB minimum deformation template using FSL FLIRT. The final dimension of the registered images was 91x109x91. The 10,446 records were split into 8356 for train and 2090 for test. \vspace{-5mm} \begin{figure}[htpb] \captionsetup{justification=centering} \subfloat[Uniform \& IID \newline Age Buckets]{ \includegraphics[width=0.32\linewidth]{brainage_plots/AgeBuckets_brainage_cnn5_federation_8FastLearners_atBDNF_SyncFedAvg_uniform_datasize_iid_v3.png} \label{subfig:UKBB_AgeBuckets_Uniform_IID} } \subfloat[Uniform \& Non-IID Age Buckets]{ \includegraphics[width=0.32\linewidth]{brainage_plots/AgeBuckets_brainage_cnn5_federation_8FastLearners_atBDNF_SyncFedAvg_uniform_datasize_noniid_v3.png} \label{subfig:UKBB_AgeBuckets_Uniform_NonIID} } \subfloat[Skewed \& Non-IID Age Buckets]{ \includegraphics[width=0.32\linewidth]{brainage_plots/AgeBuckets_brainage_cnn5_federation_8FastLearners_atBDNF_SyncFedAvg_skewed_datasize_noniid_v3.png} \label{subfig:UKBB_AgeBuckets_Skewed_NonIID} } \subfloat[Uniform \& IID \newline Age Distribution]{ \centering\includegraphics[width=0.32\linewidth]{brainage_plots/AgeDistributions_brainage_cnn5_federation_8FastLearners_atBDNF_SyncFedAvg_uniform_datasize_iid.png} \label{subfig:UKBB_AgeDistribution_Uniform_IID} } \subfloat[Uniform \& Non-IID Age Distribution]{ \centering\includegraphics[width=0.32\linewidth]{brainage_plots/AgeDistributions_brainage_cnn5_federation_8FastLearners_atBDNF_SyncFedAvg_uniform_datasize_noniid.png} \label{subfig:UKBB_AgeDistribution_Uniform_NonIID} } \subfloat[Skewed \& Non-IID Age Distribution]{ \centering\includegraphics[width=0.32\linewidth]{brainage_plots/AgeDistributions_brainage_cnn5_federation_8FastLearners_atBDNF_SyncFedAvg_skewed_datasize_noniid_v2.png} \label{subfig:UKBB_AgeDistribution_Skewed_NonIID} } \captionsetup{justification=centering} \caption{UKBB Federation Data Distributions} \label{fig:UKBB_Federation_Age_Probability_Distribution} \end{figure} \textbf{Data Distributions.} We define several challenging learning environments by partitioning the centralized UKBB neuroimaging training dataset (8356 records) across a federation of 8 learners \footnote{Available at: \url{https://dataverse.harvard.edu/dataset.xhtml?persistentId=doi:10.7910/DVN/2RKAQP}} Every environment was evaluated on the same test dataset (2090 records) and the learners used their allocated records for training. As shown in Figure~\ref{fig:UKBB_Federation_Age_Probability_Distribution}: panels (a, b, c) show the amount of data (and age buckets), and the corresponding (d, e, f) show the detailed age distribution of each of the 8 learners. Figures~\ref{fig:UKBB_Federation_Age_Probability_Distribution}(a,d) show a uniform (same amount of data per learner) and IID (all ages) distribution. Figures~\ref{fig:UKBB_Federation_Age_Probability_Distribution}(b,e) show a uniform, but non-IID (subset of ages) distribution. Figures~\ref{fig:UKBB_Federation_Age_Probability_Distribution}(c,f) show a skewed (different amount of data per learner) and non-IID distribution. \textbf{Training Environment.} We established a federation of 8 learners by assigning one learner to each GPU of a server with 8~GeForce GTX 1080 Ti graphics cards (10~GB RAM each), 40~Intel(R) Xeon(R) CPU E5-2630 v4 @ 2.20GHz, and 128GB DDR4 RAM. All learners trained on the same CNN model (Fig.~\ref{fig:brainage_cnn}). For both centralized and federated models, we used Vanilla SGD with a learning rate of $5\text{x}10^{-5}$ and a batch size ($\beta_k$) of 1. For SyncFedAvg, each learner runs 4 local epochs in all distributions. For SemiSyncFedAvg, the time per batch ($t_{\beta_{k}}$) for every learner is 120ms, the maximum time of a single epoch across all learners is 280secs (learner~1 that holds the largest partition: $\sim$2,400 examples), thus for $\lambda=4$ the maximum time ($t_{max}$) is 1,120secs (cf. Eq. \ref{eq:SemiSynchronousScheduling}). Finally, the assigned number of local updates ($\mathcal{B}_k$) per learner is close to 9300. For all experiments, the random seed was 1990. \begin{figure}[htpb] \captionsetup{justification=centering} \centering \subfloat[Wall-Clock Time]{ \centering\includegraphics[width=0.8\linewidth]{brainage_plots/ComprehensiveConvergenceRate_WallClockTime_v2.png} \label{subfig:UKBB_PoliciesConvergence_WallClockTime} } \subfloat[Federation Rounds]{ \includegraphics[width=0.8\linewidth]{brainage_plots/ComprehensiveConvergenceRate_FederationRounds_v2.png} \label{subfig:UKBB_PoliciesConvergence_FederationRounds} } \captionsetup{justification=centering} \caption{UKBB Brain Age Federated Policies Performance} \label{fig:UKBB_FederatedPoliciesConvergence} \end{figure} \textbf{Evaluation.} We compare the performance of brain age prediction in settings with uniform and skewed data sizes, and with IID and non-IID age distributions. Since we consider a homogeneous computational environment with 8 identical learners (GPUs) and the computational cost of each learner only depends on the amount of data, for uniform data sizes we only show results for the Synchronous Federated Average policy (SemiSync performs the same). For skewed data sizes, we show both synchronous and semi-synchronous policies. Figure \ref{subfig:UKBB_PoliciesConvergence_WallClockTime} shows the performance of the training policies over the different environments in terms of elapsed (wall-clock) time (i.e., the 8 learners running in parallel). For the Uniform and IID setting, the federation reaches a Mean Absolute Error (MAE) value that is very close to the one achieved by the centralized model. More challenging Non-IID settings lower the performance, with a final error of 0.5 years over the centralized model (cf. Table~\ref{table:UKBB_Evaluation}). The Semi-Synchronous FedAvg policy has a faster convergence and slightly better final performance than Synchronous FedAvg. Even though the computational power of each learner is the same (identical GPUs), in the skewed data setting for the SyncFedAvg policy the learners with the smaller amounts of data remain idle until the learner with the most data finishes its allocated epochs. In contrast, the SemiSync policy continuously processes batches without any idle time. This additional computation results in the improved convergence in this setting. Figure~\ref{subfig:UKBB_PoliciesConvergence_FederationRounds} shows the performance in terms of federation rounds, which is a proxy for the communication cost of the policy.% \footnote{Note that the wall-clock time for each federation round depends on the data distribution. To process the 25 federation rounds in Figure~\ref{subfig:UKBB_PoliciesConvergence_FederationRounds}, SyncFedAvg takes 15,482 seconds in the Uniform and IID setting, 15,777 seconds in the Uniform and Non-IID setting, and 22,713 seconds in the Skewed and Non-IID setting. For 25 federations rounds in the Skewed and Non-IID setting SemiSyncFedAvg takes 23,048 seconds. } At the end of the allocated epochs for SyncFedAvg, or $\lambda$ time for SemiSyncFedAvg, all learners share their models with the Federation Controller, which then computes the community model and sends it back to the learners. Thus, the number of models exchanged through the network is twice the number of federation rounds times the number of learners. As before, SemiSyncFedAvg shows faster convergence in terms of communication cost than SyncFedAvg. \vspace{-3mm} \begin{table}[htpb] \noindent \tiny \begin{center} \begin{tabular}{@{}llccccc@{}} & & \textbf{MSE} & \textbf{RMSE} & \textbf{MAE} & \textbf{Corr}\\ \toprule \multicolumn{2}{l}{\textbf{Centralized Model}} & 12.885 $\pm$ 0.021 & 3.589 $\pm$ 0.003 & 2.895 $\pm$ 0.006 & 0.881\\ \toprule \multicolumn{2}{l}{\textbf{Federated Model}} & & & & \\ \textbf{Data Distribution} & \textbf{Policy} & & & &\\ \cmidrule(r){1-2} \textbf{Uniform \& IID} & SyncFedAvg & 13.749 $\pm$ 0.138 & 3.707 $\pm$ 0.018 & 2.995 $\pm$ 0.018 & 0.875 \\ \midrule \textbf{Uniform \& Non-IID} & SyncFedAvg & 19.853 $\pm$ 1.347 & 4.453 $\pm$ 0.151 & 3.625 $\pm$ 0.135 & 0.861\\ \midrule \textbf{Skewed \& Non-IID} & SyncFedAvg & 19.148 $\pm$ 0.086 & 4.376 $\pm$ 0.009 & 3.553 $\pm$ 0.003 & 0.851\\ & SemiSync($\lambda$=4) & 18.491 $\pm$ 0.122 & 4.311 $\pm$ 0.015 & 3.505 $\pm$ 0.008 & 0.864\\ \bottomrule \end{tabular} \end{center} \captionsetup{justification=centering} \vspace{-1mm} \caption{UKBB Evaluation. Mean and std values for 3 runs.} \label{table:UKBB_Evaluation} \end{table} \vspace{-3mm} \section{Conclusion} \label{sec:Conclusion} We have demonstrated the effectiveness of the Federated Learning paradigm in the neuroimaging domain by collaboratively learning a global model for brain age prediction. We empirically evaluated the convergence of the federated model in statistically heterogeneous learning environments. Our immediate future work includes investigating additional learning tasks, such as disease prediction, and incorporating homomorphic encryption in the architecture We simulated the non-IID case by subsampling UKB data, but we plan to examine the more realistic case where learners receive data from different scanning protocols and cohorts, which would exhibit natural acquisition and population differences. This will better show the different relative performance of the different training policies. Finally, we plan to explore federated transfer learning in neuroimaging. \section{Acknowledgments} \label{sec:Acknowledgements} This research was supported in part by the Defense Advanced Research Projects Activity (DARPA) under contract HR0011\-2090104, and in part by the National Institutes of Health (NIH) under grants U01AG068057 and RF1AG051710. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of DARPA, NIH, or the U.S. Government. \section{Compliance with Ethical Standards} This is a study of previously collected, anonymized, de-identified data, available in a public repository. Data access approved by UK Biobank under Application Number 11559. \bibliographystyle{IEEEbib}
\chapter{Final Considerations} \epigraph{\textit{I managed to get a quick PhD — though when I got it I knew almost nothing about physics. But I did learn one big thing: that no one knows everything, and you don't have to.}}{Steven Weinberg} \section*{Summary} Research on DE is a tricky business. In principle, one should just try to answer to the question of what is causing the accelerated expansion of the Universe, but in practice this is just the first domino tile of a long chain. The Cosmological Constant $\Lambda$ seems to be the most reasonable and simplest candidate of Dark Energy, in particular because together with the CDM paradigm is able to safely match a number of different observations. However, with the outstanding precision reached in the last years in observational cosmology, the concordance model seems to be not so concordant, with the most uncomfortable question being what is the value of the Hubble parameter now. Curiously, this seems to be an evergreen question in cosmology since from its birth, and it is inspiring the tenacity shown by the scientific community through the last hundred years in looking for a satisfactory answer. We tried to give an overview of the $\Lambda$CDM model in chapter~\ref{chapter:LCDM} of this work; our main goal was to highlight the pillars on which it is built on and the kind of questions that it is able to answer. Of course our presentation is by no means exhaustive or complete by itself, but we hope it is able at least to address a satisfactory number of references for the curious reader. DE is so interesting because it could be a window towards new physics or, depending on one's personal perspective, it is already a manifestation of it. The community working on this topic has undoubtedly shown a fair amount of creativity in the last two decades, both in boosting or trying to contain the proliferation of possible candidates of DE. In chapter~\ref{chapter:DE} we tried to give a reasonable classification of the kind of models that were proposed in the last years based on the Lovelock theorem. Keeping into account that a proper treatment of the topic would have required more than a textbook, for each class of models we presented some examples in an attempt of transmitting the flavor and the potential of these proposals. The ultimate goal of this thesis is to present the results of our research from the last four years. Most of it was oriented on models of DE which does not introduce in the playground new degrees of freedom, but instead attempt to ascribe the accelerated expansion of the Universe to geometrical modifications of the gravitational interaction. An interesting phenomenology arises if in such geometrical description we relax the assumption of locality for the field equations. Ultimately, the main motivation for considering these kinds of models is that quantum mechanics seems to be nonlocal at fundamental level, and such could also be a quantum description of gravity. In chapter~\ref{chapter:NL} we review the theoretical grounds and the mathematical formalism of nonlocal models of gravity based on the inverse d'Alembertian of the Ricci scalar $\Box^{-1} R$. In chapter~\ref{chapter:PCNL} we present the results of our research on nonlocal gravity models, in particular~\cite{Giani:2019vjf,Giani:2019xjf}: \begin{itemize} \item We found that the Late-times asymptotic equation of state has a common behavior in those models which contain explicitly a term $\Box^{-1}R$ in the Lagrangian. In particular, even if the Hubble factor does not approach a constant value, we found that $\dot{H}/H^2 \rightarrow 0$ because $H\rightarrow \infty$ due to the divergence of $\Box^{-1}R$. We also show that this does not happen for the DW model if the distortion function $f(\Box^{-1})R$ is chosen in such a way that $f(\infty) \neq \infty$. \item We studied VAAS gravity within a dynamical system approach and found no stable critical points. On the other hand, a qualitative study of its field equations show that it is indeed possible to produce at background level an evolution history compatible with $\Lambda$CDM from the radiation dominated epoch until today. \item Still in VAAS gravity, we have shown that on local scales the effects of the nonlocal modifications is encoded in a slip parameter and in a modification of the effective gravitational coupling $\eta, Y \neq 1$. \item We checked consistency of the model with LLR constraints, which are not passed. However, we found that the field equations admit spherically symmetric static solutions which, if realized and stable, would satisfy trivially LLR constraints and for which one of the gravitational potential closely resemble the solution one would obtain in standard GR for the Schwarzschild-deSitter solution. \end{itemize} In chapter~\ref{chapter:IR} we discuss a geometrical theory of gravity containing higher order derivative terms which we proposed in Ref.~\cite{Amendola:2020qho}. The theory is based on the introduction of the anticurvature scalar $A$, which is the trace of the inverse of the Ricci tensor $A_{\mu\nu} = R^{-1}_{\mu\nu}$. We derive the general field equations for an $f(R,A)$ theory and assess their potential for cosmological implications. We found that an interesting phenomenology arise already for the simplest choices of $f$, but also a no-go theorem which claims that polynomial Lagrangians are not able to reproduce a viable cosmological history. Finally, we present some choices of $f$ that evades the no-go theorem and thus are worth further investigation. Finally, in chapter~\ref{chapter:Lensing} we present the results of our works~\cite{Piattella:2017uat,Giani:2020fpz} about the potential of Strong Lensing observables to study cosmology and DE. In particular, we introduce two new quantities, the \textit{angular drift} and the \textit{Time Delay drift}, which are a manifestation of the Hubble flow in a lensed system. These drifts, if measured, would allow for a reconstruction of $H(z)$ at the redshift of the lens, and thus potentially very helpful for estimating the effective equation of state parameter of the Universe $w_{eff}$. We also show that in a modified theory of gravity with a time dependent gravitational coupling, a similar effect arise, and we can use Strong Lensing Time Delay observations to constrain violations of the Equivalence Principle. The entity of these drifts is unfortunately beyond the sensitivity of current experiment, and results in very weak constraints on $\dot{G}/G$. However, we also discuss some possible future perspectives that would make them appealing. \section*{Outlooks} Most of the nonlocal models of gravity presented in the literature seems to be ruled out by LLR constraints. On the other hand they are motivated by fundamental physics, and as we saw in Ref.\cite{Giani:2019xjf} in most cases they provide a useful mechanism to trigger an accelerated expansion of the Universe only at Late-times. For these reasons we are currently trying to understand if they can be used, together with a Cosmological Constant $\Lambda$, to alleviate or solve the $H_0$ tension by changing the rate of expansion of the universe today without affecting CMB measurements or violating LLR constraints. Regarding VAAS, a perturbative analysis beyond the small scales regime is still lacking, and is crucial for properly assess the appealing of the model with respect to $\Lambda$CDM. We address this analysis for future works. Inverse Ricci gravity offers a completely new class of modified gravity theories, and as we saw it can introduce a very interesting phenomenology. On the other hand, containing higher order derivatives, one expect that it is in general unstable unless the Lagrangian is degenerate. We address to future works a research of which kind of $f(A,R)$ will result in a degenerate Lagrangian capable of escaping the no-go theorem. Finally, the increasing precision of Strong Lensing measurements motivate a deeper investigation of the cosmological information we can extract from them. Moreover, being equivalent to an interferometer with arms of astrophysical size, a strongly lensed system could be sensitive to the passage of a gravitational wave. This could be very interesting for multi-messenger astronomy, and we address to future works a quantitative estimation of the GW impact on Time Delay measurements to assess the potential of this idea. \chapter{Introduction} \epigraph{\textit{The layman always means, when he says "reality" that he is speaking of something self-evidently known; whereas to me it seems that the most important and exceedingly difficult task of our time is to work on the construction of a new idea of reality.}}{Wolfgang Pauli} This thesis is presented in candidacy for the degree of doctor of philosophy, and its main goal is to report and collect the scientific results we were able to achieve in the last four years towards the understanding of the fundamental nature of Dark Energy. The latter, whatever it is, became a fundamental ingredient in our description of the Universe after the discovery, in the late 90's, of its accelerating expansion~\cite{Riess:1998cb,Perlmutter:1998np}. In particular, our research focuses on those proposals in which Dark Energy is the manifestation of a different theory of gravitation, i.e. on those geometrical theories in which no new degrees of freedom are introduced to drive the present accelerated expansion. However, it is a legitimate question to ask why we should consider such things when the current standard model of cosmology, the $\Lambda$CDM, has proven to be in excellent agreement with a number of different observations. From our point of view, there is indeed no completely satisfactory answer to this question since the cosmological constant is the simplest and yet effective candidate of Dark Energy we can think of. It does not introduce any new physics nor changes significantly the behavior of gravity at small scales (where General Relativity has been tested with astonishing precision). On the other hand, there are a number of less satisfactory answers which motivate the quest for a different description of Dark Energy. First, General Relativity is a century old and some physicists start to get bored, or at least frustrated, of it. There is no commonly accepted framework in which its quantization can be achieved, and it is extremely difficult to explore its properties in strong gravity regimes. For these reasons Cosmology, in particular at early and late times, is a fertile ground both for testing and speculating on the nature of gravitational interaction. A slightly more satisfactory reason is that in the last decade we witnessed the appearance of a growing tension between the result of measurements from the local Universe and at early times. Part of the scientific community believe that these tensions are due to systematic, but a lot of people think that they are actually indications of new physics. At the end of the day, whether there are good reasons for studying Dark Energy or not, it seems to us that the following quote by Weinberg remarkably describes the situation: \textit{"It seems that scientists are often attracted to beautiful theories in the way that insects are attracted to flowers — not by logical deduction, but by something like a sense of smell"}. Motivated by the above considerations, we decided to dedicate chapters \ref{chapter:LCDM} and \ref{chapter:DE} of this thesis to a review of the $\Lambda$CDM model and of the landscape of Dark Energy candidates. The topics presented there are fairly standard and already covered in many textbooks, and the expert reader may freely decide to skip them. On the other hand, in our treatment (by no means complete) we tried to privilege our personal perspectives on the topics, which ultimately provide the motivation for the work done in the subsequent chapters. The third chapter is also introductory in nature, and aims to review the main motivations which led to consider nonlocal modifications of gravity as Dark Energy candidate, as well as some technicalities typical of this approach. The remaining chapters of this thesis contain instead a summary of our results. In chapter \ref{chapter:PCNL} we show some interesting cosmological features of the nonlocal model of gravity proposed in Ref.~\cite{Vardanyan:2017kal}, which we studied in Ref.~\cite{Giani:2019vjf}. Here we also try to explain, based on~\cite{Giani:2019xjf}, the apparently coincidental common behavior shared by different nonlocal models in the late stages of the evolution of the Universe. In chapter \ref{chapter:IR} we introduce a novel class of modified gravity models we recently proposed in Ref.~\cite{Amendola:2020qho}. In chapter \ref{chapter:Lensing} we will discuss how to extract cosmological information from a novel type of observables proposed by us in Ref.~\cite{Piattella:2017uat} in the context of Strong Gravitational Lensing, and how they can be used to test Dark Energy and the Equivalence Principle~\cite{Giani:2020fpz}. \chapter*{Acknowledgments} This work would not have been possible without the support and the help of a huge number of colleagues and professors who I had the pleasure and honour to met at the Federal University of Espirito Santo, and at the Institute for Theoretical Physics of Heidelberg. In particular, I owe my deepest gratitude to Prof. Oliver Fabio Piattella, who did not just completely fulfilled his duties as a supervisor, but has also been the strongest influence and inspiration in my scientific training. It is possible that I have disappointed him as a student, but I hope I did not as a friend. I want also to thank Prof. Luca Amendola for making possible my visiting stages in Heidelberg, and for letting me feel welcome and comfortable in its group. Finally, I need to thank Doctors Tays Miranda and Emmanuel Frion, and M.Sc Giorgio Laverda, who actively contributed to part of the results I am going to present in this thesis, and even more importantly have been close to me when keeping going was not easy. The results presented in this thesis have been possible thanks to the financial support from the Coordenação de Aperfeiçoamento de Pessoal de Nível Superior - Brasil (CAPES) - Finance Code 001, and from the DAAD Co-financed Short-Term Research Grant Brazil, 2019 (57479964). \chapter{Critical points in VAAS gravity} \label{AppendixA} We want to study the critical points of the system \eqref{dsfinitedistance2} satisfying the constraint \eqref{modFriedeq2}. \subsection*{Critical points at finite distance} Consider first the case where $2\alpha V = 1$, which is special because it eliminates $\dot H$ from the field equations. From the Klein Gordon equations we see that $V = 1/(2\alpha) =$ constant only if $m^2 = 0$. The latter is a parameter of the theory so it is not necessarily vanishing and thus, unless $m^2 = 0$, $V$ cannot be constant. With $V = 1/(2\alpha) =$ constant, then $\dot V = Y = 0$ and thus from Eq.~\eqref{modFriedeq2} we get $\rho = 0$. We are just left with the Klein Gordon equation for $U$ while $H$ is completely arbitrary, since we have lost the equations ruling its dynamics. Since providing a suitable $H$ is one of the objectives of the model, we do not consider this possibility anymore. Now we consider $2\alpha V \neq 1$. The right hand sides of the last three equations of the dynamical system~\eqref{dsfinitedistance2} vanish when $X = Y = 0$ and $m^2 = 0$. Again, the latter is a parameter of the theory so it is not necessarily vanishing. Thus if $m^2 \neq 0$ we can already conclude that there are no critical points at finite distance. Let us consider now the subclass of theories for which $m^2 = 0$, i.e. with $R_f = 0$. Demanding the vanishing of the right hand sides of the first three equations of system~\eqref{dsfinitedistance2} and from Eq.~\eqref{modFriedeq2} we have, taking into account $X = Y = m^2 = 0$: \begin{eqnarray} 3H^2(1 - 2 \alpha V) = \frac{\rho - P}{2 M_{ Pl}^{2}}\;,\\ -3 H(\rho + P) = 0\;,\\ H^2(1 - 2\alpha V) = \frac{P - \rho}{2 M_{ Pl}^{2}}\;,\\ 3H^2(1 - 2\alpha V) = \frac{\rho}{M_{ Pl}^{2}}\;. \end{eqnarray} Now, from the second equation above we either have that $H = 0$ or $P = -\rho$, i.e. a vacuum energy equation of state is required. If our fluid model has not such equation of state, then the only possibility is $H = 0$ and thus $\rho = P = 0$. This critical point represents Minkowski space. Note that $U$ and $V$ may assume whatever constant value, except $V = 1/(2\alpha)$. On the other hand, let us assume that indeed the fluid content satisfies a vacuum energy equation of state, i.e. $P = -\rho$. In this case, the above system becomes: \begin{eqnarray} 3H^2(1 - 2 \alpha V) = \frac{\rho}{M_{ Pl}^{2}}\;,\\ H^2(1 - 2\alpha V) = -\frac{\rho}{M_{ Pl}^{2}}\;. \end{eqnarray} Summing the two equations we arrive at: \begin{equation} 4H^2(1 - 2 \alpha V) = 0\;. \end{equation} Since $2\alpha V \neq 1$, we have again $H = 0$ and thus the same Minkowski critical point as before. There is a caveat here. When $m^2 = 0$ the evolution of $U$ is disentangled from the one of $H$. Therefore, we can reduce our dynamical system~\eqref{dsfinitedistance2} to: \begin{subequations}\label{dsm2zero} \begin{eqnarray} \dot{H} &=&\frac{1}{1 - 2 \alpha V} \left[\frac{\rho - P}{2 M_{ Pl}^{2}} + 2\alpha H Y\right] - 3 H^{2}\;,\\ \dot{\rho} &=& -3 H(\rho + P)\;,\\ \dot{Y} &=& - 3 H Y \;,\\ \dot{V} &=& Y\;. \end{eqnarray} \end{subequations} From this system is not difficult to see that there is a critical point \begin{equation} P = -\rho = -M^2_{ Pl}\left(1-2\alpha V\right)3H^2 =\mbox{ constant}\;, \end{equation} which represents a de Sitter phase. With $H > 0$ constant, the equation for $U$ becomes: \begin{equation} \ddot U + 3H\dot U = -12H^2\;, \end{equation} which has the special, non-constant solution $U = -4Ht$. \subsection*{Critical points at infinite distance} In order to investigate the critical points at infinity, we build the Poincaré hyperspherein the variable space plus one dimension. The equation of the sphere is the following: \begin{eqnarray}\label{sphere} h^{2} + r^{2} + p^{2} + x^{2} + y^{2} + u^{2} + v^{2} + z^{2} = 1\;, \end{eqnarray} where: \begin{eqnarray} H \equiv \frac{h}{z}\;, \quad \rho \equiv \frac{r}{z}\;, \quad P \equiv \frac{p}{z}\;, \quad X \equiv \frac{x}{z}\;, \quad Y \equiv \frac{y}{z}\;, \quad U \equiv \frac{u}{z}\; \quad \textrm{and} \quad V \equiv \frac{v}{z}\;. \end{eqnarray} System \eqref{dsfinitedistance2} thus becomes: \begin{subequations}\label{dsinfinitedistance1} \begin{eqnarray} z\dot{h} &=& A (1 - h^{2}) - h \left(r B + x C + y D + u E + v F \right)\;,\\ z\dot{r} &=& B (1 - r^{2})- r \left(h A + x C + y D + u E + v F \right)\;,\\ z\dot{x} &=& C (1 - x^{2}) - x \left(h A + r B + y D + u E + v F \right)\;,\\ z\dot{y} &=& D (1 - y^{2}) - y \left(h A + r B + x C + u E + v F \right)\;,\\ z\dot{u} &=& E (1 - u^{2}) - u \left(h A + r B + x C + y D + v F \right)\;,\\ z\dot{v} &=& F (1 - v^{2}) - v \left(h A + r B + x C + y D + u E \right)\;,\\ z\dot{z} &=& -\left(h A + r B + x C + y D + u E + v F \right)\;, \end{eqnarray} \end{subequations} where the equation for $\dot{z}$ is obtained from Eq.~\eqref{sphere} and the terms $A$, $B$, $C$, $D$, $E$ and $F$ are defined as follows: \begin{subequations} \begin{eqnarray} A &\equiv & \frac{z}{z - 2 \alpha v} \left[\frac{z(r - p)}{2M_{ Pl}^{2}} + \frac{m^{2}z}{2}\left(z - u\right) + 2\alpha h y\right] - 3h^2\;,\\ B &\equiv & - 3 h (r + p)\;,\\ C &\equiv & - 3 h x - 6 h^{2} -\frac{6 z}{z - 2 \alpha v} \left[\frac{z(r - p)}{2M_{ Pl}^{2}} + \frac{m^{2}z}{2}\left(z - u\right) + 2\alpha h y\right]\;,\\ D &\equiv & \frac{m^{2}z^2}{2 \alpha} - 3 h y\;,\\ E &\equiv & zx\;,\\ F &\equiv & zy\;. \end{eqnarray} \end{subequations} The critical points of the above system corresponding to $z = 0$ are critical points at infinity. In order to find them, let us first define a new time parameter such that $\frac{z}{3}\frac{d}{dt} \equiv \frac{d}{d \tau} \equiv\;'$ and the functions: \begin{eqnarray} G \equiv h \left(h^{2} + \gamma r^{2} + x^{2} + y^{2} + 2 h x -1\right)\;,\\ \tilde G \equiv h \left(h^{2} + \gamma r^{2} + x^{2} + y^{2} + 2 h x - \gamma\right)\;, \end{eqnarray} where we have assumed a barotropic equation of state linking pressure to density: \begin{equation} P = (\gamma - 1)\rho\;. \end{equation} The dynamical system \eqref{dsinfinitedistance1} for $z =0$ can thus be written as: \begin{subequations}\label{dsinfinitedistance2} \begin{eqnarray} h' &=& h G\;, \label{dsinfinitedistance2h}\\ r' &=& r \tilde G\;,\\ x' &=& x G - 2 h^{2}\;,\label{dsinfinitedistance2x}\\ y' &=& y G\;, \label{dsinfinitedistance2y}\\ u' &=& u\left(G + h\right)\;,\\ v' &=& v\left(G + h\right)\;. \end{eqnarray} \end{subequations} It is important to emphasise that the solutions of the above system must be compatible with the Friedmann equation, which in terms of the variables on the Poincaré sphere provides: \begin{eqnarray}\label{Friedmanninfinitedistance} \left(1 - 2\alpha \frac{v}{z}\right)\frac{h^{2}}{z^{2}} + \frac{m^{2} u}{6 z} - \frac{\alpha y}{3 z^{2}} (6h + x) - \frac{r}{3 z M_{ Pl}^{2}} = 0\;. \end{eqnarray} Multiplying the above equation for $z^{3}$ and then considering $z = 0$, we obtain: \begin{eqnarray} \alpha v h^{2} = 0. \end{eqnarray} So that at infinity Friedmann equation imposes that at least one among $\alpha$, $v$, $h$ is vanishing. It is easy to see that when $h = 0$ the function $G$ vanishes identically, so we have a critical hyperplane in the variables space corresponding to Minkowski spacetime. We will discuss later the stability of this critical hypersurface, and focus now on the only other interesting case,\footnote{We do not consider $\alpha = 0$ since it simply turns off the nonlocal interacting term.} $v = 0$. In this case, Friedmann equation becomes: \begin{equation}\label{Friedeqvzero} h^2 -\alpha y \left(2h + \frac{x}{3} \right) = 0 \;. \end{equation} Since $h \neq 0$, then from Eqs.~\eqref{dsinfinitedistance2h} and \eqref{dsinfinitedistance2y} we have that: \begin{equation} y = h + K\;, \end{equation} where $K$ is an integration constant. From Eq.~\eqref{Friedeqvzero} we then have: \begin{equation} x = \frac{3h^2}{\alpha y} - 6h = \frac{3h^2}{\alpha(h + K)} - 6h\;. \end{equation} This result allows us to rewrite Eq.~\eqref{dsinfinitedistance2x} as follows: \begin{equation}\label{xhequation} x' = G\left[\frac{3h^2}{\alpha \left(h + K\right)} - 6h\right] - 2h^2 \; , \end{equation} and we see that it is impossible to have both \eqref{dsinfinitedistance2h} and \eqref{xhequation} vanishing without $G=h=0$, and so there are no critical points, but $h = 0$, at infinite distance. \subsection*{Linearisation and stability of the critical point} In order to calculate the stability of the critical points at $h = 0$, let us linearise system \eqref{dsinfinitedistance2} around the critical point $h_{0} =0$, i.e, $h = h_{0} + \epsilon$, $r = r_{0} + \eta$, $x = x_{0} + \chi$, $y = y_{0} + \varphi$, $u = u_{0} + \lambda$ and $v = v_{0} + \sigma$. Consequently, the linearised dynamical system is given by: \begin{subequations}\label{linearizedds} \begin{eqnarray} \epsilon ' &=& 0 \; ,\label{linearizeddsepsilon}\\ \eta ' &=& r_{0} \left(\gamma r_{0}^{2} + x_{0}^{2} + y_{0}^{2} - \gamma \right) \epsilon \; ,\\ \chi ' &=& x_{0} \left(\gamma r_{0}^{2} + x_{0}^{2} + y_{0}^{2} - 1 \right) \epsilon \; ,\\ \varphi ' &=& y_{0} \left(\gamma r_{0}^{2} + x_{0}^{2} + y_{0}^{2} - 1 \right) \epsilon \; ,\\ \sigma ' &=& u_{0} \left(\gamma r_{0}^{2} + x_{0}^{2} + y_{0}^{2}\right) \epsilon \; ,\\ \lambda ' &=& v_{0} \left(\gamma r_{0}^{2} + x_{0}^{2} + y_{0}^{2}\right) \epsilon \; . \end{eqnarray} \end{subequations} Usually the stability of the critical point is studied by means of the Jacobian matrix, but unfortunately it is degenerate in our case. However, we easily recognise that in the above system of equations the perturbation $\epsilon$ is constrained to be a constant by \eqref{linearizeddsepsilon}. Note also that the combinations $\left(\gamma r_{0}^{2} + x_{0}^{2} + y_{0}^{2} - 1 \right)$ and $\left(\gamma r_{0}^{2} + x_{0}^{2} + y_{0}^{2} - \gamma \right)$ are constant as long as we assume a time-independent equation of state. Thus all the perturbations with the exception of $\epsilon$, which is constant, go linearly with time showing an unstable behavior. \chapter{Qualitative dynamic of nonlocal models } \label{appendixB} \subsection*{Qualitative behavior of $U$} The Klein Gordon equation for $U$ in FLRW backround, defining $X \equiv U'$ and using $N= \log a$ as time coordinate is: \begin{equation} X' + \left(3 + \xi\right)X + 6\left(2 + \xi\right) = 0\;. \end{equation} The formal solution for $X'$ is: \begin{equation} X(N) = C_1e^{-F(N)} - 6e^{-F(N)}\int^N_{N_i} d\bar Ne^{F(\bar N)}[2 + \xi(\bar N)]\;, \end{equation} which choosing vanishing initial conditions give: \begin{equation} X(N) = -6e^{-F(N)}\int^N_{N_i} d\bar Ne^{F(\bar N)}[2 + \xi(\bar N)]\;. \end{equation} It is straightforward to show that $0 \leq X \leq 6$, indeed rewrite the solution for $X$ as follows: \begin{equation} X(N) = -6e^{-F(N)}\int^N_{N_i} d\bar Ne^{F(\bar N)}[3 + \xi(\bar N)] + 6e^{-F(N)}\int^N_{N_i}d\bar Ne^{F(\bar N)}\;. \end{equation} The first integral can be cast as: \begin{equation} X(N) = -6e^{-F(N)}\int^N_{N_i} d\bar N\frac{d(e^{F(\bar N)})}{d\bar N} + 6e^{-F(N)}\int^N_{N_i}d\bar Ne^{F(\bar N)}\;, \end{equation} and thus: \begin{equation} X(N) = -6 + 6e^{-F(N)} + 6e^{-F(N)}\int^N_{N_i}d\bar Ne^{F(\bar N)}\;. \end{equation} Being the second and third terms on the right hand side strictly positive, we have then that $X(N) > -6$. \subsection*{Qualitative behavior of VAAS} During the radiation-dominated epoch one has $\xi = -2$ and thus: \begin{equation} X = 0\;, \end{equation} This implies that $U$ is a constant, and this constant must be zero, because of our initial condition. On the other hand, \begin{equation} Y(N) = -e^{-(N-N_i)}\int^N_{N_i} d\bar Ne^{(\bar N-N_i)}\frac{m^2}{H_0^2\Omega_{ r0}e^{-4\bar N}} = -\frac{m^2}{5H_0^2\Omega_{ r0}}e^{-N}\left(e^{5N} - e^{5N_i}\right)\;, \end{equation} from which: \begin{equation} \tilde V = -\frac{m^2}{20H_0^2\Omega_{ r0}}e^{4N} - \frac{m^2}{5H_0^2\Omega_{ r0}}e^{5N_i - N} + C_3\;. \end{equation} Since $\tilde V(N_i) = 1$, we then have: \begin{equation} \tilde V = -\frac{m^2}{20H_0^2\Omega_{ r0}}e^{4N} - \frac{m^2}{5H_0^2\Omega_{ r0}}e^{5N_i - N} + \frac{m^2}{4H_0^2\Omega_{ r0}}e^{4N_i} + 1\;. \end{equation} This is very small for $N$ large and negative, so one can basically take $\tilde V = 1$. During the matter-dominated epoch we have $\xi = -3/2$ and thus: \begin{equation} X = -3e^{-3N/2}\int^N_{\tilde N_i} d\bar Ne^{3\bar N/2} = -2 + 2e^{3\tilde N_i/2}\;, \end{equation} where $\tilde N_i$ is some new initial value, chosen in the matter-dominated epoch. Being this large and negative, we neglect the exponential with respect to $-2$ and so a linear solution for $U$ follows: \begin{equation} U = C_1 - 2N\;, \end{equation} with $C_1$ integration constant. For $Y$ we have a solution similar to the one we found for the radiation-dominated case. We simplify it a little bit, writing: \begin{equation} \tilde V = 1 - \frac{m^2}{12H_0^2\Omega_{ m0}}e^{3N}\;. \end{equation} We have neglected all the exponentials contributions containing the initial e-folds number because, even in the matter-dominated epoch, it is very small. It is only at late times that $\tilde V$ starts to grow different from one. In vacuum, i.e. when matter and radiation dilute, the first Friedmann equation is: \begin{equation} 3\tilde V = -\frac{m^2U}{2H^2} - \frac{Y}{2}(6 + X) + \frac{\rho}{M_{Pl}^2H^2}\;. \end{equation} Since $U < 0$, $Y < 0$, $X > -6$ and of course $\rho > 0$, we can conclude that $\tilde V > 0$. On the other hand, $Y < 0$ tells us that $\tilde V$ always decreases. So, in order for $\tilde V$ to decrease from one to zero, without becoming negative, we need that $m^2/H^2 \ge 1$ only for a limited interval of e-folds. This, in particular, means that $H$ cannot tend to zero in the far future, for large $N$, but it must increase in order to guarantee that $m^2/H^2 \ll 1$. On the basis of this argument, we can conclude that at late-times, when the matter is completely diluted: \begin{equation} 3\tilde V \sim -\frac{m^2U}{2H^2}\;, \end{equation} this however provided that $X$ does not diverge, otherwise we cannot neglect the product $XY$ in general. Combining the two Friedmann equations, we have that: \begin{equation} \xi = -3 + \frac{1}{\tilde V}\left[-Y + \frac{m^2(1 - U)}{2H^2} + \frac{\rho - P}{2M_{ Pl}^2H^2}\right]\;. \end{equation} For non-exotic fluids one has $\rho - P > 0$ and therefore we see that definitely $\xi > -3$. At late times, according to our previous discussion, we have that: \begin{equation} \xi \sim -3 - \frac{1}{\tilde V}\frac{m^2U}{2H^2} \sim 0\;. \end{equation} Hence, the effective equation of state always tends to $-1$. We can check now directly that $X$ does not diverge from its solution, computed with $\xi = 0$. One obtains: \begin{equation} X = -4\;, \end{equation} i.e. a $U$ growing indefinitely negative, say: \begin{equation} U = C_1 - 4N\;. \end{equation} With this solution, we are left with two equations: \begin{eqnarray} Y + 3\tilde V = -\frac{m^2}{2H^2}U\;,\\ Y' + 3Y = -\frac{m^2}{H^2}\;. \end{eqnarray} The derivative of the left hand side of the first equation is equal to the left hand side of the second equation. Hence, one finds that: \begin{equation} \xi = -\frac{3}{C_1 - 4N} = -\frac{3}{U}\;, \end{equation} and we have the solution for $H$: \begin{equation} H = C_2|C_1 - 4N|^{3/4} = 3|U|^{3/4}\;. \end{equation} The solution for $H'$ is instead: \begin{equation} H' = -\frac{3C_2}{C_1 - 4N}|C_1 - 4N|^{3/4}\;. \end{equation} \subsection*{$\Box^{-2}R$ model} This model was proposed in Ref. \cite{Amendola:2017qge} and is motivated from studies of nonperturbative lattice quantum gravity. The Lagrangian is: \begin{equation} \mathcal{L} = \mathcal{L}_{EH} -\frac{M^4}{6}\frac{1}{\Box^2}R \; , \end{equation} and is localized introducing the auxiliary fields: \begin{eqnarray} \Box U = -R\; , \\ \Box S = -U \; , \\ \Box Q = -1\; , \\ \Box L = -Q \; . \end{eqnarray} The field equations are: \begin{eqnarray} h^2=\frac{\gamma}{4}\left[V + WU + h^2\left( 6Z + 6Z' -U'Z' -V'W' \right)\right] + \Omega_R^0e^{-4N} + \Omega_M^0 e^{-3N} \; , \label{CosmoB1} \\ \xi = \frac{1}{2\left(1 - \frac{3}{2}\gamma Z\right)}\left[\frac{-4\Omega_R^0e^{-4N} -3\Omega_M^0 e^{-3N}}{h^2} + \frac{3}{2}\gamma \left(\frac{W}{h^2} -4Z' + U'Z' + V'W'\right)\right] \; , \label{Cosmob2} \end{eqnarray} \begin{eqnarray} U'' + \left(3 + \xi\right)U = 6\left(2 + \xi\right) \;, \label{KGBU} \\ V'' + \left(3 + \xi\right)V'= \frac{U}{h^2}\;, \label{KGBV}\\ W'' + \left(3 + \xi\right)W'= \frac{1}{h^2}\;, \label{KGBW}\\ Z'' + \left(3 + \xi\right)Z'= \frac{W}{h^2}\; \label{KGBZ}. \end{eqnarray} defining $\tilde{Z}= 1-\frac{3}{2}\gamma Z$ we can rewrite the late-times Friedmann equations \eqref{CosmoB1} \eqref{Cosmob2}, when matter is completely diluted, as: \begin{eqnarray} \tilde{Z} &=& \frac{\gamma}{4h^2}\left(UW + V \right) -\tilde{Z}'\left(1 - \frac{U'}{6}\right) - \frac{\gamma W' V'}{4} \; , \label{CosmoB1A}\\ \xi &=& \frac{1}{2\tilde{Z}}\left[\frac{3\gamma W}{2h^2} + 4\tilde{Z}' -\tilde{Z}'U' + \frac{3\gamma V'W'}{2} \right] \; \label{CosmoB2A} , \end{eqnarray} while the KG equation \eqref{KGBZ} for $\tilde{Z}$ is: \begin{equation} \tilde{Z}'' + \left(3+\xi \right)\tilde{Z}' = -\frac{3\gamma W}{2h^2} \; , \end{equation} whose formal solution for $\tilde{Z}'$ is given by: \begin{equation} \label{FormalZB} \tilde Z' = -3\gamma e^{-F(N)}\int_{N_i}^{N}d\Bar{N}e^{F(\Bar{N})}\frac{W}{2h^2} \; . \end{equation} We write for convenience also the formal solutions for $V'$ and $W'$: \begin{eqnarray} V' = e^{-F(N)}\int_{N_i}^{N}d\Bar{N}e^{F(\Bar{N})}\frac{U}{h^2} \; , \label{FormalVB}\\ W' = e^{-F(N)}\int_{N_i}^{N}d\Bar{N}e^{F(\Bar{N})}\frac{1}{h^2} \; \label{FormalWB} . \end{eqnarray} Since we chose initial conditions $W_i = 0$ and since $W' > 0$ we can conclude that $W > 0$. This implies that $\tilde{Z}'< 0$; on the other hand Eqs. \eqref{Usol} imply $V'>0$, $0< U' <6$ and $U > 0$. In order to understand the behavior of $\tilde{Z}$ let us define the function $T$: \begin{equation} T \equiv \frac{UW + V}{h^2} - W'V' \; , \end{equation} taking its time derivative and using Eqs. \eqref{KGBW} and \eqref{KGBV} we are able to set up a differential equation for $T$: \begin{equation}\label{diffeqx} T' + 2\xi X = \frac{U'W}{h^2} + 6V'W' \; . \end{equation} The formal solution of Eq. \eqref{diffeqx} is given by: \begin{equation} \label{xsol} T\left(N\right) = \frac{1}{h^2(N)}\int_{N_i}^{N} d\Bar{N} \left(U'W + 6h^2V'W'\right) - C_X h^2(N) \; , \end{equation} where $C_X$ is an integration constant. Since $X(N_i)= 0$ we can conclude from Eq. \eqref{xsol} that $T(N) > 0$. This in turns implies that the right hand side of Eq. \eqref{CosmoB1A} it's always positive, and we can conclude that, asymptotically, $\tilde Z > 0 $. Since $\tilde{Z}$ is positive definite, we must have asymptotically $\tilde{Z}' \rightarrow 0$. It is straightforward to realize from Eq. \eqref{FormalZB} that this is possible only if $h^2$ is a monotonic growing function that grows faster than $W/2$. On the other hand, $W$ is also a monotonic growing function since $W' > 0$. In particular, since $h^2$ grows faster than $W$, it also grows faster then a constant, and so we conclude from Eq. \eqref{FormalWB} that $W' \rightarrow 0$. Using the latter in Eq. \eqref{CosmoB1A} we are left with: \begin{equation} \tilde{Z} \sim \frac{\gamma}{4h^2}\left(V + WU \right) \; . \end{equation} Using the above result in Eq. \eqref{CosmoB2A} we finally obtain: \begin{equation} \xi \sim \frac{3}{\frac{V}{W} + U} \sim 0 \; , \end{equation} then once again we have $w_{ eff} \rightarrow -1$. \chapter{Field equations in Inverse Ricci gravity} \label{Appendix C} To begin with let us consider the following action: Consider first the basic Action \begin{equation} S=\int\sqrt{-g}d^{4}x (R+\alpha A)\label{eq:first} \; , \end{equation} where the anticurvature scalar $A$ is the trace of $A^{\mu\nu}$ \begin{equation} A^{\mu\nu}=R_{\mu\nu}^{-1} \; . \end{equation} By differentiating Eq. \eqref{Adefinition}, we see that \begin{equation} \delta A^{\mu\tau} =-A^{\mu\nu}(\delta R_{\nu\sigma})A{}^{\sigma\tau} \; . \end{equation} We have then \begin{align} \delta S & =\int d^{4}x(A\delta\sqrt{-g}+\sqrt{-g}A^{\mu\nu}\delta g_{\mu\nu}+\sqrt{-g}g_{\mu\nu}\delta A^{\mu\nu})\nonumber\\ & =\int d^{4}x\sqrt{-g}(\frac{1}{2}Ag^{\mu\nu}\delta g_{\mu\nu}+A^{\mu\nu}\delta g_{\mu\nu}+g_{\mu\nu}\delta A^{\mu\nu}) \; , \end{align} and since \begin{equation} \delta R_{\alpha\beta}=\nabla_{\rho}\delta\Gamma_{\beta\alpha}^{\rho}-\nabla_{\beta}\delta\Gamma_{\rho\alpha}^{\rho} \; , \end{equation} we obtain \begin{align} \delta A^{\mu\nu} & =-A^{\mu\alpha}(\nabla_{\rho}\delta\Gamma_{\beta\alpha}^{\rho}-\nabla_{\beta}\delta\Gamma_{\rho\alpha}^{\rho})A^{\beta\nu}\nonumber\\ & =-\frac{1}{2}A^{\mu\alpha}(g^{\rho\lambda}\nabla_{\rho}(\nabla_{\alpha}\delta g_{\beta\lambda}+\nabla_{\beta}\delta g_{\lambda\alpha}-\nabla_{\lambda}\delta g_{\alpha\beta})-g^{\rho\lambda}\nabla_{\beta}(\nabla_{\alpha}\delta g_{\rho\lambda}+\nabla_{\rho}\delta g_{\lambda\alpha}-\nabla_{\lambda}\delta g_{\alpha\rho}))A^{\beta\nu}\nonumber\\ & =-\frac{1}{2}A^{\mu\alpha}g^{\rho\lambda}(\nabla_{\rho}\nabla_{\alpha}\delta g_{\beta\lambda}-\nabla_{\rho}\nabla_{\lambda}\delta g_{\alpha\beta}-\nabla_{\beta}\nabla_{\alpha}\delta g_{\rho\lambda}+\nabla_{\beta}\nabla_{\lambda}\delta g_{\alpha\rho} + \left[\nabla_{\beta},\nabla_{\rho} \right]\delta g_{\lambda\alpha})A^{\beta\nu} \; . \end{align} Using integration by parts, this becomes \begin{align} g_{\mu\nu}\delta A^{\mu\nu} & =-\frac{1}{2}g_{\mu\nu}g^{\rho\lambda}(\delta g_{\beta\lambda}\nabla_{\alpha}\nabla_{\rho}(A^{\mu\alpha}A^{\beta\nu})-\delta g_{\alpha\beta}\nabla_{\lambda}\nabla_{\rho}(A^{\mu\alpha}A^{\beta\nu})-\delta g_{\rho\lambda}\nabla_{\alpha}\nabla_{\beta}(A^{\mu\alpha}A^{\beta\nu})+ \nonumber\\ &+\delta g_{\alpha\rho}\nabla_{\lambda}\nabla_{\beta}(A^{\mu\alpha}A^{\beta\nu})) +\delta g_{\alpha\rho}\nabla_{\lambda}\nabla_{\beta}(A^{\mu\alpha}A^{\beta\nu})) \nonumber \\ & =\frac{1}{2}\delta g_{\iota\kappa}(-2g^{\rho\iota}\nabla_{\alpha}\nabla_{\rho}A^{\mu\alpha}A_{\mu}^{\kappa}+\nabla^{2}(A^{\mu\iota}A_{\mu}^{\kappa})+g^{\iota\kappa}\nabla_{\alpha}\nabla_{\beta}(A^{\mu\alpha}A_{\mu}^{\beta})) \; . \end{align} So finally the variation is \begin{align} \delta g_{\mu\nu}(\frac{1}{2}Ag^{\mu\nu}+A^{\mu\nu}+\frac{1}{2}(-2g^{\rho\mu}\nabla_{\alpha}\nabla_{\rho}A^{\sigma\alpha}A_{\sigma}^{\nu}+\nabla^{2}(A^{\sigma\mu}A_{\sigma}^{\nu})+g^{\mu\nu}\nabla_{\alpha}\nabla_{\beta}(A^{\sigma\alpha}A_{\sigma}^{\beta}))) \; . \end{align} Together with the variation of the standard Hilbert-Einstein Lagrangian \begin{align} \delta g^{\mu\nu}(-\frac{1}{2}Rg_{\mu\nu}+R_{\mu\nu}) & =-\delta g_{\mu\nu}(-\frac{1}{2}Rg^{\mu\nu}+R^{\mu\nu}) \; , \end{align} we obtain finally the equations for the Action (\ref{eq:first}) \begin{align} R^{\mu\nu}-\frac{1}{2}Rg^{\mu\nu}-\alpha A^{\mu\nu}-\frac{1}{2}\alpha Ag^{\mu\nu}+\frac{\alpha}{2}\left(2g^{\rho\mu}\nabla_{\alpha}\nabla_{\rho}A_{\sigma}^{\alpha}A^{\nu\sigma}-\nabla^{2}A_{\sigma}^{\mu}A^{\nu\sigma}-g^{\mu\nu}\nabla_{\alpha}\nabla_{\rho}A_{\sigma}^{\alpha}A^{\rho\sigma}\right) & =T^{\mu\nu}\label{eq:eom1} \; , \end{align} where we used the fact that $A^{\alpha}_{\sigma }A^{\nu\sigma}=A^{\alpha\tau}g_{\tau\sigma}A^{\sigma\nu}=A^{\alpha\tau}A_{\tau}^{\nu}=A^{\alpha\sigma}A_{\sigma}^{\nu}=A_{\sigma}^{\nu}A^{\alpha\sigma}$ and we employed units in which $8\pi G=1$. It can be show that the left-hand side of Eq.~\eqref{eq:eom1} is divergenceless, as it should be in order to satisfy the Bianchi identities. The extension to any Lagrangian $f(R,A)$ is quite straightforward: \begin{equation} \delta S=\int d^{4}x\sqrt{-g}(-\frac{1}{2}f(R,A)g_{\mu\nu}\delta g^{\mu\nu}+f_{A}A^{\mu\nu}\delta g_{\mu\nu}+f_{A}g_{\mu\nu}\delta A^{\mu\nu}+f_{R}R_{\mu\nu}\delta g^{\mu\nu}+f_{R}g^{\mu\nu}\delta R_{\mu\nu}) \; , \end{equation} where $f_R=\partial f/\partial R$ and $f_A=\partial f/\partial A$. Then we have \begin{align} f_{R}R^{\mu\nu}-f_{A}A^{\mu\nu}&-\frac{1}{2}fg^{\mu\nu}+g^{\rho\mu}\nabla_{\alpha}\nabla_{\rho}f_{A}A^{\alpha}_{\sigma}A^{\nu\sigma}-\frac{1}{2}\nabla^{2}(f_{A}A_{\sigma}^{\mu}A^{\nu\sigma}) &\nonumber\\&-\frac{1}{2}g^{\mu\nu}\nabla_{\alpha}\nabla_{\beta}(f_{A}A_{\sigma}^{\alpha}A^{\beta\sigma})-\nabla^{\mu}\nabla^{\nu}f_{R}+g^{\mu\nu}\nabla^{2}f_{R} =T^{\mu\nu} \; . \end{align} \chapter{Estimating Time delay Uncertainties with PyCS3} \label{AppendixD} In this appendix, we display the time delays and their uncertainties obtained with PyCS3. Uncertainties are obtained by simulating light curves close to the data, and randomizing the true time delay applied to each curve, see Sec.~(3.2) of Ref.~\cite{Millon:2020xab} for more details. The final marginalization is done performing a hybrid approach between the ``free-knot spline" and the ``regression difference" estimators as explained in Sec.~(3.3) of Ref.~\cite{Millon:2020xab}. The parameter $\tau_{thresh}=0$ indicates the marginalization is done over the two estimators. In each figure, the top panels show the final time delay estimates marginalizing over the two estimators. The middle figure shows the residuals for the spline fit to the data. The top row of the bottom panels show the distribution of data residuals for mock curves (in gray) and data (in colors), whereas the bottom panels show their normalization over the number of runs $z_r$. The time delay estimates for the simulated curves over the whole period of observations ($\approx 1.316$ days) is shown in Fig.~\ref{fig:simul} while Fig.~\ref{fig:simulhalf} is over half the total period. Similarly, Fig.~\ref{fig:des} ($\approx 189$ days) and Fig.~\ref{fig:deshalf} show time delays for the object DES J0408-5354. \begin{figure}[h!] \centering \includegraphics[scale=0.4]{final_trialcurves.png} \includegraphics[scale=0.45]{residual_trialcurves.png} \includegraphics[scale=0.45]{residualhist_trialcurves.png} \caption{Time delay estimates for the simulated quasar over the full observation period.} \label{fig:simul} \end{figure} \begin{figure}[htp!] \centering \includegraphics[scale=0.4]{final_trialcurveshalf.png} \includegraphics[scale=0.4]{residual_trialcurveshalf.png} \includegraphics[scale=0.4]{residualhist_trialcurveshalf.png} \caption{Time delay estimates for the simulated quasar over half of the observation period.} \label{fig:simulhalf} \end{figure} \begin{figure}[htp!] \centering \includegraphics[scale=0.4]{final_DES0408.png} \includegraphics[scale=0.4]{residual_DES0408.png} \includegraphics[scale=0.4]{residualhist_DES0408.png} \caption{Time delay estimates for the quasar DES J04078-5354 over the full observation period.} \label{fig:des} \end{figure} \begin{figure}[htp!] \centering \includegraphics[scale=0.4]{final_DES0408Half.png} \includegraphics[scale=0.4]{residual_DES0408Half.png} \includegraphics[scale=0.4]{residualhist_DES0408Half.png} \caption{Time delay estimates for the quasar DES J04078-5354 over half of the observation period.} \label{fig:deshalf} \end{figure} \chapter{Dark Energy Bestiarium} \label{chapter:DE} \epigraph{\textit{The miracle of physics that I'm talking about here is something that was actually known since the time of Einstein's general relativity; that gravity is not always attractive}}{Alan Guth} The goal of this chapter is to give an overview of the possible Dark Energy models beyond the standard cosmological model, i.e. we would like to present a DE \textit{Bestiarium}.\footnote{This choice of terminology is inspired by chapter 9 of Profumo's book \cite{Profumo:2017hqp}: \textit{Bestiarium: A Short, Biased Compendium of Notable Dark Matter Particle Candidates and Models}} Keeping the analogy with biology, in the first part of the chapter we will attempt to classify the models based on their \textit{taxonomy},\footnote{In biology, taxonomy, from Ancient Greek taxis, meaning 'arrangement', and -nomia, meaning 'method', is the science of naming, defining (circumscribing) and classifying groups of biological organisms on the basis of shared characteristics} i.e. on how they look from the mathematical point of view. In the second part we will try instead to address their \textit{ethology},\footnote{The term ethology derives from the Greek words ethos, meaning "character" and -logia, meaning "the study of". In Biology refers to the scientific and objective study of animal behaviour} i.e. the way in which different DE models affect observable quantities. \section{Taxonomy of Dark Energy} \subsection{The Lovelock Theorem} General relativity has been proven to be, at least at some scales, our best description of the gravitational interaction. The Einstein Field Equations have the nice properties of being local and covariant differential equations of the metric and its first and second derivatives, and linear in the latter. One could ask whether there are alternatives to the EFE in order to describe the interplay between matter and geometry of the space-time. Of the utmost importance in this direction is Lovelock's theorem, see Refs.~\cite{Lovelock:1971yv,Lovelock:1972vz}, which can be enunciated as follows~\cite{Clifton:2011jh}: \begin{theorem} The only possible second-order Euler-Lagrange expression obtainable in a four dimensional space from a scalar density of the form $\mathcal{L}= \mathcal{L}(g_{\mu\nu})$ is: \begin{equation} E^{\mu\nu}= \alpha \sqrt{-g}\left[R^{\mu\nu}-\frac{1}{2}Rg^{\mu\nu}\right] + \sqrt{-g} g^{\mu\nu}\Lambda\; , \end{equation} where $\alpha$ and $\Lambda$ are constant. \end{theorem} Note that the above theorem is a statement about the form of the field equations resulting from a scalar Lagrangian, not a statement about the form of the Lagrangian itself, which then could be different from the standard Einstein Hilbert action. To rephrase it in other words, Lovelock's theorem states that if we want a geometrical theory of gravity in 4 dimensions arising from a scalar Lagrangian of the metric, the only possibility are the Einstein field equations plus a cosmological constant. The importance of the above result is that it clearly indicates which kind assumptions we have to relax in order to obtain a gravitational theory different from general relativity plus a cosmological constant. Indeed the only options left are: \begin{itemize} \item Increasing the number of degrees of freedom, i.e. considering other fields together with the metric tensor $g_{\mu\nu}$. \item Include higher order derivatives in the field equations \item Consider spaces with dimension $N \neq 4$. \item Giving up Lagrangian formulations \item Abandoning locality and Lorentz invariance of the field equations. \end{itemize} \subsection{Increasing the number of degrees of freedom} \subsubsection{Scalar-tensor theories} The most general Lagrangian containing a tensor field and a scalar field which gives second order equation of motion was discovered by Horndenski in 1974 in Ref.~\cite{Horndeski:1974wa}. Later on, it was rediscovered in the context of the so called generalized Galileon theories, see for example Ref.~\cite{Deffayet:2009mn}, and the equivalence between the two theories was shown in Ref.~\cite{Kobayashi:2011nu}. The general form of the Horndeski Lagrangian can be written : \begin{equation} \label{HL} \begin{split} \mathcal{L}\left(g_{\mu\nu} , \phi\right) =& G_2\left(\phi, X \right) + G_3 \left(\phi, X \right)\Box \phi + G_4\left(\phi, X \right) R + G_{4,X}\left(\phi, X \right)\left(\Box \phi - \phi^{\mu\nu}\phi_{\mu\nu}\right)+\\ &G_5\left(\phi, X \right)\phi^{\mu\nu}R_{\mu\nu} -\frac{G_{5,X}}{6}\left[\left(\Box \phi\right)^{3} - 3\Box\phi \phi^{\mu\nu}\phi_{\mu\nu} + 2\phi_{\mu\nu}\phi^{\nu \lambda}\phi^{\mu}_{\lambda} \right] \; , \end{split} \end{equation} where $X= \nabla_\mu \phi \nabla^{\mu} \phi/2$ , $G_{i,X} = \partial_X G_i$ and $\phi_{\mu\nu} = \nabla_\mu \nabla_\nu \phi$. By taking appropriately the free functions $G_i$ of the above Lagrangian one is able to reproduce any second order scalar tensor theory as a specific case. Choosing $G_4 = \frac{M_{Pl}^2}{2}$ and $G_i = 0$ for $i \neq 4$ reproduces the Einstein Hilbert action. The function $G_2$ can account for any free Lagrangian of the scalar field, for example quintessence. Note that in Eq.~\eqref{HL} the functions $G_3$ and $G_5$ must have an $X$ dependence, otherwise they can be absorbed into $G_2$ and $G_4$ up to a total derivative. Note also that general Lagrangians of the Ricci scalar, i.e. $f(R)$ theories, belong to the Horndeski family since they can be cast in a scalar tensor form by defining $\phi = df/dR$ and performing a Legendre transformation of the action functional. The same apply for other geometrical theories which result in second order equation of motion; for example also a non minimally coupled Gauss-Bonnet is contained in the Hordenski Lagrangian~\cite{Kobayashi:2011nu}. \subsubsection{Generalized Proca Theories} Another option is to increase the number of degrees of freedom by means of a vector field. The main advantage of this approach over a multi-scalar field theory is that it generally results in a richer dynamics. This family of theories is called generalized Proca theories, and were recently proposed in Ref.~\cite{Heisenberg:2014rta}. Previous attempts of introducing vector fields in a gravitational context were made already in the 2000's, with the goal of modelling anisotropic Dark Energy, see Refs.~\cite{Koivisto:2007bp,Himmetoglu:2008zp}. The Lagrangian of the generalized Proca theories is: \begin{equation} \label{GPL} \begin{split} \mathcal{L}_{GP}&= -\frac{1}{4}F^{\mu\nu}F_{\mu\nu} + G_2(X) + G_3 (X) \nabla_\mu A^{\mu}+ \\ &G_4(X)R + G_{4,X}\left[\left(\nabla_{\mu}A^{\mu}\right)^2 + c_2 \nabla_{\rho}A_{\sigma}\nabla^{\rho}A^{\sigma} +\left(1-c_2\right)\nabla_{\rho}A_{\sigma}\nabla^{\sigma}A^{\rho} \right] +\\ &G_{5}(X) \mathcal{G}_{\mu\nu}\nabla^{\mu}A^{\nu} -\frac{1}{6}G_{5,X}\left[\left(\nabla_{\mu}A^{\mu}\right)^3 -3d_2 \nabla_\mu A^{\mu}\nabla_{\rho}A_{\sigma}\nabla^{\rho}A^{\sigma} -3(1-d_2)\nabla_\mu A^{\mu}\nabla_{\rho}A_{\sigma}\nabla^{\sigma}A^{\rho}\right.+\\ &\left. \left(2 - 3d_2\right)\nabla_{\rho}A_{\sigma}\nabla^\gamma A^{\rho}\nabla^{\sigma}A_{\gamma} + 3d_2\nabla_{\rho}A_{\sigma}\nabla^\gamma A^{\rho}\nabla_{\gamma}A^{\sigma}\right] \; , \end{split} \end{equation} where $F_{\mu\nu} = \nabla_\mu A_\nu - \nabla_\nu A_\mu$ is the Maxwell tensor and $X= A_\mu A^{\mu}/2$. The $G_i$'s are free functions of the Proca field and $\mathcal{G}_{\mu\nu}$ is the Einstein tensor. Note that in the above Lagrangian the usual $U(1)$ symmetry of the vector field is broken, i.e. $A^{\mu}$ is not Abelian. The above property becomes useful and interesting for cosmological implications, indeed it allows for an isotropic background evolution, see for example Ref.~\cite{DeFelice:2016yws}. It is interesting to note that in this class of theories, on FLRW background, the vector field equation allow for constant solutions which are of de Sitter type, thus being potentially capable of describe the Late-times accelerated expansion of the Universe as well as an inflationary epoch. \subsubsection{Scalar Vector Tensor (SVT) theories} It is possible to construct a consistent covariant theory which combines together scalar, vector and tensor interations, known as SVT theories, see Ref.~\cite{Heisenberg:2018acv}. The resulting theory is richer than a theory built just from the Horndeski and generalized Proca theories. Indeed, it allows for the vector and the scalar fields to interact in non-trivial way. Thus, beyond the standard scalars of Horndeski and Proca theories, the free functions appearing in the SVT Lagrangian depend also on the scalars: \begin{eqnarray} X_2 = -\frac{1}{2}A^{\mu}\nabla_{\mu}\phi \; , \qquad Y_1 = \nabla_\mu \phi \nabla_\nu \phi F^{\mu\alpha}F^{\nu}_\alpha \; , \qquad Y_2 =\nabla_\mu \phi A_{\nu}F^{\mu\alpha}F^{\nu}_\alpha \; . \end{eqnarray} In the full SVT Lagrangian we also have terms containing the double dual Riemann tensor: \begin{equation} L^{\mu\nu\alpha\beta} = \epsilon^{\mu\nu\rho\sigma}\epsilon^{\alpha\beta\gamma\delta}R_{\rho\sigma\gamma\delta} \; , \end{equation} where the $\epsilon$'s are the Levi Civita symbols in 4 dimensions. The general form of the Lagrangian is given in Ref.~\cite{Heisenberg:2018acv} and the background and perturbed equations are developed in Ref.~\cite{Heisenberg:2018mxx}. They depend in general on whether the $U(1)$ invariance of the Proca field is broken or not. It turns out that the resulting theories are useful in Dark Energy applications and bouncing scenarios, allowing for an accelerated epoch of expansion while being capable of producing transient contracting phases, which can avoid the appearance of cosmological singularities. \subsubsection{Bimetric gravity} It is also possible to increase the number of degrees of freedom by introducing a new metric tensor field $f_{\mu\nu}$. This class of theory is usually known as \textit{bimetric gravity} and it was formulated as an attempt to generalize massive gravity models, see Refs.~\cite{deRham:2014zqa,Hassan:2011zd,Volkov:2011an}. The action functional in the original formulation takes the form: \begin{equation} S = M_g^2\int\sqrt{-g}d^4x R_g + M_f^2\int \sqrt{-f}d^4x R_f + M_{eff}m^2\int \sqrt{-g}d^4x\mathcal{L}_{int} \;, \end{equation} where $M_i$ and $R_i$ are the Planck masses and Ricci scalars relative to the metric $f$ and $g$. $M_{eff} = \left( M_g^{-1} + M_f^{-1}\right)^{-1}$ is the effective Planck mass and $m^2$ a mass term associated to the massive graviton of the metric $f$. The interaction Lagrangian is given by: \begin{equation} \mathcal{L}_{int}= \frac{1}{2}\left(X^2 - X^{\mu\nu}X_{\mu\nu}\right) + \frac{c_3}{3!}\epsilon_{\mu\nu\rho\sigma}\epsilon^{\alpha\beta\gamma\sigma}X^{\mu}_{\alpha}X^{\nu}_{\beta}X^{\rho}_{\gamma} + \frac{c_4}{4!}\epsilon_{\mu\nu\rho\sigma}\epsilon^{\alpha\beta\gamma\delta}X^{\mu}_{\alpha}X^{\nu}_{\beta}X^{\rho}_{\gamma}X^{\sigma}_{\delta} \; , \end{equation} where $X^{\mu}_{\nu} = \delta^{\mu}_{\nu} + \gamma^{\mu}_{\nu}$, with $\gamma^{\mu}_{\nu}$ defined by the relation $\gamma^{\mu}_{\sigma}\gamma^{\sigma}_{\nu} = g^{\mu\sigma}f_{\sigma\nu}$. The above form of the interaction Lagrangian has been proposed by the authors to avoid the appearance of Boulware-Deser ghost in both the $g$ and $f$ metrics. Bimetric models offer a rich and interesting phenomenology for cosmological implications and have been studied extensively in the literature, see for example Refs.~\cite{Akrami:2015qga,Akrami:2013pna} \subsection{Including higher order derivatives} It is well known that General Relativity is not renormalizable from the point of view of QFT due to the fact that the Newton constant has dimensions of an inverse squared mass $G_N \propto m^{-2}$. One of the main historical reasons to consider higher order derivative theories is that they modify the propagator improving its UV behavior. Let us consider for example the introduction of a $R_{\mu\nu}R^{\mu\nu}$ term; in this case the propagator can be symbolically written as: \begin{equation} \label{HDpropagator} \frac{1}{k^2}+\frac{1}{k^2}G_Nk^4\frac{1}{k^2}+ \frac{1}{k^2}G_Nk^4\frac{1}{k^2}G_Nk^4\frac{1}{k^2} + ... = \frac{1}{k^2 - G_N k^4} \; . \end{equation} The propagator of Eq.~\eqref{HDpropagator} is dominated at high Energy by the $k^{-4}$ term and its UV behavior is improved. On the other hand we can rewrite it as: \begin{equation} \frac{1}{k^2 - G_N k^4} = \frac{1}{k^2} -\frac{1}{k^2 - 1/G_N} \;, \end{equation} from which we can see that it decomposes in the standard graviton mode $k^{-2}$ together with the $-1/\left(k^2 - G_N^{-1}\right)$ mode, which has negative sign and thus corresponds to a ghost. The appearance of ghost modes is a recurring theme in higher order derivative theories and is strongly related to Ostrogradsky instability, see Refs.~\cite{Motohashi:2014opa,Woodard:2015zca}. To briefly illustrate how Ostrogradsky instability works let us consider a non degenerate Lagrangian containing second order derivatives $\mathcal{L}(x,\dot{x}, \ddot{x})$. The associated Euler Lagrange equations are: \begin{equation} \frac{\partial \mathcal{L}}{\partial x} - \frac{d}{d t} \frac{\partial \mathcal{L}}{\partial \dot{x}} + \frac{d^2}{d t^2} \frac{\partial \mathcal{L}}{\partial \ddot{x}} =0\; , \end{equation} and the non degeneracy conditions implies $\frac{\partial^2 \mathcal{L}}{\partial \ddot{x}^2} \neq 0$. Ostrogradsky showed that if we choose the following 4 canonical coordinates: \begin{equation} \label{Ostrocoord} Q_1 = x \qquad \; , Q_2 = \dot{x} \; , \qquad P_1 = \frac{\partial\mathcal{L}}{\partial \dot{x}} - \frac{d}{d t }\frac{\partial\mathcal{L}}{\partial \ddot{x}} \; , \qquad P_2 = \frac{\partial \mathcal{L}}{\partial \ddot{x}} \; , \end{equation} it is possible to perform a Legendre transformation and obtain the Hamiltonian: \begin{equation} \label{OstroHam} H = P_1 Q_1 + P_2 A\left(Q_1, Q_2, P_2 \right) - \mathcal{L}\left(Q_1, Q_2, P_2 \right) \; , \end{equation} where the function $A\left(Q_1, Q_2, P_2 \right)$ is obtained inverting Eqs.~\eqref{Ostrocoord} for $\ddot{x}$. The Hamiltonian~\eqref{OstroHam} is linear in the canonical momentum $P_1$ and thus is unbounded from below, i.e. the system is unstable. Note that the only assumption made here is invertibility of the Lagrangian with respect to $\ddot{x}$, so in order to have well-behaved higher order derivative theories we should consider only degenerate Lagrangians. An interesting example of a degenerate theory is given by the beyond Horndeski Lagrangian, also known as Degenerate Higher Order Scalar Tensor (DHOST) theories, see Refs.~\cite{Gleyzes:2014dya,Langlois:2017mdk} for a detailed discussion. A similar construction can be done also for vector tensor theories, and we end up with the beyond generalized Proca theories, see Ref.~\cite{Heisenberg:2016eld}. \subsection{Increasing the number of dimensions} A way out from Lovelock's theorem that was explored by Lovelock himself is to consider a geometrical description of the gravitational interaction in more than four dimensions. On the other hand, we have no observational evidence of the presence of such extra dimensions, thus higher dimensional theories need a mechanism that hides or compactifies these dimensions at scales which do not emerge in standard experiments. Higher dimensional theories have attracted a lot of interest in the past decades, with the most popular being probably string theory. To give a flavour of the potential of higher dimensional theories, we will discuss briefly here the Kaluza-Klein model, which inspired and motivated subsequent works on compactifications of higher dimensions and unifications of the fundamental interactions. We will also introduce the Lanczos-Lovelock gravity, which is essentially a generalization of General Relativity to an arbitrary number of dimensions. \subsubsection{Kaluza-Klein model} The first higher dimensional extension of General Relativity was suggested by Kaluza in Ref.~\cite{Kaluza:1921tu}, in a similar framework as in a previous attempt by Nordstrom~\cite{Nordstrom:1988fi}. In this model it is possible to obtain both Maxwell and Einstein equations in four dimensions from a geometrical vacuum theory with a fifth dimension. The five dimensional metric, $\tilde{g}_{ab}$, becomes here a function of the standard four dimensional metric $g_{\mu\nu}$ plus a vector field $A_\mu$ and a scalar field $\phi$, and could be written as: \begin{equation} \tilde{g}_{ab} = \begin{pmatrix} g_{\mu\nu} + \phi^2 A_{\mu}A_{\nu} & \phi^2A_{\mu} \\ \phi^2A_{\nu} & \phi^2 \end{pmatrix} \; . \end{equation} Kaluza imposed on the metric $\tilde{g}_{ab}$ the so-called cylinder condition, i.e. that it does not depend on the fifth coordinate $\partial \tilde{g}_{ab}/\partial x^5=0$. The five dimensional vacuum Einstein field equations reduce to: \begin{equation} R_{\mu\nu} - \frac{1}{2} g_{\mu\nu}R = \frac{k^2\phi^2}{2}T^{EM}_{\mu\nu} -\frac{1}{\phi}\left[ \nabla_\mu(\partial_\nu \phi) - g_{\mu\nu} \Box \phi \right] \; , \end{equation} while the Maxwell field equations are: \begin{equation} \nabla^\mu F_{\mu\nu} = -3\frac{\partial^\mu \phi}{\phi}F_{\mu\nu} \; . \end{equation} The so called \textit{Kaluza's miracle} is that the standard four dimensional Einstein and Maxwell field equations, with the electromagnetic term appearing in the former as a source term, are recovered in the limit $\phi = 1$. However, the latter condition is not consistent with the Klein Gordon equation for the scalar field: \begin{equation} \Box \phi = \frac{k^2\phi^3}{4}F_{\mu\nu}F^{\mu\nu} \; . \end{equation} A lot of criticism was made to Kaluza's proposal due to the cylindrical condition, i.e. the introduction of a fifth dimension that plays no role in the dynamics. To overcome this issue, Klein suggested in Ref.~\cite{Klein:1926tv} a mechanism of compactification of the fifth dimension, demanding that it has the topology of a circle $S^1$ of very small radius $r$. Thus, the whole spacetime has topology $R^4 \times S^1$ and physical fields must depend on the fifth dimension only periodically. \subsubsection{Lovelock gravity} The topological space's shape of an object is identified by a constant number $\xi$, called Euler number, or Euler characteristic, regardless of the way in which the space is bent. The Euler characteristic in $2n$ dimensions can be written as the integral of the Euler density $\mathcal{R}^n$ which reads: \begin{equation} \mathcal{R}^n = \frac{(2n!)}{2^n}\delta^{\mu_1}_{[\alpha_1}\delta^{\nu_1}_{\beta_1}\delta^{\mu_2}_{\alpha_2}\delta^{\nu_2}_{\beta_2}...\delta^{\mu_n}_{\alpha_n}\delta^{\nu_n}_{\beta_n]}\prod_{r=1}^n R^{\alpha_r\beta_r}_{\mu_r\nu_r}\; , \end{equation} where the square bracket indicate antisymmetrization. The Lovelock Lagrangian is the sum of the Euler densities: \begin{equation} \mathcal{L} = \sqrt{-g}\sum_{t=0}^{n} \alpha_t \mathcal{R}^t \; , \end{equation} and yields to conserved second order Euler Lagrange equations of motion, see for example Refs.~\cite{Lovelock:1971yv,Padmanabhan:2013xyr} for a detailed derivation. Expanding the above Lagrangian up to second order we obtain: \begin{equation} \mathcal{L} = \sqrt{-g}\left[\alpha_0 + \alpha_1 R + \alpha_2\left(R^2 + R_{\mu\nu\rho\sigma}R^{\mu\nu\rho\sigma} - 4R_{\mu\nu}R^{\mu\nu}\right) + \mathcal{O}(R^3) \right]\; , \end{equation} which shows that at zero and first order the Lovelock Lagrangian reproduces the standard Einstein Hilbert action plus a cosmological constant, while from the second order term inside the bracket we appreciate that it contains the Gauss-Bonnet gravity term. Note that in four dimensions the second and higher order terms become trivial and we are left with standard GR. \subsection{Abandoning Lagrangian formulations} Several proposals of modified gravity are based on ad hoc modifications of the EFE which are not derivable from an action functional, often with interesting cosmological applications. To illustrate the potential of this kind of modifications we will briefly present two theories belonging to this class, the Rastall gravity and the $RT$ nonlocal model. \subsubsection{Rastall gravity} Following the idea that the stress energy tensor $T_{\mu\nu}$ could be not conserved in curved spacetime, Rastall proposed in Ref.~\cite{Rastall:1973nw} the following modification of the Einstein field equations: \begin{equation} R_{\mu\nu} -\frac{1}{2}g_{\mu\nu}R = 8\pi G\left( T_{\mu\nu} - \frac{\gamma - 1 }{2}g_{\mu\nu}T \right) \; , \end{equation} with a non conserved continuity equation for $T_{\mu\nu}$: \begin{equation} T^{\mu\nu}_{;\mu} = \frac{\gamma-1}{2}T^{\; \nu} \; . \end{equation} It has been shown that Rastall gravity is very interesting from the cosmological point of view, being able to reproduce $\Lambda$CDM at the background level, see for example Ref.~\cite{Batista:2011nu}, while being different at perturbative level and resulting in a type of Dark Energy capable of clustering. It is a matter of debate if it is possible or not to derive the Rastall equations from a Lagrangian density. In the 80', in Ref.~\cite{1984NCimB..80...42S}, the Rastall field equation where obtained by a variational principle of a Lagrangian density, but the latter was not a scalar Lagrangian and thus the derivation is not completely satisfactory. Some more recent attempts were made in Refs.~\cite{Santos:2017nxm,DeMoraes:2019mef}, where the field equations were obtained as a particular case of an $f(R,T)$ theory of the type $f(R,T) = f_1(R) + f_2(T)$, or from a matter Lagrangian non minimally coupled to gravity. However, some criticism emerged since for $f(R,T)$ theories of this type has been claimed that the $f_2(T)$ type term should be included in the matter Lagrangian and not in the gravitational part, see for example Ref.~\cite{Fisher:2019ekh}. It was also suggested in Ref.~\cite{Visser:2017gpz} that Rastall gravity is equivalent to general relativity and Rastall's stress–energy tensor corresponds to an artificially isolated part of the physical conserved one. This point of view, however, was criticized in Ref.~\cite{Darabi:2017coc} and the debate is still open. \subsubsection{The $RT$ model} \label{sec:NLF} The $RT$ model was proposed in Ref.~\cite{Maggiore:2013mea} and consist of a nonlocal modification of the EFE involving the inverse d'Alembertian of the Ricci scalar $\Box^{-1} R$: \begin{equation} R_{\mu\nu}-\frac{1}{2}g_{\mu\nu} R -\frac{m^2}{3}\left(g_{\mu\nu}\Box^{-1}R\right)^T = 8 \pi G_N T_{\mu\nu} \; , \end{equation} where the superscript $T$ denotes the extraction of the transverse part, which is in itself already a nonlocal operation. We will discuss in detail nonlocal modifications of gravity in chapter \ref{chapter:NL}, for the moment we will just mention that the within the $RT$ model one is able to reproduce a viable cosmological history both at background and perturbative level. Contrary to other nonlocal models with similar features, the $RT$ model is also compatible with experiments at Solar System scales, in particular Lunar Laser Ranging constraints \cite{Belgacem:2018wtb}, making it very appealing despite the lack of a Lagrangian formulation. \subsection{Giving up locality and Lorentz invariance} Another class of theories that escapes Lovelock's theorem is based on modifications of gravity which include nonlocal terms or which broke explicitly Lorentz invariance. We will discuss in detail the former in Sec.~\ref{chapter:NL}, while we present here as prototypical examples of the latter class of theories the Unimodular and the Ho\v{r}ava-Lifshitz gravities. \subsubsection{Unimodular gravity} The ideas behind Unimodular Gravity (UG) are almost as old as GR itself, and were considered by Einstein already in Refs.~\cite{Einstein:1916vd,1952prel.book..189E}. From the mathematical point of view, UG is equivalent to standard GR with the following gauge choice, called Unimodular condition: \begin{equation}\label{UGeq} \sqrt{-g}=\epsilon_0 \; , \end{equation} where $\epsilon_0$ is a fixed scalar density which provides a fixed volume elements. Thus, UG is essentially GR with less symmetry, being invariant only with respect to the restricted group of diffeomorphisms respecting the Unimodular condition. The interesting property of UG is that, at classical level, its field equations coincide with the traceless EFE. Then, taking into account them together with the Bianchi identities, one obtain the standard EFE with a cosmological constant appearing as an integration constant. Quantum corrections to the energy-momentum tensor of matter which are of the form $Cg_{\mu\nu}$, where $C$ is a constant over spacetime, do not contribute to the traceless EFE. In particular, vacuum fluctuations in the trace of the energy-momentum tensor of matter do not affect the metric. With the latter interpretation the cosmological constant does not couple to gravity, and consequently UG solves the cosmological constant problem, see Ref.~\cite{Weinberg:1988cp}. Several generalizations of UG have been proposed, see for example Ref.~\cite{Henneaux:1989zc}, where the right hand side of Eq. \eqref{UGeq} is equal to the divergence of a vector density field, or Ref.~\cite{Barvinsky:2017pmm} where an ADM decomposition of the spacetime is assumed with the requirement that the lapse is a function of the determinant of the spatial metric $N=N(\gamma)$ only. Of course UG and its generalizations differ from GR at a quantum level, and their quantization is an active field of research, see for example Refs.~\cite{Alvarez:2015pla,Smolin:2009ti,Padilla:2014yea,Fiol:2008vk,Shaposhnikov:2008xb}. \subsubsection{Ho\v{r}ava-Lifshitz gravity} The model was suggested in Ref.~\cite{Horava:2009uw} as a viable candidate of quantum gravity, and is inspired by physics of condensed matter systems. Its characteristic feature is that space and time are treated at fundamental level on a different ground, in such a way that they scale anisotropically in the UV limit. The degree of anisotropy between space and time is measured by the anisotropic parameter $z$, and the resulting theory is power counting renormalizable for certain values of $z$. The starting point of the construction is that the line element has the following ADM shape: \begin{equation} ds^2 = -N^{2}dt^2 + g_{ij}\left(dx^i + N^{i}dt\right) \left(dx^j + N^{j}dt\right), \end{equation} in which $N$ is the shift, $N^i$ the lapse and $g_{ij}$ is the spatial metric. In GR we have the gauge freedom of representing the line element in this way foliating the space-time in terms of spacelike surfaces $\Sigma_{t}$, whilst in Ho\v{r}ava gravity the above decomposition is not just a choice of coordinates but rather the fundamental structure of the spacetime. The kinetic term of the action is given by: \begin{equation} S_{kin} = \frac{1}{g_{K}}\int d^{3}x d^t N \sqrt{g}\left[ K_{ij}K^{ij} -\lambda K^2 \right] \; , \end{equation} where the main difference with respect to standard GR is in the constant parameter $\lambda$, which must be unity if we demand Lorentz invariance. The potential part of the action, due to the anisotropic scaling, allow for the presence of higher order derivative terms of the \textit{spatial} Ricci tensor $P_{ab}$, defined in terms of the spatial metric $g_{ab}$. To achieve power counting renormalizability in 3+1 dimension we need $z=3$, which implies that we can have term up to cubic order in the 3D Ricci tensor and its spatial derivatives. The specific form of the potential depends on the formulation of Ho\v{r}ava gravity we are considering. In the original formulation of Ref.~\cite{Horava:2009uw} it is given by: \begin{equation} \begin{split} V_{HL} =& \frac{-g^2_{K}}{2\omega^4}C^{ij}C_{ij} + \frac{g^2_{k} \mu }{2\omega^2}\epsilon^{ijk}P_{il}\nabla_{j}P^{l}_{k} -\frac{g^2_{K}\mu^2}{8}P^{ij}P_{ij}\\ &+ \frac{g^2_{K}\mu^2}{8(1-3\lambda)}\left( \frac{1 - 4\lambda}{4}P^2 + \Lambda P -2\Lambda^2 \right) \; , \end{split} \end{equation} where $C_{ij}$ is the Cotton tensor and $ g_k$ and $\omega $ are coupling parameters. At long distances this potential is dominated by the last two terms, the cosmological constant and the spatial curvature, and the theory flows in the infrared to $z=1$ so that Lorentz invariance is accidentally restored. There is a very interesting phenomenology arising from Ho\v{r}ava gravity in cosmological applications. It has been shown that certain choices of the potential are able to mimic DM, see Ref.~\cite{Mukohyama:2009mz}. It is also possible to seed cosmological perturbation without inflation, see Ref. \cite{Mukohyama:2010xz}, realizing bouncing scenarios, see Ref.~\cite{Brandenberger:2009yt}, and model Dark Energy, see Refs.~\cite{Saridakis:2009bv,Carloni:2010nx,Calcagni:2009ar}. \section{Ethology of Dark Energy} As we saw in the previous section, there is a theoretically broad landscape of Dark Energy candidates. Thus, it is of the utmost importance to have a framework in which to study the impact of each particular theory on cosmological or astronomical observables. The standard approach consist of studying the specific form that a bunch of observed parameters takes in a modified gravity model and compare it with experimental data. \subsection{The $\eta$ and $Y$ parameters } A given theory of DE which allows for a background compatible with the accelerated expansion of the Universe will have, at perturbative level, some impact on smaller scales. For cosmological implications one is usually interested only in scalar perturbations, and it is convenient to work in the Newtonian gauge: \begin{equation} ds^2 = -\left(1+2\Psi\right)dt^2 + a^2(t)\left(1+2\Phi\right)\delta_{ij}dx^idx^j \; , \end{equation} where $\Psi$ and $\Phi$ are two scalar functions, i.e. the two gravitational potentials. One should study the perturbed modified EFE for this metric and compare with the ones of standard GR. For many purposes it is useful to work in the quasi static approximation (QSA), i.e. within the assumptions that spatial derivatives dominate over time ones. This approximation is valid only on scales well inside the Hubble Horizon, $k/a H \gg 1$, see Ref.~\cite{Amendola:2019laa} for a detailed discussion about the scope of validity of the QSA. From the modified EFE we obtain the two generalized Poisson equations in Fourier space for the potentials $\Psi$ and $\Phi$ in the case of pressureless matter: \begin{eqnarray} &k^2\Phi = \frac{1}{2} Y(k,t) \eta (k,t)\rho_m(t)\delta_m (k,t) \; , \\ &k^2\Psi = \frac{1}{2} Y(k,t) \rho_m(t)\delta_m (k,t) \; , \end{eqnarray} where we have defined the anisotropic stress parameter $\eta = -\Phi/\Psi$ and the $Y$ parameter, which describes an effective gravitational coupling $G_{eff}$ and measures deviations from the Newton constant $G_N$ for matter. Both these parameters can be constrained by observations; for example $\eta$ has been constrained to be $\eta \leq 10^{-5}$ on solar system scales by the Cassini spacecraft, see Refs.~\cite{Will:2014kxa,Uzan:2010pm,Bertotti:2003rm}. It is also possible to constrain $Y$ and its time derivative at various scales, see for example Refs.~\cite{Hofmann:2018myc,DeglInnocenti:1995hbi,Verbiest:2008gy,Giani:2020fpz}. \subsection{Linear theory of structure formation} As we saw before, several Dark Energy models can be expressed in the form of a scalar-tensor theory, i.e. they belong to the general class of Horndeski theories. Through an effective field theory approach (EFT) for the Horndeski theories, it was shown in \cite{Bellini:2014fua} that the cosmological information about linear perturbation theory can be encoded in four parameters: \begin{itemize} \item $\alpha_K$ is a parameter related to the kinetic energy of the scalar field and to it contribute all the $G_i$ functions of the Hordenski Lagrangian \eqref{HL}. It is also called \textit{Kinecity} \item $\alpha_B$ is a parameter related to the clustering properties of DE. It is also called \textit{Braiding} and comes from the mixing of the kinetic terms of both the metric and the scalar field. To it contribute the functions $G_3, G_4$ and $G_5$. \item $\alpha_M$ encodes the effects of a varying effective Planck mass $M$ and generates anisotropic stress. To it contribute $G_4$ and $G_5$ \item $\alpha_T$ is related to the velocity of propagation of tensor modes. It leads to the emergence of anisotropic stress by modifying the Newtonian potential $\Psi$ even in absence of scalar perturbations. To it contribute both $G_4$ and $G_5$. \end{itemize} A similar EFT approach could be applied also to Generalized Proca Theories, see Eq.~\eqref{GPL}, and SVT theories. As an example of the capability of the method, let us consider the measurements of $\alpha_T$ made possible from the event GW170817 and its electromagnetic counterpart. Since no significant deviation on the velocity of the gravitational waves was detected with respect to the value predicted by GR, the observation suggests $\alpha_T = 0$. This in turns implies $G_4 = const$ and $G_5 = 0$, thus ruling out roughly half of the Hordenski theories, see Refs.~\cite{Creminelli:2017sry,Kase:2018aps,Bordin:2020fww,Ezquiaga:2017ekz,Dalang:2019rke}. The same applies for the $G_4$ and $G_5$ function of generalized Proca and SVT theories. There is however still a caveat in the above argument, which relies on the fact that the event GW170817 comes from a fairly close distance, and thus we only got information about the value of $\alpha_T$ from Late-times observations. It was showed in Ref.~\cite{Amendola:2018ltt} that it is possible to have a class of theories, which exhibits scaling behavior, capable of reaching dynamically an attractor solution compatible with $\alpha_T = 0$. \subsection{Equation of state of Dark Energy} We do know that the equation of state parameter $w_{DE}$ of Dark Energy in the case of a cosmological constant behave as the one of vacuum energy, and has the value $w_{\Lambda} = -1$. Current observations are compatible with this value, but do not exclude a wider parameter space with enough accuracy. It must be stressed however that a measure of $w_{DE}$ alone cannot tell us too much about the fundamental nature of Dark Energy, see for example Refs.~\cite{Amendola:2016saw, Amendola:2012ky}. On the other hand, a precise measurement of $w_{DE}$ could be used to rule out particular Dark Energy candidates. For example, a measurement of $w \neq -1$ with enough statistical accuracy would rule out a pure $\Lambda$CDM scenario. Most of $DE$ models predict a value for $w_{DE} > -1$, thus a measurement in this direction would not be particularly enlightening about the nature of DE. On the other hand, a statistically significant measure of $w_{DE} < -1$ at any time of the cosmological evolution would carry a lot of information about gravitational physics. Such a regime, called \textit{phantom}, it is indeed associated to the fact that either gravity is not minimally coupled to matter, or that DE is not a perfect fluid which can interact with other species. Indeed, it is a well known fact that a perfect fluid or a minimally coupled scalar field in a phantom regime would carry ghost or gradient instabilities, see Ref.~\cite{Dubovsky:2005xd}. \subsection{Variation of the electromagnetic coupling $\alpha_{EM}$} As we mentioned before for the case of the Newton constant $G_N$, some models of Dark Energy result in a violation of the equivalence principle. The specific case of a possible variation of the fine structure constant was discussed by Bekenstein in the pioneering work~\cite{Bekenstein:1982eu}. Bekenstein, at the time, concluded that tests of the equivalence principle rule out spacetime variability of $\alpha_{EM}$ at any level. In the last decades, however, huge improvements have been made from the experimental point of view, leading to tight constraint on the variation of $\alpha_{EM}$, see for example Refs.~\cite{Uzan:2010pm, Leal:2014yqa,Holanda:2015oda,Pinho:2016mkm,Hees:2020gda}, and claims of statistical evidences of $\alpha_{EM}$ variations, see for example Refs.~\cite{Murphy:2003hw,Webb:2010hc}. For the above reasons, the subject is nowadays very popular and a violation of the equivalence principle could potentially confirm or rule out several alternative theories of gravity \cite{Tino:2020nla}. One could in general distinguish between variations on the value of $\alpha_{EM}$ on large or local scales. On local scales the variation of $\alpha_{EM}$ is related to the local gravitational field, see for example Refs.~\cite{Bekenstein:2009fq, Shaw:2006zs, Barrow:2014vva}. On cosmological scales these could be motivated by a modification of the gravitational theory due to the dynamical behavior of the DE field and were extensively studied in the literature, see for example Refs.~\cite{Olive:2001vz,Marra:2005yt,Barrow:2009nt, Barrow:2011kr,Barrow:2013uza,Sloan:2013wya,Graham:2014hva,vandeBruck:2015rma,Fritzsch:2016ewd}. It is important to note that the connection between DE and the variation of $\alpha_{EM}$ is of great importance from the observational point of view, since it is indeed possible to relate constraints on $ \Delta\alpha$ to constraints on DE parameters, see for example Refs.~\cite{Calabrese:2013lga, Martins:2019ebg, Martins:2015jta}. \chapter{Personal Contribution: \\ Ricci Inverse Gravity} \label{chapter:IR} \epigraph{\textit{I don't think there is a final theory of anything. It's theories (turtles) all the way down.}}{Jim Peebles} In Ref.~\cite{Amendola:2020qho} we proposed a novel class of modified gravity theories based on the inverse of the Ricci tensor $R_{\mu\nu}$, which we call the anticurvature tensor $A_{\mu\nu}$. Taking the trace of the latter we obtain the anticurvature scalar $A$, which can then be used to construct a new type of Lagrangian densities. It is interesting to note that with the anticurvature scalar is very simple to write down Lagrangian densities terms with the same dimension as $R$, like for example $A^{-1}$ or $R^2 A$, and thus without introducing new dimensional constants. \section{Field equations} The anticurvature tensor $A_{\mu\nu}$ is defined as the inverse of the Ricci tensor: \begin{equation}\label{Adefinition} A^{\mu\rho}R_{\rho\nu}= \delta^{\mu}_{\nu} \; , \end{equation} from which, taking the trace, we obtain the anticurvature scalar $A=A^{\mu\nu}g_{\mu\nu}$. Note that it is possible to write the inverse of any matrix in terms of its adjugate, i.e. in terms of the matrix itself and the Levi Civita symbols. In particular, for the anticurvature tensor we have: \begin{equation}\label{AR} A^{\mu\nu}= 4\frac{R_{\kappa\pi}R_{\lambda\rho}R_{\xi\sigma}\varepsilon^{\mu\kappa\lambda\xi}\varepsilon^{\nu\pi\rho\sigma}}{R_{\alpha\zeta}R_{\beta\eta}R_{\gamma\theta}R_{\delta\iota}\varepsilon^{\alpha\beta\gamma\delta}\varepsilon^{\zeta\eta\theta\iota}}\; . \end{equation} From the latter equation we can appreciate that a theory based on the anticurvature scalar is actually a strongly nonlinear, higher order theory of gravity. The field equations for a general Lagrangian $f(R,A)$ are: \begin{align} f_{R}R^{\mu\nu}-f_{A}A^{\mu\nu}&-\frac{1}{2}fg^{\mu\nu}+g^{\rho\mu}\nabla_{\alpha}\nabla_{\rho}f_{A}A^{\alpha}_{\sigma}A^{\nu\sigma}-\frac{1}{2}\nabla^{2}(f_{A}A_{\sigma}^{\mu}A^{\nu\sigma}) &\nonumber\\&-\frac{1}{2}g^{\mu\nu}\nabla_{\alpha}\nabla_{\beta}(f_{A}A_{\sigma}^{\alpha}A^{\beta\sigma})-\nabla^{\mu}\nabla^{\nu}f_{R}+g^{\mu\nu}\nabla^{2}f_{R} =T^{\mu\nu} \; ,\label{eq:master} \end{align} where $f_{A,R}$ indicate derivation with respect to the Ricci or anticurvature scalars, see Appendix \ref{Appendix C} for a detailed derivation of the above field equations.\footnote{A code that evaluates the equations of motion for any $f(R,A)$ in a given metric is made publicly available \href{https://github.com/itpamendola/inverse-ricci}{here}} It is well known that one can recast an $f(R)$ theory in the form of a scalar-tensor theory in the Einstein frame introducing a scalar field non minimally coupled to gravity. Usually this is done by defining a scalar field $\phi = df/dR$ and performing a Legendre transformation of the function $f$. Such an approach, however, fails here, because $A$ is not a one-to-one function of $R$ and therefore $df(A)/dR$ is in general not invertible. \section{Cosmology} We are interested in understand which kind of behavior could arise from Eq.~\eqref{eq:master} for cosmological implications. Since we are mainly interested in Dark Energy phenomenology, let us begin with a de Sitter ansatz for the metric $g_{\mu\nu}$. Under this assumption $R_{\mu\nu}= R g_{\mu\nu}/4$, and it is straightforward to compute $A_{\mu\nu}$ from the inverse metric. In this case all the terms with derivatives in Eq.~\eqref{eq:master} vanish, and taking the trace one has in vacuum: \begin{align} f_{R}R-f_{A}A-2f =0 \; . \end{align} Since on de Sitter background $R=12H^2$ and $A=4/(3H^2)$, the latter equation can be easily solved for any $f(R,A)$ model to check whether one gets non-trivial (i.e. $H\not = 0$) solutions that could replace a cosmological constant. For instance, if $f=R-\alpha A$ (where $\alpha$ is a constant with dimensions $H_0^4$) then we see that $H=(\alpha/3)^{1/4}=const$. Having seen that it is in principle possible to have de Sitter solutions in this model, let us investigate the behavior in a flat FLRW background. In this case we have that the Ricci and anticurvature scalars can be written: \begin{eqnarray} R = 6\left(\dot{H} + 2H^2\right) \;, \\ A=\frac{2(6+5\xi)}{3H^2(1+\xi)(3+\xi)} \;\label{AFLRW} , \end{eqnarray} where $\xi = \dot{H}/H^2$. It is straightforward to realize from Eq.~\eqref{AFLRW} that the anticurvature scalar become singular in the following cases: $H\rightarrow0$, $\xi \rightarrow -1$, or $\xi \rightarrow -3$. The fact that for $H\rightarrow 0$ the Lagrangian is ill-defined implies, as expected, the lack of a Minkowski solution for Lagrangians containing positive powers of the anticurvature scalar $A^n$. On the other hand, this does not apply for Lagrangian containing negative powers $A^{-n}$, which are instead singular for $\xi \rightarrow -6/5$. Thus, just by looking at the shape of the anticurvature scalar in FLRW background we are able to formulate the following no-go theorem for cosmology: \begin{theorem}[FLRW no-go] If the cosmic evolution passes through any one of these values of $\xi$: $\xi = -1$, $\xi = -3$ or $\xi = -6/5$, either $A$ or $A^{-1}$, or any of their powers, develops a singularity. If during the evolution $A$ passes through \textbf{both} 0 and $\pm \infty$, then any term in the Lagrangian that contains $A^n$, for $n$ positive or negative, will blow up. This behavior will reflect into equations of motion that also contain a singularity at the same cosmic epochs. \end{theorem} Observations~\cite{Abbott:2018wog,Scolnic:2017caz,Ade:2015xua,Aghanim:2018eyx} tell us that the Universe evolved from a decelerated phase with $w_{eff}\approx 0$ (so $\xi\approx -1.5$) into an accelerated phase $w_{eff}\approx -0.7$ (so $\xi\approx -0.45$). Therefore, the cosmic expansion had to pass, at redshifts around unity, through both $\xi=-1$ and $\xi=-6/5$. This demonstrates that $A$ and $A^{-1}$ will both be singular at some epoch between deceleration and acceleration. Consequently, any Lagrangian that contains additive terms proportional to $A^n$ (e.g. the two simplest scale-free models, $f(R,A)=R+\alpha A^{-1}$ and $f(R,A)=R+\alpha R^2 A$, with $\alpha$ a dimensionless constant) are ruled out as Dark Energy models. Notice also that $R=6H^2( \xi+2)$ so no power of $R$ can cure the singularity. In order to see some concrete realizations of the no-go theorem in the following we will briefly illustrate the cosmological behavior for the Lagrangians $f=R+\alpha A^{-1}$ and $f=R+\alpha R^2 A$. \section{Lagrangian $R+\alpha A^{-1}$} In this case equations \eqref{eq:master} for a FLRW background reduce to: \begin{equation}\label{FrIA} \rho_t= 3 \alpha H^2\frac{ (\xi +3)^2 (5 \xi +6)-18 \xi '}{4 (5 \xi +6)^3}+3 H^2 \; , \end{equation} which is the modified Friedmann equations, and to: \begin{align} w_t\rho_t=&-\frac{\alpha H^2 \left[(5 \xi +6) \left((\xi +3)^2 (2 \xi +3) (5 \xi +6)-18 \xi ''\right)+270 \left(\xi '\right)^2-54 (\xi +2) (5 \xi +6) \xi '\right]}{4 (5 \xi +6)^4}\nonumber \\ &-2 H^2 \xi -3 H^2 \; , \end{align}\label{AccIA} which is the $(i,i)$ equation. Note that, as follows from the No-go theorem, the singularity at $\xi = -6/5$ appears in both the equations. We have used the subscript $t$ in $\rho_t$ to indicate the total matter, which of course satisfy the continuity equation $\rho_t'=-3(1+w_t)\rho_t$. From Eq.~\eqref{FrIA} we can easily define the energy density associated to the anticurvature scalar: \begin{equation} \Omega_A\equiv -\alpha\frac{ (\xi +3)^2 (5 \xi +6)-18 \xi '}{4 (5 \xi +6)^3} \; . \end{equation} We will now consider two different cases, considering pressureless matter only and then adding a cosmological constant \subsection{Evolution with Dust} Assuming $w_t = 0$ we find for Eqs.~\eqref{FrIA} and \eqref{AccIA} the following critical points: \begin{align} &\Omega_m =1+\frac{\alpha}{4} \; , \qquad \xi = -\frac{3}{2} \; ,\\ &\Omega_m=0\,,\quad \xi_{\pm}=\frac{3(-40-\alpha\pm 6 \sqrt{-\alpha})}{100+\alpha} \; . \label{eq:walpha} \end{align} The first critical point corresponds to a matter dominated Universe in which $\Omega_A$ behaves as matter. In particular, if $\alpha = -4$, it corresponds to an empty Universe wich behave as it was filled with dust. The critical points of Eq.~\eqref{eq:walpha} instead admit solutions only for certain values of $\alpha$, see Fig.~\ref{fig:walpha} for a graphical representation of $\xi_+$. We see that for every $\alpha<0$ there are two real solutions, one above, the other below $\xi=-6/5$, or equivalently $w_{ eff}=-0.2$. \begin{figure} \includegraphics[width=12cm]{walpha.pdf} \caption{The two real branches of the function $w_{ eff}(\alpha)=-2\xi/3-1$ from Eq. (\ref{eq:walpha})\label{fig:walpha}} \end{figure} The properties of these solutions seem very interesting for cosmological implications. For instance, for $\alpha\approx -8$, the two solutions correspond to the observed present accelerated value $w_{ eff}\approx -0.67$ and to an expansion quite close to a matter dominated era, $w_{ eff}\approx 0.06$. Analogously, if $\alpha=-4$, one has $w_{eff}=0$, i.e. an exact matter era evolution without matter, in which the $A$ energy density acts as a form of Dark Matter. The other solution, $\xi_+$, corresponds to $w_{ eff}=-0.5$, i.e. an accelerated solution still marginally compatible with observations. In Fig.~\ref{fig:ximatter} we see the behavior of the Hubble parameter for the particular case $\alpha -4$. A cosmic evolution that moves from one such solution to the other would be indeed an intriguing possibility, replacing both Dark Matter and Dark Energy with the anticurvature tensor without any new scale nor fine-tuned parameters. However, as a consequence of the no-go theorem, this cannot occur. \begin{figure}[tb] \begin{center} \includegraphics[width=10cm]{plot1.pdf} \caption{ Numerical solutions $\xi(a)$ of Eq.~\eqref{eq:walpha} in case of $\Omega_m \neq 0$, $\Omega_\Lambda=0$ with $w=0$ and $\alpha=-4$. The solutions $\xi=-3/2$ and $\xi=-3/4$ are confirmed to be attractors. The divide at $\xi=-6/5$ is also evident. The red dashed line is the $\Lambda$CDM behaviour.} \label{fig:ximatter} \end{center} \end{figure} Through a stability analysis of the linearized dynamical system we find that the critical point $\xi_{-}$ is a stable attractor only for $-4\le\alpha\le 0$. The critical point $\xi_+$ is a stable attractor for $\alpha \leq 0$, while the linear analysis alone cannot assess the stability of the point $\xi = -3/2$. These findings are supported by the numerical investigation shown in Fig.~\ref{fig:ximatter}, so that the cosmic evolution will end up either at $\xi_+$ or $\xi_{-}$, depending on whether the initial $w_{eff}$ is above or below the singularity at $w_{eff}=-0.2$. The crucial point is that no trajectory can cross the $w_{eff}=-0.2$ ridge; consequently, as anticipated on general grounds, the cosmic expansion cannot move from a decelerated phase around $w_{ eff}=0$ to an accelerated one around $w_{ eff}\approx -0.7$. \subsection{Evolution with Dust and a cosmological constant} If a cosmological constant is present we can combine Eqs.~\eqref{FrIA} and \eqref{AccIA} and obtain: \begin{equation} \xi ''= \frac{6 (5 \xi +6)^4 \Omega _m+\xi (5 \xi +6)^2 \left(9 (\alpha +16)+(\alpha +100) \xi ^2+6 (\alpha +40) \xi \right)+135 \alpha \left(\xi '\right)^2-27 \alpha \left(5 \xi ^2+11 \xi +6\right) \xi '}{9 \alpha (5 \xi +6)} \; , \label{eq:mattercosmconst} \end{equation} which must be solved together with the continuity equation: \begin{equation} \Omega_{m}'=-(3+2\xi)\Omega_{m} \; . \end{equation} In this case the phase space is more complicated, $\xi_-$ is now always unstable and $\xi_+$ is a stable attractor for $\alpha <-16$. The critical point $\xi = -3/2$ is always unstable, while we found a new critical point $\xi = 0$, which is a stable de Sitter attractor when $-16 \leq\alpha \leq0$. However, the bottom line is the same, as can be immediately gleaned from Fig.~\ref{fig:ximatterlambda}, so the model is ruled out as a candidate for Dark Energy even when a cosmological constant is added, regardless of the value of $\alpha$. \begin{figure}[tb] \centering \includegraphics[width=10cm]{plot2.pdf} \caption{ Numerical solutions $\xi(a)$ of Eq.~\eqref{eq:mattercosmconst} with matter and cosmological constant, for $\alpha=-4$. The upper curves converge toward the de Sitter attractor at $\xi=0$. The lower curves converge towards the divide line at $\xi=-6/5$, which is now also an attractor. The red dashed line is the $\Lambda$CDM behavior.} \label{fig:ximatterlambda} \end{figure} \section{Circumventing the no-go theorem} Motivated by the interesting phenomenology which could be described within the anticurvature scalar, we will try now to address some possible escape routes from the no-go theorem. \subsection{Modifying the geometry} To begin with, we should consider possible modifications of the background geometry that allow for a different evolution. If we relax the assumption of a spatially flat Universe the anticurvature scalar become: \begin{equation} A=\frac{2(6+5\xi+3\Omega_k)}{3H^2(1+\xi)(3+\xi+6\Omega_k)} \; , \end{equation} where we can see that the appearance of the energy density associated with the curvature shifts the singularity $\xi = -3$ for positive powers of $A$, while shifts the singularity $\xi = -6/5$ of $A^{-1}$. Thus, in principle the presence of curvature is able to shift the singularity of the Lagrangians outside the range required by the observations. However, since observations suggest that $\Omega_k \sim 0$, this possibility is very unlikely. Another option is to take into account the contribution from spatial anisotropies. For illustrative purposes, let us consider as an example a Bianchi I geometry: \begin{equation}\label{BImetric} ds^2 = -dt^2 +a(t)^2\left(e^{2\beta_x(t)}dx^2 +e^{2\beta_y(t)}dy^2 + e^{2\beta_z(t)}dz^2 \right) \; , \end{equation} where we have defined the averaged scale factor \begin{equation} a(t) = \sqrt[3]{a_x(t) a_y(t) a_z(t)}\; , \end{equation} so that $a_i(t) = a(t)e^{\beta_i}$, and the $\beta_i$ satisfies $\sum_i \beta_i = 0$. For the sake of simplicity, let us specialize to the case $\beta_x = -\beta_z \equiv \beta$ and $\beta_y = 0$. In this case the anticurvature scalar $A$ reads: \begin{equation} A = \frac{1}{H^2}\left[\frac{4\xi + 6 + \frac{(\beta')^2}{2}}{3\left(3+\xi\right)\left(1+\xi + \frac{(\beta')^2}{6}\right)} + \frac{2(3+\xi)}{\left(3+\xi\right)^2 - \frac{1}{4}\left(\beta'' + \beta'(3+\xi)\right)^2} \right] \; , \end{equation} which for $\beta'=0$ reduces to the FLRW case. As we can see, the singularity $\xi = -1$ is shifted by the anisotropic term $(\beta')^2/6$. Note that also the singularity appearing in $A^{-1}$, $\xi = -6/5$, is in general shifted. For example, if $\beta''$ is negligible, we have that $A^{-1}$ is singular for \begin{equation} \xi = \frac{24-\frac{\beta'^4}{4}}{ 2\beta'^2-20}\approx -\frac{6}{5}(1-\frac{(\beta')^2}{10})\;,\label{betasingular} \end{equation} (the last approximate equality being valid for $\beta'\ll 1$) which recovers the FLRW case for $\beta'=0$, while being regular in $\xi= -6/5$ unless $\beta'^2 = 48/5$, i.e. the two roots of Eq.~\eqref{betasingular} for $\xi = -6/5$. This shows that relaxing the assumption of spatial isotropy the singularities occurring in the anticurvature scalar and its inverse can be arbitrarily shifted, but not removed. It is clear however that one needs $\beta'$ of order unity to move the singularity outside the observational range, which on the other hand is not likely to be compatible with experimental data. To illustrate that, let us naively estimate $\beta$ from the evidence of anisotropic expansion claimed recently in \cite{Migkas:2020fza}, emerged from X-ray observations of galaxy clusters. Here the authors find that the highest and the lowest values observed for the universe expansion rate are $H_{ max} \sim 75 \;$ km/s/Mpc and $H_{ min} \sim 66 \;$ km/s/Mpc. Assuming that the averaged Hubble factor is $H \sim 70 \;$ km/s/Mpc, we obtain \begin{equation} \beta' \sim 0.06 \; , \end{equation} which shows that generally $\beta'$ is constrained from the observations to be too small to shift the singularities of $A$ outside the observational range. \subsection{Non Polynomial Lagrangians} Another possibility is to consider Lagrangian densities which are not singular when $A$ or $A^{-1}$ diverge. Still considering scale-free Lagrangians for simplicity, we can choose for example the scalar densities $R+\alpha R\exp[-\beta (RA)^2]$ or $R/(1+\alpha RA)$. In the former case, for example, the Friedmann equation around the critical points, i.e. assuming $\xi'=\xi''=0$, becomes: \begin{equation} 3 H^2 \left(1-\frac{\alpha \mathcal{P}_5(\xi,\beta)}{(\xi +1)^3 (\xi +3)^2}e^{-\frac{16 \beta(\xi +2)^2 (5 \xi +6,)^2}{(\xi +1)^2 (\xi +3)^2}}\right) = \rho_m \; , \end{equation} where $\mathcal{P}_5(\xi,\beta)$ is a polynomial of order five in $\xi$ and linear in $\beta$. It is straightforward to realise that the above equation is regular on the poles of the denominator due to the presence of the exponential factor. Another option is to include, as in Gauss Bonnet gravity for the Ricci tensor, scalar combinations of higher order in the anticurvature tensor, like $A^{\mu\nu}A_{\mu\nu}$. In FLRW background the latter looks as follows: \begin{equation} A^{\mu\nu}A_{\mu\nu} = \frac{4}{9H^4}\frac{7\xi^2 + 15\xi + 9}{(\xi+1)^2(\xi + 3)^2} \; . \end{equation} We see that it still contains the singularities at $\xi = -3$ and $\xi=-1$, but remarkably it never vanishes, and thus $(A^{\mu\nu}A_{\mu\nu})^{-1}$ can be used to build Lagrangians which are free of this kind of singularities. \section{Summary and Outlooks} We have shown that it is difficult to describe Dark Energy using polynomial Lagrangians of the anticurvature scalar because of the no-go theorem. On the other hand, we found that an interesting phenomenology arise already for the simplest choices of $f(R,A)$, and thus Lagrangians that escape the no-go theorem are particularly promising for cosmological model building. It is important to realize that in this framework we are introducing higher order derivative terms in the Lagrangian, see Eq.~\eqref{AR}, and then we expect that instabilities will generally occur unless we consider degenerate Lagrangians. The above stability issues and the no-go theorem should be taken into account when a particular form of $f(R,A)$ is specified, which is the task we address for future works. \chapter{Overview Of the $\Lambda$CDM model} \label{chapter:LCDM} \epigraph{\textit{Indeed, it has been said that democracy is the worst form of government except all those other forms that have been tried from time to time.}}{Winston Churchill} The discovery of the accelerated expansion of the Universe~\cite{Riess:1998cb, Perlmutter:1998np} is undoubtedly one of the cornerstone of modern cosmology. After roughly two decades, it is commonly accepted that the best description of our universe on cosmological scales relies on the $\Lambda$CDM model. In this chapter we will give a brief introduction of the model, highlighting its agreement with the main observational evidences and describing the theoretical framework at his foundation. Finally, we will conclude the chapter mentioning some open problems of the standard model. Most of the material presented here is covered (surely better) in many standard textbooks, and was largely influenced by Refs.~\cite{Piattella:2018hvi,Amendola:2015ksp}, which I recommend for a detailed treatment. \section{Theoretical grounds} \label{sec:Theoretical_framework_LCDM} \subsection{The Equivalence principle} \label{subsec:EP} One of the cornerstone that led Einstein to the formulation of General relativity is the Equivalence Principle. Historically, it is formulated with the statement that \textit{the gravitational and inertial mass are equivalent}, and it is also a pillar of Newtonian theory of gravity. Roughly 300 hundreds years after its verification by Galileo, Einstein realized that one of the consequences of the principle is that no static homogeneous external gravitational field could be detected from physics experiments performed by free-falling observers located in a sufficiently small spacetime region. In the context of General Relativity, a useful statement of the Equivalence Principle is the following \cite{Weinberg:1972kfs} : \textit{at every spacetime point in an arbitrary gravitational field it is possible to choose a locally inertial coordinate system such that, within a sufficiently small region of the point in question, the laws of nature take the same form as in unaccelerated Cartesian coordinate system in the absence of gravitation}. Usually one refers to the above statement as the \textit{strong Equivalence Principle}, to distinguish it from the aforementioned equivalence between inertial and gravitational mass, which is instead labelled as \textit{weak Equivalence Principle}. Experimental tests of the Equivalence Principle, either in its weak of strong version, are of crucial importance for our fundamental understanding of gravity. Indeed, many alternative theories of gravitation result in some kind of violation of the Equivalence Principle, so that the precision within which we can trust its validity can be used to rule out a certain class of models. \subsection{Einstein Field Equations} \label{subsec:EFE_LCDM} The main goal of a cosmological model is to describe the dynamical evolution of the Universe in agreement with data. In order to relate the dynamics of the Universe to its components, a theory of gravitation is required. The $\Lambda$CDM model assumes that the appropriate description of the gravitational interaction on cosmological scales is given by the Einstein Field Equations (EFE). We prefer to speak of Einstein Field Equations instead of General Relativity because, as showed in Ref.~\cite{BeltranJimenez:2019tjy}, it is possible to obtain the same equations from other geometrical theories that differs from GR at fundamental level. The Einstein Field Equations are: \begin{equation}\label{EFE} R_{\mu\nu} - \frac{1}{2}g_{\mu\nu}R + \Lambda g_{\mu\nu} = 8\pi G_N T_{\mu\nu} \; , \end{equation} where $R_{\mu\nu}$ is the Ricci tensor, $R$ its trace, $g_{\mu\nu}$ the spacetime metric, $G_N$ the Newton's constant, $\Lambda$ the Cosmological Constant (CC) and $T_{\mu\nu}$ the energy momentum tensor. The Ricci tensor and scalars are construed from the Riemann tensor $R_{\mu\nu\lambda\sigma}$, also called curvature tensor, which satisfies the Bianchi identities:\begin{equation} R_{\mu \nu \lambda \eta} + R_{\mu \eta \nu \lambda} + R_{\mu \lambda \eta \nu} = 0 \; , \end{equation} \begin{equation} R_{\mu \nu \lambda \eta ; \sigma} + R_{\mu \nu \sigma \lambda;\eta} + R_{\mu \nu \eta \sigma; \lambda} = 0 \; , \end{equation} where we use the notation $ A_{\mu;\nu}$ to represent the covariant derivative of $A_\mu$ with respect to $x^{\nu}$. It is possible to show \cite{Landau:1982dva, Weinberg:1972kfs} using the Bianchi identities that the left hand side of Eqs.~\eqref{EFE} is divergenceless, enforcing the validity of the continuity equation $T^{\mu}_{\nu;\mu}= 0$ in curved spacetime. \subsection{The Cosmological Principle} In 1922 the Russian mathematician Alexander Friedmann obtained an analytical solution of Eqs.~\eqref{EFE} under the assumption that the spacetime is homogeneous and isotropic~\cite{Friedmann1922}. A similar result was obtained independently by the Belgian astronomer George Lema\^{i}tre in 1927~\cite{Lematre1927}, and later on by the American mathematician Howard Robertson~\cite{Robertson} and the British mathematician Arthur Walker~\cite{Walker}. The resulting spacetime is described in terms of a metric usually denoted \textit{FLRW}, named after them. The FLRW line element can be written: \begin{equation}\label{FLRW} ds^2 = -dt^2 + a(t)^2\left(\frac{dr^2}{1-Kr^2} +r^2d\Omega^2 \right) \; , \end{equation} where $\Omega$ is the solid angle, the function $a(t)$ is the scale factor and the constant $K$ is related to the curvature of the spatial slices. A negative, vanishing or positive value of $K$ corresponds respectively to Hyperbolic, Euclidean or Spherical spatial geometry. The assumptions that at background level the Universe is homogeneous and isotropic are usually referred to as the \textit{Cosmological Principle}. They are also at the core of Newtonian gravity and Galilean relativity, where they are stated as the existence of a universal time and the lack of any preferred direction in space. These definitions on the other hand are not completely satisfactory in the contest of General Relativity, where differential geometry concepts are required to unambiguously define them. A very rigorous definition by Wald is the following, see Ref.~\cite{Wald:1984rg}: \begin{itemize} \item[] \textbf{Homogeneity:} \textit{A space-time is said to be homogeneous if $\exists$ a family of 1-parameter of spacelike hypersurfaces $\Sigma_t$ foliation such that $\forall t$ and $p,q \in \Sigma_t $ $\exists$ an isometry $I : I(p) \rightarrow q $. } \item[] \textbf{Isotropy:} \textit{a space is spatially isotropic if $\exists$ at each point a congruence of timelike curves with tangents $u^\alpha$ such that $\forall p \in$ the congruence, given two $s_1^\alpha, s_2^\alpha$ spacelike vectors orthogonal to $u^\alpha \; \exists \; I$ of $g_{\mu\nu} \; : \; s_1^\alpha \rightarrow s_2^\alpha $ leaving $p$ and $u^\alpha$ fixed . } \end{itemize} A slightly less technical definition of the Cosmological Principle could be instead found in Weinberg's book \cite{Weinberg:1972kfs}: \textit{A globally hyperbolic spacetime is homogeneous and isotropic if}: \begin{itemize} \item[]\textit{i)} Hypersurfaces with cosmic standard time are maximally symmetric subspaces of the whole space-time. \item[]\textit{ii)} $g_{\mu \nu}, T_{\mu \nu}$ and all the other cosmic tensor are form invariant with respect to the isometries of these subspaces. \end{itemize} We recall that a manifold is \textit{globally hyperbolic} if it possesses a Cauchy surface, i.e. there exists a surface which every causal curve on the manifold crosses exactly once. Roughly speaking this means that a surface exists from which, once specified the initial conditions, it is possible to track past and future evolution of the causal curves through the field equations. A space of dimension $D$ is \textit{maximally symmetric} if it admits $D(D+1)/2$ independent Killing vector fields. A Killing vector field is a vector field on a Riemannian or Pseudo-Riemannian manifold that preserves the metric. Finally, an \textit{isometry} is a bijective function in a metric space that preserve distances. We hope the reader could forgive the latter brief technical digression on the cosmological principle, but once a proper definition was given we are now able to highlight some of its consequences. First we notice that no concept from General Relativity was used to define the cosmological principle. Indeed, it is an assumption (which is well motivated from the observational point of view, as we will discuss later) independent of the specific metric theory of gravitation we are considering. We also note that the existence of a preferred foliation of the spacetime in terms of a time parameter implies the existence of a privileged class of observers, i.e. free falling observers, whose clocks measure the cosmic time. This could be misleading from the perspective of General Relativity, because of general covariance and of the Equivalence Principle. The main point is that the goal of cosmology is to describe our Universe, which is just a particular realization, or solution, of the Einstein Field Equations (or any alternative metric theory of gravitation), and although the EFE are generally covariant, a particular solution of them does not have to be. \subsection{The Friedmann equations} Computing Eqs.~\eqref{EFE} for the FLRW metric \eqref{FLRW} we obtain the Friedmann equations: \begin{align}\label{Feq1} H^2 + \frac{K}{a^2} - \frac{\Lambda}{3}= \frac{8\pi G_N}{3}T_{00} \; , \\ g_{ij}\left(H^2 + 2\frac{\ddot{a}}{a} + \frac{K}{a^2} - \Lambda\right)= -8\pi G_N T_{ij} \; , \label{Req1} \end{align} where we have defined the Hubble function $H(t) = \dot{a}/a$. Note that the high symmetry of the cosmological principle restricts the allowable choices of $T_{\mu\nu}$. Since the FLRW metric depends only on time, the same must hold for the components of the energy momentum tensor. Furthermore, due to spatial isotropy, the $0i$ components must vanish. Finally, since the left hand side of Eq.~\eqref{Req1} is proportional to $g_{ij}$ the same must be true for $T_{ij}$. Usually in cosmological applications we consider perfect fluids, which satisfy the above listed properties and can be written in general as: \begin{equation}\label{Perf.Fluid} T_{\mu\nu} = \left(\rho(t) + P(t) \right)u_{\mu}u_{\nu} + P(t)g_{\mu\nu}\; , \end{equation} where we have defined the rest energy density of the fluid $\rho$ and the pressure $P$. We have also introduced the 4-velocity $u_{\mu}$, which is normalized by definition so that $g_{\mu\nu}u^{\mu}u^{\nu} = -1$. Thus, in the comoving frame, where the fluid is at rest, we have $u_{i}=0$ and $u_0 = \frac{1}{\sqrt{|g^{00}|}}$. Note that Eqs.~\eqref{Feq1},\eqref{Req1} are not completely independent; indeed, since in General Relativity the zero component of the EFE is a constraint equation that contains only first derivatives, Eq.~\eqref{Feq1} contains only the first time derivative of the scale factor. It is possible to obtain Eq.~\eqref{Req1} combining the derivative of Eq.~\eqref{Feq1} with the continuity equation of the fluid: \begin{equation}\label{ContinuityEq} \dot{\rho}(t) + 3 H\left(\rho + P\right) =0 \; . \end{equation} If we consider barotropic fluids it is possible to relate the pressure and the density through the Equation of State (EoS): \begin{equation} P(t)= w \rho (t) \; \end{equation} where $w$ is the EoS parameter. \subsection{Analytical solutions of the Friedmann equations} It is possible to obtain analytical solutions of Eqs.~\eqref{Feq1},\eqref{Req1} for barotropic fluids by solving the continuity equation Eq.~\eqref{ContinuityEq}. Indeed, we have: \begin{equation} \frac{\dot{\rho}}{\rho} = -3\frac{\dot{a}}{a}\left(1+w\right) \; , \end{equation} from which: \begin{equation}\label{eossol} \rho = a^{-3(1+w)}\;. \end{equation} For most cosmological applications the parameter space for the equation of state parameter $w$ is very simple; one usually consider pressureless non-relativistic matter with $w=0$, also dubbed \textit{dust}, and relativistic matter with $w=1/3$, denoted \textit{radiation}, which includes for example photons and neutrinos. Let us consider a model of flat Universe $K=0$ filled with a perfect fluid defined by Eq.~\eqref{eossol}. In this case we can rewrite Eq.~\eqref{Feq1} in terms of the scale factor only: \begin{equation} 3\frac{\dot{a}^2}{a^2} = 8\pi G_N a^{-3(1+w)} \; , \end{equation}which solved with respect to the scale factor gives: \begin{equation}\label{singlefluidscalefactor} a(t) = \left[\sqrt{6\pi G_N}(1+w) t \right]^{\frac{2}{3(1+w)}} \; . \end{equation} \subsubsection{Single fluid models} Let us now focus on the evolution of the Universe for particular solutions of Eq.~\eqref{singlefluidscalefactor} relevant for cosmological purposes. If only a species is present, it is straightforward to integrate the latter equation and obtain analytical solutions for the Hubble function. In Table \ref{Table I} is reported the behavior of the scale factor, the density and the equation of state parameter for a flat Universe dominated by matter, radiation and Cosmological Constant. \begin{table} \centering \begin{tabular}{c||c|c|c} & Radiation & Dust & CC \cr \hline $a(t)$ & $t^{1/2}$ &$t^{2/3}$ &$e^{Ht}$ \\ $\rho(a)$ &$a^{-4}$ &$a^{-3}$ &$\Lambda/3$\\ $ w $ & $1/3$ &$0$ &$-1$ \end{tabular} \caption{Analytical solutions for the scale factor $a(t)$, the density $\rho(a)$ and the EoS parameter $w$ for a flat FLRW Universe during radiation, matter and Cosmological Constant (CC) domination.} \label{Table I} \end{table} It is important to realize that in an expanding Universe, since $a(t)$ is a growing function, the density function of matter and radiation is decreasing. Thus, if the Universe contains only these species, they will eventually dilute and the Hubble function approaches $H(t) \rightarrow 0$. In these models, the Universe approaches a stable Minkowski attractor in the future. On the other hand, if a Cosmological Constant is present, in the future the Universe reaches a stable de Sitter attractor and the scale factor starts to grow exponentially. \subsubsection{Einstein Static Universe} When Einstein was considering cosmological applications of its theory he had in mind a static Universe with $\dot{a}=\ddot{a}=0$. From Eq.~\eqref{Feq1}, since both $\Lambda$ and $\rho$ are positive, we must impose $K = 1$, i.e. a closed Universe. Moreover, the acceleration equation implies: \begin{equation} \rho + 3P = 0 \; , \end{equation} and since $\rho$ is positive definite, the only possibility is that there must be something with negative pressure that compensates. This was the main motivation that brought Einstein to introduce a Cosmological Constant $\Lambda$ into its equations. Indeed, since $\rho_\Lambda = -P_\Lambda$ we have: \begin{equation} 2\rho_\Lambda =\rho_m\; , \end{equation} which is a critical point of the dynamical equations. On the other hand such a point is unstable, and depending on the sign of a small perturbation the Universe evolves into a de Sitter or a Minkowski critical point. \subsubsection{The standard model} The $\Lambda$CDM model describe a FLRW flat Universe filled with a mixture of dust, in the form of Cold Dark Matter and baryons, radiation and a Cosmological Constant. As we will show later, there are observational evidences that justify the hypothesis of spatial flatness. The Hubble function is given by the first Friedmann equation: \begin{equation}\label{FriedLCDM} H(z) =\sqrt{ \Omega_K^0\left(1+z\right)^2 + \Omega_{m}^0\left(1+z\right)^3 + \Omega^0_{rad}\left(1+z\right)^4+\Omega_{\Lambda}^0} \; , \end{equation} \begin{figure}[h] \includegraphics[width=13cm]{Hubdiaz.pdf} \\[2mm]\caption{The Hubble diagram as function of redshift for the $\Lambda$CDM model }\label{HubblediagramLCDMz} \end{figure} where the $\Omega^0_i \;$ are the present day densities of the species $i$, and where $\Omega_m = \Omega_{CDM} + \Omega_{baryons}$ is the total matter. In Fig.~\ref{HubblediagramLCDMz} the Hubble function for the $\Lambda$CDM model is plotted as a function of the redshift $z = 1/a -1 $ for $\Omega_m^0 \approx 0.3$, $\Omega_r^0 \approx 10^{-5}$ and $\Omega_{\Lambda}\approx 0.7$. If we define the normalized energy density of a species $x$ as $\Omega_x = 8\pi G_N\rho_x \Omega^0_x/3H^2$, it is possible to rewrite the Friedmann equation in the form: \begin{equation} 1= \Omega_m + \Omega_r + \Omega_\Lambda \; . \end{equation} \begin{figure}[h] \includegraphics[width=15cm]{Sumrule.pdf} \caption{The evolution of the energy densities of the species in the $\Lambda$CDM model} \label{Sumrule} \end{figure} In Fig.~\ref{Sumrule} are plotted the normalized energy densities in terms of the e-fold time parameter $N=\log a$. It is straightforward to realize that the Universe evolution could be divided into different epochs, during which one species is dominant with respect to the others and determinate the rate of expansion. Since radiation dilutes the fastest it will be dominant at earlier times, followed then by matter and finally by the Cosmological Constant. In Fig.~\ref{xsilcdm} the logarithmic time derivative of the Hubble function is given in terms of $N$. For $N \leq -15$, in the radiation dominated epoch, $H \sim \sqrt{\rho_{rad}}$, so that $H'/H \approx -2$. Then radiation dilutes, and around $N\approx -10$ its density equals the matter one. When matter starts to dominate the Hubble factor behave as $\sqrt{\rho_m}$, so that $H'/H \approx -3/2$. Finally, around today, matter dilutes and its density equals the one of the Cosmological Constant, so that $H'/H$ tends asymptotically to $\rightarrow 0$ in the future. \begin{figure}[h] \includegraphics[width=13cm]{xsilcdm.pdf} \caption{The evolution of $\xi = H'/H$ in the $\Lambda$CDM model} \label{xsilcdm} \end{figure} \section{Observational facts in support of the $\Lambda$CDM model} \label{sec:related:sec3} \subsection*{Observational dataset} The most important cosmological probes that support the $\Lambda$CDM model are the Cosmic Microwawe Background (CMB), type Ia Supernovae observations, and Baryonic Acustic Oscillations (BAO). Combined, they favor a model of flat Universe $|\Omega_k^0| \leq 0.003 $ where the total matter density today $ \Omega_m^0 =\Omega_{DM}^0 + \Omega_{b}^0$ is of order $\Omega_m^0 \approx 0.3$ and the Cosmological Constant value contributes to roughly $\Omega_{\Lambda}^0\approx 0.7$, with the radiation energy density of order $\Omega_r^0 \approx 10^{-5}$ \cite{Aghanim:2018eyx, Abbott:2018wog,Scolnic:2017caz}. \subsection{Age of the Universe} In a FLRW background it is possible to compute the age of the Universe $t_0$ by integrating the Hubble function: \begin{equation}\label{ageofuniverse} t_0 = \int_0^\infty \frac{dz }{\left(1+z\right)H(z)} \; . \end{equation} It is straightforward to realize that the main contribution to the above integral comes from recent times, i.e. small redshift $z$. In this regime we can neglect the contribution of radiation, whose density is of order $10^{-5}$. Using the first Friedmann equation to eliminate $\Omega_m^0= 1- \Omega_\Lambda^0$ we compute the value of the integral in Eq.~\eqref{ageofuniverse} as function of the Cosmological Constant value $\Omega_\Lambda^0$. \begin{figure}[h] \includegraphics[width=13cm]{ageuniverse.pdf} \caption{The age of the Universe in unit of $H_0^{-1}$ for a flat FLRW Universe filled with matter and Cosmological Constant depending on the value of $\Omega_\Lambda^0$ } \label{ageuniverse} \end{figure}In Fig.~\ref{ageuniverse} the result of the integral assuming flatness is reported in units of $H_0^{-1}$, and one can appreciate that for small values of the Cosmological Constant, i.e. without Dark Energy, the Universe is younger, while in the opposite limit $\Omega_m^0\rightarrow 0$ the integral in Eq.~\eqref{ageofuniverse} diverges and the Universe is eternal, as expected for a de Sitter Universe which is free of initial singularity. Even if we do not know exactly the age of the Universe, we can constrain it from below with the age of the oldest object we observe in the sky. Of the utmost importance in this respect are the globular clusters, i.e. clusters of $10^5-10^7$ stars with a high density of around $10^3$ stars for $ly^{-3}$ that share the same age and the same chemical composition, usually found in the galactic halo. These stars are remnants of galaxy formation, and are among the oldest objects observed in the sky, see Ref.~\cite{Trenti:2015zja}. It is possible to infer their age by using spectroscopic mesurements, i.e. by studying their abundance of heavy elements. It is believed that in the early Universe there were mostly Hydrogen and Helium produced during the Big Bang Nucleosynthesis, as a result the stars that were produced at the time should lack heavy elements. The oldest globular clusters found are dated around 11 Gyr, which correspond roughly to $t_0 H_0 \sim 0.8$ in Fig.~\ref{ageuniverse}. These considerations already rule out a model of flat Universe which contains only matter, signaling the necessity for some form of DE. \subsection{Structure formation and DM} Incorporating $\Lambda$ in the total density $T_{00}$ in Eq.~\eqref{Feq1} we can write: \begin{equation} H^2 = \frac{8\pi G \rho_{tot}}{3} - \frac{K^2}{a^2} \; , \end{equation} and we can define the critical density: \begin{equation} \rho_{crit}= \frac{3H^2}{8\pi G} \;, \end{equation} which is the value of $\rho$ such that $K=0$. Observations indicate that the today total density $\rho_{tot}^0$ is of order: \begin{equation} \rho_{tot}^0= \frac{3H_0^2}{8\pi G} \sim \rho_{crit} \sim 10^{-29} g/cm^3 \;. \end{equation} This means that the Universe is spatially flat and that its average density is of around 10 protons per cubic meter. On the other hand the existence of baryonic compact objects, like us, indicates that the Universe contains highly nonlinear regions which are uniformly distributed according to the cosmological principle. Baryon's perturbations at recombination, around $z = 1100$, were proportional to the CMB fluctuations which are of order $10^{-4}$. By solving the perturbations equations for $\rho_b$ at linear order during the matter dominated epoch we know that matter overdensities grow linearly with the scale factor. This in turn imply that today, $z \sim 0$, these fluctuations should be of order $10^{-1}$ and thus still linear. We can conclude that if only baryonic matter is present, its perturbations from the recombination would not have been in time for growing non-linearly and form compact objects. On the other hand, if another matter species decoupled from photons prior to recombination soon enough, it would be able to catalyze baryonic structure formation. Thus Dark Matter is a crucial ingredient for structure formation. \subsection{Disc galaxies rotation curves} Spiral galaxies, like the one in which we locate ourselves, are common objects in the Universe. The distribution of luminous matter is peaked in the center and, using Newtonian arguments and assuming spherical symmetry, one expects that the centrifugal force is compensated by the gravitational attraction: \begin{equation} \frac{v^2}{r} = \frac{G M(r)}{r^2} \; . \end{equation} Since the mass contained within a radius $r$ is proportional to the volume $r^3$, the velocity of the stars in the galaxy drops down as we move to higher $r$ as $v \propto r$. On the other hand observations are not compatible with the above simple profile, see for example \cite{Navarro:1996gj}, and show instead that the velocity of stars in the outer arms of spiral galaxies approaches a constant value. This problem is known as the \textit{flatness of velocity curve of stars}, and can be explained by assuming a different distribution of matter from the visible one, thus invoking the presence of a “dark” matter species. \subsection{Type Ia supernovae observations} During the 1998 Riess \textit{et al.} \cite{Riess:1998cb} and Perlmutter \textit{et al.} \cite{Perlmutter:1998np} realized through type Ia Supernovae observations that the rate of expansion of the Universe is accelerating. Supernovae are extremely bright stellar explosions which occur in the last stages of a massive star evolution or during the nuclear fusion of a white dwarf. The brightness of these astronomical transient events is comparable with the one of an entire galaxy, and last for several weeks or months. The classification of Supernovae is made via spectroscopic measurements and depends on which absorption lines are present. If there is no Hydrogen line in the spectrum they are classified as type I supernovae, and type II otherwise. If they contain an absorption line of singly ionized silicon they are classified as Ia, whereas they are classified Ib if they contain Helium. Finally if they lack both Helium and Silicon they are classified Ic. Type Ia supernovae are of the utmost importance in cosmology because their absolute luminosity is roughly constant at the peak of brightness. They are formed in stellar binary systems containing a white dwarf that increases its mass by absorbing gases from the companion, eventually causing it to exceed the Chandrasekhar limit and triggering the explosion. For their properties the type Ia Supernovae are called standard candles, and observing them at various redshifts it is possible to reconstruct the cosmological evolution. Indeed, it is well-known that the apparent magnitudes of two sources $m_i$ are related with their apparent fluxes $\mathcal{F}_i$: \begin{equation} m_1 -m_2 = -\frac{5}{2}\log_{10}\left(\frac{\mathcal{F}_1}{\mathcal{F}_2}\right) \; . \end{equation} From the apparent flux of a source and its absolute luminosity $L_s$ it is possible to define the luminosity distance $d_L$: \begin{equation} d_L^2= \frac{L_s}{4\pi \mathcal{F}} \; , \end{equation} finally, the apparent and the absolute magnitude of a source $m$ and $M$ are related as: \begin{equation} m - M = 5\log_{10}\left(\frac{d_L}{10 pc}\right) \; , \end{equation} i.e. the absolute magnitude of a source is defined as the magnitude that it would have if observed at a distance of $10 \;$ pc. For type Ia supernovae $M$ is roughly constant and equal to $\sim -19$, so that the apparent magnitudes $m_1$ and $m_2$ of two of them can be related to their distances: \begin{equation} m_1 -m_2 = 5\log_{10}\left(\frac{d_{L_1}}{d_{L_2}}\right) \; . \end{equation} The theoretical prediction for the luminosity distance in a FLRW Universe is: \begin{equation} d_L(z) = \frac{c\left(1+z\right)}{H_0 \sqrt{\Omega_K^0}}\sinh{\left(\sqrt{\Omega_K^0}\int_{0}^{\infty}d\bar{z}\frac{ H(0)}{H(\bar{z})}\right)} \; , \end{equation} which for a flat Universe $K=0$ and small values of $z$ can be expanded at second order as: \begin{equation} d_L(z) \sim \frac{c}{H_0}\left[z + \left(1-\frac{H'(0)}{2H_0}\right)z^2 + .... \right] \; , \end{equation} and if radiation is negligible $\Omega_r \sim 0$ takes the simple form: \begin{equation} \label{lumdistlowz} d_L (z) = \frac{c}{H_0}\left[z + \frac{1}{4}\left(1-3\omega_{DE}\Omega_{DE}^0 \right)z^2\right] \; . \end{equation} From Eq.~\eqref{lumdistlowz} it is straightforward to realize that the presence of DE, remembering that $w_{DE} < 0$, pushes $d_L$ to higher values with respect to the case without it. \subsection{Cosmic microwave background observations} In the Big Bang paradigm the early Universe was filled with a dense plasma of baryons electrons and photons. Baryons and electrons, which have opposite charge, interact via Coulomb forces. Photons instead bounce between electrons via Thompson scattering. As the Universe expands its temperature drops, and electrons and baryons merge to produce hydrogen atoms in the so-called epoch of \textit{recombination}, around $z \sim 1100$. As a consequence, the density of free electrons falls and the Thompson scattering of the photons becomes inefficient. When this happens, the photons are able to escape the baryon plasma and to propagate freely until today, cooling down to a temperature of around $\sim 2.7$ Kelvin. This radiation is called Cosmic Microwave Background (CMB), and is one of the most precious sources of cosmological information. The CMB was predicted by Alpher and Gamow, see Ref.~\cite{1948PhRv...74..505G,Alpher:1948ve}, already in the late '40 and it has been detected for the first time by Penzias and Wilson in 1965 \cite{Penzias:1965wn}. While at the time they were able to detect only the background temperature, we are nowadays able to observe with great precision anisotropies in the CMB of order $\sim 10^{-5} K$ through satellite experiments like Planck \cite{Aghanim:2018eyx}. The temperature-temperature (TT) power spectrum of the CMB is usually studied in spherical harmonics and its modes are labeled with the harmonic number $\ell$. \begin{figure}[h] \includegraphics[width=13cm]{2015_TTSpectrum.png} \caption{The TT angular Power spectrum of the CMB as a function of the angular scale $\ell$ measured by Planck 2015 \cite{Ade:2015xua} with the residual errors. The solid line represent the theoretical prediction for the $\Lambda$CDM model and the dots the observed data. Picture taken from \href{https://www.cosmos.esa.int/web/planck/picture-gallery}{https://www.cosmos.esa.int/web/planck/picture-gallery}. } \label{CMBTT2015} \end{figure} In Fig.~\ref{CMBTT2015} is reported the CMB angular power spectrum for TT anisotropies, together with the theoretical prediction for the $\Lambda$CDM model. The position and the amplitude of the peaks of Fig.~\ref{CMBTT2015} strongly constrain the energy densities of the species in the $\Lambda$CDM model today. For example, the amount of total matter and the ratio of the densities can be extrapolated measuring position and amplitudes of the first three peaks. For a detailed description of the impact on the TT CMB power spectrum of the cosmological parameters see for example Refs.~\cite{Lesgourgues:2018ncw, Lesgourgues:2013qba}. \section{Open problems of the $\Lambda$CDM model } Even being the most accepted paradigm to describe the cosmological evolution of the Universe, the $\Lambda$CDM suffers because of some theoretical and observational issues which lack a satisfactory explanation. Moreover, even if not properly an issue, the fact that most of the energy density content of the Universe today is composed by dark species, which are undetected directly with laboratory experiments, is a strong motivation for research and studies beyond the $\Lambda$CDM model. \subsection{Troubles with the Cosmological Constant} The Cosmological Constant $\Lambda$ is the simplest natural candidate for Dark Energy. On the other hand, the phenomenological value required by the observations to produce the accelerated expansion is quite challenging to predict from the theoretical point of view. From a quantum field theory (QFT) perspective the behavior of the Cosmological Constant is at a phenomenological level equivalent to the expected behavior of vacuum quantum fluctuations. Unfortunately, the vacuum fluctuations of the fields described in the standard model of particle physics would result in a value for the Cosmological Constant which span from 123 to 55 orders of magnitude higher depending on the scenario considered. The above incompatibility is usually referred to as the \textit{Cosmological Constant Problem}, see for example Refs.~\cite{Weinberg:1988cp, Martin:2012bt, Padilla:2015aaa} for a detailed account of the problem. Another problem associated with the Cosmological Constant is the so called \textit{Coincidence Problem}, see for example Refs.~\cite{Piattella:2018hvi,Velten:2014nra}. The coincidence relies on the fact that the present day energy density of DE and DM are roughly of the same order. Such an occurrence, if not explained dynamically, would require an extremely severe fine-tuning in the initial condition of the Universe. Indeed, since the Cosmological Constant density is, of course, constant and the DM density dilutes as $\rho_m \sim a^{-3}$, in the early stage of the evolution of the Universe, say the Planck scale for which $a \sim 10^{-32}$, the ratio $\rho_\Lambda/\rho_{m}$ would be of order $\sim 10^{-96}$. This means that the initial condition for the Universe should be set with the astonishing precision of 96 digits; a one digit difference would result today in a factor 10 difference on the respective energy densities, well outside the parameter space allowed by observations. \subsection{Troubles with CDM} It turns out from numerical simulations of structure formation that on small scales, around $\sim 1 kpc$, and for mass scales smaller than $M \leq 10^{11}M_\odot$, CDM is not completely satisfactory. For a review on the topic, see for example Ref.~\cite{Bullock:2017xww}. One of the problems that arise in this framework is known as the \textit{cusp/core} problem. Numerical simulations of the $\Lambda$CDM shows that DM halos should present a steep growth of the density profile at small radius, of order $\rho_{Halo}(r) \sim r^{\gamma}$, with $0.8\leq \gamma \leq 1.4$. On the other hand several observations of small galaxies with well measured rotation curves prefer $0 \leq \gamma \leq 0.5$, showing that pure $\Lambda$CDM simulations are too \textit{cuspy} compared to the observations. Another issue with CDM which appeared in the late 90' is the \textit{Missing satellites problem}. Simulations show that DM clumps should exist in a broad range of masses and should results in thousands of satellite objects with mass $M \leq 300 M_\odot$ trapped in those clumps. On the other hand, at the time, only a bunch of these satellites were observed. The problem persisted for roughly two decades, but it seems that nowadays, with the improvement of the observations and of the numerical simulations, the missing satellites problem had been turned inside out. Indeed, in the last years astronomers found thousands of low mass objects, which could be too many compared to those predicted by the simulations, see for example Ref.~\cite{Kim:2017iwr}. Finally, a third known issue of the CDM paradigm is the \textit{Too big to fail} problem. From observations, it seems that galaxies fail to form in the most massive subhalos, while at the same time satellites of lower mass form in less dense subhalos. This appears to be a contradiction, since most massive satellites should be too big to fail to form in most dense halos while smaller satellites do so in the lighter ones. \subsection{The flat Universe conspiracy} By looking at the angular spectrum of CMB alone it seems that a model of Universe with a slightly negative curvature is preferred with respect to a flat one. The situation changes if we also include priors from CMB lensing and BAO, which carry information about $H_0$ and $\Omega_m$. The constraints on the curvature density from Planck 2018 \cite{Aghanim:2018eyx} are reported in Fig.~\ref{Okplank} \begin{figure}[h] \begin{center} \includegraphics[width=10cm]{Planck_omegak.png} \caption{Constraints on a non-flat Universe from CMB angular power spectrum (dashed line), CMB + lensing (solid green), and CMB + lensing + BAO (purple region). Picture taken from \cite{Aghanim:2018eyx} } \label{Okplank} \end{center} \end{figure} If we assume that BAO, CMB lensing and CMB polarization data should not be combined, there is indeed space left for curvature being non-vanishing from Planck 2018 data, see also Ref.~\cite{Handley:2019tkm}. The impact of such a point of view on the cosmological standard model was considered by the authors of Ref.~\cite{DiValentino:2019qzk}, which claims that our current understanding of the Universe could be biased and that would imply a possible crisis for cosmology. As discussed by the authors, the tendency towards a closed Universe could just be a signal of systematic, but is stronger in Planck 2018 than in Planck 2015 \cite{Ade:2015xua}, and could indicate a strong disagreement between CMB power spectrum and BAO measurements. However, it must be noted that there is a strong degeneracy in the CMB power spectrum between the curvature $\Omega_K$ and the lensing amplitude $A_{lens}$. If the Universe is closed, data favor a higher amount of Dark Matter, which in turn enhance the lensing effect allowing for a better fit to the data at lower multipole. Whether there is a conspiracy for a flat Universe or not, the results of \cite{DiValentino:2019qzk} show the kind of dangers hidden behind the corner in the era of high precision cosmology. \subsection{Cosmological tensions on $H_0$ and $\sigma_8$} The history of cosmology is strongly entangled with the history of one of its parameters, the value of the Hubble factor today. Indeed, while the first measurement of $H_0$ by Hubble buried the philosophical preconceptions about a static Universe, its measure today possibly uncovers and targets the Achilles heel of the $\Lambda$CDM model. We can classify brutally most of the sources of cosmological information in two groups, i.e. measurements of early and Late-times Universe. With Late-times Universe sources we refer to those measurements performed at low redshift, like for example type Ia supernovae or strong lensing time delays. With early time Universe measurements we refer mostly to CMB and BAO observations. State of the art experiments seem to indicate that measurements of $H_0$ from late and early Universe are in disagreement and this tension is estimated to be significantly above $4 \sigma$ \cite{Bernal:2016gxb,Verde:2019ivm,Martinelli:2019krf}. In Fig.~\ref{H0tension}, taken from \cite{Verde:2019ivm}, measurements of $H_0$ from different experiments and their combined results are reported, and the tensions quantified. \begin{figure}[h] \begin{center} \includegraphics[width=10cm]{H0_vivien.png} \caption{The tension on the value of $H_0$ arising from late and early time measurements. Figure taken from \cite{Verde:2019ivm}. } \label{H0tension} \end{center} \end{figure} Another cosmological parameter suffers from the same kind of issue, the $\sigma_8$ parameter. It refers to fluctuations of the matter density on scales of $8 h^{-1} Mpc$: \begin{equation} \sigma_8^2 = \int_0^\infty \frac{dk}{k} \left[\frac{3j_1(8k)}{8k} \right]^2 \Delta^2(k) \; , \end{equation} where $j_1=sin(x)/x -cos(x)$ is proportional the first order spherical Bessel function and $\Delta^2(k)$ is the dimensionless matter power spectrum $\Delta^2 =k^3 \mathcal{P}_m (k)/2\pi^2$. It seems to be difficult to solve both the $\sigma_8$ and the $H_0$ tensions within the same framework. One of the reasons is that a higher value of $H_0$ could be obtained with new physics that reduces the size of the sound horizon $r_s$ with early time modifications, whilst in order to tackle the $\sigma_8$ tension one needs to suppress the linear power spectrum of matter at Late-times or decrease $\Omega_m$. These modifications usually point towards opposite directions, making it difficult to relieve both tensions within the same framework. Several modifications of gravity were proposed in order to alleviate the tensions, see for example Refs.~\cite{DiValentino:2017oaw} and \cite{Sola:2018sjf} where interactions between DM and neutrinos and dynamical DE were considered, or Ref.~\cite{Barros:2018efl} where a scalar quintessence field couples to DM, reducing its amount and clustering at Late-times thus alleviating the $\sigma_8$ tension. A promising new approach to the problem emerged in recent years, which tackles the tensions by employing the machinery of DE models proposed to explain the accelerated expansion of the Universe together with a Cosmological Constant $\Lambda$. This was done for example in \cite{Sola:2019jek} and \cite{Sola:2020lba} for the Brans-Dicke model, fitting the data better than $\Lambda$CDM. \subsection{Conclusion} An Occam's razor logic makes the $\Lambda$CDM model the most successful description of the Universe as we know it. At the cost of six parameters we are able to explain a plethorae of observations coming from a very broad landscape of physic ranging from astrophysical to cosmological scales. However, out of these 6 parameters, two are so obscure that we need to label them as \textit{dark}, and the situation is even worse when we realize that the darkness fills roughly the 95\% of the Universe. Moreover, beyond the challenging nature of DM and DE, in the past few years state of the art observations disclose a Pandora's box of inconsistencies of the $\Lambda$CDM model which cosmologists are now forced to deal with, above all the cosmological tensions on $H_0$ and $\sigma_8$. With our current understanding of the Universe under siege, it is of the utmost importance to look with fresh eyes and open mind to alternatives of the $\Lambda$CDM model. An army of scientists grouped in surveys is currently working on new experiments and exploring the consequences of different models. Maybe in 20 years from now they will still rely on a Cosmological Constant and Cold Dark Matter to describe the evolution of the Universe, or maybe they will have the luck of witnessing the appearance of new physics. Whether this is the case or not, these are exciting times to live for cosmologists. \chapter{Personal Contribution: \\ Strong Lensing for testing Gravity and Cosmology} \label{chapter:Lensing} \epigraph{\textit{Simplicity is the touchstone in finding new physical laws… If it's elegant, then it's a rough rule of thumb: you're on the right track}}{Kip Thorne} Lensing effects provide fertile ground for testing gravitational theories from more than a century. In particular, it is well known that weak gravitational lensing by Large Scale Structures can provide useful insights on the nature of Dark Energy. In this chapter we will discuss instead the potential of strong gravitational lensing in achieving a similar task. After a brief review of the main equations governing this phenomenon, we will introduce two novel drift effects proposed by us in Ref.~\cite{Piattella:2017uat}, and discuss the possibility of using them for testing violations of the Equivalence Principle and Dark Energy models~\cite{Giani:2020fpz}. \section{Overview of Gravitational Lensing} It is a well known results of geometrical optics that light rays passing through a medium will generally be refracted, as encoded in the Snell's law. Considering the gravitational field in the empty space around its source as a sort of "medium", it is a reasonable expectation that light rays traveling through it will be deflected. It is slightly uncomfortable to give a meaningful explanation of this effect within Newtonian gravity because photons have no rest mass, and thus should be blind to the gravitational interaction. On the other hand, it is a standard approach to study the motion of bodies in a gravitational potential by mean of test particles, i.e. particles whose mass is small enough to ignore their backreaction on the gravitational potential. Thus, considering photons as test particles we expect already in Newtonian gravity the deflection of light rays close to a massive body. This result was indeed obtained by Soldner\footnote{A translation from german of the original article is available \href{https://en.wikisource.org/wiki/Translation:On_the_Deflection_of_a_Light_Ray_from_its_Rectilinear_Motion}{here}} more than one century before Einstein's theory of general relativity. In GR, instead, the interpretation of the gravitational potential in the empty space as a sort of medium is straightforward, and is logical to conclude that trajectories of massless particles will in general be bent because of the curvature's gradient of the spacetime. An effective treatment of the above phenomenon resembles the standard approach of geometrical optics. The source of the gravitational field that deflects light rays is then called \textit{lens}, and the overall effect \textit{gravitational lensing}. We distinguish between the deflection caused by an extended, approximately continuous distribution of sources and the one caused by a single, massive object. The former is which is generally dubbed \textit{weak lensing}, and causes distortions on the shape of the background objects, see Ref.~\cite{Bartelmann:2016dvf} for a review of weak lensing and its cosmological applications. When the lens is instead composed by a single massive object along the line of sight between the observer and the source we are instead in a regime of \textit{Strong Lensing}, which will be our main subject during the rest of this chapter. \subsection{Strong Lensing by a point mass} To begin with, let us consider gravitational lensing by point masses. A fairly standard configuration is given in Fig.~\ref{lensingscheme}, where $\theta_0$ is the apparent angular position of the source as seen by the observer, and $\theta_S$ indicate the actual position of the source that would be observed in case of no lensing. The above quantities are related by the lens equation in the thin lens approximation~\cite{Weinberg:2008zzc}: \begin{equation}\label{LEPM} \theta_E^2\equiv \theta_0\left(\theta_0 - \theta_S\right) = \frac{4G_N M}{\mathcal{D}_L }\frac{\mathcal{D}_{LS}}{\mathcal{D}_S} =4G_N M\left(1+z_L\right)\left(\frac{1}{\chi_L} - \frac{1}{\chi_S}\right) \; , \end{equation} where the $\mathcal{D}$'s are the angular diameter distances: \begin{equation}\label{dS} \mathcal{D}_i \equiv a_i\chi_i = \frac{1}{1 + z_i}\int_0^{z_i}\frac{dz'}{H(z')}\;, \end{equation} in which the subscript $i = L,S$ refers to the lens or to the source, while $\mathcal{D}_{LS}$ is given by: \begin{equation}\label{dLS} \mathcal{D}_{LS} \equiv a_S(\chi_S - \chi_L) = \frac{1}{1 + z_S}\int_{z_L}^{z_S}\frac{dz'}{H(z')}\;. \end{equation} In the above equations $z_{L,S}$ indicates the redshifts and $\chi_{L,S}$ the comoving distances of the lens and the source respectively. Using the above definitions it is possible to rewrite the lensing equation as: \begin{equation} \theta{E}^2 = 4G_N M\left(1+z_L\right)\left(\frac{1}{\chi_L} - \frac{1}{\chi_S}\right) \; . \end{equation} Being quadratic in $\theta_0$, the lens equation \eqref{LEPM} has the following two roots: \begin{equation} \theta_0 = \frac{\theta_S}{2} \pm \sqrt{\frac{\theta_S^2}{4} + \theta_E^2}\;, \end{equation} which implies that, because of the lens, the original image of the source is split into two. Notice that $\theta_S$ is time-independent because of the cosmological principle. In other words, observer, lens and source form a triangle whose sides increase due to the Hubble flow, but whose angles remain unchanged, and therefore $d\theta_S/dt_0 = 0$. \begin{figure}[tb] \centering \includegraphics[width=10cm]{Lensing_Scheme.pdf} \caption{Scheme for strong gravitational lensing induced by a point mass lens \textbf{L}. $\theta_0$ is the apparent angle at which the source is located, $\theta_S$ the true one. The deflection angle is $\delta = 4GM/b$, where $b$ is the impact parameter, i.e. the distance on the lens plane between the incoming light ray and the lens itself. Image taken from Ref.~\cite{Piattella:2017uat}} \label{lensingscheme} \end{figure} \subsection{Strong Lensing for an extended Lens } In the thin lens approximation the lens equation \eqref{LEPM} for a general mass distribution is : \begin{equation}\label{LE} \left(\bm{\beta}- \bm{\alpha} \right) = \nabla_{\bm{\theta}}\psi\left(\bm{\beta}\right) \; , \end{equation} where $\bm{\beta} = (\beta_1,\beta_2)$ and $\bm{\alpha} = (\alpha_1,\alpha_2)$ are the position in the sky of the image and the source respectively, and $\nabla_{\theta}$ is the two-dimensional angular gradient.\footnote{From now on we will restrict the use of the $\theta_i$ notation for point mass lenses, while the $\alpha$ and $\beta$ notation for a general lens profile} The quantity $\psi(\bm{\beta})$ appearing in Eq.~\eqref{LE} is the \textit{lensing potential} and is defined as: \begin{equation}\label{LP} \psi(\bm{\beta}) \equiv \frac{2}{c^2 }\frac{\mathcal{D}_{LS}}{\mathcal{D}_L\mathcal{D}_S}\int_{\bm{\beta}} d\lambda \; \Phi \; , \end{equation} where $\Phi$ is the standard Newtonian gravitational potential and the integral is taken along the path of the light ray, which depends on $\bm{\beta}$ and is parametrized by $\lambda$. Taking the divergence of Eq.~\eqref{LE}, as long as the extent of the lens is small compared to cosmological distances, we can use the Poisson equation to relate the Laplacian of the lensing potential to the mass distribution of the lens: \begin{equation}\label{LapPsi} \nabla^2_{\bm{\theta}}\psi\left(\bm{\beta}\right) = \frac{8\pi G_N}{c^2}\frac{\mathcal{D}_L\mathcal{D}_{LS}}{\mathcal{D}_S} \Sigma(\bm{\beta}) \; , \end{equation} where we have defined the surface mass density: \begin{equation}\label{SMD} \Sigma (\bm{\beta}) \equiv \int_{\bm{\beta}} d\lambda \;\rho \;, \end{equation} in which appears the mass distribution of the lens $\rho$. For a detailed derivation and an explanation on the assumptions behind Eqs.~\eqref{LE}, \eqref{LP}, \eqref{LapPsi} see for example Ref.~\cite{Bartelmann:2016dvf}. \section{Strong Lensing observables and Cosmology} As we saw in the previous section, in a strongly lensed system are present several images of the same source. Thus, of course, a first important observable is the angular separation between the various images. The entity of this variation is typically of the order of few arcseconds. For example, using data from Ref.~\cite{2004mmu..symp..117K}, the quasar QSO0957 + 561 at redshift $z_S= 1.41$ lensed by a cluster at $z_L = 0.31$ displays two images separated by 6.1''. On the other hand, even if coming from the same source, these several images at a given moment of time are not necessarily identical. Indeed, the optical path of the photons of each image is in general different, and thus some of the photons will require more time to reach the observer. This effect is called \textit{Time Delay}, which we indicate with $\Delta$, and could be divided into two different contributions~\cite{Weinberg:2008zzc}: \begin{equation} \Delta = \Delta_{geo} + \Delta_{pot} \; , \end{equation} where $\Delta_{geo}$ is the geometrical Time Delay and $\Delta_{pot}$ is the potential Time Delay. The former is due to the bending of the trajectory of the photon, whereas the latter is due to the motion into the lens gravitational field. For a single image the geometric $\Delta t_{geo}$ induced by a point mass lens is given by: \begin{equation} \Delta t_{ geo} = \frac{(1 + z_L)^2(4GM)^2}{2\theta_0^2}\left(\frac{1}{\chi_L} - \frac{1}{\chi_S}\right)\;, \end{equation} from which we obtain $\Delta_{geo} = \Delta t_{geo}(\theta_+) - \Delta t_{geo}(\theta_-)$, where $\theta_{\pm}$ are the two roots of Eq. \eqref{LEPM}. The potential Time Delay between the two images due to a point mass in the thin lens approximation is given by: \begin{equation} \Delta_{pot} = \Delta t_{pot}(\theta_+) - \Delta t_{pot}(\theta_-) = 2GM(1 + z_L)\ln\frac{\theta_-}{\theta_+} \; . \end{equation} For an extended lens profile the Time Delay between two images $\Delta_{ij}$ is given by, see Ref.~\cite{Suyu:2012aa} : \begin{equation}\label{TD} \Delta_{ij} = \frac{D_{\Delta_t}}{c}\left( \frac{\left(\bm{\beta}_i - \bm{\alpha}\right)^2}{2} - \frac{\left(\bm{\beta_j} - \bm{\alpha}\right)^2}{2} + \psi\left(\bm{\beta_j}\right) - \psi\left(\bm{\beta_i}\right)\right)\; , \end{equation} where it was defined the Time Delay distance: \begin{equation}\label{timedelaydistance} D_{\Delta_t} \equiv \left(1+ z_L\right)\frac{\mathcal{D}_L \mathcal{D}_S}{\mathcal{D}_{LS}} \; . \end{equation} It is straighforward to separate in the right hand side of Eq.~\eqref{TD} the contributions from the geometrical and the potential Time Delay. Indeed, the first two terms inside the brackets are given by the differences between the apparent and the true position of the source, and are thus of geometrical nature. The potential Time Delay is instead given by the difference between the lensing potential at the two apparent positions. From Eq.~\eqref{TD} we can already understand the importance of precise Time Delay measurements for cosmological implications. Indeed, if one is able to know the position of the source $\bm{\alpha}$, measures with enough precision the position of the images $\bm{\beta}_i$, and is able to infer the position of the lens and its lensing potential, all the cosmological information is contained in the Time Delay distance~\eqref{timedelaydistance} through the angular diameter distances~\eqref{dS}. Thus, from Time Delay measurements (if a reliable description of the lensing profile is given), one is able to reconstruct the Hubble factor without assuming any particular cosmological model. This is precisely the goal of the H0LiCOW collaboration \footnote{\href{https://shsuyu.github.io/H0LiCOW/site/index.html}{https://shsuyu.github.io/H0LiCOW/site/index.html}}, which within the COSMOGRAIL \footnote{\href{http://www.cosmograil.org}{http://www.cosmograil.org}} program employed Time Delays measurements collected over the last decade to constrain the value of the cosmological parameter $H_0$ to a few percents level~\cite{Suyu:2016qxx,Wong:2019kwg,Bonvin:2016crt}, with competitive precision with respect to other cosmological probes. Moreover, Time Delay measurements can also be used to put constraints on the Post-Newtonian parameter $\gamma_{PPN}$, as discussed in Refs.~\cite{Collett:2018gpf,Yu:2018slt,Jyoti:2019pez,Yang:2020eoh}. Furthermore, with optimistic assumptions on the surveys, in the next years the precision of observations will be enough to provide a smoking gun for Dark Energy~\cite{Shiralilou:2019div}. In the next sections we will discuss two new observables proposed by us in Ref.~\cite{Piattella:2017uat}: the \textit{Time Delay drift} and the \textit{angular drift}, which could be used to reconstruct $H(z)$ and also to constrain violations of the Equivalence Principle \cite{Giani:2020fpz}. \section{Redshift drift of Gravitational Lensing} The redshift drift is the time variation of the redshift of a source due to the Hubble flow, see Ref.~\cite{Weinberg:2008zzc}. In an expanding universe described by the FLRW metric, one straightforwardly obtains the result that a photon is redshifted, and the redshift is given in terms of the scale factor as follows: \begin{equation} 1 + z = \frac{a_0}{a_e}\;, \end{equation} where $a_0$ is the scale factor evaluated at present time (which is the time of observation) and $a_e$ is the scale factor evaluated at the emission time. The derivative of the redshift with respect to the observation time $t_0$ is the following: \begin{equation}\label{reddriftformula} \frac{dz}{dt_0} = \frac{1}{a_e}\frac{da_0}{dt_0} - \frac{a_0}{a_e^2}\frac{da_e}{dt_0} = \frac{1}{a_e}\frac{da_0}{dt_0} - \frac{a_0}{a_e^2}\frac{da_e}{dt_e}\frac{dt_e}{dt_0}\;. \end{equation} It is not difficult to show that: \begin{equation} \frac{dt_e}{dt_0} = \frac{a_e}{a_0}\;, \end{equation} and therefore, the redshift drift formula \eqref{reddriftformula} becomes: \begin{equation}\label{reddriftformula2} \frac{dz}{dt_0} = \frac{1}{a_e}\frac{da_0}{dt_0} - \frac{1}{a_e}\frac{da_e}{dt_e} = (1 + z)H_0 - H(z)\;, \end{equation} where the Hubble constant $H_0$ and the Hubble parameter $H(z)$ have appeared, so that measuring $dz/dt_0$ would allow to study the evolution of the Hubble factor. Since the lens equation contains the angular diameter distances, we realize in Ref.~\cite{Piattella:2017uat} that the apparent positions of the source will acquire a time dependence due to the Hubble flow. Thus, applying Eq.~\eqref{reddriftformula2} to the lens equation we predict the following \textit{angular drift} and the \textit{Time Delay drift} for a point mass: \begin{equation}\label{ADTDD} 2\frac{\dot{\theta}_E}{\theta} = H_0 - \frac{H(z_L)}{1+z_L} \; , \qquad \frac{\dot{\Delta}}{\Delta} = K\left(H_0 - \frac{H(z_L)}{1+z_L}\right) \; , \end{equation} where a dot indicates derivation with respect to the observer time $\dot{} = d/dt_0$, and $K$ is a factor of order unity given by: \begin{equation} K = \frac{ \ln\frac{-\theta_-}{\theta_+} + \frac{\theta_- + \theta_+}{\theta_- - \theta_+}}{ \ln\frac{-\theta_-}{\theta_+} + \frac{\theta_+^2 - \theta_-^2 }{\theta_+\theta_-}} \; . \end{equation} The above equations tell us that the entity of these drifts is of order $H_0$. Since $H_0 \sim 10^{-18}$ s$^{-1}$, we conclude that the angular drift is of order of $10^{-10}$ arc seconds per year, which with the current precision of observation, $\sim 0.1$ arcseconds, would require $\sim 10^{9}$ yr to be detected. The Time Delay drift is instad of order $\sim 10^{-3}$ arc seconds per year, which would require $10^{8}$ years to accumulate a drift detectable by current experiments, with sensitivity of order of days. \section{Test of the Equivalence Principle using Strong Lensing Time Delay} As we saw in the previous section, drift effects from Strong Lensing in GR are too small to be detected with current experiments, being of order $\sim H_0$. On the other hand, the situation could change if we move to different theories of gravity, where the presence of a modified Poisson equation will change the time dependence of the lensing potential. From the phenomenological point of view, many alternative theories of gravity modify the strength of the gravitational interaction by inducing an effective gravitational coupling $G_{eff}$, replacing the Newton constant. For example, we already saw that in VAAS gravity the time dependence of $G_{eff}$ is given by Eq.~\eqref{geffvaas}. In $f(R)$ theories of gravity instead we have $G_{eff} \sim 4G_N/3f_R $, so that $G_{eff}$ acquires a time dependence from the term $(df/dt) \dot{R}^{-1}$. However, in the expression for the deflection angle, we have a degeneracy between the mass of the lens and the gravitational coupling $G$.\footnote{From now on we will drop the subscript on $G_{eff}$ to unburden the notation.} Thus, it would not be possible in principle to distinguish between a stronger coupling or a heavier mass. On the other hand, the situation is different if we consider drift effects. In Ref.~\cite{Giani:2020fpz} we studied the changes induced on the Time Delay drift by a time dependent $G$, and analyzed for illustrative purposes the entity of the constraints on $\dot{G}/G$ which can be extrapolated with the precision of current experiments. For the case of a point mass, Eqs.~\eqref{ADTDD} become: \begin{equation} \label{ADPMG} 2\frac{\dot{\theta}_E}{\theta_E} = H_0 - \frac{H(z_L)}{1+z_L} +\frac{\dot{G}}{G} \; , \end{equation} \begin{equation} \label{TDDPMG} \frac{\dot{\Delta}}{\Delta} = K\left(H_0 - \frac{H(z_L)}{1+z_L} +\frac{\dot{G}}{G}\right)\; , \end{equation} where it is understood that $G$ is the gravitational coupling at the redshift of the lens. The above equations show explicitly that drift effects in the context of Strong Lensing, contrary to what happens with spectroscopic measurements, are sensitive to variations of the gravitational coupling. Since a signal of order $H_0 - H_L/(1+z_L)$, assuming a realistic cosmological evolution, is beyond the sensitivity of current observations, we can convert the bounds on the drifts in upper bounds on the variation of $G$. Since Time Delay measurements are generally more precise than angular ones we need to obtain an expression for the time derivative of Eq.~\eqref{TD} for an extended lens profile. \subsection*{Time Delay drift for extended lenses} To begin with let us compute the time derivative of the lensing potential: \begin{equation} \dot{\psi}(\bm{\beta})= \frac{2}{c^2 }\frac{\mathcal{D}_{LS}}{\mathcal{D}_L\mathcal{D}_S}\left( \frac{1}{\left(1+z_L\right)}\frac{d z_L}{dt}\int_{\bm{\beta}} d\lambda \; \Phi + \frac{d}{dt}\left(\int_{\bm{\beta}} d\lambda \; \Phi \right)\right) \; . \end{equation} The time dependence of the second term in the right hand side of the latter equation comes from the change in time of the light ray path due to a variation of $\bm{\beta}$ and from the Newtonian potential. The former is difficult to compute exactly because it is in general difficult to describe precisely the curve identified by the light ray path. On the other hand, it is reasonable to assume that the induced variation of the curve is small and does not contribute to the support of the integral in Eq.~\eqref{LP}. In particular, this is true if we evaluate the above integral within the Born approximation, i.e. along the unperturbed light path, as it is customary in Strong Lensing applications where $\Phi/c^2 \ll 1$~\cite{Bartelmann:2016dvf}. Within this assumption we can interchange the operation of integration and time differentiation obtaining: \begin{equation} \dot{\psi}(\bm{\beta}) = \psi(\bm{\beta})\left(H_0 - \frac{H(z_L)}{1+z_L}\right) + \psi(\bm{\beta})\frac{\int_{\bm{\beta}} d\lambda \; \dot{\Phi}}{\int_{\bm{\beta}} d\lambda\; \Phi} \; . \end{equation} The above equation can be further simplified if we consider a static distribution of matter. Indeed, in this case the only time dependence of the Newtonian potential is through the effective gravitational coupling $G$, so that we have: \begin{equation}\label{TDTDSD} \dot{\psi}(\bm{\beta}) = \psi(\bm{\beta})\left(\frac{\dot{G}}{G} + H_0 - \frac{H(z_L)}{1+z_L}\right) \; . \end{equation} In concrete Time Delay measurements we have to take into account corrections due to the presence of mass distributed along the line of sight. This is done by introducing a parameter called \textit{external convergence}, $\kappa_{ext}$, and defining the \textit{real} Time Delay distance as: \begin{equation} D_{\Delta t}^{real} \equiv\frac{D_{\Delta t}}{1 - \kappa_{ext}} \; , \end{equation} see for example Ref.~\cite{Suyu:2012aa}. If we assume that the external convergence has a time dependence this would be inherited by the Time Delay distance~\eqref{timedelaydistance}. Combining the latter and Eq.~\eqref{TDTDSD} we can finally write down the Time Delay drift for an extended lens with a static distribution of mass: \begin{equation}\label{TDDk} \frac{\dot{\Delta}_{ij}}{\Delta_{ij}} = \left(\frac{\dot{G}}{G} + H_0 - \frac{H(z_L)}{1+z_L} \right)\left[1 + \frac{D_{\Delta t}\left(\bm{\beta}_i - \bm{\alpha}\right)^2}{2c \Delta_{ij}} - \frac{D_{\Delta t}\left(\bm{\beta_j} - \bm{\alpha}\right)^2}{2c \Delta_{ij}}\right] -\frac{\dot{\kappa}_{ext}}{1-\kappa_{ext}} \; . \end{equation} \subsection*{Estimating the variation of the Time Delay from current data} We now illustrate how the data can put constraints on the variation of the Time Delay. To this end, we use the package PyCS3 from the COSMOGRAIL program \footnote{Available \href{http://cosmograil.org/}{here}.}, see Refs.~\cite{Tewes:2012gs,Bonvin:2015jia}. The data used are the simulated light curves used in \cite{Bonvin:2015jia}, produced in the context of the blind Time Delay measurement competition named Time Delay Challenge 1 (TDC1)~\cite{Dobler:2013rda}, and from the quasar DES J0408-5354~\cite{Courbin:2017yvz}. We split the total time of observations in two equal time periods. Each period consists of 658 days for the trial curves, and of 93 days for DES J0408-5354. The Time Delay between each image is then calculated for each period. The Time Delay estimates are shown in App.~\ref{AppendixD} and summarized in Table \ref{tabletimedelay}. From it we can readily estimate the relative variation \eqref{TDDk} as: \begin{equation} \frac{\dot{\Delta}_{ij}}{\Delta_{ij}}= \frac{\Delta_{ij}\left(t + \delta t\right) - \Delta_{ij}(t)}{\delta t \Delta_{ij}(t)} = \frac{\Delta_{ij}^{I+II} - \Delta_{ij}^{I}}{\Delta_{ij}^{I} \delta t} \; , \end{equation} We display the results in Table \ref{tableredshiftdrift}. \begin{table} \centering \begin{tabular}{c||c|c|c|c|c|c} & $\Delta_{AB}$ & $\Delta_{AC}$ & $\Delta_{AD}$ & $\Delta_{BC}$ & $\Delta_{BD}$ & $\Delta_{CD}$ \\ \hline Trial I & $-4.9^{+4.3}_{-5.5}$ & $-18.0^{+6.0}_{-8.0}$ & $-0.7^{+9.6}_{-10.3}$ & $-13.5^{+7.6}_{-7.6}$ & $+4.3^{+9.8}_{-11.5}$ & $+17.5^{+10.7}_{-12.1}$ \\ Trial I+II & $-4.5^{+2.4}_{-2.0}$ & $-21.3^{+1.4}_{-1.7}$ & $-29.9^{+9.2}_{-7.0}$ & $-16.6^{+1.8}_{-3.4}$ & $-25.2^{+7.5}_{-6.4}$ & $-8.2^{+8.3}_{-6.7}$ \\ \hline DES 0408 WFI I & $-106.5^{+15.9}_{-14.1}$ & $-110.6^{+50.4}_{-21.7}$ & $-142.2^{+34.3}_{-18.3}$ & $-2.4^{+38.8}_{-19.9}$ & $-37.1^{+25.7}_{-16.2}$ & $-31.7^{+19.8}_{-30.3}$ \\ DES 0408 WFI I+II & $-112.6^{+6.6}_{-2.2}$ & $-117.2^{+5.9}_{-7.6}$ & $-153.2^{+11.9}_{-9.5}$ & $-7.1^{+8.6}_{-8.6}$ & $-40.5^{+11.3}_{-9.3}$ & $-35.6^{+14.1}_{-10.7}$ \end{tabular} \caption{Time Delay $\Delta$ between four images from a simulated quasar and the DES J0408-5354 quasar \cite{Courbin:2017yvz}. Each image is labeled from $A$ to $D$. The numbers I and I+II indicate that $\Delta$ was measured over the first half of the period of observations, or over the whole period, respectively. All values are given in days.} \label{tabletimedelay} \end{table} \begin{table} \centering \begin{tabular}{c||c|c|c|c|c|c} &$|\dot{\Delta}/\Delta|_{AB}$ & $|\dot{\Delta}/\Delta|_{AC}$ & $|\dot{\Delta}/\Delta|_{AD}$& $|\dot{\Delta}/\Delta|_{BC}$& $|\dot{\Delta}/\Delta|_{BD}$ & $|\dot{\Delta}/\Delta|_{CD}$\\ \hline Trial ($\times 10^{-5}$) & X & $27.9 \pm 12.6$ & X & $34.9 \pm 20.9 $ & X & X \\ \hline DES 0408 WFI ($\times 10^{-5}$) & $61.6 \pm 9.9$ & $64.2 \pm 29.6$ & $83.2 \pm 21.1$ & X & $98.5 \pm 73.6$ & X \end{tabular} \caption{Estimated absolute Time Delay variation for the simulated quasar and DES J0408-5354. All values are given in $day^{-1}$. The X's represent values with uncertainty bigger than the central value, and are thus omitted.} \label{tableredshiftdrift} \end{table} \subsection*{Estimated constraint on $\dot{G}/G$} Through Eq.~\eqref{TDDk} it is possible to relate constraints on the relative time variation of $\Delta_{ij}$ to upper bounds on the variation of $\dot{G}/G$. The external convergence time dependence is difficult to evaluate. We expect it to depend explicitly on $\dot{G}/G$, similarly to the potential generated by the lens, with the two contributions having the same sign, but we will assume that it is negligible with respect to the precision of current observations. We want to stress however, as we discussed in the previous sections, that it is in principle possible to disentangle such contribution by considering differences of Time Delays drifts of multiple images. As we already saw the drift due to the Hubble flow is of order of $H_0 \sim 10^{-18}$ s$^{-1}$, so we will neglect it as well. Another effect that could be of relevance is the time variation of the Time Delay due to the peculiar velocity of the lens galaxy and its transverse motion. On the other hand, according to Refs.~\cite{Zitrin:2018let,Wucknitz:2020spz}, this contribution is estimated to be of the order of a few seconds per year, so that the effect, even though it is bigger than the cosmological one due to the Hubble flow, is still not appreciable with current precision. Under these assumptions, and roughly estimating the term inside the square bracket of Eq.~\eqref{TDDk} to be of order 1, the values of Table \ref{tableredshiftdrift} can be directly converted into upper bounds on the time variation of the effective gravitational coupling. The results are reported in Table \ref{tableGconst}. \begin{table} \centering \begin{tabular}{c||c|c|c|c|c|c} &$|\dot{G}/G|_{AB}$& $|\dot{G}/G|_{AC} $& $|\dot{G}/G|_{AD} $& $|\dot{G}/G|_{BC} $& $|\dot{G}/G|_{BD} $& $|\dot{G}/G|_{CD} $\\ \hline Trial ($\times 10^{-1}$) & X & $1.0 \pm 0.5$ & X & $1.3 \pm 0.8 $& X & X \\ DES 0408 WFI ($\times 10^{-1}$) & $2.2 \pm 0.4$& $2.3 \pm 1$ & $3.0 \pm 0.8$ & X & $3.6\pm 3$ & X \end{tabular} \caption{Upper bounds on the absolute value of $\dot{G}/G$ in $yr^{-1}$ from the simulated quasar and DES J0408-5354. The X’s represent values with uncertainty bigger than the central value, and are thus omitted. } \label{tableGconst} \end{table} \section{Summary and discussion} We have introduced two novel observables in the contest of Strong Lensing, i.e. the Time Delay drift and the angular drift. We have shown that measuring these effects one is able to estimate $H(z)$, and thus reconstruct the cosmological evolution and the effective equation of state parameter of the Universe $w_{eff}$. We have shown that in a modified gravity framework where the effective gravitational coupling become time dependent, those drifts earn a contribution $\dot{G}/G$, and thus their measurements could be used to constraint both violations the Equivalence Principle and DE models. Unfortunately, the current precision of the observation is not enough to detect these drifts so that the constraints we obtain are currently not very competitive. On the other hand, they could improve already in the near future with upcoming data, see for example Ref.~\cite{Millon:2020xab}, or simply increasing the observational time. Moreover, as discussed in Refs.~\cite{Zitrin:2018let,Wucknitz:2020spz,Liu:2019jka}, if in the future strongly lensed repeating FRB will be detected, they will provide Time Delay measurements of such extremely high precision, nominally of the order of seconds, that even redshift drift effects due to the Hubble expansion will be appreciable. In this scenario, the impact for cosmological implications of the drifts we proposed in this chapter is very promising, and we keep high expectations for the future. \chapter{Nonlocal gravity} \label{chapter:NL} \epigraph{\textit{I am a Quantum Engineer, but on Sundays I Have Principles.}}{John Stewart Bell} Most of our research in the last years focused on nonlocal modifications of gravity as DE candidates. We mention this class of theories in the previous chapter, since giving up from locality is a possible escape route from Lovelock's Theorem. Amongst the possible choices of nonlocal modifications, particularly interesting for DE applications are those which introduce the inverse d'Alembert operator acting on the Ricci scalar $\Box^{-1} R$. In this chapter we will briefly review this particular branch of modified gravity models, with emphasis on their fundamental motivations and their general features. In particular, we will introduce the Deser Woodard (DW), the $RR$\footnote{The $RR$ model takes its name from the structure of its Lagrangian term $R\frac{1}{\Box}R$.} and the VAAS\footnote{This model takes its name from the initials of authors Vardanyan, Akrami, Amendola and Silvestri.} nonlocal models. The first two are amongst the most popular and analyzed models belonging to this class, while the latter has been proposed recently in Ref.~\cite{Vardanyan:2017kal}. \section{ Motivation} Nonlocalities emerged from quantum mechanics already in the early stage of its formulation, see for example Ref.~\cite{Einstein:1935rr}, and Ref.~\cite{Wiseman_2006} for a nice historical review. Phenomena observed experimentally like the quantum entanglement and the Ahronov-Bohm effect show indeed that an effective description of quantum mechanics, or rather of reality, must be nonlocal. As it is widely known, it is difficult to construct a consistent theory of quantum gravity starting from GR, which in order to be renormalizable requires the introduction of infinite counterterms. Thus, just like the Fermi description of the weak interaction, one could think that GR is just an effective geometrical description of a most deep underlying theory, and it makes sense to look for phenomenological modifications of the EFE that arise from quantum effects. The idea that the latter could be used to explain the nature of DE or other open problems of the $\Lambda$CDM is particularly intriguing, and the \textit{Leitmotiv} of many nonlocal theories of gravity. The standard recipe is to postulate an ansatz for the functional form of the nonlocal modification motivated by fundamental physics. Then one studies the phenomenology of the modification at background and perturbative level and test it against observations. \subsection{The quantum effective action} Nonlocal effects could naturally arise when we move from the classical action functional of a given field theory to its quantum effective action. We will briefly review here the construction of the quantum effective action and its generalization to curved background following Ref.~\cite{Belgacem:2017cqo}. To begin with, consider a scalar field $\varphi$ with classical action $S\left[\varphi\right]$ in a flat space of dimension $D$. Once we introduce an auxiliary, classical source $J(x)$ we can define the generating functional of the connected Green's function $W[J]$: \begin{equation}\label{vevscalar} e^{i W\left[J\right]} = \int D\varphi e^{i S\left[\varphi\right] + i\int J \varphi} \; , \end{equation} where the path integral measure $D\varphi$ denotes integration over all the possible configurations of the field $\varphi$ and $\int J\varphi$ is a shortcut for the integral $\int d^Dx J(x) \varphi(x)$, so that the spatial dependence of the source has been integrated out. Functional variation of $W[J]$ with respect to the source gives the vacuum expectation value of the field $\varphi$ in presence of a source, i.e.: \begin{equation}\label{4.2} \frac{\delta W[J]}{\delta J(x)} = \langle 0|\varphi(x) |0 \rangle_{J}\equiv \phi[J] \; , \end{equation} where we have defined the scalar field $\phi$ to indicate the vacuum expectation value of $\varphi$ as function of the source $J$. The quantum effective action $\Gamma[\phi]$ is a function of the vacuum expectation value and is defined as the Legendre transform: \begin{equation} \Gamma[\phi] \equiv W[J] - \int \phi J[\phi] \; , \end{equation} where $J[\phi]$ is obtained by inverting Eq.~\eqref{4.2}. By varying the quantum effective action $\Gamma$ we obtain: \begin{equation}\label{eomEA} \frac{\delta \Gamma[\phi]}{\delta \phi(x)} = -J(x) \; , \end{equation} where the implicit spatial dependence of $\phi[J(x)]$ has been exploited. As we can see, since on the right hand side of Eq.~\eqref{eomEA} we have the source $J(x)$, the variation of the quantum effective action gives directly the equation of motion for the vacuum expectation value of the field. A useful path integral representation of the quantum effective action is: \begin{equation} \begin{split} e^{i\Gamma[\phi]} &= e^{i W[J] - i\int\phi J}\\ &= \int D\varphi e^{i S[\varphi + \phi] - i\int \frac{\delta \Gamma[\phi]}{\delta \phi}\varphi} \; , \end{split} \end{equation} which explicitly shows that the quantum fluctuations of the field $\varphi$ have been integrated out in the quantum effective action $\Gamma[\phi]$, which is instead a functional of the vacuum expectation value and the source only. It is straightforward to generalize the above construction on curved background described by a metric $g_{\mu\nu}$ using a semi-classical approach, i.e. treating the metric at a classical level while the other fields as quantum objects. The representation of quantum effective action then becomes: \begin{equation} e^{i \Gamma\left[g_{\mu\nu},\phi\right]} = e^{i S_{EH}}\int D\varphi e^{i S_m\left[g_{\mu\nu,\phi \varphi}\right] - i\int \frac{\delta \Gamma\left[g_{\mu\nu, \phi}\right]}{\delta \phi}\varphi} \; , \end{equation} from whose variation we obtain the semi-classical EFE $G_{\mu\nu} = \langle 0|T_{\mu\nu}|0\rangle$. \subsection{The QED example} To understand which kind of nonlocal modifications could appear in the quantum effective action let us consider the case of Quantum Electrodynamics (QED). The quantum effective action takes the form, see for example Ref.~\cite{Dalvit:1994gf}:\footnote{When we integrate out the quantum fluctuations of the electron and restrict ourselves to terms involving the photon field only for simplicity} \begin{equation} \Gamma_{QED} = -\frac{1}{4}\int d^4 x \left[F_{\mu\nu}\frac{1}{e^2\left(\Box\right)}F^{\mu\nu} + \mathcal{O}\left(F^4\right) \right] \; . \end{equation} where $e^2 \left(\Box \right)$ is called \textit{form factor}. When the electron mass is small with respect to the relevant energy scale we have: \begin{equation} \frac{1}{e^2 \left(\Box \right)} \simeq \frac{1}{e^2\left(\mu\right)} - \frac{1}{\left(12\pi\right)^2} \log{\left(\frac{-\Box}{\mu^2}\right)} \; , \end{equation} where the $\mu$ is the renormalization scale and $e^2\left(\mu \right)$ the renormalized charge. Nonlocality emerges because of the logarithm of the d'Alembert operator $\Box$. It is defined by its integral representation: \begin{equation} \log{\left(\frac{-\Box}{\mu^2}\right)} = \int_0^{\infty} dm^2\left[\frac{1}{m^2 + \mu^2} - \frac{1}{m^2 - \Box } \right] \;, \end{equation} where nonlocality emerges due to the appearance of the $\Box^{-1}$ operator. In the above example we have explicitly shown how from the classical Lagrangian of QED we could obtain nonlocal contributions due to the running of the coupling constant. \section{Technical stuff} \subsection{Localization} The main character of the nonlocal class of theories we are considering here is the inverse of the d'Alembert operator acting on the Ricci scalar $\Box^{-1}R$. In order to perform calculations involving this quantity an extremely useful trick was developed in Ref.~\cite{Nojiri:2007uq}, which makes it is possible to cast these models in the form of a scalar tensor theory. The starting point is to define an auxiliary scalar field $U = -\Box^{-1}R$ whose Klein Gordon equation immediately follows: \begin{equation} \label{KGlocalized} \Box U = -R \; . \end{equation} Thus a general Lagrangian density containing an arbitrary function $f(\Box^{-1} R)$ could be rewritten as: \begin{equation} \mathcal{L}_{NL} = f(U) + \lambda\left(\Box U + R\right) \, , \end{equation} where we introduced the Lagrange multiplier $\lambda$. If negative powers of the d'Alembert operators appear in the original action, the above procedure can be iterated and the theory is mapped in a multi-scalar tensor theory. For example, if the Lagrangian contains a term $ \Box^{-2}R$, as in the model proposed in Ref.~\cite{Amendola:2017qge}, it can be localized by introducing 4 coupled auxiliary fields with their respective Lagrange multipliers: \begin{eqnarray} & \Box U =- R \;, \qquad \Box S = -U \; ,\qquad \Box Q = -1 \;, \qquad \Box L = -Q \; . \end{eqnarray} It is important to properly carry on the procedure of localization without introducing modifications of the original theory. The equivalence between the two formulations was debated after the papers~\cite{Dodelson:2013sma,Park:2012cp} and~\cite{Nersisyan:2017mgj}, which were analyzing structure formation in the DW model and obtained initially different results. It turns out that the analysis of Ref.~\cite{Dodelson:2013sma} was not correct, but the arising discussion about the localization procedure helped to outline its possible stability issues and the appearance of ghosts~\cite{Park:2017zls,Park:2019btx} \subsection{Degrees of freedom and stability in the localized formulation} \label{sec:dofstability} The introduction of auxiliary fields naturally rises the question of whether there are or not new degrees of freedom generated by the nonlocal operator $\Box^{-1}R$. The question is subtle and some care must be taken in the procedure of localization. Moreover, by looking at Eq.~\eqref{KGlocalized}, it is straightforward to realize that the kinetic energy of the auxiliary field would be of negative sign, i.e a ghost. To properly understand this point, let us consider the Lagrangian of a massive Proca field: \begin{equation}\label{Lproca} \mathcal{L}_{Proca} = -\frac{1}{4}F^{\mu\nu}F_{\mu\nu} - \frac{1}{2}m^2 A^{\mu}A_{\mu} \; , \end{equation} which describe a massive boson, with the $U(1)$ gauge invariance broken by the mass term. It has been shown in Ref.~\cite{Dvali:2006su} that the above Lagrangian is equivalent to the following nonlocal but gauge invariant one:\footnote{As long as we impose that the inverse d'Alembertian is defined in terms of the retarded Green's function only to obtain casual solutions.} \begin{equation}\label{Lprocanl} \mathcal{L}= -\frac{1}{4}F_{\mu\nu}\left(1-\frac{m^2}{\Box}\right)F^{\mu\nu}. \end{equation} If we now proceed with the localization procedure and define an auxiliary field $U^{\mu\nu} =\Box^{-1}F^{\mu\nu}$, the latter would introduce new degrees of freedom, which are surely not present in the Lagrangian~\eqref{Lproca}. In order to avoid the appearance of such spurious degrees of freedom, in the localization procedure we have to select only a particular family of solutions of Eq.~\eqref{KGlocalized}. The general solution for the field $U$ would be the sum of the homogeneous and the particular one: $U = U_{hom} + U_{par}$. In order to avoid any further propagating degrees of freedom, during the localization procedure we should specify that $U$ is not the most general solution defined by $\Box^{-1}R$, but only a particular solution selected by fixing its boundary conditions. Following this recipe we avoid the appearance of ghosts associated to $U$ after quantization. Of course the above procedure does not prevent the theory from developing instabilities at classical level, which however do not necessarily imply a pathological behavior of the theory. In particular, if such instabilities emerge on cosmological scales and at Late-times, they could be able to drive the present accelerated expansion of the Universe. \section{Nonlocal models} In this section we will briefly review a bunch of different nonlocal models proposed in the last years which are able to provide a viable cosmological history at background level, and are thus potentially very interesting Dark Energy candidates. \subsection{The Deser Woodard model} One of the most popular nonlocal gravitational theory was proposed in Ref.~\cite{Deser:2007jk} and it is known as Deser Woodard (DW) model. The fundamental idea is to incorporate nonlocal effects without postulating a priori any specific form of the nonlocal modification. This is achieved by introducing a free function of the inverse d'Alembertian of the Ricci scalar, called distortion function, and reconstruct it in such a way that it produce a background cosmological history identical to the one of the $\Lambda$CDM without cosmological constant. Then one can study the perturbative regime and test its compatibility with observations. For a review on the main features of the model we address the reader to Ref.~\cite{Woodard:2014iga}; the issue of ghosts is studied in Ref.~\cite{Park:2019btx}. A detailed study of its dynamics is performed in Ref.~\cite{Koivisto:2008xfa}, while its Newtonian limit is studied in Ref.~\cite{Koivisto:2008dh}. The effects of such kind of modification for structure formation are studied in Refs.~\cite{Park:2012cp,Dodelson:2013sma,Nersisyan:2017mgj}, while constraints from observational datasets are found in Ref.~\cite{Amendola:2019fhc}. Finally, an improved version of the model has been recently proposed in Ref.~\cite{Deser:2019lmm}. The Lagrangian of the model is: \begin{equation} \mathcal{L} = \mathcal{L}_{EH} + Rf\left(\frac{1}{\Box}R\right) \; , \end{equation} and it could be mapped in a localized scalar tensor theory by introducing the auxiliary fields, see Ref.~\cite{Nojiri:2007uq}:\footnote{We are using a different definition for the field $U$ with respect to the one of Ref.~\cite{Nojiri:2007uq}. The original ones are obtained by making the substitutions $U \rightarrow -U$, $\Bar{f}\rightarrow-\Bar{f}$. } \begin{eqnarray} \Box U = -R \; ,\\ \Box V = \Bar{f}(U)R \; , \end{eqnarray} where $\Bar{f}$ indicates the derivative of the distortion function $f$ with respect to $U$. The EFE on FLRW flat background using the e-fold number $N$ as time parameter are: \begin{eqnarray} \left(1 + f - V\right) = -\frac{U'V'}{6} - f' + V' +\frac{\Omega_R + \Omega_M}{h^2} \; , \label{CosmoDW1}\\ \left(2\xi + 3\right)\left(1 + f - V\right) = V'' - f'' + \left(V' - f'\right)\left(2 + \xi\right) + \frac{U'V'}{2} - \frac{\Omega_R}{h^2} \; ,\label{CosmoDW2} \end{eqnarray} and the KG equations for the auxiliary fields are: \begin{eqnarray} U'' + \left(3 + \xi\right)U' = 6\left(2 + \xi\right) \;, \label{KGDWU}\\ V'' + \left(3 + \xi\right)V' =-6\left(2 + \xi\right)\Bar{f} \;. \label{KGDWV} \end{eqnarray} To solve the above system of equations without introducing ghost we need to fix the initial conditions for the auxiliary fields. If we impose the latter in such a way that they are compatible with a radiation-dominated epoch, $h_i^2 \sim \Omega_{Ri}$ and $\xi_i \sim -2$, Eqs.~\eqref{CosmoDW1} and \eqref{CosmoDW2} provide the two following constraints: \begin{eqnarray} f_i - V_i = -\frac{1}{6}U_i'V_i' - f_i' + V_i' \; , \label{ICCosmoDW1} \\ -f_i + V_i = -V_i' -f_i'' + \frac{U_i'V_i'}{2} \label{ICCosmoDW2} \; , \end{eqnarray} where in Eq.~\eqref{ICCosmoDW2} we used Eq.~\eqref{KGDWV} evaluated at $\xi_i = -2$. As expected, the value of $U_i$ is unconstrained since it appears on the field equations only through the function $f(U_i)$; to compute the time derivative of the latter we use the chain rule $f' = \Bar{f}U'$, so that: \begin{equation} \label{f''} f'' = \Bar{\Bar{f}}U'^2 -\Bar{f}U'' \; . \end{equation} Evaluating Eq.~\eqref{f''} at $N = N_i$ we get: \begin{equation} \label{f_i''} f_i''= \Bar{\Bar{f_i}}{U_i'}^2 - \Bar{f}U_i' \; , \end{equation} where we have used Eq.\eqref{KGDWU} with $\xi_i = -2$. In Ref.~\cite{Deffayet:2009ca} it was developed a technique to reconstruct the distortion function starting from any cosmological history. For the $\Lambda$CDM, the best analytical approximation for the distortion function was computed in Ref.~\cite{Park:2017zls} and is given by: \begin{equation} \label{fDW} f(U) = 0.243\left[ \tanh{\left(0.348Z + 0.033Z^2 + 0.005Z^3\right) } - 1\right]\; , \end{equation} where $Z= -U + 16.7$. Note that the above distortion function satisfies the condition $f(U_i) \simeq 0$ by choosing $U_i = 0$. \subsection{The $RR$ model} \label{subsec:RR} Another very popular nonlocal theory is the $RR$ model, proposed by Maggiore and Mancarella in Ref.~\cite{Maggiore:2014sia}. The model attempts to ascribe the accelerated expansion of the Universe to nonlocal modifications of the quantum effective action caused by the appearance of a new mass scale $m^2$ dynamically generated in the infrared. For a complete review on the model we address the reader to Ref.~\cite{Belgacem:2017cqo}; the cosmological perturbation theory and the impact on structure formation are studied in Ref.~\cite{Dirian:2014ara}. A dynamical system analysis of the model was performed numerically in Ref.~\cite{Nersisyan:2016hjh}, while in Ref.~\cite{Dirian:2016puz} the model is tested against observation and compared using a bayesian approach with the $\Lambda$CDM. In this theory one adds to the usual Einstein-Hilbert Lagrangian a nonlocal modification of the form: \begin{equation} \mathcal{L}= \mathcal{L}_{EH} -\frac{1}{6}m^2 R\frac{1}{\Box^2}R \;, \end{equation} and it is possible to localize the theory by introducing the auxiliary fields: \begin{eqnarray} \Box U = -R \; , \\ \Box S = -U \; . \end{eqnarray} Defining the dimensionless quantity $V = H_0^2S$ and varying the action we obtain the following background EFE, written in terms of the e-fold number $N$, see Ref.~\cite{Nersisyan:2016hjh}: \begin{eqnarray} h^2 = \frac{\Omega_{M}^0e^{-3N} + \Omega_{R}^0e^{-4N} +\frac{\gamma}{4}U^2}{1 + \gamma\left(-3V -3V' + \frac{1}{2}U'V'\right)} \; , \label{CosmoRR1} \\ \xi = \frac{\frac{-3\Omega_M -4\Omega_R}{h^2} + 3\gamma\left(\frac{U}{h^2} + U'V' -4V'\right)}{2\left(1-3\gamma V\right)} \label{CosmoRR2} \; , \end{eqnarray} where we have defined $\gamma \equiv m^2/9H_0^2$. The KG equations of the auxiliary fields are instead: \begin{eqnarray} V'' + V'\left(3 + \xi\right)= \frac{U}{h^2}\; , \label{KGRRV} \\ U'' + U'\left(3+\xi \right)= 6\left(2 + \xi \right) \label{KGRRU} \; . \end{eqnarray} In order to avoid the introduction of new degrees of freedom we have to fix properly the initial conditions. Compatibility with radiation domination $h_i^2 \sim \Omega_{Ri}$ and $\xi_i \sim -2$ imply that Eqs.~\eqref{CosmoRR1} and \eqref{CosmoRR2} at some initial time $N = N_i$ become: \begin{eqnarray} \frac{U_i^2}{4h_i^2}&=& -3V_i -3V_i' + \frac{1}{2}U_i'V_i' \; ,\label{ICCosmoRR1}\\ V_i &=& \frac{U_i}{4h_i^2} + \frac{1}{4}U_i'V_i' - V_i' \; \label{ICCosmoRR2}, \end{eqnarray} providing two constraints for the four initial conditions required on $V_i, V_i', U_i, U_i'$. \subsection{The VAAS model} \label{subsec:VAAS} This model was proposed in Ref.~\cite{Vardanyan:2017kal}, where the possibility of a nonlocal interaction term in a bimetric theory of gravity was investigated for the first time. The action is the following: \begin{eqnarray} S = \frac{M_{Pl}^2}{2}\int d^4x\sqrt{-g}R + \frac{M_f^2}{2}\int d^4x\sqrt{-f}R_f\nonumber\\ -\frac{M_{ Pl}^2}{2}\int d^4x\sqrt{-g}\alpha\left(R_f\frac{1}{\Box}R + R\frac{1}{\Box}R_f\right) + S_{m}[g,\Psi]\;, \end{eqnarray} where $\Psi$ is a shortcut notation for all the matter fields, including CDM, and $f_{\mu\nu}$ is the auxiliary metric which does not couple to matter. It turns out, from computing the Bianchi constraints, that $R_f$ must be constant and thus the action become: \begin{equation} S = \frac{M_{Pl}^2}{2}\int d^4x\sqrt{-g}\left(1 + m^{2}\frac{1}{\Box}\right)R + S_{m}[g,\Psi]\;, \end{equation} and the arising field equations can be cast as follows: \begin{eqnarray}\label{FieldequationsNL} &(1 - 2\alpha V)G_{\mu\nu} + m^2(1 - U/2)g_{\mu\nu} + 2\alpha\nabla_\mu\nabla_\nu V + \alpha \nabla^\rho V\nabla_\rho Ug_{\mu\nu}\nonumber\\ &- 2\alpha\nabla_{\mu}U\nabla_{\nu}V = \frac{1}{M_{Pl}^2}T_{\mu\nu}\;, \end{eqnarray} where the auxiliary metric $f$ enters only through $m^2 \equiv -2\alpha R_f$ and all the other geometrical quantities are computed from the metric $g_{\mu\nu}$ . The two auxiliary fields $U$ and $V$ were introduced in order to localize the theory and satisfy the following KG equations: \begin{equation}\label{auxiliaryeqsNL} \square U = R\;, \qquad \square V = -\frac{1}{2\alpha}m^2\;. \end{equation} Later on, in Ref.~\cite{Amendola:2017qge}, an equivalent formulation of the theory was obtained motivated by nonperturbative lattice quantum gravity. The background cosmology was numerically studied in Ref.~\cite{Vardanyan:2017kal}, where the compatibility with the standard cosmological history of the $\Lambda$CDM is showed. The EFE and the Klein gordon equations in a flat FLRW background, written in terms of the e-fold number $N$, are: \begin{eqnarray} &\label{FriedeqVAAS} 3\tilde V + \frac{m^2U}{2H^2} + 3\tilde V' + \frac{U'\tilde V'}{2} = \frac{\rho}{M_{Pl}^2H^2}\;,\\ &\label{acceqVAAS} -\tilde V\left(3 + 2\xi\right) + \frac{m^2}{H^2}(1 - U/2) + \tilde V' + \frac{U'\tilde V'}{2} = \frac{1}{M_{ Pl}^2H^2}P\;,\\ &\label{KGVAASU}U'' + \left(3 + \xi\right)U' + 6\left(2 + \xi\right) = 0\;,\\ &\label{KGVAASV}\tilde V'' + \left(3 + \xi\right)\tilde V' = -\frac{m^2}{H^2}\; , \end{eqnarray} where we have defined $ \tilde V \equiv 1 - 2\alpha V$. Imposing initial conditions compatible with a radiation-dominated era, i.e. $h_i^2 \sim \Omega_{Ri}$ and $\xi_i \sim -2$, the EFE for a flat FLRW at some initial time $N=N_i$ read: \begin{eqnarray} \tilde{V_i} + \frac{\gamma U_i}{6h^2} +\tilde V_i' +\frac{1}{6}U_i'\tilde V_i' = 1 \; , \label{ICCosmoVAAS1} \\ \tilde V_i - \frac{\gamma}{h_i^2}\left(1 - \frac{U_i}{2}\right) + \tilde V_i' +\frac{1}{2}U_i'\tilde V_i' = 1 \; . \label{ICCosmoVAAS2} \end{eqnarray} The latter equations provide two constrains among the four initial conditions on the auxiliary fields $U_i,U_i',\tilde{V}_i,\tilde{V}_i'$. \chapter{Personal Contribution: \\ Nonlocal gravity} \label{chapter:PCNL} \epigraph{\textit{The worthwhile problems are the ones you can really solve or help solve, the ones you can really contribute something to. No problem is too small or too trivial if we can really do something about it.}}{Richard Feynman}{} In this chapter I will present the results of my research about nonlocal models of gravity. In particular, the first part of the chapter is devoted to the results of Ref.~\cite{Giani:2019vjf} on VAAS gravity. The second part of the chapter addresses instead the study of the general features of the Late-times asymptotic equation of state for a general class of nonlocal models, following the results of Ref.~\cite{Giani:2019xjf}. \section{Dynamical system analysis and Newtonian limit of VAAS gravity} In Ref.~\cite{Vardanyan:2017kal} the cosmological behavior of VAAS gravity was analyzed numerically and found to be compatible with the one of $\Lambda$CDM, but an analytical understanding of its dynamics was not addressed. In Ref.~\cite{Giani:2019vjf} we tried to fill this gap using a dynamical system analysis approach, revealing a number of interesting features. In particular, we addressed the existence of critical points and their stability, and studied in a qualitative but analytical way the Late-times dynamics of the model. We also studied the impact on small scales of the nonlocal modification, i.e. we have studied its Newtonian limit on solar system scales and within the quasi static approximation (QSA), showing explicitly the existence of static solutions and the changes in the perturbations equation for the density contrast. \subsection{Critical points} Defining $X\equiv\dot{U}$ and $Y\equiv\dot{V}$ it is possible to write down Eqs.~\eqref{FieldequationsNL} and \eqref{auxiliaryeqsNL} for a flat FLRW background in the form of a closed dynamical system: \begin{subequations}\label{dsfinitedistance2} \begin{eqnarray} \dot{H} &=&\frac{1}{1 - 2 \alpha V} \left[\frac{\rho - P}{2 M_{ Pl}^{2}} + \frac{m^{2}}{2}\left(1 - U \right) + 2\alpha H Y\right] - 3 H^{2}\;,\\ \dot{\rho} &=& -3 H(\rho + P)\;,\\ \dot{X} &=& - 3 H X - 6 H^{2} - \frac{6}{1 - 2 \alpha V} \left[\frac{\rho - P}{2 M_{ Pl}^{2}} + \frac{m^{2}}{2}\left(1 - U \right) + 2\alpha H Y\right]\;,\\ \dot{Y} &=& \frac{m^{2}}{2 \alpha} - 3 H Y \;,\\ \dot{U} &=& X\;,\\ \dot{V} &=& Y\;. \end{eqnarray} \end{subequations} We also have to keep into account the following constraint coming from the first Friedmann equation: \begin{equation}\label{modFriedeq2} (1 - 2\alpha V)3H^2 + \frac{m^2U}{2} - 6H\alpha Y - \alpha XY = \frac{\rho}{M_{ Pl}^2}\;. \end{equation} We define as critical point of the dynamical system a point in the phase space for which the right hand side of equations \eqref{dsfinitedistance2} vanish. The details of the analysis of the above system are reported in Appendix \ref{AppendixA}, from which we can draw the following conclusions: \begin{itemize} \item For $m^2 = 0$ and $U = const$, the only critical point at finite distance represents Minkowski space. \item For $m^2 = 0$, $U = -4Ht$ and $H$ constant, the only critical point at finite distance represents a de Sitter space. \item For $m^2 \neq 0$ there are no critical points at finite distance; \item At infinite distance we found an unstable hyperplane of critical points of Minkowski type. \end{itemize} The above results are particularly interesting because $m^2$ is the free parameter of the theory that set the strenght of the nonlocal modification. The fact that for $ m^2 \neq 0$ we do not have stable critical points reflects and confirms the classical instability typical of these models we were talking about at the end of subsection \ref{sec:dofstability}. \subsection{Qualitative dynamics} By looking at Eqs.~\eqref{FriedeqVAAS} and \eqref{acceqVAAS} we see that there is a complicated interplay between the auxiliary fields $U, V$ and the Hubble function $H$, which makes not trivial the qualitative understanding of the dynamical behavior of the system. To get some insight, let us begin with the Klein Gordon Eqs.~\eqref{auxiliaryeqsNL} written in terms of $X \equiv\dot{U}$ and $Y\equiv\dot{V}$: \begin{eqnarray} X' + \left(3 + \xi\right)X + 6\left(2 + \xi\right) = 0\;,\\ Y' + \left(3 + \xi\right)Y = -\frac{m^2}{H^2}\;. \end{eqnarray} The latter have the formal solutions: \begin{eqnarray}\label{Usol} X(N) = C_1e^{-F(N)} - 6e^{-F(N)}\int^N_{N_i} d\bar Ne^{F(\bar N)}[2 + \xi(\bar N)]\;,\\ Y(N) = C_2e^{-F(N)} - e^{-F(N)}\int^N_{N_i} d\bar Ne^{F(\bar N)}\frac{m^2}{H^2(\bar N)}\;, \end{eqnarray} with $C_1$ and $C_2$ integration constants and: \begin{equation}\label{fndef} F(N) \equiv \int^N_{N_i}d\bar{N}[3 + \xi(\bar{N})] \;. \end{equation} As we discussed in \ref{sec:dofstability}, it is important to fix the initial conditions in order to avoid the appearance of spurious propagating degrees of freedom. From the formal solutions of $X$ and $Y$ we see that: \begin{equation} C_1 = X(N_i)\;, \qquad C_2 = Y(N_i)\;, \end{equation} and choosing vanishing initial conditions for the fields, which are compatible with the constraints of Eqs.~\eqref{ICCosmoVAAS1} and \eqref{ICCosmoVAAS2}, we obtain: \begin{eqnarray} X(N) = -6e^{-F(N)}\int^N_{N_i} d\bar Ne^{F(\bar N)}[2 + \xi(\bar N)]\;,\\ Y(N) = -e^{-F(N)}\int^N_{N_i} d\bar Ne^{F(\bar N)}\frac{m^2}{H^2(\bar N)}\;. \end{eqnarray} It is straightforward to realize from the above equations that if $\xi > -2$, which is compatible with the standard cosmological evolution, then both $X$ and $Y$ are always negative. It is also easy to prove the following inequality:\footnote{The details of the calculation are reported in Appendix \ref{appendixB}} \begin{equation}\label{Xinequality} X + 6 > 0 \; . \end{equation} It is interesting to study the behavior of $U$ and $V$ during the different phases of the cosmological evolution. The explicit calculations are reported in Appendix \ref{appendixB}, the results of which are: \begin{itemize} \item During the radiation domination (RD), $\xi = -2$, we obtain: \begin{eqnarray} &U_{RD} = 0 \; , \\ &\tilde V_{RD} = -\frac{m^2}{20H_0^2\Omega_{r}^0}e^{4N} - \frac{m^2}{5H_0^2\Omega_{r}^0}e^{5N_i - N} + \frac{m^2}{4H_0^2\Omega_{r}^0}e^{4N_i} + 1\;. \end{eqnarray} \item During the matter dominated epoch (MD), $\xi = -3/2$, we have: \begin{eqnarray} &U_{MD} = C_1 - 2N \;, \\ &\tilde V_{MD} \sim 1 - \frac{m^2}{12H_0^2\Omega_{ m}^0}e^{3N}\;. \end{eqnarray} \end{itemize} Let us now try to understand how these solutions evolve at Late-times when matter and radiation are diluted enough. Following the reasoning of Appendix \ref{appendixB}, we can conclude that at Late-times (LT) the field $V$ evolve as: \begin{equation} \tilde{V}_{LT} \sim -\frac{m^2 U_{LT}}{6H^2} \; . \end{equation} From the latter equation we can estimate then the behavior of $\xi$: \begin{equation} \xi \sim -3 - \frac{1}{\tilde V_{LT}}\frac{m^2U_{LT}}{2H^2} \rightarrow 0\;, \end{equation} so that at Late-times $\xi$ vanishes approaching the value it would have in the $\Lambda$CDM scenario, independently of the value of $m^2$. The latter occurrence is not a coincidence, and we will discuss it in detail in section \ref{sec:latetimes}. Using the above asymptotic expressions for $\xi$ we found: \begin{equation} U_{LT} = C_1 - 4N \;, \end{equation} from which we finally obtain the evolution of the Hubble factor at Late-times: \begin{eqnarray} &\xi = -\frac{3}{C_1 - 4N} = -\frac{3}{U_{LT}}\;, \\ &H = C_2|C_1 - 4N|^{3/4} = 3|U_{LT}|^{3/4}\;.\label{HVAAS} \end{eqnarray} Fig. \ref{VAAS dynamic} shows the agreement between our analytical approximation for the evolution of the Hubble factor at Late-times and the numerical solution, as well as the agreement between the latter and the $\Lambda$CDM model in the past. \begin{figure}[h] \begin{center} \includegraphics[width=12.5cm]{evocomp.pdf} \caption{Behavior of the VAAS model and the analytical approximation of Eq.\eqref{HVAAS} compared to $\Lambda$CDM for $m^2 = 0.232 H_0^2$.} \label{VAAS dynamic} \end{center} \end{figure} Summarizing, our qualitative analysis shows that if choosing vanishing initial condition deep into the radiation dominated epoch results in the following cosmological evolution: \begin{itemize} \item During the RD epoch the field $U$ is constant and vanishing, while $V \sim e^{4N}$. \item During the MD epoch the field $U$ becomes linear in $N$ and starts to grow, while $V \sim e^{3N}$. \item At Late-times we found that $V\propto U/H^2$, which in turns implies that $\xi \rightarrow 0$. As a result, $U$ goes linearly as $U \sim -4N$ and $H = 3|U|^{3/4}$, so that $\xi = H'/H \propto U^{-1}$ approaches 0 as $ \sim N^{-1}$. \end{itemize} \subsection{Newtonian Limit} \subsubsection{First order perturbations} In order to understand the effects of the VAAS nonlocal term at small scales we will consider first order perturbations of the FLRW metric in the Newtonian gauge, i.e.: \begin{equation} ds^2 = -dt^2\left(1 + 2\Psi(\textbf{x,t})\right) + a(t)^{2}\left(1+ 2\Phi(\textbf{x,t})\right)\delta_{ij}dx^idx^j \; , \end{equation} where $\Psi$ and $\Phi$ are the gravitational potentials. We also need to consider perturbations of the auxiliary fields: \begin{equation} U(\textbf{x},t) = U_0(t) + \delta U(\textbf{x},t) \; , \qquad V(\textbf{x},t) = V_0(t) + \delta V(\textbf{x},t) \; , \end{equation} where $U_0$ and $V_0$ are the background solutions of the Klein Gordon equations \eqref{KGVAASU}\eqref{KGVAASV}. The first order perturbed Friedmann equation in Fourier space is then: \begin{equation} \label{1order00eq} \begin{split} &\left(1 -2\alpha V \right)\left( 6H\phi_{,0} - 6H^2\psi +2\frac{k^2\phi}{a^2}\right) -6\alpha\delta V H^2 -2m^2\left(1 - \frac{U}{2}\right)\psi +m^2\frac{\delta U}{2} \\ &+2\alpha\left(\delta V_{,00} -\psi_{,0}V_{,0} -i \frac{k^{i}\psi}{a^2} V_{,i}\right) -\alpha\left(V_{,}^{0}\delta U_{,0} + V_{,}^{k}\delta U_{,k} + \delta V_{,}^{0}U_{,0} + \delta V_{,}^{k}U_{,k}\right)\\ &-2\alpha \psi \left(V_{,}^{0} U_{,0} + V_{,}^{k} U_{,k}\right) -2\alpha\left(\delta U_{,0}V_{,0} + U_{,0}\delta V_{,0} \right) = \frac{\delta \rho}{M_{Pl}^2} \; , \end{split} \end{equation} while the acceleration equation is: \begin{equation}\label{1orderijeq} \begin{split} & \left(1-2\alpha V \right)\frac{2}{3a^2}k^2\left(\phi + \psi \right) + \left(\frac{k^i k^j}{k^2} -\frac{1}{3}\delta^{ij} \right)\left[-2\alpha\delta VG_{ij} + m^2\left(1 - \frac{U}{2}\right)2a\delta_{ij}\phi -\frac{m^2 \delta U}{2}\delta_{ij}a\right. \\ & +2\alpha\left\{\delta V_{,ij} -\delta_{ij}a_{,0}a\delta V_{,0} -\delta_{ij}a^2\left[H +2H\left(\phi - \psi \right) + \phi_{,0} \right]V_{,0} -i\phi\left(\delta_{ki}k_j +\delta_{kj}k_i -\delta_{ij}k_k\right)V_{,k} \right\} \\ &+ \alpha a\delta_{ij}\left(V_{,}^{0}\delta U_{,0} + V_{,}^{k}\delta U_{,k} + \delta V_{,}^{0}U_{,0} + \delta V_{,}^{k}U_{,k}\right) +2\phi a\delta_{ij} \alpha \left(V_{,}^{0} U_{,0} + V_{,}^{k} U_{,k}\right) -2\alpha\left(\delta U_{,i}V_{,j} + U_{,i}\delta V_{,j} \right)\bigg]\\ &= \left(\frac{k^i k^j}{k^2} -\frac{1}{3}\delta^{ij} \right)\frac{\delta T_{ij}}{M^2_{Pl}} \, . \end{split} \end{equation} Finally, the Klein Gordon equations for the auxiliary fields are: \begin{align}\label{1orderKGeqU} \begin{split} &\delta U_{,\mu}^{\mu} + H \delta U_,^{0} + \psi_{,0}U_{,}^{0} + ik_{i}\psi U_{,}^{i} +\phi_{,0}U_{,}^{0} + i\phi k_{j} U_{,}^{j}\\ &= -12\psi\left( H^2 + \frac{a_{,00}}{a}\right) -\frac{2}{a^2}\nabla^2\psi + 6\phi_{,00} -6H\left(\psi_{,0} -4\phi_{,0}\right) -\frac{4}{a^2}\nabla^2\phi \, ; \end{split}\\\label{1orderKGeqV} &\delta V_{,\mu}^{\mu} + H \delta V_,^{0} + \psi_{,0}V_{,}^{0} + ik_{i}\psi V_{,}^{i} +\phi_{,0}V_{,}^{0} + i\phi k_{j} V_{,}^{j}= 0 . \end{align} \subsubsection{Solar system scales} For analyzing physics at solar system scales we will adopt an approach similar to the one of Ref.~\cite{Koivisto:2008dh} and make the following approximations: \begin{itemize} \item We will ignore the cosmological expansion, so we set the scale factor $a\approx1$ and the Hubble factor $H\approx0$. \item We look for static spherically symmetric solutions of the gravitational potential. \item We set matter perturbations to 0. \end{itemize} Note that since in VAAS gravity there is no Minkowski solution at background level for $m^2\neq 0$, we have to consider $m^2$ as a perturbative quantity in the following calculations. The perturbations equations under these approximations become: \begin{eqnarray} &\nabla^2 \Phi = 0 \; , \\ &\nabla^2 \left(\Phi + \Psi \right) + \alpha\nabla^2\delta V = 0\; , \\ &\left(\partial^i\partial_j - \frac{\delta^i_j}{3} \nabla^2\right)\left(\Phi + \Psi -2\alpha\delta V\right)= 0 \; , \\ &2\alpha\nabla^2\delta V = -m^2\;, \\ &\nabla^2\delta U = -2\nabla^2\left(2\Phi + \Psi\right) \;. \end{eqnarray} Solving the above equations for the gravitational potentials we can draw the following conclusions: \begin{itemize} \item The $\Phi$ potential is a solution of the standard Poisson equation and thus has the same form as in GR: $\Phi = GM/r$. \item The $\Psi$ potential is instead sourced by the $m^2$ term and its solution is $\Psi = -GM/r + m^2r^2/12$. The term $\propto m^2r^2$ is particularly interesting because it closely resembles the one that would appear in GR for the Schwarzschild-deSitter solution, i.e. the nonlocal term behave similarly to a cosmological constant. \item We can write down the post Newtonian parameter $\gamma = -\Phi/\Psi$ = $m^2r^3/12GM$, which can be used to constraint the value of $m^2$. It turns out that the current constraint on $\gamma \leq 10^{-5}$ are satisfied for the value $m^2 \sim H_0^2$ required for a well-behaved cosmological evolution. \end{itemize} \subsubsection{Structure formation in the Quasi Static Approximation (QSA)} In order to address the impact of the nonlocal modifications on the process of structure formation at small scales we will work within the QSA. So we consider scales for which $k^2 \gg H^2$, in such a way that for a given perturbation we can neglect in the first order perturbation equations those terms containing time derivatives, or those proportional to $H$, with respect to terms proportional to $k^2$. Combining the Euler and the continuity equation for dust we obtain the equation for the density contrast $\delta_M$: \begin{equation}\label{dcqsaeq.} \ddot{\delta}_M + 2H\dot{\delta}_M +\frac{k^2}{a^2}\Psi = 0 \; . \end{equation} The equations for $\delta U$ and $\delta V$ are instead: \begin{equation}\label{pertUVsf} \delta U = -2\left(\Psi + 2\Phi\right) \; , \qquad \frac{k^2}{a^2}\delta V = \frac{m^2}{\alpha}\Psi \; . \end{equation} Finally, the EFE are: \begin{eqnarray} &2\left(1-2\alpha V_0\right)\frac{k^2\Phi}{a^2} + m^2\frac{\delta U}{2} -2m^2\Psi = \frac{\delta \rho_M}{M_{Pl}^2} \; , \\ &-2\left(1-2\alpha V_0\right)\frac{k^2}{a^2}\left(\Psi + \Phi\right) - 3m^2\frac{\delta U}{2} -2 \alpha \frac{k^2}{a^2} \delta V= 0 \; . \end{eqnarray} Combining the latter equations and using Eq.~\eqref{pertUVsf} to eliminate $\delta U$ and $\delta V$ we obtain: \begin{equation} -\left[2\left(1-2\alpha V_0\right)\frac{k^2}{a^2} - 6m^2\right]\Phi =\left[2\left(1-2\alpha V_0\right)\frac{k^2}{a^2} - m^2\right]\Psi \; , \end{equation} from which we can read off the slip parameter $\eta$ as: \begin{equation} \eta \equiv -\frac{\Phi}{\Psi} = \frac{2\left(1-2\alpha V_0\right)k^2 - m^2 a^2 }{2\left(1-2\alpha V_0\right)k^2 - 6m^2 a^2 } \;, \end{equation} note that, as expected, the GR result $\Phi = - \Psi $ is recovered for $m^2 \rightarrow 0$. Using the above expression for $\eta$ in the modified Poisson equation we can define the effective gravitational coupling $Y$ as follows: \begin{equation} 1 + Y \equiv -\frac{2k^2\Psi}{3H^2a^2\Omega_M\delta_M} = \frac{\left(1-2\alpha V_0\right)k^4 -3m^2k^2a^2}{\left(1-2\alpha V_0\right)^2k^4 - m^4a^4} \; . \end{equation} Using the latter it is possible to rewrite Eq.~\eqref{dcqsaeq.} as: \begin{equation} \ddot{\delta}_M +2H \dot{\delta}_M -\frac{3}{2}\left(1+Y\right)\Omega_M\delta_M = 0 \;. \end{equation} Thus, within the QSA, using the value of $m^2$ required for a compatible background history $m^2\approx H^2 $ we have that the slip parameter is essentially the same as in GR, $\eta \approx 1$, while the effective gravitational coupling is modified by the background value of the field $V_0$ and gets larger as soon as nonlocality starts to drive the accelerated expansion. For example, using the reference value $m^2/H_0^2 \approx 0.2$ we have that $1-2\alpha V_0 \approx 0.98$, and hence $Y \approx 0.02$, so that the effective gravitational coupling strength is enhanced by 2\% . \subsubsection{Lunar Laser Ranging constraints} Lunar Laser Ranging measurements provide a constraint on the time variation of the Newton constant, see for example Ref.~\cite{Hofmann:2018myc}. Currently, this constraint is of order: \begin{equation} \frac{\dot{G}}{G} = 7.71 \pm 7.76 \times 10^{-14} \;, \text{yr}^{-1} = 0.99 \pm 1.06 \times 10^{-3} \frac{0.7}{h_0} H_0 \; , \end{equation} where $h_0$ is the Hubble constant expressed in units of 100 km s$^{-1}$ Mpc$^{-1}$. As argued in Ref.~\cite{Belgacem:2018wtb}, nonlocal modifications of gravity result in field equations which can be written as: \begin{equation} G_{\mu\nu} + \Delta G_{\mu\nu} = \frac{1}{M_{Pl}^{2}}T_{\mu\nu} \; , \end{equation} where $\Delta G_{\mu\nu}$ accounts for deviations from standard GR. The terms which in the latter are proportional to $G_{\mu\nu}$ will generally result in a modification of the gravitational coupling, which for Eq.~\eqref{FriedeqVAAS} reduce to: \begin{equation} G_{eff}=\frac{G_{N}}{-2\alpha V} =_{QSA} \frac{G_{N}}{-2\alpha V_0} \; . \end{equation} where in the last equality we are considering $k^2 \gg H$, thus we applied the result of the previous section whitin the QSA, which is surely a well justified assumption for scales related to the Earth-Moon distance. Taking the time derivative of the above expression we can write: \begin{equation}\label{geffvaas} \frac{\dot{G}_{eff}}{G{eff}}= \frac{2\alpha\dot{V}_0}{1-2\alpha V_0} \; , \end{equation} or, using the e-fold number parameter: \begin{equation} \frac{\dot{G}_{eff}}{G{eff}}= H \frac{\tilde{V}'_0}{\tilde{V}_0} \; , \end{equation} and we conclude that Lunar Laser Ranging constraints are satisfied in VAAS only for $m^2/H_0^2 \leq 10^{-3}$. The latter upper bound is two order of magnitude smaller than the value required for reproducing a viable cosmological expansion, thus the LLR experiments rule out VAAS gravity. Indeed, LLR have already ruled out several nonlocal proposal, including the $RR$ and the DW model, with the exception of the $RT$ model which we mention in section~\ref{sec:NLF}. There are however a couple of caveats; if a static solution of the above field equations exist it would be clearly compatible with LLR test, thus one should study whether these static solutions are stable against time perturbations. Moreover, the calculation presented here is based on the assumptions that we can extrapolate the solution we found for linear cosmological perturbations all the way down to Earth-Moon scales, which is not guaranteed a priori and very difficult to prove due to the lack of a satisfactory geometrical description that joins cosmological and local scales. Indeed, the results of Ref.~\cite{Belgacem:2018wtb} rely on the use of the McVittie metric to connect the cosmological solution with the solar system one, but such an assumption could be too strong. \section{Late-times asymptotic equation of state in nonlocal gravity} \label{sec:latetimes} As we already mention, in the VAAS model the asymptotic equation of state of the Universe approaches the value $w_{eff} \rightarrow -1$ as in the $\Lambda$CDM model. This was shown numerically by the author of Ref.~\cite{Vardanyan:2017kal}, and explicitly shown analytically by us in Ref.~\cite{Giani:2019vjf}. It is interesting to note that similar numerical investigations of the $RR$ model and of the one proposed in Ref.~\cite{Amendola:2017qge} showed a similar behavior. Motivated by the latter apparent coincidence, we studied in Ref.~\cite{Giani:2019xjf} the behavior of the Late-times asymptotic effective equation of state for different Lagrangians containing functions of $\Box^{-1} R$. Applying the same technique we developed in Ref.~\cite{Giani:2019vjf} for the VAAS model we show analytically that, under a certain choice of initial conditions, all the models in which a term $\Box^{-1} R$ appears explicitly in the Lagrangian result in an asymptotic equation of state $w_{eff} \rightarrow -1$. This happens because such a term will inevitably diverge in the future, reflecting the classical instability we discussed in Sec.~\ref{sec:dofstability}. As a result, $H^2$ will diverge but $\dot{H}/H^2 \rightarrow 0$. On the other hand, we found that if the function $f(\Box^{-1}R)$ is chosen in such a way that $|f(\infty)| \leq const$, like for the standard DW model, the asymptotic equation of state will not approach asymptotically the $\Lambda$CDM value. \subsection{General scheme} The general scheme presented here was developed in Ref.~\cite{Giani:2019vjf} to study the late-times behavior of the model~\cite{Vardanyan:2017kal}. A sketch of the general strategy is the following: we use the fact that the sign of the first derivative of the auxiliary fields is determined by the formal solutions of the KG equations. Then, imposing initial conditions compatible with radiation and matter domination, we are able to understand qualitatively the evolution of the nonlocal fields when matter sources are totally diluted by imposing consistency with the first Friedmann equation. Finally, we insert the asymptotic solution obtained for the fields and their derivatives into the acceleration equation to compute the asymptotic value of $\xi$. Note that the scheme presented here is only valid if we make the crucial assumptions $\xi + 2 \geq 0$, which is reasonable since we fix the initial conditions during the radiation-dominated era, when $\xi = -2$, to which follow a matter-dominated epoch $\xi = -3/2$. \subsection{Qualitative behavior of the fields} First, let us notice that we can extract information about the qualitative behavior of $U$ already from the structure of its Klein Gordon equation. Indeed, it is straightforward to realize that with the above choice of initial conditions, see Appendix \ref{appendixB} for the explicit computation, the following inequality for $U'$ holds: \begin{equation} 0 \leq U' \leq 6 \; , \end{equation} so that choosing non-negative initial conditions would always imply $U \geq 0$. Since we know that $U$ has a definite sign, and we have constrained its first derivative, we grossly know its qualitative evolution. Moreover, since the other auxiliary fields are generally defined in terms of $U$, we can conclude that it is possible to obtain a similar amount of information from their Klein Gordon equations. Another crucial information on the behavior of the system comes from the first Friedmann equation, which could be written: \begin{equation} \left(1+g(N)_{NL}\right)h^2 = \Omega_{R} + \Omega_{M} +\Omega_{NL} \;, \end{equation} where the functions $g(N)$ and $\Omega_{NL}$ are the modifications due to nonlocal terms. The initial conditions set the value $g(N_i)$, and since we can estimate the signs of the first derivative of the auxiliary fields entering in $g_{NL}$, using their KG equations we are able to estimate the qualitative behavior of $g(N)$ through the cosmological history, and in particular its asymptotic value at Late-times when matter and radiation are diluted enough. \subsection{The Late-times asymptotic equation of state for the RR model} To begin with let us consider the $RR$ field equations \eqref{CosmoRR1},\eqref{CosmoRR2} and \eqref{KGRRV} when matter and radiation density are negligible and define $\tilde{V} \equiv 1 -3\gamma V$: \begin{eqnarray} \tilde{V} &=& \frac{\gamma U^2}{4 h^2} + \tilde{V}'\left(\frac{U'}{6} -1 \right) \; , \label{CosmoRR1A}\\ \xi &=& \frac{1}{2\tilde{V}}\left[\frac{3\gamma U}{h^2} - U'\tilde{V}' + 4\tilde{V}'\right] \; , \label{CosmoRR2A}\\ \tilde{V}'' &+& \tilde{V}'\left(3 + \xi\right) = -\frac{3\gamma U}{h^2} \; \label{KGRRVA} . \end{eqnarray} The formal solution of Eq.~\eqref{KGRRVA} for $\tilde{V}'$ compatible with the initial condition $\tilde{V}'(N_i)=0$ is: \begin{equation}\label{FormalVRR} \tilde V' = -3\gamma e^{-F(N)}\int_{N_i}^{N}d\Bar{N}e^{F(\Bar{N})}\frac{U}{h^2} \; , \end{equation} where $F(N)$ was defined in Eq.~\eqref{fndef}. From Eq.~\eqref{FormalVRR} it is straightforward to realize that $\tilde{V}'$ is always negative since $U$ is always positive, while imposing vanishing initial conditions for the nonlocal fields at early times determines the initial value $\tilde{V} =1 $. On the other hand from the right hand side of Eq.~\eqref{CosmoRR1A} we see that $\tilde{V}$ must be positive and so we can conclude that $ 0\leq \tilde{V} \leq 1 $.\footnote{Note that the parameter $\gamma$ can be considered as positive definite since changing its sign corresponds to switch the sign of the nonlocal interaction term in the Lagrangian. In this case it is more convenient to change the sign of the source term in the equation of the auxiliary field $U$, in such a way that the product $\gamma U$ is positive definite. Here we are neglecting the radiation and matter contributions which are anyway also positive definite.} This last argument tells us then that $\tilde{V}'$ must also vanish at late-times, or it would push $\tilde{V}$ to negative values. On the basis of these considerations we can conclude that at late-times we have \begin{equation} \label{RRasyVV'} \tilde{V} \sim \frac{\gamma U^2}{4 h^2} \; , \qquad \tilde{V}' \sim 0 \; , \end{equation} and using the above results in Eq.~\eqref{CosmoRR2A} we get: \begin{equation} \label{AxiRR} \xi \sim \frac{3\gamma U}{4h^2} \frac{4h^2}{\gamma U^2} \sim \frac{1}{U} \rightarrow 0 \; , \end{equation} where the last limit holds true since $U$ diverges.\footnote{Note that $U$ cannot reach a constant value since $U' = 0$ is possible only for $\xi = -2$, and we easily see from Eq.~\eqref{AxiRR} that at late-times $\xi > 0$. } \subsection{The Late-times asymptotic equation of state for the DW model} In order to study qualitatively the dynamic of the DW model at late-times we have first of all to understand qualitatively the behavior of the free function $f(U)$ defined in Eq.\eqref{fDW}, since it enters directly in the Friedmann equations and also rules the dynamics of the localized field $V$. It is straightforward to realize from Eq.~\eqref{fDW} that $(-2)(0.245) < f < 0$ and $\Bar{f} < 0$ , and that \ $\Bar{f} \rightarrow 0$ when $U \rightarrow \infty$. The formal solution of \eqref{KGDWV} for $V'$ is: \begin{equation} \label{FormalVDW} V' = -6e^{-F(N)}\int_{N_i}^{N}d\Bar{N}e^{F(\Bar{N})}\left(2+\xi\right)\Bar{f} \; . \end{equation} Since $\Bar{f} < 0$ and $\xi > -2$ from Eq.~\eqref{FormalVDW} it is straightforward to realize that we have at all times $V'> 0$. Since we impose initial conditions in such a way that during the radiation-dominated epoch $V$ is vanishing, we also can conclude that $V > 0$. At late-times, when matter is completely diluted Friedmann equations \eqref{CosmoDW1} and \eqref{CosmoDW2} become: \begin{eqnarray} V &=& -V'\left(1-\frac{U'}{6}\right) +\Bar{f}U' + f + 1 \; , \label{CosmoDW1A} \\ \left(2\xi + 3\right)\left(1+f-V\right) &=& V'' - f'' + \left(V' - f'\right)\left(2 + \xi \right) + \frac{U'V'}{2}\; \label{CosmoDW2A} . \end{eqnarray} Note that the first two terms in the right hand side of Eq. \eqref{CosmoDW1A} are strictly negative since, $V' > 0$ and $\Bar{f}<0$, while $f+1 > 0$. On the other hand $V' >0$ implies that $V$ is a monotonic function, and we are left with two cases; either $U$ diverges, in which case $\Bar{f} \rightarrow 0$ and $f \rightarrow (-2)(0.243)$, or $U \rightarrow const$, in which case $U' \rightarrow 0$, $f'\rightarrow 0$ and $f + 1 \rightarrow const$. In both cases consistency requires that $V' \rightarrow 0$, or $V$ will be a decreasing function and so $V' < 0$. Thus we can conclude that asymptotically: \begin{equation} V \sim \Bar{f}U' + f + 1 \; . \end{equation} Using the above in \eqref{CosmoDW2A} we obtain finally: \begin{equation} \xi \sim \frac{U' - 12 -\frac{f''}{\Bar{f}}}{6-U'} \; , \end{equation} which is in general non-vanishing. Note also that: \begin{equation} \frac{f''}{\Bar{f}} = \frac{(\Bar{f}U')'}{\Bar{f}}= U'' + \frac{\Bar{\Bar{f}}}{\Bar{f}}U'^2 \; ; \end{equation} and we can conclude that if $U \rightarrow \infty$ the term $\Bar{\Bar{f}}/\Bar{f} \rightarrow - \infty$, while $U''$ cannot diverge since $0<U'<6$, so in this case the asymptotic effective equation of state $w_{eff} \rightarrow \infty$. On the other hand, if $U \rightarrow const$, we have $U' = U'' \rightarrow 0$ and we are left with $\xi \rightarrow -2$, in such a way that the effective equation of state approaches one of radiation type. We have then shown that in the DW model with the distortion function given by \eqref{fDW} at late-times $w_{eff} \neq -1$. \subsection{Summary and discussion} By studying the Late-times asymptotic equation of state for a number of nonlocal models we realized that the auxiliary localized field related to $\Box^{-1}R$ will diverge asymptotically if we impose vanishing or positive initial conditions. The divergence of the latter in turn will push $H\rightarrow \infty$ while the ratio $H'/H \rightarrow 0$. To summarize, the structure of the source terms of the KG equations implies that only the auxiliary field related to the nonlocal term $1/\Box R$ is still dynamical asymptotically, and diverges, while the auxiliary fields related to the Lagrange multipliers used to localize the theories freeze and approach a constant value. We show how the mechanism works using as an example the $RR$ model and the DW model, since in the latter the divergence of $U$ is hidden in the distortion function $f(U)$, which is regular for $U\rightarrow \infty$. The full computation for the VAAS model and the model proposed in Ref.~\cite{Amendola:2017qge} are reported in Appendix \ref{appendixB}. It is important to remark that our conclusions strongly depend on the choice of initial conditions. Indeed, our method relies on the observation that by using Friedmann equations we can constrain the sign of the auxiliary fields, while their KG equations provide constraint on the sign of the first derivatives for our choice of initial conditions. As an example, let us consider the $RR$ model. If we choose a negative initial condition in Eq.~\eqref{KGRRV} for the field $U$ then $V' >0 $ and Eq.~\eqref{RRasyVV'} does not hold anymore. This situation corresponds to the evolution Path B described in Ref.~\cite{Nersisyan:2016hjh}, for which at late-times $w_{ eff}\rightarrow 1/3$. However, our analysis still holds for any choice of initial conditions with non-vanishing but positive values of $U$. As discussed in Ref.~\cite{Belgacem:2017cqo}, there are fundamental motivations that justify processes during the inflationary epoch that result in a huge non-vanishing positive values for the field $U$ in the RD epoch. It is interesting to note that a behavior of the type $w_{Eff}\rightarrow -1$ is remarkably for a model that wants to be competitive with the $\Lambda$CDM. Indeed, in such models, and in the $\Lambda$CDM, the so called \textit{Coincidence Problem} \cite{Velten:2014nra} is less severe (if not a problem at all, depending on the personal perspective), since at some point of its history, independently of the initial conditions, the Universe always passes through a phase in which the matter and DE densities are of the same order and then DE starts to dominate, which in the standard model in terms of cosmic time accounts for at least the last 3.5 billion years. On the other hand, in the nonlocal models considered here we have to deal with a different sort of coincidence. Indeed, the Hubble function reaches a minimum when the nonlocal fields cosmological density starts to dominate, and the occurrence of this is roughly today. This occurrence looks to us coincidental at least as the one present in $\Lambda$CDM.
\section{Introduction} Psi classes are special divisors that are ubiquitous in the study of the intersection theory of moduli spaces of curves. Psi classes arise naturally when computing products of boundary classes in $A^*(\overline{\mathcal{M}}_{g,n})$ whose strata have excess intersection. In particular, any product of boundary classes can be written in terms of polynomials of psi classes on other boundary classes, and the top degrees of these polynomials are determined by the Witten--Kontsevich theorem \cite{Witten,Kontsevich}. In genus zero, this procedure takes on an especially simple form. Given $k$ distinct boundary divisors $D_1,\dots,D_k\in A^1(\overline{\mathcal{M}}_{0,n})$, their product is also a (possibly empty) boundary class, and any monomial in these boundary divisors can be written as \begin{equation}\label{boundarydivisorproduct} D_1^{d_1}\cdots D_k^{d_k}=D_1\cdots D_k\prod_{i=1}^k(-\psi_{D_i}^--\psi_{D_i}^+)^{d_i-1}\in A^*(\overline{\mathcal{M}}_{0,n}), \end{equation} where $\psi_{D}^{\pm}$ are certain psi classes associated to each divisor $D$. Moreover, if $\sum d_i=\dim(\overline{\mathcal{M}}_{0,n})$, then the degree of the expression in the right-hand side of \eqref{boundarydivisorproduct} is a product of polynomials of psi classes on smaller dimensional moduli spaces, all of which are computable. The aim of this paper is to develop an analogue of these techniques in Chow rings of matroids. Matroids are combinatorial structures that generalize the behavior of finite sets of vectors, and Chow rings of matroids were introduced by Feichtner and Yuzvinsky \cite{FY}. In this work, we explore an appealing parallel between Chow rings of matroids and Chow rings of moduli spaces of curves. \emph{We introduce matroid psi classes in Chow rings of matroids and we show that they behave analogously to the usual psi classes in the Chow rings of moduli spaces of genus zero curves. As a first application, we then use psi classes to give simplified proofs of a number of recent foundational results concerning matroid Chow rings.} \subsection{Summary of results} Given a loopless matroid $\mathsf{M}=(E,\mathcal{L})$ consisting of a finite set $E$ and a lattice of flats $\mathcal{L}\subseteq 2^E$, the Chow ring $A^*(\mathsf{M})$ is a graded $\mathbb{Z}$-algebra generated by matroid divisors $D_F\in A^1(\mathsf{M})$, one for each proper flat $F\in\mathcal{L}^*=\mathcal{L}\setminus\{\emptyset, E\}$ (see Subsection~\ref{sec:matroidbackground} for precise definitions). The primary objects of study in this paper are the following classes. \begin{Definition}[Definition~\ref{def:matroidpsiclass}] For any $F\in\mathcal{L}$ and $e\in E$, define $\psi_F^{\pm}\in A^1(\mathsf{M})$ by \[ \psi_F^-=\sum_{G\in\mathcal{L}^*\atop e\in G}D_G-\sum_{G\in\mathcal{L}^*\atop G\supseteq F}D_G\;\;\;\text{ and }\;\;\;\psi_F^+=\sum_{G\in\mathcal{L}^*\atop e\notin G}D_G-\sum_{G\in\mathcal{L}^*\atop G\subseteq F}D_G. \] \end{Definition} The Chow classes $\psi_F^{\pm}$ do not depend on the choice of $e\in E$, which is why it is suppressed from the notation. As we will see, the definition of matroid psi classes is an immediate generalization of an expression for psi classes in terms of boundary divisors in Losev-Manin moduli spaces (see Lemma~\ref{lem:psilinearcombo}). After defining matroid psi classes, we establish the following analogue of Equation \eqref{boundarydivisorproduct}. \begin{result}[Corollary~\ref{cor:selfintersectionmatroid}] If $F_1,\dots,F_k$ are distinct flats of $\mathsf{M}$ and $d_1,\dots,d_k$ are positive integers, then \[ D_{F_1}^{d_1}\cdots D_{F_k}^{d_k}=D_{F_1}\cdots D_{F_k}\prod_{i=1}^k(-\psi_{F_i}^--\psi_{F_i}^+)^{d_i-1}\in A^*(\mathsf{M}). \] \end{result} This result allows us to express any monomial in matroid divisors as a squarefree expression along with a polynomial in psi classes. In the case that the product is in the top graded piece of the matroid Chow ring, our next result allows us to compute the degrees of the terms in Result B in terms of degrees of the special classes $\psi_0=\psi_{\emptyset}^+$ and $\psi_\infty=\psi_E^-$. \begin{result}[Proposition~\ref{prop:degreeofpsi2}] If $\emptyset=F_0\subsetneq F_1\subsetneq\dots\subsetneq F_{k}\subsetneq F_{k+1}=E$ are flats of $\mathsf{M}$ and $a_0^+,a_1^-,a_1^+,\dots,a_{k}^-,a_k^+,a_{k+1}^-$ are nonnegative integers ,then \[ \deg_\mathsf{M}\Big(D_{F_1}\cdots D_{F_k}\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{a_{i+1}^-}\Big)=\prod_{i=0}^k\deg_{\mathsf{M}[F_i,F_{i+1}]}\Big(\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}\Big) \] \end{result} In the above formula, $\mathsf{M}[F_i,F_{i+1}]$ denotes the contraction by $F_{i}$ of the restriction of $\mathsf{M}$ to $F_{i+1}$. In order to use Results B and C to explicitly compute degrees of polynomials in the generators, we use properties of psi classes to give a new proof of the following result, which had previously been proved by Huh and Katz \cite[Proposition~5.2]{HuhKatz}. \begin{result}[Proposition~\ref{prop:degreeofpsi}] If $\mathsf{M}$ is a matroid and $a,b$ are nonnegative integers, then \[ \deg_\mathsf{M}(\psi_0^a\psi_\infty^b)=\begin{cases} \mu^a(\mathsf{M}) &\text{if }a+b=\mathrm{rk}(\mathsf{M})-1,\\ 0 &\text{else,} \end{cases} \] where $\mu^a(\mathsf{M})$ is the $a$th unsigned coefficient of the reduced characteristic polynomial of $\mathsf{M}$. \end{result} Results B, C, and D provide an efficient algorithm for computing the degree of any monomial of matroid divisors. As a direct consequence of this algorithm, we recover a recent theorem of Eur \cite[Theorem 3.2]{Eur} that computes the coefficients of the volume polynomials of matroids. \begin{result}[Theorem~\ref{thm:eur2}] If $\emptyset=F_0\subsetneq F_1\subsetneq\dots\subsetneq F_{k}\subsetneq F_{k+1}=E$ are flats of $\mathsf{M}$ and $d_1,\dots,d_k$ are positive integers that sum to $\mathrm{rk}(\mathsf{M})-1$, then \[ \deg_\mathsf{M}(D_{F_1}^{d_1}\cdots D_{F_k}^{d_k})=(-1)^{\mathrm{rk}(\mathsf{M})-k-1}\prod_{i=1}^k{d_i-1\choose \tilde d_i-\mathrm{rk}(F_i)}\mu^{\tilde d_i-\mathrm{rk}(F_i)}(\mathsf{M}[F_i,F_{i+1}]), \] with \[ \tilde d_j=\sum_{i=1}^j d_i. \] \end{result} Our developments can also be used to recover a recent theorem of Backman, Eur, and Simpson \cite[Theorem 5.2.4]{BES} that computes degrees of monomials in the ``simplicial'' generators, which, as it turns out, are nothing more than the psi classes $\psi_F^-$. \begin{result}[Theorem~\ref{thm:BES}] If $F_1,\dots,F_r$ are nonempty flats with $r=\mathrm{rk}(\mathsf{M})-1$, then \[ \deg_\mathsf{M}(\psi_{F_1}^-\dots\psi_{F_r}^-)= \begin{cases} 1 &\text{if } 0<i_1<\dots<i_k\leq r\Longrightarrow \mathrm{rk}(F_{i_1}\cup\dots\cup F_{i_k})>k,\\ 0 &\text{else.} \end{cases} \] \end{result} As a final application of our developments, we provide a new proof of Poincar\'e duality for $A^*(\mathsf{M})$, a result that was first proved by Adiprasito, Huh, and Katz \cite[Theorem~6.19]{AHK}. \begin{result}[Theorem~\ref{thm:poincareduality}] Let $\mathsf{M}$ be a matroid of rank $r+1$. Then for any $k\in 0,\dots,r$, we have an isomorphism of $\mathbb{Z}$-modules: \begin{align*} A^k(\mathsf{M})&\rightarrow A^{r-k}(\mathsf{M})^\vee\\ \gamma&\mapsto (\mu\mapsto\deg_\mathsf{M}(\mu\gamma)). \end{align*} \end{result} To prove Result G, we simply use our computational algorithm to show that the transformation is lower triangular when written in terms of a particular ordering of the Feichtner--Yuzvinsky basis (see \cite[Corollary~1]{FY}) for $A^k(\mathsf{M})$ and its dual basis for $A^{r-k}(\mathsf{M})^\vee$, with all diagonal entries equal to $\pm 1$. \subsection{Related work} As should be clear from the discussion above, this work is closely related and indebted to prior contributions of several groups of mathematicians. The matroid psi classes that we introduce in this work are built from two special psi classes: $\psi_0=\psi_\emptyset^+$ and $\psi_\infty=\psi_E^-$. These two classes have already been studied extensively by Adiprasito, Huh, and Katz \cite{AHK}, where they were denoted $\beta$ and $\alpha$, respectively. Furthermore, as we mentioned above, the psi classes $\psi_F^-$ played an integral role in the work of Backman, Eur, and Simpson \cite{BES}, where they were denoted $h_F$. Our choice to use different notation for these classes in this paper simply stems from our goal of highlighting the parallel between Chow rings of matroids and Chow rings of moduli spaces of curves. There is a related notion of ``tropical psi classes'' developed by Kerber and Markwig \cite{KerberMarkwig}---these classes form the tropical analogue of the classical psi classes on $\overline{\mathcal{M}}_{0,n}$. Using the description of $\overline{\mathcal{M}}_{0,n}$ as a wonderful compactification of the complement of the braid arrangement, due to DeConcini and Processi \cite{DP}, tropical psi classes can be interpreted as special elements of Chow rings of braid matroids with minimal building sets. We note that Chow rings of matroids with building sets were defined by Feichtner and Yuzvinsky \cite{FY} and are more general than the matroid Chow rings studied herein, which correspond to the special case of maximal building sets. It would be very interesting to develop a general theory of psi classes associated to matroids with building sets that simultaneously generalizes the matroid psi classes developed in this paper and the tropical psi classes developed by Kerber and Markwig. \subsection{Outline of the paper} Losev-Manin moduli spaces are the setting in which Chow rings of matroids intersect Chow rings of moduli spaces of curves. Because of this, we start this paper with an overview of the definition and key properties of psi classes in Losev-Manin spaces; this is the content of Section~\ref{sec:LMspaces}. We conclude Section~\ref{sec:LMspaces} by using psi classes to recover two known formulas for the volumes of generalized permutahedra, due to Postnikov \cite{Postnikov} and Eur \cite{Eur}. The impetus for this work was the observation that, upon generalizing psi classes to matroids, these proofs work nearly verbatim to compute volume polynomials in the more general matroid context. In Section~\ref{sec:matroidpsi}, we introduce matroid psi classes, prove the natural generalizations of the properties discussed in Section~\ref{sec:LMspaces}, and then we give new proofs of the results of Eur and Backman, Eur and Simpson, generalizing the volume computations from Section~\ref{sec:LMspaces}, and we also give a new proof of Poincar\'e duality. We note that Section~\ref{sec:matroidpsi} is entirely self-contained and the matroid enthusiast may choose to skip Section~\ref{sec:LMspaces}. On the other hand, we hope that the discussion of Losev-Manin spaces will help the reader understand the context and motivation for the definition and development of matroid psi classes, and that this discussion might even motivate the interested combinatorialist to learn a little more about the beautiful subject of Chow rings of moduli spaces of curves. \subsection{Acknowledgements} This paper was born out of the first author's Master's thesis, which was advised by both Federico Ardila and the second author. The authors would like to warmly acknowledge Federico's guidance and contributions to this project. Despite his important influence on this work, Federico generously and graciously decided not to be listed as a coauthor of this paper. The authors would also like to express their gratitude to the Department of Mathematics at San Francisco State University, and especially to Serkan Ho\c{s}ten and Eric Hsu, for their support and leadership during the tumultuous times of the COVID-19 pandemic, during which much of this work was carried out. The second author was supported by a San Francisco State University Presidential Award during Fall 2020, and this work was also supported by a grant from the National Science Foundation (RUI DMS-2001439). \section{Losev-Manin spaces and psi classes}\label{sec:LMspaces} In order to motivate matroid psi classes, we begin with a discussion of psi classes in the setting of Losev-Manin spaces. Our purpose in this section is to describe the key properties of psi classes that are useful in computations in order to motivate the properties that we require upon generalizing psi classes to matroid Chow rings. The results in this section are well-known, so we do not provide complete proofs, only remarking on where the proofs can be found (or derived) in the literature. At the end of this section, we show how psi classes can be used to compute formulas for volumes of generalized permutahedra. All of the definitions and results in this section will be combinatorially generalized to matroid Chow rings in the next section. \subsection{Losev-Manin spaces} Losev-Manin spaces, introduced in \cite{LM}, parametrize collections of points on chains of projective lines. To describe these spaces, let us first establish some terminology. A \emph{chain of projective lines of length $k$} is a complex variety of the form \[ C=C_1\sqcup\dots\sqcup C_k/\sim \] where $C_i=\P^1$ for all $i=1,\dots,k$ and $\sim$ is the relation that identifies $\infty_i=[0:1]\in C_i$ with $0_{i+1}=[1:0]\in C_{i+1}$ to form a node. The projective lines $C_1,\dots,C_k$ are referred to as the \emph{components} of the chain $C$, and we define $0=0_1\in C_1$ and $\infty=\infty_k\in C_k$. Given a chain of projective lines $C$, a configuration of $n$ points $p_1,\dots,p_n\in C$ is called \emph{stable} if $\{p_1,\dots,p_n\}$ is disjoint from $0$, $\infty$, and the nodes of $C$, and if each component of $C$ contains at least one $p_i$. We do not require the points to be distinct. Two stable configurations $(C;p_1,\dots,p_n)$ and $(C';p_1',\dots,p_n')$ are said to be \emph{isomorphic} if there exists an isomorphism of varieties $f:C\rightarrow C'$ such that $f(0)=0$, $f(\infty)=\infty$, and $f(p_i)=p_i'$ for all $i=1,\dots,n$. \begin{definition} For any $n\geq 1$, the \emph{Losev-Manin space $\overline{\mathcal{LM}}_n$} is the set of all stable configurations of $n$ points on chains of projective lines, up to isomorphism. A point in $\overline{\mathcal{LM}}_n$ is an equivalence class $[C,p_1,\dots,p_n]$ where $C$ is a chain of projective lines and $p_1,\dots,p_n\in C$ is a stable configuration of $n$ points. \end{definition} The sets $\overline{\mathcal{LM}}_n$ were first constructed as smooth projective varieties by Losev and Manin \cite{LM}; in fact, they proved that $\overline{\mathcal{LM}}_n$ is the toric variety associated to the $(n-1)$-dimensional permutahedron. In particular, $\overline{\mathcal{LM}}_n$ is a disjoint union of tori, one corresponding to each face of the permutahedron. We now describe those tori explicitly. To every flag of nonempty subsets \[ \mathcal{F}=(\emptyset=F_0\subsetneq F_1\subsetneq \dots\subsetneq F_k\subsetneq F_{k+1}=[n]) \] define a subset of $\overline{\mathcal{LM}}_n$ by \[ \mathbb{T}_\mathcal{F}=\bigg\{[C;p_1,\dots,p_n]\;\bigg|\;{C \text{ has } k+1 \text{ components } C_0,\dots,C_{k} \atop \text{and } p_j\in C_i \text{ if and only if }j\in F_{i+1}\setminus F_{i}}\bigg\}. \] We depict a general element of $\mathbb{T}_\mathcal{F}$ as follows: \begin{center} \tikz{ \draw[thick] (-7,0.1) edge[-,bend right] (-10,1.5); \draw[thick] (-7.5,0.2) edge[-,bend left] (-4,0); \draw[thick] (-2,0) edge[-,bend left] (1.5,0.2); \draw[thick] (1,0.1) edge[-,bend left] (4,1.5); \node [] at (-3,0) {$\boldsymbol{\cdots}$}; \node [] at (-9.5,1.5) {$\bullet$}; \node [] at (-9.5,1.2) {$0$}; \node [] at (-8.75,1.4) {$/$}; \node [] at (-8.25,1.2) {$/$}; \node [] at (-7.85,1) {$/$}; \node [] at (-8.5,0.5) {$F_1\setminus F_0$}; \node [] at (-6.35,0.55) {$\backslash$}; \node [] at (-5.70,0.58) {$|$}; \node [] at (-5.05,0.5) {$/$}; \node [] at (-5.75,0.05) {$F_2\setminus F_1$}; \node [] at (0.35,0.55) {$/$}; \node [] at (-0.5,0.58) {$|$}; \node [] at (-1.35,0.35) {$\backslash$}; \node [] at (-0.40,-0.15) {$F_{k}\setminus F_{k-1}$}; \node [] at (3.5,1.5) {$\bullet$}; \node [] at (3.5,1.2) {$\infty$}; \node [] at (2.75,1.4) {$\backslash$}; \node [] at (2.25,1.2) {$\backslash$}; \node [] at (1.80,0.9) {$\backslash$}; \node [] at (3,0.45) {$F_{k+1}\setminus F_{k}$}; } \end{center} Notice that every element of $\overline{\mathcal{LM}}_n$ is an element of exactly one set of the form $\mathbb{T}_\mathcal{F}$, so the sets $\mathbb{T}_\mathcal{F}$ partition $\overline{\mathcal{LM}}_n$. Moreover each $\mathbb{T}_\mathcal{F}$ is an algebraic torus. To see why, consider a particular $\mathbb{T}_\mathcal{F}$ and choose one point from each set $F_{i+1}\setminus F_{i}$. Notice that there is a unique automorphism of $C$ that maps the chosen point in $F_{i+1}\setminus F_{i}$ to $[1,1]\in C_i$. After fixing this isomorphism, the remaining points in $F_{i+1}\setminus F_{i}$ can vary throughout any point of $C_i$ except $0_i$ and $\infty_i$. It follows that \[ \mathbb{T}_\mathcal{F}=(\mathbb{C}^*)^{|F_1|-|F_0|-1}\times(\mathbb{C}^*)^{|F_2|-|F_1|-1}\dots\times(\mathbb{C}^*)^{|F_{k+1}|-|F_k|-1}=(\mathbb{C}^*)^{n-k-1}. \] The tori $\mathbb{T}_\mathcal{F}$ are not closed subvarieties of $\overline{\mathcal{LM}}_n$, but we may take their closures, which leads to the following important subvarieties. \begin{definition} The \emph{stratum $X_\mathcal{F}\subseteq\overline{\mathcal{LM}}_n$} associated to a flag $\mathcal{F}$ of subsets of $[n]$ is the Zariski closure of the torus $\mathbb{T}_\mathcal{F}$: \[ X_\mathcal{F}=\overline{\mathbb{T}_\mathcal{F}}. \] We say that a subvariety $Z\subseteq\overline{\mathcal{LM}}_n$ is a \emph{stratum} if it is equal to $X_\mathcal{F}$ for some flag $\mathcal{F}$. For a subset $\emptyset\subsetneq F\subsetneq [n]$, we use the shorthand \[ X_F=X_{\emptyset\subsetneq F\subsetneq[n]}. \] \end{definition} Each stratum is, again, a disjoint union of tori. To describe these inclusions, it is useful to introduce the notion of refinements. We say that a flag \[ \mathcal{F}'=(\emptyset\subsetneq F_1'\subsetneq \dots\subsetneq F_\ell'\subsetneq [n]) \] is a refinement of the flag \[ \mathcal{F}=(\emptyset\subsetneq F_1\subsetneq \dots\subsetneq F_k\subsetneq [n]) \] and write $\mathcal{F}'\preceq\mathcal{F}$ if, for every $i\in\{1,\dots,k\}$, there exists some $j\in\{1,\dots,\ell\}$ such that $F_i=F_j'$. With this notion, it can be checked that \[ X_\mathcal{F}=\displaystyle\bigsqcup_{\mathcal{F}'\preceq\mathcal{F}} \mathbb{T}_{\mathcal{F}'}. \] In particular, it follows that $X_{\mathcal{F}_1}\cap X_{\mathcal{F}_2}=X_{\mathcal{F}_3}$ where $\mathcal{F}_3$ is the maximal common refinement of $\mathcal{F}_1$ and $\mathcal{F}_2$ (the intersection is empty if no common refinement exists). \subsection{Chow rings and volumes of generalized permutahedra} The Chow ring of $\overline{\mathcal{LM}}_n$ is well-known and can be expressed as a quotient of the formal polynomial ring generated by $X_F$ with $F$ a proper subset of $[n]$. By general results in toric geometry \cite[Theorem~12.5.3]{Toric}, we have \begin{equation}\label{eq:chowring} A^*(\overline{\mathcal{LM}}_n)=\frac{\mathbb{Z}\big[X_F\;|\;\emptyset \subsetneq F\subsetneq [n]\big]}{\mathcal{I}+\mathcal{J}} \end{equation} where the ideals $\mathcal{I}$ and $\mathcal{J}$ are defined by \[ \mathcal{I}=\big\langle X_FX_G\;|\;F\text{ and }G\text{ are incomparable} \big\rangle \] and \[ \mathcal{J}=\bigg\langle\sum_{i\in F}X_F-\sum_{j\in F}X_F\;\Big|\;i,j\in[n] \bigg\rangle. \] The generators $D_F=[X_F]\in A^1(\overline{\mathcal{LM}}_n)$, are called \emph{boundary divisors}. The Chow ring has a natural grading by codimension \[ A^*(\overline{\mathcal{LM}}_n)=\displaystyle\bigoplus_{k=0}^{n-1}A^k(\overline{\mathcal{LM}}_n) \] and a degree map \[ \deg_{\overline{\mathcal{LM}}_n}:A^{n-1}(\overline{\mathcal{LM}}_n)\rightarrow \mathbb{Z}, \] which is a linear isomorphism uniquely determined by the property that the degree of the class of any point is one. Any divisor $D\in A^1(\overline{\mathcal{LM}}_n)$ can be written in the form \[ D=D(x)=\sum_{\emptyset\subsetneq F\subsetneq [n]}x_FD_F\in A^1(\overline{\mathcal{LM}}_n) \] with $x_F\in\mathbb{Z}$ and, in this setting, $D(x)$ is nef if and only if the numbers $x_F$ are submodular, meaning that, for all $F_1,F_2\subseteq[n]$, we have \begin{equation}\label{eq:submodular} x_{F_1}+x_{F_2}\geq x_{F_1\cap F_2}+x_{F_1\cup F_2}, \end{equation} where, by convention, we always assume $x_\emptyset=x_{[n]}=0$. Given a nef divisor $D(x)$, we consider the corresponding polytope $\Pi_n(x)\subseteq\mathbb{R}^n$ defined by \begin{equation}\label{eq:permhyperplanes} t_1+\dots+t_n=0\;\;\;\text{ and }\;\;\;\sum_{i\in F}{t_i}\leq x_F\;\;\;\text{ for all }\;\;\;\emptyset\subsetneq F\subsetneq [n]. \end{equation} These polytopes were studied under the name of \emph{generalized permutahedra} by Postnikov \cite{Postnikov}, wherein several formulas for their volumes were discovered and proved (see Theorem~\ref{thm:postnikov} below). By standard results in toric geometry (\cite[Theorem 13.4.3]{Toric}), the volumes of generalized permutahedra can also be derived by computations in the Chow ring: \begin{equation}\label{eq:volumepolynomialdivisors} \mathrm{Vol}(\Pi_n(x))=\frac{1}{(n-1)!}\deg_{\overline{\mathcal{LM}}_n}(D(x)^{n-1}). \end{equation} In order to utilize \eqref{eq:volumepolynomialdivisors}, one needs to expand the product $D(x)^{n-1}$, then use relations in $\mathcal{I}$ and $\mathcal{J}$ to write the result as a linear combination of products of the form $D_{F_1}\dots D_{F_{n-1}}$ where the indexing sets form a complete flag \[ \emptyset\subsetneq F_1\subsetneq \dots\subsetneq F_{n-1}\subsetneq [n], \] then use the fact that, for any complete flag, $\deg_{\overline{\mathcal{LM}}_n}(D_{F_1}\dots D_{F_{n-1}})=1$. This process was carried out in the more general matroid context by Eur \cite{Eur}, which led to a new formula for volumes of generalized permutahedra (see Theorem~\ref{thm:eur} below). The heart of Eur's argument is figuring out how to systematically express general products of divisors in terms of products of divisors indexed by complete flags. Phrased another way, the difficulty in this computation is dealing with self-intersections of divisors. In the context of Losev-Manin spaces, there is a useful tool for just this type of self-intersection: psi classes. \subsection{Psi classes on Losev-Manin spaces} To understand the utility of psi classes, it is useful to discuss the multiplicative structure of $A^*(\overline{\mathcal{LM}}_n)$. If $F$ and $G$ are two distinct proper subsets of $[n]$, then the corresponding subvarieties $X_F$ and $X_G$ either intersect transversally, or they don't intersect at all. In particular, if $F$ and $G$ are distinct, then \[ D_FD_G=\begin{cases} [X_{\emptyset\subsetneq F\subsetneq G\subsetneq [n]}] & \text{if } F\subsetneq G,\\ [X_{\emptyset\subsetneq G\subsetneq F\subsetneq [n]}] & \text{if } G\subsetneq F,\\ 0 & \text{ if }F\text{ and }G\text{ are incomparable}. \end{cases} \] More generally, if $F_1,\dots,F_k\subseteq [n]$ are distinct subsets, we have \[ D_{F_1}\cdots D_{F_k}=\begin{cases} [X_\mathcal{F}] & \parbox[]{8cm}{if, after possibly relabeling, $F_1,\dots,F_k$ form a flag $\mathcal{F}=(\emptyset\subsetneq F_1\subsetneq\dots\subsetneq F_k\subsetneq [n])$,}\\ 0 & \text{if }F_i\text{ and }F_j\text{ are incomparable for some }i,j. \end{cases} \] For convenience, for any flag $\mathcal{F}=(\emptyset\subsetneq F_1\subsetneq\dots\subsetneq F_k\subsetneq [n])$, we define \[ D_\mathcal{F}=[X_\mathcal{F}]=D_{F_1}\dots D_{F_k}\in A^k(\overline{\mathcal{LM}}_n). \] The main question, then, is: How do we multiply divisors when they are not all indexed by distinct subsets? This is where psi classes are useful. In the setting of Losev-Manin spaces, there are two basic psi classes upon which the others are built. \begin{definition} Let $n\geq 1$. The \emph{psi class} $\psi_0\in A^1(\overline{\mathcal{LM}}_n)$ is the first Chern class of the line bundle $\mathbb{L}_0$, whose fiber over a point $[C,p_1,\dots,p_n]\in\overline{\mathcal{LM}}_n$ is the cotangent line of $C$ at $0$. The psi class $\psi_\infty\in A^1(\overline{\mathcal{LM}}_n)$ is the first Chern class of the line bundle $\mathbb{L}_\infty$, whose fiber over a point $[C,p_1,\dots,p_n]\in\overline{\mathcal{LM}}_n$ is the cotangent line of $C$ at $\infty$. \end{definition} A more combinatorial characterization of psi classes, which will be our starting point for the matroid generalization, appears in Lemma~\ref{lem:psilinearcombo} below. To understand why the psi classes are useful for computing self-intersections, we require a bit of additional notation. For a finite set $F$, let $\overline{\mathcal{LM}}_F$ denote the Losev-Manin space with marked points indexed by $F$. Of course, $\overline{\mathcal{LM}}_{[n]}=\overline{\mathcal{LM}}_n$. If $|F|>2$, then for each $i\in F$, there is a \emph{forgetful map} \[ f_i:\overline{\mathcal{LM}}_F\rightarrow\overline{\mathcal{LM}}_{F\setminus\{i\}}. \] For each point $[C;(p_j)_{j\in F}]\in\overline{\mathcal{LM}}_F$, the function $f_i$ forgets the marked point $p_i$ and then, if the component that contained $p_i$ no longer has any marked points, it contracts that entire component to a single point. The second step is necessary in order to insure that the image of $f$ is a stable configuration. More generally, if $\emptyset\subsetneq G\subseteq F$, then there is a forgetful map \[ r_G:\overline{\mathcal{LM}}_F\rightarrow\overline{\mathcal{LM}}_G. \] To define this map, label the points $F\setminus G=\{i_1,\dots,i_k\}$ and define \[ r_G=f_{i_1}\circ\dots\circ f_{i_k}. \] In other words, $r_G$ forgets the points that are not in $G$. We use the letter $r$ for ``remember'' because the map $r_G$ remembers the points in the index set $G$. It follows from the definition that the order of the composition in the definition of $r_G$ is irrelevant, and if $\emptyset\subsetneq G_1\subseteq G_2\subseteq F$, then \begin{equation}\label{eq:composerememberpsi} r_{G_1}=r_{G_1}\circ r_{G_2}. \end{equation} Using the forgetful maps, we obtain a more general set of psi classes. \begin{definition}\label{def:generalpsi} For $n\geq 1$ and $\emptyset\subseteq F\subseteq [n]$, define classes $\psi_F^-,\psi_F^+\in A^1(\overline{\mathcal{LM}}_n)$ by \[ \psi_F^-=r_F^*(\psi_\infty)\;\;\;\text{ and }\;\;\;\psi_F^+=r_{F^c}^*(\psi_0), \] where $r_F^*$ is the pullback of $r_F:\overline{\mathcal{LM}}_n\rightarrow\overline{\mathcal{LM}}_F$ and $F^c=[n]\setminus F$. \end{definition} Notice that $\psi_0=\psi_{\emptyset}^+$ and $\psi_\infty=\psi_{[n]}^-$. The reason we introduce psi classes is because they naturally arise when self-intersecting divisors in the following way. \begin{lemma}\label{lem:selfintersection} If $F$ is a proper subset of $[n]$, then \[ D_F^2=D_F(-\psi_F^--\psi_F^+)\in A^2(\overline{\mathcal{LM}}_n). \] \end{lemma} \begin{proof}[Proof sketch] This follows from the observation (see, for example, \cite[Lemma 25.2.2]{Mirror}) that the normal bundle of $X_F$ in $\overline{\mathcal{LM}}_n$ is \[ g_F^*(r_F^*(\mathbb{L}_\infty^\vee)\otimes r_{F^c}^*(\mathbb{L}_0^\vee)), \] where $g_F:X_F\rightarrow\overline{\mathcal{LM}}_n$ is the inclusion. \end{proof} In particular, Lemma~\ref{lem:selfintersection} allows us to compute any product of boundary divisors in terms of psi classes. We have the following immediate corollary. \begin{corollary}\label{cor:intersectdivisors} If $F_1,\dots,F_k\subseteq [n]$ are distinct proper subsets and $d_1,\dots,d_k$ are positive integers, then \[ D_{F_1}^{d_1}\cdots D_{F_k}^{d_k}=\begin{cases} D_\mathcal{F}\displaystyle\prod_{i=1}^k(-\psi_{F_i}^--\psi_{F_i}^+)^{d_i-1} & \parbox[]{8cm}{if, after possibly relabeling, $F_1,\dots,F_k$ form a flag $\mathcal{F}=(\emptyset\subsetneq F_1\subsetneq\dots\subsetneq F_k\subsetneq [n])$,}\\ 0 & \text{if }F_i\text{ and }F_j\text{ are incomparable for some }i,j. \end{cases} \] \end{corollary} In order to utilize psi classes in the volume computation of Equation~\ref{eq:volumepolynomialdivisors}, it remains to understand how to compute the degree of expressions of the form in Corollary~\ref{cor:intersectdivisors}. The next result reduces these computations to computing degrees of monomials in $\psi_0$ and $\psi_\infty$. \begin{lemma}\label{lem:product} If $\mathcal{F}=(\emptyset = F_0\subsetneq F_1\subsetneq\dots\subsetneq F_k\subsetneq F_{k+1}=[n])$ is a flag of subsets and $a_0^+,a_1^-,a_1^+,\dots,a_{k}^-,a_k^+,a_{k+1}^-$ are nonnegative integers, then \[ \deg_{\overline{\mathcal{LM}}_n}\bigg(D_\mathcal{F}\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{a_{i+1}^-}\bigg)=\prod_{i=0}^{k}\deg_{\overline{\mathcal{LM}}_{F_{i+1}\setminus F_i}}\big(\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}\big). \] \end{lemma} Pictorially, we think of the psi classes $\psi_{F_i}^\pm$ as being associated to the left and right side of the node indexed by $F_i$: \begin{center} \tikz{ \draw[thick] (-7,0.1) edge[-,bend right] (-10,1.5); \draw[thick] (-7.5,0.2) edge[-,bend left] (-4,0); \draw[thick] (-2,0) edge[-,bend left] (1.5,0.2); \draw[thick] (1,0.1) edge[-,bend left] (4,1.5); \node [] at (-3,0) {$\boldsymbol{\cdots}$}; \node [] at (-9.5,1.5) {$\bullet$}; \node [] at (-9.5,1.2) {$0$}; \node [] at (-8.75,1.4) {$/$}; \node [] at (-8.25,1.2) {$/$}; \node [] at (-7.85,1) {$/$}; \node [] at (-8.5,0.5) {$F_1\setminus F_0$}; \node [] at (-6.35,0.55) {$\backslash$}; \node [] at (-5.70,0.58) {$|$}; \node [] at (-5.05,0.5) {$/$}; \node [] at (-5.75,0.05) {$F_2\setminus F_1$}; \node [] at (0.35,0.55) {$/$}; \node [] at (-0.5,0.58) {$|$}; \node [] at (-1.35,0.35) {$\backslash$}; \node [] at (-0.40,-0.15) {$F_{k}\setminus F_{k-1}$}; \node [] at (3.5,1.5) {$\bullet$}; \node [] at (3.5,1.2) {$\infty$}; \node [] at (2.75,1.4) {$\backslash$}; \node [] at (2.25,1.2) {$\backslash$}; \node [] at (1.80,0.9) {$\backslash$}; \node [] at (3,0.45) {$F_{k+1}\setminus F_{k}$}; \node [] at (-9.5,2.5) {$\psi_{F_0}^+$}; \draw[thick] (-9.5,2.2) edge[->,bend left] (-9.35,1.6); \node [] at (-7.5,2) {$\psi_{F_1}^-$}; \node [] at (-6.5,1.7) {$\psi_{F_1}^+$}; \draw[thick] (-7.5,1.7) edge[->,bend left] (-7.4,.7); \draw[thick] (-6.7,1.4) edge[->,bend right] (-7,.6); \node [] at (.5,1.7) {$\psi_{F_k}^-$}; \node [] at (1.3,2) {$\psi_{F_k}^+$}; \draw[thick] (.6,1.35) edge[->,bend left] (.96,.6); \draw[thick] (1.3,1.7) edge[->,bend right] (1.35,.7); \node [] at (3.5,2.5) {$\psi_{F_{k+1}}^-$}; \draw[thick] (3.4,2.2) edge[->,bend right] (3.35,1.6); } \end{center} The products in Lemma~\ref{lem:product} are over all of the components of the curves, which should help explain the indices in the products. \begin{proof}[Proof sketch of Lemma~\ref{lem:product}] Let $g_\mathcal{F}: X_\mathcal{F}\rightarrow \overline{\mathcal{LM}}_n$ be the inclusion. By the projection formula, \begin{equation}\label{eq:degreeproduct} \deg_{\overline{\mathcal{LM}}_n}\bigg(D_\mathcal{F}\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{a_{i+1}^-}\bigg)=\deg_{X_\mathcal{F}}\bigg(g_\mathcal{F}^*\bigg(\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{a_{i+1}^-}\bigg)\bigg) \end{equation} Notice that \[ X_\mathcal{F}=\prod_{i=0}^{k}\overline{\mathcal{LM}}_{F_{i+1}\setminus{F_{i}}}. \] If $p_i:X_\mathcal{F}\rightarrow\overline{\mathcal{LM}}_{F_{i+1}\setminus{F_{i}}}$ is the projection onto the $i$th component of this product, then \[ g_\mathcal{F}^*(\psi^+_{F_{i}})=p_{i}^*(\psi_0) \;\;\;\text{ and }\;\;\; g_\mathcal{F}^*(\psi^-_{F_{i+i}})=p_{i}^*(\psi_\infty). \] Thus, the degree in the right-hand side of \eqref{eq:degreeproduct} can be computed as a product of degrees on each factor: \begin{align*} \deg_{X_\mathcal{F}}\bigg(g_\mathcal{F}^*\bigg(\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{a_{i+1}^-}\bigg)\bigg) &=\deg_{X_\mathcal{F}}\bigg(\prod_{i=0}^{k}p_i^*\Big(\psi_0^{a_{i-1}^+}\psi^{a_i^-}_\infty\Big)\bigg)\\ &=\prod_{i=0}^{k}\deg_{\overline{\mathcal{LM}}_{F_{i+1}\setminus F_{i}}}\Big(\psi_0^{a_{i}^+}\psi^{a_{i+1}^-}_\infty\Big).\qedhere \end{align*} \end{proof} Lastly, we simply need to know how to compute degrees of monomials in $\psi_0$ and $\psi_\infty$. The next result accomplishes that. \begin{lemma}\label{lem:degreeofpsi} If $n>1$ and $a$ and $b$ are nonnegative integers, then \[ \deg_{\overline{\mathcal{LM}}_n}(\psi_0^{a}\psi_\infty^{b})={n-1 \choose a,b}, \] where, for any nonnegative integers $k,\ell,m$, \[ {m\choose k,\ell}= \begin{cases} {m\choose k}={m\choose \ell}=\frac{m!}{k!\ell!} &\text{if }k+\ell=m,\\ 0&\text{else.} \end{cases} \] \end{lemma} \begin{proof}[Proof sketch] To our knowledge, this exact result is not stated in the literature anywhere. However, it is well known and follows, using the results of \cite{AG}, from the same arguments used to compute degrees of monomials of psi classes on $\overline{\mathcal{M}}_{0,n}$ (see \cite[Section 25.2]{Mirror}). In the specific setting of $\overline{\mathcal{LM}}_n$, this result is given as Exercise 52 in \cite{Cavalieri}. \end{proof} The combination of the previous three results tell us everything we need to know about effectively computing degrees of products of boundary divisors, such as those that appear in the right-hand side of \eqref{eq:volumepolynomialdivisors}. We illustrate such a computation in the next example. \begin{example} Let $n=7$ and consider the sets \[ F_1=\{1,2\},\;\;\; F_2=\{1,2,3,4,5\},\;\;\;\text{ and }\;\;\; F_3=\{1,2,3,4,5,6\}. \] Let us compute $\deg_{\overline{\mathcal{LM}}_7}(D_{F_1}^3D_{F_2}^2D_{F_3})$. By Corollary~\ref{cor:intersectdivisors}, we have \[ D_{F_1}^3D_{F_2}^2D_{F_3}=D_{F_1}D_{F_2}D_{F_3}(-\psi_{F_1}^--\psi_{F_1}^+)^2(-\psi_{F_2}^--\psi_{F_2}^+). \] Expanding the polynomial, we obtain \[ -D_{F_1}D_{F_2}D_{F_3}\Big((\psi_{F_1}^-)^2\psi_{F_2}^-+2\psi_{F_1}^-\psi_{F_1}^+\psi_{F_2}^-+(\psi_{F_1}^+)^2\psi_{F_2}^-+(\psi_{F_1}^-)^2\psi_{F_2}^++2\psi_{F_1}^-\psi_{F_1}^+\psi_{F_2}^++(\psi_{F_1}^+)^2\psi_{F_2}^+\Big). \] Using Lemmas~\ref{lem:product} and \ref{lem:degreeofpsi}, we see that the degree of the first monomial is zero, because the first term in the product of binomials is \[ {2-0-1\choose 0,2}={1\choose 0,2}=0. \] By a similar argument, the degree is zero on all of the monomials except for the second one. The degree of the second monomial is \begin{align*} \deg\Big(-D_{F_1}D_{F_2}D_{F_3}2\psi_{F_1}^-\psi_{F_1}^+\psi_{F_2}^-\Big)&=-2{2-0-1\choose 0,1}{5-2-1\choose 1,1}{6-5-1\choose 0,0}{7-6-1\choose 0,0}\\ &=-2(1)(2)(1)(1)=-4. \end{align*} Thus, we conclude that $\deg_{\overline{\mathcal{LM}}_7}(D_{F_1}^3D_{F_2}^2D_{F_3})=-4.$ \end{example} Since our ultimate goal is to generalize psi classes to the combinatorial setting of matroids, we present one final result, which characterizes the psi classes as linear combinations of boundary divisors. \begin{lemma}\label{lem:psilinearcombo} For any subset $F\subseteq [n]$ and any $i\in[n]$, \[ \psi_F^-=\sum_{\emptyset\subsetneq G\subsetneq[n]\atop i\in G} D_G-\sum_{\emptyset\subsetneq G\subsetneq[n]\atop G\supseteq F}D_G\;\;\;\text{ and }\;\;\;\psi_F^+=\sum_{\emptyset\subsetneq G\subsetneq[n]\atop i\notin G} D_G-\sum_{\emptyset\subsetneq G\subsetneq[n]\atop G\subseteq F}D_G. \] In particular, taking $F=\emptyset$ and $F=[n]$, respectively, we obtain \[ \psi_0=\sum_{\emptyset\subsetneq G\subsetneq[n]\atop i\notin G} D_G\;\;\;\text{ and }\;\;\;\psi_\infty=\sum_{\emptyset\subsetneq G\subsetneq[n] \atop i\in G} D_G. \] \end{lemma} \begin{proof}[Proof sketch] The formulas for $\psi_0$ and $\psi_\infty$ follow from repeated application of the comparison lemma: \[ f_i^*(\psi_0)=\psi_0+D_{\{i\}}\;\;\;\text{ and } f_i^*(\psi_\infty)=\psi_\infty+D_{\{i\}^c}, \] and the fact that $\psi_0=\psi_\infty=0\in A^*(\overline{\mathcal{LM}}_{\{i\}})$. See \cite[Theorem 5.8]{AG} or \cite[Lemma 10]{Cavalieri} for a discussion of the comparison lemma in the setting of Losev-Manin spaces. The formulas for $\psi_F^{\pm}$ then follow from their definition in terms of forgetful maps along with the observation that \[ r_F^*(D_G)=\sum_{\emptyset\subsetneq G'\subsetneq [n]\atop G\subseteq G'\subseteq G\cup F^c}D_{G'}.\qedhere \] \end{proof} We now illustrate the utility of psi classes by showing how the results reviewed above lead to new proofs of two previously-known formulas for volumes of generalized permutahedra. \subsection{Psi classes and Eur's volume formula} Eur recently proved the following formula for volumes of generalized permutahedra. \begin{theorem}[\cite{Eur} Proposition 4.2]\label{thm:eur} If $\{x_F\in\mathbb{Z}\;|\;\emptyset\subsetneq F\subsetneq [n]\}$ is submodular, then \[ \mathrm{Vol}(\Pi_n(x))=\frac{1}{(n-1)!}\sum_{F_1,\dots,F_{k}\atop d_1,\dots,d_k}(-1)^{n-k-1}{n-1\choose d_1,\dots,d_k}\prod_{i=1}^k{d_i-1\choose\tilde d_i-|F_i|}{|F_{i+1}|-|F_i|-1\choose \tilde d_i-|F_i|}x_{F_i}^{d_i} \] where the sum is over flags of subsets $\emptyset\subsetneq F_1\subsetneq\dots\subsetneq F_k\subsetneq F_{k+1}=[n]$ and positive integers $d_1,\dots,d_k$ such that $d_1+\dots+d_k=n-1$, and the numbers $\tilde d_j$ are defined by \[ \tilde d_j=\sum_{i=1}^j d_i. \] \end{theorem} In fact, Eur generalized and proved this formula in a more general matroid setting, which we will discuss in the next section. For now, let us give a short proof of Theorem~\ref{thm:eur} using psi classes. \begin{proof} Applying \eqref{eq:volumepolynomialdivisors}, we have \begin{align*} \mathrm{Vol}(\Pi_n(x))&=\frac{1}{(n-1)!}\deg\left(\bigg(\displaystyle\sum_{\emptyset\subsetneq F\subsetneq [n]}x_FD_F\bigg)^{n-1}\right)\\ &=\frac{1}{(n-1)!}\sum_{F_1,\dots,F_k \atop d_1,\dots,d_k} {n-1 \choose d_1,\dots,d_k}\deg(D_{F_1}^{d_1}\dots D_{F_k}^{d_k})x_{F_1}^{d_1}\dots x_{F_k}^{d_k}, \end{align*} where the sum is over $k$-tuples of distinct proper subsets $\emptyset\subsetneq F_1,\dots,F_k\subsetneq [n]$ and positive integers $d_1,\dots,d_k$ that sum to $n-1$. Since $D_{F_1}\cdots D_{F_k}=0$ when the indexing sets cannot be rearranged into a flag, we can restrict the sum to be over all flags of subsets of the form $\mathcal{F}=(\emptyset\subsetneq F_1\subsetneq\dots\subsetneq F_k\subsetneq F_{k+1}=[n])$. For such a flag, we may apply Corollary~\ref{cor:intersectdivisors} to obtain \begin{align*} \deg(D_{F_1}^{d_1}\dots D_{F_k}^{d_k})&=\deg\Big(D_\mathcal{F}\prod_{i=1}^k(-\psi_{F_i}^--\psi_{F_i}^+)^{d_i-1}\Big)\\ &=\deg\Bigg(D_\mathcal{F}(-1)^{n-k-1}\sum_{a_i^-,a_i^+}\prod_{i=1}^k{d_i-1 \choose a_i^-,a_i^+}(\psi_{F_i}^-)^{a_i^-}(\psi_{F_i}^+)^{a_i^+} \Bigg)\\ &=(-1)^{n-k-1}\sum_{a_i^-,a_i^+}\prod_{i=1}^k{d_i-1 \choose a_i^-,a_i^+}\deg\Big(D_\mathcal{F}\prod_{i=1}^k(\psi_{F_i}^-)^{a_i^-}(\psi_{F_i}^+)^{a_i^+} \Big). \end{align*} If we now use Lemmas~\ref{lem:product} and \ref{lem:degreeofpsi} to compute the degree, we obtain \[ \deg(D_{F_1}^{d_1}\dots D_{F_k}^{d_k})=(-1)^{n-k-1}\sum_{a_i^-,a_i^+}\prod_{i=1}^k{d_i-1 \choose a_i^-,a_i^+}\prod_{i=0}^{k}{|F_{i+1}|-|F_{i}|-1. \choose a_{i}^+,a_{i+1}^-}, \] where $a_0^+=a_{k+1}^-=0$. In order for the two sets of binomials to be nonzero, there are two systems of equations that $a_i^-$ and $a_i^+$ must satisfy: \[ a_i^-+a_i^+=d_i-1\;\;\;\text{ for all }i=1,\dots,k \] and \[ a_{i}^++a_{i+1}^-=|F_{i+1}|-|F_{i}|-1\;\;\;\text{ for all }i=0,\dots,k. \] Along with the conditions $a_0^+=a_{k+1}^-=0$, there is a unique solution given by \[ a_i^+=\tilde d_i-|F_{i}|\;\;\;\text{ for all }i=1,\dots,k. \] It follows that \[ \deg(D_{F_1}^{d_1}\dots D_{F_k}^{d_k})=(-1)^{n-k-1}\prod_{i=1}^k{d_i-1 \choose \tilde d_i -|F_i|}\prod_{i=0}^{k}{|F_{i+1}|-|F_{i}|-1. \choose \tilde d_{i}-|F_{i}|} \] Eur's formula then follows by noticing that the $i=0$ term in the second product is one. \end{proof} \subsection{Psi classes and Postnikov's volume formula} A different formula for the volumes of generalized permutahedra had previous been proved by Postnikov \cite{Postnikov}. In order to set up Postnikov's formula, we require a little more notation. For any nonempty subset $F\subseteq [n]$, define a corresponding simplex \[ \Delta_F=\mathrm{Conv}\{e_i:i\in F\}\subseteq\mathbb{R}^n. \] If $y_F$ is a nonnegative real number for every nonempty subset $F\subseteq [n]$, then Postnikov observed (\cite[Proposition 6.2]{Postnikov}) that the polytope \[ \Pi^\Delta_n(y)=\sum_{\emptyset\subsetneq F\subseteq [n]}y_F\Delta_F, \] where the sum denotes Minkowski summation, consists of all points $(t_1,\dots,t_n)\in\mathbb{R}^n$ such that: \[ t_1+\dots+t_n=z_{[n]}\;\;\;\text{ and }\;\;\;\sum_{i\in F}t_i\geq z_F\;\;\;\text{ for all }\;\;\;\emptyset\subsetneq F\subsetneq [n]. \] where $z_F$ and $y_F$ are related by the invertible linear transformation \[ z_F=\sum_{G\subseteq F} y_G. \] Under the transformation $(t_1,\dots,t_n)\mapsto(z_{[n]}-t_1,-t_2,\dots,-t_n)$, notice that $\Pi_n^\Delta(y)$ is identified with $\Pi_n(x)$ (introduced in Equation \eqref{eq:permhyperplanes}), where for any proper subset $\emptyset\subsetneq F\subsetneq [n]$, the variables $x_F$ and $y_F$ are related by \[ x_F=\begin{cases} -z_F=-\displaystyle\sum_{G\subseteq F} y_G & \text{if }1\notin F,\\ z_{[n]}-z_F=\displaystyle\sum_{G\subseteq[n]}y_G-\displaystyle\sum_{G\subseteq F} y_G&\text{if }1\in F. \end{cases} \] In addition, it can be checked that, when $y_F\geq 0$ for all nonempty subsets $F$, the corresponding numbers $x_F$ are submodular, in the sense of \eqref{eq:submodular}, meaning that the intersection-theoretic formula \eqref{eq:volumepolynomialdivisors} is valid. Postnikov proved the following formula for the volume of $\Pi_n^\Delta(y)$, which, by polynomiality of volumes, determines the volume for all generalized permutahedra (this last statement is carefully worked out by Ardila, Benedetti, and Doker \cite{ABD}). \begin{theorem}[\cite{Postnikov} Corollary 9.4]\label{thm:postnikov} If $y_G\geq 0$ for all nonempty subsets $G\subseteq [n]$, then \[ \mathrm{Vol}(\Pi_n^\Delta(y))=\frac{1}{(n-1)!}\sum_{G_1,\dots,G_{n-1}}y_{G_1}\cdots y_{G_{n-1}}, \] where the sum is over collections of nonempty subsets $G_1,\dots,G_{n-1}\subseteq [n]$ such that, for any $0<i_1<\dots<i_k<n$, we have \[ |G_{i_1}\cup\dots\cup G_{i_k}|>k. \] \end{theorem} \begin{proof} Let us prove this formula using psi classes. By Equation \eqref{eq:volumepolynomialdivisors}, we have \[ \mathrm{Vol}(\Pi_n^\Delta(y))=\frac{1}{(n-1)!}\deg\left(\bigg(\displaystyle\sum_{\emptyset\subsetneq F\subsetneq [n]}x_FD_F\bigg)^{n-1}\right). \] Applying the change of variables above, notice that \begin{align*} \displaystyle\sum_{\emptyset\subsetneq F\subsetneq [n]}x_FD_F&=-\displaystyle\sum_{\emptyset\subsetneq F\subsetneq [n] \atop 1\notin F}\Big(\displaystyle\sum_{G\subseteq F} y_G \Big)D_F+\displaystyle\sum_{\emptyset\subsetneq F\subsetneq [n]\atop 1\in F}\Big(\displaystyle\sum_{G\subseteq[n]}y_G-\displaystyle\sum_{G\subseteq F} y_G\Big)D_F\\ &=\sum_{\emptyset\subsetneq G\subseteq [n]}y_G\Big(-\sum_{F\supseteq G\atop 1\notin F}D_F+\sum_{F\subseteq [n]\atop 1\in F}D_F-\sum_{F\supseteq G\atop 1\in F}D_F\Big)\\ &=\sum_{\emptyset\subsetneq G\subseteq [n]}y_G\Big(\sum_{F\subseteq [n]\atop 1\in F}D_F-\sum_{F\supseteq G}D_F\Big)\\ &=\sum_{\emptyset\subsetneq G\subseteq [n]}y_G\psi_G^-, \end{align*} where the last equality follows from Lemma~\ref{lem:psilinearcombo}. Thus, Postnikov's formula can be reinterpreted as an intersection-theoretic property of psi classes. In particular, Postnikov's formula is equivalent to the statement that \begin{equation}\label{eq:postnikovpsi} \deg(\psi_{G_1}^-\dots\psi_{G_{n-1}}^-)= \begin{cases} 1 &\text{if } 0<i_1<\dots<i_k<n\Longrightarrow |G_{i_1}\cup\dots\cup G_{i_k}|>k,\\ 0 &\text{else.} \end{cases} \end{equation} To prove \eqref{eq:postnikovpsi}, we start by proving the second case. Suppose that there exists some $0<i_1<\dots<i_k<n$ such that \[ G=G_{i_1}\cup\dots\cup G_{i_k} \] has at most $k$ elements. By virtue of Equation~\eqref{eq:composerememberpsi}, notice that \begin{align*} \psi_{G_{i_1}}^-\dots \psi_{G_{i_k}}^-&=r_{G_{i_1}}^*(\psi_\infty)\cdots r_{G_{i_k}}^*(\psi_\infty)\\ &=r_G^*(r_{G_{i_1}}^*(\psi_\infty)\cdots r_{G_{i_k}}^*(\psi_\infty)). \end{align*} Notice that the argument of $r_G^*$ in the final expression is an element of $A^k(\overline{\mathcal{LM}}_G)$, which is zero because $\dim(\overline{\mathcal{LM}}_G)=|G|-1$, which we have assume to be strictly less than $k$. Next, to prove the first case of \eqref{eq:postnikovpsi}, suppose that $0<i_1<\dots<i_k<n$ implies $|G_{i_1}\cup\dots\cup G_{i_k}|>k$. Applying Lemma~\ref{lem:psilinearcombo}, notice that \begin{align*} \psi_{G_1}^-\cdots\psi_{G_{n-1}}^-&=\Big(\psi_\infty-\sum_{F\supseteq G_{i_1}}D_F\Big)\cdots\Big(\psi_\infty-\sum_{F\supseteq G_{i_{n-1}}}D_F\Big)\\ &=\sum_{k=0}^{n-1}\psi_\infty^{n-1-k}(-1)^k\sum_{0<i_1<\dots<i_k<n \atop F_j\supseteq G_{i_j}}D_{F_1}\cdots D_{F_k}. \end{align*} We claim that the only nonzero term in the sum is the one indexed by $k=0$. To verify this, notice that multiplying $D_{F_1}\cdots D_{F_k}$ will either be zero or a multiple of $D_\mathcal{F}$ for some flag $\mathcal{F}$. In the latter case, notice that the largest set in the flag $\mathcal{F}$ must be $F=F_1\cup\cdots\cup F_k$, which contains $G_{i_1}\cup\dots\cup G_{i_k}$. This implies that $F$ has more than $k$ elements, showing that $n-|F|-1<n-k-1$. It then follows that \[ \deg(\psi_\infty^{n-k-1}D_{F_1}\dots D_{F_k})=0 \] because, using Lemmas~\ref{lem:product}, it contains a factor of \[ \deg_{\overline{\mathcal{LM}}_{[n]\setminus F}}\big(\psi_0^{a}\psi_\infty^{n-k-1}\big)=0. \] Thus, the only nonzero term in the sum is the one indexed by $k=0$, in which case we compute \[ \deg(\psi_\infty^{n-1})=1.\qedhere \] \end{proof} \section{Matroid psi classes}\label{sec:matroidpsi} We now describe a generalization of psi classes from Losev-Manin spaces to the matroid setting. We then use matroid psi classes to give new proofs of formulas for volume polynomials of matroids, and we use them to give a constructive proof of Poincar\'e duality. \subsection{Matroid basics}\label{sec:matroidbackground} Before discussing matroid psi classes, we begin by introducing the relevant matroid background and terminology. \subsubsection{Definitions} A \emph{matroid} $\mathsf{M}=(E,\mathcal{L})$ consists of a finite set $E$, called the \emph{ground set}, and a collection of subsets $\mathcal{L}=\mathcal{L}_\mathsf{M}\subseteq 2^E$, called \emph{flats}, which satisfy the following two conditions: \begin{enumerate} \item if $F_1,F_2$ are flats, then $F_1\cap F_2$ is a flat, and \item if $F$ is a flat, then every element of $E\setminus F$ is contained in exactly one flat that is minimal among the flats that strictly contain $F$. \end{enumerate} Given a matroid $\mathsf{M}=(E,\mathcal{L})$, the set $\mathcal{L}$ is partially ordered by set inclusion. Furthermore, given any subset $S\subseteq E$, it follows from Property (1) that there is a minimal flat containing $S$, called the \emph{closure} of $S$ and denoted $\mathrm{cl}(S)\in\mathcal{L}$. Defining the \emph{join} ($\vee$) of two flats to be the closure of their union and the \emph{meet} ($\wedge$) of two flats to be their intersection, it follows from the definitions that the flats $\mathcal{L}$ form a lattice, called the \emph{lattice of flats} of $\mathsf{M}$. A subset $I\subseteq E$ is called \emph{independent} if, for any $I_1\subsetneq I_2\subseteq I$, we have $\mathrm{cl}(I_1)\subsetneq\mathrm{cl}(I_2)$. The \emph{rank} of a subset $S\subseteq E$, denoted $\mathrm{rk}(S)$, is the size of its largest independent subset. The rank of $\mathsf{M}$ is defined as the rank of $E$. An alternative characterization of the rank of flats is given by lengths of flags. In particular, the number of nonempty flats in a flag \[ \mathcal{F}=(\emptyset\subsetneq F_1\subsetneq F_2\subsetneq\cdots\subsetneq F_\ell) \] is called the \emph{length} of the flag, denote $\ell(\mathcal{F})$, and it can be checked from the above definitions that every maximal flag of flats contained in a flat $F$ has length equal to $\mathrm{rk}(F)$. There are several important types of elements in a matroid $\mathsf{M}=(E,\mathcal{L})$. A \emph{loop} of $\mathsf{M}$ is an element $e\in E$ such that $\mathrm{rk}(\{e\})=0$, and a \emph{coloop} of $\mathsf{M}$ is an element $e\in E$ such that $\{e\}^c\in\mathcal{L}$. Two elements $e,f\in E$ are said to be \emph{parallel} if $\mathrm{rk}(\{e\})=\mathrm{rk}(\{f\})=\mathrm{rk}(\{e,f\})$. A matroid without loops is called \emph{loopless} and a matroid without loops or parallel elements is called \emph{simple}. In other words, a loopless matroid is one for which the empty set is a flat, and a simple matroid is one for which, in addition, each rank-one flat is a singleton. \subsubsection{Matroid constructions} Given a matroid $\mathsf{M}=(E,\mathcal{L})$ and a subset $S\subseteq E$, there are several important ways to construct related matroids. The \emph{restriction} of $\mathsf{M}$ to $S$, denoted $\mathsf{M}|_S$, is the matroid on ground set $S$ with flats \[ \mathcal{L}_{\mathsf{M}|_S}=\{F\cap S\;|\; F\in\mathcal{L}_\mathsf{M}\}. \] The \emph{contraction} of $\mathsf{M}$ by $S$, denoted $\mathsf{M}/S$ is the matroid on ground set $E\setminus S$ with flats \[ \mathcal{L}_{\mathsf{M}/S}=\{F\setminus S\;|\;F\in\mathcal{L}_\mathsf{M}\text{ and }S\subseteq F\}. \] Lastly, the \emph{deletion} of $\mathsf{M}$ by $S$, denoted $\mathsf{M}\setminus S$, is the restriction of $\mathsf{M}$ to $E\setminus S$: \[ \mathsf{M}\setminus S=\mathsf{M}|_{E\setminus S}. \] If $F,G\in\mathcal{L}_\mathsf{M}$, then we introduce the notation $\mathsf{M}[F,G]=(\mathsf{M}|_G)/F$. By definition, $\mathsf{M}[F,G]$ is the matroid of rank $\mathrm{rk}(G)-\mathrm{rk}(F)$ on the ground set $G\setminus F$ with flats \[ \mathcal{L}_{\mathsf{M}[F,G]}=\{H\setminus F\;|\;H\in\mathcal{L}_\mathsf{M},\;F\subseteq H\subseteq G\}. \] Notice that the flats of $\mathsf{M}[F,G]$ are in natural inclusion-preserving bijection with the flats of $\mathsf{M}$ that are weakly contained between $F$ and $G$, which comprise the closed interval $[F,G]$. We use the shorthand $\mathcal{L}[F,G]$ for the flats of $\mathsf{M}[F,G]$ and we denote the proper flats by $\mathcal{L}(F,G)$. Given a matroid $\mathsf{M}=(E,\mathcal{L})$, the \emph{simplificiation} of $\mathsf{M}$, denoted $\underline\mathsf{M}$, is the matroid obtained by choosing a distinguished element from each rank-one flat and deleting all other elements of $E$. The simplification is unique up to relabeling the elements of the ground set, so we do not stress the choice of distinguished elements. Notice that the lattice of flats of $\mathsf{M}$ and $\underline\mathsf{M}$ are naturally isomorphic. \subsubsection{Characteristic polynomials} Given a matroid $\mathsf{M}=(E,\mathcal{L})$, the \emph{characteristic polynomial} of $\mathsf{M}$ is defined by \[ \chi_\mathsf{M}(\lambda)=\sum_{S\subseteq E}(-1)^{|S|}\lambda^{\mathrm{rk}(E)-\mathrm{rk}(S)}. \] From this definition, it is an excellent exercise to check the following three properties. \begin{enumerate} \item[($\chi$1)] If $\mathsf{M}$ has a loop, then $\chi_\mathsf{M}(\lambda)=0$. \item[($\chi$2)] If $e$ is a coloop of $\mathsf{M}$, then $\chi_\mathsf{M}(\lambda)=(\lambda-1)\chi_{\mathsf{M}\setminus\{e\}}(\lambda)$. \item[($\chi$3)] If $e$ is neither a loop nor a coloop, then \[ \chi_\mathsf{M}(\lambda)=\chi_{\mathsf{M}\setminus\{e\}}(\lambda)-\chi_{\mathsf{M}/\{e\}}(\lambda) \] \end{enumerate} Property ($\chi$3) is called the \emph{deletion-contraction} property, and it generalizes the property of the same name for chromatic polynomials of graphs. Notice that Properties ($\chi$1)--($\chi$3) determine $\chi_\mathsf{M}(\lambda)$ recursively on the size of the ground set. In addition, it follows from ($\chi$1) and ($\chi$3) that $\chi_\mathsf{M}(\lambda)=\chi_{\underline\mathsf{M}}(\lambda)$ for any loopless matroid $\mathsf{M}$. It also follows from Properties ($\chi$1)--($\chi$3) that, for any nonempty matroid $\mathsf{M}$, the characteristic polynomial $\chi_\mathsf{M}(\lambda)$ is divisible by $\lambda-1$. The \emph{reduced characteristic polynomial} of a nonempty matroid $\mathsf{M}$ is define by \[ \overline{\chi}_\mathsf{M}(\lambda)=\frac{\chi_\mathsf{M}(\lambda)}{\lambda-1}. \] Naturally, the reduced characteristic polynomial also satisfies Properties ($\chi$1)--($\chi$3). \subsubsection{Chow rings} Let $\mathsf{M}=(E,\mathcal{L})$ be a loopless matroid and denote the collection of proper flats of $\mathsf{M}$ by $\mathcal{L}^*=\mathcal{L}\setminus\{\emptyset,E\}$. The \emph{matroid Chow ring} is defined by \[ A^*(\mathsf{M})=\frac{\mathbb{Z}\big[X_F\;|\;F\in\mathcal{L}^*\big]}{\mathcal{I}+\mathcal{J}}, \] where \[ \mathcal{I}=\big\langle X_{F_1}X_{F_2}\;|\;F_1\text{ and }F_2\text{ are incomparable} \big\rangle \] and \[ \mathcal{J}=\bigg\langle\sum_{e\in F }X_F-\sum_{f\in F}X_F\;\Big|\;e,f\in E \bigg\rangle. \] We denote the generators of the matroid Chow ring by $D_F=[X_F]\in A^1(M)$. Notice that the Chow ring only depends on the lattice of flats, which implies that $A^*(\mathsf{M})=A^*(\underline\mathsf{M})$. Matroid Chow rings were first defined by Feichtner and Yuzvinsky \cite{FY} (in the more general setting of atomic lattices). The presentation given by Feichtner and Yuzvinsky slightly differs from the one give above in that it includes an additional generator $D_E\in A^1(\mathsf{M})$ and an additional relation \[ D_E=-\sum_{e\in F\atop F\in\mathcal{L}^*}D_F, \] where $e$ is any element of $E$. An important result of Feichtner and Yuzvinsky is the derivation of an integral basis for $A^*(\mathsf{M})$, which we recall here. \begin{theorem}{\cite[Corollary~1]{FY}}\label{thm:basis} If $\mathsf{M}$ is a loopless matroid, then a $\mathbb{Z}$-basis of $A^*(\mathsf{M})$ is given by all monomials of the form \[ D_{F_1}^{d_1}\cdots D_{F_\ell}^{d_\ell} \] with $\emptyset=F_0\subsetneq F_1\subsetneq \cdots\subsetneq F_k\subseteq E$ and $d_i<\mathrm{rk}(F_i)-\mathrm{rk}(F_{i-1})$ for all $i=1,\dots,\ell$. \end{theorem} Suppose that $\mathrm{rk}(\mathsf{M})=r+1$. It follows from Theorem~\ref{thm:basis} that $A^k(\mathsf{M})=0$ for any $k>r$, and that $A^r(\mathsf{M})$ is one-dimensional, generated by $D_E^r$. In particular, we can define a linear isomorphism \[ \deg: A^r(\mathsf{M})\rightarrow\mathbb{Z} \] by setting $\deg\big((-D_E)^r\big)=1$. The class $-D_E$ played a central role in the work of Adiprasito, Huh, and Katz, where it was denoted as $\alpha$. In particular, Proposition~5.8 of \cite{AHK} implies that \[ D_{F_1}\cdots D_{F_r}=(-D_E)^r \] for any complete flag $\emptyset\subsetneq F_1\subsetneq\cdots\subsetneq F_r\subsetneq E$. In other words, given any class $\gamma\in A^r(\mathsf{M})$, we can compute $\deg(\gamma)$ as follows. \begin{enumerate} \item Use the relations in $\mathcal{I}$ and $\mathcal{J}$ to find a linear combination \[ \gamma=\sum_{\mathcal{F}}a_\mathcal{F}(\gamma)D_\mathcal{F} \] where the sum is over complete flags $\mathcal{F}=(\emptyset \subsetneq F_1\subsetneq \dots\subsetneq F_r\subsetneq E)$, the coefficients $a_\mathcal{F}(\gamma)$ are integers, and $D_\mathcal{F}=D_{F_1}\cdots D_{F_r}$. \item Compute \[ \deg(\gamma)=\sum_\mathcal{F} a_\mathcal{F}(\gamma). \] \end{enumerate} The aforementioned result of Adiprasito, Huh, and Katz implies that the sum of the coefficients in (2) is independent of the choice of linear combination in (1). Finally, in closing this section, we note that for the specific matroid $\mathsf{M}=([n],2^E)$, the matroid Chow ring specializes to the Chow ring of Losev-Manin space $A^*(\overline{\mathcal{LM}}_n)$ and the matroid degree map is identified with the algebro-geometric degree map. This observation motivates extending tools from $A^*(\overline{\mathcal{LM}}_n)$ to Chow rings of arbitrary matroids. \subsection{Matroid psi classes}\label{subsec:matroidpsi} Throughout this subsection, we let $\mathsf{M}=(E,\mathcal{L})$ denote a loopless matroid of rank $r+1$. We begin by using the characterization of Lemma~\ref{lem:psilinearcombo} to introduce a generalization of psi classes to the matroid setting. \begin{definition}\label{def:matroidpsiclass} For any $F\in\mathcal{L}$ and $e\in E$, define classes $\psi_F^{\pm}\in A^1(\mathsf{M})$ by \[ \psi_F^-=\sum_{G\in\mathcal{L}^*\atop e\in G}D_G-\sum_{G\in\mathcal{L}^*\atop G\supseteq F}D_G\;\;\;\text{ and }\;\;\;\psi_F^+=\sum_{G\in\mathcal{L}^*\atop e\notin G}D_G-\sum_{G\in\mathcal{L}^*\atop G\subseteq F}D_G. \] In the special case that $F=\emptyset$ or $F=E$, define \[ \psi_0=\psi_\emptyset^+=\sum_{G\in\mathcal{L}^*\atop e\notin G}D_G\;\;\;\text{ and }\;\;\;\psi_\infty=\psi_{E}^-=\sum_{G\in\mathcal{L}^*\atop e\in G}D_G. \] \end{definition} Notice that $\psi_\infty=-D_E$, which, as we mentioned above, was also denoted as $\alpha$ in \cite{AHK}, and we mention that $\psi_0$ also appeared in \cite{AHK}, where it was denoted $\beta$. We already commented above on why the class $\psi_\infty$ is independent of the choice of $e\in E$, and this also implies that $\psi_F^-$ is independent of this choice for any flat $F$. It is a short exercise to verify that $\psi_F^+$ is also independent of the choice of $e\in E$. Equipped with a general definition of matroid psi classes, we now aim to generalize the basic results from the setting of Losev-Manin spaces. We start with the following generalization of Lemma~\ref{lem:selfintersection}. \begin{proposition}\label{prop:selfintersection} For any $F\in\mathcal{L}^*$, we have \[ D_F^2= D_F(-\psi_F^--\psi_F^+) \in A^2(\mathsf{M}). \] \end{proposition} \begin{proof} Choose $e\in E$ and write \begin{align} \nonumber D_F&=D_F+\sum_{e\in G} D_G-\sum_{e\in G}D_G\\ &=D_F+\sum_{G} D_G-\sum_{e\notin G}D_G-\sum_{e\in G}D_G.\label{eq.termsterms} \end{align} When we multiply the first two terms of \eqref{eq.termsterms} by $D_F$ and use the fact that $D_FD_G=0$ when $F$ and $G$ are incomparable (by definition of $\mathcal{I}$), we have \[ D_F\Big(D_F+\sum_G D_G\Big)=D_F\Big(\sum_{G\supseteq F}D_G+\sum_{G\subseteq F}D_G\Big). \] Including the final two terms of \eqref{eq.termsterms}, we conclude that \[ D_F^2=D_F\bigg(-\Big(\sum_{e\in G}D_G-\sum_{G\supseteq F}D_G\Big)-\Big(\sum_{e\notin G}D_G-\sum_{G\subseteq F}D_G\Big)\bigg)=D_F(-\psi_F^--\psi_F^+).\qedhere \] \end{proof} Repeatedly applying Proposition~\ref{prop:selfintersection} results in the following corollary. \begin{corollary}\label{cor:selfintersectionmatroid} If $F_1,\dots,F_k\in\mathcal{L}^*$ are distinct proper flats and $d_1,\dots,d_k$ are positive integers, then \[ D_{F_1}^{d_1}\cdots D_{F_k}^{d_k}=\begin{cases} D_\mathcal{F}\displaystyle\prod_{i=1}^k(-\psi_{F_i}^--\psi_{F_i}^+)^{d_i-1} & \parbox[]{8cm}{if, after possibly relabeling, $F_1,\dots,F_k$ form a flag $\mathcal{F}=(\emptyset\subsetneq F_1\subsetneq\dots\subsetneq F_k\subsetneq E)$,}\\ 0 & \text{if }F_i\text{ and }F_j\text{ are incomparable for some }i,j. \end{cases} \] \end{corollary} Now that we know how to multiply arbitrary products of generators in $A^*(\mathsf{M})$, it remains to compute the degree of the resulting expression. The first step is the next result---generalizing Lemma~\ref{lem:product}---which reduces the computation to degrees of monomials in $\psi_0$ and $\psi_\infty$. \begin{proposition}\label{prop:degreeofpsi2} If $\mathcal{F}=(\emptyset=F_0\subsetneq F_1\subsetneq\dots\subsetneq F_k\subsetneq F_{k+1}=E)$ is a flag of flats and $a_0^+,a_1^-,a_1^+,\dots,a_{k}^-,a_k^+,a_{k+1}^-$ are nonnegative integers, then \[ \deg_\mathsf{M}\Big(D_\mathcal{F}\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{a_{i+1}^-}\Big)=\prod_{i=0}^k\deg_{\mathsf{M}[F_i,F_{i+1}]}\Big(\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}\Big). \] \end{proposition} \begin{proof} For each $i=0,\dots,k$, define an algebra homomorphism from the polynomial ring $\mathbb{Z}[X_G\;|\;G\in\mathcal{L}(F_i,F_{i+1})]$ to the matroid Chow ring of $\mathsf{M}$ as follows: \begin{align*} \phi_i:\mathbb{Z}[X_G\;|\;G\in\mathcal{L}(F_i,F_{i+1})]&\rightarrow A^*(\mathsf{M}) \\ X_G&\mapsto D_{G\cup F_i}. \end{align*} Unfortunately, the ideal $\mathcal{J}$ is not in the kernel of $\phi_i$, so $\phi_i$ does not descend to a homomorphism from the Chow ring $A^*(\mathsf{M}[F_i,F_{i+1}])$. Let us modify $\phi_i$ by multiplying by $D_\mathcal{F}$: \begin{align*} \widehat\phi_i:\mathbb{Z}[X_G\;|\;G\in\mathcal{F}(F_i,F_{i+1})]&\rightarrow A^*(\mathsf{M}) \\ \gamma&\mapsto \mathcal{D}_\mathcal{F} \phi_i(\gamma). \end{align*} Notice that $\widehat\phi_i$ is linear, but not multiplicative. We claim that the linear map $\widehat\phi_i$ descends to the Chow ring $A^*(\mathsf{M}[F_i,F_{i+1}])$. To prove this, it suffices to check that the generators of both $\mathcal{I}$ and $\mathcal{J}$ are contained in the kernel of $\widehat\phi_i$. First, notice that if $\emptyset\subsetneq G_1,G_2\subsetneq F_{i+1}\setminus F_{i}$ are incomparable, then $G_1\cup F_{i}$ and $G_2\cup F_{i}$ are also incomparable. This implies that $\widehat\phi_i(X_{G_1}X_{G_2})=0$ for incomparable $G_1,G_2\in\mathcal{L}(F_i,F_{i+1})$, proving that $\hat\phi_i$ descends to the quotient by $\mathcal{I}$. Secondly, if $e,f\in F_{i+1}\setminus F_{i}$, then \begin{align*} \widehat\phi_i\Big(\sum_{G\in\mathcal{L}(F_i,F_{i+1}) \atop e\in G}X_{G}-\sum_{G\in\mathcal{L}(F_i,F_{i+1}) \atop f\in G}X_{G}\Big) &=D_\mathcal{F}\Big(\sum_{F_{i}\subsetneq H\subsetneq F_{i+1} \atop e\in H}D_H-\sum_{F_{i}\subsetneq H\subsetneq F_{i+1} \atop f\in H}D_H\Big)\\ &=D_\mathcal{F}\Big(\sum_{ H\in\mathcal{L}^* \atop e\in H}D_H-\sum_{H\in\mathcal{L}^*\atop f\in H}D_H\Big)=0. \end{align*} The second equality above uses the following observations. \begin{enumerate} \item The only flats $H\in\mathcal{L}^*$ that survive multiplication by $D_\mathcal{F}$ are those that are comparable with both $F_i$ and $F_{i+1}$. \item If $e\in H$ or $f\in H$, then the only way that $H$ is comparable with $F_{i}$ is if $H\supsetneq F_{i}$. \item If $H\supseteq F_{i+1}$, then $e,f\in H$, so the terms cancel in the difference in the final formula. \end{enumerate} Thus, $\widehat\phi_i$ descends to the quotient by $\mathcal{I}+\mathcal{J}$, and by a slight abuse of notation, we use the same notation to represent the induced linear map: $\widehat\phi_i: A^*(\mathsf{M}[F_i,F_{i+1}])\rightarrow A^*(\mathsf{M})$. Using multi-linearity, we combine the linear maps $\widehat\phi_i$ to obtain a linear map \begin{align*} \phi_\mathcal{F}:\bigotimes_{i=0}^{k}A^*(\mathsf{M}[F_i,F_{i+1}])&\rightarrow A^*(\mathsf{M})\\ \gamma_0\otimes\dots\otimes \gamma_k&\mapsto D_\mathcal{F}\prod_{i=0}^k\phi_i(\gamma_i) \end{align*} Notice that, for any $e\in F_{i+1}\setminus F_{i}$, we have \begin{align*} \widehat\phi_i(\psi_0)=\widehat\phi_i\Big(\sum_{G\in\mathcal{L}(F_i,F_{i+1}) \atop e\notin G}D_G\Big) &=D_\mathcal{F}\sum_{F_{i}\subsetneq H\subsetneq F_{i+1} \atop e\notin H}D_H\\ &=D_\mathcal{F}\Big(\sum_{e\notin H}D_H-\sum_{H\subseteq F_{i}}D_H\Big)=D_\mathcal{F}\psi_{F_{i}}^+. \end{align*} Similarly, it can be checked that $\widehat\phi_i(\psi_\infty)=D_{\mathcal{F}}\psi_{F_{i+1}}^-$. It then follows from the definition of $\phi_\mathcal{F}$ that \[ \phi_\mathcal{F}\Big(\bigotimes_{i=0}^{k}\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}\Big)=D_\mathcal{F}\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{a_{i+1}^-}. \] Notice that, to compute $\deg_{\mathsf{M}[F_i,F_{i+1}]}\big(\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}\big)$, we can use the relations in $\mathcal{I}$ and $\mathcal{J}$ to find an express $\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}$ as a linear combination of the form \begin{equation}\label{eq:linearcombo} \psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}=\sum_{\text{complete flags }\mathcal{F}^{(i)} \atop \text{in }\mathsf{M}[F_i,F_{i+1}]}a_{\mathcal{F}^{(i)}} D_{\mathcal{F}^{(i)}}, \end{equation} and then compute \[ \deg_{\mathsf{M}[F_i,F_{i+1}]}(\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-})=\sum_{\mathcal{F}^{(i)}}a_{\mathcal{F}^{(i)}}. \] Making one choice of expression \eqref{eq:linearcombo} for each $i=0,\dots,k$, we can apply $\phi_\mathcal{F}$ to obtain \begin{align}\label{eq:sumoverflags} \nonumber \phi_\mathcal{F}\Big(\bigotimes_{i=0}^{k}\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}\Big) &=\phi_\mathcal{F}\Big(\bigotimes_{i=0}^{k}\sum_{\mathcal{F}^{(i)}}a_{\mathcal{F}^{(i)}}D_{\mathcal{F}^{(i)}}\Big)\\ &=D_\mathcal{F} \sum_{\mathcal{F}^{(0)},\dots,\mathcal{F}^{(k)}}a_{\mathcal{F}^{(0)}}\cdots a_{\mathcal{F}^{(k)}}D_{\mathcal{F}^{(1)}\cup F_0}\cdots D_{\mathcal{F}^{(k)}\cup F_k}, \end{align} where, for any flag $\mathcal{F}^{(i)}=(F_1^{(i)}\subsetneq\dots\subsetneq F_{k_i}^{(i)})$ of flats in $\mathsf{M}[F_i,F_{i+1}]$, we define \[ \mathcal{F}^{(i)}\cup F_{i}=(F_1^{(i)}\cup F_{i}\subsetneq\dots\subsetneq F_{k_i}^{(i)}\cup F_{i}), \] which is a flag of flats in $\mathsf{M}$. Since each $\mathcal{F}^{(i)}$ is a complete flag of flats in $\mathsf{M}[F_i,F_{i+1}]$, it follows that the sets in \[ \mathcal{F}\cup \bigcup_{i=0}^{k} (\mathcal{F}^{(i)}\cup F_i) \] form a complete flag of flats in $\mathsf{M}$. Therefore, the products of generators in \eqref{eq:sumoverflags} are indexed by complete flags in $\mathsf{M}$, and we conclude that \begin{align*} \deg_\mathsf{M}\bigg(D_\mathcal{F}\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{a_{i+1}^-}\bigg)&=\sum_{\mathcal{F}^{(0)},\dots,\mathcal{F}^{(k)}}a_{\mathcal{F}^{(0)}}\cdots a_{\mathcal{F}^{(k)}}\\ &=\prod_{i=0}^{k}\sum_{\mathcal{F}^{(i)}}a_{\mathcal{F}^{(i)}}\\ &=\prod_{i=0}^{k}\deg_{\mathsf{M}[F_i,F_{i+1}]}(\psi_0^{a_{i}^+}\psi_\infty^{a_{i+1}^-}).\qedhere \end{align*} \end{proof} It now remains to compute degrees of monomials in $\psi_0$ and $\psi_\infty$. The key result in this regard---which is listed as Proposition~\ref{prop:degreeofpsi} below---relates these degree computations to the coefficients of reduced characteristic polynomials. This result was previously proved by Adiprasito, Huh, and Katz \cite[Proposition~9.5]{AHK}, but we find it instructive to give an alternative proof, motivated by the proof of Lemma~\ref{lem:degreeofpsi}, which uses properties of psi classes. We begin by introducing an analogue of the pullbacks of the forgetful maps. \begin{proposition}\label{prop:pullbackpsi} If $S\subseteq E$ is any subset, then there is a well-defined homomorphism $\rho_S:A^*(\mathsf{M}|_S)\rightarrow A^*(\mathsf{M})$ defined on generators by \[ \rho_S(D_G)=\sum_{G'\in\mathcal{L}^* \atop G\subseteq G'\subseteq G\cup S^c}D_{G'}. \] In addition, if $S_1\subseteq S_2$ are nonempty flats, then $\rho_{S_1}=\rho_{S_1}\circ \rho_{S_2}$. \end{proposition} Notice that the sum in the definition of $\rho_S$ is over all flats of $\mathsf{M}$ that are obtained from $G\subsetneq S$ by adding elements of $S^c$. In particular, the set $G$ is determined by any of the $G'$ via $G=G'\cap S$. In the special case of $\mathsf{M}=([n],2^{[n]})$,we have $\rho_S=r_S^*$. \begin{proof}[Proof of Proposition~\ref{prop:pullbackpsi}] Define the homomorphism \begin{align*} \rho_S:\mathbb{Z}[X_G\;|\;G\in\mathcal{L}_{\mathsf{M}|_S}^*]&\rightarrow A^*(\mathsf{M})\\ X_G&\mapsto \sum_{G'\in\mathcal{L}^* \atop G\subseteq G'\subseteq G\cup S^c}D_{G'}. \end{align*} To show that $\rho_S$ descends to a homomorphism from the Chow ring, we must verify that $\mathcal{I}$ and $\mathcal{J}$ are contained in the kernel of $\rho_S$. First, suppose that $G_1$ and $G_2$ are incomparable flats of $\mathsf{M}|_S$. Then there exists $e,f\in S$ such that $e\in G_1\setminus G_2$ and $f\in G_2\setminus G_1$. Notice that every term in the sum defining $\rho_S(X_{G_1})$ is indexed by a set that contains $e$ but not $f$ and every term in the sum defining $\rho_S(X_{G_2})$ is indexed by a set that contains $f$ but not $e$. It follows that \[ \rho_S(X_{G_1}X_{G_2})=\rho_S(X_{G_1})\rho_S(X_{G_2})=0\in A^*(\mathsf{M}), \] showing that $\rho_S$ descends to the quotient by $\mathcal{I}$. Next, to show that $\rho_S$ descends to the quotient by $\mathcal{J}$, suppose that $e,f\in S$. Then \begin{align*} \rho_S\Big(\sum_{e\in G}X_G-\sum_{f\in G}X_G\Big)&=\sum_{e\in G\subseteq G'\subseteq G\cup S^c}D_{G'}-\sum_{ f\in G\subseteq G'\subseteq G\cup S^c}D_{G'}\\ &=\sum_{e\in G'\atop G'\not\supseteq S }D_{G'}-\sum_{f\in G'\atop G'\not\supseteq S}D_{G'}\\ &=\sum_{e\in G'}D_{G'}-\sum_{f\in G'}D_{G'}=0. \end{align*} The second equality above is implied by the following observations. \begin{enumerate} \item We are assuming that $\emptyset\subsetneq G\subsetneq S$. Since $G=G'\cap S$, this condition is equivalent to $\emptyset\subsetneq G'\cap S\subsetneq S$. Since $G'\cap S$ is nonempty (it always contains $e$ in the first sum and $f$ in the second), this is equivalent to $G'\not\supseteq S$. \item Since $G=G'\cap S$ and $e\in S$, it follows that \[ e\in G\Longleftrightarrow e\in (G'\cap S)\Longleftrightarrow e\in G'. \] \end{enumerate} The third equality above is implied by the fact that every set $G'\supseteq S$ appears in both sums in the final expression, so these terms cancel. This completes the proof that $\rho_S$ descends to the quotient by $\mathcal{J}$. Thus, $\phi_S$ descends to the quotient by $\mathcal{I}+\mathcal{J}$ and induces the homomorphism whose existence is asserted in the proposition. To finish the proof of the proposition, it remains to check that $\rho_{S_1}=\rho_{S_1}\circ \rho_{S_2}$. Notice that \[ \rho_{S_1}\circ \rho_{S_2}(D_G)=\sum_{G\subseteq G'\subseteq G\cup S_2^c \atop G'\subseteq G''\subseteq G'\cup S_1^c}D_{G''}=\sum_{G\subseteq G''\subseteq G\cup S_1^c}D_{G''}=\rho_{S_1}(D_G), \] where the second equality uses that $G'$ is uniquely determined from $G''$ via $G'=G''\cap S_1$. \end{proof} The next result describes how $\psi_0$ and $\psi_\infty$ transform under the homomorphisms $\rho_S$ described in Proposition~\ref{prop:pullbackpsi}. The second statement of the result gives an alternative characterization of $\psi_F^{\pm}$ that generalizing Definition~\ref{def:generalpsi}. \begin{proposition}\label{prop:pullbackpsi} For any subset $S\subseteq E$, we have \[ \rho_S(\psi_0)=\psi_0-\sum_{G\subseteq S^c} D_{G}\;\;\;\text{ and }\;\;\;\rho_S(\psi_\infty)=\psi_\infty-\sum_{G\supseteq S} D_{G}. \] In particular, if $F\in\mathcal{L}^*$ is a proper flat, then \[ \psi_F^-=\rho_F(\psi_\infty)\;\;\;\text{ and }\;\;\;\psi_F^+=\rho_{F^c}(\psi_0). \] \end{proposition} \begin{proof} For $\psi_0$, we compute \begin{align*} \rho_S(\psi_0)&=\rho_S\Big(\sum_{e\notin G}D_G\Big)\\ &=\sum_{e\notin G\subseteq G'\subseteq G\cup S^c}D_{G'} \end{align*} Arguing as in the proof of the previous proposition, the index in the last sum can be replaced with $e\notin G'$ and $G'\not\subseteq S^c$, proving that \[ \rho_S(\psi_0)=\sum_{e\notin G'}D_{G'}-\sum_{G'\subseteq S^c} D_{G'}. \] The argument for $\rho_S(\psi_\infty)$ is similar. \end{proof} We now come to the generalization of Lemma~\ref{lem:degreeofpsi} to the matroid setting. As mentioned above, this result was previously proved by Huh and Katz \cite[Proposition~5.2]{HuhKatz}, though our formulation is more closely aligned with the presentation of Adiprasito, Huh, and Katz \cite[Proposition 9.5]{AHK}. Our proof relies on the recursive nature of the characteristic polynomial, and we note that this proof technique, using the deletion-contraction recursion, also appears in a different, more general form in recent work of Berget, Eur, Spink, and Tseng \cite[Theorem A]{BEST}. \begin{proposition}{\cite[Proposition 9.5]{AHK}}\label{prop:degreeofpsi} For nonnegative integers $a,b$, we have \[ \deg_\mathsf{M}(\psi_0^a\psi_\infty^b)=\begin{cases} \mu^a(\mathsf{M}) &\text{if }a+b=r,\\ 0 &\text{else,} \end{cases} \] where $\mu^a(M)$ is the $a$-th unsigned coefficient of the reduced characteristic polynomial of $\mathsf{M}$: \[ \overline\chi_\mathsf{M}(\lambda)=\sum_{a=0}^r(-1)^a\mu^a(\mathsf{M})\lambda^{r-a}. \] \end{proposition} Before proving Proposition~\ref{prop:degreeofpsi}, we briefly justify that it does, indeed, generalize Lemma~\ref{lem:degreeofpsi}. Suppose that $\mathsf{M}=([n],2^{[n]})$ so that $A^*(\mathsf{M})=A^*(\overline{\mathcal{LM}}_n)$. Then, for any subset $S\subseteq [n]$, we have $\mathrm{rk}(S)=|S|$, and it follows that \[ \chi_\mathsf{M}(\lambda)=\sum_{S\subseteq [n]}(-1)^{|S|}\lambda^{n-|S|}=\sum_{k=0}^n (-1)^k {n\choose k}\lambda^{n-k}=(\lambda-1)^n. \] Therefore, \[ \overline\chi_\mathsf{M}(\lambda)=(\lambda-1)^{n-1} \] and we conclude that $\mu^a(\mathsf{M})={n-1\choose a}$, as expected. \begin{proof}[Proof of Proposition~\ref{prop:degreeofpsi}] We prove the proposition by induction on $|E|$. If $|E|=1$, then $\overline{\chi}_\mathsf{M}(\lambda)=1$ and $\mu^0(\mathsf{M})=1$, so the base case follows from the fact that $A^*(\mathsf{M})=A^0(\mathsf{M})=\mathbb{Z}$ and $\deg(\psi_0^0\psi_\infty^0)=1$. We now turn to the induction step. Since $A^*(\mathsf{M})=A^*(\underline\mathsf{M})$, it suffices to assume throughout the induction step that $\mathsf{M}$ is simple. First suppose that $e\in E$ is not a coloop. This implies that $\{e\}^c$ is not contained in any proper flats of $\mathsf{M}$, and it then follows from Proposition~\ref{prop:pullbackpsi} that \[ \rho_{\mathsf{M}\setminus\{e\}}(\psi_\infty)=\psi_\infty. \] In particular, using that $\mathrm{rk}(\mathsf{M}\setminus\{e\})=\mathrm{rk}(\mathsf{M})=r+1$ and that the degree map is determined by $\deg(\psi_\infty^r)=1$, this implies that \[ \deg(\rho_{\mathsf{M}\setminus\{e\}}(\gamma))=\deg(\gamma)\;\;\;\text{ for any }\;\;\;\gamma\in A^*(\mathsf{M}\setminus\{e\}). \] Using our assumption that $\mathsf{M}$ is simple, we have that $\{e\}\in\mathcal{L}$, and it then follows from Proposition~\ref{prop:pullbackpsi} that \[ \rho_{\mathsf{M}\setminus\{e\}}(\psi_0)=\psi_0-D_{\{e\}}. \] Therefore, if $a+b=r$, then \begin{align*} \deg_{\mathsf{M}\setminus\{e\}}(\psi_0^a\psi_\infty^b)&=\deg_\mathsf{M}\big((\psi_0-D_{\{e\}})^a\psi_\infty^b\big)\\ &=\deg_\mathsf{M}(\psi_0^a\psi_\infty^b)+(-1)^a\deg_{\mathsf{M}}(D_{\{e\}}^a\psi_\infty^b)\\ &=\deg_\mathsf{M}(\psi_0^a\psi_\infty^b)-\deg_{\mathsf{M}/\{e\}}(\psi_0^{a-1}\psi_\infty^b), \end{align*} where the second equality follows from noting that we can write $\psi_0=\sum_{e\notin F}D_F$, in which case it follows $\psi_0D_{\{e\}}=0$, and the third equality follows from Proposition~\ref{prop:degreeofpsi2}. In the case where $a=0$, the second term in the final expression is equal to zero. The induction hypothesis then implies that \[ \deg_\mathsf{M}(\psi_0^a\psi_\infty^b)=\mu^a(\mathsf{M}\setminus\{e\})+\mu^{a-1}(\mathsf{M}/\{e\})=\mu^a(\mathsf{M}), \] where the final equality is an application of Property ($\chi$3) for $\overline{\chi}_\mathsf{M}(\lambda)$. Next, suppose that $e\in E$ is a coloop. Since $e$ is a coloop and $\mathsf{M}$ is simple, both $\{e\}$ and $\{e\}^c$ are flats of $\mathsf{M}$. It follows from Proposition~\ref{prop:pullbackpsi} that \[ \rho_{\mathsf{M}\setminus\{e\}}(\psi_0)=\psi_0-D_{\{e\}}\;\;\;\text{ and }\;\;\;\rho_{\mathsf{M}\setminus\{e\}}(\psi_\infty)=\psi_\infty-D_{\{e\}^c}. \] For any positive integer $a$, we have \begin{align*} \psi_0^a&=(\rho_{\mathsf{M}\setminus\{e\}}(\psi_0)+D_{\{e\}})^a\\ &=\rho_{\mathsf{M}\setminus\{e\}}(\psi_0^a)+\sum_{k=1}^a{a\choose k}D_{\{e\}}^k(-D_{\{e\}})^{a-k}\\ &=\rho_{\mathsf{M}\setminus\{e\}}(\psi_0^a)-(-D_{\{e\}})^a, \end{align*} where the second equality uses the fact that $\psi_0D_{\{e\}}=0$ and the third equality uses that $\sum_{k=1}^a{a\choose k}(-1)^{a-k}=(-1)^{a-1}$. Similarly, \[ \psi_\infty^b=\rho_{\mathsf{M}\setminus\{e\}}(\psi_0^b)-(-D_{\{e\}^c})^b. \] Thus, if $a+b=r$, we compute that \begin{align*} \psi_0^a\psi_\infty^b&=\rho_{\mathsf{M}\setminus\{e\}}(\psi_0^a\psi_\infty^b)-\rho_{\mathsf{M}\setminus\{e\}}(\psi_0^a)(-D_{\{e\}^c})^b-(-D_{\{e\}})^a\rho_{\mathsf{M}\setminus\{e\}}(\psi_\infty^b)+(-D_{\{e\}})^a(-D_{\{e\}^c})^b\\ &=-\rho_{\mathsf{M}\setminus\{e\}}(\psi_0^a)(-D_{\{e\}^c})^b-(-D_{\{e\}})^a\rho_{\mathsf{M}\setminus\{e\}}(\psi_\infty^b)\\ &=D_{\{e\}^c}\psi_0^a\psi_{\{e\}^c}^{b-1}+D_{\{e\}}\psi_{\{e\}}^{a-1}\psi_\infty^b \end{align*} where the second equality follows from observing that $\mathrm{rk}(\mathsf{M}\setminus\{e\})=r$ and $D_{\{e\}}D_{\{e\}^c}=0$, and the third equality follows from the facts that $D_{\{e\}}\psi_0=D_{\{e\}^c}\psi_\infty=0$ and Corollary~\ref{cor:selfintersectionmatroid}. As before, terms with negative exponents are equal to zero. Computing degrees via Proposition~\ref{prop:degreeofpsi2}, we then see that \[ \deg_\mathsf{M}(\psi_0^a\psi_\infty^b)=\deg_{\mathsf{M}\setminus\{e\}}(\psi_0^a\psi_\infty^{b-1})+\deg_{\mathsf{M}/\{e\}}(\psi_0^{a-1}\psi_\infty^b). \] Since $e$ is a coloop, it follows that $\mathsf{M}\setminus\{e\}=\mathsf{M}/\{e\}$, because every flat not containing $e$ remains a flat when you add $e$ to it. Therefore, applying the induction hypothesis, we have \[ \deg_\mathsf{M}(\psi_0^a\psi_\infty^b)=\mu^a(\mathsf{M}\setminus\{e\})+\mu^{a-1}(\mathsf{M}\setminus\{e\})=\mu^a(\mathsf{M}), \] where the final equality is an application of Property ($\chi$2) for $\overline{\chi}_\mathsf{M}(\lambda)$. This completes the induction step, and finishes the proof. \end{proof} \subsection{Volume polynomials} In this subsection, we illustrate the utility of psi classes by using them to reprove the main result in \cite{Eur} and one of the main results in \cite{BES}, both of which give an explicit formula for the volume polynomials of matroids. Given our parallel developments, the arguments in this setting are essentially verbatim generalizations of the arguments made in the setting of generalized permutahedra and Losev-Manin spaces. Let $\mathsf{M}=(E,\mathcal{L})$ be a loopless matroid of rank $r+1$. The \emph{volume polynomial} of $A^*(\mathsf{M})$ is the function \begin{align*} \mathrm{Vol}_\mathsf{M}:A^1(\mathsf{M})&\rightarrow\mathbb{Z}\\ D&\mapsto\deg_\mathsf{M}(D^r). \end{align*} Given a spanning set of generators $B=(B_1,\dots,B_m)$ for $A^1(\mathsf{M})$, the volume polynomial can be written explicitly as a homogeneous polynomial of degree $r$: \[ \mathrm{Vol}_{\mathsf{M},B}(x_1,\dots,x_m)=\deg_\mathsf{M}\bigg(\Big(\sum_{i=1}^mx_iB_i\Big)^{r}\bigg)\in\mathbb{Z}[x_1,\dots,x_m]. \] In fact, given that $A^*(\mathsf{M})$ satisfies Poincar\'e duality (discussed in the next subsection), it follows from Lemma 13.4.7 in \cite{Toric} that the volume polynomial associated to any generating set determines a presentation for the Chow ring $A^*(\mathsf{M})$. Thus, it follows that the matroid Chow ring is determined from computations of the form \[ \deg_\mathsf{M}(B_1^{d_m}\cdots B_m^{d_m}), \] where $d_1+\dots+d_m=r$. The main result in \cite{Eur} is the computation of these degrees for the set of generators $(D_F\;|\;F\in\mathcal{L}^*)$, and one of the main results in \cite{BES} is the computations of these degrees for the set of generators $(\psi_F^-\;|\; \emptyset\neq F\in\mathcal{L})$. We note that the authors of \cite{BES} stated their result in terms of classes that they denoted $h_F$, but it follows from the definitions that $h_F=\psi_F^-$. We now recover both of these computations using properties of psi classes. The main result in \cite{Eur}, which implies Theorem~\ref{thm:eur}, is the following. \begin{theorem}{\cite[Theorem 3.2]{Eur}}\label{thm:eur2} If $\mathcal{F}=(\emptyset\subsetneq F_1\subsetneq\dots F_k\subsetneq E)$ is a flag of flats in $\mathsf{M}$ and $d_1,\dots,d_k$ are positive integers that sum to $r$. Then \[ \deg_\mathsf{M}(D_{F_1}^{d_1}\cdots D_{F_k}^{d_k})=(-1)^{r-1}\prod_{i=1}^k{d_i-1\choose \tilde d_i-\mathrm{rk}(F_i)}\mu^{\tilde d_i-\mathrm{rk}(F_i)}(\mathsf{M}[F_i,F_{i+1}]), \] with \[ \tilde d_j=\sum_{i=1}^j d_i. \] \end{theorem} \begin{proof} To prove this using psi classes, start by applying Corollary~\ref{cor:selfintersectionmatroid}: \begin{align*} D_1^{d_1}\cdots D_k^{d_k}&=D_\mathcal{F}\displaystyle\prod_{i=1}^k(-\psi_{F_i}^--\psi_{F_i}^+)^{d_i-1}\\ &=D_\mathcal{F}(-1)^{r-k}\sum_{a_i^-,a_i^+}\prod_{i=1}^k{d_i-1 \choose a_i^-,a_i^+}(\psi_{F_i}^-)^{a_i^-}(\psi_{F_i}^+)^{a_i^+}\\ &=D_\mathcal{F}(-1)^{r-k}\sum_{a_i^+=0}^{d_i-1}\prod_{i=1}^k{d_i-1 \choose a_i^+}(\psi_{F_i}^-)^{d_i-a_i^+-1}(\psi_{F_i}^+)^{a_i^+}\\ &=D_\mathcal{F}(-1)^{r-k}\sum_{a_i^+=0}^{d_i-1}\prod_{i=1}^{k}{d_i-1 \choose a_i^+}\prod_{i=0}^{k}(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{d_{i+1}-a_{i+1}^+-1}, \end{align*} where, by convention, we define $a_0^+=d_{k+1}-a_{k+1}^+-1=0$. By Proposition~\ref{prop:degreeofpsi}, the degree of each summand in this class is zero unless \[ a_{i}^++d_{i+1}-a_{i+1}^+-1=\mathrm{rk}(F_{i+1})-\mathrm{rk}(F_{i})-1. \] These conditions have a unique solution with \[ a_i^+=\tilde d_i-\mathrm{rk}(F_i). \] Thus, computing the degrees by Proposition~\ref{prop:degreeofpsi}, we have \[ \deg_\mathsf{M}(D_{F_1}^{d_1}\cdots D_{F_k}^{d_k})=(-1)^{r-k}\prod_{i=1}^k{d_i-1\choose \tilde d_i-\mathrm{rk}(F_i)}\prod_{i=0}^{k}\mu^{\tilde d_{i}-\mathrm{rk}(F_{i})}(\mathsf{M}[F_i,F_{i+1}]). \] Theorem \ref{thm:eur2} follows by noting that $\mu^0(\mathsf{M})=1$ for any matroid $\mathsf{M}$, so the $i=0$ term of the second product is $1$. \end{proof} One of the main results of \cite{BES}, which implies Theorem~\ref{thm:postnikov}, is the following. \begin{theorem}{\cite[Theorem 5.2.4]{BES}}\label{thm:BES} If $F_1,\dots,F_r$ are nonempty flats of $\mathsf{M}$, then \[ \deg_\mathsf{M}(\psi_{F_1}^-\dots\psi_{F_r}^-)= \begin{cases} 1 &\text{if } 0<i_1<\dots<i_k\leq r\Longrightarrow \mathrm{rk}(F_{i_1}\cup\dots\cup F_{i_k})>k,\\ 0 &\text{else.} \end{cases} \] \end{theorem} \begin{proof} To prove this result using properties of psi classes, first assume that there exists some $0<i_1<\dots<i_k\leq r$ such that $\mathrm{rk}(F_{i_1}\cup\dots\cup F_{i_k})\leq k$. Denote $S=F_{i_1}\cup\dots\cup F_{i_k}$. By Proposition~\ref{prop:pullbackpsi}, we compute that \[ \psi_{F_{i_1}}^-\cdots\psi_{F_{i_k}}^-=\rho_{F_{i_1}}(\psi_\infty)\cdots \rho_{F_{i_k}}(\psi_\infty)=\rho_{S}\big(\rho_{F_{i_1}}(\psi_\infty)\cdots \rho_{F_{i_k}}(\psi_\infty)\big). \] The input of $\rho_{S}$ is a class in $A^k(\mathsf{M}|_S)$, which is zero because \[ \mathrm{rk}(M|_S)=\mathrm{rk}(S)\leq k. \] Thus, \[ \deg_\mathsf{M}(\psi_{F_1}^-\dots\psi_{F_r}^-)=\deg(0)=0. \] Next, suppose that $0<i_1<\dots<i_k\leq r$ implies that $\mathrm{rk}(F_{i_1}\cup\dots\cup F_{i_k})>k$. By definition, \begin{align*} \psi_{F_1}^-\dots\psi_{F_{r}}^-&=\Big(\psi_\infty-\sum_{G\supseteq F_{1}}D_G\Big)\cdots\Big(\psi_\infty-\sum_{G\supseteq F_{{r}}}D_G\Big)\\ &=\sum_{k=0}^{r}\psi_\infty^{r-k}(-1)^k\sum_{0<i_1<\dots<i_k\leq r \atop G_j\supseteq F_{i_j}}D_{G_1}\cdots D_{G_k}. \end{align*} We claim that the only nonzero term in the sum is the one indexed by $k=0$. To see why, notice that multiplying $D_{G_1}\cdots D_{G_k}$ will either be zero if $G_i$ and $G_j$ are incomparable for some $i$ and $j$ or it will be a multiple of $D_\mathcal{G}$ for some flag $\mathcal{G}$. In the latter case, the largest flat in the flag $\mathcal{G}$ must be $G=G_1\cup\cdots\cup G_k$, which contains $F_{i_1}\cup\dots\cup F_{i_k}$. This implies that $\mathrm{rk}(G)>k$. It follows that \[ \deg_\mathsf{M}(\psi_\infty^{r-k}D_{G_1}\cdots D_{G_k})=0, \] because, when expanded using Proposition~\ref{prop:degreeofpsi2}, the exponent of $\psi_\infty$ appearing in the final term of the product is $r-k\geq\mathrm{rk}(E)-\mathrm{rk}(G)=\mathrm{rk}(\mathsf{M}[G,E])$. Thus, the only nonzero term in the sum is \[ \deg_\mathsf{M}(\psi_\infty^r)=\mu^0(\mathsf{M})=1.\qedhere \] \end{proof} \subsection{Poincar\'e duality} In this final section, we describe one more application of our developments of psi classes, which is a new proof of the Poincar\'e duality property for matroid Chow rings. Our proof utilizes the following computational result. \begin{lemma}\label{lem:poincare} If $\mathcal{F}=(\emptyset\subsetneq F_1\subsetneq\cdots\subsetneq F_k\subsetneq E)$ is a flag of flats in $\mathsf{M}$ and we have integers $d_1,\dots,d_k>0$ and $d_E\geq 0$ that sum to $r$, then \begin{enumerate} \item $\deg_\mathsf{M}(D_{F_1}^{d_1}\cdots D_{F_k}^{d_k}D_E^{d_E})=0$ if $d_E+\displaystyle\sum_{i=m}^k d_i>r-\mathrm{rk}(F_{m-1})$ for some $m\in\{1,\dots,k\}$ and \item $\deg_\mathsf{M}(D_{F_1}^{d_1}\cdots D_{F_k}^{d_k})=(-1)^{r-k+1}$ if $d_E+\displaystyle\sum_{i=m}^k d_i=r-\mathrm{rk}(F_{m-1})$ for all $m\in\{1,\dots,k\}$. \end{enumerate} \end{lemma} \begin{proof} By Corollary~\ref{cor:selfintersectionmatroid}, we have \begin{align*} D_{F_1}^{d_1}\cdots D_{F_k}^{d_k}D_E^{d_E}&=D_\mathcal{F}(-\psi_\infty)^{d_E}\prod_{i=1}^k(-\psi_{F_i}^--\psi_{F_i}^+)^{d_i-1}\\ &=(-1)^{r-k+1}\sum_{a_i^+=0}^{d_i-1}\prod_{i=1}^k{d_i-1\choose a_i^+}D_\mathcal{F}\prod_{i=0}^k(\psi_{F_{i}}^+)^{a_{i}^+}(\psi_{F_{i+1}}^-)^{d_{i+1}-1-a_{i+1}^+} \end{align*} where $a_0^+=0$, $F_{k+1}=E$, and $a_{k+1}^-=d_\infty$. Computing the degree using Proposition~\ref{prop:degreeofpsi2}, we see that the degree is nonzero only if \[ a_i^++d_{i+1}-1-a_{i+1}^+=\mathrm{rk}(F_{i+1})-\mathrm{rk}(F_i)-1\;\;\;\text{ for all }\;\;\;i=0,\dots,k. \] The unique solution of this system is given by \[ a_m^+=r-\mathrm{rk}(F_m)-d_E-\sum_{i=m+1}^\ell d_i\;\;\;\text{ for all }\;\;\;m=1,\dots,k. \] Property (1) follows from the observation that $a_m^+\geq 0$ for all $m=1,\dots,k$. Notice that the condition in Property (2) implies that $a_m^+=0$ for all $m=1,\dots,k$, and Property (2) then follows from Proposition~\ref{prop:degreeofpsi2} and the fact that \[ \deg_{\mathsf{M}[F_i,F_{i+1]}}\big(\psi_\infty^{\mathrm{rk}(F_{i+1})-\mathrm{rk}(F_i)-1}\big)=1.\qedhere \] \end{proof} We now use the Feichtner--Yuzvinsky basis for $A^*(\mathsf{M})$ to prove Poincar\'e duality. \begin{theorem}\label{thm:poincareduality} For any $k\in 0,\dots,r$, the map \begin{align*} \phi_k:A^k(\mathsf{M})&\rightarrow A^{r-k}(\mathsf{M})^\vee\\ \gamma&\mapsto (\mu\mapsto\deg_\mathsf{M}(\mu\gamma)) \end{align*} is an isomorphism of $\mathbb{Z}$-modules. \end{theorem} \begin{proof} Recall that the Feichtner--Yuzvinsky basis for $A^k(\mathsf{M})$ comprises all monomials of the form \[ B=D_{F_1}^{d_1}\cdots D_{F_\ell}^{d_\ell} \] where $\emptyset=F_0\subsetneq F_1\subsetneq\cdots\subsetneq F_\ell\subseteq E$ and $0<d_i<\mathrm{rk}(F_i)-\mathrm{rk}(F_{i-1})$ for all $i=1,\dots,\ell$ with $\sum_{i=1}^\ell d_i=k$. Throughout this proof, we always assume that $F_\ell=E$ while allowing for the possibility that $d_\ell=0$. For each such basis element $B$, define a corresponding basis element $\widehat B\in A^{r-k}(\mathsf{M})$ by \[ \widehat B=D_{F_1}^{\hat d_1}\cdots D_{F_\ell}^{\hat d_\ell}, \] where \[ \hat d_i=\begin{cases} \mathrm{rk}(F_i)-\mathrm{rk}(F_{i-1})-d_i &\text{if }i<\ell,\\ r-\mathrm{rk}(F_{\ell-1})-d_i &\text{if }i=\ell. \end{cases} \] Let $\widehat B^\vee\in A^{r-k}(\mathsf{M})^\vee$ denote the dual of $\widehat B$. We can write $\phi_k$ as a square matrix whose rows are indexed by the basis elements $B$ and whose columns are indexed by the corresponding basis elements $\widehat B^\vee$. The $(B_1,\widehat B_2^\vee)$ entry of this matrix is $\deg_{\mathsf{M}}(B_1\widehat B_2)$, which can be computed explicitly by the results of Subsection~\ref{subsec:matroidpsi}. To prove the statement in the theorem, we show that this matrix is invertible over $\mathbb{Z}$. First, notice that the element $\widehat B$ was constructed so that \[ \sum_{i=m}^\ell (d_i+\hat d_i)=r-\mathrm{rk}(F_{m-1})\;\;\;\text{ for all }\;\;\;m\in\{1,\dots,\ell\}, \] so Lemma~\ref{lem:poincare}(2) implies that $\deg_{\mathsf{M}}(B\widehat B)=(-1)^{r-\ell+1}$. This implies that the diagonal entries of the matrix are all $\pm 1$. To finish the proof, it suffices to prove that the matrix is triangular with respect to some choice of ordering on the bases. For each basis element $B=D_{F_1}^{d_1}\cdots D_{F_\ell}^{d_\ell}$ as above, define a multidegree by \[ \delta(B)=(\hat d_\ell,\mathrm{rk}(F_{\ell-1}),\hat d_{\ell-1},\mathrm{rk}(F_{\ell-2}),\dots,\mathrm{rk}(F_1),\hat d_1,0,0,\dots). \] The multidegree defines a lexicographic partial ordering on the basis, and we let $\prec$ be any total ordering of the basis that refines the lexicographic partial ordering induced by $\delta$. In other words, we insist that $B\prec B'$ only if $\delta(B)$ is less than or equal to $\delta(B')$ in the lexicographic partial ordering. We claim that $\phi_k$ is lower triangular with respect to this order. To prove this, suppose that $B\prec B'$; we must prove that $\deg_{\mathsf{M}}(B\widehat B')=0$. First, consider the case where $\delta(B)=\delta(B')$. It follows that $\ell=\ell'$, and $\mathrm{rk}(F_i)=\mathrm{rk}(F_i')$ and $d_i=d_i'$ for all $i=1,\dots,\ell$. Since $B$ and $B'$ are not the same monomial, it must be the case that $F_i$ is incomparable to $F_i'$ for some $i$. Since $B$ has a factor of $F_i$ and $\widehat B'$ has a factor of $F_i'$, it follows that $B\widehat B'=0$, so $\deg_{\mathsf{M}}(B\widehat B')=0$. Next, consider the case where $\delta(B)\neq \delta(B')$. We first suppose that the first entry where they differ is $\mathrm{rk}(F_m)<\mathrm{rk}(F_m')$. This implies that $\hat d_i=\hat d_i'$ and $\mathrm{rk}(F_i)=\mathrm{rk}(F_i')$ for all $i>m$. Since $B$ has a nontrivial factor of $F_i$ and $\widehat B'$ has a nontrivial factor of $F_i'$, and these are flats of the same rank for $i>m$, the only way that $B\widehat B'\neq 0$ is if $F_i=F_i'$ for all $i>m$. Assuming that this is the case, we can write \[ B\widehat B'=F_\ell^{e_\ell}F_{\ell-1}^{e_{\ell-1}}\cdots F_{m+1}^{e_{m+1}}F_{m'}^e\cdots \] where the tail of the product consists of powers of flats of lower rank. Notice that \begin{align*} \sum_{i=m+1}^\ell e_i&=\sum_{i=m+1}^\ell(d_i+\hat d_i')\\ &=\sum_{i=m+1}^\ell(d_i+\hat d_i)\\ &=r-\mathrm{rk}(F_m)\\ &>r-\mathrm{rk}(F_m'), \end{align*} from which Lemma~\ref{lem:poincare}(1) implies that $\deg_\mathsf{M}(B\widehat B')=0$. Lastly, suppose that the first entry where $\delta(B)$ and $\delta(B')$ differ is $\hat d_m<\hat d_m'$. This implies that $\hat d_i=\hat d_i'$ for all $i>m$ and $\mathrm{rk}(F_i)=\mathrm{rk}(F_i')$ for all $i\geq m$. As in the previous case, we can write \[ B\widehat B'=F_\ell^{e_\ell}F_{\ell-1}^{e_\ell-1}\cdots F_{m}^{e_{m}}F^e\cdots, \] where $F$ is equal to the flat in $\{F_{m-1},F_{m-1}'\}$ with highest rank. We then compute \begin{align*} \sum_{i=m}^\ell e_i&=\sum_{i=m}^\ell(d_i+\hat d_i')\\ &>\sum_{i=m}^\ell(d_i+\hat d_i)\\ &=r-\mathrm{rk}(F_{m-1})\\ &\geq r-\mathrm{rk}(F) \end{align*} from which Lemma~\ref{lem:poincare}(1) implies that $\deg_\mathsf{M}(B\widehat B')=0$, completing the proof. \end{proof} \bibliographystyle{alpha} \newcommand{\etalchar}[1]{$^{#1}$}
\section{Introduction} In this paper, we consider simple graphs with no loops and no multiple edges. By {\em vertex coloring} of a graph, one normally means assigning integers, called {\em colors}, from $\{1,2,\ldots\}$ to graph's vertices so that no two vertices sharing the same edge have the same color. The smallest number of colors needed to color a graph $G$ is known as its {\em chromatic number}, and is often denoted by $\chi(G)$. There is an extensive literature in graph theory dedicated to vertex coloring and its various generalizations (e.g., see \cite{Malaguti,MalToth} and references therein), and graph coloring has many practical applications, e.g.\ in scheduling~\cite{Marx}, register allocation~\cite{Chaitin}, and in several other areas. In this paper, we introduce the notion of a {\em properly ordered coloring} of a weighted graph, or {\em POC}, generalizing the notion of vertex coloring of a graph, and study some of its properties. Suppose that $(G,w)$ is a vertex-weighted graph with the vertex set $V(G)$ and the edge set $E(G)$, and a weight function $w : V(G)\rightarrow W$, where $W$ is a set of positive integers. Further, let $c : V(G)\rightarrow C$ be a vertex coloring, where $C=\{1,2,\ldots,\theta\}$. A vertex coloring $c$ on $(G,w)$ is a properly ordered coloring (POC) if and only if for any edge $uv\in E(G)$, \begin{itemize} \item if $w(u)>w(v)$ then $c(u)>c(v)$; \item if $w(u)=w(v)$ then $c(u)\neq c(v)$. \end{itemize} We also let $$\chi_{POC}(G,w):=\min\{\theta |\ c \mbox{ is a POC on }(G,w)\}.$$ Note that any POC is also a proper vertex coloring on the underlying graph $G$, and so $\chi_{POC}(G,w)\geq \chi(G)$. In particular, if $|W|=1$ then $\chi_{POC}(G,w)= \chi(G)$. Also, note that for any $(G,w)$, $1\leq \chi_{POC}(G,w)\leq |V(G)|$, and $\chi_{POC}(G,w)$ is well-defined as replacing the weakly ordered weights $w_1\leq w_2\leq\cdots\leq w_{|V(G)|}$, respectively, by $1, 2,\ldots,|V|$ gives a properly ordered coloring. Throughout this paper, we may assume that $W=\{1, 2, \ldots ,|W|\}$ and $(G,w)$ contains a vertex $v_j$ such that $w(v_j)=j$ for each $j=1,\ldots ,|W|$ by the following observation: In view of the definition of POC, note that, for any pair of vertices $u,v\in V(G)$ with $w(v)<w(u)$, we may ignore the difference value $w(u)-w(v)$ unless there exists a vertex $x\in V(G)$ such that $w(u)<w(x)<w(v)$. (To see this, suppose that $u$ and $v$ are such vertices of $(G,w)$ and $w(u)>w(v)+1$. Let $w'$ be a new weight function obtained from $w$ by changing $w(u)$ as $w'(u)=w(v)+1$ (note that $w'(x)=w(x)$ for all $x\in V(G)-\{u\}$). Obviously, a POC on $(G,w)$ can also be a POC on $(G,w')$.) For example, $\chi_{POC}($\hspace{-3.5mm} \begin{minipage}[c]{3.5em}\scalebox{1}{ \begin{tikzpicture}[scale=0.5] \draw [line width=1](0,-0.5)--(0,0.5); \draw [line width=1](1,-0.5)--(1,0.5); \draw [line width=1](0,-0.5)--(1,-0.5); \draw [line width=1](0,0.5)--(1,0.5); \draw (0,-0.5) node [scale=0.4, circle, draw,fill=black]{}; \draw (1,-0.5) node [scale=0.4, circle, draw,fill=black]{}; \draw (0,0.5) node [scale=0.4, circle, draw,fill=black]{}; \draw (1,0.5) node [scale=0.4, circle, draw,fill=black]{}; \node [left] at (0,-0.6){${\small 2}$}; \node [right] at (1,-0.6){${\small 3}$}; \node [left] at (0,0.6){${\small 1}$}; \node [right] at (1,0.6){${\small 1}$}; \end{tikzpicture} }\end{minipage} $)=3$ because the induced path $P_3$ given by 1, 2, 3 makes these three vertices require three distinct colors, and the only POC of the graph is \hspace{-3.5mm} \begin{minipage}[c]{3.5em}\scalebox{1}{ \begin{tikzpicture}[scale=0.5] \draw [line width=1](0,-0.5)--(0,0.5); \draw [line width=1](1,-0.5)--(1,0.5); \draw [line width=1](0,-0.5)--(1,-0.5); \draw [line width=1](0,0.5)--(1,0.5); \draw (0,-0.5) node [scale=0.4, circle, draw,fill=black]{}; \draw (1,-0.5) node [scale=0.4, circle, draw,fill=black]{}; \draw (0,0.5) node [scale=0.4, circle, draw,fill=black]{}; \draw (1,0.5) node [scale=0.4, circle, draw,fill=black]{}; \node [left] at (0,-0.6){${\small 2}$}; \node [right] at (1,-0.6){${\small 3}$}; \node [left] at (0,0.6){${\small 1}$}; \node [right] at (1,0.6){${\small 2}$}; \end{tikzpicture} }\end{minipage}. In this paper, we shall investigate a relationship between a graph $G$ and properly ordered coloring on its weighted graphs $(G, w)$. In particular, we would like to find some invariants of a graph $G$ that can have a variety of vertex weight functions $w$. Along this line, we will show that the length of a longest path of a graph can be described as a function in terms of properly ordered coloring. To achieve this, for a graph $G$, let $$f(G):=\max\{\chi_{POC}(G,w)\ |\ w \mbox{ is a weight function on }G\}.$$ Also, let $\ell(G)$ be the number of vertices of a longest path in $G$. For a longest path $P=p_1\ldots p_{\ell(G)}$ of $G$, any weight function $w$ such that $w(p_1)<\cdots <w(p_{\ell(G)})$ forces $\chi_{POC}(G,w)\ge \ell(G)$. Therefore, note that any graph $G$ satisfies $f(G)\ge \ell(G)$. Our first result is to show that, in fact the equality holds. \begin{theorem}\label{better-bound-f} Any graph $G$ satisfies $f(G)= \ell(G)$. \end{theorem} This theorem is shown in Section~\ref{upper-f-G-sec} by providing a greedy algorithm based on vertex ordering given by non-decreasing order of their weights to give a POC on $(G,w)$ with at most $\ell(G)$ colors (see Theorem~\ref{alg-F-prime-theorem} in Section~\ref{upper-f-G-sec}). As an immediate corollary of this theorem, we see that a graph has a weighting requiring the maximum possible number of colors if and only if the graph has a Hamiltonian path. This implies that computing $f(G)$ is NP-hard in general. Next we consider a POC on $(G, w)$ with a fixed $|W|$. For a positive integer $t$, let $$\chi_{POC}(G;t):=\min\{p\ |\ \chi_{POC}(G,w)\leq p \ \mbox{for every} \ w \ \mbox{with} \ |W|=t \}.$$ Note that, by definition, $\chi_{POC}(G;t)\le \chi_{POC}(G;t')$ holds for any pair of $t$ and $t'$ with $t\le t'$ because any weight function $w$ with $|W|=t$ can also be regarded as a weight function with $|W|=t'$ by restricting the image of $w$. Somewhat surprisingly, we can show that the ratio of $\chi_{POC}(G;t)-1$ to $\chi(G)-1$ can be bounded by $t$ and the bound is best possible. Indeed, as observed in Section 4, there exist infinitely many graphs that attain the upper bound. \begin{theorem}\label{mainth} For a positive integer $t$, any graph $G$ satisfies \begin{center} $\displaystyle\frac{\chi_{POC}(G;t)-1}{\chi(G)-1}\le t$. \end{center} \end{theorem} In other words, $\chi_{POC}(G;t)$ has a sharp upper bound in terms of $\chi(G)$. This theorem is shown by determining $\chi_{POC}(G;t)$ when $G$ is a complete multipartite graph (see Proposition~\ref{p2} in Section~\ref{POC-G-t-sec}). We remark that we can easily obtain the weaker statement that $\frac{\chi_{POC}(G;t)}{\chi(G)}\le t$. To see this, for a $(G, w)$ with $|W|=t$, let $G_i$ be the induced subgraph by the vertices of weight $i$ in $G$ for $i=1,\ldots ,t$ and give a proper vertex coloring on each $G_i$ so that $\min\{c(x)| x\in V(G_{1})\}=1$ and $\min\{c(x)| x\in V(G_{i+1})\}=\max\{c(x)| x\in V(G_{i})\}+1$ for every $1\le i\le t-1$. Among such vertex colorings, we can find a POC using colors $1,\ldots, t\chi(G)$ on $(G, w)$ because $\chi(G_i)\le \chi(G)$ holds for all $i$. So Theorem~\ref{mainth} is the refinement of this observation up to the tight bound. In this paper, we also determine $\chi_{POC}(G,w)$ in terms of the number of vertices of a longest directed path for an acyclic orientation on $G$. To state this, we use the following notation: for a digraph $D$, let $\ell'(D)$ be the number of vertices of a longest directed path in $D$. For a directed path $P'$ consisting of arcs $(p_i,p_{i+1})$ for $i=1,\ldots, |V(P')|-1$, we call $p_1$ and $p_{|V(P')|}$ the \textit{tail} and the \textit{head} of $P'$, respectively. For a vertex weighted graph $(G,w)$, an acyclic orientaion is \textit{good} if $w(x)\geq w(y)$ holds for any arc $(x,y)$ in the orientation; we also define $\ell'(G,w):=\min\{\ell'(D)|\ D$ is a good acyclic orientation on $(G,w)\}$. \begin{theorem}\label{main3} Any weighted graph $(G,w)$ satisfies $\chi_{POC}(G,w)=\ell'(G,w)$. \end{theorem} This theorem can be regarded as the weighted version of the Gallai-Hasse-Roy-Vitaver theorem \cite{Gallai,Hasse,Roy,v}, which states that, for a graph $G$, $\chi(G)$ can be bounded by the number of vertices of a longest directed path in $D$, where $D$ is an orientation of $G$ and the upper bound is attained for an acyclic orientation of $G$. We now briefly mention an application of the notion of POC to a real world problem. In the intelligent chemical processing, graph coloring methods can offer a better way to raise processing effectiveness. For example, there are many stages (or procedures) for some special functions or some restrictions on the relations between two stages in the polyethylene processes (or polymer manufacturing processes) \cite{Holz,Spal}. Machine learning \cite{Kishi,Sch} can help to find the relation between stages and products and graph coloring methods can offer a lower cost way for product. We can set up stages as vertices, relation as arcs, and weights of vertices as the ordering (or prioritization) of all vertices. For example, there are five stages $A$ (stage of watching raw material), $B_1, B_2$ (stages of drying material), $C_1, C_2$ (stages of viscosity), $T$ (stage polymerization), and the relations $AB_1, AB_2, B_1B_2, B_1C_1, B_2C_2, C_1C_2, C_2T$ and a weighted function $w$ (the ordering in the processing) with $w(A)<w(B_1)=w(B_2) <w(C_1)=w(C_2)<w(T)$ in a chemical processing. By POC, we have $c(A)=1, c(B_1)=2, c(B_2)=c(C_1)=3, c(C_2)=4, c(T)=5$. The coloring $c$ can offer the minimum number of steps to run this processing (or to control the flow of this processing). \section{Upper bounds for $f(G)$}\label{upper-f-G-sec} In this section, we provide the following rather simple algorithm, thereby proving Theorem~\ref{better-bound-f}. In what follows, the neighbourhood $N(v)$ of a vertex $v$ is the set of all vertices adjacent to $v$. \begin{mdframed} \vspace{3mm} \centerline{\bf Algorithm F} \medskip \noindent {\bf Input:} $(G,w)$, where $V(G)=\{v_1,\ldots,v_n\}$ and $w(v_1)\leq\cdots\leq w(v_n)$;\\ \noindent {\bf Output:} a POC with at most $\ell:=\ell(G)$ colors.\\[-3mm] \begin{description} \item{{\bf Step 1.}} Set $c(v_1)=1$. \item{ {\bf Step 2.}} For $j=2,\ldots ,n$, if $N(v_j)\cap (\cup_{i=1}^{j-1}\{v_i\})=\emptyset$, then set $c(v_j)=1$; otherwise, set $c(v_j)=\max\{c(v_i)| v_iv_j\in E(G)$ and $1\le i<j\}+1$. \end{description} \end{mdframed} \begin{theorem}\label{alg-F-prime-theorem} For any $(G,w)$, where $G$ is of order $n$, algorithm F indeed yields a POC with at most $\ell:=\ell(G)$ colors. \end{theorem} \begin{proof} By the construction of algorithm F, note that, for any vertex $v$ of $G$, there exists a maximal path $P=p_1p_2\ldots p_t$ in $G$ such that $c(p_1)=1$ and $v=p_t$ and $c(p_{i+1})=c(p_i)+1$ for $i=1,2,\ldots , t-1$. So we have $t\le \ell(G)$. Thus, from algorithm F we obtain a POC with at most $\ell$ colors. \end{proof} Theorem~\ref{better-bound-f} is an immediate corollary of Theorem~\ref{alg-F-prime-theorem}. \section{The function $\chi_{POC}(G;t)$ in complete multipartite graphs}\label{POC-G-t-sec} We start with the following result on $\chi_{POC}(G;t)$ for complete bipartite graphs. \begin{theorem}\label{compl-bipart-theorem} For $1\leq m\leq n$, if $t\geq 2m+1$, then $\chi_{POC}(K_{m,n};t)=\min\{m+n, 2m+1\}$.\end{theorem} \begin{proof} If $m\le n\le m+1$, then $K_{m,n}$ contains a Hamiltonian path. In this case, by Theorem~\ref{better-bound-f}, we have $\chi_{POC}(K_{m,n};t)=\min\{m+n, 2m+1\}=m+n$. Thus we may assume that $m+2\le n$. Since $K_{m,n}$ has a longest path of order $2m+1$, say $P=v_1\ldots v_{2m+1}$, for any $(K_{m,n},w)$ such that $w(v_1)<\cdots<w(v_{2m+1})$, we have $\chi_{POC}(K_{m,n},w)\geq 2m+1$. Thus, $\chi_{POC}(K_{m,n};t)\geq 2m+1$. To show that $\chi_{POC}(K_{m,n};t)\leq 2m+1$, let $(X,Y)$ be the partite set of $K_{m,n}$ such that $|X|=m$ and $|Y|=n$. For $(K_{m,n},w)$ we can assume that $X$ and $Y$ can be partitioned into parts $X=X_1\cup\cdots\cup X_m$ and $Y=Y_1\cup\cdots\cup Y_{m+1}$ such that \begin{itemize} \item $X_i\neq \emptyset$ for all $1\leq i\leq m$, but some of $Y_i$ can be empty; \item $\max\{w(x)\ |\ x\in X_i\} \leq \min\{w(x')\ |\ x'\in X_{i+1}\}$ for $i=1,\ldots,m-1$; \item $\max\{w(y)\ |\ y\in Y_i\} \leq \min\{w(y')\ |\ y'\in Y_{i+1}\}$ for $i=1,\ldots,m$; and \item $\max\{w(y)\ |\ y\in Y_i\} \leq \min\{w(x)\ |\ x\in X_i\} \leq \max\{w(x)\ |\ x\in X_i\} \leq \min\{w(y)\ |\ y\in Y_{i+1}\}$ for $i=1,\ldots,m$. \end{itemize} Let $c:V\rightarrow N$ be the vertex coloring such that $c(x)=2i$ for $x\in X_i$ and $c(y)=2i-1$ for $y\in Y_i$. Note that some of colors in $C$ may not be used because $Y_i$ can be the empty set for some $i$. In any case, by the construction, $c$ is a POC on $(K_{m,n},w)$ such that $|C|\leq 2m+1$. Hence, $\chi_{POC}(K_{m,n};t)\leq 2m+1$ and the theorem is proved. \end{proof} We now turn our attention to a more general case, namely, complete multipartite graphs. Unlike Theorem~\ref{compl-bipart-theorem}, it seems difficult to provide a simple formula for $\chi_{POC}(G;t)$ in such general cases. To state our results, we give some preliminaries. Suppose that $G$ is a vertex colored graph by $c: V(G)\rightarrow C$ and let $S$ be a subset of $V(G)$ of $s$ vertices. If vertices $x_1,\ldots, x_s$ of $S$ can be ordered as $c(x_i)=c(x_{i-1})+1$ for $i=2,\ldots,s$, then we say that $S$ \textit{is consecutively colored}; in particular, when we want to specify the minimum value on $c$, we say that $S$ \textit{is consecutively colored from} $c(x_1)$. Also, for a consecutively colored subset $S$, we sometimes want to specify $x_1$ or $x_s$. In that case, we say that $S$ \textit{is consecutively colored from $x_1$ with color $c(x_1)$ to $x_s$}. Note that we do not need to mention $c(x_s)$ because we can see the value as long as we know both $c(x_1)$ and $|V(S)|(=s)$ by the assumption that $S$ is consecutively colored. Now, for $k\ge 2$, we consider a POC on weighted complete multipartite graphs $(K_{n_1,\ldots, n_k}, w)$. To state our result precisely, we give the following notation. Let $(K_{n_1,\ldots, n_k}, w)$ be a weighted complete multipartite graph such that $w: V(K_{n_1,\ldots, n_k}) \rightarrow \{1,\ldots ,t\}$. For $i=1,\ldots, t$, let $H_i$ be a complete subgraph of $K_{n_1,\ldots ,n_k}$ such that $w(x)=i$ for all $x\in H_i$. The subgraphs $H_1,\ldots , H_t$ are called \textit{maximum ordered cliques} (briefly, {\em MOCs}), if $H_1,\ldots , H_t$ are chosen so that $\displaystyle\sum_{i=1}^t|V(H_i)|$ is as large as possible in $K_{n_1,\ldots ,n_k}$. Note that, any MOCs $H_1,\ldots , H_t$ satisfy $H_i\neq\emptyset$ for every $1\le i\le t$ by the assumption that $(G,w)$ contains a vertex $v_j$ such that $w(v_j)=j$ for every $1\le j\le t$. For MOCs $H_1,\ldots , H_t$, we can find a subgraph $\mathcal{S}(H_1,\ldots , H_t)$ of $\overline{K_{n_1,\ldots ,n_k}}$ (the complement of $K_{n_1, \ldots ,n_k}$) having the following three properties (i)--(iii): \begin{description} \item{(i)} Each component $P$ of $\mathcal{S}(H_1,\ldots , H_t)$ forms a path $P=p_1\ldots p_s$ with $s\ge 2$ such that $V(P)$ is contained in a partite set of $K_{n_1,\ldots ,n_k}$ (equivalently, $V(P)$ forms isolated vertices in $K_{n_1,\ldots ,n_k}$) and $w(p_i)=w(p_{i-1})+1$ holds for $i=2,\ldots ,s$ (equivalently, $p_i\in H_{w(p_{i-1})+1}$ holds for $i=2,\ldots ,s$). Moreover, $s$ can be greater than $2$ only if $V(H_{w(p_i)})=\{p_i\}$ holds for every $i$ with $2\le i\le s-1$. (Since $H_1,\ldots ,H_t$ are cliques and $V(P)$ is contained in a partite set of $K_{n_1,\ldots ,n_k}$, note that $|V(H_i)\cap V(P)|\leq 1$ holds for every $1\leq i\leq t$.) \item{(ii)} For any pair of components $P, P'$ in $\mathcal{S}(H_1,\ldots , H_t)$, there exists at most one clique $H_i$ among $H_1,\ldots ,H_t$ such that $V(P)\cap V(H_i)\neq\emptyset$ and $V(P')\cap V(H_i)\neq\emptyset$. \item{(iii)} For $i=1,\ldots ,t$, $|H_i\cap V(\mathcal{S}(H_1,\ldots , H_t))|\le 2$. \end{description} It is possible that $\mathcal{S}(H_1,\ldots , H_t)=\emptyset$ when there is no such subgraph in $\overline{K_{n_1,\ldots ,n_k}}$ for MOCs $H_1,\ldots , H_t$. Thus we can take $\mathcal{S}(H_1,\ldots , H_t)$ for any MOCs $H_1,\ldots , H_t$. By the construction, $\mathcal{S}(H_1,\ldots , H_t)$ forms a union of vertex-disjoint paths. As observed in the proofs of Propositions~\ref{p1} and~\ref{p2}, this special subgraph is useful to save the number of colors needed to give a POC on the weighted complete multipartite graph. In fact we will give a vertex coloring so that each component of $\mathcal{S}(H_1,\ldots , H_t)$ has the same color and this is the key idea for saving the number of colors to obtain a desired POC. Note that $0\le |V(\mathcal{S}(H_1,\ldots , H_t))|\le 2t-2$, and the upper bound can be attained only if $|V(H_1)\cap V(\mathcal{S}(H_1,\ldots , H_t))|=|V(H_t)\cap V(\mathcal{S}(H_1,\ldots , H_t))|=1$ and $|V(H_i)\cap V(\mathcal{S}(H_1,\ldots , H_t))|=2$ for $i=2,\ldots ,t-1$. We say that $\mathcal{S}(H_1,\ldots , H_t)$ is \textit{maximum $(H_1,\ldots ,H_t)$-paths} if it is chosen in such a way that $|V(\mathcal{S}(H_1,\ldots , H_t))|$ is as large as possible in $\overline{K_{n_1,\ldots ,n_k}}$. For maximum $(H_1,\ldots ,H_t)$-paths $\mathcal{S}(H_1,\ldots , H_t)$, let $q(\mathcal{S}(H_1,\ldots , H_t))$ be the number of components in $\mathcal{S}(H_1,\ldots , H_t)$. We first prove the following proposition. \begin{proposition}~\label{p1} Let $n_1,\ldots, n_k$ be positive integers with $k\ge 2$ and $(K_{n_1,\ldots ,n_k}, w)$ be a vertex weighted graph of $K_{n_1,\ldots ,n_k}$ such that $w: V(G)\rightarrow \{1,\ldots ,t\}$. Also, let $H_1,\ldots ,H_t$ be a MOCs of $(K_{n_1,\ldots ,n_k}, w)$ and $\mathcal{S}(H_1,\ldots , H_t)$ be a maximum $(H_1,\ldots ,H_t)$-paths of $\overline{K_{n_1,\ldots ,n_k}}$. Then, there exists a POC on the graph $(K_{n_1,\ldots ,n_k}, w)$ that uses $\displaystyle\sum_{i=1}^t|V(H_i)|-|V(\mathcal{S}(H_1,\ldots , H_t))|+q(\mathcal{S}(H_1,\ldots , H_t))$ colors. \end{proposition} \begin{proof} Let $q:=q(\mathcal{S}(H_1,\ldots , H_t))$ and $P_1=p^1_1\ldots p^1_{|V(P_1)|},\ldots, P_q=p^q_1\ldots p^q_{|V(P_q)|}$ be components of $\mathcal{S}(H_1,\ldots , H_t)$ such that $w(p^i_1)=\min \{w(x)|\ x\in V(P_i)\}$ and $w(p^i_{|V(P_i)|})=\max \{w(x)|\ x\in V(P_i)\}$ for $i=1,\ldots ,q$ and $w(p^i_{|V(P_i)|})\le w(p^{i+1}_1)$ for $i=1,\ldots ,q-1$ (so that $P_1,\ldots , P_q$ appear in this order from $H_1$ to $H_t$). We now give a vertex-coloring by the following manner: For each component $P_i$ of $\mathcal{S}(H_1,\ldots , H_t)$, we assign the same color to all vertices in $P_i$. Therefore, in the following argument, we will only mention the color of one vertex of $P_i$. We will basically give a consecutive coloring on $H_i$ from $i=1$ to $t$ successively so that $\max\{c(x)|\ x\in V(H_{i-1})\}\le \min\{c(y)|\ y\in V(H_i)\}$ holds for $i=2,\ldots ,t$, where the equality holds only if there exists a component $P$ of $\mathcal{S}(H_1,\ldots , H_t)$ such that $V(P)\cap V(H_{i-1})\neq\emptyset$ and $V(P)\cap V(H_i)\neq\emptyset$. Thus, we start with giving a consecutive coloring on $H_1$. If $V(H_1)\cap V(P_1)=\emptyset$ then give an arbitrary consecutive coloring on $H_1$ and continue to give a consecutive coloring on $H_2, \ldots, H_{j-1}$ successively until we have some $H_j$ such that $p^1_1\in V(H_j)$ for the component $P_1=p^1_1\ldots p^1_{|V(P_1)|}$ of $\mathcal{S}(H_1,\ldots , H_t)$. Note that, if $\mathcal{S}(H_1,\ldots , H_t)=\emptyset$ then we just give consecutive colorings successively on $H_i$ from $i=1$ to $t$ and then we are done. So we now assume that $p^1_1\in V(H_j)$ with $j\ge 1$ for $P_1=p^1_1\ldots p^1_{|V(P_1)|}$. If $V(H_j)=\{p^1_1\}$, then we assign color $\displaystyle\sum_{i=1}^{j-1}|V(H_i)|+1$ on $p^1_1$. Otherwise, give a consecutive coloring on $H_j$ from a vertex of $H_1-P_1$ to $p^1_1$. From $i=j+1$ to $t$, we successively give a consecutive coloring on $H_i$ by the following manner: For a component $P_i=p^i_1\ldots p^i_{|V(P_i)|}$ of $\mathcal{S}(H_1,\ldots , H_t)$, once we have assigned a color on $p^i_{j-1}$ for some $j\ge 2$, we continue to assign the same color on $p^i_{j}$ until all the vertices of $P_i$ receive the same color. Keeping this coloring procedure in mind, we only have to consider the following three cases on coloring of $H_i$. \begin{description} \item{$\bullet$} If $H_i$ does not contain any vertex of $V(\mathcal{S}(H_1,\ldots , H_t))$ that has already been colored just after the coloring procedure on $H_{i-1}$, then we give a consecutive coloring on $H_i$ from a vertex $v\in V(H_i)$ with color $\max\{c(x)|\ x\in \displaystyle\cup_{j=1}^{i-1}V(H_j)\}+1$. In this case, if possible, choose the vertex $v$ so that $v\notin V(\mathcal{S}(H_1,\ldots , H_t))$. (Thus, we would like to color from a vertex $v$ so that $v\notin V(\mathcal{S}(H_1,\ldots , H_t))$ to a vertex in $V(\mathcal{S}(H_1,\ldots , H_t))$ if it contains a vertex for the next path.) \item{$\bullet$} If $H_i$ contains a vertex $v$ of $V(\mathcal{S}(H_1,\ldots , H_t))$ that has already been colored by the coloring procedure and $V(H_i)\cap V(\mathcal{S}(H_1,\ldots , H_t))=\{v\}$, then we give a consecutive coloring on $H_i$ from $v$. \item{$\bullet$} If $H_i$ contains a vertex $v$ of $V(\mathcal{S}(H_1,\ldots , H_t))$ that has already been colored by the coloring procedure and $V(H_i)$ contains another (uncolored) vertex $u$ from $V(\mathcal{S}(H_1,\ldots , H_t))$, then we give a consecutive coloring on $H_i$ from $v$ to~$u$. \end{description} Proceeding in this way, in view of the properties (i)--(iii) on $\mathcal{S}(H_1,\ldots , H_t)$, we can give a coloring on all the vertices of $H_1,\ldots ,H_t$. We then assign colors for the other vertices in $K_{n_1,\ldots ,n_k}$. For a vertex $v\in V(K_{n_1,\ldots ,n_k})-V(H_1\cup\ldots \cup H_t)$, there exists a vertex $u\in V(H_j)$ for some $1\le j\le t$ such that $(V(H_j)-\{u\})\cup\{v\}$ induces a clique in $K_{n_1,\ldots ,n_k}$ since $H_1,\ldots , H_t$ are a MOCs. Assign the same color $c(u)$ on $v$. We can easily see from the above construction that the resulting coloring is a desired POC. \end{proof} For the convenience of the readers, we will now demonstrate giving a POC on $(K_{1,3,5}, w)$ by the coloring procedure described in the poof of Proposition~\ref{p1} in the following case: Let $X=\{x_1\}, Y=\{y_1, y_2, y_3\}, Z=\{z_1, z_2, z_3, z_4, z_5\}$ be the three partite sets of $K_{1,3,5}$ and suppose that $w(x_1)=w(y_1)=w(z_1)=1, w(z_2)=w(z_5)=2, w(y_2)=w(z_3)=3, w(y_3)=w(z_4)=4$. In this case, we can take a MOCs $H_1, H_2, H_3, H_4$ such that $V(H_1)=\{x_1, y_1, z_1\}, V(H_2)=\{z_2\}, V(H_3)=\{y_2, z_3\}, V(H_4)=\{y_3, z_4\}$. Note that $V(K_{1,3,5})-V(H_1\cup H_2\cup H_3\cup H_4)=\{z_5\}$. Let $P_1=z_1z_2z_3, P_2=y_2y_3$ be paths in $\overline{K_{1,3,5}}$. Then we can let $\mathcal{S}(H_1, H_2, H_3, H_4)=P_1\cup P_2$. According to the coloring procedure in the proof of Proposition~\ref{p1}, we can color the vertices as follows: $c(x_1)=1, c(y_1)=2$; any vertex of $P_1$ receives color $3$; any vertex of $P_2$ receives color $4$; $c(z_4)=5, c(z_5)=2$. Note that $q(\mathcal{S}(H_1, H_2, H_3, H_4))=2$ and now we obtained a POC on $(K_{1,3,5}, w)$ using $\sum_{i=1}^4|V(H_i)|-|V(\mathcal{S}(H_1,H_2,H_3, H_4))|+q(\mathcal{S}(H_1,H_2,H_3, H_4))=8-5+2=5$ colors. Let $(K_{n_1,\ldots ,n_k}, w)$ be a weighted complete multipartite graph, where $w$ is a weight function such that $w: V(K_{n_1,\ldots ,n_k}) \rightarrow \{1, \ldots ,t\}$. For the fixed integers $n_1,\ldots ,n_k$, we can obtain a fixed value $g(n_1,\ldots ,n_k, t; w)$ as follows: \begin{center} $g(n_1,\ldots ,n_k, t; w)=\max\{\displaystyle\sum_{i=1}^t|V(H_i)|-|V(\mathcal{S}(H_1,\ldots , H_t))|+q(\mathcal{S}(H_1,\ldots , H_t)) \ | \ H_1,\ldots , H_t$ are a MOCs in $(K_{n_1,\ldots ,n_k}, w) \}$. \end{center} Under this notation, we further define the following function on $K_{n_1,\ldots ,n_k}$: \begin{center} $h(n_1,\ldots ,n_k,t):=\max\{g(n_1,\ldots ,n_k,t ;w)|\ w$ is a weight function on $K_{n_1,\ldots ,n_k}$ such that $w: V(K_{n_1,\ldots ,n_k}) \rightarrow \{1, \ldots ,t\}\}$. \end{center} \begin{proposition}~\label{p2} Let $n_1,\ldots, n_k$ be positive integers with $k\ge 2$. Then, $$\chi_{POC}(K_{n_1,\ldots ,n_k}; t)=h(n_1,\ldots ,n_k,t).$$ \end{proposition} \begin{proof} For a weighted complete multipartite graph $(K_{n_1,\ldots ,n_k}, w)$ such that $w: V(K_{n_1,\ldots ,n_k}) \rightarrow \{1, \ldots ,t\}$, let $H_1,\ldots ,H_t$ be a MOCs. By the construction, we need at least $\displaystyle\sum_{i=1}^t|V(H_i)|-|V(\mathcal{S}(H_1,\ldots , H_t))|+q(\mathcal{S}(H_1,\ldots , H_t))$ colors to give a POC on the induced subgaph by $\displaystyle\cup_{i=1}^tV(H_i)$ in $(K_{n_1,\ldots ,n_k}, w)$, since otherwise, for some $i$, $H_i$ cannot be consecutively colored, or a pair of vertices $x$ and $y$ such that $V(H_i)=\{x\}, V(H_{i+1})=\{y\}$ cannot have distinct colors and then we cannot give a POC on $(K_{n_1,\ldots ,n_k}, w)$. This implies that $\chi_{POC}(K_{n_1,\ldots ,n_k}; t)\ge h(n_1,\ldots ,n_k,t)$. This, together with Proposition~\ref{p1}, shows that $\chi_{POC}(K_{n_1,\ldots ,n_k}; t)=h(n_1,\ldots ,n_k,t).$ \end{proof} Now we obtain the following corollary. \begin{corollary}\label{cor} Let $n_1,\ldots, n_k$ be positive integers with $k\ge 2$. Then, $$\chi_{POC}(K_{n_1,\ldots ,n_k}; t)\le (k-1)t+1.$$ \end{corollary} \begin{proof} Let $H_1,\ldots ,H_t$ and $\mathcal{S}(H_1,\ldots , H_t))$ be as in Proposition~\ref{p1}. It suffices to show that $$\displaystyle\sum_{i=1}^t|V(H_i)|-|V(\mathcal{S}(H_1,\ldots , H_t))|+q(\mathcal{S}(H_1,\ldots , H_t))\le (k-1)t+1.$$ We will show a contradiction to the assumption that $$\displaystyle\sum_{i=1}^t|V(H_i)|> |V(\mathcal{S}(H_1,\ldots , H_t))|-q(\mathcal{S}(H_1,\ldots , H_t))+(k-1)t+1.$$ This implies that at least $|V(\mathcal{S}(H_1,\ldots , H_t))|-q(\mathcal{S}(H_1,\ldots , H_t))+2$ cliques of $H_1,\ldots , H_t$ have $k$ vertices, respectively. This assures us that we can find maximum $(H_1,\ldots ,H_t)$-paths in $\overline{K_{n_1,\ldots ,n_k}}$ having at least $|V(\mathcal{S}(H_1,\ldots , H_t))|-q(\mathcal{S}(H_1,\ldots , H_t))+1$ components. Recall that each component of $\mathcal{S}(H_1,\ldots , H_t)$ consists of at least two vertices. Therefore, it contains $$2(|V(\mathcal{S}(H_1,\ldots , H_t))|-q(\mathcal{S}(H_1,\ldots , H_t))+1)$$ vertices, which is more than $|V(\mathcal{S}(H_1,\ldots , H_t))|$ vertices. This contradicts our assumption on the maximality of $|V(\mathcal{S}(H_1,\ldots , H_t))|$. \end{proof} The bound on $\chi_{POC}(K_{n_1,\ldots ,n_k}; t)$ of Corollary~\ref{cor} is best possible. We will show this in the next section (after proving Theorem~\ref{mainth}) . \section{ Proof of Theorems~\ref{mainth} and~\ref{main3} together with some remarks} We are now in a position to prove our second main theorem. \begin{proof} Construct a complete multipartite graph $K_{n_1,\ldots ,n_{\chi(G)}}$ from $G$ by adding edges and apply Corollary~\ref{cor} to $K_{n_1,\ldots ,n_{\chi(G)}}$. Then there exists a POC on $K_{n_1,\ldots ,n_{\chi(G)}}$ using at most $(\chi(G)-1)t+1$ colors. This vertex coloring is also a POC on $G$. Thus we have that $\chi_{POC}(G,t)\le (\chi(G)-1)t+1$. This completes the proof of Theorem~\ref{mainth}. \end{proof} We remark that the upper bound on $\chi_{POC}(G,t)$ is sharp. To see this, consider the case where $(G, w)$ is a weighted complete multipartite graph with $w: V(G)\rightarrow \{1,\ldots ,t\}$ such that each partite set contains vertices having $t$ distinct weights. Then any MOCs $H_1,\ldots , H_t$ of $G$ satisfy $$|V(\mathcal{S}(H_1,\ldots , H_t))|=2t-2.$$ Therefore, in view of the coloring procedure described as in the proof of Proposition~\ref{p1}, we can easily check that such a graph attains the upper bound. We then provide the following two propositions concerning the relationship between digraphs and POC coloring in vertex weighted graphs. \begin{proposition}~\label{p3} Let $(G, w)$ be a weighted graph. Then there exists a good acyclic orientation of $(G,w)$; moreover, we have $\chi_{POC}(G,w)\leq \ell'(G,w)$. \end{proposition} \begin{proof} To obtain a desired orientation, we firstly look at the induced subgraph $H_i$ by the vertex set $\{v\in V(G)| w(v)=i\}$ for $i=1,\ldots , |W|$ in $(G, w)$. For every $i$, if $H_i$ contains an edge, then we give any acyclic orientation on $H_i$. We then give an orientation on other edges $xy\in E(G)$ so that $(x,y)$ is an arc if and only if $w(x)>w(y)$ holds. We now claim that the resulting orientation $D$ is a desired orientation. To see this, suppose that the resulting digraph $D$ contains a directed cycle $C$. Let $(x,y)$ be an arc on $C$ and consider the directed path obtained from $C$ by deleting $(x,y)$. Note that $y$ is the tail and $x$ is the head on this directed path and hence $w(x)\le w(y)$. By the construction, we may assume that $V(C)$ contains two vertices $u,v$ such that $w(u)<w(v)$. This implies that $w(x)<w(y)$. However, this contradicts the construction of $D$ because we have $(x,y)\in A(D)$. Hence $D$ is a good acyclic orientation. To show the second assertion, we provide the following algorithm F$'$, which is a slight modification of Algorithm F for the digraph case. Note that, $N^+(v)$ means the out-neighbour of a vertex $v$ in $D$. \begin{mdframed} \vspace{3mm} \centerline{\bf Algorithm F$'$} \medskip \noindent {\bf Input:} $(G,w)$ with a good acyclic orientation $D$, where $V(G)=$ \\ $\{v_1,\ldots,v_n\}$ and $w(v_1)\leq\cdots\leq w(v_n)$;\\ \noindent {\bf Output:} a POC with at most $\ell'(D)$ colors.\\[-3mm] \begin{description} \item{{\bf Step 1.}} Set $c(v_1)=1$. \item{ {\bf Step 2.}} For $j=2,\cdots ,n$, if $N^+(v_j)\cap (\cup_{i=1}^{j-1}\{v_i\})=\emptyset$, then set $c(v_j)=1$; otherwise, set $c(v_j)=\max\{c(v_i)| (v_j, v_i)\in A(D)$ and $1\le i<j\}+1$. \end{description} \end{mdframed} Arguing similarly as in the proof of Theorem~\ref{alg-F-prime-theorem}, we see that Algorithm F$'$ yields a POC with at most $\ell'(D)$ colors, thereby proving that $\chi_{POC}(G,w)\le \ell'(D)$. Thus we have $\chi_{POC}(G,w)\leq \ell'(G,w)$. \end{proof} \begin{proposition}\label{new} Let $(G, w)$ be a weighted graph and $c: V(G)\rightarrow C$ be a POC on $(G,w)$ with $C=\{1,2, \ldots, \theta\}$. Then there exists a good acyclic orientation $D$ of $G$ such that $\ell'(D)\leq \theta$ (that is, $\chi_{POC}(G,w)\geq \ell'(G,w)$). \end{proposition} \begin{proof} We give an orientation on $(G,w)$ from the vertex coloring of $c$ on $V(G)$ by the following manner: for an edge $xy$ of $G$, if $c(x)>c(y)$ then orient $xy$ so that $x$ is a tail and $y$ is a head. Let $D$ be the resulting orientation of $(G,w)$. Since $c$ is a POC on $(G,w)$, by the construction, obviously $D$ is a good acyclic orientaton of $(G,w)$ and we need at least $\ell'(D)$ colors in $C$. Thus we have $\ell'(D)\le \theta$. \end{proof} Combining Propositions~\ref{p3} and~\ref{new}, we obtain Theorem~\ref{main3}. We finally suggest some open questions for graphs with no large clique from the following viewpoint: Obviously, the value of $\chi_{POC}(G,t)$ must be at least the order of any clique contained in $G$. Utilizing our result concerning complete multipartite graphs, we obtained a nontrivial upper bound on $\chi_{POC}(G,t)$ (in terms of the chromatic number and $t$) for general graphs. The situation would change a lot if we restrict our attention to sparse graphs such as planar graphs or graphs with large girth. What is the sharp upper bound on $\chi_{POC}(G,t)$ for these graph classes? This could be a challenging but interesting direction of further research. \section*{Acknowledgments} The authors would like to thank the referees for carefully reading our article and for many helpful comments. The first author's research was supported by JSPS KAKENHI (19K03603).
\section{0pt}{2pt plus 4pt minus 2pt}{2pt plus 2pt minus 2pt} \usepackage{enumerate} \usepackage{amsfonts} \usepackage{color} \usepackage{soul} \usepackage{todonotes} \presetkeys% {todonotes}% {inline}{} \usepackage{graphicx} \usepackage[colorlinks,allcolors=blue]{hyperref} \usepackage[capitalize]{cleveref} \usepackage{cleveref} \newcommand{--}{--} \newcommand{\expect}[1]{\langle #1 \rangle} \newcommand{\com}[2]{\left[{#1}\,,\,{#2}\right]} \newcommand{\anticomm}[2]{\left\{{#1}\,,\,{#2}\right\}} \newcommand{\covDer}{\bar{\nabla}} \newcommand{\babs}[1]{\big| #1 \big|} \newcommand{\bnorm}[1]{\big\| #1 \big\|} \newcommand{\bexpect}[1]{\big\langle #1 \big\rangle} \newcommand{\bcomm}[2]{\big[{#1}\,,\,{#2}\big]} \newcommand{\banticomm}[2]{\big\{{#1}\,,\,{#2}\big\}} \newcommand{\sabs}[1]{\left| #1 \right|} \newcommand{\snorm}[1]{\left\| #1 \right\|} \newcommand{\sexpect}[1]{\left\langle #1 \right\rangle} \newcommand{\scomm}[2]{\left[{#1}\,,\,{#2}\right]} \newcommand{\santicomm}[2]{\left\{{#1}\,,\,{#2}\right\}} \newcommand{\me}[1]{\mathrm{e}^{#1}} \newcommand{\od}[2]{\frac{\mathrm{d} #1}{\mathrm{d} #2}} \newcommand{\odd}[2]{\frac{\mathrm{d}^2 #1}{\mathrm{d} #2^2}} \newcommand{\pd}[2]{\frac{\partial #1}{\partial #2}} \newcommand{\pdd}[2]{\frac{\partial^2 #1}{\partial #2^2}} \newcommand{\cc}[1]{{#1}^*} \newcommand{\hc}[1]{{#1}^\dagger} \newcommand{\pc}[1]{{#1}^{\vphantom{\dagger}}} \newcommand{\tc}[1]{\tilde{#1}} \newcommand{\transpose}[1]{\ensuremath{#1}^{\intercal}} \renewcommand{\v}[1]{\boldsymbol{#1}} \newcommand{\uv}[1]{\v{e}_{#1}} \newcommand{\vecr}{\boldsymbol{r}} \newcommand{\etal}{\textit{et al.}} \definecolor{DarkBlue}{rgb}{0,0,0.80} \definecolor{DarkRed}{rgb}{0.80,0,0} \definecolor{Purple}{rgb}{0.55,0,0.55} \definecolor{Purple}{rgb}{0,0,0.8} \newcommand{\textcolor{DarkRed}{[x]}}{\textcolor{DarkRed}{[x]}} \newcommand{\morten}[1]{\textcolor{DarkBlue}{#1}} \newcommand{\jacob}[1]{\textcolor{DarkRed}{#1}} \newcommand{\eirik}[1]{\textcolor{Purple}{#1}} \DeclareMathOperator{\re}{Re} \DeclareMathOperator{\im}{Im} \DeclareMathOperator{\sgn}{sgn} \DeclareMathOperator{\diag}{diag} \DeclareMathOperator{\antidiag}{antidiag} \DeclareMathOperator{\rect}{rect} \newcommand*{\coloneqq}{\coloneqq} \newcommand*{\eqqcolon}{\eqqcolon} \newcommand{\U}[1]{\underline{#1}} \renewcommand{\O}[1]{\bar{#1}} \renewcommand{\H}[1]{\hat{#1}} \newcommand{\V}[1]{\check{#1}} \newcommand{\B}[1]{\bm{#1}} \newcommand{\BV}[1]{\V{\B{#1}}} \newcommand{\BH}[1]{\H{\B{#1}}} \newcommand{\R}[1]{\H{#1}^R} \newcommand{\A}[1]{\H{#1}^A} \newcommand{\K}[1]{\H{#1}^K} \newcommand{\BR}[1]{\BH{#1}^R} \newcommand{\BA}[1]{\BH{#1}^A} \newcommand{\BK}[1]{\BH{#1}^K} \newcommand{\up}{\uparrow} \newcommand{\dn}{\downarrow} \newcommand{\create}[1][]{\Psi^\dagger_{#1}} \newcommand{\destroy}[1][]{\Psi^{\vphantom{\dagger}}_{#1}} \newcommand*{\TO}{\mathcal T} \newcommand*{\mathcal T_c}{\mathcal T_c} \newcommand*{\mathcal{C}}{\mathcal{C}} \newcommand{\textsc{SC}}{\textsc{SC}} \newcommand{\textsc{NM}}{\textsc{NM}} \newcommand{\textsc{AFI}}{\textsc{AFI}} \newcommand{\text{int}}{\text{int}} \newcommand{i.e.\ }{i.e.\ } \newcommand{e.g.\ }{e.g.\ } \newcommand{\prlsection}[1]{\textbf{#1:}} \let\epsilon\varepsilon \begin{document} \title{Spin-pumping in superconductor-antiferromagnetic insulator bilayers} \author{Eirik Holm Fyhn} \affiliation{Center for Quantum Spintronics, Department of Physics, Norwegian \\ University of Science and Technology, NO-7491 Trondheim, Norway} \author{Jacob Linder} \affiliation{Center for Quantum Spintronics, Department of Physics, Norwegian \\ University of Science and Technology, NO-7491 Trondheim, Norway} \date{\today} \begin{abstract} We study theoretically spin pumping in bilayers consisting of superconductors and antiferromagnetic insulators. We consider both compensated and uncompensated interfaces and include both the regular scattering channel and the Umklapp scattering channel. We find that at temperatures close to the critical temperatures and precession frequencies much lower than the gap, the spin-current is enhanced in superconductors as compared to normal metals. Otherwise, the spin-current is suppressed. The relevant precession frequencies where the spin-current in SC/AFI is enhanced compared to NM/AFI is much lower than the typical resonance frequencies of antiferromagnets, which makes the detection of this effect experimentally challenging. A possible solution lies in the shifting of the resonance frequency by a static magnetic field. \end{abstract} \maketitle \section{Introduction}% \label{sec:introduction} Both superconductors (SC) and antiferromagnets (AF) are of particular interest in the context of spintronics. Antiferromagnets disturb neighbouring components less than ferromagnetic or ferrimagnetic materials, because they produce no net stray field~\cite{baltz2018}. This means that antiferromagnetic components can be packed more tightly and are more robust against external magnetic fields than their ferromagnetic counterparts. Additionally, antiferromagnets operate at THz frequencies, which are much faster than the GHz frequencies of ferromagnets (F). This can allow for ultrafast information processing when working with antiferromagnets. Superconductivity is a type of order that normally competes with magnetism. However, the discovery of spin-triplet superconductivity has shown that complete synergy between superconductivity and magnetism is possible~\cite{bergeret2005,buzdin2005,linder2015,eschrig2015_rep,linder2019}, and superconductors are now an integral part of spintronics research. In addition to the potential for minimal Joule heating that comes with superconductivity, superconductors are interesting from a spintronics perspective because of spin-charge separation~\cite{kivelson1990,zhao1995}, which allows spin- and charge-imbalances to decay over different length scales. It has been observed that the spin relaxation time can be considerably longer than the charge relaxation time~\cite{quay2013}. Since both superconductors and antiferromagnets are useful as building blocks in spintronic devices, it is of interest to study spin-transport in hybrid superconductor-antiferromagnet devices. Despite this, SC/AF structures are largely unexplored compared to superconductor-ferromagnetic structures. Here, we study theoretically spin-pumping in superconductor-antiferromagnetic insulator (SC/AFI) bilayers. This refers to the injection of a spin-current in the superconductor, which we consider to be spin-singlet and s-wave, by the application of a precessing magnetic field in the AFI~\cite{tserkovnyak2002}. Spin pumping has been observed in F/SC structures~\cite{jeon2018,jeon2018_nat,yao2018} and investigated theoretically in F/SC structures by calculations based on the local dynamic spin susceptibility in the SC~\cite{inou2017,kato2019} and quasiclassical theory~\cite{silaev2020,silaev2020R}. The theoretical works found an enhanced spin current in superconductors compared to normal metals (NMs) below the transition temperatures~\cite{inou2017,kato2019}. While spin-pumping in SC/AF structures has, to our knowledge, not been explored, some important work has been done with normal metal-antiferromagnetic systems. It has been found theoretically that spin-pumping is of a similar magnitude as in the ferromagnetic case~\cite{cheng2014,kamra2017}, and more recently measurements of the inverse spin-Hall voltage demonstrated the spin-pumping effect in MnF$_2$/Pt~\cite{vaidya2020}. Combining the demonstration of AF/NM spin-pumping with the above mentioned evidence of F/SC spin-pumping, AF/SC spin-pumping is feasible and merits further study. We mainly follow the methodology presented in \cite{kato2019}, but modified for a superconductor-antiferromagnetic insulator bilayer. In particular, the staggered magnetic order of the AFI gives rise to two different scattering channels~\cite{takei2014,fjaerebu2017,fjaerebu2019}, and the two different sublattices can be coupled to the superconductor in a symmetric or asymmetric way. To capture this we will not approximate the interaction Hamiltonian by a uniform scattering amplitude, as in \cite{kato2019}, but instead model the interaction with an exchange coupling between itinerant electrons in the SC and the localized spins in the AFI. Using this coupling, it turns out that the relevant quantity is not the \emph{local} dynamic spin susceptibility, as in \cite{inou2017,kato2019}, but instead the \emph{planar} dynamic spin susceptibility. Using the planar dynamic spin susceptibility we find that the spin-pumping into superconductors from antiferromagnets is enhanced as compared to spin-pumping into normal metals when the temperature is close to the transition temperature and the precession frequency is small compared to the energy gap. Otherwise the spin-current in the superconductor is suppressed. This is similar to the results obtained from ferromagnets. However, unlike in the case of ferromagnets, the resonance frequency in antiferromagnets is typically too large for spin-pumping with frequencies below the gap to be experimentally detectable. One possible solution is to apply a static magnetic field, which we discuss in \cref{sec:experiment}. \section{Model}% \label{sec:methodology} \begin{figure}[htpb] \centering \includegraphics[width=0.7\linewidth]{sketch.pdf} \caption{Sketch of a Superconductor (SC)-antiferromagnetic insulator (AFI) bilayer with a precessing external magnetic field $\v h(t)$.}% \label{fig:sketch} \end{figure} The system depicted in \cref{fig:sketch} is modelled by the Hamiltonian \begin{equation} H = H_\textsc{SC} + H_\textsc{AFI} + H_\text{int}, \end{equation} where the Bogoliubov-de Gennes Hamiltonian, \begin{equation} H_\textsc{SC} = \sum_{\v k \in \square} \mqty(c^\dagger_{\v k, \up} & c_{-\v k, \dn}) \mqty(\xi_{\v k} & \Delta \\ \cc\Delta & -\xi_{\v k}) \mqty(c_{\v k, \up} \\ c^\dagger_{-\v k, \dn}), \end{equation} where $\square$ is the first Brillouin zone (1BZ) in the superconductor, gives a mean-field description of superconductivity. The antiferromagnetic insulator Hamiltonian is given by \begin{equation} H_\textsc{AFI} = J\sum_{\langle i, j \rangle} \v S_i \cdot \v S_j - K\sum_{i} S_{i, z}^2 - \gamma \sum_i \v S_i \cdot \v h. \label{eq:H_afi} \end{equation} where $\langle i, j \rangle$ means that the sum goes over nearest neighbours and $\sum_i$ goes over lattice points in the AFI. The exchange coupling at the interface is given by \begin{equation} H_\text{int} = -2\sum_i J_i \mqty(c^\dagger_{i, \up} & c^\dagger_{i, \dn}) \v \sigma \mqty(c_{i, \up} \\ c_{i, \dn}) \cdot \v S_i, \end{equation} where the sum goes over the lattice points in the interface. Here, $\xi_{\v k}$, is the kinetic energy measured relative to the chemical potential $\mu$, $c_{\v k,\sigma}$ is the annihilation operator for electrons with spin $\sigma$ and wavevector $\v k$, $J$ is the antiferromagnetic exchange parameter, $K$ is the easy-axis anisotropy, $\v S_i$ is the spin at lattice site $i$ in the AFI and $\gamma$ gives the coupling strength to the external magnetic field $\v h$. The vector of Pauli matrices is given by $\v \sigma$, and $J_i = J_A$ ($J_i = J_B$) when $i$ belongs to the $A$ ($B$) sublattice. Also, $\Delta$ is the superconducting gap parameter, which we assume real and satisfies \begin{equation} 1 = \lambda \int_0^{\omega_D}\frac{\tanh(\sqrt{\varepsilon^2 + \Delta^2}/2T)}{\sqrt{\varepsilon^2 + \Delta^2}}, \label{eq:gap} \end{equation} where $T$ is the temperature, which we assume to be the same for the superconductor and AFI, and $\omega_D$ and $\lambda$ are material-specific parameters that determine the critical temperature $T_c$ and the zero-temperature gap $\Delta_0 \coloneqq \Delta(0)$. In order diagonalize $H_\textsc{AFI}$ we can do a Holstein-Primakoff transformation followed by a Fourier transform and a Bogoliubov transformation. This gives to second order in magnon operators the following antiferromagnetic Hamiltonian: \begin{multline} H_\text{AFI} = \sum_{\v k\in\Diamond} \left(\omega^{\alpha}_{\v k} \alpha^\dagger_{\v k}\alpha_{\v k} + \omega^{\beta}_{\v k} \beta^\dagger_{\v k}\beta_{\v k}\right)\\ + \sqrt{2N_AS} (u_{\v 0} + v_{\v 0}) \gamma\left[h^-\left(\alpha_{\v 0} + \beta^\dagger_{\v 0}\right) + h^+\left(\alpha^\dagger_{\v 0} + \beta_{\v 0}\right)\right], \end{multline} where $\Diamond$ is the first magnetic Brillouin zone, which is the 1BZ corresponding to the $A$ sublattice, $N_A$ is the number of lattice points in the $A$ sublattice, $S$ is the spin at each lattice point, $\alpha_{\v k} = u_{\v k}a_{\v k} - v_{\v k}b^\dagger_{-\v k}$ and $\beta_{\v k} = u_{\v k}b_{\v k} - v_{\v k}a^\dagger_{-\v k}$, where $a_{\v k}$ and $b_{\v k}$ are the magnon annihilation operators for the $A$ and $B$ sublattices, and \begin{subequations} \label{eq:bogoCoeffs} \begin{align} u_{\v k} &= \frac{Jz + K}{\sqrt{\left(Jz + K\right)^2 - \left(J\gamma_{\v k}\right)^2}},\\ v_{\v k} &= -\frac{J\gamma_{\v k}}{\sqrt{\left(Jz + K\right)^2 - \left(J\gamma_{\v k}\right)^2}},\\ \omega^\alpha_{\v k} &= S\sqrt{\left(Jz + K\right)^2 - \left(J\gamma_{\v k}\right)^2} + \gamma h_z, \\ \omega^\beta_{\v k} &= S\sqrt{\left(Jz + K\right)^2 - \left(J\gamma_{\v k}\right)^2} - \gamma h_z. \end{align} \end{subequations} Here, $h_z$ is the $z$-component of the external magnetic field, which is the same as the magnetization direction in the antiferromagnet and the direction of the easy-axis anisotropy. Moreover, $h^\pm = h_x \pm i h_y$ and \begin{align} \gamma_{\v k} &= \sum_{\langle \v \delta \rangle} \cos(\v k \cdot \v \delta) = \gamma_{-\v k}, \end{align} where the sum goes over the nearest neighbour displacement vectors $\v \delta$, and $z$ is the number of nearest neighbours. To write $H_\text{int}$ in terms of Fourier components requires us to connect the reciprocal space in the superconductor with the reduced Brillouin zone of the magnetic lattice in the AFI. This gives rise to so-called Umklapp scattering, where the wavevector falls outside the 1BZ in the AFI~\cite{fjaerebu2019}. Whether this effect is present depends on the interface. Depending on how the interface slices the biparte lattice of the AFI, the interface can have a different number of atoms belonging to the $A$ and $B$ lattices. If the interface has an equal number of atoms from each sublattice and the coupling strengths $J_A$ and $J_B$ are equal, we call it a compensated interface. Otherwise, it is uncompensated. We let $\v x = \v 0$ to be the location of a lattice point belonging to the $A$ sublattice and $\v x_0$ be such that all lattice points at the interface can be written $\v x_0 + \tilde{\v x}_i$, where $\v x_0 \cdot \tilde{\v x}_i = 0$. To capture both compensated and uncompensated interfaces we will use the notation $\delta^A_{\v q_{\parallel},\v k_{\parallel}}=1$ to mean that $\v q \cdot \tilde{\v x}_i - \v k\cdot \tilde{\v x}_i = 2\pi n + d_1$ for all vectors $\tilde{\v x}_i$ such that $\v x_0 + \tilde{\v x}_i$ is in the $A$-sublattice at the interface and for some integer $n$ and a constant $d_1$ that is independent of $\tilde{\v x}_i$. Similarly, $\delta^B_{\v q_{\parallel},\v k_{\parallel}}=1$ means that $\v q \cdot \tilde{\v x}_i -\v k\cdot \tilde{\v x}_i = 2\pi n + d_2$ for all lattice vectors $\v x_0 + \tilde{\v x}_i$ in the $B$ sublattice at the interface and for some integer $n$ and a constant $d_2$ that is independent of $\tilde{\v x}_i$. We can determine $d_1$ by noting that both $\tilde{\v x}_i$ and $2\tilde{\v x}_i$ is in the $A$ sublattice, so $2d_1 = d_1 + 2\pi n \implies d_1 = 2\pi m$ for some integer $m$. Hence, we can set $d_1 = 0$. Similarly, if $\tilde{\v x}_i$ is in the $B$ sublattice, then $2\tilde{\v x}_i$ is in the $A$ sublattice, so $4\pi n + 2 d_2 = 2\pi m \implies d_2 = l\pi$ for some integer $l$. The $\v k$-vectors that result in $l$ being an odd-number give rise to the Umklapp scattering channel. We can drop the superscripts because $\delta^A_{\v q_{\parallel},\v k_{\parallel}}=1 \iff \delta^B_{\v q_{\parallel},\v k_{\parallel}}=1$. This is because every lattice point in the $B$ sublattice is midway between two lattice points in the $A$ sublattice and vica versa. Finally, if the number of lattice points at the interface is equal on the superconductor and the antiferromagnet, then half of the possible $\v k$-vectors in the superconductor will give $l = 0$ and the other half will give $l = 1$. There is a vector $\v G$ connecting the region in $\square$ with $l = 0$ to those with $l=1$. For a concrete example, consider the situation where the crystal lattices of the SC and AFI are equal and cubical. The 1BZ in the SC, $\square$, is therefore also cubical. Meanwhile, the sublattice in the AFI is face-centered cubic, so $\Diamond$ is the truncated octahedron inscribed in $\square$. A wavevector in the corner of $\square$ will be in the center of the second Brillouin zone in the AFI. If we let $\v G$ be the vector in a corner of $\square$, then $\exp(i\v G \cdot \v x_i)$ is 1 when $\v x_i$ is in the $A$ sublattice and $-1$ when $\v x_i$ is in the $B$ sublattice. Thus $\v G$ is the vector that connects the region of $\v k$-vectors in $\square$ with regular scattering and those with Umklapp-scattering. Using this notation, $H_\text{int}$ can, to first order in magnon operators, be written \begin{equation} H_\text{int} = \sum_{\v k \in \square} \sum_{\v q \in \Diamond} \left[T^\alpha_{\v q \v k} \alpha_{\v q} s^-_{\v k} + T^{\beta^\dagger}_{\v q \v k} \beta^\dagger_{\v q} s^-_{\v k} + \text{h.c.} \right] + H^Z_\text{int}, \label{eq:Hint} \end{equation} where \begin{align} H^Z_\text{int} &= -\sqrt{2SN_A} \sum_{\v k \in \square} \delta_{\v k_\parallel,\v 0}\left(\bar J_A - (-1)^l\bar J_B\right)s^z_{\v k}\me{-i\v x_0 \cdot \v k} \label{eq:zeeman_term} \end{align} is the Zeeman energy and \begin{subequations} \label{eq:transmissionCoeffs} \begin{align} T^\alpha_{\v q \v k} = - \me{i\v x_0 \cdot (\v k + \v q)}\Bigl[ \bar J_A u_{\v q} &+ (-1)^l\bar J_B v_{\v q} \Bigr]\delta_{\v k_\parallel,-\v q_\parallel}, \\ T^{\beta^\dagger}_{\v q \v k} = - \me{i\v x_0 \cdot (\v k - \v q)} \Bigl[ \bar J_A v_{\v q} &+ (-1)^l\bar J_B u_{\v q} \Bigr]\delta_{\v k_\parallel,\v q_\parallel} . \end{align} \end{subequations} Additionally, \begin{subequations} \begin{align} \bar J_A = J_A\frac{2\sqrt{2S}N_A^\parallel}{N_S\sqrt{N_A}}, \\ \bar J_B = J_B\frac{2\sqrt{2S}N_B^\parallel}{N_S\sqrt{N_A}}, \end{align} \end{subequations} where $N_S$ is the number of lattice points in the superconductor and $N_A^\parallel$ ($N_B^\parallel$) is the number of lattice points belonging to the $A$ ($B$) sublattice at the interface, and \begin{subequations} \begin{align} s^z_{\v k} &= \frac 1 2 \sum_{\v q \in \square} \left(c^\dagger_{\v q \up}c_{\v q+\v k \up} - c^\dagger_{\v q \dn}c_{\v q+\v k \dn}\right), \\ s^-_{\v k} &=\sum_{\v q \in \square} c^\dagger_{\v q \dn}c_{\v q+\v k \up}. \end{align} \end{subequations} The reason why the factor $(-1)^l$ is in front of the terms proportional to $\bar J_B$ in \cref{eq:zeeman_term,eq:transmissionCoeffs} is that the coordinate system is defined such that $\v x = 0$ is the location of a lattice point belonging to the $A$ sublattice. \section{Green's functions}% \label{sec:green_s_functions} In order to calculate the spin current we will make use of Green's functions corresponding to three different types of operators. Let $\psi$ be either $\alpha$, $\beta^\dagger$ or $s^+$, then the lesser, retarded and advanced Green's functions are \begin{subequations} \label{eq:GFs} \begin{align} G_\psi^<(t_1,t_2, \v k) &= -i\left\langle \psi^\dagger_{\v k}(t_2) \psi_{\v k}(t_1)\right\rangle_0, \\ G_\psi^R(t_1,t_2, \v k) &= -i\theta(t_1-t_2)\left\langle \left[\psi_{\v k}(t_1),\, \psi^\dagger_{\v k}(t_2)\right]\right\rangle_0, \\ G_\psi^A(t_1,t_2, \v k) &= i\theta(t_2-t_1)\left\langle \left[\psi_{\v k}(t_1),\, \psi^\dagger_{\v k}(t_2)\right]\right\rangle_0, \end{align} \end{subequations} respectively. The subscript $0$ means that the expectation values are taken in the absence on $H_\text{int}$. This is done because we will treat $H_\text{int}$ as a perturbation in the interaction picture. This is a good approximation as long as the the transmission coeffiecients are small and has previously been shown to give good agreement with experiments~\cite{oyanagi2019,kato2020,umeda2018}. We will also define the distribution function \begin{equation} f^{\psi}(\varepsilon, \v k) \coloneqq \frac{G_\psi^<(\varepsilon, \v k)}{2i \Im G_\psi^R(\varepsilon, \v k)}, \end{equation} where the Green's functions in \cref{eq:GFs} are Fourier transformed with respect to the relative time $t_1 - t_2$. In thermal equilibrium, $f^{\psi}(\varepsilon, \v k)$ is equal to the Bose-Einstein distribution function $n_B(T, \varepsilon)$. First consider the effect of spin pumping. We add spin pumping in the AFI by letting $h^\pm(t) = h_0\me{\mp i\Omega t}$. The reader is referred to \cref{sec:afi_green_s_functions} for the detailed calculation, which shows that the retarded Green's functions are unaffected to second order in $h_0$. Since the unperturbed Hamiltonian is diagonal in $\alpha$ and $\beta$, this means that the retarded Green's functions for $\alpha$ and $\beta^\dagger$ are \begin{subequations} \begin{align} G_{\alpha}^{R}(\varepsilon, \v k) &= \frac{1}{\varepsilon - \omega^\alpha_{\v k} + i\eta^\alpha},\\ G_{\beta^\dagger}^{R}(\varepsilon, \v k) &= -G_{\beta}^{A}(-\varepsilon, \v k) = \frac{1}{\varepsilon + \omega^\beta_{\v k} + i\eta^\beta}, \end{align} \label{eq:AFIretarded} \end{subequations} where $\eta^\alpha$ and $\eta^\beta$ are the lifetimes of the $\alpha$ and $\beta$ magnons. The distribution functions are modified by the oscillating magnetic field, and to second order in $h_0$ \begin{multline} f^\nu(\varepsilon, \v k) = n_B(\varepsilon, T)\\ + \frac{2\pi N_AS [(u_{\v 0} + v_{\v 0})\gamma h_0]^2}{\eta^\nu} \delta_{\v k, \v 0} \delta(\varepsilon - \Omega), \label{eq:AFIdistribution} \end{multline} where $\nu \in \{\alpha,\, \beta^\dagger\}$. The dynamic spin susceptibility $G_{s^+}^{R}$ is more complicated, but can be calculated from the imaginary time Green's function by use of analytical continuation and Matsubara summation techniques. This is shown in \cref{sec:bcs_dynamic_spin_susceptibility}, and the result is \begin{multline} G_{s^+}^{R}(\varepsilon, \v k) = -\frac 1 4 \sum_{\v q}\sum_{\omega = \pm E}\sum_{\tilde\omega = \pm\tilde E} \left(1 + \frac{\xi\tilde\xi + \Delta^2}{\omega\tilde\omega}\right) \\ \times \frac{n_F(\tilde\omega, T)- n_F(\omega, T)}{\varepsilon + i\eta^\textsc{SC} - (\tilde\omega - \omega)}, \label{eq:BCSspinSusc} \end{multline} where $\xi = \xi_{\v q}$, $\tilde \xi = \xi_{\v q + \v k}$, $E = \sqrt{\xi^2 + \Delta^2}$ and $\tilde E = \sqrt{\tilde\xi^2 + \Delta^2}$, $n_F$ is the Fermi-Dirac distribution function. Since the spin-pumping in the AFI does not affect the Hamiltonian in the superconductor, the distribution function is $f^{s^+}(\varepsilon, \v k) = n_B(\varepsilon, T)$. \section{Spin current}% \label{sec:spin_current} To find the spin current we follow \citet{kato2019} and use that \begin{align} I_s = -\frac{\partial}{\partial t}\left\langle s^z_{\v 0} \right\rangle = -i \left\langle \left[H, s^z_{\v 0}\right] \right\rangle. \end{align} From the fact that $s^z_{\v 0}$ commutes with $H_\textsc{SC} + H_\textsc{AFI}$, $\left[s^-_{\v q} , s^z_{\v 0}\right] = s^-_{\v q}$, and $[A^\dagger,B] = -[A, B^\dagger]^\dagger$, we find that \begin{align} \left[H, s^z_{\v 0}\right] = \sum_{\v k \in \square} \sum_{\v q \in \Diamond} \left[T^\alpha_{\v q \v k} \alpha_{\v q} s^-_{\v k} + T^{\beta^\dagger}_{\v q \v k} \beta^\dagger_{\v q} s^-_{\v k} - \text{h.c.} \right]. \end{align} Thus, the spin current is \begin{align} \label{eq:spinCurr_init} I_s(t) = 2 \sum_{\v k \in \square} \sum_{\v q \in \Diamond}\sum_{\nu\in\{\alpha,\; \beta^\dagger\}} \Im\left\langle T^\nu_{\v q \v k} s^-_{\v k}(t)\nu_{\v q}(t) \right\rangle. \end{align} We evaluate this expectation value in the interaction picture and treating the interfacial exchange interaction as a perturbation using the Keldysh formalism. First, let $G_\psi$ with no superscript denote contour-ordered Green's functions, \begin{equation} G_\psi(\tau_1,\tau_2, \v k) = -i\left\langle\mathcal T_c \psi_{\v k}(\tau_1) \psi^\dagger_{\v k}(\tau_2)\right\rangle_0, \end{equation} where $\mathcal T_c$ means that $\psi_{\v k}$ and $\psi_{\v k}^\dagger$ are ordered with respect to $\tau_1$ and $\tau_2$ along the complex Keldysh contour, $\mathcal C$. Next, we define \begin{align} C(\tau_1, \tau_2) \coloneqq \left\langle \mathcal T_c T^\nu_{\v q \v k} \nu_{\v q}(\tau_1) s^-_{\v k}(\tau_2)\right\rangle, \end{align} where $\nu$ is either $\alpha$ or $\beta^\dagger$. Going to the interaction picture with $H_\text{int}$ as the interaction, we get \begin{multline} C(\tau_1, \tau_2) = \left\langle \mathcal T_c T^\nu_{\v q \v k} \nu_{\v q}(\tau_1) s^-_{\v k}(\tau_2)\me{-i\int_{\mathcal C} \dd{\tau} H_\text{int}(\tau)}\right\rangle_0 \\ \approx \left\langle \mathcal T_c\int_{\mathcal C}\dd{\tau} \abs{T^\nu_{\v q \v k}}^2 \nu_{\v q}(\tau_1)\nu^\dagger_{\v q}(\tau)s^+_{-\v k}(\tau) s^-_{\v k}(\tau_2)\right\rangle_0 \\ =i\abs{T^\nu_{\v q \v k}}^2 \bigl[G_\nu(\v q) \bullet G_{s^+}(\v k)\bigr](\tau_1, \tau_2), \end{multline} where we have used the bullet product $\bullet$ to denote integration of the internal complex time parameter along the Keldysh contour. In the second equality it was used that \begin{equation} -i\left\langle \mathcal T_c s^+_{-\v k'}(\tau)s^-_{\v k}(\tau_2)\right\rangle_0 = \delta_{\v k, \v k'}G_{s^+}(\tau, \tau_2, \v k), \end{equation} as can be confirmed by using Wick's theorem. Next, if we choose $\tau_2$ to be placed later in the contour we have \begin{equation} C(\tau_1, \tau_2) = C^<(\tau_1, \tau_2) = \left\langle T^\nu_{\v q \v k} s^-_{\v k}(\tau_2)\nu_{\v q}(\tau_1) \right\rangle. \end{equation} From the Langreth rules we have \begin{align} C^<(t,t) = \left[G^R_\nu(\v q) \circ G_{s^+}^<(\v k) + G^<_\nu(\v q) \circ G_{s^+}^A(\v k)\right](t,t), \label{eq:c_time} \end{align} where the circle product $\circ$ means integration over the internal real time coordinate. The circle products are the same as normal convolution products, since $G_\psi^R(t_1, t_2)$ and $G_\psi^<(t_1, t_2)$ only depend on time through the relative time $t_1 - t_2$. Thus, by writing \cref{eq:c_time} in terms of Fourier transformed Green's functions, the circle products become normal products, so, by inserting it into \cref{eq:spinCurr_init}, \begin{multline} I_s = 4 \int \frac{\dd{\varepsilon}}{2\pi} \sum_{\v k \in \square} \sum_{\v q \in \Diamond}\sum_{\nu\in\{\alpha,\, \beta^\dagger\}} \abs{T^\nu_{\v q \v k}}^2\Im G^R_\nu(\varepsilon, \v q) \\\times \Im G_{s^+}^R(\varepsilon, \v k) \left[f^\nu (\varepsilon, \v q)-f^{s^+}(\varepsilon, \v k)\right], \label{eq:spinPumpE} \end{multline} where we used that $G_{\psi}^A(\varepsilon) = [G_{\psi}^R(\varepsilon)]^*$. Inserting \cref{eq:transmissionCoeffs,eq:AFIretarded,eq:AFIdistribution} into \cref{eq:spinPumpE} and using \cref{eq:bogoCoeffs} gives \begin{equation} I_s = I_r + I_U, \end{equation} where \begin{multline} \label{eq:regular_curr} I_r = -\bar J_A^2 \gamma^2 h_0^2 \left(\frac{1}{\left(\Omega - \omega^\alpha_{\v 0}\right)^2 + \left(\eta^\alpha\right)^2} \left[\frac{U_K + (1 - c)}{2 + U_K}\right]^2\right. \\ + \left.\frac{1}{\left(\Omega + \omega^\beta_{\v 0}\right)^2 + \left(\eta^\beta\right)^2} \left[\frac{cU_K + (c - 1)}{2 + U_K}\right]^2\right) \\ \times \sum_{\v k \in \square, l=0}\Im G_{s^+}^R(\Omega, \v k)\delta_{\v k_\parallel, \v 0} \end{multline} and \begin{multline} \label{eq:umklapp_curr} I_U = -\bar J_A^2 \gamma^2 h_0^2 \left(\frac{1}{\left(\Omega - \omega^\alpha_{\v 0}\right)^2 + \left(\eta^\alpha\right)^2} \left[\frac{U_K + (1 + c)}{2 + U_K}\right]^2\right. \\ + \left.\frac{1}{\left(\Omega + \omega^\beta_{\v 0}\right)^2 + \left(\eta^\beta\right)^2} \left[\frac{c U_K + (c + 1)}{2 + U_K}\right]^2\right) \\ \times \sum_{\v k\in\square, l=0} \Im G_{s^+}^R(\Omega, \v k + \v G)\delta_{\v k_\parallel, \v 0}. \end{multline} Here, $U_K = K/(Jz)$ and $c = \bar J_B/\bar J_A$ is the interface asymmetry parameter that gives the degree to which the interface is compensated. The sums are restricted to include only the $\v k$-vectors that satisfy $\delta_{\v k_\parallel, \v 0}=1$ with $l=0$ and $\v G$ is the vector that connects these to the $\v k$-vectors with $l=1$. When both the SC and AFI are cubical with a lattice parameter $a$ and a compensated interface, then $\v G = \pi (\uv x + \uv y + \uv z)/a$. In order for the Umklapp scattering to produce a nonzero $I_U$, it is necessary that there exists $\v k, \v q \in \square$ such that both $\v q$ and $\v q + \v k + \v G$ are close to the Fermi surface and $\delta_{\v k_\parallel, \v 0} = 1$. In a cubical lattice the minimal value of $\v k + \v G$ is $\sqrt{2}\pi/a$, so the maximal diameter of the Fermi surface must be at least $\sqrt{2}\pi/a$. The Umklapp current is also zero if the interface is fully uncompensated. In this case there is no Umklapp scattering and the current is simply $I_s = I_r$ with $c = 0$. \section{Numerical results} Next we show numerical results for a cubical lattice with lattice constant $a$ such that \begin{equation} \xi_{\v k} = -2t\sum_{i\in\{x, y, z\}} \cos(a k_i) - \mu, \end{equation} where $t$ is the hopping parameter. In \cref{fig:2d} we show the spin current into the superconductor, $I^\textsc{SC}_s$, for different temperatures $T$ and precession frequencies $\Omega$, normalized by the normal state value, $I^\textsc{NM}_s$ in \cref{fig:2d}~a) and a constant in \cref{fig:2d}~b). In this case we have used $\mu = -4t$, which means that $I_U = 0$. However, we find that both $I_r$ and $I_U$ scale in the same way as functions of $\Omega$ and $T$ also for other values of $\mu$. In \cref{fig:2d} we have also used $U_k = 0.01$, which is close to the reported value for MnF$_2$~\cite{hagiwara1996,johnson1959}, $t = 1000\Delta_0$, $c = 0.5$, $\eta^\alpha = \eta^\beta = \Delta_0 \times 10^{-4}$ and $\omega_{\v 0}^\alpha = \omega_{\v 0}^\beta = 4\Delta_0$. This corresponds to a resonance frequency of $\SI{1}{\tera\hertz}$ when $\Delta_0 = \SI{1}{\milli\electronvolt}$. From \cref{fig:2d}~b) we see that the normal state spin current at $T > T_c$ scales linearly with $\Omega$ as expected. In comparison, the spin current changes only very slowly with $\Omega$ in the superconducting state. This is consistent with the physical picture that it is the availability of quasiparticles rather than unoccupied states that limits the current in the superconducting state. As one can see from \cref{fig:2d}~a), the spin-current in the superconductor is peaked at small frequencies close to the critical temperature, where it can be more than twice as large as the normal-metal spin-current. This is similar to the results for spin-currents in superconductor-ferromagnetic bilayers~\cite{kato2019,inou2017}. \Cref{fig:slices} shows the ratio $I_s^\textsc{SC}/I_s^\textsc{NM}$ as a function of $\Omega/\Delta_0$ for various $T$. It can be seen that at zero temperature the spin current in the superconducting case is zero for $\Omega < 2\Delta_0$. For $T > 0$ the ratio $I_s^\textsc{SC}/I_s^\textsc{NM}$ initially decreases as $\Omega$ increases and reaches a minimum at $\Omega = 2 \Delta(T)$. This can be understood physically in the following way. The spin-current is generated by spin-flip scatterings which excite particles by energy $\Omega$ and flip their spin. This can be seen from \cref{eq:Hint,eq:BCSspinSusc,eq:regular_curr,eq:umklapp_curr} when $\eta^\textsc{SC} \ll 1$. In this case the sum in \cref{eq:BCSspinSusc} only contribute to imaginary part of $G^R_{s^+}(\Omega, \v k)$ when $\tilde\omega - \omega = \Omega$, and only when $n_F(\omega,T)-n_F(\tilde\omega,T)\neq 0$. In the normal metal case there is a number of electrons proportional to $\Omega$ around the Fermi surface which can be excited to an available state. Hence, the dynamic spin-susceptibility is proportional to $\Omega$. In a superconductor the spin-flip scatterings can happen by breaking a Cooper pair or exciting a quasiparticle from above the gap to a higher energy. When $\Omega < 2\Delta(T)$ only the latter is possible. Thus, in order to get a nonzero spin-current when $\Omega < 2\Delta(T)$ the temperature must be large enough for quasiparticle states above the gap to be occupied. This is why, in \cref{fig:slices}, the current is identically zero in the superconductor when $T = 0$ and $\Omega < 2\Delta_0$. On the other hand, when the temperature is close to the critical temperature there can be many available quasiparticles available because the density of states is peaked around the gap. This peak in the density of states is why the spin-current in a superconductor can be larger than the spin-current in a normal metal, but only when the temperature is close to the critical temperature. It is also only larger when $\Omega \ll \Delta(T)$, which is because the lack of states below the gap in the superconductor means that the spin susceptibility can not increase as fast as in the normal state when $\Omega$ increases. In the normal state there is a range of energies $\propto\Omega$ around the Fermi surface that can be excited to an available state, but in the superconducting state the number of states that can be excited is limited by the number of quasiparticles present. Increasing $\Omega$ therefore decreases the ratio $I_s^\textsc{SC}/I_s^\textsc{NM}$ when $\Omega < 2 \Delta(T)$, as can be seen in \cref{fig:2d,fig:slices}. At $\Omega = 2 \Delta(T)$ the breaking of Cooper pairs becomes possible as a spin-transfer mechanism, which is why $I_s^\textsc{SC}/I_s^\textsc{NM}$ starts to increase. This can be seen most clearly in \cref{fig:slices}. \Cref{fig:umklapp} shows the ratio between regular spin-current $I_r$ and the Umklapp contribution $I_U$ for $\mu = -2.2t$. The result is shown for axis anisotropy $U_k = 0.01$, which correspond to MnF$_2$~\cite{hagiwara1996,johnson1959}, and $U_k = 0.37$, corresponding to FeF$_2$~\cite{ohlman1961}. In both cases the regular current dominates when the interface asymmetry parameter $c$ is small, meaning that the superconductor is coupled more strongly to one of the sublattices in the AFI. The Umklapp contribution becomes more important as $c$ increases and when $U_k$ is small the Umklapp contribution eventually becomes larger than the contribution from the regular scattering channel. This is consistent with the work by \citeauthor{kamra2017} showing that the in the absence of easy-axis anisotropy the cross-sublattice contribution quench the spin-current from the regular scattering channel~\cite{kamra2017}. However, here we see that if we include the Umklapp scattering the spin-current will not go all the way to zero, even in the absence of easy-axis anisotropy. Mathematically, this can be seen from \cref{eq:regular_curr,eq:umklapp_curr}: when $U_k = 0$ we have $I_r \propto (1-c)^2$ and $I_U \propto (1+c)^2$. However, when $U_k= 0.37$ the regular contribution remains dominant for all values of $c$. \begin{figure}[htpb] \centering \includegraphics[width=1.0\linewidth]{2d.pdf} \caption{The spin-current into a superconductor with gap given by \cref{eq:gap}, $I^\textsc{SC}_s$, for different precession frequencies $\Omega$ and temperatures $T$ and normalized by the normal state spin-current, $I^\textsc{NM}_s$, found by setting $\Delta = 0$ in a) and the constant $I_0 = \gamma^2 h_0^2 \bar{J}_A^2 N_SN_S^\perp/\left[(2\pi)^4 \Delta_0\right]$ in b). $N_S^\perp$ is the number of lattice points in the superconductor in the direction transverse to the interface, $\Delta_0$ is the superconducting gap at $T=0$ and $T_c$ is the critical temperature.}% \label{fig:2d} \end{figure} \begin{figure}[htpb] \centering \includegraphics[width=1.0\linewidth]{slices.pdf} \caption{The spin-current into a superconductor, $I^\textsc{SC}_s$ normalized by the normal state spin-current, $I^\textsc{NM}_s$, found by setting the gap $\Delta = 0$, as a function of the spin-pumping precession frequency $\Omega$. Here, $\Delta(T)$ is the energy gap that solves \cref{eq:gap} and $T_c$ is the critical temperature.}% \label{fig:slices} \end{figure} \begin{figure}[htpb] \centering \includegraphics[width=1.0\linewidth]{umklapp.pdf} \caption{The ratio of the spin-current contribution from the regular scattering channel, $I_r$, and the Umklapp scattering channel, $I_U$, as a function of the interface asymmetry parameter $c$ for $\Omega/\Delta_0 = 0.1$, $T/T_c = 0.9$, $\mu = -2.2t$. The results are shown for easy axis anisotropy values $U_k = 0.01$ and $U_k = 0.37$, where the former is found in MnF$_2$ and the latter is found in FeF$_2$~\cite{hagiwara1996,johnson1959,ohlman1961}.}% \label{fig:umklapp} \end{figure} \section{Experimental detection} \label{sec:experiment} Although the spin-current can be enhanced in SC/AFI bilayers as compared to NM/AFI bilayers, it can be difficult to observe this enhancement experimentally. This is because the spin-current is strongly peaked around the antiferromagnetic resonance frequencies $\omega_{\v 0}^{\alpha/\beta}$. In antiferromagnets this resonance frequency is on the order of $\SI{1}{\tera\hertz}$, which is much larger than in ferromagnets~\cite{baltz2018}. This is an advantage for spintronics as it allows for ultrafast information processing, but in the context of this paper it means that observation of the enhancement produced by the superconducting order is hard to experimentally verify. A resonance frequency of $\SI{1}{\tera\hertz}$ means that the spin-current is most easily observed at $\Omega/\Delta_0 \approx 4$, assuming that $\Delta_0 = \SI{1}{\milli\electronvolt}$, but form \cref{fig:2d} we see that the current is enhanced only for $\Omega/\Delta_0 < 0.2$. In order to observe the strong suppression of spin-current at low temperatures, it is necessary to probe frequencies below $2\Delta_0$. This is also below $\SI{1}{\tera\hertz}$, but not out of reach. The resonance frequency of MnF$_2$, which was used in the detection of spin-pumping by \citeauthor{vaidya2020}, was reported to be around $\SI{250}{\giga\hertz}$~\cite{vaidya2020}. This corresponds to $\Omega \approx \SI{1}{\milli\electronvolt} \approx \Delta_0$, which makes the low-temperature suppression shown in \cref{fig:2d,fig:slices} detectable. One way to potentially detect the spin-current enhancement at low frequencies is to apply a constant magnetic field along the $z$-axis. This was also done by \citeauthor{vaidya2020}, who reduced the frequency of MnF$_2$ to $\SI{120}{\giga\hertz}$ by applying a magnetic field of $\SI{4.7}{\tesla}$. From \cref{eq:bogoCoeffs,eq:regular_curr,eq:umklapp_curr} we see that the resonance frequencies are \begin{equation} \omega_\text{res} = \omega_0\sqrt{U_k(2+U_k)} \pm \gamma h_z. \end{equation} where $\omega_0 = JzS$. Thus, by applying a magnetic field of $\omega_0\sqrt{U_k(2+U_k)}/\gamma$, the resonance frequency can be pushed well below $\Delta_0$, making the enhancement in spin-current due to superconductivity detectable. This is illustrated in \cref{fig:peaks}. At $\gamma h_z = 0$ the peak is at $\Omega = 4\Delta_0$, where the peak in $I_s^\textsc{SC}$ is only slightly smaller than the peak in $I_s^\textsc{NM}$, in accordance with \cref{fig:slices}. However, when $\gamma h_z = -3.9\Delta_0$, the peak is shifted to $\Omega = 0.1\Delta_0$ and the peak in the superconducting case is taller. How large the applied magnetic field is required to be depend on the gyromagnetic ratio $\gamma$ as well as $\omega_0$ and $U_k$, but it will in general be several tesla. Experimental ingenuity is therefore required in order to make sure that the superconductivity is not completely suppressed by the magnetic field. This could for instance be done by shielding the superconductors or using superconductors that can withstand large magnetic field from a certain direction, such as Ising superconductors. \begin{figure}[htpb] \centering \includegraphics[width=1.0\linewidth]{peaks.pdf} \caption{The superconductor spin-current $I_s^\textsc{SC}$ and normal metal spin-current $I_s^\textsc{NM}$ normalized by the maximal value of $I_s^\textsc{NM}$ as a function of the precession frequency $\Omega$ for two different values of constant external magnetic field $h_z$. Here, $\gamma$ is the gyromagnetic ratio, $T/T_c = 0.9$, $\eta^{\alpha/\beta}/\Delta_0 = 0.01$, $c=0.5$, $U_k = 0.01$, $T_c$ is the critical temperature and $\Delta_0$ is the superconducting gap at zero temperature.}% \label{fig:peaks} \end{figure} \section{Conclusion}% \label{sec:conclusion} We have derived an expression for the spin-current in SC/AFI bilayers undergoing spin-pumping, valid for both compensated and uncompensated interfaces and taking into consideration both the regular scattering channel and the Umklapp scattering channel. We found that for temperature $T$ well below the critical temperature $T_c$, the spin-current is strongly suppressed as long as the precession frequency of the applied magnetic field is less than $2\Delta(T)$. This is because the energy gap in the superconductor inhibits spin-flip scatterings below the gap and there are few quasiparticles present that can be scattered to higher energies. However, at temperatures close to $T_c$ there are quasiparticles present and because of their large density of states close to the gap, the spin-current can be more than twice as large as for NM/AFI bilayers when the precession frequency is significantly less than the gap. The spin-current contribution from the Umklapp channel is typically much smaller than the contribution from the regular scattering channel, but it can be significant if the Fermi surface is large, the easy axis anisotropy is small and the interface is compensated. The relevant precession frequencies where the spin-current in SC/AFI is enhanced compared to NM/AFI is much lower than the typical resonance frequencies of antiferromagnets, which makes the detection of this effect experimentally challenging. A possible solution lies in the shifting of the resonance frequency by a static magnetic field. \begin{acknowledgments} This work was supported by the Research Council of Norway through grant 240806, and its Centres of Excellence funding scheme grant 262633 ``\emph{QuSpin}''. J. L. also acknowledge funding from the NV-faculty at the Norwegian University of Science and Technology. \end{acknowledgments}
\section{Brief Control Theory Background\label{chap:one}} \subsection{Introduction} Control theory, simply defined, is an area of research in mathematics and engineering that is fundamentally driven by the question: how can one control the result of some mechanical, electrical, biological, or other process in an acceptable way? For example, autonmous driving and parallel parking, optimal power consumption for super computers, blood sugar levels in humans, confined plasma devices etc. It is an incredibly vague and daunting question that is almost always dependent on the particular process being considered. Nevertheless, there have been many important mathematical and engineering insights that have led to general techniques, as well as the recognition of types of control systems where said techniques may apply. In the course of researching this question, more specific lines of inquiry begin to arise, such as: can one optimally control the process subject to some constraint? How sensitive is the process to the choice of controls? Can the process be controlled even in the presence of random noise? and many more. This thesis is essentially concerned with a particular variant of the question: what types of seemingly nonlinear processes are actually linear in some--potentially expanded--sense? When this is the case, the full array of well developed techniques in linear control theory are suddenly applicable. Even this question has already accumulated a deep literature, some of which we will introduce in the remainder of Chapter 1. For a reasonably detailed overview of the big ideas and history of control theory, the reader is encouraged to peruse \cite{ControlOverviewHistory}. This thesis is in the area of geometric control theory, specifically from the viewpoint of differential geometry. There are many papers from this perspective in control theory, and we will be particularly concerned with results that answer questions of equivalence between control systems; that is, questions related to classifying control systems. Chapter 2 will address the key concepts from differential geometry, as they apply to geometric control theory, that are relevant to this thesis. These concepts include topics such as: distributions, exterior differential systems, derived systems, jet bundles, generalized Goursat bundles, etc. Chapter 3 is specifically concerned with the role of symmetry from the perspective of exterior differential systems, and provides a key property needed to define cascade feedback linearizable systems. Chapter 4 opens with the definition of a \textit{cascade feeback linearizable control system}, and then presents the primary results of this thesis, including a new necessary condition for cascade feedback linearizable control systems, as well as the presentation of a new explicit class of such systems. For more on geometric control theory, good places to begin are \cite{BulloLewisBook},\cite{JurdjevicBook}, and \cite{GeometricControlBoulder}. \subsection{Control Systems} In this section we will define explicitly what we mean by a \textit{control system} for the purposes of this thesis, as well as introduce several examples that will appear throughout. \begin{defn}\label{control system def 1} Let $M$ be a manifold such that $M\cong_{\mathrm{loc}}\mathbb{R}\times\mathbb{R}^n\times\mathbb{R}^m$, with coordinates $(t,\bx,\bu)$, where $\bx=(x^1,\ldots,x^n)$ and $\bu=(u^1,\ldots,u^m)$. A \textbf{control system} on $M$ is an underdetermined system of ordinary differential equations, \begin{equation}\label{control system} \frac{d\bx}{dt}=\bff(t,\bx,\bu), \end{equation} where $\bff(t,\bx,\bu)=(f^1(t,\bx,\bu),\ldots,f^n(t,\bx,\bu))$. The coordinate $t$ will denote time, and the variables $\bx$ and $\bu$ are the \textbf{state variables} and \textbf{control variables} respectively. Additionally, denote $\bX(M)\cong\mathbb{R}^n$ to be the \textbf{state space} of $M$ with the states $\bx$ as local coordinates on $\bX(M)$. \end{defn} \begin{defn} A \textbf{solution} or \textbf{trajectory} of a control system is any curve $(t, \bx(t),\bu(t))$ in $M\cong_{\mathrm{loc}}\mathbb{R}\times\mathbb{R}^n\times\mathbb{R}^m$ that satisfies equation (\ref{control system}). \end{defn} As alluded to in the introduction, we mention that, in general, a \textit{control system} could refer to many different types of differential equations or processes, e.g. PDEs, SDEs, discrete DEs, general stochastic processes, etc. The author is curious to know the extent to which the ideas in this thesis may be applied to other types of control systems, and will likely investigate this to some degree in the future. For now, however, we will be content with our above definition of a control system. One important property of control systems is the question of controllability. \begin{defn} A control system is \textbf{controllable} if, for any two points $p$ and $q$ in $\bX(M)$, there exists a solution to (\ref{control system}) such that $\bx(t_0)=p$ and $\bx(t_1)=q$. \end{defn} Studying controllability of control systems is of central importance in the overall field of control theory, and there are many different types of controllability and related notions. We will not explore this topic any further in this thesis, except briefly in Section 1.3 and in the following example. One can refer to \cite{BulloLewisBook} for more on controllability. We now list several examples of control systems that appear throughout this thesis. \begin{ex}\label{lin 1} \begin{equation} \begin{aligned} \,&\,&\dot{x}^1&=x^2,&\dot{x}^2&=u^2,\,&\,&\,\\ \,&\,&\dot{x}^3&=u^1,&\dot{x}^4&=u^2.\,&\,&\, \end{aligned} \end{equation} This control system has 4 states and 2 controls. \end{ex} Solutions for this control system passing through the point $(\bx_0=\bx(t_0))\in \bX(M)\cong \mathbb{R}^4$ are easily seen to be given by \begin{equation} \begin{aligned} \,&\,& x^1&= f_2(t),&x^2&=\dot{f}_2(t),\,&\,&\,\\ \,&\,&x^3&=f_1(t),&x^4&=\dot{f}_2(t) +C,\,&\,&\, \end{aligned} \end{equation} where $C=x^4(t_0)-x^2(t_0)$. We then notice the algebraic constraint $x^4(t)=x^2(t)+C$ for any choice of $f_2(t)$ and for all $t$. Thus, this control system is not controllable. All remaining examples introduced in this section are controllable. \begin{ex}\label{so(5)}\cite{Cascade2} The following is a control system of 3 states and 2 controls. \begin{equation} \begin{aligned} \dot{x}_1&=\frac{1}{2}(x_2+2x_3x_5),& \dot{x}_2&=2(x_3+x_1x_5),\\ \dot{x}_3&=\frac{2(u_1-x_1u_2)}{1+x_1},&\dot{x}_4&=x_5\\ \dot{x}_5&=\frac{2(u_1+u_2)}{1+x_1}.&\, \end{aligned} \end{equation} \end{ex} This example first appears in \cite{Cascade2}, and will have importance as an illustration of the main results in Chapter 4. It has the property of being cascade feedback linearizable, as shown in \cite{Cascade2}, and in particular, it serves as an example of Theorem \ref{sufficiency} in Chapter 4. \begin{ex}\label{HSM chap1}\cite{HuntSuMeyerLin}\cite{GSalgorithmExample} \begin{equation} \begin{aligned} \frac{dx^1}{dt}&=\sin(x^2),\,&\frac{dx^2}{dt}&=\sin(x^3),\,&\frac{dx^3}{dt}&=(x^4)^3+u^1,&\,\\ \frac{dx^4}{dt}&=x^5+(x^4)^3-(x^1)^{10},\,&\frac{dx^5}{dt}&=u^2.\,&\,&\,&\,&\, \end{aligned} \end{equation} \end{ex} Example \ref{HSM chap1} above is an example of a control system that appears to be a nonlinear system of underdetermined ODE. However, the control system is equivalent to a \textit{linear} system in a precise way to be defined in Sections 1.2 and 3.7. \begin{ex}\label{BC chap1} \begin{equation} \begin{aligned} \,&\frac{dx^1}{dt}=u^1,\,&\frac{dx^2}{dt}=x^1,\,&\,\phantom{==}&\frac{dx^3}{dt}=(x^2+x^6+x^2u^1),&\,\\ \,&\frac{dx^4}{dt}=(u^2+x^1u^3),\,&\frac{dx^5}{dt}=x^4,\,&\,\phantom{=}&\frac{dx^6}{dt}=(x^5+x^2x^4),&\,\\ \,&\frac{dx^7}{dt}=u^3.\,&\,&\,&\,&\, \end{aligned} \end{equation} \end{ex} The above system in Example \ref{BC chap1} will be referred to as the BC system, for Battilotti and Califano, who introduced the system in \cite{BC3control}. This system is also cascade feedback linearizable, as will be demonstrated in Chapter 4. \begin{ex}\label{reduction example} \begin{equation} \begin{aligned} \frac{dz^1_0}{dt}&=z^1_1,&\frac{dz^2_0}{dt}&=z^2_1,\,&\,\\ \frac{dz^1_1}{dt}&=z^1_2,&\frac{dz^2_1}{dt}&=z^2_2,\,&\,\\ \frac{d\epsilon}{dt}&=e^{z^1_1z^2_0}.&\,&\,&\,&\, \end{aligned} \end{equation} \end{ex} This relatively simple looking control system will be used only once, and will not reappear until Chapter 4. The control parameters are $z^1_2$ and $z^2_2$. It provides a nice demonstration of the necessary condition found in Theorem \ref{necessity}, which is one of the main results of this thesis. \begin{ex}\label{affine sym} \begin{equation} \begin{aligned} \frac{dx^1}{dt}&=((x^2)^2+x^1f(t,x^3,x^4,x^5,u^2)),\\ \frac{dx^2}{dt}&=x^2f(t,x^3,x^4,x^5,u^2),\\ \frac{dx^i}{dt}&=g^i(t,x^3,x^4,x^5,u^2)\left(x^2e^{-u^1}\right)^{a_i}\,\,\mathrm{ for }\,\,3\leq i\leq 5 \end{aligned} \end{equation} where $f,g$ are arbitrary functions and the $a_i$ are constants, not all zero. \end{ex} The above family of control systems possesses a familiar set of symmetries--the affine transformations of the real plane. Specific choices of the functions $g^i$ and the constants $a_i$ will be used to demonstrate various theorems in Chapter 3 and Chapter 4. \begin{ex}\label{PVTOL}\cite{VTOL} \begin{equation} \begin{aligned} \ddot{x}&=-u_1\,\sin(\theta)+h\,u_2\,\cos(\theta), \\ \ddot{z}&=u_1\,\cos(\theta)+h\,u_2\,\sin(\theta)-g, \\ \ddot{\theta}&=\lambda u_2. \end{aligned} \end{equation} \end{ex} One important example to mention, which will not be explored in this thesis, is that of the planar vertical take-off and landing vehicle, (PVTOL) control system, listed above. An in-depth analysis of the system regarding cascade feedback linearization will appear in a later work. \begin{ex}\label{Sluis} \begin{equation}\label{Sluis system} \begin{aligned} \dot{x}^1&=c_1x^1+c_3x^3+u^1(a_0+a_1x^1+a_3x^3+a_4x^4),\\ \dot{x}^2&=e_1x^1+e_3x^3+u^2(b_0+b_3x^3+b_4x^4),\\ \dot{x}^3&=u^1,\\ \dot{x}^4&=u^2. \end{aligned} \end{equation} \end{ex} Finally, Example \ref{Sluis} is an 11-parameter family of control systems. Any choice of the parameters leads to a system that is \textit{not} linearizable (see Definition \ref{ESFL def 1}). However, this system does have the property of being linearized when additional differential equations are imposed. This concept will be made precise in Section 1.3. All of the examples presented in this section have very different properties, and in terms of classification, are all inequivalent to one another. \subsection{Linear Control Systems} The most fundamental and well studied class of control systems are those that are linear. \begin{defn} A control system (\ref{control system}) in $n$ states and $m$ controls is \textbf{linear} if it has the form \begin{equation}\label{linear control system} \bxd(t)=A\bx+B\bu, \end{equation} where $A$ and $B$ are $n\times n$ and $n\times m$ constant matrices respectively. \end{defn} In particular, Example \ref{lin 1} is a linear control system. We demonstrated that it was not controllable, which naturally makes one wonder about when a linear control system is controllable. \begin{thm}(Kalman Condition)\cite{KalmanCondition} A linear control system (\ref{linear control system}) is controllable if and only if the $n\times nm$ matrix \begin{equation} [B\,AB\,A^2B\,\cdots\,A^{n-1}B], \end{equation} has rank $n$. \end{thm} We will restrict ourselves to controllable systems from here on. Given a control system, it may be possible to change the state and control variables in such a way that the new system is a linear control system. In particular, a theorem of Brunovsk\'y \cite{Brunovsky} says that \text{all} controllable linear control systems may be put into the following form by a specific type of transformation. \begin{defn}\cite{Brunovsky} The \textbf{Brunovsk\'y normal form}, is a linear control system (\ref{linear control system}) such that matrix $A$ consists of $\sigma_i\times \sigma_i$ block matrices $A_i$, $1\leq i\leq m$ down the diagonal, with the form \begin{equation} A_i= \begin{bmatrix} 0& 1 &0&\cdots& 0\\ 0& 0 & 1 &\cdots& 0\\ \vdots&\vdots&\vdots&\ddots&\vdots\\ 0& 0 & 0 &\cdots& 1\\ 0& 0 & 0 &\cdots& 0 \end{bmatrix}, \end{equation} and the matrix $B$ has entries $B^l_k=1$ if $l=k=\sum_{i=1}^s\sigma_i$ for all $1\leq s\leq m$, and $B^l_k=0$ otherwise. That is, the matrix $B$ has a one in a diagonal position on row $k$ if the $k$th row of $A$ is all zeroes, and the rest of the entries for $B$ are zero. \end{defn} Sometimes it is possible to transform a seemingly nonlinear control system to Brunovsk\'y normal form via a change of coordinates. Indeed, in \cite{HuntSuMeyerLin} and \cite{GSalgorithmExample} Example (\ref{HSM chap1}) was shown to be equivalent to a Brunovsk\'y normal form via a change of coordinates where the new state variables are of the form $\bz=\bz(\bx)$ and the new control variables have the form $\bv=\bv(\bx,\bu)$. \begin{defn}\label{ESFL def 1} A control system (\ref{control system}) is called \textbf{static feedback linearizable} (SFL) if there is an invertible map $(t,\bz,\bv)=(t,\varphi(\bx),\psi(\bx,\bu))$ such that (\ref{control system}) transforms to a Brunovsk\'y normal form $\bzd=A\bz+B\bv$. The control system is called \textbf{extended static feedback linearizable} (ESFL) if the map has the form $(t,\bz,\bv)=(t,\varphi(t,\bx),\psi(t,\bx,\bu))$. \end{defn} Notice that the forms of the maps only take state variables to state variables, while the new controls are allowed to depend on the old controls \textit{and} old state variables. This is what is meant by ``feedback". For example, when one is driving a car, the current position of the car is used to determine how to change the steering wheel or acceleration to stay on the road. However, a driver has no way of controlling the shape or orientation of the road in order to keep the car on the road. This property is important for having meaningful solutions for a control system. The first results concerning when a given \textit{nonlinear} control system is SFL were given by Krener in \cite{KrenerLin}, as well as by Brockett in \cite{BrockettLin} and then Jakubczyk and Respondek in \cite{RespondekLin}. Constructing explicit maps for SFL systems is harder, and that work was started by Hunt, Su, and Meyer in \cite{HuntSuMeyerLin}, and then a more geometric approach based on symmetry was developed in \cite{BrunovskySymmetry} by Gardner, Shadwick, and Wilkens, and finally work of Gardner and Shadwick \cite{GSalgorithm},\cite{GSFeedback}, and \cite{GSalgorithmExample} provided what is now known as the GS algorithm for static feedback linearization. The work of Vassiliou in \cite{VassiliouGoursat} and \cite{VassiliouGoursatEfficient} provides a way to construct the required maps for ESFL systems, as well as identifying when a given control system is ESFL. It is Vassiliou's work that will be central to this thesis. The main results of the two previously mentioned papers will appear in Chapter 2. \subsection{Dynamic Feedback Linearizable Control Systems} A particularly desirable property for a control system is when solutions can be written purely in terms of arbitrary function and their derivatives. Much like the case of Example \ref{lin 1}, determining a solution curve requires no integration, and involves only algebraic expressions of arbitrary functions and their derivatives. Solutions to Brunovsk\'y linear control systems always have this property. However, there are nonlinear systems that may also have this property and are \textit{not} SFL. \begin{defn} A controllable control system is called \textbf{explicitly integrable} (EI) if generic solutions may be written as \begin{equation} \bx(t)=\bA(t,z^i_0(t),z^i_1(t),\ldots,z^i_{s_i}(t)),\,\,\bu(t)=\bB(t,z^i_0(t),z^i_1(t),\ldots,z^i_{r_i}(t)), \end{equation} for $1\leq i\leq m$ for $m$ the number of controls and $z^i_{l_i}(t)=\frac{d^{l_i}z^i_0}{dt^{l_i}}$ for some arbitrary smooth functions $z^i_0(t)$. Additionally, we may add the distinction of \textbf{autonomous} to an EI system if $A$ and $B$ have time dependence only through the functions $z^i_0(t)$ and their derivatives. That is, $A$ and $B$ have the form \begin{equation} \bx(t)=\bA(z^i_0(t),z^i_1(t),\ldots,z^i_{s_i}(t)),\,\,\bu(t)=\bB(z^i_0(t),z^i_1(t),\ldots,z^i_{r_i}(t)). \end{equation} \end{defn} It turns out that EI systems are related to another type of linearization called \textit{dynamic feedback linearization}. \begin{defn} A control system (\ref{control system}) is \textbf{dynamic feedback linearizable} (DFL) if there exists an augmented system of the form \begin{equation} \begin{aligned} \bxd&=\bff\,(\bx,\bu),\phantom{\bw==}\bx\in\mathbb{R}^n,\phantom{==} \bu\in\mathbb{R}^m,\\ \byd&=\bg\,(\bx,\by,\bw),\phantom{==}\by\in\mathbb{R}^k, \phantom{==}\bw\in\mathbb{R}^q,\\ \bu&=\bh\,(\bx,\by,\bw), \end{aligned} \end{equation} such that the control system \begin{equation} \begin{aligned} \bxd&=\bff\,(\bx,\bh(\bx,\by,\bw)),\\ \byd&=\bg\,(\bx,\by,\bw), \end{aligned} \end{equation} is SFL. \end{defn} There has been considerable effort to understand DFL systems, more than we can exhaustively list here. The concept first appears in \cite{SinghDFL}, and was subsequently studied in \cite{IsidoriMoogLucaDFL}, \cite{CharletLevineMarino1}, and \cite{CharletLevineMarino2}. A geometric necessary condition based on ruled submanifolds was presented in \cite{sluis1994absolute}. A method for producing a DFL, if it exists, was the subject of work by Battilotti and Califano in \cite{BCDFL1},\cite{BCDFL2}, and \cite{BC3control}. However, a complete classification of DFL systems has yet to be achieved. The 11-parameter family from Example \ref{Sluis} was shown to be DFL in \cite{sluis1994absolute} by differentiating twice along the control $u^1$. That is, if we augment (\ref{Sluis system}) by \begin{equation} \begin{aligned} \dot{y}^1&=y^2,\\ \dot{y}^2&=v^1,\\ u^1&=y^1, \end{aligned} \end{equation} then the augmented system is SFL. We also have the following nonautonomous version of a dynamic feedback linearizable system. \begin{defn} A control system (\ref{control system}) is \textbf{extended dynamic feedback linearizable} (EDFL) if there exists an augmented system of the form \begin{equation} \begin{aligned} \bxd&=\bff\,(t,\bx,\bu), \bx\in\mathbb{R}^n, \bu\in\mathbb{R}^m,\\ \byd&=\bg\,(t,\bx,\by,\bw), \by\in\mathbb{R}^k, \bw\in\mathbb{R}^q,\\ \bu&=\bh\,(t,\bx,\by,\bw), \end{aligned} \end{equation} such that the control system \begin{equation} \begin{aligned} \bxd&=\bff\,(t,\bx,\bh(t,\bx,\by,\bw)),\\ \byd&=\bg\,(t,\bx,\by,\bw), \end{aligned} \end{equation} is ESFL. \end{defn} In forthcoming work \cite{Cascade2}, it is shown that \begin{prop}\label{EI iff EDFL} A control system is EDFL if and only if it EI. Additionally, a control system is DFL if and only if it is an autonomous EI system. \end{prop} Example \ref{BC chap1} is DFL, and in fact, in Chapter 4 of this thesis, we will show that Example \ref{BC chap1} is EI. In order to prove this, the theory of \textit{cascade feedback linearization} (CFL) is introduced and applied in Chapter 4. The key idea is the existence of two particular kinds of ESFL systems whose trajectories may be ``composed" in order to compute trajectories of Example \ref{BC chap1}. CFL systems are introduced in \cite{VassiliouCascadeI} where it is shown that such systems are EI. In light of this result and Proposition \ref{EI iff EDFL} from \cite{Cascade2}, we can say that any CFL system is EDFL. In particular, as is shown in \cite{Cascade2}, carrying out the CFL process tells one how to construct a simple augmented system that is ESFL, therefore demonstrating directly that a CFL system is EDFL. We would also like to remark briefly on Example \ref{PVTOL} mentioned in Section 2. The control system is shown to be DFL by Martin, Devasia, and Paden in \cite{DynamicVTOL}, and in \cite{VassiliouCascadeI} it is shown to be CFL. However, the sizes of the augmented systems differ from the two constructions, namely the CFL construction in \cite{VassiliouCascadeI} requires a larger augmented system. In another forthcoming work by the author, Example \ref{PVTOL} will be explored through the lens of CFL theory more closely, demonstrating, in particular, that there is an augmented system of the same size as that presented in \cite{DynamicVTOL}. \section{Geometry of Feedback Transformations and Linearization\label{chap:two}} \subsection{Exterior Differential Systems, Distributions, and Derived Systems} In this section we provide some background on exterior differential systems (EDS) and derived systems. For a comprehensive account of EDS, refer to \cite{BCGGG} and \cite{CartanBeginners}. Throughout this thesis, we will assume that the ranks of all bundles that appear are constant on sufficiently small open sets unless otherwise specified. \begin{defn} An \textbf{Exterior Differential System (EDS)} is an ideal $\mathcal{I}$ in the exterior algebra of differential forms on a manifold $M$ that satisfies the condition $d\mathcal{I}\subset\mathcal{I}$, where $d$ is the exterior derivative. \end{defn} We will always consider the case that an EDS is finitely generated as an ideal. We have two ways of generating an EDS: algebraically or differentially. That is, \begin{align} \mathcal{I}&=\langle \theta^a, d\theta^a \rangle_{\mathrm{alg}},\quad 1\leq a\leq k,\\ \mathcal{I}&=\langle \theta^a \rangle_{\mathrm{diff}} \end{align} where $k$ is positive integer, each $\theta^a$ is a differential form on $M$, and $\langle \theta^a\rangle_{\mathrm{diff}}:=\langle \theta^a, d\theta^a\rangle_{\mathrm{alg}}$. For shorthand, we will often drop the ``diff" subscript so that $\langle \theta^a\rangle=\langle \theta^a\rangle_{\mathrm{diff}}$. An important question about a given EDS is whether or not it admits integral manifolds. \begin{defn} Let $f:N\to M$ be an injective immersion of a manifold $N$ into $M$. Then $f(N)$ is an integral manifold of the EDS $\mathcal{I}$ if $f^*\phi=0$ for all $\phi\in\mathcal{I}$. \end{defn} A straightforward example is the case of integral curves of a nowhere vanishing vector field $X$ on a manifold $M^n$. Let $\{\theta^a\}_{a=1}^{n-1}$ span the space of all 1-forms $\psi$ on $M$ such that $\psi(X)=0$. Then the set of integral manifolds of the EDS $\mathcal{I}=\langle \theta^a\rangle$ contains the integral curves of $X$. If one considers the space $L(X)=\text{Span}_{C^\infty(M)}\{X\}$, then the set of all integral curves of vectors in $L(X)$ are in 1-1 correspondence with integral manifolds of $\langle \theta^a\rangle$. Sometimes it is desirable to find an $m$-dimensional integral manifold $f:N\to M$ of $\mathcal{I}$ such that $f^*\Omega\neq0$ for a given $m$-form $\Omega=dx^1\wedge\cdots\wedge dx^m$ on $M$, where $\{x^i\}_{i=1}^m$ form part of a local coordinate system given by $(x^1,\ldots,x^m,y^{m+1},\ldots,y^n)$. When this is the case, $\Omega$ is called an \textit{independence condition}, and it plays the role of establishing independent variables for integral manifolds of the EDS. The requirement that $f^*\Omega\neq0$ is equivalent to claiming that $(x^1,\ldots,x^m)$ may be chosen as local coordinates for $N$. Then the integral manifold $f:N\to M$ may be thought of as a graph given by $(\bx,\by(\bx))$ where $\bx=(x^1,\ldots,x^m)$ and $\by=(y^{m+1},\ldots,y^n)$. Returning to the example of a vector field $X$, it may be possible to pick a 1-form $\Omega=dt$ such that integral curves to $X$ (and therefore its associated EDS) may be written locally as graphs $(t,x^1(t),\ldots,x^{n-1}(t))$, where $(t,x^1,\ldots,x^{n-1})$ form coordinates for $M$. \begin{defn} Let $\{\theta^a\}_{a=1}^r$ and $\{\theta^a,\omega^i\}_{a,i=1}^{r,m}$ be bases for sections of subbundles $I,J\subset T^*M$ respectively. An EDS $\mathcal{I}=\langle \theta^1,\ldots,\theta^r \rangle$, is called a \textbf{Pfaffian system}. We say that $I$ generates $\mcal{I}$, and write $\mcal{I}=\langle I\rangle$. If in addition, $\mcal{I}$ is given an independence condition $\Omega=\omega^1\wedge\ldots\wedge\omega^m$ such that $d\theta^a\equiv 0\,\mathrm{mod}\,J$ for all $1\leq a\leq r$, then $(\mcal{I},\Omega)$ is called a \textbf{linear Pfaffian system}. \end{defn} \begin{defn} Let $\mcal{I}$ and $\tilde{\mcal{I}}$ be two Pfaffian systems generated by the subbundles $I$ and $\tilde{I}$ of $T^*M$, respectively. Then the sum of two Pfaffian systems is defined to be \begin{equation} \mcal{I}+\tilde{\mcal{I}}:=\langle I + \tilde{I}\rangle. \end{equation} Additionally, if $I\cap \tilde{I}$ is trivial, then the direct sum of two Pfaffian systems is the Pfaffian system \begin{equation} \mcal{I}\oplus\tilde{\mcal{I}}:=\langle I\oplus \tilde{I}\rangle. \end{equation} \end{defn} The EDS in this thesis will be either Pfaffian or linear Pfaffian systems. Since our systems will be Pfaffian, we will often formulate results using the dual notion of \textit{distributions}. \begin{defn} A \textbf{distribution} $\mcal{V}$ on a manifold $M$ is a subbundle of the tangent bundle $TM$. An \textbf{integral manifold} of a distribution $\mcal{V}$ is any submanifold $N$ of $M$ such that $TN$ is a subbundle of $\mcal{V}$. \end{defn} We will denote distributions by a set of sections of $TM$ that generate the distribution by $C^\infty$ linear combinations. That is, if $\mcal{V}$ is a distribution of rank $s$, then \begin{equation} \mcal{V}=\{X_1,\ldots,X_s\}, \end{equation} where the $X_i$, for $1\leq i\leq s$, are linearly independent sections of $\mcal{V}\subset TM$. In the case that we have a Pfaffian system, there is a natural distribution whose integral manifolds are the same as those of the Pfaffian system. \begin{defn} Let $I\subset T^*M$ be a subbundle. Then the \textbf{annihilator} of $I$ is the subbundle of $TM$ given by \begin{equation} \ann I=\bigcup_{p\in M}\{X_p\in T_pM\colon\theta_p\left(X_p\right)=0, \forall\,\theta_p\in I_p\}. \end{equation} Conversely, given a distribution $\mcal{V}$ on manifold M, \begin{equation} \ann \mcal{V}=\bigcup_{p\in M}\{\theta_p\in T^*M\colon \theta_p(X_p)=0, \forall\,X_p\in\mcal{V}_p\}, \end{equation} is a subbundle of the cotangent bundle of $M$. Moreover, $\ann\left(\ann B\right)=B$ for any subbundle $B$ of $T^*M$ or $TM$. \end{defn} We now discuss two equivalent versions of an important theorem in the study of EDS and distributions. \begin{thm}\label{Frobenius}The following are equivalent statements of the Frobenius theorem. \begin{enumerate} \item Let $\mcal{I}=\langle \theta^1,\ldots,\theta^{n-r}\rangle$ be a rank $n-r$ Pfaffian system on manifold $M^n$ with $r< n$. If \begin{equation}\label{fro condition} d\theta^a=\alpha^a_b\wedge \theta^b, \end{equation} where $\alpha^a_b\in \Omega^1(M)$ for all $1\leq a,b\leq n-r$, then through any point $p\in M$ there exists an $r$-dimensional integral manifold of $\mcal{I}$ containing $p$. Furthermore, on a sufficiently small open neighborhood of $p\in M$, there exists a coordinate system $(y^1,\ldots,y^{n-r}, x^{n-r+1},\ldots,x^n)$ such that \begin{equation} \mathcal{I}=\langle dy^1,\ldots,dy^{n-r}\rangle \end{equation} and integral manifolds are determined by the equations $y^1=c^1,\ldots,y^{n-r}=c^{n-1},$ where $c^a,\quad1\leq a\leq n-r$ are constants. \item Let $\mcal{V}$ be a distribution of rank $r$ on a manifold $M^n$. If $[X,Y]\in \Gamma(\mcal{V})$ for all $X,Y\in \Gamma(\mcal{V})$, then through any point $p\in M$ there exists an $r$-dimensional integral manifold of $\mcal{V}$. \end{enumerate} \end{thm} The condition (\ref{fro condition}) may also be stated as \begin{equation} d\theta^a \equiv\, 0\,\text{mod}\,I, \end{equation} for all $1\leq a\leq n-r$. Condition (\ref{fro condition}) is also equivalent to saying that $\mcal{I}$ is algebraically generated by 1-forms, i.e. \begin{equation} \mcal{I}=\langle \theta^1,\ldots,\theta^{n-r}\rangle_{\mathrm{alg}}. \end{equation} \begin{defn} Pfaffian systems and distributions that satisfy the hypotheses of the Frobenius theorem are called \textbf{Frobenius} or \textbf{completely integrable}. \end{defn} Certainly, not all Pfaffian systems are Frobenius, and indeed, one might be interested in measuring how far a system deviates from being completely integrable. One can do this by removing all the forms in $\mathcal{I}$ that obstruct the EDS from being Frobenius. This is the idea of the derived system. \begin{defn}\label{derived definition} Let $\mathcal{I}$ be a Pfaffian system. Then the Pfaffian system generated by \begin{equation} I^{(1)}=\{\theta\in\mathcal{I}\cap\Omega^1(M):d\theta\equiv 0\, \mathrm{mod}\, \,\mathcal{I}\cap\Omega^1(M)\} \end{equation} is called the \textbf{first derived system} or \textbf{derivation} of $\mathcal{I}$. If one starts with a distribution $\mathcal{V}$, then the first derived system is defined as \begin{equation} \mathcal{V}^{(1)}=\{Z\in \Gamma(TM)\colon Z=\sum_{i}a^i[X_i,Y_i],\,\, X_i,Y_i\in\Gamma(\mcal{V})\,,a^i\in C^\infty(M)\, \mathrm{or}\,Z\in \Gamma(\mcal{V})\}. \end{equation} Informally, we will denote the derived system as \begin{equation} \der{V}{1}=\mcal{V}+[\mcal{V},\mcal{V}]. \end{equation} \end{defn} Notice that if $\coder{I}{1}=I$ then $\mcal{I}$ generates a Frobenius Pfaffian system. Similarly, if $\der{V}{1}=\mcal{V}$ then $\mcal{V}$ is Frobenius. Furthermore, the derived system of a Pfaffian system is a diffeomorphism invariant since pullback commutes with exterior differentiation and the wedge product. Additionally, we mention that if a distribution and Pfaffian system are related by $\mcal{V}=\ann I$, then $\der{V}{1}=\ann \coder{I}{1}$. This fact follows from the identity \begin{equation} d\theta(X,Y)=X(\theta(Y))-Y(\theta(X))-\theta([X,Y]) \end{equation} for any $X,Y\in \Gamma(TM),\,\theta\in \Omega^1(M)$. As there is a first derived system, one can repeat the constructions in Definition \ref{derived definition} to generate a \textit{second} derived system, and so on. \begin{defn} Let $\mathcal{I}=\langle I\rangle$ for $I$ a subbundle of $T^*M$ and let $\mathcal{V}$ be a distribution. Then the $l$\textbf{th derived system} of $\mcal{I}$ is \begin{equation} \coder{I}{l}=\{\theta\in\coder{I}{l-1}\colon d\theta\equiv 0\,\mathrm{mod}\,\coder{I}{l-1}\}. \end{equation} Similarly for a distribution $\mcal{V}$, \begin{equation} \der{V}{l}=\der{V}{l-1}+[\der{V}{l-1},\der{V}{l-1}]. \end{equation} The \textbf{derived flag} of a Pfaffian system is given by \begin{equation} I^{(k)}\subset I^{(k-1)}\subset I^{(k-2)}\subset\ldots\subset I^{(1)}\subset I\subseteq T^*M, \end{equation} where $k$ is the smallest integer such that $I^{(k+1)}=I^{(k)}$. For a distribution $\mcal{V}$, the derived flag is \begin{equation} \mathcal{V}\subset \mathcal{V}^{(1)}\subset\ldots\subset\mathcal{V}^{(k-1)}\subset \mathcal{V}^{(k)}\subseteq TM, \end{equation} where $k$ is the smallest integer such that $\der{V}{k+1}=\der{V}{k}$. The integer $k$ is called the \textbf{derived length} of the EDS/distribution. \end{defn} Additionally, we have the following integer invariants of a derived flag. \begin{defn}\label{accel def}\cite{VassiliouGoursat} Let $\mathcal{V}$ be a distribution with derived length $k>1$. Let $m_i$ denote the rank of $\der{V}{i}$ for $0\leq i\leq k$. Then one can define the following lists of integers: \begin{enumerate} \item The \textbf{velocity} of $\mathcal{V}$: given by $\vel{V}=\langle \Delta_1,\ldots,\Delta_k\rangle$ where $\Delta_i=m_i-m_{i-1}$ for $1\leq i\leq k$. \item The \textbf{acceleration} of $\mathcal{V}$: given by $\mathrm{accel}(\mathcal{V})=\langle \Delta^2_2,\ldots,\Delta^2_k, \Delta_k\rangle $ where $\Delta^2_i=\Delta_i-\Delta_{i-1}$ for $2\leq i\leq k$. \item The \textbf{deceleration} of $\mathcal{V}$: given by $\dec{V}=\langle -\Delta^2_2,\ldots,-\Delta^2_k,\Delta_k\rangle$. \end{enumerate} \end{defn} The last bundle in the derived flag is always Frobenius. We see that, for distributions, if $\der{V}{k+1}=\der{V}{k}$ then $[\der{V}{k},\der{V}{k}]\subseteq \der{V}{k}$, which is exactly the condition needed to apply the Frobenius theorem. In the case of a Pfaffian system, $\coder{I}{k+1}=\coder{I}{k}$ means that $d\theta\equiv\,0\mod \coder{I}{k}$ \text{for all} $\theta\in \coder{I}{k}$. Hence the Frobenius condition is satisfied. \begin{defn} Given a Pfaffian system $\mathcal{I}=\langle I\rangle$, where $I$ is a subbundle of $T^*M$, the \textbf{first integrals} or \textbf{invariant functions} of $\mathcal{I}$ are all non-constant functions $f:M\to\mathbb{R}$ such that $df\in \Gamma\left(I\right)$. Given a distribution $\mcal{V}$, the first integrals are given by all non-constant functions $f$ such that $X(f)=0$ for all $X\in \mcal{V}$. \end{defn} Consider a completely integrable Pfaffian system $\mcal{I}$ of rank $n-r$ on a manifold $M^n$. Then the Frobenius theorem says there is a coordinate system $(y^1,\ldots,y^{n-r},x^1,\ldots,x^r)$ where the coordinate functions $\{y^1,\ldots,y^{n-r}\}$ can be chosen so that $\mcal{I}$ is generated by $I=\{dy^1,\ldots,dy^{n-r}\}\subseteq T^*M$. Hence the coordinate functions $y^1,\ldots,y^{n-r}$ are first integrals of $\mcal{I}$. Furthermore, in this coordinate system, any other first integral $F$ of $\mcal{I}$ must be of the form $F(y^1,\ldots,y^{n-r})$. Indeed, if $F(\bx,\by)$ is a first integral, then $dF\wedge \Omega_y=0$, where $\Omega_y=dy^1\wedge\cdots\wedge dy^{n-r}\neq0$. However, this means that $\partiald{F}{x^i}dx^i\wedge\Omega_y=0$ for all $1\leq i\leq r$, and thus $F$ has no dependence on $x^i$ for all $1\leq i\leq r$. \begin{defn} If the derived flag of a system terminates in the zero ideal for an EDS (or is the entire tangent bundle for a distribution), then there are no first integrals of the system. We call such systems \textbf{completely non-integrable}. \end{defn} A classic example of a completely non-integrable system is the EDS generated by a contact form on $\mathbb{R}^3$. Indeed, if \begin{equation} \mathcal{I}=\langle dy-z\,dx\rangle, \end{equation} then it is clear that $d(dy-z\,dx)=-dz\wedge dx$. This 2-form is not zero modulo $dy-z\,dx$. Thus the first derived system is the zero ideal, and therefore this EDS has no first integrals. When we consider control systems as linear Pfaffian systems, we will also assume that such systems are completely non-integrable. This is a necessary condition for a control system to be controllable. In fact, the contact system on $\mathbb{R}^3$ is a simple example of a control system with 1 control and 1 state, where $x$ is the independent variable. The contact system has only curves as integral manifolds, and such curves are given in coordinates by $(x,f(x),f'(x))$ where $f:\mathbb{R}\to\mathbb{R}$. Another important bundle that is associated to a given EDS/distribution is the Cauchy bundle. \begin{defn} The \textbf{Cauchy bundle} of an EDS $\mathcal{I}=\langle I\rangle$ is \begin{equation} \mathrm{Char}\,(\mathcal{I})=\{X\in TM: \iota_X\psi\in\mathcal{I}\,\,\mathrm{for}\,\,\mathrm{all}\,\,\psi\in\mathcal{I}\}, \end{equation} or in the language of distributions with $\mathcal{V}=\mathrm{ann}\,I$, \begin{equation} \mathrm{Char}\,\mathcal{V}=\{X\in \mathcal{V}: [X,\mathcal{V}]\subseteq\mathcal{V}\}. \end{equation} We call sections of $\Chare{V}$ \textbf{Cauchy characteristics}. \end{defn} Note that $\Chare{\mcal{V}}$ is integrable. This follows directly from the Jacobi identity on Lie brackets. Let $X$ be any Cauchy characteristic for $\mcal{I}$ and let $N$ be any $m$-dimensional integral manifold of $\mathcal{I}$ on $M^n$ that is transverse to $X$. Consider the family of submanifolds $N_s=\varphi_s(N)$, where $\varphi_s$ is the 1-parameter family of diffeomorphisms generated by the flow of $X$. Each submanifold in the family $N_s$ is a an integral manifold of $\mcal{I}$, and moreover, the manifold $\bigcup_{s}N_s$ is an $m+1$ dimensional integral manifold of $\mcal{I}$. Hence, knowledge of the Cauchy bundle of an EDS can be used to construct more integral manifolds to the EDS. Additionally, we will always assume that the rank of any Cauchy bundle that appears in this thesis is constant. \begin{defn}\label{EDS symmetry} Let $\mathcal{I}$ be an EDS. Then a vector field $X$ is an \textbf{infinitesimal symmetry of} $\mathcal{I}$ if $\mathcal{L}_X\psi\in\mathcal{I}$ for all $\psi\in\mathcal{I}$, where $\mcal{L}_X$ is the Lie derivative in the Lie derivative in the direction of $X$. \end{defn} Cauchy characteristic vector fields turn out to be a special type of infinitesimal symmetry of an EDS. In general, the flow generated by an infinitesimal symmetry of an EDS will take integral manifolds to integral manifolds. However, we may not be able to construct higher dimensional integral manifolds as in the case of transverse Cauchy characteristics. In this thesis, symmetry plays a particularly important role and will be the main subject in Chapter 2. We will frequently use a diffeomorphism invariant from \cite{VassiliouGoursat} to identify particular types of distributions. \begin{defn}\label{refined derived type}\cite{VassiliouGoursatEfficient} Let $\mcal{V}$ be a distribution with derived length $k>1$. Let \begin{equation} \inChar{V}{i}=\der{V}{i-1}\cap\Char{V}{i},\, 1\leq i\leq k, \end{equation} $m_i=\dim \der{V}{i}$, $\chi^i=\dim \Char{V}{i}$, and $\chi^i_{i-1}=\dim \inChar{V}{i}$. Then the \textbf{refined derived type} of $\mcal{V}$ is \begin{equation} \mathfrak{d}_r(\mcal{V})=[[m_0,\chi^0],[m_1,\chi^1_0,\chi^1],\ldots,[m_{k-1},\chi^{k-1}_{k-2},\chi^{k-1}],[m_k,\chi^k]]. \end{equation} \end{defn} \subsection{The Resolvent Bundle} A particularly special structure that appears in the study of generalized Goursat bundles (see section 2.6 below) is that of the resolvent bundle. In this section we present the definition of a resolvent bundle as well as important theorems from \cite{VassiliouGoursat}. Let $\mathcal{V}$ be a subbundle of $TM$ and consider the map \begin{align} \sigma:\mathcal{V}\to\mathrm{Hom}(\mathcal{V},TM/\mathcal{V}),\\ \sigma(X)(Y)=[X,Y]\mod\mcal{V}. \end{align} The kernel of this map is exactly the Cauchy bundle of $\mathcal{V}$. \begin{defn}\label{singular polar}\cite{VassiliouGoursat} For each $x\in M$, let \begin{equation} \mathcal{S}_x=\{v\in \Gamma(\mathcal{V})\big|_x\backslash0\mid\,\sigma(v)\text{ has less than generic rank for all } y \text{ in a neighborhood of }x\}. \end{equation} Then the \textbf{singular variety} of $\mathcal{V}$ is the bundle \begin{equation} \mathrm{Sing}(\mathcal{V})=\coprod_{x\in M}\mathcal{S}_x. \end{equation} Additionally, for $X\in \mathcal{V}$, any matrix representation of the homomorphism $\sigma(X)$ is called a \textbf{polar matrix} of $[X]\in \mathbb{P}\mathcal{V}$. \end{defn} Given some $[X]\in\mathbb{P}\mathcal{V}$, the map $\text{deg}_{\mathcal{V}}:\mathbb{P}\mathcal{V}\to\mathbb{N}$ is called the \textit{degree} of $[X]$ and is defined by \begin{equation} \mathrm{deg}_{\mathcal{V}}\left([X]\right)=\mathrm{rank}\,\sigma(X),\text{ for }[X]\in\mathbb{P}\mathcal{V}. \end{equation} Note that for $X\in\mathrm{Char}\mathcal{V}$, $\text{deg}_{\mathcal{V}}\left([X]\right)=0$. For this reason, we consider the quotient $\pi:TM\to TM/\mathrm{Char}\mathcal{V}$ and denote all quotient objects by an overbar, so that $\overline{TM}=TM/\mathrm{Char}\mathcal{V}$. \begin{defn}\cite{VassiliouGoursat} Let $\mathcal{V}$ be a subbundle of $TM$ of rank $c+q+1,\,q\geq2,\,c\geq0$ and $\dim{M}=c+2q+1$. Assume $\mathcal{V}$ has the properties: \begin{enumerate} \item $\dim\mathrm{Char}\mathcal{V}=c,\,\mathcal{V}^{(1)}=TM$, \item $\bar{\Sigma}:=\mathrm{Sing}(\bar{\mathcal{V}})=\mathbb{P}\bar{\mathcal{B}}$, where $\bar{\mcal{B}}$ is some rank $q$ subbundle of $\bar{\mcal{V}}$. \end{enumerate} Then we call $(\mathcal{V},\bar{\Sigma})$ a \textbf{Weber structure} on $M$. Furthermore, for a Weber structure $(\mathcal{V},\bar{\Sigma})$, let $\mathcal{R}_{\bar{\Sigma}}(\mathcal{V})$ denote the rank $q+c$ subbundle of $\mathcal{V}$ such that \begin{equation} \pi(\mathcal{R}_{\bar{\Sigma}}(\mathcal{V}))=\bar{\mathcal{B}}, \end{equation} where $\pi:TM\to TM/\Chare{\mcal{V}}$. We call $\mathcal{R}_{\bar{\Sigma}}(\mathcal{V})$ the \textbf{resolvent bundle} of the Weber structure $(\mathcal{V},\bar{\Sigma})$. Additionally, $(\mcal{V},\bar{\Sigma})$ is an \textbf{integrable Weber structure} if its resolvent bundle is integrable. \end{defn} \begin{prop}\cite{VassiliouGoursat} Let $(\mathcal{V},\bar{\Sigma})$ be an integrable Weber structure on $M$. Then $\mathcal{R}_{\bar{\Sigma}}(\mathcal{V})$ is the unique, maximal, integrable subbundle of $\mathcal{V}$. \end{prop} \subsection{Control Systems as Geometric Objects} We want to express Definition \ref{control system def 1} in the language of Pfaffian systems and distributions so that we can better explore the underlying geometry of control systems. \begin{defn}\label{geometric control system} Let $M$ be a manifold such that $M\cong_{\mathrm{loc}}\mathbb{R}\times \bX(M)\times\bU(M)$, where $\mathbb{R}$ has $t$ as a local coordinate, $\bX(M)$ is a manifold of dimension $n$ with local coordinates $\bx=(x^1,\ldots,x^n)$, and $\bU(M)$ is a manifold of dimension $m$ with local coordinates $\bu=(u^1,\ldots,u^m)$. Then a control system on $M$ with $n$ states and $m$ controls is given by the rank $n$ linear Pfaffian system \begin{equation}\label{control pfaff} \omega=\langle dx^1-f^1(t,\bx,\bu)\,dt,\ldots,dx^n-f^n(t,\bx,\bu)\,dt \rangle, \end{equation} with independence condition $dt$. In the language of distributions, a control system is given by the rank $m+1$ distribution $\mcal{V}=\ann\omega$, which in local coordinates is given by \begin{equation}\label{control dist} \mcal{V}=\{\partial_t+f^1(t,\bx,\bu)\,\partial_{x^1}+\cdots+f^n(t,\bx,\bu)\,\partial_{x^n},\partial_{u^1},\ldots,\partial_{u^m}\}. \end{equation} Additionally, we require that the Cauchy bundles of $\omega$ and $\mcal{V}$ be trivial. \end{defn} The last part of this definition is found in the definition of Sluis in \cite{sluis1994absolute} on page 34/35. Control systems must be underdetermined ODE systems. That is, the differential equations (\ref{control system}) must have nontrivial dependence on \textit{all} the specified control parameters in a way that is not redundant. This is the reason for the Cauchy bundle condition. For control systems, we would like to pick the controls $u^1,\ldots,u^m$ to be functions of $t$ so that a corresponding solution of the control system is the graph of a curve in $M$ that passes through two desired points in $\bX(M)$. If we assume that a control system is controllable, then it follows that as a Pfaffian system or distribution, the control system needs to be completely nonintegrable; otherwise integral curves would be ``stuck" in submanifolds that foliate $M$. To see this in a bit more detail, assume that there is some $k$ such that $\coder{\omega}{k+1}=\coder{\omega}{k}$ is nontrivial. That is, the derived flag of $\omega$ terminates in a nontrivial Frobenius system at step $k$. Any integral curve of $\omega$ is also an integral curve of $\coder{\omega}{k}$. Let $\gamma(t)=(t,\bx(t), \bu(t))$ be such an integral curve, and let $\coder{\omega}{k}$ be generated by the exact 1-forms $dy^1,\ldots,dy^s$, so that locally we have a new coordinate system $(t,y^1,\ldots,y^s,z^{s+1},\ldots,z^{n+m})$. Note that neither $dt$ nor the $du^a$ may be in $\coder{\omega}{k}$; otherwise they would belong to $\omega$ as well, and this is prohibited by the independence condition and the Cauchy characterstic condtion, respectively. In these new coordinates, the curve $\gamma(t)$ becomes $\tilde{\gamma}(t)=(t,\by(t),\bz(t))$. However, since $\gamma(t)$ is an integral curve of $\coder{\omega}{k}$, then so is $\tilde{\gamma}(t)$, and thus $\by(t)=\bc$ for some constants $\bc=(c^1,\ldots,c^s)$. Thus the curve $\tilde{\gamma}(t)$ is contained in the submanifold defined by $\by=\bc$. However, if we wanted to connect two points \textit{not} in any such submanifold, then we could not connect those two points via an integral curve of $\omega$. Hence, the controllability property implies that $\omega$ must be completely nonintegrable. Hence, for the remainder of this thesis, we will always assume that control systems are completely nonintegrable. \subsection{Lie Transformations} The classes of diffeomorphisms considered in this thesis fall under the umbrella of Lie transformation (pseudo)groups. The study of transformation pseudogroups has produced a rich literature of interesting results. We cannot give a full account here, but we would like to direct the interested reader to \cite{BryantLieSymplectic}, \cite{KuranishiPseudo1},\cite{KuranishiPseudo2}, and \cite{LieCartanGroups}, as well as \cite{OlverPseudoOverview} for modern perspectives in this area. We will use the following definition of a Lie pseudogroup. \begin{defn}\label{pseudo def}\cite{LieCartanGroups} Let $M$ be a differentiable manifold and let $\mcal{P}$ be a collection of diffeomorphisms of open subsets of $M$ into $M$. We say that $\mcal{P}$ is a \textbf{Lie pseudogroup} if: \begin{enumerate} \item $\mcal{P}$ is closed under restriction: if $\varphi:U\to M$ belongs to $\mcal{P}$ so does $\varphi|_V$ for any $V\subset U$, open. \item Elements of $\mcal{P}$ can be pieced together: If $\varphi: U\to M$ is a diffeomorphism and $U=\cup_{\alpha} U_\alpha$ with $\varphi|_{U_\alpha}\in\mcal{P}$ then $\varphi\in\mcal{P}$. \item $\mcal{P}$ is closed under inverse: if $\varphi:U\to M$ belongs to $\mcal{P}$ so does $\varphi^{-1}:\varphi(U)\to M$. \item $\mcal{P}$ is closed under composition: if $\varphi: U\to M$ and $\psi: \varphi(U)\to M$ are in $\mcal{P}$ then $\psi\circ\varphi\in \mcal{P}$. \item The identity diffeomorphism belongs to $\mcal{P}$. \end{enumerate} \end{defn} Although we are interested in studying control systems invariant under certain infinite dimensional Lie pseudogroups of transformations, we will also work with transformations induced by finite dimensional Lie groups. \begin{defn}\label{local Lie group} Let $G$ be a Lie group of dimension $r<\infty$. A \textbf{local Lie group} is (up to Lie group isomorphism) any open subset of $G$ containing the identity element $e$. \end{defn} Unless otherwise specified, all Lie groups $G$ in this thesis will be considered as local Lie groups. Furthermore, we note that Definition \ref{local Lie group} is essentially Theorem 1.22 of \cite{OlverLieBook} which says that every local Lie group may be realized as an open subset of a Lie group that contains the identity element. \begin{defn}\cite{OlverLieBook} Let $M$ be a smooth manifold. A \textbf{(local) Lie group of transformations} acting on $M$ is given by a (local) Lie group $G$, an open subset $U$, with \begin{equation} \{e\}\times M\subset U\subset G\times M, \end{equation} which is the domain of definition of the group action, and a smooth map $\Psi:U\to M$ with the following properties: \begin{enumerate} \item If $(h,x)\in U,\,(g,\Psi(h,x))\in U$, and also $(g\cdot h,x)\in U$, then \begin{equation} \Psi(g,\Psi(h,x))=\Psi(g\cdot h, x). \end{equation} \item For all $x\in M$, \begin{equation} \Psi(e,x)=x. \end{equation} \item If $(g,x)\in U$, then $(g^{-1},\Psi(g,x))\in U$ and \begin{equation} \Psi(g^{-1},\Psi(g,x))=x. \end{equation} One may also write $g\cdot x$ for $\Psi(g,x)$. \end{enumerate} \end{defn} When we refer to a Lie group of transformations, we will always be referring to a \textit{local} Lie group of transformations unless otherwise specified. In practice, we will usually rely on the infinitesimal version of Lie transformations, which we now define. \begin{defn}\cite{OlverLieBook} Let $G$ be a Lie transformation group acting on a smooth manifold $M$, and let $\mathfrak{g}$ be the Lie algebra of right-invariant vector fields on $G$. Then the \textbf{infinitesimal action} of $\mathfrak{g}$ on $M$ is given by \begin{equation} \psi(v)|_x=\frac{d}{ds}\Big|_{s=0}\Psi(\exp(sv),x)=d\Psi_x(v|_e)\label{exp action} \end{equation} for all $v\in\mathfrak{g}$ and $x\in U\subset M$, and where $\Psi_x(g)=\Psi(g,x)$. Equation (\ref{exp action}) defines a vector field, $\psi(v)$, on $U\subset M$. \end{defn} The map $\psi:\mathfrak{g}\to \Gamma(TM)$ defined by \ref{exp action}, is a Lie algebra homomorphism and sections of $TM$ in the image of $\psi$ are \textit{infinitesimal generators} of the group action $G$. We then have the following important theorem. \begin{thm}\label{inf vf}\cite{OlverLieBook} Let $w_1,\ldots,w_r$ be vector fields on a manifold $M$ satisfying \begin{equation} [w_i,w_j]=\sum_{k=1}^r c^k_{ij}w_k,\quad i,j=1,\ldots,r, \end{equation} for certain constants $c^k_{ij}$. Then there is a Lie group $G$ whose Lie algebra has the given $c^k_{ij}$ as structure constants relative to some basis $v_1,\ldots,v_r,$ and a local group action of $G$ on $M$ such that $\psi(v_i)=w_i$ for $i=1,\ldots,r,$ where $\psi$ is defined by (\ref{exp action}). \end{thm} \begin{defn} The vector fields in $w_1,\ldots,w_r$ in Theorem \ref{inf vf} are called the \textbf{infinitesimal generators} of the action of $G$ on $M$. \end{defn} Recall Definition \ref{EDS symmetry}, where we defined an infinitesimal symmetry of an EDS. If an EDS has infinitesimal symmetries that satisfy the hypotheses of Theorem \ref{inf vf}, then there will be an associated local Lie group of transformations that, as will be discussed later, takes integral manifolds of an EDS to integral manifolds of the same EDS. It is often easier to work with infinitesimal symmetries, however, and in light of Theorem \ref{inf vf}, the word ``symmetry" will be used to mean either an element of a local Lie group of transformations $G$, or one of the vector fields that arise from an infinitesimal action of $\mathfrak{g}$ on a manifold $M$. In Chapter 3, we will explore symmetries of Pfaffian systems as they apply to control systems. Next, we'll present some important facts about local Lie group actions that will allow us to investigate invariant integral manifolds of an EDS. \begin{defn} Let $G$ be a local Lie group of transformations acting on a manifold $M$. Define the \textbf{stabilizer} of a point $x\in M$ as the set \begin{equation} G_x=\{g\in G\colon\,g\cdot x=x\}. \end{equation} We say the action of $G$ on $M$ is \textbf{free} if for all $x\in M$, $G_x=\{e\}$, where $e$ is the identity element. \end{defn} \begin{defn} Let $G$ be a local Lie transformation group acting on a manifold $M$. Then the \textbf{orbit} of the action on a point $x\in M$ is \begin{equation} G\cdot x=\{y\in M\colon\,y=g\cdot x, \,\mathrm{for}\,\mathrm{some}\,g\in G\}. \end{equation} Two points $x$ and $y$ in $M$ are \textbf{equivalent} if and only if they belong to the same orbit. Then the space of equivalence classes endowed with the quotient topology is denoted $M/G$ and is called the \textbf{orbit space} of the action of $G$ on $M$. \end{defn} \begin{thm}\cite{BryantLieSymplectic} The stabilizer $G_x$ for any point $x\in M$ is a closed Lie subgroup of $G$. Additionally, the orbits $G\cdot x$ are smooth immersed submanifolds of $M$. \end{thm} \begin{prop}\cite{OlverSymmetryBook} Let $G$ be a local Lie group of transformations acting on a manifold $M$. Then the dimensions of the orbits of $G$ are all equal to the dimension of $G$ if and only if $G$ acts freely on $M$. \end{prop} \begin{defn}\label{regular def}\cite{OlverLieBook} Let $G$ be a local Lie group of transformations acting on a manifold $M$. If the dimensions of the orbits of the action are all constant and equal then we say that $G$ acts \textbf{semi-regularly} on $M$. Furthermore, the action of $G$ on $M$ is called \textbf{regular} if $G$ acts semi-regularly on $M$ and has the additional property that for any $x\in M$, there exist arbitrarily small open sets $U$ containing $x$ such that individual orbits of $G$ intersect $U$ in pathwise connected subsets. \end{defn} \textbf{Remark:} In other contexts, a \textit{regular} group action may refer to a free and transitive group action; however, we have no need for this meaning of the word. We also mention that, if a group action on a manifold is regular as in Definition \ref{regular def}, then the orbits of the action are regular submanifolds, although the converse may not be true. A classic example of a semi-regular, but not regular, group action on a manifold $M$ is the case of an irrational flow on the 2-torus. The group $G$ is the whole real line, and although each orbit is a 1-dimensional, immersed submanifold of $M$, every open set of any point on $\mathbb{T}^2$ fails the definition of regularity since the orbits of the action are dense. However, if $G$ is any nontrivial, finite open interval of $\mathbb{R}$ containing zero, then the corresponding irrational flow \textit{is} a regular action by $G$ on $\mathbb{T}^2$. The definitions of semi-regular and regular actions extend to the infinitesimal action of a Lie group as well. Additionally, the definition extends to any completely integrable distribution on $M$. \begin{defn}\cite{OlverLieBook} Let $\mcal{V}$ be a completely integrable distribution on a manifold $M$. If $\rank\mcal{V}$ is a fixed constant everywhere on $M$, then we say $\mcal{V}$ is \textbf{semi-regular}. Furthermore, a semi-regular distribution $\mcal{V}$ is \textbf{regular} if the integral manifolds of $\mcal{V}$ have the property that for any $x\in M$, there exist arbitrarily small open sets $U$ containing $x$ such that the individual integral manifolds of $\mcal{V}$ intersect $U$ in pathwise connected subsets. \end{defn} Let $\Gamma$ denote the span over $C^\infty(M)$ of the infinitesimal generators of the action on $M$ of a Lie group $G$, which as a distribution, is always completely integrable by virtue of the Jacobi identity and Definition \ref{EDS symmetry}. If $\Gamma$ is semi-regular or regular, then the action of $G$ is also semi-regular or regular, respectively. As in the previous example, one may not always be guaranteed that a given distribution $\Gamma$ on $M$ corresponding to a Lie group action is regular or even semi-regular. However, we can always restrict to smaller open submanifolds of $M$ and smaller open submanifolds of $G$ containing the identity such that $\Gamma$ is semi-regular or regular. For the remainder of the thesis, we will always assume that we have restricted to sufficiently small open submanifolds of $M$ and $G$ to guarantee that all actions are regular. \begin{thm}\cite{OlverLieBook} Let $M$ be a smooth $n$-dimensional manifold. Suppose $G$ is an $r$-dimensional local Lie group of transformations which acts regularly and freely on $M$. Then the orbit space, or quotient manifold $M/G$, is a smooth $(n-r)$-dimensional manifold with a projection map $\pi:M\to M/G$ such that the following hold. \begin{enumerate} \item $\pi$ is a smooth map between manifolds.\\ \item Two points $x$ and $y$ belong to the same orbit of $G$ in $M$ if and only if $\pi(x)=\pi(y)$.\\ \item If $\Gamma$ denotes the Lie algebra of infinitesimal generators of the action of $G$ on $M$, then the linear map \begin{equation} d\pi:TM\big|_{x}\to T(M/G)\big|_{\pi(x)} \end{equation} is onto, with kernel $\Gamma\big|_x=\{X\big|_x\colon X\in \Gamma\}$.\\ \item If $\{\eta^i(x)\}_{i=1}^{n-r}$ are independent first integrals of the Lie algebra of infinitesimal generators $\Gamma$, then $(\eta^1,\ldots,\eta^{n-r})$ form a local coordinate system on $M/G$. \end{enumerate} \end{thm} \subsection{Extended Static Feedback Transformations (ESFTs)} We are concerned with two types of diffeomorphisms determining equivalence classes of control systems. They are known as \textit{static feedback transformations} and \textit{extended static feedback transformations}. The former of the two types of transformations are of particular interest to control theory as a whole and are generally well studied. The latter are a slightly broader type of diffeomorphism that allows for extra time dependence. To be precise: \begin{defn} A diffeomorphism $\Phi:M\to N$ of the form \[ \Phi:(t,x,u) \mapsto (t,\varphi(x),\psi(x,u)) \] is called a \textbf{static feedback transformation} (SFT). Two control systems $(M,\omega)$ and $(N,\eta)$ are called \textbf{static feedback equivalent} (SFE) if $\Phi^*\eta=\omega$ for some SFT $\Phi:M\to N$. \end{defn} And the slightly broader class of diffeomorphisms can be defined by: \begin{defn} A diffeomorphism $\Phi:M\to N$ of the form \[ \Phi:(t,x,u) \mapsto (t,\varphi(t,x),\psi(t,x,u)) \] is called an \textbf{extended static feedback transformation} (ESFT). Two control systems $(M,\omega)$ and $(N,\eta)$ are called \textbf{extended static feedback equivalent} (ESFE) if $\Phi^*\eta=\omega$ for some ESFT $\Phi:M\to N$. \end{defn} Although SFTs are more common in the control theory literature, we will need the use of both types. In particular, the last chapter necessarily requires that we use ESFTs. Since SFTs are special type of ESFTs, we will always refer to the more general case unless otherwise specified. \begin{ex} The two systems \begin{equation} \omega=\langle dx^1-x^3\,dt,dx^2-x^4\,dt,dx^3-u^1\,dt,dx^4-u^2\,dt\rangle \end{equation} on the manifold $M=\mathbb{R}\times\mathbb{R}^4\times\mathbb{R}^2$ and \begin{equation} \eta=\langle dy^1-(y^3e^{-ty^1}-t)\,dt,dy^2-y^4\,dt,dy^3-v^1y^2\,dt,dy^4-y^1\arctan(v^2)\,dt\rangle \end{equation} on the manifold $N=\mathbb{R}\times\mathbb{R}^4\times\mathbb{R}^2$ are ESFE. \end{ex} The ESFT that accomplishes the equivalence is given by \begin{equation} \Phi^{-1}: (t,\by,\bv)\mapsto (t,e^{ty^1},y^2,y^3,y^4,v^1y^2,y^1\arctan(v^2)). \end{equation} Computing the pullback by $\Phi^{-1}$ of the forms that generate $\omega$, we find \begin{align} (\Phi^{-1})^*(dx^1-x^3\,dt)&=te^{ty^1}\left(dy^1-\frac{(y^3e^{-ty^1}-y^1)}{t}\,dt\right),\\ (\Phi^{-1})^*(dx^2-x^4\,dt)&=dy^2-y^4\,dt,\\ (\Phi^{-1})^*(dx^3-u^1\,dt)&=dy^3-v^1y^2\,dt,\\ (\Phi^{-1})^*(dx^4-u^2\,dt)&=dy^4-y^1\arctan(v^2)\,dt. \end{align} Hence, $(\Phi^{-1})^*\omega=\eta$, so the two systems are ESFE. \subsection{Brunovsk\'y Normal Forms and Goursat Bundles} In this section we will explore a specific class of controllable linear control systems that are equivalent via ESFTs. We will introduce jet bundles, contact systems, and a generalization of these concepts known as Goursat bundles. \begin{defn}\label{jet} Let $f,g: \mathbb{R}\to \mathbb{R}^m$ be two $C^n$ curves in $\mathbb{R}^m$. We say that $f$ and $g$ are equivalent via $n$\textbf{-th order contact at a point} $x_0\in\mathbb{R}$ if the $n$th degree Taylor polynomials for $f$ and $g$ agree at $x_0$. In particular, we denote the equivalence class of $f$ as $j^n_{x_0}f$ and we call $j^n_{x_0}f$ the $n$-\textbf{jet of} $f$ \textbf{at} $x_0$. \end{defn} Two functions are in $0$-th order contact at $x_0$ if the graphs of $f$ and $g$ in $\mathbb{R}\times \mathbb{R}^m$ pass through the same point at $x_0$, $1$-st order contact if the graphs are mutually tangent to each other at $x_0$, and so on. However, we are not only interested in $n$-jets of functions over a single point. \begin{defn} Let $J^n_{x_0}(\mathbb{R},\mathbb{R}^m)$ denote the space of $n$-jets of functions $f:\mathbb{R}\to\mathbb{R}^m$ at $x_0$. Then the \textbf{jet bundle of order} $n$ is defined to be \begin{equation} J^n(\mathbb{R},\mathbb{R}^m)=\coprod_{x_0\in\mathbb{R}}J^n_{x_0}(\mathbb{R},\mathbb{R}^m). \end{equation} Furthermore, the space $\mathbb{R}$ in the notation $J^n(\mathbb{R},\mathbb{R}^m)$ may be refered to as the \textbf{source} and is the image of the \textbf{source projection map} \begin{align*} \pi_n:J^n(\mathbb{R},\mathbb{R}^m)\to \mathbb{R}, j^n_{x_0}f\mapsto x_0. \end{align*} \end{defn} We will often abbreviate the notation $J^n(\mathbb{R},\mathbb{R}^m)$ to $J^n$ whenever there is no danger of ambiguity. In general, jet bundles can be defined for maps between any two differentiable manifolds $M$ and $N$. For more on jet bundles see the text \cite{JetBundleText}. Let $t$ be the local coordinate for $\mathbb{R}$ in $J^n$ and $(z^1_0,\ldots,z^m_0)$ the local coordinates for $\mathbb{R}^m$ in $J^n$. The jet bundle $J^n$ has local coordinates given by $(t, z^i_0, z^i_1,\ldots, z^i_n)$ where $1\leq i\leq m$. The $n$-jet lift of a function $f:\mathbb{R}\to\mathbb{R}^m$ is the curve $j^nf:\mathbb{R}\to J^n$ that has the parameterization given by $\left(t, f^i(t), \frac{df^i}{dt}(t),\ldots, \frac{d^nf^i}{dt^n}(t)\right)$. Thus one can interpret local coordinates for a jet bundle so that the coordinate from $\mathbb{R}$ is the ``independent variable", the coordinates $z^i_0$ are ``place-holders" for the ``dependent variables", and the $z^i_l$ may be thought of as ``place-holders" for $l$th order derivatives of the ``dependent variables". Consider the jet space $J^n(\mathbb{R},\mathbb{R}^m)$. There is a natural Pfaffian system on this space whose integral manifolds correspond to the graphs of jets of functions from $\mathbb{R}$ to $\mathbb{R}^m$. This Pfaffian system is called the \textit{contact system} or the \textit{Cartan system} \cite{CartanBeginners}. Note: the terminology ``Cartan system" has another well established meaning in EDS theory as the \textit{retracting space}; see Chapter 6.1 of \cite{CartanBeginners}. \begin{defn} The linear Pfaffian system $\left(J^n(\mathbb{R},\mathbb{R}^m),\beta^n_m\right)$ with \begin{align} \beta^n_m&=\langle \theta^i_l \rangle,\\ \theta^i_l&=dz^i_l-z^i_{l+1}\,dt, \end{align} for all $1\leq i\leq m$ and $0\leq l\leq n-1$, is called the \textbf{contact system}. Furthermore, denote by $\mathcal{C}^n_m$ the distribution on $J^n(\mathbb{R},\mathbb{R}^m)$ that is annihilated by the 1-forms $\{\theta^i_l\}$. \end{defn} Let $f:\mathbb{R}\to\mathbb{R}^m$ be any smooth function given in coordinates by $(t,f^1(t),\ldots,f^m(t))$. Then the $n$-jet $j^nf$ is an integral curve of $\beta^n_m$. Indeed, each $\theta^i_l$ is zero when restricted to the curve $j^nf(t)$, since \begin{equation} \begin{aligned} (j^nf)^*(dz^i_l)&=d\left(\frac{d^lf^i}{dt^l}\right)\\ \,&=\frac{d^{l+1}f^i}{dt^{l+1}}\,dt\\ \,&=(j^nf)^*(z^i_{l+1})\,dt, \end{aligned} \end{equation} and therefore \begin{equation} (j^nf)^*(dz^i_l-z^i_{l+1}\,dt)=0. \end{equation} We now discuss the notion of \textit{prolongation} of a jet space/contact system. First, notice that there is a surjective submersion $\pi: J^{n+1}(\mathbb{R},\mathbb{R}^m)\to J^n(\mathbb{R},\mathbb{R}^m)$ given by $j^{n+1}f\mapsto j^nf$, or in coordinates, $(t,z^i_0,\ldots,z^i_{n+1})\mapsto(t,z^i_0,\ldots,z^i_n)$. The canonical contact systems on these two jet spaces have the property that \begin{equation} \beta^{n+1}_m=\pi^*\left(\beta^n_m\right)\oplus\langle \theta^i_n\rangle, \end{equation} so that integral curves $j^n_tf$ of $\beta^n_m$ lift to integral curves $j^{n+1}_tf$ of $\beta^{n+1}_m$. For our purposes, we'll use the following restricted definition: \begin{defn} The linear Pfaffian system $\left(J^{n+1}(\mathbb{R},\mathbb{R}^m),\beta^{n+1}_m\right)$ is a \textbf{prolongation}\\ of $\left(J^n(\mathbb{R},\mathbb{R}^m),\beta^n_m\right)$. \end{defn} See \cite{CartanBeginners} and \cite{BCGGG} for the general definition of prolongation of exterior differential systems. In this thesis, we will frequently work on \textit{partial} prolongations of jet spaces. \begin{defn}\label{partial prolongation} A \textbf{partial prolongation} of the Pfaffian system $(J^1(\mathbb{R},\mathbb{R}^m),\beta^1_m)$ is given by the Pfaffian system $(J^\kappa(\mathbb{R},\mathbb{R}^m), \beta^\kappa_m)$ where \begin{align} J^\kappa(\mathbb{R},\mathbb{R}^m)&:=\left(\prod_{i\in I}J^i(\mathbb{R},\mathbb{R}^{\rho_i})\right)/\sim,\label{jkappa}\\ \beta^\kappa_m&:=\bigoplus_{i\in I}\beta^i_{\rho_i}, \end{align} with $I=\{1\leq a\leq k\,\mid\rho_a\neq0 \}$. The equivalence relation `$\sim$' in (\ref{jkappa}) is defined by \begin{equation} \pi_i\left(J^i(\mathbb{R},\mathbb{R}^{\rho_i})\right)=\pi_j\left(J^j(\mathbb{R},\mathbb{R}^{\rho_j})\right), \end{equation} for all $1\leq i,j\leq k$, where $\pi_i,\pi_j$ are source projection maps. Furthermore, $m=\rho_1+\cdots+\rho_k$, where $k$ is the derived length of $\beta^\kappa$, and $\kappa=\langle \rho_1,\ldots,\rho_k\rangle$ is the list of natural numbers that defines the \textbf{type} of the partial prolongation of $J^1(\mathbb{R},\mathbb{R}^m)$. \end{defn} The contact system mentioned in Definition \ref{partial prolongation} represents an important class of control systems. Indeed, in \cite{Brunovsky} it was proven than any controllable linear system is equivalent via a linear feedback transformation to a partial prolongation of the form given in Definition \ref{partial prolongation}. \begin{defn} The contact system $\beta^\kappa_m$ in Definition \ref{partial prolongation} is called a \textbf{Brunovsk\'y normal form} of type $\kappa$, and we will denote by $\mcal{C}^\kappa_m$ the distribution annihilated by $\Omega^1(M)\cap\beta^\kappa_m$. \end{defn} A Brunovsk\'y normal form is uniquely determined by its type $\kappa$. For example, a Brunovsk\'y normal form of type $\kappa=\langle1,2,0,0,1,1\rangle$ on \begin{equation} J^\kappa(\mathbb{R},\mathbb{R}^5)=\left(J^1(\mathbb{R},\mathbb{R})\times J^2(\mathbb{R},\mathbb{R}^2)\times J^5(\mathbb{R}\mathbb{R})\times J^6(\mathbb{R},\mathbb{R})\right)/\sim \end{equation} is generated by the 1-forms \begin{equation*} \begin{array}{ccccc} \,&\,&\,&\,&\theta^5_5=dz^5_5-z^5_6\,dt,\\ \,&\,&\,&\theta^4_4=dz^4_4-z^4_5\,dt,&\theta^5_4=dz^5_4-z^5_5\,dt,\\ \,&\,&\,&\theta^4_3=dz^4_3-z^4_4\,dt,&\theta^5_3=dz^5_3-z^5_4\,dt,\\ \,&\,&\,&\theta^4_2=dz^4_2-z^4_3\,dt,&\theta^5_2=dz^5_2-z^5_3\,dt,\\ \,&\theta^2_1=dz^2_1-z^2_2\,dt,&\theta^3_1=dz^3_1-z^3_2\,dt,&\theta^4_1=dz^4_1-z^4_2\,dt,&\theta^5_1=dz^5_1-z^5_2\,dt,\\ \theta^1_0=dz^1_0-z^1_1\,dt,&\theta^2_0=dz^2_0-z^2_1\,dt,&\theta^3_0=dz^3_0-z^3_1\,dt,&\theta^4_0=dz^4_0-z^4_1\,dt,&\theta^5_0=dz^5_0-z^5_1\,dt. \end{array} \end{equation*} In this example, one can say that $J^\kappa$ has one variable of order 1, two of order 2, zero of orders 3 and 4, one of order 5, and one of order 6. So the type $\kappa$ is a list of the local coordinates on $J^\kappa$ categorized by order. As we will see later in this section, the type $\kappa$ of a Brunovsk\'y form is a diffeomorphism invariant. However, when working in coordinates on the partial prolongation of a jet space, it is often easier to use an alternative notation. Indeed, we can also write the partial prolongation of a jet space as \begin{equation} J^\kappa(\mathbb{R},\mathbb{R}^m)=\left(\prod_{i=1}^m J^{\sigma_i}(\mathbb{R},\mathbb{R})\right)/\sim \end{equation} where the equivalence relation is the same as in Definition \ref{partial prolongation} in the sense that all source manifolds for each jet space are identified. For this description of $J^\kappa$ we can write local coordinates as $(t, j^{\sigma_1}z^1,\ldots,j^{\sigma_m}z^m)$, where $j^{\sigma_i}z^i$ represents the $(\sigma_i+1)$-tuple $(z^i_0,z^i_1,\ldots,z^i_{\sigma_i})$. For the example of a partial prolongation of a jet space with type $\kappa=\langle1,2,0,0,1,1\rangle$, one can then write the local coordinates as $(t,j^1z^1,j^2z^2,j^2z^3,j^5z^4,j^6z^5)$. \begin{prop}\label{refined derived type numbers}\cite{VassiliouGoursatEfficient} Let $\mcal{C}^\kappa_m\subset TM$ be the distribution that annihilates the 1-forms in a Brunovsk\'y normal form $\beta^\kappa_m$ with type $\kappa=\langle \rho_1,\ldots,\rho_k\rangle$. Then the entries in the refined derived type \begin{equation} \mathfrak{d}_r(\mcal{C}^\kappa_m)=[[m_0,\chi^0],[m_1,\chi^1_0,\chi^1],\ldots,[m_{k-1},\chi^{k-1}_{k-2},\chi^{k-1}],[m_k,\chi^k]] \end{equation} satisfy the following relations: \begin{align} \kappa&=\mathrm{deccel}(\mcal{C}^\kappa_m),\quad \Delta_i=\sum_{l=i}^{k}\rho_l,\\ \nonumber m_0&=1+m,\quad m_j=m_0+\sum_{l=1}^j\Delta_l,\quad1\leq j\leq k,\\ \nonumber \chi^j&=2m_j-m_{j+1}-1,\quad 0\leq j\leq k-1,\\ \nonumber \chi^i_{i-1}&=m_{i-1}-1,\quad 1\leq i\leq k-1, \nonumber \end{align} where $\Delta_j$ is given in Definition \ref{accel def}. \end{prop} Some of the most important geometric structures for this thesis are the generalized Goursat bundles \cite{VassiliouGoursat}. The prototypical examples of Goursat bundles are exactly those subbundles $\mathcal{B}^\kappa$ of the tangent bundle of some $J^\kappa$ that are annihilated by the Brunovsk\'y 1-forms on $J^\kappa$. Like the example of Brunovsk\'y forms, Goursat bundles have the property of being \textit{completely nonintegrable}. \begin{defn} A (nonsingular) \textbf{rank 2 Goursat bundle} is a rank 2 distribution $\mathcal{V}$ on $M$ with no Cauchy characteristics such that $\mathrm{dim}\mathcal{V}^{(i+1)}=1+\mathrm{dim}\mathcal{V}^{(i)}$ for all $1\leq i\leq k-1$ and $\mathcal{V}^{(k)}=TM$. \end{defn} Furthermore, although Goursat bundles are examples of completely nonintegrable distributions, they are in some sense degenerate among such distributions. The growth of the derived flag is as slow as possible to still guarantee that the distribution is completely nonintegrable. Rank 2 Goursat bundles are the classical Goursat bundles that were studied by Goursat, Engel, and E. Cartan. Indeed, in the case that $M$ is a 4 dimensional manifold, a rank 2 Goursat bundle on $M$ is exactly an Engel structure. What about bundles of higher rank? This is the work of Vassiliou in \cite{VassiliouGoursat} and \cite{VassiliouGoursatEfficient}. Indeed, a generalized Goursat bundle, or simply a Goursat bundle, is given by the following definition. \begin{defn}\cite{VassiliouGoursat}\label{Goursat} A subbundle $\mathcal{V}\subset TM$ of derived length $k$ will be called a \textbf{Goursat bundle of type} $\kappa$ if: \begin{enumerate} \item $\mathcal{V}$ has the refined derived type of a partial prolongation of $J^1(\mathbb{R},\mathbb{R}^m)$ whose type $\kappa=\mathrm{deccel}(\mathcal{V})$, \item each intersection $\inChar{V}{i}:= \mathcal{V}^{(i-1)}\cap\Char{V}{i}$ is an integrable subbundle whose rank, assumed to be constant on $M$, agrees with the corresponding rank of $\mathrm{Char}(\mathcal{C}^\kappa_m)^{(i)}_{i-1}$, and \item in case $\Delta_k>1$, then $\mathcal{V}^{(k-1)}$ determines an integrable Weber structure whose resolvent bundle is of rank $\Delta_k+\chi^{k-1}$. \end{enumerate} \end{defn} Goursat bundles have a particularly nice normal form, and this is the main result of \cite{VassiliouGoursat}. \begin{thm}\label{Generalized Goursat Normal Form}\cite{VassiliouGoursat} (Generalized Goursat Normal Form). Let $\mathcal{V}\subset TM$ be a Goursat bundle on a manifold $M$, with derived length $k>1$, and type $\kappa=\mathrm{deccel}(\mathcal{V})$. Then there is an open dense subset $U\subset M$ such that the restriction of $\mathcal{V}$ to $U$ is locally equivalent to $\mathcal{C}^\kappa_m$ via a local diffeomorphism of $M$. Conversely, any partial prolongation of $\mathcal{C}^1_m$ is a Goursat bundle. \end{thm} The paper \cite{VassiliouGoursat} establishes the local normal form for generalized Goursat bundles constructively. However, in \cite{VassiliouGoursatEfficient}, the construction of local coordinates is streamlined into a nearly algorithmic procedure. We'll next outline this procedure, often referred to as procedure \textbf{contact}, and apply it to an example in detail. \subsection{ESF Linearizable Systems and Procedure Contact} In this section we'll present procedure \textbf{contact} from \cite{VassiliouGoursatEfficient} and then apply the procedure to Goursat bundles that represent control systems. There will be additional requirements to make sure that the diffeomorphism created by procedure \textbf{contact} can be chosen to be an ESFT. At the end of this section, we prove a result that highlights the difference between ESFL and SFL systems. Let $\mathcal{V}$ be a Goursat bundle on a manifold $M$ with derived length $k$. The Goursat bundle $\mathcal{V}$ will induce one of two possible filtrations of $TM$; one for the case that $\mathcal{V}$ has $\Delta_k>1$ and the other for the case of $\Delta_k=1$. To start, we'll assume that $\Delta_k>1$. The associated filtration of $TM$ for such a Goursat bundle is given by \begin{equation}\label{filt res} \text{Char}\,\mathcal{V}^{(1)}_0\subseteq\text{Char}\,\mathcal{V}^{(1)}\subset\cdots\subset\text{Char}\,\mathcal{V}^{(k-1)}_{k-2}\subseteq\text{Char}\,\mathcal{V}^{(k-1)}\subset\mathcal{R}_{\bar{\Sigma}_{k-1}}(\mathcal{V}^{(k-1)})\subset TM. \end{equation} Similarly, there is also a filtration of $T^*M$ defined by taking the annihilator of all of the above subbundles, \begin{equation} \Upsilon_{\bar{\Sigma}_{k-1}}(\mathcal{V}^{(k-1)})\subset \Xi^{(k-1)}\subseteq \Xi^{(k-1)}_{k-2}\subset\cdots\subset\Xi^{(1)}\subseteq\Xi^{(1)}_0\subset T^*M, \end{equation} where $\Xi^{(i)}=\text{ann }\Char{V}{i},\,\Xi^{(i)}_{i-1}=\text{ann }\inChar{V}{i}$, and $\Upsilon_{\bar{\Sigma}_{k-1}}(\mathcal{V}^{(k-1)})=\text{ann }\mathcal{R}_{\bar{\Sigma}_{k-1}}(\mathcal{V}^{(k-1)})$. Each subbundle in these filtrations is integrable by Definition \ref{Goursat}. In particular, these subbundles are diffeomorphism invariants of a given Goursat bundle, and hence their first integrals are also diffeomorphism invariants of the Goursat bundle. Such invariant functions will be used to construct the appropriate contact coordinates. We will not, however, need all first integrals of these subbundles. Notice that $\Char{V}{i}=\inChar{V}{i}$ if and only if $-\Delta^2_i=\rho_i=0$. Specifically, it is the case that $\rank \Xi^{(i)}_{i-1}/\Xi^{(i)}=\rho_i$. It turns out that the first integrals of each nontrivial quotient bundle $\Xi^{(i)}_{i-1}/\Xi^{(i)}$, and also of the annihilator of the resolvent bundle, $\Upsilon_{\bar{\Sigma}_{k-1}}(\mathcal{V}^{(k-1)})$, give the zeroth order contact coordinates on the appropriate $J^\kappa$. \begin{defn}\cite{VassiliouGoursatEfficient} For each $1\leq j\leq k-1$, let $\{\varphi^{l_j,j}\}_{l_j=1}^{\rho_j}$ generate the independent first integrals of $\Xi^{(j)}_{j-1}/\Xi^{(j)}$. Each $\varphi^{l_j,j}$ is called a \textbf{fundamental function of order} $j$. Now let $\{\varphi^{0,k},\ldots,\varphi^{\rho_k,k}\}$ generate the first integrals of $\Upsilon_{\bar{\Sigma}_{k-1}}(\mathcal{V}^{(k-1)})$. These will be the \textbf{fundamental functions of order} $k$. \end{defn} Notice that there are $\rho_j$ fundamental functions of order $j$ and $\rho_k+1$ fundamental functions of order $k$. The fundamental function $\varphi^{0,k}$ will usually denote a local coordinate for the source of $J^\kappa$. \begin{thm}\cite{VassiliouGoursatEfficient} Let $\mathcal{V}\subset TM$ be a Goursat bundle of derived length $k$ with $\kappa=\mathrm{deccel}(\mathcal{V})=\langle \rho_1,\ldots,\rho_k\rangle$, $\rho_k\geq2$. Let $\{x,\varphi^{1,k},\ldots,\varphi^{\rho_k,k}\}$ denote the fundamental functions of order $k$, and for each $\rho_j>0$ let $\{\varphi^{1,j},\ldots,\varphi^{\rho_j,j}\}$ denote the fundamental functions of order $j$ defined on some open subset $U\subseteq M$. Then there is an open, dense subset $V\subseteq U$ and a section $Z$ of $\mathcal{V}$ such that on $V$, $Zx=1$ and the fundamental functions, $x,\varphi^{l_j,j}_0:=\varphi^{l_j,j}$, together with the functions \begin{equation} \varphi^{l_j,j}_{s_j+1}=Z\varphi^{l_j,j}_{s_j},\,j\in\{1,\ldots,k\},\,1\leq l_j\leq\rho_j,\,0\leq s_j\leq j-1, \end{equation} are contact coordinates for $\mathcal{V}$, identifying it with $\mathcal{C}^\kappa_m$ on $J^\kappa$. \end{thm} The above theorem gives a way to explicitly construct the coordinates for the Brunovsk\'y normal form for a Goursat bundle (in the case that $\Delta_k>1$). We now give the analogous result in the case that $\Delta_k=1$. In this case, the Goursat bundle $\mathcal{V}$ induces the filtrations \begin{equation}\label{filt fun} \text{Char}\,\mathcal{V}^{(1)}_0\subseteq\text{Char}\,\mathcal{V}^{(1)}\subset\cdots\subset\text{Char}\,\mathcal{V}^{(k-1)}_{k-2}\subseteq\text{Char}\,\mathcal{V}^{(k-1)}\subset\Pi^{k-1}\subset TM, \end{equation} and \begin{equation} (\Pi^{k-1})^\perp\subset \Xi^{(k-1)}\subseteq \Xi^{(k-1)}_{k-2}\subset\cdots\subset\Xi^{(1)}\subseteq\Xi^{(1)}_0\subset T^*M. \end{equation} In place of the resolvent bundle is a new integrable bundle $\Pi^{k-1}\subset\mathcal{V}^{(k-1)}$. \begin{defn}\cite{VassiliouGoursatEfficient} Let $\mathcal{V}$ be a Goursat bundle with $\Delta_k=1$, $x$ a first integral of $\Char{V}{k-1}$, and $Z$ any section of $\mathcal{V}$ such that $Zx=1$. Then the \textbf{fundamental bundle} $\Pi^{k-1}\subset\mathcal{V}^{(k-1)}$ is defined inductively as \begin{equation} \Pi^{l+1}=\Pi^l+[\Pi^l,Z],\,\,\Pi^0=\inCharOne{V},\,\,0\leq l\leq k-2. \end{equation} \end{defn} In the proof of Theorem 4.2 in \cite{VassiliouGoursat} it is shown that $\Pi^{k-1}$ is integrable and has corank 2 in $TM$. Note also that $x$ is a first integral of $\Pi^{k-1}$ by virtue of filtration (\ref{filt fun}). We can now state the theorem that constructs contact coordinates for $\mathcal{V}$ in the case that $\Delta_k=1$. \begin{thm}\cite{VassiliouGoursatEfficient} Let $\mathcal{V}\subset TM$ be a Goursat bundle of derived length $k$ and $\kappa=\mathrm{deccel}({\mathcal{V}})=\langle \rho_1,\ldots,\rho_k\rangle, \rho_k=1$. Let $\Pi^{k-1}$ be the fundamental bundle, and let $\varphi^{1,k}$ be any first integral of $\Pi^{k-1}$ such that $dx\wedge d\varphi^{1,k}\neq0$ on an open set $U\subseteq M$. Then there is an open dense subset $V\subseteq U$ upon which there is a section $Z$ of $\mathcal{V}$ satisfying $Zx=1$ such that the fundamental functions $x,\varphi^{l_j,j}_0:=\varphi^{l_j,j}$ together with the functions \begin{equation} \varphi^{l_j,j}_{s_j+1}=Z\varphi^{l_j,j}_{s_j},\,j\in\{1,\ldots,k\},\,1\leq l_j\leq\rho_j,\,0\leq s_j\leq j-1, \end{equation} are contact coordinates for $\mathcal{V}$ on $V$, identifying it with $\mathcal{C}^\kappa_m$ on $J^\kappa$. \end{thm} These results can summed up as a procedure for calculating local contact coordinates for a Goursat bundle.\ \begin{proc contact}\cite{VassiliouGoursatEfficient}\\ \textbf{Procedure A}\label{proc A}\\ Let $\mathcal{V}\subset TM$ be a Goursat bundle with derived length $k>1$ such that $\Delta_k>1$. Then one can do the following to produce local contact coordinates for $\mathcal{V}$: \begin{enumerate} \item Build filtration (\ref{filt res}) and its associated filtration of $T^*M$. \item For each $1\leq j \leq k-1$ such that $\rho_j>0$, compute the quotient bundle $\Xi^{(j)}_{j-1}/\Xi^{(j)}$. \item Compute the fundamental functions $\varphi^{l_j,j}$ of $\Xi^{(j)}_{j-1}/\Xi^{(j)}$. \item Fix any fundamental function of order $k$ of the resolvent bundle, denoted $x$, and any section $Z$ of $\mathcal{V}$ such that $Zx=1$. \item For each $1\leq j\leq k$ such that $\rho_j>0$, define $z^{l_j,j}_0=\varphi^{l_j,j}$, $1\leq l_j\leq \rho_j$. Furthermore, define the remaining contact coordinates to be \begin{equation}\label{contact coord A} z^{l_j,j}_{s_j}=Zz^{l_j,j}_{s_j-1}=Z^{s_j}z^{l_j,j}_0,\,1\leq s_j\leq j,\,1\leq l_j\leq \rho_j. \end{equation} \end{enumerate} The local coordinates for $J^\kappa(\mathbb{R},\mathbb{R}^m)$ are given by $x,z^{l_j,j}_0$, and (\ref{contact coord A}). In these coordinates $\mathcal{V}$ has the form $\mathcal{C}^\kappa_m$.\\ \textbf{Procedure B}\label{proc B}\\ Let $\mathcal{V}\subset TM$ be a Goursat bundle with derived length $k>1$ such that $\Delta_k=1$. Then one can do the following to produce local contact coordinates for $\mathcal{V}$: \begin{enumerate} \item Build filtration (\ref{filt fun}) and its associated filtration of $T^*M$ up to $\Char{V}{k-1}$. \item Identify a first integral $x$ of $\Char{V}{k-1}$ such that there is a section $Z$ of $\mathcal{V}$ with the property $Zx=1$. Then construct $\Pi^{k-1}$, thereby completing filtration (\ref{filt fun}). \item For each $1\leq j\leq k-1$ such that $\rho_j>0$, compute the quotient bundle $\Xi^{(j)}_{j-1}/\Xi^{(j)}$. \item Compute the fundamental functions $\varphi^{l_j,j}$ of $\Xi^{(j)}_{j-1}/\Xi^{(j)}$. \item Define $z^{1,k}_0=\varphi^{1,k}$ to be any first integral of $\Pi^{k-1}$ such that $dx\wedge d\varphi^{1,k}\neq0$. \item For each $1\leq j\leq k$ such that $\rho_j>0$, define $z^{l_j,j}_0=\varphi^{l_j,j}$, $1\leq l_j\leq \rho_j$. Furthermore, define the remaining contact coordinates to be \begin{equation}\label{contact coord B} z^{l_j,j}_{s_j}=Zz^{l_j,j}_{s_j-1}=Z^{s_j}z^{l_j,j}_0,\,1\leq s_j\leq j,\,1\leq l_j\leq \rho_j. \end{equation} \end{enumerate} The local coordinates for $J^\kappa(\mathbb{R},\mathbb{R}^m)$ are given by $x,z^{l_j,j}_0$, and (\ref{contact coord B}). In these coordinates $\mathcal{V}$ has the form $\mathcal{C}^\kappa_m$. \end{proc contact} Procedure \textbf{contact} produces a local \textit{diffeomorphism} equivalence between a Goursat bundle and a contact system. In particular, the first integral $x$ in procedure \textbf{contact} plays the role of the source variable of some $J^\kappa$, so that $dx$ forms the independence condition for the linear Pfaffian system $(J^\kappa,\beta^\kappa_m)$. Therefore, if $\mathcal{V}$ represents a control system with $dt$ as the independence condition, then integral curves of $\mathcal{V}$ may not be sent to integrals curves of $\beta^\kappa_m$ that are parameterized by $t$. The following theorem gives additional conditions that ensures that procedure \textbf{contact} produces an ESFT equivalence between a Goursat bundle $\mathcal{V}$ representing a control system and a Brunovsk\'y normal form. \begin{thm}\cite{VassiliouSICON}\label{Goursat ESFL} Let $\mathcal{V}$ be a Goursat bundle of derived length $k>1$ that represents a control system on the manifold $M\cong_{\mathrm{loc}}\mathbb{R}\times\bX(M)\times\bU(M)$. Then $\mathcal{V}$ is ESF equivalent to a Brunovsk\'y normal form if and only if \begin{enumerate} \item $\{\partial_{u^a}\}\subset \inCharOne{V}$, \item $dt\in \Xi^{(k-1)}$ if $\Delta_k=1$ and $dt\in \Upsilon_{\bar{\Sigma}_{k-1}}(\mathcal{V}^{(k-1)})$ if $\Delta_k>1$. \end{enumerate} \end{thm} \begin{defn} Let $\omega$ be a control system on the manifold $M\cong_{loc}\mathbb{R}\bX(M)\times\bU(M)$ . Then $\omega$ is \textbf{intrinsically nonlinear} if it is not ESF equivalent to a Brunovsk\'y normal form. \end{defn} Before we present some examples, it is important to discuss previous work concerning linearization of control systems via feedback transformations. The work of Gardner, Shadwick, and Wilkens \cite{BrunovskySymmetry} solved the recognition problem of understanding when a given control system is SF equivalent to a Brunovsk\'y normal form. Their discovery was that the symmetry pseudogroups of Brunovsk\'y forms completely characterize such systems. In \cite{GSalgorithm}\cite{GSalgorithmExample}, Gardner and Shadwick devised an algorithm for transforming a SFL control system into Brunovsk\'y normal form. This approach used E. Cartan's method of equivalence and EDS theory and is considered the best method for SF linearization of a control system by control theorists. However, the GS algorithm does have some shortcomings. For instance, it only applies to systems that are SF equivalent to a Brunovk\'y normal form. This means it cannot fully address the question for control systems that are nonautonomous. Secondly, although the algorithm does indeed use the minimal number of integrations required to produce the SFT, one generally has to calculate the full structure equations in order to find the systems whose first integrals are used to construct contact coordinates. On the other hand, with Vassiliou's approach, one can first solve the recognition problem by computing the refined derived type and checking the integrability of the subbundles in (\ref{filt res}) and (\ref{filt fun}), as opposed to calculating the full symmetry pseudogroup of the control system. Procedure \textbf{contact} allows for one to be able to find general ESFTs instead of just SFTs, and furthermore, one need only compute first integrals of nonempty quotients of sequential subbundles of either (\ref{filt res}) or (\ref{filt fun}), plus the first integrals of the final subbundle in these filtrations (either the resolvent bundle or fundamental bundle). In this way, procedure \textbf{contact} also accomplishes the construction of an ESFT using the minimal number of integrations possible. Additionally, procedure \textbf{contact} is not restricted to control systems, and may be used to construct contact coordinates for any Goursat bundle (i.e. general diffeomorphism equivalence). The ability of procedure \textbf{contact} to produce ESFTs is especially important for the last steps of the cascade linearization process (see Chapter 4, Section 1). We would also like to remark that the construction of the remaining contact coordinates from procedure \textbf{contact} is reminiscent of the computation of higher order invariants from Olver's method of equivariant moving frames for Lie pseudogroups \cite{OlverPseudoMovingFrames}. Indeed, the author believes that Olver's methods would be yet another way to construct an algortihm for producing contact coordinates for a Goursat bundle. To further highlight the comparison of procedure \textbf{contact} and the GS algorithm, we present the following example of Hunt-Su-Meyer \cite{HuntSuMeyerLin}, which was then linearized via the GS algorithm in \cite{GSalgorithmExample}. Note that procedure contact can be executed in MAPLE or another suitable computer algebra program in a systematic way. For the sake of completeness, the following example has been computed with almost no details suppressed. \begin{ex}\cite{HuntSuMeyerLin}\cite{GSalgorithmExample} \begin{align*} &\frac{dx^1}{dt}=\sin(x^2),\,&\frac{dx^2}{dt}=\sin(x^3),\,&\,\phantom{==}&\frac{dx^3}{dt}=(x^4)^3+u^1,&\,\\ &\frac{dx^4}{dt}=x^5+(x^4)^3-(x^1)^{10},\,&\frac{dx^5}{dt}=u^2.\,&\,\phantom{==}&\, \end{align*} \end{ex} First, we'll rewrite the control system as the distribution $\mathcal{V}=\{X,\partial_{u^1},\partial_{u^2}\}$, where \begin{equation} X=\partial_t+\sin(x^2)\,\partial_{x^1}+\sin(x^3)\,\partial_{x^2}+((x^4)^3+u^1)\,\partial_{x^3}+(x^5+(x^4)^3-(x^1)^{10})\,\partial_{x^4}+u^2\partial_{x^5}. \end{equation} \textbf{Step 1:} The derived flag of $\mathcal{V}$ is given by, \begin{align} \der{V}{1}&=\mathcal{V}+\{\partial_{x^3},\partial_{x^5}\},\\ \der{V}{2}&=\der{V}{1}+\{\partial_{x^2},\partial_{x^4}\},\\ \der{V}{3}&=\der{V}{2}+\{\partial_{x^1}\}=TM. \end{align} Hence $\mathcal{V}$ has derived length 3, $\vel{V}=\langle 2,2,1 \rangle$, and $\dec{V}=\langle 0,1,1 \rangle$. Since $\Delta_k=1$ we will implement Procedure B. Next we compute the Cauchy bundles for $\der{V}{1}$ and $\der{V}{2}$. Let \begin{equation} C=TX+a^1\partial_{u^1}+a^2\partial_{u^2}+b^1\partial_{x^3}+b^2\partial_{x^5}\in \der{V}{1} \end{equation} be a section of the Cauchy bundle of $\der{V}{1}$, where $T,b^1,b^2,c^1,$ and $c^2$ are smooth functions. Then \begin{equation} [C,Y]\in \der{V}{1}\,\text{ for all }Y\in\der{V}{1}. \end{equation} It is enough to check $\mathcal{L}_C$ applied to the linearly independent sections generating $\der{V}{1}$. Doing so, we obtain \begin{align} [C,X]&=a^1\partial_{x^3}+a^2\partial_{x^5}+b^1[\partial_{x^3},X]+b^2[\partial_{x^5},X]\label{HSM CX}\\ \,&-(X(T)X+X(a^1)\partial_{u^1}+X(a^2)\partial_{u^2}+X(b^1)\partial_{x^3}+X(b^2)\partial_{x^5})\nonumber,\\ [C,\partial_{u^1}]&=T[X,\partial_{u^1}]-(T_{u^1}X+a^1_{u^1}\partial_{u^1}+a^2_{u^1}\partial_{u^2}+b^1_{u^1}\partial_{x^3}+b^2_{u^1}\partial_{x^5}),\\ [C,\partial_{u^2}]&=T[X,\partial_{u^2}]-(T_{u^2}X+a^1_{u^2}\partial_{u^1}+a^2_{u^2}\partial_{u^2}+b^1_{u^2}\partial_{x^3}+b^2_{u^2}\partial_{x^5}),\\ [C,\partial_{x^3}]&=T[X,\partial_{x^3}]-(T_{x^3}X+a^1_{x^3}\partial_{u^1}+a^2_{x^3}\partial_{u^2}+b^1_{x^3}\partial_{x^3}+b^2_{x^3}\partial_{x^5})\label{HSM T=0 1},\\ [C,\partial_{x^5}]&=T[X,\partial_{x^5}]-(T_{x^5}X+a^1_{x^5}\partial_{u^1}+a^2_{x^5}\partial_{u^2}+b^1_{x^5}\partial_{x^3}+b^2_{x^5}\partial_{x^5}).\label{HSM T=0 2} \end{align} Equation (\ref{HSM CX}) implies that $b_1=b_2=0$, and either of equations (\ref{HSM T=0 1}) or (\ref{HSM T=0 2}) imply that $T=0$ since $[X,\partial_{x^3}]=-\cos(x^3)\partial_{x^2}$ and $[X,\partial_{x^5}]=-\partial_{x^4}$ are in $\der{V}{2}$ and not $\der{V}{1}$. Therefore, any section of the Cauchy bundle must be of the form $a^1\partial_{u^1}+a^2\partial_{u^2}$ for arbitrary functions $a^1$ and $a^2$. Therefore, \begin{equation} \Char{V}{1}=\{\partial_{u^1},\partial_{u^2}\}. \end{equation} Now let $C=TX+b^1\partial_{x^3}+b^2\partial_{x^5}+c^1\partial_{x^2}+c^2\partial_{x^4}\in \der{V}{2}$, where $T,b^1,b^2,c^1,$ and $c^2$ are smooth functions, such that $C$ is a section of the Cauchy bundle of $\der{V}{2}$. Then applying the Lie derivative $\mathcal{L}_C$ to the generating sections of $\der{V}{2}$, we find \begin{align} [C,X]&=b^1[\partial_{x^3},X]+b^2[\partial_{x^5},X]+c^1[\partial_{x^2},X]+c^2[\partial_{x^4},X]\label{HSM CX 2}\\ \,&-(X(T)X+X(b^1)\partial_{x^3}+X(b^2)\partial_{x^5}+X(c^1)\partial_{x^2}+X(c^2)\partial_{x^4}),\nonumber\\ [C,\partial_{x^3}]&=T[X,\partial_{x^3}]-(T_{x^3}X+b^1_{x^3}\partial_{x^3}+b^2_{x^3}\partial_{x^5}+c^1_{x^3}\partial_{x^2}+c^2_{x^3}\partial_{x^4}),\\ [C,\partial_{x^5}]&=T[X,\partial_{x^5}]-(T_{x^5}X+b^1_{x^5}\partial_{x^3}+b^2_{x^5}\partial_{x^5}+c^1_{x^5}\partial_{x^2}+c^2_{x^5}\partial_{x^4}),\\ [C,\partial_{x^2}]&=T[X,\partial_{x^2}]-(T_{x^2}X+b^1_{x^2}\partial_{x^3}+b^2_{x^2}\partial_{x^5}+c^1_{x^2}\partial_{x^2}+c^2_{x^2}\partial_{x^4}),\label{HSM T=0 1 2}\\ [C,\partial_{x^4}]&=T[X,\partial_{x^4}]-(T_{x^4}X+b^1_{x^4}\partial_{x^3}+b^2_{x^4}\partial_{x^5}+c^1_{x^4}\partial_{x^2}+c^2_{x^4}\partial_{x^4}).\label{HSM T=0 2 2} \end{align} Since \begin{align} [\partial_{x^2},X]&=\cos(x^2)\partial_{x^1}\not\in\der{V}{2},\\ [\partial_{x^4},X]&=3(x^4)^2(\partial_{x^3}+\partial_{x^4})\in\der{V}{1}, \end{align} equations (\ref{HSM CX 2}) and (\ref{HSM T=0 1 2}) force $c^1=0$ and $T=0$, respectively. Hence $C=b^1\partial_{x^3}+b^2\partial_{x^5}+c^2\partial_{x^4}$ for arbitrary smooth functions $b^1,b^2,$ and $c^2$. Notice also that there is no need to check sections of $\der{V}{2}$ with components from $\Char{V}{1}$, since $\Char{V}{1}\subset \Char{V}{2}$. Therefore, \begin{equation} \Char{V}{2}=\{ \partial_{u^1},\partial_{u^2},\partial_{x^3},\partial_{x^4},\partial_{x^5}\}. \end{equation} From here, it is easily deduced that \begin{align} \inCharOne{V}&=\{\partial_{u^1},\partial_{u^2}\},\\ \mathrm{Char}\der{V}{2}_1&=\{\partial_{u^1},\partial_{u^2},\partial_{x^3},\partial_{x^5}\}. \end{align} Thus the refined derived type of $\mathcal{V}$ is \begin{equation} \mathfrak{d}_r(\mathcal{V})=[[3,0],[5,2,2],[7,4,5],[8,8]]. \end{equation} Checking that the relations in Proposition \ref{refined derived type numbers} are true and seeing that all the bundles in (\ref{filt fun}) (up to the fundamental bundle) are integrable, we see that $\mathcal{V}$ must be a Goursat bundle. Furthermore, since $dt\in \ann\Char{V}{2}$; by Theorem \ref{Goursat ESFL} we deduce that $\mathcal{V}$ must be ESFL. Constructing the filtration of $T^*M$ (excluding the fundamental bundle) induced by $\mathcal{V}$, we find \begin{equation} \coder{\Xi}{2}=\{dt,dx^1,dx^2\}\subset \coder{\Xi}{2}_1=\{dt,dx^1,dx^2,dx^4\}\subset\coder{\Xi}{1}=\{dt,dx^1,dx^2,dx^3,dx^4,dx^5\}=\coder{\Xi}{1}_0. \end{equation} \textbf{Step 2:} Notice that $t$ is a first integral of $\Char{V}{2}$ and that $X(t)=1$. Now the fundamental bundle $\Pi^2$ is given by \begin{equation} \Pi^2=\{\partial_{u^1},\partial_{u^2},\partial_{x^2},\partial_{x^3},\partial_{x^4},\partial_{x^5}\}. \end{equation} \textbf{Steps 3 and 4:} There is only one non-empty quotient bundle to be computed for this step, \begin{equation} \coder{\Xi}{2}_1/\coder{\Xi}{2}=\{dx^4\}, \end{equation} and therefore $z_0^{1,2}=x^4$.\\ \textbf{Step 5:} From $\Pi^2$, we deduce that the other zeroth order contact variable is given by $z_0^{1,3}=x^1$ since $dt\wedge dx^1\neq0$. For simplicity, we shall relabel these zeroth order contact coordinates as $z_0^{1,2}=z_0^1$ and $z_0^{1,3}=z_0^2$.\\ \textbf{Step 6:} Applying the final step of the procedure, we conclude that the remaining contact coordinates are \begin{align}\label{HSM contact coords start} z^1_1&=X(z_0^1)=x^5+(x^4)^3-(x^1)^{10},\\ z^1_2&=X(z^1_1)=u^2+3(x^4)^2(x^5+(x^4)^3-(x^1)^{10})-10(x^1)^9\sin(x^2),\\ z^2_1&=X(z^2_0)=\sin(x^2),\\ z^2_2&=X(z^2_1)=\cos(x^2)\sin(x^3),\\ z^2_3&=X(z^2_2)=-\sin(x^2)\sin^2(x^3)+((x^4)^3+u^1)\cos(x^2)\cos(x^3).\label{HSM contact coords end} \end{align} Thus $t$, $z^1_0=x^5$, $z^2_0=x^4$, and (\ref{HSM contact coords start})-(\ref{HSM contact coords end}) define a static feedback transformation of $\mathcal{V}$ to the Brunovsk\'y normal form $\beta^{\langle 0,1,1\rangle}$. Next, we will present an example in which Procedure A must be applied. \begin{ex} Consider the following control system that arises from selecting $c_1=e_3=a_0=a_1=b_0=1,\,b_3=-1$, and all other constants equal to zero in Example \ref{Sluis}. \begin{align*} \dot{x}^1&=x^1+u^1(1+x^1),\\ \dot{x}^2&=x^3+u^2(1-x^3),\\ \dot{x}^3&=u^1,\\ \dot{x}^4&=u^2. \end{align*} The control system as a distribution is $\mcal{V}=\{X,\partial_{u^1},\partial_{u^2}\}$, where \begin{equation} X=\partial_t+(x^1+u^1(1+x^1))\partial_{x^1}+(x^3+u^2(1-x^3))\partial_{x^2}+u^1\partial_{x^3}+u^2\partial_{x^4}. \end{equation} The distribution $\mcal{V}$ is a Goursat bundle with type $\kappa=\langle 0,2 \rangle$, and we will find contact coordinates by applying Procedure A. \end{ex} \textbf{Step 1:} First we calculate the derived flag, and then the filtration (\ref{filt res}), stopping short of the resolvent bundle. Using MAPLE, we find that the derived flag is given by \begin{align*} \der{V}{1}&=\mcal{V}+\{(1+x^1)\partial_{x^1}+\partial_{x^3},(1-x^3)\partial_{x^2}+\partial_{x^4}\},\\ \der{V}{2}&=\der{V}{1}+\{\partial_{x^1}+(1-u^2)\partial_{x^2},u^1\partial_{x^2}\}\\ \,&=TM. \end{align*} Using MAPLE to compute Cauchy bundles, we find \begin{equation} \inCharOne{V}=\{\partial_{u^1},\partial_{u^2}\}=\Char{V}{1}=\{\partial_{u^1},\partial_{u^2}\}\subset\mcal{R}_{\bar{\Sigma}}(\der{V}{1}). \end{equation} \tab\textbf{Step 2:} Next we calculate the resolvent bundle $\mcal{R}_{\bar{\Sigma}}(\der{V}{1})$. First, we need to compute the quotient $\der{V}{1}/\Char{V}{1}=\bar{\mcal{V}}^{(1)}$. Doing so gives \begin{equation} \bar{\mcal{V}}^{(1)}=\{X,Y_1=(1+x^1)\partial_{x^1}+\partial_{x^3},Y_2=(1-x^3)\partial_{x^2}+\partial_{x^4}\}. \end{equation} Now let $E=[a_0X+a_1Y_1+a_2Y_2]\in \mathbb{P}\bar{\mcal{V}}^{(1)}$ and let \begin{equation} \overline{TM}=\{X,Y_1,Y_2,Y_3=\partial_{x^1}+(1-u^2)\partial_{x^2},Y_4=u^1\partial_{x^2}\}, \end{equation} so that $\overline{TM}/\bar{\mcal{V}}^{(1)}=\{Y_3,Y_4\}$. Note that $Y_1=[\partial_{u^1},X], Y_2=[\partial_{u^2},X], Y_3=[Y_1,X]$, and $Y_4=[Y_2,X]$. Now we can compute the polar matrix of $E$ (see Definition \ref{singular polar}), \begin{equation} \sigma(E)= \begin{bmatrix} a_1& -a_0 & 0\\ a_2& a_2/u^1 & -a_0-a_1/u^1 \end{bmatrix}. \end{equation} The polar matrix has less than generic rank when $a_0=-a_1/u^1$. This means that the singular bundle is given by \begin{equation} \bar{\mcal{B}}=\{X-u^1Y_1,Y_2\}\subset\mathbb{P}\bar{\mcal{V}}^{(1)}, \end{equation} and therefore the resolvent bundle is \begin{equation} \mcal{R}_{\bar{\Sigma}}(\mcal{V}^{(1)})=\{X-u^1Y_1,Y_2,\partial_{u^1},\partial_{u^2}\}. \end{equation} Notice that the resolvent bundle is integrable.\\ \tab\textbf{Steps 3 and 4:} We see that there are no nontrivial quotient bundles $\coder{\Xi}{i}_{i-1}/\coder{\Xi}{i}$, and hence no fundamental functions of order less than $2$.\\ \tab\textbf{Step 5:} Now we compute the first integrals of the resolvent bundle. By use of MAPLE, we find the first integrals to be \begin{equation} F:=\{x=x^3,z^1_0=x^1e^{-t},z^2_0=(x^4-t)x^3+x^2-x^4\}. \end{equation} \tab\textbf{Step 6:} Let $Z=\frac{1}{u^1}X$, so that $Z(x)=1$. Then we can construct the remaining contact coordinates as \begin{align} z^1_1&=Z(z^1_0)=e^{-t}(1+x^1),\\ z^1_2&=Z(z^1_1)=e^{-t}\left(1+x^1-\frac{1}{u^1}\right),\\ z^2_1&=Z(z^2_0)=x^4-t,\\ z^2_2&=Z(z^2_1)=u^2-\frac{1}{u^1}. \end{align} Thus we have found local contact coordinates for this Goursat bundle $\mcal{V}$.\\ \tab Notice that although we have found contact coordinates that put the Goursat bundle into normal form, it is \textit{not} via an ESFT. Indeed, this is not possible since $dt\not\in\Upsilon_{\bar{\Sigma}}(\der{V}{1})$, and therefore the time coordinate cannot be singled out as the parameter for integral curves to $\mcal{V}$ in Brunovsk\'y normal form. However, as mentioned in Section 3 of Chapter 1, this example can be prolonged twice to an ESFL system. The author has observed this property in a few other examples of control systems and conjectures the following: \begin{conj} If a control system with at least 2 controls is a Goursat bundle, but cannot be transformed to Brunovsk\'y normal form via an ESFT, then there exists a DF linearization of the control system. \end{conj} \subsection{Background on the Euler Operator} In Chapter 4, we will introduce an operator known as a \textit{truncated} Euler operator, which will be used to establish the main results of this thesis. In this section, we will introduce some basic properties of the Euler operator from the theory of the calculus of variations. There is a vast literature on the calculus of variations, and much of the theory goes beyond our needs in this thesis. We primarily consider the geometric approach taken in \cite{OlverLieBook} and to some extent \cite{VarBi}. Furthermore, we will restrict ourselves to real valued functions of a single real variable, but we mention that generalizations are straightforward and can be found in any of the works referenced in this section. The motivating problem in the calculus of variations is given by the following: Let $L:\mathbb{R}\to\mathbb{R}$ be a smooth function and $A=(a,c)$ and $B=(b,d)$ be two fixed points in the plane. Then for what functions $u(t)$ whose graphs connect $A$ and $B$ does the integral, \begin{equation}\label{lagrangian functional} \sL[u]=\int_a^bL(t,u(t),\dot{u}(t),\ldots,u^{(n)}(t))\,dt, \end{equation} attain a minimum or maximum? In the physics literature, $\sL$ is a functional associated to some physical system, and asking that there be a smooth function $u(t)$ that minimizes this functional is to say the physical system possesses a \textit{principle of least action}. \begin{defn} A function $u(t)$ is an \textbf{extremal} of $\sL$ if $\sL[u]$ is a local maximum or local minimum on a space of functions with a given topology containing $u(t)$. \end{defn} Typically, the function space in question is some type of Banach space, and there are many considerations from functional analysis one has to check to ensure that extremals exist. We start with an analogy to optimization of real valued functions. We will compute a type of derivative of the functional and subsequently check if any associated critical points give rise to optimal solutions. The precise arguments needed to make this idea rigorous will not be presented here, but can be found in any introductory text on the calculus of variations such as \cite{VarCalc}. The derivative we will calculate is called a variational derivative. \begin{defn} The \textit{variational derivative} $\delta\sL[u]$ is defined by the condition that \begin{equation} \frac{d}{d\epsilon}\Big|_{\epsilon=0}\sL[u+\epsilon v]=\int_a^b\delta\sL[u]\,v(t)\,dt \end{equation} for any smooth function $v(t)$ such that $v(a)=v(b)=0$. \end{defn} Analogously with optimization of functions of real variables, we have the following proposition. \begin{prop} If $u(t)$ is an extremal for $\sL[u]=\int_a^bL(t,u,\dot{u},\ldots,u^{(n)})\,dt$, then \begin{equation} \delta\sL[u(t)]=0 \end{equation} for all $t\in[a,b]$. \end{prop} A simple example is that of the arc length functional \begin{equation} \int_a^b\sqrt{1+\dot{u}^2}\,dt, \end{equation} which returns the length of the graph of the function $u(t)$ connecting two fixed points $A=(a,u(a))$ and $B=(b,u(b))$. Indeed, the idea of a variational derivative is to ``perturb'' the curve $u(t)$ by $\epsilon v(t)$ for any smooth function $v(t)$ such that $v(a)=v(b)=0$, and some small $\epsilon$. First we compute the derivative of $\sL[u+\epsilon v]$ with respect to $\epsilon$ and evaluate at $\epsilon=0$. Doing so, we obtain \begin{equation} \frac{d}{d\epsilon}\Big|_{\epsilon=0}\sL[u+\epsilon v]=\int_a^b \frac{\dot{v}\dot{u}}{\sqrt{1+\dot{u}^2}}\,dt, \end{equation} so that upon performing integration by parts, we arrive at \begin{equation} \frac{d}{d\epsilon}\Big|_{\epsilon=0}\sL[u+\epsilon v]=-\int_a^b \frac{\ddot{u}}{(1+\dot{u}^2)^{3/2}}\,v(t)\,dt, \end{equation} and hence the variational derivative is $\delta\sL[u]=-\frac{\ddot{u}}{(1+\dot{u}^2)^{3/2}}$. The only way for a function $u(t)$ to be an extremal is if the graph of $u(t)$ is the line segment connecting the two points $A$ and $B$. We now repeat this process for the more general case of (\ref{lagrangian functional}). Doing so, we obtain \begin{equation}\label{derivation of EO} \begin{aligned} \frac{d}{d\epsilon}\Big|_{\epsilon=0}\sL[u+\epsilon v]&=\int_a^b \sum_{i=0}^nv^{(i)}\partiald{L}{u^{(i)}}\,dt\\ \,&=\int_a^b\left(\sum_{i=0}^n (-1)^i\frac{d^i}{dt^i}\partiald{L}{u^{(i)}}\right)v(t)\,dt, \end{aligned} \end{equation} where $v(t)$ is any smooth function that forces all boundary terms in the repeated integration by parts to vanish. Here, $\frac{d}{dt}$ is the total derivative in the multivariable calculus sense. The variational derivative is therefore \begin{equation} \delta\sL[L]=\sum_{i=0}^n (-1)^i\frac{d^i}{dt^i}\partiald{L}{u^{(i)}}. \end{equation} It turns out that we can use the language of jets to describe the the variational derivative in a more geometric way. We will not go too deeply into this subject here; however, \cite{VarBi} is an excellent reference for a modern geometric formulation of the calculus of variations. \begin{defn} Given a function $L:J^n(\mathbb{R},\mathbb{R})\to \mathbb{R}$, we call the functional \begin{equation} \sL[u]=\int_a^bL(t,z_0,z_1,\ldots,z_n)\,dt \end{equation} a \textbf{cost functional} or \textbf{action} and the function $L$ a \textbf{Lagrangian}. Here, \end{defn} \begin{defn} The operator defined by \begin{equation} D_t=\partiald{\,}{t}+\sum_{i=0}^\infty z_{i+1}\partiald{\,}{z_i} \end{equation} is the \textbf{total derivative operator}, and may be considered as a map from $J^n(\mathbb{R},\mathbb{R})$ to $J^{n+1}(\mathbb{R},\mathbb{R})$ for all $n\geq0$. \end{defn} Properly, the total derivative operator is a vector field on an infinite jet bundle. We will not go through the details here; however, we want to emphasize that the action of the total derivative operator on a function $f\in C^\infty\left( J^n(\mathbb{R},\mathbb{R})\right)$, for some non-negative integer $n$, produces no issues of convergence since the function $f$ will have no dependence on jet variables with order greater than $n$. When the total derivative operator is applied to $L$, we find that $D_t(L)\circ (j^{n+1}f(t))$ agrees with $\frac{d}{dt}\left(L(j^n_tf)\right)$. The variational derivative can also be written in terms of jet coordinates, and we give it a special name. \begin{defn} The variational derivative of a functional with Lagrangian $L$ is obtained by applying an operator to $L$ called the \textbf{Euler operator}. It is given by \begin{equation} E(L)=\sum_{i=0}^\infty(-1)^iD^i_t\left(\partiald{L}{z_i}\right). \end{equation} If $L$ is a function on $J^n(\mathbb{R},\mathbb{R})$, then $E(L)$ defines a function on $J^{2n}(\mathbb{R},\mathbb{R})$. When $E(L)$ is restricted to the $2n$-jet of some function $f:\mathbb{R}\to\mathbb{R}$, then the equation \begin{equation} E(L)\circ j^{2n}f(t)=0 \end{equation}defines an order $2n$ ODE known as the \textbf{Euler-Lagrange equation}. \end{defn} Although variational questions are of deep interest, we will be primarily concerned with properties of the total derivative operator and the Euler operator. In Chapter 4 we will introduce $\textit{truncated}$ versions of these operators, and it important to understand how they differ from each other. \begin{prop}\label{tot kernel const} The total derivative operator of a function $f$ on some connected subset of $J^n(\mathbb{R},\mathbb{R})$ is zero if and only if $f$ is constant. \end{prop} \begin{proof} Let $f\in C^\infty(J^n(\mathbb{R},\mathbb{R}))$. Then \begin{equation} D_tf=\partiald{f}{t}+z_1\partiald{f}{z_0}+\cdots+z_{n+1}\partiald{f}{z_n}. \end{equation} If $f$ is constant, then $D_tf=0$ immediately. Thus, assume that $D_tf=0$. Indeed, this means that \begin{equation}\label{Dt const} z_{n+1}\partiald{f}{z_n}=-\left(\partiald{f}{t}+z_1\partiald{f}{z_0}+\cdots+z_n\partiald{f}{z_{n-1}}\right). \end{equation} Since $f$ has no dependence on $z_{n+1}$, the right hand side of (\ref{Dt const}) has no dependence on $z_{n+1}$, so we must have $\partiald{f}{z_n}=0$. This means that $f\in C^\infty(J^{n-1}(\mathbb{R},\mathbb{R}))$. We can then iterate this argument to conclude that $\partiald{f}{z_i}=0$ for all $0\leq i\leq n$. On the final iteration we can then conclude that $\partiald{f}{t}=0$ as well. Therefore, $f$ must be a constant. \end{proof} \begin{thm} Let $E$ be the Euler operator. Then \begin{equation} \ker E=\{f : f=D_t\,g,\,\,\mathrm{where}\,\,g\in C^\infty(J^n(\mathbb{R},\mathbb{R}))\,\,\mathrm{for}\,\mathrm{any}\,\,n\geq0\}. \end{equation} \end{thm} We will not prove this theorem; however, a proof may be found in Chapter 4, Section 1 of \cite{OlverLieBook}. Importantly, this means that two different Lagrangians may have the same Euler-Lagrange equations. Indeed, two Lagrangians \begin{equation} \sL[u]=\int_a^bL(t,z_0,\ldots,z_n)\,dt \end{equation} and \begin{equation} \tilde{\sL}[u]=\int_a^b\tilde{L}(t,z_0,\ldots,z_n)\,dt \end{equation} have the same Euler-Lagrange equation if and only if $\tilde{L}(t,z_0,\ldots,z_n)=L(t,z_0,\ldots,z_n)+D_tf$ for some smooth function $f$ on $J^n(\mathbb{R},\mathbb{R})$, since $E(L)=E(\tilde{L})$. \section{Invariant Control Systems and Reconstruction \label{chap:three}} In this chapter we will explore certain phenomena of control systems that admit particular kinds of symmetries. In particular, we will be interested in studying quotient control systems that arise from a control system's ``special" symmetries. We can use solutions for the quotient control system to construct individual trajectories to the original control system by essentially solving an ODE that arises from the group action. We are particularly interested in the case that the associated quotient control system is ESFL. \subsection{Exterior Differential Systems with Symmetry} In this section we discuss some important results concerning EDS with symmetry. The material in this section is primarily from \cite{AndersonFelsBacklund} and \cite{AndersonFelsGroupInvSol}. Recall from Definition \ref{EDS symmetry} that a vector field $X$ is an infinitesimal symmetry of an EDS on a manifold $M$ if the Lie derivative with respect to $X$ of any form in $\mathcal{I}$ is in $\mathcal{I}$. It is possible that an EDS has no nontrivial symmetries whatsoever, and this will usually be the case. However, control systems that arise from application will usually have plenty of symmetries because of some underlying physics. So in terms of applications, studying control systems with symmetry can be quite enlightening. It is also possible that an EDS has enough symmetries such that the associated group of symmetries $G$ for the EDS has the general structure of a Lie pseudogroup, as in Definition \ref{pseudo def}. We will always restrict our attention to finite dimensional \textit{subgroups} of symmetries. In particular, we will choose subgroups of small enough dimension so that the subgroup in question has strictly smaller dimension than the dimension of the manifold $\bX(M)$. The reason for this restriction will become clear in our subsequent discussion. Our first goal is to recognize when a linear Pfaffian system $\mathcal{I}$ on a manifold $M$ with a finite-dimensional group of symmetries $G$ has the property that on the quotient manifold $M/G$, the forms in $\mathcal{I}$ descend to another linear Pfaffian system $\mathcal{I}/G$, called the \textit{quotient system}. \begin{defn}\cite{AndersonFelsGroupInvSol} Let $\mcal{I}$ be an EDS with symmetry group $G$. The \textbf{quotient system} or \textbf{reduced system} of $\mcal{I}$ is defined as \begin{equation} \mathcal{I}/G=\{\theta\in\Omega(M/G): \pi^*\theta\in\mathcal{I}\}, \end{equation} where $\pi:M\to M/G$ is the orbit projection map. \end{defn} We are specifically interested in the case that the quotient of a Pfaffian system is again a Pfaffian system. To that end, we need the following definition. \begin{defn}\cite{AndersonFelsGroupInvSol} Let $\Gamma$ be a Lie algebra of infinitesimal symmetries of a Pfaffian system $\mathcal{I}=\langle I\rangle$. Then we say that $\Gamma$ is \textbf{transverse} to $\mathcal{I}$ if $\Gamma\cap\mathrm{ann}\,\,I=\{0\}$. We say that the symmetries are \textbf{strongly transverse} if $\Gamma\cap\mathrm{ann}\,\,I^{(1)}=\{0\}$. \end{defn} \begin{thm}\cite{AndersonFelsGroupInvSol} Let $M$ be a manifold and consider a Pfaffian system $\mathcal{I}$ on $M$ with finite dimensional Lie group of symmetries $G$ such that $\dim{G}<\dim{M}$. Furthermore, assume that the Lie algebra of infinitesimal symmetries $\Gamma$ for the action of $G$ on $M$ is strongly transverse to $\mathcal{I}$. Then the quotient system $\mcal{I}/G$ is also a Pfaffian system. \end{thm} \begin{ex}\label{Quotient Example} Consider the following 5 state and 2 control Pfaffian system, \begin{align} \omega=\langle \theta^1,\theta^2,\theta^3,\theta^4,\theta^5\rangle \end{align} with \begin{align} \theta^1&= dx^1-((x^2)^2+x^1f(t,x^3,x^4,x^5,u^2))\,dt,\\ \theta^2&=dx^2-x^2f(t,x^3,x^4,x^5,u^2)\,dt,\\ \theta^{i+2}&=dx^{i+2}-g^i(t,x^3,x^4,x^5,u^2)\left(x^2e^{-u^1}\right)^{a_i}\,dt\,\,\mathrm{ for }\,\,1\leq i\leq 3, \end{align} where $a_i$ are constants not all zero. Then the Lie algebra \begin{equation}\label{affine alg} \Gamma=\{x^2\partial_{x^1},2x^1\partial_{x^1}+x^2\partial_{x^2}+\partial_{u^1}\} \end{equation} of infinitesimal symmetries of $\omega$ is strongly transverse to $\omega$ (for generic functions $f$ and $g^i$), and hence the quotient system is a Pfaffian system as well. \end{ex} It is reasonably direct to check that $\Gamma$ forms a Lie algebra of infinitesimal symmetries for $\omega$. Denote the generating vector fields of \ref{affine alg} as $X_1$ and $X_2$ respectively. Then \begin{align} \mathcal{L}_{X^1}\theta^1&=dx^2-x^2f(t,x^3,x^4,x^5,u^2)\,dt=\theta^2,\\ \mathcal{L}_{X^2}\theta^1&=2dx^1-2((x^2)^2+x^1f(t,x^3,x^4,x^5,u^2))\,dt=2\theta^1,\\ \mathcal{L}_{X^1}\theta^2&=0,\\ \mathcal{L}_{X^2}\theta^2&=dx^2-x^2f(t,x^3,x^4,x^5,u^2)\,dt=\theta^2,\\ \mathcal{L}_{X^i}\theta^{j+2}&=0\text{ for }i=1,2,\text{ and }j=1,2,3, \end{align} the right hand sides of which all clearly belong to $\omega$. Next we need to check that the symmetries are strongly transverse to $\omega$. Let $\mathcal{V}=\mathrm{ann}\,\omega$, $A^i=g^i(t,x^3,x^4,x^5,u^2)\left(x^2e^{-u^1}\right)^{a_i}$, and notice that \begin{multline} \mathcal{V}=\{\partial_t+((x^2)^2+x^1f(t,x^3,x^4,x^5,u^2))\partial_{x^1}+x^2f(t,x^3,x^4,x^5,u^2)\partial_{x^2}\\ +A^3\partial_{x^3}+A^4\partial_{x^4}+A^5\partial_{x^5},\partial_{u^1},\partial_{u^2}\}. \end{multline} Next we compute the derived system of $\mathcal{V}$: \begin{equation} \mathcal{V}^{(1)}=\mathcal{V}+\{A^3_{u^1}\partial_{x^3}+A^4_{u^1}\partial_{x^4}+A^5_{u^1}\partial_{x^5},\,x^1f_{u^2}\partial_{x^1}+x^2f_{u^2}\partial_{x^2}+A^3_{u^2}\partial_{x^3}+A^4_{u^2}\partial_{x^4}+A^5_{u^2}\partial_{x^5}\}. \end{equation} So for sufficiently generic functions $g^1,g^2,$ and $g^3$, we can see that $\Gamma$ is strongly transverse to $\omega$. If $G$ is the 2-dimensional Lie group whose action on $M$ is defined by the flows of $\Gamma$, then $\omega/G$ on $M/G$ will be a Pfaffian system. Local coordinates on $M/G$ can be defined in terms of the invariant functions of $\Gamma$. Indeed, \begin{equation} \mathrm{Inv}\,\Gamma=\left\{t, y^1=x^3, y^2=x^4, y^3=x^5, v^1=u^2,v^2=x^2e^{-u^1}\right\} \end{equation} and hence they may also be chosen to represent local coordinates on the quotient manifold $M/G$. In these coordinates on $M/G$ we find that \begin{equation}\label{quotient h} \omega/G=\langle dy^1-h^1(v^2)^{a_1}\,dt, dy^2-h^2(v^2)^{a_2}\,dt, dy^3-h^3(v^2)^{a_3}\,dt\rangle, \end{equation} where $h^i=h^i(t,y^1,y^2,y^3,v^1)$, so that $\pi^*h^i=g^{i}$. Not only is $\omega/G$ a Pfaffian system, but it is also representative of a control system on $M/G$ with 3 states and 2 controls. For this example, one can pick the $a^i$ and $h^i$ to make $\omega/G$ fit into nearly any of the normal forms presented in \cite{Wilkens3s2cEquiv} (the only exceptions are normal form III of Theorem 2 and possibly the classes determined by case IV of Theorems 2 and case III of Theorem 1). Example \ref{Quotient Example} has, or can be made to have, other nice properties which we explore in the forthcoming sections of this chapter. \subsection{Control Admissible Symmetry Groups} Given a control system that can be represented by a completely nonintegrable distribution or Pfaffian system on a manifold $M$, there may be many different kinds of symmetry groups. However, we are interested in a particular class of symmetries that are specific to the study of control systems. We want to make sure that any action by a control system's symmetries will not mix up time, state variables, and control variables in any way inappropriate for control theory purposes. To be precise, we present the following definition. \begin{defn}\cite{VassiliouSICON} Let $M\cong_{loc}\mathbb{R}\times\bX(M)\times\bU(M)$, $\omega$ a Pfaffian system representing a control system, and let $\mu:G\times M\to M$ be a Lie transformation group with Lie algebra $\Gamma$ that has the following properties: \begin{enumerate}\label{control symmetries} \item $\Gamma$ is a Lie algebra of infinitesimal symmetries of $\omega$, \item the action of $G$ on $M$ is free and regular, \item $\mu^*_gt=t$, for all $g\in G$, where $\mu_g(x)=\mu(g,x)$, \item if $\pi:M\to\mathbb{R}\times\bX(M)$ is the projection map, then $\mathrm{rank}\,\left({d\pi(\Gamma)}\right)=\dim(G)$. \end{enumerate} We say that such a group $G$ is a \textbf{control admissible symmetry group}. We may abuse this language somewhat by using the word ``symmetries'' to reference either a control admissible symmetry group or its infinitesimal generators. \end{defn} In particular, items (3) and (4) of Definition \ref{control symmetries} force elements of $G$ to act as ESFTs. It turns out that we have already encountered an example of such a symmetry group. \begin{ex}\label{quotient action} The symmetry group $G$ generated by $\Gamma=\{x^2\partial_{x_1},2x^1\partial_{x^1}+x^2\partial_{x^2}+\partial_{u^1}\}$ for the control system $\omega$ in Example \ref{Quotient Example} is an example of a control admissible symmetry group. \end{ex} Let $(\epsilon_1,\epsilon_2)$ be local coordinates on the Lie group associated to $\Gamma$. To compute the group action from $\Gamma$, we simply find the flows of each generator in $\Gamma$ on $M$. These flows are \begin{align} \Phi^1_{\epsilon_1}(t,\bx,\bu)&=(t, x^1+\epsilon_1x^2,x^2,x^3,x^4,x^5,u^1,u^2),\\ \Phi^2_{\epsilon_2}(t,\bx,\bu)&=(t,x^1e^{2\epsilon_2}, x^2e^{\epsilon_2}, x^3,x^4,x^5,u^1+\epsilon_2,u_2), \end{align} so that the action may be written as the composition \begin{align} \mu((\epsilon_1,\epsilon_2),(t,\bx,\bu))&=\Phi^1_{\epsilon_1}\circ\Phi^2_{\epsilon_2}(t,\bx,\bu)\\ \,&=(t,x^1e^{2\epsilon_2}+x^2\epsilon_1e^{\epsilon_2},x^2e^{\epsilon_2},x^3,x^4,x^5,u^1+\epsilon_2,u^2). \end{align} This action has exactly the form of an ESFT for any $\epsilon_1$ and $\epsilon_2$. Thus, the action by any element $g\in G$ on $M$ is by an ESFT. Furthermore, the control admissible symmetry group $G$ is diffeomorphic to $\text{Aff}(\mathbb{R})$, since the 2D Lie algebra $\Gamma$ is not abelian. We remark that this group $G$ may not be the entire (possibly pseudo-) group of control admissible symmetries for $\omega$. A class of examples of such systems are those that are ESFL, since they will necessarily be invariant under the pseudogroup of contact transformations of their equivalent Brunovsk\'y normal form. Interestingly, there is at least one control system that is provably \textit{not} ESFL and has an infinite dimensional control admissible symmetry group. Consider the control system in 7 states and 3 controls which is given as Example 2 in \cite{BC3control}. \begin{ex}\label{BC system} The Battilotti-Califano (BC) system is the 7 state, 3 control, Pfaffian system generated by the forms \begin{align} \,&\theta^1=dx^1-u^1\,dt,\,&\theta^2=dx^2-x^1\,dt,\,&\,\phantom{==}&\theta^3=dx^3-(x^2+x^6+x^2u^1)\,dt&\,,\\ \,&\theta^4=dx^4-(u^2+x^1u^3)\,dt,\,&\theta^5=dx^5-x^4\,dt,\,&\,\phantom{==}&\theta^6=dx^6-(x^5+x^2x^4)\,dt&\,,\\ \,&\theta^7=dx^7-u^3\,dt.\,&\,&\,&\,&\, \end{align} The control admissible symmetry group of the BC system is generated by the infinitesimal symmetries $\Gamma=\{X_1,X_2,X_3\}$, where \begin{align} X_1=&\frac{t^2}{2}\partial_{x^3}+\partial_{x^5}+t\partial_{x^6}+F\partial_{x^7}-x^1K\partial_{u^2}-K\partial_{u^3},\\ X_2=&t\partial_{x^3}+\partial_{x^6}+F\partial_{x^7}-x^1K\partial_{u^2}-K\partial_{u^3},\\ X_3=&\partial_{x^3}+F\partial_{x^7}-x^1K\partial_{u^2}-K\partial_{u^3}, \end{align} and \begin{equation} K=(x^2+x^2u^1+x^6)F_3+(u^3x^1+u^2)F_4+(x^2x^4+x^5)F_6+u^1F_1+x^1F_2+x^4F_5+u^3F_7+F_t) \end{equation} with $F$ any real-valued smooth function on $M$ that has no dependence on the controls, $F_i=\partiald{F}{x^i}$, and $F_t=\partiald{F}{t}$. \end{ex} Thus we see that the BC system has an infinite dimensional control admissible symmetry group due to the dependence on $F$. Furthermore, using procedure \textbf{contact} in Maple, we find that the refined derived type of the BC system is [[4,0],[7,3,4],[9,5,5],[11,11]], which does not agree with the refined derived type of a Goursat bundle presented in Proposition \ref{refined derived type numbers}. Hence the BC system is not ESFL. The following theorem is an important result that guarantees that the quotient of a Pfaffian system by a control admissible symmetry group is again representative of a control system. \begin{thm}\cite{VassiliouSICON} Let $G$ be a control admissible symmetry group of a control system $\omega$ on a manifold $M$ such that $G$ is strongly transverse to $\omega$ and $\dim(G)<\dim\bX(M)$. Then the quotient system $\omega/G$ is a control system on $M/G$ and has the same number of controls as $\omega$. \end{thm} One can easily verify that Example \ref{Quotient Example} has the property that its quotient system is again a control system. It is also true that there are subgroups of the infinite dimensional control symmetry group of the BC system that are strongly transverse to the BC system. Indeed, choose $H$ to be the subgroup of control admissible symmetries of the BC system are generated by \begin{equation}\label{BC sym} \Gamma_H=\left\{\frac{t^2}{2}\partial_{x^3}+\partial_{x^5}+t\partial_{x^6}+\partial_{x^7},t\partial_{x^3}+\partial_{x^6}+\partial_{x^7},\partial_{x^3}+\partial_{x^7}\right\}, \end{equation} which arises from choosing $F=1$. The annihilator of $\omega^{BC}$ is given by \begin{equation} \mathcal{W}=\{X,\partial_{u^1},\partial_{u^2},\partial_{u^3}\}, \end{equation} where \begin{multline} X=\partial_t+u^1\partial_{x^1}+x^1\partial_{x^2}+(x^2+x^2u^1+x^6)\partial_{x^3}+(x^1u^3+u^2)\partial_{x^4}+x^4\partial_{x^5}\\ +(x^2x^4+x^5)\partial_{x^6}+u^3\partial_{x^7}. \end{multline} Thus, \begin{equation} \mathcal{W}^{(1)}=\mathcal{W}+\{\partial_{x^1}+x^2\partial_{x^3},\,\partial_{x^4},\,x^1\partial_{x^4}+\partial_{x^7}\}, \end{equation} and one can now see that $\Gamma_H$ is strongly transverse to $\omega^{BC}$. Hence $\omega^{BC}/H$ is a control system of 4 states and 3 controls. We see also that the ESFTs generated by $\Gamma_H$ are \begin{multline}\label{BC Flow} \Phi^{BC}_{\epsilon_1,\epsilon_2,\epsilon_3}(t,\bx,\bu)=(t,x^1,x^2,\frac{t^2}{2}\epsilon_1+t\epsilon_2+\epsilon_3+x_3,x^4,\epsilon_1+x^5,t\epsilon_1+\epsilon_2+x^6,\\ \epsilon_1+\epsilon_2+\epsilon_3+x^7,u^1,u^2,u^3). \end{multline} Interestingly, these maps are necessarily ESFTs, as opposed to SFTs, despite the fact that the original system is autonomous. \subsection{ESFL Quotient Systems} In general, we have seen that we can find reductions of control systems and obtain control systems again provided that the group action belongs to the Lie psuedogroup of ESFTs. The resulting control systems in Example \ref{Quotient Example} are of 3 states and 2 controls and can therefore be classified according to \cite{Wilkens3s2cEquiv}. However, we need not restrict ourselves to control systems whose quotients will fit into a broad classification scheme (as in general, there are presently none for higher numbers of states and controls). There is, however, a nice class of control systems that were introduced in Chapter 1 that are generated by Brunovsk\'y/contact differential forms as discussed in Chapter 2. Given a control system $\omega$ with control admissible symmetry group $G$, one may wonder when the resulting control system $\omega/G$ is ESFL. This is the content of \cite{VassiliouSICON}, and we will state some of those key results here. \begin{defn}\cite{VassiliouSICON} A \textbf{relative Goursat bundle} $\mathcal{V}\subset TM$ is a distribution of derived length $k>1$ that has the following properties: \begin{enumerate} \item the type numbers satisfy the same relations as those listed in Proposition \ref{refined derived type numbers}, \item the $\inChar{V}{i}$ are all integrable, \item if $\Delta_k>1$, then $\mathcal{V}^{(k-1)}$ determines an integrable Weber structure whose resolvent bundle is of rank $\Delta_k+\chi^{k-1}$. \end{enumerate} \end{defn} Note that a relative Goursat bundle may have a non-trivial Cauchy bundle. Next we state the most important theorem of this section. \begin{thm}\label{ESFL Quotient}\cite{VassiliouSICON} Let $\Gamma$ be the Lie algebra of a strongly transverse, control admissible symmetry group $G$ of a control system $\mathcal{V}$. If $\mathrm{Char}(\mathcal{V})=\{0\}$ and $\hat{\mcal{V}}:=\mathcal{V}\oplus\Gamma$ is a relative Goursat bundle, then the quotient system $\omega/G$ is a control system that is locally equivalent to a Brunovsk\'y normal form via a diffeomorphism. Furthermore, one can choose the diffeomorphism to be an ESFT if points (1) and (2) of Theorem \ref{Goursat ESFL} are true for $\hat{\mcal{V}}$. \end{thm} This gives a direct way to check whether a control system $\omega$ with control admissible symmetry group $G$ admits ESFL quotients. \begin{defn} A relative Goursat bundle will be called an \textbf{ESF relative Goursat bundle} if it satisfies the points (1) and (2) of Theorem \ref{Goursat ESFL}. \end{defn} We will once again use the examples that have previously been explored in this chapter. Indeed, let $\omega$ be the control system from Example \ref{Quotient Example} with $f=e^{u^2}$, $g^1=\ln\left(1+(u^2)^2\right)$, $g^2=\sin(x^5)$, $g^3=x^3$, $a_1=5,a_2=0$, and $a_3=1$. The control system is now generated by \begin{align} \theta^1&= dx^1-((x^2)^2+x^1e^{u^2})\,dt,\\ \theta^2&=dx^2-x^2e^{u^2}\,dt,\\ \theta^3&=dx^3-\ln\left(1+(u^2)^2\right)(x^2)^5e^{-5u^1}\,dt,\\ \theta^4&=dx^4-\sin(x^5)\,dt,\\ \theta^5&=dx^5-x^2x^3e^{-u^1}\,dt, \end{align} and has annihilator given by $\mathcal{V}=\{X,\partial_{u^1},\partial_{u^2}\}$, where \begin{multline} X=\partial_t+((x^2)^2+x^1e^{u^2})\partial_{x^1}+x^2e^{u^2}\partial_{x^2}+\ln\left(1+(u^2)^2\right)(x^2)^5e^{-5u^1}\partial_{x^3} +\sin(x^5)\partial_{x^4}\\+x^2x^3e^{-u^1}\partial_{x^5}. \end{multline} Next we need to calculate the refined derived type of $\widehat{\mathcal{V}}=\mathcal{V}\oplus\Gamma$ in order to apply Theorem \ref{ESFL Quotient}. We can once again use procedure \textbf{contact} to determine the refined derived type of $\widehat{\mathcal{V}}$. Doing so, we find \begin{equation} \mathfrak{d}_r(\mathcal{\widehat{V}})=[[5,2],[7,4,5],[8,8]]. \end{equation} We then discover that the associated type numbers are those of a relative Goursat bundle by checking the conditions in Proposition \ref{refined derived type numbers}. Next we check that $\hinCharOne{V}$ is integrable. To do so, we use MAPLE to calculate the derived flag and the associated Cauchy bundles. We find that \begin{equation} \hChar{V}{1}=\{\partial_{x^1},\partial_{x^2},\partial_{x^3},\partial_{u^1},\partial_{u^2}\}, \end{equation} and since $\Gamma\oplus\{\partial_{u^1},\partial_{u^2}\}=\{\partial_{x^1},\partial_{x^2},\partial_{u^1},\partial_{u^2}\}\subset \widehat{\mcal{V}}$, we have \begin{equation} \inCharOne{\widehat{V}}=\Gamma\oplus\{\partial_{u^1},\partial_{u^2}\}. \end{equation} Hence $\hChar{V}{1}_0$ is integrable, and thus $\widehat{\mcal{V}}$ is a relative Goursat bundle. Therefore, by Theorem \ref{ESFL Quotient} we can conclude that $\omega/G$ is a Pfaffian system representing a control system on $M/G$ that is diffeomorphism equivalent to a Brunovsk\'y normal form. Furthermore, the diffeomorphism equivalence is an ESFT since $dt\in\coder{\Xi}{1}$ and $\{\partial_{u^1},\partial_{u^2}\}\subset \hinCharOne{V}$. Of course, one can see this directly by explicitly constructing $\omega/G$ as in equation (\ref{quotient h}), and then checking the refined derived type of $\omega/G$. However, Theorem \ref{ESFL Quotient} provides a much simpler determination when an example presents itself with several control admissible symmetry groups. Thus Theorem \ref{ESFL Quotient} allows us to avoid needless computation--and subsequent ESFL testing of--several different quotient systems. The quotient system for this example is \begin{equation}\label{quotient f1} \omega/G=\{dy^1-(v^2)^5\ln\left(1+(v^1)^2\right)\,dt,dy^2-\sin\left(y^3\right)\,dt, dy^3-y^1v^2\,dt\}. \end{equation} We can explicitly find the ESF linearization of (\ref{quotient f1}) via procedure \textbf{contact} in MAPLE. The ESFT is given by \begin{equation} (t,y^1,y^2,y^3,v^1,v^2)\mapsto (t,z^1_0,z^1_1,z^2_0,z^2_1,z^2_2), \end{equation} where \begin{align} \,&\,&z^2_2&=y^1v^2\cos\left(y^3\right),\\ z^1_1&=(v^2)^5\ln\left(1+(v^1)^2\right),&\,z^2_1&=\sin\left(y^3\right),\\ z^1_0&=y^1,\,&z^2_0&=y^2. \end{align} The BC system also admits an ESFL quotient. Let $\mcal{W}=\ann \omega^{BC}$ and $\Gamma_H$ be as in (\ref{BC sym}). Furthermore, denote $\widehat{\mcal{W}}=\mcal{W}\oplus \Gamma_H$. Using MAPLE to calculate the refined derived type of $\wh{\mcal{W}}$, we find \begin{equation} \mathfrak{d}_r(\widehat{\mcal{W}})=[[7, 3], [10, 6, 8], [11, 11]], \end{equation} which are precisely the type numbers of a relative Goursat bundle. We also find that \begin{equation} \hinCharOne{W}=\{\partial_{u^1},\partial_{u^2},\partial_{u^3}\}\oplus\Gamma_H, \end{equation} and we easily see that $\hinCharOne{W}$ is integrable and is annihilated by $dt$. Hence by Theorem \ref{ESFL Quotient}, we find that $\omega/H$ is ESFL. We will further confirm that $\omega/H$ is ESFL by constructing an explicit ESFT to a Brunovsk\'y normal form. First, the invariant functions of $\Gamma_H$ are \begin{multline} \mathrm{Inv}\,\Gamma_H=\{t, y^1=x^1, y^2=x^2, y^3=\frac{1}{2}((t-1)^2+1)x^5+(t-1)x^6+x^7-x^3,\\ y^4=x^4, v^1=u^1,v^2= u^2, v^3=u^3\}, \end{multline} and they form a local coordinate system for the quotient manifold $M/H$. In these coordinates, the quotient system is given by $\omega/H=\langle \theta^1,\ldots,\theta^4\rangle$, where \begin{align} \theta^1&=dy^1-v^1\,dt,\\ \theta^2&=dy^2-y^1\,dt,\\ \theta^3&=dy^3-\left(\left((t-1)y^2-\frac{1}{2}((t-1)^2+1)\right)y^4-(1+v^1)y^2+v^3\right)\,dt,\\ \theta^4&=dy^4-(y^1v^3+v^2)\,dt. \end{align} The annihilator of $\omega/H$ will be denoted $\mcal{W}/H=\{X_H,\partial_{u^1},\partial_{u^2},\partial_{u^3}\}$, where \begin{multline} X_H=\partial_t+v^1\partial_{y^1}+y^1\partial_{y^2}+\left(\left((t-1)y^2-\frac{1}{2}((t-1)^2+1)\right)y^4-(1+v^1)y^2+v^3\right)\partial_{y^3}\\ +(y^1v^3+v^2)\partial_{y^4}. \end{multline} Checking the refined derived type, we find \begin{equation} \mathfrak{d}_r(\mcal{W}/H)=[[4, 0], [7, 3, 5], [8, 8]], \end{equation} which are the type numbers of the canonical contact system on $J^{\langle 2,1\rangle}$. Since $\rho_2=1$, we construct the filtration (\ref{filt fun}) for $\mcal{W}/H$ and find that \begin{align} \left(\Pi^1\right)^\perp&=\{dt,dy^2\},\\ \coder{\Xi}{1}&=\{dt,dy^1,dy^2\},\\ \coder{\Xi}{1}_0&=\{dt,dy^1,dy^2,dy^3,dy^4\}. \end{align} All these bundles are integrable, and thus we have confirmed that $\mcal{W}/H$ is ESFL. Next, we use procedure contact B to build an ESFT between $\beta^{\langle 2,1\rangle}$ and $\omega/H$. Indeed, the invariants of $\coder{\Xi}{1}_0/\coder{\Xi}{1}=\{dy^3,dy^4\}$ are $y^3$ and $y^4$, while the needed invariant of $\Pi^1$ is $y^2$. Hence, the ESFT is given by \begin{align}\label{BC quotient ESFL} z^1_0&=y^2,&z^2_0&=y^3,&z^3_0&=y^4,\\ z^1_1&=y^1,&z^2_1&=\left((t-1)y^2-\frac{1}{2}((t-1)^2+1)\right)y^4-(1+v^1)y^2+v^3,&z^3_1&=(y^1v^3+v^2),\\ z^1_2&=v^1.&\,&\,&\,&\, \end{align} \subsection{Reconstruction of Integral Manifolds and the Contact Sub-connection} In the previous sections of this chapter we have seen when and how one can perform symmetry reduction of a control system so that the resulting reduced system is again a control system. Now, we want to be able to construct solutions to the original control system using the reduced control system. This is the content of \cite{AndersonFelsEDSwithSymmetry}, \cite{AndersonFelsBacklund}, \cite{AndersonFelsGroupInvSol} for general Pfaffian systems, and \cite{VassiliouCascadeI} when applied to control systems. We'll start with the following definition. \begin{defn}\cite{VassiliouCascadeI} Let $G$ be a Lie group and let $M$ and $M_G$ be manifolds such that $\pi: M\to M_G$ is a right principal $G$-bundle, and let $VM$ be the vertical bundle $\ker \pi_*$. Let $\Pi^G\subset TM_G$ be a subbundle. A constant rank distribution $u\mapsto H_u\subset T_uM$ is called a \textbf{principal sub-connection relative to} $\Pi^G$ if the following are true: \begin{enumerate} \item $H_u\cap V_uM=\{0\}$, \item $d\pi(H_u)=\Pi^G_{\pi(u)}$, \item $(\mu_g)_*H_u=H_{u\cdot g}$, for all $g\in G$, \item $u\mapsto H_u$ is smooth. \end{enumerate} \end{defn} If $\Pi^G=T(M_G)$ then this is the usual definition of a connection on a principal $G$-bundle. We state the following proposition about principal sub-connections. \begin{prop} Let $\pi:M\to M_G$ be a right principal $G$-bundle with principal sub-connection $H$ relative to a subbundle $\Pi^G$ of $TM_G$. If $c:[a,b]\to M_G$ is any integral curve of $\Pi^G$, then for any $u\in \pi^{-1}(c(a))$ there is a unique curve $\tilde{c}: [a,b]\to M$ such that $\tilde{c}(a)=u$ and $\tilde{c}(t)$ is an integral curve of $H$ and $(\pi\circ \tilde{c})(t)=c(t)$. \end{prop} First we present a result which gives conditions for when an integral manifold of an EDS descends to an integral manifold of a quotient system. \begin{prop}\label{int q int}\cite{AndersonFelsEDSwithSymmetry} Let $G$ be a symmetry group of the EDS $\mcal{I}$ whose action is regular and strongly transverse to $\mcal{I}$. If $s:N\to M$ is an integral manifold of $\mcal{I}$, then $\pi\circ s$ is an integral manifold of $\mcal{I}/G$, where $\pi:M\to M/G$ is the quotient map. \end{prop} A more interesting result concerns when one can reverse this process. Given an integral manifold of the quotient EDS can it be used to construct an integral manifold to the original EDS? \begin{thm}\label{lifted solutions}\cite{AndersonFelsEDSwithSymmetry} Let $\mcal{I}$ be an EDS with strongly transverse symmetry group $G$ acting freely and regularly on a manifold $M$ with quotient map $\pi: M\to M/G$, and let $s:N\to M$ be an integral manifold of $\mcal{I}$. Then for every point $s(x_0)\in s(N)$, there exists a $G$-invariant open neighborhood $U$ of $s(x_0)$ and a cross-section $\sigma:U/G\to U$ such that $s(x)=\mu(\epsilon(x), \sigma\circ s_G(x))$ for all $x\in s^{-1}(U)$, where \begin{enumerate} \item $s_G=\pi\circ s$ is an integral manifold of $\mcal{I}/G\big|_{U/G}$, and \item $\epsilon:s^{-1}(U)\to G$, where the graph of $\epsilon$ satisfies a completely integrable Pfaffian system on $s^{-1}(U)\times G$. \end{enumerate} \end{thm} We would like to emphasize that this theorem may be used to construct \textit{any} integral manifold of $\omega$. We will now work through a simple example. We will use Example \ref{Quotient Example}, but for ease of demonstration we now choose $f=e^{u^2},g^1=u^2, g^2=x^5, g^3=1$ and $a_1=a_2=0, a_3=1$. It then follows that the quotient system in Equation (\ref{quotient h}) takes the form \begin{equation} \omega/G=\langle dy^1-v^1\,dt,dy^2-y^3\,dt,dy^3-v^2\,dt\rangle, \end{equation} which is precisely in Brunovsk\'y normal form and has type $\langle 1,1\rangle$. Hence, integral curves are given by \begin{equation} s_G(t)=(t,F_1(t), F_2(t), \dot{F}_2(t), \dot{F}_1(t), \ddot{F}_2(t)), \end{equation} where $F_1$ and $F_2$ are arbitrary smooth functions of $t$. To compute a lifted integral manifold of $\omega$ using $s_G$, we need an appropriate cross-section of $M\to M/G$, and then we will need to find a curve $\epsilon(t)$ in $G$ in order to construct $s(t)$. We may pick $\sigma$ to be the cross section given by \begin{equation} \sigma: (t,y^1,y^2,y^3,v^1,v^2)\mapsto (t,0,1,y^1,y^2,y^3,-\ln(v^2), v^1). \end{equation} Using this cross-section to lift $s_G(t)$ to $M$, we find \begin{equation} (\sigma\circ s_G)(t)=(t,0,1,F_1(t),F_2(t),\dot{F}_2(t),-\ln(\ddot{F}_2(t)), \dot{F}_1(t)). \end{equation} Now we explicitly use the action of $G$ on $M$. Recall that we have already computed the action in Example \ref{quotient action}. Applying this action to $\sigma\circ s_G(t)$ with $\gamma=(\epsilon_1,\epsilon_2)$, we find \begin{equation}\label{pre lie equation} \mu(\epsilon,(t,\bx,\bu))=(t,\epsilon_1e^{\epsilon_2}, e^{\epsilon_2},F_1(t),F_2(t),\dot{F}_2(t),\epsilon_2-\ln(\ddot{F}_2(t)), \dot{F}_1(t)). \end{equation} Since we want (\ref{pre lie equation}) to be an integral manifold of $\omega$, we need to pull back $\omega$ by (\ref{pre lie equation}) to determine the necessary conditions on $\epsilon_1$ and $\epsilon_2$. Doing so gives \begin{equation}\label{lie type} \mu^*_t(\omega)=\langle d\epsilon_1-e^{\epsilon_2+\dot{F}_1(t)}\,dt,d\epsilon_2-e^{\dot{F}_1(t)}\,dt\rangle, \end{equation} where $\mu_t$ denotes (\ref{pre lie equation}). Therefore, in order for $s(t)=\mu_t$ to be an integral manifold for $\omega$, we need the curve $\epsilon: s^{-1}(U)\to G$ to solve the Frobenius system (\ref{lie type}). Putting everything together, we can explicitly write down a formula for an integral manifold of $\omega$ given an integral manifold to $\omega/G$. Indeed, let $I(t)=\int_{t_0}^te^{\dot{F}_1(\tau)}\,d\tau$ and $J(t)=\int_{t_0}^te^{I(\tau)+\dot{F}_1(\tau)}\,d\tau$; then \begin{equation} s(t)=\left(t,J(t)e^{I(t)},e^{I(t)},F_1(t),F_2(t),\dot{F}_2(t),e^{I(t)}-\ln(\ddot{F}_2(t)), \dot{F}_1(t) \right) \end{equation} is an integral curve of $\omega$. The use of several quadratures here is undesirable from a control theory perspective, since one must compute these integrals for each individual trajectory from the quotient manifold. We now present one of the main theorems of \cite{VassiliouCascadeI}, which is essentially an application of Theorem \ref{lifted solutions} in the case that a control system with control admissible symmetry group admits an ESFL quotient system. \begin{figure}[h]\label{reconstruction diagram} \centering \begin{tikzcd} {(M,\omega)} \arrow[dd, "\pi"] \arrow["G"', loop, distance=2em, in=215, out=145] & & {(J^\kappa\times G,\gamma^G)} \arrow[dd, "\pi_0"] \arrow[ll, "\tilde{\varphi}"'] & \\ & & & \\ {(M/G,\omega/G)} & & {(J^\kappa, \beta^\kappa)} \arrow[ll, "\varphi"'] & \mathbb{R} \arrow[l, "c"'] \arrow[luu, "\tilde{c}"'] \end{tikzcd} \caption{Decomposition of integral curves to a non-ESFL control system with control symmetry $G$ and ESFL quotient.} \end{figure} \begin{thm}\label{control reconstruction}\cite{VassiliouCascadeI} Let $(M,\omega)$ be a non-ESFL control system invariant under the Lie group $G$ acting on $M$ freely, regularly, and strongly transversely, via $\mu: G\times M\to M$, and with Lie algebra of infinitesimal symmetries $\Gamma$. Denote $\mcal{V}=\ann \omega$; let $\widehat{\mcal{V}}=\mcal{V}\oplus\Gamma$ be an ESF relative Goursat bundle of type $\kappa$, and let $\varphi$ and $\tilde{\varphi}$ be the principal bundle maps of Figure 3.1, which satisfy $(\varphi^{-1})_*(\mcal{V}/G)=\mcal{C}^\kappa_m$. Then there is a principal sub-connection $\mcal{H}_G$ for $\pi_0:J^\kappa\times G\to J^\kappa$ whose lift $\tilde{c}$ of a contact curve $c:\mathbb{R}\to J^\kappa$ is such that $t\mapsto (\mu\circ \Gamma_\sigma\circ \tilde{c})(t)$ is an integral manifold of $(M,\omega)$. Here $\Gamma_\sigma: J^\kappa\times G\to M\times G$ via $(\bz,g)\mapsto (\sigma\circ \varphi(\bz), g)$ where $\sigma$ is a cross-section of $\pi:M\to M/G$. Furthermore, the principal sub-connection is of the form \begin{equation}\label{contact connection} \mcal{H}_G=\left\{\partial_t+\sum_{i=1}^m\sum_{l_i=0}^{\sigma_i-1}z^i_{l_i+1}\partial_{z^i_{l^i}}+\sum_{a=1}^rp^a(t,\bz)R_a, \partial_{z^i_{\sigma_i}}\right\}, \end{equation} where $\{R_a\}$ spans the right invariant vector fields on $G$. \end{thm} \begin{defn}\label{contact sub-connection def} The principal sub-connection given in (\ref{contact connection}) is called a \textbf{contact sub-connection}. It is a principal sub-connection relative to the subbundle \begin{equation} \Pi^G=\left\{\partial_t+\sum_{i=1}^m\sum_{l_i=0}^{\sigma_i-1}z^i_{l_i+1}\partial_{z^i_{l^i}},\partial_{z^i_{\sigma_i}}\right\}, \end{equation} and may equivalently be written as \begin{equation} \mcal{H}_G=\left\{\partial_t+\sum_{i=1}^m\sum_{l_i=0}^{\sigma_i-1}z^i_{l_i+1}\partial_{z^i_{l^i}}+\sum_{a,b=1}^rp^a(t,\bz)\rho_a^b(\epsilon)\partial_{\epsilon_b}, \partial_{z^i_{\sigma_i}}\right\}, \end{equation} where $R_a=\rho_a^b(\epsilon)\partial_{\epsilon_b}$. As a Pfaffian system, it may also be written as \begin{equation} \gamma^G=\beta^\kappa\oplus \Theta^G, \end{equation} where $\Theta^G=\langle d\epsilon_a-p^b(t,\bz)\rho_b^a(\epsilon)\,dt\rangle$. \end{defn} Theorem \ref{control reconstruction} says that the control system may be ``decomposed" to a Brunovsk\'y normal form plus an underdetermined \textit{equation of Lie type}, that is, an underdetermined ODE arising from the action of a Lie group on a manifold. Although equations of Lie type have very nice properties, as explained in \cite{BryantLieSymplectic}, most of these properties only apply in the case that the associated group has nontrivial isotropy subgroups, i.e. the group does not act freely on $M$. The group actions appearing in this thesis are free and hence much of the larger theory of equations of Lie type does not apply. The only exception to this is the case when the Lie group $G$ is solvable. In this situation we are guaranteed to be able to find solutions with a finite number of integrations, but only for fixed trajectories of the quotient system. Notice that the map $\tilde{\varphi}$ in Theorem \ref{control reconstruction} is given by $\mu\circ \Gamma_\sigma$, and hence $\tilde{\varphi}$ is an ESFT since $\varphi$ is an ESFT and $G$ is an admissible control symmetry group. Before starting an example, we wish to emphasize the difference between Theorem \ref{control reconstruction} and Theorem \ref{lifted solutions}, as well as the importance of the contact sub-connection. Theorem \ref{lifted solutions} should be thought of as a ``decomposition" of an integral manifold to an EDS $\mcal{I}$ via an integral manifold of the quotent system and a Frobenius system induced by both the group action and the integral manifold of the quotient system. In Theorem \ref{control reconstruction}, a normal form for the given control system $\omega$ is given via the contact sub-connection. One may still consider Theorem \ref{control reconstruction} as providing a ``decomposition" of integral manifolds, or in this case, trajectories; however, it is the special structure of the quotient system that allows for an explicit formulation of $\Theta^G$ in coordinates. We now construct the contact connection $\mcal{H}_G$ for the BC system from Example \ref{BC system}. We already have the action of the group $H$ from (\ref{BC Flow}), as well as the projection map $\pi:M\to M/H$ defined by $\mathrm{Inv}\,\Gamma_H$. So we pick a cross-section of the projection map to be \begin{equation} \sigma:(t,y^1,y^2,y^3,y^4,v^1,v^2,v^3)\mapsto (t,y^1,y^2,-y^3,y^4,0,0,0,v^1,v^2,v^3). \end{equation} Now by (\ref{BC quotient ESFL}), we can conclude that integral curves of $\omega/H$ are given by \begin{equation} c(t)=(t,y^1=\dot{F}_1(t),y^2=F_1(t),y^3=F_2(t),y^4=F_3(t),v^1=\ddot{F}_1(t),v^2=A(t),v^3=B(t)), \end{equation} where \begin{align} A(t)&=\dot{F}_3(t)-\dot{F}_1(t)\left(\dot{F}_2(t)+(1+\ddot{F}_1(t))F_1(t)-\left((t-1)F_1(t)-\frac{1}{2}((t-1)^2+1)\right)F_3(t)\right),\\ B(t)&=\dot{F}_2(t)+(1+\ddot{F}_1(t))F_1(t)-\left((t-1)F_1(t)-\frac{1}{2}((t-1)^2+1)\right)F_3(t), \end{align} and $F_1(t), F_2(t),$ and $F_3(t)$ are arbitrary smooth functions. Next we wish to construct the contact connection $\mcal{H}_H$. We will use the dual form of the contact connection, which in this case is given by \begin{equation} \gamma^H:=\beta^\kappa\oplus \Theta^H, \end{equation} where $\Theta^H=\langle d\epsilon^a-p^a(t,\bz)\,dt \rangle$ for $1\leq a\leq 3$. The form of $\Theta^H$ follows from the fact that $H$ is abelian. Hence, we need only determine the functions $p^a(t,\bz)$. In order to find these functions, we use MAPLE to compute $\mu_t^*(\omega^{BC})$, where $\mu_t=(\mu\circ \Gamma_{H,\sigma}\circ \tilde{c})(t)$, and this leads to \begin{align}\label{BC p(t) 1} (p^1(t,\bz)\circ c)(t)&=F_3(t),\\ (p^2(t,\bz)\circ c)(t)&=F_3(t)(F_1(t)-t),\\ (p^3(t,\bz)\circ c)(t)&=B(t)-F_3(t)(F_1(t)-t+1).\label{BC p(t) 2} \end{align} Each of (\ref{BC p(t) 1})-(\ref{BC p(t) 2}) gives the form of one of the $p^a(t,\bz)$. Indeed, \begin{align} p^1(t,\bz)&=z^3_0,\\ p^2(t,\bz)&=z^3_0(z^1_0-t),\\ p^3(t,\bz)&=B(t,\bz)-z^3_0(z^1_0+1-t), \end{align} where \begin{equation} B(t,\bz)=z^3_1+(z^1_2-1)z^1_0-\left((t-1)z^1_0-\frac{1}{2}((t-1)^2+1)\right)z^2_0. \end{equation} Hence the contact connection for the BC system with respect to symmetry group $H$ is \begin{equation} \mcal{H}_H=\{\partial_t+\sum_{i=1}^3\sum_{l_i=0}^{\sigma_i-1}z^i_{l_i+1}\partial_{z^i_{l_i}}+z^3_0\partial_{\epsilon_1}+z^3_0(z^1_0-t)\partial_{\epsilon_2}+\left(B(t,\bz)-z^3_0(z^1_0+1-t)\right)\partial_{\epsilon_3},\partial_{z^i_{\sigma_i}}\}, \end{equation} or the dual form, \begin{equation} \gamma^H=\beta^{\langle 2,1\rangle}\oplus\langle d\epsilon_1-z^3_0\,dt,\,d\epsilon_2-z^3_0(z^1_0-t)\,dt,\,d\epsilon_3-(B(t,\bz)-z^3_0(z^1_0+1-t))\,dt\rangle. \end{equation} In the next chapter, we will introduce another linearization that may arise from the contact sub-connection. In particular, in Chapter 4 we will prove new results on the form of the contact sub-connection $\gamma^G$ that allow one to determine whether $\gamma^G$--and hence $\omega$--is or is not EDFL. \section{Cascade Feedback Linearization and the Truncated Euler Operator\label{chap:four}} \subsection{Overview of Cascade Feedback Linearization} \tab In the previous chapter we learned that a control system $(M,\omega)$ with control admissible symmetries can be put into a normal form adapted to said symmetries. In particular, if there is a quotient system $(M/G,\omega_G)$ that is ESFL, then the original control system is ESFT equivalent to a ``linear" system plus an equation of Lie type. In this chapter we will explore the fourth item in the following definition of Cascade Feedback Linearization: \begin{defn}\label{CFL def} Let $(M,\omega)$ be a control system with control admissible symmetry group $G$. Then we say that $(M,\omega)$ is \textbf{cascade feedback linearizable} (CFL) if: \begin{enumerate} \item The right group action of $G$ on $M$ is such that the orbit space $M/G$ is again a manifold and the associated \textit{quotient system} $\omega_G$ is again a linear Pfaffian system with the same number of controls. \item $(M/G,\omega_G)$ is equivalent to a Brunovsk\'y normal form on the partial prolongation of a jet space $(J^\kappa,\beta^\kappa)$ via an ESFT, where $\beta^\kappa$ is the Pfaffian system of Brunovsk\'y normal forms, i.e. the canonical contact system on $J^\kappa$. \item The original control system $(M,\omega)$ is ESFT equivalent to a normal form $(J^\kappa\times G, \gamma^G)$, where $\gamma^G= \beta^\kappa\oplus\Theta^G$ with $\Theta^G$ a 1-form associated to the action of $G$ on $M$. This may be interpreted as the local trivialization of a principal $G$-bundle over $J^\kappa$ with \textit{contact sub-connection} 1-form $\gamma^G$. \item The restrictions of $(J^\kappa\times G, \gamma^G)$ to a certain family of submanifolds known as \textit{partial contact curves} become ESFT equivalent to a Brunovsk\'y normal form. \end{enumerate} \end{defn} The last item in the definition for a CFL system is possibly the most mysterious, and the main results in the remainder of this thesis concern necessary and sufficient conditions for a control system to have this property. It turns out that, at least in the case $\mathrm{dim}\,G=1$, the last step is related to \textit{truncated} versions of familiar operators from the calculus of variations. These operators and some of their properties are described in Section 4.3 below. \subsection{Partial Contact Curve Reduction} \tab The final requirement for cascade feedback linearization is ESFT equivalence to Brunovsk\'y normal forms when the system on the principal $G$-bundle is restricted to what may be called ``partial integral manifolds" of $\gamma^G$ on $J^\kappa(\mathbb{R},\mathbb{R}^m)\times G$. For $m\geq 2$, we can always rewrite a Brunovsk\'y normal form as $\beta^\kappa=\beta^\nu\oplus\beta^{\nu^\perp}$, where $\kappa=\nu+\nu^\perp$ and $m=m_\nu+m_{\nu^\perp}$, so that $\beta^\nu$ and $\beta^{\nu^\perp}$ are the canonical contact systems on $J^\nu(\mathbb{R},\mathbb{R}^{m_\nu})$ and $J^{\nu^\perp}(\mathbb{R},\mathbb{R}^{m_{\nu^\perp}})$, respectively. \begin{defn} We say that a submanifold $\Sigma^\nu_f\subset J^\kappa\times G$ is a \textbf{codimension $s$ partial contact curve} of $\beta^\kappa=\beta^\nu\oplus\beta^{\nu^\perp}$ if $\Sigma^\nu_f$ is an integral manifold of $\beta^\nu$ and $s$ is the sum of the entries in $\nu^\perp$. It is described by the image of a map $C_f^{\nu}=j^{\nu}f\times Id_{J^{\nu^\perp}}\times Id_G:\mathbb{R}\times J^{\nu^\perp}\times G\to J^\kappa\times G$ for a choice of sufficiently differentiable $f:\mathbb{R}\to\mathbb{R}^{m_\nu}$. In particular, we refer to a system $\gamma^G$ restricted to a family of such submanifolds of the form $\{\Sigma_f^\nu\colon f\in C^\infty(\mathbb{R},\mathbb{R}^{m_\nu})\}$ as a \textbf{partial contact curve reduction} of $\gamma^G$ and denote it by $\bar{\gamma}^G$. \end{defn} One may find it odd that we will be restricting our control system to submanifolds. However, we note that the definition for a partial contact curve leaves open an arbitrary choice for the function $f$. Indeed, restriction to a particular partial contact curve is equivalent to a choice of $m_\nu$ controls and the states determined by that choice. If the resulting system $\bar{\gamma}^G$ is ESFL, then integral curves of $\bar{\gamma}^G$ can be expressed in terms of an arbitrary (up to some mild genericity conditions) function $g:\mathbb{R}\to\mathbb{R}^{m_{\nu^\perp}}$, as well as in terms of the arbitrary choice of partial contact curve (again up to mild genericity conditions to be elaborated on later). Thus no real freedom of choice for the controls is lost by this process, since the choice of a partial contact curve is a choice of $m-s$ controls. We now present an example. We will again use the BC system from Example \ref{BC system}. At the end of Chapter 3, we found the contact sub-connection of the BC system associated to the admissible control symmetry group $H$ whose infinitesimal generators are given by (\ref{BC sym}). The contact sub-connection has the Brunovsk\'y normal form $\beta^{\langle 2,1\rangle}$ as a component. we will decompose this Brunovsk\'y normal form as $\beta^{\langle 2,1\rangle}=\beta^{\langle 0,1\rangle}\oplus \beta^{\langle 2 \rangle}$. Specifically, we will be choosing our reduction along the copy of $\beta^{\langle 2\rangle}$ given by $j^2(z^1_0)$ by choosing $z^1_0=f(t)$ for an arbitrary smooth function $f$. This defines a codimension 2 partial contact curve and leads to the following reduced contact sub-connection on $J^{\langle 0,1\rangle}\times H$: \begin{equation}\label{BC reduced} \bar{\gamma}^H=\beta^{\langle 2\rangle}\oplus\langle d\epsilon_1-z^3_0\,dt,\,d\epsilon_2-z^3_0(f(t)-t)\,dt,\,d\epsilon_3-(B(t,j^2f(t),\bz)-z^3_0(f(t)+1-t))\,dt \rangle, \end{equation} where \begin{equation} B(t,j^2f(t),\bz)=z^3_1+(\ddot{f}(t)-1)f(t)-\left((t-1)f(t)-\frac{1}{2}((t-1)^2+1)\right)z^2_0. \end{equation} The refined derived type of the reduced contact sub-connection is $[[3, 0], [5, 2, 3], [6, 4, 4], [7,5,5], [8, 8]]$, which agrees with a Brunovsk\'y normal form with type $\bar{\kappa}=\langle 1,0,0,1\rangle$. Since $\bar{\rho}_3=1$, we can construct the filtration (\ref{filt fun}): \begin{equation}\label{BC reduced filt} \begin{aligned} (\bar{\Pi}^3)^\perp&=\{dt,dz^3_0-\left(f(t)^2-tf(t)+\frac{1}{2}t^2\right)d\epsilon_1+(f(t)-t)d\epsilon_2-d\epsilon_3\},\\ \coder{\Xi}{3}&=\coder{\Xi}{3}_2=\{dt,dz^2_0-\frac{1}{2}t(2f(t)-t)d\epsilon_1-d\epsilon_3,(f(t)-t)d\epsilon_1-d\epsilon_2\},\\ \coder{\Xi}{2}&=\coder{\Xi}{2}_1=\{dt,d\epsilon_1,d\epsilon_2,dz^2_0-d\epsilon_3\},\\ \coder{\Xi}{1}&=\{dt,d\epsilon_1,d\epsilon_2,dz^2_0-d\epsilon_3,dz^3_0\},\\ \coder{\Xi}{1}_0&=\{dt,d\epsilon_1,d\epsilon_2,d\epsilon_3,dz^2_0,dz^3_0\}, \end{aligned} \end{equation} and observe that all subbundles of the filtration are integrable and contain $dt$. Therefore, we can conclude that $\bar{\gamma}^G$ is ESFL to a Brunovsk\'y normal form of signature $\langle 1,0,0,1\rangle$ by Definition \ref{Goursat}, Theorem \ref{Generalized Goursat Normal Form}, and Theorem \ref{Goursat ESFL}. Thus we conclude that the BC system is CFL with respect to the symmetry group $H$. We now mention an important consequence of a control system satisfying Definition \ref{CFL def}. \begin{thm}\label{CFL is EI}\cite{VassiliouCascadeI} If a control system $\omega$ on a smooth manifold $M$ is cascade feedback linearizable, then it is explicitly integrable. \end{thm} As example demonstrating Theorem \ref{CFL is EI}, we once again use the BC system. First we construct the ESF linearization for (\ref{BC reduced}) via procedure \textbf{contact} B since $\bar{\rho}_k=1$. Using (\ref{BC reduced filt}), we find that $\coder{\Xi}{1}_0/\coder{\Xi}{1}=\{d\epsilon_3\}$. Thus the new contact coordinates on $J^{\langle 1,0,0,1\rangle}$ can be given by \begin{equation}\label{BC reduced ESF} \begin{aligned} w^1_0&=z^2_0,&w^2_0&=z^2_0-\left(f(t)^2-tf(t)+\frac{1}{2}t^2\right)\epsilon_1+(f(t)-t)\epsilon_2-\epsilon_3,\\ w^1_1&=z^2_1,&w^2_1&=(f(t)-t)\epsilon_1-\epsilon_2-f(t)(1+f(t)\ddot{f}(t)),\\ \,&\,&w^2_2&=-\epsilon_1,\\ \,&\,&w^2_3&=-z^3_0,\\ \,&\,&w^2_4&=-z^3_1. \end{aligned} \end{equation} Let $j^1g_1(t)$ and $j^4g_2(t)$ be arbitrary smooth solutions to the canonical contact system on $J^{\langle 1,0,0,1 \rangle}$. Inverting (\ref{BC reduced ESF}) and solving for $(\bz,\epsilon)$ in terms of $j^1g_1(t)$ and $j^4g_2(t)$, we find the following solution to $\bar{\gamma}^H$:\begin{equation} \begin{aligned} z^2_0(t)&= g_1(t), & \epsilon_1(t) &=-\ddot{g}_2(t),\\ z^2_1(t)&=\dot{g}_1(t), & \epsilon_2(t) & = -(f(t)-t)\ddot{g}_2-\dot{g}_2-f(t)(1+f(t)\ddot{f}(t)),\\ z^3_0(t)&= -\dddot{g_2}(t), & \epsilon_3(t) &= g_1(t)+\left(f(t)^2-tf(t)+\frac{1}{2}t^2\right)\ddot{g}_2(t)\\ z^3_1(t) &= -\ddddot{g_2}(t), &\, &-(f(t)-t)((f(t)-t)\ddot{g}_2+\dot{g}_2\\ \,&\,&\,&+f(t)(1+f(t)\ddot{f}(t)))-g_2(t). \end{aligned} \end{equation} The contact curve reduction depends on an arbitrary smooth function $f(t)$. Thus, if we append $j^2z^1_0(t)=j^2f(t)$ to our above solution, then we have described all integral curves to $\gamma^H$. Furthermore, if we pass through the ESFT $\tilde{\varphi}$ from Theorem \ref{control reconstruction}, then we can find an explicit solution to the BC system in terms of arbitrary functions and their derivatives alone. That is, no integration is required to describe the trajectories of the BC system. \subsection{Truncated Euler Operator} \tab In the last step of the cascade feedback linearization process, we want to know \textit{why} a contact sub-connection $\gamma^G$ admits an ESFL partial contact curve reduction. Towards this goal, we will explore the structure of ESFL reductions more closely by directly analyzing the PDEs associated to the calculation of the refined derived type. Recall that a contact sub-connection on $J^\kappa(\mathbb{R},\mathbb{R}^m)\times G$ has the form \begin{equation} \mathcal{H}_G=\{X,\partial_{u^a}\}, \end{equation} where $1\leq a\leq m$ and \begin{equation} X=\partial_t+\sum_{i=1}^m\sum_{l_i=0}^{\sigma_i-1}z^i_{l_{i}+1}\partiald{\,}{z^i_{l_i}}+\sum_{a,b}\rho^a_b(\epsilon)p^b(z)\partial_{\epsilon^a}. \end{equation} Note that the terms involving only jet bundle coordinates look very similar to the notion of a total derivative on an infinite jet bundle \cite{VarBi}. In computing the derived flag of an ESFL reduction for this contact sub-connection, one finds that this \textit{truncated} total derivative operator is iterated in such a way that there is a \textit{truncated} Euler operator that naturally appears. Hence, to better understand how the properties of these operators impact the refined derived type of an ESFL reduction, we will spend this section building some results about these types of operators. These truncated operators have similar--but not exactly the same--properties as their full infinite jet bundle analogues. The difference between the truncated versions and non-truncated versions arise naturally in proofs of results in this chapter, especially in Theorem \ref{sufficiency}. \begin{defn} The \textbf{truncated total derivative} and \textbf{truncated sub-fiber total derivative} operators on $J^\kappa(\mathbb{R},\mathbb{R}^m)$ are given by \begin{align*} \sD_t:=&\partial_t+\sum_{i=1}^m\sum_{l_i=0}^{\sigma_i-1}z^i_{l_{i}+1}\partiald{\,}{z^i_{l_i}},\\ \sD_{t,i}:=&\partial_t+\sum_{l_i=0}^{\sigma_i-1}z^i_{l_i+1}\partiald{\,}{z^i_{l_i}} \end{align*} respectively, where $\sigma_i$ is the order of the jet for each $z^i_0$. \end{defn} \begin{prop}\label{Dt inv 1} The first integrals of the truncated total derivative operator $\sD_{t}$ are generated by \begin{equation} I^i_k(t,z)=z^i_{\sigma_i-k}-\int_{t_k}^tI^i_{k-1}(s,z)\,ds, \end{equation} where $I^i_0=z^i_{\sigma_i}$, $I^i_{-1}=0$, $0\leq k\leq \sigma_i$, $1\leq i\leq m$ and the $t_k$ are arbitrary constants. \end{prop} \begin{proof} The proof follows by induction on $k$ for each $i$. It is immediate that $\sD_t(I_0^i)=0$, thus establishing the base case. Now assume that the above identity holds for some $k>0$ and that $\sD_t(I^i_{k-1})=0$. Then \begin{equation} \begin{aligned} \sD_t(I^i_k(t,z))&=z^i_{\sigma_i-k+1}-I^i_{k-1}(t,z)-\int_{t_k}^t \sD_s(I^i_{k-1}(s,z))-\partiald{I^i_{k-1}(s,z)}{s}\,ds\\ \,&=z^i_{\sigma_i-k+1}-I^i_{k-1}(t,z)+\int_{t_k}^t\partiald{I^i_{k-1}(s,z)}{s}\,ds\\ \,&=z^i_{\sigma_i-k+1}-I^i_{k-1}(t_k,z). \end{aligned} \end{equation} In the last line we have the invariant $I^i_{k-1}$ evaluated at $t=t_k$. The induction hypothesis means that the recursive formula is true for $k-1$ and hence $I^i_{k-1}(t_k,z)=z^i_{\sigma_i-k+1}$. Thus, $\sD_t(I^i_k(t,z))=0$ for all $k\leq \sigma_i$. It is easy to see that the all $dI^i_k$ are linearly independent of each other, and upon a quick dimension count we find that there are precisely $\sum_{i\leq m}(\sigma_i+1)$ functions $I^i_k$. The total dimension of $J^\kappa$ is $1+\sum_{i\leq m}(\sigma_i+1)$; hence, the $I^i_k$ are a complete set of invariants for $\sD_t$. \end{proof} Note that we can explicitly write formulas for the invariant functions in Proposition \ref{Dt inv 1}. Indeed, for each $t_k=0$, \begin{equation} \begin{aligned} I^i_0&=z^i_{\sigma_i},\\ I^i_1&=z^i_{\sigma_i-1}-tz^i_{\sigma_i},\\ I^i_2&=z^i_{\sigma_i-2}-tz^i_{\sigma_i-1}+\frac{1}{2}t^2z^i_{\sigma_i},\\ \,&\vdots\\ I^i_k&=\sum_{a=0}^k\frac{(-1)^{k-a}}{(k-a)!}t^{k-a}z^i_{\sigma_i-a},\\ \,&\vdots\\ I^i_{\sigma_i}&=\sum_{a=0}^{\sigma_i}\frac{(-1)^{\sigma_i-a}}{(\sigma_i-a)!}t^{\sigma_i-a}z^i_{\sigma_i-a}. \end{aligned} \end{equation} An important observation about the proposition above is that if $f:J^\kappa\to\mathbb{R}$ is a differentiable function such that $\sD_t(f)=0$, then $f$ cannot have dependence on arbitrary functions of $t$ alone. With this in mind, we will now characterize the time-independent invariant functions of $\sD_t$. The first two of these $t$-independent invariants are \begin{align} J^i_2&=-\frac{1}{2}(z^i_{\sigma_i-1})^2+z^i_{\sigma^i-2}z^i_{\sigma_i},\\ J^i_3&=\frac{1}{3}(z^i_{\sigma_i-1})^3-z^i_{\sigma_i-2}z^i_{\sigma_i-1}z^i_{\sigma_i}+z^i_{\sigma_i-3}(z^i_{\sigma_i})^2. \end{align} \begin{prop}\label{t indep tot invs} The $t$-independent invariant functions of $\sD_t$ are generated by the functions $J^i_1:=z^i_{\sigma_i}$ together with the functions \begin{equation} J^i_k=(-1)^{k-1}\frac{k-1}{k!}(z^i_{\sigma_i-1})^k+\sum_{a=2}^k\frac{(-1)^{k-a}}{(k-a)!}z^i_{\sigma_i-a}(z^i_{\sigma_i})^{a-1}(z^i_{\sigma_i-1})^{k-a} \end{equation} for $2\leq k\leq \sigma_i$ and $i\leq m$. \end{prop} \begin{proof} To prove that each $J^i_k$ is an invariant of $\sD_t$, we will simply compute $\sD_t(J^i_k)$ for all $1\leq i\leq m$ and $2\leq k\leq \sigma_i$. Indeed, since \begin{align} \sD_t(z^i_{l_i})&=z^i_{{l_i}+1},\\ \sD_t(z^i_{\sigma_i})&=0 \end{align} for all $0\leq l_i\leq \sigma_i-1$ and $1\leq i\leq m$, then \begin{equation}\label{telescope} \begin{aligned} \sD_t(J^i_k)&=(-1)^{k-1}\frac{1}{(k-2)!}z^i_{\sigma_i}\left(z^i_{\sigma_i-1}\right)^{k-1}\\ \,&+\sum_{a=2}^k\frac{(-1)^{k-a}}{(k-a)!}\left(z^i_{\sigma_i-a+1}\left(z^i_{\sigma_i}\right)^{a-1}\left(z^i_{\sigma_i-1}\right)^{k-a}+(k-a)z^i_{\sigma_i-a}(z^i_{\sigma_i})^a(z^i_{\sigma_i-1})^{k-a-1}\right)\\ \,&=(-1)^{k-1}\frac{1}{(k-2)!}z^i_{\sigma_i}\left(z^i_{\sigma_i-1}\right)^{k-1}\\ \,&+\sum_{a=2}^{k-1}\left(\frac{(-1)^{k-a}}{(k-a)!}z^i_{\sigma_i-a+1}\left(z^i_{\sigma_i}\right)^{a-1}\left(z^i_{\sigma_i-1}\right)^{k-a}-\frac{(-1)^{k-a}(k-a-1)}{(k-a)!}z^i_{\sigma_i-a}(z^i_{\sigma_i})^a(z^i_{\sigma_i-1})^{k-a-1}\right).\\ \end{aligned} \end{equation} The sum in equation (\ref{telescope}) is telescopic and the last term vanishes. Hence, \begin{equation} \begin{aligned} \sD_t(J^i_k)&=(-1)^{k-1}\frac{1}{(k-2)!}z^i_{\sigma_i}\left(z^i_{\sigma_i-1}\right)^{k-1}+(-1)^{k-2}\frac{1}{(k-2)!}z^i_{\sigma_i-1}z^i_{\sigma_i}\left(z^i_{\sigma_i-1}\right)^{k-2}\\ \,&=0. \end{aligned} \end{equation} We finish with a dimension count. The $J^i_k$ are invariants of both $\sD_t$ and $\partial_t$. Thus, for each $i=1,2,\ldots,m$, there are precisely $\sigma_i$ independent invariants of $\sD_t$ and $\partial_t$ that may be chosen to generate all invariants of $\sD_t$ and $\partial_t$. It is clear that all the $dJ^i_k$ are linearly independent. Therefore, the $J^i_k$ will generate the $t$-independent invariants of $\sD_t$. \end{proof} Next, we define the truncated Euler operator and prove some properties about its kernel. Its definition is in terms of the truncated total derivative operators. The truncated Euler operator appears naturally when computing terms arising in the derived flag of a contact sub-connection. In particular, an understanding of its kernel will lead to insight about how the symmetry group of a control system can act on the manifold and have the property that the control system is CFL with respect to that symmetry. \begin{defn} For each $\tau_i\leq \sigma_i$, define the \textbf{truncated Euler operator} $\sE_{\tau_i}$ on $J^\kappa(\mathbb{R},\mathbb{R}^m)$ to be \begin{equation} \sE_{\tau_i}(f)=\partiald{f}{z^i_0}-\sD_t\left(\partiald{f}{z^i_1}\right)+\sD_t^2\left(\partiald{f}{z^i_2}\right)-\cdots+(-1)^{\tau_i}\sD_t^{\tau_i}\left(\partiald{f}{z^i_{\tau_i}}\right) \end{equation} for any sufficiently differentiable function $f$ on $J^\kappa$, where $\sD_t$ is the truncated total derivative operator on $J^\kappa$. We can also define the \textbf{truncated sub-fiber Euler operator} $\sE_{\tau_i,j}$ by using the truncated sub-fiber total derivative operator $\sD_{t,j}$ in place of $\sD_t$. \end{defn} \begin{prop}\label{EO kernel} The kernel of the truncated Euler operator of any order $\tau_i\leq \sigma_i$ on $J^\kappa(\mathbb{R},\mathbb{R}^m)$ contains the set \begin{equation} K_{\sE_{\tau_i}}:=\left\{f(z)=\sD_tg(z)\,|\,\,g\in C^1(J^\kappa(\mathbb{R},\mathbb{R}^m))\,\text{and}\,\partiald{g}{z^i_{\tau_i}}\in\ker\,\sD_t^{\tau_i+1}\right\}, \end{equation} where $\sD_t$ is the truncated total derivative operator on $J^\kappa(\mathbb{R},\mathbb{R}^m)$. \end{prop} \begin{proof} The result above effectively follows from repeated applications of the identity \begin{equation} \partiald{\,}{z^i_{l_i+1}}\circ \sD_t=\partiald{\,}{z^i_{l_i}}+\sD_t\circ \partiald{\,}{z^i_{l_i+1}}. \end{equation} In the case that $l_i=0$, the identity is $\partiald{\,}{z^i_0}\circ \sD_t=\sD_t\circ \partiald{\,}{z^i_0}$. Applying these identities, we have \begin{equation} \begin{aligned} \sE_{\tau_i}(f)&=\sD_t\left(\partiald{g}{z^i_0}\right)-\sD_t\left(\partiald{g}{z^i_0}+\sD_t\left(\partiald{g}{z^i_1}\right)\right)+\sD_t^2\left(\partiald{g}{z^i_1}+\sD_t\left(\partiald{g}{z^i_2}\right)\right)-\cdots\\ \,&+(-1)^{\tau_i-1}\sD_t^{\tau_i-1}\left(\partiald{g}{z^i_{\tau_i-2}}+\sD_t\left(\partiald{g}{z^i_{\tau_i-1}}\right)\right)+(-1)^{\tau_i}\sD_t^{\tau_i}\left(\partiald{g}{z^i_{\tau_i-1}}+\sD_t\left(\partiald{g}{z^i_{\tau_i}}\right)\right), \end{aligned} \end{equation} which reduces to \begin{equation} \sE_{\tau_i}(f)=(-1)^{\tau_i}\sD_t^{\tau_i+1}\left(\partiald{g}{z^i_{\tau_i}}\right). \end{equation} But since $\partiald{g}{z^i_k}$ is in the kernel of $\sD_t^{\tau_i+1}$, this implies that $\sE_{\tau_i}(\sD_tg)=0$. \end{proof} \begin{cor}\label{kernel cor} If $f=\sD_tg$, where $\sD_t$ is the truncated total derivative operator on the jet space $J^\kappa(\mathbb{R},\mathbb{R}^m)$, $g$ is a function on $J^\kappa(\mathbb{R},\mathbb{R}^m)$, and $\sE_{\tau_i}$ is the truncated Euler operator of order $\tau_i\leq\sigma_i$, then \begin{equation} \sE_{\tau_i}(f)=(-1)^{\tau_i}\sD_t^{\tau_i+1}\left(\partiald{g}{z^i_{\tau_i}}\right). \end{equation} \end{cor} This is in contrast to the classical theory of calculus of variations, which has a modern geometric formulation on $J^\infty$ outlined wonderfully in \cite{VarBi}. In that work, the kernel of the Euler operator is the space of all functions on $J^\infty$ that are equal to the total derivative of some other function on $J^\infty$. Theorem \ref{EO kernel} and Corollary \ref{kernel cor} above highlight the difference between the kernel of the full Euler operator and that of our truncated version. This discrepancy is necessary for our work, and for finding examples of CFL systems. Theorem \ref{sufficiency} below makes this fact clear. One more important remark about the truncated Euler operator is required here. If $f\in C^\infty(J^{2n}(\mathbb{R},\mathbb{R}^m), \mathbb{R})$ for some $n>0$, then \begin{equation} \sE_{2n}(f)=E(f) \end{equation} if and only if either $f$ is constant or $\partiald{f}{z^i_k}=0$ for all $k\geq n$ and $1\leq i\leq m$. \subsection{PDEs for the Refined Derived Type} In the first chapter, the idea of the ``refined derived type" of a distribution/EDS was discussed. Recall that a given distribution admits a local normal form via diffeomorphism to a standard Goursat bundle if and only if both the refined derived type of the distribution in question is the same as one for a Goursat bundle and the appropriate filtration, given by either \ref{filt fun} and \ref{filt res}, is integrable. Furthermore, to ensure that the diffeomorphism is an ESF transformation, the control directions must be contained in the Cauchy characteristic bundle of the first derived distribution, and the 1-form $dt$ must either annihilate the Cauchy characteristic bundle of the penultimate derived distribution or annihilate the resolvent bundle, whichever applies by procedure \textbf{contact}. In this section, we will look at the equivalent PDE conditions for the refined derived type of distributions on $J^{\sigma_1}(\mathbb{R},\mathbb{R})\times G$ that are ESF equivalent to the Goursat bundle associated with some $J^{\sigma_1+1}(\mathbb{R},\mathbb{R})$ when $\mathrm{dim}\,G=1$. For this case in particular, we mention that the integrable filtration condition will be satisfied automatically due to the necessary rank conditions on the derived flags of our distributions. \begin{remark} We emphasize here that the above-mentioned $J^{\sigma_1+1}(\mathbb{R},\mathbb{R})$ with contact distribution is \textbf{not} a prolongation of the contact distribution on $J^{\sigma_1}(\mathbb{R},\mathbb{R})$. It is better to think of the relationship as ``anti-prolongation," in that, instead of a derivative being added to the represented control system in Brunovsk\'y normal form, a new state is being added via some kind of anti-differentiation. \end{remark} Below is a proposition that is equivalent to a special case of Theorem 13 in \cite{VassiliouSICON}. The purpose of this proposition is to recognize explicit PDE conditions that will be necessary and sufficient for the reduction of a contact sub-connection to be ESFL. As will be seen in the next section, the specific PDE conditions to be satisfied will be conditions on \textit{truncated} Euler operators of the function associated to the right hand side of the equation of Lie type. \begin{prop}\label{PDE form} Let \begin{equation} \mathcal{H}_G=\{X,\partial_{z^1_{\sigma_1}},\ldots,\partial_{z^m_{\sigma_m}}\} \end{equation} be a contact sub-connection on $J^{\sigma_1}(\mathbb{R},\mathbb{R}^m)\times G$, with $\text{dim}\,G=1$ and with \begin{equation} X=\sD_t+p(z)\,\partial_\epsilon. \end{equation} If \begin{equation} \bar{\mathcal{H}}_G=\{\bar{X},\partial_{z^1_{\sigma_1}}\} \end{equation} is the partial contact curve reduction along the partial contact curves that annihilate the Brunovsk\'y forms $\theta^i_{l_i}$ for $2\leq i\leq m$, then $\bar{\mathcal{H}}_G$ is ESFL if and only if the following hold: \begin{itemize} \item For $1\leq k\leq \sigma_1$, the $k$th derived flag of the reduced contact sub-connection is \begin{align} \bar{\mathcal{H}}_G^{(k)}=\{\bar{X},\bar{Y}_0,\bar{Y}_1,\cdots,\bar{Y}_k\}, \end{align} where \begin{equation} \begin{aligned} \bar{Y}_k&=[\bar{X},\bar{Y}_{k-1}]\\ \,&=Q_{k}\partial_\epsilon+(-1)^k\partial_{z_{\sigma_1-k}^1} \end{aligned} \end{equation} with $\bar{Y}_0=\partial_{z^1_{\sigma_1}}$, and the coefficients $Q_k$ defined recursively by \begin{align} Q_{k}&=\bar{\sD}_t\left(Q_{k-1}\right)+(-1)^{k}\partiald{\bar{p}}{z_{\sigma_1-k+1}^1}, \end{align} initialized with $Q_0=0$. For $k=\sigma_1+1$, we have \begin{equation}\label{Qn+1 not 0} \begin{aligned} \bar{Y}_{\sigma_1+1}&=[\bar{X},\bar{Y}_{\sigma_1}]\\ \,&=Q_{\sigma_1+1}\partial_{\epsilon}, \end{aligned} \end{equation} with \begin{equation} Q_{\sigma_1+1}=\bar{\sD}_t\left(Q_{\sigma_1}\right)+(-1)^{\sigma_1+1}\partiald{\bar{p}}{z^1_0}. \end{equation} Furthermore, $\bar{\mathcal{H}}^{(\sigma_1+1)}_G=TU$ for some open $U\subset J^{\sigma_1}(\mathbb{R},\mathbb{R})\times G$. That is, $\bar{\mathcal{H}}_G$ is bracket generating. \item For each $0\leq k \leq \sigma_1-1$, the Cauchy characteristics of $\bar{\mathcal{H}}^{(k+1)}_G$ are spanned by $\{\bar{Y}_l\}_{l=0}^{k}$, and hence the system of PDE \begin{equation}\label{CC PDE} (-1)^i\partiald{Q_k}{z_{\sigma_1-i}^1}+(-1)^{k+1}\partiald{Q_i}{z_{\sigma_1-k}^1}=0 \end{equation} must be satisfied for all $0\leq i\leq k\leq \sigma_1$. \end{itemize} \end{prop} \begin{proof} We start by noting that for the first bullet point, the requirement that the rank of the derived flag of $\bar{\mathcal{H}}_G$ increases by one at each step is a necessary condition for ESF linearizability. Indeed, this condition would be sufficient to show that $\bar{\mathcal{H}}_G$ is local diffeomorphism equivalent to a Goursat bundle. However, for the stricter class of ESF equivalence, the second bullet point adds an additional condition to guarantee sufficiency and necessity. The second bullet point is equivalent to the condition from Theorem \ref{Goursat ESFL} that $\partial_{z^1_{\sigma_1}}$ is a Cauchy characteristic for $\bar{\mathcal{H}}_G^{(1)}$ and $dt\in\ann\left(\text{Char}\left(\bar{\mathcal{H}}_G^{(\sigma_1)}\right)\right)$. To prove the form above for the $\bar{Y}_k$, we use induction. First, we have \begin{equation} \begin{aligned} \bar{Y}_1&=[\bar{X},\bar{Y}_0]\\ \,&=\partiald{\bar{p}}{z^1_{\sigma_1}}\,\partial_\epsilon-\partial_{z^1_{\sigma_1-1}}, \end{aligned} \end{equation} thus establishing the base case. Now notice that \begin{equation}\label{bracket fact} [\bar{\sD}_t,\partial_{z^1_l}]=-\partial_{z^1_{l-1}} \end{equation} for $1\leq l \leq \sigma_1$. Hence equation (\ref{bracket fact}) tells us that $[\bar{X},\bar{Y}_l]$ will be linearly independent from $\bar{X}$ and all the previous $\bar{Y}_i$ with $i\leq l$. For the inductive step, we assume that for $1\leq l \leq k-1$, \begin{equation} \bar{Y}_l=Q_{l}\partial_\epsilon+(-1)^l\partial_{z_{\sigma_1-l}^1}. \end{equation} Computing $[\bar{X},\bar{Y}_{k-1}]$, we find \begin{equation} \begin{aligned} [\bar{X},\bar{Y}_{k-1}]&=[\bar{\sD}_t+\bar{p}\,\partial_\epsilon,\,Q_{k-1}\partial_\epsilon+(-1)^{k-1}\partial_{z_{\sigma_1-k+1}^1}]\\ \,&=\bar{\sD}_t(Q_{k-1})\partial_\epsilon-(-1)^{k-1}\partial_{z^1_{\sigma_1-k}}+[\bar{p}\partial_\epsilon,\,Q_{k-1}\partial_\epsilon+(-1)^{k-1}\partial_{z_{\sigma_1-k+1}^1}]\\ \,&=\left(\bar{\sD}_t\left(Q_{k-1}\right)+(-1)^{k}\partiald{p}{z_{\sigma_1-k+1}^1}\right)\partial_\epsilon+(-1)^k\partial_{z^1_{\sigma_1-k}}\\ \,&=Q_{k}\partial_\epsilon+(-1)^k\partial_{z^1_{\sigma_1-k}}. \end{aligned} \end{equation} Next we address the second bullet. We need to show that all $\bar{Y}_l$ for $1\leq l\leq k$ are Cauchy characteristics for each $\bar{\mathcal{H}}_G^{(k)}$. In particular, the requirement that $dt\in\ann\left(\text{Char}\left(\bar{\mathcal{H}}_G^{(\sigma_1)}\right)\right)$ is equivalent to the condition that the $\bar{X}$-projection of any element of $\Char{\bar{H}}{\sigma_1}$ is zero (except in the last step of the derived flag, since it generates the tangent bundle). To see this, notice that in order for $\bar{\mcal{H}}_G$ to be bracket generating, we must have $\text{Char}\left(\bar{\mathcal{H}}^{(l)}_G\right)\subset\text{Char}\left(\bar{\mathcal{H}}^{(l+1)}_G\right)$ for all $l\leq n-1$, and hence $\ann\left(\text{Char}\left(\bar{\mathcal{H}}^{(l+1)}_G\right)\right)\subset\ann\left(\text{Char}\left(\bar{\mathcal{H}}^{(l)}_G\right)\right)$. Therefore, if $\bar{X}$ is not a Cauchy characteristic for any of the derived distributions save the last, then $dt\in\ann\left(\text{Char}\left(\bar{\mathcal{H}}_G^{(\sigma_1)}\right)\right)$ and vice versa. Next, we observe that \begin{equation} [\bar{Y}_i,\bar{Y}_k]=\left((-1)^i\partiald{Q_k}{z_{\sigma_1-i}^1}+(-1)^{k+1}\partiald{Q_i}{z_{\sigma_1-k}^1}\right)\partial_\epsilon, \end{equation} so in order to not violate the condition that the dimension at each step in the derived flag increases by only one we must have \begin{equation}\label{4.49} (-1)^i\partiald{Q_k}{z_{\sigma_1-i}^1}+(-1)^{k+1}\partiald{Q_i}{z_{\sigma_1-k}^1}=0. \end{equation} Since (\ref{4.49}) holds by assumption, it is evident that $[\bar{Y}_i,\bar{Y}_k]=0$ for all $i\leq k$ in $\bar{\mathcal{H}}_G^{(k+1)}$ for all $0<k\leq \sigma_1$. Since $[\bar{X},\bar{Y}_i]=\bar{Y}_{i+1}\in\bar{\mathcal{H}}_G^{(k+1)}$ for $0\leq i\leq k$, there exist a maximal number of linearly independent vector fields in $\bar{\mathcal{H}}_G^{(k+1)}$ that are Cauchy characteristics. Were it not a maximal number, then $\bar{\mathcal{H}}^{(k+1)}_G$ would be Frobenius, contradicting the non-integrability of $\bar{\mathcal{H}}^{(k+1)}_G$. Therefore, we conclude that for each $k\leq \sigma_1$, \begin{equation} \text{Char}\left(\bar{\mathcal{H}}_G^{(k+1)}\right)=\{\bar{Y}_0,\bar{Y}_1,\ldots,\bar{Y}_{k}\}. \end{equation} \end{proof} \subsection{Necessity for ESFL Reductions} \tab In this section we give an important necessary condition for a contact sub-connection to be ESFL via partial contact curve reduction. It is a condition on the truncated Euler operator applied to a function arising from the group action. we will prove the following theorem: \begin{thm}\label{necessity} Let $(t,z,\epsilon)=(t,j^{\sigma_1}z_0^1,\ldots,j^{\sigma_m}z_0^m,\epsilon)$ be local coordinates for $J^\kappa\times G$, where $\mathrm{dim}\,G=1$. Furthermore, assume that $\Theta^G=d\epsilon-p(z)\,dt$, and let $\bar{\gamma}^G$ be the reduction of $\gamma^G$ by codimension 1 partial contact curves defined by $j^{\sigma_l}z^l_0=j^{\sigma_l}f_l(t)$, for all $l\neq i$ for some $1\leq i\leq m$ and $m-1$ arbitrary smooth functions $f_l(t)$. If $\bar{\gamma}^G$ is ESFL, then the truncated Euler operator applied to $\bar{p}(z)$ must be degenerate in the sense that $\bar{\sE}_{\sigma_i}(\bar{p}(z))$ has no dependence on $z^i_k$ for $k\geq 1$. \end{thm} \begin{proof} Without loss of generality, take $i=1$. For notational simplicity we will drop the superscript of `1' on all $z^1_l$ variables. Now recall the fundamental bundle in filtration (\ref{filt fun}) from Chapter 2. In this case, our fundamental bundle $\Pi^{\sigma_1}$ is defined recursively by \begin{equation} \Pi^{k+1}=\Pi^k+[\bar{X},\Pi^k],\text{ where } \Pi^0=\{\partial_{z^1_{\sigma_1}}\}. \end{equation} In particular, \begin{equation} \begin{aligned} \Pi^1&=\{\partial_{z_{\sigma_1}},\bar{Y}_1\},\\ \Pi^2&=\{\bar{Y}_0,\bar{Y}_1,\bar{Y}_2\},\\ \vdots&\,\\ \Pi^{\sigma_1}&=\{\bar{Y}_0,\ldots,\bar{Y}_{\sigma_1}\}. \end{aligned} \end{equation} Each $\Pi^k$ for $k\leq \sigma_1$ must be Frobenius for an ESFL system. Consider the Pfaffian system defined by \begin{equation} \begin{aligned} \mathcal{F}^{\sigma_1}&:=\langle \ann\left(\Pi^{\sigma_1}\right)\rangle\\ \,&=\langle dt,d\epsilon-\psi\rangle. \end{aligned} \end{equation} Here $\psi$ is a \textit{truncated} version of the Poincar\'e-Cartan form from the calculus of variations \cite{CartanForm2} \cite{CartanForm3} and is defined by \begin{equation} \psi:=\bar{p}\,dt+\sum_{i=1}^{\sigma_1}(-1)^{i+1}Q_i\theta^{\sigma_1-i}, \end{equation} where the $\theta^{\sigma_1-i}$ are the canonical contact forms on $J^{\sigma_1}(\mathbb{R},\mathbb{R})$. We can actually say a bit more. Indeed, for each bundle $\Pi^k$ in the recursive definition of the fundamental bundle, we can similarly define \begin{equation} \mathcal{F}^k:=\langle\ann(\Pi^k)\rangle=\langle dt,d\epsilon-\psi_{k},\theta^{0},\cdots,\theta^{\sigma_1-k-1} \rangle, \end{equation} where \begin{equation} \psi_{k}=\bar{p}\,dt+\sum_{i=1}^{k}(-1)^{i+1}Q_i\theta^{\sigma_1-i}. \end{equation} As a brief remark, this also means that $\bar{\gamma}^G=\langle \theta^a, d\epsilon-\psi\rangle$. Since $\mathcal{F}^{\sigma_1}$ must be Frobenius for an ESFL system, we know that $d(d\epsilon-\psi)=-d\psi=\alpha\wedge\,dt$ for some 1-form $\alpha$. We will determine what this 1-form is and then check the wonderful identity $d^2=0$ to make our conclusion. Indeed, \begin{equation} \begin{aligned} d\psi&=d\bar{p}\wedge dt+\sum_{i=1}^{\sigma_1}(-1)^{i}z_{\sigma_1-i+1}dQ_i\wedge dt+(-1)^iQ_idz_{\sigma_1-i+1}\wedge dt+(-1)^{i+1}dQ_i\wedge dz_{\sigma_1-i}\\ \,&=d\bar{p}\wedge dt+\sum_{i=1}^{\sigma_1}\sum_{j=0}^{\sigma_1}(-1)^iz_{\sigma_1-i+1}\partiald{Q_i}{z_{\sigma_1-j}}dz_{\sigma_1-j}\wedge dt+(-1)^iQ_idz_{\sigma_1-i+1}\wedge dt\\ \,&+(-1)^{i+1}\partiald{Q_i}{z_{\sigma_1-j}}dz_{\sigma_1-j}\wedge dz_{\sigma_1-i}+(-1)^{i}\partiald{Q_i}{t}dz_{\sigma_1-i}\wedge dt. \end{aligned} \end{equation} However, since $\mathcal{F}^{\sigma_1}$ is Frobenius, we must have \begin{equation}\label{frob 1} (-1)^{i+1}\partiald{Q_i}{z_{\sigma_1-j}}+(-1)^j\partiald{Q_j}{z_{\sigma_1-i}}=0 \end{equation} and \begin{equation}\label{frob 2} \partiald{Q_i}{z_{\sigma_1}}=0. \end{equation} Now rearranging indices to collect like forms in $d\psi$ while applying (\ref{frob 2}) gives \begin{equation} \begin{aligned} d\psi&=d\bar{p}\wedge dt-Q_1\,dz_n\wedge dt\\ \,&+\sum_{i=1}^{\sigma_1-1}\left((-1)^{i+1}Q_{i+1}+(-1)^i\partiald{Q_i}{t}+\sum_{j=1}^{\sigma_1}(-1)^{j}z_{\sigma_1-j+1}\partiald{Q_j}{z_{\sigma_1-i}}\right)dz_{\sigma_1-i}\wedge dt\\ \,&+\left((-1)^{\sigma_1}\partiald{Q_{\sigma_1}}{t}+\sum_{j=1}^{\sigma_1}(-1)^{j}z_{\sigma_1-j+1}\partiald{Q_j}{z_0}\right)dz_{0}\wedge dt. \end{aligned} \end{equation} Then applying (\ref{frob 1}), we arrive at \begin{equation} \begin{aligned} d\psi&=d\bar{p}\wedge dt-Q_1\,dz_n\wedge dt\\ \,&+\sum_{i=1}^{\sigma_1-1}(-1)^i\left(-Q_{i+1}+\partiald{Q_i}{t}+\sum_{j=1}^nz_{\sigma_1-j+1}\partiald{Q_i}{z_{\sigma_1-j}}\right)dz_{\sigma_1-i}\wedge dt\\ \,&+(-1)^{\sigma_1}\left(\partiald{Q_{\sigma_1}}{t}+\sum_{j=1}^nz_{\sigma_1-j+1}\partiald{Q_{\sigma_1}}{z_{\sigma_1-j}}\right)dz_{0}\wedge dt\\ \,&=d\bar{p}\wedge dt-Q_1\,dz_n\wedge dt\\ \,&+\sum_{i=1}^{\sigma_1-1}(-1)^i\left(-Q_{i+1}+\bar{\sD}_t(Q_i)\right)dz_{\sigma_1-i}\wedge dt+(-1)^{\sigma_1}\bar{\sD}_t(Q_{\sigma_1})dz_{0}\wedge dt. \end{aligned} \end{equation} Now recalling the recursive formula $Q_{i+1}=\bar{\sD}_t\left(Q_i\right)+(-1)^{i+1}\bar{p}_{z_{\sigma_1-i}}$, we arrive at \begin{equation} \begin{aligned} d\psi&=d\bar{p}\wedge dt+\partiald{\bar{p}}{z_{\sigma_1}}\,dz_n\wedge dt\\ \,&+\sum_{i=1}^{\sigma_1-1}\partiald{\bar{p}}{z_{\sigma_1-i}}\,dz_{\sigma_1-i}\wedge dt+\left(\partiald{\bar{p}}{z_0}+(-1)^{\sigma_1}\bar{\sE}_{\sigma_1}(\bar{p})\right)dz_0\wedge dt, \end{aligned} \end{equation} and thus we have \begin{equation} d\psi=2\,d\bar{p}\wedge dt +(-1)^{\sigma_1}\bar{\sE}_{\sigma_1}(\bar{p})\,dz_0\wedge dt. \end{equation} So, upon computing $d^2\psi=0$, we quickly conclude that $\bar{\sE}_{\sigma_1}(\bar{p})$ has no dependence on $z_i$ for $1\leq i\leq n$ and must therefore be degenerate. \end{proof} Theorem \ref{necessity} provides, for the first time, a coordinate specific obstruction to ESFL partial contact curve reducibility. In particular, if an ESFL partial contact curve reduction exists, then computation of $\bar{\sE}_{\sigma_1}(\bar{p}(z))$ can inform one about an appropriate choice of codimension 1 partial contact curve reduction to achieve the ESF linearization. There is also the added bonus that computing $\bar{\sE}_{\sigma_1}(\bar{p}(z))$ is a straightforward, albeit potentially tedious, calculation. As an application of Theorem \ref{necessity}, recall Example \ref{reduction example} from Chapter 1. It already has the form of a contact sub-connection on $J^{\langle 0,2\rangle}\times G$, where $G\cong \mathbb{R}$. The contact sub-connection may be written as \begin{equation} \gamma^G=\langle dz^i_0-z^i_1\,dt, dz^i_1-z^i_2\,dt,d\epsilon-e^{z^1_1z^2_0}\,dt\rangle,\, i=1,2. \end{equation} Reduction along the $z^1_0$ jet coordinates does not produce an ESFL system. Let $z^2_l=f^{(l)}(t)$ for all $l=0,1,2$, so that $\bar{p}(z)=e^{z^1_1f(t)}$. Computing the truncated Euler operator of this function, we find \begin{equation} \bar{\sE}_2(\bar{p})=-e^{z^1_1 f(t)}(z^1_1f(t)\dot{f}(t)+z^1_2f(t)^2+\dot{f}(t)). \end{equation} Hence, by Theorem \ref{necessity}, $\bar{\gamma}^G$ is not ESFL since $d\bar{\sE}_2(\bar{p})\wedge dz^1_0\wedge dt\neq0$. However, $\bar{\gamma}^G$ does have the form of a Goursat bundle. Although it is a Goursat bundle, the last Cauchy bundle in filtration (\ref{filt fun}) has the form \begin{equation} \mathrm{Char}\bar{\mcal{H}}_G^{(2)}=\left\{\partial_t+\partial_{z^1_0}-\frac{\dot{f}(t)(z^1_1f(t)+1)}{f(t)^2}\partial_{z^1_1}+e^{z^1_1f(t)}\partial_{\epsilon},\partial_{z^1_2}\right\}, \end{equation} where $\bar{\mcal{H}}_G=\ann \bar{\gamma}^G$. Notice that $dt\not\in\ann\mathrm{Char}\bar{\mcal{H}}_G^{(2)}$ and therefore $\bar{\gamma}^G$ cannot be ESFL by Theorem \ref{Goursat ESFL}. Thus, we have agreement with Theorem \ref{necessity}. However, if we reduce along the other contact coordinates $(z^2_0,z^2_1,z^2_2)$, then the reduced system \textit{is} ESFL. For this reduction $z^1_l=g^{(l)}(t)$ for all $l=0,1,2$, and hence $\bar{p}(z)=e^{\dot{g}(t)z^2_0}$. This time, not only is the reduced system a Goursat bundle, but its last Cauchy bundle is given by \begin{equation} \mathrm{Char}\bar{\mcal{H}}_G^{(2)}=\left\{\partial_{z^2_1},\partial_{z^2_2}\right\}. \end{equation} Thus we see from Theorem \ref{Goursat ESFL} that the system is ESFL. Computing the truncated Euler operator of $\bar{p}(z)$, we find \begin{equation} \bar{\sE}_2(\bar{p})=\dot{g}(t)e^{\dot{g}(t)z^2_0}, \end{equation} and so $d\bar{\sE}_2(\bar{p})\wedge dz^2_0\wedge dt=0$, which agrees with Theorem \ref{necessity}. \subsection{Sufficiency for ESFL Reductions} The main theorem of this section gives the first known class of control systems that will always admit an ESFL reduction. The first lemma below establishes a relationship between the truncated Euler operators and the Cauchy characteristics of each $\bar{\mathcal{H}}_G^{(k)}$ for $0\leq k\leq \sigma_1$. In particular, it is important to notice that since $Q_{\sigma_1+1}$ must be nonzero from Proposition \ref{PDE form}, the lemma below implies that $\bar{\sE}_{\sigma_1}(\bar{p})$ must also be nonzero. \begin{lem}\label{EOQ} Let each $Q_{k+1}$, $0\leq k\leq \sigma_1$ be as defined in Proposition \ref{PDE form}. Then \begin{equation} (-1)^{\sigma_1-1}\bar{\sD}^{\sigma_1-k}_t(Q_{k+1})=\bar{\sE}_{\sigma_1}(\bar{p})-\bar{\sE}_{\sigma_1-k-1}(\bar{p}). \end{equation} \end{lem} \begin{proof} This is by direct computation. Since the $Q_{k+1}$ are defined recursively, we can easily compute that \begin{equation}\label{Qk+1 expanded} \begin{aligned} Q_{k+1}&=\bar{\sD}_t(Q_k)+(-1)^{k+1}\partiald{\bar{p}}{z^1_{\sigma_1-k}}\\ \,&=\bar{\sD}^2_t(Q_{k-1})+(-1)^{k}\bar{\sD}_t\left(\partiald{\bar{p}}{z^1_{\sigma_1-k+1}}\right)+(-1)^{k+1}\partiald{\bar{p}}{z^1_{\sigma_1-k}}\\ \,&\vdots\\ \,&=-\bar{\sD}^{k}_t\left(\partiald{\bar{p}}{z^1_{\sigma_1}}\right)+\bar{\sD}^{k-1}_t\left(\partiald{\bar{p}}{z^1_{\sigma_1-1}}\right)+\cdots+(-1)^{k}\bar{\sD}_t\left(\partiald{\bar{p}}{z^1_{\sigma_1-k+1}}\right)+(-1)^{k+1}\partiald{\bar{p}}{z^1_{\sigma_1-k}}. \end{aligned} \end{equation} Applying $(-1)^{\sigma_1-1}\bar{\sD}^{\sigma_1-k}_t$ to \ref{Qk+1 expanded} gives \begin{equation} \begin{aligned} (-1)^{\sigma_1-1}\bar{\sD}^{\sigma_1-k}_t(Q_{k+1})&=(-1)^{\sigma_1}\bar{\sD}^{\sigma_1}_t\left(\partiald{\bar{p}}{z^1_{\sigma_1}}\right)+\cdots+(-1)^{\sigma_1-k+1}\bar{\sD}^{\sigma_1-k-1}_t\left(\partiald{\bar{p}}{z^1_{\sigma_1-k+1}}\right)\\ \,&\phantom{=}\,+(-1)^{\sigma_1-k}\bar{\sD}^{\sigma_1-k}_t\partiald{\bar{p}}{z^1_{\sigma_1-k}}, \end{aligned} \end{equation} which is precisely the difference between the truncated Euler operators $\bar{\sE}_{\sigma_1}$ and $\bar{\sE}_{\sigma_1-k-1}$ acting on $\bar{p}$. \end{proof} From Lemma \ref{EOQ} and Theorem \ref{necessity} we know that $\bar{\sE}_{\sigma_1}(\bar{p})$ must be both nonzero and depend on only $z^1_0$ and $t$, respectively. Given that the truncated Euler operator has nontrivial kernel, it is possible that there is some amount of freedom in the form of $\bar{p}(z)$. That is, it may have terms that are annihilated by the Euler operator. Such terms would not lead to a violation of Theorem \ref{sufficiency}. Thus, for control systems in the form of a contact sub-connection with a 1-dimensional control admissible symmetry, we would like to establish explicit forms for the $p(z)$ that will guarantee that there is an ESFL codimension 1 reduction by partial contact curves. To this end, we would like to know how codimension 1 partial contact curve reduction impacts the truncated total derivative as it applies to functions on $J^\kappa$ that have no dependence on higher order terms along some sub-fiber. \begin{lem}\label{reduced} Let $p=\sD^r_{t,1}(A)$ for $A=A(z_0^1,j^{\sigma_2}z^2_0,j^{\sigma_3}z^3_0,\cdots,j^{\sigma_m}z^m_0)$ and any integer $r\geq0$. Then \begin{equation}\label{reduced D eq} \bar{p}=\overline{\sD_{t,1}^r A}=\left(\bar{\sD}_t-\partiald{\,}{t}\right)^r\bar{A}, \end{equation} or, in expanded form, \begin{equation} \bar{p}=\sum_{l=0}^{r}{r \choose l}(-1)^l\bar{\sD}_t^{r-l}\circ\frac{\partial^l}{\partial t^l}\bar{A}, \end{equation} where $\bar{\cdot}$ denotes reduction along the jet coordinates $j^{\sigma_l}z^l_0$ for $2\leq l\leq m$. \end{lem} \begin{proof} Since $p=\sD^r_{t,1}(A)$ has no time dependence on $J^\kappa(\mathbb{R},\mathbb{R}^m)$, the reduction must have no time derivatives. To see this, notice that for any $t$-independent function $F$ on $J^\kappa$, \begin{equation} \bar{F}(t,j^{\sigma_1}z^1_0)=F(j^{\sigma_1}z^1_0,j^{\sigma_2}f^2(t),j^{\sigma_3}f^3(t),\cdots,j^{\sigma_m}f^m(t)). \end{equation} This implies that \begin{equation} \overline{\partiald{F}{z^1_{l_1}}}=\partiald{\bar{F}}{z^1_{l_1}} \end{equation} for $0\leq l_1\leq \sigma_1$. Therefore, \begin{equation}\label{reduced degree 1} \begin{aligned} \overline{\sD_{t,i}F}&=\overline{\sum_{l_1=0}^{\sigma_1-1}z^1_{l_1+1}\partiald{F}{z^1_{l_1}}}\\ \,&=\sum_{l_1=0}^{\sigma_1-1}z^1_{l_1+1}\partiald{\bar{F}}{z^1_{l_1}}\\ \,&=\bar{\sD}_t\bar{F}-\partiald{\bar{F}}{t}. \end{aligned} \end{equation} Now if $F=\sD_{t,1}G$ for another $t$-independent function $G$ on $J^\kappa$, then \begin{equation} \begin{aligned} \overline{\sD_{t,i}F}&=\bar{\sD}_t\bar{F}-\partiald{\bar{F}}{t}\\ \,&=\bar{\sD}_t\left(\bar{\sD}_t\bar{G}-\partiald{\bar{G}}{t}\right)-\partiald{\,}{t}\left(\bar{\sD}_t\bar{G}-\partiald{\bar{G}}{t}\right)\\ \,&=\left(\bar{\sD}_t-\partiald{\,}{t}\right)^2\bar{F}, \end{aligned} \end{equation} where the second line is by application of equations (\ref{reduced degree 1}). Iterating this argument gives the general form in the lemma. \end{proof} We are now ready to state and prove the second main result of this thesis: an explicit description of an entire class of control systems that admit an ESFL codimension 1 partial contact curve reduction. \begin{thm}\label{sufficiency} Let \begin{equation} \mathcal{H}_G=\left\{\partial_t+\sum_{i=1}^{m}\sum_{l_{i}=0}^{\sigma_i-1}z^i_{l_i+1}\partial_{z^i_{l_i}}+p(z)\,\partial_\epsilon\right\} \end{equation} be a partial contact sub-connection on $J^\kappa(\mathbb{R},\mathbb{R}^m)\times G$ with $\text{dim}(G)=1$ such that \begin{equation}\label{p(z) form} p(z)=\sum_{l=0}^{N} \sD^l_{t,i}A_l \end{equation} for any $0\leq N\leq \sigma_i$ and some $i=1,\ldots,m$, where the $\{A_l\}_{l=0}^{\sigma_i}$ are functions on $J^\kappa(\mathbb{R},\mathbb{R}^m)$ with no dependence on $t$ or $j^l(z_0^i)$ for any $l\geq1$. Then the reduction of $\mathcal{H}_G$ by the codimension 1 partial contact curves that annihilate all Brunovsk\'y forms except $\beta^{\sigma_i}$ is an ESFL system. \end{thm} \begin{proof} Without loss of generality, take $i=1$. For notational simplicity we will drop the superscript of `1' on all $z^1_l$ variables. Furthermore, we can take $p(z)=\sD^{\sigma_1}_{t,i}A$, where $A=A_{\sigma_1}$, and ignore the lower order terms in (\ref{p(z) form}). We can do so because all the operations applied to $p(z)$ in the proof are linear, and any power of $\sD_t$ that is smaller than $\sigma_1$ will satisfy all the important inequalities concerning $\sigma_1$ in the proof. We need to compute each $Q_{k}$ and check that the Cauchy characteristic conditions (\ref{CC PDE}) on the $Q_k$ are satisfied. Indeed, for $k\leq \sigma_1-1$, we use Lemma \ref{EOQ} to see that \begin{equation} \begin{aligned} (-1)^{\sigma_1-1}\bar{\sD}^{\sigma_1-k}_t(Q_{k+1})&=\bar{\sE}_{\sigma_1}\left(\sum_{l=0}^{\sigma_1}{\sigma_1 \choose l}(-1)^l\bar{\sD}_t^{\sigma_1-l}\circ\frac{\partial^l}{\partial t^l}\bar{A}\right)\\ \,&-\bar{\sE}_{\sigma_1-k-1}\left(\sum_{l=0}^{\sigma_1}{\sigma_1 \choose l}(-1)^l\bar{\sD}_t^{\sigma_1-l}\circ\frac{\partial^l}{\partial t^l}\bar{A}\right). \end{aligned} \end{equation} Now by Proposition \ref{EO kernel}, we have \begin{equation} \begin{aligned} (-1)^{\sigma_1-1}\bar{\sD}^{\sigma_1-k}_t(Q_{k+1})&=\bar{\sE}_{\sigma_1}\left((-1)^{\sigma_1}\frac{\partial^{\sigma_1}}{\partial t^{\sigma_1}}\bar{A}+\bar{\sD}^{\sigma_1}_t\bar{A}\right)\\ \,&-\bar{\sE}_{\sigma_1-k-1}\left((-1)^{\sigma_1}\frac{\partial^{\sigma_1}}{\partial t^{\sigma_1}}\bar{A}+\sum_{l=0}^{k+1}{\sigma_1 \choose l}(-1)^l\bar{\sD}_t^{\sigma_1-l}\circ\frac{\partial^l}{\partial t^l}\bar{A}\right). \end{aligned} \end{equation} However, since $\bar{A}$ has no dependence on $z_l$ for $l\geq 1$, \begin{equation} \bar{\sE}_{\sigma_1}\left((-1)^{\sigma_1}\frac{\partial^{\sigma_1}}{\partial t^{\sigma_1}}\bar{A}\right)=\bar{\sE}_{\sigma_1-k-1}\left((-1)^{\sigma_1}\frac{\partial^{\sigma_1}}{\partial t^{\sigma_1}}\bar{A}\right)=\frac{\partial^{\sigma_1+1}}{\partial z_0\,\partial t^{\sigma_1}}\bar{A}. \end{equation} Hence, these terms cancel, leaving \begin{equation} \begin{aligned} (-1)^{\sigma_1-1}\bar{\sD}^{\sigma_1-k}_t(Q_{k+1})&=\bar{\sE}_{\sigma_1}\left(\bar{\sD}^{\sigma_1}_t\bar{A}\right)-\bar{\sE}_{\sigma_1-k-1}\left(\sum_{l=0}^{k+1}{\sigma_1 \choose l}(-1)^l\bar{\sD}_t^{\sigma_1-l}\circ\frac{\partial^l}{\partial t^l}\bar{A}\right). \end{aligned} \end{equation} Now by use of Corollary \ref{kernel cor}, \begin{equation} \begin{aligned} (-1)^{\sigma_1-1}\bar{\sD}^{\sigma_1-k}_t(Q_{k+1})&=(-1)^{\sigma_1}\bar{\sD}^{\sigma_1+1}_t\left(\partiald{\,}{z_{\sigma_1}}\bar{\sD}^{\sigma_1-1}_t\bar{A}\right)\\ \,&-\sum_{l=0}^{k+1}{\sigma_1 \choose l}(-1)^l\bar{\sE}_{\sigma_1-k-1}\left(\bar{\sD}_t^{\sigma_1-l}\circ\frac{\partial^l}{\partial t^l}\bar{A}\right)\\ \,&= (-1)^{\sigma_1-k}\sum_{l=0}^{k+1}{\sigma_1 \choose l}(-1)^l\bar{\sD}^{\sigma_1-k}_t\left(\partiald{\,}{z_{\sigma_1-k-1}}\circ\bar{\sD}_t^{\sigma_1-l-1}\circ\frac{\partial^l}{\partial t^l}\bar{A}\right). \end{aligned} \end{equation} Formally inverting $\bar{\sD}^{\sigma_1-k}_t$ as a linear differential operator, we find that \begin{equation} \begin{aligned} Q_{k+1}&=C_{\sigma_1-k}+(-1)^{k+1}\sum_{l=0}^{k+1}{\sigma_1 \choose l}(-1)^l\partiald{\,}{z_{\sigma_1-k-1}}\circ\bar{\sD}_t^{\sigma_1-l-1}\circ\frac{\partial^l}{\partial t^l}\bar{A}\\ \,&=C_{\sigma_1-k}+(-1)^{k+1}\sum_{l=0}^{k}{\sigma_1 \choose l}(-1)^l\partiald{\,}{z_{\sigma_1-k-1}}\circ\bar{\sD}_t^{\sigma_1-l-1}\circ\frac{\partial^l}{\partial t^l}\bar{A}, \end{aligned} \end{equation} where $C_{\sigma_1-k}\in \text{ker}\,\bar{\sD}^{\sigma_1-k}_t$ and the upper limit in the sum decreases by one because $\bar{\sD}^{\sigma_1-k-2}\circ\frac{\partial^l}{\partial t^l}\bar{A}$ has no dependence on $z_{\sigma_1-k-1}$. Thus we also have \begin{equation} Q_{k}=C_{\sigma_1-k+1}+(-1)^k\sum_{l=0}^{k-1}{\sigma_1 \choose l}(-1)^l\partiald{\,}{z_{\sigma_1-k}}\circ\bar{\sD}_t^{\sigma_1-l-1}\circ\frac{\partial^l}{\partial t^l}\bar{A}. \end{equation} We need to show that the $C_{\sigma_1-k}$ terms are zero for all defined values of $k$. we will check that the recursive definition for the $Q_{k+1}$'s is satisfied. Indeed, \begin{equation} Q_{k+1}=\bar{\sD}_t(Q_k)+(-1)^{k+1}\partiald{\bar{p}}{z_{\sigma_1-k}}. \end{equation} Now, for our choice of $\bar{p}$ we have \begin{equation} \begin{aligned} \partiald{\bar{p}}{z_{\sigma_1-k}}&=\sum_{l=0}^{\sigma_1}{\sigma_1\choose l}(-1)^l\frac{\partial}{\partial z_{\sigma_1-k}}\circ\bar{\sD}^{\sigma_1-l}_t\circ\frac{\partial^l}{\partial t^l}\bar{A}\\ \,&=\sum_{l=0}^k{\sigma_1\choose l}(-1)^l\frac{\partial}{\partial z_{\sigma_1-k}}\circ\bar{\sD}^{\sigma_1-l}_t\circ\frac{\partial^l}{\partial t^l}\bar{A}, \end{aligned} \end{equation} where the terms in the sum for $l>k$ are all zero since $\bar{\sD}^{\sigma_1-l}_t\circ\frac{\partial^l}{\partial t^l}\bar{A}$ has dependence on jet coordinates only up to order $\sigma_1-l$. Now using \begin{equation} \frac{\partial}{\partial z_{\sigma_1-k}}\circ\bar{\sD}^{\sigma_1-l}_t=\frac{\partial}{\partial z_{\sigma_1-k-1}}\circ\bar{\sD}^{\sigma_1-l-1}_t+\bar{\sD}_t\circ\frac{\partial}{\partial z_{\sigma_1-k}}\circ \bar{\sD}^{\sigma_1-l-1}_t, \end{equation} we see that \begin{multline} \partiald{\bar{p}}{z_{\sigma_1-k}}=\sum_{l=0}^k{\sigma_1\choose l}(-1)^l\frac{\partial}{\partial z_{\sigma_1-k-1}}\circ\bar{\sD}^{\sigma_1-l-1}_t\circ\frac{\partial^l}{\partial t^l}\bar{A}\\ +\bar{\sD}_t\sum_{l=0}^{k-1}{\sigma_1\choose l}(-1)^l\frac{\partial}{\partial z_{\sigma_1-k}}\circ\bar{\sD}^{\sigma_1-l-1}_t\circ\frac{\partial^l}{\partial t^l}\bar{A}. \end{multline} Hence the recursion relation simplifies to \begin{equation} Q_{k+1}=\bar{\sD}_t(C_{\sigma_1-k+1})+(-1)^{k+1}\sum_{l=0}^k{\sigma_1\choose l}(-1)^l\frac{\partial}{\partial z_{\sigma_1-k-1}}\circ\bar{\sD}^{\sigma_1-l-1}_t\circ\frac{\partial^l}{\partial t^l}\bar{A}. \end{equation} This is precisely the form we have already derived, where $C_{\sigma_1-k}=\bar{\sD}_t(C_{\sigma_1-k+1})$. This implies that $C_{\sigma_1-k}=\bar{\sD}^k_t(C_{\sigma_1})$ for all $k$. Now, checking directly that \begin{equation} Q_1=-\partiald{\bar{p}}{z_{\sigma_1}}, \end{equation} by the recursion relation definition of the $Q_k$ we can conclude that $C_{\sigma_1}=0$, and hence all $C_{\sigma_1-k}=0$. Now we check the Cauchy characteristic PDE (\ref{CC PDE}) and find that \begin{equation} \begin{aligned} \,&(-1)^{k+i}\sum_{l=0}^{k-1}{\sigma_1 \choose l}(-1)^l\partialds{\,}{z_{\sigma_1-k}}{z_{\sigma_1-i}}\circ\bar{\sD}_t^{\sigma_1-l-1}\circ\frac{\partial^l}{\partial t^l}\bar{A}\\ \,&+(-1)^{k+i+1}\sum_{l=0}^{i-1}{\sigma_1 \choose l}(-1)^l\partialds{\,}{z_{\sigma_1-i}}{z_{\sigma_1-k}}\circ\bar{\sD}_t^{\sigma_1-l-1}\circ\frac{\partial^l}{\partial t^l}\bar{A}=0, \end{aligned} \end{equation} which simplifies to \begin{equation}\label{final form for proof} \sum_{l=i}^{k-1}{\sigma_1 \choose l}(-1)^l\partialds{\,}{z_{\sigma_1-k}}{z_{\sigma_1-i}}\circ\bar{\sD}_t^{\sigma_1-l-1}\circ\frac{\partial^l}{\partial t^l}\bar{A}=0. \end{equation} However, since $\bar{A}$ has dependence only on $t$ and $z_0$, the function $\bar{\sD}_t^{\sigma_1-l-1}\circ\frac{\partial^l}{\partial t^l}\bar{A}$ has no dependence on $z_{\sigma_1-i}$ for $i\leq l\leq k-1$, and hence equation (\ref{final form for proof}) is true. \end{proof} Theorem \ref{sufficiency} gives an entire class of examples of control systems that have the property that they admit ESFL reductions. So for the first time, we can now construct explicit examples of control systems that are CFL and hence DFL. One can in principle ask how such functions $p(z)$ arise from the reconstruction process of Anderson and Fels, and this will be a focus of later work. Furthermore, the author informally conjectures the following: \begin{conj} The \textit{only} examples of systems with ESFL reductions by codimension 1 partial contact curves must have $p(z)$ in the kernel of the truncated Euler operator and also satisfy truncated versions of identities relating higher order Euler operators to the total derivative operator. \end{conj} We mention that in Theorem \ref{sufficiency}, the requirement that the power of $\sD_{t,i}$ be no larger than $\sigma_i$ is necessary. Assume that \begin{equation} p(z)=\sD^{\sigma_1+1}_{t,i}(A). \end{equation} Then the reduction of the contact sub-connection fails to be ESFL. Indeed, applying the truncated Euler operator and using Corollary \ref{kernel cor}, we find that \begin{equation} \bar{\sE}_{\sigma_i}(\bar{p})=\bar{\sD}^{\sigma_i+1}_t\left(\partiald{\bar{A}}{z_0}\right). \end{equation} This violates Theorem \ref{necessity} of the previous section, which says that if $\bar{\mathcal{H}}_G$ is ESFL then $\bar{\sE}_{\sigma_1}(\bar{p})$ must be nonzero and have dependence only on $t$ and $z_0$. Recall Example \ref{so(5)} from Chapter 1: \begin{equation} \begin{aligned} \dot{x}_1=\frac{1}{2}(x_2+2x_3x_5),& \phantom{==}\dot{x}_2=2(x_3+x_1x_5),\\ \dot{x}_3=\frac{2(u_1-x_1u_2)}{1+x_1},&\phantom{==}\dot{x}_4=x_5,\\ \dot{x}_5=\frac{2(u_1+u_2)}{1+x_1}.&\, \end{aligned} \end{equation} This system is cascade feedback linearizable via a 1-dimensional symmetry group. This control system first appears in \cite{Cascade2}, where it was shown to be CFL, but not SFL or even EDFL by partial prolongation. The control system has a 1-dimensional control admissible symmetry group whose infinitesimal action is generated by the vector field \begin{equation} X_\Gamma=x_1\partial_{x_1}+x_2\partial_{x_2}+x_3\partial_{x_3}+u_1\partial_{u_1}+\frac{x_1u_2-u_1}{1+x_1}\partial_{u_2}. \end{equation} The associated quotient system is SFL, and thus we can use Theorem \ref{control reconstruction} to transform the system into a contact sub-connection: \begin{equation} \gamma^G=\left\langle\theta^i_0,\theta^i_1,d\epsilon-\frac{2(z^2_1)^2-z^2_1z^1_1-z^1_0}{z^2_1z^1_0-2}\,dt\right\rangle,\text{ for }i=1,2. \end{equation} Notice that in $\gamma^G$ the $p(z)$ term is given by \begin{equation} \begin{aligned} p(z)&=\frac{2(z^2_1)^2-z^2_1z^1_1-z^1_0}{z^2_1z^1_0-2}\\ \,&=\frac{2(z^2_1)^2-z^1_0}{z^2_1z^1_0-2}-\sD_{t,1}\ln(z^2_1z^1_0-2). \end{aligned} \end{equation} Looking at the hypotheses of Theorem \ref{sufficiency} we see that $p(z)=A_0+\sD_{t,1}(A_1)$, where \begin{equation} A_0=\frac{2(z^2_1)^2-z^1_0}{z^2_1z^1_0-2}\\ \end{equation} and \begin{equation} A_1=-\ln(z^2_1z^1_0-2). \end{equation} The $A_0$ and $A_1$ terms both have dependence on $z^1_0$, but not on any higher order terms, i.e. $z^1_1$ or $z^1_2$. Thus if we reduce by codimension 1 partial contact curves that annihilate $\theta_0^2$ and $\theta_1^2$, then by Theorem \ref{sufficiency} we should expect the resulting control system to be ESFL. This reduction can be described by setting $z^2_0=g(t), z^2_1=\dot{g}(t),\text{ and }z^2_2=\ddot{g}(t)$. We then find that \begin{equation} \bar{\gamma}^G=\left\langle\theta^1_0,\theta^1_1,d\epsilon-\frac{2(\dot{g})^2-\dot{g}z^1_1-z^1_0}{\dot{g}z^1_0-2}\,dt\right\rangle. \end{equation} Additionally, if we compute $\bar{p}(z)$, then we can determine $Q_{\sigma_1+1}=Q_{3}$. Using Lemma \ref{reduced}, we obtain \begin{equation} \begin{aligned} \bar{p}(z)&=\frac{2(\ddot{g})^2-z^1_0}{\dot{g}z^1_0-2}-\bar{\sD}_t\ln(\dot{g}z^1_0-2)+\frac{\ddot{g}z^1_0}{\dot{g}z^1_0-2}\\ \,&=\frac{2(\ddot{g})^2+(\ddot{g}-1)z^1_0}{\dot{g}z^1_0-2}-\bar{\sD}_t\ln(\dot{g}z^1_0-2),\\ \end{aligned} \end{equation} and so by Lemma \ref{EOQ} we can conclude that \begin{equation} \begin{aligned} Q_{3}&=-\bar{\sE}_2(\bar{p})\\ \,&=\frac{2\dot{g}\ddot{g}^2+2(\ddot{g}-1)}{(\dot{g}z^1_0-2)^2}. \end{aligned} \end{equation} Hence the choice of partial contact curve that permits $\bar{\gamma}^G$ to be ESFL is generic. To see this, notice that $g(t)$ cannot be a solution of $\dot{g}\ddot{g}^2+\ddot{g}-1=0$. Indeed, if $g(t)$ is a solution to $\dot{g}\ddot{g}^2+\ddot{g}-1=0$, then $Q_{\sigma_1+1}=0$. But this contradicts that $\bar{\mathcal{H}}_G$ is bracket generating because of (\ref{Qn+1 not 0}) in Proposition \ref{PDE form}. \subsection{Final Thoughts and Future Work} We conclude this thesis by highlighting the importance of the results in Chapter 4 in relation to the theories of CFL and EDFL control systems. Recall that Theorem \ref{CFL is EI} says that CFL systems are explicitly integrable; however, Proposition \ref{EI iff EDFL} from Chapter 1 says that a control system is explicitly integrable if and only if the control system is EDFL. Therefore it is sufficient to prove that a control system is CFL to determine that it is EDFL. In fact, given a CFL control system, \cite{Cascade2} gives an explicit way to produce an EDF linearization of the associated contact sub-connection. In light of the relationship between CFL and EDFL control systems, we then realize the importance of Theorem \ref{sufficiency}. It produces an entire class of control systems that are \textit{known} to be EDFL. Furthermore, Theorem \ref{necessity} imposes a strong necessary condition on a contact sub-connection to have an ESFL partial contact curve reduction and gives an indication about which contact coordinates should be reduced to arrive at an ESFL reduced system. These are both important results for the goal of completely classifying all control systems with symmetry that are EDFL. Thus, with the main reults of this thesis in mind, we are suddenly presented with a number of natural questions and conjectures to investigate in order to further complete a general theory of CFL control systems. \begin{Q} Can Theorems \ref{necessity} and \ref{sufficiency} be extended to necessary and sufficient conditions on the unreduced function $p(t,z)$ in the contact sub-connection? Or stated differently, can we classify \textit{all} functions $p(t,z)$ that correspond to EDFL contact sub-connections? \end{Q} The author believes this can be achieved by exploring truncated versions of more identities and operators from the calculus of variations. Namely, establishing an insightful relationship between the reduced truncated Euler operator $\bar{\sE}_{\sigma_1}$ and the non-reduced truncated Euler operator $\sE_{\sigma_1}$ in a similar manner to Lemma \ref{reduced} for the truncated total derivative operator. \begin{Q} At least in the case of codimension 1 contact curve redutions, can the results of this thesis be extended to similar theorems for control systems with control admissible symmetry groups of dimension greater than 1? \end{Q} The author believes this is also possible. Careful examination of procedure \textbf{contact} ought to reveal any additional obstructions to ESF linearizability of the reduced system. This will also be the content of future work by the author. \begin{conj} If a contact sub-connection is ESFL via a codimension $s>1$ partial contact curve reduction, then the contact sub-connection must have a codimension 1 partial contact curve reduction that is ESFL. \end{conj} This conjecture is of central importance to the theory of CFL control systems. If true, the conjecture would mean that classifying all contact sub-connections that possess an ESFL partial contact curve reduction would be reduced to understanding the phenomenom of ESFL partial contact curve reductions to control systems of a single input. One example for which this conjecture holds true is the BC system. If one further reduces the reduced contact sub-connection (\ref{BC reduced}) with $z_0^2=g(t), z_1^2=\dot{g}(t)$ for an arbitrary $g(t)$ then the resulting control system with one control is ESFL. Additionally, the author has recently had some insight about the following: \begin{conj} In the case that $\dim G=1$, if a contact sub-connection is EDFL by partial prolongation, then it must admit an ESFL codimension 1 partial contact curve reduction. \end{conj} The key idea here has to do with the fundamental bundle from procedure \textbf{contact}. One can also investigate other aspects of CFL control systems related to a control admissible symmetry group. Interestingly, there appears to be little connection between the algebraic structure of the control admissible symmetry groups and whether or not control systems are CFL. However, the \textit{representation} of a Lie group of control admissible symmetries in the diffeomorphism group of the manifold of time, states, and controls for the control system \textit{does} appear to have an impact. This is seen in Theorem \ref{lifted solutions} in Chapter 3, where the equation of Lie type is constructed precisely from the \textit{action} of $G$ on $M$. From this perspective, the explicit form of the contact sub-connection in Theorem \ref{sufficiency} seems to hint at some kind of prolongation structure for the action of $G$ on $M$. The author hopes that research in this direction will help shed light on the following conjecture. \begin{conj} If a control system with control admissible symmetry group is EDFL, then it must be CFL. \end{conj} Although algebraic properties of the control admissible symmetry group seem to be mostly irrelevant, one algebraic structure that is known to play a role is solvability. This property eases finding first integrals for the group action, for example. Another interesting structure to investigate is the relationship between two CFL reductions of the same control system $\omega$ with control admissible symmetry groups $G$ and $H$ such that $H<G$. If $H$ is normal in $G$, then $\omega/G=(\omega/H)(G/H)$, which is found in \cite{AndersonFelsBacklund}. \begin{Q} Let $\omega$ be a control system with two control admissible symmetry groups $G$ and $H$ such that $H<G$. If $\omega/G$ and $\omega/H$ are ESFL, then what can be said about ESFL partial contact curve reductions of $\gamma^H$ and $\gamma^G$? \end{Q} The author intends to present some results concerning this question in a forthcoming work. One can also consider extensions of CFL theory of control systems to cases in which quotient systems are not ESFL. \begin{Q} Assume that $\omega$ is a control system with 2 controls and that it possesses a control admissible symmetry group $G$. If the dimension of $G$ is such that the quotient system $\omega/G$ is a control system of 3 states and 2 controls, then the work of \cite{Wilkens3s2cEquiv} allows one to find a normal form for $\omega/G$ via a SF transformation. Can one then construct a theory analagous to that of CFL systems? That is, can one construct a ``contact" sub-connection $\delta^G$ along with some variation of ESFL contact curve reductions of $\delta^G$? \end{Q} Naturally, this leaves behind the question of explicit integrability, but in principle, if one can perform such a ``generalized" CFL process, then further avenues of control system classification present themselves. The questions and conjectures above are by no means an exhaustive list of possible directions for future research. One could envision studying global phenomena or incorporating topological questions along the lines of $h$-principles, for example. One may even be able to build analagous versions of CFL theory for \textit{PDE} control systems or combine the theory of CFL system with mixed discrete or stochastic control processes, although these latter subjects are (currently) beyond the expertise of the author. Overall, this thesis presents a thorough treatment of the geometric theory of cascade feedback linearizable control systems. Furthermore, it adds to that theory by presenting new examples, new theorems, as well as brand new connections to operators that are related to the calculus of variations. The theory of CFL control systems is still far from complete but seems to offer many different avenues of interesting research. Finally, the author hopes that this theory will find itself useful in applications to concrete scientific and engineering problems. \bibliographystyle{plain} \nocite{*}
\section{Introduction} \input{sections/introduction.tex} \input{sections/relatedwork.tex} \input{sections/background.tex} \input{sections/methodology.tex} \input{sections/results.tex} \input{sections/conclusion.tex} \bibliographystyle{apalike} \section{Background} \label{sec:background} Our focus in Part I was to present the theoretical foundation needed to transform the defining objects of a shift invariant space (a lattice and a basis function) into a form that can easily be translated into an implementation --- it is assumed that the reader has a good notion of the content and background presented in that work~\cite{part1}. The translation into LLVM is the focus of this paper. In the prequel, our analyses provided us with a shift invariant structure over a lattice; in specific, we concluded with a shift invariant polyhedral region of evaluation, and a dissection of the region of evaluation into sub-regions of evaluation. One only needs to consider a single space-tiling region of evaluation since, by definition of a shift invariant space, every other region of evaluation is related by a shift. Each sub-region contains a polynomial and a set of lattice sites. The data at these lattice sites are components of the polynomial belonging to each sub-region and the polynomial dictates how to reconstruct a value in a given sub-region. Figure~\ref{fig:ex1} visualizes all these components. \begin{figure}[t] \centering \begin{subfigure}{0.25\textwidth} \includegraphics[scale=1.6]{images/2d/ex1_cont.pdf} \end{subfigure} \begin{subfigure}{0.74\textwidth} \centering \begin{tabular}{cccc} Sub-region & Polynomial & Transform \\ \hline \hline 1 & \makecell{ $\frac{1}{4} \, {\left(2 \, c_{0} - c_{1} - 2 \, c_{2} - c_{3} + c_{4} + c_{6}\right)} x_{0}^{2} + $ \\ $ \frac{1}{4} \, {\left(c_{1} - 2 \, c_{2} + c_{3} + c_{4} - 2 \, c_{5} + c_{6}\right)} x_{1}^{2} +$ \\ $ \frac{1}{2} \, {\left({\left(c_{1} - c_{3} - c_{4} + c_{6}\right)} x_{0} - c_{1} + c_{3}\right)} x_{1} + $ \\ $ \frac{1}{8} \, c_{0} + \frac{1}{8} \, c_{1} + \frac{1}{2} \, c_{2} + \frac{1}{8} \, c_{3} + \frac{1}{8} \, c_{5} -$ \\ $ \frac{1}{2} \, {\left(c_{0} - c_{5}\right)} x_{0}$} & None \\ 2 & Reference to sub-region 1 & $\circlearrowright 90^\circ$ \\ 3 & Reference to sub-region 1 & $\circlearrowright 180^\circ$ \\ 4 & Reference to sub-region 1 & $\circlearrowleft 90^\circ$ \\ \hline \end{tabular} \end{subfigure} \caption{The image on the left continues the example from Part I, showing the sub-region decomposition for the ZP-element~\cite{part1}. The square region in the center is the region of evaluation; it is subdivided into the sub-regions of evaluation, labelled 1-4. The coefficients $c_0$ to $c_6$ denote the lattice sites that contribute to a reconstruction in sub-region 1. The table on the right details the relationship between sub-regions --- the transformation is generally affine, however in this case we do not need to make use of any shift. Sub-regions with no transform are {\rm reference} sub-regions, in this example there is only one. However, in general a spline may emit more than one reference sub-region (e.g. the cubic spline on the FCC lattice~\cite{kim2008box}). } \label{fig:ex1} \end{figure} Very often in practice, the splines we use on a given lattice are symmetric, at least in dimensions 1 to 3 --- this helps encourage reconstruction spaces to capture frequency content more evenly in all directions. This is because the underlying shift invariant space inherits, partially, the symmetry of the basis function --- in reality, the symmetry of the underlying space is a combination of the symmetry of the lattice and the basis function. This symmetry is a tool that allows us to write different sub-regions in terms of each other --- relating them by rigid body transformations, thereby allowing us to reduce the amount of polynomials stored for each sub-region. For most splines used in visualization, we only require one distinct polynomial, this polynomial is then used to reconstruct values within each sub-region (after an appropriate change of variables). As such, we also store this auxiliary information. That is, if there exists a rigid body transformation that takes one region into another, we only store that transformation. The above representation is generic and independent from the machine on which we will implement said scheme. This is advantageous because it allows for further simple processing of the spline space. One may easily take derivatives of the polynomials within sub-regions to obtain gradient estimates (note that the symmetry analyses still apply even for derivative computation). This can be taken further to compute the Hessian, provided the spline is smooth enough. One may also transform these polynomials into forms that are more convenient for evaluation, i.e. Horner form, or Berstein B\'{e}zier (BB) form. A na\"ive approach, provided this representation, would be to represent each polynomial into a specific form --- BB-form for example --- then implement an algorithm to perform that style of polynomial evaluation. For polynomials in BB form, the algorithm would be De CastleJau's algorithm. However, the algorithm we choose may be inappropriate for a given machine. For example De CastleJau's algorithm is recursive, which is difficult to implement on GPU architectures --- this can, in part, be alleviated by unrolling the recursion. Another downside of simply using De CastleJau's algorithm is temporary space usage. Temporary space usage is bound by the number of terms in the BB form (i.e. the degree of the polynomial). On modern CPU architectures, this space is allocated on the stack, which resides in main memory, but is likely aliased to cache for fast access. On the GPU, temporary storage space often means increasing register allocation for a program, which can drastically reduce the amount of parallelism available for the program. Alternatively, higher temporary storage needs may cause registers to ``spill'' into global memory, requiring global memory accesses which are very slow. Moreover, polynomial evaluation is only one part of the reconstruction scheme, there is also the preamble of determining which region and sub-region of evaluation a point resides in prior to reconstruction. This must be accounted for --- there is overhead in looking up the properties of a given reconstruction space and delineating what is to be done in certain cases. The approach we take is to generate implementations rather than provide a single implementation that takes a lattice and a basis function as parameters. This allows us to reduce some amount of overhead by ``baking'' information into the generated code. For example, we are able to remove the (small) cost associated with looking up member variables, hard-code any logic that may need to be applied for a specific basis function or lattice, and unroll loops as necessary. This is similar to template meta-programming in C++ which, in part, exists to take advantage of such optimizations. Code generation also allows us to replace certain components of our pipeline with other implementations. For example, we may pull out the Horner polynomial evaluation and replace it with De Castlejau's algorithm. We avoid doing so in this work, since Horner schemes have low temporary storage requirements and are easily unrollable. There are also many options for decomposing and pipelining a Horner scheme, which we also extensively explore --- the same treatment for De Casteljau's algorithm is outside the scope of this paper. \subsection{Machine Architecture} One simple approach to code generation is to choose a popular language, such as C, as a target language, then create ``templates'' for specific parts of the reconstruction function. For example, one component may be to determine the region of evaluation, whereas another may be to evaluate a given polynomial. In our experience, this becomes messy quite quickly, the amount of cases one must write and test is fairly large. Moreover, the template code becomes unreadable quickly. This approach also lacks elegance; we would start with a low level description of the spline space, then generate high level code, which must be processed by a compiler to produce low level code. A more elegant approach is to directly generate a low level representation. Thus, we emit code to LLVM intermediate representation (LLVM-IR) directly; this has the benefit of being low level but still platform and machine agnostic. One must, however, take into account {\em some} differences in machine architecture when generating code. According to Flynn's taxonomy~\cite{flynn1972some}, there are four main classes to computer architecture. The two of interest to us are {\em single instruction single data} (SISD) machines in which each operation operates on at most one element of data, and {\em single instruction multiple data} machines (SIMD) in which an operation may operate over multiple elements of data. The other two main distinctions: {\em multiple instruction multiple data} (MIMD) and {\em multiple instruction single data} are not as relevant --- from the perspective of a compute thread, instructions are either SISD or SIMD. Figure~\ref{fig:machineex} show the differences between the two. \begin{figure}[t!] \centering \includegraphics[scale=0.7]{images/flynn.pdf} \caption{An example of the difference between SISD and SIMD architecture. Here, $n$ is the vector length, and as a single operation is applied to the operands $a$ and $b$, this operation is applied in parallel to all elements of $a$ and $b$.} \label{fig:machineex} \end{figure} Most modern CPUs are super-scalar machines, that is, they perform instruction level parallelism --- many operations may be in flight at any given time. For example, a memory fetch may appear early in an instruction stream, but may only be required near the end of the stream; the CPU may commit this to the memory controller and move on to the next instruction, only stalling once the required memory access is actually needed and has not finished yet. This is in contrast to traditional scalar architectures, in which instructions are strictly executed in order and have predictable execution times. From the perspective of a thread, most contemporary CPUs are SIMD machines, whose SIMD instructions are vectorized SISD instructions. \subsection{GPU Architecture} GPUs have historically been fixed function multi-processing units dedicated to triangle rasterization --- that is, a single GPU contained a large amount of cores dedicated to transforming and projecting triangles onto a planar display. This allowed for a high level of paralellism for the task of rasterization. However, as the graphics pipeline became more programmable through the use of different types of shaders, GPUs eventually became general purpose computing devices. Modern GPU architectures are more akin to general purpose SIMD machines with wide instruction lanes --- a single instruction on a GPU will operate on 32 to 64 elements of data, depending on the manufacturer. While this is true at the hardware level, the programming model presented by GPU manufacturers is that each lane of execution corresponds to a lightweight ``thread''. From the perspective of each thread, the instruction stream is largely SISD. Again, historically practitioners have taken advantage of the parallelism offered by GPUs through OpenGL shaders. Shaders in OpenGL are small programs that execute on the GPU and operate element wise over data: pixels, vertices and/or triangles. However, this quickly became insufficient for general purpose computing on the GPU (GPGPU). This was for various reasons, but one pressing reason was the lack of fine grained control over hardware resources. NVIDIA first offered a solution to this, CUDA, which provided better control over (and access to) the underlying hardware. Programs in CUDA are known as CUDA kernels and execute element-wise over data. CUDA code runs on CUDA devices, these devices contain their own address space and are connected to a host via a PCI-e bus. Data and programs must be uploaded across the PCI-e bus prior to execution. Once a kernel is completed, the results of the computation must be again copied off the device into host memory. The basic unit of execution in CUDA is a thread; threads are collected in groups of 32 called warps. Warps execute programs in lockstep and share the resources of a streaming multiprocessor (SM) --- that is, an SM has a set of registers that are allocated to each thread in a warp; based on the problem one wishes to solve, more or less registers may be required. Threads in a warp may communicate with each other at the register level, and may use fast local shared memory to communicate with other threads within the same block. The amount of shared memory and registers allocated per thread may be so that it is not possible to schedule a warp on each core of a SM at any given moment. The ratio of active warps to total number of possible warps active is known as occupancy. Generally, one wishes to maximize occupancy to make the best use of resources on a given SM, but it is not always possible to do so. Grids are collections of blocks and are the most coarse grain level of problem decomposition. For example, to render an image, we may break it up into chunks of 8x8 pixels, or a total of 32 pixels. This would correspond to a block size of 64 (block sizes must be multiples of the warp size, i.e. 32). There is no guaranteed order in which blocks complete --- for the example above completion order is irrelevant, one simply needs to ensure that all blocks are completed before the image is displayed. If synchronization is needed between blocks, then one must synchronize by waiting for the current kernel to finish, then launching a new kernel\footnote{Although block level synchronization is supported through cooperative groups in CUDA 9 and above.}. Since GPU cores are SIMD machines at the hardware level, one potential difficulty with the lightweight thread model of CUDA is branching --- what are threads (i.e. SIMD lanes) to do when a branch occurs? Provided all threads take the same path for a branch, then there is no issue. If threads within a warp take different paths at a branch, then those threads are disabled and revisited later. This is known as branch divergence. This is something one generally wishes to avoid, at least for long runs of instructions. This can be dealt with by algorithm design or branch predication. From the perspective of an application running on the GPU, to compute a value from an interpolation scheme as fast as possible, one may be tempted to distribute computation along each lane of a warp in terms of SIMD threads. However, this approach makes little sense, as applications are likely demanding reconstructions on a per thread basis. Thus it makes more sense to create optimized SISD instruction streams along every lane. However, taking the same observation into account for code on the CPU, again each thread is likely going to correspond to one element of the problem, but each thread also has access to SIMD vector instructions. Additionally, one must take care to use the appropriate memory fetch --- on a GPU texture fetches are spatially cached, and one must take care to organize memory reads to take advantage of this. Of course NVIDIA is not the only GPU vendor, AMD also produces comparable GPUs, but the eco-system for developing GPGPU applications on AMD has been limited to OpenCL until recently with HIP. The concepts in OpenCL are very similar to those in CUDA --- the concept of a warp translates to that of a wavefront (which is a collection of 64 threads); block translates to work group; and grid translates to overall problem size. Another subtlety of GPU compute applications is that bandwidth is a more prominent serious concern. Since compute throughput is high, GPUs must be able to read and write data to memory at comparable rates. To facilitate this, the best performance is achieved when memory access patterns are simple. CUDA provides a programmer with various different levels of memory. The first is a register; registers which are accessible to a thread. The next level is constant memory and shared memory, then global memory. Each is an order of magnitude slower than the last. \subsection{LLVM} Shifting a performant implementation of any algorithm to a different architecture can be a daunting task. In that respect LLVM is a powerful tool. One of the core components of LLVM that helps facilitate this is LLVM-IR, a low level assembly-like language targeting a fictional virtual machine. This representation is in single static assignment (SSA) form. That is, values are assigned to output variables, then those variables cannot be modified, and may only be used as inputs in subsequent operations. While LLVM-IR can be interpreted and therefore explicitly executed, doing so is only advisable when the LLVM tool-chain does not support code generation on a specific architecture; the intention of LLVM-IR is to be translated into machine code of a given architecture. This can either be linked into an executeable at compile time, or linked into a running executable on-the-fly (i.e. just in time or JIT compilation). \begin{figure} \centering \includegraphics[scale=0.7]{images/LLVM.pdf} \caption{A high level overview of the LLVM ecosystem, including our analysis and code generation contributions. The * in the LLVM optimization passes denotes that they are optional.} \label{fig:llvmhl} \end{figure} In terms of code generation, it is the responsibility of the {\em backend} translator to take LLVM-IR and generate machine code. For the most part, the job of a backend translator is to assign registers and stack space to operands and results, as well as translating LLVM-IR instructions to the target machine's architecture. Prior to final compilation, LLVM also provides many optimization passes --- these passes transform LLVM-IR into optimized LLVM-IR. The decision to implement optimization passes at the level of LLVM-IR reduces the complexity of compilers producing LLVM-IR (also known as {\em frontends} for LLVM; frontends need not worry too much about optimization. Figure~\ref{fig:llvmhl} shows how the frontend, optimization passes, and backend relate, as well as where our works fit into the LLVM ecosystem. LLVM is a natural complement to the CUDA ecosystem. CUDA similarly provides a low-level machine abstraction, the parallel thread executable (PTX) environment. PTX code reads very much like LLVM-IR however with more low-level constructs that expose certain features of the hardware to a developer (thread communication primitives, for example). PTX and LLVM are similar in their goals --- PTX exists as a means of representing shader/compute code in a low-level format, yet still affords some platform agnosticism. Again, PTX code is written from the perspective of a single thread, so translating LLVM-IR to PTX is relatively straight-forward. Final register allocation, grid size, and block size will be determined by the CUDA run-time, and is independent of the LLVM-IR/PTX representation of the code. In the next section, we detail how we use LLVM to translate each component of a reconstruction space into LLVM-IR, and the different variations on how each component is parameterized. \section{Conclusions, Limitations and Future Work} Long has the belief been held that non-Cartesian methods are impractical because they introduce additional complexity and unacceptable computational overhead. First of all, this is not true in general, we have explicitly shown in this work that there are cases in which non-Cartesian splines out perform Cartesian splines. The matter is more nuanced than it appears, and depends on many factors including machine architecture, polynomial representation, pipelining, to name a few. Thanks to modern advances in GPU technology and theoretical frameworks (i.e. thi s work) we claim that the overhead for non-Cartesian interpolation is now negligible on the GPU. We should be clear, we are not stating that there is no overhead to non-Cartesian splines, there clearly is in certain cases, but we are at a point where raw computation is cheap enough to use such methods. We also show good performance on the CPU as well, but the sentiment against non-Cartesian methods has not seemed as strong for CPU based implementations in the literature. Additionally, by using the results from our previous work in Part I~\cite{part1}, and proposing a framework for generating efficient cross-platform implementations of spline spaces, we lift the burden of implementation away from the practitioner. While these results are likely not the absolute fastest possible, our methodology is applicable to a large number of splines, including splines that are very difficult to implement and have not received any form of an efficient implementation in the literature (i.e. the Voronoi Splines). Our code generation framework includes a small set of tune-able parameters that impact performance. In exploring these, we exposed the effect of these parameters on performance. Moreover, we showed that parameter choice affects performance differently depending on architecture --- this affords a practitioner more options in tuning performance on a given architecture, as it is clear that one evaluation scheme is not guaranteed to attain optimal performance over all possible compute architectures. We also provide a reference implementation of both Part I and II~\cite{fastsplinegit}. Future work is devoted to investigating alternative polynomial representations, increasing the class of interpolants to which this work is applicable (i.e. to extend beyond polynomial interpolants), incorporating gradient computations and applying additional heuristics to accelerate tensor product forms. \section{Experiments and Results} \label{sec:results} To validate the performance of our method and demonstrate the utility of our parameterization, we measure the average ``speed'' of our generated code for various cases. In this context, we take ``speed'' to mean the average number of point-wise reconstructions one may perform per second. We do this for all valid combinations of pipeline depth, maximum fetch count and, when appropriate, branch behaviour. We also collect and report the variance associated with each experiment when possible. We performed our tests over three different architectures: x86\_64, ARM, and CUDA. All of our x86\_64 tests were performed on a Ryzen 9 3900X clocked at 3.8GHz with 64GB of DDR4 RAM running at 3200 MHz. Our ARM test cases were run on a Raspberry-Pi 4 (i.e. a Cortex-A72 at 1.5GHz and 4GB of RAM). Finally, we ran our CUDA tests on an RTX 3090 with 24GB of RAM. We ran our tests over the CC, BCC and FCC lattices; in each case, the lattices are chosen so that they occupy approximately the same amount of memory. More explicitly, the CC lattice has dimension $128\times128\times128$, the BCC lattice $202 \times 202 \times 202$ (but with the non-BCC points discarded) and the FCC has dimension $161\times161\times161$ (again, with the non-FCC lattice sites discarded). Lattice size is chosen so that it does not fit completely in the fastest cache memory on any given device. The lattices are chosen with roughly equivalent sizes so as to ensure one does not have an advantage over the other. The average reconstruction time and variance are visualized as lower diagonal matrix plots, where the group size is presented along the x-axis and the pipeline depth along the y-axis; see Figure~\ref{fig:order2} as the simplest example. Experiments on x86\_64 and ARM measure both mean reconstruction time and variance. For the visualizations of the CUDA results, we are unable to collect the variance on a per-reconstruction basis, as CUDA batches reconstructions in groups. In these cases we omit the variance. CUDA also provides a linear texture fetch, in which case we report timing results with that optimization present --- however, when using a linear texture fetch, the concept of a group size no longer applies, as fetches are forced into groups as determined in Part I~\cite{part1}. This also limits maximum pipeline depth, as many coefficient reads may be combined into one. Additionally, linear fetches are not compatible with branch predication, as part of the texture fetch relies on computing terms of the polynomial withing a sub-region, thus, for cases in which branch predication is used, no results are presented for the linear fetch trick. \subsection{Box Splines} In this experiment we look at some of the box-splines found in the scientific visualisation literature --- we omit splines that emit a Cartesian coset decomposition (i.e. those that are effectively a sum of splines on two or more shifted grids). We do this for box-splines of order 2,3 and 4. \begin{figure}[h] \centering \includegraphics[width=0.95\linewidth]{experiments/order2.pdf} \caption{Timing results for second order splines. Each square cell in the plot refers to code that has been generated with a specific value for ``pipeline depth'' and ``group size''. The mean reconstruction speed is averaged over $10^6$ trials at random locations in the volume. GPU results have no variance collected, but do include timing results for cases in which a linear texture fetch has been used to group multiple reads together. } \label{fig:order2} \end{figure} Figure~\ref{fig:order2} compares second order box-splines. There are only two cases in the literature to consider, the BCC Linear spline~\cite{entezari2004linear} and the tensor-product linear spline. Between architectures one sees orders of magnitudes of speed differences. The ARM results are the slowest, being orders of magnitude slower than x86\_64 --- an expected result, since the Ryzen 9 is fabricated at a lower process node, includes features like branch prediction and out of order execution that are not present on the ARM chip, and is clocked higher than the Cortex CPU. The CUDA code also performed orders of magnitude faster than the x86\_64 code. Again, this is expected, since the raw parallel compute capability of the RTX 3090 is many orders of magnitude higher than that of the Ryzen 9. The linear rhombic dodecahedon box-spline requires only four memory lookups and has a relatively simple polynomial representation compared the the tri-linear interpolant, which requires eight memory lookups and includes more terms in its polynomial representation. In our ARM tests, as expected, the linear rhombic dodecahedron spline to outperforms the tri-linear. This is a trend that is seen in the ARM code, but not the x86\_64 or GPU code. This discrepancy is likely due to the fact that there is slightly worse data locality on the BCC lattice compared to the CC --- splitting lattice cosets into separate textures has the side effect of reducing data locality. For both test splines, one sees no benefit in making use of a linear fetch. This is strange for the tensor product linear spline on the CC lattice, as the linear texture fetch is natively implemented in hardware on the card. However, our framework is not intelligent enough to simply replace this case with a single texture fetch instruction; there is a small amount of overhead in the preamble which likely leads to this case under-performing. \begin{figure}[t] \centering \includegraphics[width=0.95\linewidth]{experiments/order3.pdf} \caption{Timing results for third order splines. The FCC Cubic Truncated Octahedron spline~\cite{kim2008box} emits a decomposition that requires either branch predication or branching, labelled as ``branchless'' and ``branchy'' respectively.} \label{fig:order3} \end{figure} Figure~\ref{fig:order3} compares third order splines. This marks the first experiment in this work in which we see the use of branch predication --- the FCC cubic truncated octahedron box-spline has two representative sub-regions~\cite{kim2013efficient}, which necesscitates either a branch or branch predication. In this case, for both CPU results we see the FCC cubic spline readily outperforming the tensor product quadratic on the CC lattice. This is likely due to the simple fact that the FCC cubic spline has many fewer points in its support. Requiring fewer memory accesses on a CPU architecture where arithmetic is cheap would lead to all-around better performance. The use of branching provides insight into the effect of support size on reconstruction speed. When branching is disabled, reconstruction with the FCC cubic spline requires approximately twice the amount of computation, but this does not amount to doubling of the reconstruction time when compared to the case in which branching is enabled. This suggests that memory bandwidth has a bigger effect on reconstruction time than raw compute requirements do. This observation is present in both CPU results, but is exaggerated on x86\_64 which is likely due to its superior arithmetic performance in general. It is difficult to make a similar observation from the GPU results in this case, we will touch more on the effect branching has on the GPU when we look at the Voronoi splines, but in this specific case branching provides a tangible benefit in reconstruction speed, but only for certain parameter combinations, on average it seems to hurt performance. The tensor product quadratic spline has some interesting discrepancies. Between different CPU architectures, there is a vast difference in the effect of the group size and pipeline depth. Specifically for the ARM CPU, after a group size of 1, increasing the group size leads to better performance, but it is the opposite on the x86 CPU. However, both attain their best performance when group size is 1. Between the two splines, we see the spline with smaller support (the FCC cubic) outperforming the tensor product spline on both CPU architectures. However, we see the FCC cubic spline under-performing on the GPU, again, likely due to memory locality. However, the performance of the best case FCC cubic code is similar to the best case tensor product quadratic. In both test splines, introducing a linear fetch hurts performance. \begin{figure}[t!] \centering \includegraphics[width=0.85\linewidth]{experiments/order4.pdf} \caption{Timing results for fourth order splines.} \label{fig:order4} \end{figure} Figure~\ref{fig:order4} compares fourth order splines.~\cite{entezari2006extensions}. Most cases echo observations seen for the third order splines. The notable exceptions are certain GPU results. The tensor product cubic spline on the CC lattice marks the first instance in which the linear fetch trick improves performance. This is unsurprising, as we reduce 64 fetches to 8 via the linear fetch trick in this instance. This experiment also marks the first time a non-Cartesian spline outperforms equivalent order Cartesian splines --- both splines on the BCC lattice outperform the fourth order splines on the CC lattice, with the BCC quartic spline being fastest in all cases. \subsection{Voronoi Splines} The Voronoi splines are important test cases as they provide the same support size and order on all 3D lattices. As such, we consider them the most fair comparison to the tensor product splines on the Cartesian lattice (which are exactly the Voronoi splines for the Cartesian lattice). Figure~\ref{fig:voronoi2} shows the performance results for the second order Voronoi splines. In general, on the both the CPU and GPU, the non-Cartesian Voronoi splines perform on par with the tensor product linear spline (see Figure~\ref{fig:order2} as a comparison) when branchy code is generated --- they perform on the same order of magnitude with a small speed penalty likely due to the additional non-separability of their polynomial regions and memory incoherence. The effect of branching on the CPU code in this case is consistent with the observations for the FCC cubic box spline. This is many orders of magnitude faster than what is reported in the original Voronoi spline paper, in which it is cited that their renders took many days to complete~\cite{mirzargar2010voronoi, mirzargar2011quasi}. On the GPU, the effect of branching is inconclusive. The second order BCC spline is hurt by allowing branches (on average), however the second order FCC spline is aided by the addition of branches (on average). Enabling linear fetches reduces performance. \begin{figure} \centering \includegraphics[width=0.95\linewidth]{experiments/voronoi_2.pdf} \caption{Timing results for the second order Voronoi splines. The results on the left were generated on an x86 machine, whereas the results on the right were generated on an ARM machine. } \label{fig:voronoi2} \end{figure} Figure~\ref{fig:voronoi3} shows the performance for the third order Voronoi splines. On the CPU, the best case branchy code is roughly on par with the third order tensor product spline (see Figure~\ref{fig:order3}). The performance is significantly worse than the branchy case. The likely reason for this is the 7 unique sub-region polynomials the must be predicated on each evaluation. This leads to an excess of additional work that must be performed on each evaluation. On the GPU, branching increases performance on the FCC lattice on average, and reduces performance on the BCC lattice (on average). However, the best GPU performance on the BCC lattice is attained when branching is enabled. Additionally, the best performanceon the BCC lattice is on the same order of magnitude as the best performance on the FCC lattice (albeit a small factor slower). Both results are an order of magnitude slower than the GPU code for the third order tensor product spline on the Cartesian lattice (Figure~\ref{fig:order3}). Figure~\ref{fig:vorsum} shows a summary of the {\em best} performance of the different Voronoi splines (on their native lattices) on different architectures. Notably, the ARM experiments shows better relative performance on the BCC and FCC lattices compared to the x86\_64 implementations. This is likely because the ratio of compute to memory bandwidth is higher on the ARM chip --- that is, the ARM implementation has more time to "compute" while waiting for memory fetches to return. Compared to the x86\_64 implementation in which the compute to memory bandwidth ratio is much lower. This would also imply that the Quadratic polynomial that is being evaluated is somehow more complicated than those for the Voronoi spline. This would imply that more work must be done to compute the Quadratic tensor product spline than the other Voronoi splines, which is counter intuitive, since tensor product splines are notably more simple than their non-separable counterparts. Keep in mind that we expand the tensor product representation, then use a greedy Horner factorization for evaluation, which leads to more work than the original tensor product representation would have. The GPU has a higher compute to memory bandwidth ratio, but gets penalized heavier for more complicated memory reads. Moreover, this better compute to bandwidth ratio gets consumed by the branch predication, which must waste up to 7$\times$ the computation for evaluation on the BCC lattice. \begin{figure} \centering \includegraphics[width=0.95\linewidth]{experiments/voronoi_3.pdf} \caption{Timing results for the third order Voronoi splines. } \label{fig:voronoi3} \end{figure} \begin{figure} \centering \includegraphics[width=0.95\linewidth]{experiments/voronoi_summary.pdf} \caption{Best performance for Voronoi, each bar shows the relative performance to the "baseline" Cartesian Voronoi spline. } \label{fig:vorsum} \end{figure} \subsection{Overall remarks} Overall, the parameters we introduced into our code generation scheme have a large impact on the speed of resulting approximation scheme. In general, for CPU based interpolation methods enabling branches in the code generation leads to more efficient implementations --- this is an expected result, since the performance penalty of branching on CPU architectures is very small compared to the performance impact of wasting computation. The same cannot be uniformly said for GPU, there are indeed cases in which branch predicated code performs better than branch-heavy code. However, our results show that the dogma of avoiding branches in GPU code is not completely true, at least on modern Volta GPUs. On average, however, branching seems to hurt performance more than it helps performance. In terms of polynomial grouping, larger groups tend to worse performance in most cases. This is somewhat counter-intuitive, as one would expect grouping multiple memory reads together would result in less time spent on polynomial evaluations. However, smaller grouping likely leads to better interleaving of computation and memory fetches. Keep in mind that setting the group size low may lead to lower accuracy results compared to larger group sizes, since a larger group size combines more terms during the Horner factorization, which implies lower error rates. Pipeline depth does seem to have an effect on reconstruction speed, but it is not as pronounced as the memory fetch grouping. A good set of default parameters seems to be a low group size (simply set to 1) and a high pipeline depth (the maximum value) with branches enabled for CPU code, and disabled for GPU code. \section{Introduction} In Part I, we introduced a framework of analysis that allows one to process a piece-wise polynomial interpolant (defined over a convex simplicial complex) into a list of related ``sub-regions'' with desirable properties for implementation within a machine~\cite{part1}. The implementation details, however were left up to interpretation; this work elaborates upon the generation and evaluation of code from the form given in the prequel. In reality, there are parameters to tune depending on the details of the machine that one wishes to target. For example, code with branching patterns are potentially detrimental to performance on GPU architectures, whereas CPU architectures have been engineered so as to minimize much of the overhead of branching. The main contribution of this paper is a framework for generating code from the abstract description provided in the prequel, and provide an exploration of the parameter space. While the focus in the prequel was on generality (i.e. interesting test cases), the discussion in this paper is more tuned towards performance. The analysis in the prequel provides one with a means to explore many different combinations of basis functions and lattices --- translating such a description into a concise and performant implementation is non-trivial. A na\"{i}ve approach is to simply take an interpolant $\varphi$ and evaluate it within the convolution sum: \begin{equation}\label{eq:conv_sum} \sum_{\mathbf{n} \in L\mathbb{Z}^s} c_{\mathbf{n}}\varphi(\mathbf{x}-\mathbf{n}). \end{equation} While this is straightforward, it is plagued by performance issues. For a spline with $n$ points in its support, this leads to $n$ evaluations of the interpolant $\varphi$ for a given reconstruction, however, there is often a good deal of symmetry in higher dimensional splines, thus most of these evaluations contain some amount of repeated work (under symmetry). Moreover, many interesting splines used in scientific visualization are non tensor product splines and thus have many separate cases one needs to consider for different areas of the spline --- the area a point resides within must be determined at each of the $n$ evaluations of the interpolant. It is more efficient to unroll the convolution sum so as to reduce the amount of repeated work and reduce branching behaviour. To accomplish this, while still balancing generality and performance, we propose a code generation framework that takes the abstract representation from Part I, and generates a low level representation that is both close to machine code and relatively platform independent. The main tool we use to accomplish this is the Low Level Virtual Machine (LLVM) which is a framework for code analysis and generation. LLVM is the foundation of many contemporary compilers --- at its core it is a library for expressing low level code; code that is independent of a target architecture. To this end, this allows one to divorce optimisation from high level language design, and allows language designers to focus simply on generating good low level code. Optimization passes are performed solely on LLVM's low level instruction representation (LLVM-IR). As in Part I, our goal is to make the benefits of non-Cartesian computing more tangible. This work finalizes the ideas of Part I. To summarize, the contributions of this work are as follows: \begin{itemize} \item We provide a unified framework that generates code for fast interpolants from non-separable interpolants on common lattices in scientific computing and visualization. Our framework is generalizeable to $s$-dimensions. \item We detail the parameters of said code generation, elaborate upon how they affect performance for certain types of compute architectures, we also provide a reference implementation which is available on Github~\cite{fastsplinegit} which contains the code to perform the analysis detailed in Part I, the code genertion framework presented in this work, as well as example code that demonstrates the use of the framework and builds upon examples in this work. \item We explore the effect of parameter choice on generated code for different compute architectures. Additionally, we explore the performance of the Voronoi splines in 3D, which are arguably the most splines that are closest to the tensor product spline on the Cartesian lattice (in both support size and order.) Prior to this work, they have not received an efficient implementation and have been seen as impractical interpolants. \end{itemize} The remainder of this paper is organized as follows. In Section~\ref{sec:related_work} we touch upon some related work --- this ranges from splines used in 1,2 and 3 dimensional signal processing, to domain specific compilers. We then describe the neccesary background in Section~\ref{sec:background}, referring to the first part for details on shift invariant spaces; it is assumed that the reader is familiar with the first part of this work. In Section~\ref{sec:method}, we detail the mechanisms behind our code generation framework, breaking the system down into components or ``blocks'' and showing how to compose them so as to implement the algorithm in Part I. Finally, in Section~\ref{sec:results} we compare and contrast the effect on performance of different parameters for different compute architectures. \section{Methodology} \label{sec:method} We start by breaking down the components of the algorithm proposed in Part I into separate distinct chunks, then elaborate upon how code is generated for each of these chunks. We reiterate the algorithm here with minor modifications; specifically we make the memory fetches explicit in Algorithm~\ref{alg:eval}. We first decompose Algorithm~\ref{alg:eval} into different parts: the preamble, the summation loop and polynomial evaluation. We present these as different generation ``blocks''. Blocks take in LLVM-IR variables, and output a set of LLVM-IR variables. Some input variables may correspond to input (i.e. the point at which we are evaluating the spline) whereas other may correspond to internal use elements (lookup tables, or the output of other blocks). Bridging the gap between input and output are LLVM-IR instructions which take input, and provide one output. We proceed with the running example from Part I, which has already been reintroduced in Section~\ref{sec:background}. \begin{algorithm} \caption{Branch free evaluation at a point.} \label{alg:eval} \begin{algorithmic}[1] \Procedure{Eval}{$\mathbf{x}$} \State $f \gets 0$ \For{$\mathbf{l} \in \{\mathbf{l}_0,\mathbf{l}_1,\cdots \mathbf{l}_{M-1}\} $} \State $\mathbf{k} \gets \rho(\mathbf{x})$ \Comment{Determine the shift to ROE} \State $\mathbf{x} \gets \mathbf{x} - \mathbf{k}$ \Comment{Shift ROE} \State $q \gets 0$ \For{$i \in \{0,1,\cdots Q-1\} $} \Comment{Determine BSP index} \State $q \gets (\mathbf{x}\cdot\mathbf{p}_i - d_i < 0) \ ? \ q : q \mathbin{|} 2^i$ \EndFor \State $SubRegionIndex \gets \sigma(q \% p)$\Comment{Map BSP index into sub-regions} \State $g \gets 0$ \State $T^\prime \gets T[SubRegionIndex]$ \State $\mathbf{t}^\prime \gets -T^\prime\mathbf{t}[SubRegionIndex]$ \State $\pi^\prime \gets \pi[SubRegionIndex]$ \For{$j \in \{0,1\cdots, n-1\}$} \State $c_j \gets MemoryLookup(\pi^\prime[LatticeSite[j]])$ \EndFor \For{$i \in \{0,1,\cdots, K-1\} $} \State $v \gets {\psi_i^{\pi^\prime}}(T^\prime\mathbf{x} - \mathbf{t}, \mathbf{k}) $ \State $g \gets g + PsiIndex[SubRegionIndex] == i \ ? \ v \ : \ 0$ \EndFor \State $f \gets f + g$\Comment{Add the contribution for this coset} \EndFor \State \textbf{return} $f$ \EndProcedure \end{algorithmic} \end{algorithm} \subsection{Preamble} The generated code begins with a function declaration and generation of the lookup tables needed for computation --- specifically, the tables precomputed in Part I (explicitly $T, \mathbf{t}, \pi$ and $PsiIndex$ in Algorithm~\ref{alg:eval}) are populated if necessary; some splines have only one element in each of these tables, so tables are not generated in those cases and that single element will be inlined when needed. The function definition takes a spatial location (i.e. $s$ floating or double scalar values) and a memory lookup primitive. The lookup primitive can be a pointer to a function, a sequence of memory arrays (each corresponding to a Cartesian coset of the lattice) or a texture object (for GPU code). If the lookup primitive is a function pointer, this function is called on every lattice site lookup. If an array is specified, memory fetches are generated at every lattice site fetch. If the lookup primitive is a texture fetch, then code generation module will generate texture fetches when the data within lattice sites are needed. These can be specified as either linear or nearest neighbor fetches. Listing~\ref{lst:preamble} shows an example of the generated LLVM-IR code containing lookup tables and the function declaration. \begin{lstlisting}[language=LLVM, label={lst:preamble}, caption=Example of function and lookup table definition. Some splines may have more or less lookup tables; some have none. In practice `texture\_t' is presented as an i64 in order to remain transparent to LLVM.] ; Different indexes are declared here, addrspace(4) tells the backend to place these tables in constant memory @"bsp_index" = addrspace(4) constant [8 x i8] ;; constant data omitted @"xform_lookup" = addrspace(4) constant ; constant data omitted ; For functions passed a pointer, the function signature is: define double @reconstruct(double ; For functions passed a texture, the function signature is: define double @reconstruct(double entry: ; ... composition of blocks ... } \end{lstlisting} \subsubsection{Coset Loop} If the spline space has a coset decomposition, we generate the header for a loop over the cosets. We first generate a label and index, then generate the memory look-ups for the coset offsets. We then increment the index for the next iteration. After the subsequent blocks, a conditional branch brings execution flow back to the label we defined above. \subsubsection{Region of evaluation} This block determines the lattice site closest to (or within) the region of evaluation. The user may specify the region of evaluation as a paralellpiped region that tiles space according to the given lattice (in which they specify the paralellpiped via a matrix); they may also specify the region of evaluation as the Voronoi cell of the lattice. These are two methods of collecting the reference sub-regions of evaluation, there other possible groupings, but these two are very simple to implement and cover a wide variety of cases. The output of this block is an $s$-tuple of LLVM-IR variables that correspond to a lattice shift to the reference region. The input point is then shifted by the reference point. Figure~\ref{fig:roe} demonstrates how $\rho$ is calculated, and also (geometrically) how it is used. \begin{figure}[h!] \begin{subfigure}{0.2\textwidth} \includegraphics[scale=1.3]{images/shiftregion.pdf} \end{subfigure} \hspace{2.5cm} \begin{subfigure}{0.63\textwidth} \begin{lstlisting}[language=LLVM] ; clamp to center of parallelpiped \end{lstlisting} \end{subfigure} \caption{The image on the left exemplifies the utility of $\rho(x)$ --- space is tesselated into regions of evaluations, using $\rho(x)$ we shift it to our reference region of evaluation. In general this is performed by an inverse matrix transform, then either a round or floor operation, and finally a transform back to the original space tiled by the paralellpiped. This is exemplified by the LLVM code on the right. The value of $\rho(x)$ is also used to shift the lookup lattice sites (i.e. the stencil) from the reference region to the correct lattice sites. } \label{fig:roe} \end{figure} \subsubsection{Sub-region membership} Once the point of evaluation has been shifted to the region of evaluation, the next task is to determine the sub-region the point resides within. The next block takes in the shifted evaluation point from the previous blocks and compares the point of evaluation with the planes that split the region of evaluation into sub-regions. Each comparison consists of a dot product and a subtraction or addition, this is easily vectorized, however the vector reduction functions are still experimental in LLVM, thus we leave this as scalar code, and hope that a given backend will vectorize this code if possible. Each plane comparison corresponds to a bit in an unsigned integer; where the integer width is chosen to accomodate the number of planes, this produces an integer $q$. Figure~\ref{fig:bspexample} shows both how the plane comparisons determine the sub-region index, as well as the generated code. While $q$ could be used to index the sub-region of evaluation, we may have drastically more possible values of $q$ than sub-regions, this would require an entry for ever possible value of $q$ in our lookup tables. Instead, we take $q$ mod $p$ to compress it to a more suitable range, then we pass this through a lookup table that produces the final sub-region of evaluation. \begin{figure}[h!] \begin{subfigure}{0.44\textwidth} \includegraphics[scale=1.7]{images/subregionmember.pdf} \end{subfigure} \hspace{0cm} \begin{subfigure}{0.55\textwidth} \begin{lstlisting}[language=LLVM] ; Test against plane 1 ; Test against plane 2 ; lookup the subregion \end{lstlisting} \end{subfigure} \caption{The image on the left shows the planes that decompose the region of evaluation into sub-regions of evaluation. To determine the sub-region, the point of evaluation is shifted to the reference region, then the point of evaluation is tested to determine which side of each plane it lies on. Each plane test corresponds to a bit of an integer, which then is compressed down into a reasonable range before being fed into a lookup table that yields the final sub-region index. The code on the right demonstrates what this procedure looks like in LLVM-IR.} \label{fig:bspexample} \end{figure} \subsection{Table Lookups} Now that the sub-region index is known, we may look up the various transformations needed to translate one sub-region into another. There are a few subtleties to note here. The first is that even though we require only one query to the different lookup tables, it may be advantageous to explicitly re-fetch the elements of these lookup tables whenever they are needed --- this hints at the lifespan of a register and allows the backend to allocate less registers, increasing occupancy, at the cost of a few memory accesses. On the GPU the lookup tables are stored in constant memory and avoid additional slow accesses to main memory; on the CPU these tables will quickly enter the CPU's cache memory system. Since this operation consists only of memory look-ups, we omit an example listing. \subsection{Reference Sub-region Loop} The next significant body of code is the loop over all reference sub-regions. This loop is always explicitly unrolled, since the representation of the polynomial may not necessarily be the same per reference sub-region. \subsection{Polynomial evaluation} The final step is to evaluate the given polynomial within a sub-region. Since the width of the memory bus on a compute architecture is variable, as is the ``raw compute to memory bandwidth'' ratio of modern architectures, we introduce parameters to tune the performance of the polynomial evaluation on a per-architecture basis. The first parameter we explore is a consequence of dividing the polynomial within a sub-region into smaller chunks; that is, we divide the polynomial into groups of size $m$ based on memory accesses. This allows us to interleave computation and memory accesses --- that is, as memory read instructions are waiting on results, we are able to compute parts of a polynomial that do not depend on the memory reads still in flight. First, the polynomial is split up into groups that depend only on (at most) $m$ coefficients --- we call $m$ the evaluation {\em group size}. At any given moment, we allow a maximum of $d$ (such that $d \ge m$) memory reads to be sent to the memory controller, computations for the first $m$ coefficients begin once they have come back from the memory controller --- we call $d$ the {\em pipeline depth}. To make this idea more concrete, we demonstrate the principle with the example from the above. We set $m=2$ and $d=4$, then the polynomial in Figure~\ref{fig:ex1} is decomposed into the following polynomials: \begin{eqnarray} p_0(x_0,x_1,c_0,c_1) & := & \left(\frac{1}{2}c_0 - \frac{1}{4}c_1x_0-\frac{1}{2}c_0+\frac{1}{2}c_1x_1\right)x_0-\frac{1}{2}c_1x_1+\frac{1}{8}c_0 + \frac{1}{8}c_1+\frac{1}{4}c_1x_1x_1 \\ p_1(x_0,x_1,c_2,c_3) &:= & \left(\frac{1}{2}c_3-\frac{1}{2}c_3x_0-\frac{1}{2}c_2 + \frac{1}{4}c_3x_1\right)x_1-\frac{1}{2}c_2 - \frac{1}{4}c_3x_0x_0+\frac{1}{2}c_2 + \frac{1}{8}c_3 \\ p_2(x_0,x_1,c_4,c_5) &:= & \left(\frac{1}{4}c_4x_0+\frac{1}{2}c_5-\frac{1}{2}c_4x_1\right)x_0+\frac{1}{8}c_5+\frac{1}{4}c_4 - \frac{1}{2}c_5x_1x_1 \\ p_3(x_0,x_1,c_6) &:= & \left(\frac{1}{4}c_6x_0+\frac{1}{2}c_6x_1\right)x_0+\frac{1}{4}c_6x_1x_1 \end{eqnarray} Each of the above polynomials is in a multivariate Horner form (from a greedy Horner factorization). Summing all of these polynomials gives the polynomial for the reference sub-region in Figure~\ref{fig:ex1}. Keep in mind that each of the $c_i$ correspond to memory lookup at a lattice site, so the decomposition above will depend on the order in which one decides to visit $c_i$ --- for discussion on this and its optimization procedure, see Part I. Algorithm~\ref{alg:pipeline} shows a concrete example of pipelining. \begin{algorithm} \caption{Piplineing example.} \label{alg:pipeline} \begin{algorithmic}[1] \State $c_0 \gets FETCH( T^{t} [-1,0]^t + [rho0, rho1]^t)$ \Comment{Commit 4 memory reads} \State $c_1 \gets FETCH( T^{t} [0,-1]^t +[rho0, rho1]^t)$ \State $c_2 \gets FETCH( T^{t} [0,0]^t + [rho0, rho1]^t)$ \State $c_3 \gets FETCH( T^{t} [0,1]^t + [rho0, rho1]^t)$ \State $STALL(c_0)$ \Comment{Wait for 2 fetches to complete} \State $STALL(c_1)$ \State $result \gets p_0(xt_0, xt_1, c_0,c_1)$ \Comment{Compute what we can while memory fetches are in flight} \State $c_4 \gets FETCH( T^{t} [1,-1]^t + [rho0, rho1]^t)$ \Comment{Commit 2 new reads to the controller before } \State $c_5 \gets FETCH( T^{t} [1,0]^t + [rho0, rho1]^t)$ \State $STALL(c_2)$ \State $STALL(c_3)$ \State $result \gets result + p_1(xt_0, xt_1, c_2,c_3)$ \State $c_6 \gets FETCH( T^{t} [1,1]^t + [rho0, rho1]^t)$ \State $STALL(c_4)$ \State $STALL(c_5)$ \State $result \gets result + p_2(xt_0, xt_1, c_4,c_5)$ \State $STALL(c_6)$ \State $result \gets result + p_3(xt_0, xt_1, c_6)$ \end{algorithmic} \end{algorithm} \subsubsection{Polynomial Evaluation with Linear Texture Fetches} When the linear fetch is used, the order of operations changes compared to the case above. In this case, parts of the polynomial are computed prior to the trilinear memory fetches. Thus the approach is similar to the above, but the order of fetches and computation are reversed. Moreover, it is no longer possible to pipeline polyomial evaluation as above, since the trilinear decomposition requires an evaluation group size of 1. \section{Related Work} \label{sec:related_work} The motivating factor for this work is the plethora of other publications investigating non tensor product splines in scientific visualization. However, there are also many works that investigate novel interpolants in lower dimensions. For uni-variate splines, the optimal class of splines in the maximal order minimal support (MOMS) splines~\cite{blu2001moms}, although there are some notable, yet non-polynomial, splines such as the CINAPACT splines that boast nice properties such as being infinitely differentiable~\cite{cinapact}. Authors tend to neglect implementation details for uni-variate splines since it is typically straightforward --- simply fix the ``region of evaluation'' as a line segment, then distribute the polynomials from the convolution sum; polynomial evaluation is performed (optimally) with Horner's algorithm~\cite{horner1}. In 2D, there has been some work around hexagonal interpolants, however, the provided implementations exist as MATLAB code~\cite{condat2006three}. Implementing a shift invariant reconstruction space becomes more tedious as the dimension of the interpolant increases. If one wishes to implement tensor product schemes, it is relatively straightforward to extend univariate implementations by simply reducing the problem along each dimension. If one is considering non tensor product splines, and/or non-Cartesian lattices, the problem becomes more difficult. The reason for this is that non tensor product splines are non-separable --- one can no longer simply apply univariate results along each axis. Typically, the problem requires some amount of geometric analysis to take advantage of the symmetry of a spline. As such, when an implementation appears in the literature, it may include a detailed implementation, but more often it is followed by a publication describing an efficient implementation~\cite{kimeval,finkbeiner2010efficient,csebfalvi2013cosine}. However, these implementations are, again, often specific to a single language and platform. We aim to fill that gap in this paper, and the main tool we use is LLVM. Specifically, we take an abstract representation of a shift invariant reconstruction space and translate it into a low level representation. There are many benefits in translating to LLVM-IR. First of all, it allows us to represent a reconstruction space with low level code that is relatively agnostic to the underlying machine architecture. This strong abstraction between high-level and low-level representations better facilitates further processing of the original abstract representation. Languages such as Julia keep their abstract representation wholly distinct from the underlying machine~\cite{bezanson2017julia}; one may build additional processing steps on top of this representation, such as auto-differentiation, then pass the resulting representation through the same code generation mechanism used for the original code. The second main benefit we reap is the removal of the overhead that comes from a general purpose implementation of a shift invariant reconstruction space. While there is no other work that specifically attempts to take a shift invariant space and generate code, there are works within numerical computing that use LLVM as a tool to reduce overhead in a similar way as described below. TensorFlow's XLA (Accelerated Linear Algebra) library is a domain specific compiler\footnote{From this perspective, one may consider our work a domain specific compiler whose input is a spline reconstruction space.} that translates components of a computational graph into LLVM-IR, which is in turn compiled to a target architecture~\cite{xla2017xla}. The main benefit XLA provides is that one may fuse together operations in a computational graph so as to keep more operations in registers during computation, thereby reducing overhead by using less memory bandwidth. While the improvement is modest; roughly 1.14$\times$ in their benchmarks, the improvement is consistent, especially when one considers that many applications that use TensorFlow are long running applications. There are also libraries, such as Nimble~\cite{shen2020nimble}, that compile deep learning models down to lower level code to both reduce the overhead of inference, and remove dependencies on large deep learning libraries. From the perspective of numerical computation, domain specific compilation is a relatively new, but powerful, technique. Combined with an appropriate analysis framework, it has been used to accelerate matrix operations --- this is particularly useful when the matrices in question have very specific structure~\cite{fabregat2012domain}. Another example of numerical computation domain specific compiler (and language) is SDSLc, a language for generating fast stencil computation code~\cite{rawat2015sdslc} --- curiously, this work does not acknowledge or make use of LLVM.
\section{\@startsection {section}{1}{\z@}% \def\hfill$\Box$ \bigskip{\hfill$\Box$ \bigskip} \def\mathcal{W}{\mathcal{W}} \def\langle{\langle} \def\rangle{\rangle} \begin{document} \begin{abstract} We prove that in a $C^1$-open and $C^k$-dense set of some classes of $C^k$ Anosov flows all Lyapunov exponents have multiplicity 1 with respect to appropriate measures. The classes are geodesic flows with equilibrium states of Hölder-continuous potentials, volume-preserving flows, and all fiber-bunched Anosov flows with equilibrium states of Hölder-continuous potentials. In the proof, we use and prove perturbative results for jets of flows to modify eigenvalues of certain Poincaré maps and, using a Markov partition, apply the simplicity criterion of Avila and Viana \cite{av}. \end{abstract} \maketitle \section{Introduction} The existence of a positive Lyapunov exponent and more generally the multiplicity of the Lyapunov exponents of a system are of essential interest due to their relation to other dynamical invariants and the geometry of the associated dynamical foliations. In this paper, we seek to address the question of how often simplicity (i.e. all exponents of multiplicity 1) of Lyapunov spectrum arises for some classes of hyperbolic flows. In \cite{bv}, Bonatti and Viana first established a criterion for simplicity of Lyapunov spectrum of a cocycle over a discrete symbolic base which holds in great generality with respect to a large class of measures. Applying a Markov partition construction, the authors also extend the results to cocycles over hyperbolic maps, which naturally leads to the question of whether the criterion generically holds for the derivative cocycle in the space of diffeomorphisms. Indeed, without any further restrictions, the arguments in \cite{bv} can be modified without much difficulty to show that such a result would be possible, for appropriate choices of measures. Here we consider the question of genericity of simple spectrum in the continuous-time setting -- in particular in more restrictive classes (geodesic flows, conservative flows, etc.) of Anosov flows, which presents significant differences relative to the discrete-time scenario. We establish a method of constructing appropriate perturbations of the Lyapunov spectrum by perturbing the 1-jet of an appropriate Poincaré map within a given class. We apply it in different settings to obtain the following results. Let $X$ be a smooth closed manifold; precise definitions of the other terms below are given in Section \ref{sec:prel}: \begin{theorem}[Geodesic flows]\label{main} For $3 \leq k \leq \infty$ we denote by $\mathcal{G}^k$ the set of $C^{k}$-Riemannian metrics on $X$ with sectional curvatures $1 \leq -K < 4$. There exists a $C^2$-open and $C^k$-dense set in $\mathcal{G}^{k}$ of metrics such that with respect to the equilibrium state of any Hölder potential (e.g. Liouville measure, m.m.e.) the derivative cocycle of the geodesic flow has simple Lyapunov spectrum, i.e., all its Lyapunov exponents have multiplicity one. \end{theorem} \begin{theorem}[Conservative flows] \label{volmain} For a fixed smooth volume $m$ and for $2 \leq k \leq \infty$ let $\mathfrak{X}^k_{m}(X)$ be the set of divergence-free (with respect to $m$) $C^k$ vector fields on $M$ which generate (strictly) $\frac{1}{2}$-bunched Anosov flows. Then flows in a $C^1$-open and $C^k$-dense set of $\mathfrak{X}^k_{m}(X)$ have simple Lyapunov spectrum with respect to $m$. \end{theorem} \begin{theorem}[All flows] \label{generalmain} For $2 \leq k \leq \infty$ let $\mathfrak{X}^k_A(X)$ be the set of $C^k$ vector fields on $M$ which generate (strictly) $\frac{1}{2}$-bunched Anosov flows. Then flows in a $C^1$-open and $C^k$-dense set of $\mathfrak{X}^k_A(X)$ have simple Lyapunov spectrum with respect to the equilibrium state of any Hölder potential (e.g. SRB measure, m.m.e.). \end{theorem} As indicated before, the proofs are accomplished by constructing a discrete symbolic system via a Markov partition to apply a simplicity criterion of Avila and Viana \cite{av}, which is itself an improvement of the criterion of Bonatti and Viana \cite{bv} aforementioned. In each class, we prove or use a previously established perturbational result to obtain density in the theorems above. One main difficulty particular to the setting of $\R$-cocycles which was already present in \cite{bv} arises in attempting to perturb the norms of pairs of complex eigenvalues generically. In \cite{bv}, through the introduction of rotation numbers which vary continuously with the perturbation for orbits near a periodic point, a small rotation on a periodic orbit is propagated to an arbitrarily large one for a homoclinic point, which can then be made to have real eigenvalues. While such rotation numbers are well-defined for the particular perturbation of the cocycle introduced in \cite{bv}, a general construction which allows for perturbations of the base system has only been introduced recently in \cite{gourm}. However, the constructions in \cite{gourm} do not apply directly to flows, and so we introduce new ideas to control the eigenvalues of the cocycle in the continuous-time setting. Since the class of geodesic flows is the substantially more difficult case, we carry out the proof of Theorem \ref{main} in detail, and in Section \ref{sec:volpres} we prove the analogous results needed for Theorem \ref{volmain}. \subsection{Outline} In Section \ref{sec:prel} we give the necessary background for the later sections; we summarize the main results of \cite{klta} and \cite{av} and introduce rotation numbers. For a more basic introduction to Lyapunov exponents and cocycles we refer the reader to \cite{v} and for background on geodesic flows \cite{pa}. In Sections \ref{sec: pt} and \ref{sec: proof} we specialize to the setting of the geodesic flows, giving the main arguments to prove of Theorem \ref{main}. Finally, in Section \ref{sec:volpres} we prove a perturbational result for the volume-preserving class, which by direct adaptation of the arguments of the previous sections proves Theorem \ref{volmain} and Theorem \ref{generalmain}. \subsection{Acknowledgements} I would like to thank Amie Wilkinson for all her suggestions and continued guidance in the process of research leading up to this paper, and also for her help in reviewing the text. \section{Preliminaries} \label{sec:prel} \subsection{Lyapunov exponents and Simplicity of Spectrum} \label{ssec:bvi} Here we collect and fix the definitions and background results used in later sections. For a continuous flow $\Phi^t: X \to X$ on a compact metric space $X$ preserving an ergodic measure $\mu$, a continuous linear cocycle over $\Phi$ on a linear bundle $\pi: \mathcal{E}\to X$ is a continuous map ${\mathcal{A}}: \R \times \mathcal{E} \to\mathcal{E}$ such that the maps $$A^t_{\pi(v)} := \pi \circ {\mathcal{A}}(t, \pi(v)): \mathcal{E}_{\pi(v)} \to \mathcal{E}_{\Phi^t(\pi(v))}$$ are linear isomorphisms of the fibers and $\Phi^t \circ \pi = \pi \circ \mathcal{A}^t$, where $\mathcal{A}^t := \mathcal{A}(t, \cdot)$. Suppose $\log^+ \|A^t(x)\| \in L^1(X, \mu)$ for all $t \in \R$. For some fixed choice of norm $\|\cdot \|$ on the fibers, the fundamental result describing asymptotic growth of vectors under $\mathcal{A}$ is Oseledets' theorem: there exists a set of numbers $\lambda_1, ..., \lambda_n \in \R$, with $\lambda_i \neq \lambda_j$ for $i\neq j$, a measurable splitting $\mathcal{E} = \mathcal{E}^1 \oplus \dots \oplus \mathcal{E}^n$ and a set of full measure $Y \subseteq X$ such that for all $x \in Y$ and $t \in \R$ we have $A_x^t \mathcal{E}^i_x = \mathcal{E}^i_{\Phi^t(x)}$ and moreover for $v \in \mathcal{E}^i_x$: $$\lim_{t \to \pm \infty} \frac{1}{t} \log ||A_x^t v|| = \lambda_i.$$ The numbers $\lambda_i$ are the \textit{Lyapunov exponents} of $\mathcal{A}$ with respect to $\mu$. When all bundles $\mathcal{E}^i$ are 1-dimensional, $\mathcal{A}$ is said to have \textit{simple Lyapunov spectrum} with respect to $\mu$. When $X$ is a smooth manifold and $\Phi^t$ is $C^1$, the \textit{dynamical cocycle} on $\mathcal{E} = TX$ is the derivative map $D\Phi^t$ of the flow, we often refer to its Lyapunov exponents as the Lyapunov exponents of $\Phi$ with respect to $\mu$ -- similarly, we say $\Phi$ has simple Lyapunov spectrum when the dynamical cocycle does. The definitions above hold in the discrete-time setting of \cite{av}, with appropriate modifications, where the criterion for simplicity of Lyapunov spectrum we need is proved -- following their notation, we let $\hat{f}$ be the shift on the space $\hat{\Sigma} = \N^\Z$ and $\mathcal{A}$ be a measurable cocycle on $\hat{\Sigma} \times \R^d$ over $\hat{f}$, which alternatively can be equivalently described by some measurable $\hat{A}: \hat{\Sigma}_T \to GL(d,\R)$ when the bundle is trivial, a harmless assumption since all bundles we consider are measurably trivializable. The theorems of Avila and Viana all require the additional bunching assumption: \begin{definition}[Domination/Holonomies]\label{dom} $\hat{A}$ is dominated if there exists a distance $d$ in $\hat{\Sigma}$ and constants $\theta < 1$ and $\nu \in (0, 1]$ such that, up to replacing $\hat{A}$ by some power $\hat{A}^N$: \begin{enumerate} \item [(1)] $d(\hat{f}(\hat{x}), \hat{f}(\hat{y})) \leq \theta d(\hat{x}, \hat{y})$ and $d(\hat{f}^{-1}(\hat{x}), \hat{f}^{-1}(\hat{y})) \leq \theta d(\hat{x}, \hat{y})$ for every $\hat{y} \in W^s_{loc}(\hat{x})$ and $\hat{z} \in W^u_{loc}(\hat{x})$ \item [(2)] The map $\hat{x} \mapsto \hat{A}(\hat{x})$ is $\nu$-Hölder continuous and $\|\hat{A}(\hat{x})\|\|\hat{A}^{-1}(\hat{x})\|\theta^\nu < 1$ for every $\hat{x} \in \hat{\Sigma}$. \end{enumerate} If $\hat{A}$ is either dominated or constant on each cylinder, there exists a family of holonomies $\phi^u_{\hat{x}, \hat{y}}$, i.e., linear isomorphisms of $\R^d$ such that for each $\hat{x}, \hat{y} \in \hat{\Sigma}$ in the same local unstable manifold of $\hat{f}$ there exists $C_1 > 0$ such that: \begin{enumerate} \item [(1)] $\phi^u_{\hat{x}, \hat{x}} = id$ and $\phi^u_{\hat{x}, \hat{y}} = \phi^u_{\hat{x}, \hat{z}} \circ \phi^u_{\hat{z}, \hat{y}}$, \item [(2)]$\hat{A}(\hat{f}^{-1}(\hat{y})) \circ \phi^u_{\hat{f}^{-1}(x), \hat{f}^{-1}(y)} \circ \hat{A}^{-1}(\hat{x}) = \phi^u_{\hat{x}, \hat{y}},$ \item [(3)] $\|\phi^u_{\hat{x}, \hat{y}} - id\| \leq C_1 d(\hat{x}, \hat{y})^\nu$. \end{enumerate} There is a family $\phi^s$ of holonomies over stable manifolds satisfying analogous properties. \end{definition} For such cocycles, the holonomies allow to propagate the dynamics over single periodic orbits to obtain data on the Lyapunov spectrum of certain measures. Thus, the adaptation of the original pinching and twisting conditions for a monoid of matrices can be adapted to these cocycles as follows: \begin{definition}[Simple cocycles] \label{deftyp} Suppose $\hat{A} : \hat{\Sigma} \to GL(d, \R)$ is either dominated or constant on each cylinder of $\hat{\Sigma}$ . We say that $\hat{A}$ is \textit{simple} if there exists a periodic point $\hat{p}$ and a homoclinic point $\hat{z}$ associated to $\hat{p}$ such that: \begin{enumerate} \item [(P)] the eigenvalues of $\hat{A}$ on the orbit of $\hat{p}$ have multiplicity 1 and distinct norms -- let $\omega_j \in \R P^{d-1}$ represent the eigenspaces, for $1 \leq j \leq d$; and \item [(T)] $\{\psi_{\hat{p},\hat{z}}(\omega_i): i \in I\} \cup \{\omega_j: j \in J\}$ is linearly independent, for all subsets $I$ and $J$ of ${1,...,d}$ with $\# I + \# J \leq d$ where, denoting by $\phi^u$ and $\phi^s$ the holonomies as above, $$\psi_{\hat{p},\hat{z}} = \phi^s_{\hat{z},\hat{p}} \circ \phi^u_{\hat{p},\hat{z}}.$$ \end{enumerate} \end{definition} An invariant probability measure $\hat{\mu}$ has local product structure if for every cylinder $[0:i]$: $$\hat{\mu}|[0:i] = \psi \cdot (\mu^+ \times \mu^-)$$ where $\psi: [0:i] \to \R$ is continuous and $\mu^+$ and $\mu^-$ are the projections of $\hat{\mu}|[0:i]$ to spaces of one-sided sequences indexed by positive and negative indices respectively. For instance, this property holds for every equilibrium state of $\hat{f}$ associated to a Hölder potential \cite{bow}. \begin{theorem} \label{bvmainthm}\cite[Theorem A]{av} If $\hat{A}$ is a simple cocycle then it has Lyapunov exponents of multiplicity one with respect to any $\hat{\mu}$ with local product structure. \end{theorem} \subsection{Anosov Flows} The continuous-time hyperbolic systems we study are: \begin{definition}[$C^k$-Anosov Flows] A $C^k$ ($1 \leq k \leq \infty$) flow $\Phi^t: X \to X$ on a smooth manifold $X$ is called \textit{Anosov} if it preserves a splitting $E^u \oplus E^0 \oplus E^s$ of $TX$ such that $E^0$ is the flow direction and there exist $\lambda > 0$ and $C > 1$ such that for all $v \in E^u$ and $u \in E^s$: $$||D\Phi^t v|| \geq Ce^{\lambda t} ||v||,\, \hspace{.3cm} ||D\Phi^{-t} u|| \geq Ce^{\lambda t} ||u||.$$ \end{definition} A significant class of cocycles over Anosov flows related to the theory of partially hyperbolic systems and to the class of dominated cocycles over shift maps is that of \textit{fiber bunched cocycles}, whose expansion and contraction rates are dominated by the base dynamics: \begin{definition}[Fiber Bunching] \label{fbunchdef} A $\beta$-Hölder continuous cocycle $\mathcal{A}: \mathcal{E} \times \R \to \mathcal{E}$ over an Anosov flow $\Phi^t:X \to X$ is said to be $\alpha$-fiber bunched if $\alpha \leq \beta$ and there exists $T> 0$ such that for all $p \in M$ and $t \geq T$: $$\|A^t_p\| \|A_p^{-t}\| \| D\Phi^t|_{E^s}\|^{\alpha} < 1, \hspace{.3cm} \|A^t_p\| \|A_p^{-t}\| \| D\Phi^{-t}|_{E^u}\|^{\alpha} < 1.$$ When the cocycles $D\Phi^t|_{E^{i = u,s}}$ themselves satisfy the inequalities above in place of $\mathcal{A}$, the Anosov flow is said to be $\alpha$-bunched. \end{definition} Fiber bunching is a partial hyperbolicity condition on the projectivization of the fiber bundle, with the fibers composing the center direction and the base system the stable and unstable directions. The strong stable and unstable manifold theorem can be interpreted as defining holonomy maps between the fibers: \begin{theorem} \cite{kalsad} \label{holsflow} Suppose $\mathcal{A}$ is $\beta$-Hölder and fiber bunched over a base system as in Definition \ref{fbunchdef}. Then the cocycle admits \textit{holonomy maps} $h^u$, that is, a continuous map $h^u: (x,y) \to h^u_{x,y}$, $x\in M$, $y \in W^u_{loc}(x)$, such that: \begin{enumerate} \item [(1)] $h^u_{x,y}$ is a linear map $\mathcal{E}_x \to \mathcal{E}_y$, \item [(2)] $h^u_{x,x} = Id$ and $h^u_{y,z} \circ h^u_{x,y} = h^u_{x,z}$, \item [(3)] $h^u_{x,y} = (A^t_y)^{-1} \circ h^u_{\Phi^t(x), \Phi^t(y)} \circ A^t_x$ for every $t \in \R$. \end{enumerate} Moreover, the holonomy maps are unique, and, fixing a system of linear identifications $I_{xy}: \mathcal{E}_x\to \mathcal{E}_y$, see \cite{kalsad}, they satisfy: $$\|h^u_{x,y}- I_{x,y} \| \leq C d(x,y)^\beta.$$ Using property (3), one may extend these holonomies for all $y \in W^{cu}(x)$ (as opposed to $W^u_{loc}(x)$), and such holonomies are denoted by $h^{cu}$. \end{theorem} For the case where $\Phi$ is itself $\alpha$-bunched, it is known that \cite{hass} the bunching constant is directly related to the regularity of the Anosov splitting: for $\frac{1}{2}$-bunched Anosov flows, the weak stable and unstable bundles $E^{cu,cs} := E^0 \oplus E^{u,s}$ are of class $C^1$. Thus: \begin{proposition} \label{bunchingquotient} For $\Phi^t: X \to X$ a $\frac{1}{2}$-bunched $C^2$-Anosov flow, the cocycle $\mathcal{A}^u$ (resp. $\mathcal{A}^s$) on the bundle $Q^u:= E^{cu}/E^0$ (resp. $Q^s:=E^{cs}/E^0$) given by the derivative $D\Phi^t$ is $1$-bunched. \end{proposition} \begin{proof} The cocycle $D\Phi^t|_{E^{cu}/E^0}$ is $C^1$ by the regularity of the splitting mentioned above, and by hypothesis $D\Phi^t|_{E^{cu}/E^0}$ satisfies the inequalities in the definition of fiber bunching with $\alpha = 1$. Same for $E^{cs}$ \end{proof} Finally, we describe the class of measures with respect to which we prove our results. Fix a topologically mixing $C^2$-Anosov flow $\Phi^t$. Let Let $\rho: X \to \R$ be a Hölder-continuous function, which we refer to as a \textit{potential}. Then an \textit{equilibrium state} $\mu_\rho$ of $\rho$ is an invariant measure satisfying the variational principle: $$ h_{\mu_\rho}(\Phi) + \int \rho \, d\mu_\rho = \sup_{\mu \in \mathcal{M}_\Phi(X)} h_{\mu}(\Phi) + \int \rho \, d\mu,$$ where $h_\mu(\Phi)$ is the measure-theoretic entropy of $\Phi$ with respect to $\mu$ and $ \mathcal{M}_\Phi(X)$ is the set of invariant measures of $\Phi$. The existence and uniqueness of the equilibrium state $\mu_\rho$, is, in this setting, a foundational result in the theory of the thermodynamical formalism \cite{bow}. Important examples of equilibrium states include the case $\rho = 0$, which gives the measure of maximal entropy as the equilibrium state, and $\rho(x) = - \frac{d}{dt} \log J^u(x,t)|_{t=0}$, where $J^u(x,t) = \det {D_x\Phi^t|_{E^u}}$, which gives the SRB measure. Moreover, the product structure property mentioned in the previous section is also a classical result for equilibrium states proved in \cite{bow}. \subsection{Rotation Numbers} \label{ssec:rotation} As indicated in the introduction, in order to perturb away complex eigenvalues by a small rotation, one needs the formalism of rotation numbers, which we introduce in complete form here. We roughly follow the discussion in Section 3 of \cite{gourm}. As a brief introduction, recall that for an orientation preserving homeomorphism of the circle $f: S^1 \to S^1$, the \textit{Poincaré rotation number} $\rho(f) \in S^1 = \R/2\pi$ of $f$ is defined as: $$ \rho(f) = \lim_{n \to \infty} \frac{\tilde{f}^n(x)-x}{n} \text{ (mod }2\pi),$$ for a lift $\tilde{f}: \R \to \R$ of $f$. This limit always exists and is independent of the choice of $x \in \R$ and the lift $\tilde{f}$. For an orientation reversing homeomorphism we define $\rho(f) = 0$. The Poincaré rotation number measures, on average, how much an element is rotated by an application of $f$ and is a conjugation invariant, i.e., $\rho(g^{-1}f g) = \rho(f)$, for $g$ also a homeomorphism of $S^1$. In what follows we extend this definition for cocycles on circle bundles. Throughout this section, let $X$ a compact metric space and $\Phi^t$ a continuous flow on $X$. Let $\mathcal{M}_\Phi(X)$ be the space of probability measures on $X$ invariant under $\Phi^t$ with the weak-* topology. For our purposes, it will suffice to work with trivial bundles $E = X \times S^1$, and a continuous cocycle ${\mathcal{A}}: \R \times E \to E$ over $\Phi^t$. Then for $(x, \theta) \in E$, the map $t \mapsto A^t_x(\theta)$ is a continuous map from $\R \to S^1$, so it may lifted to some $w_{x,\theta}: \R \to \R$. Let $\tilde{w}_{x,\theta}(t) := w_{x,\theta}(t) - w_{x,\theta}(0)$, so that $\tilde{w}$ does not depend on the lift $w$. \begin{definition} [Pointwise Rotation Number] The average rotation number $\rho: X \to \R$ is defined by the limit: $$\rho(x) = \lim_{t \to \infty} \frac{\tilde{w}_{x,\theta}(t)}{t} ,$$ whenever it exists, and is independent of the choice of $\theta$. \end{definition} Indeed, for any $\theta, \theta' \in S^1$, we have $|\tilde{w}_{x,\theta}(t) - \tilde{w}_{x,\theta'}(t)| < 2\pi$ for any $t$ so the limit does not depend on choice of $\theta \in S^1$. Now define $\sigma: X \times \R \to \R$ and $\tau: X \times \R \to \R$ by: $$\sigma^t(x) := \sup_{\theta \in S^1} \tilde{w}_{x,\theta}$$ $$\tau^t(x) := \inf_{\theta \in S^1} \tilde{w}_{x,\theta},$$ which, by continuity of $\mathcal{A}$ are evidently continuous in $t$ and in $x$. Moreover, by the cocyle equation for $\mathcal{A}$ it is clear that $\sigma$ is subadditive and $\tau$ is superadditive. By Kingman's subadditive ergodic theorem for flows, for any $\mu \in \mathcal{M}_\Phi(X)$: \begin{itemize} \item [(1)] The sequence $\frac{1}{t}\sigma^t$ converges $\mu$-a.e. to a $\Phi$ invariant map, which agrees with $\rho$. \item [(2)] We may compute the integral of $\rho$ by: \begin{equation} \label{eq:subad} \rho_\mu: = \int \rho \, d\mu = \inf_{t > 0} \frac{1}{t} \int \sigma^t \,d\mu. \end{equation} \end{itemize} The discussion above then implies: \begin{theorem} \label{rotationnumberiscontinuous} The map $\mathcal{M}_\Phi(X) \to \R$ given by $\mu \mapsto \rho_\mu$ is continuous. \end{theorem} \begin{proof} Note that by compactness of $X$ and continuity of $\sigma^t:X \to \R$, the map $\mu \to \int \sigma^t \,d\mu$ is continuous, and hence by: $$\int \rho \, d\mu = \inf_{t > 0} \frac{1}{t} \int \sigma^t \,d\mu $$ and the analogous equation for $\tau$, we obtain upper and lower semicontinuity of $\mu \mapsto \rho_\mu$. \end{proof} \begin{remark} \label{closedrotationdefinition} When $\mu$ is supported on a periodic orbit $\mathcal{O}$, we will often write $\rho_\mathcal{O}$ for $\rho_\mu$. \end{remark} Next we consider perturbations of cocycles over a fixed base flow. The space of cocycles $\mathcal{C}_\Phi$ over the same $\Phi$ has a $C^0$-topology of uniform convergence defined by the property that $\mathcal{A}_n \to \mathcal{A}$ if for each $x \in X$ and $|t| <1 $ the maps $(A_n)_x^t \to A^t_x$ in $C^0(S^1, S^1)$ uniformly. Associated to the cocycles $\mathcal{A}$ are rotation numbers $\rho_\mu(\mathcal{A})$ for invariant measures $\mu$ defined by Equation (\ref{eq:subad}). Then: \begin{proposition} \label{contcocy} For a $\mu \in \mathcal{M}_\Phi(X)$, the map $\mathcal{C}_\Phi \to \R$ given by $$\mathcal{A} \mapsto \rho_\mu(\mathcal{A})$$ is continuous. \end{proposition} \begin{proof} The proof is nearly identical to that of Theorem \ref{rotationnumberiscontinuous}. Namely, one uses continuity of $\mathcal{A}\mapsto \int \sigma^t(\mathcal{A}) \, d\mu$ and the subadditive ergodic theorems. \end{proof} Now we specialize to the case where $X = \mathcal{O}$ is a hyperbolic periodic orbit of a $C^1$ flow $\Phi_0$ on a Riemannian manifold $N$, which will be $N = SM$ with the Sasaki metric in the setting of this paper. We are interested in how $\rho_\mathcal{O}$ varies as the flow $\Phi$ varies, for the derivative cocycle on certain circle bundles. By structural stability of the hyperbolic set $\mathcal{O}$ there exists $\mathcal{U}$ a $C^1$-neighborhood of $\Phi_0$ and a continuous $h: \mathcal{U} \times \mathcal{O} \to N$ such that the maps $h_{\Phi}(x) := h(\Phi, x)$ are $C^1$-diffeomorphisms onto their images, and $\mathcal{O}_\Phi: = h_{\Phi}(\mathcal{O})$ is a closed orbit of $\Phi$. Moreover, since the maps $h_{\Phi}$ are $C^1$ there exists a continuous $\kappa: \mathcal{U} \times \mathcal{O} \times \R\to \R$ such that $\kappa_{\Phi}(x, t) := \kappa(\Phi, x, t)$ is $C^1$ and the flow $\tilde{\Phi}$ (defined on $\mathcal{O}_\Phi$) given by: $$\tilde{\Phi}^t(x) = {\Phi}^{\kappa_{\Phi}(h_\Phi(x),t)}(x),$$ is in fact conjugated to $\Phi_0$ by $h_{\Phi}$, i.e., $h_\Phi \circ \Phi_0 = \tilde{\Phi} \circ h_\Phi$. . For any bundle $E$, we write $\mathcal{P} E$ for its projectivization. Let $F_0$ be a 2-dimensional trivial subbundle of $TN|_\mathcal{O}$ which is part of a dominated splitting $E_0 \oplus_\leq F_0 \oplus _\leq G_0$ of $TN|_\mathcal{O}$. The derivative cocycle $D\Phi$ on $\mathcal{P} F_0$ then is a cocyle on a trivial $S^1$ bundle, and it has a rotation number $\rho_\mathcal{O}$ as before. Assuming $\mathcal{U}$ is taken sufficiently small, by persistence of dominated splittings for each $\Phi \in \mathcal{U}$ there is a splitting $TN|_{\mathcal{O}_\Phi} = E_\Phi \oplus_\leq F_\Phi \oplus _\leq G_\Phi$ for $\Phi$ and the bundle $F_\Phi$ is trivial. Moreover, the splitting is also dominated for the flow $\tilde{\Phi}$, which is simply a time change of $\Phi$. Hence, $D\tilde{\Phi}$ and $D{\Phi}$ on $\mathcal{P} F_\Phi$ also have well defined rotation numbers $\rho_{\mathcal{O}_{\tilde{\Phi}}}$, $\rho_{\mathcal{O}_{\Phi}}$, which satisfy the relation: $$\rho_{\mathcal{O}_{\tilde{\Phi}}} \ell(\mathcal{O}_\Phi) = \rho_{\mathcal{O}_{\Phi}} \ell(\mathcal{O}),$$ as they differ by a time change. With all the objects defined, we now state the continuity with respect to the parameters: \begin{proposition} \label{rotcont2} The map $\mathcal{U} \to \R$ given by $$ \Phi \mapsto \rho_{\mathcal{O}_\Phi},$$ is continuous in some open $\mathcal{V} \subseteq \mathcal{U}$ containing $\Phi_0$. \end{proposition} \begin{proof} First, we would like to consider all cocycles $D\tilde{\Phi}$ constructed on $F_\Phi$ as existing on the same bundle over the same base map. For $x \in \mathcal{O}$ there exists a unique length-minimizing geodesic segment (from the Riemannian structure on $N$) from $x$ to $h_\Phi(x)$, as long as $h_\Phi$ is close to the identity, which may be ensured by passing to some $\mathcal{V} \subseteq \mathcal{U}$ further if needed. By parallel transport of the bundle $F_\Phi$ over $\mathcal{O}_\Phi$ along such segments, one then obtains a $2$-dimensional trivial bundle $F_\Phi'$ over $\mathcal{O}$. By shrinking $\mathcal{V}$ further if needed, the bundle $F_\Phi'$ obtained is a given by a graph over $F_0$ with respect to the fixed Riemannian metric on $N$, and hence by orthogonal projection they may be identified. Since all maps above are continuous, the construction above describes a continuous map $Th: \mathcal{U} \times F_0 \to TN$, so that $Th_\Phi(\cdot) := Th(\Phi, \cdot)$ are bundle isomorphisms $F_0 \to F_\Phi$ fibering over $h_\Phi$. Hence, conjugating by $Th_\Phi$ we may regard $D\tilde{\Phi}$ on $F_\Phi$ as a cocyle on $F_0$ over $\Phi_0$. By continuous dependence on $\Phi$, this defines a continuous map $\Phi \to D\tilde{\Phi}$, where $D\tilde{\Phi}$ are now regarded as elements of the space of cocycles over $\Phi_0$ on $F_0$ with the $C^0$-topology. Since all rotation numbers $\rho_{\mathcal{O}_{\tilde{\Phi}}}$ defined previously are preserved by conjugation, it suffices to check continuity of the rotation numbers of the conjugated cocycles, which is given by Proposition \ref{contcocy}. Thus the map $\Phi \mapsto\rho_{\mathcal{O}_{\tilde{\Phi}}}$ is continuous, and finally since $$\rho_{\mathcal{O}_{\tilde{\Phi}}} \ell(\mathcal{O}_\Phi) = \rho_{\mathcal{O}_{\Phi}} \ell(\mathcal{O}),$$ and the periods vary continuously, the map $\Phi \mapsto \rho_{\mathcal{O}_\Phi}$ is continuous as well. \end{proof} \subsection{Geodesic Flows} Let $M$ be a smooth closed manifold. Since twe consider varying Riemannian metrics, it is useful to work on the sphere bundle over $M$ of oriented directions of the tangent space, which we denote by $SM$, rather than on the unit tangent bundle. When a metric $g$ is fixed, $T^1_g M$ is canonically diffeomorphic to $SM$, and one can pullback the Sasaki metric from $T^1_gM$ to $SM$. Recall that for $3 \leq k \leq \infty$ we denote by $\mathcal{G}^k$ the set of $C^{k}$-Riemannian metrics on $M$ with sectional curvatures $1 \leq -K < 4$. The geodesic flow on the unit tangent bundle of a negatively curved Riemannian manifold is an Anosov flow with the horospherical foliations corresponding to the stable and unstable foliations; moreover, under the pinching condition above it is a $\frac{1}{2}$-bunched (see Anosov flows section) Anosov flow \cite[Theorem 3.2.17]{k}. In particular, the bundles $E^{cu, cs}$ are $C^1$, and, since the flow is contact and the kernel of the $C^{k-1}$ contact form equals $E^u \oplus E^s$, in fact $E^u \oplus E^0 \oplus E^s$ is a (at least) $C^1$ Anosov spliting. We describe now the perturbational results of \cite{klta} that will be used to perturb the derivative cocycle by perturbing the metric. For a fixed embedded compact interval or closed loop $\gamma \subseteq SM$, the set of metrics for which $\gamma$ is an orbit segment of the geodesic flow is denoted by $\mathcal{G}_\gamma^k \subseteq \mathcal{G}^{k}$. For a fixed $g_0 \in \mathcal{G}_\gamma^k$, pick local hypersurfaces $\Sigma_0$ and $\Sigma_1$ in $SM$ that are transverse to $\dot{\gamma}(t) \in TSM$ at $t = 0$ and $t = 1$, respectively. This allows us to define a Poincaré map $$P_{g_0} : \Sigma_0 \supseteq U \to \Sigma_1,$$where $U$ is a neighborhood of $\gamma(0)$, by mapping $\xi \in U$ to $\varphi_{g_0}^{t_1}(\xi)$, where $t_1$ is the smallest positive time such that $\varphi_{g_0}^{t_1}(\xi) \in \Sigma_1$. By the Implicit Function Theorem and the fact that $\varphi_{g_0}^{t}$ is $C^{k-1}$, the map $P$ is $C^{k-1}$. By projecting the tangent spaces of $\Sigma_{i= 0,1}$ to $E^u \oplus E^s$ one may give $\Sigma_{i =0,1}$ a symplectic structure which is preserved by the Poincaré map, since the symplectic form is invariant by the geodesic flow \cite{klta}. With $g_0$ fixed, we let $\mathcal{G}_{g_0, \gamma}^k \subseteq \mathcal{G}_\gamma^k$ be the set of metrics such that $\pi(\gamma(0)), \pi(\gamma(1)) \notin (g - g_0)$ ($\pi:SM \to M$ is the canonical projection map) that is, metrics unperturbed at the ends of the fixed geodesic segment $\gamma$ relative to $g_0$. We will repeatedly use the main result on generic metrics established by Klingenberg and Takens in \cite{klta} to perturb the metric $g_0$: \begin{theorem} \label{ktmain} \cite[Theorem 2]{klta} Suppose $g_0 \in \mathcal{G}^\infty_\gamma$, and let $Q$ be some open dense subset of the space of $(k-1)$-jets of symplectic maps $(\Sigma_0, \gamma(0)) \to (\Sigma_1, \gamma(1))$. Then there is arbitrarily $C^k$-close to $g_0$ a $g' \in \mathcal{G}_{ g_0, \gamma}^k$ such that $P_{g'} \in Q$, where $P_{g'}: (\Sigma_0, \gamma(0)) \to (\Sigma_1, \gamma(1))$ is the Poincaré map for the geodesic flow of $g'$. \end{theorem} \begin{remark} The technical assumption that $g_0$ is $C^\infty$ needed in \cite{klta} is virtually harmless, since by smooth approximation $\mathcal{G}^\infty \subseteq \mathcal{G}^k$ is dense for all $k$. \end{remark} We will need two additional facts about how these perturbations can be made, both of which follow directly from the proof of Theorem \ref{ktmain} in \cite{klta}: \begin{proposition} \label{localpert} Let $h:= g'- g_0 \in S^2 T^*SM$, where $g'$ and $g_0$ given as in the statement of Theorem \ref{ktmain}. For any tubular neighborhood $V$ of $\gamma$, $h$ can be taken to satisfy: \begin{enumerate} \item [(1)] $\text{supp}(h) \subseteq V$; \item [(2)] For a system of coordinates $\{x_0, ..., x_{2n-2}\}$ on $V$ where $\partial_{x_0}$ is parallel to the geodesic flow, the $k$-jets of $h_{00}$ (where $h = h_{ij} \, dx_i\, dx_j$) vanish identically along $\{x_0 = 0\}$. In particular, this implies that the parametrization of $\gamma$ by arc-length in $g_0$ is the same as that in $g'$, i.e., the geodesic flow for both metrics agree along $\gamma$. \end{enumerate} \end{proposition} Let $J^{k-1}_s$ denote the Lie group of $(k-1)$-jets of $C^{k-1}$ symplectic maps $(\R^{2n}, 0) \to (\R^{2n}, 0)$ with the standard symplectic form $\sum_i dx^i \wedge dy^i$. If $\mathcal{O}$ is a closed orbit, we may take $v := \gamma(0) = \gamma(1) \in \mathcal{O}$ and fix $\Sigma := \Sigma_0 = \Sigma_1$, so by Darboux's theorem we may choose coordinates that identify the space of $(k-1)$-jets of $C^{k-1}$ symplectic maps $(\Sigma, v) \to (\Sigma, v)$ with $J^{k-1}_s$. \begin{corollary} \label{perturbclosed} If $\mathcal{O}$ is a closed geodesic for $g_0 \in \mathcal{G}_\mathcal{O}^\infty$ and $Q \subseteq J^{k-1}_s$ is an open dense invariant ($Q$ satisfies $\sigma Q \sigma^{-1} = Q$ for any $\sigma \in J^{k-1}_s$) set then there is arbitrarily $C^k$-close to $g_0$ a $g' \in \mathcal{G}_{\mathcal{O}}^k$ such that for any $v \in \mathcal{O}$ and any $\Sigma$ a transverse at $v$, $P_{g'} \in Q$, where $P_{g'} = P(v, \Sigma) $ is the Poincaré return map for the geodesic flow of $g'$. \end{corollary} \begin{proof} Choice of a different section $\Sigma$ or a different point $v$ of the orbit changes $P_{g'}$ by conjugation, so the property that $P_{g'} \in Q$ needs only be assured at one fixed point and one fixed section, which is done by Theorem \ref{ktmain}. \end{proof} \begin{remark} \label{1jets} Since the map $\pi^{k-1}: J^{k-1}_s \to J^1_{s} \cong \text{Sp}(2n)$ is a submersion, for $Q$ an open dense invariant subset of $\text{Sp}(2n)$, $(\pi^{k-1})^{-1}(Q)$ is an open dense invariant subset of $J^{k-1}_s$, so in the statement of Corollary \ref{perturbclosed} we may take an open dense invariant $Q \subseteq \text{Sp}(2n)$ instead, while the approximation is still in $\mathcal{G}^k$. In the context of Theorem \ref{ktmain}, the analogous observation holds; that is, one may take $Q$ to be an open dense subset of $1$-jets of symplectic maps $(\Sigma_0, \gamma(0)) \to (\Sigma_1, \gamma(1))$, and approximate in $\mathcal{G}^k$. \end{remark} \section{Pinching and Twisting for Flowss} \label{sec: pt} In this section, we present the main technical results of the paper, namely, the construction of perturbations of Anosov flows leading to an appropriate pinching and twisting condition. For the sake of simplicity we specialize to the class of geodessic flows, but the main arguments here adapt to the proofs of the other theorems with adjustments which we describe in the last section. We define pinching and twisting for orbits of the geodesic flow in analogy with Definition \ref{deftyp}, and use the results on generic metrics to show that these are $C^1$-open and $C^k$-dense. We fix the following useful notation. For a metric $g$ such that $\mathcal{O} \subseteq SM$ is a periodic orbit of its geodesic flow with period $\ell$, let $v \in \mathcal{O}$ and let $\{\lambda_1, ..., \lambda_{2n}\}$ be the generalized eigenvalues of $D_v\varphi_g^\ell|_{E^u \oplus E^s}$, which do not depend on the choice of $v$, sorted so that $|\lambda_i| \geq |\lambda_j|$ whenever $i < j$. We write: $$ \exps^u(\mathcal{O}, g): = (\lambda_1, ..., \lambda_n) ,\, \hspace{.3cm} \exps^s(\mathcal{O}, g): = (\lambda_{n+1}, ..., \lambda_{2n}) \in \C^n, $$ $$\, \exps (\mathcal{O}, g): = (\lambda_1, ..., \lambda_{2n}) \in \C^{2n}.$$ The $i$-th coordinates of the vectors above are written as $\exps^{u, s, \cdot}_i(\mathcal{O}, g)$ (where $\cdot$ means no superscript above). The following continuity lemma about these $\exps$ is the bread and butter of all ``openness" arguments which follow: \begin{lemma} \label{expscont} For a metric $g_0 \in \mathcal{G}^k$ there exists a neighborhood $\mathcal{U} \subseteq \mathcal{G}^k$ of $g_0$ such that for any $g \in \mathcal{U}$ any orbit $\mathcal{O}$ of the geodesic flow of $g_0$ has a hyperbolic continuation $\mathcal{O}_g$ for the geodesic flow of $g$, and the maps $\mathcal{U}\to \C^n$ given by $$g \mapsto \exps^{u,s}(\mathcal{O}_g, g)$$ are continuous with respect to the $C^2$-topology. \end{lemma} \begin{proof} Let $\Sigma$ be a smooth hypersurface parallel to $E^u \oplus E^s$ at $v$ so that $\mathcal{O} \cap \Sigma =: \{v\}$. The return map for the geodesic flow $\varphi_{g_0}$ then defines a map $P_{g_0}: U \to \Sigma$, where $U\subseteq \Sigma$ is some neighborhood of $v$, for which $v$ is a hyperbolic fixed point. For any $g$ sufficiently close to $g_0$, we also obtain a map $P_g: U \to \Sigma$ given by the return map of $\varphi_g$, and by the standard hyperbolic theory, a fixed point $v_g$ such that $g \mapsto v_g$ is continuous. The geodesic flow $\varphi_g$ varies in a $C^{k-1}$ fashion as $g$ varies in $\mathcal{G}^k$, and by the implicit functon theorem so does $P_g$. Then by fixing a coordinate system, since $k \geq 3$ the matrices $D_{v_g}P_g$ vary continuously, so their eigenvalues vary continuously as $g$ varies in $\mathcal{G}^k$. Finally, the eigenvalues of the matrices $D_{v_g}\varphi_g^{\ell_g}|_{E^u \oplus E^s}$ and $D_{v_g}P_g$ agree, so we obtain the desired result. \end{proof} \subsection{Pinching} Before moving to the definition of pinching, first we verify that generically there exists a periodic orbit with a dominated splitting of $E^u \oplus E^s$ into 1-dimensional subspaces and 2-dimensional subspaces corresponding to conjugate pairs of eigenvalues. \begin{proposition} \label{gdopendense} Let $$\mathcal{G}_d^k :=\{g \in \mathcal{G}^k: \exists\mathcal{O}: |\lambda_i| \neq |\lambda_j|, \text{ unless } \lambda_i = \overline{\lambda}_j, \text{ where } (\lambda_1, ..., \lambda_n):=\exps^u(\mathcal{O}, g)\}.$$ The set $\mathcal{G}_d^k$ is $C^2$-open and $C^k$-dense in $\mathcal{G}^k$. \end{proposition} \begin{proof} Openness follows directly from Lemma \ref{expscont}, since by continuity of $\exps^u$ the continuations of $\mathcal{O}$ will satisfy the same condition defining $\mathcal{G}_d^k$. For density, we start by assuming that $g_0 \in \mathcal{G}^\infty_\mathcal{O}$, for some $\mathcal{O}$, which is possible by density of $\mathcal{G}^\infty$ in $\mathcal{G}^k$. It remains to check that the property defining $\mathcal{G}_d^k$ is indeed an open dense in $J^{k-1}_s$, so that we may apply Corollary \ref{perturbclosed} to finish the proof. By Remark \ref{1jets}, it suffices to check that having eigenvalues distinct with distinct norms, apart from complex conjugate pairs, is an openand dense Sp$(2n)$. Openness is clear, since the eigenvalues depend continuously on the matrix entries. For density, we note that the condition of distinct eigenvalues is given by the complement of the equation $\Delta = 0$, where $\Delta$ is the discriminant of the characteristic polynomial, which is a non-empty Zariski open set in Sp$(2n)$, and thus dense in the analytic topology. In particular, the set of diagonalizable matrices is dense. Since diagonalizable matrices are symplectically diagonalizable, by the lemma following this proof, by a small perturbation on the norm of the diagonal blocks we obtain density of eigenvalues of distinct norms. \end{proof} We prove the linear algebra lemma used above, which will also be useful in what follows: \begin{lemma} \label{linalg} A matrix $A \in \text{Sp}(2n)$ with all eigenvalues distinct is symplectically diagonalizable in the sense that there exists $P \in \text{Sp}(2n)$ such that $P^{-1}AP$ is in real Jordan form (i.e., given by diagonal blocks which are either trivial or $2\times 2$ conformal). \end{lemma} \begin{proof} Recall that eigenvalues of $A \in \text{Sp}(2n)$ appear in 4-tuples $$\{\lambda, \overline{\lambda}, \lambda^{-1}, \overline{\lambda}^{-1}\}$$ for $\lambda \notin \R$ and in pairs $\{\lambda, \lambda^{-1}\}$ for $\lambda \in \R$. For each $\lambda$ we let $E_\lambda = E_{\lambda^{-1}}$ be the 2-dimensional subspace spanned by the eigenspaces of $\lambda$ and $\lambda^{-1}$. Extend $\omega$ and $A$ to $\omega_\C$ and $A_\C$ in the complexification $\C^{2n} = \R^{2n} \otimes \C$. By definition $A_\C$ and $\omega_\C$ agree with $A$ and $\omega$ on $\R^{2n} \otimes 1$. The identity for eigenvectors $v_\lambda$ and $v_\eta$: $$\omega_\C(v_\lambda, v_\eta) = \omega_\C(A_\C v_\lambda, A_\C v_\eta) = \lambda\eta\, \omega_\C(v_\lambda, v_\eta),$$ implies that, unless $\lambda\eta = 1$, we have $\omega_\C(v_\lambda, v_\eta) = 0$. Therefore $E_\lambda \otimes \C$ is symplectically orthogonal to $E_\eta \otimes \C$ for any $\lambda \neq \eta, \eta^{-1}$. In particular, this implies that the $E_\lambda \otimes 1$ are symplectic subspaces with respect to $\omega$ the real form, and symplectically orthogonal to each other. In each $E_\lambda$, $A$ can be put in Jordan real form with respect to a symplectic basis. By orthogonality we may construct a symplectic basis for $\R^{2n}$ by taking the union of symplectic bases for the $E_\lambda$. Then let $P$ be the matrix which sends the standard $\R^{2n}$ basis to the constructed symplectic basis. \end{proof} The next step is to construct a metric with a periodic orbit with simple real spectrum with an arbitrarily small perturbation of the metric. Following \cite{bv}, this is accomplished by slightly perturbing a periodic orbit $\mathcal{O}$ rotating a complex eigenspace, and propagating the perturbation to a periodic orbit which shadows a homoclinic orbit of $\mathcal{O}$ that spends a long time near $\mathcal{O}$. Recall the following definitions: an \textit{$\varepsilon$-pseudo-orbit} for a flow $\Phi$ on a space $X$ is a (possibly discontinuous) function $g : \R \to X$ such that: $$d(\gamma(t+\tau),\Phi^\tau(\gamma(t)))<\varepsilon \, \text{ for } t \in \R \, \text{ and } \,|\tau| < 1. $$ For $\gamma$ a $\varepsilon$-pseudo-orbit, we say $\gamma$ is said to be \textit{$\delta$-shadowed} if there exists a point $p \in X$ and a homeomorphism $\alpha: \R \to \R$ such that $\alpha (t) - t$ has Lipschitz constant $\delta$ and $d(\gamma(t), \Phi^{\alpha (t)}(p)) \leq \delta$ for all $t \in \R$. The classic closing lemma for Anosov flows we need is: \begin{theorem} \cite{fh} (Anosov Closing Lemma) \label{closinglemma} If $\Lambda$ is a hyperbolic set for a flow $\Phi$ then there are a neighborhood $U$ of $\Lambda$ and numbers $\varepsilon_0, L > 0$ such that for $\varepsilon \leq \varepsilon_0$ any compact $\varepsilon$-pseudo-orbit in $U$ is $L\varepsilon$-shadowed by a unique compact orbit for $\Phi$. \end{theorem} We use it to prove the main result of this section: \begin{proposition} \label{pinch} Let $$\mathcal{G}_p^k := \{g \in \mathcal{G}^k: \exists \mathcal{O}: \lambda_i \neq \lambda_j, \lambda_i \in \R, \textit{ where } (\lambda_1, ..., \lambda_n):=\exps^u(\mathcal{O}, g). \}. $$ In this situation, we say $\mathcal{O}$ has the \textit{pinching property} for $g$. Then $\mathcal{G}_p^k$ is $C^2$-open and $C^k$ dense in $\mathcal{G}^k$. \end{proposition} \begin{proof} Fix a $C^2$-open set $\mathcal{U} \subseteq \mathcal{G}^k$. First, since $\mathcal{G}_d^k$ is $C^2$-open and dense and $\mathcal{G}^\infty$ is $C^k$-dense in $\mathcal{G}^k$, we may fix some $g_0 \in \mathcal{U} \cap \mathcal{G}_d^\infty$. Let $\mathcal{O}$ be as in Proposition \ref{gdopendense}. Suppose that the vector $\exps^u(\mathcal{O}, g)$ has $2c$ entries in $\C \setminus \R$, for some $c > 0$. It suffices to show that there exists a metric $g'$ in $\mathcal{U}$ which has a periodic orbit $\mathcal{O}'$ such that $\exps^u(\mathcal{O}', g')$ has $2(c-1)$ complex entries and all real entries distinct. Along $\mathcal{O}$ there is a dominated splitting $E^u = E^-_1 \oplus \dots \oplus E^-_k$ such that each $E_i$ is either 1 or 2-dimensional. Fix the smallest index $i \in \{1,..., k\}$ such that $E^\pm_{i}$ is 2-dimensional and let $P_{g_0}$ denote the Poincaré return map of the geodesic flow for a fixed section $\Sigma$ transverse to the flow small enough so that $\mathcal{O} \cap \Sigma =:\{v\}$. By shrinking $\mathcal{U}$ further if needed we may assume that $\mathcal{U} \subseteq \mathcal{G}_d^k$, i.e., that the dominated splitting for $\varphi_{g_0}$ along $\mathcal{O}$ persists for the continuation of $\mathcal{O}$ for all $g \in U$; thus, by Lemma \ref{expscont} the map $g \mapsto \theta_g:= |\text{arg}(\lambda_g)|$ is well defined and continuous, where $\lambda_g$ is an eigenvalue of $D\varphi_g$ on $E^-_i$ on the continuation of $\mathcal{O}$ \begin{lemma} There exists $g_1 \in \mathcal{U} \cap \mathcal{G}_\mathcal{O}^k$ such that $\theta_{g_1} \neq \theta_{g_0}$. \end{lemma} \begin{proof} The derivative of the Poincaré map is conjugate to $D\varphi_g|_{E^u \oplus E^s}$ over the closed orbit $\mathcal{O}$, so $\theta_{g_0}$ agrees with the argument of the eigenvalue of $DP_{g_0}$ along the 2-dimensional Jordan block $F^- \subseteq T_v\Sigma$ mapped to $E_{i}^-$ under the conjugation aforementioned. Moreover, let $F^+$ be the Jordan block corresponding to $E^+_i$ in the same manner. Identifying the space of symplectic maps $T_v\Sigma \to T_v\Sigma$ with Sp$(2n)$ there exists some neighborhood $\mathcal{V} \subseteq \text{Sp}(2n)$ of the original map $DP_{g_0}$, such that for $A \in \mathcal{V}$ the Jordan block $F$ has a continuation for $A$, and we call the norm of the argument of the eigenvalue of $A$ along this continuation $\theta_A$. Let $\mathcal{W} \subseteq \mathcal{V}$ be the set of matrices $A$ such that $\theta_A \neq \theta_{g_0}$. If $\mathcal{W}$ is open and dense in $\mathcal{V}$ then by Remark \ref{1jets} we may apply Corollary \ref{perturbclosed} to $\mathcal{W} \cup ((\text{Sp}(2n)\setminus \text{Cl}(\mathcal{V}))$, which will be open and dense in Sp$(2n)$ to find that the set of metrics which has $\theta_{g_1} \neq \theta_{g_0}$ is dense (and open) in $\mathcal{U}$. It remains to check that $\mathcal{W}$ is open and dense in $\mathcal{V}$. Openness is clear by continuous dependence of eigenvalues on matrix entries. For density, let $R_\theta$ be given by rotation of any angle of $\theta > 0$ on the subspaces $F^-, F^+$ and the identity on the other subspaces, satisfies $R_\theta \Omega R_\theta^{T} = \Omega$, where $\Omega$ is the standard symplectic form. Then $R_\theta DP_{g_0}$ has $\theta_{R_\theta DP_{g_0}} \neq \theta_{g_0}$; since $\theta > 0$ can be made arbitrarily small, this finishes the proof. \end{proof} Let $g_1$ be given as in the lemma above, and for $0 \leq s \leq 1$ we let $g_s = sg_1 + (1-s)g_0$, which, if $g_1$ is taken sufficiently close to $g_0$, also satisfies $\{g_s\} \subseteq \mathcal{U} \cap \mathcal{G}_\mathcal{O}^k$. Clearly, the map $[0,1] \to \mathcal{G}^k$ given by $s \mapsto g_s$ is continuous. Also note that, by Proposition \ref{localpert} (2), $\mathcal{O}$ is not only a closed orbit of $\varphi_{g_s}$ for all $s \in [0,1]$, but it in fact has the same arc-length parametrization with respect to all $g_s$. For the geodesic flow of $g_0$, fix $w$ a transverse homoclinic point of $v$, i.e., $w \in W^{u}(v) \cap W^{cs}(v)$. Fix some $\varepsilon > 0$ so that the geodesic flow has local product structure at scale $2\varepsilon$. Then there exists $t_1, t_2 > 0$ such that $\varphi^{-t_2}_{g_0}(w) \in W^u_{\varepsilon}(v)$, $\varphi^{t_1}_{g_0}(w) \in W^s_{\varepsilon}(v)$ and also a $C> 0$ such that for all $t > 0$: $$d(\varphi^{-(t_2+t)}_{g_0}(w), \varphi_{g_0}^{-t}(v)) < C\varepsilon e^{-t},$$ $$d(\varphi^{t_1+t}_{g_0}(w), \varphi_{g_0}^t(v)) < C\varepsilon e^{-t}.$$ Hence for $n \in \N$ the $\gamma_n: \R \to SM$ given by $$\gamma_n(t) = \varphi^{\tilde{t}-(t_2+n\ell)}_{g_0}(w), \text{ where }\tilde{t} = t \text{ mod } (t_2 + t_1 + 2n \ell)$$ are $\varepsilon_n$-pseudo-orbits where $\varepsilon_n < 2C\varepsilon e^{-n\ell}$, by the fact that the minimal expansion of the geodesic flow is $\tau = 1$ by the assumption on curvature. For $n$ sufficiently large, there exist unique periodic $w_n$'s which $L\varepsilon_n$-shadow $\gamma_n$. Let $w_{n,s}$ be continuations of $w_n$ for $0 \leq s \leq 1$ (where $w_{n,0} = w_n$, by definition). Let $w_s$ be the hyperbolic continuations of $w$. By uniqueness of shadowing, note that the $w_{n,s}$ can also be constructed by shadowing segments of the orbit of $w_s$. The following proposition shows we can extend the dominated splitting of $\mathcal{O}$ to the new orbits we defined: \begin{lemma} \label{domsplit} There exists $N$ large so that for each $0 < s < 1$ the compact invariant set $$K_{N,s} = \bigcup_{n \geq N} \mathcal{O}(w_{n,s}) \cup \mathcal{O}(w_s) \cup \mathcal{O},$$ for the geodesic flow $\varphi_{g_s}$ of $g_s$ admits a dominated splitting for the bundle $E^u = E^{-}_{s,1} \oplus \dots \oplus E^{-}_{s,k}$ over $K_{m,s}$ coinciding with the dominated splitting of $E^u$ over $\mathcal{O}$, and similarly for $E^s = E^{+}_{s,1} \oplus \dots \oplus E^{+}_{s,k}$. \end{lemma} \begin{proof}[Proof sketch. See \cite{bv}, Lemma 9.2] We sketch the proof for $s = 0$ which is almost identical to the result cited. Then since dominated splittings over compact invariant sets persists under $C^1$-small perturbations by an invariant cone argument, this shows the result for all $s \in [0,1]$. Consider the case of $E^u$. Since $w\in W^{u}(v) \cap W^{cs}(v)$, one can extend the dominated splitting of $\mathcal{O}$ to $\mathcal{O}(w)$ as follows. Consider the bundles over $\mathcal{O}$ given by $F^i = E^{-}_{1} \oplus \dots \oplus E^{-}_{j+1}$, and $G^i = E^{-}_{j} \oplus \dots \oplus E^{-}_{k}$ for $i,j= 1, ..., k-1$. Then we define $$E^j(w) : = \phi^{cs}_{v, w} F^j(v) \cap \phi^{cu}_{v,w}G^j(v)$$ and extend the $E^j$ bundles to $\mathcal{O}(w)$ by the derivative of the flow. Proof of continuity and domination of this splitting follows closely that in \cite{bv}. For $N$ sufficiently large we observe that $K_{N,0}$ is contained in an arbitrarily small neighborhood of $\mathcal{O} \cup \mathcal{O}(w)$, so the dominated splitting extends by continuity. \end{proof} For each $n$, we let $\theta_{n}: [0,1] \to S^1 = \R/2\pi\Z$ be defined by setting $\theta_n(s)$ to be the argument of the eigenvalue of $D\varphi_{g_s}$ along $E_{s,i}^{-}$ on the closed orbit $w_{n,s}$. By Lemma \ref{expscont}, the $\theta_n$ are continuous so for each $n$ they may be lifted to some $\tilde{\theta}_n: [0,1] \to \R$. The main result about these rotation numbers, whose proof is postponed to the next section due to its length, is: \begin{lemma} \label{rotationlemma} There exists $n \in \N$ so that $|\tilde{\theta}_n(1) - \tilde{\theta}_n (0)| > 2\pi $. \end{lemma} By continuity one then finds $n,s$ such that $\tilde{\theta}_{n,s}$ is an integer multiple of $2\pi$, i.e., such that the eigenvalues in $\exps^u(\mathcal{O}(w_{n,s}), g_s)$ corresponding to the subspace $E^-_{i,s}$ are real. By another perturbation using Corollary \ref{perturbclosed}, there exists a metric such that these eigenvalues become distinct. Then by induction on the other eigenspaces with complex eigenvalues, all eigenvalues are real and distinct. To finish the proof, openness follows again by Lemma \ref{expscont}, since the requirements on the products of the eigenvalues is an open condition. \end{proof} \subsection{Proof of Lemma \ref{rotationlemma}} \label{ssec:lemma} We apply the notions introduced in Section \ref{ssec:rotation} to give a proof of Lemma \ref{rotationlemma}. \begin{proof} [Proof of Lemma \ref{rotationlemma}] Fix $N$ large enough so that $K_{N,s}$ satisfies the conclusion of Lemma \ref{domsplit}. We begin with: \begin{proposition} \label{trivialization} There exists $N' > N$, which we denote by $N$ after this proposition, such that the bundles with total spaces $E_s$ defined by the fibers $E_s(x) := E_{s,i}^-(x)$ over $x \in K_{N',s}$ are continuously trivializable, for each $s \in [0,1]$. \end{proposition} \begin{proof} First, note that it suffices to prove that $E_s$ is trivializable for $s = 0$, since the bundles $E_s$ vary continuously in the ambient space $TSM$ as $s$ varies. We will construct a non-vanishing section of the frame bundle $F$ associated to $E_0$ over some $K_{N',0}$ for $N'$ large, which is equivalent to a continuous choice of basis for $E_0$, proving triviality of the bundle. \begin{figure}[ht] \begin{center} \includegraphics[scale=.18 ]{bundles/bundles.001.jpeg} \end{center} \caption{Proof of Proposition \ref{trivialization}. The closed orbit $\mathcal{O}$ is schematically represented by the black dot.} \end{figure} For $\delta > 0$ let $B_\delta(\mathcal{O})$ a $\delta$-tubular neighborhood of $\mathcal{O}$. If $\delta$ is sufficiently small relative to the scale of local product structure of the Anosov flow, for all $n \geq N'$, and $N'$ sufficiently large, $\mathcal{O}(w_n)_\delta := B_\delta(\mathcal{O}) \cap \mathcal{O}(w_{n})$ consists of a connected segment of the embedded circle $\mathcal{O}(w_{n})$ and moreover, $\mathcal{O}(w)_\delta := B_\delta(\mathcal{O}) \cap \mathcal{O}(w)$ consists of the complement of a connected closed interval in $\mathcal{O}(w)$, i.e., two immersed connected components (see Figure 1). Note that we may assume that the return map of $D\varphi_{g_0}^{\ell(w_n)}$ is orientation preserving on $E_0$ over any periodic orbit $\mathcal{O}(w_n)$, since otherwise it would have real eigenvalues (any $A \in \text{GL}(2, \R)$ with negative determinant has real eigenvalues) and we would obtain a proof of Lemma \ref{rotationlemma}. Hence, the bundle $E_0$ is trivializable over any $\mathcal{O}(w_{n})$. It is also clearly so over $\mathcal{O}(w)$, since it is an immersed real line, and we may assume it is too for $\mathcal{O}$, since otherwise, again, we would have real eigenvalues. By shrinking $\delta$ further if necessary, there exists a well-defined closest point projection $p: B_\delta(\mathcal{O}) \to \mathcal{O}$ which is a surjective submersion. Fix a trivialization of $E_0$ over $\mathcal{O}$, i.e., a non-vanishing section $S: \mathcal{O} \to F$, which is possible by the previous paragraph. For $x \in B_\delta(\mathcal{O}) \cap K_{N', 0} =: K_\delta$, again shrinking $\delta$ further if necessary, there exists a unique length-minimizing geodesic segment between $x$ and $p(x)$, and by parallel transporting $E_0(p(x))$ along such segments and then projecting orthogonally onto $E_0(x)$ one obtains a continuous bundle map $E_0|_{K_\delta} \to E_0|_\mathcal{O}$ which is an isomorphism on fibers. This map induces a map $F|_{K_\delta} \to F_\mathcal{O}$ and so by pulling back the non-vanishing section $S: \mathcal{O} \to F$ we obtain a non-vanishing section, which we now denote by $S: K_\delta \to F$ since its restriction to $\mathcal{O}$ agrees with the previous $S$, of $F$ over $K_\delta$. Recall that $\mathcal{O}(w)_\delta$ consists of two connected immersed components homeomorphic to $\R$. Since $\mathcal{O}(w)$ is contractible, it is possible to define a determinant on $F|_{\mathcal{O}(w)}$; up to scalar it is unique, and hence there is a well defined continuous sign function on each fiber. Then we claim that $S|_{\mathcal{O}(w)_\delta}$ has the same determinant sign on both components, so that it may be extended to a continuous section $\mathcal{O}(w) \to F|_{\mathcal{O}(w)}$. Suppose not for a contradiction. Define the line bundle $L:= \bigwedge^2 E^0$ over $K$, which restricted to individual orbits is trivial since $E_0$ is. At each point $x \in K$ there is a natural map $F(x) \to L(x)$ given by $(e_1, e_2) \mapsto e_1 \wedge e_2$, which extends to a continuous global map $W: F \to L$. Considering the image of $S|_{\mathcal{O}(w)_\delta}$ under $W$, we obtain a section $\mathcal{O}(w)_\delta \to L$, which has opposite signs in the two connected components. Let $B: \mathcal{O}(w) \to L$ be any extension of this section to all of $\mathcal{O}(w)$; by the previous remark, $B$ must have an odd number of zeros. By continuity $$\mathcal{O}(w_n) \setminus B_{\delta/2}(\mathcal{O}) \to \mathcal{O}(w) \setminus B_{\delta/2}(\mathcal{O})$$ as $n \to \infty$, so by continuity of the bundle for $n$ sufficiently large we can parallel transport the section $B$ on $\mathcal{O}(w) \setminus B_{\delta/2}(\mathcal{O})$ to $\mathcal{O}(w_n) \setminus B_{\delta/2}(\mathcal{O})$ to obtain a section $B_n$ on $\mathcal{O}(w_n) \setminus B_{\delta/2}(\mathcal{O})$ which has the same number of zeros as $B$ on $\mathcal{O}(w) \setminus B_{\delta/2}(\mathcal{O})$, i.e., oddly many. On the other hand as $n \to \infty$, $$B_n|_{\mathcal{O}(w_n)_\delta \setminus B_{\delta/2}(\mathcal{O})} \to (W\circ S)|_{\mathcal{O}(w_n)_\delta \setminus B_{\delta/2}(\mathcal{O})},$$ and hence for $n$ large enough $B_n$ has constant sign on $\mathcal{O}(w_n)_\delta \setminus B_{\delta/2}(\mathcal{O})$. Thus $B_n$ extends to $\mathcal{O}(w_n)_\delta$ without any zeros. Hence we obtain a global section $B_n$ on $\mathcal{O}(w_n)$ with an odd number of zeros, contradicting the triviality of $L$ over $\mathcal{O}(w_n)$. Hence we may extend $S|_{\mathcal{O}(w)_\delta}$ continuously to all of $\mathcal{O}(w)$. Since in $K_\delta$ the section $S$ is continuous, and again $\mathcal{O}(w_n) \setminus B_{\delta/2}(\mathcal{O}) \to \mathcal{O}(w) \setminus B_{\delta/2}(\mathcal{O})$ as $n \to \infty$, we can then continuously extend $S|_{\mathcal{O}(w)\setminus B_{\delta/2}(\mathcal{O})}$ to $\mathcal{O}(w_n) \setminus B_{\delta/2}(\mathcal{O})$ while agreeing with $S$ in $K_\delta$. Since $S|_{\mathcal{O}(w)}$ is non-vanishing, the section obtained in this way is also globally non-vanishing. \end{proof} The projectivization $\mathcal{P} E_{s}$ of the bundle $E_{s}$ then defines a trivial circle bundle over $K_{N,s}$, and we fix a trivializing bundle isomorphism $\phi_{s}: \mathcal{P} E_s \to K_{N,s} \times S^1$. By conjugating with $\phi_{s}$, the derivative of the geodesic flow then defines a continuous cocycle $\mathcal{A}_{s}$ on $K_{N,s} \times S^1$ over the geodesic flow, so we may apply the results of Section \ref{ssec:rotation} for $\mathcal{A}_{s}$. Then the the rotation numbers have the following characterization over periodic orbits: \begin{lemma} \label{rotform} For a closed orbit $\mathcal{O}(u)$ of a point $u \in K_{N,s}$, the argument $\theta(u)$ of the eigenvalue of the return map of the geodesic flow on $E^-_{s,i}$ satisfies: $$\theta(u) = \ell(u) \cdot \rho_{\mathcal{O}(u)} \, (\text{mod} \, \, 2\pi)$$ where $\ell(u)$ is the period of $u$, and $\rho_{\mathcal{O}(u)}$ is as in Remark \ref{closedrotationdefinition} for the cocycle $\mathcal{A}_{s}$ defined above. \end{lemma} \begin{proof} On one hand, it follows from the definition of $\rho$ that $ \ell(u) \cdot \rho_{\mathcal{O}(u)}$ agrees mod $2\pi$ with the Poincaré rotation number for the map $$(A_s)_u^{\ell(u)}: S^1 \to S^1.$$ On the other, the projectivization of the derivative of the flow also defines on the fiber a homeomorphism $S^1 \to S^1$ with Poincaré rotation number equal to the argument of the eigenvalue of the derivative. Since the two above differ by a conjugation given by $\pi_2\circ \phi_{s}(u, \cdot): S^1 \to S^1$, where $\pi_2: K_{N,s} \times S^1$ is the natural projection, by invariance we obtain the result. \end{proof} Applying Lemma \ref{rotform} to the $\theta_n(s)$, we obtain for $0 \leq s \leq 1$: $$\theta_n(s) = \ell(w_{n,s})\rho_{\mathcal{O}(w_{n,s})}\, (\text{mod}\, 2\pi),$$ By continuity of the functions $\theta_n$ we may lift them to $\tilde{\theta}_n: [0,1] \to \R$ satisfying $\tilde{\theta}_n(0) = \ell(w_{n,0})\rho_{\mathcal{O}(w_{n,0})}.$ By the continuity of $\rho_{\mathcal{O}(w_{n,s})}$ in $s$, given by Proposition \ref{rotcont2}, our choice of lift then implies: $$\tilde{\theta}_n(s) = \ell(w_{n,s})\rho_{\mathcal{O}(w_{n,s})}, \text { for } 0 \leq s \leq 1. $$ Let $\theta(s)$ be the argument of the eigenvalue of the $D\varphi_{g_s}$ on $E^-_{i,s}$ on the periodic orbit $\mathcal{O}$ (recall $\mathcal{O}$ is a closed geodesic for all $g_s$ with $\ell(\mathcal{O})$ fixed), and repeat the constructions above to obtain $\tilde{\theta}(s)$ as well satisfying \begin{equation} \label{eq: thetaellrho} \tilde{\theta}(s) = \ell(\mathcal{O}) \rho_\mathcal{O}(s), \end{equation} where $\rho_{\mathcal{O}}(s)$ is $\rho_\mathcal{O}$ of the geodesic flow of $g_s$. Since $\mu_{\mathcal{O}(w_{n,s})} \to \mu_{\mathcal{O}}$ (where $\mu_\mathcal{O}$ is the invariant probability measure supported on the closed orbit $\mathcal{O}$) we have $\rho_{\mathcal{O}(w_{n,s})} \to \rho_{\mathcal{O}}(s)$ as $ n \to \infty$ by Theorem \ref{rotationnumberiscontinuous}. By hypothesis $\theta(1) \neq \theta(0)$, and since $\ell(\mathcal{O})$ is constant as $s$ varies, Equation (\ref{eq: thetaellrho}) gives that $\rho_\mathcal{O}(1) - \rho_\mathcal{O}(0) \neq 0$. Hence for $n$ large enough there exists some $\delta > 0$ such that $|\rho_{\mathcal{O}(w_{n,1})}- \rho_{\mathcal{O}(w_{n,0})}| \geq \delta$. Finally, let $\delta_n = |\ell(w_{n,1}) - \ell(w_{n,0})|$. Again, we defer the proof of the following final proposition we need: \begin{proposition} \label{boundlength} There exists $M_2 > 0$ such that $\delta_n < M_2$ for all $n \in \N$. \end{proposition} With Lemma \ref{boundlength}, we complete the proof of Lemma \ref{rotationlemma}: $$ \begin{aligned} |\tilde{\theta}_n(1) - \tilde{\theta}_n(0)| &= |\ell(w_{n,1})\tilde{\rho}_{\mathcal{O}(w_{n,1})} - \ell(w_{n,0})\tilde{\rho}_{\mathcal{O}(w_{n,0})}| \\ &\geq |\ell(w_{n,1})(\tilde{\rho}_{\mathcal{O}(w_{n,1})} - \tilde{\rho}_{\mathcal{O}(w_{n,0})}) | \\ &\,\,\,- |(\ell(w_{n,1})-\ell(w_{n,0}))\tilde{\rho}_{\mathcal{O}(w_{n,0})} |\\ &\geq \delta \ell(w_{n,1}) - \delta_n |\tilde{\rho}_{\mathcal{O}(w_{n,0})} | \\ &> \delta \ell(w_{n,1}) - M _1M_2> 2\pi \end{aligned} $$ for all $n$ sufficiently large, since $\ell(w_{n,1}) \to \infty$. \end{proof} At last, we prove Proposition \ref{boundlength}. \begin{proof}[Proof of Proposition \ref{boundlength}] To bound the variations $\delta_n$, we use exponential shadowing and Hölder continuity of the geodesic stretch, defined below. Since the geodesic flow is unperturbed on $\mathcal{O}$ and the orbits $\mathcal{O}(w_{n,s})$ approximate $\mathcal{O}$, the two mentioned properties give us the bound on $\delta_n$. Recall that the $w_n$ are constructed by shadowing $\gamma_n: \R \to SM$ given by $$\gamma_n(t) = \varphi^{\tilde{t}-(t_2+n\ell)}_{g_0}(w), \text{ where }\tilde{t} = t \text{ mod } (t_2 + t_1 + 2n \ell), $$ which is a $\varepsilon_n$-pseudo-orbit, where $t_1$ (resp. $t_2$) is such that $\varphi^{t_1}_{g_0}(w)$ (resp. $\phi^{-t_2}_{g_0}(w)$) is in $W^s_{\varepsilon}(v)$ (resp. $W^u_{\varepsilon}(v)$) and $\varepsilon_n < 2C\varepsilon e^{-n\ell}$. The following well-known theorem is an adaptation for flows of the usual ``exponential" shadowing theorem, which uses the Bowen bracket in its proof. The statement gives a sharper estimate on how well shadowing orbits approximate pseudo-orbits: \begin{theorem} \cite[Theorem 6.2.4]{fh} For a hyperbolic set $\Lambda$ of a flow $\Phi$ on a closed manifold $\exists c,\eta>0$ such that $\forall \varepsilon >0, \, \exists \delta>0$ so that: if $x,y\in \Lambda$, $s:\R\to\R$ continuous, $s(0) = 0$ and $d(\Phi^t(x),\Phi^{s(t)}(y)) < \delta $ for all $|t| \leq T$, then \begin{enumerate} \item [(1)] $|t - s(t)| < 3 \varepsilon$ for all $|t| \leq T$, \item [(2)] there exists $t(x,y)$ with $|t(x,y)| < \varepsilon$ so that the $\varepsilon$-stable manifold $\Phi^{t(x,y)}(x)$ intersects uniquely the $\varepsilon$-unstable manifold of $y$ and: $$ d(\Phi^t(y), \Phi^t(\Phi^{t(x,y)} (x))) < c e^{\eta(T-|t|)} \text{ for } |t| < T.$$ \end{enumerate} \end{theorem} In the context of the current proof, we apply the above theorem as follows. Let $T_n = \ell(w_n)$, $x = \varphi^{T_n/2}_{g_0} (w_n)$ and $y = \varphi^{\tau_n}_{g_0} (w)$ where $\tau_n := T_n/2 - (t_2 + n\ell)$. For $n$ sufficiently large, $d(\varphi^t_{g_0}(x),\varphi^{s(t)}_{g_0}(y)) < \delta$ is satisfied, by the statement of shadowing, for $|t| < T_n/2$ and $\delta$ given by the theorem for the $\varepsilon > 0$ fixed before. Then the theorem gives a $t_n \in \R$ such that: $$ d(\varphi^{t_n+t}_{g_0}(w_n), \varphi^{\tau_n + t}_{g_0} (w) ) <c e^{\eta(T_n/2-|t|)}, \text{ for } |t| < T_n/2.$$ Now we turn to computing the period of $w_{n,1}$ using the facts established above. By structural stability, there exists $h: SM \to SM$ which conjugates the orbits of $\varphi_{g_0}$ to those of $\varphi_{g_1}$. This conjugacy can be taken to be Hölder continuous and $C^1$ along the flow direction. Thus, there exists some $a: SM \to \R$ which is Hölder continuous with some exponent $1 \geq \beta > 0$, such that for $u \in SM$: $$dh (u) X_{g_0}(u) = a(u) X_g(h(u)),$$ where $X_g$ (resp. $X_{g_0}$) is the vector field generating the geodesic flow for $g$ (resp. $g_0$). The function $a$ is referred to as the \textit{geodesic stretch}, and the proof of the facts above can be found, for instance, in \cite[p. 12-13]{stretch} The period of $w_{n,1}$ is given by the formula: $$\ell(w_{n,1}) = \int_0^{T_n} a(\varphi^t_{g_0}(w_n)) \, dt$$ By Proposition \ref{localpert} (2), since $\mathcal{O}$ is a closed geodesic, with same arclength parametrization for $g_0$ and $g_1$, it is clear that $a|_\mathcal{O} \equiv 1$. Therefore, we may compute the difference $\delta_n = |\ell(w_{n,1}) - \ell(w_{n,0})|$ as follows: $$ \begin{aligned} |\ell(w_{n,1}) - \ell(w_{n,0})| &\leq \int_{-T_n/2}^{T_n/2} |a(\varphi^t_{g_0}(w_n)) - 1| \, dt \\ &\leq M \int_{-T_n/2}^{T_n/2} d(\varphi^{t_n+t}_{g_0}(w_n), \mathcal{O})^\beta \, dt, \end{aligned}$$ since $a$ is $\beta$-Hölder continuous and the distance between a point and a compact set is well defined. To estimate the distance, note: $$\begin{aligned} d(\varphi^{t_n+t}_{g_0}(w_n), \mathcal{O}) &\leq d(\varphi^{t_n+t}_{g_0}(w_n), \varphi^{\tau_n+ t}_{g_0} (w) ) + d(\varphi^{\tau_n+ t}_{g_0} (w) , \mathcal{O}) \\ &\leq c (e^{\eta(T_n/2-|t|)} + e^{-|t|}), \text{ for } |t| < T_n/2, \end{aligned},$$ since $w$ is a homoclinic point of $\mathcal{O}$ so $d(\varphi^{\tau_n+ t}_{g_0} (w) , \mathcal{O}) \leq ce^{-|t|}$ for some $c > 0$ which we assume, by taking the max if necessary, is the same as the previous $c$. Substituting this inequality into the previous integral, we obtain: $$|\ell(w_{n,1}) - \ell(w_{n,0})| \leq M\int_{-T_n/2}^{T_n/2} (e^{\eta(T_n/2-|t|)} + e^{-|t|})^\beta \, dt < M_2 < \infty, $$ for $M_2$ independent of $n$, as an easy calculus exercise shows. \end{proof} \subsection{Twisting}Following the previous section, we fix a metric $g_0 \in \mathcal{G}_p^k$. Let $\mathcal{O}$ be the orbit with the pinching property, $v \in \mathcal{O}$ and $l$ the period of $\mathcal{O}$.We fix an arbitrary $w \in W^{cs}_{g_0}(v) \cap W^{cu}_{g_0}(v)$ a transverse homoclinic point of the orbit of $v$, and consider the holonomy maps $$\psi^{g_0}_{v,w} = h^{cs}_{w,v} \circ h^{cu}_{v,w}$$ given from Theorem \ref{holsflow}, for the unstable bundle $E^u$. Recall that $\exps^u(\mathcal{O}, g)$ consists of distinct real numbers, so let $\{e_i\}$ be an (non-generalized, real) eigenbasis for $E^u$. For all $1 \leq j \leq k$ the alternating powers $\Lambda^j E^u(v)$ have a basis obtained as exterior products of the $e_i$. We write $e_I^k := e_{i_1} \wedge \dots \wedge e_{i_k}$, where $I = \{i_1, ..., i_k\}$. \begin{proposition} \label{twist} For $g_0 \in \mathcal{G}_p^k$ as above we say $g_0$ has the \textit{twisting property} for $w \in SM$ with respect to $v$, and we write $g_0 \in \mathcal{G}_{p,t}^k$, if $$\forall e^k_I, e^l_{I'}, k + l = n: (\wedge^k \psi^{g_0}_{v,w}) (e^k_I) \wedge e^l_{I'} \neq 0, $$ which is to say that the image of any direct sums of eigenspaces intersects any direct sum of eigenspaces of complementary dimension only at the origin. The set $\mathcal{G}_{p,t}^k$ is $C^2$-open and $C^k$-dense in $\mathcal{G}^k$. \end{proposition} \begin{proof} Again, by density of $\mathcal{G}^\infty \subseteq \mathcal{G}^k$ and openness of $\mathcal{G}_p^k$ we may assume that $g_0 \in \mathcal{G}^\infty$ so we can apply Theorem \ref{ktmain}. For some small $\varepsilon > 0$, consider the geodesic segment $\gamma = \varphi^{g_0}_{[0, \varepsilon]}(w)$. Note that since $\mathcal{O}(w)$ accumulates as $|t| \to \infty$ on the compact set $\mathcal{O}$, if we take $\varepsilon > 0$ small enough we may take $\pi(\gamma)$ to be disjoint from $\pi(\mathcal{O}(w) \setminus \gamma) \cup \pi(\mathcal{O})$, where $\pi: SM \to M$ is the projection map. Then we apply Theorem \ref{ktmain} to $\gamma' \subseteq \gamma$, where $\gamma' = \varphi^{g_0}_{[\delta, \varepsilon-\delta]}(w)$ for $\delta > 0$ small, to perturb $D_w \varphi^\varepsilon_{g_0}$ by perturbing the metric only on a tubular neighborhood $V_{\gamma'}$ of $\gamma'$ small enough (possible by Proposition \ref{localpert} (1)) so that $$V_{\gamma'} \cap \text{Cl}(\pi(\mathcal{O}) \cup \pi(\mathcal{O}(w) \setminus \gamma)) = \varnothing.$$ where Cl denotes closure. By equivariance of holonomies the map $\psi^{g_0}_{v,w}$ can be rewritten as: $$\psi^{g_0}_{v,w} = h^{cs}_{\varphi^\varepsilon_{g_0}(w),v} \circ D_w{\varphi}_{g_0}^{\varepsilon}|_{E_u} \circ h^{cu}_{v,w}. $$ Then observe that perturbations to the metric of the form described in the previous paragraph affect only the $D_w{\varphi}_{g_0}^{\varepsilon}|_{E_u}$ term in the composition above. Indeed, we recall that $h^{cu}_{w,v}$ depends only on the values of the cocycle on a neighborhood of the $(-\infty, 0]$ part of the orbit $\varphi^t_{g_0}(w)$, and $h^{cs}_{\varphi^\varepsilon_{g_0}(w),v}$ on a neighborhood of the $[\varepsilon, \infty)$ part of the orbit $\varphi^t_{g_0}(w)$ and on the cocyle along $\mathcal{O}$. By construction of $V_{\gamma'}$, the cocyle is not perturbed in any of these sets. It remains to check that for an open and dense set of $1$-jets of symplectic maps $P$ from a small transversal to the flow at $w$ to a small transversal section to the flow at $\varphi_{g_0}^\varepsilon(w)$ the map $\psi^{g_0}_{v,w}$ has the twisting property (we assume both transversals to be tangent to $E^u$ at $w$ and at $\varphi_{g_0}^\varepsilon(w)$, respectively), if we replace $D_w{\varphi}_{g_0}^{\varepsilon}|_{E_u}$ by $DP|_{E^u}$. This implies by Theorem \ref{ktmain} that we can construct such a small perturbation in the space of metrics, completing the proof. Since both holonomy maps in the composition defining $\psi^{g_0}_{v,w}$ as above are symplectic isomorphisms, an open and dense subset of $\text{Sp}(E^u(v) \oplus E^s(v))$ is mapped under composition with the holonomies to an open dense set of the $1$-jets of symplectic maps $P$ as above, so it suffices to check that twisting holds when the map $\psi_{v,w}^{g_0}$ takes value in an open and dense subset of $\text{Sp}(E^u(v) \oplus E^s(v))$. Again, observe that the condition defining twisting is given by a Zariski open subset of the matrices $\text{Sp}(E^u(v) \oplus E^s(v))$. Hence, as long this set is non-empty the twisting set must also be open and dense in the analytic topology. Then by the paragraph above, this translates to an open and dense condition in $1$-jets of symplectic maps $P$, and as there is no condition imposed on higher jets, we obtain the desired result by Remark \ref{1jets}. To finish the proof, it thus suffices to check that the Zariski open set defining twisting is non-empty in the symplectic group, which is done below. \end{proof} \begin{lemma} \label{linalg2} There exists a matrix $A \in \text{Sp}(2n)$, where $\R^{2n}$ is taken with standard symplectic basis $\{e_i, f_i\}$ such that $A$ preserves $E^u := \text{span}\, \{e_i\}_{i=1}^n$ and $$\forall e^k_I, e^l_{I'}, k + l = n: (\wedge^k A)(e^k_I) \wedge e^l_{I'} \neq 0. $$ \end{lemma} \begin{proof} Note that for fixed $e^k_{I}, e^l_{I'}$ the property that $(\wedge^k A)(e^k_I) \wedge e^l_{I'} \neq 0$ is open in Sp$(2n)$. Thus by induction it suffices to show that or some $e^k_I, e^l_{I'}$ one can arrange so that $(\wedge^k A)(e_I^k) \wedge e^l_{I'}\neq 0$ and moreover $A$ still preserves $E^u$, by an arbitrarily small perturbation of $A \in \text{Sp}(2n)$ -- then repeat inductively by sucessively small perturbations over all pairs $I, I'$. To prove the claim, suppose $(\wedge^k A)(e^k_I) \wedge e^l_{I'} = 0$, and write $ (\wedge^k A)(e^k_I) = \sum_{J} a_J e^k_J.$ Since $A$ is invertible, there exists $J_0$ such that $a_{J_0} \neq 0$ and such that $|J_0 \cap I'|$ is minimal. Since $|J_0| + |I'| = n$, we have $|J_0 \cap I'| = \{1,\dots, n\}\setminus (J_0 \cup I')$, so we take an arbitrarily chosen bijection $i \mapsto j_i$ from $J_0 \cap I$ to $\{1,\dots, n\}\setminus (J_0 \cup I')$. For $\theta > 0$, let $R_\theta^{i,j}$ given by rotating the (oriented) planes $\text{span}(e_i, e_j)$ and $\text{span}(f_i, f_j)$ by $\theta$ and preserving the other basis elements. Let $A'$ be obtained by composing $A$ with each of $R_\theta^{i, j_i}$ for $i \in J_0 \cap I$ (in any order, since the rotation matrices commute). One checks directly that $R_\theta^{i,j} \Omega (R_\theta^{i,j})^T = \Omega$, where $\Omega$ is the standard symplectic form, so $R^{i,j}_\theta$ preserves $E^u$ so $A'$ is symplectic and preserves $E^u$. Writing \[\prod_{i \in J_0 \cap I'}(\wedge^k R_\theta^{i, i_j})e_{J}^k = \sum_{L} b_L e^k_L,\] by a direct computation one checks that $b_{\{1,..., n\}\setminus I'}\neq 0$ if and only if $J = J_0$, which implies that $(\wedge^k A')(e^k_I) \wedge e^l_{I'} \neq 0$. \end{proof} \section{Proof of Theorem \ref{main}} \label{sec: proof} We finish the proof of the Theorem \ref{main}. In what follows, let $\sigma: \Sigma \to \Sigma$ be the shift map of an invertible subshift of finite type $\Sigma$. The suspension of $\Sigma$ under a continuous $f: \Sigma \to \R^+$ is the compact metric space: $$\Sigma_f := (\Sigma \times \R)/((x,s) \sim \alpha^n(x,s), \, n \in \Z),$$ where $\alpha(x,s) := (\sigma(x), s - f(x))$. The shift $\sigma$ lifts to a continuous-time system $\sigma^t_{f}: \Sigma_f \to \Sigma_f$ given by $\sigma^t_f(x, s) = (x, s+ t)$ for $t \in \R$. First, we need to represent Anosov flows by the suspension of a shift. The following is the standard statement of the construction of a Markov partition for an Anosov flow: \begin{theorem} \label{markovpart} \cite[Theorem 6.6.5]{fh} Let $\Phi: M \to M$ be a $C^1$ Anosov flow. There is a semiconjugacy from a hyperbolic symbolic flow to $\Phi$ that is finite-to-one and one-to-one on a residual set of points, where the roof function for the subshift of finite type corresponds to the travel times between the local sections for the smooth system. \end{theorem} At last we prove Theorem \ref{main}. \begin{proof} [Proof of Theorem 1.1] We prove that the statement holds for all $g \in \mathcal{G}^k_{p,t}$, so the theorem is proved by Proposition \ref{twist}. Fix some such $g_0 \in \mathcal{G}^k_{p,t}$ and let $v, w \in SM$ be the vectors along whose orbits pinching and twisting hold respectively. Following the proof of Theorem \ref{markovpart} in \cite{fh}, we see that it is possible to construct the Markov partition so that $v \in SM$ has a unique lift $(p,t)$ to $\Sigma_f$, the suspension of the shift: by enlarging the Markov rectangles by an arbitrarily small amount, one can make the orbit of $v$ only intersect their interior. Then by \cite[Claim 6.6.9, Corollary 6.6.12]{fh} there is also a unique $(q,s)$ which lifts the homoclinic point with twisting $w$. Let $P: \Sigma_f \to SM$ be the semi-conjugacy map. We write $\mathcal{E} \to \Sigma_f$ for the pullback of the bundle $E^u \to SM$ to $\Sigma_f$ under $P$, and by $A^t: \mathcal{E} \to \mathcal{E}$ the pullback of the derivative cocycle. By using the return map of $A^t$ to the $0$ section of $\Sigma_f $, the cocycle $A^t$ determines a discrete time cocycle $A$ on $\mathcal{E} \to \Sigma$ identified with $\Sigma \times \{0\} \subseteq \Sigma_f$. Following the propositions in Section 2.1 of \cite{bgv} there exists a distance on $\Sigma$ which makes the cocycle $A$ dominated, so that it admits holonomies. First we prove the following lemma which verifies agreement of holonomies of the geodesic flow and its symbolic discrete representation: \begin{lemma} \label{holsagree} The stable and unstable holonomies $H^{s,u}$ of $A$ on $\mathcal{E}$ are given by the center-stable and unstable $h^{cs,cu}$ holonomies of $\varphi_g^t$ on the stable bundle. More precisely, let $x = \overline{x} \times \{0\} \in \Sigma_f^{g_0}$, $\overline{x} \in \Sigma$, and $y = \overline{y} \times \{0\} \in \Sigma_f$, $y \in \Sigma^{g_0}$, where $\overline{y} \in W^s(\overline{x})$, so that $y \in W^{cs}(x)$. Let $v = P(x)$ and $w = P(y)$, then $h^{cs}_{vw} = (H^{s}_{g,g_0})_{\overline{x}\overline{y}}$. The analogous result holds for unstable holonomies. \end{lemma} \begin{proof} By the proof of existence of holonomies as in \cite{bv}, one obtains the holonomy map as a limit: $$H^s_{\overline{x},\overline{y}} = \lim_{n \to \infty} ((A^{n})_{\overline{x}})^{-1} \circ I_{\sigma^n\overline{x} \sigma^n\overline{y}} \circ (A^{n})_{\overline{y}}.$$ As $n \to \infty$, note that $\sigma^n \overline{x} \times \{0\}$ and $\sigma^n \overline{y} \times \{0\}$ converge to the same stable manifold in $\Sigma_f$. Hence, if we let $T_n := \sum_{i=0}^{n-1} f(\sigma^i\overline{x})$ so that $(A^{n})_{\overline{x}} = (A^{T_n})_{\overline{x} \times \{0\}}$, then $\sum_{i=0}^{n-1} f(\sigma^i\overline{y}) - (T_n+r) \to 0$, as $n \to \infty$, where $r \in \R$ is such that $\sigma_f^r(y) \in W^s(x)$. On the other hand, using the formula defining the holonomies and the definition of $A^t$ as a pullback cocycle of $D\varphi^t_g|_{E^u}$: $$\begin{aligned} h^{cs}_{vw} &= \lim_{T \to \infty} (D\varphi_g|_{E^u}^T)_{v}^{-1} \circ I_{\varphi_g^T(v), \varphi_g^{T+r}(w) } \circ (D\varphi_g|_{E^u}^T)_{\varphi_g^r(w)} \circ (D\varphi_g|_{E^u}^r)_{w}, \\ &= \lim_{T \to \infty} (A^T)_x^{-1} \circ I_{\sigma^T_f y, \sigma^{T+r}_f y } \circ (A^T)_{\sigma^r_f y} \circ (A^r)_y, \end{aligned}$$ so letting $T = T_n$ we conclude that $ H^s_{\overline{x},\overline{y}} = h^{cs}_{vw}.$ \end{proof} Hence, the cocycle $A$ over $\Sigma$ is simple. Let $\rho: SM \to \R$ be a Hölder potential and $\mu_\rho$ its associated equilibrium state for the geodesic flow of $g_0$. Let $\tilde{\rho}$ be the Hölder continuous potential on $\Sigma_{f}$ given by $\tilde{\rho} = \rho \circ P$, and $\tilde{\mu}_\rho$ its associated equilibrium state for $\sigma_{f}^t: \Sigma_{f} \to \Sigma_{f}$. It is a well-known fact (see e.g. \cite{axiomaflows}) that $P_g$ is in fact a measurable isomorphism between $(\Sigma_{f}, \tilde{\mu}_\rho)$ and $(SM, \mu_\rho)$. Hence the Lyapunov spectrum of $A^t$ with respect to $\tilde{\mu}_\rho$ agrees with that of $D\varphi_g^t$ with respect to $\mu_\rho$, and it suffices to show simplicity of the spectrum of the former. Since $f: \Sigma \to \R$ is Hölder, identifying $\Sigma$ with $\Sigma \times \{0\} \subseteq \Sigma_{f}$, the Hölder continuous function: $$ \int_0^{f(x)} \tilde{\rho}(x, t) \, dt - P(\sigma^t_{f}, \tilde{\rho}) f_g(x),$$ where $P(\sigma^t_{f}, \tilde{\rho})$ is the pressure of $\sigma^t_{f}$ with respect to $\tilde{\rho}$, defines a potential on $\Sigma = \Sigma \times \{0\} \subseteq \Sigma_{f_g}$ and has a unique equilibrium state $\mu$ which satisfies, for $F \in C^0(\Sigma_{f})$: $$ \int_{\Sigma_{f}} F \, d\tilde{\mu}_\rho = \frac{\int_\Sigma \left( \int_0^{f(x)} F(x,t) \, dt \right)d\mu}{\int_\Sigma f(x)\, d\mu}$$ by \cite[Proposition 4.3.17]{fh}. In particular, since $\mu$ is an equilibrium state it has local product structure. The product $\mu \times dt$ defines a measure for the suspension flow $\sigma_1^t$ on $\Sigma_1$ (where $1$ is the constant function $1$) which has the same Lyapunov spectrum as $\mu$. Since $\mu \times dt$ and $\tilde{\mu}_\rho$ are related by a time change, the Lyapunov spectrum of $A^t$ with respect to $\mu_\rho$ and the Lyapunov spectrum of $A$ with respect to $\mu$ differ by a scalar, see e.g. \cite[Proposition 2.15]{clarklyap}. Hence applying Theorem $\ref{bvmainthm}$ to the simple cocycle $A$ for the measure $\mu$ we obtain simplicity of the Lyapunov spectrum for $\mu_\rho$. \end{proof} \section{Proof of Theorems \ref{volmain} and \ref{generalmain}} \label{sec:volpres} In this section we explain the needed modifications to the previous sections to give the proofs of Theorems \ref{volmain} and \ref{generalmain}: \begin{proof}[Proof of Theorems \ref{volmain} and \ref{generalmain}] For $\frac{1}{2}$-bunched Anosov flows, the splitting $E^u \oplus E^0 \oplus E^s$ may not be $C^1$, so instead we consider the derivative cocycle on the $C^1$-bundles $Q^u := E^{cu}/E^0$ and $Q^s:= E^{cs}/E^0$, which we have shown to be $1$-bunched in Proposition \ref{bunchingquotient}. In what follows, we prove simplicity for the spectrum on $Q^u$ and $Q^s$ implies the desired result since $D\Phi$ on $Q^{u,s}$ has the same spectrum as $D\Phi$ on $E^{u,s}$. For Theorem \ref{generalmain}, recall that topological mixing is $C^1$-open and $C^k$-dense in the space of Anosov flows. Then we follow the propositions in Section \ref{sec: pt} to construct orbits with pinching and twisting for the cocycle on $Q^u$ by a $C^k$-small perturbation, which in this case is achievable since the analogue of Theorem \ref{ktmain} is clear in the space of all vector fields and $\mathfrak{X}^k_A(X)$ is open by structural stability in the space of all vector fields and moreover the linear algebra lemmas (Lemma \ref{linalg}, Lemma \ref{linalg2}) needed for the case of Sp$(2n)$ are immediate for GL$(n)$. The $C^1$-openness of the conditions also is proved similarly. Then by a symmertric argument it is clear that pinching and twisting for both $Q^u$ and $Q^s$ is $C^1$-open and $C^k$-dense. The proof then follows the same outline in Section \ref{sec: proof}. The proof of Theorem \ref{volmain} is similar, in that the linear algebra lemmas (Lemma \ref{linalg}, Lemma \ref{linalg2}) needed for the case of Sp$(2n)$ are still immediate for SL$(n)$. Moreover, topological mixing is known for all $C^2$-volume-preserving Anosov flows. Finally, it remains to prove an analogue of Theorem \ref{ktmain} for the conservative class, which we do in the next section. With that in hand, the proof also follows the same outline as Theorem \ref{main}. \end{proof} \subsection{Conservative Perturbations} In this section we prove the analogue of Theorem \ref{ktmain} in the volume-preserving category. To the best of the author's knowledge the result is not found anywhere in the literature so the complete proof is included here. Throughout, we let $X \in \mathfrak{X}_{m}^\infty(M)$ be a non-vanishing vector field generating the flow $\varphi_X$ on the smooth manifold $M$ which preserves the smooth volume $m$. Fix an embedded segment of a flow orbit $l:[0,\varepsilon] \to M$ parametrized by the time-parameter and a small transversal smooth hypersurface $\Sigma(0)$ to $X$ at $l(0)$. For $t \in [0,\varepsilon]$, set $\Sigma(t) = \varphi_X^t(\Sigma(0))$ so that $\iota_X m$ is a volume form on the hypersurfaces $\Sigma(t)$. The following result, whose proof is elementary except for an application of the conservative pasting lemma, shows that it is possible to perturb the $k$-jets in the conservative setting generically by $C^k$-small perturbations. \begin{theorem} \label{conspres} Let $Q$ be some dense subset of the space of $k$-jets of volume-preserving maps $(\Sigma(0), \iota_X m,l(0)) \to (\Sigma(\varepsilon), \iota_X m, l(\varepsilon))$. Then there is arbitrarily $C^k$-close to $X$ an $m$-preserving $X'$ such that: \begin{enumerate} \item [(a)] $Y:= X' -X$ is supported in an arbitrarily small tubular neighborhood $B$ of $l([\delta, \varepsilon-\delta])$, for some $0< \delta < \varepsilon$; \item [(b)] $Y = 0$ on $l([0,1])$ and $Y$ is tangent to the hypersurfaces $\Sigma(t)$; \item [(c)] The flow of $X'$ generates a map $(\Sigma(0), l(0)) \to (\Sigma(\varepsilon), l(\varepsilon))$ with $k$-jets in $Q$. \end{enumerate} \end{theorem} \begin{proof} If $B$ is sufficiently small we may assume that it is foliated by the transversals $\Sigma(t)$ and, moreover, by passing to a further neighborhood we may assume that the transverse sections are mapped diffeomorphically onto each other by the flow $X$, i.e., we may construct the perturbation in a flow box with transversals given by the $\Sigma(t)$. In the flowbox, a classic application of Moser's trick allows us to assume that the flow is in normal coordinates $\varphi^t_X (x_1, ..., x_{n-1}, s) \mapsto (x_1, ..., x_{n-1}, s +t)$, where the image of $l$ is contained in $\{x_1 = ... = x_n = 0\}$ and $m = dx^1 \wedge ... \wedge dx^n$ . In these coordinates, we may regard $B \cong U \times [0,\varepsilon]$, where $U\subseteq \R^{n-1}$ is a domain and so $Q \subseteq J^k_{m}(n-1, \R)$, where $J^k_{m}(n-1, \R)$ is the Lie group of $k$-jets of volume preserving maps fixing the origin. Using the flow to identify the fibers of $U \times \R \to \R$, the problem is thus reduced to the construction, for each $\delta > 0$, of a time dependent vector field $\{Y_t\}_{t \in [0,\varepsilon]}$ on $\R^{n-1}$ with the following properties: \begin{enumerate} \item [(a)] $Y_t(0) = 0$ and $\text{supp}(Y_t) \subseteq U$ for $t \in [0,\varepsilon]$; \item [(b)] $Y_t \equiv 0$ on $[0, \delta]$ and $Y_t \equiv 0$ on $[\varepsilon-\delta, \varepsilon]$; \item [(c)] $Y_t$ is divergence free for all $t \in [0,\varepsilon]$; \item [(d)] The time-$\varepsilon$ map $f: (\R^{n-1},0) \to (\R^{n-1},0)$ of $Y_t$ has derivative at $0$ in $Q$; \item [(e)] $\|Y_t\|_{C^\infty} < \delta$ for all $t \in [0,\varepsilon];$ \end{enumerate} The construction is given by first specifying the time-$\varepsilon$ map $f$ and then finding an appropriate isotopy within the volume-preserving category to the identity. Fix some $\theta \in Q$ sufficiently close to the $k$-jets of $I$ (the identity map) and a map $F: (\R^{n-1},0) \to (\R^{n-1},0)$ whose $k$-jet at the origin is given by $\theta$. Take some $C^\infty$ bump function $\rho: \R^{n-1} \to \R$ which interpolates between the constant function $1$ in $B(0, \eta/2)$ to the constant function $0$ outside of $B(0,\eta)$ for some $\eta$ small. Let $F' = \rho F$; if $\theta$ is sufficiently close to $0$, then $||F'-I||_{C^k}$ is small so in particular $F'\in \text{Diff}(\R^{n-1})$. Applying Moser's trick, we can find an $f \in \text{Diff}_{m}(\R^{n-1})$, i.e. preserving $m$, which is $C^k$-close to the identity and which agrees with $F'$ where it is conservative, namely, everywhere except $B(0,\eta)\setminus B(0, \eta/2)$. In particular, the $k$-jet of $f$ at the origin equals $\theta \in Q$. To obtain such an $f$, we construct a family $s \mapsto h_{s} \in \text{Diff}(\R^{n-1})$ such that $h_1 = F$ and $h_0 =:f$ is conservative. Let $r: B \to \R$ be the smooth function $C^k$ close to $1$ satisfying $F_*\mu = r\mu$. Then for $s \in [0,1]$ we solve $(h_s)_* \mu = r^s \mu$, namely div$Z_{s} = r^s\log r^s$, where $Z_{s} = \partial_s h_{s}$. Moreover, the proof of the Poincaré Lemma shows that we can take $Z_s$ to be constant equal to $0$ outside of of $B(0,\eta)$. By the conservative pasting lemma \cite{pasting}, there exists $W_s$ which agrees with $Z_s$ on a neighborhood of $\R^{n-1} \setminus (B(0,\eta)\setminus B(0, \eta/2))$ and is divergence-free. Then $Z'_s = Z_s - W_s$ also satisfies div$Z'_{s} = r^s\log r^s$ and it is identically $0$ where $r = 1$, so that $h_s(x) = F(x)$ on $B(0,\eta)\setminus B(0, \eta/2)$, where now $\partial_s h_s = Z'_s$. In particular, $f:= h_0$ is the identity outside of $B(0,\eta)$ and its $k$-jet at the origin is given by $\theta$. This constructs the desired $f$. Now let $\alpha:[0,\varepsilon]\to [0,\varepsilon]$ be a $C^\infty$ function such that $\alpha \equiv 0$ on $[0, \delta]$ and $\alpha \equiv \varepsilon$ on $[\varepsilon-\delta, \varepsilon]$. If $\|f-I\|_{C^k}$ is sufficiently small (which is ensured by taking $\theta$ closer to the jets of the identity), the maps $g_t := \alpha(t) f + (1-\alpha(t))I$ are all diffeomorphisms and $t \mapsto \partial_t g_t$ is a time-dependent vector field that satisfies all desired properties except for being divergence-free. To repair that, again Moser's trick constructs a family $s \mapsto g_{t,s}$ such that $g_{t,0} = g_t$ and $g_{t,1}$ is conservative as follows. Let $r_t: B \to \R$ be the smooth 1-parameter family of smooth functions $C^k$ close to $1$ satisfying $(g_t)_*\mu = r_t\mu$. Then for $s \in [0,1]$ we solve $(g_{t,s})_* \mu = r_t^s \mu$, namely div$Z_{t,s} = r^s_t\log r_t^s$, where $Z_{t,s} = \partial_s g_{t,s}$. It is an easy consequence of the proof of the Poincaré lemma that the family $Z_{t,s}$ may be taken to be smooth in $t$ with small $t$ derivatives, since $t \mapsto r_t$ as a 1-parameter family has the same properties. Moreover, we can take supp $Z_{t,s} \subseteq \text{supp} \, (r_t-1)$. The $C^k$ norm of the $Z_{t,s}$ is a continuous function of the $C^k$ norm of $r^s_t\log r_t^s$, so that taking $Y_t = \partial_t g_{t,1}$ finishes the proof. \end{proof}
\section{Introduction} \label{intro} Many recent graph representation learning (GRL) models are creative and theoretically-justified \citep{kipf, sage, gat, qiu2018network, GIN, mixhop, GCNII}. Unfortunately, however, they contain hyperparameters that need to be tuned (such as learning rate, regularization coefficient, depth and width of the network), and training takes a long time (e.g. minutes) even on smaller datasets. We circumvent these weaknesses. We (i) \textbf{quickly} train (ii) \textbf{competitive} GRL models by posing convex objectives and estimating optimal solutions in closed-form, hence (iii) \textbf{relieving} practitioners from hyperparameter tuning or convergence checks. Our goals remind us of a \textit{classical learning technique} that has been used for decades. Specifically, Singlar Value Decomposition (SVD). SVD periodically appears within powerful yet simple methods, competing on state-of-the-art. The common practice is to design a matrix $\mathbf{M}$, such that its decomposition (via SVD), provides an estimate for learning a model given an objective. For instance, \citet{levy2014-neural} show that the learning of NLP skipgram models such as word2vec \citep{word2vec} and GloVe \citep{glove}, can be approximated by the SVD of a \textit{Shifted Positive Pointwise Mutual Information} matrix. In GRL, \citet{ultimatewalk, qiu2018network, wys} have approximated methods of DeepWalk \citep{perozzi2014deepwalk} and Node2Vec \citep{grover2016node2vec} via decomposition of some matrix $\mathbf{M}$. However, their decomposition requires $\mathbf{M}$ to be either (a) exactly calculated or (b) sampled entry-wise, but (a) is unnecessarily expensive for real-world large networks (due to Small World Phenomenon, \citep{travers1969study}) and (b) incurs unnecessary estimation errors. On the other hand, known algorithms in matrix theory can decompose \textit{any} matrix $\mathbf{M}$ \textit{without explicitly knowing} $\mathbf{M}$. Specifically, it is sufficient to provide a function $f_\mathbf{M}(.) = \langle \mathbf{M}, . \rangle$ that can multiply $\mathbf{M}$ with arbitrary vectors (§\ref{sec:fsvd}). We, argue that if the popular frameworks (e.g., TensorFlow) implement a \textit{functional SVD}, that accept $f_\mathbf{M}(.)$ rather than $\mathbf{M}$, then modern practitioners may find it useful. We review powerful GRL methods (§\ref{sec:prelim_grl}) that we \textit{convexify} (§\ref{sec:cvx}), allowing us to use (randomized) SVD for obtaining (approximate) optimum solutions. Our contributions are: \begin{enumerate}[itemsep=0pt, topsep=0pt, leftmargin=12pt] \item We implement a functional SVD (\S\ref{sec:fsvd}) of the randomized algorithm of \citet{halko2009svd}. \item We approximate embedding and message passing methods via SVD (\S\ref{sec:cvx}), showing competitive performance with state-of-the-art, yet much faster to train (\S\ref{sec:exp}). \item We analyze that learning is fast and approximation error can be made arbitrarily small (\S\ref{sec:analysis}). \end{enumerate} \section{Preliminaries} \subsection{Singular Value Decomposition (SVD)} Truncated (top-$k$) Singular Value Decomposition (SVD) estimates input matrix $\mathbf{M} \in \mathbb{R}^{r \times c}$ with low-rank estimate ${\widetilde{\mathbf{M}}}$ that minimizes the Frobenius norm of the error: \begin{equation} \min_{\widetilde{\mathbf{M}}} ||\mathbf{M} - {\widetilde{\mathbf{M}}}||_F^2, \textrm{ \ \ \ \ subject to: \ \ } \textrm{rank}(\widetilde{\mathbf{M}}) \le k, \end{equation} while parameterizing $\widetilde{\mathbf{M}}$ as $\widetilde{\mathbf{M}} = \mathbf{U}_k \mathbf{S}_k \mathbf{V}_k^\top$, subject to, columns of $\mathbf{U}_k, \mathbf{V}_k$ being orthonormal. It turns out, the minimizer of Frobenius norm $||.||_F$ recovers the top-$k$ singular values (stored along diagonal matrix $\mathbf{S}_k \in \mathbb{R}^{k \times k}$), with their corresponding left- and right-singular vectors, respectively, stored as columns of the unitary matrices $\mathbf{U}_k \in \mathbb{R}^{r \times k}$ and $\mathbf{V}_k \in \mathbb{R}^{c \times k}$ (\textit{a.k.a}, the \textit{singular bases}). SVD has many applications and we utilize two: (1) it is used for embedding and matrix completion; and (2) it can estimate the pseudoinverse of matrix $\mathbf{M}$ (a.k.a., Moore-Penrose inverse), as: \begin{equation} \label{eq:pinv_approx_svd} \mathbf{M}^\dagger \triangleq {\mathbf{M}}^\top \left({\mathbf{M}} {\mathbf{M}}^\top \right)^{-1} \approx \mathbf{V}_k \mathbf{S}_k^{-1} \mathbf{U}_k^\top, \end{equation} where one calculates inverse $\mathbf{S}^{-1}$ by reciprocating entries of diagonal matrix $\mathbf{S}$. The $\approx$ becomes $=$ when $k \ge \textrm{rank}(\mathbf{M})$, due to \citep{eckart1936lowrank, golub1996matrix}. \subsection{Graph Representation Learning (GRL)} \label{sec:prelim_grl} \begin{itemize}[itemsep=0pt, topsep=0pt,leftmargin=12pt] \item[(i)] Many \textit{message passing} models can be written as: \begin{equation} \label{eq:prelim_mp} \mathbf{H} = \sigma_L\Bigg(g_L(\mathbf{A}) \dots \ \ \overbrace{\sigma_2\bigg(g_2(\mathbf{A}) \ \ \underbrace{\sigma_1 \left( g_1(\mathbf{A}) \mathbf{X} \mathbf{W}_1 \right)}_{\textrm{output of layer 1}} \mathbf{W}_2 \bigg)}^{\textrm{output of layer 2}} \dots \mathbf{W}_L \Bigg) \end{equation} where $L$ is the number of layers, matrix $\mathbf{X}\in \mathbb{R}^{n \times d}$ contains $d$ features per node, $\mathbf{W}$'s are trainable parameters, $\sigma$ denote activations (e.g. ReLu), and $g$ is some (possibly trainable) transformation of adjacency matrix. GCN \citep{kipf} set $g$ to symmetric normalization per \textit{renormalization trick}, GAT \citep{gat} set $g(\mathbf{A}) = \mathbf{A} \circ \textrm{MultiHeadedAttention}$ and GIN \citep{GIN} as $g(\mathbf{A}) = \mathbf{A} + (1+\epsilon) \mathbf{I} $ with identity $\mathbf{I}$ and $\epsilon > 0$. For node classification, it is common to set $\sigma_L = \textrm{softmax}$ (applied row-wise), specify the size of $\mathbf{W}_L$ s.t. $\mathbf{H} \in \mathbb{R}^{n \times y}$ where $y$ is number of classes, and optimize cross-entropy objective: \begin{equation} \label{eq:xe_mp} \min_{ \{\mathbf{W}_j\}_{j=1}^L} - \mathbf{Y} \circ \log \mathbf{H} - (1-\mathbf{Y}) \circ \log (1-\mathbf{H}), \end{equation} where $\mathbf{Y}$ is a binary matrix with one-hot rows indicating node labels. $\circ$ is Hadamard product. in semi-supervised node classification settings where not all nodes are labeled, before measuring the objective, subset of rows can be kept in $\mathbf{Y}$ and $\mathbf{H}$ that correspond to labeled nodes. \item[(ii)] \textit{Network embedding} methods map nodes onto a $z$-dimensional vector space $\mathbf{Z} \in \mathbb{R}^{n \times z}$. Modern approaches train skipgram models (e.g. word2vec \citep{word2vec}) on sampled random walks. It has been shown that these skipgram network embedding methods, including DeepWalk \citep[][]{perozzi2014deepwalk}) and node2vec \citep[][]{grover2016node2vec}, with a learning process of walk sampling followed by positional embedding, can be approximated as a matrix deomposition \citep{ultimatewalk, wys, qiu2018network}. We point the curious reader to the listed papers for how the decomposition was derived, but show here the derivation of \citet[WYS,][]{wys}, as it performs well in our experiments: \begin{equation} \label{eq:embedding} \min_{\mathbf{Z}} - \mathbf{M}^{^\textrm{(WYS)}} \circ \log h(\mathbf{Z}) - (1 - \mathbf{A}) \circ \log (1 - h(\mathbf{Z})), \end{equation} where $h(\mathbf{Z})=h([ \begin{matrix}[c;{1pt/1pt}c] \mathbf{L} & \mathbf{R} \end{matrix} ] ) =(1+\exp(\mathbf{L} \times \mathbf{R}^\top ))^{-1}$ i.e. $\mathbf{Z}$ concatenates $\mathbf{L}, \mathbf{R} \in \mathbb{R}^{n \times \frac{z}{2}}$ and $h$ is the logistic of their cross-correlation (pairwise dot-products). $\mathbf{M}^{^\textrm{(WYS)}} =\sum_i^C (\mathbf{D}^{-1} \mathbf{A})^i \mathbf{c}_i = \sum_{i=1}^C \mathcal{T}^i \mathbf{c}_i$, where $\mathcal{T}$ is the transition matrix, $\mathbf{D}=\textrm{diag}(\mathbf{1}^\top \mathbf{A})$ is diagonal degree matrix, and we fix vector $\mathbf{c}$ to staircase: $\mathbf{c}_i = C-i+1$. For instance, $\mathbf{c} = [4, 3, 2, 1]$ for context size $C=4$. \end{itemize} \section{Our Proposed Convex Objectives} \label{sec:cvx} \subsection{Network Embedding Model} \label{sec:embeddingmodel} Objective in Eq~\ref{eq:embedding} learns node embeddings $\mathbf{Z}=[\begin{matrix}[c;{1pt/1pt}c] \mathbf{L} & \mathbf{R} \end{matrix}] \in \mathbb{R}^{n \times z}$ using cross-entropy. The terms: model output (outer product, $\sigma(\mathbf{L} \times \mathbf{R}^\top)$), negatives (non-edges, $1-\mathbf{A}$), and positives (expected number of node pairs covisits, $\mathbf{M}$), are all dense matrices with $\mathcal{O}(n^2) \gg m$ nonzero entries. For instance, even a relatively-small social network with $n$=100,000 and average degree of 100 (i.e. $m=100n$) would produce an $\mathbf{M}$ occupying $\approx$40GB memory, whereas one can do the entire learning with $\approx$40MB memory using functional SVD (§\ref{sec:fsvd}). We start by designing a matrix $\widehat{\mathbf{M}}^{^\textrm{(WYS)}}$ incorporating positive and negative information ($\mathbf{M}^{^\textrm{(WYS)}}$ and $1 - \mathbf{A}$) as: \begin{align} \widehat{\mathbf{M}}^{^\textrm{(WYS)}} &= \mathbf{M}^{^\textrm{(WYS)}} - \lambda (1 - \mathbf{A}) = \sum_i \mathcal{T}^i \mathbf{c}_i - \lambda (1 - \mathbf{A}), \label{eq:m_wys} \end{align} with coefficient $\lambda \ge 0$ weighing negative samples. We use $\widehat{\ .\ }$ to denote our convexification. \textbf{Learning:} We can directly set $\mathbf{Z}$ to the SVD \textit{basis} $(\mathbf{U}, \mathbf{S}, \mathbf{V})$. Matrix $\widehat{\mathbf{M}}^{^\textrm{(WYS)}}$ has large entry $\widehat{\mathbf{M}}_{uv}$ when nodes ($u, v$) are well-connected (co-visited many times, during random walks) and small if they are non-edges. SVD provides a rank $k$ estimator of $\widehat{\mathbf{M}}$ as $\widehat{\mathbf{L}} \widehat{\mathbf{R}}^\top \approx \widehat{\mathbf{M}}$ i.e. with minimum Frobenius norm of error. We can set the network embedding model parameters $\mathbf{Z}=[\begin{matrix}[c;{1pt/1pt}c] \widehat{\mathbf{L}} & \widehat{\mathbf{R}} \end{matrix}]$ as: \begin{align} \textrm{SVD}(\widehat{\mathbf{M}}, k) & \leftarrow \argmin_{\widehat{\mathbf{U}}_k \widehat{\mathbf{S}}_k \widehat{\mathbf{V}}_k} \left|\left| \widehat{\mathbf{M}} - \widehat{\mathbf{U}}_k \widehat{\mathbf{S}}_k \widehat{\mathbf{V}}_k^\top \right|\right|_F^2 =\argmin_{\widehat{\mathbf{U}}_k \widehat{\mathbf{S}}_k \widehat{\mathbf{V}}_k} \left|\left| \widehat{\mathbf{M}} - \underbrace{\left(\widehat{\mathbf{U}}_k \widehat{\mathbf{S}}_k^\frac12\right)}_{\triangleq \widehat{\mathbf{L}} } \underbrace{\left(\widehat{\mathbf{S}}_k^\frac12 \widehat{\mathbf{V}}_k^\top\right)}_{\triangleq \widehat{\mathbf{R}}^\top } \right|\right|_F^2 \end{align} \begin{flalign} \label{eq:compute_lr} \textrm{Learning follows as:} \hspace{0.6cm} \widehat{\mathbf{U}}_k, \widehat{\mathbf{S}}_k, \widehat{\mathbf{V}}_k \leftarrow \textrm{SVD}(\widehat{\mathbf{M}}^{^\textrm{(WYS)}}, k); \hspace{0.6cm} \widehat{\mathbf{L}} \leftarrow \widehat{\mathbf{U}}_k \widehat{\mathbf{S}}_k^{\frac12}; \hspace{0.6cm} \widehat{\mathbf{R}} \leftarrow \widehat{\mathbf{V}}_k \widehat{\mathbf{S}}_k^{\frac{1}{2}} && \end{flalign} \begin{flalign} \textrm{\textbf{Inference:} Given query edges $Q=\{(u_i, v_i)\}_i$, one can compute model:} \hspace{0.1cm} \mathbf{H}_Q = \widehat{\mathbf{R}}_{\{v\}_i}^\top \widehat{\mathbf{L}}_{\{u\}_i}, && \end{flalign} where the (RHS) set-subscript denotes \textit{gathering} rows ({a.k.a, advanced indexing}), and $\mathbf{H}_Q \in \mathbb{R}^{|Q|}$. \subsection{Messaging Passing Models} \label{sec:classification_learning} We can linearize \textbf{message passing} models (Eq.~\ref{eq:prelim_mp}) by assuming all $\sigma$'s are identity ($\sigma(.) = .)$. Let $g = g_1 = g_2 = \dots$, specifically let $g(\mathbf{A}) = (\mathbf{D} + \mathbf{I})^{\sfrac{-1}{2}} (\mathbf{A} + \mathbf{I}) (\mathbf{D} + \mathbf{I})^{\sfrac{-1}{2}}$ per renormalization trick of \citep{kipf}. A linear $L$-layer message passing network can be: \begin{equation} \label{eq:h_jkn} \widehat{\mathbf{H}} = \underbrace{\left[ \begin{matrix}[c;{1pt/1pt}c;{1pt/1pt}c;{1pt/1pt}c;{1pt/1pt}c] \mathbf{X} & g(\mathbf{A}) \mathbf{X} & g(\mathbf{A})^2 \mathbf{X} & \dots & g(\mathbf{A})^L \mathbf{X} \end{matrix} \right]}_{\hspace{1.2cm} \overset{\Delta}{=} \ \ \widehat{\mathbf{M}}^{\textrm{(JKN)}} } \widehat{\mathbf{W}}. \end{equation} Concatenation of all layers was proposed in Jumping Knowledge Networks \citep[JKN,][]{jknet}. \begin{flalign} \textrm{\textbf{Learning:} We optimize $\widehat{\mathbf{W}}$ with:} \hspace{1cm} \min_{\widehat{\mathbf{W}}} ||\widehat{\mathbf{H}} - \mathbf{Y}||_F^2 = \min_{\widehat{\mathbf{W}}} ||\widehat{\mathbf{M}}^{\textrm{(JKN)}} \widehat{\mathbf{W}} - \mathbf{Y}||_F^2 && \label{eq:min_mp} \end{flalign} Loss in Equation \ref{eq:min_mp} can perform well on classification tasks, and according to \citet{hui2021squareloss}, as well as the cross entropy loss defined in Equation \ref{eq:xe_mp}. Taking $\nabla_{\widehat{\mathbf{W}}} $ of Eq.~\ref{eq:min_mp} then setting to zero, \begin{flalign} \textrm{yields minimizer:} \hspace{1cm} \widehat{\mathbf{W}}^* \triangleq \argmin_{\widehat{\mathbf{W}}} ||\widehat{\mathbf{M}}^{\textrm{(JKN)}} \widehat{\mathbf{W}} - \mathbf{Y}||_F^2 = \left(\widehat{\mathbf{M}}^{\textrm{(JKN)}}\right)^\dagger \mathbf{Y}.&& \end{flalign} Rank-$k$ SVD can estimate $\left(\widehat{\mathbf{M}}^{\textrm{(JKN)}}\right)^\dagger$ and hence $\widehat{\mathbf{W}}^*$ as: \begin{equation} \widehat{\mathbf{U}}_k, \widehat{\mathbf{S}}_k, \widehat{\mathbf{V}}_k \leftarrow \textrm{SVD}(\widehat{\mathbf{M}}^{^\textrm{(JKN)}}, k); \hspace{1cm} \widehat{\mathbf{W}}^* \leftarrow (\widehat{\mathbf{V}}_k (\widehat{\mathbf{S}}_k^{-1} (\widehat{\mathbf{U}}_k^\top \mathbf{Y}))). \label{eq:w_svd} \end{equation} Order of multiplications in Eq.~\ref{eq:w_svd} is for efficiency. Further, in the case when only subset of nodes $\mathcal{V} = \{v\}_v$ have labels, the right-most multiplication of Eq.~\ref{eq:w_svd} could restricted to the labeled nodes. Let $\mathbf{Y}_{\mathcal{V}}$ be a matrix of $|\mathcal{V}|$ rows selected from $\mathbf{Y}$ according to elements $\mathcal{V}$. The right-most multiplication of Eq.~\ref{eq:w_svd} can modified to: ${{\widehat{\mathbf{U}}_{k_\mathcal{V}}}^\top} \mathbf{Y}_\mathcal{V}$. \section{Functional Singular Value Decomposition} \vspace{-0.3cm} \label{sec:fsvd} We do not have to explicitly calculate the matrices $\widehat{\mathbf{M}}$. Rather, we only need to implement product functions $f_{\widehat{\mathbf{M}}}(\mathbf{v}) = \langle \widehat{\mathbf{M}}, \mathbf{v} \rangle $ that can multiply $\widehat{\mathbf{M}}$ with arbitrary (appropriately-sized) vector $ \mathbf{v}$. We implement a (TensorFlow) \textbf{functional} version of the randomized SVD algorithm of \citet{halko2009svd}, that accepts $f_{\widehat{\mathbf{M}}}$ rather than $\widehat{\mathbf{M}}$. We show that it can train our models quickly and with arbitrarily small approximation error (in linear time of graph size, in practice, with less than 10 passes over the data) and can yield l2-regularized solutions for classification (see Appendix). We now need the (straightforward $f_{\widehat{\mathbf{M}}^{^\textrm{(WYS)}}}$ and $f_{\widehat{\mathbf{M}}^{^\textrm{(JKN)}}}$. We leave the second outside this writing. For the first, the non-edges term, $(1 - \mathbf{A})$, can be re-written by explicit broadcasting as $(\mathbf{1}\mathbf{1}^\top - \mathbf{A})$ giving \begin{equation} \label{eq:fmwys} f_{\widehat{\mathbf{M}}^{^\textrm{(WYS)}}}(\mathbf{v}) = \sum_i \underbrace{(\mathcal{T})^i \mathbf{v}}_{\mathcal{O}(im)} \mathbf{c}_i - \lambda \mathbf{1} \underbrace{(\mathbf{1}^\top \mathbf{v})}_{\mathcal{O}(n)} + \lambda \underbrace{\mathbf{A} \mathbf{v}}_{\mathcal{O}(m)}. \end{equation} All matrix-vector products can be efficiently computed when $\mathbf{A}$ is sparse. \section{Experimental Results (details in Appendix)} \label{sec:exp} \vspace{-0.3cm} \begin{figure}[h] \includegraphics[width=\linewidth]{linkpred_time.pdf} \vspace{-25pt} \caption{ROC-AUC versus train time of methods on datasets. Each dataset has a distinct shape, with shape size proportional to graph size. Each method uses a different color. Our methods are in blue (dark uses SVD rank $k=32$, light uses $k=100$, trading estimation accuracy for train time). Ideal methods should be placed on top-left corner (i.e., higher test ROC-AUC and faster training).} \end{figure} \begin{figure}[h] \includegraphics[width=0.49\linewidth]{sensitivity_planetoid.pdf} \includegraphics[width=0.49\linewidth]{sensitivity_k_linkpred.pdf} \vspace{-15pt} \caption{Sensitivity Analysis. \textbf{Left}: Test Accuracy VS Depth of model defined by $\widehat{\mathbf{M}}^{^\textrm{(JKN)}}$. \textbf{Right}: Test ROC-AUC VS rank of SVD on $\widehat{\mathbf{M}}^{^\textrm{(WYS)}}$.} \label{fig:sensitivity} \end{figure} \begin{table}[h] \caption{Test Performance. \textbf{Left}: accuracy (training time) for Semi-supervised Node Classification, over citation datasets. \textbf{Right}: ROC-AUC for link prediction when embedding with $z$=64=$2k$.} \label{table:results} \begin{adjustwidth}{-8pt}{-8pt} \begin{tabular}{r| l | l| l} \toprule & \multicolumn{1}{c|}{\textbf{Cora}} & \multicolumn{1}{c|}{\textbf{Citeseer}} & \multicolumn{1}{c}{\textbf{Pubmed}} \\ \hline Planetoid & 75.7 (13s) & 64.7 (26s) & 77.2 (25s) \\ GCN & 81.5 (4s) & 70.3 (7s) & 79.0 (83s) \\ GAT & 83.2 (1m23s) & 72.4 (3m27) & 77.7 (5m33s) \\ MixHop & 81.9 (26s) & 71.4 (31s) & 80.8 (1m16s) \\ GCNII & 85.5 (2m29s) & 73.4 (2m55s) & 80.3 (1m42s) \\ \hline \hline $f_{\widehat{\mathbf{M}}^\textrm{(JKN)}}$ & 82.4 (0.28s) & 72.2 (0.13s) & 79.7 (0.14s) \\ \bottomrule \end{tabular}{} \hspace{5pt} \setlength\tabcolsep{2pt} \begin{tabular}{r| c | c | c | c} \toprule & \multicolumn{1}{c|}{\textbf{FB}} & \multicolumn{1}{c|}{\textbf{AstroPh}} & \multicolumn{1}{c|}{\textbf{HepTh}} & \multicolumn{1}{c}{\textbf{PPI}} \\ \hline WYS & 99.4 & 97.9 & 93.6 & 89.8 \\ n2v & 99.0 & 97.8 & 92.3 & 83.1 \\ NetMF & 97.6 & 96.8 & 90.5 & 73.6 \\ $\widetilde{\textrm{NetMF}}$ & 97.0 & 81.9 & 85.0 & 63.6 \\ \hline \hline $f_{\widehat{\mathbf{M}}^\textrm{(WYS)}}$ & 98.7 & 92.1 & 89.2 & 87.9 \\ ($k$=100) & 98.7 & 96.0 & 90.5 & 86.2 \\ \bottomrule \end{tabular}{} \end{adjustwidth} \end{table} \newpage \subsubsection*{Acknowledgments} This material is based upon work supported by the Defense Advanced Research Projects Agency (DARPA) and the Army Contracting Command-Aberdeen Proving Grounds (ACC-APG) under Contract Number W911NF-18-C-0020.
\subsubsection*{\bibname}} \bibliographystyle{apalike} \usepackage[utf8]{inputenc} % \usepackage[T1]{fontenc} % \usepackage{hyperref} % \usepackage{url} % \usepackage{booktabs} % \usepackage{amsfonts} % \usepackage{nicefrac} % \usepackage{microtype} % \usepackage{xcolor} % \usepackage{caption} \usepackage{subcaption} \usepackage{multirow} \usepackage{amsmath} \usepackage[ruled, lined, linesnumbered, commentsnumbered, longend]{algorithm2e} \usepackage{todonotes} \input{preamble} \usepackage{cleveref} \crefformat{footnote}{#2\footnotemark[#1]#3} \begin{document} \runningauthor{Zhu, Kouridi, Nemmour, Sch\"olkopf} \twocolumn[ \aistatstitle{Adversarially Robust Kernel Smoothing} \aistatsauthor{ Jia-Jie Zhu \\ Empirical Inference Department\\ Max Planck Institute for Intelligent Systems\\ T\"ubingen, Germany\\ and Weierstrass Institute\\ Berlin, Germany\\ \texttt{<EMAIL>} \And Christina Kouridi\\ Empirical Inference Department\\ Max Planck Institute for Intelligent Systems\\ T\"ubingen, Germany \\ Currently at InstaDeep Ltd.\\ London, United Kingdom \\ \texttt{<EMAIL>} \AND Yassine Nemmour \\ Empirical Inference Department\\ Max Planck Institute for Intelligent Systems\\ T\"ubingen, Germany \\ \texttt{<EMAIL>} \And Bernhard Sch\"olkopf\\ Empirical Inference Department\\ Max Planck Institute for Intelligent Systems\\ T\"ubingen, Germany \\ \texttt{<EMAIL>}} \aistatsaddress{ } ] \begin{abstract} We propose a scalable robust learning algorithm combining kernel smoothing and robust optimization. Our method is motivated by the convex analysis perspective of distributionally robust optimization based on probability metrics, such as the Wasserstein distance and the maximum mean discrepancy. We adapt the integral operator using supremal convolution in convex analysis to form a novel function majorant used for enforcing robustness. Our method is simple in form and applies to general loss functions and machine learning models. Exploiting a connection with optimal transport, we prove theoretical guarantees for certified robustness under distribution shift. Furthermore, we report experiments with general machine learning models, such as deep neural networks, to demonstrate competitive performance with the state-of-the-art certifiable robust learning algorithms based on the Wasserstein distance. \end{abstract} \input{sections/main} \section*{Acknowledgements} We thank the anonymous reviewers for their constructive comments during the review process. We also thank Simon Buchholz for sending us helpful feedback on the initial manuscript. This project received support from the German Federal Ministry of Education and Research (BMBF): Tübingen AI Center, FKZ: 01IS18039B. \subsection{Adversarially Robust Kernel Smoothing} \label{sec:smooth} \input{sections/smooth.tex} \section{Introduction} When learning with finitely many samples, there is an inevitable distribution shift between the training data and the test data, characterized by empirical process theory \citep{vaartWeakConvergenceEmpirical2013}. A lack of causal inference can also cause learners to lose robustness under the shifted distribution \citep{meinshausenCausalityDistributionalRobustness2018}. Furthermore, potential malicious \emph{adversaries} may create large artificial distribution shifts to hamper modern deep learners \citep{madryDeepLearningModels2019}. Hence, learning under \emph{distribution shift} presents significant challenges to current machine learning algorithms. \emph{Distributionally robust optimization} (DRO) \citep{delageDistributionallyRobustOptimization2010,scarfMinmaxSolutionInventory1958} seeks to robustify against unknown distribution shift explicitly. Given a loss function of interest $l(\var, \cdot)$, it solves a \emph{robust optimization} \citep{soysterTechnicalNoteConvex1973,ben-talRobustOptimization2009a} problem \newcommand{\eqref{eq:dro_intro}}{\eqref{eq:dro_intro}} \begin{equation} \label{eq:dro_intro} \min_\var \sup_{P\in \mathcal C}\expected{\xi\sim P} l(\var, \xi), \end{equation} where \var is the decision variable, $\xi$ noise or randomness, $\mathcal C$ a set of distributions over the uncertain variable $\xi$ that the optimizer wishes to robustify against, often referred to as the \emph{ambiguity set}. DRO is particularly relevant to statistical machine learning as one may construct the ambiguity set $\mathcal C$ as a metric ball centering at the empirical distribution $\pemp$ that also contains the true data-generating distribution $\ptrue$. For example, the performance guarantees for Wasserstein DRO have been established by \cite{mohajerinesfahaniDatadrivenDistributionallyRobust2018,zhaoDatadrivenRiskaverseStochastic2018}. Here, the idea is to use known convergence rate results for empirical estimations of the underlying probability metrics, e.g., the Wasserstein metrics \citep{kantorovichSpaceTotallyAdditive1958} and the closely related \emph{integral probability metrics} (IPM) \citep{sriperumbudurEmpiricalEstimationIntegral2012,mullerIntegralProbabilityMetrics1997}. Such metrics (or topologies) often correspond to smooth functions as their dual spaces, which characterize the empirical distribution's convergence to the true data-generating distribution \citep{vaartWeakConvergenceEmpirical2013,billingsleyWeakConvergenceMeasures1971}. Researchers have proposed DRO algorithms with various statistically meaningful ambiguity sets in a large body of literature. While not the focus of previous works, convex analysis tools play important roles in enforcing distributional robustness. They are the primary tools we employ in this paper. Certain simple DRO problems, such as linear classification with logistic regression losses, admit the tractable reformulation into convex problems, as studied by \cite{ben-talRobustSolutionsOptimization2013,namkoongVariancebasedRegularizationConvex,mohajerinesfahaniDatadrivenDistributionallyRobust2018,blanchetOptimalTransportBased2018,shafieezadeh-abadehDistributionallyRobustLogistic2015}. However, this only applies to a limited class of convex loss functions and simple models, as also noted by, e.g., \cite{sinhaCertifyingDistributionalRobustness2017}. For general machine learning models, e.g., deep neural networks (DNNs), and common losses $l$ in \eqref{eq:dro_intro}, there exists no tractable reformulation to solve DRO~\eqref{eq:dro_intro}. This paper addresses general losses in machine learning tasks, which are less explored in terms of principled distributional robustness, save very few exceptions such as \cite{sinhaCertifyingDistributionalRobustness2017,blanchetOptimalTransportBased2018,zhuKernelDistributionallyRobust2020d}. \newcommand{worst-case\xspace}{worst-case\xspace} \paragraph{Contribution.} This paper leverages the critical roles smoothness and function majorants play in enforcing distributional robustness. We summarize our contributions and sketch the main results. \begin{enumerate}[noitemsep,topsep=0pt] \item We analyze the smooth function majorant perspective of distributional robustness, which generalizes the existing practice of using the Moreau-Yosida regularization\xspace in \wdro to flexibly chosen general majorants surrogate losses. Specifically, we propose the $k$-transform\xspace (Definition~\ref{def:ktran}) that adapts the convolution in the integral operator to the supremal convolution in convex analysis to form a new function majorant. \item Using those tools, we propose a novel robust learning algorithm (Section~\ref{sec:algs}), the \emph{adversarially robust kernel smoothing} (\sdro). It solves the minimax program \begin{equation} \min_\var \frac{1}N\sum_{i=1}^N \Bigg\{ \kconvmult{\xi_i} \Bigg\}. \end{equation} \item Exploiting a connection between the $k$-transform\xspace and optimal transport (OT), we provide theoretical guarantees in terms of robustness certificate for \sdro under distribution shift. Highlighting the role of kernel bandwidth, our analysis unifies the two perspectives of DRO using OT and kernel methods. \item While \sdro is derived from kernel methods, it can be easily applied to large-scale machine learning with DNNs. For example, we report an experiment with a ResNet-20 model, where applying exact \wdro reformulation techniques (e.g.,~\citep{mohajerinesfahaniDatadrivenDistributionallyRobust2018,shafieezadeh-abadehDistributionallyRobustLogistic2015}) is out of the question. There, \sdro performs at least competitively with the WRM algorithm \eqref{eq:sinha}\xspace proposed by \cite{sinhaCertifyingDistributionalRobustness2017}. \item Our code is publicly available online at \url{https://github.com/christinakouridi/arks}. \end{enumerate} \paragraph*{Notation.} \input{sections/notation.tex} \section{Reproducing Kernel Hilbert Spaces} \label{sec:bg_apprx} A learning task can be mathematically described as a function approximation problem ${\min_{f\in H}\|f - l\|_{\cdot}}$, for some criterion $\|\|_{\cdot}$, e.g., function norm. The target function $l$ is often only known at certain data points $[x_1, ..., x_N]$. One way to approach the function approximation problem is to consider a function approximator of the form $ \sum_{j=1}^N a_j k (x_i,x_j) = l(x_i), 1\leq i\leq N, $ where $a_j$ are the coefficients to be determined and $k (x_i,x_j)$ some bi-variate function. It is in our interest that the matrix $[k (x_i,x_j)]_{i,j}$ should be positive definite. Motivated by this, we now define a symmetric real-valued function $k$ as a positive (semi-)definite kernel if $\sum_{i=1}^n \sum_{j=1}^n a_i a_j k(x_i, x_j)\ge 0$ for any $n \in \mathbb{N}$, $\{ x_i \}_{i=1}^n \subset \mathcal{X}$, and $\{a_i\}_{i=1}^n \subset \mathbb{R}$. It is known \citep[e.g.][Chapter 2]{SchSmo02} that there is a one-to-one relationship between every positive semi-definite kernel $k$ and a Hilbert space \ensuremath{\mathcal H}\xspace, whose feature map $\phi\colon \mathcal{X} \to \ensuremath{\mathcal H}\xspace$ satisfies $k(x,y) = \langle \phi(x), \phi(y) \rangle_\ensuremath{\mathcal H}\xspace$. This Hilbert space is \emph{reproducing}, meaning that $f(x) = \langle f, \phi(x) \rangle_\ensuremath{\mathcal H}\xspace$ for all $f\in \ensuremath{\mathcal H}\xspace, x \in \mathcal{X}$. We call \ensuremath{\mathcal H}\xspace the reproducing kernel Hilbert space (RKHS), also termed the native space of the kernel $k$. RKHSs are widely used in function approximation based on data due to their attractive properties. In addition to the functional approximation aspect, the RKHS has also been recently used to manipulate distributions, leveraging its statistical properties as the so-called Glivenko-Cantelli classes; cf. \citep{vaartWeakConvergenceEmpirical2013}. Relevant to the robustness aspect, the \emph{maximum mean discrepancy} (MMD, \citep{grettonKernelTwoSampleTest2012}) associated with an RKHS \ensuremath{\mathcal H}\xspace is a metric in the probability simplex, $ \gamma_\ensuremath{\mathcal H}\xspace(P, Q ) = \sup_{ \|f\|_\ensuremath{\mathcal H}\xspace \le 1} \int f \, d(P-Q), $ given the associated kernel is characteristic. In particular, the minimax optimal rate for the MMD empirical estimation has been studied by \cite{tolstikhin2016minimax}, which can be used to set the ambiguity set level $\epsilon$ in the DRO problem~\eqref{eq:kdro_dual} with computable constants, independent of the dimensions. In contrast, measure concentration rates (used for \wdro in \citep{mohajerinesfahaniDatadrivenDistributionallyRobust2018}) for the \wsd are dimension-dependent. The MMD also has a closed-form estimator, while computing \wsd is hard in general~\citep{peyreComputationalOptimalTransport2019,santambrogioOptimalTransportApplied2015}. MMD can be generalized to the integral probability metrics (IPM)~\citep{mullerIntegralProbabilityMetrics1997} defined by some function class $\mathcal F$, i.e., ${\ipm (P,\hat{P}):=\sup_{f\in \mathcal F}\int f d (P-\hat{P})}.$ The well-known choices relevant to this paper include: $\mathcal F=\{f:\lnorm{f}\leq 1\}$ recovers the type-1 Wasserstein metric (Kantorovich metric); the RKHS norm-ball $\mathcal F=\{f:\hnorm{f}\leq 1\}$ recovers the MMD. Given a kernel $k$ and probability measure $\mu$, recall that the integral operator $\kop{}: L^2_\mu\to \ensuremath{\mathcal H}\xspace$ is defined as \begin{equation} \label{eq:int_op} \begin{aligned} \kop{}\ l (x) := \int l(z) k(x,z) d\mu(z). \end{aligned} \end{equation} The integral operator maps $L^2_\mu$ to a subspace of the RKHS \citep{wendlandScatteredDataApproximation2004,conwayCourseFunctionalAnalysis2019} and is used in the celebrated Mercer's theorem to characterize the eigendecomposition of RKHS functions. In the context of this paper, we view the integral operator as a smoothing operation. \section{Distributionally Robust Optimization for Machine Learning} \label{sec:bg_dro} We limit our discussion to DRO using the Wasserstein metrics~\citep{mohajerinesfahaniDatadrivenDistributionallyRobust2018,zhaoDatadrivenRiskaverseStochastic2018,gaoDistributionallyRobustStochastic2016,blanchetQuantifyingDistributionalModel2017}, the MMD~\citep{zhuKernelDistributionallyRobust2020d,staibDistributionallyRobustOptimization2019}, and general IPMs~\citep{zhuKernelDistributionallyRobust2020d}. See \citep[Section~1.1]{gaoDistributionallyRobustStochastic2016,grettonKernelTwoSampleTest2012,arbelGradientRegularizersMMD2021,peyreComputationalOptimalTransport2019,weedSharpAsymptoticFinitesample2017} for the details of why those probability metrics are more advantageous in many machine learning applications than, e.g., $f$-divergences. For convenience, we now restate the data-driven DRO primal formulation in \eqref{eq:dro_intro} with a probability discrepancy constraint. \begin{equation} \label{eq:dro_metric} (\emph{DRO-\textrm{Primal}}):\ \min_\var \sup_{\gamma(P,\pemp)\leq\epsilon}\expected{P} l(\var, \xi), \end{equation} The discrepancy measure $\gamma$ in \eqref{eq:dro_metric} can be chosen to be an IPM or OT metric. In general, solving the minimax DRO problem~\eqref{eq:dro_metric} requires a reformulation via the duality of conic linear optimization, cf. \citep{shapiroDualityTheoryConic2001,ben-talDerivingRobustCounterparts2015}. While the \wsd has become the most popular choice for the DRO problem, it is important to understand that one \emph{cannot} simply reformulate any \wdro problem as a convex program, except for very simple losses such as logistic regression~\citep{shafieezadeh-abadehDistributionallyRobustLogistic2015}. Unfortunately, for many practical machine learning models, there exists no exact tractable reformulation. Popular \wdro approaches such as those proposed in \citep{mohajerinesfahaniDatadrivenDistributionallyRobust2018,zhaoDatadrivenRiskaverseStochastic2018} apply to a limited class of loss functions and models, such as logistic regression (linear classification). Moreover, it is also known that estimating the Lipschitz constant for general models is intractable; cf. \citep{virmauxLipschitzRegularityDeep2018,biettiKernelPerspectiveRegularizing2019}, making Lipschitz regularization in \citep{shafieezadeh-abadehRegularizationMassTransportation2019} difficult. This paper does not impose such restrictions on losses or models. For commonly-used machine learning losses, it is well-known that one must resort to general approximate solution methods such as in~\citep{sinhaCertifyingDistributionalRobustness2017,blanchetOptimalTransportBased2018,zhuKernelDistributionallyRobust2020d}. Most relevant to our work, the authors of \citep{sinhaCertifyingDistributionalRobustness2017} proposed to \emph{give up} certifying the exact distributional robustness level $\epsilon$ and apply a convexification technique using the Moreau-Yosida regularization\xspace, as approximate \wdro. They solve the risk minimization problem, which they termed Wasserstein robust method (WRM), \begin{multline} \label{eq:sinha} (\emph{WRM}):\ \min_\var\frac{1}N\sum_{i=1}^N \Big\{ \widehat{f^y_\var}(\xi_i):= \sup_u\{l(\var,u)\\ - y\cdot c(u, \xi_i)\} \Big\}, \end{multline} where $c$ is called the transport cost \citep{santambrogioOptimalTransportApplied2015}. For example, when $c$ is the squared Euclidean distance, $\widehat{f^y_\var}(\xi_i) $ is referred to as the Moreau-Yosida regularization or Moreau envelope\xspace. In that setting, WRM overcomes the hurdle of the aforementioned hardness of DRO for general machine learning tasks by virtue of a convexification effect. Intuitively, subtracting a strongly convex function makes the inner objective more concave. This technique was also used in robust nonlinear optimization \citep{houskaNonlinearRobustOptimization2013}, trust-regions in numerical optimization (Chapter~4 of \citep{nocedal2006numerical}), and the S-procedure in robust control~\citep{polikSurveySLemma2007,yakubovichSprocedureNolinearControl1971}. We refer interested readers to those works for detailed numerical procedures. Later, we compare our novel kernel smoothing algorithm with WRM~\citep{sinhaCertifyingDistributionalRobustness2017} in experiments with general machine learning models, e.g., DNNs, to demonstrate our advantages over classical reformulation techniques. On the other hand, if we choose the metric $\gamma$ to be an IPM associated with the function class $\mathcal F\subseteq \ensuremath{\mathcal H}\xspace$, \cite{zhuKernelDistributionallyRobust2020d} proved the IPM-DRO duality. It states that the primal DRO problem~\eqref{eq:dro_metric} is equivalent to solving the variational optimization problem \begin{equation} \begin{aligned} \vspace{-0.2cm} (\emph{IPM-DRO}):\ &\min_{ \var,f\in{\mathcal H}}& & \frac{1}N\sum_{i=1}^N f(\xi_i)+ \epsilon\hnorm{f}\\ &\sjt& & l(\var, \xi) \leq f(\xi) ,\ \forall \xi \in\ensuremath{\mathcal X}\xspace a.e. \end{aligned} \label{eq:kdro_dual} \end{equation} Those authors also proposed approximate solution methods when the IPM is chosen as the MMD (see Section~\ref{sec:bg_apprx} for the advantages of MMD), which generalized the results of \cite{staibDistributionallyRobustOptimization2019} to general loss functions. Through the lens of this paper, \eqref{eq:kdro_dual}\xspace explicitly seeks an upper \emph{envelope} $f$ of the loss $l$ as solutions to the variational dual program~\eqref{eq:kdro_dual}. Instead of the Moreau-Yosida regularization, the smooth majorant role there is played by a more general smooth function $f\in\ensuremath{\mathcal H}\xspace$. Note that program~\eqref{eq:kdro_dual} is trivial if the loss $l$ is in an \ensuremath{\mathcal H}\xspace and has a known RKHS norm. The authors of \citep{zhuKernelDistributionallyRobust2020d} then proposed \kdro that makes it possible to use the MMD associated with any universal RKHSs for DRO and compute the rate for general losses. To our knowledge, that is the only work aiming to exactly reformulate DRO for general machine learning models. Compared to their method, we provide an approach that produces a function that satisfies the (semi-)infinite constraint in \eqref{eq:kdro_dual}, whereas \cite{zhuKernelDistributionallyRobust2020d}'s method can only satisfy that constraint approximately through constraint sampling. To motivate our method, we make two key observations into \eqref{eq:sinha}\xspace: (1) the absence of the robustness level $\epsilon$ and (2) the fixed dual variable $y$. That insight is also equivalent to \emph{giving up the exact minimization} w.r.t. $f\in\ensuremath{\mathcal H}\xspace$ and $\hnorm{f}$ in dual IPM-DRO~\eqref{eq:kdro_dual}, since fixing $y$ in \eqref{eq:sinha} is to not optimize w.r.t. the Moreau envelope\xspace $\widehat{f^y_\var}$. This is equivalent to Lagrangian relaxation in nonlinear optimization. \section{A Kernel Smoothing Algorithm for Robust Learning} \label{sec:algs} \input{sections/practical.tex} \input{sections/theory.tex} \section{Numerical Experiments} \label{sec:exp} In this section, we empirically demonstrate that \sdro can easily work with DNN models, which is a limitation of typical existing DRO reformulation techniques. Our selection of neural architectures is meant to demonstrate the algorithmic robustification effect instead of achieving state-of-the-art benchmarks. To that end, we also ablate factors known to influence robustness, such as dropout if not specified. More details on our experimental setup, hyper-parameter selection, and additional experimental results can be found in the appendix. \begin{figure}[b!] \centering \vspace{-0.5cm} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/fmnist_pgd_all_no_pgd_type1.pdf} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/cifar_pgd_all_no_pgd_type1.pdf} \end{subfigure} \caption{Black-box PGD attack with respect to $\| . \|_\infty$ on the Fashion-MNIST (\textbf{top}) and CIFAR-10 (\textbf{bottom}) datasets. We show the classification error on perturbed test images versus the allowed magnitude of the adversarial perturbation $\Delta$. \sdro and WRM exhibit similar adversarial performance profiles; \sdro becomes more robust as the kernel width $\sigma$ increases, while WRM improves with a lower Lagrangian penalty $y$. For all algorithms, we report the mean and standard deviation across 10 random seeds.} \label{fig:pgd_attacks} \end{figure} \subsection{Robust Learning with DNNs} \label{subsec:exp_adv} We compare the following algorithms when applicable: \emph{(A)} \sdro~Algorithm~\ref{alg:smooth}, \emph{(B)} empirical risk minimization (ERM) and \emph{(C)} WRM~\citep{duchiStatisticsRobustOptimization2018}, as well as \emph{(D)} projected gradient descent (PGD) for training \citep{madryDeepLearningModels2019} (reported in the appendix since it is based on RO instead of DRO; We also refer to \citep{sinhaCertifyingDistributionalRobustness2017} for extensive comparisons of PGD against WRM) and \emph{(E)} (worst-case) robust optimization~\citep{ben-talRobustOptimization2009a,soysterTechnicalNoteConvex1973} (reported in the appendix since it is not applicable for deep learning tasks). We do not test classical \wdro algorithms, e.g. \citep{mohajerinesfahaniDatadrivenDistributionallyRobust2018,zhaoDatadrivenRiskaverseStochastic2018,shafieezadeh-abadehRegularizationMassTransportation2019}, since they cannot be applied to our test settings with general losses and DNN models. We further note that the classical type-2 \wdro reformulation is equivalent to WRM with the optimal dual variable. In our evaluation, the test data is perturbed with worst-case disturbances $\delta$ within a box $\{\delta: \| \delta\|_{\infty} \leq \Delta \}$. $\delta$ is generated by attacking the model trained with ERM (for each random seed) using the PGD algorithm. This type of attack is referred to as \textit{black-box}. The experiment is also performed with black-box fast-gradient sign method (FGSM) \citep{goodfellowExplainingHarnessingAdversarial2015} attacks with respect to $\| .\|_{\infty}$, as well as white-box PGD attacks; the results are included in the appendix. We note that our focus is to demonstrate the robustification effect of the algorithm in a known environment instead of benchmarking various attacks exhaustively. \textbf{Fashion-MNIST \citep{xiao2017fashionmnist} with CNN.} The top panel of Figure~\ref{fig:pgd_attacks} shows the classification error for increasing perturbation magnitude $\Delta$. We observe that ERM attains good performance when there is no perturbation but quickly underperforms as $\Delta$ increases. \sdro and WRM yield improved robustness while also achieving low test error under no perturbation. \sdro and WRM exhibit similar performance profiles; see the caption of Figure~\ref{fig:pgd_attacks}. To conclude, \sdro performs at least competitively with WRM. \textbf{CIFAR-10 \citep{cifar} with ResNet-20.} The above experiment is repeated for the CIFAR-10 dataset. We choose a deeper architecture, the ResNet-20 \citep{he2015deep} with batch normalization \citep{ioffe2015batch} and ReLU activations. During training, we noticed that WRM might require tuning $y$ to be arbitrarily large for stable performance under highly non-smooth losses, while $\sigma$ can be easily tuned within a small range. The results are shown on the bottom panel of Figure~\ref{fig:pgd_attacks}: \sdro exhibits improved robustness under adversarial perturbations with little to no training performance sacrifice and is at least competitive with WRM. \textbf{CelebA \citep{liu2015faceattributes} with CNN.} Experimental results -- similar to other datasets -- can be found in the appendix, while Figure~\ref{fig:celeba_imgs} illustrates examples of perturbed images generated during training. \begin{figure}[h!] \centering \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/celeba_imgs.png} \end{subfigure} \caption{\textbf{(top)} Perturbed images ($u^{*}$) maximizing the inner optimization of \sdro in CelebA binary classification. \textbf{(bottom)} Unperturbed counterpart. We observe that \sdro generates worst-case perturbations by creating interference around the eyes, reducing apparent separation between the two classes (with or without eye-wear).} \label{fig:celeba_imgs} \end{figure} \section{Discussion} \label{sec:discus} \input{sections/discuz.tex} \section{Certifying distributional robustness} We now detail the theoretical guarantees for our \sdro algorithm. Our analysis is based on an insight on the connection between our robustification scheme using the $k$-transform\xspace~\eqref{eq:ktrans} and OT. We first show that \sdro can be viewed as a robustification and convexification scheme in the log-transformed space. All proofs are given in the appendix. \subsection{Robustification in log scale} \newcommand{\ensuremath{\widehat{\ln l_{1/\sigma}}}}{\ensuremath{\widehat{\ln l_{1/\sigma}}}} We rewrite the surrogate loss $l^k_\var(\xi_i)$ of the inner optimization problem in \eqref{eq:ksmooth} by simplying taking the log transform, obtaining \begin{equation} \label{eq:intro_ctran_lnl} l^k_\var(\xi_i) = \exp \sup_u \Bigg\{ \ln l(u) -\frac{1}{\sigma}c(u,\xi_i) \Bigg\}. \end{equation} We exchanged the $\sup$ and $\exp$ above due to the monotonicity and continuity of the exponential function. Using the above relationship, we rewrite \sdro as the equivalent optimization problem \begin{multline} \label{eq:log} \min_\var \frac{1}N\sum_{i=1}^N \exp \Bigg\{ \ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi_i):= \\ \sup_u \big\{ \ln l(u) -\frac{1}{\sigma}c(u,\xi_i) \big\} \Bigg\} , \end{multline} where $\ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \cdot )$ denotes the (negative) $c$-transform\xspace of the log-loss $\ln l(\var, \cdot)$. The following lemma states that the inner maximization objective is concave for certain choices of the kernel bandwidth. Hence, standard analysis such as \citep{linGradientDescentAscent2021} applies to our setting. A function $f$ on $\mathbb R^d$ is said to be L-smooth if $ \|\nabla f(x)-\nabla f(y)\|_{2} \leq L\|x-y\|_2, \forall x,y\in\ensuremath{\mathcal X}\xspace, $ provided that all quantities exist. \begin{proposition} [Convexification] Suppose the function $\ln l(\var, \cdot)$ is L-smooth, transport cost $c$ is 1-strongly convex, and $\sigma < \frac{1}{L}$. Then, the inner maximization objective of \eqref{eq:log} is strictly concave. \label{thm:convexify} \end{proposition} In particular, Gaussian kernels with appropriately chosen bandwidths satisfy the assumptions in Proposition~\ref{thm:convexify}. The intuition is that, by moving the exponentiation outside, we see the convexification mechanism of \sdro more clearly: compared with \wdro, \sdro can be viewed as applying the $c$-transform\xspace as robustification in log scale. The log-transform in \eqref{eq:log} also gives us an intuition for choosing the kernel bandwidth $\sigma$ using the practice in proximal algorithms (Moreau-Yosida regularization). Alternatively, \eqref{eq:log} can also be seen as optimizing a (differentiable) \emph{softmax} version of the worst-case loss $\sup_{\xi\in\ensuremath{\mathcal X}\xspace}\ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi)$. \subsection{Certifying robustness under distribution shift using OT} \label{sec:theory} \newcommand{\raten}{\ensuremath{r_{N,\delta}}} % So far, it is not immediately clear how we can produce a certificate for the amount of robustness against distribution shift, or how to measure the distribution shift, e.g., in what metric? This section exploits the connection of our proposed $k$-transform\xspace and the $c$-transform\xspace to provide answers to those questions. Specifically, we bound the quantity when considering an arbitrary distribution $P$ that differs from the true data-generating distribution \ptrue. We then show that the \sdro procedure \eqref{eq:ksmooth} produces a robustness certificate in the setting of distribution shift. In the following, we assume that the $c$-transform\xspace $\ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi)$ (see \eqref{eq:log}) is bounded, i.e., $\exists M>0$ such that $ | \ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi) |\leq M, \forall \xi\in\ensuremath{\mathcal X}\xspace. $ As we have already shown that \ensuremath{\widehat{\ln l_{1/\sigma}}}{} is a \emph{majorant} of $\ln l$, the assumption also implies $ l (\var, \xi) \leq e^{M}. $ Intuitively, our analysis of \sdro certifies the robustness in log scale. Nonetheless, since the log function is monotone, we can still use OT distances to control the generalization under distribution shift. To ease the notation, put $\raten:=\sqrt{\frac{\ln(1/\delta)}{n}}$. \newcommand{\ensuremath{\operatorname{\mathcal{R}_N}}}{\ensuremath{\operatorname{\mathcal{R}_N}}} \newcommand{\ensuremath{\radm(\{\lnlsighat(\var, \cdot) | \var \in \Theta\})}}{\ensuremath{\ensuremath{\operatorname{\mathcal{R}_N}}(\{\ensuremath{\widehat{\ln l_{1/\sigma}}}(\var, \cdot) | \var \in \Theta\})}} \begin{proposition} [Certifying robustness against distribution shift] For any \var pointwise, there exists a constant $C>0$ such that, $\forall \rho > 0$, any probability measure $P$, and kernel bandwidth $\sigma>0$, the following holds except probability $\delta$: \begin{multline} \label{eq:certificate} \sup_{\gamma(P,\ptrue)\leq\rho} \expected{P}{\ln l (\var, \xi)} \leq\\ \ln \Bigg\{ \underbrace{ \frac1N\sum_{i=1}^N l^k_\var(\xi_i) }_{\textrm{\sdro{} objective}} \Bigg\} + \frac{\rho}{\sigma} +C\cdot \raten, \end{multline} where $\gamma$ is the \wsd associated with transport cost $c$. Furthermore, there exits a constant $C'$ that does not depend on \var such that the following holds except probability $\delta$: \begin{multline} \sup_{\gamma(P,\ptrue)\leq\rho} \expected{P}{\ln l (\var, \xi)} \leq \\ \ln \Bigg\{ \frac1N\sum_{i=1}^N l^k_\var(\xi_i) \Bigg\} + \frac{\rho}{\sigma}+C'\cdot \raten \\ +2\cdot \ensuremath{\radm(\{\lnlsighat(\var, \cdot) | \var \in \Theta\})} , \end{multline} where \ensuremath{\operatorname{\mathcal{R}_N}} denotes the Rademacher complexity. \label{thm:generalization} \end{proposition} The first two (non-diminishing) terms of the bound in \eqref{eq:certificate} RHS, $\ln \Bigg\{ \frac1N\sum_{i=1}^N l^k_\var(\xi_i) \Bigg\} + \frac{\rho}{\sigma}$, give us a \emph{computable robustness certificate} under the distribution shift from $\ptrue$ to arbitrary $P$. This is in line with the robustness certificate of \citep{sinhaCertifyingDistributionalRobustness2017,leeMinimaxStatisticalLearning2018a}, and different from typical statistical learning theory bounds. Furthermore, the robustness certificate is simply the log-transform of the \sdro objective plus the \emph{regularization} term $ \frac{\rho}{\sigma}$. \begin{remark} The bound for Rademacher complexity of common function classes is a well-studied topic in statistical learning theory. It also follows the Lipschitz composition rule. For example, for model classes such as RKHS functions with bounded norms $\{f\in\ensuremath{\mathcal H}\xspace|\hnorm{f}\leq R\}$ for $R>0$ and bounded kernels, the Rademacher complexity decays at the rate of $\frac{1}{\sqrt{N}}$. However, as mentioned earlier, we are interested in the function spaces that are more general and hence do not further expand on bounding the Rademacher term using specific spaces. We refer to more specialized texts such as \citep{vaartWeakConvergenceEmpirical2013} for more details and \citep{sinhaCertifyingDistributionalRobustness2017} for a recent application to robustness certificate. \end{remark} \paragraph{Unifying DRO using OT and kernel methods} Our analysis above establishes a non-trivial connection between two branches of DRO research using OT (e.g., \citep{mohajerinesfahaniDatadrivenDistributionallyRobust2018,sinhaCertifyingDistributionalRobustness2017}) and kernel methods \citep{zhuKernelDistributionallyRobust2020d,staibDistributionallyRobustOptimization2019}. In the center stage is the kernel bandwidth parameter $\sigma$. From the OT perspective, we see that larger $\sigma$ in \sdro corresponds to smaller scaling parameters in the c-transform for OT, which is known to lead to more conservatism in \wdro (since we down-weigh the transportation cost, resulting in larger ambiguity region). On the other hand, and from the kernel perspective, the authors of \citep{zhuKernelDistributionallyRobust2020d} use functional analysis arguments to characterize that conservative \kdro can be a consequence of using small RKHSs as the dual spaces for DRO, which are associated with kernels with larger bandwidth $\sigma$. In summary, through the bandwidth parameter $\sigma$, this paper unifies the DRO performance-robustness trade-off for both OT and kernel methods. \section{Proofs of theoretical guarantees} \subsection{Proof of Proposition~\ref{thm:convexify}} \begin{proof} The proof is an exercise of calculus, e.g., by using the Taylor expansion of $ \ln l(u) -\frac{1}{\sigma}c(u,\xi_i) $ w.r.t. the variable $u$. \end{proof} \subsection{Proof of Proposition~\ref{thm:generalization}} As preparation, we first establish a standard concentration result in this paper's context. \begin{lemma} [Concentration] For any \var pointwise, there exists constant $C>0$ such that, $\forall \rho > 0$, probability measure $P$, and kernel bandwidth $\sigma>0$, the following holds except probability $\delta$: \begin{equation*} \expected{\ptrue}{\ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi)} \leq \frac1N\sum_{i=1}^N \ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi_i) +C\cdot\raten. \end{equation*} \label{thm:moreau_concentrate} \end{lemma} \begin{proof} Since the function of interest $\ensuremath{\widehat{\ln l_{1/\sigma}}}(\theta, \cdot)$ satisfies the bounded difference condition by assumption, the lemma statement follows directly from the McDiarmid's inequality. \end{proof} We now prove Proposition~\ref{thm:generalization}. \begin{proof} By the strong duality of DRO using \wsd (see, e.g., \cite{mohajerinesfahaniDatadrivenDistributionallyRobust2018,gaoDistributionallyRobustStochastic2016,zhaoDatadrivenRiskaverseStochastic2018}) and the $c$-transform\xspace notation, we have, $\forall \sigma > 0, \rho >0, \var\in\Theta$, \begin{equation} \label{eq:duality_concentration} \sup_{\gamma(P,\ptrue)\leq\rho} \expected{P}{\ln l (\var, \xi)} = \inf_{\sigma > 0} \Bigg\{ \expected{\ptrue}\ensuremath{\widehat{\ln l_{1/\sigma}}}(\var, \xi) + \frac{\rho}{\sigma} \Bigg\} \leq \expected{\ptrue}\ensuremath{\widehat{\ln l_{1/\sigma}}}(\var, \xi) + \frac{\rho}{\sigma}. \end{equation} By Lemma~\ref{thm:moreau_concentrate}, for any fixed \var, the RHS above is bounded by \begin{equation*} \frac1N\sum_{i=1}^N \ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi_i) + \frac{\rho}{\sigma} +C\cdot \raten \leq \ln\frac1N\sum_{i=1}^N \exp\Bigg\{\ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi_i)\Bigg\} + \frac{\rho}{\sigma} +C\cdot \raten , \end{equation*} where the inequality is due to the concavity of the log function. Noting the quantity inside the logarithm is simply the \sdro objective (see, e.g., \eqref{eq:log}), we obtain the first half of the proposition statement. We now show the uniform convergence. Put \begin{equation*} F_N : = \sup_{\var\in\Theta} \expected{\ptrue}\ensuremath{\widehat{\ln l_{1/\sigma}}}(\var, \xi) -\frac1N\sum_{i=1}^N \ensuremath{\widehat{\ln l_{1/\sigma}}} (\var, \xi_i) . \end{equation*} Using symmetrization (see, e.g., \cite{vaartWeakConvergenceEmpirical2013}), we have $$\expected{\ptrue}{F_N}\leq 2 \ensuremath{\radm(\{\lnlsighat(\var, \cdot) | \var \in \Theta\})}.$$ By McDiarmid, with $1-\delta$ probability, \begin{equation*} F_N \leq \expected{\ptrue}{F_N} + C'\cdot \raten, \end{equation*} where $C'$ does not depend on \var due to the $\sup$ operation. Combining the above relationships with \eqref{eq:duality_concentration} yields the uniform bound. \end{proof} \section{Additional technical details} \subsection{Equivalence of type-1 \wdro to IPM-DRO} \begin{lemma}(Motivating example using type-1 \wdro) \label{thm:w1envelope} Suppose the loss function $l(\var,\cdot)$ is $y-$Lipschitz continuous. Let variable $f$ in dual IPM-DRO~\eqref{eq:kdro_dual} be set to the $y$-Pasch-Hausdorff envelope\xspace $f(\cdot):=\sup_u\{ l(\var, u) - y\cdot \|u - \cdot\| \}$. Then, \eqref{eq:kdro_dual} is equivalent to the dual formulation of type-$1$ \wdro; cf. \citep{mohajerinesfahaniDatadrivenDistributionallyRobust2018,zhaoDatadrivenRiskaverseStochastic2018,kuhnWassersteinDistributionallyRobust2019}. \end{lemma} Unfortunately, estimating Lipschitz constants for general model classes is known to be difficult \citep{virmauxLipschitzRegularityDeep2018,biettiKernelPerspectiveRegularizing2019}, resulting in the intractability of \wdro when used with common machine learning models, e.g., neural networks, which our method in this paper can handle. \subsection{Proof of Lemma~\autoref{thm:w1envelope}} We now prove Lemma~\autoref{thm:w1envelope}. First, it is an exercise to show the following technical lemmas. \subsubsection{Technical lemma and proofs using convex analysis} \begin{lemma} \label{thm:sup_conv} A function's $y$-Pasch-Hausdorff envelope\xspace dominates itself, i.e., $$ l_{y,1} (x) \geq l(x), \forall x\in\ensuremath{\mathcal X}\xspace. $$ Furthermore, $l_{y,1}$ is the smallest majorant of $l$ with Lipschitz constant $y$. \end{lemma} \begin{lemma} \label{thm:sup_conv_coincide} If $l$ is Lipschitz-continuous with constant $y$, then $l_{y,1}$ coincides with $l$. \end{lemma} \newcommand{\ly}[1]{\ensuremath{l_{y, {#1}}}\xspace} % \newcommand{$y$-Lipschitz majorant\xspace}{$y$-Lipschitz majorant\xspace} Similar results concerning the \emph{infimal convolution} (instead of supremal) are well-known \cite[Chapter 12]{bauschkeConvexAnalysisMonotone2011}. For completeness, we give self-contained proofs below. We assume the regularity condition that $f(x):=\ly1(x)=\sup_u\{ l(\var, u) - y\cdot \|u - x\| \} < \infty $; we refer to \cite[Proposition~12.14]{bauschkeConvexAnalysisMonotone2011} for the degenerative case when $\ly1=\infty$ and $l$ has no $y$-Lipschitz majorant\xspace. We now prove Lemma~\ref{thm:sup_conv}. \begin{proof} By noting the special choice of $u=x$, the relationship $f(x)\geq l(x)$ is obvious. We now prove the Lipschitz continuity. For any $x,z$ in the domain, \begin{multline} f(x) =\sup_u\{ l(u) - y\cdot \|u - x\|\} \geq \sup_u\{ l(u) - y\cdot \|u - z\| - y\cdot\|z - x\|\} =\sup_u\{ l(u) - y\cdot \|u - z\|\} - y\cdot\|z - x\|\\ = f(z) -y\cdot\|z - x\|. \end{multline} Therefore, $ f(z) - f(x)\leq y\cdot\|z - x\|, $ $f$ is $y$-Lipschitz. To show that $f$ is the smallest $y$-Lipschitz majorant\xspace, we let $g$ be any $y$-Lipschitz majorant\xspace of $l$. Then, $$ g(x)\geq g(z) - y\cdot\|z - x\| \geq l(z) - y\cdot\|z - x\| . $$ Take supremum on both sides, $$ g(x) \geq\sup_z\{ l(z) - y\cdot\|z - x\|\}= f(x) . $$ Hence, $f$ is the smallest $y$-Lipschitz majorant\xspace. \end{proof} Lemma~\ref{thm:sup_conv_coincide} follows directly from Lemma~\ref{thm:sup_conv}. See, e.g., \cite{bauschkeConvexAnalysisMonotone2011} Chapter 12 for more technical details on the convolution operator. By plugging in the expression for $l_{y,1}$, we have \begin{equation} \begin{aligned} \frac{1}N\sum_{i=1}^N \sup_u\{l(u) - y\cdot \|u - \xi_i\|\} + \epsilon y \end{aligned} \end{equation} We have thus recovered the type-1 Wasserstein DRO dual as a special case of our analysis. \subsection{Proof of Proposition~\ref{thm:majorant}} \newcommand{u^*}{u^*} We now verify the relationship $ \ensuremath{l^k}\xspace(x)\geq l(x), \forall x\in\ensuremath{\mathcal X}\xspace,\text{ and } \ensuremath{l^k}\xspace \to l \textrm{ as } \sigma \to 0. $ The dominance relationship $\ensuremath{l^k}\xspace(x)\geq l(x)$ can be seen by taking the special case $u=x$ in the supremum. Finally, the convergence of $\ensuremath{l^k}\xspace \to l \textrm{ as } \sigma \to 0$ is obvious by examining the expression of the Gaussian RBF kernel\xspace and Laplacian kernel\xspace. \subsection{Proof of Proposition~\ref{thm:recover_ro} (Robustness-performance trade-off using kernel width $\sigma$)} First, we note the continuity of the Gaussian RBF kernel\xspace and the loss function $l$; hence all limits are attained. If we let the kernel width be large $\sigma\to\infty$, then $ \lim_{\sigma\to\infty} k(u,x) = 1. $ Hence, the robust learning algorithm recovers the worst-case robust optimization (RO) $$ \min_\var \sup_\xi l(\var, \xi). $$ Similarly, if kernel width is small $\sigma\to 0$, then we recover the trivial Dirac function at limit $ \lim_{\sigma\to0} k(u,x) = \delta_x(u). $ Hence \sdro becomes the empirical risk minimization (ERM), $$ \min_\var \frac{1}N\sum_{i=1}^N l(\var, \xi_i). $$ \subsection{Alternative analysis on convexity properties of inner optimization problem} We now provide an alternative view (to Proposition~\ref{thm:convexify}) of the convexity properties of the objective function of the inner objective of \sdro, which we denote as $f(u):= l(u)k(u,x)$. For \sdro, our intuition is that, by multiplying the loss $l(u)$ by a function $k(u,x)$ which is strongly concave near its peak, the resulting function is consequently locally concave too. This idea is illustrated in Figure~\ref{fig:sgdstep_landscape}. For conciseness, we assume that the loss function $l$ is positive twice-differentiable (cf. \cite{sinhaCertifyingDistributionalRobustness2017} for why this is not restrictive), and $x, u$ are scalars. We first show that the inner objective $f(u)=l(u)k(u,x)$ is locally concave in a neighborhood of $x$. \begin{proof} We compute the curvature $\frac{d^2}{du^2}f(u)$. \begin{multline} \label{eq:hessian} \frac{d^2}{du^2}f(u) =\frac{d}{du} \left(\frac{d}{du}l(u) k(u,x) + l(u) \frac{d}{du}k(u,x)\right),\\ = \frac{d^2}{du^2}l(u) k(u,x) + 2\frac{d}{du}l(u)\frac{d}{du}k(u,x) + l(u)\frac{d^2}{du^2}k(u,x)\\ = e^{-{(u-x)^2}/2\sigma } \left[ \frac{d^2}{du^2}l(u) + 2\frac{d}{du}l(u) \left(-{(u-x)}/\sigma\right) + l(u)\left( -1/\sigma + (u-x)^2/\sigma^2 \right) \right]. \end{multline} Let us choose $\sigma>0$ small enough such that the following holds. \begin{equation} \frac{d^2}{du^2}l(u) - l(u)/\sigma < 0.\label{eq:curvature1} \end{equation} This can be done trivially if the curvature of the loss $l$ is bounded (similar to the assumptions in \cite{sinhaCertifyingDistributionalRobustness2017,houskaNonlinearRobustOptimization2013}) and $l(u)>0$. Then, there exists $\Delta>0$ such that, for $|u-x|\leq\Delta$, the curvature value~\eqref{eq:hessian} is negative. Therefore, the objective $f(u)=l(u)k(u,x)$ is concave in the $\Delta-$neighborhood of $x$. \end{proof} We now show that, for a suitable choice of $\sigma$, every stationary point of $f$ is a local maximum, hence explaining the good empirical performance in our experiments. A full convergence analysis is out of the scope of our current paper. Let $$ \sigma^* = \frac{2{(u^*-x)}^2}{\sqrt{1+4{(u^*-x)}^2\cdot \frac{d^2}{du^2}l(u^*)/l(u^*)}-1}, $$ which is a non-negative quantity if $u^*\neq x$ and $\frac{d^2}{du^2}l(u^*) > 0$ by straightforward verification. \begin{lemma} Suppose either the loss $l$ is concave or the bandwidth satisfies $\sigma<\sigma^*$. Then, every stationary point of $f$ is a maximum. \end{lemma} \begin{proof} Suppose $u^*$ is a stationary point of $f$, which implies \begin{equation*} \frac{d}{du}f(u)\mid_{u=u^*}=\frac{d}{du}l(u) k(u,x) + l(u) \frac{d}{du}k(u,x)\mid_{u=u^*}=0. \end{equation*} Since $k(u,x)\neq 0$, that further implies \begin{equation*} \frac{d}{du}l(u) + l(u) \left(-{(u-x)}/\sigma\right)\mid_{u=u^*}=0. \end{equation*} Plugging the above equality into the last line of \eqref{eq:hessian}, \begin{equation*} \frac{d^2}{du^2}f(u)\mid_{u=u^*} = e^{-{(u-x)^2}/2\sigma } \left[ \frac{d^2}{du^2}l(u) - l(u)\left( 1/\sigma + (u-x)^2/\sigma^2 \right) \right]\mid_{u=u^*}. \end{equation*} Since either $\frac{d^2}{du^2}l(u^*)\leq 0$ or $\sigma<\sigma^*$, we have \begin{equation*} \frac{d^2}{du^2}l(u^*) - l(u^*)\left( 1/\sigma + (u^*-x)^2/\sigma^2 \right) < 0. \end{equation*} Then, \begin{equation*} \frac{d^2}{du^2}f(u)\mid_{u=u^*} < 0. \end{equation*} Therefore, $u^*$ is a local maximum by the second derivative test of calculus. \end{proof} Note that the condition $\sigma<\sigma^*$ can be easily satisfied when $l$ has bounded curvature and is a weaker condition than \eqref{eq:curvature1}. Therefore, the above lemma implies that a gradient-based algorithm converges to a maximum. Note that the analysis presented in Proposition~\ref{thm:convexify} is stronger than the lemma above. \subsection{Additional function approximator and majorant constructions} \input{sections/other_methods.tex} \section{Experimental set-up and additional results} \label{sec:appendixc} In this Section, we provide additional information on the numerical experiments presented in Section~\ref{sec:exp}, and report supplementary material. This includes benchmark results with the PGD adversarial learning algorithm \citep{madryDeepLearningModels2019}, and a brief discussion on its differences with ARKS. All of our experiments are conducted using the PyTorch \citep{NEURIPS2019_9015} and the CVXPY \citep{diamond2016cvxpy} libraries. \subsection{Robust learning under Adversarial Perturbations} \paragraph{Datasets.} The numerical experiments in Section~\ref{subsec:exp_adv} make use of the following publicly available datasets: Fashion-MNIST\footnote{available at \url{https://pytorch.org/vision/stable/datasets.html\#fashion-mnist}} \citep{xiao2017fashionmnist}, CIFAR-10\footnote{available at \url{https://pytorch.org/vision/stable/datasets.html\#cifar}} \citep{cifar}, and CelebA\footnote{available at \url{https://www.kaggle.com/jessicali9530/celeba-dataset}} \citep{liu2015faceattributes}. The Fashion-MNIST dataset contains greyscale images of garments from 10 categories. Each image $x$ is represented by $x \in [0, 1]^{28 \times 28}$. The CIFAR-10 dataset contains colored images of different objects from 10 categories. Each image x is represented by $x \in \left[0, 1 \right]^{32 \times 32 \times 3}$. As is customary in such settings, we augment the training set with additional samples by randomly cropping and flipping images. Using the provided attributes, the CelebA dataset is reduced to only contain a balanced number of colored images of celebrities with eye-wear (class 1) or without (class 0). Each image $x$ is represented by $x \in [0, 1]^{64 \times 48 \times 3}$. Our codebase includes a script to modify this dataset. \paragraph{Model architectures.} For Fashion-MNIST, the model architecture consists of two $3 \times 3$ convolutional layers with ELU activations and max pooling, followed by two fully connected layers and a softmax layer. For CIFAR-10 we use the ResNet-20 model architecture \citep{he2015deep}, consisting of 18 convolutional layers with batch normalization \citep{ioffe2015batch} and ReLU activations, followed by a fully connected and a softmax layer. For CelebA, the model architecture is borrowed from \cite{heinze-demlConditionalVariancePenalties2021}, comprised of four $5 \times 5$ convolutional layers with Leaky ReLU activations, followed by a fully connected and a softmax layer. The convolutions produce 16, 32, 64 and 128 channels respectively, using a stride of 2. \paragraph{Hyper-parameter search.} To optimize our algorithms, we performed grid search over the hyper-parameters outlined in Table \ref{tab:krs_param_adv}. We first searched for the hyper-parameters of ERM that achieved the lowest classification error on unperturbed images independent of the training set, averaged across seeds $\{0, 10, 20\}$. The same procedure was then repeated for ARKS, WRM and PGD; the hyper-parameters that most closely recovered the lowest possible error given by ERM were selected. We note that although WRM~\eqref{eq:sinha}\xspace requires for the Lagrangian relaxation coefficient $2y \geq L$, the Lipschitz constant of the loss gradient, $L$ is hard to compute for our models. In order to provide a fair comparison to \sdro, we searched for the optimal $y$ within a large range. Similarly, the PGD benchmark was tuned to defend against worst-case disturbances $\delta$ within a box $\{\delta: \| \delta\|_{\infty} \leq \Delta \}$. $\Delta$ was set to 0.3, the maximum magnitude of the disturbances considered during evaluation. For both the optimization of model weights and the inner optimization of worst-case perturbations, we consider common optimizers such as stochastic gradient descent (SGD), Adam \citep{kingma2014adam} and AMSGrad \citep{Tran_2019}. \begin{table}[h] \renewcommand{\arraystretch}{1.3} \begin{center} \begin{tabular}[h]{@{\hspace{0.15cm}}l@{\hspace{0.5cm}} l@{\hspace{0.01cm}} c@{\hspace{0.22cm}} c@{\hspace{0.2cm}} c@{\hspace{0.15cm}}} \parbox{1.1cm}{Algorithm} & Hyper-parameters & Fashion-MNIST & CIFAR-10 & CelebA \\ \hline \multirow{ 5}*{\parbox{1.1cm}{ALL}} & training epochs & 45 & 65 & 45 \\ &batch size $\in \{64, 128, 256\}$ & 256 & 128 & 128 \\ &optimizer $\in \{$SGD, AMSGrad, Adam$\}$ & AMSGrad & SGD & AMSGrad \\ & learning rate $\in \left[0.0001, 0.2\right]$ & 0.001 & 0.1 & 0.001 \\ &decay learning rate $\in \{$True, False$\}$ & False & True & False \\ \hline \multirow{ 3}*{\parbox{1.1cm}{\sdro, WRM, PGD}}&inner optimization epochs & 15 & 15 & 15 \\ &inner optimizer $\in \{$SGD, AMSGrad, Adam$\}$ & AMSGrad & AMSGrad & AMSGrad\\ &decay inner learning rate $\in \{$True, False$\}$ & False & False & False\\\hline \multirow{ 2}*{\parbox{1.1cm}{\sdro}}&inner learning rate $\in \left[0.0001, 0.1\right]$ & 0.01 & 0.001 & 0.002\\ &kernel bandwidth $\sigma \in \left[0.01, 10\right]$ & 0.5& 0.1& 0.2 \\ \hline \multirow{ 2}*{\parbox{1.1cm}{WRM}}&inner learning rate $\in \left[0.0001, 0.1\right]$ & 0.05& 0.001& 0.002\\ &Lagrangian coefficient $y \in \left[0.01, 1000\right]$ & 1.0 & 50 & 4.0\\ \hline PGD &inner learning rate $\in \left[0.0001, 0.1\right]$ & 0.001 & 0.0001 & 0.0005\\ \bottomrule \end{tabular} \end{center} \caption{Hyper-parameter configuration for classification tasks on the Fashion-MNIST, CIFAR-10 and CelebA datasets. For clarity, we indicate a range for large sets of hyper-parameter values.} \label{tab:krs_param_adv} \end{table} In the CIFAR-10 classification task, the learning rate is decayed by a multiplicative factor of 0.1 at steps 25 and 50. Additionally, to prevent ERM from overfitting and ensure a fair comparison across algorithms, they all use a weight decay of $0.0001$ as per the authors of the ResNet architecture \citep{he2015deep}. \paragraph{Adversarial attacks.} In our evaluation, we perturb test images with worst-case disturbances $\delta$ within a box $\{\delta: \| \delta\|_{\infty} \leq \Delta \}$. We consider two types of adversarial attacks using this norm. Firstly, \textit{black-box attacks} for which the disturbances are generated by attacking the model trained with ERM (for each random seed) using PGD and FGSM. Secondly, instead of evaluating each objective on ERM-adversarial loss, we perform \textit{white-box attacks} using PGD on each model individually. In all evaluations, the perturbed images $x + \delta$ are clipped to the valid image range $\left[0, 1 \right]$. PGD performs 15 iterations of gradient ascent on $\delta$ with a learning rate $\alpha=0.03$ for Fashion-MNIST, and $\alpha=0.02$ for CIFAR-10 and CelebA. FGSM performs one iteration of gradient ascent by design. \paragraph{Supplementary results on black-box attacks.} We repeat Figure \ref{fig:pgd_attacks} with the PGD adversarial training algorithm and for FGSM attacks with respect to $\|.\|_{\infty}$. The results for Fashion-MNIST are shown on Figure \ref{fig:fmnist_with_pgd}, and for CIFAR-10 on Figure \ref{fig:cifar_with_pgd}. The same procedure is also applied to binary classifiers trained on CelebA face images, with the results shown on Figure \ref{fig:celeba_attacks}. Across all tests, we see that ERM offers the least robustness. This is expected for an optimistic statistical estimator that underestimates risk and is a well-known fact in stochastic optimization~\citep{shapiroLecturesStochasticProgramming2014}. We emphasize that we included the comparison with the PGD benchmark for completeness. In reality, \sdro is only directly comparable with WRM since they are DRO approaches while PGD is based on RO, as we have discussed in the main text. We do not intend to show PGD to be less robust than ARKS and WRM since the robustness of DRO and RO depends on the choices of uncertainty and ambiguity sets. ARKS and WRM exhibit similar adversarial profiles, with ARKS offering slightly more robustness as the magnitude of the adversarial perturbations increase. We use the hyper-parameter values outlined in Table~\ref{tab:krs_param_adv}, but also include \sdro with a higher $\sigma$ and WRM with a lower $y$ (but otherwise optimal hyper-parameter values), exhibiting improved robustness for a small sacrifice on classifying unperturbed images. Further increasing $\sigma$ or decreasing $y$ would increase this test-time penalty. However WRM would rapidly become unstable. To use WRM for deep networks such as ResNet, $y$ needs to be tuned to a high value in order to prevent instabilities from the propagation of the input perturbation through the network. \begin{figure}[h!] \centering \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/fmnist_pgd_all_with_pgd_type1.pdf} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/fmnist_fgsm_all_with_pgd_type1.pdf} \end{subfigure} \caption{Black-box PGD (\textbf{left}) and FGSM (\textbf{right}) attacks with respect to $\| . \|_\infty$ on the Fashion-MNIST dataset. We show the classification error on perturbed test images versus the allowed magnitude of the adversarial perturbation $\Delta$. For all algorithms, we report the mean and standard deviation across 10 random seeds.} \label{fig:fmnist_with_pgd} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/cifar_pgd_all_with_pgd_type1.pdf} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/cifar_fgsm_all_with_pgd_type1.pdf} \end{subfigure} \caption{Black-box PGD (\textbf{left}) and FGSM (\textbf{right}) attacks with respect to $\| . \|_\infty$ on the CIFAR-10 dataset. We show the classification error on perturbed test images versus the allowed magnitude of the adversarial perturbation $\Delta$. For all algorithms, we report the mean and standard deviation across 10 random seeds.} \label{fig:cifar_with_pgd} \end{figure} \begin{figure}[h!] \centering \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/celeba_pgd_all_with_pgd_type1.pdf} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/celeba_fgsm_all_with_pgd_type1.pdf} \end{subfigure} \caption{Black-box PGD (\textbf{left}) and FGSM (\textbf{right}) attacks with respect to $\| . \|_\infty$ on the reduced CelebA dataset. We show the classification error on perturbed test images versus the allowed magnitude of the adversarial perturbation $\Delta$. For all algorithms, we report the mean and standard deviation across 10 random seeds.} \label{fig:celeba_attacks} \end{figure} \paragraph{Supplementary results on white-box attacks.} In previous experiments, models trained with each learning objective were evaluated on the same set of perturbed images generated by black-box PGD attacks on the models trained with ERM. In this experiment, each model is evaluated on perturbations generated by white-box PGD $\|\|_\infty$ attacks on itself. The left panel of Figure~\ref{fig:whitebox_pgd_attacks} shows the evaluation results for Fashion-MNIST, and the right panel for CIFAR-10. \begin{figure}[h!] \centering \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/fmnist_pgd_all_whitebox_type1.pdf} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[width=2.7in,valign=c]{figures/cifar_pgd_all_whitebox_type1.pdf} \end{subfigure} \caption{White-box PGD attack with respect to $\| . \|_\infty$ on the Fashion-MNIST (\textbf{left}) and CIFAR-10 (\textbf{right}) datasets. We show the classification error on perturbed test images versus the allowed magnitude of the adversarial perturbation $\Delta$. For all algorithms, we report the mean and standard deviation across 10 random seeds. On the right plot, the curves for WRM $\gamma=50$ and PGD almost coincide.} \label{fig:whitebox_pgd_attacks} \end{figure} \subsection{Comparison with the work of \cite{madryDeepLearningModels2019}} In this section, we briefly contrast ARKS against the work of \cite{madryDeepLearningModels2019} that introduces PGD, a common adversarial learning algorithm. However, we emphasize that ARKS is best compared to WRM, a state-of-the-art method based on DRO, as PGD is based on RO. We refer to \cite{sinhaCertifyingDistributionalRobustness2017} for extensive comparisons of PGD with WRM. Theoretically, as ARKS and WRM are derived using the strong duality of DRO, they are less conservative than RO and therefore PGD. This is reflected in robustifying against \textit{imperceptible attacks} in the evaluations of \cite{sinhaCertifyingDistributionalRobustness2017}. Computationally, the inner maximization of PGD is typically difficult in the case of non-convex losses, while ARKS and WRM both apply convexification (see our discussion in Section \ref{sec:bg_dro}) and smoothing. For instance, the projected gradient step is prone to get stuck in local optima. Furthermore, ARKS makes contributions in areas that substantially differ from the main idea of \cite{madryDeepLearningModels2019}. Notably, ARKS sheds light on using kernel smoothing theory to robustify deep neural networks. Kernel methods are conventionally not scalable, but our experiments show that ARKS can scale in practical adversarial learning tasks. While previous attempts in robust kernel density estimation exist, the underlying robust kernel methods are not adversarial to specific loss functions nor scalable. ARKS also opens up a new lane of designing kernels for robustness and causal inference. The current work only tested with the default Gaussian kernel, whose empirical performance is already competitive. Finally, our work develops new functional analysis theory for robustness, which does not exist in \citep{madryDeepLearningModels2019}. \subsection{Further analysis of \sdro} In the toy problem for Figure~\ref{fig:sgdstep_landscape}{}, we followed the set-up from \citep{zhuKernelDistributionallyRobust2020d} for the robust least-squares example, which appeared in \citep{elghaouiRobustSolutionsLeastSquares1997,boydConvexOptimization2004}. We formulate the optimization problem $\min_{ \var}{\|A(\xi)\cdot \var-b\|_2^2}$, where $A(\xi)$ is assumed to be uncertain and given by $A(\xi) = A_0 + \xi A_1$, where $-1\leq\xi\leq1$ is an uncertain variable. We refer to \citep{zhuKernelDistributionallyRobust2020d} for more details. The ERM solution to the robust least-squares problem is computed by solving a convex program. The RO solution is obtained by solving the SDP reformulation in \citep{elghaouiRobustSolutionsLeastSquares1997}. Additional visual insights, such as a comparison of our approach with the ERM and RO solution, a comparison of empirical and adversarial distribution, are highlighted in Figure~\ref{fig:tradeoff_advkde}. We refer to the caption for more details. For \sdro, we solved the program~\eqref{eq:ksmooth} using stochastic gradient descent ascent (GDA): in each iteration, we sample a mini-batch $\{\xi_i\}$, then performed gradient ascent to maximize the inner objective of \eqref{eq:ksmooth} w.r.t. the inner variable $u$. In practice, we performed $10$ steps inner gradient ascent using the L-BFGS routine. The inner maximization problem is illustrated in Figure~\ref{fig:sgdstep_landscape}. Following that, we took one outer gradient descent step w.r.t. the decision variable \var, and repeated the loop. See Algorithm \ref{alg:smooth} for more details. The outer optimization problem is solved using the L-BFGS optimization routine in PyTorch, with a learning rate of 1. \begin{figure}[h] \centering \begin{subfigure}{0.49\textwidth} \centering \includegraphics[height=1.7in,valign=c]{figures/rls_sigma.pdf} \label{fig:tradeoff} \end{subfigure} \begin{subfigure}{0.49\textwidth} \centering \includegraphics[height=1.7in,valign=c]{figures/density_estimation_0_41_MMD0_18818.pdf} \label{fig:interpl} \end{subfigure} \caption{ (\textbf{left}) We plot the performance-robustness trade-off of \sdro for various width settings (black, yellow, blue). We create settings of perturbed test distribution (different from the training data distribution, with the random variables satisfying $X_\textrm{test} = (1+\delta)\cdot X_\textrm{train}$), with increasing amounts of distribution shift parameter $\delta$. We compare with ERM and the worst-case robust optimization (RO) solution of~\citep{elghaouiRobustSolutionsLeastSquares1997}. We see that \sdro with large width $\sigma$ is more robust and conservative, tending towards RO. When width $\sigma$ is small, \sdro achieves better performance but less robust under a large distribution shift. Overall, \sdro performs as Proposition~\ref{thm:recover_ro} indicates, achieving a balance of moderate performance and robustness between ERM and RO. For every algorithm, we ran train $10$ independent models. The error bars are in standard errors. (\textbf{right}) Histogram density estimation with $\sigma=0.41$ (as used in \sdro) for both the empirical data (black) and the perturbed (adversarial) points (red). The closed-form MMD estimator~\citep{grettonKernelTwoSampleTest2012} between the samples and the adversarial samples evaluates to MMD $= 0.167 \pm 0.02$, averaged over 10 independent runs. } \label{fig:tradeoff_advkde} \end{figure} \subsection{Results for additional models and data sets} \label{sec:neural} In addition to the linear model in the RLS example and the previously reported benchmarks on CIFAR-10, Fashion-MNIST, and CelebA datasets, we report other results using \sdro with a smaller neural network model. We used a multi-layer perceptron with two fully connected hidden layers, with 32 hidden units for each layer. The multi-layer perceptron (MLP) uses the ELU activation because of its smoothness property. We trained $5$ independent models for every setting and use stochastic weight averaging \citep{izmailov2018averaging} for all neural network training. We report the results in Figure~\ref{fig:diabetes_samples} and the caption therein. For exact hyperparameter configurations of the MLP training, consult Table~\ref{tab:mlp_param}. \begin{table}[h] \renewcommand{\arraystretch}{1.3} \begin{center} \begin{tabular}[h]{l@{\hspace{0.5cm}} l@{\hspace{0.5cm}} c@{\hspace{0.5cm}} c@{\hspace{0.5cm}} c} \parbox{1.1cm}{Algorithm} & Hyper-parameters & Diabetes & Iris \\ \hline \multirow{ 5}*{\parbox{1.1cm}{ERM \& \sdro}} & batch size & 256 & 128\\ & optimizer & Adam & SGD \\ & learning rate & 0.001 & 0.1\\ & epochs & 2000 & 2000 \\ \hline \multirow{ 3}*{\parbox{1.1cm}{\sdro}} & inner optimizer & L-BFGS & L-BFGS \\ & inner learning rate & 1 & 1 \\ & inner epochs & 10 & 10 \\ \bottomrule \end{tabular} \end{center} \caption{Hyperparameter configurations for experiments using a multi-layer perceptron as model} \label{tab:mlp_param} \end{table} We report results on the diabetes regression dataset \footnote{\label{footnote1}available at \url{https://scikit-learn.org/stable/datasets/toy_dataset.html}} and the iris plants classification dataset \cref{footnote1}. % To test the robustness property of the methods, we add the perturbation to the test data samples using the following rule \begin{equation*} X_\textrm{perturbed} = X_\textrm{test} + d \cdot \textrm{Uniform}(-1, 1). \end{equation*} We increase the perturbation magnitude $d$ from $0$ to $1$. The results are reported in Figure~\ref{fig:diabetes_samples}. \begin{figure}[h] \centering \includegraphics[width=2.6in,valign=c]{figures/samples40_diabetes.pdf} \includegraphics[width=2.6in,valign=c]{figures/samples80_diabetes.pdf} \vspace{0.7cm} \includegraphics[width=2.6in,valign=c]{figures/samples40_iris.pdf} \includegraphics[width=2.6in,valign=c]{figures/samples80_iris.pdf} \caption{ We trained the neural network model with the \sdro algorithm. We compare the results with the ERM solutions. The top-left figure shows model evaluations trained with $40$ samples from the diabetes dataset; the top-right figure corresponds to $80$ training samples from the diabetes dataset. The bottom-left figure shows model evaluations trained with $40$ samples from the iris plant dataset and the bottom-right figure for $80$ training samples from the same dataset. Across all figures, we observe that the ERM performance degrades as the perturbation of the test data increases. By contrast, and as expected, \sdro has better robustness against the distribution shift. For smaller kernel width $\sigma$, the curve approaches the ERM solution. With increasing kernel widths, the \sdro solution becomes more robust but is also more conservative. Note that the curves are the mean test errors; the error bars denote the standard errors} \label{fig:diabetes_samples} \end{figure}
\section{Introduction} Most real world data are only recorded in the rounded figure with a fixed number of significant digits. Strictly this rounding introduces additional systematic uncertainties which must be properly accounted for, in order to infer the property of the intrinsic distribution of the measured quantities. Naively, assuming that there is neither intrinsic uncertainty nor systematic bias, the differences between the true value and the rounded reported value are expected to be distributed evenly over the window of the size of the reporting unit. In particular, if the variable value $x$ is rounded to an integer multiple value of the measurement unit as in $nw$ (where $w$ is the measurement unit and $n$ is an integer), then $(n+\delta-1/2)w\le x<(n+\delta+1/2)w$ or $(n+\delta-1/2)w<x\le (n+\delta+1/2)w$. Here the constant $\delta\in[-1/2,1/2]$ specifies the rounding method (e.g., $\delta=1/2$ for rounding down to the floor, $\delta=-1/2$ for rounding up to the ceiling, and $\delta=0$ for rounding to the nearest integer etc.) whereas the equal signs at the boundary follow the prescribed convention. Then the rounding error (i.e.\ $\rho=nw-x$) is distributed in the rectangular distribution: \begin{equation} P(\rho)=\begin{cases}w^{-1}&\text{for $-(1/2+\delta)w<\rho<(1/2-\delta)w$} \\0&\text{elsewhere}\end{cases}, \end{equation} where the distribution at the boundary is determined by the chosen convention -- however provided that $x$ is a real variable in a continuous distribution, the boundaries consitute a null measure set and so the specific choice does not affect the following discussion. For a random variable $x$, the mean of the rounded values is (with $\bar x$ being the true mean of $x$) \begin{equation} \overline{nw}=\overline{x+\rho}=\bar x +\int_{-(1/2+\delta)w}^{(1/2-\delta)w}\frac\rho w\,{\rm d}\rho =\bar x-\delta u, \end{equation} while the variance is \begin{equation}\begin{split} s^2&=\overline{(nw-\overline{nw})^2} =\overline{(x+\rho)^2}-(\bar x+\bar\rho)^2 \\&=\sigma^2+\overline{\rho^2}-\bar\rho^2+2(\overline{x\rho}-\bar x\bar\rho), \end{split}\end{equation} where $\sigma^2=\overline{x^2}-\bar x^2$ is the variance of $x$, with the variance of the rounding errors given by \begin{equation} \overline{\rho^2}-\bar\rho^2 =\int_{-(1/2+\delta)w}^{(1/2-\delta)w}\frac{\rho^2}w\,{\rm d}\rho-(\delta w)^2 =\frac{w^2}{12}. \end{equation} In other words, provided that the distribution of $x$ does not affect the rounding (as in $\overline{x\rho}=\bar x\bar\rho$), the standard deviation of the rounded values is simply a quadrature sum of the true underlying standard deviation and that of the rounding errors, and the true standard deviation may be estimated from the variance of the rounded values via \begin{equation} \sigma=\left(s^2-\frac{w^2}{12}\right)^{1/2}. \end{equation} However, this result is only valid ``on average'' sense. That is to say, the underlying distribution of the variable can technically affect the rounding but for an arbitrary unspecified distribution, the expected value of ``$\overline{x\rho}-\bar x\bar\rho$'' should be zero and the reported error tends to the quadrature sum of the random error and the rounding error ($\sigma_\rho/w=1/\!\sqrt{12}\approx0.2887$). \section{Theory} Suppose that $f(x)$ is a probability distribution of a real random variable $x$ with \begin{equation}\label{eq:norm}\begin{split} &\int_{-\infty}^\infty\!{\rm d}x\,f(x)=1 ,\quad \int_{-\infty}^\infty\!{\rm d}x\,x\,f(x)=\mu,\\& \int_{-\infty}^\infty\!{\rm d}x\,(x-\mu)^2f(x)= \int_{-\infty}^\infty\!{\rm d}x\,x^2f(x)-\mu^2=\sigma^2. \end{split}\end{equation} Next consider the rounding off the measured value of the variable such that, with a fixed constant $\delta\in[-1/2,1/2]$ and the measurement unit $w$, the value $x$ is read off by an integer multiple of the unit, i.e.\ $nw$, where $n=\left\lfloor(x/w+1/2-\delta)\right\rfloor$ or $n=\left\lceil(x/w-1/2-\delta)\right\rceil$ with $\lfloor x\rfloor$ and $\lceil x\rceil$ being the integer floor and ceiling of $x$. Then the (discrete) distribution of the reported integer $n$ for the rounded value is found to be \begin{equation}\label{eq:fndef} F_n=\int_{(n+\delta-1/2)w}^{(n+\delta+1/2)w}\!{\rm d}x\,f(x). \end{equation} This distribution is properly normalized: that is, \begin{equation} \sum_{n=-\infty}^\infty F_n=\int_{-\infty}^\infty\!{\rm d}x\,f(x)=1, \end{equation} and so we can find the mean and the variance of the rounded variables by calculating \begin{equation}\begin{split} m&=\bar nw=w\sum_{n=-\infty}^\infty nF_n,\quad \\s^2&=\overline{(nw-m)^2}=\overline{n^2}w^2-m^2 \\&=w^2\left[\sum_{n=-\infty}^\infty n^2F_n -\left(\sum_{n=-\infty}^\infty nF_n\right)^2\right]. \end{split}\end{equation} For some distributions $f(x)$, the associated discrete distribution $F_n$ as well as its mean $m$ and the standard deviation $s^2$ of the rounded variable can be computed analytically. However the calculations become quite tedious even for many simple distributions and the computations can only be done numerically for most distributions including the important example such as the normal distribution. Instead here we try to analyze the problem more generally. Henceforth we also assume $w=1$ but the requisite adjustments for any other value of $w$ are trivial. \subsection{characteristic function} First let us introduce the characteristic function $\varphi(t)$ of the distribution $f(x)$: namely, \begin{equation} \varphi(t)=\int_{-\infty}^\infty\!{\rm d}x\,e^{itx}f(x). \end{equation} The derivatives of the characteristic function then result in \begin{equation}\begin{split} \varphi^{(n)}(t)&=i^n\int_{-\infty}^\infty\!{\rm d}x\,x^ne^{itx}f(x); \\\varphi^{(n)}(0)&=i^n\int_{-\infty}^\infty\!{\rm d}x\,x^nf(x), \end{split}\end{equation} and so $\varphi(0)=1$, $\varphi'(0)=i\mu$ and $\varphi''(0)=-(\sigma^2+\mu^2)$. We can also define the shifted characteristic function: \begin{equation}\label{eq:scfdef}\begin{split} \tilde\varphi(t)&=e^{-it\mu}\varphi(t) =\int_{-\infty}^\infty\!{\rm d}x\,e^{it(x-\mu)}f(x) \\&=\int_{-\infty}^\infty\!{\rm d}\epsilon\,e^{it\epsilon}f(\mu+\epsilon), \\\tilde\varphi'(t)&=e^{-it\mu}[\varphi'(t)-i\mu\varphi(t)]; \\\tilde\varphi''(t)&=e^{-it\mu} [\varphi''(t)-2i\mu\varphi'(t)-\mu^2\varphi(t)]. \end{split}\end{equation} Then $\tilde\varphi(0)=\varphi(0)=1$, $\tilde\varphi'(0)=\varphi'(0)-i\mu\varphi(0)=0$, and $\tilde\varphi''(0)=\varphi''(0)-2i\mu\varphi'(0)-\mu^2\varphi(0) =-\sigma^2-\mu^2+2\mu^2-\mu^2=-\sigma^2$. In other words, the Maclaurin series coefficients of $\tilde\varphi(t)$ result in the sequence of the central moments whereas those of $\varphi(t)$ result in the moments about the origin. Furthermore, if the distribution is symmetric about its mean $\mu$ as in $f(\mu+\epsilon)=f(\mu-\epsilon)$ for any $\epsilon\in\mathbb R$, then \begin{equation}\begin{split} \tilde\varphi(t) &=\int_{-\infty}^\infty\!{\rm d}\epsilon\,e^{it\epsilon}f(\mu-\epsilon) \\&=\int_{-\infty}^\infty\!{\rm d}\varepsilon\, e^{i(-t)\varepsilon}f(\mu+\varepsilon)=\tilde\varphi(-t); \end{split}\end{equation} and also $\tilde\varphi^{(n)}(t)=(-1)^n\tilde\varphi^{(n)}(-t)$. That is to say, the shifted characteristic function of a symmetric distribution is an even function. The converse also holds in that, if the characteristic function is in the form of $\varphi(t)=e^{it\mu}\tilde\varphi(t)$ with an even function such that $\tilde\varphi(t)=\tilde\varphi(-t)$, the distribution must be symmetric about the mean $\mu$. \subsection{distribution of rounded values} The characteristic function may also be inverted to recover the distribution via the inverse Fourier transform: that is, \begin{equation}\label{eq:invf}\begin{split} f(x)&=\frac1{2\pi}\int_{-\infty}^\infty\!{\rm d}t\,e^{-itx}\varphi(t) \\&=\frac1{2\pi}\int_{-\infty}^\infty\!{\rm d}t\,e^{it(\mu-x)}\tilde\varphi(t). \end{split}\end{equation} Inserting this into equation (\ref{eq:fndef}), we find the expression for the discrete distribution $F_n$ of the rounded variable in terms of the characteristic function $\varphi(t)$: namely, \begin{equation}\begin{split} F_n&=\frac1{2\pi}\int_{n+\delta-1/2}^{n+\delta+1/2}\!{\rm d}x \int_{-\infty}^\infty\!{\rm d}t\,e^{-itx}\varphi(t) \\&=\frac1{2\pi}\int_{-\infty}^\infty\!{\rm d}t\,\varphi(t) \int_{n+\delta-1/2}^{n+\delta+1/2}\!{\rm d}x\,e^{-itx} \\&=\frac1{2\pi}\int_{-\infty}^\infty\!{\rm d}t\,\varphi(t) \,\mbox{sinc}\Bigl(\frac t2\Bigr)\,e^{-it(n+\delta)} \\&=\frac1{2\pi}\int_{-\infty}^\infty\!{\rm d}t\,\tilde\varphi(t) \,\mbox{sinc}\Bigl(\frac t2\Bigr)\,e^{it(\mu-\delta-n)}. \end{split}\end{equation} Here $\mbox{sinc}(x)=x^{-1}\sin x$ for $x\ne0$ and $\mbox{sinc}(0)=1$. In addition we can also define the characteristic function of $F_n$. Since $F_n$ is a discrete distribution, its characteristic function is given by\citep{Tr84} \begin{equation}\label{eq:fn_char}\begin{split} \Phi_t&=\sum_{n=-\infty}^\infty\!e^{itn}F_n \\&=\frac1{2\pi}\int_{-\infty}^\infty\!{\rm d}\tau\,\varphi(\tau) \,\mbox{sinc}\Bigl(\frac\tau2\Bigr)\,e^{-i\tau\delta} \sum_{n=-\infty}^\infty\!e^{i(t-\tau)n} \\&=\sum_{k=-\infty}^\infty\!\varphi(t+2\pi k) \,\mbox{sinc}\left(\frac t2+\pi k\right)\,e^{-i(t+2\pi k)\delta} \\&=\sum_{k=-\infty}^\infty\!\tilde\varphi(t+2\pi k) \,\mbox{sinc}\left(\frac t2+\pi k\right)\,e^{i(t+2\pi k)(\mu-\delta)}, \end{split}\end{equation} Here we have used the Fourier series representation of the so-called Dirac comb distribution: namely, \begin{equation} \frac1{2\pi}\sum_{n=-\infty}^\infty\!e^{in(t-\tau)} =\sum_{k=-\infty}^\infty\!\deltaup(t-\tau+2\pi k). \end{equation} Then the derivative of $\Phi_t$ is found to be \begin{multline} \frac{d\Phi_t}{dt} =\sum_{k=-\infty}^\infty\Biggl\{ \left[\varphi'(t+2\pi k)-i\delta\varphi(t+2\pi k)\right] \,\mbox{sinc}\Bigl(\frac t2+\pi k\Bigr) \\+\varphi(t+2\pi k)\frac d{dt}\mbox{sinc}\Bigl(\frac t2+\pi k\Bigr)\Biggr\} e^{-i(t+2\pi k)\delta}, \end{multline} while the second-order derivative is given by \begin{widetext} \begin{multline} \frac{d^2\Phi_t}{dt^2} =\sum_{k=-\infty}^\infty\Biggl\{ \left[\varphi''(t+2\pi k)-2i\delta\varphi'(t+2\pi k) -\delta^2\varphi(t+2\pi k)\right] \,\mbox{sinc}\Bigl(\frac t2+\pi k\Bigr) \\ +2\left[\varphi'(t+2\pi k)-i\delta\varphi(t+2\pi k)\right] \frac d{dt}\mbox{sinc}\Bigl(\frac t2+\pi k\Bigr) +\varphi(t+2\pi k)\frac{d^2}{dt^2}\mbox{sinc}\Bigl(\frac t2+\pi k\Bigr)\Biggr\} e^{-i(t+2\pi k)\delta}. \end{multline} \end{widetext} Here for the sake of clarity, we have not yet introduced the explicit forms for the derivatives of the sinc function, \begin{equation}\begin{split} \frac d{dt}\,\mbox{sinc}\Bigl(\frac{t}2+\pi k\Bigr) &=\frac12\frac{\cos(t/2+\pi k)-\mbox{sinc}(t/2+\pi k)}{t/2+\pi k} \\ \frac{d^2}{dt^2}\,\mbox{sinc}\Bigl(\frac{t}2+\pi k\Bigr) &=-\frac14\mbox{sinc}\Bigl(\frac{t}2+\pi k\Bigr) \\&-\frac12\frac{\cos(t/2+\pi k)-\mbox{sinc}(t/2+\pi k)}{(t/2+\pi k)^2}. \end{split}\end{equation} Next given that \begin{equation} \frac{d^k\Phi_t}{dt^k}=i^k\sum_{n=-\infty}^\infty\!n^ke^{itn}F_n\ \Rightarrow\ \sum_{n=-\infty}^\infty\!n^kF_n =\frac1{i^k}\left.\frac{d^k\Phi_t}{dt^k}\right\rvert_{t=0}, \end{equation} we can find that \begin{equation}\label{eq:res1}\begin{split} m&=\sum_{n=-\infty}^\infty\!nF_n=\frac1i\left.\frac{d\Phi_t}{dt}\right\rvert_{t=0} =\mu-\delta+S_0 \\s^2&=\sum_{n=-\infty}^\infty\!(n-m)^2F_n =-\left.\frac{d^2\Phi_t}{dt^2}\right\rvert_{t=0}-m^2 \\&=\sigma^2+\frac1{12}-S_1-S_0^2, \end{split}\end{equation} where \begin{equation}\label{eq:msd}\begin{split} S_0&=\sum_{\substack{k=-\infty\\k\ne0}}^\infty\! \frac{(-1)^k\varphi(2\pi k)}{2\pi ik}e^{-2\pi ik\delta} \\&=\sum_{\substack{k=-\infty\\k\ne0}}^\infty\! \frac{(-1)^k\tilde\varphi(2\pi k)}{2\pi ik}e^{2\pi ik(\mu-\delta)}, \end{split}\end{equation} and \begin{equation}\label{eq:ssd}\begin{split} S_1&=\sum_{\substack{k=-\infty\\k\ne0}}^\infty\!\frac{(-1)^k}{\pi k} \left[\varphi'(2\pi k)-i\mu\varphi(2\pi k)-\frac{\varphi(2\pi k)}{2\pi k}\right] e^{-2\pi ik\delta} \\&=\sum_{\substack{k=-\infty\\k\ne0}}^\infty\!\frac{(-1)^k}{\pi k} \left[\tilde\varphi'(2\pi k)-\frac{\tilde\varphi(2\pi k)}{2\pi k}\right] e^{2\pi ik(\mu-\delta)}. \end{split}\end{equation} Here we have used the fact that $\mbox{sinc}(\pi k)=(\pi k)^{-1}\sin(\pi k)=0$ for any non-zero integer $k\in\mathbb Z-\{0\}$ as well as \begin{equation} \left.\frac d{dt}\,\mbox{sinc}\Bigl(\frac{t}2+\pi k\Bigr)\right\rvert_{t=0} =\begin{cases} \dfrac{(-1)^k}{2\pi k}&k\in\mathbb Z-\{0\} \smallskip\\0&k=0\end{cases}, \end{equation} and \begin{equation} \left.\frac{d^2}{dt^2}\,\mbox{sinc}\Bigl(\frac{t}2+\pi k\Bigr)\right\rvert_{t=0} =\begin{cases} \dfrac{(-1)^{k+1}}{2(\pi k)^2}&k\in\mathbb Z-\{0\} \smallskip\\-\dfrac1{12}&k=0\end{cases}. \end{equation} Equations (\ref{eq:res1}) indeed reproduce the results expected from the elementary arguments given in the introduction with the proviso that the infinite sums, $S_0$ and $S_1$ in equations (\ref{eq:msd}) and (\ref{eq:ssd}) are negligible. In other words, if one considers only the $k=0$ term in the characteristic function of equation (\ref{eq:fn_char}), we would recover the results that $m=\mu-\delta$ and $s^2=\sigma^2+1/12$. In fact, if one regards $F_n$ to be a continuous distribution over real $n$ and replace the infinite sum $\sum_{n=-\infty}^\infty e^{i(t-\tau)n}$ in equation (\ref{eq:fn_char}) with the integral $\int_{-\infty}^\infty e^{i(t-\tau)n}{\rm d}n$, the Dirac comb $\sum_{k=-\infty}^\infty\deltaup(t-\tau+2\pi k)$ would be replaced by a single Dirac delta $\deltaup(t-\tau)$. That is to say, the naive expectation that $m=\mu-\delta$ and $s^2=\sigma^2+1/12$ may be considered as the approximation in the limit of continuous $F_n$. \subsection{symmetric distribution} If $M\in\mathbb Z$ is the integer to which the mean $\mu$ is rounded, $\mu\in[M+\delta-1/2,M+\delta+1/2]$ and $\chi=\mu-\delta-M\in[-1/2,1/2]$. Since $M$ and $k$ are integers and $\mu-\delta=M+\chi$, we find \begin{equation}\label{eq:csum}\begin{split} S_0&=\sum_{\substack{k=-\infty\\k\ne0}}^\infty\! \frac{(-1)^k\tilde\varphi(2\pi k)}{2\pi ik}e^{2\pi ik\chi}; \\S_1&=\sum_{\substack{k=-\infty\\k\ne0}}^\infty\!\frac{(-1)^k}{\pi k} \left[\tilde\varphi'(2\pi k)-\frac{\tilde\varphi(2\pi k)}{2\pi k}\right] e^{2\pi ik\chi}, \end{split}\end{equation} which is basically the Fourier series expressions of $S_0(\chi)$ and $S_1(\chi)$ for $\chi\in[-1/2,1/2]$. Since $\tilde\varphi(-t)=\tilde\varphi(t)$ and $\tilde\varphi'(-t)=-\tilde\varphi'(t)$ for a symmetric distribution, these can be further reducible to the real ones: \begin{equation}\label{eq:rsum}\begin{split} S_0&=\sum_{k=1}^\infty\! \frac{(-1)^k\tilde\varphi(2\pi k)}{\pi k}\sin(2\pi k\chi); \\S_1&=\sum_{k=1}^\infty\!\frac{2\cdot(-1)^k}{\pi k} \left[\tilde\varphi'(2\pi k)-\frac{\tilde\varphi(2\pi k)}{2\pi k}\right] \cos(2\pi k\chi) \\&=\sum_{k=1}^\infty\!4\cdot(-1)^k \left.\frac d{dt}\biggl(\frac{\tilde\varphi(t)}t\biggr)\right|_{t=2\pi k} \cos(2\pi k\chi) \end{split}\end{equation} if $f(x)$ is symmetric about its mean. Next, consider the family of the distributions sharing the common normalized form; namely, \begin{equation} f(x)=\frac1\sigma\,F\!\left(\frac{x-\mu}\sigma\right) \end{equation} where $F(u)$ is a fixed non-negative function such that $\int_{-\infty}^\infty\!{\rm d}u\,F(u)=1$, $\int_{-\infty}^\infty\!{\rm d}u\,u\,F(u)=0$, and $\int_{-\infty}^\infty\!{\rm d}u\,u^2F(u)=1$. Then, for all members of the family, we find $\varphi(t)=e^{i\mu t}\Phi(\sigma t)$ and $\tilde\varphi(t)=\Phi(\sigma t)$ where \begin{equation} \Phi(\tau)=\int_{-\infty}^\infty\!{\rm d}u\,e^{iu\tau}F(u) \end{equation} is the characteristic function of the normalized distribution. Here $f(x)$ is a symmetric distribution if and only if $F(u)$ and $\Phi(\tau)$ are even functions: $F(-u)=F(u)$ and $\Phi(-\tau)=\Phi(\tau)$. In the limit of $\sigma=0$ -- essentially $F(u)=\deltaup(u)$ -- we then have $\tilde\varphi(t)=\Phi(0)=1$ and $\tilde\varphi'(t)=\sigma\Phi'(\sigma t)=0$ and so \begin{equation}\begin{split} \lim_{\sigma^2\to0}S_0&=\sum_{k=1}^\infty\! \frac{(-1)^k}{\pi k}\sin(2\pi k\chi)=-\chi; \\\lim_{\sigma^2\to0}S_1&=\sum_{k=1}^\infty\!\frac{(-1)^{k+1}}{(\pi k)^2} \cos(2\pi k\chi)=\frac1{12}-\chi^2, \end{split}\end{equation} for $\chi\in[-1/2,1/2]$. Then it follows that $m=\mu-\delta-\chi=M$ and $s^2=\sigma^2+1/12-(1/12-\chi^2)-(-\chi)^2 =\sigma^2=0$, as expected (i.e.\ every sample point is rounded to the same integer). Now suppose that $\Phi(\tau)$ admits an asymptotic expansion; \begin{equation}\label{eq:asymphi} \Phi(\tau)\simeq\frac1{|\tau|^s} \sum_{p=0}^\infty\frac{\Phi_{\infty,p}}{\tau^{2p}} \qquad\text{($\tau\to\infty$)} \end{equation} with a constant $s>0$. Then it follows from equation (\ref{eq:rsum}) that \begin{equation}\label{eq:sasum}\begin{split} S_0&\simeq\sum_{p=0}^\infty\!\frac{\Phi_{\infty,p}}{(2\sigma)^{2p+s}} \sum_{k=1}^\infty\!\frac{(-1)^k\sin(2\pi k\chi)}{(\pi k)^{2p+s+1}}; \\S_1&\simeq\sum_{p=0}^\infty\! \frac{(2p+s+1)\Phi_{\infty,p}}{(2\sigma)^{2p+s}} \sum_{k=1}^\infty\!\frac{(-1)^{k+1}\cos(2\pi k\chi)}{(\pi k)^{2p+s+2}}. \end{split}\end{equation} Here the inner sums on $k$ converge absolutely for $s>0$ (NB: the sums for an even integer $s$ are actually reducible to the Bernoulli polynomials) given that \begin{multline} \left\lvert \sum_{k=1}^\infty\!\frac{(-1)^k\sin(2\pi k\chi)}{(\pi k)^{2p+s+1}} \right\rvert\le \sum_{k=1}^\infty\!\frac{|(-1)^k\sin(2\pi k\chi)|}{(\pi k)^{2p+s+1}} \\\le\sum_{k=1}^\infty\!\frac1{(\pi k)^{2p+s+1}} =\frac{\zeta(2p+s+1)}{\pi^{2p+s+1}}, \end{multline} where $\zeta(z)$ is the Riemann zeta function and similarly \begin{equation} \left\lvert \sum_{k=1}^\infty\!\frac{(-1)^{k+1}\cos(2\pi k\chi)}{(\pi k)^{2p+s+2}} \right\rvert\le\frac{\zeta(2p+s+2)}{\pi^{2p+s+2}}. \end{equation} If $\chi=1/2$, then $\cos(2\pi k\chi)=\cos(\pi k)=(-1)^k$ for any integer $k$ and so the last bound is actually sharp. By contrast, the first bound is not sharp but it suffices for our purposes here. Since $\lim_{z\to\infty}\zeta(z)=1$ and $\zeta(z)$ for $z>1$ is monotonically decreasing, we can conclude that equations (\ref{eq:sasum}) is in fact valid asymptotic expansion of $S_0$ and $S_1$ as $\sigma\to\infty$. Also it follows that, if $\lim_{\tau\to\infty}d\ln|\Phi(\tau)|/d\ln|\tau|=-s<0$, we have $S_0\sim\sigma^{-s}\to0$ and $S_1\sim\sigma^{-s}\to0$ as $\sigma\to\infty$ as well as $m=\mu-\delta+\mathcal O(\sigma^{-s})$ and $s^2=\sigma^2+1/12+\mathcal O(\sigma^{-s})$. As a concrete example, consider the bilateral exponential (Laplace) distribution of the mean $\mu$ and the variance $\sigma^2$: \begin{equation}\label{eq:bed} f(x)=\frac1{\!\sqrt2\sigma} \exp\biggl(-\frac{\!\sqrt2}\sigma\lvert x-\mu\rvert\biggr), \end{equation} which is easily normalizable so that \begin{equation} F(u)=\frac{e^{-\!\sqrt2|u|}}{\!\sqrt2};\quad \Phi(\tau)=\left(1+\frac{\tau^2}2\right)^{-1}. \end{equation} Here we find $\Phi(\tau)=-\sum_{k=1}^\infty(-2/\tau^2)^k\simeq2/\tau^2$ as $\tau\to\infty$ and so it should be $m=\mu-\delta+\mathcal O(\sigma^{-2})$ and $s^2=\sigma^2+1/12+\mathcal O(\sigma^{-2})$. In fact for this case, we know the analytic forms for $S_0(\chi)$ and $S_1(\chi)$. That is to say, let us consider the odd function for $\chi\in[-1/2,1/2]$ given by \begin{equation}\label{eq:s0_bed}\begin{split} S_0(\chi)&=\sum_{k=1}^\infty\frac{2^kB_{2k+1}(1/2+\chi)}{(2k+1)!\sigma^{2k}} \\&=\frac{\sinh(\!\sqrt2\chi/\sigma)}{2\sinh[1/(\!\sqrt2\sigma)]}-\chi, \end{split}\end{equation} where $B_n(z)$ is the Bernoulli Polynomial. Then we find that \begin{equation} \int_{-1/2}^{1/2}\!{\rm d}\chi\,S_0(\chi)\sin(2\pi k\chi) =\frac{(-1)^k}{2\pi k[1+2(\sigma\pi k)^2]}. \end{equation} for a positive integer $k$. It follows that the first infinite sum in equation (\ref{eq:rsum}) with $\tilde\varphi(t)=\Phi(\sigma t)=[1+(\sigma t)^2/2]^{-1}$ is the Fourier (sine) series expansion for $S_0(\chi)$ in equation (\ref{eq:s0_bed}). In other words, if we sample the random variable $x$ distributed according to equation (\ref{eq:bed}) and round it to an integer $n$ such that $n+\delta-1/2\le x<n+\delta+1/2$ or $n+\delta-1/2<x\le n+\delta+1/2$ with a fixed $\delta\in[-1/2,1/2]$, the mean of $n$ is \begin{equation}\begin{split} m&=\mu-\delta+S_0 =M+\frac{\sinh(\!\sqrt2\chi/\sigma)}{2\sinh[1/(\!\sqrt2\sigma)]} \\&\simeq\mu-\delta-\frac{\chi(1-4\chi^2)}{12\sigma^2}+\mathcal O(\sigma^{-4}), \end{split}\end{equation} where $M$ is the integer to which $\mu$ is rounded and $\chi=\mu-\delta-M$. Similarly we can also establish that the second infinite sum in equation (\ref{eq:rsum}) with the same $\tilde\varphi(t)$ is a Fourier series representation of \begin{equation}\begin{split} S_1(\chi)&=\sum_{k=1}^\infty\!\frac{2^kB_{2k+2}(1/2+\chi)}{(k+1)(2k)!\sigma^{2k}} \\&=\sigma^2+\frac1{12}-\chi^2 +\frac{\chi\sinh(\!\sqrt2\chi/\sigma)}{\sinh[1/(\!\sqrt2\sigma)]} \\&\phantom{=\sigma^2} -\frac{\cosh[1/(\!\sqrt2\sigma)]\cosh(\!\sqrt2\chi/\sigma)} {2\sinh^2[1/(\!\sqrt2\sigma)]}, \end{split}\end{equation} and so the variance of the rounded integers sampled over the random variables with the distribution in equation (\ref{eq:bed}) is \begin{equation}\label{eq:bedsasym}\begin{split} s^2&=\frac{2\cosh[1/(\!\sqrt2\sigma)]\cosh(\!\sqrt2\chi/\sigma)-\sinh^2(\!\sqrt2\chi/\sigma)}{4\sinh^2[1/(\!\sqrt2\sigma)]} \\&\simeq\sigma^2+\frac1{12} -\left(\frac7{480}-\frac{\chi^2}4 +\frac{\chi^4}2\right)\frac1{\sigma^2}+\mathcal O(\sigma^{-4}). \end{split}\end{equation} \section{Expectation Values for unspecified mean} The results so far have concerned the distributions with a known fixed mean. Here instead we consider the cases of unspecified means. That is to say, let us calculate the expectation values for the (difference to the true) mean and the variance of the rounded variables averaged over distributions with all possible means. In practice, this is achieved by averaging over $\chi\in[-1/2,1/2]$ and so $\langle m-\mu\rangle=-\delta+\langle S_0\rangle$ and $\langle s^2\rangle=\sigma^2+1/12 -\langle S_1\rangle-\langle S_0^2\rangle$, where $\langle S_0\rangle=\int_{-1/2}^{1/2}{\rm d}\chi\,S_0(\chi)$ and so on. However, we have $\langle e^{2\pi ik\chi}\rangle =\langle\sin(2\pi\chi k)\rangle=\langle\cos(2\pi\chi k)\rangle=0$ for any non-zero integer $k$ and thus $\langle S_0\rangle=\langle S_1\rangle=0$ given equations (\ref{eq:csum}) and (\ref{eq:rsum}). As for $\langle S_0^2\rangle$, let us first note $\langle S_0^2\rangle\ne\langle S_0\rangle^2$. Rather from equation (\ref{eq:csum}), \begin{equation}\label{eq:avs0}\begin{split} \langle S_0^2\rangle&= \sum_{\substack{k,p=-\infty\\k,p\ne0}}^\infty\!(-1)^{k+p} \frac{\tilde\varphi(2\pi k)\tilde\varphi(2\pi p)}{(2\pi i)^2kp} \langle e^{2\pi i(k+p)\chi}\rangle \\&=\sum_{\substack{k=-\infty\\k\ne0}}^\infty\! \frac{\tilde\varphi(2\pi k)\tilde\varphi(-2\pi k)}{(2\pi k)^2} =\sum_{k=1}^\infty\! \frac{\lvert\tilde\varphi(2\pi k)\rvert^2}{2(\pi k)^2}, \end{split}\end{equation} where we have used the fact that $\tilde\varphi(-t)$ is the complex conjugate of $\tilde\varphi(t)$ for any real $f(x)$ (see eq.~\ref{eq:scfdef}). The same result for the symmetric distributions may also be derived from equation (\ref{eq:rsum}) given $\langle\sin^2(2\pi\chi k)\rangle=1/2$ and $\langle\sin(2\pi\chi k)\sin(2\pi\chi p)\rangle=0$ for positive integers $k\ne p$. Consequently \begin{equation}\label{eq:s2av} \langle m\rangle=\mu-\delta,\quad \langle s^2\rangle=\sigma^2+\frac1{12}-\sum_{k=1}^\infty\! \frac{\lvert\tilde\varphi(2\pi k)\rvert^2}{2(\pi k)^2}, \end{equation} with $\lim_{\sigma\to0}\langle S_0^2\rangle=\zeta(2)/(2\pi^2)=1/12$ (given $\tilde\varphi(t)=1$ for $\sigma=0$) and $\langle s^2\rangle=\sigma^2=0$ in the limit of $\sigma=0$. If $\Phi(\tau)$ is given by the same function admitting the asymptotic expansion of equation (\ref{eq:asymphi}), we find \begin{equation} \langle S_0^2\rangle\simeq\sum_{p=0}^\infty\frac{\zeta(2p+2s+2) \left(\sum_{r=0}^p\Phi_{\infty,p-r}\Phi_{\infty,r}\right)} {2^{2(p+s)+1}\pi^{2(p+s+1)}\sigma^{2(p+s)}}, \end{equation} and so $\langle S_0^2\rangle\sim\sigma^{-2s}\to0$ and $\langle s^2\rangle=\sigma^2+1/12+\mathcal O(\sigma^{-2s})$ (also $0\le\langle s^2\rangle\le\sigma^2+1/12$) as $\sigma\to\infty$ for $\Phi(\tau)\sim\tau^{-s}$ as $\tau\to\infty$. That is to say, $\langle s^2\rangle$ typically tends to the limiting value $\lim_{\sigma^2\to\infty}(\langle s^2\rangle-\sigma^2)=1/12$ about twice much faster than the individual $s^2$ does. For example, with the bilateral exponential distribution given in equation (\ref{eq:bed}), we specifically have \begin{equation}\begin{split} \langle S_0^2\rangle&=\sum_{k=1}^\infty\!\frac1{2(\pi k)^2[1+2(\pi k\sigma)^2]^2} \\&=\sum_{k=1}^\infty\!\frac1{2^3(\pi k)^6\sigma^4} \sum_{p=0}^\infty\!\frac{(-1)^p(p+1)}{2^p(\pi k\sigma)^{2p}} \\&=\sum_{p=0}^\infty\!\frac{(-1)^p(p+1)}{\sigma^{2(p+2)}} \frac{\zeta(2p+6)}{(2\pi^2)^{p+3}} \\&=\sum_{p=0}^\infty\!\frac{(p+1)B_{2p+6}}{(2p+6)!}\frac{2^{p+2}}{\sigma^{2(p+2)}} \\&=\sigma^2+\frac1{12} -\frac{2+3\!\sqrt2\,\sigma\sinh(\!\sqrt2/\sigma)}{16\sinh^2[1/(\!\sqrt2\sigma)]} \end{split}\end{equation} where $B_k$ is the Bernoulli number, and so \begin{equation}\begin{split} \langle s^2\rangle &=\frac{2+3\!\sqrt2\,\sigma\sinh(\!\sqrt2/\sigma)}{16\sinh^2[1/(\!\sqrt2\sigma)]} \\&=\sigma^2+\frac1{12} -\frac1{\sigma^4} \sum_{p=0}^\infty\!\frac{(p+1)B_{2p+6}}{(2p+6)!}\frac{2^{p+2}}{\sigma^{2p}}; \end{split}\end{equation} that is, $\langle s^2\rangle\simeq\sigma^2+1/12-1/(7560\sigma^4) +\mathcal O(\sigma^{-6})$, which contrasts to equation (\ref{eq:bedsasym}). \subsection{distributions with a compact support} Suppose that $f(x)$ is \begin{equation}\label{eq:ud} f(x)=\begin{cases} \dfrac1{2\!\sqrt3\sigma}&(\mu-\!\sqrt3\sigma\le x\le\mu+\!\sqrt3\sigma) \\0&\text{elsewhere}\end{cases}, \end{equation} i.e.\ the uniform distribution over a compact interval, the normalized form of which is \begin{equation}\begin{split} F(u)&=\begin{cases} \dfrac1{2\!\sqrt3}&(-\!\sqrt3\le u\le\!\sqrt3) \\0&\text{elsewhere}\end{cases}; \\\Phi(\tau)&=\int_{-\!\sqrt3}^{\!\sqrt3} \frac{e^{iu\tau}{\rm d}u}{2\!\sqrt3} =\frac{\sin(\!\sqrt 3\tau)}{\!\sqrt3\tau}. \end{split}\end{equation} We then find for the compact uniform distribution that \begin{equation}\label{eq:s0unid}\begin{split} \langle S_0^2\rangle&=\sum_{k=1}^\infty\! \frac{\sin^2(2\!\sqrt3\pi\sigma k)}{2(\pi k)^2(2\!\sqrt3\pi\sigma k)^2} =\sum_{k=1}^\infty\!\frac{1-\cos(4\!\sqrt3\pi\sigma k)}{48\sigma^2(\pi k)^4} \\&=\frac1{48\sigma^2}\left[ \frac{\zeta(4)}{\pi^4}-\frac{B_4(\xi)}3\right] =\frac{\xi^2(1-\xi)^2}{144\sigma^2} \end{split}\end{equation} where $\xi=2\!\sqrt3\sigma-\lfloor2\!\sqrt3\sigma\rfloor\in[0,1)$ is the fractional part of ``$2\!\sqrt3\sigma$ (which is the width of the support)''. Here we have used the Fourier series expansion of the Bernoulli polynomial (for $0\le\xi\le1$) of the even order\citep{DLMF} \begin{equation} B_{2n}(\xi)=(-1)^{n+1}\frac{(2n)!}{2^{2n-1}} \sum_{k=1}^\infty\frac{\cos(2\pi k\xi)}{(\pi k)^{2n}}, \end{equation} with $\zeta(4)=\pi^4/90$ and $B_4(\xi)=\xi^2(\xi-1)^2-1/30$. That is to say, while the remainder $\langle S_0^2\rangle=\sigma^2+1/12-\langle s^2\rangle$ falls off ``on average'' like $\sim\sigma^{-2}$ as $\sigma\to\infty$, the actual behavior includes the periodic modulation superimposed on the asymptotic scale-free decay. This is due to the compact support on the underlying distribution: note that a compact distribution $F(u)$ typically results in an oscillatory $\Phi(\tau)$, and $\langle S_0^2\rangle$ is basically the sum on the regular sampling of the latter. The resulting modulation of $\langle S_0^2\rangle$ may be understood as a sort of interference patterns between the width of the compact support and the unit intervals for the rounded integer values. However unless the variance of the underlying continuous distribution $f(x)$ is known a priori, the averaged asymptotic behavior of $\langle S_0^2\rangle$ as $\sigma\to\infty$ may be used to estimate $\sigma^2$ from $s^2$ in practice within a reasonable accuracy (provided $s^2>>1$). If one is in fact only interested in the averaged asymptotic behavior, we can further average $\langle S_0^2\rangle$ in equation (\ref{eq:s0unid}) over $\xi\in[0,1)$ and get $\langle S_0^2\rangle=\zeta(4)/(48\sigma^2\pi^4)=(4320\sigma^2)^{-1}$. For a general distribution with a compact support, one may obtain the averaged asymptotic behavior for $\langle S_0^2\rangle$ in equation (\ref{eq:avs0}) by assuming that any sum of the form $\sum_k\sin(a\sigma k)/k^n$ or $\sum_k\cos(a\sigma k)/k^n$ (where $a$ is a fixed real constant) also vanishes on average. In principle we can also calculate $S_0$ and $S_1$ first, and subsequently average them over the proper interval. For the uniform distribution in equation (\ref{eq:ud}), equation (\ref{eq:rsum}) results in \begin{equation}\label{eq:us0}\begin{split} S_0&=\sum_{k=1}^\infty\!(-1)^k \frac{\sin(2\!\sqrt3\sigma\pi k)}{2\!\sqrt3\sigma(\pi k)^2}\sin(2\pi k\chi) \\&=\sum_{k=1}^\infty\! \frac{\cos(2\pi\Delta_-k)-\cos(2\pi\Delta_+k)}{4\!\sqrt3\sigma(\pi k)^2} \\&=\frac{B_2(\Delta_-)-B_2(\Delta_+)}{4\!\sqrt3\sigma} =-\frac{\lambda\zeta}{\!\sqrt3\sigma}, \end{split}\end{equation} where $\Delta_\pm=\mu-\delta+1/2\pm\!\sqrt3\sigma-m_\pm$ is the fractional part of $\mu\pm\!\sqrt3\sigma-\delta+1/2$ and $m_\pm=\lfloor(1/2+\mu-\delta\pm\!\sqrt3\sigma)\rfloor$ is the integer to which the upper/lower limit of the compact support (i.e.\ $\mu\pm\!\sqrt3\sigma$) is rounded. In addition, $\lambda=(\Delta_++\Delta_--1)/2$ and $\zeta=(\Delta_+-\Delta_-)/2$. Also used are $(-1)^k\sin(2\pi k\chi)=\sin[2\pi k(1/2+\mu-\delta)]$ for any integer $k$ given $\chi=\mu-\delta-M$ with an integer $M$, and $B_2(x)=x^2-x+1/6$. Similarly, \begin{equation}\label{eq:us1}\begin{split} S_1&=\sum_{k=1}^\infty\!(-1)^k \left[\frac{\cos(2\!\sqrt3\sigma\pi k)}{(\pi k)^2} -\frac{\sin(2\!\sqrt3\sigma\pi k)}{\!\sqrt3\sigma(\pi k)^3}\right] \cos(2\pi k\chi) \\&=\frac{B_2(\Delta_-)+B_2(\Delta_+)}{2} +\frac{B_3(\Delta_-)-B_3(\Delta_+)}{3\!\sqrt3\sigma} \\&=\lambda^2+\zeta^2-\frac1{12} -\left(2\lambda^2+\frac23\zeta^2-\frac16\right)\frac\zeta{\!\sqrt3\sigma}, \end{split}\end{equation} further utilizing $B_3(x)=x^3-3x^2/2+x/2$ and the Fourier series for the odd-order Bernoulli polynomial\citep{DLMF}: \begin{equation} \sum_{k=1}^\infty\frac{\sin(2\pi kx)}{(\pi k)^{2n+1}} =\frac{(-1)^{n+1}2^{2n}}{(2n+1)!}B_{2n+1}(x) \quad(0\le x\le 1). \end{equation} Here note $\lim_{\sigma^2\to0}S_1=\lambda^2+\zeta^2-1/12$ and so $s^2=\sigma^2-\lambda^2-\zeta^2+1/6+\mathcal O(\sigma^{-1})$ even though $\Phi(\tau)=\mbox{sinc}(\!\sqrt3\tau)\sim\tau^{-1}$ as $\tau\to\infty$. Technically this is not a counter-example of the prior discussion following equation (\ref{eq:asymphi}), since $\mbox{sinc}(x)$ does not actually have a proper asymptotic expansion as $x\to\infty$ in the strict sense. In fact, we observe that, while the asymptotic behavior of $S_0$ as $\sigma\to\infty$ follows that of $\Phi(\tau)$ as $\tau\to\infty$, the behavior of $S_1$ actually traces $\tau\Phi'(\tau)$ instead. With an oscillatory $\Phi(\tau)$ due to $F(u)$ on a compact support, $\tau\Phi'(\tau)$ can indeed be much larger than $\Phi(\tau)$ even if $\Phi(\tau)$ is bounded by an asymptotically decaying envelope, and so $s^2-\sigma^2$ does not necessarily tend to $1/12$ unless $\tau\Phi'(\tau)\to0$ as $\tau\to\infty$. By contrast, the formula for $\langle s^2\rangle$ in equation (\ref{eq:s2av}) only involves $|\tilde\varphi(2\pi k)|^2$ and we thus expect the asymptotic behavior of the remainder $\sigma^2+1/12-\langle s^2\rangle$ to trace that of $|\Phi(\tau)|^2$ in general. In order to average the expresseions in equations (\ref{eq:us0}) and (\ref{eq:us1}) over $\chi\in[-1/2,1/2]$, we first observe that $\zeta=\xi/2\ge0$ or $\zeta=(\xi-1)/2<0$ (where $0\le\xi<1$ is still the fractional part of $2\!\sqrt3\sigma$). Next $\Delta_\pm=\lambda\pm\zeta+1/2\in[0,1)$ implies $\lambda\in[-1/2+\zeta,1/2-\zeta)=[(\xi-1)/2,(1-\xi)/2)$ for $\zeta\ge0$ and $\lambda\in[-1/2-\zeta,1/2+\zeta)=[-\xi/2,\xi/2)$ for $\zeta<0$. Finally $\lambda=\chi\pm\frac12$ or $\chi$ depending on the parity of $m_++m_-$ and we find that $\chi\in[-1/2,1/2]$ at fixed $\sigma$ (and consequently $\xi$ is also fixed) then maps to the union of those two allowed intervals on $\lambda$. Consequently averaging over $\chi\in[-1/2,1/2]$ is achieved through summing two integrals on $\lambda$: viz.\ \begin{equation}\label{eq:s0av}\begin{split} \langle S_0^2\rangle &=\int_{\frac{\xi-1}2}^{\frac{1-\xi}2}\!{\rm d}\lambda \left.S_0^2\right\rvert_{\zeta=\frac\xi2} +\int_{-\frac\xi2}^{\frac\xi2}\!{\rm d}\lambda \left.S_0^2\right\rvert_{\zeta=\frac{\xi-1}2} \\&=\frac2{3\sigma^2} \left[\frac{\xi^2}4\int_0^{\frac{1-\xi}2}\!{\rm d}\lambda\,\lambda^2 +\frac{(\xi-1)^2}4\int_0^{\frac\xi2}\!{\rm d}\lambda\,\lambda^2\right] \\&=\frac2{3\sigma^2} \left[\frac{\xi^2}4\frac{(1-\xi)^3}{24} +\frac{(\xi-1)^2}4\frac{\xi^3}{24}\right] =\frac{\xi^2(1-\xi)^2}{144\sigma^2}, \end{split}\end{equation} which recovers equation (\ref{eq:s0unid}). Since $S_0$ is an odd function of $\lambda$, it is immediately obvious that $\langle S_0\rangle=0$. As for $\langle S_1\rangle$, two respective integrals for $\zeta=\xi/2\ge0$ and $\zeta=(\zeta-1)/2<0$ exactly cancel each other and so $\langle S_1\rangle=0$. Since $\chi$ (i.e.\ the offset of the mean from an integer value) determines both $\Delta_\pm$ (i.e.\ the offsets of the boundary points of the support from integer values) once $\sigma$ (which specifies the width of the support) is fixed, $\Delta_+$ and $\Delta_-$ are not in fact independent from each other. Nevertheless it is still formally possible to consider $S_0$ in equation (\ref{eq:us0}) as a function of the pair of independent variables $(\Delta_+,\Delta_-)\in[0,1)^2$ and average $S_0^2$ over this whole rectangular domain. Following the coordinate transform $(\Delta_+,\Delta_-)\rightarrow(\lambda,\zeta)$, the resulting average is shown to be identical to further averaging the $\chi$-average of equation (\ref{eq:s0av}) over $\zeta\in(-1/2,1/2)$ or equivalently $\xi\in[0,1)$. That is to say, if one assume that both upper and lower boundaries of the compact support are randomly placed relative to the integer values (and independent from each other), the resulting expectation value (averaged over all possible such placements) recovers only the ``slow'' asymptotic decay behavior of $\langle s^2\rangle$ for the rounded random variables on a compact support while averaging off the ``fast'' modulation due to the interference between the width of the support and the integer signposts. \section{Normal distributions} Finally we would like to consider the case of $f(x)$ being the Gaussian normal distribution: \begin{equation} f(x)=\frac1{(2\pi)^{1/2}\sigma} \exp\biggl[-\frac{(x-\mu)^2}{2\sigma^2}\biggr], \end{equation} or in the standard form \begin{equation} F(u)=\frac{e^{-u^2/2}}{\!\sqrt{2\pi}},\quad \Phi(\tau)=e^{-\tau^2/2}. \end{equation} Then with $\tilde\varphi(t)=\Phi(\sigma t)$, we have \begin{equation}\begin{split} S_0&=\sum_{k=1}^\infty\!(-1)^k\sin(2\pi k\chi)\, \frac{e^{-2(\pi\sigma k)^2}}{\pi k}; \\S_1&=\sum_{k=1}^\infty\!(-1)^k\frac{\cos(2\pi k\chi)}{\pi^2} \,\left. \frac d{d\kappa}\biggl(\frac{e^{-2(\pi\sigma\kappa)^2}}\kappa\biggr) \right\rvert_{\kappa=k} \\&=\sum_{k=1}^\infty\!(-1)^{k+1}\cos(2\pi k\chi)\, \frac{1+(2\pi\sigma k)^2}{(\pi k)^2}e^{-2(\pi\sigma k)^2}. \end{split}\end{equation} Thanks to the super-exponential decay $\propto e^{-2(\pi\sigma k)^2}$ in $k$ (NB: the $k=2$ term is suppressed relative to the $k=1$ term by $\sim e^{-6(\pi\sigma)^2}$: if $\sigma=1$, note $e^{-6\pi^2}\approx2\times10^{-26}$!), these sums (which are actually in the form of the \emph{Jacobi theta function} and its antiderivatives) converge extremely quickly and are completely dominated by their respective first terms unless $\sigma\ll1$. Alternatively we may construct a more formal argument by bracketing the infinite sums following the integral convergence test. In particular, we first observe that \begin{equation}\begin{split} |S_0|&\le\sum_{k=1}^\infty\frac{e^{-2(\pi\sigma k)^2}}{\pi k}=I_0, \\|S_1|&\le\sum_{k=1}^\infty \frac{1+(2\pi\sigma k)^2}{(\pi k)^2}e^{-2(\pi\sigma k)^2}=I_1 \end{split}\end{equation} but the summands now are strictly decreasing positive functions of $k\ge1$. Hence the integral convergence test indicates \begin{equation}\begin{split} \frac{E_1(2\pi^2\sigma^2)}{2\pi}&\le I_0\le\frac{e^{-2(\pi\sigma)^2}}\pi+\frac{E_1(2\pi^2\sigma^2)}{2\pi}, \\\frac{e^{-2(\pi\sigma)^2}}{\pi^2}&\le I_1\le\frac{(2\pi\sigma)^2+2}{\pi^2}e^{-2(\pi\sigma)^2}, \end{split}\end{equation} where $E_1(x)=\int_1^\infty\!{\rm d}t\,e^{-tx}/t$ is the analytic exponential integral. Note that $I_0$ for $\sigma=0$, which results in the harmonic series, actually diverges and so the first bounds are only valid for $\sigma>0$, but it has been already shown that $S_0=-\chi$ if $\sigma=0$. Given the asymptotic expansion $e^xE_1(x)\sim\sum_{k=0}^\infty(-1)^kk!/x^{k+1}$ as $x\to\infty$, the first bounds may also be replaced by the purely elementary functions. In particular, for $x>0$, we find \begin{equation} e^xE_1(x)=\int_1^\infty\!\frac{e^{x(1-t)}{\rm d}t}t <\int_1^\infty\!{\rm d}t\,e^{-x(t-1)}=\frac1x, \end{equation} i.e.\ $E_1(x)<e^{-x}/x$ for $x>0$, and so follows that \begin{equation} |S_0|\le I_0\le \left[1+\frac1{(2\pi\sigma)^2}\right]\frac{e^{-2(\pi\sigma)^2}}\pi. \end{equation} That is to say, for a sufficiently large $\sigma$, both sums $I_0$ and $I_1$ are completely dominated by their respective first terms, and $S_0\sim\mathcal O(e^{-2(\pi\sigma)^2})$ and $S_1\sim\mathcal O(\sigma^2e^{-2(\pi\sigma)^2})$ as $\sigma\to\infty$. In conclusion, the mean $m$ and the variance $s^2$ of the rounded variables drawn from the normal distribution (of the mean $\mu$ and the variance $\sigma^2$) behave like \begin{equation}\begin{split} m&\simeq\mu-\delta+\mathcal O(e^{-2(\pi\sigma)^2}); \\s^2&\simeq\sigma^2+\frac1{12}+\mathcal O(\sigma^2e^{-2(\pi\sigma)^2}), \end{split}\end{equation} as $\sigma\to\infty$, but the remainder in most practical purposes can be safely ignored provided $\sigma\gtrsim1$ (NB: $e^{-2\pi^2}/\pi\approx8.5\times10^{-10}$). As for the expectation value averaged over $\mu$ at fixed $\sigma^2$, if we consider the sum \begin{equation} \langle S_0^2\rangle= \sum_{k=1}^\infty\frac{e^{-(2\pi\sigma k)^2}}{2(\pi k)^2}, \end{equation} the integral test is still applicable: \begin{equation} \int_1^\infty\!\frac{e^{-(2\pi\sigma x)^2}{\rm d}x}{2(\pi x)^2}\le \langle S_0^2\rangle\le \frac{e^{-(2\pi\sigma)^2}}{2\pi^2} +\int_1^\infty\!\frac{e^{-(2\pi\sigma x)^2}{\rm d}x}{2(\pi x)^2}. \end{equation} While here the integral is technically reducible to the incomplete gamma function (or an expression involving the error function), it is sufficient for our purpose to note \begin{equation} e^a\!\int_1^\infty\!\frac{e^{-ax^2}{\rm d}x}{x^2} =\int_0^\infty\!\frac{e^{-at}{\rm d}t}{2(t+1)^{3/2}} <\int_0^\infty\!\frac{e^{-at}{\rm d}t}2=\frac1{2a} \end{equation} for $a>0$. Hence it follows that, for $\sigma>0$, \begin{gather} \langle S_0^2\rangle=\sigma^2+\frac12-\langle s^2\rangle \le\left[\frac12+\frac1{(4\pi\sigma)^2}\right]\frac{e^{-(2\pi\sigma)^2}}{\pi^2}; \\\therefore\ \langle s^2\rangle\simeq\sigma^2+\frac1{12}+\mathcal O(e^{-(2\pi\sigma)^2}) \end{gather} with an even faster-decaying (cf.\ $e^{-(2\pi)^2}/\pi^2\approx7.2\times10^{-19}$) remainder term. In summary, the rounding errors for the normally distributed random variables can for most practical applications be considered as independent from the intrinsic dispersion unless the intrinsic dispersion itself is quite smaller than the rounding unit.
\section{INTRODUCTION} High pressure (HP) and high temperature (HT) can significantly alter both crystal structure and electronic properties of a material without creating any external impurities, leading to a tremendous amount of discovery of new compounds and unusual properties. For instance, most matters contract in all directions under hydrostatic pressure, whereas very few materials expand along one direction coupled to the volume reduction due to its anisotropy, which is defined as negative linear compressibility (NLC) \cite{R01,R02,R03}. Several NLC materials were previously reported in dense inorganic oxides and fluorides, as well as a few complex organics \cite{R04,R05,R06,R07,R08,R09,R10,R11}. On the basis of this anomalous mechanical property, the NLC materials have important applications in the design of pressure sensors, actuators, artificial muscles and optical fibers with high shock resistance \cite{R02,R12,R13,R14,R15,R16}. Another example relates to superionic compounds, also denoted as fast ion conductors or solid electrolytes, whose structures usually contain the rigid frameworks with open channels along which ions can migrate \cite{R17,R18,R19}. Superionic materials featured by a liquid-like conductivity within the fixed crystalline frameworks have long attracted enormous attention for battery, fuel cell, thermoelectrics, and other energy applications, e.g., Li$_{10}$GeP$_{2}$S$_{12}$, LiAlSO and Cu$_{2}$Se \cite{R20,R21,R22}. Furthermore, a few common materials such as ice and ammonia exhibit superionic state at HPHT conditions, which even improves our knowledge of the middle ice layers of Neptune and Uranus \cite{R17,R18}. For sodium borides, only a few compounds are precisely determined with regard to their compositions and structures \cite{R23,R24,R25}. The new predicted phase of $I2_{1}2_{1}2_{1}$-Na$_{2}$B$_{30}$ with an unprecedented open-framework boron sublattice is helpful to resolve the debate on the ground-state structure of sodium borides \cite{R23,R24,R25,R26}. Those results inspired us to further explore the phase diagram and properties of sodium borides at mild pressure. In this work, we surprisingly found sodium boride (NaB$_{3}$) had a temperature-induced swap state beside superionicity and NLC simultaneously, providing a representative example to better understand material's structure and properties in general. \section{METHOD} Structure searches were performed utilizing the \textit{ab initio} evolutionary algorithm USPEX \cite{R27,R28} for NaB$_{3}$ with up to six formula units (f.u.) per supercell under various pressures. The structure relaxations and electronic properties were carried out using density functional theory (DFT) within the Perdew-Burke-Ernzerhof (PBE) parametrization of the generalized gradient approximation (GGA) exchange-correlation functional \cite{R29}, as implemented in the VASP code \cite{R30} with 2$s^{2}$2$p^{6}$3$s^{1}$ and 2$s^{2}$2$p^{1}$ treated as valence electrons for Na and B atoms, respectively. A plane-wave basis set with an energy cutoff of 850 eV and uniform $\Gamma$-centered $k$-point grids with a resolution of $2 \pi \times 0.02$~\AA$^{-1}$ were used in the electronic self-consistent calculations. The structures were fully optimized until the maximum energy and force were less than 10$^{-8}$ eV and 0.001 eV/{\AA}, respectively. Electronic properties were also calculated by using the Heyd-Scuseria-Ernzerhof (HSE06) functional \cite{R31}. \textit{Ab initio} molecular dynamics (AIMD) simulations \cite{R32} were carried out using $2 \times 2 \times 3$ supercell for the $P$4/$mbm$ and $Pbam$ phases, and $2 \times 2 \times 2$ supercell for the $I$-$4m2$ phase. A Nos\'e-Hoover thermostat was adopted to perform the $NVT$ simulations with the temperature range of 500-4500 K lasting for 10 ps with a time step of 1 fs. The statistical information of each atomic trajectory was extracted from the last 5 ps, and some trajectories were extended to 40 ps to confirm the stability of the simulations. Phonon dispersion curve of $P$4/$mbm$ NaB$_{3}$ was performed using the finite displacement method ($2 \times 2 \times 2$ supercell) with the \textsc{phonopy} code \cite{R33}. In addition, the energy barrier was calculated by the climbing-image nudged elastic band (CI-NEB) method \cite{R34}. \begin{figure}[t] \begin{center} \includegraphics[width=8.0cm]{./Figure1.pdf} \caption{% (a) The enthalpy difference of NaB$_{3}$ compounds as a function of pressure with respect to $P$4/$mbm$ phase. The insert shows the pressure-volume relations. (b) The variation of the angle $\omega$ as function of pressure. The inset shows the angle $\omega$ between the orientation of the centered B$_{6}$ octahedral and [100] direction. (c-e) Schematic views of structural evolutions of NaB$_{3}$ system during compression. The rotation direction of B$_{6}$ octahedral is labeled by magenta arrows as increasing pressure. Purple and green balls represent the Na and B atoms, respectively.} \end{center} \end{figure} \begin{figure}[t] \begin{center} \includegraphics[width=8.0cm]{./Figure2.pdf} \caption{% (a) The lattice parameters for the predicted stable phases as a function of pressure. (b) The compressibility of the principal axes for $Pbam$ phase as a function of pressure. (c) The structural projection of $Pbam$ phase along the [001] direction, where the letters $A$, $O$ and $B$ are the centers of B$_{6}$ octahedra. The pressure-independent coordinates for $A$, $O$ and $B$ are (1, 0, 1/2), (1/2, 1/2, 1/2) and (1, 1, 1/2), respectively. (d) Evolution of compressibility for the $O$-$A$ or $O$-$B$ distance $r$, $\sin$($\theta$/2) and $\cos$($\theta$/2) within the pressure range of 15.8-26.3 GPa.} \end{center} \end{figure} \section{RESULTS AND DISCUSSION} The phase diagram and physical properties of NaB$_{3}$ are systematically investigated. Since the enthalpy of formation of $P$4/$mbm$-NaB$_{3}$ is negative (Fig. S1) referring to the enthalpies of $bcc$-Na and $\alpha$-boron structure or any isochemical mixture of Na-B compounds \cite{R35}, first-principles calculations reveal that $P$4/$mbm$-NaB$_{3}$ system is stable above $\sim$0.4 GPa and may be quenchable to ambient pressure because there are no imaginary phonon frequencies in the whole Brillouin zone (Fig.S2) \cite{R35}. The enthalpy-pressure curves show that NaB$_{3}$ undergoes a reversible phase transition from a tetragonal $P$4/$mbm$ phase to an orthorhombic $Pbam$ phase at $\sim$16 GPa. Note that the $Pbam$ symmetry is the subgroup of $P$4/$mbm$ symmetry with the index of two, and the fourfold rotation symmetry is broken (mainly attributed to the rotation of B$_{6}$ octahedron) as pressure is increased. Moreover, no chemical bonds break during the phase transition, leading to the gradual variation of volume and the reversible phase transition. Then $P$4/$mbm$-NaB$_{3}$ undergoes an irreversible phase transition to another tetragonal $I$-$4m2$ phase at $\sim$26 GPa [Fig. 1(a)]. The phase transition from the $P$4/$mbm$ to $Pbam$ structure is accompanied by the negligible volume change, indicative of the second-order phase transition, while 7.87$\%$ volume collapse for the phase transition from $Pbam$ to $I$-$4m2$ structure, the characteristic of first-order phase transition [the inset of Fig. 1(a)]. These results are different from the reported phase transition from $P$4/$mbm$ to $Cmmm$ structure \cite{R36,R37}, and the $Cmmm$ structure is higher in enthalpy than the newly proposed phases at the studied pressure range. \begin{figure*}[t] \begin{center} \includegraphics[width=13cm]{./Figure3.pdf} \caption{% (a-c) The MSDs from AIMD simulations for the Na and B atoms in $P$4/$mbm$ phase at ambient pressure and different temperatures. (d-f) The projection of atomic trajectories along the [001] direction in $P$4/$mbm$ phase from the last 5 ps run representing the solid phase (500 K), the swap phase (1500 K), and the superionic phase (3000 K). (g-i) The probability of the presence of Na atoms at 500, 1500 and 3000 K.} \end{center} \end{figure*} The crystal structures of the $P$4/$mbm$ and $Pbam$ phases are plotted in Figs. 1(c) and 1(d) for contrast. They are composed of interstitial Na atoms and different boron frameworks, that is, B$_{6}$-octahedral network for $P$4/$mbm$ and $Pbam$ phases whereas the dominant B$_{8}$-dodecahedral network for $I$-$4m2$ phase [Fig. 1(e)]. The angle ($\omega$) between the orientation of the centered B$_{6}$ octahedra (marked by the magenta dotted line) and the [100] direction is represented to explore the mechanism for the reversible phase transition [the inset of Fig. 1(b)]. As shown in Fig. 1(b), the angle $\omega$ in $P$4/$mbm$ phase is linearly increased as a function of pressure owing to the counterclockwise rotation of the centered B$_{6}$ octahedron. In contrast, it abruptly decreases in parabolic-shape from 15.8 GPa to 26.3 GPa because of the opposite rotation behavior of the B$_{6}$ octahedron in $Pbam$ phase. As further increasing pressure above 26 GPa, the B$_{6}$ octahedra are destroyed and transform into distorted B$_{8}$ dodecahedra and interstitial B atoms, resulting in the formation of $I$-$4m2$ phase. The lattice parameters of NaB$_{3}$ under selected pressures are listed in Table SI \cite{R35}. Moreover, band structure calculations show that all predicted NaB$_{3}$ compounds are semiconductors. In contrast, the DFT band gap of $Pbam$ phase is increased as a function of pressure and different from other phases (Fig. S3) \cite{R35}, which is partially originated from the NLC effect. Unexpectedly, the phase transition from the $P$4/$mbm$ to $Pbam$ phase is quite different from those second-order phase transitions \cite{R38,R39,R40,R41}, because it is accompanied by the emergence of anomalous lattice expansion along the crystallographic $a$-axis (belong to the proper ferroelastic transitions \cite{R05}) whereas normal lattice contractions along the $b$- and $c$-axes within pressure range of $\sim$16-26 GPa [Fig. 2(a)]. The compressibility of a materials is generally defined as the relative change rate of dimensions with respect to pressure at constant temperature, $K_{i}$ = -(1/$i$)($\partial$$i$/$\partial$$p$)$_{T}$, where $i$ can be assigned as $V$, $A$, and $l$ for volume, area and linear compressibility, respectively \cite{R02}. The compressibility coefficients of the principal axes (equivalent to crystallographic axes in orthorhombic phase) for $Pbam$ phase, computed by the PASCal program in the pressure range from 15.8 to 26.3 GPa \cite{R42}, are $K_{a}$ = -6.65 TPa$^{-1}$, $K_{b}$ = 12.10 TPa$^{-1}$ and $K_{c}$ = 1.94 TPa$^{-1}$, respectively. The variation of the compressibility of the principal axes as a function of pressure is plotted in Fig. 2(b), which shows NLC along the $a$-axis while positive line compressibility (PLC) along the $b$-, $c$-axis. The mechanism of NLC can be rationalized by its special geometrical configuration. In the unit cell of $Pbam$ phase, the distance $r$ and angle $\theta$ with respect to three nearest centers of neighboring B$_{6}$ octahedra are illustrated in Fig. 2(c). The lattice constants, $a$ and $b$, have the relationship with the parameters of $r$ and $\theta$ as follows: a = 2$r\cos(\theta$/2), b = 2$r\sin(\theta$/2); $K_{a}$ = -(1/$a$)($\partial$$a$/$\partial$$p$) = $K_{r}$ + $K_{\cos(\theta/2)}$, $K_{b}$ = -(1/$b$)($\partial$$b$/$\partial$$p$) = $K_{r}$ + $K_{\sin(\theta/2)}$. It is evident that the values of $r$ and $\theta$ ($\theta$ $\textless$ 90$\degree$) decrease as pressure increases from 15.8 to 26.3 GPa (Fig. S4) \cite{R35}, resulting in a positive $K_{r}$, a positive $K_{\sin(\theta/2)}$ and a negative $K_{\cos(\theta/2)}$. The pressure-dependent variations of $K_{r}$, $K_{\sin(\theta/2)}$ and $K_{\cos(\theta/2)}$ are depicted in Fig. 2(d). Because $K_{r}$ is much smaller than $K_{\sin(\theta/2)}$ and $K_{\cos(\theta/2)}$, the compressibility of the $a$-axis ($b$-axis) is dominantly determined by the corresponding $K_{\cos(\theta/2)}$ ($K_{\sin(\theta/2)}$) in $Pbam$ phase. Compared with the compression behavior of $P$4/$mbm$ phase, the pressure-induced opposite rotation of B$_{6}$ octahedra in $Pbam$ phase significantly enhances the change rate of $\theta$ above 16 GPa, which guarantees a small $K_{r}$ and a large $K_{\theta}$ value, resulting in NLC accordingly. \begin{figure}[t] \begin{center} \includegraphics[width=7.0cm]{./Figure4.pdf} \caption{% (a,b) Potential Na diffusion paths, where local exchanges for the Na pairs (path I) and inter-paired Na atoms (path II). The color balls represent the exchanged Na atoms. (c) Calculated energy barriers of $P$4/$mbm$ phase with different Na diffusion paths. The insets show the structural illustrations of the saddle point at path I and path II.} \end{center} \end{figure} \begin{figure}[t] \begin{center} \includegraphics[width=7.0cm]{./Figure5.pdf} \caption{% The phase diagram of NaB$_{3}$ system. The symbols of blue triangles, green squares, yellow circles and jacinth diamonds represent solid, swap, superionic and fluid states, respectively. The data points marked by color symbols in red, cyan and yellow shaded areas relate to $P$4/$mbm$, $Pbam$ and $I$-$4m2$ phases, respectively.} \end{center} \end{figure} To further examine the thermodynamic stability of $P$4/$mbm$ phase, we performed AIMD simulations at ambient pressure and the temperature range of 500-4500 K by analyzing the combination of mean square displacements (MSDs) and atomic trajectories. At 500 K, the oscillations of Na and B atoms with respect to their equilibrium positions without any migrations indicate that the structure is stable, hence the $P$4/$mbm$ structure maintains the solid phase [Figs. 3(a) and 3(d)]. At 1500 K, the MSDs of Na atoms demonstrate step-like increase in several picoseconds, indicating a special displacement during this stage [Fig. 3(b)]. Upon a more detailed study of the atomic trajectories, the local exchange among Na atoms is observed and designated as an intermediate state, as shown in Fig. 3(e) and Supplemental Material \cite{R35}. The Na pairs composed of the nearest neighboring Na atoms rotate $\sim$90$\degree$ nearly parallel to the (110) or ($\bar{1}$10) plane, and then rotate to the initial positions or exchanged positions. This isolated rotation behavior is similar to that of molecular crystals, such as low-temperature phase of H$_{2}$ in hexagonal-close-packed (hcp) form \cite{R43}. However, unlike H$_{2}$ molecules, there is a strong electrostatic repulsion between Na cations instead of covalent bonds. Therefore, the intermediate state of NaB$_{3}$ may be termed as a `swap' phase, which will be further discussed in the later section. At 3000 K, the Na atoms vibrate strongly and migrate freely within a fixed open-framework boron structure, resulting in a persistently ascendant MSDs with a diffusion constant of approximately 0.69 $\times$ 10$^{-8}$ m$^{2}$s$^{-1}$. All these indicate $P$4/$mbm$ phase turns into a superionic conductor [Figs. 3(c) and 3(f)]. When the temperature is increased beyond 3500 K, $P$4/$mbm$ phase melts. Figures 3(g)-3(i) show the probability density maps of Na atoms \cite{R44}, indicating the diffusive feature of Na atoms in $P$4/$mbm$ phase. The coordinates were first built, with the center \textbf{r}$_{c}$ = ($\bm{\mu}_{i}$(0) + $\bm{\mu}_{j}$(0))/2 = $\bm{\mu}_{i}(t)$ - $\bm{\mu}^{'}_{i}(t)$ defined as the mid-point of the Na-Na vector, where $i$, $j$ represents the atomic number of the nearest neighboring Na atoms, and \bm{$\mu$}$_{i}(t)$ represents the position vector of the $i$ th atoms at the moment of $t$. We defined $\hat{\bm{\eta}}$ as the nearest Na-Na vector and the coordinate $\eta$ = $\bm{\mu}^{'}_{i}(t)\cdot\hat{\bm{\eta}}$ of a given atom $i$. Coordinate $\rho$ is defined as $\rho$ =$\sqrt{\verb||||\bm{\mu}^{'}_{i}(t)\verb||||^{2} - \eta^{2}}$ = $\verb||||\bm{\mu}^{'}_{i}(t)$ - $\eta\hat{\bm{\eta}}\verb||||$. At 500 K, the $P$4/$mbm$ phase retains the solid state [Fig. 3(g)]. When temperature further increases to 1500 K, the diffusive trajectories of Na atoms involving the rotation behavior of Na pairs can be characterized by a diamond shape with two diagonal lines of $\sim$2.43 {\AA} (the distance of the Na pairs in the initial position) and $\sim$2.39 {\AA} (the distance of Na pairs rotating $\sim$90$\degree$ relative to its initial positions) [Fig. 3(h)]. All Na pairs have similar distance of approximately 2.14$\sim$2.43 {\AA} with fixed mass centers, implying a swap state. To reveal the likely mechanism of this particular state, the potential migration pathway of Na atoms is studied by the CI-NEB method, where the initial and final states are identical but with different diffusion paths [Figs. 4(a) and 4(b)]. The results show the energy barrier of the swap state (0.39 eV/atom) is lower than that of inter-paired Na atoms (0.99 eV/atom) [Fig. 4(c)], indicating that the asymmetric energy barrier may be dominantly responsible for the origin of the swap state. When temperature reaches 3000 K, Na atoms diffuse freely within the fixed boron frameworks, entering a superionic state [Fig. 3(i)]. According to the multiple transition states discussed above, we expanded the pressure range up to 60 GPa to explore the phase diagram of NaB$_{3}$. The systematical AIMD simulations at HPHT show that the $Pbam$ phase also exhibits a solid - swap - superionic - fluid phase transition similar to the $P$4/$mbm$ phase (Fig. S5) \cite{R35}, while the $I$-$4m2$ phase transforms directly from solid to fluid above 4000 K [Fig. S6 and Fig. 5] \cite{R35}. \section{CONCLUSION} In summary, the phase diagram and compression behavior of NaB$_{3}$ have been systematically studied from first principles. Under high pressure, a solid-solid phase transition originated from the symmetry-breaking of boron framework results in a striking NLC effect. At high temperature, a phase transition sequence of solid - swap - superionic - fluid state is identified by the AIMD simulations. Interestingly, different from the normal solid-superionic phase transition, the particular swap state attributed to the local diffusion of Na pairs may give a deeper insight into the understanding of ion transportation. \section*{ACKNOWLEDGMENTS} This work was supported by the National Science Foundation of China (Grants 11874224, 52025026, 52090020, 51772263, and 21803033), the Tianjin Science Foundation for Distinguished Young Scholars (Grant No. 17JCJQJC44400) and Young Elite Scientists Sponsorship Program by Tianjin (No. TJSQNTJ-2018-18). X. D. and X.-F. Z. thank the computing resources of Tianhe II and the support of Chinese National Supercomputer Center in Guangzhou.
\section{Introduction} \label{intro} The Soil Water Retention Curve (SWRC) correlates the degree of saturation or water content of unsaturated soil to its matric suction or capillary pressure. Idealized functional forms of SWRC~\cite{Brooks1964a,VanGenuchten1980a} are often used to estimate mechanical properties of unsaturated soil such as effective stress and shear strength~\cite{Khalili1998a,Lu2006a} as well as hydraulic properties such as relative permeability~\cite{Mualem1976,FREDLUND1994a}. As the soil undergoes volumetric deformation during shearing, its water retention behavior changes with the change of porosity. Many researchers have proposed models that consider the effect of porosity (or void ratio) on SWRC~\cite{Aubertin1998a,Gallipoli2003a,Tarantino2009a,Masin2009a,Zhou2012a}. In this study, we investigate the effect of porosity on the suction characteristics of unsaturated soil from a micromechanics perspective~\cite{Richefeu2016a}, by simulating the multiphase system using the Shan-Chen Lattice Boltzmann Method (LBM). \section{Numerical method} An in-house 3D multiphase LBM code is developed for modelling the multiphase fluid domain of unsaturated granular material. The D3Q19 scheme~\cite{Qian1992} for velocity discretization and the BGK collision operator are used. The interaction between the three phases, i.e. liquid, gas and solids, is considered by introducing Shan-Chen (SC)-type interaction forces into the model \cite{Shan1993a,Shan1994}. The SC interaction forces per unit volume are calculated using \begin{equation}\label{eq_1} \boldsymbol{F}_{SC}(\boldsymbol{x})=-\psi(\boldsymbol{x})G\sum_iw_i\psi(\boldsymbol{x}+\boldsymbol{c_i}\Delta t)\boldsymbol{c_i}\Delta t, \end{equation} where $\psi$ is an effective density, $G$ is a parameter that controls the strength of the interaction (negative for attraction), $\{\boldsymbol{c_i}\}$ is the discrete velocity set with $\{w_i\}$ as the corresponding weights, and $\Delta t$ is the time step which is set to 1 dimensionless lattice unit (lu). $\psi$ is defined as \begin{equation}\label{eq_2} \psi(\rho)=\sqrt{\frac{2}{c_s^2\Delta t^2G}(p(\rho)-\rho c_s^2)} , \end{equation} where $c_s$ is lattice sound speed equal to $\frac{1}{\sqrt{3}} \frac{\Delta x}{\Delta t}$ for the D3Q19 model~\cite{Qian1992,He1997} with both $\Delta x$ and $\Delta t$ set to 1 lu, $\rho$ is density at point $\textit{\textbf{x}}$, and $p$ is pressure. ~\Cref{eq_2} is a rearrangement of the Equation of State (EOS) of the SC-type multiphase system, which allows incorporating different EOS by simply redefining $p$~\cite{Yuan2006a}. The Carnahan-Starling (C-S) EOS is used to increase the numerical stability for systems with large liquid-gas density ratios: \begin{equation}\label{eq_3} p=\rho RT\frac{1+b\rho/4+(b\rho/4)^2-(b\rho/4)^3}{(1-b\rho/4)^3}-a\rho^2, \end{equation} with $a = 0.4963R^2T_c^2/p_c$ and $b = 0.18727RT_c/p_c$~\cite{Yuan2006a}. $T_c$ is the temperature below which phase separation occurs and $p_c$ is the pressure at which the first and second derivatives of the EOS at $T_c$ are zero. The C-S EOS curves for different temperatures are shown in~\Cref{coex_curve}. The developed code is validated by comparing the coexistence densities, the densities at which the liquid and gas phases coexist in a multiphase system, from the numerical simulations against the theoretical solution, at the different $T/T_c$ values shown in~\Cref{coex_curve}. The density at each node is initialized to a value between the liquid and gas densities, with a small random perturbation to allow phase separation, and the system is allowed to equilibrate. Once a liquid droplet is formed, the average liquid and gas densities are measured, and the corresponding pressures are calculated using~\Cref{eq_3}. For this study $a = 1$ lu, $b = 4$ lu and $R = 1$ lu are used~\cite{Yuan2006a}.~\Cref{coex_curve} shows a good match between the numerical and the theoretical solutions. \begin{figure}[htbp] \centering \includegraphics[width=0.9\columnwidth,clip]{figs/coex_curve.eps} \caption{Comparison of the numerical (multiphase LBM simulation) and theoretical coexistence curves for the C-S EOS at different $T/T_c$.} \label{coex_curve} \end{figure} \section{Model description and simulation} In this study, we use four different grain configurations with initial porosities ($\eta=V_{void}/V_{total}$) of 0.50, 0.40, 0.30, 0.15 (corresponding to void ratios of 1.00, 0.67, 0.43, 0.18) to investigate the effect of porosity on the SWRC. These configurations are created by randomly positioning grains inside a fixed-size domain until the required porosity is achieved. As the objective of this study is to develop SWRCs at constant porosities, the grain positions are fixed and grain-grain interactions are not considered. The granular assembly comprises of grain diameters between 10 lu and 30 lu, with a uniform distribution. The lattice spacing, $\Delta x$, is set to 1 lu, which corresponds to a minimum of 10 grid points per grain diameter. The LBM domain is set to $200\times200\times200$ lu$^3$, with periodic boundaries in every direction to eliminate boundary effects. In all simulations, the relaxation parameter, $\tau$, for the BGK collision operator is set to 1 lu. The parameters for the C-S EOS are chosen as $a = 1$ lu, $b = 4$ lu and $R = 1$ lu \cite{Yuan2006a}, corresponding to $T_c = 0.0943$ lu, $p_c = 0.0044$ lu, and $\rho_c = 0.13044$ lu. $T/T_c$ of 0.7 is selected for these simulations. $G$ is set to -1 (by using~\Cref{eq_2} for $\psi$, the parameter $G$ cancels out when this equation is substituted in~\Cref{eq_1}, therefore, the magnitude of $G$ is irrelevant and only its sign is of importance). The density of solids, $\rho_s$, in a multiphase simulation only controls the contact angle between the solids and the liquid and does not correspond to the physical density of the solids; $\rho_s$ closer to the liquid density, $\rho_l$, results in a more hydrophilic surface, whereas $\rho_s$ closer to the gas density, $\rho_g$, creates a more hydrophobic surface \cite{Kruger2017}. In these simulations, $\rho_s$ is set to 0.98$\rho_l$, corresponding to a contact angle of 14$^{\circ}$. The dimensionless lattice units, lu, used for all the parameters in this study can be converted to physical units by choosing appropriate conversion factors. It can be shown that the fluid kinematic viscosity in an LBM simulation is $\nu=c_s^2(\tau-0.5)$ in lu~\cite{Qian1992}; the conversion factors for length, $C_l$, and time, $C_t$, should be chosen such that $c_s^2(\tau-0.5)C_l^2/C_t$ corresponds to the correct physical kinematic viscosity. In addition to this criteria, accuracy and stability should be taken into account when choosing these conversion factors. For this qualitative study, all values are simply reported in lu. In all four configurations of the granular assembly, the density of the fluid domain is initialized to a value between the liquid and gas coexistence densities (0.358 lu and 0.009 lu, respectively), with a random perturbation of $\pm0.1$, to allow phase separation. After an adequate number of steps, when the fluid has phase separated and reached equilibrium, liquid is injected into the system by increasing the density of all fluid nodes by $0.005$ lu every 1000 steps. It is ensured that 1000 steps is enough for the system to reach equilibrium before the next injection. The SWRC is generated by calculating the average suction, $\delta p$, and degrees of saturation, $\mathit{S_r}$, at the end of each injection stage. $\delta p$ is defined as the difference between the average gas pressure and the average liquid pressure in the entire fluid domain. $\mathit{S_r}$ is measured by dividing the total number of liquid nodes by the total number of fluid nodes (voids). In addition, the number of liquid clusters at each injection stage is computed using the Depth-First Search algorithm~\cite{tarjan1972depth}. \section{Results and discussion} \Cref{3d} shows a 3D view of the grain configuration with $\eta$ = 0.40 and the liquid clusters formed at $\mathit{S_r}$ = 0.4.~\Cref{states} shows snapshots of 2D slices of the unsaturated granular media, indicating that multiphase LBM is able to capture the different states of liquid clustering: pendular (\ref{states}a), funicular (\ref{states}b), capillary (\ref{states}c), and droplet states~\cite{mitarai2006wet}. In the pendular state, pairs of grains are connected by binary liquid bridges (e.g. dashed-circle zones). In the funicular state, a combination of binary liquid bridges (e.g. dashed-circle zone) and liquid clusters connecting multiple grains (e.g. dashed-triangle zone) is present. In the capillary state, the liquid almost fills the entire pore space between grains, however, its surface forms concave menisci (e.g. dashed-square zones) exerting a net cohesive force on the grains. In the droplet state, the liquid immerses the entire domain and exerts no capillary forces on the grains. \begin{figure}[htb] \centering \includegraphics[width=0.7\columnwidth]{figs/3d.eps} \caption{3D view of the multiphase domain with $\eta$ = 0.40 at $\mathit{S_r}$ = 0.4.} \label{3d} \end{figure} \begin{figure} \centering \includegraphics[width=0.7\columnwidth]{figs/bubbles5.eps} \caption{Snapshots of 2D slices of the multiphase domain with $\eta$ = 0.40 at (a) $\mathit{S_r}$ = 0.1, (b) $\mathit{S_r}$ = 0.4 and (c) $\mathit{S_r}$ = 0.7. The dashed-circle zones show examples of binary liquid bridges, the dashed-triangle zone shows an example of a liquid cluster connecting multiple grains, and the dashed-square zones show examples of concave menisci in the capillary state.} \label{states} \end{figure} The pore-scale evolution of clusters with increase in saturation is investigate by examining the evolution of number of liquid clusters.~\Cref{cluster} shows the number of liquid clusters normalized by the number of disconnected pores in the soil structure ($N_{cluster}/N_{pores}$) as a function of $\mathit{S_r}$, for different porosities. The circles indicate points at which snapshots of the simulation are provided in~\Cref{states}. As $\mathit{S_r}$ increases from zero, $N_{cluster}/N_{pores}$ initially increases rapidly up to a peak value, due to the formation of a large number of small liquid droplets on the surface of the grains. With further increase in saturation, these small droplets aggregate together to form liquid films around the grains and subsequently coalesce to binary bridges between grains, thereby decreasing the number of individual clusters at a steep rate. The number of distinct clusters gradually decreases as the system moves from the pendular state to the funicular state, and finally, to the capillary state. Eventually, all the pores are filled with liquid, and the cluster count becomes equal to the number of disconnected pore spaces. As the porosity decreases, the peak of the curves in~\Cref{cluster} shift to the right, indicating that a higher $\mathit{S_r}$ is required for the initial clusters to connect and form liquid films on the grain surfaces. This is expected as lower porosity corresponds to a larger number of tiny pore spaces and a higher surface area of the granular assembly. In addition, in the case of the lowest porosity, the number of distinct clusters decreases more gradually throughout the transition from the pendular state to the capillary state, compared to the other porosity cases. \begin{figure}[tb] \centering \includegraphics[width=0.9\columnwidth]{figs/cluster.eps} \caption{Evolution of normalized number of clusters as a function of degree of saturation, for different porosities. The circles indicate points at which snapshots of the simulation are provided in~\Cref{states}.} \label{cluster} \end{figure} The SWRCs simulated for different porosities are shown in~\Cref{wrc}. The simulated SWRCs are compared against fitted curves based on the simplified van Genuchten model \cite{VanGenuchten1980a, Gallipoli2003a} \begin{equation}\label{vG} \mathit{S_r}=(\frac{1}{1+(\alpha\delta p)^n})^m, \end{equation} where $\alpha$, $n$ and $m$ are fitting parameters. The fitting parameters for the curves in this study are reported in~\Cref{tab-1}. Parameter $\alpha$ controls the shift of the curve to left and right and is inversely proportional to the air-expulsion/air-entry value (AEV). It can be deduced from the shift of the simulated curves in~\Cref{wrc} or the value of $\alpha$ in~\Cref{tab-1}, that the AEV for the simulated SWRCs increases with decreasing porosity. The inverse relation between the AEV and porosity is consistent with all proposed models for the SWRC which take void ratio into account \cite{Aubertin1998a,Gallipoli2003a,Tarantino2009a,Masin2009a,Zhou2012a}. Parameter $n$ controls the slope of the curve and is related to the pore size distribution, with higher $n$ corresponding to a more uniform distribution~\cite{Matlan2014a}. Comparing the $n$ parameter for the different curves shows that the curves with the highest and lowest porosities have steeper slopes at the middle section of the SWRC, compared to the curves with intermediate porosities. This could be explained by assuming that the lowest and highest porosity models have uniform small and large pores, respectively, while the intermediate porosity models have a combination of small and large pores; however, the verification of this assumption is left for future studies. Parameter $m$ controls the symmetry of the curve when $\delta p$ is plotted in log space. As seen in~\Cref{wrc}, the maximum suction of the simulated curves is constrained, creating an unsymmetrical shape for the SWRC at lower porosities. Therefore, $m$ is higher for lower porosities. \begin{figure}[t] \centering \includegraphics[width=0.9\columnwidth]{figs/wrc.eps} \caption{SWRCs from the LBM simulations for different porosities. The dashed lines represent the fitted curves based on the van Genuchten model.} \label{wrc} \end{figure} \begin{table}[htbp] \centering \caption{van Genuchten fitting parameters.} \label{tab-1} \begin{tabular}{llll} \hline $\eta$ & $\alpha$ & $n$ & $m$ \\\hline 0.15 & 67 & 6 & 4.50\\ 0.30 & 79 & 4 & 3.47\\ 0.40 & 119 & 4 & 1.66\\ 0.50 & 228 & 5 & 0.75\\\hline \end{tabular} \end{table} The SWRC for the simulation with the highest porosity ($\eta$ = 0.50) has the expected ``S'' shape and the fitted van Genuchten (vG) curve matches the trend of the data. For the two simulations with intermediate porosities, the fitted vG curves match the simulated curves perfectly in the $\mathit{S_r}$ range of 0.1 to about 0.8. However, at higher saturation ($\mathit{S_r}$ > 0.8), the vG curves smoothly transition to zero suction while the simulated curves continue with the same slope up to $\mathit{S_r}$ = 0.96, where the suction abruptly drops to zero. Furthermore, as the saturation decreases below 0.1 for these intermediary porosity cases, LBM simulations only indicate a very small increase in suction, which contrasts the dramatic increase predicted by vG curves. For the lowest porosity case ($\eta$ = 0.15), the smooth transition to zero suction at high $\mathit{S_r}$ occurs as expected, however, at $\mathit{S_r}$ below 0.2, the suction remains unchanged. Interestingly, all simulated curves converge to the same value of maximum suction, indicating that the maximum suction in these multiphase LBM simulations may be constrained by the modeling parameters. Further research is required to understand the cause of this behavior. \section{Conclusion} The effect of porosity on the Soil Water Retention Curve (SWRC) was studied by simulating unsaturated soil using the 3D multiphase Shan-Chen-type Lattice Boltzmann Method. Four different grain configurations with porosities ranging from 0.15 to 0.50 were used. The four different states of liquid clustering, namely pendular, funicular, capillary, and droplet states, were observed in the multiphase simulation for the different porosity cases. The simulations were able to correctly capture the increase of the air-entry value with decreasing porosity and the shift of the SWRC towards higher suction. However, the results indicated that the maximum suction is constrained at low degrees of saturation and further research is needed to explain this behavior.
\section{Introduction} Fluctuations of conserved charges represent one of the central observables for probing the phase structure of QCD. The corresponding measurements are in the focus of the experimental search for the QCD critical point at RHIC beam energy scan~\cite{Bzdak:2019pkr,Adam:2020unf}, being expected to exhibit strong critical behavior in its vicinity~\cite{Stephanov:1998dy,Stephanov:1999zu}. Fluctuations of conserved charges are also studied in heavy ion experiments at the highest RHIC and LHC energies with the goal to identify experimentally the remnants of the chiral criticality at vanishing chemical potentials~\cite{Friman:2011pf,Citron:2018lsq}. Theoretical calculations of fluctuations are typically performed in the grand-canonical ensemble (GCE), where cumulants of the conserved charge distribution correspond to the susceptibilities -- the derivatives of the grand potential with respect to the chemical potentials. At zero chemical potentials the QCD susceptibilities are accessible from first principles via lattice QCD simulations~\cite{Bazavov:2017dus,Borsanyi:2018grb}, whereas at finite densities they can be treated with various effective QCD approaches~\cite{Isserstedt:2019pgx,Fu:2019hdw}. An important question is how to relate the theoretical calculations with experimental measurements. In the GCE the system can exchange charges with a reservoir, thus the charges are conserved only on average. In heavy-ion experiments, on the other hand, the charges are globally conserved. It is thus essential to establish how these susceptibilities are related to experimental measurements~\cite{Bleicher:2000ek,Schuster:2009jv,Bzdak:2012an,Braun-Munzinger:2016yjz,Pruneau:2019baa}. A subensemble acceptance method~(SAM) has been developed recently~\cite{Vovchenko:2020tsr,Vovchenko:2020gne}, which allows to correct the grand-canonical cumulants to account for global conservation of (multiple) conserved charges, and for any equation of state, such as that of QCD. Another important issue is the difference between coordinate space, where the vast majority of theories operate, and the momentum space, where experimental measurements are performed. Experimental cuts in the momentum space may correspond to cuts in the coordinate space if there is a strong correlation between the momenta and coordinates of the particles. This is situation for instance in case of longitudinal Bjorken flow, approximately realized at the highest collision energies, where one can associate the kinematic rapidity $Y$ of a particle with its space-time rapidity $\eta_s$ at freeze-out. Even in this case, however, a smearing of order $\Delta Y_{\rm th} \sim 1$~\cite{Ling:2015yau} due to random thermal motion is present. Additional smearing is generated by the decays of resonances after the freeze-out. It is thus crucial to control these effects well for any reliable physics interpretation of experimental measurements. Recently, a generalized Cooper-Frye particlization routine has been proposed~\cite{Vovchenko:2020kwg}, which allows one to incorporate the aforementioned effects. The routine, called \emph{subensemble sampler}, samples the equation of state of an interacting hadron resonance gas that can, for instance, be matched to reproduce the lattice QCD susceptibilities at freeze-out. Here we discuss the main ideas behind this sampler, the first results obtained for event-by-event fluctuations at the LHC, and the necessary steps for future applications to the measurements in RHIC beam energy scan programme. \section{Subensemble sampler} Consider the particlization stage of heavy-ion collisions at the end of hydrodynamic evolution. This stage is characterized by a hypersurface $\sigma(x)$, where $x$ is the space-time coordinate. The QCD fluid is transformed into an expanding gas of hadrons and resonances. The momentum distributions of the all the hadron species at particlization are determined by the famous Cooper-Frye formula, which for hadron species $i$ reads \eq{\label{eq:CF} \omega_p \frac{d N_i}{d^3 p} = \int_{\sigma(x)} d \sigma_\mu (x) \, p^\mu \, f_i[u^\mu(x) p_\mu;T(x),\mu_i(x)]. } Here $T(x)$, $\mu_i(x)$, $u^\mu(x)$, and $d \sigma_\mu(x)$ correspond to the space-time distributions of the temperature, chemical potential, flow velocity, and the hypersurface normal elements, respectively. $f_j$ is the distribution function in the local rest frame. We take it in the following form \eq{ f_i[u^\mu p_\mu;T(x),\mu_i(x)] = \frac{d_i \, \lambda_i(x)}{(2\pi)^3} \, \exp\left[ \frac{\mu_i(x) - u^\mu(x) p_\mu}{T(x)} \right]. } Here we neglected the viscous corrections. The factor $\lambda_i(x)$~($=1$ in the ideal gas limit) incorporates possible deviations of the hadronic equation of state from the ideal gas limit. The presence of this factor is one new element of our procedure relative to the standard routine. In general $\lambda_i$ can be a function of both the space-time coordinate $x$ and the momentum $p$. Presently we restrict our considerations to the case where $\lambda_i$ depends on $x$ only. The Cooper-Frye formula~\eqref{eq:CF} defines the momentum distributions of all the hadrons emerging from the hydrodynamic evolution. This equation, however, carries no information regarding the fluctuations in the event-by-event distribution of the various hadron numbers. Usually, the yields are sampled in each fluid element from a Poisson distribution. Because the Poisson distribution is additive, this means that the yields of all hadron species in the full space follow the Poisson distribution as well. Most hydro simulations use this type of sampling~\cite{Kisiel:2005hn,Shen:2014vra,Karpenko:2015xea,Bernhard:2018hnz}. Such a multiplicity distribution, however, is valid only for an ideal Maxwell-Boltzmann hadron resonance gas~(HRG) in the grand-canonical ensemble. The key new feature of our subensemble sampler is the ability to simultaneously incorporate in the sampling procedure (i) exact global conservation of charges and (ii) interactions between hadrons. Let us consider for simplicity the case of a single conserved charge $B$. For the more general case of multiple conserved charges see~\cite{Vovchenko:2020kwg}. In the subensemble sampler we partition the particlization hypersurface $\sigma$ into contiguous subvolumes. Let the index $j$ enumerate the subvolumes. The subvolume $V_j$ then reads $V_j = \int_{x \in \sigma_j} d \sigma_\mu (x) \, u^\mu(x)$. We further assume that each subvolume is (i) characterized by constant values of the thermal parameters $T$ and $\mu_B$ and (ii) is sufficiently large compared to the correlation length $\xi$, i.e. $V_j \gg \xi^3$. The latter assumption implies that interactions between particles from different subvolumes can be neglected. The total partition function can then be written as \eq{\label{eq:Zce} Z_{\rm tot}^{\rm ce} & ~ \sim ~ \prod_j \, \sum_{B_j} \, e^{\mu_{B,j} B_j} \, Z^{\rm iHRG} (T_j,V_j,B_j)\, \times \delta \left(B_{\rm tot} - \sum_k B_k \right)~. } Here $Z^{\rm iHRG} (T_j,V_j,B_j)$ is the canonical partition function of an interacting HRG~(iHRG). Equation~\eqref{eq:Zce} represents a sum over all possible values $B_j$ of the baryon number in each of the subvolumes. The Kronecker delta ensures that the total baryon number is globally conserved. One can rewrite Eq.~\eqref{eq:Zce} in terms of the sum over all possible hadron numbers in each of the subvolumes: \eq{ \label{eq:PNjoint} P \left(\left\{ \hat{N}_{j} \right\} \right) & = \prod_j \, P^{\rm iHRG}(\hat{N}_{j}; T_j,V_j,\boldsymbol \mu_j) \times \delta \left(B_{\rm tot} - \sum_k B_k \right)~, \\ \label{eq:Qhrg} B_k & = \sum_{i=1}^f \, b_i \, N_{k,i}~. } Here $\hat{N}_{j} = \{N_{j,i}\}_{i=1}^f$ are hadron numbers in subvolume $j$ and $b_i$ is the baryon charge of hadron species $i$. $P^{\rm iHRG}$ is the probability distribution function of hadron numbers in an interacting HRG. Each term in Eq.~\eqref{eq:PNjoint} defines the joint probability distribution of all hadrons numbers in all the subvolumes. The subensemble sampler routine thus consists of the following steps: \begin{enumerate} \item The hadron multiplicities in all the subvolumes are sampled from Eq.~\eqref{eq:PNjoint}. This is achieved by first sampling the grand-canonical multiplicities independently for each subvolume and then applying a rejection sampling step to ensure exact global conservation of baryon number. It is assumed that the procedure to sample the grand-canonical multiplicity distribution of the interacting HRG model under consideration is known. \item The momenta for each of the hadrons is sampled via the Cooper-Frye formula~\eqref{eq:CF} applied independently for each hadron from each of the subvolumes. \end{enumerate} \section{Fluctuations at the LHC energies} The subensemble sampler has first been applied to event-by-event fluctuations in heavy-ion collisions at the LHC energies in Ref.~\cite{Vovchenko:2020kwg}. Here we review the main results that were obtained. Specifically, we discuss 0-5\% central Pb-Pb collisions at $\sqrt{s_{\rm NN}} = 2.76$~TeV. As discussed in Ref.~\cite{Vovchenko:2020kwg} the particlization hypersurface in these collisions can be approximated by a longitudinally boost-invariant blast-wave surface covering 9.6 units of space-time rapidity $\eta_s$. The thermal parameters are uniform and correspond to the freeze-out temperature of $T = 160$~MeV and vanishing chemical potentials. With this choice the model accurately reproduces the bulk observables in a range $|Y| \lesssim 2$ around midrapidity as well as the total charged multiplicity in full space. The latter feature is important to properly account for the effects of global conservation. The blast-wave model parameters are taken from Ref.~\cite{Mazeliauskas:2019ifr} ensuring that the $p_T$ distribution of protons at midrapidity is reproduced accurately. As we are mainly interested in the rapidity dependence of various cumulants, the partition of the particlization hypersurface is performed along the longitudinal space-time rapidity axis. The axis is split into 96 slices~(subvolumes), each covering 0.1 units of rapidity. The choice of interacting HRG model is constrained by requiring it to agree with lattice QCD data on cumulants of conserved charges that are being studied. For that purpose we take an HRG model with repulsive excluded volume interactions in the baryonic sector, first formulated in Ref.~\cite{Vovchenko:2016rkn}. As shown in~\cite{Vovchenko:2017xad}, with the excluded volume parameter value of $b = 1$~fm$^3$ this model describes quantitatively both the net-baryon susceptibilities at $\mu_B = 0$ as well as the Fourier coefficients of net baryon density at imaginary $\mu_B$. The details of the grand-canonical multiplicity sampling within this model are described in Refs.~\cite{Vovchenko:2020kwg,Vovchenko:2018cnf}. The entire sampling procedure is implemented within an extended version of the open source package Thermal-FIST~\cite{Vovchenko:2019pjl}. \begin{figure*}[t] \centering \includegraphics[width=.65\textwidth]{netbaryonLHC_reco.pdf} \caption{ Rapidity acceptance dependence of cumulant ratios $\tilde{\kappa}_2^B/\mean{B + \bar{B}}$ (top), $\tilde{\kappa}_4^B/\tilde{\kappa}_2^B$ (middle), and $\tilde{\kappa}_6^B/\tilde{\kappa}_2^B$ (bottom) of net baryon distribution in 0-5\% central Pb-Pb collisions at the LHC in the EV-HRG model and corrected for global baryon conservation via the SAM. The symbols depict the results of the Monte Carlo event generator, the full black squares correspond to neglecting the momentum smearing, the open red triangles include the thermal smearing at particlization, and the full red circles incorporate the smearing due to both the thermal motion and resonance decays. The solid red lines correspond to a Gaussian rapidity smearing model. } \label{fig:chiLHC} \end{figure*} First we focus on the rapidity dependence of net baryon cumulants. We analyze the following three ratios: $$ \frac{\kappa_2[B-\bar{B}]}{\mean{B + \bar{B}}}, \qquad \frac{\kappa_4[B-\bar{B}]}{\kappa_2[B-\bar{B}]}, \qquad \frac{\kappa_6[B-\bar{B}]}{\kappa_2[B-\bar{B}]}. $$ These ratios are calculated as a function of rapidity by sampling $10^{10}$ events. The Monte Carlo results naturally incorporate the effect of baryon number conservation on these ratios. These effects can be corrected for analytically in the framework of the sub-ensemble acceptance method (SAM) of Ref.~\cite{Vovchenko:2020tsr}. The SAM expresses these cumulant ratios in terms of the corresponding ratios without baryon number conservation effect. At the LHC energies, where all odd order cumulants of net baryon number vanish, the SAM expressions read: \eq{\label{eq:SAMc2} \left(\frac{\kappa_2[B-\bar{B}]}{\mean{B + \bar{B}}}\right)_{\rm LHC} & = (1 - \alpha) \, \frac{\tilde{\kappa}_2[B-\bar{B}]}{\mean{B + \bar{B}}}, \\ \label{eq:SAMc4} \left(\frac{\kappa_4[B-\bar{B}]}{\kappa_2[B-\bar{B}]}\right)_{\rm LHC} & = (1-3\alpha \beta) \, \frac{\tilde{\kappa}_4[B-\bar{B}]}{\tilde{\kappa}_2[B-\bar{B}]}, \\ \label{eq:SAMc6} \left(\frac{\kappa_6[B-\bar{B}]}{\kappa_2[B-\bar{B}]}\right)_{\rm LHC} & = \left[1-5\alpha \beta (1 - \alpha \beta ) \right] \frac{\tilde{\kappa}_6[B-\bar{B}]}{\tilde{\kappa}_2[B-\bar{B}]} \nonumber \\ & \quad - 10 \alpha (1-2\alpha)^2 \beta \left( \frac{\tilde{\kappa}_4[B-\bar{B}]}{\tilde{\kappa}_2[B-\bar{B}]}\right)^2~. } Here $\beta \equiv 1 - \alpha$ and the tilde corresponds to net baryon cumulants without the effect of baryon number conservation. The parameter $\alpha$ corresponds to the fraction of the total volume covered by the acceptance. For a $p_T$-integrated acceptance in a range $\Delta Y_{\rm acc}$ around midrapidity in 2.76~TeV Pb-Pb collisions one can approximate this parameter as $\alpha = \Delta Y_{\rm acc} / 9.6$~\cite{Vovchenko:2020kwg}. Figure~\ref{fig:chiLHC} depicts the $\Delta Y_{\rm acc}$ dependence of the three cumulant ratios where the effect of global baryon conservation was accounted for in accordance with Eqs.~(\ref{eq:SAMc2}-\ref{eq:SAMc6}). Here $\tilde{\kappa}_n^B \equiv \tilde{\kappa}_n[B-\bar{B}]$. The black symbols depict the Monte Carlo results without the effect of momentum smearing, i.e. where the kinematic rapidity of each particle coincides with its space-time rapidity. In this case the SAM-corrected Monte Carlo results are independent of $\Delta Y_{\rm acc}$ and agree with the corresponding ratios of the grand-canonical susceptibilities, shown in Fig.~\ref{fig:chiLHC} by dash-dotted horizontal lines. Calculations that incorporate the effect of thermal smearing and resonance decays are depicted by the red symbols. The effect of resonance decays is found to be largely negligible. The thermal smearing ``poissonizes'' the cumulants in small acceptances, where the cumulant ratios approach unity in the limit $\Delta Y_{\rm acc} \to 0$. The deviations of the cumulant ratios from the grand-canonical limit are significant for $\Delta Y_{\rm acc} \lesssim 1$ whereas at larger acceptances they are subleading. The magnitude of the effect is similar for all three cumulant ratios considered. We find that the Monte Carlo results can be accurately described analytically by assuming that the rapidity $y$ of each particle smeared around its space-time rapidity $\eta_s$ by a Gaussian with a width $\sigma_y = 0.3$, the corresponding results are depicted by the red lines in Fig.~\ref{fig:chiLHC}. The presented results illustrate that a reliable interpretation of the experimental data will require control over the effects of baryon conservation and thermal smearing. In particular, as follows from Fig.~\ref{fig:chiLHC}, a measurement of a negative hyperkurtosis $\kappa_6[B-\bar{B}]/\kappa_2[B-\bar{B}]$, corrected for global baryon conservation via the SAM, would indicate a negative grand-canonical hyperkurtosis $\chi_6^B / \chi_2^B$, which could be interpreted as an experimental signature of the chiral QCD crossover transition. It should also be noted that the obtained results do not incorporate the effect of volume fluctuations~~\cite{Gorenstein:2011vq}. This effect should be minimized via an appropriate centrality selection and/or corrected for e.g. using the formalism of Ref.~\cite{Skokov:2012ds}. The experiments do not measure baryons directly but instead use protons as a proxy. It is natural to expect net protons to carry at least some information about net baryon fluctuations. In fact, as shown by Kitazawa and Asakawa~\cite{Kitazawa:2011wh,Kitazawa:2012at}, under the assumption of isospin randomization at the late stages of heavy-ion collisions, one can reconstruct the cumulants of net baryon distribution from the measured factorial moments of proton and antiproton distributions. The subensemble sampler can be used to elaborate on the similarities and differences between net proton and baryon number cumulants. \begin{figure*}[t] \centering \includegraphics[width=.65\textwidth]{netbaryon_netproton_c4c2new.pdf} \caption{ Rapidity acceptance dependence of net baryon~(red squares) and net proton~(blue circles) kurtosis $\kappa_4/\kappa_2$ in 0-5\% central 2.76 TeV Pb-Pb collisions at the LHC. The open blue diamonds correspond to net proton cumulants evaluated from net baryon cumulants using a binomial folding method of Kitazawa and Asakawa~\cite{Kitazawa:2011wh,Kitazawa:2012at}. The analytical predictions of the SAM framework with and without Gaussian rapidity smearing are depicted by solid red and dashed black lines, respectively. The thin gray line corresponds to the value in the grand canonical ensemble consistent with lattice QCD. Adapted from Ref.~\cite{Vovchenko:2020kwg}. } \label{fig:netbaryonproton} \end{figure*} Figure~\ref{fig:netbaryonproton} depicts the rapidity acceptance dependence of net baryon~(black squares) and net proton~(blue symbols) kurtosis $\kappa_4/\kappa_2$ resulting from Monte Carlo sampling. The results shown include the effect of global baryon conservation and reveal large differences between net proton and net baryon cumulant ratios. Net proton cumulant ratios are considerably closer to the Skellam baseline of unity. This can be understood in the following way. By taking only a subset of baryons -- the protons -- one dilutes the total signal due to baryon correlations. This leads to a smaller deviation of cumulants from Poisson statistics -- the limiting case of vanishing correlations. The results shown in Fig.~\ref{fig:netbaryonproton} clearly indicate that direct comparisons between the grand-canonical cumulants and the measured cumulants of net baryon or net proton distribution are unjustified. Let us for example take fluctuations within one unit of rapidity. The predicted kurtosis of net baryon number in $\Delta Y_{\rm acc} = 1$ is affected by thermal smearing and global baryon conservation, resulting in a value $\kappa_4^B/\kappa_2^B \simeq 0.56$. The value of net proton kurtosis is $\kappa_4^p/\kappa_2^p \simeq 0.83 \neq \kappa_4^B/\kappa_2^B$, considerably different from the net baryon kurtosis. Both the net proton and net baryon kurtosis differ notably from the grand-canonical net baryon kurtosis of $\chi_4^B/\chi_2^B \simeq 0.67$. We do observe that the method of Kitazawa and Asakawa~\cite{Kitazawa:2011wh,Kitazawa:2012at} can accurately relate net baryon and proton cumulants between each other. This confirms that cumulants of net baryon distribution can be recovered from factorial moments of net proton distribution via a binomial unfolding with probability $q$, where $q$ is the ratio between the mean numbers of protons and baryons. Only the experiment can perform this unfolding model-independently because the factorial moments of baryon (proton) distribution cannot be computed in lattice QCD. \begin{figure}[t] \centering \includegraphics[width=.49\textwidth]{EV_c2ALICE_alt.pdf} \includegraphics[width=.49\textwidth]{nudyn_ALICE_upd.pdf} \caption{ Pseudorapidity acceptance dependence of net proton $\kappa_2/\mean{p + \bar{p}}$~(\emph{left panel}) and the $D$-measure of net-charge fluctuations~(\emph{right panel}) in 0-5\% central Pb-Pb collisions at the LHC. In the left panel the dashed blue line, the solid black line, and the dash-dotted magenta line corresponds to calculations within the grand-canonical, $B$-canonical, and $BQS$-canonical ensembles, respectively. In the right panel the dashed blue line and the black lines correspond to calculations within the grand-canonical, $BQS$-canonical ensembles, respectively. The $BQS$-canonical calculations are corrected for charge conservation via additive~(dash-dotted line) or multiplicative corrections~(solid line) corrections. The experimental data of the ALICE collaboration~\cite{Acharya:2019izy,Abelev:2012pv} are shown by the symbols with error bars. Adapted from Ref.~\cite{Vovchenko:2020kwg}. } \label{fig:ALICE} \end{figure} The results we have discussed so far correspond to fluctuations of baryons and protons in acceptances integrated over all transverse momenta. This has not yet been achieved experimentally. Instead, the ALICE collaboration has published measurements of the variance of the net-proton distribution in Pb-Pb collisions at $\sqrt{s_{\rm NN}} = 2.76$~TeV in an acceptance in a 3-momentum range $0.6 < p < 1.5$~GeV/$c$ and various longitudinal pseudorapidity ranges up to $|\eta| < 0.8$~\cite{Acharya:2019izy}. The left panel of Fig.~\ref{fig:ALICE} depicts the comparison between the data~(symbols) and the EV-HRG model with exact baryon number conservation~(black line) for the ratio $\kappa_2/\mean{p+\bar{p}}$ of net protons in the ALICE acceptance. In addition to the $B$-canonical calculation, we also depict the grand-canonical~(dashed blue line) and the full $BQS$-canonical~(dash-dotted magenta line) calculations. This allows to elaborate on the influence of various effects on net proton fluctuations. The results indicate that baryon number conservation has the strongest effect on net proton $\kappa_2/\mean{p+\bar{p}}$, followed by an additional suppression due to excluded volume interactions and exact conservation of electric charge. When baryon conservation is included, the data are described within errors. The uncertainties in the presently available measurements, as well as the limited momentum coverage, do not currently allow to distinguish any additional effects that go beyond baryon number conservation. Fluctuation measurements of other identified hadron yields, such as $\Lambda$'s, kaons and pions, have also been performed by ALICE and the final results are being finalized~(see e.g. ~\cite{Arslandok:2020mda} for the preliminary results). The influence of the various conservation laws, as well as resonance decays, on these observables have been discussed in Ref.~\cite{Vovchenko:2020kwg}. Finally, we conclude the discussion of the experimental measurements at the LHC with the variance of net-charge distribution. In Ref.~\cite{Abelev:2012pv} the ALICE collaboration has reported measurements of the so-called $D$-measure, which at the LHC is defined as \eq{ D = 4 \frac{\mean{\delta Q^2}}{\mean{N_{\rm ch}}}~. } The measurements were performed in a broad transverse momentum range $0.2 < p_T < 5.0$~GeV/$c$ and varied pseudorapidity ranges. As this quantity is affected by net-charge conservation, the measurements were corrected using either an additive correction~($D'$) of Ref.~\cite{Pruneau:2002yf} or a multiplicative correction~($D''$) advocated in~\cite{Bleicher:2000ek}, the difference between the two contributing to the systematic uncertainty. The right panel of Fig.~\ref{fig:ALICE} depicts the pseudorapidity acceptance dependence of the $D$-measure resulting from Monte Carlo simulations using the subensemble sampler. The grand-canonical calculation is depicted by the dashed blue line. For the $BQS$-canonical calculation the two charge conservation corrections have been performed in the same way as it was done in the experiment, the results for $D'$ and $D''$ are shown by the black lines. It is seen that the $BQS$-canonical $D''$ measure is closer to the true grand-canonical $D$ measure than $D'$, indicating that the multiplicative correction is more accurate. The model, however, fails to describe the experimental data, which lies considerably below the model predictions. The measurement, therefore, points to the suppression of net-charge fluctuations in central heavy-ion collisions at the LHC relative to the hadronic scenario. One tantalizing possibility here is the QGP formation, where a suppression of the $D$-measure is expected~\cite{Jeon:2000wg}. We hope that future measurements and analyses will shed more light on whether the observation of a suppressed $D$-measure constitutes a QGP signature. \section{Summary and outlook} In summary we have presented the subensemble sampler which is a new Cooper-Frye particlization routine appropriate for event-by-event fluctuations in heavy-ion collisions. It is designed to sample multiplicity distribution of an arbitrary interacting hadron resonance gas, incorporating exact global conservation of the QCD conserved charges. This allows to quantify the effects of global conservation, thermal smearing, and resonance decays on various cumulants measured in experiment, being an important step toward direct comparison between lattice QCD susceptibilities and heavy-ion measurements. The method has been applied to provide insight into the behavior of various cumulants in heavy-ion collisions at the LHC. This has been achieved by approximating the particlization stage by a boost-invariant blast-wave model with a cut-off at large rapidities and using hadron resonance gas model with excluded volume interactions in the baryon sector to reproduce the lattice QCD susceptibilities. More data are available at lower collision energies, for instance from the RHIC beam energy scan program. In particular, the higher-order cumulants of net-proton distribution have attracted a lot of attention, being potentially sensitive to the presence of the QCD critical point. The measurements by the STAR collaboration~\cite{Adam:2020unf,Abdallah:2021fzj} show significant deviations of the cumulants from the uncorrelated proton production baseline. With the possible exception of the lowest energy, $\sqrt{s_{\rm NN}} = 7.7$~GeV, the results are qualitatively consistent with expectations from baryon number conservation. However, it should pointed out that presently no quantitative analysis of net-proton cumulants have been achieved in the hydrodynamic description of heavy-ion collisions in that energy range. The particlization routine that we discussed is one way to achieve such a description. Of course, at lower collision energies one can no longer assume the longitudinally boost-invariant blast-wave model to provide an appropriate quantitative description of the particlization surface. On the other hand, recently three-dimensional hydro simulations of Au-Au collision at BES energies have become available, and they provide a reasonable description of the available rapidity distributions of various hadrons~\cite{Shen:2020jwv}. The subensemble sampler can be combined with the numerical particlization hypersurfaces emerging from such hydro simulations to provide a quantitative analysis of net proton cumulants at RHIC BES. \section*{Acknowledgements} V.V. acknowledges the support by the Feodor Lynen program of the Alexander von Humboldt foundation. This work received support through the U.S. Department of Energy, Office of Science, Office of Nuclear Physics, under contract number DE-AC02-05CH11231231 and within the framework of the Beam Energy Scan Theory (BEST) Topical Collaboration.
\section{Introduction} \section{Introduction} \label{intr} It has been widely acknowledged that machine learning has become fundamentally important in a wide range of research and engineering areas, including autonomous driving, face recognition, speech recognition \cite{deng2013recent}, text understanding \cite{lang/mikolov2013efficient,lang/liang2017recurrent}, image classification \cite{image/yan2019hierarchical,image/yan2016automatic}, etc. There has been an imperative need to improve the performance when training machine learning models, especially in the presence of larger volumes of data and increasingly complex computing models. Current the structure of neural network have at hundreds layers are relatively common, such as the Bert\cite{devlin2018bert} language model proposed by Google contains 300 million parameters, ImageNet\cite{deng2009imagenet} data set contains 20000 categories a total of 15 million images. Parameter servers\cite{li2013parameter}. are widely used in today's distributed training system, such as MXNet\cite{chen2015mxnet} and TensorFlow\cite{abadi2016tensorflow}.The architecture is shown in the Fig.1. Parameter server architecture consists of a logic server group and a lot of workers. Under the parameter server architecture. Each worker holds different training data and the same copy of the model. Each worker calculates the gradient locally, then periodically push the local gradient to parameter server, and then parameter server summarizes the gradient of each worker and updates the model parameters. Finally, each worker pull the latest parameters to continue the training. In addition, there is a decentralized architecture that is distinct from Parameter server, called Ring-AllReduce. In this architecture, all nodes form a logic ring, and each node only communicates with its neighbor nodes, effectively avoiding the bandwidth congestion caused by centralization. However, due to the characteristics of the architecture, only synchronous algorithm can be used, so Straggler in this architecture will lead to more serious problems. At present, there are also some work to optimize ring, such as horovod \cite{horovod,gibiansky2017bringing,jia2018highly,mikami2018imagenet}. In this work, we focus on parameter server. At present, the prevalent synchronous paradigms are: Bulk Synchronous Parallel(BSP)\cite{gerbessiotis1994direct}, Asynchronous Parallel (ASP), and Stale Synchronous Parallel (SSP)\cite{ho2013more}. BSP, as a famous general parallel computing synchronization model in distributed computing. Due to its stability and reliability, it has the same stability as SGD on a single machine. Thus the mainstream distributed training systems take it as the default parallel strategy. Barriers are a critical component in BSP. It requires each node to stop working after completing its own tasks and to wait until all nodes have completed their tasks. Although this can ensures a high degree of consistency of models on different nodes, it has serious drawbacks. In a heterogeneous or volatile cloud environment, the performance of each node is not the same. This means that each node takes different amounts of time to process the same amount of data, which results in a large amount of time spent waiting for the slowest node in each synchronization process. A typical example is shown in Figure 2. \begin{figure}[tp] \centering \includegraphics[width=0.45\textwidth]{psandring.png} \caption{The architecture of Parameter Server and Ring-AllReduce.} \label{ps} \end{figure} So a natural idea would be to relax synchronization requirements. \begin{figure}[tp] \centering \includegraphics[width=0.5\textwidth]{bsp.png} \caption{Under the restriction of barrier, the fastest node must wait for the slowest node after each iteration, which is very inefficient} \label{bspli} \end{figure} According to this naive idea, ASP paradigms remove the strict barriers, so that each node can work asynchronously. However, because the progress of each node is too different, the model will shake, and it will take longer time to converge. SSP\cite{ho2013more} is a compromise between the two methods. As long as the pace between the fastest node and the slowest node does not exceed the stale threshold, each node can work asynchronously. But due to SSP introduces an extra threshold,If the threshold setting is not reasonable, it will also be seriously affected by the straggler, causing the fastest nodes frequently to stop waiting for the slowest node during the training process or too big causing non-converge. In order to make up for the shortcomings of the above Parallel paradigm. We propose a adaptive load balance approach. The aim of our approach is to relax the strict synchronization requirement of classical BSP and to improve resource utilization. The core idea is let slower workers do less computation between synchronization, and faster workers do more. Under global control, the waiting time of each synchronization is minimized. Thus, the overall training time is shortened. Our contributions are summarized as follows: \section{Motivation} \label{mo} Mini-batch stochastic gradient descent (SGD) is state of the art in large scale distributed training (See Figure \ref{bsp_on_hom}). The scheme can reach a linear speedup with respect to the number of workers, but this is rarely seen in practice as the scheme often suffers from large network delays and bandwidth limits. To overcome this communication bottleneck recent works propose to reduce the communication frequency. An algorithm of this type is Local SGD \cite{zinkevich2010parallelized,mcdonald2010distributed,zhang2014improving,mcmahan2017communication} that runs SGD independently in parallel on different workers and averages the sequences only once in a while. Local SGD requires all workers to compute the average of individual solutions every I iterations and synchronization among local workers are not needed before averaging. However, the fastest worker still needs to wait until all the other workers finish I iterations of SGD even if it finishes its own I iteration SGD much earlier. (See Figure \ref{local_without_balancing} for a 4 worker example where one worker is significantly faster than the others.) As a consequence, the computation capability of faster workers is wasted. Such an issue can arise quite often in heterogeneous networks where nodes are equipped with different hardwares. In this paper, we present asynchronous local SGD with load-balancing (Figure \ref{local_with_balancing}) that does not require that the local sequences are synchronized. This does not only reduce communication bottlenecks, but by using load-balancing techniques the algorithm can optimally be tuned to heterogeneous settings (slower workers do less computation between synchronization, and faster workers do more). \begin{figure}[ht] \centering \includegraphics[width=1\columnwidth]{bsp_on_hom.png} \caption{Mini-batch SGD on homogeneous environment. The green arrow represent the computation.} \label{bsp_on_hom} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=1\columnwidth]{localsgd.png} \caption{Local SGD in heterogeneous environment. The green arrow represent the computation and the gray arrow represent the idle state.} \label{local_without_balancing} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=1\columnwidth]{lb_localsgd.png} \caption{Local SGD with load-balancing in heterogeneous environment. The green arrow represent the computation and the gray arrow represent the idle state.} \label{local_with_balancing} \end{figure} \section{Problem Formulation } \label{pf} Most data centers have high availability, assuming that they are run in a stable environment, and each worker's computational speed is in a steady state. According to the case study, the time spent by a worker before the global barrier can be composed of three parts, the barrier notated as $T$. The first part is the gradient calculation time, notated as $t_{i}^{iter}$. The second part is the idle time of wait for other workers to synchronize parameters, notated as $t_{i}^{w}$. and the third part is the time of synchronize the parameters. We assume that the bandwidth between workers in the data center is very fast, so we will ignore the third part. For N workers in a heterogeneous cluster, each worker has to process a certain amount of iterations before the global barrier where each iteration time on the same worker is similar. Assume N worker index by $i$, the time of a local iteration of each worker can be notated as $t_{1}^{iter}, t_{2}^{iter}, t_{3}^{iter}...t_{N}^{iter}$. Given a global barrier $T$, we can get the $t_{i}^{w}$ of each worker: \begin{equation} t_{i}^{w} = mod(T,t_{i}^{iter}) \end{equation} Before a synchronization, the maximum waiting time can reflect the idle degree of workers. If the maximum wait time is as small as possible, it means that all worker can complete the last batch calculation exactly at the global barrier. Thus, computing resources can be fully utilized. We define the maximum wait time as: \begin{equation} max(mod(T, t_{i}^{iter})) \label{max_wait_time} \end{equation} So, We are looking for the optimal $T^{*}$ which gives the minimum Eq. \ref{max_wait_time} from all possible $T$. At last, we formulate the following optimization problem: \begin{equation} T^{*} = \mathop{argmin}\limits_{T} max mod(T, t_i) \end{equation} $ S.T. \quad floor(T/min(t_{i}^{iter})) - floor(T/max(t_{i}^{iter})) < M $ Where $floor(T/(t_{i}^{iter}))$ represent how many times can the $i$-th worker iterate before the barrier at most, notated as $\tau_{i}$, and $M$ limits the difference of local step of different workers in the appropriate range. \begin{table}[] \begin{tabular}{|l|l|} \hline Name & Description \\ \hline $t_{i}^{iter}$ & Time of a local iteration of worker i \\ \hline $t_{i}^{w}$ & Time of wait of worker i \\ \hline $T$ & The time point of global synchronization \\ \hline $N$ & Number of workers \\ \hline \end{tabular} \caption{Frequently used notations} \end{table} \section{Approach} \label{ap} In this section we present load-balance local SGD. This does not only using load-balancing techniques which the algorithm can optimally be tuned to heterogeneous settings (slower workers do less computation between synchronization, and faster workers do more), but also reduce the network overhead caused by the frequently communication. \subsection{Local-SGD load balancing} To minimize the wait time and improve cluster utilization, we propose an fast and efficient algorithm based on the principle of least common multiple. The algorithmic flow can be found here\ref{alg:Load-Balance Algorithm},and the described as follows: First let $T=max(t_{i}^{iter})$. Next use a loop to get the max value of $mod(T,t_{i}^{iter})$, and $T++$. The above loop is repeated until the constraint is not satisfied. Last take the $T^{*}$ that make the max value of $mod(T,t_{i}^{iter})$ is the minimum. Therefore, the total computation complexity is $O(MN)$ which is an linear complexity. It will not bring additional overhead to the original training system. After obtain the optimal $T^{*}$, we can calculate the number of iterations for each worker according to $t_{i}^{iter}$. The number of iterations of each worker is expressed as: $\tau_{1},\tau_{2}...\tau_{N}$. So the model update rule is: \begin{equation} x_{t+1}^{i} = \left\{ \begin{array}{ll} \frac{1}{N} \sum_{k=1}^{N} (x_{t}^{k} - \eta g(x_{t}^{k})) & \textrm{ $t \ mod \ \tau_{i} =0$}\\ x_{t}^{i} - \eta g(x_{t}^{i})& \textrm{otherwise} \end{array} \right. \end{equation} where $x_{t}^{i}$ denotes the model parameters in the $i$-th worker. \subsection{Data partition load balancing} \begin{algorithm} \caption{Load-Balance Algorithm} \label{alg:Load-Balance Algorithm} \begin{algorithmic} \State {\textbf{Input: } $t_{i}^{iter},M$} \State {\textbf{Output: } $T^{*}$} \State {\textbf{Initial: }$T=max(t_{i}^{iter})$} \For{$floor(T/min(t^{iter})) - floor(T/max(t^{iter})) < M , i=1$} \For{$each\quad worker:j=1,2,3...N$} \State {$t^{w}[j] = mod(T,t_{j}^{iter})$} \EndFor \State $max\_wait\_time[i]$ = $max(t^{w})$ \State $T\_set[i] = T$ \State $T++$ \EndFor $T^{*} = T\_set[indexOf(min(max\_wait\_time))]$ \end{algorithmic} \end{algorithm} \section{Evaluation Setup} \subsection{Testbed} We conduct our experiments on a GPU server. The server runs with 2 NVIDIA RTX 2080 GPUs and interconnected with 10Gbps PCI-E. The server run Ubuntu Server 18.06. We used Pytorch framework to build our algorithm prototypes. \subsection{Dataset and DL Models} We used CIFAR-10 datasets for image classification tasks. The datatsets has 50,000 training images and 10,000 test images. We choosed ResNet101 as our deep neural network baseline to evaluate our approach. \subsection{Metrics} The performance metrics include scalability and Rate of convergence. The scalability denotes the speedup on throughput (number of iterations finished per hour) compared with single node DL. \section{Evaluations} \label{exp} \begin{figure}[ht] \centering \includegraphics[width=1\columnwidth]{loss.png} \caption{} \label{local_with_balancing} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=1\columnwidth]{W_B-Chart-2020_9_14_8_19_17.pdf} \caption{} \label{local_with_balancing} \end{figure} \begin{figure}[ht] \centering \includegraphics[width=1\columnwidth]{WB.png} \caption{} \label{local_with_balancing} \end{figure} \subsection{Rate of convergence} Figure 6 plots the training time in ResNet101. We set the training time to 1 hour, batchsize to 128. It can be clearly observed in the above figure that the curve of BSP is more smoother. This is due to the strong synchronization characteristics of BSP, which can ensure the correctness of the gradient from different workers and avoid shocks. Although the convergence process of BSP is very stable, its convergence speed is very slow. This is because in a heterogeneous environment, the performance of each worker is different, which causes different workers to process data of the same size in different times. Thus some workers with good performance are idle for most of the time. Our approach uses load balancing to improve the utilization of computing resources, so that more data can be iterated in the same time. Thereby accelerating convergence. \subsection{Scalability} \section{Related Works} \label{rel} \subsection{Asynchronous SGD} \label{async} For large scale machine learning optimization problems, parallel mini-batch SGD suffers from synchronization delay due to a few slow machines, slowing down entire computation. To mitigate synchronization delay, asynchronous SGD method are studied in \cite{recht2011hogwild,de2015taming,lian2015asynchronous}. These methods, though faster than synchronized methods, lead to convergence error issues due to stale gradients. \cite{agarwal2011distributed} shows that limited amount of delay can be tolerated while preserving linear speedup for convex optimization problems. Furthermore, \cite{zhou2018distributed} indicates that even polynomially growing delays can be tolerated by utilizing a quasilinear step-size sequence, but without achieving linear speedup. \subsection{Large batch SGD} \label{large} Recent schemes for scaling training to a large number of workers rely on standard mini-batch SGD with very large overall batch sizes \cite{you2018imagenet,goyal2017accurate} , i.e. increasing the global batch size linearly with the number of workers K. \cite{yu2019computation} has shown that remarkably, with exponentially growing mini-batch size it is possible to achieve linear speed up (i.e., error of \(\mathcal{O}(1/KT))\) with only \(\log{T}\) iterations of the algorithm, and thereby, when implemented in a distributed setting, this corresponds to \(\log{T}\) rounds of communication. The result of \cite{yu2019computation} implies that SGD with exponentially increasing batch sizes has a similar convergence behavior as the full-fledged (non-stochastic) gradient descent. While the algorithm of \cite{yu2019computation} provides a way of reducing communication in distributed setting, for a large number of iterations, their algorithm will require large minibatches, and washes away the computational benefits of the stochastic gradient descent algorithm over its deterministic counter part. Furthermore, it has been found that increasing the mini-batch size often leads to increasing generalization errors, which limits their distributivity \cite{li2014efficient}. Our work is complementary to the approach of \cite{yu2019computation}, as we focus on approaches that use local updates with a fixed minibatch size, which in our experiments, is a hyperparameter that is tuned to the data set. \subsection{Local SGD} \label{local} Motivated to better balance the available system resources (computation vs. communication), local SGD (a.k.a. local-update SGD, parallel SGD, or federated averaging) has recently attracted increased research interest \cite{zinkevich2010parallelized,mcdonald2010distributed,zhang2014improving,mcmahan2017communication}. In local SGD, each worker evolves a local model by performing H sequential SGD updates with mini-batch size B, before communication (synchronization by averaging) among the workers. A main research question is whether local-update SGD provides a linear speedup with respect to the number of workers \(K\), similar to mini-batch SGD. Recent work partially confirms this, under the assumption that \(H\) is not too large compared to the total iterations \(T\). \cite{stich2018local} show convergence at \(\mathcal{O}((KT)^{-1})\) on strongly convex and smooth objective functions when \(H = \mathcal{O}(T^{1/2})\). For smooth non-convex objective functions, \cite{yu2019parallel} give an improved result \(\mathcal{O}((KT)^{-1/2})\) when \(H = \mathcal{O}(T^{1/4})\). \cite{zhang2016parallel} empirically study the effect of the averaging frequency on the quality of the solution for some problem cases and observe that more frequent averaging at the beginning of the optimization can help. Similarly, \cite{bijral2016data} argue to average more frequently at the beginning. Although existing works provides convergence guarantees on local-update SGD, there is still no effort focus on optimally tuning local-update SGD to heterogeneous settings (slower workers do less computation between synchronization, and faster workers do more) using load-balancing techniques. \section{Conclusion} \label{con} This is Conclusion.
\section{Introduction} Due to increasing populations living in urban areas, many cities are facing the problem of traffic congestion, which leads to increasing levels of pollution and massive waste of time and money \cite{congestion}. The problem of mitigating congestion has been tackled in the literature from two main perspectives. One approach is to influence the user behaviour by incentive-design mechanisms, for instance by road tolling \cite{brown2017studies,fleischer2004tolls,zhao2006line,cole2006much,Como.ea:16,Como.Maggistro:22}, information design \cite{das2017reducing,meigs2020optimal,wu2019information,wu2021value} or lottery rewards \cite{yue2015reducing}, to minimize the inefficiencies due to the autonomous uncoordinated decisions of the agents. A second approach is to intervene on the transportation network, by building new roads or enlarging the existing ones. The corresponding \emph{network design problem} (i.e., the problem of optimizing the intervention on a transportation network subject to some budget constraints, see e.g. \cite{leblanc1975algorithm}) is very challenging because of its bi-level nature, i.e., it involves a network intervention optimization problem given the flow distribution for that particular network. We assume that each link of the network is endowed with a delay function and the flow distributes according to a Wardrop equilibrium, taking paths with minimum cost, defined as the sum of the delay functions of the links along the path (see \cite{beckmann1956studies,wardrop1952road}). A characterization of the Wardrop equilibrium is used to construct the lower level of the bi-level network design problem. In this work we define a network design problem (NDP), and analyze in details a special instance of the problem, where the delay functions are affine, and the planner can improve the delay function of a single link. Our objective is to strike a balance between a problem that is simple enough to guarantee tractable analysis, yet rich enough to allow insights for more general classes of NDPs. We then extend the validity of the proposed method by a numerical analysis, showing that good performance are achieved even if the delay functions are non-linear. For single-link affine NDPs, our first theoretical result provides an analytical characterization of the cost variation (i.e., the total travel time at the equilibrium) corresponding to an intervention on a particular link under a regularity assumption, which states that the set of links carrying positive flow remain unchanged with an intervention. This assumption, which is not new in the traffic equilibrium literature (see e.g. \cite{steinberg1983prevalence,dafermos1984some}) leads to a characterization of Wardrop equilibria using a system of linear equations and enables representing single-link interventions as rank-1 perturbations of the system. We show that this assumption is satisfied provided that the total incoming flow to the network is large enough and the network is series-parallel, which may be of independent interest. We exploit the structure of our characterization and the linearity of the delay functions to express the cost variation using the effective resistance of a link (i.e., between the endpoints of the link), defined with respect to a related resistor network, obtained by making the directed transportation network undirected, and assigning a conductance to each link based on the delay function of the link. Computing the effective resistance of a single link requires the solution of a linear system whose dimension scales with the network size (we indistinctly refer to the network size as the cardinality of the node and the link sets, implicitly assuming that transportation networks are sparse in a such a way that the average degree of the nodes is independent of the number of nodes, inducing then a proportionality between the number of nodes and links). Hence, solving the NDP requires the solution of $\mathrm{E}$ of these problems, with $\mathrm{E}$ denoting the number of links. Since this can be computationally intractable for large networks, our second main result proposes a method based on Rayleigh's monotonicity laws to approximate the effective resistance of each link with a number of iterations independent of the network size, thus leading to a significant reduction of complexity. The key idea is that the effective resistance between two adjacent nodes $i$ and $j$ depends mainly on the local structure of the network around the two nodes (i.e., the set of nodes $\mathcal{N}_{\le d}$ that are at distance no greater than a small constant $d$ from at least one of $i$ and $j$), and may therefore be approximate by performing only local computation. Since typically in transportation networks the local structure of the network is independent of the network size (think for instance of a bidimensional square grid), the size of $\mathcal{N}_{\le d}$ does not scale with the network size, thus we can guarantee that the approximation error and computational complexity of our method also do not scale. Our third main result establishes sufficient conditions under which the approximation error vanishes asymptotically in the limit of infinite networks, proving that if the related resistor network is recurrent the approximation error tends to vanish for large distance $d$. In the conclusive section we conduct a numerical analysis on synthetic and real transportation networks, showing that a good approximation of the effective resistance of a link can be achieved by looking at a small portion of the network. Moreover, while several assumptions are made to establish theoretical results (e.g., affine delay functions, support of equilibrium flows not varying with the intervention), we conduct a numerical analysis showing that good performance are achieved even if some assumptions are relaxed, i.e., if the delay functions are non-linear and the support of the equilibrium is allowed to vary with interventions. In our work we consider a special case of NDPs. These problems have been formalized in the last decades via many different formulations. Both \textit{continuous} network design problems \cite{chiou2005bilevel,li2012global,wang2014models}, where the budget can be allocated continuously among the links, and \textit{discrete} formulations, in which the decision variables include which new roads to build \cite{gao2005solution}, how many lanes to add to existing roads \cite{wang2013global}, or a mix of those two problems \cite{poorzahedy2007hybrid}, have been considered in the literature, together with \textit{dynamical} formulations \cite{fontaine2017dynamic}, and formulations where the optimum is achieved by removing, instead of adding, links, because of Braess' paradox \cite{roughgarden2006severity,fotakis2012efficient}. For comprehensive surveys on the literature on NDP we refer to \cite{yang1998models,farahani2013review}. We stress that most of the literature focuses on finding polynomial algorithms to solve in approximation NDPs in their most general form. Our main contribution is to provide a tractable approach to solve a single-link network design problem in quasi-linear time, as well as providing intuition and a completely new formulation. For the future we aim at extending our techniques to more general cases, like the multiple interventions case. In the setting of affine delay functions, our NDP formulation is also related to the literature on marginal cost pricing. We assume that interventions modify the linear coefficient of the delay function of link $e$ from $a_e$ to $\tilde{a}_e$, leading to $\tilde{\tau}_e(f_e) = \tau_e(f_e)-(a_e-\tilde{a}_e)f_e$, which is equivalent to adding a negative marginal cost toll on a link. In the literature the problem of optimal toll design has been widely explored, also dealing with the problem of the support of the Wardrop equilibrium varying after the intervention, i.e., without imposing restrictive assumptions. However, most of the toll literature aim at finding conditions under which a general NP-hard problem may be solved in polynomial time. The scope of our work is instead to provide a new formulation to a more tractable problem. Moreover, to relax the regularity assumption on the support of the equilibrium, in the toll literature it is often assumed that the network has parallel links, which is unrealistic for transportation networks (see, e.g., \cite{hoefer2008taxing,jelinek2014computing}. Our work is also related to \cite{steinberg1983prevalence,dafermos1984some}, where the authors investigate the sign of total travel time variation when a new path is added to a two-terminal network, under similar assumptions to ours, providing sufficient conditions under which the Braess' paradox arises. In our work we instead compute the total travel time variation with an intervention, and suggest an efficient algorithm to select the optimal intervention. As mentioned, the key step of our approach is to reformulate the NDP in terms of a resistance problem, and also exploits the parallelism between resistor networks and random walks. From a methodological perspective it is worthwhile mentioning that the relation between Wardrop equilibria and resistor networks has been first investigated in \cite{klimm2019computing}, while the parallelism between random walks and Wardrop equilibria has been investigated in \cite{rebeschini2018locality}, although with different purposes. The relation between random walks and resistor networks is quite standard and well-known (see e.g. \cite{doyle1984random}). To summarize, the contribution of this paper is two-fold. From a methodological perspective, we provide a method to locally approximate the effective resistance between adjacent nodes, which may be of independent interest (effective resistance of a link is related to spanning tree centrality \cite{hayashi2016efficient}). From NDP perspective, we provide a new formulation of the NDP in terms of resistor networks, and exploit our methodological result to approximate efficiently single-link NDPs. The rest of the paper is organized as follows. In Section~\ref{sec:model} we define the model and formulate the NDP as a bi-level program. In Section~\ref{sec3} we define single-link NDPs, rephrase the problem in terms of resistor networks, and discuss the regularity assumption. In Section~\ref{approximation} we provide our method to approximate the effective resistance of a link and exploit such a method to construct an algorithm to solve the problem. We then analyze the asymptotic performance of the proposed method in the limit of infinite networks in Section~\ref{performance}. In Section~\ref{sec:simulations} we provide numerical simulations. Finally, in the conclusive section, we summarize the work and discuss future research lines. \subsection{Notation} We let $\delta^{(i)}$, $\mathbf{1}$, $\mathbf{0}$ and $\mathbf{I}$ denote the unitary vector with $1$ in position $i$ and $0$ in all the other positions, the column vector of all ones, the column vector of all zeros, and the identity matrix, respectively, where the size of them may be deduced from the context. $A^T$ and $v^T$ denote the transpose of matrix $A$ and vector $v$, respectively. Given a vector $v$, we let $\mathbf{I}_v$ denote the matrix whose off-diagonal elements are zero and with diagonal elements $(\mathbf{I}_v)_{ii} = v_i$. \section{Model and problem formulation} \label{sec:model} We model the transportation network as a directed multigraph $\mathcal{G}=(\mathcal{N},\mathcal{E})$, and denote by $\mathrm{o}, \mathrm{d} \in \mathcal{N}$ the origin and the destination of the network. We assume for simplicity of notation that $\mathcal{N}=\{1,\cdots,\mathrm{N}\}$ and $\mathcal{E}=\{1,\cdots,\mathrm{E}\}$, and assume that $\mathrm{o}$ and $\mathrm{d}$ are respectively the first and the last node of the network. Every link $e$ is endowed with a tail $\xi(e)$ and a head $\theta(e)$ in $\mathcal{N}$. We allow multiple links between the same pair of nodes, and assume that every link belongs to at least a path from $\mathrm{o}$ to $\mathrm{d}$, otherwise such a link may be removed without loss of generality. Let $m > 0$ denote the throughput from the origin $\mathrm{o}$ to the destination $\mathrm{d}$, and $\nu = m(\delta^{(\mathrm{o})}-\delta^{(\mathrm{d})}) \in \mathds{R}^\mathrm{N}$. Let $\mathcal{P}=\{1,\cdots,\mathrm{P}\}$ denote the set of paths from $\mathrm{o}$ to $\mathrm{d}$. An admissible path flow is a vector $z \in \mathds{R}^{\mathrm{P}}_+$ satisfying the mass constraint \begin{equation} \label{constraints} \mathbf{1}^T z=m. \end{equation} Let $A \in \mathds{R}^{\mathrm{E} \times \mathrm{P}}$ denote the link-path incidence matrix, with entries $A_{ep}=1$ if link $e$ belongs to the path $p$ or $0$ otherwise. The path flow induces a unique link flow $f \in \mathds{R}^\mathrm{E}$ via \begin{equation} f=Az. \label{incidence_path} \end{equation} Every link $e$ is endowed with a non-negative and strictly increasing delay function $\tau_e : \mathds{R}_+ \to \mathds{R}_+$. We assume that the delay functions are in the form $\tau_e(f_e) = \tau_e(0) + a_e(f_e)$, where $\tau_e(0)$ is the travel time of the link when there is no flow on it, and $a_e(f_e)$ describes congestion effects, with $a_e(0)=0$. The cost of path $p$ under flow distribution $f$ is the sum of the delay functions of the links belonging to $p$, i.e., \begin{equation} c_p(f)=\sum_{e \in \mathcal{E}}A_{ep}\tau_e(f_e). \label{cost_path} \end{equation} \begin{definition}[Routing game] A \emph{routing game} is a triple $(\mathcal{G}, \tau, \nu)$. \end{definition} A Wardrop equilibrium is a flow distribution such that no one has incentive in changing path. More precisely, we have the following definition. \begin{definition}[Wardrop equilibrium] A path flow $z^*$, with associated link flow $f^*=Az^*$, is a Wardrop equilibrium if for every path $p$ \begin{equation*} z^*_p>0 \implies c_p(f^*)\le c_q(f^*), \quad \forall q \in \mathcal{P}. \end{equation*} \end{definition}\medskip Let $B \in \mathds{R}^{\mathrm{N} \times \mathrm{E}}$ denote the node-link incidence matrix, with entries $B_{ne}=1$ if $n=\xi(e)$, $B_{ne}=-1$ if $n=\theta(e)$, or $B_{ne}=0$ otherwise. It is proved in \cite{beckmann1956studies} that a link flow $f^*$ is a Wardrop equilibrium of a routing game if and only if \begin{equation} \begin{aligned} f^* = \ & \underset{f \in \mathds{R}_+^\mathrm{E}, Bf=\nu}{\arg\min} & & \sum_{e \in \mathcal{E}} \int_0^{f_e} \tau_e(s) ds, \end{aligned} \label{convex_prob} \end{equation} where $Bf=\nu$ is the projection of \eqref{constraints} on the link set. Since the delay functions are assumed strictly increasing, the objective function in \eqref{convex_prob} is strictly convex and the Wardrop equilibrium $f^*$ is unique. \begin{definition}[Social cost] The social cost of a routing game is the total travel time at the equilibrium, i.e., \begin{equation*} C^{(0)}=\sum_{e \in \mathcal{E}} f_e^*\tau_e(f_e^*). \end{equation*} \end{definition} \medskip The social cost can be interpreted as a measure of performance by a planner that aims at minimizing the overall congestion on the transportation network. We now provide an equivalent characterization of the social cost of a routing game. To this end, let $\lambda^*$ and $\gamma^*$ denote the Lagrangian multipliers associated to $f^*\ge \mathbf{0}$ and $Bf=\nu$, respectively. The KKT conditions of \eqref{convex_prob} read: \begin{align} \label{kkt2} \begin{cases} \tau_e(f_e^*)+\gamma_{\theta(e)}^*-\gamma^*_{\xi(e)} - \lambda^*_{e}=0 & \forall e \in \mathcal{E},\\ \sum_{e \in \mathcal{E}: \theta(e)=i} f_e - \sum_{e \in \mathcal{E}: \xi(e)=i} f_e + \nu_i=0 & \forall i \in \mathcal{N},\\ \lambda_{e}^*f_{e}^*=0 & \forall e \in \mathcal{E},\\ \lambda_{e}^*\ge 0 & \forall e \in \mathcal{E},\\ f_{e}^*\ge 0 & \forall e \in \mathcal{E}. \end{cases} \end{align} The third condition, known as complementary slackness, implies that if $\lambda_e^*>0$, then $f_e^*=0$, i.e., link $e$ is not used at the equilibrium. We let $\mathcal{E}_+$ denote the set of the links $e$ such that $\lambda_e^*>0$. The next lemma shows that the social cost may be characterized in terms of the Lagrangian multiplier $\gamma^*$. \begin{lemma} \label{cost} Let $(\mathcal{G},\tau,\nu)$ denote a routing game. Then, \begin{equation*} \begin{gathered} C^{(0)}=m(\gamma^*_\mathrm{o}-\gamma_\mathrm{d}^*). \end{gathered} \end{equation*} \end{lemma}\medskip \begin{proof} See Appendix~\ref{app:proofs}. \end{proof} We consider a NDP where the planner can improve the delay functions of the network with the goal of minimizing a combination of the social cost after the intervention and the cost of the intervention itself. Specifically, let $u \in \mathds{R}_+^{\mathrm{E}}$ denote the intervention vector, with corresponding delay functions $$ \tau_e^{(u_e)}(f_e) = \tau_e(0) + \frac{a_e(f_e)}{1+u_e}. $$ This type of interventions may correspond for instance to enlarging some roads of the network. We let $h_e : [0,+\infty) \to [0,+\infty)$ denote the cost associated to the intervention on link $e$. The goal of the planner is to minimize a combination of the social cost and the intervention cost, where $\alpha \ge 0$ is the trade-off parameter. More precisely, by letting $f^*(u)$ denote the Wardrop equilibrium corresponding to intervention $u$, the NDP reads as follows. \begin{problem} \label{prob:general} Let $(\mathcal{G},\tau,\nu)$ be a routing game, and $\alpha\ge0$ be the trade-off parameter. The goal is to select $u^*$ such that \begin{equation} \label{eq:ndp} u^* \in \underset{u \in \mathds{R}^\mathrm{E}_+}{\arg\min} \ \sum_{e \in \mathcal{E}} f^*_e(u) \tau_e^{(u_e)}(f^*_e(u)) + \alpha h(u), \end{equation} where $h(u)=\sum_e h_e(u_e)$, and \begin{equation} \begin{aligned} f^*(u) = \ & \underset{f \in \mathds{R}_+^\mathrm{E}, Bf=\nu}{\arg\min} & & \sum_{e \in \mathcal{E}} \int_0^{f_e} \tau_e^{(u_e)}(s) ds. \end{aligned} \label{eq:f(k)} \end{equation} \end{problem} \medskip \begin{remark} We stress the fact that Problem~\ref{prob:general} is bi-level, in the sense that the planner optimizes the intervention $u$ according to a cost function that depends on the Wardrop equilibrium $f^*(u)$, which in turn is the solution of the optimization problem \eqref{eq:f(k)}, whose objective function depends on the intervention $u$ itself. \end{remark} \begin{remark} Problem~\ref{prob:general} is not equivalent to the toll design problem. The key difference between the two problems is that tolls modify the Wardrop equilibrium, but the performance of tolls is evaluated with respect to the original delay functions $\tau_e$. On the contrary, in Problem~\ref{prob:general} the intervention is evaluated with respect to the new delay functions $\tau_e^{(u_e)}$. \end{remark} Problem~\ref{prob:general} is in general non-convex, and hard to solve because of its bi-level nature. For these reasons, in the next section we shall study a simplified problem where the delay functions are affine and the planner may intervene on one link only. In this setting we are able to rephrase the problem as a single-level optimization problem, and provide an electrical network interpretation of the problem. \section{Single-link interventions in affine networks} \label{sec3} In this section we provide an electrical network formulation of the NDP under some restrictive assumptions. In particular, we provide a closed formula for the social cost variation in terms of electrical quantities computed on a related resistor network. To this end, we restrict our analysis to the space of feasible interventions $\mathcal{U}$, defined as $$ \mathcal{U} := \{u : u_e \delta^{(e)} \ \text{for a link} \ e \in \mathcal{E}, u_e \ge 0 \}. $$ In other words, $\mathcal{U}$ represents the space of interventions on a single link of the network. We also assume that the delay functions are affine, i.e., $\tau_e(f_e) = a_ef_e + b_e$ for every $e$, and denote by $(\mathcal{G},a,b,\nu)$ routing games with affine delay functions. For an intervention $u$, let $(\mathcal{G},a^{(u)},b,\nu)$ denote the corresponding affine routing game, $C^{(u)}$ denote the corresponding social cost, and $\Delta C^{(u)} = C^{(0)} - C^{(u)}$ denote the social cost gain. Our problem can be expressed as follows. \begin{problem} Let $(\mathcal{G}, a, b, \nu)$ be an affine routing game and $\alpha \ge0$ be the trade-off parameter. Find \begin{equation*} u^* \in \ \underset{u \in \mathcal{U}}{\arg\max} \ (\Delta C^{(u)} - \alpha h(u)). \end{equation*} \label{prob1} \end{problem} The next example shows that the problem cannot be decoupled by first selecting the optimal link $e^*$ and then the optimal strength of the intervention $u^*_e$. \begin{example} \label{ex:ex} Consider the transportation network in Figure~\ref{fig:ex}, with linear delay functions $\tau_e(f_e) = a_ef_e$. By some computation, one can prove that \begin{equation*} \begin{aligned} \Delta C^{(u_1\delta^{(1)})} & = m \frac{a_1a_2^2 u_1}{(a_1+a_2)((u_1+1) a_1 + a_2)},\\ \Delta C^{(u_2 \delta^{(2)})} & = m \frac{a_1^2a_2 u_2}{(a_1+a_2)(a_1 + (u_2+1) a_2)},\\ \Delta C^{(u_3 \delta^{(3)})} & = m \frac{u_3}{u_3+1}. \end{aligned} \end{equation*} In Figure~\ref{fig:ex} the social cost variation corresponding to intervention on every link $e$ is illustrated as functions of $u_e$. Observe that the link that maximizes the social cost gain depends on $u_e$. Thus, the problem cannot be decoupled by first selecting the optimal link $e^*$ and then the optimal $u_e^*$. \begin{figure} \centering \begin{tikzpicture} \node[draw, circle] (1) at (0,0.5) {o}; \node[draw, circle] (2) at (0,-1) {n}; \node[draw, circle] (3) at (0,-2.5) {d}; \node (4) at (0,-3) {}; \path [->, >=latex] (1) edge [bend right=30] node [left] {$e_1$} (2); \path [->, >=latex] (1) edge [bend left=30] node [right] {$e_2$} (2); \path [->, >=latex] (2) edge [bend left=0] node [right] {$e_3$} (3); \end{tikzpicture} \includegraphics[width = 6cm]{optimal_link_kappa.png} \caption{\emph{Left}: the graph of Example~\ref{ex:ex}. \emph{Right}: the social cost variation corresponding to single link interventions, with assignment $a_1 = 3, a_2 = 2, a_3 = 1, m = 3$. \label{fig:ex}} \end{figure} \end{example} Our theoretical results rely on the following technical assumption, stating that the support of the Wardrop equilibrium is not modified with an intervention. \begin{assumption} Let $\mathcal{E}_+(u)$ be the set of links $e$ such that for the routing game $(\mathcal{G}, a^{(u)}, b, \nu)$ the Lagrangian multiplier $\lambda_e^*(u)>0$. We assume that $\mathcal{E}_+(u)=\mathcal{E}_+$ for every $u$ in $\mathcal{U}$. \label{assumption} \end{assumption} Assumption~\ref{assumption} is not new in the literature \cite{steinberg1983prevalence,dafermos1984some}. We will get back to the assumption in Section~\ref{sec:assumption}. With a slight abuse of notation, from now on let $\mathcal{E}$ denote $\mathcal{E} \setminus \mathcal{E}_+$. We now define a mapping from the transportation network $\mathcal{G}$ to an associated resistor network $\mathcal{G}_R$. \begin{definition}[Associated resistor network] Given the transportation network $\mathcal{G}=(\mathcal{N},\mathcal{E})$, the \emph{associated resistor network} $\mathcal{G}_R=(\mathcal{N},\mathcal{L},W)$ is constructed as follows: \begin{itemize} \item the node set $\mathcal{N}$ is the same. \item $W \in \mathds{R}^{\mathrm{N} \times \mathrm{N}}$ is the conductance matrix, with elements \begin{equation} W_{ij}= \begin{cases} \sum_{\substack{e \in \mathcal{E}: \\ \xi(e)=i, \theta(e)=j, \ \text{or} \\ \xi(e)=j, \theta(e)=i}} \frac{1}{a_e} & \text{if}\ i \neq j \\ 0 & \text{if}\ i=j. \end{cases} \label{W} \end{equation} Note that $W$ is symmetric, thus $\mathcal{G}_R$ is undirected. The element $W_{ij}$ has to be interpreted as the conductance between nodes $i$ and $j$. \item Multiple links connecting the same pair of nodes are not allowed, hence every link $l$ in $\mathcal{L}$ can be identified by a unordered pair of nodes $\{i,j\}$, and the set $\mathcal{L}$ is uniquely determined by $W$. Let $\mathrm{L}$ denote the cardinality of $\mathcal{L}$. The mapping $M: \mathcal{E} \to \mathcal{L}$ associates to every link $e$ of the transportation network the corresponding link $l = M(e) = \{\xi(e),\theta(e)\}$ of the resistor network. Note by \eqref{W} that $M(e)$ belongs to $\mathcal{L}$ for every $e$ in $\mathcal{E}$. \end{itemize} \end{definition} Note that the coefficients $a_e$ correspond to resistances in the resistor networks. We let $w = W\mathbf{1}$ denote the degree distribution of the resistor network, and $w^* = \max_{i \in \mathcal{N}}w_i$ denote the maximal degree. Before establishing our first main result, we define two relevant quantities. \begin{definition} \label{def:voltage} Let $v \in \mathds{R}^\mathrm{N}$ be the \emph{voltage} vector on $\mathcal G_R$ when a net electrical current $m$ is injected from $\mathrm{o}$ to $\mathrm{d}$, i.e., $v$ is the unique solution of \begin{equation} \label{eq:voltage} \sum_{k \in \mathcal{N}} W_{hk}(v_h- v_k)=m(\delta^{(\mathrm{o})}-\delta^{(\mathrm{d})})\qquad \forall h\in\mathcal N. \end{equation} For a link $e$ in $\mathcal{E}$, let $y_e$ denote the \emph{electrical current} flowing from $\xi(e)$ to $\theta(e)$ on link $M(e)$ of $\mathcal G_R$, and let $\Delta v_e = v_{\xi(e)}-v_{\theta(e)}$. By Ohm's law, $\Delta v_e = a_e y_e$. \end{definition} \begin{definition} \label{def:effective} Let $\overline v \in \mathds{R}^\mathrm{N}$ be the voltage vector on $\mathcal G_R$ when a unitary current is injected from $i$ to $j$, i.e., \begin{equation} \label{eq:potential} \sum_{k \in \mathcal{N}} W_{hk}(\overline v_h- \overline v_k)=\delta^{(i)}-\delta^{(j)}\qquad \forall h\in\mathcal N. \end{equation} The \emph{effective resistance} $r_{l}$ of link $l = \{i,j\}$ in $\mathcal L$ is the effective resistance between $i$ and $j$, i.e., $r_{l}=\overline{v}_i-\overline{v}_j$. Given a link $e$ in $\mathcal E$, we denote by $r_e$ the effective resistance of link $M(e)$ of the associated resistor network. \end{definition} The next theorem establishes a relation between the social cost gain with a single-link intervention and the associated resistor network. \begin{theorem} Let $(\mathcal{G}, a, b, \nu)$ be an affine routing game, and let Assumption~\ref{assumption} hold. Then, \begin{equation} \Delta C^{(u_e \delta^{(e)})}=a_e f_e^*\frac{y_e}{\frac{1}{u_e}+\frac{r_e}{a_e}}. \label{el_form} \end{equation} \label{thm} \end{theorem} \begin{proof} See Appendix~\ref{app:proofs}. \end{proof} The ratio $r_{e}/a_e$ belongs to $(0,1]$ and is also known as \emph{spanning tree centrality}, which measures the fraction of spanning trees including link $M(e)$ among all spanning trees of the undirected network $\mathcal G_R$ \cite{hayashi2016efficient}. The spanning tree centrality of a link is maximized when removing the link disconnects the network. Theorem \ref{thm} states that the social cost variation due to intervention on link $e$ is: \begin{itemize} \item proportional to $a_e f_e^*$, which measures the delay at the equilibrium due to congestion on link $e$; \item decreasing in the spanning tree centrality. Intuitively speaking, the benefits of intervention on link $e$ is larger when the intervention modifies the equilibrium flows so that agents can move from paths not including $e$ to paths including $e$, namely when $f_e^*$ increases after the intervention. This phenomenon does not occur if $e$ is a bridge, i.e., if $r_{e}/a_e=1$, and occurs largely when many paths from $\xi(e)$ to $\theta(e)$ exist, i.e., when $r_{e}/a_e$ is small; \item proportional to the current $y_e$. The role of this term is more clear in the special case of linear delay functions. In this case $y_e = f_e^*$ for all links $e$ in $\mathcal{E} \setminus \mathcal E_+ $, hence $a_e f_e^* y_e^* = a_e (f_e^*)^2$, which is the total travel time on link $e$ before the intervention. \end{itemize} The idea behind the proof is that with affine delay functions the KKT conditions of the Wardrop equilibrium are linear, and under Assumption~\ref{assumption} single-link interventions are equivalent to rank-1 perturbations of the system. Thus, by Lemma~\ref{cost} we can compute the cost variation by looking at Lagrangian multiplier $\gamma_\mathrm{o}^*$, and then express such a variation in terms of electrical quantities. In order to solve Problem~\ref{prob1} by the electrical formulation, we need to compute \eqref{el_form} for every link $e$ in $\mathcal E$. The Wardrop equilibrium $f^*$ is assumed to be observable and therefore given. The voltage $v$ (and thus $y$) can be derived by solving the linear system \eqref{eq:voltage} and has to be computed only once. On the contrary, the computation of $r_{e}$ must be repeated for every link, hence it requires to solve $\mathrm{L}$ sparse linear systems. To reduce the computational effort, in Section~\ref{approximation} we shall propose a method to \textit{approximate} the effective resistance of a link that, under a suitable assumption on the sparseness of the network, does not scale with the network size, allowing for a more efficient solution to Problem~\ref{prob1}. The next result shows how to compute the derivative of the social cost variation for small interventions. \begin{corollary} Let $(\mathcal{G}, a, b, \nu)$ be a routing game, and assume that for every $i$ in $\mathcal E$ it holds either $f_i^*>0$ or $\lambda_i^*>0$. Then, $$ \frac{\partial \Delta C(u)}{\partial u_e}\Big|_{u = \mathbf{0}} = \begin{cases} a_e f_e^* y_e \quad & \text{if} \ \lambda_e^* = 0, \\ 0 & \text{if} \ \lambda_e^* > 0. \end{cases} $$ \end{corollary} \medskip \begin{proof} The fact that for every link $i$ it holds either $f_i^*>0$ or $\lambda_i^*>0$ implies that for infinitesimal interventions the support of $f^*$ is not modified. If $\lambda_e^*=0$, then $f_e^*$ and we can derive the social cost variation in \eqref{el_form} with respect to $u_e$. The case $\lambda_e^*>0$ follows from continuity arguments and from the complementary slackness condition, which implies that $f_e^*(u)=0$ in a neighborhood of $u = \mathbf{0}$. \end{proof} \begin{remark} Observe that the derivative of the social cost does not depend on the effective resistance of the link. \end{remark} \subsection{On the validity of Assumption~\ref{assumption}} \label{sec:assumption} In this section we discuss Assumption~\ref{assumption}. In particular, we show that the assumption is without loss of generality on series-parallel networks, if the throughput is sufficiently large. We first recall the definition of directed series-parallel networks, and then present the result in Proposition~\ref{sp_prp}. \begin{definition A directed network $\mathcal{G}$ is series-parallel if and only if (i) it is composed of two nodes only ($\mathrm{o}$ and $\mathrm{d}$), connected by single link from $\mathrm{o}$ to $\mathrm{d}$, or (ii) it is the result of connecting two directed series-parallel networks $\mathcal{G}_1$ and $\mathcal{G}_2$ in parallel, by merging $\mathrm{o}_1$ with $\mathrm{o}_2$ and $\mathrm{d}_1$ with $\mathrm{d}_2$, or (iii) it is the result of connecting two directed series-parallel networks $\mathcal{G}_1$ and $\mathcal{G}_2$ in series, by merging $\mathrm{d}_1$ with $\mathrm{o}_2$. \end{definition} \begin{proposition} \label{sp_prp} Let $(\mathcal{G}, a, b, \nu)$ be a routing game. If $\mathcal{G}$ is series-parallel, there exists $\overline{m}$ such that for every $m \ge \overline{m}$, $\mathcal{E}_+=\emptyset$. Furthermore, if $b=\mathbf{0}$, $\mathcal{E}_+=\emptyset$ for every $m >0$. \end{proposition} \begin{proof} See Appendix~\ref{app:proofs}. \end{proof} \begin{remark} Proposition~\ref{sp_prp} implies that Assumption~\ref{assumption} is without loss of generality on series-parallel networks if $m \ge \overline{m}$. \end{remark} The next example shows that, if the throughput is not sufficiently large, Assumption~\ref{assumption} may be violated. \begin{example} Consider the series-parallel network in Figure~\ref{wheatstone}. \begin{figure} \centering \begin{tikzpicture}[scale = 0.7] \node[draw, circle] (1) at (0,0) {o}; \node[draw, circle] (2) at (4,0) {d}; \path [->, >=latex] (1) edge [bend right=30] node [below] {$e_1$} (2); \path [->, >=latex] (1) edge [bend left=30] node [above] {$e_2$} (2); \end{tikzpicture} \caption{A directed series-parallel network. If the throughput is not sufficiently large, Assumption~\ref{assumption} is not guaranteed to hold.} \label{wheatstone} \end{figure} Let $m=1$, and consider affine delay functions $\tau_1(f_1)=f_1+1, \tau_2(f_2)=f_2+3/2$. One can verify that \begin{equation*} f_1^*=3/4, \quad f_2^*=1/4, \quad \lambda_1^*=\lambda_2^*=0. \end{equation*} Modifying $a_1$ from $1$ to $1/3$ (i.e., with $u=2\delta^{(1)}$), we get: \begin{equation*} f_1^*(u)=1, \quad f_2^*(u)=0, \quad \lambda_1^*(u)=0, \quad \lambda_2^*(u)=1/6, \end{equation*} violating Assumption~\ref{assumption}. Proposition~\ref{sp_prp} proves that this does not occur if $m$ is sufficiently large. \end{example} \section{An approximate solution to Problem 1} \label{approximation} As shown in the previous section, Problem~\ref{prob1} may be rephrased in terms of electrical quantities over a related resistor network. Solving the NDP problem in this formulation requires to solve $\mathrm{L}$ linear systems whose dimension scales linearly with $\mathrm{N}$. Since the voltage $v$ may be computed in quasi-linear time by solving the sparse linear system \eqref{eq:voltage} (see \cite{cohen2014solving} for more details), the computational bottleneck is given by the computation of the effective resistance of every link of the resistor network. The main idea of our method is that, although the effective resistance of a link depends on the entire network, it can be approximate by looking at a local portion of the network only. We then formulate an algorithm to solve Problem~\ref{prob1} by exploiting our approximation method. \subsection{Approximating the effective resistance} \label{method} We introduce the following operations on resistor networks. \begin{definition}[Cutting at distance $d$] \label{def:cutting} A resistor network $\mathcal{G}_R$ is cut at distance $d$ from link $l = \{i,j\}$ in $\mathcal{L}$ if every node at distance greater than $d$ from link $l$ (i.e., from both $i$ and $j$) is removed, and every link with at least one endpoint in the set of the removed nodes is removed. Let $\mathcal{G}^{U_{d}}_{l}$ and $r_{l}^{U_d}$ denote such a network and the effective resistance of link $l$ on it, respectively. \end{definition} \begin{definition}[Shorting at distance $d$] A resistor network $\mathcal{G}_R$ is shorted at distance $d$ from $l$ in $\mathcal{L}$ if all the nodes at distance greater than $d$ from link $l$ are shorted together, i.e., an infinite conductance is added between each pair of such nodes. Let $\mathcal{G}^{L_{d}}_{l}$ and $r_{l}^{L_d}$ denote such a network and the effective resistance of link $l$ on it, respectively. \end{definition} We refer to Figure~\ref{quad} for an example of these techniques applied to a regular grid. We next prove that $r^{U_d}_{l}$ and $r^{L_d}_{l}$ are respectively an upper and a lower bound for the effective resistance $r_{l}$ for every link $l$. To this end, let us introduce Rayleigh's monotonicity laws. \begin{figure} \centering \begin{tikzpicture}[scale=0.7, transform shape] \node[draw,fill=green] (1) at (0,0) {}; \node[draw,fill=green] (2) at (1,0) {}; \node[draw,fill=yellow] (3) at (-1,0) {}; \node[draw,fill=yellow] (4) at (0,1) {}; \node[draw,fill=yellow] (5) at (1,1) {}; \node[draw,fill=yellow] (6) at (2,0) {}; \node[draw,fill=yellow] (7) at (1,-1) {}; \node[draw,fill=yellow] (8) at (0,-1) {}; \node[draw,fill=orange] (9) at (-2,0) {}; \node[draw,fill=orange] (10) at (-1,1) {}; \node[draw,fill=orange] (11) at (0,2) {}; \node[draw,fill=orange] (12) at (1,2) {}; \node[draw,fill=orange] (13) at (2,1) {}; \node[draw,fill=orange] (14) at (3,0) {}; \node[draw,fill=orange] (15) at (2,-1) {}; \node[draw,fill=orange] (16) at (1,-2) {}; \node[draw,fill=orange] (17) at (0,-2) {}; \node[draw,fill=orange] (18) at (-1,-1) {}; \node[draw,fill=red] (19) at (-3,0) {}; \node[draw,fill=red] (20) at (-2,1) {}; \node[draw,fill=red] (21) at (-1,2) {}; \node[draw,fill=red] (22) at (0,3) {}; \node[draw,fill=red] (23) at (1,3) {}; \node[draw,fill=red] (24) at (2,2) {}; \node[draw,fill=red] (25) at (3,1) {}; \node[draw,fill=red] (26) at (4,0) {}; \node[draw,fill=red] (27) at (3,-1) {}; \node[draw,fill=red] (28) at (2,-2) {}; \node[draw,fill=red] (29) at (1,-3) {}; \node[draw,fill=red] (30) at (0,-3) {}; \node[draw,fill=red] (31) at (-1,-2) {}; \node[draw,fill=red] (32) at (-2,-1) {}; \node[draw,fill=none] (33) at (-3,1) {}; \node[draw,fill=none] (34) at (-2,2) {}; \node[draw,fill=none] (35) at (-1,3) {}; \node[draw,fill=none] (36) at (2,3) {}; \node[draw,fill=none] (37) at (3,2) {}; \node[draw,fill=none] (38) at (4,1) {}; \node[draw,fill=none] (39) at (4,-1) {}; \node[draw,fill=none] (40) at (3,-2) {}; \node[draw,fill=none] (41) at (2,-3) {}; \node[draw,fill=none] (42) at (-1,-3) {}; \node[draw,fill=none] (43) at (-2,-2) {}; \node[draw,fill=none] (44) at (-3,-1) {}; \node[draw,fill=none] (45) at (-3,2) {}; \node[draw,fill=none] (46) at (-2,3) {}; \node[draw,fill=none] (47) at (3,3) {}; \node[draw,fill=none] (48) at (4,2) {}; \node[draw,fill=none] (49) at (4,-2) {}; \node[draw,fill=none] (50) at (3,-3) {}; \node[draw,fill=none] (51) at (-2,-3) {}; \node[draw,fill=none] (52) at (-3,-2) {}; \node[draw,fill=none] (53) at (-3,3) {}; \node[draw,fill=none] (54) at (4,3) {}; \node[draw,fill=none] (55) at (4,-3) {}; \node[draw,fill=none] (56) at (-3,-3) {}; \path (1) edge node [above] {$l$} (2); \path (1) edge (3); \path (1) edge (4); \path (1) edge (8); \path (2) edge (5); \path (2) edge (6); \path (2) edge (7); \path (4) edge (5); \path (7) edge (8); \path (3) edge (9); \path (3) edge (10); \path (10) edge (4); \path (4) edge (11); \path (5) edge (12); \path (11) edge (12); \path (3) edge (9); \path (3) edge (10); \path (10) edge (4); \path (5) edge (13); \path (6) edge (13); \path (6) edge (14); \path (6) edge (15); \path (15) edge (7); \path (16) edge (7); \path (16) edge (17); \path (8) edge (17); \path (8) edge (18); \path (3) edge (18); \path (19) edge (9); \path (9) edge (20); \path (10) edge (20); \path (10) edge (21); \path (11) edge (21); \path (11) edge (22); \path (22) edge (23); \path (12) edge (23); \path (12) edge (24); \path (24) edge (13); \path (25) edge (13); \path (25) edge (14); \path (26) edge (14); \path (27) edge (14); \path (15) edge (28); \path (15) edge (27); \path (16) edge (28); \path (16) edge (29); \path (29) edge (30); \path (17) edge (30); \path (17) edge (31); \path (31) edge (18); \path (32) edge (9); \path (32) edge (18); \path (53) edge (46); \path (46) edge (35); \path (35) edge (22); \path (23) edge (36); \path (36) edge (47); \path (47) edge (54); \path (45) edge (34); \path (34) edge (21); \path (24) edge (37); \path (37) edge (48); \path (33) edge (20); \path (25) edge (38); \path (44) edge (32); \path (27) edge (39); \path (52) edge (43); \path (43) edge (31); \path (28) edge (40); \path (40) edge (49); \path (56) edge (51); \path (51) edge (42); \path (42) edge (30); \path (29) edge (41); \path (41) edge (50); \path (50) edge (55); \path (53) edge (45); \path (46) edge (34); \path (35) edge (21); \path (24) edge (36); \path (37) edge (47); \path (48) edge (54); \path (45) edge (33); \path (34) edge (20); \path (25) edge (37); \path (38) edge (48); \path (33) edge (19); \path (26) edge (38); \path (44) edge (19); \path (26) edge (39); \path (52) edge (44); \path (43) edge (32); \path (27) edge (40); \path (39) edge (49); \path (56) edge (52); \path (51) edge (43); \path (42) edge (31); \path (28) edge (41); \path (40) edge (50); \path (49) edge (55); \end{tikzpicture} \vspace{0.3cm} \\ \centering{$\mathcal{G}_{l}^{U_1}$ \hspace{2.6cm} $\mathcal{G}_{l}^{L_1}$} \\ \vspace{0.2cm} \centering \begin{tikzpicture}[scale=0.85, transform shape] \node[draw,fill=green] (1) at (0,0) {}; \node[draw,fill=green] (2) at (1,0) {}; \node[draw,fill=yellow] (3) at (-1,0) {}; \node[draw,fill=yellow] (4) at (0,1) {}; \node[draw,fill=yellow] (5) at (1,1) {}; \node[draw,fill=yellow] (6) at (2,0) {}; \node[draw,fill=yellow] (7) at (1,-1) {}; \node[draw,fill=yellow] (8) at (0,-1) {}; \path (1) edge node [above] {$l$} (2); \path (1) edge (3); \path (1) edge (4); \path (1) edge (8); \path (2) edge (5); \path (2) edge (6); \path (2) edge (7); \path (4) edge (5); \path (7) edge (8); \end{tikzpicture} \quad \begin{tikzpicture}[scale=0.65, transform shape] \node[draw,fill=green] (1) at (0,0) {}; \node[draw,fill=green] (2) at (1,0) {}; \node[draw,fill=yellow] (3) at (-1,0) {}; \node[draw,fill=yellow] (4) at (0,1) {}; \node[draw,fill=yellow] (5) at (1,1) {}; \node[draw,fill=yellow] (6) at (2,0) {}; \node[draw,fill=yellow] (7) at (1,-1) {}; \node[draw,fill=yellow] (8) at (0,-1) {}; \node[draw,fill=orange] (9) at (0.5,2) {s}; \path (1) edge node [above] {$l$} (2); \path (1) edge (3); \path (1) edge (4); \path (1) edge (8); \path (2) edge (5); \path (2) edge (6); \path (2) edge (7); \path (4) edge (5); \path (7) edge (8); \path (4) edge [bend right=0] node [below] {} (9); \path (5) edge [bend right=0] node [below] {} (9); \path (3) edge [bend right=-20] node [below] {} (9); \path (6) edge [bend right=20] node [below] {} (9); \coordinate (ghost) at (3, 0); \coordinate (ghost2) at (-2,0); \draw[-] (7) to[out=0, in=-90] (ghost) to[out=90, in=0] (9); \draw[-] (8) to[out=180, in=-90] (ghost2) to[out=90, in=180] (9); \end{tikzpicture} \caption{Square grid. \emph{Above}: the yellow, orange and red nodes are at distance $1$, $2$ and $3$, respectively from the green nodes. \emph{Bottom-left}: the grid cut at distance $1$ from link $l$. \emph{Bottom-right}: the grid shorted at distance $1$ from link $l$. Note that in the bottom right network the links connecting yellow nodes with node $s$ do not have unitary weights.} \label{quad} \end{figure} \begin{lemma}[Rayleigh's monotonicity laws \cite{levin2017markov}] If the resistances of one or more links are increased, the effective resistance between two arbitrary nodes cannot decrease. If the resistances of one or more links are decreased, the effective resistance cannot increase. \label{ray} \end{lemma} \begin{proposition} \label{prp_ray} Let $\mathcal{G}_R$ be a resistor network. For every link $l=\{i,j\}$ in $\mathcal{L}$, \begin{equation*} \label{bounds} r^{U_{d_1}}_{l}\ge r^{U_{d_2}}_{l} \ge r_{l} \ge r^{L_{d_2}}_{l} \ge r^{L_{d_1}}_{l}, \quad \forall d_2 \ge d_1 \ge 1. \end{equation*} Moreover, \begin{equation} 1/w^* \le r^{L_d}_{l}\le r^{U_d}_{l} \le 1/W_{ij}, \quad \forall d \ge 1. \label{remark} \end{equation} \end{proposition}\medskip \begin{proof} Cutting a network at distance $d$ is equivalent to setting to infinity the resistance of all the links with at least one endpoint at distance greater than $d$. Shorting a network at distance $d$ is equivalent to setting to zero the resistance between any pair of nodes at distance greater than $d$. Then, by Rayleigh's monotonicity laws, it follows $r^{U_d}_{l}\ge r_{l} \ge r^{L_d}_{l}$. Similar arguments may be used to show that, if $d_1<d_2$, then $r^{U_{d_1}}_{l} \ge r^{U_{d_2}}_{l}$ and $r^{L_{d_1}}_{l} \le r^{L_{d_2}}_{l}$. The right inequality in \eqref{remark} follows from Rayleigh's monotonicity laws, by noticing that the effective resistance computed in the network with only nodes $i$ and $j$ (which is equal to $1/W_{ij}$) is an upper bound for $r_{l}^{U_{1}}$. The left inequality follows from noticing that the effective resistance on the network in which every node except $i$ is shorted with $j$, which results in a network with only two nodes and a conductance between $i$ and $j$ not greater than $w^*$ (hence, resistance no less than $1/w^*$) is a lower bound of $r^{L_1}_{l}$. \end{proof} Proposition~\ref{prp_ray} states that cutting and shorting a network provides upper and lower bound for the effective resistance of a link. Moreover, the bound gap is a monotone function of the distance $d$. \subsection{Our algorithm} We here propose an algorithm to solve in approximation Problem~\ref{prob1} based on our method for approximating the effective resistance. Our approach is detailed in Algorithm 1. \begin{algorithm} \SetAlgoNoLine \KwIn{The affine routing game $(\mathcal{G},a,b,\nu)$, the cost functions $\{h_e\}_{e \in \mathcal{E}}$, and the distance $d\ge1$ for effective resistance approximation.} \KwOut{The optimal intervention $u^{*d}$.} Construct the associated resistor network $\mathcal{G}_R$.\\ Compute $v$ and $y$ by solving \eqref{eq:voltage}.\\ \For{every $l$ in $\mathcal{L}$} {Construct $\mathcal{G}_{l}^{U_d}$ and $\mathcal{G}_{l}^{L_d}$. \\ Compute $r_{l}^{U_d}$ and $r_{l}^{L_d}$ on $\mathcal{G}_{l}^{U_d}$ and $\mathcal{G}_{l}^{L_d}$.} \For{every $e$ in $\mathcal{E}$} {Find $u_e^{*d}$ such that \begin{equation} \label{step1alg} \begin{aligned} u_e^{*d} \in \ & \underset{u_e \ge 0} {\argmax} & & a_e f_e^* \frac{y_e}{\frac{1}{u_e}+\frac{r_e^{U_d}+r_e^{L_d}}{2a_e}} - \alpha h_e(u_e). \end{aligned} \end{equation}} Find $e^{*d}$ such that \begin{equation} \begin{aligned} e^{*d} \in \ & \underset{e \in \mathcal{E}} {\argmax} & & a_e f_e^*\frac{y_e}{\frac{1}{u_e^{*d}}+\frac{r_e^{U_d}+r_e^{L_d}}{2a_e}} - \alpha h_e(u_e^{*d}). \end{aligned} \label{step2alg} \end{equation} \caption{} \label{alg} The optimal intervention is $u^{*d} = u_e^{*d} \delta^{(e^{*d})}$. \end{algorithm} Notice that the performance of Algorithm 1 depends on the choice of the parameter $d$. Specifically, the higher $d$ is the better is the approximation of the social cost variation. \begin{theorem} \label{thm2} Let $\Delta C^{(u)}$ be the social cost gain corresponding to intervention $u = u_e \delta^{(e)}$ as given in Theorem~\ref{thm}, and $$ \Delta C_d^{(u)}=a_ef_e^*\frac{y_e}{\frac{1}{u_e}+\frac{r_e^{U_d}+r_{e}^{L_d}}{2a_e}}$$ be the social cost gain estimated by Algorithm~\ref{alg} for a given distance $d\ge 1$. Then, \begin{equation*} \begin{aligned} \bigg|\frac{\Delta C^{(u)}-\Delta C_d^{(u)}}{\Delta C^{(u)}}\bigg| &\le \frac{\epsilon_{ed}}{2\Big(\frac{1}{u_e}+\frac{r_e^{U_d}+r_e^{L_d}}{2a_e}\Big)} \\ &\le \frac{\epsilon_{ed}}{2\Big(\frac{1}{u_e}+\frac{1}{w^* \cdot a_e}\Big)}, \label{err_rel2} \end{aligned} \end{equation*} where \begin{equation*} \label{epsilon} \epsilon_{ed}:= \frac{r_e^{U_d}-r_e^{L_d}}{a_e}. \end{equation*} Furthermore, \begin{equation} \Delta C^{(u)} \ge a_e f_e^* \frac{y_e}{\frac{1}{u_e}+\frac{r_e^{U_d}}{a_e}}. \label{min_gain} \end{equation} \end{theorem}\medskip \begin{proof} See Appendix~\ref{app:proofs}. \end{proof} In the next section we provide sufficient conditions for $\epsilon_{ed}$ to vanish for large distance $d$ in the limit of infinite networks. In the rest of this section we show that the bound gap (and therefore $\epsilon_{ed}$) and the computational complexity of the bounds (for a fixed $d$) depend only on the local structure around link $M(e)$ of the resistor network, and do not scale with the network size, under the following assumption. \begin{assumption} \label{sparse} Let $\mathcal{G}_R$ be the resistor network corresponding to the transportation network $\mathcal{G}$. Let $l \in \mathcal L$ be an arbitrary link of $\mathcal{G}_R$, and $\mathcal{N}_{\le d}$ denote the set of nodes that are at distance no greater than $d$ from link $l$. We assume that the network $\mathcal{G}$ is sparse in such a way that the cardinality of $\mathcal{N}_{\le d}$ does not depend on $\mathrm{N}$ for any $d$. \end{assumption} Assumption~\ref{sparse} is suitable for transportation networks, because of physical constraints not allowing for the degree of the nodes to grow unlimitedly (think for instance of planar grids, where the degree of the nodes is given no matter what the size of the network is, and the local structure of the network around an arbitrary node does not depend on the network size $\mathrm{N}$). Notice also that, under Assumption~\ref{sparse}, $\mathrm{N}$ and $\mathrm{L}$ are proportional. \begin{proposition} Let $\mathcal{G}_R=(\mathcal{N},\mathcal{L},W)$ be a resistor network, $l = \{i,j\}$ in $\mathcal{L}$, and $d \ge 1$. Then, $r_l^{U_d}$ and $r_l^{L_d}$, and their computational complexity, depend only on the structure of $\mathcal{G}_R$ within distance $d+1$ from $i$ and $j$ only. Furthermore, under Assumption~\ref{sparse} they do not depend on $\mathrm{N}$. \label{speed} \end{proposition} \begin{proof} See Appendix~\ref{app:proofs}. \end{proof} \begin{remark} To the best of our knowledge, the complexity of the most efficient algorithm to compute the spanning tree centrality (or effective resistance) of a link in large networks scales with the number of links \cite{hayashi2016efficient}. On the contrary, Proposition~\ref{speed} states that under Assumption~\ref{sparse} the computational time for approximating a single effective resistance does not scale with $\mathrm{N}$. Therefore, approximating all the effective resistances requires a computational time linear in $\mathrm{N}$. Observe that $v$ (and thus $y$) is computed via a diagonally dominant, symmetric and positive definite linear systems. The design of fast algorithms to solve this class of problem is an active field of research in the last years. To the best of our knowledge, the best algorithm has been provided in \cite{cohen2014solving} and has complexity $O(M \log^k \mathrm{N} \log \mathrm{1/\epsilon})$, where $\epsilon$ is the tolerance error, $k$ is a constant, and $M$ is the number of non-zero elements in the matrix of the linear system. Since in our case $M$ scales with $\mathrm{L}$, and since $\mathrm{L}$ scales with $\mathrm{N}$ under Assumption~\ref{sparse}, Algorithm~\ref{alg} is quasilinear in $\mathrm{N}$. Step \eqref{step1alg} consists in maximizing a function of one variable. Finally, step \eqref{step2alg} consists in taking the maximum of $\mathrm{E}$ numbers. \end{remark} \section{Bound analysis} \label{performance} In this section we characterize the gap between the bounds on the effective resistance of a link in terms of random walks over the resistor networks $\mathcal{G}_R$, $\mathcal{G}_{l}^{U_d}$ and $\mathcal{G}_{l}^{L_d}$. We then leverage this characterization to provide a sufficient condition on the network under which the bound gap vanishes asymptotically for large distance $d$. To this end, we interpret the conductance matrix $W$ of the resistor network as the transition rates of continuous-time Markov chain whose state space is the node set of the network, and introduce the following notation. Let: \begin{itemize} \item $T_\mathcal{S}$ and $T_\mathcal{S}^+$ denote the hitting time (i.e., the first time $t\ge0$ such that the random walk hits the set $\mathcal{S} \in \mathcal{N}$), and the return time (i.e., the first time $t>0$ such that the random walk hits the set $\mathcal{S}$), respectively. \item $\mathcal{N}_d$ denote the set of the nodes that are at distance $d$ from link $l = \{i,j\}$, i.e., at distance $d$ from $i$ (or $j$) and at distance greater or equal than $d$ from $j$ (or $i$). Index $l$ is omitted for simplicity of notation. \item $p_k(X)$, $p_k^{U_d}(X)$ and $p_k^{L_d}(X)$, denote the probability that event $X$ occurs, conditioned on the fact that the random walk starts in $k$ at time $0$ and evolves over the resistor networks $\mathcal{G}_R$, $\mathcal{G}_{l}^{U_d}$ and $\mathcal{G}_{l}^{L_d}$, respectively. \end{itemize} The next result provides a characterization of the bound gap in terms of random walks over $\mathcal{G}_R$, $\mathcal{G}_{l}^{U_d}$ and $\mathcal{G}_{l}^{L_d}$. \begin{proposition} \label{gap} Let $\mathcal{G}_R=(\mathcal{N},\mathcal{L},W)$ be a resistor network. For every link $l = \{i,j\}$ in $\mathcal{L}$, \begin{equation} \begin{aligned} r^{U_d}_{l}-r^{L_d}_{l} & \le \frac{w_{i}}{(W_{ij})^2} \underbrace{p_i(T_{\mathcal{N}_d} < T_j)}_{\text{Term 1}} \ \cdot \\ & \cdot \underset{g \in \mathcal{N}_d}{ \max} \underbrace{\big(p^{U_d}_g(T_i < T_j)-p^{L_d}_g(T_i < T_j)\big)}_{\text{Term 2}}, \end{aligned} \label{equat_gap} \end{equation} where the quantities in \eqref{equat_gap} are computed with respect to the continuous-time Markov chain with transition rates $W$. \end{proposition} \begin{proof} See Appendix~\ref{app:proofs}. \end{proof} In the next sections we shall use this result to analyze the asymptotic behaviour of the bound gap for an arbitrary link $l$ in $\mathcal{L}$ as $d \to +\infty$, for networks whose node set is infinite and countable. In particular, we show in Section~\ref{rec_sec} that this error vanishes asymptotically for the class of recurrent networks. The core idea to prove this result is to show that Term 1 vanishes. To generalize our analysis beyond recurrent networks, in Section~\ref{beyond} we study both Term 1 and 2 and provide examples showing that all combinations in Table~\ref{table_bounds} are possible. In particular, it is possible that the bound gap vanishes asymptotically for non-recurrent networks (for which Term 1 $\nrightarrow 0$, see \cite[Section 21.2]{levin2017markov}) if Term 2 $\rightarrow 0$. \begin{table} \caption{All the four cases are possible, as shown in Section~\ref{beyond}. Term 1 $\rightarrow 0$ under the assumption that the network is recurrent, as proved in Section~\ref{rec_sec}. \label{table_bounds}} \centering \begin{tabular}{lll} & Term 2 $\rightarrow 0$ & Term 2 $\nrightarrow 0$ \\ \hline Term 1 $\rightarrow 0$ & 2d grid & Ring \\ Term 1 $\nrightarrow 0$ & 3d grid & Double tree\\ \hline \end{tabular} \end{table} \subsection{Recurrent networks} \label{rec_sec} We start by introducing the class of recurrent networks. \begin{definition}[Recurrent random walk] A random walk is recurrent if, for every starting point, it visits its starting node infinitely often with probability one \cite[Section 21.1]{levin2017markov}. \end{definition} \begin{definition}[Recurrent network] An infinite resistor network $\mathcal{G}_R=(\mathcal{N},\mathcal{L}, W)$ is recurrent if the random walk on the network is recurrent. \end{definition} The next theorem states that the bound gap vanishes asymptotically on recurrent networks if the degree of every node is finite. Note that the boundedness of the degree of all the nodes is guaranteed under Assumption~\ref{sparse}. \begin{theorem} Let $\mathcal{G}_R=(\mathcal{N},\mathcal{L},W)$ be an infinite recurrent resistor network, and let $w^*<+\infty$. Then, for every $l$ in $\mathcal{L}$, \begin{equation*} \lim_{d \rightarrow +\infty} (r^{U_d}_{l}-r^{L_d}_{l})=0, \end{equation*} \label{recurrent} \end{theorem} \begin{proof} It is proved in \cite[Proposition 21.3]{levin2017markov} that a network is recurrent if and only if \begin{equation} \lim_{d \rightarrow +\infty}p_i(T_{\mathcal{N}_d}<T_j)=0 \quad \forall l=\{i,j\} \in \mathcal{L}. \label{lim_rec2} \end{equation} Observe that, to hit any node in $\mathcal{N}_{d+1}$, the random walk starting from $i$ has to hit at least one node in $\mathcal{N}_d$. Hence, the sequence $\big\{p_i(T_{\mathcal{N}_d}<T_j)\big\}_{d=1}^\infty$ is non-increasing in $d$ and the limit in \eqref{lim_rec2} is well defined. Then, from \eqref{equat_gap}, \eqref{lim_rec2}, from the fact that $0 \le p^{U_d}_g(T_i < T_j)-p^{L_d}_g(T_i < T_j)\le1$ for every node $g$, and from the assumptions $w^* < +\infty$ and $W_{ij}>0$ (recall that $i$ and $j$ are adjacent nodes), it follows \begin{equation*} \lim_{d \rightarrow +\infty} r^{U_d}_{l}-r^{L_d}_{l}\le \frac{w^*}{(W_{ij})^2} \lim_{d \rightarrow +\infty} p_i(T_{\mathcal{N}_d}<T_j) = 0, \end{equation*} which completes the proof. \end{proof} \begin{corollary} Let $\mathcal{G}$ be a transportation network with recurrent associated resistor network $\mathcal{G}_R$. Then, for every $u$ in $\mathcal{U}$, $$ \lim_{d \to + \infty}\bigg|\frac{\Delta C^{(u)}-\Delta C_d^{(u)}}{\Delta C^{(u)}}\bigg|=0. $$ \end{corollary}\medskip \begin{proof} The proof follows from Theorem~\ref{thm2} and Theorem~\ref{recurrent}, which imply $\lim_{d \rightarrow +\infty} \epsilon_{ed}=0$ for every $e$ in $\mathcal{E}$. \end{proof} Recurrence is a sufficient condition for the approximation error of a link effective resistance to vanish asymptotically, but is not necessary, as discussed in the next section. \subsection{Beyond recurrence} \label{beyond} We here provide examples of infinite resistor networks for all of the cases in Table~\ref{table_bounds}. Observe that, for every link $l = \{i,j\}$ in $\mathcal{L}$, the network cut at distance $d$ from $l$ and the network shorted at distance $d$ from $l$ differ for one node only (denoted by $s$), which is the result of shorting in a unique node all the nodes at distance greater than $d$ from $l$. Intuitively speaking, our conjecture is that Term 2 in \eqref{equat_gap} is small when the network has many short paths. In this case, adding the node $s$ leads to a small variation of the probability, starting from any node in $\mathcal{N}_d$, of hitting $i$ before $j$, thus making Term 2 small. This intuition can be clarified with the next examples. \subsubsection{2d grid} Consider an infinite unweighted bidimensional grid as in Figure~\ref{quad3}. This network is very relevant for NDPs, since many transportation networks have similar topologies. The network is known to be recurrent \cite[Example 21.8]{levin2017markov}, hence Theorem~\ref{recurrent} guarantees that Term 1 vanishes asymptotically for every link $l = \{i,j\}$. Our conjecture, confirmed by numerical simulations, is that for every node $g$ in $\mathcal{N}_d$, \begin{equation*} \begin{gathered} \lim_{d \rightarrow +\infty} p^{U_d}_g(T_i < T_j) = 1/2, \quad \lim_{d \rightarrow +\infty} p^{L_d}_g(T_i < T_j) = 1/2. \end{gathered} \end{equation*} Hence, this is recurrent network for which also Term 2 vanishes asymptotically. \subsubsection{3d grid} Consider an infinite unweighted tridimensional grid. This network is not recurrent \cite[Example 21.9]{levin2017markov}, therefore Term 1 does not vanish asymptotically, and we cannot conclude from Theorem~\ref{recurrent} that for every $l = \{i,j\}$ the bound gap vanishes asymptotically. Nonetheless, numerical simulations show that, similarly to the bidimensional grid, for every node $g$ in $\mathcal{N}_d$, \begin{equation*} \begin{gathered} \lim_{d \rightarrow +\infty} p^{U_d}_g(T_i < T_j) = 1/2, \quad \lim_{d \rightarrow +\infty} p^{L_d}_g(T_i < T_j) = 1/2. \end{gathered} \end{equation*} Hence, this is a non-recurrent network for which Term 2 (and therefore the bound gap $r_l^{U_d}-r_l^{L_d}$) vanishes asymptotically in the limit of infinite distance $d$. \subsubsection{Ring} Consider an infinite unweighted ring network, and let us focus on nodes $5$ and $6$ in Figure~\ref{upper_lower_ring}. Then, \begin{equation*} \begin{gathered} p^{U_d}_{5}(T_1 < T_2)=1, \quad p^{U_d}_6(T_1 < T_2)=0. \end{gathered} \end{equation*} for each $d$ (even $d \rightarrow + \infty$), whereas, \begin{equation*} \begin{gathered} p^{L_d}_5(T_1 < T_2)=\frac{d}{2d+1} \xrightarrow[d \rightarrow + \infty]{} \frac{1}{2}, \\ p^{L_d}_5(T_1 < T_2)=\frac{d+1}{2d+1} \xrightarrow[d \rightarrow + \infty]{} \frac{1}{2}, \end{gathered} \end{equation*} since this case is equivalent to the gambler's ruin problem (see \cite[Proposition 2.1]{levin2017markov}). Hence, Term 2 does not vanish for the ring. This is due to the fact that all the paths from $5$ to $2$ in $\mathcal G_l^{L_2}$ not including node $1$ include the node $s$. Still, Term 1 (and thus the bound gap $r_l^{U_d}-r_l^{L_d}$) vanishes asymptotically by Theorem~\ref{recurrent}, because the ring network is recurrent. \begin{figure} \centering \begin{tikzpicture}[scale=0.65, transform shape] \node[draw,fill=green] (1) at (0,0) {i}; \node[draw,fill=green] (2) at (1,0) {j}; \node[draw,fill=none] (3) at (-1,0) {}; \node[draw,fill=none] (4) at (0,1) {}; \node[draw,fill=none] (5) at (1,1) {}; \node[draw,fill=none] (6) at (2,0) {}; \node[draw,fill=none] (7) at (1,-1) {}; \node[draw,fill=none] (8) at (0,-1) {}; \node[draw,fill=none] (9) at (-2,0) {}; \node[draw,fill=none] (10) at (-1,1) {}; \node[draw,fill=none] (11) at (0,2) {}; \node[draw,fill=none] (12) at (1,2) {}; \node[draw,fill=none] (13) at (2,1) {}; \node[draw,fill=none] (14) at (3,0) {}; \node[draw,fill=none] (15) at (2,-1) {}; \node[draw,fill=none] (16) at (1,-2) {}; \node[draw,fill=none] (17) at (0,-2) {}; \node[draw,fill=none] (18) at (-1,-1) {}; \node[draw,fill=red] (19) at (-3,0) {}; \node[draw,fill=red] (20) at (-2,1) {}; \node[draw,fill=red] (21) at (-1,2) {}; \node[draw,fill=red] (22) at (0,3) {}; \node[draw,fill=red] (23) at (1,3) {}; \node[draw,fill=red] (24) at (2,2) {}; \node[draw,fill=red] (25) at (3,1) {}; \node[draw,fill=red] (26) at (4,0) {}; \node[draw,fill=red] (27) at (3,-1) {}; \node[draw,fill=red] (28) at (2,-2) {}; \node[draw,fill=red] (29) at (1,-3) {}; \node[draw,fill=red] (30) at (0,-3) {}; \node[draw,fill=red] (31) at (-1,-2) {}; \node[draw,fill=red] (32) at (-2,-1) {}; \path (1) edge (2); \path (1) edge (3); \path (1) edge (4); \path (1) edge (8); \path (2) edge (5); \path (2) edge (6); \path (2) edge (7); \path (3) edge (9); \path (3) edge (10); \path (10) edge (4); \path (4) edge (11); \path (4) edge (5); \path (5) edge (12); \path (11) edge (12); \path (3) edge (9); \path (3) edge (10); \path (10) edge (4); \path (5) edge (13); \path (6) edge (13); \path (6) edge (14); \path (6) edge (15); \path (15) edge (7); \path (16) edge (7); \path (16) edge (17); \path (8) edge (17); \path (8) edge (18); \path (7) edge (8); \path (3) edge (18); \path (19) edge (9); \path (9) edge (20); \path (10) edge (20); \path (10) edge (21); \path (11) edge (21); \path (11) edge (22); \path (22) edge (23); \path (12) edge (23); \path (12) edge (24); \path (24) edge (13); \path (25) edge (13); \path (25) edge (14); \path (26) edge (14); \path (27) edge (14); \path (15) edge (28); \path (15) edge (27); \path (16) edge (28); \path (16) edge (29); \path (29) edge (30); \path (17) edge (30); \path (17) edge (31); \path (31) edge (18); \path (32) edge (9); \path (32) edge (18); \end{tikzpicture} \caption{Bidimensional square grid, cut at distance $d=3$ from $l=\{i,j\}$. The red nodes belong to $\mathcal{N}_d$. As $d$ increases, $p_g(T_1 < T_2)$ approaches $1/2$ for every node $g$ in $\mathcal{N}_d$. \label{quad3}} \end{figure} \begin{figure} \centering{\hspace{0.6cm} $\mathcal{G}_{l}^{U_2}$ \hspace{1.8cm} $\mathcal{G}_{l}^{L_2}$}\\ \vspace{0.2cm} \begin{tikzpicture}[scale=0.75, transform shape] \node[draw, circle, fill=green] (1) at (-1,0) {$1$}; \node[draw, circle, fill=green] (2) at (1,0) {$2$}; \node[draw, circle] (3) at (-1,1) {$3$}; \node[draw, circle] (4) at (1,1) {$4$}; \node[draw, circle, fill=red] (5) at (-1,2) {$5$}; \node[draw, circle, fill=red] (6) at (1,2) {$6$};; \path (1) edge [bend right=0] node [above] {$l$} (2); \path (1) edge [bend right=0] node [above] {} (3); \path (2) edge [bend left=0] node [above] {} (4); \path (3) edge [bend right=0] node [above] {} (5); \path (4) edge [bend right=0] node [below] {} (6); \end{tikzpicture} \qquad \begin{tikzpicture}[scale=0.56, transform shape] \node[draw, circle, fill=green] (1) at (-1,0) {$1$}; \node[draw, circle, fill=green] (2) at (1,0) {$2$}; \node[draw, circle] (3) at (-1,1) {$3$}; \node[draw, circle] (4) at (1,1) {$4$}; \node[draw, circle, fill=red] (5) at (-1,2) {$5$}; \node[draw, circle, fill=red] (6) at (1,2) {$6$}; \node[draw, circle] (7) at (0,3) {$s$}; \path (1) edge [bend right=0] node [above] {$l$} (2); \path (1) edge [bend right=0] node [above] {} (3); \path (2) edge [bend left=0] node [above] {} (4); \path (3) edge [bend right=0] node [above] {} (5); \path (4) edge [bend right=0] node [below] {} (6); \path (5) edge [bend left=0] node [below] {} (7); \path (6) edge [bend left=0] node [below] {} (7); \end{tikzpicture} \caption{\emph{Left}: ring cut at distance $d=2$ from $l$. \emph{Right}: ring shorted at distance $d=2$ from link $l=\{1,2\}$.} \label{upper_lower_ring} \end{figure} \subsubsection{Double tree network} \label{section_tree} The last examples illustrates an infinitely large network in which the bound gap does not vanish asymptotically. This network is not relevant for traffic applications, since it admits one path only between every pair of nodes, but provides an interesting counterexample where the bound gap does not converge asymptotically. The network is composed of two infinite trees starting from node $i$ and $j$, connected by a link $l = \{i,j\}$ (see Figure~\ref{counterex}), and is unweighted. It can be shown that on this network the probability that a random walk, starting from $i$, returns on $i$ is equal to the same quantity computed on a biased random walk over an infinite line (for more details see Appendix~\ref{app:tree}). Since the biased random walk on a line is not recurrent \cite[Example 21.2]{levin2017markov}, then the double tree network is non-recurrent, and Term 1 $\nrightarrow 0$. Moreover, we show in Appendix~\ref{app:tree} that \begin{equation*} \lim_{d \rightarrow +\infty} r^{U_d}_{l}-r^{L_d}_{l}=\frac{1}{3}, \end{equation*} thus implying that Term 2 $\nrightarrow 0$. \begin{figure} \centering \begin{tikzpicture}[scale=0.65, transform shape] \node[draw, circle, fill=green] (1) at (-2,0) {$i$}; \node[draw, circle, fill=green] (2) at (2,0) {$j$}; \node[draw, circle] (3) at (-2.8,1) {}; \node[draw, circle] (4) at (-1.2,1) {}; \node[draw, circle] (5) at (1.2,1) {}; \node[draw, circle] (6) at (2.8,1) {}; \node[draw, circle] (7) at (-3.2,2) {}; \node[draw, circle] (8) at (-2.4,2) {}; \node[draw, circle] (9) at (-1.6,2) {}; \node[draw, circle] (10) at (-0.8,2) {}; \node[draw, circle] (11) at (0.8,2) {}; \node[draw, circle] (12) at (1.6,2) {}; \node[draw, circle] (13) at (2.4,2) {}; \node[draw, circle] (14) at (3.2,2) {}; \node[draw=none] (15) at (-3.5,3) {}; \node[draw=none] (16) at (-2.9,3) {}; \node[draw=none] (17) at (-2.7,3) {}; \node[draw=none] (18) at (-2.1,3) {}; \node[draw=none] (19) at (-1.9,3) {}; \node[draw=none] (20) at (-1.3,3) {}; \node[draw=none] (21) at (-1.1,3) {}; \node[draw=none] (22) at (-0.5,3) {}; \node[draw=none] (23) at (0.5,3) {}; \node[draw=none] (24) at (1.1,3) {}; \node[draw=none] (25) at (1.3,3) {}; \node[draw=none] (26) at (1.9,3) {}; \node[draw=none] (27) at (2.1,3) {}; \node[draw=none] (28) at (2.7,3) {}; \node[draw=none] (29) at (2.9,3) {}; \node[draw=none] (30) at (3.5,3) {}; \path (1) edge [bend right=0] node [above] {$l$} (2); \path (1) edge [bend right=0] node [above] {} (3); \path (1) edge [bend left=0] node [above] {} (4); \path (2) edge [bend right=0] node [above] {} (5); \path (2) edge [bend right=0] node [below] {} (6); \path (3) edge [bend left=0] node [below] {} (7); \path (3) edge [bend left=0] node [below] {} (8); \path (4) edge [bend right=0] node [above] {} (9); \path (4) edge [bend right=0] node [above] {} (10); \path (5) edge [bend left=0] node [above] {} (11); \path (5) edge [bend right=0] node [above] {} (12); \path (6) edge [bend right=0] node [below] {} (13); \path (6) edge [bend left=0] node [below] {} (14); \path (7) edge [dashed] node [above] {} (15); \path (7) edge [dashed] node [above] {} (16); \path (8) edge [dashed] node [above] {} (17); \path (8) edge [dashed] node [above] {} (18); \path (9) edge [dashed] node [below] {} (19); \path (9) edge [dashed] node [below] {} (20); \path (10) edge [dashed] node [below] {} (21); \path (10) edge [dashed] node [above] {} (22); \path (11) edge [dashed] node [above] {} (23); \path (11) edge [dashed] node [above] {} (24); \path (12) edge [dashed] node [above] {} (25); \path (12) edge [dashed] node [below] {} (26); \path (13) edge [dashed] node [below] {} (27); \path (13) edge [dashed] node [above] {} (28); \path (14) edge [dashed] node [below] {} (29); \path (14) edge [dashed] node [below] {} (30); \end{tikzpicture} \caption{The double tree is an infinite non-recurrent network. \label{counterex}} \end{figure} \section{Numerical simulations} \label{sec:simulations} This section is devoted to numerical simulations. In Section~\ref{sec:res_approx} we analyze the bound gap for finite distance $d$, both on real and synthetic transportation networks. Then, we discuss in Section~\ref{sec:relax_ass} how to adapt our method to more general NDPs with non-linear delay functions, and provide numerical simulations showing that our algorithm may be applied in real scenarios even if the regularity assumption on the Wardrop equilibrium (i.e., Assumption \ref{assumption}) is violated. \subsection{Effective resistance approximation} \label{sec:res_approx} \subsubsection{Infinite grids} Infinite regular grids are relevant networks to test the performance of the bounds on the effective resistance, since they are good proxy for transportation networks. In Table~\ref{table} the bound gap in a square grid network with unitary conductances is shown. Similar results are obtained in any regular infinite grid. Numerical simulations show that for every link $l$ in $\mathcal{L}$, \begin{equation*} \frac{r^{U_d}_{l}-r_{l}}{r_{l}}=\frac{r_{l}-r^{L_d}_{l}}{r_{l}}=O(1/d^2). \end{equation*} We emphasize that, despite the network being infinitely large, even at $d=5$ the bounds are close to the true value effective resistance, which is 1/2 \cite{bartis1967let}. \begin{table}[] \caption{Table of upper and lower bound in infinite square grid. \label{table}} \centering \begin{tabular}{llllll} & $d=1$ & $d=2$ & $d=3$ & $d=4$ & $d=5$\\ \hline $(r_{l}^{U_d}-r_{l})/r_{l}$ & $1/5$ & $0.0804$ & $0.0426$ & $0.0262$ & $0.0178$\\ \hline $(r_{l}-r_{l}^{L_d})/r_{l}$ & $1/5$ & $0.0804$ & $0.0426$ & $0.0262$ & $0.0178$\\ \hline \end{tabular} \end{table} \subsubsection{Oldenburg transportation network} \begin{figure} \centering \includegraphics[width=5cm]{oldenburg.png} \caption{Average relative gap of the bounds on Oldenburg network as a function of distance $d$. \label{old_fig}} \end{figure} In this section we illustrate the performance of our bounds on the effective resistance of links of the resistor network associated to the transportation network of Oldenburg \cite{brinkhoff2002framework}. The transportation network is composed of $6105$ nodes and $7035$ links, and the diameter of the associated resistor network (i.e., maximum distance between pair of nodes) is $104$. We assume for simplicity $a_e=1$ for every link $e \in \mathcal{E}$, but numerical results prove to be robust with respect to some variability in those parameters. The average relative bound gap on the associated resistor network, defined as \begin{equation*} \Delta R_d:=\frac{1}{\mathrm{L}}\sum_{l \in \mathcal{L}}\frac{r^{U_d}_{l}-r^{L_d}_{l}}{r_{l}} \end{equation*} is shown in Table~\ref{oldenburg_lower_bound} and Figure~\ref{old_fig}. \begin{table}[] \caption{Table of average relative error bound gap at distance $d$ on the Oldenburg network. \label{oldenburg_lower_bound}} \centering \begin{tabular}{llllllll} & d=1 & d=2 & d=3 & d=4 & d=5 & d=6 & d=7\\ \hline $\Delta R_d$ & 0.21 & 0.12 & 0.079 & 0.056 & 0.041 & 0.031 & 0.024\\ \hline \end{tabular} \end{table} We observe that also in this network the bound gap decreases quickly compared to the diameter of the network. \subsection{Relaxing assumptions} \label{sec:relax_ass} The goal of this section is two-fold. We first show how to adapt Theorem \ref{thm} when the delay functions are non-affine, and validate by numerical analysis the proposed method. We then show that violating Assumption \ref{assumption} is not a practical issue in real case scenarios. The numerical example is based on the highway network of Los Angeles (see Figure~\ref{fig:mapLA} \cite{los_angeles}). To handle non-linear delay functions, the main idea is to adapt Theorem~\ref{thm} by constructing a resistor network and then follow same steps as in Algorithm~\ref{alg}. To this end, let us write the KKT conditions of \eqref{convex_prob} as follows: $$ \left[ \begin{array}{ c c } \text{diag}\Big(\Big\{\frac{\tau_e(f_e^*)}{f_e^*}\Big\}_{e \in \mathcal E}\Big) & -(B_-)^T \\ -B_- & \mathbb{0} \end{array} \right] \left[ \begin{array}{c} f^* \\ \gamma^*_- \end{array} \right] = -\left[ \begin{array}{c} \tau_e(0) \\ \nu_- \end{array} \right], $$ where $f^*$ and $\gamma^*$ denote the Wardrop equilibrium and the optimal Lagrangian multipliers before the intervention. The KKT conditions suggest that in non-affine routing games the term $\tau_e(f_e^*)/f_e^*$ plays the role of $a_e$ in affine routing games (see the proof of Theorem~\ref{thm} in Appendix~\ref{app:proofs} for more details). Hence, by following similar steps as in affine routing games, we construct a resistor network with conductance matrix \begin{equation} \label{eq:new_W} W_{ij}= \begin{cases} \sum_{\substack{e \in \mathcal{E}: \\ \xi(e)=i, \theta(e)=j, \ \text{or} \\ \xi(e)=j, \theta(e)=i}} \frac{f_e^*}{\tau_e(f_e^*)} & \text{if}\ i \neq j \\ 0 & \text{if}\ i=j. \end{cases} \end{equation} The social cost variation for single-link interventions is then computed by using Theorem \ref{thm} with respect to the new resistor network with conductance matrix \eqref{eq:new_W}. Observe that, in contrast with the affine case, this method is not exact for non-linear delay functions, since the Wardrop equilibrium (and thus the elements of $W$) are modified by interventions, not allowing to leverage Sherman-Morrison theorem to compute the social cost variation. To validate our method we assume that delay functions are in the form $\tau_e(f_e) = a_e (f_e)^4+b_e$, and consider interventions in the form $u = 3 \delta^{(e)}$ for every $e$ in $\mathcal{E}$. Numerical parameters are not reported in the paper due to limited space, but the obtained results are robust with respect to a change of numerical values. For every intervention, we compare the social cost variation computed by two methods: \emph(i) by solving the convex optimization~\eqref{eq:f(k)} and plugging the new equilibrium $f^*(u)$ into the social cost function (\emph{exact}); \emph(ii) via the electrical formulation, i.e., by leveraging Theorem~\ref{thm} with conductance matrix \eqref{eq:new_W} and ignoring the fact that Assumption~\ref{assumption} may be violated (\emph{approximated}). Figure~\ref{fig:non_linear} illustrates the social cost variation computed by the two methods corresponding to interventions on the five links of the network that yield the largest cost variation. The numerical simulations show that support of the equilibrium varies with the intervention. Nonetheless, the proposed method approximates quite well the social cost variation and selects the optimal link for the intervention. The implication of combining the results of this section and Section \ref{sec:res_approx} is that Algorithm~\ref{assumption} should manage to select optimal (or weakly suboptimal) interventions in large transportation networks also when the delay functions are non-linear, Assumption~\ref{assumption} is violated, and effective resistances are computed at small distance~$d$. \begin{figure}[t!] \centering \includegraphics[scale=0.22]{LAmap.png}\\[12pt] \begin{tikzpicture}[scale=0.55,transform shape] \node[draw, circle] (1) at (1,0) {1}; \node[draw, circle] (2) at (4,0) {2}; \node[draw, circle] (3) at (6,0) {3}; \node[draw, circle] (4) at (10,0) {4}; \node[draw, circle] (5) at (14,-1) {5}; \node[draw, circle] (6) at (2,-4) {6}; \node[draw, circle] (7) at (4,-4) {7}; \node[draw, circle] (8) at (6,-4) {8}; \node[draw, circle] (9) at (8,-3) {9}; \node[draw, circle] (10) at (4,-8) {10}; \node[draw, circle] (11) at (6,-8) {11}; \node[draw, circle] (12) at (8, -8) {12}; \node[draw, circle] (13) at (12, -9) {13}; \node[draw, circle] (14) at (14, -9) {14}; \node[draw, circle] (15) at (6, -10) {15}; \node[draw, circle] (16) at (9,-10.5) {16}; \node[draw, circle] (17) at (14, -11) {17}; \path[->,shorten >=1pt,auto, node distance = 0.5cm, semithick] (1) edge node {$l_1$} (2) (2) edge node {$l_2$} (3) (3) edge node {$l_3$} (4) (4) edge node {$l_4$} (5) (1) edge node {$l_5$} (6) (6) edge node {$l_6$} (7) (7) edge node {$l_7$} (8) (8) edge node {$l_8$} (9) (9) edge node {$l_{9}$} (13) (2) edge node {$l_{10}$} (7) (3) edge node {$l_{11}$} (8) (3) edge node {$l_{12}$} (9) (4) edge node {$l_{13}$} (9) (5) edge node {$l_{14}$} (14) (6) edge node {$l_{15}$} (10) (10) edge node {$l_{16}$} (11) (10) edge[left] node {$l_{17}$} (15) (7) edge node {$l_{18}$} (10) (8) edge node {$l_{19}$} (11) (9) edge node {$l_{20}$} (12) (11) edge node {$l_{21}$} (12) (12) edge node {$l_{22}$} (13) (13) edge node {$l_{23}$} (14) (11) edge node {$l_{24}$} (15) (13) edge[left] node {$l_{25}$} (17) (14) edge node {$l_{26}$} (17) (15) edge[below] node {$l_{27}$} (16) (16) edge[below] node {$l_{28}$} (17); \end{tikzpicture} \caption{\emph{Top}: the highway network in Los Angeles. \emph{Bottom}: a graph representation of the network, where node $1$ (Santa Monica) and $17$ (Santa Ana) are respectively the origin and the destination. \label{fig:mapLA}} \end{figure} \begin{figure} \centering \includegraphics[width=7cm]{quarta2-5links.png} \caption{\emph{Top}: Social cost variation for interventions in the form $u = 3 \delta^{(e)}$ for a routing game on the graph of Figure~\ref{fig:mapLA} with delay functions in the form $\tau_e(f_e) = a_e (f_e)^4 + b_e$. The cost variation is computed by solving convex optimization (\emph{exact}) and by adapting Theorem~\ref{thm} to the case of non-linear delay functions (\emph{approximated}), as explained in Section~\ref{sec:relax_ass}. The plot illustrates the social cost variation for the five links that maximize the cost variation.\label{fig:non_linear}} \end{figure} \section{Conclusion} In this work we study a network design problem where a single link can be improved. Under the assumption that the support of the Wardrop equilibrium is not modified with an intervention, we reformulate the problem in terms of electrical quantities computed on a related resistor network, in particular in terms of the effective resistance of a link. We then provide a method to approximate such an effective resistance by performing only local computation, which may be of separate interest. Based on the electrical formulation and our approximation method for the effective resistance we propose an efficient algorithm to solve efficiently the network design problem. We then show by numerical examples that our method can be adapted to routing games with non-linear delay functions, and achieves good performance even if the support of the equilibrium is modified by the intervention. An interesting direction for the future is a deeper analysis on tightness of the bounds on effective resistance for finite distance $d$. Future research lines also include extending the analysis to the case of multiple interventions. Indeed, the general problem is not submodular, thus guarantees on the performance of greedy algorithm are not given. A possible direction is to exploit the closed formula for the social cost derivative to implement gradient descents algorithms. Other directions include extending the theoretical framework to the case of multiple origin-destination pairs and heterogeneous preferences \cite{Cianfanelli.ea:19,Cianfanelli.ea:22}. \bibliographystyle{plain}
\section{Summary} \label{sec:conclusions} We have developed a numerical radiation hydrodynamics scheme based on the two-moment method and using and improved closure relation. The two-moment method is based on the first two moments of the radiation moment hierarchy, and the hierarchy is closed with an Eddington closure relation. The M1 Eddington tensor closure is the simplest anisotropic closure that maximizes the entropy (see \S\ref{sec:method}), our modified closure relation improves the stability of the method, in particular in the optically thin regime. The numerical scheme is implemented in the smoothed particle hydrodynamics (SPH) code {\small SWIFT} \citep{Scha16SWIFT}. The interaction of radiation with a pure hydrogen gas is implemented in non-equilibrium, using sub-cycling to improve computational speed. Key aspects of the method and its implementation include: \begin{itemize} \item the first stable and accurate SPH implementation of the two moment method (Eqs. \ref{eq:sphxi} and \ref{eq:SPHdfrad}); \item improvements to the M1 closure relation (Eq. \ref{eq:codeest}), making the method (1) less prone to noise in the optically thin regime (enabling the implementation of the two moment method in SPH) and (2) correct in the optically thin limit; \item anisotropic artificial viscosity and high-order artificial diffusion schemes (\S\ref{sec:artdiss}) to capture discontinuities in the radiation. These are essential to propagate radiation accurately in the optically thin regime; \item an efficient non-equilibrium thermo-chemistry solver with sub-cycling (\S\ref{sec:thermochemisty}); \item implementation in {\small SWIFT}, a task-based parallel SPH galaxy simulation code \citep{Scha16SWIFT}. \end{itemize} The accuracy and stability of the scheme is demonstrated in \S\ref{sec:results}. The scheme: \begin{itemize} \item preserves the directions and speed of propagation in the optically thin regime; \item can simulate radiation hydrodynamics in dynamical multi-scale problems; \item has accuracy comparable to other radiative transfer codes in the cosmological code comparison papers \citep{Ilie06RTcom,Ilie09RTcom}. \end{itemize} Note that the method yields robust results for spherically symmetric problems, e.g. Str\"omgren sphere, even without imposing that radiation propagates radially, provided that the injection region is sufficiently well sampled; see \S\ref{sec:injection} \& \ref{sec:statictest}. The main advantage of our scheme (and of moment methods in general) as compared to other radiative transfer schemes, is that it is computationally efficient in large-scale simulations with numerous sources, since this cost is independent of the number of sources (which has been demonstrated in many other studies; see \S\ref{sec:Introduction}). Our scheme is also highly adaptive in both space and time, since the radiation field is directly sampled by individual SPH particles. Our scheme can be also implemented in other SPH codes without requiring substantial structural changes. This is because the two-moment equations resemble the set of hydrodynamic equations themselves, e.g. the radiation energy density equation resembles the gas density equation, and the radiation flux equation resembles the momentum equation of hydrodynamics. The artificial dissipation terms for the propagation of radiation are also very similar to the artificial viscosity and diffusion terms in SPH. This method was developed to enable tracking of the propagation of ionizing radiation through the intergalactic medium or interstellar medium in galaxy simulations. It should be sufficiently accurate to correctly model the propagation of ionization fronts and cast shadows behind optically thick absorbers, while at the same time being sufficiently efficient to be able to handle thousands of sources without overly slowing down the calculations. The M1 method has also been applied to study the effect of diffuse radiation or account for multiple scattering events, for example, when studying the transport of IR radiation in the interstellar medium, where multiply-scattered IR photons are thought to be important in transferring momentum to gas (e.g. \citealt{Skin13M1,Rosd15M1IR,Kann19AREPORT}). We intend to extend our code to be able to study these problems in the future. We are aiming to release this code to the community in the near future, after we have completed the following two improvements. First, we are implementing multi-frequency radiative transfer so that we can include Helium in the calculations. Multi-frequency radiation also enables the modelling of spectral hardening. Secondly, we are improving the efficiency of the implementation by decoupling the update of the hydrodynamics variables and the radiation variables, i.e. sub-cycling the radiation transport module. Taking advantage of the very different time-scales for the motion of gas and of radiation should lead to a large speed-up in computing time. We will report on these improvements and demonstrate the efficiency of our code elsewhere. \section{Discussion} \label{sec:discussions} In the previous sections, we have demonstrated that our RT implementation accurately propagates radiation in the optically thin limit, preserving the direction of propagation and advancing the radiation front at the correct speed (\S\ref{sec:method} and \S\ref{sec:purepro}). In three dimensions, it accurately reproduces the initial expansion of an ionization front around a source, and its asymptotic slow down to the Str\"omgren radius. The implementation also handles ionization front trapping (\S\ref{sec:results}), reproducing results accurately also when the hydrodynamics of the gas is accounted for, even at moderate numerical resolution (\S\ref{sec:rhdtest}). Importantly, the method has favourable computational scaling, which is proportional only to the number of gas particles, and independent of the number of sources. By implementing a \lq reduced speed of light\rq\ method, the time-step associated with radiation propagation can be dramatically increased (see \S\ref{sec:RSL}). The thermo-chemistry uses sub-cycling in order to decouple the short ionization timescales from the much longer radiation propagation timescale (see \S\ref{sec:thermochemisty}). The RT implementation inherits the full spatial and temporal adaptivity of the underlying gas dynamics scheme (e.g. \S\ref{sec:rhdtest}). The method as described can be combined with any SPH code, without any need for extra structures (e.g. grids, rays, photon packets, or angular discretization). However, the method also has limitations, e.g. those associated with the closure relation and numerical noise. In this section, we discuss these limitations in more detail. \subsection{Limitations of the Two-Moment M1 method} \subsubsection{Approximations in the Moment Closure} \label{sec:radcoll} \begin{figure*} \includegraphics[width=0.95\textwidth,left]{figures/Quiver_mult_frad_Rad2FrontSpherical_2D_4.png} \caption{Radiation collision in two dimensions: spherical radiation fronts emanate from two sources into an optically thin medium. The setup is the same as Fig.~\ref{fig:radfrontsph2d_tm}, but with two spherical fronts instead of one. The panels from left to right show the initial conditions and the state at later times of $t=0.02$ and $0.04$ when the spherical fronts overlap. The simulation uses the modified M1 closure relation (Eqs.~\ref{eq:eddclose} and \ref{eq:codeest}). Colors represent the radiation energy density, red arrows show the radiation fluxes. Whereas the shells should pass through each other, this closure relation results in a collision of the two fronts, resulting in the formation of horizontal beams of light.} \label{fig:rad2frontsph2d_tm} \end{figure*} \begin{figure} \includegraphics[width=0.5\textwidth]{figures/Quiver_mult_frad_RadStream_headon_2D_8.png} \caption{A short beam of radiation propagating to the top, colliding with a short beam of radiation propagating to the bottom, simulated with the default two-moment method (see \S\ref{sec:testartdiss}) in an optically thin medium (with the same condition as in Fig.\ref{fig:radstream2d_difdiss}, except there is an extra radiation beam pointing downward). Colors represent the radiation energy density, whereas the red arrows show the radiation fluxes. This shows our modified M1 closure (Eq.\ref{eq:codeest}) can handle the head-on beam collision problems.} \label{fig:radstreamheadon2d_tm} \end{figure} As discussed in \S\ref{sec:method}, the two-moment method results from truncating an infinite hierarchy of moment equations by postulating a closure relation for the Eddington tensor. The choice of closure relation affects the accuracy of the method. The \lq M1 closure relation\rq\ is not exact in the regime intermediate between optically thin and optically thick, even in the case of a single source. As shown by \citet{Leve84}, this is because in such a situation the closure relation cannot be uniquely determined by the first two moments. Secondly, this closure relation cannot handle situations where particles receive radiation from two or more directions, even in the optically thin regime (see \S\ref{sec:momentclosure} and \S\ref{sec:radcoll}). In such cases, beams of radiation \lq collide\rq\ with each other rather than simply pass through one another as they should do. The reason for this is twofold. Firstly, the M1 closure relation of Eq.~(\ref{eq:feddcon}) erroneously implies that the radiation is optically thick when two beams collide (see also Fig.~1 in \citealt{Rosd13ramsert}). Secondly, the form of the Eddington tensor in Eq.~(\ref{eq:eddclose}) implicitly assumes that radiation is moving in a single direction (single stream, plus an additional isotropic component). We illustrate the \lq collision of radiation\rq\ in Fig.~\ref{fig:rad2frontsph2d_tm}. The setup is as follows: two sources emit a burst of radiation isotropically into an optically thin medium. This results in two spherical shells of radiation, propagating away from each source. When these shells overlap, they {\em should} simply pass through each other. When this situation is simulated with the M1 closure relation, the shells \lq collide\rq\ instead, erroneously producing two spikes of radiation. Such collisions could significantly distort the radiation morphology {\em e.g.} when sources are associated with multiple star clusters or multiple galaxies. There are several ways to improve the method to reduce the impact of such collisions. Firstly, we introduced the modified M1 closure relation in Eq.~(\ref{eq:codeest}). This new closure relation does not lead to radiation collision in one dimension, as shown in Fig.~\ref{fig:radstreamheadon2d_tm}. The reason is that this modified closure relation correctly identifies that the radiation is optically thin even where the two beams collide (unlike the original M1 close relation). Unfortunately, the modified closure scheme still cannot handle the collision of optically thin beams, which is not head-on. Hence it does not resolve the problem illustrated in Fig.~\ref{fig:rad2frontsph2d_tm}. A possible way forward would be to resort to higher order methods, {\em e.g.} \cite{Vika13QMOMRT} and \cite{Leve96keclosure}. However, a stable and efficient high-order method has not been discussed in the astrophysics literature, as far as we are aware. Another avenue might be to calculate the closure relation itself more accurately, for example using short characteristic \citep{Finl09VET,Jian12VET} or using a Monte Carlo scheme \citep{Fouc18VET}. Unfortunately, both these schemes are computationally more expensive in the case of multiple bright sources. \subsubsection{Numerical/Artificial Noise} Another limitation of the moment method, which is not restricted to the two-moment or M1 methods, is numerical noise. Such noise can destroy the coherence of the radiation even in the optically thin regime (see {\em e.g.} Fig.~ \ref{fig:radstream2d_difdiss}), or cause radiation to propagate into a shadow (see {\em e.g.} Fig. \ref{fig:radshadow3d}). There are two major sources of noise. Firstly, the discretization of the density field into a disordered set of SPH particles, which is especially problematic when the symmetry of the particle distribution differs from that of the radiation field and/or when the numerical resolution is low. In addition, SPH suffers from \lq zeroth-order errors\rq\ that are also particularly severe when the particle distribution is irregular (see \S\ref{sec:Introduction}, \citealt{Dehnen12}); our SPH formulation is designed to minimize these (see \S\ref{sec:SPHform}). Higher-order SPH schemes could reduce such SPH noise further ({\em e.g.} \citealt{Vila99bettergrad,Gabu11WPMHD,Ross15improvedSPH,GIZMO,Fron17CRKSPH}). The second major source of noise is the discontinuity-capturing artificial dissipation, which can introduce unphysical diffusion and damping. We have tried to limit the severity of such artefacts by introducing {\it anisotropic} viscosity as well as a {\it higher-order} artificial diffusion scheme. Even so, our artificial diffusion is not completely anisotropic, so that a small amount of radiation still diffuses artificially perpendicular to the propagation direction of a beam of radiation (see Figs.~\ref{fig:radstream2d_defaultdiss} and \ref{fig:radshadow3d}). We suggest that higher order artificial anisotropic diffusion, similar to that used in the HLL Riemann solver \citep{Hart83HLL}, might reduce these artefacts. Our method can further reduce unphysical diffusion in cases where it is possible to impose the direction of propagation of the radiation. \subsubsection{Computational Cost} Another limitation of the M1 method is that the computational cost may be high in some physically interesting situations, {\em e.g.} when capturing the final stages of reionization when the reduced speed of light needs to be close to $c$ to capture the speed of ionization fronts correctly (e.g.\citealt{Baus15Hreion}). Possible improvements include using a \lq variable speed of light approximation\rq\ (see \S\ref{sec:RSL}, \citealt{Katz17reionVSL}) or implementing the radiation transfer on graphics processing units \citep{Ocvi16CoDa}. Subcycling the radiative transfer module can further improve the performance of the overall code \citep{Rosd13ramsert,Kann19AREPORT}. However, we emphasise that the computational cost of our method scales with the number of gas particles, $N_{\rm gas}$, more favourably than ray-tracing methods (which additionally scale with the number of sources) and {\small OTVET} (which scales with the $N\log N$ scaling of its Poisson solver). \subsection{A comparison with other M1 codes} The two-moment M1 method is a popular scheme in the field of galaxy formation simulations and is implemented in {\em e.g.} {\small ATON} \citep{Aube08M1}, {\small RAMSES-RT} \citep{Rosd13ramsert}, and {\small AREPO-RT} \citep{Kann19AREPORT}. The first two codes are Eulerian schemes, whereas {\small AREPO-RT} is a moving mesh scheme \citep{Spri10AREPO}. Our implementation in the {\sc swift} code takes advantages of the Lagrangian nature of SPH, which is important, particularly when gas flows at high speeds. This is a great advantage compared to Eulerian codes, especially at relatively low resolution \citep{Robe10gridcodeerror} and high redshift \citep{Pont20gridnoise}. While Eulerian mesh codes can gain adaptivity through the adaptive mesh refinement, the refinement and de-refinement are not trivial and can be noisy. {\small AREPO-RT} and our code can follow fluid motions and are highly adaptive, so both of them are advantageous in galaxy formation simulations, where the large dynamic range and high speeds of the gas are both numerically challenging. We think that the main advantages of our scheme are its computational efficiency and its parallelizability. The moving mesh code requires mesh reconstruction, which can be computationally expensive; such reconstruction is not necessary in SPH. SPH codes can also be parallelized efficiently through task-based parallelism, {\em e.g.} {\small ChaNGa} \citep{Jetl08ChaNGa} and {\small SWIFT} \citep{Scha16SWIFT}, the code in which our method is implemented. \section{Introduction} \label{sec:Introduction} Almost everything we know about galaxies and most of what we know about stars comes from studying their radiation. However, radiation is not just a messenger informing us about the sources and sinks of radiation, but may impact gas directly, for example through photo-heating or the suppression of cooling, or by affecting its chemistry. Radiation pressure on gas and dust can also affect the dynamics of the gas directly. Unfortunately, including the effects of radiation in numerical models is challenging: the equation that accounts for the change of intensity of a light ray resulting from emission and absorption is 7 dimensional. To make matters worse, radiation travels at the speed of light, requiring dramatically shorter time-steps than those required to solve the associated hydrodynamics equations. Progress has been made by concentrating on particular aspects of the impact of radiation. We briefly mention some of these aspects and the codes in which they are implemented, without aiming to be exhaustive. The {\sc cloudy} code, last described by \cite{Ferland17Cloudy}, implements in great detail the interaction between radiation and matter in simple geometries assuming equilibrium conditions. {\sc cloudy} has been instrumental in interpreting the spectra of galaxies. Accounting for absorption and re-emission of light by dust in more complex geometries has been implemented using Monte-Carlo radiative transfer in for example the {\sc skirt} \citep{Baes15Skirt}, {\sc sunrise} \citep{Jonsson06Sunrise}, {\sc CMacIonize} \citep{Vand18MCRT}, and {\small AREPO-MCRT} \citep{Smit20AREPOMCRT} codes. The resonant scattering of Lyman-$\alpha$ has been implemented by, for example \cite{Zheng02Lya, Cantalupo05Lya, Verhamme06Lya,Smit15COLT} and others. Radiation can also regulate star formation through radiative feedback. The infrared radiation on the interstellar medium (ISM) is modelled in, e.g., \cite{Turn01FLD,Davi12RTSC}. Radiative feedback is also important in the formation of the first stars and galaxies \citep[e.g][]{Brom091ststar, Kim2019}. In this paper we concentrate on the propagation of (hydrogen) ionizing photons. Radiative transfer (henceforth RT) of ionizing photons is important in the context of galaxies, governing the evolution of HII regions in the interstellar medium (ISM), and in the physics of the intergalactic medium (IGM), which is highly ionized \citep{Gunn65} by radiation from active galactic nuclei (AGN, \citealt{Sargent80}) and massive stars in galaxies \citep{Shapiro87, Madau94}. In both situations, the following considerations are relevant to the design of a successful RT implementation: (1) there is no useful symmetry to be exploited; (2) radiation is emitted by numerous sources; and (3) gas and radiation interact under non-equilibrium conditions. In addition, even without including RT, simulating the ISM and the IGM is computationally demanding requiring the inclusion of many other physical processes. These considerations motivate us to build RT on top of an existing hydrodynamics code, and implement a method that is independent of the number of sources. Smooth Particle Hydrodynamics (SPH) \citep{Lucy77SPH,Ging77SPH} is a Lagrangian hydrodynamics scheme that has been applied to a large variety of astrophysical problems (from planet to star to galaxy formation simulations) as well as non-astrophysical problems. In this scheme, the hydrodynamic properties of a fluid are carried by a set of discrete {\it particles} that move with the fluid and are used to interpolate physical quantities such as density using a smooth function called the \lq kernel\rq. The method is computationally efficient, highly adaptive in space and time, and can easily be coupled to gravity. Many current state-of-the art astrophysical hydrodynamics codes are SPH based \citep[e.g.][]{Spri05Gadget2,FIRE,Scha15EAGLE,Wads17GASOLINE2,Pric18phantom,Spri20Gadget4}. We briefly discuss available options for including RT in hydrodynamical codes, especially for transporting ionizing photons. Conceptually most intuitive is direct ray tracing (also called \lq long characteristics\rq), where each source casts a number of rays and the equation for RT is solved along all rays simultaneously. With a computational cost scaling as $N_{\rm source}\times N^2_{\rm sink}$, where $N_{\rm source}$ and $N_{\rm sink}$ are the number of sources and sinks, this method may be accurate but it is also computationally extremely demanding. Approximations to full ray-tracing are possible though, for example using short characteristic \citep{Miha78shortchar,Mell06c2ray}, hybrid characteristic \citep{Rijk06Hybridchar}, or adaptive ray-tracing \citep{Abel02ART,Wise11ART,Kim17ART}. While the short characteristic method is faster than the long characteristic methods, its angular resolution is lower \citep{Finl09VET}; it is difficult to handle bright point sources \citep[e.g][]{Davi12RTSC}; and it has not yet been implemented directly on top of irregular meshes or particle-based codes such as SPH (though see \citealt{Finl09VET}). Adaptive ray-tracing is fast and can be applied to irregular meshes (and particle methods), so it remains a viable option for RT in SPH, although its computational cost still scales with the number of sources. In cases where the radiation field is largely known, reverse ray-tracing \citep{Kess00reverseRT,Alta13revrt} has been used to calculate the attenuation of ionizing radiation in high density regions. A variation of reverse ray-tracing has proved to be efficiently parallelizable in SPH \citep[e.g.][]{Susa06RSPH,Hase10START}. An alternative to ray-tracing is to discretize radiation directions in a finite number of cones \citep{Pawl08TRAPHIC,Petk11coneRT}. The scaling of this implementation is independent of the number of sources provided a \lq cone merging scheme\rq\ is implemented. The method has been applied in reionization simulations \citep{Pawl17Aurora}. However, the method is still relatively expensive, given that a high number of cones is required to avoid excessive loss of angular resolution. It also requires substantial modifications to the hydrodynamics code, e.g. virtual particles and rotation of cones to improve the angular sampling and avoid artificial radiation spikes. Another strategy, the Monte Carlo method (e.g. \citealt{Alta08SPHRAY,Baek09MCRTSPH, Graziani13}), is even more expensive requiring a large number of photon packets to reduce shot noise to acceptable levels. A different starting point for an RT algorithm is to compute angular and spectral moments of the radiative transfer equation and integrate the resulting \lq moment\rq\ equations numerically. It is the radiation equivalent of integrating the fluid equations rather than the full Boltzmann equation. In both cases, doing so leads to a dramatic reduction in the dimensionality of the problem. Just as in the case of the fluid equations, there is an infinite hierarchy of moment equations which needs to be truncated by a \lq closure relation\rq. The closure relation is not unique and obtaining a good closure relation is challenging, because it needs to be able to handle the very different nature of the transport of optically thick and optically thin radiation. RT moment methods vary in terms of the order of the moments used and in the choice of closure relation. Ideally, the closure relation uses only local properties of the gas and the radiation: this makes the computational cost independent of the number of sources and makes the implementation easily parellelisable. Moment methods do not require fine angular discretization - unlike cone-based or short characteristic methods - so the computational cost per cell or particle can be lower. The \lq Flux Limited Diffusion\rq\ method (FLD, \citealt{Leve81FLD}) solves only for the zeroth moment of the RT equation, which is a diffusion equation provided the time derivative of the first moment is neglected. The speed with which a radiation front propagates is not limited by the speed of light but can be infinite; however, it is possible to impose a \lq flux limiter\rq\ to enforce causality. FLD has been used in many astrophysical simulations \citep[e.g.][]{Turn01FLD,Reyn09FLD,Comm11FLD,Krum12FLD}, some of which use SPH \citep{Whit04SPHFLD}. \cite{Gned01OTVET} developed the {\sc otvet} method, which also evolves a diffusion equation of radiation energy density, but with a closure relation applicable to optically thin radiation. FLD and {\sc otvet} are fast with a compute time that is largely independent of the number of sources. However, the relatively diffusive nature of transport in FLD makes it hard to preserve the propagation direction of radiation accurately. As a consequence, neither standard FLD nor {\sc otvet} cast sharp shadows behind optically thick regions, albeit for slightly different reasons \citep{Haye03RT,Gned01OTVET}. The time-step for propagating radiation in these methods is very restrictive as a consequence of the infinite propagation speed of information; thus, it may be more efficient to use an implicit integration scheme. Unfortunately, an implicit method is computationally inefficient in a scheme like SPH for a large neighbour number (\citealt[e.g][]{Whit04SPHFLD,Petk09OTVET}; see also the discussion about the efficiency of the implicit FLD scheme in \citealt{Skin13M1}). The \lq Two Moment\rq\ method solves the zeroth and first order moments of the RT equation simultaneously. A popular closure relation for this method was introduced by \cite{Leve84} to which we will refer as the \lq M1\rq\ closure relation\footnote{The \lq M\rq\ in \lq M1\rq\ refers to Minerbo, who introduced the maximum entropy closure in \cite{Mine79closure}.}. The M1 method was first used in astrophysics by \cite{Gonz07M1}, and has also been implemented in other hydrodynamics codes, e.g. grid-based (\citealt{Aube08M1}, \citealt{Skin13M1}, \citealt{Rosd13ramsert}, and \citealt{Kann19AREPORT}) and hybrid schemes (\citealt{Hopk20rhd}). This computational scheme is accurate up to order $v/c$ (the fluid velocity divided by the speed of light; \citealt{Buch83rtff}) for a single source in the optically thin or thick limits \citep{Leve84}. In the optically thick case, it captures the minimum entropy (production) principle in the presence of one preferred direction \citep{Leve96keclosure,Dubr99M1}. In the optically thin case, it preserves the radiation's direction - and hence it can cast shadows - with radiation fronts moving at the speed of light. It may be surprising at first, but this second-order method is generally {\em faster} than FLD or {\sc otvet} if solved explicitly. This is a consequence of the hyperbolic nature of the equations which result in a much less restrictive time-step \citep{Thom98pde}. The speed and accuracy of the method makes it a promising scheme for including RT in astrophysical hydrodynamics calculations. While the M1 method works well on structured and unstructured meshes, to date, it has not been implemented in SPH. One reason is that SPH has zeroth-order errors under irregular particle distributions meaning that the SPH estimate does not converge to the true value in the limit of vanishing smoothing length \citep{Lucy77SPH,Ravi85SPHinconsistent,Lans08bettergrad, Dehnen12}. Secondly, devising a good artificial dissipation scheme in SPH is not trivial. However, such artificial dissipation is necessary in order to suppress numerical oscillations around discontinuities. As we will demonstrate, the usual scheme, e.g. \cite{Pric08artcon}, for implementing artificial dissipation fails when applied to the M1 scheme. Finally, the original M1 closure relation artificially amplifies noise in the optically-thin regime which requires changes to the closure relation. Despite these difficulties, implementing the M1 RT method in SPH would be highly desirable: SPH is highly adaptive and ideal for problems that are characterised by a very large dynamic range, whereas the M1 method is efficient and accurate in both the optically thick and thin limits\footnote{But it has issues in handling multiple sources in the optically thin region; see \S\ref{sec:discussions}.}. Furthermore, the M1 method can be straightforwardly implemented on top of any SPH code, since the structures of the hydrodynamics equations and radiation moment equations are quite similar. This results in an accurate and fast code that can handle a very large number of sources in a computationally efficient way. As such, the method described in this paper goes some way towards enabling the inclusion of RT in simulations of galaxy formation as a matter of course. In this paper, we describe how to incorporate the M1 method into SPH and examine its performance through standard RT problems. We begin in \S\ref{sec:method} by briefly illuminating the analogy between taking moments of the Boltzmann equation to derive the fluid equations, and taking moments of the RT equation to derive the two-moment method. We then discuss closure relations and discuss our modification to the M1 closure. Next, we show how the SPH equations can be dicretized to yield the more accurate gradients required for implementing the two-moment method and discuss ways of capturing discontinuities in the radiation field. We finish \S\ref{sec:method} by discussing the coupling of radiation to the thermodynamics and chemistry of the gas, explain and discuss the advantages and drawbacks of the \lq reduced speed-of-light\rq\ approximation, and discuss how we inject radiation. In \S \ref{sec:results}, we present the results of tests with a known solution and compare more realistic tests without a known solution to those in the RT code comparison project \citep{Ilie06RTcom,Ilie09RTcom}. In \S \ref{sec:discussions}, we comment on the strengths and weaknesses of our scheme and compare with other radiative transfer methods. In \S \ref{sec:conclusions}, we briefly summarise our findings and foresee possible improvements in the future. \section{Validation} \label{sec:results} This section contains an extensive series of tests to validate the numerical scheme and its implementation in the {\sc swift} code. The tests combine the {\it default} scheme for radiation (\S\ref{sec:testartdiss}) with the {\small SPHENIX} SPH formulation for hydrodynamics (\S\ref{sec:SPHform}), unless explicitly stated otherwise. Some test impose the optically thin direction in the Eddington tensor (\S\ref{sec:opticalthindir}). Otherwise, the flux propagates in the direction $\hat{\bf n}=\hat{\bf f}$, as computed for each gas particle. In all except the shadowing test (\S\ref{sec:statictest}), we apply periodic boundary conditions. We will make the on-the-spot approximation in all of the tests (\S\ref{sec:semiimplicit}). We do not use the reduced speed of light (RSL) approximation in \S\ref{sec:purepro} in which we aim to compute the radiation distribution, but we {\em do} use the RSL approximation in \S\ref{sec:statictest}-\ref{sec:rhdtest}, which focuses on properties of the gas (see \S\ref{sec:RSL}). \input{result/maintests} \section{Thermo-chemistry rate coefficients} \label{sec:heatcoolparam} \begin{figure} \includegraphics[width=0.45\textwidth]{figures/Heating.png} \caption{Injected energy, $\epsilon$, in eV per photo-ionisation as a function of the temperature, $T$, of the irradiating black-body spectrum. {\em Solid blue line} is the optically thin case, {\em dashed red line} is the optically thick case.} \label{fig:Heating} \end{figure} \begin{figure*} \includegraphics[width=0.95\textwidth]{figures/Rates.png} \caption{{\bf Left panel:} Heating and cooling rates from Table~\ref{table:heatcoolparam} as a function of temperature under thermal equilibrium: collisional line cooling rate, $x(1-x)\Gamma_{\rm line,e{\rm HI}}(T)$ ({\em orange solid}), collisional ionization cooling rate, $x(1-x)\Gamma_{\rm ion,e{\rm HI}}(T)$ ({\em blue dashed}), Bremsstrahlung cooling rate, $(1-x)^2\Gamma_{\rm ff,e{\rm HII}}(T)$ ({\em red dotted}), recombination cooling rate $(1-x)^2\Gamma_{B,e{\rm HII}}(T)$ ({\em green long-dashed}) and photo-heating rate, $\epsilon_\gamma x\,\Gamma_{\gamma,{\rm HI}}/n_{\rm H}$ ({\em purple dot-dashed}). Each rate is shown twice: for a hydrogen number density of $n_{\rm H}=1~{\rm cm}^{-3}$ (lines with symbols), and for $n_{\rm H}=10^{-2}{\rm cm}^{-3}$ (lines without symbols). The assumed photo-ionisation rate is $\Gamma=10^{-12}{\rm s}^{-1}$ and the energy injected per photo-ionization is $\epsilon_\gamma=6.33~{\rm eV}$, appropriate for a black-body spectrum of temperature $10^5~{\rm K}$ {\bf Right panel: } corresponding equilibrium temperature ($T_{\rm eq}$, solid black line) and neutral fraction ($x_{\rm eq}$, blue dashed line).} \label{fig:Rates} \end{figure*} \begin{table*} \centering \begin{tabular}{llll} \hline \hline &Recombination rate \citep{Hui97EOSIGM} by fitting \cite{Ferl92}\\ $\alpha_{\rm A}$ &= $1.269\times 10^{-13}{\rm cm^3s^{-1}}\lambda^{1.503}[1.0+(\lambda/0.522)^{0.470}]^{-1.923}$ \\ $\alpha_{\rm B}$ &= $2.753\times 10^{-14}{\rm cm^3s^{-1}}\lambda^{1.5}[1.0+(\lambda/2.740)^{0.407}]^{-2.242}$ \\ \hline &Collisional ionization rate \cite{Theu98P3MSPH} modified from \cite{Cen92hydro} \\ $\beta$ &= $1.17\times 10^{-10}{\rm cm^3s^{-1}}T^{1/2}\exp(-157809.1/T)(1+T_5^{1/2})^{-1}$ \\ \hline &Collisional ionization cooling rates \cite{Theu98P3MSPH} modified from \cite{Cen92hydro} \\ $\Gamma_{\rm ion,e{\rm HI}}$ &$=2.54\times 10^{-21}{\rm erg\;cm^3\;s^{-1}}T^{1/2}\exp(-157809.1/T)(1+T^{1/2}_5)^{-1}$\\ \hline &Collisional excitation cooling rates \cite{Theu98P3MSPH} modified from \cite{Cen92hydro} \\ $\Gamma_{\rm line,e{\rm HI}}$& $=7.5\times 10^{-19}{\rm erg\;cm^3\;s^{-1}}\exp(-118348/T)(1+T^{1/2}_5)^{-1}$\\ \hline &Recombination cooling rates taken from \cite{Hui97EOSIGM} (fitted from \cite{Ferl92}) \\ $\Gamma_{A,e{\rm HII}}$ & $=1.778\times 10^{-29}{\rm erg\;cm^3\;s^{-1}K^{-1}}T\lambda^{1.965}[1.0+(\lambda/0.541)^{0.502}]^{-2.697}$\\ $\Gamma_{B,e{\rm HII}}$ & $=3.435\times 10^{-30}{\rm erg\; cm^3s^{-1}K^{-1}}T\lambda^{1.970}[1.0+(\lambda/2.250)^{0.376}]^{-3.720}$\\ \hline &Bremsstrahlung cooling rate \cite{Theu98P3MSPH} modified from \cite{Cen92hydro} and \cite{Spit78ISMbook} \\ $\Gamma_{\rm ff,e{\rm HII}}$& $= 1.42\times 10^{-27}{\rm erg\;cm^3\;s^{-1}}T^{1/2}\{1.1+0.34\exp(-[5.5-\log(T)]^2/3)\}$\\ \hline \hline \end{tabular} \caption{Coefficients for heating and cooling of hydrogen. $T_n=T/(10^n{\rm K})$ and temperature $T$ is in K. $\lambda = 315614 {\rm K}/T$. If the on-the-spot approximation is applied, we used the case B recombination cooling (in Eq.~\ref{eq:dedt}). Otherwise, the case A recombination cooling is used.} \label{table:heatcoolparam} \end{table*} The hydrogen photo-ionization rate, $\Gamma_{\gamma{\rm HI}}$ in units ${\rm s}^{-1}$, is \cite[e.g.][]{Oste89Nebulae} \begin{align} \Gamma_{\gamma,{\rm HI}}=\int^\infty_{\nu_{{\rm HI}}}\frac{4\pi J_\nu}{2\pi\hbar\nu}\sigma_{\gamma}(\nu)\,{\rm d}\nu\,,\label{eq:photoionization} \end{align} where $h\nu_{{\rm HI}}\approx 13.6~{\rm eV}$ is the hydrogen binding energy, $J_\nu$ is the angular-averaged specific intensity $I$ (in unit of ${\rm erg\; cm^{-2}s^{-1} Hz^{-1}}$), and $\sigma_{\rm \gamma}$ is the photo-ionization cross-section of hydrogen as a function of frequency, $\nu$, where we used the fit from \cite{Vern96sigmacross}. Defining the frequency-averaged photo-ionization cross-section \begin{align} \langle\sigma_\gamma\rangle \equiv \left [\int^\infty_{\nu_{\rm HI}}\frac{4\pi J_\nu}{2\pi\hbar\nu}\sigma_{\gamma }(\nu)\,{\rm d}\nu\,\right ]\left [ \int^\infty_{\nu_{\rm HI}}\frac{4\pi J_\nu}{2\pi\hbar\nu}\,{\rm d}\nu\right ]^{-1}, \label{eq:sigmagamma} \end{align} the photo-ionization rate of Eq.~(\ref{eq:photoionization}) is \begin{align} \Gamma_{\gamma,{\rm HI}}=\langle\sigma_\gamma\rangle \int^\infty_{\nu_{{\rm HI}}}\frac{4\pi J_\nu}{2\pi\hbar\nu}\,{\rm d}\nu=\langle\sigma_\gamma\rangle\tilde{c}n_\gamma, \end{align} where the frequency-averaged photon flux is: \begin{align} \tilde{c} n_\gamma \equiv \int^\infty_{\nu_{{\rm HI}}}\frac{4\pi J_\nu}{2\pi\hbar\nu}\,{\rm d}\nu\,. \end{align} For reference, the spectrum of a black-body (BB) with temperature $T=10^5~{\rm K}$ has $\langle \sigma_\gamma\rangle=1.62\times 10^{-18}{\rm cm}^2$. The energy injected into the gas per photo-ionization is \begin{align} \epsilon_\gamma &= \left [\int^\infty_{\nu_{{\rm HI}}}\frac{4\pi J_\nu}{\hbar\nu}\,\sigma_{\gamma }(\nu)(\hbar\nu-\hbar\nu_{{\rm HI}})\,{\rm d}\nu \right ]\nonumber\\ &\times \left [ \int^\infty_{\nu_{{\rm HI}}}\frac{4\pi J_\nu}{2\pi \hbar\nu}\,\sigma_{\gamma }(\nu)\,\,{\rm d}\nu\ \right ]^{-1}\,, \label{eq:photoheatperion} \end{align} in the \lq optically thin\rq\ limit where the probability that a photon of frequency $\nu$ is responsible for the ionization is set by the photo-ionization cross-section. In the \lq optically thick\rq\ limit, we simply assume that every photon with $h\nu\geqslant h\nu_{{\rm HI}}$ causes an ionization, and replace $\sigma_{\gamma}\to 1$. This increases the value of $\epsilon_\gamma$ as higher-energy photons contribute relatively more to the ionizations \cite[e.g.][]{Abel99}. This is only an approximation: in the optically thick-limit, hard photons with $h\nu\gg h\nu_{{\rm HI}}$ tend to partially ionize gas upstream from the ionization front, which is not describe accurately by simply increasing the value of $\epsilon_\gamma$. In the special case of a BB spectrum, $J_\nu=B_\nu$, with \begin{align} B_\nu=\frac{4\pi\hbar\nu^3}{c^2}\frac{1}{\exp(2\pi\hbar\nu/k_{\rm B}T)-1}\,, \end{align} the photo-heating per photo-ionization is \begin{align} \frac{\epsilon_\gamma}{kT} &= \frac {\int_{\zeta_{T}}^\infty \zeta ^3\,(\exp(\zeta )-1)^{-1}\,\sigma_{\gamma{\rm HI}}(\zeta )\,d\zeta } {\int_{\zeta_{T}}^\infty \zeta^2\,(\exp(\zeta )-1)^{-1}\,\sigma_{\gamma{\rm HI}}(\zeta )\,d\zeta } -\zeta_{T}\,, \end{align} where $\zeta _{T}\equiv 2\pi \hbar \nu_{{\rm th}}/(k_{\rm B}T)\approx 1.578\times 10^5{\rm K}/T$ is a dimensionless fraction. The value of $\epsilon_\gamma$ as a function of the temperature $T$ of the BB is plotted in Fig.~\ref{fig:Heating}. For reference, $\epsilon_\gamma\approx 6.33~{\rm eV}$ ($16.0~{\rm eV}$) in the optically-thin (thick) case, when $T=10^5~{\rm K}$. Table \ref{table:heatcoolparam} lists the interpolation formula for the ionization, recombination, heating, and cooling coefficients for hydrogen, as used in the thermo-chemistry described in section \S\ref{sec:thermochemisty}. For reference, the cooling rate due to collisional line excitation, collisional ionization, thermal Bremsstrahlung and recombination radiation (in the on-the-spot approximation), in units of ${\rm erg}~{\rm cm}^{-3}~{\rm s}^{-1}$, are respectively \begin{align} \left.\rho\frac{du}{dt}\right|_{\rm line} &=-x(1-x)\Gamma_{\rm line,e{\rm HI}}\,n^2_{\rm H}\\ \left.\rho\frac{du}{dt}\right|_{\rm Ion} &=-x(1-x)\Gamma_{\rm ion,e{\rm HI}}\,n^2_{\rm H}\\ \left.\rho\frac{du}{dt}\right|_{\rm Bremss} &=-(1-x)^2\Gamma_{\rm ff,e{\rm HII}}\,n^2_{\rm H}\\ \left.\rho\frac{du}{dt}\right|_{\rm Recomb} &=-(1-x)^2\Gamma_{{\rm B},e{\rm HII}}\,n^2_{\rm H}\,, \end{align} whereas the photo-heating rate is \begin{align} \left.\rho\frac{du}{dt}\right|_{\rm Heat} &=x\epsilon_\gamma\,\Gamma_{\gamma, {\rm HI}}\,n_{\rm H}\,. \end{align} These rates are plotted in Fig.\ref{fig:Rates}, together with the thermal equilibrium values of the temperature and neutral fraction. For a gas temperature of $10^{4}{\rm K}\leqslant T\leqslant 10^5{\rm K}$, line cooling typically dominates the cooling rate, whereas at lower temperatures recombination cooling takes over. For reference, the case-A and case-B recombination coefficients are $\alpha_{\rm A}=4.29\times 10^{-13}{\rm cm^3s^{-1}}$ and $\alpha_{\rm B}=2.59\times 10^{-13}{\rm cm^3s^{-1}}$ respectively, and the collisional ionization coefficient $\beta=1.25\times 10^{-17}{\rm cm^3s^{-1}}$ at a gas temperature of $T=10^4{\rm K}$. \section{Moment derivations} \label{sect:appendix-moments} This short Appendix aims to elucidate the analogy between taking moments of the Boltzmann equation to derive the fluid equations, and taking moments of the RT equation to derive the moment equations for radiation. The collisional Boltzmann equation is \begin{equation} \frac{\partial}{\partial t}f+{\bf v}\cdot\frac{\partial}{\partial{\bf x}}f + {\bf a}\cdot\frac{\partial}{\partial {\bf v}}f=\left(\frac{Df}{Dt} \right)_{\rm coll}\,, \label{eq:BE} \end{equation} where the right hand side (R.H.S.) is the collision term, and the distribution function $f$ is a function of position, ${\bf x}$, velocity ${\bf v}$, and time, $t$. We will suppress this dependency to avoid clutter. Moments of the equation are derived by multiplying Eq.~(\ref{eq:BE}) with some function $Q({\bf v})$ and integrating over velocities, \begin{eqnarray} \frac{\partial}{\partial t} \int Q({\bf v})\,f\,d{\bf v}&+&\frac{\partial}{\partial{\bf x}}\cdot\,\int {\bf v}Q({\bf v})f\,d{\bf v} \nonumber\\ &+& {\bf a}\cdot\int \left\{\frac{\partial}{\partial {\bf v}} Q({\bf v})f - f\frac{\partial}{\partial {\bf v}}Q({\bf v})\right\}\,d{\bf v}\nonumber\\ &=&\int\, Q({\bf v})\,\left(\frac{Df}{Dt} \right)_{\rm coll}\,d{\bf v}\,. \label{eq:BE2} \end{eqnarray} The first term in curly brackets is the flux $Q\,f$ evaluated at the integration limits of the velocity. Provided we integrate over all velocities, we can assume that $f$ goes to zero sufficiently fast that this term vanishes. Writing the velocity as ${\bf v}={\bf V}+{\bf w}$, where ${\bf V}$ is the mean and ${\bf w}$ is the random component of ${\bf v}$, the density, momentum, pressure and viscous stress tensor, are defined as \begin{eqnarray} \rho &\equiv & m\int f\,d{\bf v}\nonumber\\ P &\equiv & \frac{1}{3}\int w^2\,f\,d{\bf v}\nonumber\\ \Pi^{ij} &\equiv & P\delta^{ij}- \int w^i\,w^j f\,d{\bf v}\,. \end{eqnarray} The fluid equations then follow by realising that integrals over collision term on the R.H.S. of Eq.~(\ref{eq:BE2}) vanish for functions $Q$ that are conserved during collisions. This is the case for $Q=m$ (the particle's mass), and $Q=m{\rm v}$ (the particle's momentum), which then yield the first two moment equations (the continuity and Euler equations), \begin{eqnarray} \frac{\partial}{\partial t}\rho &+& \frac{\partial}{\partial{\bf x}}\cdot \rho{\bf V}=0\nonumber\\ \frac{\partial}{\partial t}\rho{\bf V}^i&+&\frac{\partial}{\partial{\bf x}^j} \left( \rho{\bf V}^j+P\,\delta^{ij}-\Pi^{ij}\right) - \rho\,{\bf a}^i=0\,. \end{eqnarray} Contrast this derivation with taking moments of the radiative transfer equation \cite[e.g][]{Leve81FLD}\footnote{Here we only briefly illustrate the concept, so we suppress the acceleration term of Eq.~(\ref{eq:RT1}) for simplicity. This missing term is included in \S\ref{sec:two-moment} which is based on the derivation by \cite{Buch83rtff}. \cite{Gnedin97} \cite[see also e.g.][]{Petk09OTVET, Cantalupo11} did include the rate of change of frequency in Eq.~(\ref{eq:RT1}) but only to include cosmological redshifting of photons while neglecting changes of radiation energy density from gas velocity.}, \begin{equation} \frac{1}{c}\frac{\partial}{\partial t}I+{\bf n}\cdot \frac{\partial}{\partial{\bf x}}I=\left(\frac{DI}{Dt}\right)_{SS}\,, \label{eq:RT1} \end{equation} where the specific intensity $I$ is a function of position, ${\bf x}$, direction, ${\theta, \phi}$ in spherical coordinates, frequency, $\nu$, and time, $t$. The Cartesian coordinates of the unit vector in direction ${\bf n}$ are ${\bf n} = (\sin(\theta)\cos(\phi), \sin(\theta)\sin(\phi), \cos(\theta))$. The R.H.S. now represents photon sources and sinks. We proceed as before, by multiplying with some function $Q(\theta, \phi)$, which can be a scalar or a tensor, and integrating the RT equation over solid angle $d\Omega$, but not over frequency. We then take $Q=1$ and $Q={\bf n}$ to yield the first two moment equations, \begin{eqnarray} \frac{\partial}{\partial t} E + \frac{\partial}{\partial x^i} F^i &=&\int \left(\frac{DI}{Dt}\right)_{SS}\,d\Omega\nonumber\\ \frac{1}{c^2}\frac{\partial}{\partial t} F^i + \frac{\partial}{\partial x^j} {\mathbb P}^{ij} &=&\int {\bf n}^i\,\left(\frac{DI}{Dt}\right)_{SS}\,d\Omega\nonumber\\ E &=& \frac{1}{c}\int I\,d\Omega=3P\nonumber\\ {\mathbb P}^{ij} &\equiv & P\,\delta^{ij} - \Pi^{ij}\nonumber\\ {\bf F}^i &=& \int {\bf n}^i\,I\,d\Omega\nonumber\\ \Pi^{ij} &=& P\,\delta^{ij} - \int {\bf n}^i\,{\bf n}^j\,Id\Omega\,. \label{eq:RT2} \end{eqnarray} Here, $E$ is the energy density, $P$ the radiation pressure, ${\bf F}$ the flux, and the trace-less tensor $\Pi$ is the radiation equivalent of the viscous stress tensor. These are the moment equations of Eq.(\ref{eq:durad}) and Eq.~(\ref{eq:dfrad}) in the fluid frame, ${\bf v}=0$. In the special case where the sources plus sinks term have the form of isotropic absorption, $\left({DI}/{Dt}\right)_{SS}=-\kappa\,I$, where $\kappa$ is the isotropic absorption coefficient, the sink terms in Eq.~(\ref{eq:RT2}) are $-\kappa E$ and $-\kappa{\bf F}$ for the first and second equation, respectively. Provided that the term $(1/c^2)\partial{\bf F}/\partial t$ can be neglected, the moment equations then combine to \begin{align} \frac{\partial}{\partial t} E = \nabla\cdot\left[ \frac{1}{\kappa} \nabla {\mathbb P}\right] - \kappa E\, , \end{align} which is a diffusion equation. In the isotropic case, $\Pi^{ij}=0$, and a Gaussian package of the form $E({\bf x}, t)=\left(2\pi\sigma^2\right)^{-3/2}\exp[-x^2/(2\sigma^2)]\exp(-\kappa t)$ is a solution, spreading out as $\sigma^2(t)=\sigma^2(t=0)+2t/(3\kappa)$ while dimming, $\propto \exp(-\kappa t)$. \section{Analytic solution of the Str\"omgren sphere} \label{sec:anaStromgren} In the classical Str\"omgren sphere problem \citep{Stro39stromgrensphere}, a source emitting ionizing photons at a constant rate $\dot{N}_\gamma$ is embedded in a spherical cloud, initially filled with completely neutral hydrogen atoms with density $n_{\rm HI}=n_{\rm H}$. As the source switches on, an ionization front expands around the source, and the gas inside the ionization front, radius $R_I$, will be mostly ionized, $x\equiv n_{\rm HI}/n_{\rm H}\ll 1$, and outside $R_I$ will be mostly neutral. The equations describing the evolution of the neutral fraction and photon density of such an idealized system are \begin{align} \frac{\partial n_{{\rm HI}}}{\partial t}&=-n_{{\rm HI}}c\sigma_\gamma n_\gamma +n_en_{{\rm HII}}\alpha_{A}-n_en_{\rm HI}\beta\,, \label{eq:stromdnHI} \end{align} \begin{align} \frac{\partial n_\gamma}{\partial t}&=-n_{{\rm HI}}c\sigma_{\gamma} n_\gamma + n_en_{{\rm HII}}(\alpha_{\rm A}-\alpha_{\rm B}) + S_\gamma,\nonumber\\ &=\frac{\partial n_{{\rm HI}}}{\partial t} -\alpha_{\rm B} n_en_{{\rm HII}} + S_\gamma. \label{eq:simngamma} \end{align} As a first approximation to describe such a system, we assume that the gas inside $R_I$ is fully ionized, $x=0$, and outside $R_I$ is fully neutral, $x=1$, and that the ionization front is infinitely sharp. We further neglect collisional ionization, setting $\beta=0$. In this case, $n_{{\rm HI}}(r)=n_{{\rm HI}} \Theta (R_I-r)$, where $\Theta (x)$ is the step function. Integrating each term of Eq.~(\ref{eq:simngamma}) over the volume centered at the source, we find \begin{eqnarray} \int \frac{\partial n_{{\rm HI}}}{\partial t}{\rm d}V &=& \int \frac{\partial}{\partial t}\left [ n_{{\rm HI}} \Theta (R_I-r)\right ]{\rm d}V\nonumber\\ &=&n_{{\rm HI}} \int \delta(R_I-r)\frac{\partial R_I}{\partial t}{\rm d}V\nonumber\\ &=& -4\pi R_I^2 n_{{\rm HI}} \frac{\partial R_I}{\partial t}\nonumber\\ \int \alpha_{\rm B} n_en_{{\rm HII}}{\rm d}V &\approx & \alpha_{\rm B} n^2_{\rm H}\frac{4\pi}{3}R^3\nonumber\\ \int S_\gamma{\rm d}V &=& \dot{N}_\gamma\,. \end{eqnarray} Combined, these yield the well-known equation, \begin{align} \dot{N}_\gamma=4\pi R_I^2 n_{{\rm H}}\frac{\partial R_I}{\partial t}+\alpha_{\rm B} n^2_{{\rm H}}\frac{4\pi}{3}R_I^3\,, \label{eq:strogremdt} \end{align} with solution \begin{align} R_I(t)=R_S[1-\exp(-t/\tau_r)]^{1/3}\,. \label{eq:anars} \end{align} Here, the recombination time $\tau_r=(\alpha_{\rm B} n_{\rm H})^{-1}$ and the Str\"omgren radius \begin{align} R_S \equiv \left(\frac{3\dot{N}_\gamma}{4\pi \alpha_{\rm B} n_{{\rm H}}^2}\right)^\frac{1}{3}. \label{eq:Stromgrenradius} \end{align} For times $t\gg \tau_r$, and greater than the ionization time scale $\tau_i$, \begin{align} \tau_i\equiv \frac{(4\pi/3)n_{\rm H}}{R^3_s}{\dot N_\gamma}\,, \end{align} the ionization front reaches an equilibrium location where ionizations balance recombinations. To derive the profile of the hydrogen neutral fraction in equilibrium analytically, we work with the time independent equation in the on-the-spot approximation, $\alpha_{\rm A}\to\alpha_{\rm B}$, \begin{align} \frac{\partial n_\gamma }{\partial t}=-\nabla\cdot{\bf f}_\gamma -n_{\rm HI}c\sigma_\gamma n_\gamma=0\,, \end{align} In spherical symmetry (and neglecting the scattered radiation), ${\bf f}_\gamma = n_\gamma c\hat{\bf r}$ so that \begin{align} \nabla\cdot (cn_\gamma \hat{\bf r} ) + n_{\rm HI}c\sigma_\gamma n_\gamma = 0. \label{eq:stromgrendivF} \end{align} Writing this is spherical coordinates yields \begin{align} \frac{1}{r^2}\frac{\partial }{\partial r}\left ( r^2 n_\gamma \right ) + n_{\rm HI}\sigma_\gamma n_\gamma = 0\,, \end{align} with formal solution \begin{align} n_\gamma = \frac{\dot N_\gamma}{4\pi c\,r^2}\exp\left(-\int^r_0n_{\rm HI}(r')\sigma_\gamma {\rm d}r'\right)\,. \label{eq:stromgrenngamma} \end{align} This derivation implicitly assumes that the mean free-path of photons is much less than $R_S$, which should be a good approximation for typical HII regions. The steady-state neutral hydrogen profile follows by balancing ionizations and recombinations, {\em i.e.} substituting the previous relation into Eq.~(\ref{eq:stromdnHI}) and setting $\partial n_{\rm HI}/\partial t=0$, \begin{align} \frac{x\sigma_\gamma\dot{N}_\gamma}{4\pi r^2}\exp\left(-\tau(r)\right) &=(1-x)^2n_{\rm H}\alpha_{\rm B} -x(1-x)\beta\,n_{\rm H}^2\,, \label{eq:intsolxH0} \end{align} where the optical depth is given by \begin{align} \tau(r)=n_{\rm H}\sigma_\gamma \int^r_0\,x(r'){\rm d}r'\,. \end{align} The nature of the solution is brought out better by casting these equations in dimensionless form, \begin{align} \frac{\tau_S x}{q^2}\,\exp(-\tau)&=3(1-x)^2-3\frac{\beta}{\alpha_{\rm B}}x(1-x)\nonumber\\ \tau&=\tau_S\int_0^q\,x(q')dq'\,, \label{eq:qtau} \end{align} where the dimensionless radius $q\equiv r/R_s$, and the \lq Str\"omgren optical depth\rq\ $\tau_S\equiv n_{\rm H}\sigma_\gamma\,R_S$. This is an integral equation for the neutral fraction, $x(q)$. We follow \cite{Alta13revrt} to convert this into an easier to integrate differential equation: take the logarithm of both sides and differentiate with respect to $q$, which yield \begin{align} \left[\frac{1}{x}+\frac{2(1-x)-(1-2x)\beta/\alpha_{\rm B}}{(1-x)^2-x(1-x)\beta/\alpha_{\rm B}} \right]\frac{dx}{dq}=\tau_S\,x+\frac{2}{q}\,, \label{eq:anabeta} \end{align} with boundary condition for $q\to 0$ \begin{align} x\to \frac{3}{\tau_S}\,q^2\,. \end{align} Provided that collisional ionizations can be neglected, the differential equation simplifies to \begin{align} \frac{dx}{dq}=\frac{x(1-x)}{1+x}\,\left(\tau_S\,x+\frac{2}{q}\right)\,, \label{eq:Stromgren} \end{align} which shows that there is a one-parameter family of solutions that are characterised by the value of $\tau_S$. The numerical integration of Eq.~(\ref{eq:anabeta}) with its associated boundary conditions is plotted as the line labelled \lq Analytic\rq\ in Fig.~\ref{fig:stromgren3d_tm}. \section{Thermo-chemistry sub-cycling} \label{sec:thermochemsub} \begin{figure} \includegraphics[width=0.45\textwidth]{figures/NsubNmainsinglecelltest.png} \caption{The number of sub-cycles per global time-step in the single particle photo-ionization heating test, described in \S\ref{sec:singlegasparcel}, as a function of time. The global time-step $\Delta t_{\rm main}=0.1\;{\rm Myr}$. This ratio can be up-to a factor of ten initially, reducing to tens of percents after the gas reaches equilibrium.} \label{fig:Nsubsingleparcel} \end{figure} \begin{figure} \includegraphics[width=0.45\textwidth]{figures/Nsub_r_Stromgren3D_10.png} \caption{The number of sub-cycles per global time-step for the variable temperature Str\"omgren sphere test with static gas particles described in \S\ref{sec:statictest}. This ratio is plotted for every SPH particle ({\em red dots}) as a function of its distance to the centre, at time $t=100~{\rm Myr}$; {\em blue points with error bars} show the mean and variance in radial bins. The speed-up due to sub-cycling is around a factor of two, mainly near the location of the ionization front.} \label{fig:Nsubstromvartemp} \end{figure} Here we analyze the computational efficiency of using sub-cycling in the thermo-chemistry solver, as described in \S\ref{sec:thermochemisty}. Note that during sub-cycling, we only need to solve a few equations (at most quadratic) for each active gas particle, making the computational cost small compared to calculating hydrodynamical or gravitational forces, or performing the radiative transfer, all of which require loops over neighbouring particles and potentially communication between compute nodes. Therefore, the number of sub-cycling steps per global time-step is a measure of the efficiency of sub-cycling. We plot this ratio for the single gas particle test (see \S\ref{sec:singlegasparcel}) in Fig.~\ref{fig:Nsubsingleparcel}, and for the static 3D Str\"omgren test (see \S\ref{sec:statictest}) in Fig.~\ref{fig:Nsubstromvartemp}. The number of sub-cycling steps per global time-step is typically highest in {\em nearly} neutral regimes, where the ratio can be up-to an order of magnitude. This is because the gas in this regime is far from equilibrium, and the sub-cyle time-step is limited by the photo-ionization time scale, $\tau_i=1/\Gamma_{\gamma, {\rm HI}}$, which can be {\em much} shorter than the global time-step set by the {\sc cfl} condition. Once the gas is highly ionized, sub-cyle time-step is usually set by the recombination time-scale, which is typically much longer than $\tau_i$. In addition, the gas may be in ionization equilibrium or even thermal equilibrium, so that the chemistry time-step is long. In the kind of astrophysical application that we have in mind, for example reionization simulations, sub-cycling is essential since otherwise the short time-step required in gas being over run by an ionization front will grind the code to a halt. Finally, our sub-cycling scheme parallelizes well, since it does not require any communication. \subsection{Radiation injection} \label{sec:injection} In our implementation, radiation is injected by \lq star particles\rq\, which, in our SPH implementation, have a smoothing length $h$, which is calculated in the same way as that of gas particles ({\em i.e.} by requiring that each star particle interacts with the desired number of kernel-weighted gas neighbours). A star particle $i$ with time-step $\Delta t_i$ and energy injection rate $\dot{e}_{i,{\rm rad}}$ distributes a total amount of radiation $\dot{e}_{i,{\rm rad}}\Delta t_i$ into all of its neighbouring gas particles. Each individual neighbouring gas particle $j$ receives an amount of energy equal to \begin{align} \Delta e_{ij} = m_j\Delta \xi_j = \frac{m_j}{N_{\rm nor}\rho_j r_{ij}^2}\dot{e}_{i,{\rm rad}}\Delta t_i\,. \end{align} This kernel-weighted energy transfer is normalized by $N_{\rm nor}$, computed such that $\sum_j \Delta e_{ij}=\,\dot{e}_{i,{\rm rad}}\Delta t_i$, where the sum is performed over all of $i$'s gas neighbours $j$. We inject the corresponding isotropic radiation flux, $m_j\Delta {\bf f}_j$, as if the surrounding medium were optically thin: \begin{align} \Delta {\bf f}_j = \tilde{c}\hat{\bf r}_{ji}\Delta \xi_j\, . \end{align} Because the distribution of gas neighbours around any star particle is generally relatively disordered, the resulting radiation field may not be very isotropic unless energy is injected over a sufficiently large number of gas particles. To avoid that the source of photons is unacceptably anisotropic, we increase the smoothing lengths of star particles to be a few times the smoothing length of gas particles, e.g. $h_{\rm star}=2h_{\rm gas}$ (see Fig. \ref{fig:stromgren3dhs}). An alternative way of ensuring isotropic radiation around sources is to impose the radiation direction in the optically thin limit (\S\ref{sec:opticalthindir}). In some tests, e.g. tests of Str\"omgren spheres, we calculate the total radiation energy within the injection region, and then reset the radiation distribution according to the optically thin expectation\footnote{It is possible to inject radiation energy only - without updating the radiation flux - provided we apply the original M1 closure (Eq.\ref{eq:feddcon}), since the moment equations will generate an isotropic radiation field in the absence of initial flux. But this is not possible with the modified M1 closure in the optically thin environment for which the (initial) direction of the Eddington tensor needs specifying.}. \subsection{The radiative transfer equation} The radiative transfer equation expresses the constancy of the specific intensity ($I$; in ${\rm erg\; cm^{-2}s^{-1} Hz^{-1} sr^{-1}}$) of a beam of light in the absence of sources or sinks and fluid motion \cite[e.g.][]{Pomraning73} \begin{equation} \frac{1}{c}\frac{\partial}{\partial t}I+\hat{\bf n}\cdot \frac{\partial}{\partial{\bf x}}I=\left(\frac{DI}{Dt}\right)_{SS}\,. \label{eq:RT} \end{equation} Here, $I$ is a function of position (${\bf x}$), direction ($\hat{\bf n}$), frequency ($\nu$) and time ($t$). The right-hand side term represent sources, sinks, and/or the scattering of photons. In the astronomical literature, $I$ is usually called the \lq surface brightness\rq, and just as surface brightness suffers from redshifting, but this is not included in Eq. \ref{eq:RT}. We refer the reader to \cite{Buch83rtff} for the derivation of the complete RT equation. {\em Moment methods} drastically simplify the solution of this equation by multiplying Eq.~(\ref{eq:RT}) with some function of direction and integrating the resulting equation over solid angle. This yields an infinite number of moment equations, with the hierarchy closed after a finite number of moments by a \lq closure relation\rq. Solving the resulting RT moment equations is the radiation equivalent of solving the fluid equations rather than the collisional Boltzmann equation. We point the interested reader to a sketch of the derivation of these moment equations and the relation to fluid equations in Appendix \ref{sect:appendix-moments}. It is worth recalling that fluid equations, being differential equations, do not properly describe the behaviour of a set of particles in case of discontinuities such as shocks or contact discontinuities. Their numerical integration requires the addition of extra terms (such as \lq artificial viscosity\rq\ or \lq artificial conduction\rq). The same is true for moments of the RT equation, and we describe the discontinuity capturing scheme below, after we introduce the full moment equations for fluid and radiation combined in the next section. \subsection{Radiation Moments} We convert the specific intensity $I$ to angular moments by integrating over the solid angle: \begin{align} E_\nu&=\frac{1}{\tilde{c}}\int I{\rm d} \Omega,\nonumber\\ {\bf F}^i_\nu&=\int \hat{\bf n}^i\,I{\rm d} \Omega,\nonumber\\ {\mathbb P}^{ij}_\nu&=\frac{1}{\tilde{c}}\int \hat{\bf n}^i\,\hat{\bf n}^j\,I\,{\rm d}\Omega\,, \label{eq:intIE} \end{align} When additionally integrated over frequency (in the \lq grey\rq\ approximation, e.g. \citealt[][]{Turn01FLD}), those angular moments become radiation energy density $E$, radiation flux ${\bf F}$ and radiation stress tensor ${\mathbb P},$ respectively. Integrating over small frequency intervals, in order to mimic multi-frequency RT, is challenging when Doppler shifts or redshifts are large. This case is not considered here. The relations between the photon number density, $n_\gamma$, and the radiation energy density, $E$, and between the photon flux, ${\bf F}_\gamma$ and the radiation flux, ${\bf F}$, are \begin{align} n_\gamma = \frac{E}{2\pi\hbar\bar{\nu}};\;{\bf F}_\gamma \approx \frac{\bf F}{2\pi\hbar\bar{\nu}}, \label{eq:ngammahv} \end{align} where the mean photon energies $2\pi\hbar\bar{\nu}$ are \begin{align} &\hbar\bar{\nu} = \left[\int I{\rm d} \Omega{\rm d} \nu\right] \left[\int (I/\hbar\nu){\rm d} \Omega{\rm d} \nu\right]^{-1};\nonumber\\ &\hbar\bar{\nu} \approx \left[\left|\int \hat{\bf n}I{\rm d} \Omega{\rm d} \nu\right|\right] \left[\left|\int \hat{\bf n}(I/\hbar\nu){\rm d} \Omega{\rm d} \nu\right|\right]^{-1}\,. \label{eq:meanhnu} \end{align} The second relation is a good approximation when the radiation is either isotropic or optically thin. For reference, the mean photon energy $2\pi\hbar\bar{\nu}$ of ionizing radiation is 29.6eV for a black-body spectrum at $T=10^5{\rm K}$; $\hbar$ is Planck's constant divided by $2\pi$ (see Appendix \ref{sec:heatcoolparam} for details). We further defined the ratio of the radiation energy density over the fluid's density, $\xi\equiv E/\rho$, and the ratio of radiation flux over the fluid's density as ${\bf f}\equiv{\bf F}/\rho$. \subsection{Two-moment equations} \label{sec:two-moment} The moment equations describing the interaction of gas with radiation are \citep[e.g][]{Buch83rtff,Miha84rhd}: \begin{align} \frac{D\rho}{Dt}+\rho{\bf \nabla\cdot} {\bf v}=0, \label{eq:masscon} \end{align} \begin{align} \frac{D{\bf v}}{Dt}=-\frac{\nabla p}{\rho}-\nabla\phi+\frac{\chi\rho}{\tilde{c}}{\bf f} + {\bf S}_{\bf v}, \label{eq:momcon} \end{align} \begin{align} \frac{Du}{Dt}=-\frac{p}{\rho}{\bf \nabla\cdot\bf v}+\Lambda_{u}+S_{u}, \label{eq:intcon} \end{align} \begin{align} \frac{D\xi}{Dt}=-\frac{1}{\rho}\nabla\cdot(\rho{\bf f}) -\frac{{\bf\nabla v:} \mathbb{P}}{\rho}+\Lambda_{\xi}+S_{\xi}, \label{eq:durad} \end{align} \begin{align} \frac{1}{\tilde{c}^2}\frac{D}{Dt}{\bf f}=-\frac{{\bf \nabla\cdot \mathbb{P}}}{\rho}-\frac{\chi\rho}{\tilde{c}}{\bf f}+{\bf S}_{\bf f}, \label{eq:dfrad} \end{align} \begin{align} \mathbb{P}=\mathbb{F}E=\mathbb{F}\rho\xi\,. \label{eq:stressrad} \end{align} These equations are series expansions including all terms up to $v/c$, in which properties of the radiation field are measured in the local fluid frame. As such, they (partially) account for changes in radiation energy density due to fluid velocities \citep{Buch83rtff}. A list of variable descriptions is given in Table~\ref{table:variables}. Eqs. (\ref{eq:masscon}-\ref{eq:intcon}) express the local conservation of mass, momentum, and energy respectively. The fluid variables are mass density ($\rho$), velocity (${\bf v}$), pressure ($p$), and thermal energy per unit mass ($u$); $\nabla\phi$ is the gravitational acceleration. $D/Dt$ is the Lagrangian time derivative. The terms ${\bf S}_{\bf v}$ and $S_u$ are sources or sinks for the injection of momentum and energy respectively, e.g. due to feedback from stars. The term $\Lambda_u$ is the combined heating and cooling rate. The case of photo-heating and radiative cooling will be discussed in detail in \S\ref{sec:thermochemisty}. Finally, the term $({\chi\rho}/{\tilde{c}}){\bf f}$ represents radiation pressure\footnote{Currently, we apply radiation pressure inferred from the quantities averaged over the volume of each particle. However, \cite{Hopk18M1} demonstrated that it is more accurate to apply radiation pressure to the interface between particles, an improvement we intend to implement in future. In the case of ionizing radiation propagating through a low resolution simulation - for example when simulating cosmic reionization - the resulting differences are expected to be small because the radiation imparts little momentum. However, a more accurate treatment of radiation pressure may be required in high-resolution simulations to capture radiation pressure from massive stars or active galactic nuclei.}. Here, $\tilde{c}$ is the reduced speed of light (see \S\ref{sec:RSL}) and $\chi$ is the opacity related to the optical depth per unit length as $d\tau/dr=\chi\,\rho$. Eqs. (\ref{eq:durad}-\ref{eq:dfrad}) express the local conservation of radiation energy and momentum respectively. The radiation variables are radiation energy per unit mass ($\xi$), radiation flux per unit mass (${\bf f}$), and the \lq radiation stress tensor\rq\ (${\mathbb P}$). ${\bf\nabla v:} \mathbb{P}$ is short hand for the contraction $\mathbb{P}^{ij}v_{i,j}$. In Eq.~(\ref{eq:stressrad}), the tensor $\mathbb{F}$ is the Eddington tensor, which we will discuss in \S\ref{sec:momentclosure}. Some further source/sink terms appear on the right-hand sides of Eqs.~(\ref{eq:durad}-\ref{eq:dfrad}). $\Lambda_\xi$ is the rate at which the radiation density changes due to heating and cooling, discussed in more detail in \S \ref{sec:thermochemisty}. $S_{\rm \xi}$ and ${\bf S}_{\bf f}$ are the source terms for radiation energy and flux, respectively. The injection of radiation will be described in more detail in \S\ref{sec:injection}. In this paper we propagate radiation at the speed $\tilde{c}<c$, which is a \lq reduced\rq\ speed of light. The motivation, validity and limitations of this approximation are discussed in \S\ref{sec:RSL}. In the two-moment method, the time derivatives of the radiation density and radiation flux are kept, unlike in the case of flux limited diffusion (FLD, \citealt{Leve81FLD}). There are some advantages in keeping this term. Firstly, \cite{Buch83rtff} showed that the time derivative of ${\bf f}$ may be significant in the optically thin (free streaming) regime, making the two-moment method more accurate than FLD. Secondly, because of this time derivative, M1 can maintain the direction of the radiation, whereas in FLD the radiation follows the gradient in energy density and hence incorrectly goes around corners in the optically thin limit. Finally, including the time derivative yields hyperbolic equations rather than the parabolic equation of FLD. Solving a parabolic differential equation explicitly requires a more restrictive timestep, $\Delta t\propto (\Delta x)^2/\tilde{c}$, compared to the hyperbolic case where $\Delta t\propto \Delta x/\tilde{c}$; where $\Delta x$ is the spatial resolution. Combined with using a reduced speed of light approximation ($\tilde c$ rather than $c$) improves the efficiency of the RT implementation compared to FLD\footnote{The M1 method can be faster even if FLD is solved implicitly because the inversion step in the implicit solver is expensive (see, e.g. \citealt{Skin13M1}).}. \subsection{Closure relation} \label{sec:momentclosure} Taking successive angular moments of the RT relation leads to an infinite set of coupled moment equations \citep{Miha84rhd}. A \lq closure relation\rq\, which relates higher order moments to lower-order ones, is required to break this hierarchy. Unfortunately, the closure relation is not unique and depends on the problem at hand. \cite{Leve84} derived a closure relation as follows. We consider the RT equations assuming ${\bf v}=0$ and additionally neglecting the $\Lambda$ and $S$ terms. Then, Eqs.~(\ref{eq:durad}) and (\ref{eq:dfrad}) simplify to the following two moment equations: \begin{align} \frac{\partial E}{\partial t}=-\nabla\cdot{\bf F}\,, \label{eq:duradS} \end{align} \begin{align} \frac{1}{\tilde{c}^2}\frac{\partial }{\partial t}{\bf F}=-{\bf \nabla\cdot \mathbb{P}}-\frac{\chi\rho}{\tilde{c}}{\bf F}\,. \label{eq:dfradS} \end{align} Provided that the radiation field is symmetric around a given direction $\hat{\bf n}$, \cite{Leve84} demonstrated that the second moment can be written as \begin{align} &\mathbb{P}=\mathbb{F}E=\frac{E}{2}(1-f_{\rm Edd})\mathbb{I}+\frac{E}{2}(3f_{\rm Edd}-1){\bf \hat{n}}{\bf \hat{n}}, \label{eq:eddclose} \end{align} where $f_{\rm Edd}$ is called the \lq Eddington factor\rq. When the radiation field is {\em almost} isotropic, $\mathbb{P}_{ij}\approx (E/3)\delta_{ij}$ which corresponds to $f_{\rm Edd}=1/3$. Combining the two moment equations with this relation yields \begin{align} \frac{\partial E}{\partial t} = \nabla\cdot\left(\frac{\tilde c}{3\chi\rho}\nabla E\right)-\nabla\cdot\left( \frac{1}{\tilde{c}\chi\rho}\frac{\partial }{\partial t}{\bf F}\right)\,. \label{eq:optthickdelP} \end{align} This describes isotropic diffusion of the energy density, $E$, in case the rate of change of the flux (the last term on the right hand side) can be neglected. Of course, if the radiation field were exactly isotropic everywhere it has to be uniform as well - but this diffusion approximation can be used, provided $E$ varies sufficiently slowly in space and time \citep{Leve84}. This case corresponds to the classical \lq Eddington\rq\ approximation for the propagation of radiation in the isotropic case, and we will refer to as the \lq optically-thick\rq\ solution. In contrast, the value $f_{\rm Edd}=1$ leads to anisotropic radiation propagation with \begin{align} {\bf \nabla\cdot \mathbb{P}}= \hat{\bf n}\left(\hat{\bf n}\cdot\nabla E\right)\,. \label{eq:optthindelP} \end{align} In this \lq optically-thin\rq\ case, \begin{align} \frac{\partial^2E}{\partial t^2}+\tilde c^2 (\hat{\bf n}\cdot\nabla)^2 E=-{\tilde c}\chi\rho\frac{\partial E}{\partial t}\,, \label{eq:streaming} \end{align} and radiation \lq streams\rq\ in direction $\hat{\bf n}$ with speed $\tilde c$, with its intensity decreasing due to absorption as quantified by the right hand side of the equation. The closure relation of Eq.~(\ref{eq:eddclose}) therefore captures the propagation correctly in the two limiting cases of (1) high-optical depth, with the solution describing isotropic diffusion, and (2) the optically-thin regime of negligible optical depth, where the solution describes free propagation at the speed ${\tilde c}$ in the characteristic direction ${\bf \hat{n}}$. The expectation is then that Eq.~(\ref{eq:eddclose}) also provides a good approximation to any intermediate case \citep{Leve81FLD}. One disadvantage of the scheme is that radiation behaves as a \lq collisional\rq\ fluid: beams of light with different propagation directions $\hat{\bf n}$ that intersect will collide. This is because the local Eddington tensor closure relation of Eq. (\ref{eq:eddclose}) can only handle one direction $\hat{\bf n}$ at a time (in addition to an isotropic component). We will discuss this issue in more details in \S\ref{sec:radcoll}. \subsubsection{Choice of Eddington factor} Next we turn to the choice of $f_{\rm Edd}$. As shown by \cite{Leve84}, given that ${\bf F}/(\tilde{c}E)$ and $\mathbb{P}/E$ are the first and second moments of a non-negative unit density variable requires that \begin{align} \varepsilon^2= \left|\frac{\bf F}{\tilde{c}E}\right|^2=\left|\frac{\bf f}{\tilde{c}\xi}\right|^2\leq f_{\rm Edd} \leq 1, \label{eq:feddcon} \end{align} which we term the `original' closure. Of course, even if we demanded that the Eddington factor should only depend on the local values of ${\bf F}$ and $E$, then this would not specify $f_{\rm Edd}$ uniquely (see \citealt{Leve84} for a summary of reasonable choices). One particular choice is the `M1' closure, which \cite{Leve84} derived by assuming that there exist inertial frames in which the radiation density is isotropic (not necessarily isotropic in the lab or fluid frame). This original M1 relation is \begin{align} f_{\rm Edd} = \frac{3+4\varepsilon^2}{5+2\sqrt{4-3\varepsilon^2}}. \label{eq:feddest} \end{align} \cite{Dubr99M1} showed that this corresponds to the simplest moment closure that maximizes the entropy and is anisotropic\footnote{Note that in the mathematics community, the entropy has the opposite sign compared to that in the physics community.}. The evaluation of this expression for M1 is computational efficient as well as highly parallelisable, as compared to e.g. ray-tracing or Monte Carlo methods, because $f_{\rm Edd}$ depends only on local quantities. Because of this, several astrophysical RT implementations use this M1 closure relation, e.g. \cite{Gonz07M1,Aube08M1,Skin13M1,Rosd13ramsert,Kann19AREPORT,Skin19FORNAX}. However, this choice is not without its problems (as are other variants based on local variables). Firstly, consider the case of two otherwise identical beams of radiation propagating in opposite directions. Where the beams hit the net flux is zero, $|{\bf f}/(\tilde{c}\xi) |\sim 0$ so that $\varepsilon=0$ and $f_{\rm Edd}=1/3$: this corresponds to the optically-thick solution, even in the system were optically thin. It is as if the beams of radiation collide with each other \citep[see also][]{Rosd13ramsert}. Clearly, this behaviour is incorrect. This choice of closure relation also results in artificial dispersion, since radiation does not move at the same speed when $|{\bf f}/(\tilde{c}\xi) |$ varies: radiation propagates with speed between $\tilde{c}/3$ and $\tilde{c}$, when Eq.~(\ref{eq:optthickdelP}) or Eq.~(\ref{eq:streaming}) applies, respectively. An improved closure relation can be derived from the following considerations. In the optically thick limit, we desire that $f_{\rm Edd}=1/3$, since the corresponding isotropic diffusion captures the random walks of photons through the medium as a consequence of numerous independent scattering events. In the opposite limit of an optically thin medium, we desire that $f_{\rm Edd}=1$, since that correctly describes streaming of radiation at the speed of light. Note that in this strategy, we set $f_{\rm Edd}=1$ only according to the optical depth ($\tau$) and independent of $|{\bf f}/(\tilde{c}\xi) |$, since the latter can be small even in the optically thin regime, e.g. head-on collision. Finally, we require that $f_{\rm Edd}\le 1$. Our proposed `modified' M1 closure relation is \begin{align} \varepsilon=\max\left[\exp(-\tau),|{\bf f}/(\tilde{c}\xi)|\right], \label{eq:codeest} \end{align} where $\tau\equiv\chi\rho h$ is the local optical depth across the extent $h$ of a resolution element. This choice satisfies $\varepsilon\le 1$, and has the correct limiting behaviour. In the optically thin limit ($\tau\rightarrow 0$), $\varepsilon\rightarrow 1$, while in the optically thick case ($\tau\rightarrow\infty$), $\varepsilon\rightarrow |{\bf f}/(\tilde{c}\xi)|\rightarrow 0$, since the flux $|{\bf f}|$ is small. In case $|{\bf f}|$ is small due to the \lq collision\rq\ of two beams of radiation, $\varepsilon$ can still be of order 1 and describe radiation streaming rather than diffusion provided the optical depth is small. We will demonstrate in \S\ref{sec:radcoll} that our modified M1 closure (Eq.\ref{eq:codeest}) can handle head-on beam collisions and more generally, 1D RT problems. We choose to modify M1 by the factor $\exp(-\chi\rho h)$ to mimic the diffusion of radiation when the optical depth is large. The choice is also motivated by a desire to help numerical convergence: the combined contributions of two resolution elements, for example two SPH particles with extents $h_i$ and $h_j$, is approximately $\exp(-\chi\rho h_i)\times\exp(-\chi\rho h_j)=\exp[-\chi\rho (h_i + h_j)]$, which corresponds to the approximate effect of a lower resolution SPH particle with size $(h_i + h_j)$. We will also show in Fig.\ref{fig:radstream2d_difdiss} that our scheme is more stable than the original M1 closure in optically thin regions when simulated with SPH. However, the scheme does not solve the problem of the artificial collision of radiation beams in case they are not head on (\S\ref{sec:radcoll}), since the radiation directions will still merge locally according to Eq.~(\ref{eq:eddclose}). Fortunately, even in this case, our closure (Eq. \ref{eq:codeest}) will still prevent the numerical diffusion in the optically thin limit. Finally, we justify the use of physical quantities other than radiation energy and flux in the Eddington factor. The Eddington tensor should be derived from the RT equation, which contains information about the gas, e.g. density, velocity, and the opacity (through the collisional term). Thus, the Eddington tensor should be also a function of these gas properties. In fact, in the absence of the collision term ($\chi=0$), the radiation should always be free streaming at the the speed of light regardless of the value of $\xi$ and ${\bf f}$. \subsection{SPH forms for the two moment method and the numerical solution to the propagation equation} \label{sec:SPHform} In the standard formulation of SPH \citep[e.g][]{Mona02sphtur}, the density, $\rho_i$, at the location of particle $i$ is calculated through interpolating over \lq neighbouring\rq\ particles in a gather approach, \begin{align} \rho_i =\sum_jm_jW_{ij}(h_i), \end{align} where the kernel $W_{ij}(h_i)=W(|{\bf r}_i-{\bf r}_j|,h_i)$ is a function with compact support (by default the $M_4$ cubic B-spline function), $h_i$ is the smoothing length and $m_i$ the mass of particle $i$. We follow the variable smoothing length treatment similar to that in \cite{Spri02esph} such that the number of neighbour particles that contribute to the sum is $N_{\rm ngb}$(=48 in 3D) (see the {\small GADGET-2} SPH section in \citealt{Scha15EAGLEhydro} for more details, including the SPH formulation of the hydrodynamics in {\small SWIFT}). In the radiation hydrodynamics tests presented below, we do not use the standard SPH formulation but rather the modifications introduced by \cite{Borr20SPHENIX} called {\small SPHENIX}, which uses the density and energy hydrodynamic variables, rather than pressure and energy. {\small SPHENIX} applies the \cite{Cull10} shock detector to minimize artificial viscosity away from shocks and the artificial diffusion term to capture fluid mixing described by \cite{Pric08artcon}. One of the main hurdles to overcome for implementing a moment method in SPH is that such a higher-order method requires the calculation of derivatives, and these tend to be noisy when the particle distribution is irregular. For example, there are several ways to estimate the divergence of a vector field ${\bf X}$, which include \citep[e.g.][]{Tric12divBclean} the `{\it symmetric}' estimate: \begin{align} \left.\left ( \nabla\cdot{\bf X} \right )_i\right|_{\rm sym} = \rho_i\sum_jm_j&\left[\frac{{\bf X}_i}{\Omega_i\rho_i^2}\cdot\nabla_iW_{ij}(h_i)\right.\nonumber\\&\left.+ \frac{{\bf X}_j}{\Omega_j\rho_j^2}\cdot\nabla_iW_{ij}(h_j)\right ], \label{eq:sym} \end{align} and the `{\it difference}' estimate: \begin{align} \left.\left ( \nabla\cdot{\bf X} \right )_i\right|_{\rm diff} = -\sum_j\frac{m_j}{\Omega_i\rho_i}\left ( {\bf X}_i-{\bf X}_j \right )\cdot\nabla_iW_{ij}(h_i), \label{eq:dif} \end{align} where ${\bf X}$ is an arbitrary vector or tensor associated with each particle, and \begin{align} \Omega_i = 1+\frac{h_i}{3\rho_i}\sum_jm_j\frac{\partial W_{ij}(h_i)}{\partial h_i}, \label{eq:omegai} \end{align} is a correction factor introduced by \cite{Spri02esph} to account for spatial variations in the value of the smoothing length, $h$. We use the difference form to evaluate Eqs.(\ref{eq:durad}) and (\ref{eq:dfrad}): \begin{align} &\left.\left(\frac{D\xi_i}{Dt}\right)\right|_{\rm diff}=\left.\left[-\frac{1}{\rho}\nabla\cdot(\rho{\bf f})\right]\right|_{i}\nonumber\\ &=-\sum_j \frac{m_j}{\Omega_i\rho_i^2}(\rho_i{\bf f}_i-\rho_j{\bf f}_j)\cdot\nabla_i W_{ij}(h_i), \label{eq:sphxi} \end{align} and \begin{align} &\left.\left(\frac{1}{\tilde{c}^2}\frac{D {\bf f}_i}{Dt}\right)\right|_{\rm diff}=\left.\left[-\frac{{\bf \nabla\cdot \mathbb{P}}}{\rho}-\frac{\chi\rho}{\tilde{c}}{\bf f}\right]\right|_{i}\nonumber\\ &=- \sum_{j}\frac{m_j}{\Omega_i\rho_i^2}\left ( \rho_i\xi_i\mathbb{F}_i -\rho_j\xi_j\mathbb{F}_j\right )\cdot\nabla_i W_{ij}(h_i)-\frac{\chi_i\rho_i}{\tilde{c}}{\bf f}_i. \label{eq:SPHdfrad} \end{align} The difference formulation subtracts the zeroth-order errors that occur in SPH explicitly, yielding first-order accuracy regardless of the underlying particle distribution. This results in superior numerical estimates of the divergence particularly near steep gradients. However, the difference estimate does not manifestly conserve flux, unlike the `symmetric' estimate\footnote{The `symmetric' SPH form can also help to regularize the particle distribution in hydrodynamics calculations, albeit by introducing purely numerical forces \citep{Pric12SPHMHD}. This is less important when propagating ionising radiation which does not usually exert strong forces on the gas particles.}. Fortunately, we find that the level of non-conservation of flux is small in our experiments (Typically less than one percent, better accuracy could be reached by increasing the order of the scheme, if required.). There is no known formulation that simultaneously avoids zeroth-order errors and is manifestly conservative in SPH \citep[see the discussion in][]{Pric12SPHMHD}. We add the term $-\chi_i\rho_i{\bf f}_i/\tilde{c}$ to Eq.~(\ref{eq:dfrad}) using operator splitting, \begin{align} {\bf f}_i(t+\Delta t)=\exp(-\chi_i\rho_i \tilde{c}\Delta t)\times{\bf f}_i(t). \end{align} Though this scheme in unconditionally stable, it nevertheless yields the wrong answer when the time-step, $\Delta t$, is too long. This could be avoided by limiting the time-step to $\Delta t\le 1/(\chi\rho \tilde{c})$, but that would result in unacceptably short time-steps in regions of high optical depth. Since in such regions the impact of radiation may be small anyway, we will limit the time-step by the usual\footnote{In the time-step determination, we will use the smallest $h$ of all neighbouring SPH particles and of the particle itself, to ensure stability and conservation.} Courant–Friedrichs–Lewy (CFL) condition, $\Delta t\le 0.1h/\tilde{c}$. To ensure that our results are physically meaningful, numerically stable and satisfy causality, we apply the following additional limiters at the beginning of each time-step: ({\em i}) $|{\bf f}|\le {\tilde c}\xi$, ({\em ii}) $\xi\ge 0$, and ({\em iii}) we zero unused components of ${\bf f}$ in 1D or 2D simulations. The latter limiter corrects for any numerical scatter of radiation into unused dimensions, as may happen if the Eddington tensor is non-zero but $|{\bf f}|$ is small. \subsubsection{Optically thin radiation} \label{sec:opticalthindir} In general, we set the propagation direction, $\hat{\bf n}$, to be that of the local flux, $\hat{\bf n}=\hat{\bf f}$. However, radiation propagates in a constant direction in the optically thin case. Since the flux is computed numerically, round-off errors or numerical noise may rotate the flux vector so that imposing $\hat{\bf n}=\hat{\bf f}$ does not guarantee that radiation travels in a straight line, even in the optically thin case. In some special cases, for example of light emanating from a single point source or the propagation of a plane parallel radiation front, the direction $\hat{\bf n}$ is known a priori, and we can therefore choose to simply impose the propagation direction, and use that direction to compute the optically thin Eddington tensor, Eq.~(\ref{eq:eddclose}). Not surprisingly, imposing the direction of radiation propagation yields spherical ionization regions around a point source (Fig.\ref{fig:stromgren3d_tm}) and casts sharp shadows behind optically thick absorbers even at low resolution (Fig.\ref{fig:radshadow3d}). Of course in general, the propagation direction $\hat{\bf n}$ is not generally known, for example, there may be several sources or an additional isotropic background, which require improvements of our scheme. \subsection{Discontinuity-capturing dissipation terms} \label{sec:artdiss} The fluid equations encoded in SPH are differential equations and hence need to be supplemented with extra terms in order to correctly capture discontinuities such as shocks and contact discontinuities. These terms broaden discontinuities by introducing numerical dissipation so that they can be resolved by the interpolation scheme \citep[see e.g][]{Mona97SPHRiem, Ager07SPH, Pric08artcon}. The SPH implementation of the moment method needs to be extended with similar dissipation terms to handle discontinuities in the radiation field, and we base these on the artificial diffusion and artificial viscosity terms of the SPH fluid equations. The energy dissipation term is similar to the {\it artificial diffusion} term in SPH hydrodynamics, \begin{align} \left.\left(\frac{{\rm D}\xi_i}{{\rm D} t}\right)\right|_{\rm diss}=\sum^N_{j=1}D_{\xi,ij}\frac{m_j}{\bar{\rho}^2}(\tilde{\rho_i\xi_i}-\tilde{\rho_j\xi_j})\frac{{\bf \hat{r}}_{ij}\cdot\overline{\nabla_i W_{ij}}}{r_{ij}}, \label{eq:xidiss} \end{align} where $\bar{\rho}=\sqrt{\rho_i\rho_j}$ is the geometric mean of the densities of the pair of interacting particles $i$ and $j$. If the density contrast is larger than 10, we found the scheme to be more stable with the choice $\bar{\rho}=\min(\rho_i,\rho_j)$, but this choice is not used in the tests in this paper. Flux dissipation can modelled with the {\it artificial viscosity} term in SPH hydrodynamics\footnote{This is not our default choice, see Eq.~(\ref{eq:fdissaniso}) below.}, \begin{align} \left.\left(\frac{{\rm D}{\bf f}_i}{{\rm D} t}\right)\right|_{\rm diss}=\left\{\begin{matrix} \sum^N_{j=1} D_{{\bf f},ij}\frac{m_j}{\bar{\rho}^2}(\rho_i{\bf f}_i-\rho_j{\bf f}_j)\cdot{\bf \hat{r}}_{ij}\frac{\overline{\nabla_i W_{ij}}}{r_{ij}},\\{\rm if}\; (\rho_i{\bf f}_i-\rho_j{\bf f}_j)\cdot{\bf \hat{r}}_{ij}<0,\\ \\ 0, \;{\rm otherwise}. \end{matrix}\right. \label{eq:fdiss} \end{align} In these expression, $D_{\xi, ij}$ and $D_{{\bf f}, ij}$ are the \lq artificial dissipation\rq\ coefficients, they have the units of a diffusion constant and we write them as \begin{align} D_{\xi,ij} = \alpha_{\xi,i} v_{{\rm sig},i}h_{i} +\alpha_{\xi,j} v_{{\rm sig},j}h_{j},\nonumber\\ D_{{\bf f},ij} = \alpha_{{\bf f},i} v_{{\rm sig},i}h_{i} +\alpha_{{\bf f},j} v_{{\rm sig},j}h_{j}\,.\nonumber\\ \label{eq:artDalpha} \end{align} Here, $v_{\rm sig}$ is the signal speed, \begin{align} v_{\rm sig} = |{\bf \hat{f}}\cdot{\bf \hat{r}}_{ij}| \tilde{c},, \label{eq:signalkappa} \end{align} and $(\alpha_{\bf f},\alpha_\xi)\leq 1$ are dimensionless numbers that quantify the strength of the numerical dissipation. The forms of Eqs.~(\ref{eq:xidiss}) and (\ref{eq:fdiss}) are consistent with the Riemann solver across the boundary of two SPH particles \citep{Mona97SPHRiem}. The kernel averaged over smoothing length is $\overline{\nabla_i W_{ij}} = 0.5[\nabla_iW_{ij}(h_j)+\nabla_iW_{ij}(h_j)]$. Eqs.~(\ref{eq:xidiss}) and (\ref{eq:fdiss}) are diffusion equations \citep[see e.g.][]{Jube04thcon,Pric08artcon}. The maximum value of the diffusion speed is $h\tilde{c}$, where $h$ is the particle size and $\tilde{c}$ is the propagation speed of the radiation. A numerical diffusion coefficient larger than this maximum value will result in numerical instabilities if the time-step is set by the CFL condition, $\Delta t\lesssim h/\tilde{c}$. \cite{Pric08artcon} set $\tilde{\rho_i\xi_i}=\rho_i\xi_i$, the values associated with individual SPH particles, and minimized the amount of numerical dissipation by choosing how the signal speed depends on local quantities. However, another way to minimize artificial dissipation is by reconstructing fluid quantities at the interface between particles \citep[see e.g.][]{Fron17CRKSPH,Ross19MAGMA2}. To do so, we reconstruct the radiation energy density at the interface using a Taylor series expansion, \begin{align} &\tilde{\rho_i\xi_i}-\tilde{\rho_j\xi_j} = |\hat{\bf f}\cdot\hat{\bf r}_{ij}|\{(\rho_i\xi_i-\rho_j\xi_j) \nonumber\\ &+\phi [\frac{h_i}{h_i+h_j}{\bf r}_{ji}\cdot\nabla(\rho_i\xi_i)-\frac{h_j}{h_i+h_j}{\bf r}_{ij}\cdot\nabla(\rho_j\xi_j)]\}, \label{eq:highorderdiss} \end{align} where $\phi$ is the slope limiter (implemented using the {\em minmod} function, {\em minmod}($x$)={\em max}(0,{\em min}($x$,1)) to minimize spurious oscillations. The term $\hat{\bf f}\cdot\hat{\bf r}_{ij}$ limits unwanted dissipation perpendicular to direction of the flux. We find that for $\alpha_\xi=1$, discontinuity-capturing is good while dissipation is small in smooth regimes. A discontinuity \lq detector\rq\\ for artificial diffusion is therefore not required. \cite{Chow97SRSPH} suggested turning off artificial dissipation when $(\rho_i{\bf f}_i-\rho_j{\bf f}_j)\cdot{\bf \hat{r}}_{ij}>0$, in order to reduce unnecessary diffusion, e.g. behind a discontinuity. However in our experiments we found that such a switch makes the scheme unstable, in particular in cases where radiation beams collide in the optically thin regime. The instability results in significant non-conservation of energy. We therefore do not use the \cite{Chow97SRSPH} switch, but instead apply a discontinuity detector to minimize the artificial viscosity as described in \S\ref{sec:dissswitch}. The artificial flux dissipation term of Eq.~(\ref{eq:fdiss}) causes numerical dissipation of the flux in directions perpendicular to the flux. This is problematic, in particular in the optically thin case\footnote{In the optically thick regime, $\chi$ already provides the necessary dissipation. This is one of the reason why the flux-limited diffusion does not require artificial dissipation. Another reason is that there are no artificial oscillations when solving a diffusion equation).} where it leads to the destruction of a packet of radiation as shown in Fig.\ref{fig:radstream2d_difdiss}. To avoid this, it requires that any artificial flux dissipation should be in the direction of the flux itself. Simply multiplying the right hand side of Eq.~(\ref{eq:fdiss}) by $\hat{\bf f}\cdot\hat{\bf r}_{ij}$ does not work: any component of numerical flux perpendicular to the actual flux, for example due to numerical noise, will still lead to the artificial destruction of an optically thin radiation packet\footnote{It is possible to use Eq. \ref{eq:fdiss} without disrupting radiation directions if the optically thin direction is imposed, as in \S\ref{sec:opticalthindir}. In this case, we will only consider the dissipation component (in Eq. \ref{eq:fdiss}) along the optically thin direction, and only consider the flux difference in that direction.}. A better solution is to implement the dissipation scheme as as anisotropic diffusion\footnote{`Anisotropic artificial viscosity' was also considered by \citealt{Owen04artvisaniso}, but our SPH form is simpler and different from theirs.}. Here we outline our {\it default} choice of {\it artificial flux dissipation}. We begin by rewriting Eq.~(\ref{eq:fdiss}) in the form of an anisotropic diffusion equation, \begin{align} \left.\left(\frac{{\rm D}{\bf f}}{{\rm D} t}\right)\right|_{\rm diss} &= \frac{1}{\rho} \nabla\cdot\left[ \mathbb{D}^{\bf f}\nabla\cdot(\rho{\bf f})\right],\nonumber\\ &\equiv\frac{1}{\rho} \nabla\cdot\left[ \rho\mathbb{D}^{\bf f}\,\psi\right]\,, \label{eq:fdissaniso} \end{align} where the tensor $\mathbb{D}^{\bf f}$ and the scalar $\psi$ are given by \begin{align} \mathbb{D}^{\bf f} &=\alpha_{\bf f} v_{\rm sig} h \hat{{\bf n}}\hat{{\bf n}}\nonumber\\ \psi &\equiv \rho^{-1}\,\nabla\cdot(\rho{\bf f})\,. \label{eq:fdissaniso2} \end{align} We implement the diffusion equation in SPH as \begin{align} \psi_i &=-\sum_j \frac{m_j}{\Omega_i\rho_i^2}(\rho_i{\bf f}_i-\rho_j{\bf f}_j)\cdot\nabla_i W_{ij}(h_i)\,, \label{eq:psianiso}\\ \left.\left(\frac{{\rm D}{\bf f}}{{\rm D} t}\right)\right|_{i,{\rm diss}} &=-\sum_{j} \frac{m_j}{\Omega_i\rho_i^2}\left (\rho_i\psi_i\mathbb{D}^{\bf f}_i - \rho_j\psi_j\mathbb{D}^{\bf f}_j\right )\cdot\nabla_i W_{ij}(h_i). \end{align} This formulation of anisotropic viscosity in SPH is novel and we suggest that it may be applicable to other situations as well, for example when implementing magneto-hydrodynamics or cosmic ray propagation. \subsubsection{A switch for applying flux dissipation} \label{sec:dissswitch} Clearly it would be advantageous to activate flux dissipation only near discontinuities in the radiation, which requires efficient detection of such discontinuities. Such switches are also regularly used to activate dissipation in the SPH equations for hydrodynamics itself. \cite{Morr97artvisswitch} proposed to use the divergence of the velocity as a measure of how discontinuous the fluid flow evolves, but this cannot distinguish compression - which conserves entropy - from true discontinuities. In addition, flux dissipation may be activated unnecessarily in the case of wave-like disturbances. \cite{Ross19entropyswitch} suggested to use changes in entropy as a discontinuity detector, however it is not clear how to apply this in the case of radiation. \citep{Cull10} suggested to track the time derivative of the velocity divergence, $\nabla\cdot {\bf v}$, so that the diffusion coefficient is of the form $h^2\,|\dot\nabla{\bf v}|/v_{\rm sig}^2$, where $v_{\rm sig}$ is the signal velocity. This effectively corresponds to a switch that is based on the second time-derivative of the density and hence can distinguish between gas in the pre- and post-shock regions. Such a switch is implemented in {\small SPHENIX}. Inspired by the \cite{Cull10} switch and after experimenting with various forms of how their expression can be applied to the case of radiation, we settled on the following target value for the diffusion coefficient, \begin{align} \alpha_{{\bf f},{\rm aim}}={\rm min}\left({\rm max}\left\{-\frac{Ah^2}{\rho\xi \tilde{c}^2}\frac{{\rm D}[\nabla\cdot(\rho{\bf f})]}{{\rm D}t},0\right\},1\right)\,. \label{eq:alphaf} \end{align} The denominator is $\rho\xi \tilde{c}^2$ rather than $\rho|{\bf f}|\tilde{c}$ because $\rho c\xi\gg|\rho{\bf f}|$ in the optically thick limit where artificial dissipation is not needed. $A(=200)$ is a constant multiplication factor to compensate for the large $\tilde{c}^2$ in the equation. Upstream from a discontinuity, we require that the diffusion coefficient be large enough so that the discontinuity can be captured by the interpolation scheme. Downstream from the discontinuity, a smaller level of diffusion is still required to suppress any numerical oscillations. We follow \cite{Morr97artvisswitch} and implement this by making the diffusion coefficient time-dependent, as follows: (1) when $\alpha\le \alpha_{\rm aim}$, we set $\alpha=\alpha_{\rm aim}$; (2) when $\alpha\ge \alpha_{\rm aim}$, we evolve $\alpha$ back to $\alpha_{\rm aim}$ by solving \begin{align} \frac{{\rm D}}{{\rm D}t}(\alpha-\alpha_{\rm aim})=-\frac{1}{\tau_{\rm relax}}=-(\tilde{c}/h +\tilde{c}\chi\rho), \end{align} where $\tau_{\rm relax}$ is the relaxation time scale. The term $\tilde{c}\chi\rho$ ensures that a large value for the $\alpha$ quickly relaxes back to the target value in the optically thick yet smooth regime. Finally, for gas particles in which we inject radiation we set $\alpha=1$ to better capture any discontinuities associated with radiation injection. Before ending this section, we comment on the required number of SPH neighbour loops associated with our RT scheme. If the radiation moment and hydrodynamics equations (Eqs. \ref{eq:masscon}-\ref{eq:dfrad}) are solved simultaneously, then at least three neighbour loops are required to compute the right-hand-size of the anisotropic diffusion equation, Eq.~(\ref{eq:fdissaniso}): the variable $\psi$ in Eq.~(\ref{eq:fdissaniso2}) requires (1) a loop to compute $\rho$ and (2) a second loop to compute the gradient; and finally the scheme requires (3) a third loop to compute the gradient of $\psi$ Eq.~(\ref{eq:fdissaniso}). Similarly, the dissipation switch of Eq.~(\ref{eq:alphaf}) requires three loops. The scheme may be optimized by solving the radiation transport equation on a shorter time-scale than used to update the hydrodynamics. During such sub-cycling, the density is kept a constant, in which case the radiation transport only requires two SPH neighbour loops. We will report on such improvements elsewhere. \subsection{Tests of the Eddington tensor closure and artificial dissipation schemes} \label{sec:testartdiss} \begin{figure} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_frad_RadStream2D_4difdiss.png} \caption{A packet of radiation propagating upwards (from $x=0$ to $x=2$) over a 2D glass-like distribution of $48\times192$ particles shown at time $t=0.4$; the reduced speed of light is $\tilde{c}=1$ and the extent of the simulation volume is $\Delta x=2$ in the vertical direction and $\Delta y=0.5$ in the horizontal direction. Colours represent the radiation energy density $\xi$ and small red-arrows the radiation flux density, ${\bf f}$. Panels from left to right illustrate the {\it default}, {\it isomax}, {\it none} and {\it original} choices for the artificial dissipation and closure scheme (see text). The optical depth of the medium is zero and the packet should propagate freely at the speed of light while retaining its square form. With isotropic artificial dissipation ({\it isomax}) or with the {\it original} closure scheme, the radiation packet incorrectly dissolves quickly. The case without artificial dissipation ({\it none}) results in strong oscillations which leads to significant non-conservation of energy. The {\it default} choice correctly maintains the morphology of the beam while suppressing artificial numerical oscillations.} \label{fig:radstream2d_difdiss} \end{figure} A test of the artificial dissipation scheme and the choice of the Eddington tensor closure by propagating a single short beam of light is illustrated in Fig.~\ref{fig:radstream2d_difdiss}. The underlying $48\times192$ particle distribution is glass-like. The figure shows four choices of the artificial dissipation and closure relation labelled {\it default}, {\it isomax}, {\it none}, and {\it original}: \begin{itemize} \item {\it default}: uses the {\it default} artificial dissipation of Eqs.~\ref{eq:xidiss}, \ref{eq:highorderdiss}, and \ref{eq:fdissaniso} described in \S\ref{sec:dissswitch}, and the {\it default} modified closure M1 scheme of Eq.~(\ref{eq:codeest}); \item {\it isomax}: uses isotropic artificial dissipation of Eqs.~ \ref{eq:xidiss} and \ref{eq:fdiss}, setting $\alpha_{\bf f}=\alpha_\xi=1$, see Eq.~(\ref{eq:artDalpha}), and the {\it default} modified closure scheme; \item {\it none}: does not use any artificial dissipation (i.e. $\alpha_{\bf f}=\alpha_\xi=0$ in Eq.~\ref{eq:artDalpha}) and the {\it default} closure scheme; \item {\it original}: uses the {\it default} artificial dissipation but the `{\it original}' closure Eq.~(\ref{eq:feddcon}). \end{itemize} Figure~\ref{fig:radstream2d_difdiss} demonstrates that artificial diffusion is needed to suppress the artificial oscillations seen in panel {\it none}: oscillations lead to non-physical negative values of $\xi$, which, if zeroed, lead to a catastrophic artificial increase in radiation energy. However, such diffusion should be anisotropic to avoid that the beam artificially diffuses perpendicular to the propagation direction as seen in panel {\it isomax}. The {\it original} scheme fails to preserve the beam's shape: it does not handle well non-uniform particle distributions. Fortunately, our {\it default} scheme preserves the beam shape, suppresses artificial oscillations and conserves energy. \subsection{Implementation details} \label{sec:code} Our RT scheme is implemented in the public version of the {\small SWIFT} ({\bf S}PH {\bf w}ith {\bf i}nterdependent {\bf f}ine-grained {\bf t}asking) code \citep{Scha16SWIFT}\footnote{\url{http://swift.dur.ac.uk/}}, which has been applied in galaxy formation and planetary giant impact simulations \citep{Kege19planetimpact}. The target application of {\small SWIFT} are zoomed cosmological simulations and simulations in representative volumes, with subgrid physics modules similar to {\sc eagle} \citep{Scha15EAGLE}. {\small SWIFT} is an SPH code that solves cosmological or non-cosmological hydrodynamic equations, including self-gravity, and is designed to work on hybrid shared/distributed memory computer architectures. Load balance is optimised using task-based parallelism, with tasks assigned by a graph-based domain decomposition, and using dynamic, asynchronous communication. For hydrodynamics, \cite{Borr18SWIFT} found {\small SWIFT} to have good weak scaling from 1 to 4096 codes (losing only 25\% performance) in low redshift cosmological galaxy simulations (with {\small EAGLE} physics from \citealt{Scha15EAGLE}). The time-stepping of the RT scheme follows the \cite{Hern89TREESPH} factor-of-two time-step hierarchy implemented in {\small SWIFT}: a particle with time-step $\Delta t$ is assigned to the time-step bin $N$ such that $2^{\rm N} \le \Delta t/t_{\rm min} < 2^{\rm N+1} $, where $t_{\rm min}$ is some small minimum time-step. At each step in time, the radiation field in particles in all bins $N$ with $N \le M$ are updated with a forward Euler method, where $2^M t_{\rm min}$ is the time-step of the active particles with the largest time step (see \citealt{Borr18SWIFT} for the time-stepping strategy in {\small SWIFT} in the absence of RT). When hydrodynamics and other processes are included, the time-step of each individual particle is the minimum time-step required by all these processes combined, although typically the radiation time-step ($\Delta t_{\rm rad}\sim 0.1 h/\tilde{c}$) is the most limiting. We do not (yet) sub-cycle the radiative transport step, therefore all processes (including gravity and hydrodynamics) are integrated using the smallest time-step. This is an avenue for future optimization. However, we {\em do} sub-cycle the thermo-chemistry differential equations, as described in \S\ref{sec:thermochemisty}. This leads to significant saving in computation time, since the time-step associated with these chemistry equations can be orders of magnitude shorter than the RT time step. \subsection{The Reduced Speed of Light approximation} \label{sec:RSL} When radiation travels at the speed of light, the time-step to advance a radiation front correctly is of order $\Delta t_c\sim h/c$, for a smoothing length $h$ of an SPH particle. This is, of course, much shorter than the CFL step, which is of order $\Delta t_s\sim h/v_s$, where $v_s$ is the sound speed. However, ionising radiation with flux $F$ moves at the speed of the ionization front, $v_I\sim F/(2\pi n_{\rm H}\hbar\nu)$, through neutral gas with density $n_{\rm H}$. When $v_I\ll c$, the code can be sped up by a large factor by reducing the speed of light, from $c$ to $\tilde c$. As long as $\tilde c>v_I$, the speed of an ionization front can still be correct for a given $F$ (see e.g. the discussion in \citealt{Rosd13ramsert}). This \lq reduced speed of light\rq\ (RSL) approximation was introduced by \citet{Gned01OTVET} to simulate radiative transfer efficiently and has been applied to other radiative transfer simulations, e.g. by \cite{Aube08M1}. They demonstrate that RSL performs well in problems involving ionization, photo-heating, and expansion of HII regions. However, there is no unique way to implement RSL. \cite{Skin13M1} implemented the RSL approximation in simulating RT in the interstellar medium, e.g. modeling radiation reprocessed by dust. However, their approach does not conserve total radiation plus matter energy and momentum, and the non-equilibrium solution might not be correct. \cite{Ocvi19DSL} examined the \lq dual speed of light\rq\ (DSL) approximation, where $c\to\tilde c$ in the propagation equation but not in the thermo-chemistry equations. Unfortunately, DSL fails to reproduce the correct equilibrium gas properties. This is because when $c$ is reduced to $\tilde c$ in the propagation equation, the photon-matter interaction rate does not change accordingly in DSL. This can be seen by considering the analytical solution of the Str\"omgren sphere (Appendix \ref{sec:anaStromgren}), \begin{align} n_{{\rm HI}}{c}\sigma_\gamma n_\gamma&= \left(\frac{c}{\tilde c}\right) \frac{n_{{\rm HI}}\sigma_\gamma \dot{N}_\gamma}{4\pi r^2}\exp\left(-\int^r_0n_{\rm HI}\sigma_\gamma {\rm d}r\right)\nonumber\\ &=\,n_en_{{\rm HII}}\alpha_B\,, \label{eq:rslstromgren} \end{align} where the factor ${\tilde c}$ arises from the propagation equation in the optically thin limit, and the factor $c$ comes from the thermo-chemistry equation. The equilibrium neutral fraction will deviate from the correct solution due to the ${c}/{\tilde c}$ factor. Thus, our {\it default} treatment is to replace $c\to\tilde c$ in all equations \citep{Aube08M1,Rosd13ramsert}, including the propagation and thermo-chemistry equations. For a fixed photon flux, $F$, (or photon injection rate), this choice reduces the interaction strength between light and matter (e.g. $\sigma_\gamma \tilde{c}$) to compensate for higher photon density (due to the slower photon propagation speed). As a result, the photo-ionization rate will be independent of $\tilde{c}$ (as long as $\tilde{c}$ is larger than other speeds). Furthermore, the choice of $\tilde{c}$ will {\it not} affect the equilibrium gas properties, as demonstrated in Eq. \ref{eq:rslstromgren} (and see the tests in next sections). However, there are limitations to RSL. First, $\tilde{c}$ should exceed the speed $v_I$ of any ionization front. For example, \cite{Baus15Hreion} showed that using $\tilde{c}=c/10$ affects the timing of reionization. Another issue of RSL is that using ${\tilde c}<c$ increases the momentum term $\nabla(\mathbb{F}E)$, and if this is not corrected for then the radiation pressure will be too large \citep[see also][]{Jian12VET,Jian18}. This may be problematic in cases where radiation pressure is crucial, for example when modelling radiation pressure from AGN. In the case of reionization simulations, the photon-density is low and radiation pressure is mostly neglected anyway. \subsection{Thermo-chemical processes} \label{sec:thermochemisty} In this section we briefly describe how we implement the interaction between matter and radiation, limiting the discussion to the particular case of ionizing radiation in a pure hydrogen gas. \subsubsection{Pure Hydrogen Gas thermo-chemistry} The processes of collisional ionization and photo-ionization, photo-heating, and collisional and radiative cooling in a hydrogen gas are \citep[e.g.][]{Aube08M1}: \begin{align} \frac{\partial n_\gamma}{\partial t}&=\frac{\rho(\Lambda_\xi+S_\xi)}{2\pi\hbar\bar{\nu}}\nonumber\\ &=-n_{{\rm HI}}\tilde{c}\sigma_\gamma n_\gamma + n_en_{{\rm HII}}(\alpha_A-\alpha_B)+S_\gamma\,, \label{eq:dngammadt} \end{align} \begin{align} \frac{\partial {\bf f}_\gamma}{\partial t}&=-\chi\rho\tilde{c}{\bf f}_\gamma+\frac{\rho{\bf S}_{\bf f}}{2\pi\hbar\bar{\nu}}=-n_{{\rm HI}}\tilde{c}\sigma_\gamma {\bf f}_\gamma + {\bf S}_\gamma\,, \label{eq:dfgammadt} \end{align} \begin{align} \frac{\partial n_{{\rm HI}}}{\partial t}&=-n_{{\rm HI}}\tilde{c}\sigma_\gamma n_\gamma +n_en_{{\rm HII}}\alpha_A-n_e n_{{\rm HI}}\beta\,, \label{eq:dnH0dt} \end{align} \begin{align} \frac{\partial e_{\rm tot}}{\partial t} &= \rho\frac{\partial u}{\partial t} =\rho(S_u+\Lambda_u)\nonumber\\ &=\epsilon_\gamma n_{{\rm HI}}\tilde{c}\sigma_\gamma n_\gamma - n_{{\rm HI}}n_e\Gamma_{e{\rm HI}}-n_{{\rm HII}}n_e\Gamma_{e{\rm HII}}\,. \label{eq:dedt} \end{align} \begin{comment} In addition to the variables described in section \ref{sec:two-moment}, $n_{\rm X}$ is the number density of element species $X$ ({\em i.e} neutral and ionised hydrogen, and electrons), $e_{\rm tot} \equiv \rho u = \frac{3}{2}n_{\rm tot}k_{\rm B}T$ is the thermal energy density of the fluid, $n_{\rm tot}=\rho/(\mu m_{\rm H})=n_{\rm HI}+2\times n_{\rm HII}$ is the total number density of all particles, $\mu=1/(2-x)$ is the mean molecular weight and $x\equiv n_{\rm HI}/n_{\rm H}$ is the neutral fraction {\color{red}(sometimes we refer the neutral fraction as $x_{\rm HI}$)}. Furthermore, $\alpha_A$ and $\alpha_B$ are the \lq case A\rq\ and \lq case B\rq\ recombination coefficients, respectively, $\beta$ is the collisional ionization coefficient, $\sigma_\gamma$ is the photoionization cross section, $\Gamma_{e{\rm HI}}$ is the collisional cooling rate per unit volume (combining collisional ionization and collisional excitation), $\Gamma_{e{\rm HII}}$ represents the sum of recombination cooling and thermal Bremsstrahlung, and $\epsilon_\gamma$ is the photoionization heating energy per ionization. The values of these coefficients, together with their dependence on photon frequency, $\nu$, and/or gas temperature, $T$, are listed in Appendix \ref{sec:heatcoolparam}. Finally, $S_\xi$ and $S_\gamma$ are external sources of photons. \end{comment} Eq.~(\ref{eq:dngammadt}) accounts for changes in the photon density due to the sink term $\Lambda$ and the source term $S$ (see \S\ref{sec:two-moment}). In the second line, we specialize the sink term to photo-ionization ($\sigma_\gamma$ is the photo-ionization cross-section and $n_{\rm HI}$ is the neutral hydrogen number density) and add recombination as a source term ($\alpha_A$ and $\alpha_B$ are the \lq case A\rq\ and \lq case B\rq~ recombination coefficients, respectively). The final term $S_\gamma$ represents any other source of photons. Eq.~(\ref{eq:dfgammadt}) is the corresponding equation for the photon flux ${\bf f}_{\gamma}$, which includes a photo-ionization term and a source term. Eq.~(\ref{eq:dnH0dt}) accounts for the corresponding changes in the density of neutral hydrogen, $n_{\rm HI}$. The terms on the right hand side are the photo-ionization, recombination, and collisional ionization rates respectively ($n_{\rm HII}$ is the density of ionized hydrogen, $n_e$ is the electron density and $\beta$ is the collisional ionization coefficient). Eq.~(\ref{eq:dedt}) is the corresponding thermal energy equation ($e_{\rm tot}$ is the internal energy per unit volume and $u$ is the internal energy per unit mass). In the second line, terms from left to right are, respectively, photo-ionization heating ($\epsilon_\gamma$ is the excess thermal energy per ionization) and gas cooling (quantified by the coefficients $\Gamma$). The values of the various constants and coefficients, together with any dependence on photon frequency, $\nu$, and/or gas temperature, $T$, are summarized in Appendix \ref{sec:heatcoolparam}. The above set of differential equations is in general numerically stiff, meaning that the numerical solution is unstable unless the equations are integrated in time using a very short time-step, $\Delta t$. The reason is that the coefficients in these equations are large in some situations, e.g. $n_{\rm HI}\tilde{c}\sigma_\gamma n_{\gamma}$ is large in the neutral region near radiation sources. The usual remedy is to use an implicit scheme because this is stable, however its solution may not be sufficiently accurate. Our strategy described below is to combine explicit and implicit methods. \subsubsection{Solving the thermo-chemistry equations with a semi-implicit scheme combined with sub-cycling} \label{sec:semiimplicit} To illustrate the solution method we make the \lq on-the-spot\rq\ approximation by assuming that recombinations directly to the ground state produce an ionizing photon that is absorbed close to where it was emitted ({\em i.e.} \lq on the spot\rq). In this approximation we set $\alpha_A=\alpha_B$, resulting in the following set of three coupled differential equations, \begin{align} \frac{\partial n_\gamma}{\partial t}&=-x n_{{\rm H}}\tilde{c}\sigma_\gamma n_\gamma, \label{eq:OTSngamma} \end{align} \begin{align} \rho\frac{\partial u}{\partial t}= \epsilon_\gamma x n_{\rm H} \tilde{c}\sigma_\gamma n_\gamma - n^2_{\rm H}x(1-x)\Gamma_{e{\rm HI}}-n^2_{\rm H}(1-x)^2\Gamma_{e{\rm HII}}, \label{eq:thermaleq} \end{align} \begin{align} \frac{\partial x}{\partial t}&=-x \tilde{c}\sigma_\gamma n_\gamma +(1-x)^2n_{{\rm H}}\alpha_B-x(1-x)n_{\rm H}\beta, \label{eq:chemHeq} \end{align} where $x=n_{\rm HI}/n_{\rm H}$ is the neutral hydrogen fraction. Note that we denote neutral fraction as $x_{\rm HI}$ in the figures for clarity and as $x$ in text for simplicity. The partial time derivatives refer to changes due to interaction between radiation and gas only. There may be additional terms, for example, due to other photon sources or sinks, and heating and cooling due to adiabatic processes or shocks. Here, we restrict ourselves to solving these radiative equations, treating any other source/sink terms in operator split fashion. We integrate these equations following the approach of \cite{Petk09OTVET}: solve the first two equations explicitly and use that solution to solve the third equation (the chemistry equation) implicitly. However, we additionally perform {\it sub-cycling}, requiring that $n_\gamma$ and $u$ do not change by more than 10\% in each sub-cycle. We do so by requiring that $\Delta t\le 0.1\,{\rm min}(1/(x n_{{\rm H}}c\sigma_\gamma), u/|\partial u/\partial t|)$. While the implicit solver for the neutral fraction $x$ is unconditionally stable, it can be inaccurate if the time-step is too large. Therefore, we further limit the sub-cycle time-step to $\Delta t\le \mathit{C}x/|\partial x/\partial t|$, where $\mathit{C}$ is a parameter we choose to be 0.1 (but can be larger depending on the tolerance). So in summary, we take the sub-cycling step to be \begin{align} \Delta t=0.1\,{\rm min}(\frac{n_\gamma}{|\partial n_\gamma/\partial t|}, \frac{u}{|\partial u/\partial t|}, \frac{x}{|\partial x/\partial t|})\,. \label{eq:chemHeqDt} \end{align} Fig. \ref{fig:subcyclethermal} illustrates the semi-implicit sub-cycle scheme. \begin{figure} \begin{center} \includegraphics[width=0.6\textwidth]{figures/subcycle_schematic.png} \caption{A schematic diagram illustrating the sub-cycling method for solving non-equilibrium thermo-chemistry equations. In the main loop, we advance the radiation, hydrodynamics, gravity, and radiation injection equations, and any other equations not related to radiation ({\em e.g.} sub-grid schemes). In between we sub-cycle the thermo-chemistry equations (Eqs.~\ref{eq:OTSngamma}, \ref{eq:thermaleq} \& \ref{eq:chemHeq}), with a smaller time-step. Note that the whole set of the thermo-chemistry equations is solved sequentially within one sub-cycle, accurately accounting for any rapid changes of ionization state or photon density.} \label{fig:subcyclethermal} \end{center} \end{figure} We update $n_\gamma$ using the analytic solution of Eq.~(\ref{eq:OTSngamma}) in case $x$ and $n_{\rm H}$ are held constant, \begin{align} n_\gamma(t^{n+1})=n_\gamma(t^{n})\exp(-\Delta t \sigma_\gamma c n_{\rm H}x)\,. \end{align} Doing so guarantees that $n_\gamma$ is always positive, as it should be, and that the solution is asymptotically correct when recombinations are negligible. We update $u$ using the corresponding analytical solution of Eq.~(\ref{eq:thermaleq}). The implicit solution to the chemistry equation uses the updated values for the radiation and internal energies, \begin{align} &\frac{x(t^{n+1})-x(t^n)}{\Delta t} = - \tilde{c} \sigma_\gamma n_\gamma (t^{n+1}) x(t^{n+1})\nonumber\\ &+n_{\rm H}\alpha_B(t^{n+1})[1-x(t^{n+1})]^2- n_{\rm H}\beta(t^{n+1}) x(t^{n+1})[1-x(t^{n+1})]\,. \end{align} which is a quadratic equation for $x(t^{n+1})$. This method can be generalised to the case of more elements by adopting the approach of \cite{Anni97multchem}, {\em i.e.} updating each element implicitly one by one in order of increasing timescale. A possible alternative scheme uses the {\small CVODE} library \citep{Cohe96CVODE} to solve these stiff equation, {\em e.g.} \cite{Kann19AREPORT}. For now, we have restricted this discussion to the on-the-spot approximation. This limitation can be relaxed by adding recombination radiation as a source terms to each gas particle. Given that the computing time of our RT scheme is independent of the number of sources, this could be feasibly implemented in the future. Our semi-implicit sub-cycling scheme is accurate, as we show below, as well as computationally efficient, as shown in Appendix \ref{sec:thermochemsub}. Sub-cycles are initiated only when the system is out of equilibrium, for example when a source of photons is suddenly switched on. But even in such situations, we find that only a few dozen sub-cycles occur. Sub-cycling should also help with load balancing the computation. Without sub-cycling, most of the computing time will be spent in the vicinity of ionization fronts, where the thermo-chemistry is highly out of equilibrium. With sub-cycling enabled, the time-step of the main loop is instead limited by the overall CFL time-step. We proceed by showing some tests of the thermo-chemistry implementation. \subsubsection{Thermo-chemistry test I: ionizing a single gas parcel} \label{sec:singlegasparcel} This test is a variation of Test 0 in \cite{Ilie06RTcom}: an initially neutral parcel of pure hydrogen gas at low temperature is suddenly ionized and heated by a source of ionizing radiation with a specified spectrum of ionizing photons. After a specified time, the ionizing source is switched off. The total density of the gas parcel is kept constant. The radiation is assumed to be optically thin at all times. The test involves following the evolution of the neutral fraction, $x$, and of the temperature of the gas, $T$. To enable a fair comparison between codes, it is, of course, important to make sure that the physical constants used - such as, for example, the frequency dependence of the ionization cross section - are the same. As the source is switched on and the hydrogen gas gets ionized, the temperature increases to a value that depends on the shape of the ionizing spectrum. The gas is then in ionization equilibrium. However, it takes longer for the gas to be in thermal equilibrium - where photo-heating balances radiative cooling. When the source is switched off, the gas starts to recombine and cool. We do not include molecule formation in the calculation, and hence the cooling rate drops with decreasing $T$. \noindent $\bullet$ {\bf Analytical description} The evolution can be understood by writing Eq.~(\ref{eq:chemHeq}) as a Ricatti equation, \begin{align} \frac{dx}{dt}&=-\frac{x}{\tau_i}+\frac{(1-x)^2}{\tau_r}-\frac{x(1-x)}{\tau_e}\equiv\frac{1}{\tau}(x-x_1)(x-x_2)\,, \end{align} where we defined three characteristic time-scales, \begin{align} \tau_i&\equiv \frac{1}{c\sigma_\gamma n_\gamma}\,;\quad \tau_e\equiv\frac{1}{n_H\beta}\,;\quad \tau_r\equiv \frac{1}{n_H\alpha_B}\,, \end{align} and \begin{align} \frac{1}{\tau}&=\frac{1}{\tau_e}+\frac{1}{\tau_r}\,;\quad x_1+x_2=2+\frac{\tau_r}{\tau_i}\,;\quad x_1x_2=\frac{\tau}{\tau_r}\,. \end{align} Choosing initial condition $x=x_0$ at $t=0$, the general solution in case all $\tau$'s are constant, is \begin{align} x(t) &= \frac{x_2(x_0-x_1)-x_1(x_0-x_2)f(t)} {(x_0-x_1)-(x_0-x_2)f(t)}\nonumber\\ f(t)&=\exp[-(x_1-x_2)t/\tau]\,. \label{eq:xt} \end{align} In the special case where collisional ionizations are neglected, $\tau_e\to\infty$ and when $\tau_i\ll \tau_r$, this solution simplifies to approximately $x(t)=x_0 \exp(-t/\tau_i)+\tau_i/\tau_r$: the neutral fraction approaches its {\it ionization equilibrium} exponentially on the ionization timescale, $\tau_i$. This approximate description assumes that $\tau_r$ - and hence the temperature of the gas - remains a constant. An estimate of the change in temperature following rapid ionization, $\tau_i\ll \tau_r$, follows from neglecting radiative cooling in the short time it takes to ionize the gas, so that \begin{align} \rho\frac{du}{dt}&\approx -\epsilon_\gamma \frac{dn_{\rm HI}}{dt}=-\epsilon_\gamma\,n_{\rm H}\frac{dx}{dt}\,, \end{align} where $\epsilon_\gamma$ is the mean energy injected into the gas per photo-ionization, see \S A. Writing the thermal energy per unit mass, $u$, in terms of the neutral fraction, $x$, as $u=k_{\rm B}T/(\mu m_{\rm H})$ with $\mu=(2-x)^{-1}$, yields the following relation between the initial temperature $T=T_0$ at $t=0$, and the temperature $T$ when the neutral fraction is $x$: \begin{align} k_{\rm B}T&=\frac{2-x_0}{2-x}k_{\rm B}T_0+\frac{2\epsilon_\gamma}{3}\frac{x_0-x}{2-x}\,. \end{align} In the test described below, the gas is initially neutral, $x_0=1$, and at low temperature, $k_{\rm B}T_0\ll \epsilon_\gamma$, and the photo-ionization rate is high so that in photo-ionization equilibrium, $x\ll 1$. In this case, the photo-ionization equilibrium temperature is $T_1\approx \epsilon_\gamma/(3k_{\rm B})$, which depends only on the ionization energy per photon, regardless of radiation intensity or gas density. On a longer timescale, the parcel of gas will reach thermal equilibrium (temperature $T_2$), where photo-heating balances radiative cooling. Provided $T_2>T_1$, the timescale to reach this equilibrium can be estimated by simply neglecting cooling and noting that the rate at which the gas is heated is approximately the product of the ionization rate, $x/\tau_i$, times the energy injected per photo-ionization per hydrogen atom, $\epsilon_\gamma/m_{\rm H}$, hence \begin{align} \frac{{\rm d}u}{{\rm d}t}=\frac{\epsilon_\gamma}{m_{\rm H}}\frac{x}{\tau_i}\approx \frac{\epsilon_\gamma}{m_{\rm H}\,\tau_r}\,. \end{align} Therefore it takes approximately a recombination time to reach thermal equilibrium (see also \citealt{Pawl11multifRT}). When the source is suddenly switched off, gas will start to recombine. This is still described by a Ricatti equation of the form of Eq.~(\ref{eq:xt}), except that now \begin{align} x(t) &= \frac{x_2(x_{\rm eq}-x_1)-x_1(x_{\rm eq}-x_2)f(t)} {(x_{\rm eq}-x_1)-(x_{\rm eq}-x_2)f(t)}\nonumber\\ f(t)&=\exp[-(x_1-x_2)(t-t_{\rm eq}))/\tau]\,, \label{eq:xt2} \end{align} where $x_{\rm eq}$ is the neutral fraction in thermal equilibrium, $t_{\rm eq}$ is the time that the ionizing source is switched off, and $x_1+1/x_1=1+\tau/\tau_r$ with $x_2=1/x_1$. If the gas is no longer heated, it will of course simply keep on cooling and there is no further equilibrium state. \noindent $\bullet$ {\bf Numerical solution} For the numerical values for this test, we take\footnote{Note that the value of ${\tilde c}$ is irrelevant to the solution since the pure thermo-chemistry equation is independent of ${\tilde c}$ if $F_{\rm photon}$ is given.} ${\tilde c}=c$, $n_{\rm H}=1~{\rm cm}^{-3}$, $x_0=1$ and $T_0=100~{\rm K}$. From time $t=0$, the parcel of gas is being irradiated with a black body spectrum of temperature $T=10^5{\rm K}$ (for which $\epsilon_\gamma=6.33\,{\rm eV}$ in the optically thin limit) and photon flux $F_{\rm photon} = 10^{12} \;{\rm photons}\;{\rm s}^{-1}\;{\rm cm}^{-2}$. The source is switched off after a time $t_s=5\times 10^7 {\rm yr}$ and we follow the evolution until time $t_e=10^8 {\rm yr}$. For a reference temperature of $T=10^4~{\rm K}$, the three timescales are $\tau_i\approx 10^{-2.3}{\rm yr}$, $\tau_r\approx 10^{5.1}{\rm yr}$ and $\tau_e\approx 10^{9.3}{\rm yr}$, so that $\tau_i\ll \tau_r\approx\tau\ll t_e<\tau_e$. The temperature in photo-ionization equilibrium is $T=6.33~{\rm eV}/(3k_{\rm B})\approx 10^{4.39}{\rm K}$, and the temperature in thermal equilibrium is about twice that. The timescale for the gas to reach thermal equilibrium can be estimated as follows. The heating rate of the gas, when in photo-ionization equilibrium, is $du/dt\approx \epsilon_\gamma/\tau_r\approx 8.3\times 10^{-11}{\rm erg}~{\rm Myr}^{-1}$. Therefore the timescale to reach thermal equilibrium is approximately \begin{align} t_{\rm eq}\approx \frac{\Delta u}{du/dt}=\frac{u_{\rm eq}-u_i}{du/dt}\approx \frac{u_i}{du/dt}\approx 10^{5.1}~{\rm yr}\,, \end{align} where we have used the fact that for the parameters of this test, $u_{\rm eq}\approx 2 u_i$. In summary: the gas should reach its photo-ionization equilibrium temperature by a time $\tau_i$, reach its thermal equilibrium temperature by the time $t_{\rm eq}$, and start to cool and recombine after time $t_s$. We want to verify that the combination of explicit sub-cycling and implicitly solving the chemistry equations yields the correct solution, independently of a globally imposed time-step. To demonstrate the accuracy of the integration scheme, we also want to compare to a run in which we integrate the equations with a short, fixed time-step. However, the ionization timescale $\tau_i$ is much smaller than the evolution timescale $t_e$, and it is impractical to simulate the whole time evolution with a time-step much shorter than $\tau_i$. Here we follow \cite{Pawl11multifRT} and perform a dozen simulations with different (fixed) time-steps, from $\Delta t\ll \tau_i$ to $\Delta t\gg \tau_i$. \begin{figure} \includegraphics[width=0.45\textwidth]{figures/singlecelltestTvsT_realc.png} \caption{A variation of \protect\cite{Ilie06RTcom} Test 0: photo-heating of a single gas parcel irradiated with black body radiation of temperature $T=10^5~{\rm K}$. The source is switched off after time $t_s=5\times 10^7{\rm yr}$. Vertical dashed lines indicate the ionization timescale $\tau_i$ ({\em red}) and the time to reach thermal equilibrium, $t_{\rm eq}$ ({\em black}), horizontal dashed lines indicate the expected photo-ionization equilibrium temperature (or neutral fraction) ({\em red}) and the thermal equilibrium temperature ({\em black}). {\em Points with different colours} show the evolution computed with different, fixed, global time-steps, as per the legend. Simulations with different $\Delta t$ step sizes yield the same evolution, which also matches the analytical estimate a well as the curves in \protect\cite{Ilie06RTcom} and \protect\cite{Pawl11multifRT} (not shown here).} \label{fig:SCTrealc} \end{figure} Results are shown in Fig. \ref{fig:SCTrealc}, where differently coloured curves show the evolution for different values of the global time-step, $\Delta t$. All curves follow the analytical expectation: gas heats and gets almost fully ionized on a timescale $\tau_i$ (vertical dashed red line), reaching its photo-ionization equilibrium temperature (horizontal dashed line), continues to be heated on a timescale $\tau_r$ (vertical dashed black line) to reach thermal equilibrium (horizontal dashed black line), and finally starts to recombine and cool when the source is switched off. All simulation runs fall on top of each other, demonstrating that the numerical solution is independent of the global fixed value of $\Delta t$. After the radiation is switched off, gas recombines and cools rapidly to $T\sim 10^4{\rm K}$, below which the cooling rate drops rapidly as we only include cooling by neutral hydrogen. There are two major takeaways from Fig. \ref{fig:SCTrealc}. Firstly, the simulated evolution follows the analytical expectation as well as the results from other simulation codes in \cite{Ilie06RTcom} (see their Fig. 5), therefore the scheme is accurate. Secondly, the evolution is independent of the global time-step, demonstrating the convergence of the sub-cycle thermo-chemistry solver. With this solver, the (main) time-step of the simulation is only limited by the Courant condition in solving the moment equation (\S\ref{sec:two-moment}). \section{Methods} \input{method/TwoMoment} \input{method/thermosolver} \input{method/Injection} \input{method/code} \input{method/rol} \input{Tests} \input{Discussions} \input{Conclusions} \section*{ACKNOWLEDGEMENTS} We thank J.~Borrow, M.~Schaller, M.~Ivkovic, L.~Hausammann, and C.~Correa for their assistance with the implementation in {\small SWIFT}, and A.~Richings, Y.~Revaz, and A.~Benítez-Llambay for helpful discussions. We thank Joakim Rosdahl for a thoughtful and constructive referee's report, which led to significant improvements to our paper. This work was supported by the Science and Technology Facilities Council (STFC) through Consolidated Grants ST/P000541/1 and ST/T000244/1 for Astronomy at Durham. We acknowledge support from the European Research Council through ERC Advanced Investigator grant, DMIDAS [GA 786910] to CSF. This work used the DiRAC@Durham facility managed by the Institute for Computational Cosmology on behalf of the STFC DiRAC HPC Facility (www.dirac.ac.uk). The equipment was funded by BIS capital funding via STFC capital grants ST/K00042X/1, ST/P002293/1, ST/R002371/1 and ST/S002502/1, Durham University and STFC operations grant ST/R000832/1. DiRAC is part of the National e-Infrastructure. The research in this paper made use of the {\small SWIFT} open source simulation code (http://www.swiftsim.com, \citealt{Scha18SWIFTascl}) version 0.9.0 This work also made use of matplotlib \citep{Hunt07matplotlib}, numpy \citep{vand11numpy}, scipy \citep{Jone01scipy}, swiftsimio \citep{Borr20swiftsimio}, and NASA’s Astrophysics Data System. \section*{DATA AVAILABILITY} The data underlying this article will be shared on reasonable request to the corresponding author (TKC). \bibliographystyle{mn2e} \subsection{Optically Thin Propagation tests} \label{sec:purepro} \begin{figure} \includegraphics[width=0.5\textwidth]{figures/RadFront1D_topaper_010.png} \includegraphics[width=0.5\textwidth]{figures/RadFront1D_energyevo_010.png} \caption{Propagation in 1D: {\it Upper panel:} radiation energy density, $\xi(x)$ of a package of radiation propagating to the right at the speed of light ($c=1$ in these units). The {\em black dashed line} is the initial profile in units of the initial value of $E$, the {\em blue} line is the edge of the initial profile shifted to the right by $\Delta x=5$, the {\em red points} are the simulated values of $E$ for individual SPH particles at time $t=50$. The simulation uses 400 SPH particles located on the vertices of a regular grid. The test shows that the front moves at the correct speed. {\it Lower panel:} the relative error in total radiation energy as a function of time, where $E_0$ and $E_{\rm rad,tot}$ are the total radiation energy at the beginning and at time $t$, respectively. The deviation from energy conservation is less than 0.01\% at all times.} \label{fig:radfront1d_tm} \end{figure} \begin{figure} \includegraphics[width=0.5\textwidth,left]{figures/Quiver_mult_frad_RadStream2D_densitygradient.png} \includegraphics[width=0.48\textwidth,left]{figures/RadStream2D_010.png} \caption{Propagation in 2D: propagation of a packet of radiation in two dimension at the speed of light, $c=1$. {\it Upper panels}: Radiation energy density of the packet in units of its initial value. The {\em left panel} shows the initial state, where the packet has length $\delta y=1$. The central panels show the system at different times at a constant particle density. The rightmost panel labelled `var. $\rho$' shows the radiation beam in case of an underlying density gradient (see main text) at t=1. Colors represent the radiation energy density and {\em red arrows} show the radiation fluxes. {\it Lower panel}: radiation energy density, $\xi(x,y)$, of SPH particles with $1.4\le y\le 1.6$ at time $t=1.0$ ({\em red line}), the {\em dashed-black line} is the initial shape of the packet.} \label{fig:radstream2d_defaultdiss} \end{figure} \begin{figure*} \includegraphics[width=0.95\textwidth]{figures/Quiver_mult_frad_RadFrontSpherical_2D_002.png} \includegraphics[width=0.95\textwidth]{figures/RadFrontSpherical_mult_2d_002.png} \caption{Propagation in 2D: propagation of a shell of light away from a source at the speed of light, $c=1$. {\it Upper panel}: radiation energy density of the shell of light in units of its initial value. The {\em left panel} shows the initial state, where radiation is filled uniformly within a circle with radius $r=0.1$ and points out radially. Panels to the right show the system at times $t=0.1$ and $t=0.2$. The SPH particle distribution is glass-like, with $128\times 128$ particles filling the computational volume of horizontal extent $\Delta x=2$ and vertical extent $\Delta y=2$. Colours represent the radiation energy density and {\em red arrows} show the radiation fluxes; the colour scale is not the same in each panel to bring out the smoothness of the radiation density as the shell moves out. {\it Lower panel}: radiation flux ({\em left panel}) and radiation density ({\em right panel}) as a function of radius at time $t=0.2$. The {\em red points} represent values of all individual SPH particles, {\em blue points} show binned values. The {\em blue vertical lines} at $r=0.3$ show the location of the radiation front at time $t=0.2$.} \label{fig:radfrontsph2d_tm} \end{figure*} \begin{figure*} \includegraphics[width=0.95\textwidth]{figures/Quiver_mult_xH0_Stromgren_3D_050_hs.png} \caption{Isothermal Str\"omgren sphere from \protect\cite{Ilie06RTcom} Test 1: a source of radiation, located at the centre of the panels, photoionizes hydrogen gas, kept at constant density and constant temperature. Panels show the neutral fraction, ${n_{\rm HI}}/n_{\rm H}$, at time $t=500~{\rm Myr}$ in a slice through the centre of the three-dimensional volume. {\it Left panel}: radiation is injected in all gas particles within one smoothing length from the source, see \S\ref{sec:injection} for the method of injection. {\it Central panel:} radiation is injected in all gas particles within two smoothing lengths from the source. {\em Right panel:} as in left panel, but the direction in which radiation travels is set to ${\hat{\bf n}}={\hat{\bf r}}$, see \S\ref{sec:opticalthindir} for details. The ionization front becomes more spherical if the injection region is enlarged, or if the radiation is forced to propagate radially.} \label{fig:stromgren3dhs} \end{figure*} \begin{figure} \includegraphics[width=0.48\textwidth]{figures/nH_r_Stromgren3D_050_static_fixtemp.png} \caption{Isothermal Str\"omgren sphere from \protect\cite{Ilie06RTcom} Test 1: a source of radiation, located at radius $r=0$, photoionizes hydrogen gas, kept at constant density and constant temperature. The system is shown a time $t=500~{\rm Myrs}$ after the source is switched on. {\em Red points} are the neutral hydrogen fraction, $x_{\rm HI}=n_{\rm HI}/n_{\rm H}$, of individual gas particles, with the {\em thick blue points} showing binned values, with horizontal error bars indicating the bin width, and vertical error bars the standard deviation; the {\em black line} is the analytical solution derived in Appendix \ref{sec:anaStromgren}. {\em Small blue points}, and {\em thick black points} with black error bars show the corresponding ionized fraction, $1-x_{\rm HI}$, with the {\em yellow line} the analytical solution. The {\em vertical blue line} is the approximate analytic location of the Str\"omgren radius from the balance between injection and recombination (Eq.~\ref{eq:anars}). The mean interparticle separation of the SPH particles is 0.625~kpc. Here we inject radiation over two smoothing lengths.} \label{fig:stromgren3d_tm} \end{figure} \begin{figure} \includegraphics[width=0.48\textwidth]{figures/rI_evo_Stromgren3D.png} \caption{Test 1 \protect\citep{Ilie06RTcom}: pure hydrogren isothermal HII region expansion from time $t = 0$ to $500~{\rm Myr}$. {\it Top}: the evolution of the radius of the ionization front, defined by where 50\% hydrogen in the spherical shell is ionized, divided by the Str\"omgren radius (Eq.~\ref{eq:Stromgrenradius}). {\it Bottom}: the evolution of the velocity of the ionization front, divided by the Str\"omgren radius over the recombination time $t_{\rm rec}=(n_{\rm H}\alpha_B)^{-1}$. The $c/\tilde{c}$ lines represent our simulation results with different reduced speeds of light and the fixed optically thin direction (\S\ref{sec:opticalthindir}). The black lines show the analytic solutions (Eq.~\ref{eq:anars} and its derivative; note that the analytic solution is only approximately correct). Finally, the `{\small C2-ray}' lines represent the {\small C2-ray} \protect\citep{Mell06c2ray} result in \protect\cite{Ilie06RTcom}.} \label{fig:stromgren3devo} \end{figure} \begin{figure*} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_xH0_Stromgren_3D_010_static.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_temp_Stromgren_3D_010_static.png} \includegraphics[width=0.95\textwidth]{figures/nH_r_Stromgren3D_010_static_res32_hs3.png} \caption{\protect\cite{Ilie06RTcom} Test2: HII region expansion in a uniform gas with varying temperature and static gas particles at time $t=100~{\rm Myr}$. {\it Top left}: a slice of the hydrogen neutral fraction through the center; {\it Top right}: a slice of the gas temperature through the center; {\it Bottom left}: hydrogen neutral fraction as a function of radius; {\it Bottom right}: temperature as a function of radius. The red points represent the values of individual particles. The vertical error bars show the mean and standard deviation. The horizontal error bars show the smoothing length. The solid black line is the `{\small TT1D thin}' result \protect\citep{Pawl11multifRT} and the shaded region is the upper and lower bounds of the \protect\cite{Ilie06RTcom} results. Here we inject radiation over three smoothing lengths.} \label{fig:stromvartemp} \end{figure*} \begin{figure*} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_xH0_RadShadow_3D_015.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_temp_RadShadow_3D_015.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_xH0_RadShadow_3D_015_static_dirx.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_temp_RadShadow_3D_015_static_dirx.png} \caption{\protect\cite{Ilie06RTcom} Test 3: I-front trapping in a dense clump. {\it Left}: a slice of mass-weighted hydrogen neutral fraction through the midplane of the simulation volume at $t=15\;{\rm Myr}$; {\it Right}: same but for temperature. {\it Upper panels}: for the default optically thin direction, $\hat{\bf n}=\hat{\bf f}$; {\it Lower panels}: for an imposed fixed optically thin direction in the $x$ direction (see \S\ref{sec:opticalthindir}), as shown by the arrows.} \label{fig:radshadow3d} \end{figure*} \begin{figure*} \includegraphics[width=0.95\textwidth]{figures/xH0temp_RadShadow3D_015_both.png} \caption{\protect\cite{Ilie06RTcom} Test 3: I-front trapping in dense clump at $t=15\;{\rm Myr}$. {\it Left}: the neutral fraction along the axis of symmetry through the centre of the clump, where $x=0$; {\it Right}: the corresponding plot for temperature. The red points represent the values of individual particles (particles with distance < 0.1 kpc from the axis). The vertical errorbars show the mean and standard deviation and the horizontal errorbars show the smoothing length. The blue dashed lines show the result if we do not fix the optically thin direction. The shaded region encompasses the upper and lower bounds of the \protect\cite{Ilie06RTcom} results. Vertical dashed lines show the initial clump front position, whereas horizontal dashed lines show the initial neutral fraction and temperature. We only show the results for the case when the direction of the flux is imposed to be the optically thin direction (\S\ref{sec:opticalthindir}). } \label{fig:radshadow3dxH0temp} \end{figure*} \begin{figure*} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_xH0_Stromgren_3D_020.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_temp_Stromgren_3D_020.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_rho_Stromgren_3D_020.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_mach_Stromgren_3D_020.png} \caption{Slices of neutral fraction ({\it upper left}), temperature ({\it upper right}), gas density ({\it lower left}), and Mach number ({\it lower right}) through an HII region expanding in an initially uniform medium (\protect\citealt{Ilie09RTcom} Test 5) at $t=200\;{\rm Myr}$ through the centre of the HII region. Hydrodynamics is turned on and we inject radiation over two smoothing lengths. } \label{fig:rhdtest} \end{figure*} \begin{figure*} \includegraphics[width=0.95\textwidth]{figures/velpth_r_Stromgren3D_020.png} \caption{Gas density ({\it upper left}), gas velocity ({\it upper right}), neutral fraction ({\it lower left}), and pressure ({\it lower right}) as a function of radius of the HII region expansion in an initially uniform medium (\protect\citealt{Ilie09RTcom} Test 5) at $t=200\;{\rm Myr}$. The red points represent the values of individual particles. The vertical error bars show the mean and standard deviation. The horizontal error bars show the smoothing length. The lines are the results from the {\small ZEUS-MP} code \protect\citep{Whal06ZEUSMP} in \protect\cite{Ilie09RTcom}. Black solid represents monochromatic light, i.e. a single frequency bin, similar to our implementation, whereas green dashed lines represent multi-frequency transfer. Injecting radiation over two smoothing lengths results causes the ionization front to propagates slightly faster than seen in {\small ZEUS-MP}.} \label{fig:rhdtestr} \end{figure*} \begin{figure*} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_xH0_Stromgren_3D_025_stromgrenspheredensitygradient.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_temp_Stromgren_3D_025_stromgrenspheredensitygradient.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_rho_Stromgren_3D_025_stromgrenspheredensitygradient.png} \includegraphics[width=0.48\textwidth]{figures/Quiver_mult_mach_Stromgren_3D_025_stromgrenspheredensitygradient.png} \caption{Slices of neutral fraction ({\it upper left}), temperature ({\it upper right}), gas density ({\it lower left}), and Mach number ({\it lower right}) through an HII region expanding in a medium with initial density profile $\propto r^{-2}$ (\protect\citealt{Ilie09RTcom} Test 6) at $t=25\;{\rm Myr}$ through the centre of the HII region. Hydrodynamics is turned on and we inject radiation over two smoothing lengths. } \label{fig:stromgrenspheredensitygradient} \end{figure*} \begin{figure*} \includegraphics[width=0.95\textwidth]{figures/velpth_r_Stromgren3D_025_stromgrenspheredensitygradient.png} \caption{Gas density ({\it upper left}), Mach number ({\it upper right}), neutral fraction ({\it lower left}), and pressure ({\it lower right}) as a function of radius of the HII region expanding in an initially $1/r^2$ density profile (\protect\citealt{Ilie09RTcom} Test 6) at times $t=3,10,25\;{\rm Myr}$ (thicker lines at later times). The computational volume in the original \protect\citealt{Ilie09RTcom} test has a linear extent of $L_{\rm box}=0.8~{\rm kpc}$. The {\em red solid lines} represent the mean values from our simulations; the {\em black lines} are the results from the {\small C2-Ray+TVD} code, which uses multi-frequency RT transfer. } \label{fig:stromgrenspheredensitygradientr} \end{figure*} \subsubsection{Propagation in one dimension} The setup propagates a finite radiation packet in an optically thin medium. We test whether the radiation front travels at the correct speed, $c=1$, without excessive smoothing of the front and without generating artificial oscillations in the radiation density, $E(x)$, behind the radiation packet. Initially, the radiation energy density and flux are uniform and non-zero only for $x<0$, with the radiation flux is pointing in the $+x$ direction initially. Fig. \ref{fig:radfront1d_tm} shows the initial condition and the configuration at $t=5$, when the radiation front has propagated 100 times the mean inter-particle spacing. While there is small broadening of the radiation front caused by the artificial dissipation, numerical oscillations are suppressed significantly and the scheme is stable. The front propagates at the correct speed ($c = 1$) and the radiation energy density $E$ remains constant inside the radiation package, unaffected by the artificial dissipation. The lower panel demonstrates the excellent energy conservation of our scheme in this test problem. \subsubsection{Propagation in two dimensions} We repeat the previous test but now in two-dimensions: a rectangular radiation package propagates in empty space in 2D. The constant-mass SPH particle distribution is glass-like, with $256\times 1024$ particles filling the computational volume of horizontal extent $\Delta x=0.5$ and vertical extent $\Delta y=2.0$. This tests the extent to which radiation leaks out of the package artificially, either perpendicular or parallel to the propagation direction, as a consequence of the artificial dissipation. The propagation direction of the radiation on individual particles is not imposed, but computed from $\hat{\bf n}=\hat{\bf f}$. Results are shown in Fig.~\ref{fig:radstream2d_defaultdiss} where the radiation package moves upwards from the initial state at time $t=0$ (left panel) to time $t=0.5$ (right panel). The top panel of the figure demonstrates the ability of the implementation to maintain the direction of the radiation, with little artificial leakage of radiation perpendicular to the beam. At $t=1$, the packet has propagated upwards over 256 mean particle spacings. Two small \lq tails\rq\ of radiation trail the package, where radiation leaked out of the beam. In the rightmost panel, labelled `var. $\rho$', we test the radiation propagation in the presence of a particle density gradient. Constant-mass SPH particles are distributed according to a cored power-law density profile $\rho(y)$: \begin{align} \rho(y) = \left\{\begin{matrix} \rho_c, & 0.5<y< 1.5\\ \rho_c[0.5/(y-1)]^2, & {\rm elsewhere.} \end{matrix}\right. \end{align} Here, $y$ is the direction of propagation of the radiation. The particle density inside the core $\rho_c$ is the same as that in the uniform density test. The radiation distribution is similar to the uniform density case, except that the beam broadens slightly once it enters the low density region at the top of the panel, where the spatial resolution is lower. The total radiation energy increases by $\sim 1$\% at t=1, mainly because of the numerical oscillations at the beam front. Because we enforce that radiation energy density remains positive everywhere, clipping negative radiation densities increase the total radiation energy. Smoothing perpendicular to the beam is quantified in more in detail in the lower panel, which is a cut through the middle of the beam at time $t=1$. This profile has approximately Gaussian-shaped edges, as expected from artificial diffusion (\S\ref{sec:artdiss}); the diffusion coefficient is proportional to $h\,c$. The dependence on the smoothing length, $h$, means that the beam can propagate further without distortion at higher resolution. Due to the finite resolution and, in general, non-uniform underlying SPH particle distribution, it is not possible to completely eliminate radiation leakage perpendicular to the propagation direction without causing instabilities; higher-order shock-capturing schemes \cite[e.g.][]{Liu94WENO} might suppress such artificial leakage more efficiently. The next test is that of radiation propagating isotropically away from a source in two dimensions, see Fig.~\ref{fig:radfrontsph2d_tm}. The figure confirms that the radiation front preserves rotational symmetry as it propagates out at the speed of light. The radiation energy density is smooth in the radial shell, with no appreciable noise even though the underlying particle distribution is non-uniform. The energy density is small behind the shell. The absence of significant artificial \lq left over\rq\ radiation results from the artificial dissipation switch. \subsection{Radiation tests without hydrodynamics: constant temperature} \label{sec:statictest} \subsubsection{Static Stromgren Sphere with Constant temperature} The first test is Test~1 in \cite{Ilie06RTcom}. This tests the radiative transfer scheme and the thermo-chemistry solver against an analytical solution: uniform density, neutral gas is photoionized by a source that emits ionizing photons at a constant rate. We keep the density and temperature of the gas constant, {\em i.e.} the gas is not allowed to move, heat or cool. The ionization front propagates into the gas cloud until it reaches its Str\"omgren radius. The analytical solution (assuming grey opacity) is derived and summarised in Appendix \ref{sec:anaStromgren}. The numerical parameters are taken to be identical to those used by \cite{Ilie06RTcom} to allow for a direct comparison: the gas cloud consists of pure hydrogen gas with density $n_{\rm H}=10^{-3}{\rm cm^{-3}}$, the collisional ionization coefficient $\beta=3.1\times10^{-16}{\rm cm^3s^{-1}}$ and the recombination coefficient is $\alpha_{\rm B}=2.59\times10^{-13}{\rm cm^3s^{-1}}$ (with the on-the-spot approximation); the photoionization cross section is $\sigma_{\rm \gamma HI}=8.13\times 10^{-18}{\rm cm^2}$. The source emits ionizing radiation at a constant rate of $\dot N_\gamma=5\times10^{48} {\rm photons~s}^{-1}$. The computational volume has linear extent of 20~kpc; the SPH particle distribution is glass-like with approximately $32^3$ particles. In this problem we also test the RSL approximation, using ${\tilde c}=c/10$. We first compare several implementations of the injection of radiation energy by the source (\S\ref{sec:injection}) and of the optically thin closure relation (\S\ref{sec:opticalthindir}); results are shown in Fig.~\ref{fig:stromgren3dhs}. Without requiring that the optically thin direction be radial, the ionization front is not spherical when radiation is injected over one smoothing length (left panel), a consequence of the fact that the SPH particles are not exactly uniformly distributed around the source. This can be remedied by either injecting radiation into gas particles up to two smoothing lengths away from the source (middle panel) or by requiring that the radiation should move radially away from the source, {\em i.e.} ${\hat{\bf n}}={\hat{\bf r}}$ (right panel). For the actual test, we inject radiation in all gas particles within two smoothing lengths from the source but without imposing a propagation direction, as in the middle panel of Fig.~\ref{fig:stromgren3dhs}. The simulation results at time $t=500~{\rm Myr}$ are compared to the analytical solution derived in Appendix \ref{sec:anaStromgren} in Fig.~ \ref{fig:stromgren3d_tm}. By this time, the system is in a steady-state where ionizations balance recombinations and the ionization front is at the location of the Str\"omgren radius. We can compare the neutral fraction in the simulation to the exact analytical solution. The mean value of the neutral fraction as a function of radius, $x(r)=n_{\rm HI}(r)/n_{\rm H}$, follows the analytical result closely with relatively small scatter. There are small systematic deviations from the analytical solution near $r=0$, where radiation is injected, and at $r\ge 6$, where the analytical value of neutral fraction drops faster than the simulated value. The latter is due to radiation \lq leaking\rq\ beyond the Str\"omgren radius in the simulation due to the artificial dissipation. The overall performance of the scheme is relative good: (1) the neutral fraction is approximately spherically symmetric; (2) the scheme is photon-conserving and therefore the location of the Str\"omgren radius agrees well with the analytical solution; (3) the scheme is accurate both in the optically thin region near the source as well as in the optically thick region outside the Str\"omgren radius, as well as in the intermediate region. We note that some cone-based \citep[e.g.][]{Pawl08TRAPHIC} or short-characteristic \citep[e.g.][]{Finl09VET} RT schemes could produce artificial \lq ray-like\rq\ features in the neutral fraction, depending on angular resolution; no such features appear in the present scheme\footnote{Deviations from spherical symmetry near the Str\"omgren radius are apparent in Fig. \ref{fig:stromgren3dhs} due to low spatial resolution and irregular particle distribution, but these are significantly less severe than the ``ray effect'' in the cone-based or short-characteristic methods.}. The effect of using the RSL approximation on the time evolution of the I-front is illustrated in Fig.~\ref{fig:stromgren3devo}. We use a similar setup as above, but to capture the early phase of the expansion of the ionization front (1) we inject radiation over only one smoothing length but impose that the radiation propagates radially outwards, {\em i.e.} $\hat{\bf n}=\hat{\bf r}$; (2) we use higher resolution, $64^3$ particles. The traditional analytical solution for the time-dependent location of the ionization front, $r_I(t)$, of Eq.~(\ref{eq:anars}) assumes that the front is infinitely thin and that the down-stream gas is fully ionized. In reality, the down-stream gas is not completely ionized and the analytical solution of Eq.~(\ref{eq:anars}) is only approximately correct\footnote{The mean free path of ionizing photons is $\lambda=n_{\rm H}\sigma_{\gamma}\approx 0.04~{\rm kpc}$ and not resolved in the simulation setup.}. Because of this, we compare our simulation results to another simulation code, namely {\small C2-ray} \citep{Mell06c2ray} (see also \citealt{Ilie06RTcom}) and, follow them by defining the position of the I-front as the radius at which $x_{\rm HI}=0.5$. Fig. \ref{fig:stromgren3devo} demonstrates that our results converge for $\tilde c \to c$, and even when $\tilde c=c/100$ are close to those obtained with {\small C2-ray}. Using $\tilde c=c/1000$, we notice deviations of a few tens of percent at times less than a recombination time, and much smaller than 10 per cent later on. This matches our expectation discussed in \S\ref{sec:RSL} \cite[see also][]{Rosd13ramsert}. The scheme works well at low resolution even when using non-uniform particle distributions. This is important because in typical applications ({\em e.g.} reionization simulations or simulations of the interstellar medium) the gas distribution around the ionizing sources is often at best marginally resolved. \subsection{Radiation tests without hydrodynamics: variable temperature} \label{sec:vttest} \subsubsection{Static Str\"omgren Sphere with Thermodynamics} We repeat the previous test, but now allow photo-heating of the ionized gas, testing the interaction between the radiative transfer and the photo-chemistry solver. The parameters of the test are identical to the previous case; the photo-heating and cooling processes are detailed in Appendix \ref{sec:heatcoolparam} (the test makes the on-the-spot approximation). We use the optically thin value for the photo-heating energy rate per ionization, $\epsilon_{\gamma}$ (see Appendix \ref{sec:heatcoolparam}). The underlying particle distribution is glass-like with 32 particles on a side; the injection radius is three smoothing lengths (see \S\ref{sec:injection}); and $\tilde c=0.01c$. Fig.~\ref{fig:stromvartemp} summarises our simulation results. We compare our results to results for the same setup published by \citet{Ilie06RTcom}, since this test has no known analytical solution. Unfortunately the comparison is not straightforward because some codes in that paper use different values for the thermo-chemistry coefficients (see Fig. 2 in \citealt{Ilie06RTcom}), and some codes use multi-frequency RT to account for spectral hardening. Spectral hardening leads to pre-heating of gas upstream from the ionization front. To make the comparison appropriate, we also compare to {\small TT1D} (TestTraphic1D), which is a 1D radiative transfer code developed by \cite{Pawl08TRAPHIC,Pawl11multifRT} for testing the {\small TRAPHIC} code. We will compare to their `{\small TT1D thin}' result, which uses the same assumptions as ours, {\em i.e.} one frequency bin (grey approximation) and photoheating in the optically thin limit. Fig. \ref{fig:stromvartemp} demonstrates that our scheme produces a roughly spherical morphology at this resolution with the mean value at a given radius matching those obtained by {\small TT1Dthin}. In addition, our result falls within the grey-band defined by the range of simulation results published by \cite{Ilie06RTcom}. \subsubsection{Ionization Front trapping with a Dense Clump} Next, we illustrate our scheme's ability to trap an ionization front and cast a shadow, by repeating \lq Test 3\rq\ in \citealt{Ilie06RTcom}. The setup is as follows: a cubic volume of linear extent $4.0~{\rm kpc}$ is filled with hydrogen gas of density $n_{\rm out}=2\times10^{-4}{\rm cm}^{-3}$ and temperature $T_{\rm out}=8000\;{\rm K}$. A spherical cloud with radius $0.8~{\rm kpc}$, hydrogen density $n_{\rm clump}=0.04\;{\rm cm}^{-3}$ and temperature $T_{\rm clump}=40\;{\rm K}$ is placed at the centre of the volume. The system is irradiated from the top with a black-body spectrum with temperature $T_{\rm BB}=10^5{\rm K}$, injecting a constant photon flux of $10^6\,{\rm photons}\,{\rm s}^{-1}{\rm cm}^{-2}$ from the upper computational boundary. We impose absorbing boundary conditions at the lower computational boundary and periodic boundary conditions at all other computational boundaries. The SPH particle distribution is glass-like with approximately $64^3$ particles (which is lower than the tests published in \cite{Ilie06RTcom} but enough to demonstrate the performance of our scheme). We model the over-density of the gas in the clump by increasing the hydrogen fraction of the SPH particles in the clump. We use the RSL approximation, setting ${\tilde c}=c/10$. We show the simulation results in Fig.~\ref{fig:radshadow3d}, with (lower panels) and without (upper panels) imposing the optically thin propagation direction for the radiation, ${\hat{\bf n}}={\hat{\bf x}}$, ( \S\ref{sec:opticalthindir}). As expected, the gas in front of the high-density region is highly ionized; inside the high-density region but upstream from the ionization front it is ionised to a level $n_{\rm HI}/n_{\rm H}\sim 10^{-2}$; the ionization front is trapped inside the high-density region at $x\sim 0.1~{\rm kpc}$, and finally the gas is mostly neutral behind the ionization front in the shadow behind the high-density region. We follow the reasoning of \S\ref{sec:singlegasparcel} to estimate the temperature immediately after the ionization front has passed, \begin{align} T_1&=\frac{2-x_0}{2-x_1}T_0+\frac{2}{3}\frac{x_0-x_1}{2-x_1}\frac{\epsilon_\gamma}{k_{\rm B}}\,, \end{align} where $x_0$ and $T_0$ are the initial neutral fraction and temperature, $x_1$ and $T_1$ are the neutral fraction and temperature when the ionization front has passed, and $\epsilon_\gamma\approx 6.33~{\rm eV}$ is the photoheating per ionization. In front of the high-density region, we take $x_0=1$, $T_0=8000~{\rm K}$ and $x_1\approx 0$ to find $T_1=10^{4.45}~{\rm K}$; upstream from the ionization front inside the high-density region, we take $x_0=1$, $T_0=40~{\rm K}$, $x_1=10^{-2}$ to find $T_1=10^{4.38}~{\rm K}$. Once the front has passed, the gas will continue to be photoheated while also cooling radiatively. In front of the high-density region, the recombination time, $\tau_r\equiv 1/(\alpha_B\,n_{\rm H})\approx 600~{\rm Myr}$, is long compared to the simulation time, and the gas is still heating slowly to its new equilibrium temperature of $10^{4.64}~{\rm K}$. Inside the high-density region, $\tau_r\approx 3~{\rm Myr}$ is short compared to the simulation time and the gas should be in thermal equilibrium. Scaling the flux so that the neutral fraction is $10^{-2.2}$, close to what is found in the simulation at the front of the high-density region, yields an equilibrium temperature of $\approx 10^{4.18}~{\rm K}$, consistent with what we find in the simulation (Fig.~\ref{fig:radshadow3dxH0temp}). When the propagation direction is imposed, the over-dense gas traps the I-front at time $t=15\,{\rm Myr}$, and the run of the neutral fraction and temperature from the top of the volume in the $x$-direction follows our analytical estimates. It also falls within the grey-region, defined by the the locus of the simulation results for the different codes for Test 3 in \cite{Ilie06RTcom}, as shown in Fig.~\ref{fig:radshadow3dxH0temp}. The shadow is relatively sharp, with a small level of ionization at its boundary due to the numerical/artificial diffusion. As expected, the gas is also cooler in the shadow with the temperature there agreeing with the results of some of the codes in \cite{Ilie06RTcom}. As in the previous test case, our results are not directly comparable to some of the codes in \cite{Ilie06RTcom}, in particular codes that perform multi-frequency RT capture the pre-heating ahead of the ionization front due to the smaller optical depth of higher-energy photons. When the direction of propagation is not imposed (top panels in Fig.~\ref{fig:radshadow3d} and Fig.~\ref{fig:radshadow3dxH0temp}), the ionization front is still trapped in the high-density region and there is still a fraction of self-shielded gas. However, the numerical and/or artificial diffusion wipes-out the shadow. Some high-density gas down-stream from the ionization front also gets ionized as a consequence of artificial diffusion. While fixing the optically-thin direction is less relevant for simulations with many sources, this approach is useful for a few radiation sources or the propagation of radiation fronts in a few directions, which we are currently investigating. \subsection{Radiation tests with hydrodynamics and variable temperature} \label{sec:rhdtest} In this section we present tests with heating, cooling, and hydrodynamics with radiation\footnote{We ignore the $\nabla{\bf v}:\mathbb{P}$ and radiation pressure terms (see \S\ref{sec:two-moment}) in these test problems.}. \subsubsection{Str\"omgren Sphere with hydrodynamics} The first test is a repeat of the HII region, but now allowing the gas to expand as it is heated; this is Test 5 in \cite{Ilie09RTcom}. The problem setup and conditions are exactly identical to the variable temperature Str\"omgren sphere test in \S\ref{sec:vttest}, but we simulate also the hydrodynamics response of the gas. We use the default {\small SPHENIX} SPH formulation for hydrodynamics (\S\ref{sec:SPHform}) with $64^3$ particles in the computational volume. We do {\it not} fix the optically thin direction here, but instead inject radiation over two smoothing lengths. We find that the ionized region is nevertheless almost spherically symmetric (as it should be). However, the location of the front is slightly further out compared to the profile computed with {\small ZEUS-MP}. This is because this way of injecting radiation does not quite guarantee that the flux drops correctly with distance in the injection region. Figure~ \ref{fig:rhdtest} shows that the gas profiles are approximately spherically symmetric and there is no evidence of any numerical instabilities. In Fig.~\ref{fig:rhdtestr} we compare our simulation results (red points show values for individual SPH particles, blue points show the mean and scatter of values in radial bins) to those of {\small ZEUS-MP} single-frequency bin result (black solid lines), as published by \cite{Ilie09RTcom}. For the gas neutral fraction and pressure, the single-frequency bin result is not available, so we compare to the multi-frequency {\small ZEUS-MP} result instead. As the gas is ionized and heated, the surrounding gas is swept-up in a dense shell. The location of the shell agrees well with that found by {\small ZEUS-MP}, as do gas neutral fraction, density and velocity profiles. In our simulation, the shell is somewhat wider than that found by {\small ZEUS-MP}, partly because of our much lower resolution and possibly due to the applied artificial viscosity in the hydrodynamics solver. Our pressure profile agrees with {\small ZEUS-MP-multi} until $r=8\;{\rm kpc}$, where {\small ZEUS-MP-multi} shows a slower falloff in pressure. This is because {\small ZEUS-MP-multi} includes also {\it spectral hardening}, where high frequency photons penetrate further into the neutral medium. Our current single-bin method cannot model this effect. \subsubsection{Str\"omgren Sphere in a $1/r^2$ density profile with hydrodynamics} \label{sec:stromgrendensitygradient} Finally, we examine how our code performs in the case when the density is not uniform (\citealt{Ilie09RTcom} Test 6). This allows us to validate our hierarchical time-stepping scheme (\S\ref{sec:code}) and test the propagation of radiation down a density slope. We initialise a density profile $n_{\rm H}(r)$ as a function of radius $r$ from the center, given by \begin{align} n_{\rm H}(r)= \begin{cases} n_{\rm core}, & \text{ if } r<r_{\rm core}, \\ n_{\rm core}(r_{\rm core}/r)^2, & \text{ if } r> r_{\rm core}, \end{cases} \end{align} by distributing $\sim 64^3$ equal-mass SPH particles in a $(2~{\rm kpc})^3$ box\footnote{We use a slightly larger box size than \cite{Ilie09RTcom} (box size $=1.6~{\rm kpc}$) since we adopt periodic boundary condition rather than trans-missive BCs and we want to avoid edge effects.}. We take $n_{\rm core}=3.2\,{\rm cm}^{-3}$ and $r_{\rm core}=91.5\,{\rm pc}$. We also set up a star particle at the center of the box which emits $10^5{\rm K}$ black body spectrum photons at a rate of $\dot{N}_\gamma=10^{50}~{\rm photons~s^{-1}}$. We choose to inject radiation over one smoothing length and set $\tilde{c}=0.01c$ in this test. Initially, the R-type ionization front moves quickly on a time-scale $\ll 1 {\rm Myr}$ stalling at the initial Str\"omgren radius at $r_{\rm S}\sim 70 {\rm pc}$. Then the gas itself starts to expand as it is heated and the ionization front expands slowly towards the edge of the computational volume. The ionization front accelerates once it exits the core region, due to the lower gas density at a larger radius. In Fig.~\ref{fig:stromgrenspheredensitygradient} we plot slices through the neutral gas fraction, temperature, density, and Mach number at time $t=25~{\rm Myr}$. The profiles are approximately spherically symmetric in the ionized region, although there are some deviations from spherical symmetry caused by the non-uniform particle distribution. There is also some noise visible in the Mach number slice outside the ionization front, because it is difficult to set up a completely static SPH density field when the density distribution has a steep gradient. In Fig.~\ref{fig:stromgrenspheredensitygradientr}, we compare spherically-averaged radial profiles to the results obtained with the {\small C2-Ray+TVD} code \citep{Mell06c2ray, Trac04TVD}. Our results agree reasonably well on the location and speed of the ionization front, as well as on the run of density, mach number, ionised fraction and pressure. The biggest differences occur in the outer parts that have not been reached yet by the radiation. These differences are a consequence of how the initial conditions are set up: in SPH, it is difficult to set up the initial conditions very accurately. Furthermore, {\small C2-Ray+TVD} has higher pressure downstream from the ionization front, because, unlike in our implementation, it performs multi-frequency RT, so that gas downstream from the ionization front undergoes preheating.
\section{Introduction} Reinforcement Learning (RL) has shown exceptional successes in a variety of domains, from video games \cite{vinyals2019grandmaster,Mnih2015HumanlevelCT,Hessel2018RainbowCI} to robotics \cite{kurutach2018model,haarnoja2018soft}. As a self-learning method, RL is promising to reduce the massive engineering efforts in autonomous driving. In recent years, there has been a growing interest towards RL in autonomous driving community, such as adaptive cruise control \cite{lin2019longitudinal}, lane-keeping \cite{duan2020hierarchical}, trajectory tracking \cite{Mu2020MixedRL} and multi-vehicle cooperation \cite{Guan2020CentralizedCF}. However, despite achieving decent performance, these RL methods mostly lack explicit safety constraints, which significantly limits their application in safety-critical autonomous driving. Recently, some RL researchers begin to investigate including different forms of safety constraints in RL algorithms to improve safety for real-world applications \cite{chow2017risk,achiam2017constrained,yang2019projection,garcia2015comprehensive}. One of the most popular forms is the chance constraint, which constrains the possibility of the control policy violating the state constraint below a given level\cite{Peng2020ModelBasedAW, Paternain2019LearningSP, chow2017risk}. Chance constraint gives an intuitive and quantitative measure of the safety level of the control policy, so it is suitable to represent the safety demands in real-world systems with uncertainty. Existing strategies used to solve the chance constrained RL problems can be roughly categorized into two approaches. The first solution is the penalty method that gives a large penalty to the objective function for violation of the constraint \cite{Guan2020CentralizedCF,Peng2020ModelBasedAW}. Although this approach is very straightforward and simple to implement, it requires the penalty weight to strike a balance between safety and performance correctly. Unfortunately, it is usually difficult to select an appropriate weight. As shown in Fig. \ref{demo_penalty0.9}, a large penalty is prone to rapid oscillations and does not converge to a safe policy, while a small penalty cannot satisfy the constraint \cite{tessler2018reward}. The second approach is the Lagrangian method \cite{Paternain2019LearningSP,chow2017risk}, which is widely used in constrained optimization. Actually, it can be regarded as the penalty method with an adaptive weight, which is dynamically adjusted by safety level rather than fixed. Nevertheless, the Lagrangian method suffers from overshooting of Lagrange multiplier under tight chance constraint as shown in Fig. \ref{demo_Lag0.9}, which leads to a conservative policy. Besides, it may also have periodic oscillations, resulting from the delay between the optimization of policy and adaptation of the Lagrange multiplier \cite{wah2000improving, stooke2020responsive}. \begin{figure}[hbt] \centering \subfigure[]{ \includegraphics[width=0.225\textwidth]{demo_penalty09.pdf} \label{demo_penalty0.9} } \subfigure[]{ \includegraphics[width=0.225\textwidth]{demo_Lag09.pdf} \label{demo_Lag0.9} } \caption{(a) Penalty method exhibits oscillations and violates the constraint. (b) Lagrangian method exhibits overshooting and oscillations of Lagrange multiplier.} \end{figure} To overcome the drawbacks of the two methods, we take the dynamical systems view of optimization \cite{An2018APC, stooke2020responsive} and propose a separated proportional-integral Lagrangian (SPIL) method which can fulfill the safety requirements with a steady and fast learning process. From a control perspective, the safe probability is the control output and the penalty weight is the control input. Then the penalty method can be interpreted as a proportional feedback controller, while the Lagrangian method can be interpreted as an integral feedback controller. Subsequently, the proportional-integral (PI) Lagrangian method is formulated, which integrates both methods to get their merits. To prevent integral-overshooting, we draw inspiration from PID control again and introduce the integral separation technique, i.e., separate the integrator out when the feedback error is large. Such a recipe solves the integral-overshooting problem that is ignored and unsolved in similar works \cite{stooke2020responsive}. In addition, we also adopt an analytical gradient of the safe probability with the theoretical basis to solve chance constraints in a model-based framework. Finally, the experiment of a narrow car-following task demonstrates SPIL succeeds in satisfying the chance constraint while achieving best cumulative reward. The contributions of this paper are as follows, \begin{enumerate} \item an integral-separated proportional-integral Lagrangian (SPIL) method is proposed to solve chance constrained RL problems with better performance while satisfying the constraint. \item an analytical gradient of safe probability is adopted for model-based policy optimization with theoretic basis. \end{enumerate} The rest of this paper is organized as follows. The chance constrained RL problem is formulated in Section \ref{sec:Preliminary}. The SPIL method is proposed in Section \ref{sec:chance constrained algorithm}. The effectiveness of the method is illustrated by a narrow car-following task in Section \ref{sec:Numerical Experiment}. Section \ref{sec:Conclusion} concludes this paper. \section{Chance Constrained RL problems} \label{sec:Preliminary} Considering a discrete-time stochastic system, the dynamic with the chance constraint is mathematically described as: \begin{equation} \begin{aligned} &x_{t+1}=f(x_{t}, u_{t}, \xi_{t}),\\ &\xi_{t}\sim p(\xi_{t}),\\ &{\rm Pr}\left\{ \bigcap_{t=1}^{N} \left[h\left(x_{t}\right)<0\right]\right\}\ge1-\delta \end{aligned} \end{equation} where $t$ is the current step, $x_{t}\in{\mathcal{X}}$ is the state, $u_{t}\in{\mathcal{U}}$ is the action, $f(\cdot,\cdot,\cdot)$ is the environmental dynamic model, $\xi_{t}\in{\mathbb{R}}^{n}$ is the uncertainty following an independent and identical distribution $p(\xi_{t})$. $h(\cdot)$ is the state constraint function defining a safe state region. We do not make assumptions about the form of $f(\cdot,\cdot,\cdot)$ and $h(\cdot)$, i.e., they can be linear or nonlinear. Note that here the safety constraint takes the form of a joint chance constraint with $1-\delta$ as the required threshold. This form is extensively used in stochastic systems control \cite{Mesbah2016StochasticMP}. Intuitively, it can be interpreted as the probability of the plant staying within a safe region over the finite horizon $N$ is at least $1-\delta$. For simplicity, we only consider one constraint. The objective of chance constrained RL problems is to maximize the expectation of cumulative reward $J$, while constraining the safe probability $p_s$: \begin{equation} \begin{aligned} &\max _{\pi} J\left(\pi\right)={\mathbb{E}_{x_0,\xi}}\left\{\sum_{t=0}^{\infty} \gamma^{t} r\left(x_{t}, u_{t}\right)\right\}\\ &\text { s.t. }p_s(\pi)={\rm Pr}\left\{ \bigcap_{t=1}^{N} \left[h\left(x_{t}\right)<0\right]\right\}\ge1-\delta \label{CCRL problem} \end{aligned} \end{equation} where $r(\cdot,\cdot)$ is the reward function, $\gamma\in(0,1)$ is the discounting factor, ${\mathbb{E}_{x_0,\xi}}(\cdot)$ is the expectation w.r.t. the initial state $x_0$ and uncertainty $\xi$. $\pi$ is the control policy, i.e., a deterministic mapping from state space ${\mathcal{X}}$ to action space ${\mathcal{U}}$ with parameters $\theta$, i.e., $u_{t}=\pi(x_{t};\theta)$. \section{Separated PI Lagrangian for Chance Constrained RL Problems} \label{sec:chance constrained algorithm} In this section, we will elaborate on the SPIL method for chance constrained problems. Besides, we also introduce an analytical gradient of safe probability and update the policy in a model-based mechanism. \subsection{Separated PI Lagrangian method}\label{SPIL} The PI Lagrangian method comes from a control view of the penalty method and the traditional Lagrangian method. It considers the penalty method as a proportional feedback controller and the traditional Lagrangian method as an integral feedback controller, which can be integrated together and lead to a PI Lagrangian method. To see this, we first review the penalty method and traditional Lagrangian method. The penalty method adds a quadratic penalty term in the objective function to force the satisfaction of the constraint: \begin{align} \label{penalty} &\max_\pi J(\pi) - \frac{1}{2}\alpha_p \left((1-\delta- p_s(\pi))^+\right)^2 \end{align} where $\alpha_p>0$ is the penalty weight, $(\cdot)^+$ means $\max(\cdot,0)$. This unconstrained problem is solved by gradient ascent \begin{equation} \label{penalty_update} \theta^{k} \leftarrow \theta^{k-1}+\alpha_{\theta}(\nabla_{\theta}J^{k}+\alpha_p (1-\delta - p_s^k)^+ \nabla_{\theta}p_s^{k}) \end{equation} where $k$ means $k$-th iteration, $\alpha_{\theta}>0$ is the learning rate. As for the traditional Lagrangian method, it first transforms the original chance constrained problem \eqref{CCRL problem} into an dual problem by introduction of a the Lagrange multiplier $\lambda$ \cite{boyd2004convex}: \begin{align} \label{maxmax} &\max_{\lambda\ge0}\max_\pi\mathcal{L}(\pi,\lambda)=J(\pi)-\lambda\left(1-\delta- p_s(\pi)\right) \end{align} The problem \eqref{maxmax} is solved by iteratively updating the Lagrange multiplier and primal variables: \begin{equation} \label{dual_update} \lambda^{k}\leftarrow (\lambda^{k-1} +\alpha_{\lambda}(1-\delta- p_s^{k}))^+ \end{equation} \begin{equation} \label{primal_update} \theta^{k} \leftarrow \theta^{k-1}+\alpha_{\theta}(\nabla_{\theta}J^{k}+\lambda^k \nabla_{\theta}p_s^{k}) \end{equation} where $\alpha_{\lambda}>0$ is the learning rate. Comparing the policy update rule of penalty method \eqref{penalty_update} with that of Lagrangian method \eqref{primal_update}, one may find they are surprisingly similar. Both gradients is the weighted sums of $\nabla_{\theta}J^{k}$ and $\nabla_{\theta}p_s^{k}$. The only difference lies in that the weight $(1-\delta + p_s^k)^+$ in penalty method is the one-step constraint violation, while the weight $\lambda$ in Lagrangian method is the cumulative constraint violation as \eqref{dual_update} shows. This insight builds the bridge between optimization and feedback control. One can view the optimization as dynamic systems control, where the weight of $\nabla_{\theta}p_s$ is the control input, $p_s$ is the control output and $1-\delta$ is the desired output. Consequently, the penalty method becomes a proportional controller with coefficient $\alpha_p$, while the Lagrangian method becomes an integral controller with coefficient $\alpha_\lambda$. Considering constrained optimization in such a control perspective, one can immediately understand the merits and faults of these two methods. For the penalty method, a large penalty $\alpha_p$ is prone to oscillations, while a small penalty leads to steady-state errors, i.e., not satisfying the constraint. For the Lagrangian method, it suffers from periodic oscillations from a delayed feedback. Subsequently, we naturally formulate a proportional-integral Lagrangian method to realize fast and steady learning process with no steady-state error. The update rule is a combination of previous two methods: \begin{align} \label{P_update} &\Delta^{k} \leftarrow 1-\delta-p_s^{k} \\ \label{I_update} &I^{k} \leftarrow (I^{k-1} + \Delta^{k})^+ \\ \label{lambda_update} &\lambda^{k} \leftarrow (K_P\Delta^k+K_II^k)^+ \\ \label{PI_update} &\theta^{k} \leftarrow \theta^{k-1}+\alpha_{\theta}(\nabla_{\theta}J^{k}+\lambda^k \nabla_{\theta}p_s^{k}) \end{align} where $\Delta, I$ are proportional and integral values, respectively, with $K_P,K_I$ denoting their corresponding coefficients. The proportional term $\Delta$ serves as an immediate feedback of the constraint violation. The integral term $I$ eliminates the steady-state error at convergence. In such a framework, the penalty method and traditional Lagrangian method can be regarded as two special cases of PI Lagrangian with $K_P>0, K_I=0$ and $K_P=0,K_I>0$, respectively. Actually, the proportional and integral terms together will achieve better performance in RL, just as the PI controller works well in control area. However, if the chance constraint is very tight and the initial policy is relatively unsafe, the integral terms usually increase rapidly since $\Delta$ is large, which will cause the overshooting of $\lambda$. With a large $\lambda$ in \eqref{PI_update}, the policy tends to become extremely conservative since the weight of $\nabla_{\theta}p_s^{k}$ is relatively large. Even worse, since the maximal safe probability is 1, the overshooting and conservatism problems will not recover by themselves. For e.g., if $1-\delta=0.999, p_s=1.0$ and the $\lambda^k$ is already overshooting, the integral term $I$ only decreases very slowly with the speed of $\Delta^{k}=-0.001$. Therefore, the policy optimization in such a case will be decelerated. This challenge is also not well recognized and resolved in previous similar works like \cite{stooke2020responsive}. In this paper, we draw inspiration from some anti-saturation methods in PID control \cite{Jia2019AnIP}, and introduce the integral separation technique. It reshapes the integrator in \eqref{I_update} into: \begin{equation} \begin{aligned} \label{SI_update} &I^{k} \leftarrow (I^{k-1} + K_S\Delta^{k})^+, \\ &K_S= \begin{cases} 0& \text{$\varepsilon_1<\Delta^{k}$} \\ \beta& \text{$\varepsilon_2<\Delta^{k}<\varepsilon_1$} \\ 1& \text{$\Delta^{k}<\varepsilon_2$} \end{cases} \end{aligned} \end{equation} where $K_S$ is the separation function, $1>\beta>0, \varepsilon_1>\varepsilon_2>0$ are the parameters. Obviously, the piecewise function $K_S$ separates the integrator out or slows it down if the error is relatively large. Such a recipe prevents the occurrence of integral-overshooting, greatly improving the performance under tight constraint as shown in our experiments. The framework of proposed method is summarized Fig. \ref{fig:SPIL algorithm}. \begin{figure}[htbp] \centering \centerline{\includegraphics[width=0.5\textwidth]{SPIL_algorithm.pdf}} \caption{The framework of SPIL method.} \label{fig:SPIL algorithm} \end{figure} \subsection{Analytical Gradient for Safe Probability} In the previous subsection, we have derived the main update rules of our SPIL method. The following parts discuss about how to calculate $p_s$ and $\nabla_\theta p_s$ in the update equations. The safe probability $p_s$ in the update rules can be directly estimated through Monte-Carlo sampling. To be specific, we rollout $M$ trajectories with current policy $\pi$ through the dynamic model. Suppose there are $m$ safe trajectories, then the safety probability is $p_s\approx \frac{m}{M}$. Note that this rollout procedure will not impose much extra computation burden since these trajectories are also necessary for the update of actor-critic as we will discuss in \ref{actor-critic}. However, it turns out that the gradient $\nabla_\theta p_s(\pi)$ is rather difficult to compute, which is also a major challenge in chance constrained problems \cite{Mesbah2016StochasticMP, Geletu2019AnalyticAA}. Previous researchers in chance constrained RL usually replace $\nabla_\theta p_s(\pi)$ with the gradient of a lower bound of $p_s$ without sufficient theoretical guarantees \cite{Paternain2019LearningSP, Peng2020ModelBasedAW}. In this paper, we introduce an analytical approximated gradient with theoretical basis \cite{Geletu2019AnalyticAA}. To the best of our knowledge, this is the first time such a gradient is used in chance constrained RL. We first define an indicator-like function $\phi(x,\alpha)$: \begin{equation} \begin{aligned} &\phi(x,\tau)=\frac{1+a_1\tau}{1+a_2\tau\exp(-\frac{x}{\tau})}, \\ &0<a_2<\frac{a_1}{1+a_1}, 0<\tau<1 \end{aligned} \end{equation} where $\tau,a_1,a_2$ are the parameters. The expected production $\Phi(\pi,\tau)$ is defined as: \begin{equation} \Phi(\pi,\tau)={\mathbb{E}_{x_0,\xi}}\left\{\prod_{t=1}^{N}\phi\left(-h(x_{t}),\tau\right)\right\} \end{equation} Intuitively, $\phi(x,\tau)$ can be regarded as a differentiable approximation of indicator function for constraint violation, and its expectation form $\Phi(\pi,\tau)$ approximates joint safe probability. The parameter $\tau$ controls how well the indicator function is approximated. Under mild assumptions, the gradient of $\Phi(\pi,\tau)$ converges to the gradient of joint safe probability $p_s(\pi)$ as $\tau$ approaches $0$ \cite{Geletu2019AnalyticAA}. \begin{equation} \label{app_gradient} \lim\limits_{\tau\to0+} \sup\limits_{\theta\in\Theta}\nabla_{\theta}\Phi(\pi,\tau)=\nabla_{\theta}p_s(\pi) \end{equation} where $\Theta$ is a ball in the policy parameter space. The equation \eqref{app_gradient} shows that one can use the gradient of a differentiable function $\Phi(\pi,\tau)$ to approximate $\nabla_{\theta}p_s(\pi)$ if $\tau$ is small enough. For simplicity, we do not provide more mathematical details; interested readers are recommended to refer to \cite{Geletu2019AnalyticAA} for a rigorous explanation. In practice, one only needs to pick a small fixed $\tau$ and compute $\nabla_{\theta}\Phi(\pi,\tau)$ with any autograd package, where the expectation is substituted by sampling average. In addition, the order of magnitude of $\nabla_{\theta}J$ and $\nabla_{\theta}p_s$ are usually different. To better balance them, the gradient $\nabla_{\theta}p_s$ is re-scaled to match the scale of $\nabla_{\theta}J$: \begin{equation} \nabla_{\theta}p_s \leftarrow \frac{\|\nabla_{\theta}J\|}{\|\nabla_{\theta}p_s\|}\nabla_{\theta}p_s \end{equation} \subsection{Model-based Actor-Critic with Parameterized Functions} \label{actor-critic} In this subsection, the main focus is on how to learn a parameterized policy and state-action value function in the model-based framework, where the gradient of the dynamic model will be utilized to attain an accurate ascent direction and thus improve the convergence rate compared with model-free RL algorithms \cite{deisenroth2011pilco,Shengbo2019}. For an agent behaving according to policy $\pi$, the values of the state-action pair $(x,u)$ are defined as follows: \begin{align} &Q^{\pi}(x,u)={\mathbb{E}_{\xi}}\left\{\sum_{t=0}^{\infty} \gamma^{t} r\left(x_{t}, u_{t}\right)\Big|x_0=x,u_0=u\right\} \end{align} Consequently, the expected cumulative reward $J$ can be expressed as a $N$-step form: \begin{align} \label{n-step} &J(\pi)={\mathbb{E}_{x_0,\xi}}\left\{\sum_{t=0}^{N-1}\gamma^{t} r\left(x_{t}, u_{t}\right)+\gamma^{N}Q^{\pi}(x_N,u_N)\right\} \end{align} For large and continuous state spaces, both value function and policy are parameterized, as shown in \eqref{para}. The parameterized state-action value function with parameter $w$ is usually named the ``critic'', and the parameterized policy with parameter $\theta$ is named the ``actor'' \cite{Shengbo2019}. \begin{equation} Q(x,u) \cong Q(x,u ; w), \quad u \cong \pi(x ;\theta) \label{para} \end{equation} The parameterized critic is trained by minimizing the average square error \eqref{td error}: \begin{equation} \begin{aligned} J_{Q}^k={\mathbb{E}}_{x_0,\xi}\left\{\frac{1}{2}\left(Q_{\text {target}}-Q(x_0,u_0;w^k)\right)^{2}\right\} \end{aligned} \label{td error} \end{equation} where $Q_{\text {target}} = \sum_{t=0}^{N-1} \gamma^{t} r\left(x_{t}, u_{t}\right)+\gamma^{N} Q\left(x_{N},u_{N};w^k\right)$ is the $N$-step target. Note that the rollout length $N$ is identical to the horizon of chance constraint. The semi-gradient of the critic is \begin{equation} \begin{aligned} \nabla_{\omega}J_Q^k&={\mathbb{E}}_{x_0,\xi}\left\{\left(Q(x_0,u_0;w^k)-Q_{\text {target}}\right) \frac{\partial Q(x_0,u_0;w^k)}{\partial w}\right\} \end{aligned} \label{semi-gradient of the critic} \end{equation} As discussed in \eqref{maxmax}, the parameterized actor aims to maximize Lagrangian function $\mathcal{L}$ via gradient ascent. The analytical gradient $\nabla_{\theta}\mathcal{L}$ is composed of $\nabla_{\theta}J$ and $\nabla_{\theta}p_s$, which are computed via backpropagation though time with the dynamic model \cite{Shengbo2019}. In practice, they can be easily obtained by any autograd package. Finally, the pseudo-code of proposed algorithm is summarized in Algorithm \ref{alg:SPIL}. Note that, to maintain a relatively consistent step size, the update rules for $\theta$ in \eqref{PI_update} is re-scaled by $\frac{1}{1+\lambda^k}$. \begin{algorithm}[!htb] \caption{SPIL algorithm} \label{alg:SPIL} \begin{algorithmic} \STATE Initialize $x_{0}\in \mathcal{X}$, $k=0$ \REPEAT \STATE{Rollout $M$ trajectories by $N$ steps via dynamic model} \STATE{Estimate safe probability} \STATE{\quad $p_s^k\approx\frac{m}{M}$} \STATE{Update $\lambda$ via PI Lagrangian rules} \STATE{\quad $\Delta^{k} \leftarrow 1-\delta-p_s^{k}$} \STATE{\quad $I^{k} \leftarrow (I^{k-1} + K_S\Delta^{k})^+$} \STATE{\quad $\lambda^{k} \leftarrow (K_P\Delta^k+K_II^k)^+ $} \STATE {Update critic according to \eqref{semi-gradient of the critic}:} \STATE{\quad $\omega^{k} \leftarrow \omega^{k-1} + \alpha_{\omega}\nabla_{\omega}J_{Q}^k$ } \STATE {Update actor:} \STATE{\quad $\theta^{k} \leftarrow \theta^{k-1}+\alpha_{\theta}\nabla_{\theta}\mathcal{L}$ } \STATE{\quad $\nabla_{\theta}\mathcal{L}= \frac{1}{1+\lambda^k}\left(\nabla_{\theta}J^{k}+\lambda^{k} \nabla_{\theta}p_s^{k}\right)$ } \STATE $k\leftarrow k+1$ \UNTIL $|Q^{k}-Q^{k-1}|\le \zeta$ and $|\pi^{k}-\pi^{k-1}| \le \zeta$ \end{algorithmic} \end{algorithm} \section{Numerical Experiment} \label{sec:Numerical Experiment} \subsection{Experiment Setup} In this section, the proposed SPIL is applied to a narrow car-following scenario as shown in Fig. \ref{fig:car-follwoing}, where the ego car expects to drive fast and closely with the front car to reduce wind drag \cite{gao2016robust}, while keeping a minimum gap between the two cars at a high probability. Concretely, the ego car and front car follow the kinematics model, where the front car is assumed to drive with a randomly varying velocity (e.g., due to the varying road grade, wind drag). \begin{figure}[htbp] \centerline{\includegraphics[width=0.4\textwidth]{car-following.pdf}} \caption{Car-following scenario.} \label{fig:car-follwoing} \end{figure} The discrete-time stochastic system is \begin{equation} \begin{aligned} &x_{t+1}=A x_t+B u_t+D \xi_t \\ &A=\left[{\small{\begin{array}{ccc} 1 & 0 & 0 \\ 0 & 1 & 0 \\ -T & T & 1 \end{array}}}\right],\\ &B=[T,0,0]^{\top}, \quad D=[0,T,0]^{\top} \end{aligned} \end{equation} \begin{figure*}[hbt] \centering \subfigure[Cumulative reward under $90.0\%$ threshold]{ \includegraphics[width=0.38\textwidth]{return09.pdf} \label{return0.9} } \subfigure[Cumulative reward under $99.9\%$ threshold]{ \includegraphics[width=0.38\textwidth]{return0999.pdf} \label{return0.999} } \\ \subfigure[Safe probability under $90.0\%$ threshold]{ \includegraphics[width=0.38\textwidth]{safety09.pdf} \label{safe0.9} } \subfigure[Safe probability under $99.9\%$ threshold]{ \includegraphics[width=0.38\textwidth]{safety0999.pdf} \label{safe0.999} } \caption{Comparison of performance among SPIL (separated PI Lagrangian), penalty method and traditional Lagrangian method.} \label{performance} \end{figure*} The system state vector is $x =[v_e \quad v_f \quad \epsilon]^{\top}$ , where $v_e$ denotes the velocity of ego car, $v_f$ is the velocity of front car, and $\epsilon$ is the gap between the two cars. The control input $u \in (-4,3)$ is the acceleration of ego car. The disturbance $\xi_t \sim \mathcal{N}(0,0.7)$ and $T=0.1 s$ is the simulation time step. With a chance constraint on the gap, the chance constrained RL problem is defined as \begin{equation}\begin{aligned} &\max _{\pi} \sum_{t=0}^{\infty} \gamma^{t}(0.2v_{e,t}-0.1\epsilon_t-0.02u^2_t) \\ &\text { s.t. } {\rm Pr}\left\{ \bigcap_{t=1}^{N} \left(\epsilon_{t}>2\right)\right\}\ge1-\delta \end{aligned}\end{equation} where $v_{e,t}$ denotes the ego car velocity at step $t$. \subsection{Implementation Details} We implement SPIL algorithm on the problem above. Our parameterized actor and critic are both fully-connected neural networks. Each network has two hidden layers using rectified linear unit (ReLU) as activation functions, with 64 units per layer. We adopt the Adam method to update the networks \cite{lecun2015deep}. The main hyper-parameters are listed in Table \ref{tab:hyper}. To demonstrate the advantages of SPIL, we compare the performance of SPIL with the penalty method (amounts to proportional-only SPIL) and traditional Lagrangian method (amounts to integral-only SPIL). The coefficients of SPIL are $K_P=15, K_I=0.6$. The penalty method is trained in two different weights $K_P=12$ and $80$. The traditional Lagrangian is trained on $K_I=18$ (we had tested on small $K_I=0.6$ but got terrible results). The cumulative reward and safe probability in horizon $N$ are compared under two chance constraint thresholds 90.0\% and 99.9\%, i.e., $\delta=0.1$ and $\delta=0.001$. \begin{table}[hbt] \caption{Hyper-parameters} \begin{center} \label{tab:hyper} \begin{tabular}{lcc} \hline Parameters & Symbol & Value \\ \hline trajectories number & $M$ & 4096 \\ constraint horizon & $N$ & 40 \\ discounting factor & $\gamma $ & 0.99 \\ learning rate of policy network & $\alpha_{\theta}$ & 3e-4 \\ learning rate of value network & $\alpha_{\omega}$ & 2e-4 \\ parameters of $K_S$ & $\beta$ & 0.3 \\ parameters of $K_S$ & $\varepsilon_1$ & 0.2 \\ parameters of $K_S$ & $\varepsilon_2$ & 0.05 \\ parameters of $\phi(\cdot)$ & $\tau$ & 1e-3 \\ parameters of $\phi(\cdot)$ & $a_1$ & 0.45 \\ parameters of $\phi(\cdot)$ & $a_2$ & 1 \\ \hline \end{tabular} \end{center} \end{table} \subsection{Evaluation Results} The learning curves are plotted in Fig. \ref{performance}, where each curve is averaged over five independent experiments. The SPIL not only succeeds to satisfy the chance constraint without periodic oscillations, but also achieves best cumulative reward among methods which meet the safety threshold. Observing the safe probability curves in Fig. \ref{safe0.9} and Fig. \ref{safe0.999}, the proposed SPIL satisfies the chance constraint in both settings. On the contrary, the penalty method with $K_P=12$ fails to achieve the required threshold due to small penalty weight. Although one can improve the penalty size and raise $K_P$ to reduce this error (i.e., set $K_P=80$), large $K_P$ also brings about rapid oscillations as a side effect, especially when the threshold is $90.0\%$. This is because with a large $K_P$, a small change of $\Delta$ will cause a dramatic change of $\lambda$ . The Lagrangian method does not have steady-state errors, but suffers from periodic oscillations under $90.0\%$ threshold. In a word, the proposed SPIL combines the advantages of integral and proportional methods, leading to a stable learning process with no steady-state errors. Interestingly, these phenomena are quite similar to conclusions in PID control, which exhibits the beauty of understanding optimization from the control perspective. As for the cumulative reward shown in Fig. \ref{return0.9} and Fig. \ref{return0.999}, excluding the unsafe penalty method $(K_P=12)$, SPIL achieves the best cumulative reward in both thresholds among the other three methods, which confirms the excellent performance of SPIL. Subsequently, we demonstrate that the integral separation technique in SPIL helps to prevent integral overshooting and reduce policy conservatism. We manually select five initially unsafe random seeds, i.e., the safe probability of initial policy $p_s<0.5$, and train the policy under $99.9\%$ threshold using SPIL with and without integral separation. The learning curves of cumulative reward $J$, safe probability $p_s$, integral value $I$ are plotted in Fig. \ref{unsafe_performance}. If the integral separation is removed, the integral value $I$ in Fig. \ref{unsafe_integral0.999} will have a sharp rise at the beginning. Then the policy rapidly learns to satisfy the constraint with safe probability becoming 1. However, since $\Delta=-0.001$ in \eqref{I_update}, the decrease of $I$ is quite slow. With the excessively large $I$ and $\lambda$, the policy keeps conservative for a long time and wins few rewards. On the contrary, with the help of integral separation, $I$ will not overshoot at the start and the policy successfully strikes a good balance between performance and safety, i.e., achieves more rewards while satisfying the constraint. Note that the results in Fig. \ref{performance} and Fig. \ref{unsafe_performance} are not comparable since the latter are conducted under manually chosen bad initial policies. \begin{figure*}[hbt] \centering \subfigure[Safe probability under $99.9\%$ threshold]{ \includegraphics[width=0.3\textwidth]{unsafe_safety0999.pdf} \label{unsafe_safety0.999} } \subfigure[Cumulative reward under $99.9\%$ threshold]{ \includegraphics[width=0.3\textwidth]{unsafe_return0999.pdf} \label{unsafe_return0.999} } \subfigure[Integral value under $99.9\%$ threshold]{ \includegraphics[width=0.3\textwidth]{unsafe_integral0999.pdf} \label{unsafe_integral0.999} } \caption{Comparison of performance of SPIL with and without integral separation.} \label{unsafe_performance} \end{figure*} \section{Conclusion} \label{sec:Conclusion} This paper proposed the separated PI Lagrangian method for chance constrained problems. Viewing optimization from a control perspective, SPIL adopted PI feedback to adjust the Lagrange multiplier and achieved good performance with a steady and fast learning process. Besides, integral separation was also included to prevent overshooting and reduce conservatism. Finally, we utilized an analytical gradient of safe probability for model-based policy optimization. The benefits of SPIL were demonstrated in simulations of a narrow car-following task. It achieved more cumulative reward while satisfying the chance constraint. The application of SPIL to more general environmental dynamics will be investigated in the future. \input{ref.bbl} \bibliographystyle{ieeetr} \end{document}
\section{Definition of torsion classes} For the elementary material in this section and the two following, a further reference is \cite[Chapter VI]{ASS}. A torsion class in $\mod A$ is a subcategory $\mathcal T$ of $\mod A$ which is \begin{itemize} \item closed under quotients (i.e., $Y\in \mathcal T$ and $Y\twoheadrightarrow Z$ implies $Z\in \mathcal T$). \item closed under extensions (i.e., $X,Z \in \mathcal T$ and $0\rightarrow X \rightarrow Y \rightarrow Z \rightarrow 0$ implies $Y\in \mathcal T$. \end{itemize} I should clarify that for me a subcategory is always full, closed under direct sums, direct summands, and isomorphisms. In other words, a subcategory of $\mod A$ can be specified as the direct sums of copies of some subset of the indecomposable modules of $A$. We write ${\sf {tors}}~\! A$ for the set of torsion classes of $\mod A$, and we think of it as a poset ordered by inclusion. \begin{example}[Type $A_2$] Our quiver $Q$ is $1\leftarrow 2$, and the algebra is the path algebra $A=kQ$. The category $\mod A$ has three indecomposable objects $S_1, P_2, S_2$, which I denote by their dimension vectors as $[10]$, $[11]$, and $[01]$, respectively. The torsion classes are as follows, where the angle brackets denote additive hull. $$\begin{tikzpicture} \node (a) at (0,0) {$\langle [10],[11],[01] \rangle$}; \node (b) at (-1,-1) {$\langle [11],[01]\rangle$}; \node (c) at (-1,-2) {$\langle [01]\rangle$}; \node (d) at (0,-3) {$0$}; \node (e) at (1,-2) {$\langle [10]\rangle$}; \draw (a) -- (b) -- (c) -- (d) -- (e) -- (a); \end{tikzpicture}$$ \end{example} \begin{example}[Type $A_n$] For an example in type $A_n$, where $Q$ is $1\leftarrow \dots \leftarrow n$, see \cite{K}. \end{example} \begin{example}[Kronecker quiver] \label{ex3} Let $k$ be algebraically closed. Let $Q$ be the quiver $\begin{tikzpicture}[baseline=-1.1mm] \node (a) at (0,0) {$1$}; \node (b) at (1,0) {$2$}; \draw[->] ([yshift=.5mm]b.west) -- ([yshift=.5mm]a.east); \draw[->] ([yshift=-.5mm]b.west) -- ([yshift=-.5mm]a.east); \end{tikzpicture}$ and let $A=kQ$. The AR quiver is displayed in Figure \ref{figb}, where I write $[ab]$ for an indecomposable module with dimension vector $(a,b)$. \begin{figure} $$\begin{tikzpicture}[->] \node (a) at (0,0) {$[10]$}; \node (b) at (1,1) {$[21]$}; \node (c) at (2,0) {$[32]$}; \node (d) at (3,1) {\phantom{$[43]$}}; \node (x) at (3.3,.5) {$\cdots$}; \node (e) at (4.5,0) {$[11]$}; \node (f) at (4.5,1) {$[22]$}; \node (g) at (4.5,2) {$\vdots$}; \draw ([xshift=.5mm]a.north east) -- ([yshift=-.5mm]b.south west); \draw ([yshift=.5mm]a.north east) -- ([xshift=-.5mm]b.south west); \draw ([xshift=.5mm]b.south east) -- ([yshift=.5mm]c.north west); \draw ([yshift=-.5mm]b.south east) -- ([xshift=-.5mm]c.north west); \draw ([xshift=.5mm]c.north east) -- ([yshift=-.5mm]d.south west); \draw ([yshift=.5mm]c.north east) -- ([xshift=-.5mm]d.south west); \draw (e) to [bend left=30] (f); \draw (f) to [bend left=30](g); \draw (g) to [bend left=30] (f); \draw (f) to [bend left=30] (e); \node (h) at (6,0) {\phantom{$[10]$}}; \node (i) at (7,1) {$[23]$}; \node (j) at (8,0) {$[12]$}; \node (k) at (9,1) {$[01]$}; \node (l) at (5.7,.5) {$\cdots$}; \draw ([xshift=.5mm]h.north east) -- ([yshift=-.5mm]i.south west); \draw ([yshift=.5mm]h.north east) -- ([xshift=-.5mm]i.south west); \draw ([xshift=.5mm]i.south east) -- ([yshift=.5mm]j.north west); \draw ([yshift=-.5mm]i.south east) -- ([xshift=-.5mm]j.north west); \draw ([xshift=.5mm]j.north east) -- ([yshift=-.5mm]k.south west); \draw ([yshift=.5mm]j.north east) -- ([xshift=-.5mm]k.south west); \draw[decorate,decoration={brace,mirror,amplitude=5pt}] (-.3,-.3) -- node[yshift=-2pt][below]{preprojective component} (3.3,-.3); \draw[decorate,decoration={brace,mirror,amplitude=5pt}] (3.7,-.3) -- node [yshift=-2pt][below] {tubes} (5.3,-.3); \draw[decorate,decoration={brace,mirror,amplitude=5pt}] (5.7,-.3) -- node[yshift=-2pt][below]{preinjective component} (9.3,-.3); \end{tikzpicture}$$ \caption{\label{figb} The AR quiver of the path algebra of the Kronecker quiver.} \end{figure} The tubes are indexed by points in $\mathbb P^1(k)=k\bigcup\{\infty\}$; they each look the same. The torsion classes consist of the additive hull of each of the following sets:\begin{itemize} \item any final part of the preinjective component, \item all preinjectives and a subset of the tubes, \item all preinjectives, all tubes, and a final part of the preprojectives, \item $S_1=[10]$.\end{itemize} An image of the lattice of torsion classes is displayed in Figure \ref{figa}. There, $\mathcal I$ denotes the preinjective component, and $\mathcal R_x$ denote the tube corresponding to $x\in \mathbb P^1(k)$. I write ${\sf {ind}}~\! \mod A$ for the set of indecomposable $A$-modules. The interval between $\mathcal I$ and $\langle \mathcal I, \bigcup_{x\in\mathbb P^1(k)} \mathcal R_x\rangle$ is isomorphic to the Boolean lattice of all subsets of $\mathbb P^1(k)$, ordered by inclusion. \begin{figure} $$\begin{tikzpicture} \node (a) at (-1,-0.3) {$0$}; \node (b) at (1,0.7) {$\langle [01]\rangle$}; \node (c) at (1,2) {$\langle [12],[01]\rangle$}; \node (d) at (1,3) {$\vdots$}; \node (e) at (1,4) {$\mathcal I$}; \node (h) at (-1,5) {$\langle \mathcal I, \mathcal R_{-1}\rangle$}; \node (hh) at (.1,5) {$\cdots$}; \node (f) at (1,5) {$\langle \mathcal I,\mathcal R_0\rangle$}; \node (ff) at (2,5) {$\cdots$}; \node (g) at (3,5) {$\langle \mathcal I,\mathcal R_1\rangle$}; \node (i) at (1,7) {$\langle \mathcal I,\bigcup_{x\in\mathbb P^1(k)} \mathcal R_x\rangle$}; \node (j) at (1,6) {\phantom{$\mathcal I,\mathcal R_{-1}\rangle$}}; \node (k) at (-1,6) {\phantom{$\langle\mathcal I,\mathcal R_{-1}\rangle$}}; \node (l) at (3,6) {\phantom{$\langle\mathcal I,\mathcal R_1\rangle$}}; \node (kk) at (0,6) {$\cdots$}; \node (jj) at (2,6) {$\cdots$}; \node (ll) at (-2,5) {$\cdots$}; \node (mm) at (4,5) {$\cdots$}; \node (nn) at (3,6) {$\cdots$}; \node (pp) at (-1,6) {$\cdots$}; \node (qq) at (1,6) {$\cdots$}; \draw (a)-- node[below right]{\color{blue}$[01]$}(b)--node[right]{\color{blue}$[12]$}(c)--(d); \draw ([yshift=-2mm]d.north)--(e); \draw (e) -- (f); \draw (e) -- (g); \draw (e) -- (h); \draw (i) -- (j); \draw (i) -- (k); \draw (i) --(l); \draw[decorate,decoration={brace,mirror,amplitude=5pt}] (4.5,4)--node[xshift=2pt][right]{Boolean lattice}(4.5,7); \node (m) at (1,8) {$\vdots$}; \node (n) at (1,9) {$\langle {\sf {ind}}~\! \mod A \setminus\{[10],[21]\}\rangle$}; \node (o) at (1,10.3) {$\langle {\sf {ind}}~\! \mod A \setminus \{[10]\}\rangle$}; \node (p) at (-1,11.3) {$\mod A$}; \node (q) at (-3.5,5.5) {$\langle [10]\rangle$}; \draw (a) -- node[left]{\color{blue}$[10]$}(q) -- node[left]{\color{blue}$[01]$}(p); \draw (p) -- node[above right]{\color{blue}$[10]$}(o) --node[right]{\color{blue}$[21]$}(n)-- ([yshift=-2mm] m.north); \draw (m)--(i); \end{tikzpicture}$$ \caption{\label{figa}The lattice of torsion classes for $A$ the path algebra of the Kronecker quiver. The labels on the edges should be ignored for now; they are the brick labelling $\hat\gamma$ defined in Section \ref{cons}.} \end{figure} \end{example} \section{Specifying a torsion class} In general, how can we specify a torsion class? For $\mathcal C$ a subcategory of $\mod A$, define $T(\mathcal C)$ to be the subcategory whose modules are filtered by quotients of objects from $\mathcal C$. That is to say $M\in T(\mathcal C)$ if and only if $M$ admits a filtration $0=M_0 \subset M_1 \subset \dots \subset M_r=M$ with $M_i/M_{i-1}$ a quotient of an object of $\mathcal C$ for all $i$. \begin{proposition}\label{p1} For $\mathcal C$ an arbitrary subcategory, $T(\mathcal C)$ is the smallest torsion class containing all the objects from $\mathcal C$. \end{proposition} \begin{proof} Suppose that $M\in T(\mathcal C)$, so that we have a filtration $0=M_0 \subset M_1 \subset \dots \subset M_r=M$ with $M_i/M_{i-1}$ a quotient of an object of $\mathcal C$ for all $i$. Consider some quotient of $M$, say $N=M/L$. Then define $N_i=(M_i+L)/L$, which forms a filtration of $N$. We see that $N_i/N_{i-1}$ is a quotient of $M_i/M_{i-1}$, and therefore a quotient of an object of $\mathcal C$. This shows that $N\in T(\mathcal C)$. Suppose next that we have two modules $M$ and $N$, both in $T(\mathcal C)$, and an extension $$0 \rightarrow M \rightarrow E \rightarrow N \rightarrow 0.$$ Now $E$ has a two-step filtration $0 \subset M \subset E$, with $E/M \simeq N$, and we can refine the two steps of the filtration to filtrations of $M$ and $N$ with subquotients being quotients of $\mathcal C$, since we know such filtrations exist. This shows that $E\in T(\mathcal C)$. It follows that $T(\mathcal C)$ satisfies the two defining properties, and is therefore a torsion class. $T(\mathcal C)$ is the smallest torsion class containing $\mathcal C$ because any element of $T(\mathcal C)$ is an iterated extension of quotients of $\mathcal C$, which must be in any torsion class containing $\mathcal C$. \end{proof} We now consider a second way to specify a torsion class. For $\mathcal C$ a subcategory of $\mod A$, define $${}^\perp \mathcal C=\{ X\in \mod A \mid \operatorname{Hom}(X,Y)=0 \textrm{ for all } Y \in \mathcal C\}.$$ \begin{proposition}\label{p2} For $\mathcal C$ an arbitrary subcategory, ${}^\perp \mathcal C$ is a torsion class. \end{proposition} \begin{proof} Let $M\in{}^\perp \mathcal C$. Let $N$ be a quotient of $M$. Since there are no non-zero morphisms from $M$ into any object of $\mathcal C$, the same holds for $N$, so $N\in {}^\perp \mathcal C$. Suppose now that we have $M$ and $N$ in ${}^\perp \mathcal C$, and an extension: $$0 \rightarrow M \rightarrow E \rightarrow N \rightarrow 0.$$ For any $Y\in \mathcal C$, we have $\operatorname{Hom}(M,Y)=0$ and $\operatorname{Hom}(N,Y)=0$, and it follows from the left exactness of the $\operatorname{Hom}$ functor that $\operatorname{Hom}(E,Y)=0$ as well. We deduce that $E \in {}^\perp \mathcal C$. ${}^\perp \mathcal C$ satisfies the two defining conditions, and is therefore a torsion class. \end{proof} \section{Torsion classes and torsion free classes} There is a dual notion to that of torsion class, namely that of torsion free class. A torsion free class in $\mod A$ is a subcategory closed under submodules and extensions. We write ${\sf {tf}}~\! A$ for the torsion free classes of $A$, and we think of it as a poset ordered by inclusion. As one should expect, in the setting of finite-dimensional algebras in which we work, the theory of torsion free classes is completely parallel to the theory of torsion classes. For $\mathcal C$ a subcategory of $\mod A$, define $F(\mathcal C)$ to be the subcategory of $\mod A$ consisting of all modules filtered by submodules of modules from $\mathcal C$. Then $F(\mathcal C)$ is the smallest torsion free class containing $\mathcal C$. We can also define $$\mathcal C^\perp=\{Y\in \mod A\mid \operatorname{Hom}(X,Y)=0 \textrm{ for all } X\in \mathcal C\}.$$ One easily checks that for any subcategory $\mathcal C$, the subcategory $\mathcal C^\perp$ is a torsion free class. \begin{proposition} Let $\mathcal T$ be a torsion class, and let $X\in\mod A$. There is a maximum submodule of $X$ contained in $\mathcal T$. \end{proposition} \begin{proof} If $M$ and $N$ are submodules of $X$, then we have a short exact sequence $$ 0 \rightarrow M \rightarrow M+N \rightarrow N/(N\cap M)\rightarrow 0$$ If $N$ and $M$ are both in $\mathcal T$, it follows that $M+N$ is also. Because $X$ is finite-dimensional by assumption, it therefore has a maximum submodule contained in $\mathcal T$. \end{proof} We denote this maximum submodule by $t_\mathcal T X$. \begin{proposition} $X/t_\mathcal T X$ lies in $\mathcal T^\perp$. \end{proposition} \begin{proof} Suppose there were a non-zero map $f$ from some $M\in \mathcal T$ to $X/t_\mathcal T X$. Then ${\sf im} f$ is a quotient of $M$, and therefore itself in $\mathcal T$. The preimage of ${\sf im} f$ in $X$ is then an extension of ${\sf im} f$ by $t_\mathcal T X$, and is therefore also in $\mathcal T$, contradicting the definition of $t_\mathcal T X$. \end{proof} For any $X$ in $\mod A$, we now have a short exact sequence:\begin{equation*} 0 \rightarrow t_\mathcal T X \rightarrow X \rightarrow X/t_\mathcal T X\rightarrow 0.\tag{$*$}\end{equation*} with the lefthand term in $\mathcal T$ and the righthand term in $\mathcal T^\perp$. \begin{proposition} For $X\in \mod A$, any short exact sequence of the form $$ 0\rightarrow X' \rightarrow X \rightarrow X'' \rightarrow 0$$ with $X'$ in $\mathcal T$ and $X''\in \mathcal T^\perp$ is isomorphic to $(*)$. \end{proposition} \begin{proof} Viewing $X'$ as a submodule of $X$, it must be contained in $t_\mathcal T X$. If the containment were strict, then $X''$ would not lie in $\mathcal T^\perp$. The result follows. \end{proof} We can now prove the following theorem: \begin{thm}\label{rev} The map $\mathcal T \to \mathcal T^\perp$ is an inclusion-reversing bijection from torsion classes to torsion free classes. Its inverse is given by the map $\mathcal F \to {}^\perp\mathcal F$. \end{thm} \begin{proof} Let $\mathcal T$ be a torsion class. We already pointed out that $\mathcal T^\perp$ is torsion free. It is easy to see that ${}^\perp(\mathcal T^\perp)\supseteq \mathcal T$. For the other inclusion, suppose $X\in {}^\perp(\mathcal T^\perp)$. Since $X/t_\mathcal T X\in \mathcal T^\perp$, there are no non-zero morphisms from $X$ to $X/t_\mathcal T X$. But this must mean that $X/t_\mathcal T X=0$, so $X=t_\mathcal T X$, and $X \in \mathcal T$. Starting with a torsion free class $\mathcal F$, we see just as easily that the composition of the two maps in the other order is also the identity. They are therefore inverse bijections. It is easy to see that they are order-reversing. \end{proof} From the previous theorem, together with Proposition \ref{p2}, the following corollary follows: \begin{cor} The following pairs of subcategories are the same: \begin{itemize} \item $\{(\mathcal T,\mathcal T^\perp)\mid \mathcal T \in {\sf {tors}}~\! A\}$, \item $\{({}^\perp \mathcal F,\mathcal F)\mid \mathcal F \in {\sf {tf}}~\! A\}$, \item $\{(\mathcal X,\mathcal Y)\mid \mathcal X={}^\perp \mathcal Y, \mathcal Y=\mathcal X^\perp)\}$. \end{itemize} \end{cor} \section{Posets and lattices} A possible reference for basis material on lattices is \cite{Gr}. A poset is a partially ordered set. In a poset, we say that $x$ covers $y$ if $x$ is greater than $y$ and there is no element $z$ such that $x>z>y$. In this case we write $x\gtrdot y$. A lattice is a poset in which any two elements $x$ and $y$ have a unique least upper bound (their ``join'') denoted $x\vee y$, and a unique greatest lower bound (their ``meet'') denoted $x\wedge y$. A complete lattice is a lattice such that any subset $S$ of $L$ has a unique least upper bound, which we denote either $\bigvee_{x\in S} x$ or $\bigvee S$, and a unique greatest lower bound, which we denote $\bigwedge_{x\in S} x$ or $\bigwedge S$. A finite lattice is necessarily complete. The perspective taken in this note is that the desirable infinite generalization of finite lattices are the complete lattices. A complete lattice necessarily has a minimum element $\hat 0$ (the meet of all the elements of $L$) and similarly a maximum element $\hat 1$. \section{Torsion classes form a complete lattice} The poset ${\sf {tors}}~\! A$ clearly has a meet operation given by intersection, since the intersection of two torsion classes again satisfies the defining properties of a torsion class. The same is true for meets of arbitrary collections of torsion classes, for the same reason. To see the other lattice operation, there are three approaches which all work. Since the left perpendicular/right perpendicular operations are order-reversing bijections between torsion-classes and torsion-free classes, we have that $$\bigvee_{\mathcal T\in S} \mathcal T = {}^\perp \left(\bigwedge_{\mathcal T\in S} \mathcal T^\perp\right).$$ Since the $\bigwedge$ on the righthand side exists (being given by intersection), so does the $\bigvee$ on the lefthand side. We can also define the join operation in ${\sf {tors}}~\! A$ implicitly. Any poset with a maximum element and a $\bigwedge$ also has a $\bigvee$, which can be defined as follows: $$\bigvee_{\mathcal T\in S} \mathcal T= \bigwedge_{\{\mathcal Y\in {\sf {tors}}~\! A \,\mid\, \,\forall \mathcal T\in S,\, \mathcal Y\supseteq\mathcal T \}} \mathcal Y$$ Finally, we can also describe the join explicitly using Proposition \ref{p1}: $$\bigvee_{\mathcal T \in S} \mathcal T = T\left(\bigcup_{\mathcal T\in S} \mathcal T\right)$$ We therefore have the following result: \begin{proposition} ${\sf {tors}}~\! A$ is a complete lattice. \end{proposition} \section{join irreducible elements in lattices} An element $x$ of a lattice $L$ is called join irreducible if it cannot be written as the join of two elements both strictly smaller than it, and it is also not the minimum element of the lattice. Especially for finite lattices, the join irreducible elements can be viewed as ``building blocks'' of the lattice. \begin{proposition} In a finite lattice $L$, any element is the join of the join irreducible elements below it. \end{proposition} \begin{proof} Suppose $x\in L$ were a minimal counter-example to the statement of the proposition. If $x$ were join irreducible, it is obviously not a counter-example, so suppose that it is not join irreducible. We can therefore write $x=y\vee z$ with $y,z<x$. By the assumption that $x$ is a minimal counter-example, $y$ and $z$ can each be written as a join of join irreducible elements. Joining together these two expressions, we get an expression for $x$ as a join of join irreducible elements, contradicting our assumption that $x$ was a counter-example. \end{proof} The situation for infinite lattices is more complicated. It can still be interesting to consider join irreducible elements defined as above. However, for our purposes, the following definition is more important. We say that $x\in L$ is completely join irreducible if $\bigvee_{y<x}y < x$. Equivalently, there is an element, which we denote $x_*$ such that $y<x$ if and only if $y\leq x_*$. Note that the minimum element $\hat 0$ is not considered to be completely join irreducible. We write $\operatorname{Ji}^c L$ for the completely join irreducible elements of $L$. Note that for a finite lattice, $x\in L$ is join irreducible if and only if it is completely join irreducible. However, this is not true in infinite lattices. For example, consider $[0,1]$, as an interval in $\mathbb R$ with the usual order. Every element except $0$ is join irreducible, but there are no completely join irreducible elements. This suggests that neither of these notions is necessarily all that useful for general infinite lattices. However, for the lattices we are interested in, the notion of completely join irreducible elements will turn out to be very important. Let us return to consider the torsion classes of the Kronecker quiver presented in Example \ref{ex3}. Of the torsion classes in the interval isomorphic to a Boolean lattice, the elements covering the minimum are completely join irreducible, while the others are not. Among the other torsion classes, all are completely join irreducible except the minimum and maximum elements. The unique torsion class which is join irreducible but not completely join irreducible is the one composed of all the preinjective modules, labelled $\mathcal I$ in the diagram. It is the join of the (infinite) set of torsion classes generated by preinjective modules, but it is not the join of any finite set of torsion classes strictly contained in it. There are also dual notions of meet irreducible and completely meet irreducible elements of a lattice. We write $\operatorname{Mi}^c L$ for the completely meet irreducible elements of $L$. For $m$ a completely meet irreducible element, we write $m^*$ for the unique element which covers it. \section{Completely join irreducible torsion classes} Recall that a module $B$ is called a brick if every non-zero endomorphism of $B$ is invertible. A brick is necessarily indecomposable, since projection onto a proper indecomposable summand is a non-invertible endomorphism. Write ${\sf br}~\! A$ for the $A$-modules which are bricks. In the case of the Kronecker quiver, the bricks are the indecomposable modules from the preprojective and preinjective components, together with the quasi-simple module at the bottom of each tube. In this section, we shall show an important result by Barnard--Carroll--Zhu \cite[Theorem 1.5]{BCZ}, that there is a bijection between ${\sf br}~\! A$ and the completely join irreducible elements of ${\sf {tors}}~\! A$. The same result holds for ${\sf {tf}}~\! A$, and, by the order-reversing bijection between ${\sf {tf}}~\! A$ and ${\sf {tors}}~\! A$, the same result also holds for the meet irreducible elements of ${\sf {tors}}~\! A$ and ${\sf {tf}}~\! A$. For simplicity, we will focus our attention on ${\sf {tors}}~\! A$ and its completely join irreducible elements; everything we prove has analogues in the other settings. The following lemma says that a torsion class is characterized by the bricks it contains. \begin{lemma} \label{lone} Let $\mathcal T\in {\sf {tors}}~\! A$. Then $$\mathcal T=\bigvee_{B\in \mathcal T\cap {\sf br}~\! \!A} T(B)$$ \end{lemma} \begin{proof} Let us write $$\mathcal U= \bigvee_{B\in \mathcal T\cap {\sf br}~\! \!A} T(B)$$ Clearly, $\mathcal U \subseteq \mathcal T$. Now suppose that we have some $X$ which is in $\mathcal T$ but not in $\mathcal U$, and among such $X$, choose one of minimal dimension. $X$ is clearly not a brick, since otherwise it would be contained in $\mathcal U$. Thus it has a non-zero non-invertible endomorphism $f$. We get a short exact sequence: $$ 0 \rightarrow f(X) \rightarrow X \rightarrow X/f(X) \rightarrow 0$$ Since $X\in \mathcal T$, we have $X/f(X)\in\mathcal T$, and since the dimension of $X/f(X)$ is less than that of $X$, it follows that $X/f(X) \in \mathcal U$. Similarly, though, since $f(X)$ is also a quotient of $X$, we know $f(X)\in\mathcal T$ and since $f(X)$ is in fact a proper quotient of $X$, the minimality assumption on $X$ then implies that $f(X)\in \mathcal U$. We now see that $X$ is the extension of two objects from $\mathcal U$, so it is itself in $\mathcal U$, contrary to our assumption.\end{proof} We also need the following lemma due to Sota Asai. \begin{lemma}[{\cite[Lemma 1.7(1)]{Asai}}] \label{slem} If $X\in T(B)$, then either $X$ admits a surjection onto $B$ or $\operatorname{Hom}(X,B)=0$. \end{lemma} \begin{proof} Suppose that $f\in\operatorname{Hom}(X,B)$ is non-zero. Since $X$ is filtered by quotients of $B$, we can write $0=X_0 \subseteq X_1 \subseteq \dots \subseteq X_r=X$, with $X_i/X_{i-1}$ isomorphic to a quotient of $B$. Consider the smallest $i$ such that $f|_{X_{i}}$ is non-zero. Since $f|_{X_{i-1}}=0$, $f$ induces a map from $X_i/X_{i-1}$ to $B$, and thus from $B$ to $B$. Since $B$ is a brick, this map must be surjective, so $f|_{X_i}$ is surjective, and thus $f$ is surjective. \end{proof} We can now prove the main result of the section: \begin{thm}[{\cite[Theorem 1.5]{BCZ}}]\label{cjib} The map $B\to T(B)$ is a bijection from ${\sf br}~\! A$ to $\operatorname{Ji}^c {\sf {tors}}~\! A$. \end{thm} \begin{proof} First of all, we want to show that, for $B$ a brick, $T(B)$ is a completely join irreducible torsion class. This requires showing that there is a unique maximum element among all those torsion classes strictly below $T(B)$. We claim that this torsion class can be described as $T(B) \cap {}^\perp F(B)$. Since $B\not\in {}^\perp F(B)$, it is clear that $T(B) \cap {}^\perp F(B)$ is a torsion class strictly contained in $T(B)$. On the other hand, any torsion class strictly contained in $T(B)$ cannot contain $B$, and thus cannot contain any module $X$ admitting a surjective map onto $B$. Thus, by Lemma~\ref{slem}, any such torsion class must be contained in ${}^\perp B$. Clearly ${}^\perp B \supseteq {}^\perp F(B)$, and the reverse inclusion follows because any element of $F(B)$ is filtered by subobjects of $B$, so if $X$ has no non-zero morphisms into $B$, it has no non-zero morphisms into any element of $F(B)$. Therefore, any torsion class properly contained in $T(B)$ is contained in $T(B) \cap {}^\perp F(B)$. This proves the claim, thus establishing that $T(B)$ is a completely join irreducible torsion class. On the other hand, by Lemma \ref{lone}, any torsion class can be written as the join of $T(B)$ as $B$ runs through all bricks in the torsion class. This shows that any torsion class can be written as a join of the completely join irreducible torsion classes we have already identified (those of the form $T(B)$ for $B$ a brick) so there cannot be any completely join irreducible torsion classes not of this form. Finally, we want to check that the map from bricks to torsion classes is injective. Suppose that $T(B)=T(B')$, for $B$ and $B'$ two bricks. $B'$ cannot be contained in $T(B)_*$. Thus there is a surjection from $B'$ to $B$ by Lemma \ref{slem}. Reversing the rôles of $B'$ and $B$, there is also a surjection from $B$ to $B'$. Therefore $B$ and $B'$ must be isomorphic. \end{proof} This theorem is one of the key justifications for the impression that when considering lattices of torsion classes, it is most appropriate to think in terms of the complete versions of lattice-theoretic phenomena. As we saw in the example of the Kronecker quiver, there is a join irreducible torsion class which is not completely join irreducible, namely, the additive hull of the preinjective component. In accordance with Theorem \ref{cjib}, it does not correspond to any brick in $\mod A$. This raises the following interesting question: \begin{question} Is there any way to extend Theorem \ref{cjib} to characterize the join irreducible but not completely join irreducible elements of ${\sf {tors}}~\! A$? \end{question} The proof of the following theorem is dual to the proof of Theorem \ref{cjib}. \begin{thm} The map $B\to F(B)$ is a bijection from ${\sf br}~\! A$ to $\operatorname{Ji}^c {\sf {tf}}~\! A.$\end{thm} Then, applying Theorem \ref{rev}, we deduce: \begin{cor} \label{cmib} The map $B\to {}^\perp F(B)$ is a bijection from ${\sf br}~\! A$ to $\operatorname{Mi}^c {\sf {tors}}~\! A$.\end{cor} From Theorem \ref{cjib}, Corollary \ref{cmib}, and their proofs, we can say that associated to a brick $B$, there are four torsion classes, arranged as in the following diagram, where the join of the two torsion classes on the middle layer equals the top torsion class, and their meet equals the bottom torsion class. $$\begin{tikzpicture} \node (a) at (0,0) {$({}^\perp F(B))^*$}; \node (b) at (1,-1) {$T(B)$}; \node (c) at (-1,-1) {${}^\perp F(B)$}; \node (d) at (0,-2) {$T(B)_*$}; \draw[dotted] (a) -- (b); \draw[dotted] (c) -- (d); \draw (a)--(c); \draw (b) --(d); \end{tikzpicture}$$ In the diagram, the edges drawn as undashed lines are cover relations in the lattice of torsion classes. The edges drawn using dashed lines are weak poset relations. In particular, the torsion classes at the endpoints of a dotted line may be equal. Also, the pair of torsion classes not connected by a line are not comparable in the lattice of torsion classes. We follow these conventions in subsequent diagrams. \section{Parenthesis: $\tau$-tilting} We include the following section because it makes the link to another topic of current research related to torsion classes, which was also presented during the spring school. A possible reference is the survey by Iyama and Reiten \cite{IR}. A torsion class $\mathcal T$ is called functorially finite if there is some $X\in \mod A$ such that $\mathcal T=\operatorname{Gen}(X)$, where $\operatorname{Gen}(X)$ is by definition the collection of quotients of direct sums of copies of $X$. In the Kronecker case, which ones are functorially finite? Exactly those not in the Boolean lattice. There is no single module which generates the whole preinjective component and nothing more, and there is no single module which generates any tube without in fact being preprojective (and thus generating all the tubes and more). As shown by Adachi, Iyama, and Reiten, in the paper \cite{AIR} which introduced the topic of $\tau$-tilting theory, functorially finite torsion classes correspond bijectively to a certain class of modules called basic support $\tau$-tilting modules; the bijection from basic support $\tau$-tilting modules to torsion classes is $\operatorname{Gen}$. Functorially finite torsion classes need not form a lattice. There is nothing that guarantees that the intersection of two functorially finite torsion classes will be functorially finite, so in order for them to form a lattice anyway, there would have to be a biggest functorially finite torsion class contained in the intersection, and this does not always hold. Generally, for hereditary algebras not of finite type, the functorially finite torsion classes do not form a lattice \cite {IRRTT,Ring}. Thus, for lattice-theoretic study, it seems preferable not to restrict to functorially finite torsion classes. \section{Semidistributivity}\label{csd} In this section we introduce the notion of semidistributivity of a lattice. See \cite{AN,RST} for more on the subject. A lattice $L$ is called join semidistributive if $x\vee y = x\vee y'$ implies that $x\vee (y \wedge y')$ is also equal to both of them. It is called completely join semidistributive if given $x\in L$ and a set $S\subseteq L$, such that $x\vee y=z$ for all $y\in S$, then $x\vee \bigwedge S=z$. Join semidistributivity and complete join semidistributivity are equivalent for finite lattices. As usual for us, in the infinite setting, the version which we prefer is the complete one. Complete join semidistributivity is equivalent to saying that, given $x,z\in L$, if we consider $\{y\mid x\vee y =z\}$, then this set, if it is non-empty, has a minimum element. When we say ``minimum element,'' we do not mean only ``minimal'' (i.e., an element such that there is no element strictly below it), we mean an element which is weakly below all the elements in the set. Similarly, a lattice is called meet semidistributive if $x\wedge y=x\wedge y'$ implies that $x\wedge (y\vee y')$ is also equal to both of them. It is called completely meet semidistributive if given $x\in L$ and a set $S\subseteq L$, such that $x\wedge y=z$ for all $y\in S$, then $x\wedge \bigvee S=z$. Equivalently, given $x,z\in L$, if we consider $\{y\mid x\wedge y=z\}$, then this set, if non-empty, has a maximum element. A lattice is called semidistributive if it is join semidistributive and meet semidistributive. It is called completely semidistributive if it is completely join semidistributive and completely meet semidistributive. Complete semidistributivity is the property which we are going to focus on. We are now going to develop some properties of completely semidistributive lattices. \begin{proposition} In any completely join semidistributive lattice $L$, every cover $y\gtrdot x$ has a unique completely join irreducible element $j$ such that $x\vee j=y$ and $x\vee j_*=x$.\end{proposition} \begin{proof} Let $S=\{z\mid x\vee z=y\}$. This set is non-empty, since $y\in S$. Thus, by complete join semidistributivity, it has a minimum element. Call it $j$. Any $z<j$ satisfies that $x\vee z < y$, and thus that $x\vee z=x$. It follows that any $z<j$ satisfies that $z\leq x$. Therefore, any $z<j$ satisfies $z\leq x\wedge j$. Since $j\not<x$, we have $x\wedge j < j$. Thus every element strictly below $j$ is weakly below $x\wedge j<j$. It follows that $j$ is completely join irreducible, and $j_*=j\wedge x$. Now suppose that we had some other completely join irreducible element $j'$ such that $x\vee j'=y$ and $x\vee j'_*=x$. Since $j$ is the minimum element of $S$, we must have $j'>j$. But then $x\geq j'_*\geq j$, which contradicts $x\vee j> x$. Thus $j$ is unique. \end{proof} Write $\gamma(y\gtrdot x)$ for the completely join irreducible element defined in the previous proposition. Similarly, in a completely meet semidistributive lattice $L$, every cover $y\gtrdot x$ has a unique completely meet irreducible element $m$ such that $m\wedge y=x$ and $m^*\wedge y=y$. Write $\mu(y\gtrdot x)$ for this completely meet irreducible element. \begin{proposition} In a completely semidistributive lattice $L$, there are inverse bijections $\kappa$ and $\kappa^d$: $$\begin{tikzpicture} \node (a) at (0,0) {$\operatorname{Ji}^c(L)$}; \node (b) at (3,0) {$\operatorname{Mi}^c(L)$}; \draw[-stealth] ([yshift=.5mm]a.east) -- node[above] {$\kappa$} ([yshift=.5mm]b.west); \draw[-stealth] ([yshift=-.5mm]b.west) -- node[below] {$\kappa^d$} ([yshift=-.5mm]a.east); \end{tikzpicture}$$ such that $\kappa(j)=\mu(j\gtrdot j_*)$ and $\kappa^d(m)=\gamma(m^*\gtrdot m)$. \end{proposition} It is standard to call these two maps $\kappa$ and $\kappa^d$ but different sources disagree as to which is which. \begin{proof} Let $j$ be a completely join irreducible element of $L$, and let $m=\kappa(j)=\mu(j\gtrdot j_*)$. We therefore have the following diagram: $$\begin{tikzpicture} \node (a) at (0,0) {$m^*$}; \node (b) at (1,-1) {$j$}; \node (c) at (-1,-1) {$m$}; \node (d) at (0,-2) {$j_*$}; \draw[dotted] (a) -- (b); \draw[dotted] (c) -- (d); \draw (a)--(c); \draw (b) --(d); \end{tikzpicture} $$ But now it is clear that $\kappa^d(m^*\gtrdot m)=j$, so $\kappa^d\circ \kappa$ is the identity. The dual argument shows that $\kappa\circ\kappa^d$ is the identity, and we have shown that $\kappa$ and $\kappa^d$ are inverse bijections. \end{proof} We now have the following theorem, which shows that the two labellings of the covers of $L$ differ only by a bijection. \begin{thm} Let $L$ be a completely semidistributive lattice. Then $\mu(y\gtrdot x)=\kappa(\gamma(y\gtrdot x))$ \end{thm} \begin{proof} For any $y\gtrdot x$, let $j=\gamma(y\gtrdot x)$ and $m=\mu(y\gtrdot x)$. We therefore have the following diagram, from which the result follows. $$\begin{tikzpicture} \node (a) at (0,0) {$m^*$}; \node (b) at (1,-1) {$y$}; \node (c) at (-1,-1) {$m$}; \node (d) at (0,-2) {$x$}; \node (e) at (2,-2) {$j$}; \node (f) at (1,-3) {$j_*$}; \draw[dotted] (a) -- (b); \draw[dotted] (c) -- (d); \draw[dotted] (b) -- (e); \draw [dotted] (d) -- (f); \draw (a)--(c); \draw (b) --(d); \draw (e) -- (f); \end{tikzpicture}$$ \end{proof} \section{Complete semidistributivity of ${\sf {tors}}~\! A$} The fact that lattices of torsion classes are semidistributive was first proved by Garver and McConville \cite{GM}. For not necessarily finite lattices of torsion classes, it turns out to be natural to consider complete semidistributivity. \begin{thm}[{\cite[Theorem 3.1(a)]{DIRRT}}] ${\sf {tors}}~\! A$ is completely semidistributive. \end{thm} \begin{proof} We will prove complete meet semidistributivity. Complete join semidistributivity follows from the complete meet semidistributivity of ${\sf {tf}}~\! A$, which is established by a dual argument. Let $\mathcal X\in {\sf {tors}}~\! A$, and let $S\subseteq {\sf {tors}}~\! A$ such that for all $\mathcal Y \in S$, we have $\mathcal X\wedge \mathcal Y$ is equal. Let $\mathcal Z$ be their common value. Since the meet of torsion classes is intersection, we have that $\mathcal Z=\mathcal X\cap \mathcal Y$ for any $\mathcal Y \in S$. We want to show that $\mathcal X \cap \bigvee S = \mathcal Z$ also. Clearly $\mathcal X \cap \bigvee S \geq \mathcal Z$. To prove the opposite inclusion, let $M\in X\cap \bigvee S$ be a minimal-dimensional counter-example. Since $M\in \bigvee S$, there is a filtration of $M$ $$0=M_0 \subset M_1 \dots \subset M_r=M$$ with $M_i/M_{i-1} \in \mathcal Y_i$, with $\mathcal Y_i \in S$. Consider the short exact sequence: $$ 0 \rightarrow M_1 \rightarrow M \rightarrow M/M_1 \rightarrow 0$$ Now $M/M_1\in X \cap \bigvee S$ since $M$ is. Since $M_1$ is non-zero, the dimension of $M/M_1$ is less than that of $M$, and thus by our choice of $M$, we know that $M/M_1$ is not a counter-example. Therefore, $M/M_1\in \mathcal Z$, so in particular $M/M_1\in \mathcal Y_1$. On the other hand, we also know that $M_1\in \mathcal Y_1$. Because $\mathcal Y_1$ is a torsion class, and therefore closed under extensions, $M\in \mathcal Y_1$. We also know $M\in \mathcal X$. Therefore $M\in \mathcal X \cap \mathcal Y_1=\mathcal Z$. This contradicts our choice of $M$, so it must be that $\mathcal X \cap \bigvee S = \mathcal Z$. \end{proof} \section{Consequences of the complete semidistributivity of ${\sf {tors}}~\! A$} \label{cons} As we showed in Section \ref{csd}, a completely semidistributive lattice has a labelling of every cover relation $y \gtrdot x$ by a completely join irreducible element $\gamma(y\gtrdot x)$, and a labelling of every cover relation by a completely meet irreducible element $\mu(y\gtrdot x)$, and these two labellings are related by the maps $\kappa$ and $\kappa^d$. We would like to understand what this means in the case of the lattice of torsion classes. Since we know that the completely join irreducible torsion classes correspond to bricks by Theorem \ref{cjib}, for $\mathcal Y \gtrdot \mathcal X$ in ${\sf {tors}}~\! A$, define $\hat \gamma(\mathcal Y \gtrdot X)= B$, such that $\gamma(\mathcal Y\gtrdot \mathcal X)=T(B)$. The following proposition defines $\hat\gamma(\mathcal Y\gtrdot \mathcal X)$ directly. \begin{proposition} $\hat\gamma(\mathcal Y\gtrdot \mathcal X)$ is the unique brick $B$ which is contained in $\mathcal Y$ but not in $\mathcal X$. \end{proposition} \begin{proof} By the complete semidistributivity of ${\sf {tors}}~\! A$, we know that there is a unique completely join irreducible torsion class, $\gamma(\mathcal Y\gtrdot \mathcal X)$, such that $\mathcal Y\geq \gamma(\mathcal Y\gtrdot \mathcal X)$ but $\mathcal X \not \geq \gamma(\mathcal Y\gtrdot \mathcal X)$. By Theorem \ref{cjib}, the completely join irreducible elements are of the form $T(B)$, for $B$ a brick. We have that $\mathcal Y \supseteq T(B)$ and $\mathcal X \not \supseteq T(B)$ iff $B\in\mathcal Y$ and $B\not\in \mathcal X$. So there is a unique brick contained in $\mathcal Y$ but not in $\mathcal X$, and it is $\hat\gamma(\mathcal Y\gtrdot \mathcal X)$. \end{proof} Dually, $\mu(\mathcal Y\gtrdot\mathcal X)={}^\perp F(\hat\gamma(\mathcal Y\gtrdot\mathcal X))$. \begin{example}[Type $A_2$] The brick labelling of the covers of ${\sf {tors}}~\! kQ$ for $Q= 1\leftarrow 2$ is as follows: $$\begin{tikzpicture}[yscale=1.5] \node (a) at (0,0) {$\langle [10],[11],[01] \rangle$}; \node (b) at (-1,-1) {$\langle [11],[01]\rangle$}; \node (c) at (-1,-2) {$\langle [01]\rangle$}; \node (d) at (0,-3) {$0$}; \node (e) at (1,-2) {$\langle [10]\rangle$}; \draw (a) -- node[left] {\color{blue} $[10]$}(b) -- node[left] {\color{blue} $[11]$} (c) -- node[left] {\color{blue} $[01]$} (d) -- node[right] {\color{blue} $[10]$} (e) -- node [right] {\color{blue} $[01]$} (a); \end{tikzpicture}$$ \end{example} \begin{example}[Kronecker quiver] We revisit the Kronecker quiver from Example \ref{ex3}. The brick labels of some of the covers were already shown in Figure \ref{figa}. Inside the interval that is isomorphic to a Boolean lattice on the set of tubes, one torsion class covers another if they differ exactly in that there is one tube present in one but not the other. In this case the brick labelling the cover relation is the quasi-simple at the bottom of that tube. \end{example} \section{Algebra quotients and lattice quotients} A surjective map of lattices $L\twoheadrightarrow L'$ is called a (complete) lattice quotient if it respects the (complete) lattice operations. For $I$ an ideal of an algebra $A$, consider the algebra quotient $\phi:A\twoheadrightarrow A/I$. We can view $\mod A/I$ as the subcategory of $\mod A$ consisting of modules annihilated by $I$. We will be interested in the map sending $\mathcal T$ in $\mod A$ to $\mathcal T\cap \mod A/I$. \begin{proposition} $\mathcal T\cap \mod A/I$ is a torsion class for $A/I$. \end{proposition} \begin{proof} It is easy to check that it satisfies the two defining conditions. \end{proof} \begin{proposition}[{\cite[Proposition 5.7(a)]{DIRRT}}] \label{dprop} If $(\mathcal T,\mathcal F)$ is a torsion pair of $\mod A$, then $$(\mathcal T\cap \mod A/I,\mathcal F\cap \mod A/I)$$ is a torsion pair of $\mod A/I$. \end{proposition} \begin{proof} In this proof, when we write $\mathcal C^\perp$ or ${}^\perp \mathcal C$, we always intend it in the ambient category $\mod A$. Consider $(\mathcal T\cap \mod A/I)^\perp$. Clearly this contains $\mathcal F$. Now suppose we have some module $M\in \mod A/I$, $M\not\in \mathcal F$. There is therefore some $N\in \mathcal T$ and some non-zero $f\in \operatorname{Hom}(N,M)\ne 0$. Since $IM=0$, we must have $f(IN)=0$, so $f$ descends to a map in $\operatorname{Hom}(N/IN,M)$. But $N/IN\in (\mathcal T\cap \mod A/I).$ This shows that in fact $M\not\in (\mathcal T\cap \mod A/I)^\perp$. We conclude that the torsion free class in $\mod A/I$ which corresponds to $\mathcal T\cap \mod A/I$ is $\mathcal F\cap \mod A/I$. \end{proof} For $\mathcal T$ a torsion class in $\mod A$, write $\overline\phi(\mathcal T)$ for $\mathcal T\cap \mod A/I$. \begin{proposition}[{\cite[Proposition 5.7(d)]{DIRRT}}] If $\phi$ is the quotient $A \twoheadrightarrow A/I$, then $\overline\phi$ is a lattice quotient from ${\sf {tors}}~\! A$ to ${\sf {tors}}~\! A/I$. \end{proposition} \begin{proof} From the definition, it is clear that $\overline\phi$ respects the meet operation on ${\sf {tors}}~\! A$. To see that $\overline\phi$ respects join, we recall that $$\bigvee_{\mathcal T\in S} \mathcal T= {}^\perp \left(\bigcap_{\mathcal T \in S} \mathcal T^\perp\right)$$ and the result now follows from Proposition \ref{dprop}. \end{proof} We are interested in understanding this lattice quotient better. In particular, we will address the question of when two torsion classes in $\mod A$ have the same image under this quotient. For this purpose, we need the following lemma. \begin{lemma}\label{three} For $\mathcal U \leq \mathcal V$ in ${\sf {tors}}~\! A$, the following are equivalent:\begin{enumerate} \item $\mathcal U < \mathcal V$, \item $\mathcal U^\perp \cap \mathcal V \ne \{0\}$, \item $\mathcal U^\perp \cap \mathcal V$ contains a brick.\end{enumerate} \end{lemma} \begin{proof} The implications (3) implies (2) and (2) implies (1) are obvious. To see that (1) implies (2), let $X\in \mathcal V \setminus \mathcal U$. We have a short exact sequence $$ 0 \rightarrow t_\mathcal U X \rightarrow X \rightarrow X/t_\mathcal U X \rightarrow 0.$$ Since $X\not\in \mathcal U$, we know that $t_\mathcal U X \ne X$, so $X/t_\mathcal U X$ is a non-zero module in $\mathcal U^\perp$. On the other hand, $X\in \mathcal V$, so $X/t_\mathcal U X$ is also. Thus $X/t_\mathcal U X$ witnesses (2). We now show that (2) implies (3). Suppose that $X\in \mathcal U^\perp \cap \mathcal V$, and suppose that the dimension of $X$ is minimal among non-zero modules in $\mathcal U^\perp \cap \mathcal V$. If $X$ is a brick, we are done, so suppose that $X$ is not a brick. It therefore has a non-invertible non-zero endomorphism $f$. Let $Y=f(X)$. Now $Y$ is at the same time a quotient and a submodule of $X$. Since $Y$ is a quotient of $X$, we know that $Y\in \mathcal V$. On the other hand, since $Y$ is a submodule of $X$, we know that $Y\in \mathcal U^\perp$. Therefore $Y$ is an element of $\mathcal U^\perp \cap \mathcal V$ of dimension smaller than $X$, contradicting our choice of $X$. Thus $X$ must have been a brick. \end{proof} From Lemma \ref{three}, the following proposition is immediate: \begin{proposition}[{\cite[Theorem 5.15(b)]{DIRRT}}]\label{equal} For $\mathcal U\leq \mathcal V$ in ${\sf {tors}}~\! A$, $\overline\phi (\mathcal U)=\overline\phi (\mathcal V)$ if and only if $\mathcal U^\perp\cap\mathcal V$ contains no modules annihilated by $I$, or equivalently contains no bricks annihilated by $I$. \end{proposition} Another way to formulate the proposition is that if $\mathcal U\leq \mathcal V$, then $\overline\phi (\mathcal U) \ne \overline\phi (\mathcal V)$ precisely if there is some module in $\mathcal U^\perp \cap \mathcal V$ which is annihilated by $I$. Also, we have the following proposition. We write $\hat\gamma_A$ and $\hat\gamma_{A/I}$ for the labellings associated to covers in ${\sf {tors}}~\! A$ and ${\sf {tors}}~\! A/I$, respectively. \begin{proposition}[{\cite[Theorem 5.15(a)]{DIRRT}}] \label{agree} If $\mathcal Y \gtrdot \mathcal X$ in ${\sf {tors}}~\! A$ and $\overline\phi(\mathcal Y) \gtrdot \overline\phi(\mathcal X)$ in ${\sf {tors}}~\! A/I$, then $\hat\gamma_A(\mathcal Y\gtrdot \mathcal X)=\hat\gamma_{A/I}(\overline\phi(\mathcal Y)\gtrdot \overline\phi(\mathcal X))$. \end{proposition} \begin{proof} If $\mathcal Y\gtrdot\mathcal X$ in ${\sf {tors}}~\! A$, then there is a unique brick from $\mod A$ in $\mathcal X^\perp \cap \mathcal Y$, namely $\hat\gamma_A(\mathcal Y\gtrdot\mathcal X)$. Given that $\overline\phi(\mathcal Y)\ne \overline\phi(\mathcal X)$, this brick must in fact lie in $\mod A/I$. It is therefore the unique brick in $ \overline\phi(\mathcal X)^\perp \cap \overline\phi(\mathcal Y)$, and thus equals $\hat\gamma_{A/I}(\mathcal Y\gtrdot\mathcal X)$. \end{proof} \begin{example}[Type $A_2$] Let $A=kQ$, where $Q=1\leftarrow 2$. Let $I$ be the ideal of $A$ generated by the arrow. $A/I$ is the path algebra of two vertices and no arrows; ${\sf {tors}}~\! \mod A/I$ is as follows: $$ \begin{tikzpicture}[yscale=1.5] \node (a) at (0,0) {$\langle[01],[10]\rangle$}; \node (b) at (-1,-1) {$\langle [01]\rangle$}; \node (c) at (1,-1) {$\langle [10]\rangle$}; \node (d) at (0,-2) {$0$}; \draw (a) -- node [left] {\color{blue}$[10]$} (b) -- node [left] {\color{blue}$[01]$} (d) -- node[right] {\color{blue} $[10]$} (c) -- node[right] {\color{blue} $[01]$} (a); \end{tikzpicture} $$ We see that it is obtained from the lattice ${\sf {tors}}~\! A$ by identifying the two torsion classes $\langle[01],[11]\rangle$ and $\langle[01]\rangle$, which differ only in modules which are not in $\mod A/I$. We further see that the labels of the cover relations which remain cover relations in ${\sf {tors}}~\! A/I$ receive the same labels as cover relations in ${\sf {tors}}~\! A$ and as cover relations in ${\sf {tors}}~\! A/I$, consistent with Proposition \ref{agree}. \end{example} In the next section, we will see how to combine Proposition \ref{equal} with the labelling $\hat\gamma$. In order to do that, we need another important structural result about ${\sf {tors}}~\! A$. \section{${\sf {tors}}~\! A$ is weakly atomic} A lattice is called weakly atomic if in any interval $[u,v]$ with $u<v$, there is some pair of elements $x,y$ with $x\lessdot y$. (This property is referred to as arrow-separatedness in the current version of \cite{DIRRT} and as cover-separatedness in the current version of \cite{RST}, but they will be updated to reflect the standard terminology.) The interval $[0,1]$ in $\mathbb R$, with the usual order, is an example of a lattice which is not weakly atomic (since it has no cover relations at all). In this section, we will prove the following two theorems. \begin{thm}[\cite{DIRRT}]\label{tha} ${\sf {tors}}~\! A$ is weakly atomic. \end{thm} \begin{thm}[\cite{DIRRT}]\label{thb} Let $\phi:A\twoheadrightarrow A/I$ be an algebra quotient. For $\mathcal U\subseteq \mathcal V$, we have that $\overline\phi(\mathcal U)=\overline\phi(\mathcal V)$ iff all covers in $[\mathcal U,\mathcal V]$ are labelled by bricks which are not annihilated by $I$.\end{thm} On the way to proving these theorems, we first prove the following proposition, which can be viewed as a relative version of Theorem \ref{cjib}. \begin{proposition}[{\cite[Theorem 3.4]{DIRRT}}] \label{rcjib} Let $\mathcal U\leq \mathcal V$ be two torsion classes. The map $B\to T(B)\vee \mathcal U$ is a bijection from ${\sf br}~\! \!(\mathcal U^\perp \cap \mathcal V)$ to $\operatorname{Ji}^c [\mathcal U,\mathcal V]$. \end{proposition} \begin{proof} Let $B \in {\sf br}~\! \!(\mathcal U^\perp \cap \mathcal V)$. Let $\mathcal Y=\mathcal U\vee T(B)$. Also consider the torsion class $\mathcal X=\mathcal Y\cap {}^\perp F(B)$. Since $B\in \mathcal U^\perp$, we have that ${}^\perp F(B) \supseteq \mathcal U$, so $\mathcal X$ also lies in $[\mathcal U,\mathcal V]$. Now $\mathcal X$ is strictly contained in $\mathcal Y$ since it does not contain $B$. But any torsion class containing $\mathcal U$ which is strictly contained in $\mathcal Y$ cannot include any module admitting a surjective map onto $B$. By Lemma \ref{slem}, any such torsion class is therefore contained in ${}^\perp B={}^\perp F(B)$. This shows that $\mathcal Y$ is completely join irreducible in $[\mathcal U,\mathcal V]$ and that $\mathcal Y$ covers $\mathcal X$. We now show that all the completely join irreducible elements of $[\mathcal U,\mathcal V]$ correspond to some brick as above. Any torsion class can be written as the join of the torsion classes corresponding to the bricks it contains, so any torsion class in $[\mathcal U,\mathcal V]$ can be written as the join of $\mathcal U$ and a set of torsion classes of the form $T(B)$ for $B$ lying in some subset of $\mathcal U^\perp \cap \mathcal V$. It follows that the only completely join irreducible elements of $[\mathcal U,\mathcal V]$ are those of the form $\mathcal U\vee T(B)$. Finally, the map from bricks to torsion classes is invertible. If $\mathcal Y$ is a completely join irreducible torsion class in $[\mathcal U,\mathcal V]$, with $\mathcal X$ the unique torsion class in $[\mathcal U,\mathcal V]$ which it covers, then the brick corresponding to $\mathcal Y$ is $\hat\gamma(\mathcal Y\gtrdot \mathcal X)$. \end{proof} Based on this, we can now easily establish the following proposition: \begin{proposition}[\cite{DIRRT}]\label{interval} Let $\mathcal U < \mathcal V$ be two torsion classes in $\mod A$. Then there are covers in $[\mathcal U,\mathcal V]$ labelled by each brick in $\mathcal U^\perp \cap \mathcal V$, and no others. \end{proposition} Note that $\mathcal U^\perp \cap \mathcal V$ is non-empty by Lemma \ref{three}. \begin{proof} It is clear that no other brick can appear as a label since if $\mathcal V\geq \mathcal Y\gtrdot \mathcal X\geq \mathcal U$, and $\hat\gamma(\mathcal Y\gtrdot\mathcal X)=B$ then $B\in \mathcal Y\subseteq \mathcal V$ and $B\in \mathcal X^\perp \subseteq \mathcal U^\perp$. For the converse direction, if $B$ is a brick in $\mathcal U^\perp\cap \mathcal V$, then by Proposition \ref{rcjib}, there is a completely join irreducible in $[\mathcal U,\mathcal V]$ corresponding to $B$, and the cover relation down from it in $[\mathcal U,\mathcal V]$ is labelled by $B$. \end{proof} Theorem \ref{tha} follows directly from Proposition \ref{interval}, since if $\mathcal U<\mathcal V$, then by Lemma \ref{three}, $\mathcal U^\perp\cap \mathcal V$ contains a brick. Theorem \ref{thb} follows as well, by combining Proposition \ref{equal} with Proposition \ref{interval}. \section{A combinatorial application: finite semi-distributive lattices} Consider the following lattice: $$\begin{tikzpicture}[scale=.75] \coordinate (a) at (0,0); \coordinate (b) at (1,-1); \coordinate (c) at (2,-2); \coordinate (d) at (0,-2); \coordinate (e) at (1,-3); \coordinate (f) at (0,-4); \coordinate (g) at (-2,-2); \draw (a) -- (c) -- (f) -- (g) -- (a); \draw (b) -- (d) -- (e); \foreach \x in {(a), (b), (c), (d), (e), (f), (g)}{ \fill \x circle[radius=2pt];} \end{tikzpicture}$$ This lattice is semidistributive. Suppose that it were isomorphic to ${\sf {tors}}~\! A$ for some $A$. We see that this lattice has four (completely) join irreducible elements and four (completely) meet irreducible elements, so $\mod A$ would necessarily have four bricks by Theorem \ref{cjib}. We see that two of the bricks would have to be simple, call them $S_1$ and $S_2$, and there would be maps as follows, with $X$ and $Y$ being the other two bricks: $$\begin{tikzpicture} \node (w) at (0,0) {$S_1$}; \node (x) at (1.5,.5) {$X$}; \node (y) at (1.5,-.5) {$Y$}; \node (z) at (3,0) {$S_2$}; \draw[right hook->] (w) -- (x); \draw [right hook->] (w) -- (y); \draw [->>] (x) -- (z); \draw [->>] (y) -- (z); \end{tikzpicture}$$ There is no such module category. Results of \cite{AP}, extending \cite{J}, can also be used to construct many examples of finite semidistributive lattices which are not lattices of torsion classes. In light of this, it would seem unlikely that representation theory could help us to understand general finite semidistributive lattices. Nonetheless, it turns out that it can. Indeed, in \cite{RST}, inspired by properties of lattices of torsion classes, we gave a construction which yields exactly the finite semidistributive lattices. I will close by describing this construction. Given any finite set, which we will call $\Br$, and a reflexive relation $\rightarrow$ on $\Br$, for a subset $\mathcal C\subset \Br$, we can define $\mathcal C^\perp= \{ Y \in \Br \mid \forall X\in \mathcal C, X \not\rightarrow Y\}$, and ${}^\perp\mathcal C=\{X \mid \forall Y \in \mathcal C, X \not\rightarrow Y\}$. Torsion pairs in $\Br$ are then defined to be pairs of subsets $(\mathcal T,\mathcal F)$ such that $\mathcal T^\perp=\mathcal F$ and $\mathcal T= {}^\perp\mathcal F$. We can then define ${\sf {tors}} (\Br,\rightarrow)$ to be the set of torsion pairs $(\mathcal T,\mathcal F)$, ordered by inclusion on $\mathcal T$. If we allow ourselves to start with any set $\Br$ and reflexive relation $\rightarrow$, this construction is so general as to be able to construct any finite lattice, as was discovered by Markowsky \cite{Ma}. Therefore, if we want to get only semidistributive lattices, we need to put some further conditions on $\rightarrow$. It turns out that the way to do this is the insist that the relation $\rightarrow$ on the set $\Br$ be more like the relation ``there exists a non-zero morphism'' on the set of bricks of a module category. We make this precise as follows. Starting from a reflexive relation $\rightarrow$, define two other relations, $\twoheadrightarrow$ and $\hookrightarrow$. We define $X\twoheadrightarrow Y$ iff whenever $Y\rightarrow Z$ then $X\rightarrow Z$. Similarly, we define $X\hookrightarrow Y$ iff whenever $Y\rightarrow Z$ then $X\rightarrow Z$. Again, the intuition from representation theory is clear: if $M$ and $N$ are $A$-modules and there is a surjection from $M$ to $N$ then whenever there is a non-zero map from $N$ to some $L$, then there is also a non-zero map from $M$ to $L$ and dually for injections. (Note, though, that if we take $\Br={\sf br}~\!\mod A$ and take $\rightarrow$ to be ``there exists a non-zero morphism'', the relations $\twoheadrightarrow$ and $\hookrightarrow$ defined as above are not exactly ``there exists a surjection'' and ``there exists an injection''. See \cite[Section 8]{RST} for more details.) We say that a reflexive relation $\rightarrow$ on $\Br$ is factorizable if it satisfies the following two conditions: \begin{itemize} \item For any $X,Z \in \Br$ with $X\rightarrow Z$, there exists $Y\in \Br$ such that $$X\twoheadrightarrow Y \hookrightarrow Z.$$ \item Any of $X\twoheadrightarrow Y \twoheadrightarrow X$ or $X\hookrightarrow Y \twoheadrightarrow X$, or $X \hookrightarrow Y \hookrightarrow X$ imply $X=Y$. \end{itemize} As is probably clear, the motivating intuition for the first condition is that a non-zero morphism can be factored as a surjection followed by an injection. We can now state the main result of \cite{RST}: \begin{thm}[{\cite[Theorem 1.2]{RST}}] Let $\Br$ be a finite set, and $\rightarrow$ a reflexive factorizable relation on $\Br$. Then ${\sf {tors}} (\Br,\rightarrow)$ is a semidistributive lattice, and every semidistributive lattice arises in this way for a choice of $\Br$ and $\rightarrow$ which is unique up to isomorphism. \end{thm} I close with the following question: \begin{question} Is there a way to interpret any finite semidistributive lattice as the lattice of torsion classes of a ``real'' category? \end{question} The question is deliberately worded somewhat imprecisely. Another way to ask the question would be to ask for a representation-theoretic meaning to the construction of finite semidistributive lattices of \cite{RST}. \section*{Acknowledgements} I would like to thank my coauthors on \cite{IRRTT,DIRRT,RST}, from whom I have learned a great deal. It is my pleasure to acknowledge NSERC and the Canada Research Chairs program for their financial support. Thanks to Nathan Reading, Alexander Garver, and two anonymous referees for helpful comments on this manuscript. I am extremely grateful to have been given the opportunity to present this material at Zhejiang University in 2018 and at the Isfahan School on Representations of Algebras in 2019. Thanks to Fang Li for the invitation to Zhejiang and to the organizers of the Isfahan School and Conference on Representations of Algebras, and in particular Javad Asadollahi, for the invitation to speak in Isfahan, and for the invitation to prepare this contribution to the special issue.
\section{Discussions}\label{sec:discussion} \section{Implications}\label{subsec:implications} The findings from our study can guide the following major stakeholders in software engineering: \begin{inparaenum} \item \textit{API Authors} to guide them during their creation of new APIs, \item \textit{API Documentation Writers} by offering them automated tool supports to produce API documentation, \item \textit{Software Developers} by offering them new and better API documentation format than traditional Javadocs, and \item \textit{Software Engineering Researchers} to study new and innovative ways of documenting API usage scenarios from online technical Q\&A sites. \end{inparaenum} We discuss the implications below. \textbf{\ul{API Authors.}} The number of open source repositories in GitHub was 10 million in 2013, 67 million in 2018, 100 million in 2019. This growth has been quite exponential. Within just last one year, 10 million new users joined GitHub contributing to 44 million repositories across every continent on earth~\cite{website:github-octoverse}. For an API author, this is a unique time to create and promote new APIs. However, the creation of an API can take significant time, resource and effort. The API documentation in Opiner can help them to make a decision on whether and how to develop a new competitor to an API. We observed this in our user study, when we asked the developers whether they would author a new competitor to the Java Jackson API. Out of the respondents 48.4\% responded with a `No' and 35.5\% responded with a `Yes'. The Statistical documentation page offers visualized insights into the various usage statistics of an API. Those who responded with a `No' referred to the more positive reviews around the usage scenarios of the API in Opiner: \emt{Given that I can see that there is a positive trend for Jackson API from statistical documentation and there are no or very few negative responses from the users among the eight usage scenarios that I had selected. I feel that I would not author a new API to compete Jackson.} The concept-based documentation can show how conceptually relevant usage scenarios (i.e., concepts) are reviewed. For example, if a concept is negatively reviewed, the competitor API can focus more on improving the features related to the concept. Those who responded with a `Yes' resonated: \emt{The negative sentiments in statistical summary indicate that many think it might not be best tool for JSON manipulation or there are other alternatives. It also indicate that an improved API can be derive for the same purpose. The conceptual summary help to identify the weaknesses.} \textbf{\ul{API Documentation Writers.}} Without the presence of good documentation and tutorials, it is difficult to learn any API~\cite{Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Robillard-APIsHardtoLearn-IEEESoftware2009a}. Unfortunately, official API documentation are often found to be incomplete, ambiguous and even incorrect~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. The problem with official documentation lies mainly on the lack of adequate resources to create and maintain the documentation~\cite{Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a}. This problem can be exacerbated when a developer moves to a new project landscape leaving behind the documentation he maintained in their previous projects, but now he needs to learn the new project by looking at the current project documentation~\cite{Dagenais-DeveloperLearningResources-PhDThesis2012,Dagenais-MovingToNewSoftwareLandscape-ICSE2010}. Our proposed new API documentation algorithms in Opiner can assist API documentation writer to create new API documentation and to maintain existing documentation. This is because the documentation can be automatically created by analyzing how developers are discussing the different API usage scenarios in online technical Q\&A sites. In our survey, more than 80\% of the respondents agreed that the new documentation algorithms in Opiner offer improvement over official API documentation. The documentation writers can first generate the documentation using the algorithms and then decide which usage scenario to include in the official documentation based on the opinion analysis as follows: \emt{Conceptual documentation presented the usage with rating, I would chose the answer with highest rating cause it shows that this particular answer is correct on the given scenario, it also has example plus more related answer.} The automated nature of our documentation algorithms can help documentation writers to keep the official documentation up to date. In our survey, around 80\% of the participants agreed that Opiner documentation can complement API official documentation. The participants wished the the API documentation in Opiner to be integrated into the formal API documentation to produce a better official documentation. \textbf{\ul{Software Developers.}} The presence of good documentation is paramount for a software developer to be able to use an API~\cite{Robillard-APIsHardtoLearn-IEEESoftware2009a}. In fact, developers often decide to stop using an API with low quality documentation~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}, or pick a competing API with a better documentation~\cite{Uddin-OpinionValue-TSE2019}. The proposed two documentation algorithms in Opiner can be used to create new API documentation and to complement existing API official documentation. This can help developers to select and use an API. While working in a team, the visualized presentation in Statistical documentation can be used to justify the selection and usage of an API: \emt{The summary gives the positive and negative sentiments regarding this API which is helpful for justifying the long term goals.}. The clustering of similar API usage scenarios in concept-based documentation can help developers to dive deeper into conceptually relevant problems in an API: \emt{Generally the need to use a new API is engineered because of some issues with existing one or some domain problem. Conceptual summary is best feature as it summarizes different relevant problems and solutions. "See Also" is great feature. The sentiments on each summary is great. Jumping to the details is easy.} The developers in our studies considered the combinations of code examples and reactions (i.e., positive and negative opinions) was useful in Opiner and wished such format could be integrated into official documentation. This finding confirms our previous surveys of 178 developers, who reported to consider the combination of code example and API reviews as a form of API documentation~\cite{Uddin-SurveyOpinion-TSE2019}. Current research has focused on detecting API misuse patterns in SO code examples~\cite{Zhang-APIMisuseSOStudy-ICSE2018}. The detection of API misuse to inform developers of problematic code examples can be challenging due to the domain specific nature of the patterns (e.g., C++ patterns could be different from Java patterns). Our findings show that a combination of code example and reviews can offer a viable alternative to API misuse pattern detection, until we can reliably identify all different API misuse patterns in developer forums. \begin{figure*}[t] \centering \subfloat[Statistical Documentation]{ \resizebox{2.5in}{!}{ \begin{tikzpicture} \pie[explode=0.1, text=pin, number in legend, sum = auto, color={black!0, black!10, black!20, black!30, black!40}] { 17.2/\Huge{Every Day (17.2\%)}, 31/\Huge{Every Week (31\%)}, 31/\Huge{Every Month (31\%)}, 13.8/\Huge{Once a Year (13.8\%)}, 6.9/\Huge{Never (6.9\%)} } \end{tikzpicture}}% } \qquad \subfloat[Concept-Based Documentation]{ \resizebox{2.5in}{!}{ \begin{tikzpicture} \pie[explode=0.1, text=pin, number in legend, sum = auto, color={black!0, black!10, black!20, black!30, black!40}] { 34.5/\Huge{Every Day (34.5\%)}, 20.7/\Huge{Every Week (20.7\%)}, 31/\Huge{Every Month (31\%)}, 3.4/\Huge{Once a Year (3.4\%)}, 10.3/\Huge{Never (10.3\%)} } \end{tikzpicture}}% } \caption{Preferences of developers to use the Statistical and Concept-Based documentation in Opiner to stay aware}% \vspace{-0.35cm} \label{fig:prefStayAwareStatistical}% \end{figure*} Finally, with its growing popularity, SO now has become quite huge. As such, developers are now finding it challenging to get quick but concise insights of of an API usage that can be scattered across millions of SO posts~\cite{Uddin-SurveyOpinion-TSE2019}. For the developers, the synthesized API documentation in Opiner can be useful. Indeed, more than 80\% of the developers in our survey agreed that Opiner documentation offered increased usability, productivity, confidence and saved time over the informal documentation, such as SO. In fact, when we asked the 29 survey participants whether they would like to stay aware of APIs by using our produced API documentation, more than 86\% mentioned that they would like to use Concept-based documentation at least once a month (34\% everyday) and more than 79\% mentioned that they would like to use Statistical documentation at least once a month (see Figure~\ref{fig:prefStayAwareStatistical}). \textbf{\ul{Software Engineering Researchers.}} While software documentation is an established and active research for many decades, the automatic generation of API documentation from online Q\&A sites is a relatively new field. Existing such research has so far focused on augmenting API official documentation, such as Javadoc with code examples and interesting insights from SO~\cite{Subramanian-LiveAPIDocumentation-ICSE2014,Treude-APIInsight-ICSE2016}. Our study shows that we can offer innovative documentation options besides such javadoc adaptation. In our user study, our two proposed API documentation algorithms (Statistical and Concept-Based) were consistently preferred over Type-based documentation in all four development scenarios. This finding is consistent with previous seminal research of Carroll et al.~\cite{Carroll-MinimalManual-JournalHCI1987a} and Shull et al.~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000} who promoted task-centric documentation instead of traditional hierarchical documentation (e.g., javadoc). The participants in our study voiced the lack of usability with such a type-based format: \emt{In Type based summary I have to search the documentation based upon the type, and then statistics and then the solution. I would like it to be accessed easily.} Our proposed two new algorithms offered the study participants better usability and better access to right information in least time and least effort. Our findings thus can influence research that can combine human computer interaction with programming needs, such as incorporating useful visualized summaries into existing code completion tools~\cite{Zilberstein-Codota-ONWARD2016}, as well as crowd-sourced documentation techniques~\cite{Ponzanelli-PrompterRecommender-EMSE2014,Souza-CookbookAPI-BSSE2014}. In summary, our study opens the door for new and innovative API documentation approaches, by promoting an effective departure from traditional documentation approaches. \section{Usefulness of Proposed Crowd-Sourced API Documentation Algorithms}\label{sec:evalProposedAgainstType} In this section, we present the results of a user study that we conducted to compare the usefulness of our two proposed documentation algorithms (Statistical and Concept-based) over type-based documentation of API usage scenarios. \subsection{Motivation} Previous research find that a Javadoc-style hierarchical API documentation format is less useful to developers than a more practical task-centric documentation~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000,Uddin-HowAPIDocumentationFails-IEEESW2015}. As previously reported, effective developers investigate source code by looking for structural cues~\cite{Robillard-HowEffectiveDevelopersInvestigateSourceCode-TSE2004} and such exploration could involve the usage of multiple types of a single API~\cite{Uddin-TemporalApiUsage-ICSE2012}. Thus, a traditional type-based documentation may not handle the more useful task-based documentation format as hypothesized by Carroll et al.~\cite{Carroll-MinimalManual-JournalHCI1987a} as later confirmed by Shull et al.~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000}. We thus need to understand whether and how our proposed documentation algorithms could offer added benefits over a traditional type-based documentation format across diverse development scenarios. Such assessment can be formed based on inputs from software developers on the documentation produced in Opiner using the three algorithms. \subsection{Approach} We investigate how software developers rate the three documentation types (our two proposed + type-based) in Opiner along four development scenarios. Our \textit{goal} was to judge the \textit{usefulness} of a given documentation as shown in Opiner (see Section~\ref{sec:documentation-opiner}). The \textit{objects} were the three types documentation produced for a given API using the algorithms and the \textit{subjects} were the participants who rated each documentation. The \textit{contexts} are four development scenarios. The scenarios are previously used in Uddin and Khomh~\cite{Uddin-OpinerReviewAlgo-ASE2017}. \subsubsection{Participants.} We recruit 29 software developers. Among the 29 participants, 18 were professional developers. The rest of the participants (11) were recruited from four universities: two in Canada (University of Saskatchewan and Polyt\'{e}chnique Montreal) and two in Bangladesh (Bangladesh University of Engineering \& Technology and Khulna University). The 18 professional developers were recruited through the online professional social network site, Freelancer.com. Sites like Amazon Mechanical turks and Freelancer.com have been gaining popularity to conduct studies in empirical software engineering research due to the availability of efficient, knowledgeable and experienced software engineers. In our study, we only recruited a freelancer if he had professional software development experience in Java. Among the 11 participants recruited from the universities, eight reported their profession as students, two as graduate researchers. Among the 18 freelancers, one was a business data analyst, four were team leads, and the rest were software developers. Among the 29 participants 88.2\% were actively involved in software development (94.4\% among the freelancers and 81.3\% among the university participants). Each participant had a background in computer science and software engineering. The number of years of experience of the participants in software development ranged between less than one year to more than 10 years: three (all of them being students) with less than one year of experience, nine between one and two, 12 between three and six, four between seven and 10 and the rest (nine) had more than 10 years of experience. Among the four participants that were not actively involved in daily development activities, one was a business analyst (a freelancer) and three were students (university participants). The business data analyst had between three and six years of development experience in Java. The diversity in the participant occupation offered us insights into whether and how Opiner was useful to all participants in general. \subsubsection{Tasks.} We asked the participants to compare the documentation produced by the three algorithms under four different development scenarios (selection, documentation, presentation, and API authoring). Each task was described using a hypothetical development scenario where the participant was asked to judge the summaries through the lens of a software engineering professional. Persona based usability studies have been proven effective both in Academia and Industry~\cite{Mulder-PersonaStudy-2006}. We describe the tasks below. \begin{enumerate}[leftmargin=10pt] \item \ul{Selection.} \textit{Can the usage documentation help you to select this API?} The persona was a `Software Architect' who was tasked with making decision on the selection of an API given the usage documentation produced for the API in Opiner. The participants were asked to consider the following decision criteria in their answers: the documentation \begin{inparaenum}[(C1)] \item contained all the \textit{right} information, \item was \textit{relevant} for selection, and \item was \textit{usable}. \end{inparaenum} \item \ul{Documentation.} \textit{Is the produced documentation complete and readable?} The persona was a `Technical API Documentation Writer' who was tasked with the writing of the documentation of an API by taking into accounts the usage summaries of the API in Opiner. The decision criteria on whether and how the different summaries in Opiner could be useful for such a task were: \begin{inparaenum}[(C1)] \item the \textit{completeness} of the information, and \item the \textit{readability} of the summaries. \end{inparaenum} \item \ul{Presentation.} \textit{Can the documentation easily help you to justify your selection of the API?} The persona was a development team lead who was tasked with the creation of a presentation by using the summaries in Opiner to justify the selection of an API. The decision criteria were: \begin{inparaenum}[(C1)] \item the \textit{conciseness} of the information and \item \textit{recency} of the provided scenarios. \end{inparaenum}. \item\ul{Authoring.} \textit{Can the documentation easily help you to decide whether to improve an API feature?} the persona was an API author who was tasked with the creation of a new API by learning the strengths and weaknesses of the competing APIs using Opiner. The decision criteria were: \begin{inparaenum}[(C1)] \item the reactions towards code examples and \item the presence of \textit {diverse scenarios}. \end{inparaenum} \end{enumerate} We assessed the ratings of the three tasks (Selection, Documentation, Presentation) using two metrics: useful (the documentation does not miss any info, misses some info but still useful), not useful (misses all the info so not useful at all). For the task (Authoring), we define usefulness as follows: useful (Fully helpful, helpful), not useful (Partially Unhelpful, Fully unhelpful). For the authoring scenario, we further asked the participants whether he had decided to author a new API as a competitor to the Jackson API whose documentation he had analyzed in Opiner. The options were: Yes, No, Maybe. Jackson is the most popular Java API for JSON parsing. Each participant was asked to justify his rating for each scenario in a text box. The study was conducted in a Google form. \subsection{Results} \begin{table}[t] \centering \caption{Impact of the summaries (in percentages) based on the scenarios} \begin{tabular}{rlrrr}\toprule \multicolumn{1}{l}{\textbf{Scenario}} & \textbf{Rating} & \multicolumn{1}{l}{\textbf{Type-Based}} & \multicolumn{1}{l}{\textbf{Statistical}} & \multicolumn{1}{l}{\textbf{Concept-Based}} \\ \midrule \multicolumn{1}{l}{\textbf{Selection}} & Useful & 93.1 & 93.1 & \textbf{100.0} \\ & Not Useful & 6.9 & 6.9 & 0 \\ \midrule \multicolumn{1}{l}{\textbf{Documentation}} & Useful & 93.1 & 79.3 & \textbf{100.0} \\ & Not Useful & 6.9 & 20.7 & 0 \\ \midrule \multicolumn{1}{l}{\textbf{Presentation}} & Useful & 93.1 & \textbf{96.6} & 93.1 \\ & Not Useful & 6.9 & 3.4 & 6.9 \\ \midrule \multicolumn{1}{l}{\textbf{Authoring}} & Useful & 72.4 & 69.0 & \textbf{89.7} \\ & Not Useful & 10.3 & 10.3 & 3.4 \\ & Neutral & 17.2 & 20.7 & 6.9 \\ \bottomrule \end{tabular}% \label{tbl:scenario_overview_usefulness} \end{table}% In Table~\ref{tbl:scenario_overview_usefulness}, we show the percentage of the ratings for each usage documentation algorithm for the four development scenarios (Selection, Documentation, Presentation, and Authoring). \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} Our two proposed documentation algorithms (Concept and Statistical) were rated as more useful than the type-based documentation (Javadoc adaptation) across all four development scenarios. \end{tcolorbox} For the `Selection' scenario, the incorporation of reactions as positive and negative opinions in the usage documentation were considered as useful. According to one participant: \emph{``Conceptual documentation is the most useful of all. Inexperienced developers can select code snippet based on positive or negative reactions while the experienced developers can compare the code and go for the best one.} However, just the presence of the reactions were not considered as enough for selection of an API when coding tasks were involved. \emph{``Statistical documentation just shows the negative and positive views, it is not useful to view the working examples or code. Conceptual documentation groups together the common API features, it helped me to find the common examples in same place. Type based documentation is also ok but had to dig in to find the description. All code examples provided the full code example, so it was good.''} For the `Documentation' scenario, the participants appreciated the innovative presentation formats of clustering usage scenarios by concepts. According to one participant \emt{``For Documentation purpose , Conceptual documentation is more readable than other two documentation.''}. Similar to the observations of Carroll et al.~\cite{Carroll-MinimalManual-JournalHCI1987a} for the needs for documenting APIs based on tasks, the participants advocated the potential of concept-based summaries documentation, such as \emt{Conceptual documentation is important to generate different kind of ideas and thoughts to complete different kind of task such as serialization, deserialization, format specification, mapping with Jackson API. This documentation is most useful to me because of the availability of resource.}. The participants considered type-based documentation to be useful for specific tasks that may not involve multiple types of a given API at the same time. For the `Presentation' scenario, the participants preferred the visualized charts from statistical documentation. Their suggested workflow was to start the presentation with the charts and then dive deeper into the presentation based on insights from concept-based documentation. According to one participant, the combination of ratings and examples is the key: \emt{If I was the team lead, statistical documentation would help to decide me to view the users positive and negative reaction over the selection API, I would definitely take this into consideration. Conceptual documentation would help me to create a presentation based on the examples and the ratings.} The participants asked for an extension in statistical documentation to compare APIs by the features offered, \emt{The statistical documentation helps to summarize the popularity of the API and other co-existing APIs. But it would be more helpful if there was comparisons among competitive APIs as well. The team lead should should this information one by one.} For the `API Authoring' scenario, when asked about whether the documentation of the Jackson API in Opiner showed enough weakness of the API that the developers would like to author a competing API, 48.4\% responded with a `No', 35.5\% with a `Yes' and 16.1\% with Maybe. The participants considered the concept-based documentation to be most useful during such decision making, followed by statistical documentation. According to one participant, \emt{In order to author a new API, I would like to understand how the market of developers is reacting to the current API. More negative responses would indicate that there is dissatisfaction among the developers and there is a need to create a new API for which I would look into the negative responses in the conceptual documentation. Given that I can see that there is a positive trend for jackson Api from statistical documentation and there are no or very few negative responses from the users among the eight usage scenarios that I had selected. I feel that I would not author a new API to compete Jackson, simply because it still works and the developers are content, which I could identify from the statistical documentation.} \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} The concept-based documentation was considered as the most useful in three out of the four scenarios (Selection 100\%, Documentation 100\%, and Authoring 89.7\%), while the statistical documentation was considered as the most useful for the other scenario (Presentation 96.6\%). \end{tcolorbox} \section{Effectiveness of Opiner Documentation Over API Web Documentation Resources}\label{sec:evaluation} In this section, we evaluate the effectiveness of the documentation in Opiner web site against traditional API web documentation resources, i.e., API official documentation and developer forum (SO). \subsection{Motivation} The goal of the automatic documentation of APIs usage scenarios in Opiner is to assist developers in finding the right solutions to their coding tasks with relative ease than other resources. Therefore, we need to assess the effectiveness of Opiner API usage documentation in real-world coding tasks. Previous research reported that developers consider the combination of code examples and API reviews in the online developer forums as a form of API documentation~\cite{Uddin-SurveyOpinion-TSE2019} and preferred such documentation over API official documentation. However, the developers struggled to make a complete and concise insights due to the huge volume and scattered nature of the usage discussions in the online forums. Therefore, the usage scenario documentation in Opiner should alleviate the pains of developers to find a complete solution to a development task without going over multiple SO posts. Previous research also showed that the API documentation is often incomplete, obsolete and incorrect~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015} and that developers find it hard to learn and use an API by simply relying on API official documentation~\cite{Robillard-APIsHardtoLearn-IEEESoftware2009a}. Therefore, the usage scenario documentation in Opiner should be able to compensate for such shortcomings in the official documentation of an API during their coding tasks. \subsection{Approach} We recruited 31 developers and asked them to complete four coding tasks using the documentation produced in Opiner and using API web documentation resources (i.e., baselines). At the end of the coding tasks, we asked the participants to participate in a short survey to share their experience of using Opiner over the baseline resources. The participants used the documentation produced in Opiner (see Section~\ref{sec:documentation-opiner}) for the coding tasks. \subsubsection{Participants.} The coding tasks were completed by a total of 31 participants. 29 out of the 31 participants came from our previous study to evaluate the usefulness of our API documentation algorithms in Section~\ref{sec:evalProposedAgainstType}. The additional two participants in this study are recruited from universities. Both of them are graduate students with more than one year experience in software development. Among the 31 participants, 18 were professional developers. The rest of the participants (13) were recruited from four universities. Each freelancer was remunerated with \$20, which was a modest sum given the volume of the work. Each participant had a background in computer science and software engineering. The survey questions were answered by 29 out of the 31 participants. \subsubsection{Coding Tasks.} The four tasks are described in Table~\ref{tbl:coding-tasks}. Each task was required to be completed using a pre-selected API. Thus for the four tasks, each participant needed to use four different APIs: Jackson~\cite{website:jackson}, Gson~\cite{website:gson}, Xstream~\cite{website:xstream}, and Spring framework~\cite{website:spring}. Jackson and Gson are two most popular Java APIs for JSON parsing~\cite{website:stackoverflow-2378402}. Spring is one of the most popular web framework in Java~\cite{website:javaFrameworkPopularity} and XStream is well-regarded for its efficient adherence to the JAXB principles~\cite{website:stackoverflow-1558087}, i.e., XML to JSON conversion and vice versa. All of the four APIs can be found in the list of top 10 most discussed APIs in our evaluation corpus. The APIs are mature and are fairly large and thus can be hard to learn. The largest API is the Spring framework 5.0.5 with a total of 3687 types (Class, Annotation, etc.), followed by Jackson 2.2 (467 types), XStream 1.4.10 (340 types), and Gson 2.8.4 (34 types). For Jackson API, we counted the code types that are shipped with the core modules (jackson-core, databind, and annotations). The Jackson API has been growing with the addition of more modules (e.g., jackson-datatype). The four APIs have a total of 4528 types. In comparison, the entire Java SE 7 SDK has a total of 4024 code types, and the entire Java SE 8 SDK has a total of 4240 code types.\footnote{We used the online official Javadocs of the APIs to collect the type information. Our online appendix contains the list.} \subsubsection{Task Settings.} For each coding task, we prepared four settings: \begin{description}[leftmargin=2em] \item[\textbf{SO}]complete task using only SO, \item[\textbf{DO}]complete task using only API official documentation, \item[\textbf{OP}]complete the task only with the help of Opiner, and \item[\textbf{EV}]complete task using any online resources available (i.e., SO, DO, Opiner, and Search engines). \end{description} The above four settings help us properly analyze the diverse coding behavior of software developers using the diverse online API documentation resources available to complete a coding task. Intuitively, the EV setting is the most natural, because it allows a developer to use search engines and/or any other resources. The SO, DO, and OP settings simply restrict the access of resources. This restriction then provides insights whether the participants are more/less useful while simply using a subset of all available resources. If, a user still shows performance similar/higher similar to the EV setting while only using Opine (i.e, the OP setting), that then can offer increased confidence on the the overall effectiveness of Opiner to support developers in their coding tasks. We follow a between-subject design~\cite{Woh00}, with four different groups (G1, G2, G3, G4) of participants, each participant completing four tasks in four different settings. Each of three groups (G1, G3, G4) had eight participants. At the end, eight participant from the three groups (G1, G3, G4) and seven from G2 completed the coding tasks. Each participant in a group was asked to complete the four tasks. Each participant in a group completed the tasks in the order and settings shown in Table~\ref{tbl:task-distribution}. To ensure that the participants used the correct development resource for a given API in a given development setting, we added the links to those resources for the API in the task description. For example, for the task TJ and the setting SO, we provided the following link to query SO using Jackson as a tag: \urls{https://stackoverflow.com/questions/tagged/jackson}. For the task TG and the setting DO, we provided the following link to the official documentation page of the Google GSON API: \urls{https://github.com/google/gson/blob/master/UserGuide.md}. For the task TX and the setting PO, we provided a link to the summaries of the API XStream in the Opiner website \urls{http://sentimin.soccerlab.polymtl.ca:38080/opinereval/code/get/xstream/}. For the task TS with the setting EV, we provided three links, i.e., one from Opiner (as above), one from SO (as above), an one from API formal documentation (as above). For the `EV' setting, we added in the instructions that the participants are free to use any search engine. To avoid potential bias in the coding tasks, we enforced the homogeneity of the groups by ensuring that: \begin{inparaenum} \item no group entirely contained participants that were only professional developers or only students, \item no group entirely contained participants from a specific geographic location and--or academic institution, \item each participant completed the tasks assigned to him independently and without consulting with others \item each group had same number of four coding tasks \item each group had exposure to all four development settings as part of the four development tasks. \end{inparaenum} The use of balanced groups simplified and enhanced the statistical analysis of the collected data. \subsubsection{Task Selection Rationale.} The four tasks were picked randomly from our evaluation corpus of 22.7K SO posts. Each task was observed in SO posts more than once and was asked by more than one developer. Each task was related to the manipulation of JSON inputs using Java APIs for JSON parsing. The manipulation of JSON-based inputs is prevalent in disk-based, networked as well as HTTP-based message, file, and object processing. Therefore, the Java APIs for JSON parsing offer many complex features to support the diverse development needs. The solution to each task spanned over two posts. The two posts are from two different threads in SO. Thus the developers could search in Stack Overflow to find the solutions. However, that would require those searching posts from multiple threads in SO. All of those tasks are common using the four APIs. Each post related to the tasks was viewed and upvoted more than hundred times in SO. To ensure that each development resource was treated with \textit{equal fairness} during the completion of the development tasks, we also made sure that each task could be completed using any of the development resources, i.e., the solution to each task could be found in any of the resources at a given time, without the need to rely on the other resources. \begin{table}[tbp] \caption{Overview of coding tasks} \begin{tabular}{llp{12.5cm}}\toprule \textbf{Task} & \textbf{API} & \textbf{Description} \\ \midrule TJ & Jackson & Write a method that takes as input a Java Object and serializes it to Json, using the Jackson annotation features that can handle custom names in Java object during deserialization. \\ \midrule TG & GSON & Write a method that takes as input a JSON string and converts it into a Java Object. The conversion should be flexible enough to handle unknown types in the JSON fields using generics. \\ \midrule TX & Xstream & Write a method that takes as input a XML string and converts it into a JSON object. The solution should support aliasing of the different fields in the XML string to ensure readability \\ \midrule TS & Spring & Write a method that takes as input a JSON response and converts it into a Java object. The response should adhere to strict JSON character encoding (e.g., UTF-8). \\ \bottomrule \end{tabular} \label{tbl:coding-tasks} \end{table} \begin{table}[tbp] \centering \caption{Distribution of coding tasks per group per setting. SO = SO, DO = Javadoc, OP = Opiner, EV = Everything. TJ, TG, TX, TS = Task Using Jackson, GSON, XStream, Spring, resp.} \begin{tabular}{lrrrr}\toprule \textbf{$\downarrow$ Group $|$ Setting $\rightarrow$ } & \textbf{SO} & \textbf{DO} & \textbf{OP} & \textbf{EV} \\ \midrule \textbf{G1} & TJ & TG & TX & TS \\ \textbf{G2} & TS & TJ & TG & TX \\ \textbf{G3} & TX & TS & TJ & TG \\ \textbf{G4} & TG & TX & TS & TJ \\ \bottomrule \end{tabular} \label{tbl:task-distribution} \end{table} \subsubsection{Coding Guide.} A seven-page coding guide was produced to explain the study requirements (e.g., the guide for Group G1: \urls{https://goo.gl/ccJMeY}). Before each participant was invited to complete the study, he had to read the entire coding guide. Each participant was encouraged to ask questions to clarify the study details before and during the study. To respond to the questions the participants communicated with the first author over Skype. Each participant was already familiar with formal and informal documentation resources. To ensure a fair comparison of the different resources used to complete the tasks, each participant was given a brief demo of Opiner before the beginning of the study. This was done by giving them an access to the Opiner web site. \subsubsection{Data Collection Process.} The study was performed in a Google Form, where participation was by invitation only. Four versions of the form were generated, each corresponding to one group. Each group was given access to one version of the form representing the group. An offline copy of each form is provided in our online appendix~\cite{website:opinerusagescenariotse-online-appendix}. The developers were asked to write the solution to each coding task in a text box reserved for the task. The developers were encouraged to use any IDE to code the solution to the tasks. Before starting each task, a participant was asked to mark down the beginning time. After completing a solution the participant was again asked to mark the time of completion of the task. The participant was encouraged to not take any break during the completion of the task (after he marked the starting time of the task). To avoid fatigue, each participant was encouraged to take a short break between two tasks. Besides completing each coding task, each participant was also asked to assess the complexity and effort required for each task, using the NASA Task Load Index (TLX)~\cite{Hart88}, which assesses the subjective workload of subjects. After completing each task, we asked each subject to provide their self-reported effort on the completed task through the official NASA TLX log engine at \url{nasatlx.com}. Each subject was given a login ID, an experiment ID and task IDs, which they used to log their effort estimation for each task, under the different settings. \subsubsection{Variables to Assess The Coding Tasks.} The main independent variable we consider is the development resource that participants use to find solutions for their coding tasks. Dependent variables are the values of the following metrics: correctness of the code solutions, time, and effort spent to code the solutions (discussed below). \begin{inparaenum} \item \ul{Correctness.} To check the correctness of the solution for a coding task, we used the following process: \begin{inparaenum} \item We identified the correct API elements (types, methods) used for the coding task. \item We matched how many of those API elements were found in the coding solution and in what order. \item We quantified the correctness of the coding solution using the following equation: \begin{equation}\label{eq:correctness} \textrm{Correctness} = \frac{|\textrm{API Elements Found}|}{|\textrm{API Elements Expected}|} \end{equation} \end{inparaenum} An API element can be either an API type (class, annotation) or an API method. Intuitively, a complete solution should have all the required API elements expected for the solution. We discarded the following types of solutions: \begin{inparaenum} \item \textit{Duplicates.} Cases where the solution of one task was copied into the solution of another task. We identified this by seeing the same solution copy pasted for the two tasks. Whenever this happened, we discarded the second solution. \item \textit{Links.} Cases where developers only provided links to an online resource without providing a solution for the task. We discarded such solutions. \item \textit{Wrong API.} Cases where developers provided the solution using an API that was not given to them. \end{inparaenum} \item\ul{Time.} We computed the time taken to develop solutions for each task, by taking the difference between the start and the end time reported for the task by the participant. Because the time spent was self-reported, it was prone to errors (some participants failed to record their time correctly). To remove erroneous entries, we discarded the following type of reported time: \begin{inparaenum} \item reported times that were less than two minutes. It takes time to read the description of a task and to write it down, and it is simply not possible to do all such activities within a minute. \item reported times that were more than 90 minutes for a given task. For example, we discarded one time that was reported as 1,410 minutes, i.e., almost 24 hours. Clearly, a participant cannot be awake for 24 hours to complete one coding task. This happened in only a few cases. \end{inparaenum} \item \ul{Effort.} We used the TLX metrics values as reported by the participants. We analyzed the following five dimensions in the TLX metrics for each task under each setting: \begin{inparaenum}[\bfseries(a)] \item \textit{Frustration Level.} How annoyed versus complacent the developer felt during the coding of the task? \item \textit{Mental Demand.} How much mental and perceptual activity was required? \item \textit{Temporal Demand.} How much time pressure did the participant feel during the coding of the solution? \item \textit{Physical Demand.} How much physical activity was required. \item \textit{Overall Performance.} How satisfied was the participant with his performance? \end{inparaenum} Each dimension was reported in a 100-points range with 5-point steps. A TLX `effort' score is automatically computed as a task load index by combining all the ratings provided by a participant. Because the provided TLX scores were based on the judgment of the participants, they are prone to subjective bias. Detecting outliers and removing those as noise from such ordinal data is a standard statistical process~\cite{Tukey-ExploratoryDataAnalysis-Pearson1977}. By following Tukey, we only considered values between the following two ranges as valid: \begin{inparaenum} \item Lower limit: First quartile - 1.5 * IQR \item Upper limit: Third quartile + 1.5 * IQR \end{inparaenum}. Here IQR stands for `Inter quartile range', which is calculated as: $\textrm{IQR} = Q3 - Q1$. Q1 and Q3 stand for the first and third quartile, respectively. \end{inparaenum} \subsubsection{Follow Up Survey.} The survey was conducted in a Google doc form. We asked five questions, the first three questions were related to API official documentation and the last two were related to SO: \begin{enumerate} \item How do the Opiner documentation offer improvements over formal documentation? \item How can Opiner complement formal API documentation? \item How would you envision for Opiner to complete the formal API documentation? \item How do Opiner summaries offer improvements over the SO contents for API usage? \item How would you envision Opiner to complement SO in your daily development activities? \end{enumerate} The first and the fourth question had a five-point Likert scale (Strongly Agree, Agree, Neutral, Disagree, and Strongly Disagree). The other questions were answered in text boxes. \subsection{Results from Coding Tasks} A total of 135 coding solutions were provided by the participants. We discarded 14 as invalid solutions (i.e., link/wrong API). Out of the 135 reported time, we discarded 23 as being spurious. 24 participants completed the TLX metrics (providing 96 entries in total), with each setting having six participants. \begin{table}[t] \centering \caption{Summary statistics of the correctness (scale 0 - 1), time (minutes) and effort (Scale 0-100) spent in the coding tasks. Baselines: SO = SO, DO = Official Documentation, EV = Everything including search engine} \begin{tabular}{lr|rr|rr|rr}\toprule & \multicolumn{1}{l}{\textbf{Opiner (OP)}} & \multicolumn{1}{l}{\textbf{SO}} & $\Delta_{SO, OP}$ & \multicolumn{1}{l}{\textbf{DO}} & $\Delta_{DO, OP}$ & \multicolumn{1}{l}{\textbf{EV}} & $\Delta_{EV, OP}$ \\ \midrule \textbf{Correctness} & \textbf{0.62} & 0.46 & -35\%$\downarrow$ & 0.5 & -24\%$\downarrow$ & 0.55 & -13\%$\downarrow$ \\ \textbf{Time} & \textbf{18.6} & 22.3 & 17\%$\uparrow$ & 23.7 & 22\%$\uparrow$ & 19.4 & 4\%$\uparrow$ \\ \textbf{Effort} & \textbf{45.8} & 55.8 & 18\%$\uparrow$ & 63.9 & 28\%$\uparrow$ & 54.8 & 16\%$\uparrow$ \\ \bottomrule \end{tabular}% \label{tbl:coding-task-summ-stat}% \end{table}% \begin{figure*} \centering \includegraphics[scale=0.45]{images-tosem/correctness} \includegraphics[scale=0.45]{images-tosem/time} \includegraphics[scale=0.45]{images-tosem/ScaleEffort} \caption{Correctness of the completed solutions and the time and effort spent by tasks. Red horizontal bar shows the median} \label{fig:boxblot-correctness} \end{figure*} Table~\ref{tbl:coding-task-summ-stat} compares Opiner against the three baselines (API official documentation, SO, and Everything including search engines) based on the three metrics: the average correctness of the provided solutions, and the average time and effort spent to complete the solutions. The columns with $\Delta$ computes the percent difference between Opiner and each baseline for each metric. For example, $\Delta_{SO, OP}$ for the metric `Effort' is computed as: \begin{equation} \Delta_{Effort_{SO}, Effort_{OP}} = \frac{{Effort_{SO} - Effort_{OP}}}{Effort_{SO}} \end{equation} Recall that the effort calculation uses the NASA TLX software effort index. \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} {Opiner outperforms each baseline for each metric. The participants coded with the maximum correctness (0.62), with least time (18.6 minutes) and effort (45.8) per coding solution using Opiner.} \end{tcolorbox} Among the three baselines, the `EV' setting was the most useful for the developers. The EV setting contained everything (SO, API official documentation, Opiner, and search engine), i.e., the developers were able to consult all the documentation resources available in the Web. {Opiner still outperformed the `EV' setting; developers coded with less correctness (-13\%), and spent more time (4\%) and effort (16\%) while using `EV' setting than Opiner.} \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} {The correctness of the provided solutions were the lowest when participants used only SO.} {For code correctness, the difference is the maximum between Opiner and SO (35\% less correct code while using SO)}. \end{tcolorbox} The difficulty of developers to produce a correct solution just by relying on SO confirms previous findings that developers are facing difficulty while attempting to find the right solution from the millions of forum posts~\cite{Uddin-OpinerReviewAlgo-ASE2017,Uddin-SurveyOpinion-TSE2019}. \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} Participants on average spent the highest amount of time and effort per coding solution when using only the formal documentation. {For both effort and time spent, the differences are the maximum between Opiner and API formal API documentation (22\% more time and 28\% more effort while using API official documentation).} \end{tcolorbox} The difficulty of developers while just relying on formal API documentation confirms previous findings~\cite{Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a,Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000} that developers can be less productive while using API official documentation, because it is hard to develop solutions quickly due to the various shortcomings in API official documentation (e.g., incompleteness, ambiguity, presentation)~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. In Figure~\ref{fig:boxblot-correctness}, we show the correctness of the coding tasks, effort and time spent across the four settings using four boxplots, one for each coding task. The red square in each box shows the mean ($\mu$), and the red horizontal line shows the median ($M$) of accuracy. For example, for the task TJ, the mean in accuracy using Opiner was 0.52 while the median was 0.67. The participants showed more accuracy while using Opiner for two tasks (TJ and TX) than while using the other resources. For the task TG, they showed lower accuracy ($\mu = 0.83$) while using Opiner than while using othe resources. In fact, they achieved almost perfect accuracy for the task TG, while using both SO and API official documentation. For the task TS, while the participants showed the highest accuracy using every resources (i.e., EV setting with an average $\mu = 0.39$ and median $M = 0.45$), Opiner was the second best with a slightly lower mean accuracy of 0.38 and a median of 0.4. {The participants spent less time while using Opiner, than the other resources for the two tasks (TG, TS). For the task TX, participants spent on average 19.4 minutes using Opiner was the second best behind (17.3 minutes) only SO (the lowest completion time).} Out of all tasks, the participants spent the longest time (on average) while completing the task TJ across all the settings. Even though the participants spent the most amount of time (on average) to complete the task TJ, they achieved the best accuracy for the task while using Opiner. The participants spent the least amount of effort while using Opiner for one task (TS). For the task (TJ), developers spent more effort when using the official documentation than Opiner. \rev{Task TJ required using the Jackson API. The official documentation of Jackson is considered to be complex by developers in SO~\cite{website:stackoverflow-q2378402}. Intuitively, the clustering of similar usage scenarios in Opiner could be useful to find relevant code examples easily. Indeed, the participants in the survey reported that they found the concept-based documentation of Jackson in Opiner useful to complete the tasks.} For the task TS involving the Spring Framework, Opiner considerably outperformed the other settings for this task (less than 40\% for Opiner to more than 70\% for formal documentation). \begin{table}[t] \centering \caption{Results of the Wilcoxon Mann-Whitney U test and Cliff's delta effect size for the pair-wise comparisons of the accuracy, time, and effort spent per the four settings (OP = Opiner only, DO = Official documentation only, SO = Stack Overflow only, EV = Everything including search engine) for the four coding tasks} \begin{tabular}{llrr}\toprule \multicolumn{1}{l}{\textbf{Metric}} & \textbf{Comparison} & \multicolumn{1}{l} {\textbf{$p-value$}} & \textbf{Cliff's $\delta$} \\ \midrule \multicolumn{1}{l}{Correctness} & \textbf{OP vs DO} & 0.08 & 0.206 S \\ & \textbf{OP vs SO} & 0.04* & 0.265 S \\ & \textbf{OP vs EV} & 0.27 & 0.092 N \\ \cmidrule{2-4} & DO vs SO & 0.31 & 0.075 N \\ & DO vs EV & 0.21 & 0.118 N \\ & SO vs EV & 0.12 & 0.174 S \\ \midrule \multicolumn{1}{l}{Time} & \textbf{OP vs DO} & 0.12 & 0.206 S \\ & \textbf{OP vs SO} & 0.08 & 0.244 S \\ & \textbf{OP vs EV} & 0.47 & 0.015 N \\ \cmidrule{2-4} & DO vs SO & 0.43 & 0.030 N \\ & DO vs EV & 0.10 & 0.221 S \\ & SO vs EV & 0.08 & 0.246 S \\ \midrule \multicolumn{1}{l}{Effort} & \textbf{OP vs DO} & 0.03* & 0.330 S \\ & \textbf{OP vs SO} & 0.15 & 0.177 S \\ & \textbf{OP vs EV} & 0.14 & 0.181 S \\ \cmidrule{2-4} & DO vs SO & 0.18 & 0.158 S \\ & DO vs EV & 0.28 & 0.101 N \\ & SO vs EV & 0.32 & 0.080 N \\ \bottomrule \end{tabular}% \label{tbl:rq1-nonparametrictests}% \end{table}% \rev{In Table~\ref{tbl:rq1-nonparametrictests}, we compare the three variables (accuracy per coding solution, time and effort spent per solution) by the four settings (OP = Opiner only, DO = Official documentation only, SO = Stack Overflow only, EV = Everything including search engine). We use Wilcoxon Mann-Whitney U test to determine whether the difference between any two settings for a given variable is statistically significant (i.e, $\alpha \le 0.05$). Mann-Whitney U test is non-parametric, which is used in software engineering literature to compare data that is not normally distributed~\cite{Hu-MobileAppConsistency-EMSE2018}. We estimate the effect size between the distributions. We use cliff's delta which is suitable for non-parametric distribution (unlike Cohen delta which is suitable for normal distribution). Cliff's delta produces a value between -1 and 1. Following Romano et al.~\cite{Romano-TtestCohenD-SAIR2006}, we use the following threshold to interpret the cliff's delta effect size:} \begin{equation} \textrm{Effect Size} =\left\{ \begin{array}{@{}ll@{}} {negligible~(N)}, & \textrm{if}\ |\delta| \leq 0.147 \\ {small~(S)}, & \textrm{if}\ 0.147 < |\delta| \leq 0.33 \\ {medium~(M)}, & \textrm{if}\ 0.33 < |\delta| \leq 0.474 \\ {large~(L)}, & \textrm{if}\ 0.474 < |\delta| \leq 1 \end{array}\right. \end{equation} \rev{The effect size categories (negligible, small, medium, or large) quantify the differences between the distributions. For the coding accuracy variable, the difference between OP and SO is statistically significant, i.e, the participants were significantly more effective to produce correct coding solutions while using Opiner only than Stack Overflow only. For the effort spent, the difference between OP and DO is statistically significant, i.e., the participants spent significantly less time to complete their coding tasks while using Opiner than while using the API official documentation. The effect sizes are small or negligible, given that the size our dataset is not large enough.} \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} The participants reported the most satisfaction about their coding solution while using Opiner for three out the four tasks (TJ, TS, TX). For the other task (TG), Opiner was slightly behind official documentation. With TG, developers found all solutions in one single Javadoc page, which contributed to its higher satisfaction score. \end{tcolorbox} \vspace{1mm}\noindent\textbf{Opiner vs EV.} \rev{Despite allowing the participants to use any resources available to complete a coding task in the EV setting, the participants spent least time and effort but with the most accuracy while coding using Opiner only. We did not have any follow up questions to the participants to understand this phenomenon. To understand the reasons behind this, we simulated the four coding tasks under the EV setting. We sought to accept or refute the following hypothesis:} \rev{\begin{enumerate}[label=\textbf{H\arabic{*}}] \item The Search engine did not have the right results to complete the coding task. \item The participants may not have used Search engine at all, despite being asked to do otherwise (i.e., when a solution was indeed present in the Search Engine result). \end{enumerate}} \rev{For each task, we searched the Google search engine on May 6, 2018. The search query was a string that combined the API name with the task description as shown in Table~\ref{tbl:coding-tasks}. Therefore, for the task involving the Jackson API (i.e., TJ), the query was ``Jackson + $<$Description$>$''. We manually analyzed each of the results returned in the first page of Google. For each result, we searched for code examples in the web page linked to the result. If one or more code examples are found in the linked web page, we assessed the accuracy of the code examples by computing the coverage of API elements expected in the correct solution against the found code examples, i.e., using Equation~\ref{eq:correctness}. If a solution was not found in the search result, we accept the first hypothesis (H1). If a solution was found, we further compare the found solution against the solutions coded by the participants. If the comparison shows no or low coverage we accept the second hypothesis (H2). For a search result pointing to a question in SO, we took the solution found in the accepted answer of the question (following Subramanian et al.~\cite{Subramanian-LiveAPIDocumentation-ICSE2014}). If no accepted answer is found, we discarded that result.} \begin{table}[t] \centering \caption{The perceived correctness of the solutions using results from the first page of Google} \begin{tabular}{lrrrrrr}\toprule \textbf{Task} & \multicolumn{1}{l}{\textbf{Links}} & \multicolumn{1}{l}{\textbf{Mean}} & \multicolumn{1}{l}{\textbf{SD}} & \multicolumn{1}{l}{\textbf{Median}} & \multicolumn{1}{l}{\textbf{Max}} & \multicolumn{1}{l}{\textbf{Min}} \\ \midrule TJ (Jackson) & 5 & 0.42 & 0.28 & 0.5 & 0.67 & 0 \\ TG (Gson) & 10 & 0.25 & 0.4 & 0 & 1 & 0 \\ TX (Xstream) & 9 & 0.19 & 0.28 & 0 & 0.67 & 0 \\ TS (Spring) & 10 & 0.1 & 0.2 & 0 & 0.5 & 0 \\ \midrule Overall Average & 8.5 & 0.24 & 0.29 & 0.125 & 0.71 & 0 \\ \bottomrule \end{tabular}% \label{tab:google-simulation}% \end{table}% \rev{In Table~\ref{tab:google-simulation}, we show the \textit{perceived} correctness of the solutions for the coding tasks based on the Google search result. The second column (Links) shows the number of search links provided for each task as a search query. The last five columns provide descriptive statistics (e.g., average, median) of the correctness of the solutions to coding tasks using the code examples found in the links. On average, we got 8.5 hits (i.e, links) per search query (i.e., API name + Task description). The number of hits was the lowest for the task involving Jackson API. However, the average correctness was the highest for this API. For Spring, the number of hits is highest (jointly with Gson), but the average correctness was the lowest. The major reason of the lower correctness is that most links provide code examples involving other APIs. Some links did not have any code example at all. For example, one hit for the Spring API only consists of all the different ways the Spring framework can be configured.} \rev{Overall, the average correctness of the coding tasks is higher while using Opiner than while using Google search result only (see Table~\ref{tbl:coding-task-summ-stat} for statistics about Opiner). We observed the following reasons for this phenomenon:} \rev{\begin{enumerate} \item\textbf{Discoverability.} Google is not a code search engine. Therefore, many links did not have any code examples. There is no explicit filter in Google search engine to explicitly specify that we need the results only for an API and not for something else (for example, Spring can be many things besides being a Java framework, such as a season, a store, a perfume, etc.). Both of these two mitigating factors were not helpful to search for coding solutions using Google. \item\textbf{Scatteredness.} The solutions to each of our four coding tasks were scattered in more than one SO post. Using Google search result, we were able to find half of the solutions in many cases. For example, the maximum correctness using the Spring API was only 50\% due to that reason. \end{enumerate} Despite this, we note that when Google offered good results, it was indeed very good. For example, the maximum correctness using the Gson API was 100\%, i.e., we were able create a complete solution simply by relying on Google search result for the Gson API. Therefore, it would be interesting to see how Google search could be combined with Opiner search to improve the overall developers' experience.} \subsection{Results from the Follow Up Survey} \begin{figure}[t] \vspace{-2.cm} \includegraphics[scale=.7]{images-tosem/opinercodeOverFormal2} \vspace{-2.cm} \caption{Developers' response to whether Opiner's usage documentation offer improvements over API official documentation} \label{fig:usefulness-of-summaries-over-javadoc} \end{figure} In Figure~\ref{fig:usefulness-of-summaries-over-javadoc}, we show the responses of the participants to the question whether Opiner offered improvements whether in their four development tasks over formal documentation and if so which documentation. \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} More than 85\% of the respondents agreed (= agree + strongly agree) that the new documentation algorithms in Opiner offered improvement over API official documentation in their four coding tasks. \end{tcolorbox} For the statistical and concept-based documentation, the participants appreciated the following improvements in Opiner over API official documentation: \begin{inparaenum} \item Uptodateness of the scenarios, and \item Presence of sentiments to validate the effectiveness of usage scenarios. \end{inparaenum} According to one participant, \emt{Statistical documentation would help me to find the users decisions about the API. I would chose conceptual documentation rather than formal documentation because these provides the usage example with positive and negative reaction.} \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} \rev{The respondents considered that statistical and concept-based documentation complement the API official documentation by offering innovative ways of documenting up to date API usage scenarios with reviews from online developer forums.} \end{tcolorbox} The preference of the developers of our two proposed documentation algorithms over type-based documentation confirms previous seminal research by Carroll et al.~\cite{Carroll-MinimalManual-JournalHCI1987a} and Shull et al.~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000} that technical tasks are better supported by `minimal manual', i.e., where the produced documentation can help them easily and quickly to complete a given development task in hand with task-centric documentation focus. \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} {Around 80\% of the participants agreed that Opiner documentation can complement API official documentation and as such the API documentation in Opiner (statistical and concept-based) should be integrated into the formal API documentation to produce a better official documentation.} \end{tcolorbox} According to one participant, \emt{Formal documentation will almost always be the starting point for new APIs. But as the APIs start to grow, Opiner will serve as the most useful tool to find correct solutions to the problems in less time, become familiar with the trends and compare different alternatives.} In particular, the participants appreciated the combination of usage examples with discussions based on reactions in the concept-based documentation, \emt{One thing that official documentation miss on are the problems and discussion forum. Opiner could complement the formal documentation, if the conceptual documentation are incorporated within the API documentations.} \begin{figure}[t] \includegraphics[scale=.65]{images-tosem/opinercodeOverSO} \vspace{-1.cm} \caption{Developers' response to whether Opiner's usage documentation offer improvements over API informal documentation} \vspace{-2mm} \label{fig:usefulness-of-summaries-over-forum} \end{figure} In Figure~\ref{fig:usefulness-of-summaries-over-forum}, we show how developers responded to our questions on whether in their coding tasks Opiner offered benefits over the informal documentation. \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} More than 80\% of the participants agreed that Opiner documentation offered increased usability, productivity, confidence and saved time over the informal documentation, such as SO. \end{tcolorbox} According to one developer \emph{``there are some sections like conceptual summary and code example would be useful for developer on daily basis''}. According to another participant \emph{``It is quicker to find solution in Opiner since the subject is well covered and useful information is collected.''} The participants mentioned that Opiner offers more features than SO to learn an API: \emph{``Opiner has more feature set to help the developers find out the better API for a task. The evaluation and nice presentation of positive and negative sentiments help them decide an API.''} The participants wished for an AI-powered search feature in Opiner: \emph{``The most challenging thing I faced in tech based domains is the collection of my vocabulary. To search or ask something we need to first know the proper question. If we do not know with what terms I would ask something, then no only a tool but not even a human can answer me. ''} \addtocounter{o}{1} \begin{tcolorbox}[flushleft upper,boxrule=1pt,arc=0pt,left=0pt,right=0pt,top=0pt,bottom=0pt,colback=white,after=\ignorespacesafterend\par\noindent] \vspace{1mm}\noindent\textit{\textbf{Observation \arabic{o}.}} With regards to complementarity of Opiner to SO, the participants considered learning an API using Opiner could be quicker than while using SO, because Opiner synthesizes the information from SO by APIs using both sentiment and source code analyses. \end{tcolorbox} \section{Introduction}\label{sec:introduction}} \section{Introduction}\label{sec:introduction} APIs (Application Programming Interfaces) offer interfaces to reusable software components~\cite{Robillard-APIProperty-IEEETSE2012}. Modern day rapid software development is facilitated by the numerous open source APIs that are available for any given task. Such is the popularity of APIs that the number of open source repositories in GitHub now is 100 million, an exponential increase over 67 million from only two years ago~\cite{website:github-octoverse}. With the growing number of open source repositories and the APIs supported by the repositories, developers now can face two major challenges: selection of an API amidst multiple choices and then learning how to properly use it~\cite{Uddin-OpinerReviewAlgo-ASE2017,Uddin-SurveyOpinion-TSE2019}. Both tasks can be facilitated by the official API resources. Unfortunately, official API documentation can be incomplete, obsolete and incorrect~\cite{Robillard-FieldStudyAPILearningObstacles-SpringerEmpirical2011a, Robillard-APIsHardtoLearn-IEEESoftware2009a,Uddin-HowAPIDocumentationFails-IEEESW2015}, which often leaves developers no choice but to look for alternative documentation and knowledge sharing resources~\cite{Uddin-SurveyOpinion-TSE2019,Ponzanelli-PrompterRecommender-EMSE2014}. The advent and proliferation of online developer forums has opened up an interesting avenue for developers to look for solutions of their development tasks in the forum posts~\cite{Barzillay-StackOverflow-Springer2013,Treude-APIInsight-ICSE2016}. Among the numerous online forums, Stack Overflow (SO) is a large online community where millions of developers ask and answer questions about their programming needs. Developers post questions in SO about their different technical topics, such as selection, usage, and troubleshooting of APIs. Volunteers answer those questions, or make comments, as do participants in other social forums. To date, there are around 120 million posts, out of which 48 million are questions/answers, and the rest (72 million) are comments. Around 11 million users visit SO and add 9K new questions to the site each day~\cite{website:stackexchange-sites}. The popularity and growing influence of SO has motivated a number of recent research efforts to produce API documentation automatically from SO contents, such as adding code examples and interesting textual contents about a Java API type (e.g., a class) in the Javadocs~\cite{Subramanian-LiveAPIDocumentation-ICSE2014,Treude-APIInsight-ICSE2016}, recommending usage examples within a given IDE~\cite{Ponzanelli-PrompterRecommender-EMSE2014}, summarizing API reviews (i.e., opinions with positive and negative sentiments) to assist in API selection~\cite{Uddin-OpinerReviewAlgo-ASE2017}, and so on. In our previous surveys of 178 developers, we find that developers consider the combination of code examples and API reviews as a form of API documentation~\cite{Uddin-SurveyOpinion-TSE2019}. In fact, the developers consider such a combination as more valuable than official API documentation, when the official resources can be lacking~\cite{Uddin-SurveyOpinion-TSE2019}. We are aware of no previous research that attempts to automatically produce API documentation from SO by combining both code examples and reviews. In this paper, we propose a new documentation format for APIs that we can generate automatically by mining SO. The format considers both code example of an API and relevant reviews about the code example from other developers in the forum posts. We present two novel documentation algorithms based on the code examples and reviews. The first algorithm is called \textbf{Statistical Documentation} which offers visualized usage and review statistics about code examples of an API. The second algorithm in \textbf{Concept-Based Documentation} which clusters usage scenarios API that are conceptually similar, e.g., one scenario consisting of creating an HTTP connection and another sending messages over the HTTP connection. Using the two algorithms, we automatically produce the documentation of an API by mining SO. We deploy those documentation in Opiner~\cite{Uddin-OpinerReviewAlgo-ASE2017}. Opiner was previously developed as an online prototype engine to summarize reviews about an API from online developer forums. The overarching goal of Opiner is to become a one stop resource for crowd-sourced API documentation. In this paper, we have extended Opiner to also include our mined usage documentation of the APIs. Opiner is hosted at: \url{http://opiner.polymtl.ca}. \begin{figure}[t] \centering \vspace{-6mm} \hspace*{-.8cm}% \includegraphics[scale=.7]{images-tosem/opiner-intro-tosem2} \hspace*{-1.0cm}% \vspace{-4mm} \caption{Screenshots of Opiner online website with the deployed our two novel API usage scenario documentation algorithms. While Opiner online website offers other features, the screenshots here only show the extensions of Opiner that were implemented as part of the new contributions presented in this paper} \label{fig:opiner-motivation-solution} \vspace{-4mm} \end{figure} In Figure~\ref{fig:opiner-motivation-solution}, we show screenshots of Opiner usage documentation engine. The Opiner online web-site currently indexes the mined and documented usage scenarios of the APIs from a total of 3048 threads SO tagged as `Java+JSON'. This dataset was previously used to mine and summarize reviews about diverse Java APIs~\cite{Uddin-OpinerReviewAlgo-ASE2017,Uddin-OpinerReviewToolDemo-ASE2017}. As such, we expect to see code examples discussing about Java APIs for JSON parsing in the posts. A developer can search for the usage documentation of an API by searching its name in Opiner - see \circled{1} under the front page of Opiner in Figure~\ref{fig:opiner-motivation-solution}. The front page also shows the APIs with the most number of usage scenarios. As shown in \circled{2}, one of the most used APIs for JSON parsing in Java is Jackson. The circles \circled{3} and \circled{4} show some metrics that we developed to produce and visualize the Statistical Documentation. The circle \circled{3} shows the overall distribution of positive and negative opinions in the forum posts where the code examples of the API Jackson were found. The circle \circled{4} shows that the API javax.ws (blue pie) is frequently used alongside the Jackson API in the same code examples. The javax.ws API is an official Java package that is used to create RESTful services, where JSON is the primary medium of communication. The right part of Figure~\ref{fig:opiner-motivation-solution} shows screenshots of the concept-based documentation of Jackson in Opiner. In Opiner, each concept consists of one or more similar API usage scenarios. Each usage scenario of an API consists of a code example, a textual description of the underlying task addressed by the code example, and reviews (i.e., opinionated sentences with positive/ negative sentiments) of the code examples as found in the comments to the post where the code example is found. Each concept is titled as the title of the most recently posted usage scenario. In circle \circled{5}, we show the most recent three concepts for API Jackson. The concepts are sorted by time of their most recent usage scenarios. The most recent concept is placed at the top of all concepts. Upon clicking on a concept title, we can see details of the most recent scenario in the concept as shown in circle \circled{6}. Each concept is provided a star rating as the overall sentiments towards all the usage scenarios that are grouped under the concept (see circle \circled{6}). Other relevant usage scenarios of the concept are grouped under a `See Also' (see circle \circled{7}). Each usage scenario under the `See Also' can be further explored (see circle \circled{8}). Each usage scenario is linked to the corresponding post in SO where the code example was found (by clicking the \textit{details} word after the description text of a scenario as shown in \circled{6}). We evaluated the usefulness of the proposed two documentation algorithms over the traditional type-based documentation approach~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000}. In a type-based documentation, we adopt a Javadoc-style by clustering all the usage scenarios of an API type (e.g., a class) under the type name in Opiner website. Previously, Subramanian et al.~\cite{Subramanian-LiveAPIDocumentation-ICSE2014} also promoted similar documentation format for Javadocs by automatically mining all the code examples of an API from SO. Given that each usage scenario in our concept-based documentation also contains reviews and textual task description of a code example, we added all such information to each code example in our Type-based documentation. We then recruited 29 developers (18 professional) and asked them to compare the three documentation types (i.e., Statistics, Concept-Based and Type-Based) along four development scenarios (e.g., API selection, documentation) as originally used in~\cite{Uddin-OpinerReviewAlgo-ASE2017}. The participants preferred our proposed two algorithms over type-based documentation in all the development scenarios. We conducted a second user study using 31 developers to evaluate the effectiveness of the produced documentation in Opiner to complete coding tasks. Each participant completed four coding tasks using Opiner documentation, official Javadocs, SO, and everything (i.e., including search engine). The participants, on average, wrote more correct code, in the least amount time, and using the least effort while using Opiner compared to the other documentation resources. In a subsequent survey, more than 80\% participants preferred the Opiner documentation over existing SO posts. More than 85\% of participants asked the Opiner documentation platform to be integrated into the formal API documentation to complement and improve the API official documentation. \begin{table}[t] \centering \caption{Contributions and Research Advances Made in our Paper} \begin{tabular}{lp{3.5cm}p{8.6cm}}\toprule \multicolumn{1}{l}{\textbf{Contribution}} & \multicolumn{1}{l}{\textbf{Summary}} & \multicolumn{1}{l}{\textbf{Research Advancement}} \\ \midrule Algorithms & We propose two novel algorithms to automatically document API usage scenarios from online developer forum: Statistical and Concept-based. & Previous related research focused mainly on linking code example or interesting insights directly to the Javadoc of an API type~\cite{Subramanian-LiveAPIDocumentation-ICSE2014,Treude-APIInsight-ICSE2016}, or to complement API official documentation using SO contents~\cite{Wang-APIsUsageObstacles-MSR2013,Kavaler-APIsUsedinAndroidMarket-SOCINFO2013,Souza-CookbookAPI-BSSE2014,Sunshine-APIProtocolUsability-ICPC2015,Mastrangelo-JavaUnsafeAPIs-OOPSLA2015,YeDeheng-ExtractAPIMentions-ICSME2016,Campos-SearchSORecommend-JSS2016,Campos-SearchSOPostAPIBug-CASCON2016,Azad-GenerateAPICallrules-TOSEM2017,Ahsanuzzaman-ClassifySOPost-SANER2018,Wang2013Detecting,Dagenais-DeveloperDocumentation-FSE2010a,Parnin-MeasuringAPIDocumentationWeb-Web2SE2011,Parnin2012,Jiau-FacingInequalityCrowdSourcedDocumentation-SENOTE2012,Campbell-DeficientDocumentationDetection-MSR2013,Treude-DocumentationInsightsSO-ICSE2016,Delfim-RedocummentingAPIsCrowdKnowledge-JournalBrazilian2016,LiXing-LeveragingOfficialContentSoftwareDocumentation-TSC2018,LiSun-LearningToAnswerProgrammingQuestions-JIS2018}. Our algorithms offer directions to design innovative algorithms to complement and improve API official documentation. \\ \midrule Techniques & We implemented and deployed the algorithms in our tool, Opiner~\cite{Uddin-OpinerReviewToolDemo-ASE2017}. & We are aware of no tool that can offer search and documentation features of API usage scenarios automatically collected from developer forums. The underlying documentation framework in Opiner can be further extended with new API usage documentation algorithms.\\ \cmidrule{2-3} & We conducted three user studies to demonstrate the effectiveness of the proposed usage documentation algorithms over traditional API documentation approach and resources. & The positive reception of our proposed API documentation formats based on the two algorithms opens up a new research area in software engineering to design innovative techniques and tools by harnessing knowledge shared in online crowd-sourced forums. As we noted in Sections~\ref{sec:introduction} and \ref{sec:related-work}, existing research~\cite{Subramanian-LiveAPIDocumentation-ICSE2014,Treude-APIInsight-ICSE2016,Souza-CookbookAPI-BSSE2014,Sunshine-APIProtocolUsability-ICPC2015,Campos-SearchSORecommend-JSS2016,Campbell-DeficientDocumentationDetection-MSR2013,Treude-DocumentationInsightsSO-ICSE2016,Delfim-RedocummentingAPIsCrowdKnowledge-JournalBrazilian2016,LiXing-LeveragingOfficialContentSoftwareDocumentation-TSC2018,LiSun-LearningToAnswerProgrammingQuestions-JIS2018} mostly focused on complementing the traditional official documentation. \\ \bottomrule \end{tabular}% \label{tab:researchAdvancement}% \end{table}% In summary, we advance the state of the art by presenting two novel algorithms to automatically document API usage scenarios from online developer forums with each deployed in an online API documentation prototype tool Opiner. We demonstrate the effectiveness of the algorithms and the tool to assist developers in their diverse development tasks using three user studies. In Table~\ref{tab:researchAdvancement}, we outline the major contributions of this paper. \section{Related Work}\label{sec:related-work} Related work can broadly be divided into two categories: \begin{inparaenum}[(1)] \item API documentation efforts, and \item Assisting development task completion using knowledge shared in developer forums. \end{inparaenum} We summarize and compare our study with related work in Table~\ref{tab:compareRelatedWork}. We discuss selected research work below. \begin{table}[t] \centering \caption{Comparison between our study and previous related work} \resizebox{\columnwidth}{!}{% \begin{tabular}{p{1.5cm}p{4cm}|p{4cm}|p{5cm}}\toprule \textbf{Theme} & \textbf{Our Study} & \textbf{Prior Study} & \multicolumn{1}{l}{\textbf{Comparison}} \\ \midrule \textbf{Automatic API Documentation Efforts} & We propose two novel algorithms to automatically produce API documentation from SO. Each algorithm takes as input a list of all mined API usage scenarios from SO. The produced API documentation is presented using statistical metrics (e.g., star ratings of reviews) and by grouping conceptually similar API usage scenarios. & Previous research mined API usage concepts and traces from the version history of clients or the source code of an API~\cite{Uddin-TemporalApiUsage-ASE2011,Uddin-TemporalApiUsage-ICSE2012,Robillard-AutomaticSuggestionProgramNavigation-FSE2005,Robillard-RecommendChangeClusters-JournalSoftwareMaintain2010a,Robillard-RepresentingConcern-PhDThesis2003}. Javadocs of API classes are annotated with code examples and interesting textual insights of an API from SO~\cite{Subramanian-LiveAPIDocumentation-ICSE2014,Treude-APIInsight-ICSE2016}. Techniques are proposed to add clarification to API usage using crowd-sourced knowledge~\cite{Ren-DemystifyOfficialAPIUsageDirectivesWithCorwdExample-ICSE2020}. & We identify API usage concepts by mining API usage scenarios from SO. We do not annotate Javadocs with our documented API usage scenarios. Instead, we present those in an online API portal using innovating documentation presentation format. More than 80\% participants in our user study wished for our produced API documentation to be included in official API documentation. \\ \cmidrule{2-4} & We include reviews (i.e., positive/negative opinions) about code examples in our produced API documentation to give information about the quality of the shared code examples. & Recent research finds that code examples shared in online forums can miss important details, could be partially correct, may not be directly usable, and may contain API misuse patterns~\cite{Zhang-AreCodeExamplesInForumReliable-ICSE2018,Yang-QueryToUsableCode-MSR2016,Terragni-CSNIPPEX-ISSTA2016,Ren-DiscoverControversialDiscussions-ASE2019} & Previously, we found that developers utilize the reviews in online forums to assess the goodness of the code examples and they prefer the reviews over API official documentation~\cite{Uddin-SurveyOpinion-TSE2019}. We are aware of no previous API documentation effort that combine API code examples with reviews. \\ \midrule \textbf{Assisting Development Task Completion} & We implement and deploy our proposed algorithms and a Javadoc adaptation as Type-based documentation in an online Tool, Opiner. Our two user studies show that tool is effective for developers to complete coding tasks. The users preferred the API documentation produced by our two proposed algorithms over the Type-based documentation across all development scenarios. & Code segments from SO and YouTube are recommended within an IDE/search engine to assist in programming tasks~\cite{Ponzanelli-PrompterRecommender-EMSE2014,Ponzanelli-CodeTube-ICSE2016}. Techniques are proposed to automatically recommend and summarize quality answers to a question/bug~\cite{LiSun-LearningToAnswerProgrammingQuestions-JIS2018,BowenXu-AnswerBot-ASE2017,YuanTian-APIBot-ASE2017,Campos-SearchSOPostAPIBug-CASCON2016}, and to improve software query reformulation~\cite{Silva-RecommendSolutionTaskUsingSO-ICPC2019,Masud-QueryReformulationSO-EMSE2019,Masud-RACK-ICSE2017,Masud-RACK-ICSME2016}. & We do not provide suggestions to complete a development task. Instead, we produce API documentation. However, in our concept-based documentation algorithm, we cluster API usage scenarios that can be used to complete conceptually similar development tasks (e.g., establish HTTP connection before sending an HTTP message). Developers in our user studies wrote the most correct code using least effort and least time while using Opiner, compared to while using API official documentation, SO, and/or search engine. \\ \bottomrule \end{tabular}% } \label{tab:compareRelatedWork}% \end{table}% \subsection{API Documentation Efforts Using Crowd-Sourced Knowledge} The inference of API usage patterns and properties by mining software repositores (e.g., version history of client software) has been an active research area for over a decade. Dynamic analysis is used on the execution traces to detect usage patterns~\cite{Lo-MiningHierarchicalScenarioBasedSpec-ASE2009,Lo-MiningIterativePatterns-SIGKDD2007,Fahland-MiningBranchingTimeScenarios-ASE2013,Safyallah-PatternMiningDynamicAnalysis-ICPC2006}. The techniques instrument software and collect execution traces by running the software for relevant task scenarios. Static analysis is used on the version control data of software to find API usage concepts~\cite{Uddin-TemporalApiUsage-ASE2011,Uddin-TemporalApiUsage-ICSE2012,Robillard-AutomaticSuggestionProgramNavigation-FSE2005,Robillard-RecommendChangeClusters-JournalSoftwareMaintain2010a,Robillard-RepresentingConcern-PhDThesis2003}. Unlike above research, we mine API usage scenarios from developer forum, SO. The automated mining of crowd-sourced knowledge from developer forums to support API documentation has broadly focused on two areas in recent years: \begin{inparaenum} \item Creation of API documentation and usage patterns from crowd-sourced knowledge, and \item Assessing the quality and feasibility of crowd-sourced developer knowledge. \end{inparaenum} \subsubsection{Producing API Documentation and Usage Patterns.} Javadocs are annotated by Baker~\cite{Subramanian-LiveAPIDocumentation-ICSE2014} to add code examples to the official documentation of an API type (e.g., class) from SO and by API Insight~\cite{Treude-APIInsight-ICSE2016} to add important textual insights about the API type. Unlike Baker and API Insight, we produce stand-alone API documentation by proposing two novel algorithms: Statistical and Concept-Based. API sequence (e.g., one after another or together) calls are mined by Gu et al.~\cite{KimGu-DeepAPILearning-FSE2016} from GitHub code repositories and by Azad et al.~\cite{Azad-GenerateAPICallrules-TOSEM2017} on Android code base and SO code examples. We do not produce API sequence calls in our API documentation. Instead, in our concept-based documentation we find API usage scenarios that are conceptually relevant to each other. Li et al.~\cite{LiXing-LeveragingOfficialContentSoftwareDocumentation-TSC2018} propose CnCxL2R, a software documentation recommendation engine by incorporating the content of the official documentation with social context from SO. Souza et al.~\cite{Souza-CookbookAPI-BSSE2014,Souza-BootstrapAPICodeBookSO-IST2019} propose a semi-automatic approach based on topic modeling to build cookbooks for APIs by organizing knowledge available in SO. Topic modeling was also applied by Campbell et al.~\cite{Campbell-DeficientDocumentationDetection-MSR2013} on a combined dataset of SO, and PHP and Python official documentation to determine missing topic coverage in the official documentation. Ren et al.~\cite{Ren-DemystifyOfficialAPIUsageDirectivesWithCorwdExample-ICSE2020} develop a text mining approach to discover API misuse scenarios in SO. They extract erroneous code examples, patches, related and confusing APIs from the misuse scenarios and construct demystification reports. The reports can be used to help developers understand the official API usage directives. Unlike the above work, we also consider reviews about code examples while producing the documentation. In our previous surveys of 178 software developers, we found that developers consider the combination of code examples and reviews about the examples as a form of API documentation and they value such documentation over official documentation. To produce API documentation from crowd-sourced forum, we first need to link code examples to APIs. A number of techniques automatically infer code terms (e.g., API method, class) in textual contents and code examples of forum posts (see \cite{Dagenais-RecoDocPaper-ICSE2012a}, \cite{Subramanian-LiveAPIDocumentation-ICSE2014}, \cite{Rigby-CodeElementInformalDocument-ICSE2013}, \cite{YeDeheng-ExtractAPIMentions-ICSME2016}, \cite{Phan-StatisticalLearningFQNForums-ICSE2018}, and \cite{Ma-APINERSODeepLearning-TSE2019}). Unlike above techniques, we associate a code example to an API mentioned in the textual contents of the forum post, about which the code example is provided. Therefore, we do not link \textit{all} the different APIs whose classes are used in the code example or all different API/code elements that are mentioned in the textual contents. In our previously published paper~\cite{Uddin-MiningAPIUsageScenarios-IST2020}, we showed that this approach is better suited to produce task-centric~\cite{Carroll-MinimalManual-JournalHCI1987a,DeSouza-DocumentationEssentialForSoftwareMaintenance-SIGDOC2005} API documentation from SO, where an API is of particular focus to complete a task. \subsubsection{Assessing Quality and Documentation Feasibility of Forum Contents} The recent focus on API documentation creation from SO and online contents is motivated by previous research findings on analyzing the feasibility of SO to support API documentation and program comprehension. Parnin and Treude~\cite{Parnin-MeasuringAPIDocumentationWeb-Web2SE2011} analyzed to what extent the methods of an API (jQuery) are documented on the Web. They analyzed 1730 search results and find that 87.9\% of the methods are mainly covered in online blogs and tutorials. Jiau and Yang~\cite{Jiau-FacingInequalityCrowdSourcedDocumentation-SENOTE2012} find that API classes with with lower documentation can be covered by another class with more documentation in SO, where both are found under same inheritance. Delfim et al.~\cite{Delfim-RedocummentingAPIsCrowdKnowledge-JournalBrazilian2016} find that developers in SO provide more content for debugging tasks then for how-to-do tasks. Sunshine et al.~\cite{Sunshine-APIProtocolUsability-ICPC2015} find that developers spent significant time in online forums to seek information about API protocol usage. Studies found code examples from different programming languages can have different usability factors in SO~\cite{Yang-QueryToUsableCode-MSR2016}, some Android API classes in the shared code can be more challenging to use than other~\cite{Wang-APIsUsageObstacles-MSR2013}, but there is sub-linear relationship between the Android class popularity in Android apps and the requests for their documentation in SO~\cite{Kavaler-APIsUsedinAndroidMarket-SOCINFO2013}. The encouraging documentation coverage in the Web, in participate in SO, have motivated us to produce our API documentation from SO. Zhang et al.~\cite{Zhang-ReadingAnswerSONotEnough-TSE2019} find that majority of comments posted in SO are informative and thus they can enhance the quality of their associated answers. They propose to include comments into knowledge seeking and documentation resources, which traditionally have been only using accepted answers from SO. Following suggestions from Zhang et al.~\cite{Zhang-ReadingAnswerSONotEnough-TSE2019}, we analyze both answers and comments to code examples while producing our API documentation. The encouraging findings on the feasibility and availability of crowd-sourced knowledge have motivated researchers to also analyze the quality of the shared knowledge. A number of recent research papers~\cite{Zhang-AreCodeExamplesInForumReliable-ICSE2018,Yang-QueryToUsableCode-MSR2016,Terragni-CSNIPPEX-ISSTA2016} warn against directly copying code from SO, because such code can have potential bugs or misuse patterns~\cite{Zhang-AreCodeExamplesInForumReliable-ICSE2018} and that such code may not be directly usable (e.g., not compilable)~\cite{Yang-QueryToUsableCode-MSR2016, Terragni-CSNIPPEX-ISSTA2016}. Mondal et al.~\cite{Mondal-SOIssueReproducability-MSR2019} analyze the reproducibility of code example shared in SO questions. They find that questions with reproducible problem in the code example are three times more likely to be answered. Mastrangelo et al.~\cite{Mastrangelo-JavaUnsafeAPIs-OOPSLA2015} investigate the spread of unsafe Java code that are used as ``backdoors'' in Java runtime to facilitate high-performance system level code in Java. They analyze 74GB of compiled Java code, spread over 86,479 Java archives. They find that 25\% of the Java archives use such unsafe code. Zhang et al.~\cite{Zhang-ObsoleteAnswerSO-TSE2019} analyze answers with obsolete solutions in SO. They find that more than 50\% of those obsolete answers were obsolete even during the time of their creation. They find that answers to questions related to node.js, ajax, android, and objective-c are more likely to become obsolete. Tools and techniques are also proposed to detect high quality posts and answers~\cite{Ponzanelli-ImproveLowQualityPostDetect-ICSME2014}. Recently, Ren et al.~\cite{Ren-DiscoverControversialDiscussions-ASE2019} propose a technique to discover answers that are being criticized in SO for having erroneous solutions. They identify such critique posts as controversial discussions. They then summarize the controversial discussions per problematic answer. In our current Opiner API documentation framework, we inform developers of problems in the code examples by showing them negative opinions provided against the code examples in the comments to the answers. The developers in our user studies mentioned that such insights are very useful. The produced API documentation can be made more useful by highlighting controversial discussions about a code example, by utilizing the techniques from Ren et al.~\cite{Ren-DiscoverControversialDiscussions-ASE2019}. Ragkhitwetsagul et al.~\cite{Ragkhitwetsagul-ToxicCodeSO-TSE2018} identify toxic code in SO as the code examples that are outdated or that violate original software license. They conduct a survey of 201 high-reputation SO users and find that they rarely check for license violation. Violation of licenses is a common problem for code examples shared in other platforms, such as Android Ecosystem (see Mlouki et al.~\cite{Mlouki-LicenseViolationAndroid-SANER2016}). All documented API usage scenarios in Opiner can be further enhanced by the information of license that need to be adopted before the reuse of a code example. This can help reduce the above license violation problems. \subsection{Assisting Development Task Completion Using Crowd-Sourced Knowledge} A number of tools are developed to offer context-aware code completion information into the IDE of a developer based on crowd-sourced knowledge. Zilberstein and Yahav~\cite{Zilberstein-Codota-ONWARD2016} proposed an approach to leverage code examples from forum posts to support auto code completion features in IDEs. They built Codota, a tool that given a code context from the IDE, automatically searches forum posts to find most relevant code examples that can be relevant to the code context. Ponzanelli et al.~\cite{Ponzanelli-PrompterRecommender-EMSE2014} developed an Eclipse Plug-in that takes into account the source code in a given file as a context and use that to search SO posts to find relevant discussions (i.e., \textit{code to relevant information}). Campbell and Treude~\cite{Campbell-NLP2Code-ICSME2017} develop NLP2Code that integrates with a developer's IDE to provide him with a content assist feature to close the vocabulary gap between the needs of the developer and the code snippet meta data. While the above tools extend IDEs, Opiner is a stand-alone portal to show API documentation from SO. Unlike the above tools that only use code example/discussions, Opiner use code example and reviews. Developers query for technical contents online. A number of techniques are proposed to provide better results to an input technical query by leveraging crowd-sourced knowledge. Campos et al.~\cite{Campos-SearchSOPostAPIBug-CASCON2016} propose an approach to find fixes to API-related bugs bugs by matching code snippet that are being debugged against related snippets in SO. To find the API-related bugs, they used OHLOH code search engine containing potentially buggy API method calls. Rahman et al.~\cite{Masud-QueryReformulationSO-EMSE2019,Masud-RACK-ICSE2017,Masud-RACK-ICSME2016,Masud-NLP2API-ICSME2018} propose RACK and NLP2API that suggest a list of relevant API classes for a natural language query intended for code search. The technique exploits keyword-API associations from SO posts to reformulate the queries. Silva et al.~\cite{Silva-RecommendSolutionTaskUsingSO-ICPC2019} propose a tool CROKAGE (Crowd Knowledge Answer Generator) that takes as input a natural language query of the description of a programming task and outputs solutions to the task by offering code examples and explanations. The query is expanded with relevant API classes from SO. Li et al.~\cite{LiSun-LearningToAnswerProgrammingQuestions-JIS2018} develop QDLinker, a deep-learning-to-answer framework to answer programming questions with software documentation. The tool learns from the discussions in SO to bridge the semantic gap between the types of questions asked and software documentation. Based on the learning, the tool can effectively answer a programmer question with links to software documentation. Unlike the above techniques, all the documentation of an API in Opiner can be searched by simply searching by the API name. Thus Opiner can be extended with above techniques, so that developers can search Opiner API documentation using natural language query. In fact, during our surveys, this is also one of the features that developers wished Opiner could have in future extensions. Recently, bots are developed to assist developers in diverse development tasks by utilizing crowd-sourced knowledge. Xu et al.~\cite{BowenXu-AnswerBot-ASE2017} develop AnswerBot that takes as input a natural language description of a programming task. The tool finds questions relevant to the query and summarizes the useful answers from those questions. Tian et al.~\cite{YuanTian-APIBot-ASE2017} develop APIBot to answer API questions given API documentation as an input. The Bot is built by adapting SiriusQA, a cross-domain intelligent personal assistant. The engine achieve a Hit@5 score of 0.706 to answer the questions. Future extensions of the bots can also target the curated API documentation in Opiner. Finally, contents in SO can be better used, if the underlying contexts can be better processed. Ahsanuzzaman et al.~\cite{Ahsanuzzaman-ClassifySOPost-SANER2018,Ahasanuzzaman-ClassifyIssueSO-EMSE2019} develop machine learning classifier to automatically label SO questions describing an issue or not. Terragni et al.~\cite{Terragni-CSNIPPEX-ISSTA2016} investigate the compilability issues with the code snippets shared in SO. They developed CSnippEx that can automatically convert a shared Java code into a compilable code by resolving external dependencies, import statements and syntax errors. Both of these techniques can help extend the API documentation in Opiner, e.g., by producing compilable code using CSnippEx. \section{Background}\label{sec:background} This research borrows concepts and techniques from software engineering and opinion analysis. In this section, we present the major concepts and techniques upon which this study is founded. \subsection{API} In this paper, we investigated our API usage documentation techniques for both open-source and official Java APIs. As such, we analyzed SO posts tagged as ``Java'' where Java APIs are mostly discussed. However, the analysis and the techniques developed can be applicable for any API. In particular, we adopt the definition of an API pioneered by Martin Fowler. An API is a ``set of rules and specifications that a software program can follow to access and make use of the services and resources provided by its one or more modules''~\cite{website:wikipedia-api}. An API is identified by a name. An API consists of one or more modules. Each module can have one or more source code packages. Each package can have one or more code elements, such as classes, methods, etc. For the Java official APIs available through the Java SDKs, we consider an official Java package as an API. Similar format is adopted in the Java official documentation (e.g., the \mct{java.time} package is denoted as the Java date APIs in the new JavaSE official tutorial~\cite{website:oracle-javadateapi}). As shown in Figure~\ref{fig:HowAPIsDiscussed}, this is also how APIs are discussed and mentioned in SO. For example, there are three open source Java APIs mentioned in the textual contents in Figure~\ref{fig:HowAPIsDiscussed}: Jackson, Google Gson, and org.json. In the code example, two packages from the official Java SDK are used along with Gson: java.util and java.lang. An API is normally designed to support specific development needs. Each need can be implemented as a functionality in the API. Each functionality is denoted as `feature'~\cite{Robillard-APIProperty-IEEETSE2012}. For example, the Gson API is developed to support the processing and manipulation of JSON-based inputs in Java. One feature of the Gson API is the conversion of JSONArray into a Java Object. As shown in Figure~\ref{fig:HowAPIsDiscussed}, this can be addressed by using two methods from the two classes of the Gson API: getType(\ldots) and fromJson(\ldots) from the classes TypeToken and Gson, respectively. \subsection{Opinion} Bing Liu, in his book~\cite{liu-sentimentanalysis-handbookchapter-2016}, defines opinion as: ``An opinion is a quintuple $<$$e_i$, $a_{ij}$, $s_{ijkl}$, $h_k$, $t_l$$>$, where $e_i$ is the name of the entity, $a_{ij}$ is an aspect of $e_i$, $s_{ijkl}$ is the sentiment on aspect $a_{ij}$ of entity $e_i$, $h_k$ is the opinion holder, and $t_l$ is the time when the opinion is expressed by $h_k$". The sentiment $s_{ijkl}$ is positive or negative. Both entity ($e_i$) and aspect ($a_{ij}$) represent the opinion target. An aspect about an entity can be about a property or a feature supported by the entity. For example, in Figure~\ref{fig:HowAPIsDiscussed} the first comment (C1) has two sentences. The first sentence is `The code is buggy'. This a negative opinion about the the bug aspect of the provided code example. \begin{figure}[t \centering \vspace{-6mm} \hspace*{-.4cm}% \includegraphics[scale=.65]{images-tosem/HowAPIsDiscussed} \vspace{-4mm} \caption{How APIs are discussed in SO} \label{fig:HowAPIsDiscussed} \vspace{-4mm} \end{figure} \subsection{API Usage Scenario}\label{sec:apiUsageScenario} In this paper, we produce API documentation by combining code examples of an API with the relevant reviews towards the code examples. We use the notion `API Usage Scenario' which is a composite of three items: a code example associated to an API, a textual description of the underlying task addressed by the code example, and a set of reviews (i.e., opinions with positive and negative sentiments) towards the code example as provided in the comments to the post where the code example is found. For example, from Figure~\ref{fig:HowAPIsDiscussed}, we can produce an API usage scenario based on the code snippet as follows: \begin{inparaenum} \item The code snippet is provided to complete a development task involving Java to convert JSON data to Java object using the Google Gson API. \item A textual task description of the task by identifying relevant sentences, such as those immediately before the code snippet. \item The reviews in comments C1 and C2 that are relevant to code snippet. \end{inparaenum} Our decision to use API usage scenarios instead of simply code examples is influenced by seminal research of Carroll et al.~\cite{Carroll-MinimalManual-JournalHCI1987a} and Shull et al.~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000}. Carroll et al.~\cite{Carroll-MinimalManual-JournalHCI1987a} proposed `minimal manual' for technical documents by designing the documentation around specific tasks. In subsequent study, Shull et al.~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000} find that such a task-based documentation format is more useful than a traditional hierarchical documentation format~\cite{Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000}. In our API usage scenarios, each scenario corresponds to a specific development task. Our decision to utilize reviews from comments is based on our previous findings from surveys of 178 software developers from SO and GitHub~\cite{Uddin-SurveyOpinion-TSE2019}. We find that developers consider the combination of a code example in an answer post and the reviews about it from other developers in the comments as a form of API documentation. We also find that developers consider such a combination more valuable than API official documentation, because the reviews are offered by experts and are based on their real-world experience on the API usage. The usefulness of comments is confirmed with empirical evidence by two recent studies as well, published at the same year of our surveys (i.e., 2019). Ren et al.~\cite{Ren-DiscoverControversialDiscussions-ASE2019} exploited comments to identify `controversial' answers, i.e., answers that may be potentially incorrect. They find that in those `controversial' cases, comments are useful to offer a more accurate usage experience of the API. In a separate study, Zhang et al.~\cite{Zhang-ReadingAnswerSONotEnough-TSE2019} manually analyzed a statistically significant sample of all SO comments and found that more than 75\% of the comments are useful. Indeed, the number of comments is much more than the number of answers in SO (72 million vs 29 million as of 2020). Zhang et al.~\cite{Zhang-ReadingAnswerSONotEnough-TSE2019} further emphasized: \emt{The amount of information in comments cannot be neglected, with 23\% of the answers having a commenting-thread that is longer than their actual answer.} These positive findings from Zhang et al.~\cite{Zhang-ReadingAnswerSONotEnough-TSE2019} highlight that most of the comments in SO are informative and not noisy, and thus could be used to assist developers. \subsection{Javadoc} Our API documentation framework in Opiner currently supports our two proposed algorithms and a Javadoc-style presentation of the mined API usage scenarios. In the Javadoc of an API, individual pages are created to document each type of the API. A type for a Java API can be a class, annotation, or an interface. The Javadoc-style presentation in Opiner is called Type-based documentation, because we cluster all usage scenarios associated to an API type under the type. For Java APIs, Javadocs are one of the most commonly known and used documentation formats - as noted in a number of old and recent previous research~\cite{Ponzanelli-PrompterRecommender-EMSE2014,Shull-InvestigatingReadingTechniquesForOOFramework-TSE2000}. As such, previous research on automatic API documentation efforts have proposed to augment the Javadocs of an API type with code examples and relevant insights (e.g., specific conditions of usage) from SO~\cite{Subramanian-LiveAPIDocumentation-ICSE2014,Treude-APIInsight-ICSE2016}. However, previous research finds that a Javadoc-type hierarchical documentation format is not a useful presentation format~\cite{Uddin-HowAPIDocumentationFails-IEEESW2015}. We thus innovate by proposing two novel API documentation algorithms, which are different from the type-based documentation format. \section{The Usage Summarization Algorithms}\label{sec:summarizationAlgos} \section{The API Documentation Framework}\label{sec:framework} \begin{figure}[t \hspace*{-.7cm}% \centering \includegraphics[scale=.86]{images-tosem/frameworkMod2} \hspace*{-.7cm}% \vspace{-4mm} \caption{The major components in our proposed crowd-sourced API documentation framework} \label{fig:framework} \end{figure} The input to our API documentation framework is a list of forum posts and an API database. The final outputs are API documentation based on the input. The framework consists of two major components (see Figure~\ref{fig:framework}): \begin{enumerate} \item Mining Component. Takes as input the forum posts and an API database. The output is a list of API usage scenarios. Each API scenario consists of a code snippet, textual description, and reviews towards the snippet. \item Documentation Component. Takes as input the mined usage scenarios of an API and produces three types of documentation. The first two are based on our two proposed documentation algorithms (statistical and concept-based). The third is type-based documentation, which is developed as an adaptation of Javadoc. \end{enumerate} Our API database consists of \begin{inparaenum} \item all the Java APIs collected from the online Maven Central repository~\cite{website:maven-central},\footnote{We consider a binary file (e.g., jar) of a project from Maven as an API} and \item all the Java official APIs from JavaSE (6-8) and EE (6 and 7). \end{inparaenum} In Table~\ref{tbl:apidb}, we show the summary statistics of our API database. All of the APIs (11,576) hosted in Maven central are for Java. We picked the Maven Central because it is the primary source for hosting Java APIs with over 70 million downloads every week~\cite{website:mavencentral-blog}. \begin{table}[t] \caption{Descriptive statistics of the Java APIs in the database} \centering \begin{tabular}{llll|rrr}\toprule \textbf{API} & \textbf{Module} & \textbf{Version} & \textbf{Link} & \textbf{\#Avg Links/API} & \textbf{\#Avg Modules/API} & \textbf{\#Avg Versions/Module} \\ \midrule 12,451 & 144,264 & 603,534 & 72,589 & 5.8 & 11.6 & 4.2 \\ \bottomrule \end{tabular} \label{tbl:apidb} \end{table} We describe the components below. \subsection{Mining Component}\label{sec:mining-component} \rev{Given as input a forum post, first we preprocess the post contents and then we mine API usage scenarios from the parsed contents. The techniques supporting both steps are previously published in Uddin et al.~\cite{Uddin-MiningAPIUsageScenarios-IST2020}. We thus briefly describe the steps below and leave the details in \cite{Uddin-MiningAPIUsageScenarios-IST2020}.} Given as input an answer to a question in SO, we divide its contents using three parts: \begin{inparaenum}[(1)] \item Code snippet in the answer. We detect code snippets as the tokens wrapped with the $<$code$>$ tag. \item Textual contents in answer, and \item Textual contents in the comments to the answer. \end{inparaenum} The textual contents are tokenized into sentences. Opinionated sentences are detected as sentences having positive or negative polarity. To detect opinionated sentences, we use the OpinerDSO algorithm~\cite{Uddin-OpinionValue-TSE2019} which offered performance comparable to state-of-the-art sentiment detection tools for software engineering, e.g., Senti4SD~\cite{Calefato-Senti4SD-EMSE2017}. Nevertheless, the Opiner framework is flexible to replace the OpinerDSO by any other sentiment detector. During the parsing of code snippets, we discard non-code and non-Java snippets (e.g., XML, Javascript) using Language-specific naming conventions (similar to Dagenais and Robillard~\cite{Dagenais-RecoDocPaper-ICSE2012a}). We parse a valid code example to identify API elements (types, methods, interfaces). We consult our API database to infer FQN (Fully Qualified Name) of the API elements. Given as input a parse code example and the textual contents in the post where code example is found, we produce an API usage scenario using three algorithms as follows. \rev{First, we heuristically link a code snippet to an API name mentioned in the textual contents of the forum post where the code snippet is discussed by consulting the textual contents and API elements found in the code snippet. For example, in Figure~\ref{fig:HowAPIsDiscussed}, the code snippet is linked to the Google Gson API. State-of-the-art algorithm like Baker~\cite{Subramanian-LiveAPIDocumentation-ICSE2014} is not designed to link a code example to an API name mentioned in the textual contents of a forum post. For example, for the code snippet in Figure~\ref{fig:HowAPIsDiscussed}, Baker~\cite{Subramanian-LiveAPIDocumentation-ICSE2014} links it to three APIs (java.util, java.lang, and Google GSON). However, the code snippet is provided to explain the conversion of JSON data to JSON object using the GSON API, as mentioned in the textual contents. The code snippet also has the most number of API classes and methods matched with those found in the Gson API. Second, we produce a textual description of the underlying task addressed by the code snippet. The algorithm does this by picking sentences in the textual contents of the forum post where the code snippet is discussed and where the API linked to the code snippet is referred to. For example, in Figure~\ref{fig:HowAPIsDiscussed}, the following sentence is picked into (among others) the description, ``Google Gson supports generics and nested beans \ldots'', but not this sentence ``if you don't need object deserialization, \ldots you can try org.json''. The description is produced by combining beam search~\cite{Reddy-BeamSearch-CMU1977} with TextRank algorithm~\cite{Mihalcea-Textrank-EMNLP2004}. Third, we associate positive and negative opinions relevant to the code example by analyzing the comments to the post. The algorithm does this by looking for references in the comments to the API that is linked to the code snippet. For example, in Figure~\ref{fig:HowAPIsDiscussed}, all opinionated sentences from comment C1 and C2 are linked to the code snippet. Each algorithm shows a precision and recall of over 0.8 on multiple evaluation settings. Each algorithm outperforms the state-of-the-art baselines (e.g., Baker~\cite{Subramanian-LiveAPIDocumentation-ICSE2014}). For further details we refer to the paper~\cite{Uddin-MiningAPIUsageScenarios-IST2020}.} \subsection{Documentation Component}\label{sec:documentation-component} Given as input the mined usage scenarios of an API, we produce three types of documentation: two using our two proposed novel documentation algorithms (statistical, concept-based) and the third based on an adaption of Javadoc presentation format. We discuss the three documentation types below. \subsection*{Algorithm 1. Statistical Documentation}\label{sec:statistical-summary} We produce statistical documentation of the mined API usage scenarios to offer a visualized overview of the usage of an API based on the mined usage scenarios. This documentation thus can complement the front/introductory page of a API documentation by offering visualized statistics of the API usage. In addition, this type of documentation can also offer a quick overview of the underlying quality of the code example (described below). To complement the front page of API documentation, we produce three types of visualizations: \begin{enumerate} \item {Sentiment Overview.} The overall sentiments in the reactions to the usage scenarios of the API, and \item{Co-Used APIs.} The usage of other APIs in the same code examples of the API. \item {Co-Used API Types.} How the various types (e.g., classes) of an API are often used together. \end{enumerate} In addition, we provide an overview of the quality of each API usage scenario as follows: \begin{enumerate}[start=4] \item {Star Rating of API Usage Scenario.} Following previous research and adoption of 5-star ratings in online product reviews~\cite{Liu-SentimentAnalysisOpinionMining-MorganClaypool2012} and API review summarization~\cite{Uddin-OpinerReviewAlgo-ASE2017,Uddin-OpinerReviewToolDemo-ASE2017}, we show the overall rating of each API usage scenario by analyzing the positive and negative opinions related to a code example. \item {Star Rating of API Type.} The overall star-rating of an API type based on the usage scenarios of the API where the type was used. \end{enumerate} We describe the approaches below. \begin{inparaenum} \vspace{1mm}\noindent\item\ul{Sentiment Overview.} In our previous work on API review summarization~\cite{Uddin-OpinerReviewAlgo-ASE2017}, we observed that developers reported to have increased awareness about an API while seeing the visualized overview of the API reviews from developer forums. We thus offer two types of overview of the quality of all code examples of an API. The first is a simple pie chart by showing the overall counts of all the positive and negative reactions to the usage scenarios linked to an API. We do this aggregating all the positive and negative opinions across all the mined usage scenarios of an API. The second is a time-series of the aggregated sentiments. We do this as follows. \begin{inparaenum} \item We find the first and last month-year of creation dates among the usage scenarios of an API. The creation date of a usage scenario is the time when the post containing the usage scenario was created. \item For each month-year, we create two bins: positive and negative. The posiive bin contains the count of all positive opinions the posts created in that month-year received due to the code examples discussed in those posts and included in our API usage scenarios. \item We create two time-series one for positive and another for negative polarities. Each time-series chart has an X-axis as month-year and y-axis as the counts of positive/negative polarity for that month-year. \end{inparaenum} While the pie-chart offers overall sentiments of developers towards the usage scenarios of an API, the time-series chart shows how the sentiments changed over time. For example, an API may have high positive reviews when it was first created, but it started get more negative reviews over time due to obsolete code examples. \vspace{1mm}\noindent\item\ul{Co-Used APIs.} For a given API, we show how many other APIs were used in the code examples where the API was used. Because each API offers features focusing on specific development scenarios, such insights can be helpful to know which other APIs besides the given API a developer needs to learn to be able to properly utilize the API for an end-to-end development solution. We create a pie-based presentation as follows: \begin{inparaenum}[(a)] \item Identify all the other APIs discussed in the same code example. We did this by looking at imports and by matching the different types in the code example against all the APIs in the mention candidate lists associated with the code example. \item Take a distinct count of API for each example. Thus the bigger a pie in the chart, the more number of code examples were found where the two APIs were used together. \end{inparaenum} \vspace{1mm}\noindent\item\ul{Co-Used API Types.} For a given type (e.g., a class) of an API, we show how frequently other types of the same API were used together. We create a pie-chart that shows how frequently other types from the same API were co-used in the same code example where the given API type was used. \vspace{1mm}\noindent\item\ul{Star Rating of API Usage Scenario.} We compute the overall five star rating of a mined API usage scenario by taking into account all the positive and negative reactions towards the code example in the scenario. The computation is adopted from the star rating schemes we proposed previously~\cite{Uddin-OpinerReviewAlgo-ASE2017,Uddin-OpinerReviewToolDemo-ASE2017}. For every concept of an API, we collect all the positive and negative opinions and compute the star rating as: \begin{equation}\label{eq:star-rating} \textrm{Star Rating} = \frac{| Positives |\times 5 }{ | Positives | + | Negatives |} \end{equation} \vspace{1mm}\noindent\item\ul{Star Rating of API Type.} We compute the overall five star rating (using Equation~\ref{eq:star-rating}) of each type by taking into account all the positive and negative reactions towards the usage scenarios grouped under the type. \end{inparaenum} \subsection*{Algorithm 2. Concept Based Documentation}\label{sec:concept-summary} \rev{The input to the concept-based documentation algorithm is a list of all usage scenarios associated to an API. The output is a list of concepts, where each concept contains a list of API usage scenarios that are \textit{similar} to each other based on the development tasks implemented. We propose concept-based documentation to present the mined API usage scenarios by grouping the scenarios around conceptually similar tasks. A \textit{concept} in our documentation algorithm is a \textit{cluster} of API usage scenarios that offer \textit{similar} features or that are \textit{situationally relevant}. Two API usage scenarios are similar, if the code examples use the same API elements (e.g., classes) and they have similar inputs and outputs. For example, if two code examples using the GSON API offer conversion of JSON objects to Java objects, they have similar inputs (e.g., JSON object) and similar outputs (e.g., Java objects). As such, we cluster the two code examples into one concept. Two API usage scenarios are situationally relevant, if the code examples have similar inputs, but they produce different outputs and vice versa. For example, two code examples using the GSON are situationally relevant if both take as input a JSON object, but one offers conversion of the JSON object to Java objects and another to XML objects.} Given that the code examples in a concept should have similar inputs, the code examples should then use similar API elements. That means the code examples in a concept should exhibit similar usage pattern involving similar API elements. Therefore, given as input all the usage scenarios of an API, we first identify \textit{frequent itemsets} as types (e.g., classes) of an API that are found to be used frequently together. A set of code examples showing similar usage patterns can be similar, if they are clone of each other or if they conceptually relevant (e.g., similar input or similar output). Therefore, our approach has two major steps: \begin{enumerate} \item {Detect Usage Patterns.} We detect API types as itsemsets that are frequently used together in the scenarios. We assign usage scenarios to the patterns. \item {Detect Concepts.} We create clusters of API usage scenarios in the detected usage patterns that are similar to each other based on inputs and/or outputs. Each cluster is denoted as a `concept'. \end{enumerate} We provide visualized examples of the two steps in Figure~\ref{fig:concept-summary-example} and describe the steps below. \begin{figure*}[t] \centering \includegraphics[scale=.7]{images-tosem/concept-summary-algo} \hspace*{-2cm}% \caption{Examples on how usage patterns and concepts are detected in the concept-based documentation of an API} \label{fig:concept-summary-example} \end{figure*} \vspace{1mm}\noindent\ul{Step 1. Detect Usage Patterns.} Given that similar code examples in our concepts should use similar API elements, we first need to identify \textit{patterns} of API elements in the mined usage scenarios of an API that are frequently used together. To detect usage patterns, we use frequent itemset mining~\cite{Pasquier-FrequentClosedMining-ICDT1999}. Frequent itsemset mining has been used in summarizing product features~\cite{Hu-MiningSummarizingCustomerReviews-KDD2004} and to find useful usage patterns from software repositories~\cite{Bettenburg:2013:DSS:2486788.2486960,ZimmermannZeller-eRose-TSE2006a}. Using frequent itemset mining, we cluster code examples that use the same types of a given API, even that the code example can use more than one API. For example, if a code example is provided to convert JSON string to Java object using the GSON API, the JSON string can come from a file, from a web service, or from any source. The code example thus can show usage of the reading of the JSON string from those sources using APIs other than the GSON API. A clone detection technique may consider such code examples as not clones, because one code example may be using the java.util API to read a JSON string from a file while another may be using the HttpClient API to read the JSON string from web server. However, both code examples are using the same GSON API types. As such both will be clustered under a concept using our frequent itemset mining approach. In Figure~\ref{fig:concept-summary-example}, the left column shows examples of detecting usage patterns. The right column shows four of the code snippets (S1-S4) used in the examples of left column. All the code snippets in Figure~\ref{fig:concept-summary-example} are associated to the API Jackson for JSON parsing. Given as input all the mined API usage scenarios of an API, our pattern detection involves two steps: \begin{inparaenum} \item Collection of API types from the code examples, and \item Generation of frequent sets of API types. \end{inparaenum} First, for each code example linked to an API, we collect all the types (class, exception, annotation, etc.) found in the code example that belong to the API of our interest. For example, for the code snippet S1 in Figure~\ref{fig:concept-summary-example}, only one type (\mct{ObjectMapper}) is collected, because this is the only type from Jackson API in S1. For the code snippet S2, we find two types from Jackson API (\mct{ObjectMapper} and \mct{XmlMapper}). Similarly, given we focus on clustering types of given API, which is Jackson in Figure~\ref{fig:concept-summary-example}, we ignore types that come from other APis or that are local, such as Registration in S1, foo and String in S2, etc. Registration and foo are ignored, because those are local classes, i.e., those are not provided by the Jackson API. The class `String' is ignored, because it is provided by java.lang package. \rev{Please note that our linking of a code example to an API name mentioned in the forum text considers all the code elements from all APIs in a code example (method, class, interface, etc.), as we describe the linking algorithm in our paper~\cite{Uddin-MiningAPIUsageScenarios-IST2020}. While producing concepts by taking as input all code examples linked to an API, we focus on types (class, interface) of a given API in the code examples, because we focus on clustering code examples implementing similar features of the API and that previous studies find that API types are more informative than API methods to analyze API features~\cite{Dagenais-DeveloperLearningResources-PhDThesis2012}.} Second, we create a list of itemsets by collecting API types as explained above. Thus for eight code examples in Figure~\ref{fig:concept-summary-example} left column, we have eight itemsets. Second, we apply the Frequent Itemset Mining~\cite{Pasquier-FrequentClosedMining-ICDT1999} on the lists using the FPGrowth C implementation developed by Borget~\cite{Borgelt-FIM-Wiley2012}. The output is a list of frequent itemsets and a support value for each itemset. For example, the second frequent itemset in Figure~\ref{fig:concept-summary-example} (ID 2) is $\{T4,T5,T6\}$ with support 3 (because it is found in three code snippets S4, S6, S8). Each frequent itemset is considered as a pattern. For example, in Figure~\ref{fig:concept-summary-example} we have eight patterns that were found in at least two code examples. We assign a code snippet to a pattern by computing the similarity between a code snippet ($S$) and a pattern ($P$) as follows: \begin{equation} \textrm{Similarity} = \frac{|\textrm{Types}(S)\bigcap \textrm{Types}(P)|}{|\textrm{Types}(S)|} \end{equation} We assign a code example to the pattern with the highest similarity. For example, all the three code examples (S4, S6, S8) are assigned to the pattern $\{T4,T5,T6\}$ (ID 2) in Figure~\ref{fig:concept-summary-example}. If more than one pattern is found with the maximum similarity value, we assign the code snippet to the pattern with the maximum support. Therefore, the output of this step is a matrix $P\times S$, where $P$ stands for a usage pattern and $S$ stands for a set of usage scenarios assigned to the pattern. More than one API usage scenario can belong to one concept. For example, all the code examples related to the frequent itemsets (T4, T5), (T4,T6), and (T5,T6) will be grouped under the super itemset (T4,T5,T6) in Figure~\ref{fig:concept-summary-example}. We do this to ensure that a concept can contain all the different use cases (i.e., scenarios) that use the API types under the concept. \rev{The current implementation of concepts in our algorithm assigns each API usage scenario into one concept only, i.e., it is a `hard' assignment. Intuitively, an API usage scenario can be similar to API usage scenarios assigned to more than one concept, e.g., due to situational relevance. We leave the creation and analysis of such `soft' assignment of API usage scenarios into concept as our future work.} Given that all such relevant code examples are grouped under a concept, a developer in our produced API documentation would only need to look at one or two of the grouped API usage scenarios in the concept to get a concise but complete insight of the overall API usage addressed by the concept. Another way to produce such concepts would be to use closed frequent itemsets~\cite{Pasquier-FrequentClosedMining-ICDT1999}. However, closed frequent itemsets only return the super (i.e., closed) itemsets. Therefore, while our concept detection approach borrows ideas from closed frequent itemset to find super itemset, we leverage standard frequent itemset mining to also identify all the frequent itemsets under the closed itemset. The output from this step is a matrix of patterns vs mined API usage scenarios $P\times S$, where P stands for a pattern and S contains a list of code examples belonging to the pattern. The code examples in a pattern of an API contain a set of commonly co-used types of the API. \vspace{1mm}\noindent\ul{Step 2. Detect Concepts.} In this step, we further analyze the patterns identified in the previous step to determine whether two or more patterns could be connected with each other. Intuitively, a connection between two patterns can be established if code examples in the two patterns share similar inputs/outputs. For example, suppose one pattern contains code examples related to the establishment of an HTTP connection using the HttpClient API and another pattern contains code examples related to the sending/receiving or messages over an HTTP connection. The two patterns can be connected, because the output (i.e., an established HTTP connection) from pattern 1 (i.e., the code examples in pattern 1) is used as input in pattern 2. If we find such connected patterns, we group those patterns together into a concept. We detect concepts as follows. First, given all code examples under a pattern, we apply clone detection to find code examples that are similar to each other. This helps us create intermediate sub-groups of code examples in a pattern, where code examples in a sub-group are clones of each other. We then compare the inputs/outputs between two patterns by comparing the inputs/outputs in the sub-groups found in the two patterns. Thus the formation of sub-groups reduces the number of analysis (of inputs/outputs) between patterns. This step is important, because otherwise we will be left with an exponential combination of multiple patterns to analyze. For clone detection, we use NiCad~\cite{CKRoy-Nicad-ICPC2008}, which is a widely used state of the art clone detection tool in software engineering literature. Specifically, we use NiCad 3, which detects near-miss clones\footnote{Following~\cite{Svajlenko-EvaluatingCloneDetectionTools-ICSME2014}, we set a minimum of 60\% similarity and a minimum block size of five lines in the code example. }. We detect inputs to a code example by analyzing the inputs taken by methods in the code example, where the inputs are generated by another method in the code example. We detect outputs from a code example as the outputs from the methods, where the outputs are not fed into other method(s) in the same code example. As a demonstration of the above process, consider Figure~\ref{fig:concept-summary-example} right column: The first code snippet (S1) belongs to pattern with ID 1 (left column) and the second code snippet (S2) belongs to pattern with ID 7 (left column). S1 uses one type of API Jackson (\mct{ObjectMapper}), S2 uses both \mct{ObjectMapper} and \mct{XmlMapper}. Both code snippets use the \mct{readValue} method of the \mct{ObjectMapper} to convert a JSON string into a Java class. Code snippet S2 further attempts to produce an XML string out of the generated Java class. It does that by using the \mct{XmlMapper} class of the same Jackson API and by taking as input the generated Java class from \mct{ObjectMapper}. Therefore, we say Patterns 1 and 7 are situationally relevant, because Pattern 1 always needs to be executed before Pattern 7 above. To ensure that we establish the relationship between patterns correctly, we employ program slicing. For example, the third code snippet (S3) in Figure~\ref{fig:concept-summary-example} right column belongs to pattern with ID 3. S3 also uses the \mct{ObjectMapper} class of the Jackson API. However, S3 does not use the \mct{readValue} method of \mct{ObjectMapper}. Instead S3 creates a string out of a \mct{httpresponse} and assigns that to another class of the Jackson API (\mct{ObjectWriter}) for pretty printing. We thus do not create an edge between Pattern 1 and Pattern 8. Similarly, all the code examples (S4, S6, S8) belong to another concept. Once a set of patterns are grouped together into a concept, we assign a numeric ID to the concept. The output of this step is a matrix $C\times S$, where $C$ stands for a concept and $S$ denotes a list of API usage scenarios assigned to the concept. In Opiner web site, we present each concept as a list of four items: \{$R, S, O, T$\}. Here $R$ corresponds to a scenario determined as representative of all the usage scenarios belonging to the concept (discussed below). $S$ corresponds to the rest of the usage scenarios in the bucket that we wrap under a `See Also' sub-list. $O$ is the overall star rating for the bucket (discussed below). $T$ is the title of the concept. We describe the fields below. \begin{enumerate \item {Representative Scenario (R).} We pick the most recent scenario as the most representative. This decision is based on previous findings of 178 developers from SO and GitHub~\cite{Uddin-SurveyOpinion-TSE2019} that developers give a code example more value that is more recent (based on the post creation time). One major reason for this is that APIs undergo rapid version changes. As such the code examples that are provided even six months ago can be obsolete/less useful for the newer version of the API. The ranking of API usage scenarios using other metrics (e.g., scores) or a combination of scores and recency could be some other alternatives, which we leave for future work. \item {Concept Title (T).} We assign to the concept the title of the most representative usage scenario. \item {See Also (S).} We put the rest of the usage scenarios in the concept in a `See Also' bucket. \item {Concept Star Rating (O).} We compute the overall five star rating of the concept by taking into account all the positive and negative reactions towards the usage scenarios. For every concept of an API, we collect all the positive and negative opinions from all of its scenarios, and compute the star rating using Equation~\ref{eq:star-rating}. \end{enumerate} \subsection*{Javadoc Adaptation. Type-Based Documentation} \label{sec:type-summary} We generate the type-based documentation of an API by grouping the scenarios of the API based on the API type as follows. \begin{inparaenum} \item We identify all the types in a code example associated with the API \item We create a bucket for each type and put each code example in the bucket where the type was found. We present this bucket as a sorted list by time (most recent as the topmost). \end{inparaenum} Our type-based documentation approach is similar to Baker~\cite{Subramanian-LiveAPIDocumentation-ICSE2014}, who proposed to annotate the Javadoc of an API class using all the code examples in SO where the API class was found. For example, based on Figure~\ref{fig:HowAPIsDiscussed}, the code example will be put under two classes of the Google GSON API (Gson and TypeToken), one class under java.util API (List) and one class under java.lang API (Type). The class `Data' is ignored, because it is a locally declared class in the code example. \subsection{Opiner Architecture to Support the API Documentation Algorithms}\label{subsec:generate-deploy-opiner} We implemented the API usage scenario documentation algorithms by extending Opiner~\cite{Uddin-OpinerReviewAlgo-ASE2017}. We focused on following two requirements during the extension: \begin{enumerate} \item Scalability. The Opiner's system should be able to process millions of posts from developer forums. \item Efficiency. The processing should be completed in short time, ideally in hours. \end{enumerate} \begin{figure} \vspace{-2mm} \centering \includegraphics[scale=0.73]{images-tosem/opiner-system-arch4} \vspace{-5mm} \caption{The system architecture in Opiner to support the proposed API usage scenario documentation algorithms} \label{fig:opiner-arch} \vspace{-5mm} \end{figure} The Opiner's system architecture is able to process millions of posts. The proposed documentation algorithms are supported in Opiner by four major components (see Figure~\ref{fig:opiner-arch}): \begin{enumerate \item {Database:} A hybrid data storage component to manipulate data in diverse formats. \item {Application Engine:} Handles the loading and processing of the data from forum posts and hosts all the algorithms to mine and summarize usage scenarios about APIs. \item {REST Web Server:} The middleware between the Application Engine and the Website that supports two types of REST APIs: \begin{inparaenum} \item Search. to find an API with auto-completion support. \item Documentation. provides the documentation and visualization produced by the three algorithms. \end{inparaenum} \item {Website:} The web-based user interface to host the search and documentation results for API usage scenarios. \end{enumerate} The decoupling of the `Application Engine' from other components allows it to run independently of the website. Thus the `Application Engine' can run offline, even when the Website is being used. The `Application Engine' is designed to load and preprocess each SO thread in parallel. The documentation algorithms are applied on the preprocessed post contents. Our profiling of the `Application Engine' shows that the preprocessing of the contents takes almost 80\% of all the time. This is because this step handles the creation of the meta information of posts based on preprocessing, such as the parsing of code snippets, the linking of code snippets to the API mentions, for examples. The documentation component takes less than 10\% of the time. Therefore, once API usage scenarios are mined and properly preprocessed, the generation of the documentation using the proposed algorithms should take minimal time in Opiner. \subsection{API Usage Scenario Documentation in Opiner Web Site}\label{sec:documentation-opiner} We applied the algorithms on a dataset consists of 3,048 threads from SO that contain a total of 22.7K posts (question+answer+comment). The Opiner online web-site currently indexes the mined and documented usage scenarios of the APIs found in this dataset. The threads in the dataset are tagged as `Java+JSON', i.e., the posts discussed about JSON-based tasks using Java APIs. This dataset was previously used in \cite{Uddin-OpinerReviewAlgo-ASE2017} to summarize reviews about APIs and was found to offer a rich set of competing APIs with diverse API usage discussions. As such, we expect to see code examples discussing about Java APIs for JSON parsing in the posts. This dataset contains numerous usage scenarios from multiple competing APIs to support JSON-based manipulation in Java (e.g., REST-based architectures, microservices, etc.). JSON-based techniques can be used to support diverse development scenarios, such as, serialization of disk-based and networked files, lightweight communication between server and clients and among interconnected software modules, messaging format over HTTP as a replacement of XML, in encryption techniques, and on-the-fly conversion of Language-based objects to JSON formats, etc. We parsed the dataset to collect all the code examples. There are 8,596 \textit{valid} code snippets (e.g., Java code) and 4,826 invalid code snippets (e.g., XML block). In Table~\ref{tbl:datasets-overview} we show descriptive statistics of the dataset. A total of around 15K API names are mentioned in the textual contents of the posts. On average, each valid snippet contained at least 7.9 lines. The last column ``Users'' in Table~\ref{tbl:datasets-overview} shows the total number of distinct users that posted at least one answer/comment/question. On average, around four users participated in one thread. More than one user participated in 2,940 threads (96.4\%). A maximum of 56 distinct users participated in one thread~\cite{website:stackoverflow-338586}. \begin{table}[t] \caption{Descriptive statistics of the dataset used to produce API documentation in Opiner website} \centering \begin{tabular}{rr|rr|rr|r|r}\toprule \textbf{Threads} & \textbf{Posts} & \textbf{Sentences} & \textbf{Words} & \textbf{Snippet} & \textbf{Lines} & \textbf{APIs Mentioned in Texts} & \textbf{Users}\\ \midrule 3,048 & 22.7K & 87K & 1.08M & 8,596 & 68.2K & 15,605 & 7.5K\\ \midrule \textbf{Average} & 7.5 & 28.6 & 353.3 & 2.8 & 7.9 & 5.1 & 3.9\\ \bottomrule \end{tabular} \label{tbl:datasets-overview} \end{table} \begin{table}[t] \centering \caption{Distribution of Code Snippets By APIs} \begin{tabular}{rrrr|rrrr}\toprule \multicolumn{4}{c}{\textbf{Overall}} & \multicolumn{4}{c}{\textbf{Top 5}} \\ \midrule {\textbf{API}} & {\textbf{Snippet}} & {\textbf{Avg}} & {\textbf{STD}} & {\textbf{Snippet}} & {\textbf{Avg}} & {\textbf{Max}} & {\textbf{Min}} \\ \midrule 175 & 8,596 & 49.1 & 502.7 & 5,196 & 1,039.2 & 1,951 & 88 \\ \bottomrule \end{tabular}% \label{tbl:api-resolution-overview}% \end{table}% \begin{table}[t] \centering \caption{Distribution of Reviews in Scenarios with at least one reaction} \begin{tabular}{lrr|rr|rr}\toprule \textbf{Scenarios} & \multicolumn{2}{c}{\textbf{Comments}} & \multicolumn{2}{c}{\textbf{Positive}} & \multicolumn{2}{c}{\textbf{Negative}} \\%& \multicolumn{2}{c}{\textbf{Neutral}} \\ \midrule \textbf{w/Reviews} & {\textbf{Total}} & {\textbf{Avg}} &{\textbf{Total}} & {\textbf{Avg}} & \multicolumn{1}{l}{\textbf{Total}} & \multicolumn{1}{l}{\textbf{Avg}} \\%& \multicolumn{1}{l}{\textbf{Total}} & \multicolumn{1}{l}{\textbf{Avg}} \\ \midrule 1,154 & 7,538 & 6.5 & 2,487 & 2.2 & 1,216 & 1.1 \\%& 3835 & 3.3 \\ \bottomrule \end{tabular}% \label{tab:api-comment-overview}% \end{table}% The 8,596 code examples are associated with 175 distinct APIs using the code example to API mention linking algorithm from Section~\ref{sec:mining-component}. Table~\ref{tbl:api-resolution-overview} presents the distribution of the APIs by the code examples. The majority (60\%) of the code examples were associated to five APIs for parsing JSON-based files and texts in Java: java.util, org.json, Google Gson, Jackson, and java.io. Some API types are more widely used in the code examples than others. For example, the \mct{Gson} class from Google Gson API was found in 679 code examples out of the 1,053 code examples linked to the API (i.e., 64.5\%). Similarly, the \mct{JSONObject} class from the org.json API was found in 1,324 of 1,498 code examples linked to the API (i.e., 88.3\%). Most of those code examples also contained other types of the APIs. Therefore, if we follow the documentation approach of Baker~\cite{Subramanian-LiveAPIDocumentation-ICSE2014}, we would have at least 1,324 code examples linked to the Javadoc of \mct{JSONObject} for the API org.json. This is based on the parsing of our 3,048 SO threads. Among the API usage scenarios in our study dataset, we found 1,154 scenarios contained at least one review using our proposed algorithm to associate reviews to an API usage scenario. In Table~\ref{tab:api-comment-overview}, we show the distributions of comments and reviews in the 1,154 scenarios. There are a total of 7,538 comments found in the corresponding posts of those scenarios, out of which 2,487 are sentences with positive polarity and 1,216 are sentences with negative polarity. \section{Conclusions}\label{sec:summary} The rapid growth of online developer forum posts encourages developers to harness the knowledge of the crowd in their daily development activities. The enormous volume of such insights distilled into the API code examples presents challenges to the developers to gain quick and actionable insights into the usage of an API. In this paper, we propose two novel algorithms to automatically produce API documentation from SO: Statistical and Concept-based. Each algorithm takes as input a list of mined API usage scenarios from SO. Statistical algorithm produces visualized metrics, while concept-based algorithm clusters conceptually relevant code examples. An API usage scenario consists of a code example, a textual task description, and the reviews towards the code example. A review is an opinionated sentence with positive or negative sentiments. In three user studies involving Opiner, we observed that: \begin{enumerate} \item The two proposed algorithms, Statistical and Concept-based Documentation are preferred over a traditional Javadoc styled Type-based documentation by the study participants across all the four development scenarios. \item Developers spent the least time and effort while coding solutions to development tasks using Opiner compared to formal and informal documentation. Moreover, the accuracy of their solutions is highest using Opiner. \item More than 80\% of developers considered that Opiner offer improvements over both formal and informal API documentation, and wished to use Opiner in their daily or weekly development activities. \end{enumerate} The findings from our study can guide \begin{inparaenum} \item \textit{API Authors and Documentation Writers} to improve the official documentation of their APIs, \item \textit{Software Developers} by offering them a new and potentially better API documentation format than traditional Javadocs, and \item \textit{Researchers} to study new ways of documenting API usage scenarios from developer forums. \end{inparaenum} Our future work focuses on the better understanding of the interplay between comments and answers. In particular, we analyze how we can better support API documentation by automatically incorporating insights from comments. For example, comments can be useful to know whether a code example is applicable to a given API version or whether the code has any other compatibility or buggy issues. Currently, we simply show all comments towards a code example by grouping the sentences from the comments into three polarity classes: sentences containing positive, negative or neutral sentiments. In addition, we can determine whether suggestions from comments are already incorporated into the answers. This can be checked by comparing the different suggested and approved edits to an answer and whether such edits were made after a constructive comment was provided. With such intelligent analyses, we can then reduce the number of comments that are already addressed. In addition, we will focus on the following areas: \begin{inparaenum}[(1)] \item Automatic mining and documentation of usage scenarios from multiple developer forums, \item Addition of improved search capabilities to facilitate the discovery of usage summaries in Opiner, and \item Incorporation of a continuous feedback learner in the Opiner documentation engine that can automatically learn from users feedback to improve the documentation. \end{inparaenum} \section{Threats to Validity}\label{sec:threats} We discuss the threats to validity of our studies following common guidelines for empirical studies~\cite{Woh00}. \textbf{Construct Validity Threats} concern the relation between theory and observations. In our study, they could be due to measurement errors. We assessed the correctness of a provided solution to a coding task by comparing the coverage of the API elements (types and methods) found in the solutions against those as expected in a correct solution to the task. This approach is adopted from our previous analysis of API usage concepts in API official documentation~\cite{Uddin-TemporalApiUsage-ICSE2012}. This approach allows us to measure the accuracy with a reproducible technique (i.e., using Equation~\ref{eq:correctness}). In particular, this approach is required to avoid the \textit{Instrumentation} threat which arises when the measurement of the dependent variable (e.g., correctness in our study) varies between the different groups of participants. We note, however, that a solution with all the expected API elements may still not be fully correct, when they are not used properly (e.g., when the inputs are not set properly). We did not observe any such cases in the provided solutions. The accuracy of the algorithms to mine API usage scenarios can have an impact on our produced documentation. In~\cite{Uddin-MiningAPIUsageScenarios-IST2020}, we report the performance of the algorithm. Each algorithm shows more than 80-90\% precision and recall. The algorithms outperformed eight state of the art baselines (see our published paper~\cite{Uddin-MiningAPIUsageScenarios-IST2020}). We use clone detection during the identification of concepts in our proposed algorithm, Concept-based documentation. To detect clones, we applied a 60\% similarity. Svajlenko et al.~\cite{Svajlenko-EvaluatingCloneDetectionTools-ICSME2014} proposed this threshold to detect clones in big dataset, such as our dataset of more than 8K code examples. Given that the Concept-based documentation in Opiner is the most positively reviewed by the developers in our user study, the real-world application of the concepts shows promise. Further investigation of the clones may provide additional benefits, which we leave as future work. \rev{The atomic unit of analysis in our two proposed algorithms is an API usage scenario, which consists of a code example of an API, a textual description, and reviews towards the code example as found in the comments to the answer where the code example is found. Our user studies show that the study participants appreciated the reviews towards the code example and found those useful. However, research results show that not all comments can be insightful or informative~\cite{Zhang-ReadingAnswerSONotEnough-TSE2019}, such as comments those are upvoted by others and comments that are not disputed by others. Further improvements to our API documentation generation algorithms will focus on determining and showing informative comments. Nevertheless, the creation of our API usage scenarios benefits from reviews from comments because the reviews are useful to provide contextual information with regards to the usage of APIs. However, not all answers have many comments, i.e., in our dataset we could not add reviews to each API usage scenario. While we did not limit our study participants to only API usage scenarios with reviews, the experience of our study participants with more comments per usage scenarios could have been different and that could have influenced them to give even more preference to Opiner. Future extension of Opiner can be developed to monitor real-time any new comments posted against an answer and to collect comments from other answers that are similar to an answer.} \rev{Currently, we simply show all comments towards a code example by grouping the sentences from the comments into three polarity classes: sentences containing positive, negative, or neutral sentiments. However, some comments may already have been addressed into the provided example and thus may have become obsolete and/or misleading. Future extensions will compare the answer editing history to determine whether and how a comment is already addressed before we decide to include it in our API usage scenario.} \rev{Currently, an API usage scenario is assigned to one concept only in our proposed concept-based documentation algorithm (see Section~\ref{sec:documentation-component}). Intuitively, an API usage scenario can be linked to multiple concepts due to situational relevance between tasks that are addressed in two different concepts (i.e., soft assignment of API usage scenarios by allowing them to be included in multiple concepts). The concept-based documentation was the most favored by our study participants. An extension of the concept-based documentation with `soft' assignment of API usage scenarios) may make the concept-based documentation more useful to the developers. We leave it as our future work.} \textbf{Maturation Threats} concern about the changes in a participant during the study due to the \textit{passage of time}, such as development environment changes, hunger, fatigue, etc. To mitigate the effect of fatigue, we asked participants to take breaks between the tasks. We also used TLX to measure the effort of participants. TLX is by its nature subjective. However, it is a mature tool that has been used in multiple empirical studies, e.g.,~\cite{Abbes11}. In addition, we discarded the reported times by the participants in their coding tasks that are most likely wrong, e.g., task completion time taking more than 24 hours (see Section~\ref{sec:evaluation}). \textbf{Internal Validity Threats} compromise the confidence in attributing the relationship between the dependent and independent variables. The dependent variables in our coding tasks are the three metrics (correctness, time and effort). The independent variables are the ratings of the participants about Opiner and the baselines (e.g., the API documentation). In particular \emph{Internal validity threats} relevant in this study are learning, selection, and diffusion threats. \textit{Learning/History threats} do not affect our study since we used a between-subject design, which is a recommended approach in controlled study to avoid such bias in the study~\cite{Woh00}. We followed standard practices of between-subject studies in empirical software engineering~\cite{Abbes11}: Each participant performed different tasks in different settings. The tasks are formulated in a way so that the learning from one task cannot be transferred to another task, even when the participants are using different APIs to complete the tasks (see Description column in Table~\ref{tbl:coding-tasks}). For example, the input to each task is different from each other. For the task involving Jackson (TJ) it is a Java object, for Gson it is a JSON string, for XStream it is an XML string, and for Spring it is a JSON response coming from the web server. Each task focused on the distinct features offered by the APIs that distinguish the APIs from each other. Therefore, the requirements with the inputs are also different: for Jackson the participant needs to use Jackson annotation feature to convert the Java object. For Gson, the participant needs to handle unknown types in the input dynamically. For XStream the participant needs to convert the input fields names to something custom using the aliasing feature specifically provided by the XStream API. For Spring, the participant needs to adhere to the specific encoding as specified in the JSON response. \textit{Diffusion threats} do not impact our study because our participants did not know each other, and therefore could not discuss about the experiments. \rev{\textit{Selection threat} could arise if the participants were biased towards a specific tool. The participants from our coding tasks were asked to compare Opiner with the baselines, after completion of their coding tasks. While 87\% of the participants showed interest to use Opiner, almost half of them responded with a `yes' and the other half with a `maybe'. The participants who responded with a `maybe' cited their lack of familiarity with Opiner, given the tool was introduced to them right before the coding tasks. In contrast, these developers were quite familiar with other resources (i.e., baselines), such as SO, official documentation and search engines. Several participants mentioned that they would prefer SO over Opiner, because they are already familiar with SO. However, we did not observe any bias towards SO or Opiner from the participants during their completion of coding tasks. In fact, despite the lack of familiarity with Opiner, the participants completed the coding tasks with the highest accuracy while using Opiner.} \textbf{External Validity Threats} compromise the confidence in stating whether the study results are applicable to other groups. Due to the diversity of the domains where APIs can be used and developed, the generalizability of the approach requires careful assessment. While the current implementation of the approach applies for Java APIs, the evaluation corpus consists of the APIs discussed in the SO threads tagged as `Java+JSON'. We used this same dataset previously to mine and summarize reviews about APIs~\cite{Uddin-OpinerReviewAlgo-ASE2017,Uddin-OpinionValue-TSE2019,Uddin-OpinerReviewToolDemo-ASE2017}. We observed that the dataset offers diverse perspectives about many competing APIs. To evaluate the effectiveness of the API documentation in Opiner, we selected four coding tasks, each of which required the consultation of two SO posts. This decision is based on previous research findings that developers often need to consult diverse resources to complete a coding task using an API~\cite{Ekwa-StudyUnfamiliarAPIs-ICSE2012}. In our previous research, we also found that developers often use a set of usage scenarios of an API in a sequence~\cite{Uddin-TemporalApiUsage-ICSE2012}. For example, we found that developers using the HttpClient API first established an HTTP connection, before sending/receiving messages over the HTTP connection. Such sequences of API usage scenarios are often not found together in SO posts. Our focus in the coding tasks was to mimic real-world development scenarios. However, it may happen that a SO post may still contain a complete sequence of API usage scenarios. We leave the evaluation of Opiner against such usage examples from SO as future work. In summary, while our assessment of Opiner shows promising signs in this new research direction, the results will not carry the automatic implication that the same results can be expected in general. Transposing the results to other domains requires an in-depth analysis of the diverse nature of challenges and characteristics each domain and resources can present.
\section{Introduction} \label{sec:intro} The creation of heavy elements poses a number of open and interesting questions going from a small scales to the largest scales including formation of stars or even galaxies. Recent studies of Milky Way (MW) halo stars have shown that stars rich in neutron-capture elements may have originated in now dissolved (ultra faint) dwarf galaxies \citep{Roederer2018b}. Limited to smaller sample sizes, the results seem to indicate that stars with the strongest rapid neutron-capture process (r-process) enhancement have formed ex situ and later been accreted into the MW. This makes dwarf galaxies excellent study cases for understanding the r-process. Fornax (Fnx) is one of the most massive dwarf spheriodals (dSph) in the Local Group (LG). It shows a unique star formation history with a sudden increase of star formation only $\sim4$\,Gyr ago \citep{deBoer2012, Lemasle2014,Hendricks2014,Weisz2014,Rusakov2021}. Furthermore, Fornax might currently have gas left, however, this is still under debate \citep{Bouchard2006}. All dwarf galaxies show individual trades and chemical imprints \citep{Grebel1997,Tolstoy2009}. Here we present three Fornax stars with extreme high Eu abundances (rII stars, [Eu/Fe]\footnote{$\mathrm{[Eu/Fe]} = \log \left( N_\mathrm{Eu} / N_\mathrm{Fe} \right)-\log \left( N_\mathrm{Eu} / N_\mathrm{Fe} \right)_\odot$, with the number of europium and iron atoms per cm$^3$, $N_\mathrm{Eu}$ and $N_\mathrm{Fe}$.}$>1$, \citealt{Beers2005}) at high metallicities. Moreover, we report a large study of the neutron-capture element Zr in the dSph Fornax. Our study presents the first detection of the heavy element Lu in a dSph. In contrast to most r-process enriched stars, typically found at low-metallicities ([Fe/H]$\sim -2$), the three Eu-stars in Fornax are relatively metal-rich ([Fe/H]$\sim -1$). Hence, we use them to understand the astrophysical source of the r-process by comparing to various yield predictions. Stars with peculiar enhanced r-process abundances have rarely been observed at these high metallicities. Most of them are clearly members of a dSph galaxy, e.g., Ursa Minor (Cos 82, \citealt{Shetrone2001,Aoki2007,Sadakane2004} or Sculptor, SCMS 982, \citealt{Geisler2005,Skuladottir2020b}). We note that there are also neutron-capture enhanced stars at similar metallicities reported already by \citet{Letarte2010} in Fornax, which were not found in \citet{Letarte2018} and \citet{Reichert2020}. Also MW field stars, for example, 2MASS 18174532-3353235 \citep{Johnson2013} a possible bulge contender, shows a high neutron-capture enhancement at a high metallicity. Moreover, some halo stars show similar abundance enhancements and are thought to be accreted into the MW halo, as indicated by a low $[\alpha/\mathrm{Fe}]$ ratio (J1124+4535, \citealt{Xing2019}), while for others, their origin is, however, not so clear. Also HD 222925 is r-rich and located in the halo, but due to its highly eccentric and retrograde orbit it has been suggested to be accreted from a satellite galaxy \citep{Roederer2018b}. By looking at the alpha-abundances and fitting a knee to the stellar population, the dSph mass can be assessed. Following the fit of the $\alpha$-knee of \citet[][Eq.~6]{Reichert2020}, the host environment of this star must have at least the size of Sagittarius or Fornax and an accretion scenario may therefore be possible \citep[see also][for a discussion on the origin of HD 222925]{Roederer2018}. The astrophysical sites of the r-process are still under discussion, even if recent kilonova \citep{Abbott2017,Watson2019} has shown that neutron star mergers (NSM) can produce heavy elements. Galactic chemical evolution (GCE) models \citep[e.g.,][]{Matteucci2014, Cote2019, Kobayashi2020} suggest that an additional site may be active in our galaxy. An exciting possibility are magneto-rotational supernovae \citep[MR-SNe;][]{Winteler2012,Nishimura2015, Nishimura2017, Moesta2018, Reichert2021}. Stars at intermediate metallicities are highly mixed and remain poorly studied in the GCE scheme. Also collapsars \citep{Siegel2019, Miller2019, Just2021} have been discussed as a potential site. Our results indicate that both sites, NSM and MR-SNe, can explain the Eu-stars and probe a late star formation burst in Fornax. This paper is organised as follows. In Sect.~\ref{sec:obs}, we present the observations, sample, and stellar parameters. The abundances are shown in Sect.~\ref{sec:ab} including the largest Zr sample in a dwarf galaxy and heavy neutron-capture elements with focus on Eu and the first Lu detection in a dwarf galaxy. In Sect.~\ref{sec:origin}, we discuss in detail the possible origin of the Eu-stars, which is associated with one r-process event and requires late star formation. Finally, we conclude in Sect.~\ref{sec:conclusions}. \section{Observations, sample, and stellar parameters} \label{sec:obs} \subsection{Observations} We present four Fornax stars including three with anomalous high Eu ($1.25\le \mathrm{[Eu/Fe]} \le 1.45$). The quality of the available observations allows for an accurate and precise determination of abundances (typically to within $\pm0.2$\,dex). The stars were observed at high and low resolution with FLAMES/GIRAFFE \citep{FLAMES} with the setups HR10, HR13, HR14, and LR8 (see Table~\ref{tab:grating}). The LR8 setup \citep{Battaglia2006} is used here only for radial velocity determinations. We use reduced spectra from the ESO archive\footnote{https://archive.eso.org/wdb/wdb/adp/phase3\_main/form} and perform the data processing (sky correction, radial velocity shifts, co-adding, and normalisation of the spectra) as in \citet{Reichert2020}. \begin{center} \begin{table} \caption{Different FLAMES/GIRAFFE setups showing minimum and maximum wavelength coverage and resolving power ($R$).} \label{tab:grating} \begin{tabular}{l c c c } \hline\hline Grating & $\lambda_{min} [\mathrm{\AA}]$& $\lambda_{max} [\mathrm{\AA}]$ & $R$ \\ \hline HR10 & 5339 & 5619 & 19800 \\ HR13 & 6120 & 6405 & 22500 \\ HR14 & 6308 & 6701 & 17740 \\ LR8 & 8206 & 9400 & 6500 \\ \hline \end{tabular} \end{table} \end{center} \subsection{Sample} \label{sec:sample} \begin{figure}[h] \centering \includegraphics[width=\hsize]{location.pdf} \caption{Coordinates of sample stars together with pointings of \citet{Battaglia2006}, \citet{Lemasle2014}, \citet{Hendricks2014}, \citet{Letarte2010}, and \citet{Kirby2010}. The large oval shows the nominal tidal radius and the small dashed oval the core radius \citep{Battaglia2006}. The black cross marks the center of the galaxy as given by \citet{Battaglia2006}. The grey 2D histogram shows the amount of stars observed by \textit{Gaia} \citep[DR2,][]{Gaia2018,Gaia_vizier2018}. Cyan crosses indicate the globular clusters of Fornax \citep{Mackey2003}.} \label{fig:location} \end{figure} Our sample consists of Fornax stars from \citealt{Reichert2020} who analysed $380$ stars in dSph galaxies. The stars have been extracted from the reduced ESO and KOA archives. More specifically, we assigned a star membership if its coordinates agree within a circle of three arcsec with the coordinates in the SIMBAD \citep{Simbad}, NED \citep{Mazzarella2007}, or the second {\it Gaia} data release \citep[DR2,][]{Gaia2018,Gaia_vizier2018}. Therefore, the three Eu-enhanced stars are clearly members of Fornax as previous studies have already assigned them Fornax membership based on radial velocities, and distance to the centre of Fornax \citep[see Fig.~\ref{fig:location} and ][]{Battaglia2006,Lemasle2014}. Also the proper motions of \textit{Gaia} \citep[DR2,][]{Gaia2018,Gaia_vizier2018} indicate their membership (see Table~\ref{tab:prop_motions}). \begin{table}[h] \caption{Proper motions in right ascension direction $\mu _\delta$, and in declination direction $\mu _\alpha \cos \delta$ taken from \textit{Gaia} \citep[DR2,][]{Gaia2018,Gaia_vizier2018}. Furthermore, we list the mean values of Fornax \citep{McConnachie2020}.} \label{tab:prop_motions} \centering \begin{tabular}{l c c } \hline\hline Object & $\mu _\delta$ [$\mathrm{mas \, yr^{-1}}$]& $\mu _\alpha \cos \delta$ [$\mathrm{mas \, yr^{-1}}$] \\ \hline Fnx-mem0546 & $0.088 \pm 0.145$ & $ -0.199 \pm 0.210$ \\ Fnx-mem0556 & $0.400 \pm 0.148$ & $-0.775 \pm 0.203$ \\ Fnx-mem0595 & $0.344 \pm 0.120$ & $-0.237 \pm 0.167$ \\ Fornax (mean) & $0.038 \pm 0.003$ & $-0.416 \pm 0.004$ \\ \hline \end{tabular} \end{table} The [$\alpha$/Fe] ratio of the stars also fits with the general trend of Fornax (Fig.~\ref{fig:mg_evolution}) and similar to many other r-process enriched metal-rich stars, a clear contribution from type Ia SNe is visible. \begin{figure}[h] \centering \includegraphics[width=\hsize]{mgfe.pdf} \caption{[Mg/Fe] versus metallicity is shown for the four Fornax stars that we investigate here \cite[see also][]{Reichert2020}: Fnx-mem0607 (red star), Fnx-mem0595 (yellow square), Fnx-mem0546 (yellow diamond), and Fnx-mem0556 (yellow circle). For comparison we show other Fornax stars \citep[green stars, ][]{Reichert2020} and MW stars \cite[grey dots, ][]{Reddy2003, Cayrel2004, Reddy2006, Ishigaki2013, Fulbright2000, Nissen1997, Prochaska2000, Stephens2002, Ivans2003, McWilliam1995, Ryan1996, Gratton1988, Edvardsson1993, Roederer2016, Ezzeddine2020}. Moreover, we compare to other typical r-process enhanced stars: Cos 82 \citep[blue diamond,][]{Shetrone2001}, SCMS 982 \citep[black diamond,][]{Geisler2005}, HD 222925 \citep[magenta diamond,][]{Roederer2018}, J1124+4535 \citep[blue diamond,][]{Xing2019}, and Reticulum II \citep[teal diamonds,][]{Ji2016b}. In all following figures we keep the same symbols and colors for the various stars. } \label{fig:mg_evolution} \end{figure} \subsection{Stellar parameters} The stars were previously analysed by \citet{Lemasle2014}, \citet{Reichert2020}, and \citet{Battaglia2006}. Table~\ref{tab:stel_pars} shows their determined effective temperature, surface gravity, and metallicity (for \citealt{Battaglia2006} the metalicities are from the calcium triplet). We note that the star Fnx-mem0546 was excluded from \citet{Lemasle2014} due to convergence problems when determining the stellar parameters. Here, we adopt stellar parameters from \citet{Reichert2020}. The effective temperatures and metallicities were derived using the automatic code SP\_Ace \citep{Boeche2016} which fits a theoretically calculated spectrum to the observed spectrum of the star until convergence is reached. The theoretical spectrum is constructed by using a previously calculated curve of growth library. We note that the metallicity is therefore also biased by the LTE assumptions. \newline The surface gravities were derived using: \begin{align} \log g_* = \log g_{\odot} +\log \frac{M_*}{M_\odot} + 4\, \log \frac{T_{\text{eff},*}}{T_{\text{eff},\odot}}\\ +0.4\left( M_{\text{bol},*} - M_{\text{bol},\odot} \right), \nonumber \end{align} with $\log g_{\odot}=4.44$, $T_{\text{eff},\odot}=5780\, \rm K$, $M_*=0.8\pm 0.2 M_\odot$ and $M_{\text{bol},\odot}=4.72\, \rm mag$, and the distance to Fornax of $147\pm8 $\, kpc taken from \citealt{Karczmarek2017}). \newline The microturbulence was calculated with an empirical relation from \citet{Kirby2010}: \begin{equation} \xi _\mathrm{t} = ((2.13\pm 0.05) - (0.23\pm 0.03)\cdot \log g) \, \rm km \, s^{-1}. \end{equation} In general, effective temperatures in \citet{Reichert2020} are hotter than in \citet{Lemasle2014} because of the different methods in deriving them (spectroscopic versus photometric, see Appendix~B of \citealt{Reichert2020} for a more detailed discussion). However, we stress that the strong neutron-capture element enhancement is also present when using the stellar parameters of \citet{Lemasle2014}, hence the choice of stellar parameters does not change our conclusions. \begin{table*} \caption{Stellar parameters from different studies} \label{tab:stel_pars} \centering \begin{tabular}{c c c c c c c c} \hline\hline & \multicolumn{3}{c}{\citet{Reichert2020}} & \multicolumn{3}{c}{\citet{Lemasle2014}} & \citet{Battaglia2006}\\ Identifier & $T_\mathrm{eff}$ & $\log g$ & [Fe/H] & $T_\mathrm{eff}$ & $\log g$ & [Fe/H] & [Fe/H] \\ \hline Fnx-mem0546 & $4367\pm 110$ & $0.82 \pm 0.13$ & $-1.33 \pm 0.08$ & - & - & -&$-1.31\pm 0.07$\\ Fnx-mem0556 & $4176\pm 58$ & $0.70 \pm 0.12$ & $-0.79 \pm 0.09$ & $3971 \pm 150$ & $0.64 \pm 0.5$ & $-0.63 \pm 0.03$ & $-0.64 \pm 0.16$\\ Fnx-mem0595 & $4223\pm 67$ & $0.66 \pm 0.12$ & $-0.92 \pm 0.13$ & $3889 \pm 150$ & $0.51 \pm 0.5$ & $-0.88 \pm 0.03$ & $-1.04 \pm 0.08$\\ Fnx-mem0607 & $4207\pm 63$ & $0.69 \pm 0.12$ & $-0.77 \pm 0.09$ & $3916 \pm 150$ & $0.55 \pm 0.5$ & $-0.96 \pm 0.02$ & -\\ \hline \end{tabular} \end{table*} \section{Abundances} \label{sec:ab} We combine the previously determined abundances \citep{Reichert2020} with eight newly analyzed elements: Co, Zr, La, Ce, Pr, Nd, Er, and Lu (Table~\ref{tab:linelist}). Hyperfinesplitting is included for the redder lines of La, Co, and Lu \citep{Lawler1989,Kurucz2011}. We derive all additional abundances by synthesizing and fitting theoretical spectra with the local thermodynamic equilibrium (LTE) spectrum synthesis code MOOG \citep[version of 2014,][]{Moog} using 1-dimensional model atmospheres from \citet{Kurucz1970}\footnote{http://kurucz.harvard.edu/grids.html}, and solar abundances from \citet{Asplund2009}. In addition, we have tried to extract carbon from several molecular absorption lines but those were too weak in the covered spectral region. Therefore, we can exclude a strong carbon enhancement. \begin{table} \caption{Lines analyzed in addition to those used in \citet{Reichert2020}.} \label{tab:linelist} \centering \begin{tabular}{l l c c c } \hline\hline Element & Wavelength& EP& $\log gf$ & Literature\\ \hline Co I & $5483.34$ & 1.709 & -1.500 & 1\\ Y II & $5509.89$ & 0.992 & -1.015 & 2\\ Zr I & $6127.46$ & 0.154 & -1.060 & 3\\ Zr I & $6134.62$ & 0.000 & -1.280 & 3\\ Zr I & $6143.20$ & 0.071 & -1.100 & 3\\ La II & $6320.43$ & 0.173 & -1.610 & 4\\ La II & $6390.46$ & 0.321 & -1.410 & 5\\ Ce II & $5512.08$ & 1.007 & -0.390 & 6\\ Pr II & $5509.15$ & 0.482 & -1.168 & 7\\ Pr II & $6165.94$ & 0.923 & -0.205 & 7\\ Nd II & $5356.97$ & 1.263 & -0.280 & 8\\ Nd II & $5361.17$ & 0.559 & -1.480 & 8\\ Nd II & $5361.47$ & 0.680 & -0.370 & 7\\ Er II & $5414.60$ & 0.000 & -2.499 & 7\\ Lu II & $6221.87$ & 1.540 & -0.760 & 9\\ \hline \end{tabular} \tablerefs{(1) \citet{Lawler2015}; (2) \citet{Hannaford1982}; (3) \citet{Biemont1981}; (4) \citet{Corliss1962}; (5) \citet{Lawler2001b}; (6) \citet{Lawler2009}; (7) \citet{Meggers1975}; (8) \citet{Denhartog2003}; (9) \citet{denhartog1998}.} \end{table} All derived abundances, including those already obtained by \citet{Reichert2020}, are presented in Table~\ref{tab:abundances} for the four Fornax stars. The star Fnx-mem0607 is used as a reference because it has typical abundances of neutron-capture elements in Fornax stars. The stars Fnx-mem0556, and Fnx-mem0595 have the highest europium abundance ever observed to our knowledge with $\log \epsilon (\mathrm{Eu})=0.98$ (Table~\ref{tab:abundances}). Within uncertainties, this is comparable only to SCMS~982 in Sculptor (\mbox{$\log \epsilon (\mathrm{Eu})=0.95 \pm 0.18$}, \citealt{Geisler2005}). In the following, we will refer to them as Eu-stars, defining them as r-II stars (i.e., [Eu/Fe]$>1$) at high metallicities (i.e., [Fe/H]$\gtrsim -1.5$). \begin{table*} \caption{Derived absolute abundances (including also those already presented in \citet[][R20]{Reichert2020}).} \label{tab:abundances} \centering \begin{tabular}{l c c c c r} \hline\hline Element & Fnx-mem0546 & Fnx-mem0556 & Fnx-mem0595 & Fnx-mem0607 & Reference\\ \hline Mg I & $6.16 \pm 0.27$ & $6.66 \pm 0.24$ & $6.51\pm 0.11$ & $6.75 \pm 0.17$ & R20 \\ Sc I & $1.26 \pm 0.26$ & $1.79 \pm 0.10$ & $1.60\pm 0.29$ & $1.93 \pm 0.11$ & R20\\ Ti II& $3.93 \pm 0.31$ & $4.32 \pm 0.25$ & $3.79\pm 0.28$ & $4.08 \pm 0.11$ & R20\\ Cr I & $3.57 \pm 0.39$ & $5.22 \pm 0.26$ & $4.76\pm 0.18$ & $4.86 \pm 0.44$ & R20\\ Mn I & $3.90 \pm 0.37$ & $3.97 \pm 0.14$ & $4.15\pm 0.23$ & $4.31 \pm 0.28$ & R20\\ Fe I & $6.17 \pm 0.08$ & $6.71 \pm 0.09$ & $6.58\pm 0.13$ & $6.73 \pm 0.09$ & R20\\ Co I & $3.29 \pm 0.29$ & $3.90 \pm 0.26$ & $3.59\pm 0.24$ & $3.93 \pm 0.19$ & This study\\ Ni I & $4.76 \pm 0.20$ & $5.14 \pm 0.21$ & $5.12\pm 0.23$ & $5.11 \pm 0.23$ & R20\\ Y II & $0.89 \pm 0.25$ & $1.35 \pm 0.29$ & $1.11\pm 0.24$ & - & R20\\ Zr I & $2.19 \pm 0.30$ & $2.29 \pm 0.13$ & $2.12\pm 0.18$ & $1.70 \pm 0.20$ & This study \\ Ba II& $1.25 \pm 0.12$ & $1.76 \pm 0.30$ & $1.79\pm 0.14$ & $1.65 \pm 0.12$ & R20\\ La II& $1.50 \pm 0.28$ & $1.47 \pm 0.26$ & $1.04\pm 0.13$ & $0.60 \pm 0.09$ & This study\\ Ce II& $1.03 \pm 0.25$ & $1.33 \pm 0.24$ & $1.45\pm 0.24$ & - & This study\\ Pr II& $1.17 \pm 0.25$ & $1.15 \pm 0.34$ & $1.01\pm 0.23$ & $0.33 \pm 0.15$ & This study\\ Nd II& $1.49 \pm 0.19$ & $1.89 \pm 0.29$ & $1.82\pm 0.30$ & $0.99 \pm 0.22$ & This study\\ Eu II& $0.64 \pm 0.19$ & $0.98 \pm 0.13$ & $0.98\pm 0.12$ & $0.18 \pm 0.34$ & R20\\ Er II& - & $1.69 \pm 0.25$ & $1.53\pm 0.28$ & - & This study\\ Lu II& $0.22 \pm 0.23$ & $0.61\pm 0.26$ & $0.18\pm 0.37$ & $<0.23$ & This study \\ \hline $[$Ba$/$Eu$]$ & $-1.05$ $(r)$ & $-0.88$ $(r)$ & $-0.85$ $(r)$ & $-0.19$ $(r+s)$& -\\ $[$Ba$/$La$]$ & $-1.33$ $(r)$ & $-0.80$ $(r)$ & $-0.33$ $(r)$ & $-0.03$ $(r+s)$ & -\\ \hline\hline \end{tabular} \end{table*} The enhancement of neutron capture elements (Zr, Ba, and Eu) is evident from the spectra shown in Fig.~\ref{fig:spectra}, where we include also SCMS~982 \citep{Geisler2005}, a star with similar absolute europium abundances. All stars have similar stellar parameters and the strength of the lines can therefore be roughly compared (Fnx-mem0546 is slightly more metal-poor than the other stars). The europium absorption line is strongest for Fnx-mem0546, Fnx-mem0556, and Fnx-mem0595 and even comparable in strength to the nickel line close by. Note that SCMS~982 has stronger Ba and Zr lines than the Fornax stars indicating a considerable s-process or i-process enhancement of this Sculptor star (see Sect.~\ref{sec:pattern}). \begin{figure}[h] \centering \includegraphics[width=\hsize]{eu_region.pdf}\\ \includegraphics[width=\hsize]{ba_region.pdf} \caption{Spectra (including an offset for better visibility) for Fnx-mem0546, Fnx-mem0556, Fnx-mem0595, Fnx-mem0607, and SCMS~982 for regions around the Eu absorption line (top panel) and around a Ba II line (bottom panel).} \label{fig:spectra} \end{figure} In the following, we will compare the four Fornax stars to other stars keeping symbols and colors the same in all figures. Fnx-mem0546, Fnx-mem0556, Fnx-mem0595, Fnx-mem0607 \citep{Reichert2020} are marked by an orange diamond, a circle, a square, and a red star, respectively. Other Fornax stars \citep{Reichert2020} are shown as green stars, and the MW stars as grey dots (\citet{Reddy2003}, \citet{Cayrel2004}, \citet{Reddy2006}, \citet{Ishigaki2013}, \citet{Fulbright2000}, \citet{Nissen1997}, \citet{Prochaska2000}, \citet{Stephens2002}, \citet{Ivans2003}, \citet{McWilliam1995}, \citet{Ryan1996}, \citet{Gratton1988}, \citet{Edvardsson1993}, \citet{Roederer2016}, \citet{Hansen2012} and \citet{Ezzeddine2020}). Moreover, we show other typical r-process enhanced stars: Cos~82 \citep[blue diamond,][]{Shetrone2001}, SCMS~982 \citep[black diamond,][]{Geisler2005}, HD 222925 \citep[magenta diamond,][]{Roederer2018}, J1124+4535 \citep[blue diamond,][]{Xing2019}, and Reticulum II \citep[teal diamonds,][]{Ji2016b}. \subsection{Largest Zr sample in a dwarf galaxy} \label{sec:Zr} We have derived (neutral) zirconium abundances for all Fornax stars presented in \citet{Reichert2020}. For many stars it is the first Zr determination, making it the largest sample of Zr abundances in a dwarf galaxy to date. Figure~\ref{fig:zr_evolution} shows the $\mathrm{[Zr/Fe]}$ in Fornax including the neutron-capture enhanced stars. The average Zr abundance for all Fornax stars is slightly sub solar and the reference star (Fnx-mem0607) is located slightly below this general trend. There may be corrections to the abundances due to the LTE assumption which tends to affect neutral atoms more when they are the minority species as it is the case for Zr \citep[c.f., ][for a discussion]{Andrievsky2017}. The exact size of the NLTE correction depends on several factors such as the stellar parameters and the abundance value. Currently, there is no large, available Zr NLTE grid covering our parameter space. However, based on NLTE computations in \citet{Velichko2010} and more recent ones in \citet{Hansen2020} we would estimate corrections of the order of $\sim0.0$ to $>+0.3$\,dex depending on the Zr abundances and stellar parameters. For our three enhanced stars the corrections would likely amount to $\gtrsim+0.3$\,dex. The three Eu-enhanced Fornax stars (Fnx-mem0546, Fnx-mem0556, and Fnx-mem0595) are clearly enhanced also in Zr. This agrees with these stars having an r-process pattern typical of other r-I or r-II stars, see for example the Reticulum II stars (teal diamonds) in Fig.~\ref{fig:zr_evolution} and the discussion in Sect.~\ref{sec:pattern}. Despite the high metallicities and Zr being dominated by the s-process in the solar system ($\sim 66\%$, \citealt{Bisterzo2014}); at low metallicities Zr is formed by the r-process as shown by most r-II stars. For the Eu-enhanced stars in Fornax, the enhancement of Zr is probably produced by an r-process event and not by the s-process, see Sect.~\ref{sec:pattern}. \begin{figure}[h] \centering \includegraphics[width=\hsize]{zr.pdf} \caption{[Zr/Fe] versus metallicity following the same notation and references as in Fig.~\ref{fig:mg_evolution}.} \label{fig:zr_evolution} \end{figure} \subsection{Heavy neutron-capture elements} \label{sec:heavy_ncap} The three Eu-enhanced Fornax stars are enriched in europium with $\sim 1$ dex more than the average Fornax stars (see Fig.~\ref{fig:eu_enhancement}). With $\log \epsilon (\mathrm{Eu}) =0.98$, Fnx-mem0595 and Fnx-mem0556 are the most europium-enriched stars observed until today, together with SCMS~982 that is enriched by an s- or i- process \citep[see][for a discussion]{Skuladottir2020b}. Even though rare, there are several stars with enhanced europium at low metallicities. However, such stars are even more rare at high metallicities. In Fig.~\ref{fig:eu_enhancement}, we show some of those Eu-stars: Cos~82 \citep{Shetrone2001,Aoki2007,Sadakane2004}, J1124+4535 \citep{Xing2019}, HD~222925 \citep{Roederer2018}, and SCMS~982 \citep{Geisler2005,Skuladottir2020b}. With the exception of SCMS~982, these stars show a dominant contribution from the r-process as indicated by their $\mathrm{[Ba/Eu]}$ ratio and discussed below (Fig.~\ref{fig:ba_eu_theory}). \begin{figure} \centering \includegraphics[width=\hsize]{eufe.pdf} \caption{Absolute Eu (upper panel) and relative [Eu/Fe] abundances (lower panel) versus metallicity following the same notation and references as in Fig.~\ref{fig:mg_evolution}.} \label{fig:eu_enhancement} \end{figure} The combination of metal-rich stars together with the extreme enhancements of neutron capture elements gives us the unique possibility to derive abundances of neutron capture elements that are otherwise challenging to detect. Therefore, we are able to derive lutetium abundances (Fig.~\ref{fig:lu_synth}). \begin{figure*} \centering \includegraphics[width=\hsize]{lutetium_plot.pdf} \caption{Normalized flux together with a synthetic spectrum. The synthetic spectrum is shown for a negligible amount of Lu (black line) and for an enhanced Lu abundance (red line). A red band indicates a deviation of the Lu abundance in the range of a typical error ($\pm 0.3$ dex). The lower panels show the residual of the synthetic spectrum with respect to the observed flux. Yellow horizontal bands mark a one sigma deviation from the synthesized spectra, grey bands a two sigma deviation, and dashed lines a three sigma deviation.} \label{fig:lu_synth} \end{figure*} Due to the heavy blending of the absorption line, we claim a Lu detection if more than three points deviate by more than three sigma (dashed line in Fig.~\ref{fig:lu_synth}) from the flux when assuming basically no Lu (i.e., $\mathrm{[Lu/H]} = -9$). Even though uncertain due to irregular noise next to the absorption line, we clearly detect lutetium in Fnx-mem0546, but also in Fnx-mem0556 and Fnx-mem0595. Because the continuum shows some artifacts next to the absorption line in Fnx-mem0595, we assign an additional error of $0.1\,\mathrm{dex}$ to the lutetium abundance. This adds all three stars to the rare stars with lutetium detections ($9$ in JinaBase, \citealt{Abohalima2018}, $13$ in SAGA, \citealt{SAGA}) and makes it the first detections in a dwarf spheroidal galaxy. \newpage \section{Origin of Eu-stars} \label{sec:origin} In this section we probe the origin of the Eu-stars by first finding the predominant process that enriched these stars. Following, we assess which possible sites could host this process. We make use of yield predictions and abundance ratios for this purpose, but we caution the use of a single element ratio to assign a dominant process contribution. We point towards using such ratios together with observationally derived abundance patterns, as these present a more complete chemical trace of the true stellar enrichment. \subsection{r-, i-, or s-process?} \label{sec:pattern} At high metallicity, the neutron-capture elements stem mainly from the s- and r-process, possibly also from the i-process. The i-process operates at intermediate n-densities and exposures and may be able to take place in rapidly accreting white dwarfs \citep[e.g.,][]{Denissenkov2017}, super asymptotic giant branch stars \citep[e.g.,][]{Doherty2015}, or low-mass AGB \citep[e.g.,][]{Stancliffe2011}. In order to check whether the Eu-stars are enriched by an r-process event or whether they have a strong contribution from the s-process, we first check the [Ba/Eu] ratio shown in Fig.~\ref{fig:ba_eu_theory} and Table~\ref{tab:abundances}. For the three stars, the ratio is well below zero and this is often used to define neutron-capture-rich, r-process enhanced stars ([Ba/Eu]$<$0, \citealt{Beers2005}). A stronger constraint on the heavy-element enhancement is the estimate of the pure process trace, which is typically assessed through the [Ba/Eu] being less than $\sim-0.7$\,dex (pure r) or larger than $\sim1.1$\,dex (pure s) \citep{Arlandini1999,Hansen2018}. The [Ba/Eu] ratio points towards a pure r-ratio in the three Fornax stars, while the reference star, Fnx-mem0607, is clearly a mixture of r and s. We also probe if there is an i-process contamination. A typical fingerprint of the i-process is a positive [Ba/La] ratio \citep{Koch2019,Hampel2016,Denissenkov2019}, but this ratio is negative for the four Fornax stars. In this connection, we note that Fnx-mem0546 has a relatively low Ba abundance with respect to La and also compared to the Ba in the other two stars. The La abundance is more than 1\,dex higher than the Ba abundance in Fnx-mem0546. This leads to a strong odd-even abundance difference in this region. In Fig.~\ref{fig:ba_eu_theory}, it is also clear that SCMS~982 is not r-process dominated with [Ba/Eu] close to 0.5. If the peculiar pattern of SCMS~982 stems from an s- or i-process is still under debate \citep{Geisler2005,Skuladottir2020b}. Based on these abundance ratios, we focus our further comparison on r-process and s-process yields. \begin{figure*} \centering \includegraphics[width=\hsize]{ratios_ba_eu_new.pdf} \caption{[Ba/Eu] versus metallicity (right panel) following the same notation and references as in Fig.~\ref{fig:mg_evolution}. Theoretical predictions are shown for s-process (horizontal lines) and r-process (left panel). The s-process yields are from F.R.U.I.T.Y. database \citep{Cristallo2011} and are indicated by horizontal lines starting at the metallicity of the model. These models are for three AGB masses: $1.3\,M_\odot$ (solid lines), $2.0\,M_\odot$ (dashed lines), and $5.0\,M_\odot$ (dotted lines). The red, thin lines indicate a metallicity of $Z=0.001$, and blue, thick lines correspond to $Z=0.0001$ and [$\alpha$,Fe]=0.5. The r-process ratios are shown with bars that cover the calculate range taking into account uncertainties due to the various astrophysical conditions and different nuclear physics theoretical models. The ratio is shown for the early, dynamical ejecta of neutron star merger (NSNS) and neutron star black hole merger (NSBH) as well as for their disk ejecta (Disk~1, Disk~2, and Disk~3). Results are also presented for MR-SNe based on two simulations. For more details and references see Sect.~\ref{sec:chasing} and \cite{Cote2020, Eichler2019, Reichert2021}.} \label{fig:ba_eu_theory} \end{figure*} We now compare the observationally derived abundances to theoretical predictions. For the s-process, we take yields for different AGB star masses and metallicities from the F.R.U.I.T.Y. database \citep{Cristallo2011,Cristallo2015}. In Fig.~\ref{fig:ba_eu_theory}, this contribution is shown by horizontal dashed and dotted lines covering the metallicity range where they are predicted and appropriate. For the r-process, we compare to yields from different scenarios (for details see Sect.~\ref{sec:chasing}). The variation in any abundance ratio within a given scenario is due to the nuclear physics uncertainties \cite[see][for more details about models and nuclear physics included in the nucleosynthesis]{Cote2020,Eichler2019}. As seen from Fig.~\ref{fig:ba_eu_theory}, the [Ba/Eu] ratios of the three Eu-stars agree with the theoretical predictions of the r-process within uncertainties. However, those uncertainties are rather large and thus it is not possible to conclude which scenario contributed most to the observed abundances. Now we explore another possibility to check whether the three Eu-star's abundances are mainly due to the r-process. We compare their abundance patterns to that of HD 222925 \citep{Roederer2018}, a star that has been identified as r-process enhanced. Figure~\ref{fig:r_pattern} shows this comparison and demonstrates that two of the Eu-stars (Fnx-mem0556 and Fnx-mem0595) fit with an excellent reduced $\chi^2<1$ the r-process pattern of HD 222925. Fnx-mem0546 deviates slightly from this pattern with an enhancement in lanthanum, and praseodymium relative to barium and europium. Lutetium on the other hand agrees well with the r-process pattern for Fnx-mem0546 and Fnx-mem0556. For Fnx-mem0595, lutetium is underabundant compared to the r-process ratio, however, it also has a larger error (see Sect.~\ref{sec:heavy_ncap}). \begin{figure}[h] \centering \includegraphics[width=\hsize]{rprocess_HD222925.pdf} \caption{Abundances of Fnx-mem0546 (diamonds), Fnx-mem0556 (circles), and Fnx-mem0595 (squares) scaled to fit the r-process pattern of HD~222925 \citep[black line, with errors indicated as grey bands, ][]{Roederer2018}. In the legend we give the reduced $\chi ^2$ of the fit for $Z>50$. Bottom panel shows the relative differences between the Fornax stars and HD~222925.} \label{fig:r_pattern} \end{figure} In summary, all stars show a striking similarity to the r-process pattern without too many contributions from other processes. We can therefore safely assume that the abundances of the three Eu-stars are mainly enriched by the r-process. \subsection{One r-process event} \label{sec:one-r} After showing that the Eu-stars are r-process enhanced, we estimate how many r-process events are necessary to enrich these stars and calculate the ejected europium per event. The three Eu-stars were born in a gas cloud/region with a total mass $M_\mathrm{gas}$. \cite{Magg2020} provide an approximation for the dilution mass where the new elements from an r-process event(s) are mixed: \begin{equation} \label{eq:dillmass} M_\mathrm{gas} = 1.9 \cdot 10^4 \mathrm{M}_\odot E_{51}^{0.96}n_0^{-0.11}, \end{equation} here $n_0$ is the ambient density and $E_{51}$ is the explosion energy of the event. \cite{Magg2020} uses $n_0 = 1$ corresponding to the environment where Pop III stars formed, however this has an small impact on the final dilution mass due to the small exponent. The explosion energy ($E_{51}$) of the event can be assumed to be between $10^{51}$ and $10^{52} \, \mathrm{erg}$ (c.f., $10^{51}$ erg for GW170817; \citealt{Kathirgamaraju2019} and the explosion energy of $10^{52}$ erg of hypernovae; \citealt{Nomoto2006}). The dilution mass ($M_\mathrm{gas}$) therefore lies between $10^4$ to $10^5\, \mathrm{M_\odot}$, which is at least three orders of magnitudes smaller than the total stellar mass of Fornax $M_\mathrm{Fornax}\sim10^8\, \mathrm{M_\odot}$ \citep{Lokas2009}. Before the r-process event(s), the mass of Eu in the gas was $M_\mathrm{Eu}^\mathrm{pre-event}$ and the mass injected by the event was $M_\mathrm{Eu}^\mathrm{r-event}$. We can estimate $M_\mathrm{Eu}^\mathrm{pre-event}$ using the abundance of our reference star, Fnx-mem0607, in the following definition: \begin{equation} \log \epsilon (\mathrm{Eu}) = \log \frac{M_\mathrm{Eu}^\mathrm{pre-event}}{A_\mathrm{Eu} \cdot M_\mathrm{gas}} +12, \end{equation} where $A_\mathrm{Eu}=152$ is the average mass number of europium. Therefore, the Eu in the r-process stars is: \begin{equation} \log \epsilon (\mathrm{Eu}) = \log \frac{M_\mathrm{Eu}^\mathrm{pre-event}+M_\mathrm{Eu}^\mathrm{r-event}}{A_\mathrm{Eu} \cdot M_\mathrm{gas}} +12, \label{eq:Eu_event} \end{equation} and from this expression we obtain an europium mass per event $M_\mathrm{Eu}^\mathrm{r-event}$ between \mbox{$\sim 1.5\cdot 10^{-5}$} and \mbox{$\sim 3\cdot 10^{-4} \, \mathrm{M_\odot}$}. This is similar to the values reported by \citet{Ji2016a} to explain the r-process enhanced stars in Reticulum II \mbox{($\sim 2.5\cdot 10^{-5} - 5\cdot 10^{-5} \, \mathrm{M_\odot}$)}. Therefore, it is likely that Fnx-mem0556, Fnx-mem0595, and Fnx-mem0546 also got enriched by a single r-process event. Moreover, the stars probably formed only a few Myr after the event. Otherwise, the r-process material would have been mixed into a larger amount of gas \citep{vandefoort2019}. Our simple estimate has several input parameters (e.g., $n_0$, $E_{51}$), therefore we show in Fig.~\ref{fig:ejected_eu} an overview covering different possible values. In this figure, the absolute europium abundances of Fnx-mem0556 are indicated by horizontal orange lines, the estimated dilution mass by vertical orange lines, and the colors correspond to the Eu mass ejected by the r-process event using Eq.~\ref{eq:Eu_event}. The latter changes smoothly over several orders. However, the amount of Eu needed to explain the Eu-stars ($M_\mathrm{Eu}\sim 10^{-5}-10^{-4}\, M_\odot$, Fig.~\ref{fig:ejected_eu}) agrees with having only one r-process event (c.f. also \citealt{Beniamini2016} for estimates of the ejected Eu mass per r-event in dSph galaxies.). \begin{figure} \centering \includegraphics[width=\hsize]{ejected_eu.png} \caption{Absolute abundances of europium versus dilution mass. The amount of europium needed to enhance a star to a given absolute abundance value is color coded. The orange box indicates the range, predicted from Fnx-mem0556, where the left and right vertical lines are obtained from different explosion energies and the horizontal lines from the observed absolute europium abundances including the error. The range of estimated Eu masses to enhance Reticulum II \citep{Ji2016a} is given by blue lines. The maximum Eu mass ejected from NSMs based on simulation is shown as a black line ($8\cdot 10^{-5}\,\mathrm{M_\odot}$), while the maximum ejected europium mass from MR-SNe simulations is traced by red line ($1.5\cdot 10^{-5}\,\mathrm{M_\odot}$).} \label{fig:ejected_eu} \end{figure} \subsection{Chasing the r-process site in Fornax} \label{sec:chasing} Which r-process event is responsible for the enhanced Eu in the three Fornax stars? The possible candidates are compact binary mergers (two neutron stars or a neutron star and a black hole) and MR-SNe including the early explosion phase and the late evolution as collapsar. In Fig.~\ref{fig:ba_eu_theory}, we have compared the [Ba/Eu] of the Eu-stars to various theoretical predictions from compact binary mergers (dynamical and disk ejecta) and from MR-SNe using different nuclear physics input \citep{Kodama1975,Duflo1995,Panov2001,Moeller2003,Kelic2008,Marketin2016}. We test the dynamical ejecta of mergers of two neutron stars (NSNS (B), \citealt{Bovard2017}) and (NSNS (R), \citealt{Korobkin2012}), and a neutron star and a black hole (NSBH (R), \citealt{Korobkin2012}); ejecta from the accretion disk formed after merger surrounding the compact object (Disk 1, Disk 2, and Disk 3, \citealt{Wu2016}); ejecta from magneto-rotational supernovae MR-SN (W) \citep{Winteler2012} and MR-SN (O) \citep{Reichert2021}. A similar set of models was used also by \citet{Cote2020,Eichler_Arcones2021} to compare to meteorite ratios of r-process isotopes. However, there are too large theoretical uncertainties in the nuclear physics input as well as the variation in the astrophysical conditions and this makes it impossible to conclude from the [Ba/Eu] ratio alone which scenario has contributed to the enhanced Eu. The mass of Eu estimated above ($M_\mathrm{Eu}\sim 10^{-5} - 3\cdot 10^{-4} \, \mathrm{M_\odot}$) could be also used as a constraint on the r-process site. We compare this amount of Eu to the mass that is ejected in NSM and MR-SNe, as obtained in hydrodynamic simulations. However, these simulations are still uncertain due to various aspects (e.g., resolution, magnetic fields, neutrino matter interactions, high density equation of state) and predictions about the amount of Eu ejected are only approximate. In compact binary mergers, the masses of ejected europium in the dynamic ejecta depends on the simulation and can differ by orders of magnitudes (see, e.g., \citealt{Cote2018} for an overview of different ejecta masses of the dynamical ejecta). Just to name a few examples, the europium mass based on the simulation of \citet{Bovard2017} is $M_\mathrm{Eu} \sim 10^{-6}-10^{-5} \, \mathrm{M_\odot}$. Yields of other simulations are slightly higher with $M_\mathrm{Eu} \sim 10^{-5}-8 \cdot 10^{-5} \, \mathrm{M_\odot}$ \citep{Korobkin2012} and similar $M_\mathrm{Eu} \sim 3\cdot 10^{-5}-5 \cdot 10^{-5} \, \mathrm{M_\odot}$ \citep{Goriely2011}. In the case of a NSBH merger, the ejected europium mass of the dynamic ejecta can reach $M_\mathrm{Eu} \sim 3\cdot 10^{-4}\,\mathrm{M}_\odot$ \citep{Korobkin2012}. In addition, the disk ejecta will also contribute to europium ($M_\mathrm{Eu} \sim 3\cdot 10^{-6}- 10^{-5} \, \mathrm{M_\odot}$, \citealt{Wu2016}). However, it is still under discussion how much each ejected component contributes and how neutron-rich the components are \citep[see, e.g.,][for a recent review]{Shibata2019}. In GW170817, \cite{Watson2019} directly observed Sr and predicted a mass $M(\mathrm{Sr})\ga 5 \cdot 10^{-5}\, \mathrm{M_\odot}$ . When assuming that the ejecta is scaled like the solar r-process residual \citep{Sneden2008} the ejected europium mass is $M_\mathrm{Eu} \sim 3\cdot 10^{-6}\,\mathrm{M}_\odot$. We note that the lighter heavy elements like strontium usually scatter with respect to the heavier elements. Because of this and other involved uncertainties, this value should be treated as a rough estimate only. Nevertheless, it agrees well with the masses of $M_\mathrm{Eu} \sim 3\cdot 10^{-6}-1.5 \cdot 10^{-5}\,\mathrm{M}_\odot$ obtained in \citet{Cote2018} for GW170817. The amount of Eu produced in MR-SNe based on recent simulations is $\lesssim 1\cdot 10^{-5}\, \mathrm{M_\odot}$ \citep{Winteler2012}, $\lesssim 1.5\cdot 10^{-5}\, \mathrm{M_\odot}$ \citep{Nishimura2015}, $\lesssim 8\cdot 10^{-6}\, \mathrm{M_\odot}$ \citep{Nishimura2017}, and $\lesssim 5\cdot 10^{-6}\, \mathrm{M_\odot}$ \citep{Reichert2021}. These values are on the lower end of our assumed uncertainties (Fig.~\ref{fig:ejected_eu}), but they could still be responsible for the enrichment. After some MR-SNe, a black hole forms and is surrounded by an accretion disk. The disk conditions may be similar to those found in accretion disks after neutron star mergers and may favour an r-process. \cite{Siegel2019} have found that Eu may be produced in collapsars, however, more detailed investigations are necessary to understand whether the conditions are appropriate for an r-process, see \cite{Miller2019,Just2021}. In Fig.~\ref{fig:ejected_eu}, we show the maximum europium mass ejected by NSM (black line, $8\cdot 10^{-5}\,\mathrm{M_\odot}$) and by MR-SNe (red line, $1.5\cdot 10^{-5}\,\mathrm{M_\odot}$). Moreover, we include the estimated europium mass necessary to explain r-II stars in Reticulum II \citep{Ji2016a}. All of these estimates are close to the mass that is necessary to enhance the Eu-stars, as derived from the observed stellar abundances. In addition to Eu, one can use $\alpha-$elements, e.g., Mg, to check whether MR-SNe are the r-process site responsible for more element abundances in the Fornax Eu-stars. Since the amount of ejected $\alpha-$elements depends on the progenitor mass \citep[e.g.,][]{Kobayashi2006}, and the progenitors of MR-SNe may differ from the average CC-SNe, the amount of ejected $\alpha$-elements may also vary between the two types of SNe. If an abnormal supernova produces r-process material and a huge amount of Mg, one would possibly see a signature of this in the Mg abundances in the Fornax Eu-stars. However, in Fig.~\ref{fig:mg_evolution}, the three stars present normal Mg abundances (see also Table~\ref{tab:abundances}). This may be an indication of a neutron star merger producing the observed Eu or of MR-SNe ejecting normal amount of Mg as any other supernova in Fornax. Therefore, we cannot use Mg as an indicator for rare supernovae and their r-process yields. In summary, based on the abundance ratio of [Ba/Eu], on the estimated amount of Eu, and on the Mg abundance, we cannot determine the r-process site enriching the Eu-stars in Fnx. Based on Fig.~\ref{fig:ejected_eu}, NSMs seem a promising site to explain the r-material in the Eu-stars, however, their time delay coupled with recent star formation in Fnx may pose an issue that is easier to overcome if MR-SNe would be the r-site. On the other hand, recent studies also show that a substantial fraction of the NSM population may occur on short timescales ($< 100\, \mathrm{Myr}$, see e.g. \citealt{Beniamini2019}). \subsection{Time scale - late r-process event linked to a star formation burst in Fornax} \label{sec:environment} The strong r-process enhancement, despite the remaining unknown formation site, combined with the typical low $\alpha-$ content indicates, together with the \textit{Gaia} proper motions \citep[DR2,][]{Gaia2018,Gaia_vizier2018}, that these rare Eu-stars are indeed Fornax members (see Sect.~\ref{sec:sample}). From the time scale perspective, neutron star mergers remain viable sources and could explain the observed abundances. Neutron star mergers are expected to contribute with some delay and thus such an event could account for producing r-process material late or at high metallicities. However, this would imply that there is some star formation just after the neutron stars merge and eject r-process material. Similarly linked to the late star formation, massive stars could also have formed and exploded as MR-SNe producing the r-process observed in the Eu-stars. This would require more gas at a later stage, which may be feasible in Fornax. In any case, the three r-rich stars must have formed shortly after the r-process event, i.e., there must have been an active star forming environment. According to \citet{Lemasle2014}, Fnx-mem0556 has an age of $4.36\pm0.86\, \mathrm{Gyr}$ and Fnx-mem0595 an age of $5.75\pm 1.78 \, \mathrm{Gyr}$. Fornax shows a complex star formation history with several outbreaks. A significant number of stars were formed at early times, i.e., more than $10\, \mathrm{Gyr}$ ago. Moreover, there was a very recent period of star formation $\sim 4 \, \mathrm{Gyr}$ ago \citep[e.g.,][]{Coleman2008,deBoer2012,Hendricks2014,Weisz2014,Rusakov2021}. This late sudden burst of star formation agrees well with the age of the r-process enhanced stars. Although the origin of this burst is not known, there are speculations that Fornax has undergone some galaxy merger events in its history, indicated by over-dense features in the spatial distribution of stars in Fornax \citep[e.g.,][]{Coleman2004}. Another explanation for such an peculiar enhancement of neutron-capture elements was investigated by \citet{Tsujimoto2002}. They proposed that inhomogeneous mixing, caused by a high velocity dispersion in dSph galaxies may be responsible for the existence of stars as Cos~82, and possibly also Fnx-mem0546, Fnx-mem0556, and Fnx-mem0595 \citep[see also][for a discussion]{Sadakane2004,Aoki2007}. \section{Conclusions} \label{sec:conclusions} We study neutron-capture elements in Fornax stars including three stars at high metallicities with extreme enhancements of heavy r-process elements. We define these new type of stars as Eu-stars, they are r-II stars ([Eu/Fe]$>1$) at high metallicity ([Fe/H]$\gtrsim -1.5$). Although previously observed, metal-rich stars with enhanced neutron-capture elements are rare. The Eu-stars show an europium abundance up to $\log \epsilon (\mathrm{Eu})= 0.98 \pm 0.12$, which is the highest europium abundance ever observed. Thus, Eu is approximately three times more abundant than in our Sun while their iron abundance is a factor of seven smaller. In addition to an enrichment in heavy neutron-capture elements, Zr is also enhanced in the three stars. In order to compare to other Fornax stars, we have derived Zr abundances for $105$ stars. This is the largest Zr sample in a dSph to date and offers a new chance to explore the galactic chemical evolution of Fornax. Moreover, we have derived lutetium abundances for the first time for stars in a dSph galaxy. This was possible due to the unique combination of high metallicities and r-process enrichment that allowed for a Lu line detection. We have demonstrated that the enhancements in neutron-capture elements is due to the r-process as indicated by the [Ba/Eu] ratio and typical r-process pattern. Moreover, we give an estimate of the amount of Eu necessary to explain these r-process rich / Eu-stars, namely $M(\mathrm{Eu)}\sim8\cdot 10^{-6} - 3\cdot 10^{-4} \, \mathrm{M_\odot}$. This agrees with an individual r-process event being enough to explain the observed Eu abundances. Based on the elemental ratios and the europium mass ejected, we try to identify the r-process site by comparing to theoretical yield predictions from neutron star mergers and magneto-rotational supernovae. However, the uncertainties in the astrophysical conditions and the nuclear physics input prevent us of making any firm conclusion about the site. There is a clear need of improved hydrodynamic simulations with detailed microphysics as well as more theoretical and experimental information of the extreme neutron-rich nuclei involved in the r-process. The r-process event responsible for the Eu-stars was occurring during a star formation episode. If the event was a NSM, this could come from neutron stars born in early supernovae. The delay of the merger was coinciding with the star formation event where the Eu-stars were born shortly after. Despite NSM yield a very promising range of Eu abundances, the time scale is a bit more tricky in this scenario. Another possibility is that during the star formation event, massive stars formed and at least one died fast as a MR-SN ejecting the r-process material necessary to explain the observed abundances. Therefore, an active star forming environment simultaneously with the r-process event is in any case required for the formation of stars with such an enhanced europium content. The age of the stars approximately traces the time when the r-process event occurred. Their age is estimated to be around $4\, \mathrm{Gyr}$ \citep{Lemasle2014}, which coincides with a sudden increase of star formation in Fornax \citep{Coleman2008,deBoer2012,Hendricks2014,Weisz2014,Rusakov2021}. We conclude that the existence of these Eu-stars proves that the r-process can efficiently form r-II stars across a broad range of dwarf galaxies - from the faintest low-mass ones to the most massive dSph galaxies. It is not unique to ultra faint dwarf galaxies as suggested before. Moreover, we emphasize that gas dilution and star formation time scales must be considered in the search for the r-process sites. Future observations are critical to find more Eu-stars that are key to understand the origin of heavy elements produced by the r-process. \acknowledgments The authors thank M. Eichler, M. Hanke, A. Koch, and {\'A}. Sk{\'u}lad{\'o}ttir for valuable discussions. MR and AA were supported by the ERC Starting Grant EUROPIUM-677912, Deutsche Forschungsgemeinschaft through SFB~1245, and Helmholtz Forschungsakademie Hessen für FAIR. CJH acknowledges support from the Max Planck Society. This work has benefited from the COST Action “ChETEC” (CA16117) supported by COST (European Cooperation in Science and Technology).
\section{Introduction}\label{sec:intro} Applications reuse as much existing code as possible for cost savings. Existing code is often in the form of libraries, which keep evolving and may introduce incompatible changes (e.g., changing interface signatures). Misuses of library versions containing incompatible changes may lead to failures in applications. We refer to these failures as \textit{compatibility failures}, or \textit{CFailures}. A \textit{CFailure} involves three roles: library developers, application developers, and end users (\textit{library} and \textit{application} are relative concepts as an application itself may be a library for anther application). As shown in Figure~\ref{fig:failures}, library developers release two versions containing incompatible changes. The changes are classified into two types: \textit{backward incompatible change (BIC)} (e.g., removing an interface), and \textit{forward incompatible change (FIC)} (e.g., adding an interface). The solid (dashed) lines show how a \textit{BIC} (an \textit{FIC}) causes \textit{CFailures}: if application developers develop an application based on the old (new) library version, end users may suffer from \textit{CFailures} when linking the application to the new (old) library version. In either case, the incompatible change causes \textit{CFailures}. \ignore{ The incompatible changes in a library can introduce \emph{dependency bugs}. A dependency bug happens when the version range (usable by the application) specified in the library contains incompatible versions and can cause compatibility failures when interacting with the application. \commentty{Please double-check if I made the correct argument.} } When incompatible changes happened, the three roles can prevent \textit{CFailures} with different solutions: 1)~library developers can undo the changes in the latest version; 2)~application developers can update the application to adapt the changes; 3)~end users can avoid using the incompatible library versions. There has been some research on detecting library changes ~\cite{ 8330249, Ponomarenko2012, 6062100, 10.5555/2337223.2337265, mezzetti_et_al:LIPIcs:2018:9212, 10.1145/3236024.3275535}. These techniques focus on suggesting incompatible changes for library developers (i.e., the first solution). There has also been some work on detecting incompatible API usages in applications~\cite{ 10.1145/3238147.3238185, 10.1145/3213846.3213857, 8812128, 6619503}, or helping applications adapt library changes~\cite{ 10.1145/1094811.1094832, 1553570, 10.1145/1108792.1108818, 4359473}. These techniques focus on helping application developers update the application (i.e., the second solution). In either of the above solutions, end users may have already suffered from \textit{CFailures} and have to wait for new library/application versions. The third solution, on the other hand, is more light-weighted --- end users can avoid \textit{CFailures} from the very beginning without having to see the \textit{CFailures} occur. However, there exists no research that can achieve this goal by helping users automatically select compatible library versions. \begin{figure}[tb] {\centering \resizebox*{0.95\columnwidth}{!} {\includegraphics{figure/sketch.pdf}} \caption{Incompatible changes cause \textit{CFailures}. \small{\emph{The solid and dashed lines show how \textit{BIC} (backward incompatible changes) and \textit{FIC} (forward incompatible changes) cause \textit{CFailures}, respectively.}}} \label{fig:failures}} \vspace*{-12pt} \end{figure} Some industrial settings use dependency management systems (\textit{DMSs}) that can help users select right library versions. Examples include \textit{dnf}~\cite{Fedora2019Using} in RPM-based Linux distributions and \textit{apt}~\cite{Ubuntu2019Apt} in Debian-based Linux distributions. However, \textit{DMSs} have several practical limitations (more details in Section~\ref{sec:limitation}): \begin{enumerate} \item \textit{DMSs} require manual inputs from either application or library developers, which can be tedious and error-prone. For example, \textit{dnf} requires application developers to specify version ranges of required libraries. \textit{apt} asks library developers to maintain a symbol list provided by the library. \item Manual inputs provided by developers may be outdated as the libraries evolve. For example, application developers specified the version range \textit{libfoo>=1.0}, after which \textit{libfoo-2.0} is released and backward incompatible to \textit{libfoo-1.0}. The version range should have been updated to \textit{2.0>libfoo>=1.0}. \item Developers may not comply with the requirements of the \textit{DMSs}. For example, \textit{apt} requires libraries not to break backward compatibility in a package, but library developers may unintentionally introduce incompatibilities since there is no mechanism to guarantee the requirement. \end{enumerate} Since \textit{DMSs} depend on version ranges specified in specification files (e.g., the \textit{control} file used by \textit{apt}, or the \textit{.spec} file used by \textit{dnf}) to resolve dependencies, the above limitations may introduce incompatible versions being included in the version ranges. In this case, we say there are \textit{dependency bugs} (or \textit{DepBugs}) in the specification files. \ignore{ The goal of this research is to detect \textit{DepBugs} and develop solutions for end users to prevent \textit{CFailures} without asking software (application and library) developers to modify their code and waiting for the new software release. While there has been some research on detecting library changes ~\cite{ 8330249, Ponomarenko2012, 6062100, 10.5555/2337223.2337265, mezzetti_et_al:LIPIcs:2018:9212, 10.1145/3236024.3275535}, these techniques focus on suggesting incompatible changes for library developers (i.e., the first solution); they are incapable of helping users select the compatible library versions. There has also been some work on detecting incompatible API usages in applications~\cite{ 10.1145/3238147.3238185, 10.1145/3213846.3213857, 8812128, 6619503}, or helping applications adapt library changes~\cite{ 10.1145/1094811.1094832, 1553570, 10.1145/1108792.1108818, 4359473}, these techniques focus on helping application developers update the application (i.e., the second solution); again, they do not provide solutions for end users to use the compatible library versions. } \ignore{ There has been much research on addressing compatibility issues. Li~\textit{et al.}~\cite{Li:2018:CAD:3213846.3213857} and He~\textit{et al.}~\cite{He:2018:UDE:3238147.3238185} propose tools to automatically detect compatibility issues in Android apps. These works help software developers find compatibility issues caused by library updates, and the issues could be fixed by patching the problem code. They are hard to help software users find compatibility issues caused by limitations of dependency management, while the issues should be fixed by upgrading/downgrading the software/library. On the other hand, these works are based on Android system, in which developers only need to focus on the version of one library, i.e., JDK. While in Linux system, there might be tens of thousands libraries. There are many other works xxx(TBD), which can not help this situation neither. There has been much research addressing compatibility or dependency problems. For examples, many works are targeted at breaking changes in libraries~\cite{ Bagherzadeh2018, 7816486, 10.1145/3196398.3196419, 8453124, 8330214, doi:10.1002/smr.328, 1510134, 6676878, Dietrich2016, JOT:issue_2017_04/article2, Ponomarenko2012, mezzetti_et_al:LIPIcs:2018:9212, 8330249, 6062100, 10.5555/2337223.2337265, 10.1145/2950290.2950345, 10.1145/1321631.1321688, 10.1145/3236024.3275535}, which study why and how library changed, detect the breaking changes in released versions. Besides, there have been some works focusing on compatibility failures of software~\cite{ 10.1145/3293882.3330564, 7884616, JEZEK2015129, 6747226, 8443581, 10.1145/3196398.3196420, 10.1145/2491411.2491428, 10.1145/2393596.2393661, 10.1145/3213846.3213857, 10.1145/3238147.3238185, 6619503, 4359473, 10.1145/1108792.1108818, 10.1145/1094811.1094832, 1553570}, and help the software to co-evolve with the libraries. These works help the library to fix the breaking changes, and guide the software to avoid using breaking changes in future versions. As a result, the latest software version can work well against the latest library version. However, the in-use versions in production environments are still under the risk of compatibility failures. Nearly half of desktop users do not update their software regularly, even after global ransomware attacks like WannaCry~\cite{Elissa2019The}. Some works have studied dependency management systems~\cite{ 10.1007/978-3-319-90421-4_6, 10.5555/3155562.3155577, Kula2018, 10.1109/MSR.2019.00061, 6975655, Decan2019, Bavota2015, 10.1145/2950290.2950325, 10.1109/MSR.2017.55, 10.1145/3239235.3268920, 10.1145/3133956.3134059, 10.1145/1858996.1859058, 4400160, 6928807}, which can manage dependencies of all software versions. These works involve tools helping to update dependencies when libraries evolve, but cannot avoid bad dependencies in the existing systems. In Section~\ref{sec:work}, we will introduce the related works in detail. } To address the limitations within \textit{DMSs}, we propose a new approach, \textit{DepOwl}{}, to detect \textit{DepBugs} and prevent \textit{CFailures}. \textit{DepOwl}{} works at the binary level to check compatibility between libraries and applications instead of analyzing the API usage in source code of applications (e.g., \textit{compilers})\footnote{The current design of \textit{DepOwl}{} focuses on C/C++ applications and libraries.}. This is advantageous for end users who prefer to install binary files without having to compile the source code. For example, end users often use the command \textit{apt install} to download binary files. The source-code level compatibility can not guarantee the compatibility of the binary files installed by the users. Specifically, given the binaries of a library and an application, \textit{DepOwl}{} automatically checks if the application is compatible to each version of the library, so it can help users select the right library versions to prevent \textit{CFailures}. \textit{DepOwl}{} contains three major steps. In the first step, \textit{DepOwl}{} collects all potentially incompatible changes (e.g., add/remove/change interfaces) during the evolution of the library (from an old version to a new version), including both \textit{BICs} and \textit{FICs}. Next, \textit{DepOwl}{} checks if the API usage in the target application matches the API definitions in either of the old and new library versions. If the change is a \textit{BIC} (\textit{FIC}) and the API usage matches the old (new) library version, the new (old) library version is regarded as an incompatible version. In the third step, \textit{DepOwl}{} compares the incompatible version to all other library versions. Any version that is both backward and forward \emph{compatible} to the incompatible version is also identified as an incompatible version. Users can prevent \textit{CFailures} by avoiding using the reported incompatible versions. A common usage scenario of \textit{DepOwl}{} is to serve as a plugin for \textit{DMSs}. Taking \textit{apt} as an example, in Debian-based Linux distributions, \textit{apt} helps users manage application dependencies. Each application contains a \textit{control} file indicating its required libraries and version ranges. These ranges, however, may contain incompatible versions. \textit{DepOwl}{} is able to detect incompatible versions, so that \textit{apt} can avoid using incompatible versions when resolving dependencies, and users will be free of \textit{CFailures}. We evaluated \textit{DepOwl}{}'s ability in preventing both known and unknown \textit{CFailures}. We first evaluated \textit{DepOwl}{} on 38 real-world known \textit{CFailures} from StackOverflow, and \textit{DepOwl}{} can prevent 35 of them. We also applied \textit{DepOwl}{} to the software repository shipped with Ubuntu-19.10, the latest Ubuntu stable version at the time of writing. \textit{DepOwl}{} detected 77 unknown \textit{DepBugs}, which may cause \textit{CFailures}. In summary, the contributions of this paper are as follows: \begin{enumerate} \item We propose a lightweight solution to prevent \textit{CFailures} when incompatible changes happened in libraries. Existing research work mainly focuses on fixing \textit{CFailures} in new versions, but can not prevent the \textit{CFailures}. Industrial \textit{DMSs} can help users resolve dependencies, but still have limitations. \item We design and implement \textit{DepOwl}{}, a practical tool to detect \textit{DepBugs} and prevent \textit{CFailures}. \textit{DepOwl}{} can collect incompatible changes in libraries, detect \textit{DepBugs} in applications, and suggest incompatible versions to help users prevent \textit{CFailures}. \item \textit{DepOwl}{} can prevent 35 out of 38 \textit{CFailures} selected from StackOverflow. and detect 77 \textit{DepBugs} in the repository shipped with Ubuntu-19.10. \textit{DepOwl}{} is more accurate compared with baseline methods, and requires no human efforts. \end{enumerate} \ignore{ The remainder of this paper is organized as follows. We present the limitations of dependency management systems in Section~\ref{sec:limitation}. Section~\ref{sec:motivation} gives the motivation and overview of \textit{DepOwl}{}. Section~\ref{sec:design} and \ref{sec:evaluation} are the design and evaluation of \textit{DepOwl}{}. We discuss limitations and related works in Section~\ref{sec:discussion} and \ref{sec:work}, and finally conclude our work in Section~\ref{sec:conclusion}. } \section{Understanding \textit{DepBugs} \& \textit{CFailures}}\label{sec:understand} In this section, we study how to prevent \textit{CFailures}, and analyze how \textit{DMSs} introduce \textit{DepBugs}. \begin{table}[tb] \caption{Distributions of dependency issues.} \vspace*{-6pt} \label{tab:study} \small \begin{tabular}{|c|l|c|} \hline \multicolumn{2}{|c|}{Classification} & \#Issues \\ \hline \multirow{2}*{\tabincell{c}{Limited user\\experience}} & Failed to link to the library & 70 \\ \cline{2-3} & Linked to a wrong library version & 32 \\ \hline \multirow{2}*{\tabincell{c}{Source code}} & Revise software code & 23 \\ \cline{2-3} & Revise library code & 12 \\ \hline \multirow{3}*{\tabincell{c}{Incompatible\\Dependency}} & Downgrade the library version & 17 \\ \cline{2-3} & Upgrade the library version & 29 \\ \cline{2-3} & Cannot determine from the description & 22 \\ \hline \multicolumn{2}{|c|}{Total}& 205 \\ \hline \end{tabular} \vspace*{-12pt} \end{table} \subsection{How to Prevent Compatibility Failures}\label{subsec:study} To better understand how to prevent \textit{CFailures}, we conduct an empirical study addressing real-world compatibility problems. We collect issues from question and answer sites like StackOverflow by using keywords searching. Simply using keywords like \textit{library, dependency, version} may result in tens of thousands of issues, which require massive manual efforts in the following analysis. Instead, we use the error messages when users come across compatibility problems as keywords. For example, when a library removes a symbol, the application will echo "symbol lookup error" at runtime. When a library symbol adds or removes a parameter, the complier will complain "too few/many parameter to function" at compiling time. In total, we collect 529 issues by using error-message searching. First, we manually analyze root causes of these issues. We find the root causes of 103 issues are incompatible changes in libraries. These changes lead to \textit{CFailures} through misuses of library versions. There are 102 issues caused by dependency problems but not related to compatibility. For example, the original poster fails to link to the library (e.g. missing environment variables). These issues are caused by limited user experiences, and hard to be fixed automatically. Other 324 issues are not related to dependency; thus we ignore the issues. These results indicate library incompatibilities always lead to \textit{CFailures} through incompatible library-application dependencies, while dependency problems are not always caused by incompatibilities. Then, we analyze fixing solutions of the 103 compatibility-related issues, and find these issues can be classified into three types: 12 (11.7\%) issues undo the library changes, 23 (22.3\%) issues update the application code to adapt the library changes, and 68 (66.0\%) issues change the incompatible library version. These results indicate about one third of issues are fixed from the developers' perspective: the latest application version works well against the latest library version. While most issues are fixed from the users' perspective: change the incompatible library version to a compatible one from existing available versions. Finally, we analyze how the original posters change library versions in the 68 issues, and find 29 issues and 17 issues choose to upgrade and downgrade the library versions, respectively. While the other 22 issues cannot be determined from the issue description. \begin{center} \begin{tabular*}{84.5mm}{|p{81mm}|} \hline Finding 1: 66.0\% of \textit{CFailures} can be prevented by changing the incompatible library version to a compatible one from existing available library versions. A tool that can suggest incompatible versions of libraries will help to prevent \textit{CFailures}. \\ \hline \end{tabular*} \end{center} } \section{Existing \textit{DMSs} and Their Limitations}\label{sec:limitation} Manual management of software dependencies is time-consuming and sometimes even error-prone, since an application may depend on many libraries, which keep evolving all the time. In this regard, a common approach, especially in the open-source community, is to use a dependency management system (\textit{DMS}), e.g., \textit{pip}~\cite{PyPA2019pip} for Python, \textit{Maven}~\cite{Apache2019Apache} for Java, \textit{npm}~\cite{npm2019npm} for JavaScript, \textit{apt}~\cite{Ubuntu2019Apt} and \textit{dnf}~\cite{Fedora2019Using} in Linux distributions. These \textit{DMSs} provide interfaces for developers to specify dependencies (i.e., the required libraries and corresponding versions), as well as repositories that contain all libraries. Developers manually specify dependencies, then the \textit{DMSs} can automatically download and install the libraries from the repositories. For a required library, developers can specify a fixed version or a version range. Using a fixed version is a reliable solution because it has little to virtually zero \textit{CFailures}, but it lacks flexibility because critical fixes in later versions of the library cannot be automatically included~\cite{10.1145/3133956.3134059}. While using a version range increases flexibility since it can automatically include critical fixes in later versions of the library, but decreases its reliability because the later versions may also introduce \textit{CFailures}. There is a tradeoff between flexibility and reliability in these two approaches. Developers struggle to find the sweet spot~\cite{10.1109/MSR.2019.00061}. \ignore{ For C/C++ projects, the libraries are usually in two different forms, i.e., static libraries and dynamic (shared) libraries. Static libraries put all the code into the executable file at compile time, so programs will have faster execution times. Programs with static libraries can be regarded as in an isolated environment, where programs are built against a fixed library version, thus have little to virtually zero compatibility problem. The builds are more deterministic, but critical fixes in later versions of the library cannot be automatically included~\cite{10.1145/3133956.3134059}. On the other hand, dynamic libraries defer the linking process until a program starts running. This feature significantly reduces the compiling time, dynamic linking load time, and the size of the executable program~\cite{Nickolas2018Shared}. Programs with dynamic libraries can be regarded as in a shared environment, where programs accept a version range of the target library, thus can automatically include critical fixes in later versions of the library. But dynamic libraries may cause compatibility problems. For example, program \textit{bar} relies on library \textit{libfoo-1}, while program \textit{cat} relies on \textit{libfoo-2}, which is not backward-compatible with \textit{libfoo-1}. When users install \textit{cat} and updates \textit{libfoo-1} to \textit{libfoo-2}, \textit{bar} will suffer compatibility issues. } Most \textit{DMSs} leave this choice to application developers, who can manually limit the version range of each required library. Taking \textit{dnf} as an example, \textit{dnf} is the \textit{DMS} used in RPM-based Linux distributions like Fedora. \textit{dnf} requires application developers to specify the required libraries and version ranges (e.g., \textit{ocaml>=3.08}), which may be outdated: 1)~The version ranges may be too large as libraries evolve. For example, developers specify \textit{libfoo>=1.0} at first, after which \textit{libfoo-2.0} is released and backward incompatible with \textit{libfoo-1.0}. In this case, the version range should be updated to \textit{2.0>libfoo>=1.0}. 2)~The version ranges may be too small as libraries evolve. For example, developers specify \textit{libfoo<=1.0} at first, after which \textit{libfoo-2.0} is released and backward compatible with \textit{libfoo-1.0}. In this case, the version range should be updated to \textit{libfoo<=2.0}. To avoid these limitations, another solution is to maintain a \textit{symbols} file by library developers. This solution is applied in \textit{apt}, the \textit{DMS} in Debian-based Linux distributions like Ubuntu. According to Debian policy~\cite{Debian2019Shared}: 1)~"ABI (Application Binary Interface) changes that are not backward-compatible require changing the \textit{soname}~\cite{Wikipedia2019soname} of the library"; 2)~"A shared library must be placed in a different package whenever its \textit{soname} changes". It means that two library versions should be placed in two library packages, when the versions are backward incompatible. These two packages, to some degree, can be regarded as two different libraries, e.g., \textit{libssl1.0.0} and \textit{libssl1.1}. Library developers are required to maintain a \textit{symbols} file~\cite{Debian2019Shared}, in which each line contains a symbol provided by the library, as well as the minimal version that the symbol is introduced. Then, the version range of this library can be inferred automatically by extracting symbols used by an application. The minimal version of the version range is the maximum value of introducing versions of all used symbols. The maximum version is not necessary since all versions are backward compatible in one package. Finally, the version range is used by \textit{apt} to help users manage dependencies. \ignore{ \begin{figure}[tb] {\centering \resizebox*{0.75\columnwidth}{!} {\includegraphics{figure/library.pdf}} \caption{An example of library evolution~\cite{Debian2019Shared}} \label{fig:library}} \end{figure} } \begin{figure}[tb] {\centering \resizebox*{0.95\columnwidth}{!} {\includegraphics{figure/example.pdf}} \caption{Example usages of library incompatible changes. \small{\emph{Both cockpit-202.1 and homebank-5.2.2 use return values of glib functions, which return void in some glib versions.}}} \label{fig:example}} \vspace*{-6pt} \end{figure} The above solution, however, is still limited since: 1)~There is no mechanism to guarantee that library developers comply with the policy. Library developers may unintentionally introduce ABI incompatibilities between two versions, which have the same \textit{soname}. Existing studies~\cite{10.1145/3236024.3275535, 6975655} show 26\%-33\% of library versions violate semantic versioning, meaning libraries frequently introduce incompatibilities during minor version changes. 2)~This solution only works for binary packages, since \textit{apt} needs to analyze binary files to extract symbols used by the application. Application developers have to manually specify version ranges for source packages, which do not have binary files. In this case, \textit{apt} will suffer from the same limitations as \textit{dnf}. 3)~Library developers need to manually update the \textit{symbols} file when introducing forward incompatible changes. For example, when a \textit{struct} type adds a \textit{field} in a new library version, the introducing version of all symbols using the \textit{struct} must be increased to the version at which the new \textit{field} was introduced. Otherwise, a binary built against the new version of the library may be installed with a library version that does not support the new \textit{field}. This is a common change during library evolutions, failing to update the introducing version of any symbol will lead to \textit{DepBugs}. We will show a real-world example in Section~\ref{sec:motivation}. In summary, the \textit{DMSs} supporting version ranges may introduce \textit{DepBugs} --- the ranges contain incompatible versions. In this paper, we focus on detecting and fixing \textit{DepBugs} in the range-based \textit{DMSs}, so that applications can achieve higher reliability without affecting flexibility. \begin{figure}[tb] {\centering \resizebox*{1\columnwidth}{!} {\includegraphics{figure/overview.pdf}} \caption{Overview of \textit{DepOwl}{}. \small{\emph{\textit{DepOwl}{} contains three major steps: collect incompatible changes, detect dependency bugs, and suggest incompatible versions.}}} \label{fig:overview}} \end{figure} \section{Motivation and Overview of \textit{DepOwl}{}}\label{sec:motivation} In this section, we show a \textit{DepBug} example which motivates us to design \textit{DepOwl}{}. Based on the example, we introduce how \textit{DepOwl}{} works at a high level. \ignore{ The first example is \textit{zlib}, a library used for data compression. The library developers remove the function \textit{gzgetc} (change \textit{gzgetc} to a macro for speed) from \textit{zlib-1.2.5.1} to \textit{zlib-1.2.5.2}. After that, the developers restore \textit{gzgetc} for compatibility from \textit{zlib-1.2.5.2} to \textit{zlib-1.2.5.3}~\cite{Zlib2019ChangeLog}. Any application using \textit{gzgetc} will suffer from \textit{CFailures} if depending on \textit{zlib-1.2.5.2}. These changes affect many application packages in Ubuntu-19.10, e.g., \textit{ccache-3.7.3} (requires \textit{zlib>=1.1.4}) and \textit{mathgl-2.4.4} (requires \textit{zlib>=1.2.0}). Both the packages use the function \textit{gzgetc} and accept \textit{zlib-1.2.5.2}, which does not provide \textit{gzgetc}. The root cause of this example is that the library developers break backward compatibility during minor version changes. } \textbf{Motivating example.} From \textit{glib-2.39.1} to \textit{glib-2.39.2}, the return types of some functions (e.g., \textit{g\_hash\_table\_replace}, \textit{g\_hash\_table\_insert}) changed from \textit{void} to \textit{gboolean}. These changes are: 1) backward compatible --- a binary complied against the old version will ignore the return value of the new version, and there is no error; 2) forward incompatible --- a binary complied against the new version may use the return value, where the old version returns void. These changes may cause \textit{DepBugs} in many applications (e.g., \textit{cockpit-202.1}, \textit{homebank-5.2.2}), where the return values of the changed functions are used. Figure~\ref{fig:example} shows code snippets of two applications. The usage of return values indicates any \textit{glib} version returning void will be incompatible to the applications. However, in Ubuntu-19.10, \textit{cockpit-202.1} depends on \textit{glib>=2.37.6}, and \textit{homebank-5.2.2} depends on \textit{glib>=2.37.3}. Both the version ranges contain the incompatible version \textit{glib-2.39.1}. Therefore, we say \textit{cockpit-202.1} and \textit{homebank-5.2.2} contain \textit{DepBugs} since their version ranges contain incompatible versions. The root cause of the \textit{DepBugs} is that library developers do not update the introducing versions of the changed functions in the \textit{symbols} file of the library. \ignore{ The last example is \textit{sqlite}, a widely-used database engine. The \textit{sqlite3\_module} struct adds a field, \textit{xSavepoint}, from \textit{sqlite\_3.7.6.3} to \textit{sqlite\_3.7.7}. This change is also backward compatible, but still affect some packages, e.g. \textit{qgis-providers} depends on \textit{libsqlite3-0>=3.5.9}. The package uses the \textit{sqlite3\_module} struct and accepts \textit{libsqlite3-0\_3.7.6.3} (from \textit{sqlite\_3.7.6.3}). Meanwhile, as shown in the last code snippet of Figure~\ref{fig:example}, the package uses the \textit{xSavepoint} filed, which is not supported in \textit{sqlite\_3.7.6.3} as yet. These examples are caused by library changes that break backward or forward compatibility. The first example will result in `symbol lookup error' when the affected binaries start running. For the second example, the affected binaries may terminate at runtime if the errors are well handled. Otherwise, the binaries may not print any error message, but generate unexpected results. For the ease of presentation, we introduce some terminologies that will be used throughout the paper: \begin{itemize} \item \textbf{Version pair:} Two library versions where a library change happens, e.g., <2.39.1, 2.39.2> for \textit{glib} in the second example. \item \textbf{Version range:} Library version range required by a software package, e.g., glib>=2.37.6 for \textit{cockpit-202.1}. \item \textbf{Direct problem version:} One library version from a \textit{version pair} that causes software failures, e.g., 2.39.1 for \textit{cockpit-202.1}. \item \textbf{Indirect problem versions:} All library versions that lead to software failures (caused by a library change) and belong to \textit{Version Range}, e.g. 2.37.6<=glib<=2.39.1 for \textit{cockpit-202.1}. \end{itemize} } \textbf{The \textit{DepOwl}{} approach.} \textit{DepOwl}{} can detect \textit{DepBugs} in the above example, and prevent \textit{CFailures} caused by the bugs. Figure~\ref{fig:overview} shows the overview of \textit{DepOwl}{}, which contains three major steps. First, the root causes of \textit{CFailures} are incompatible changes in libraries. \textit{DepOwl}{} collects incompatible changes from any two successive library versions, including both \textit{BICs} and \textit{FICs}. For example, the above example contains two incompatible changes as shown in Table~\ref{tab:changes}. Second, one incompatible change may or may not result in \textit{CFailures}. \textit{DepOwl}{} analyzes usages of the changed element (e.g., \textit{g\_hash\_table\_replace}) in each application, and detects whether the old or new library version of the change is incompatible to the application. If yes, \textit{DepOwl}{} reports a \textit{DepBug} when the incompatible version is included in the required version range of the application. For the above example, the third column of Table~\ref{tab:dependencies} shows the incompatible versions that cause \textit{DepBugs}. \ignore{ For the last example, \textit{DepOwl}{} finds the data-type is used by at least one symbol in the package, and the additional field is also used by the package. Then, \textit{DepOwl}{} determines the problem version is 3.7.6.3, which do not support \textit{xSavepoint} as yet. } \begin{table}[tb] \caption{Examples of \textit{DepOwl}{} results.} \label{tab:workflow} \footnotesize \begin{subtable}[c]{.49\textwidth} \centering \caption{Collecting incompatible changes in libraries.} \label{tab:changes} \begin{tabular}{|c|c|l|} \hline Library & Change Versions & Change Content \\ \hline glib & <2.39.1, 2.39.2> & \textit{g\_hash\_table\_replace} adds return values\\ \hline glib & <2.39.1, 2.39.2> & \textit{g\_hash\_table\_insert} adds return values \\ \hline \end{tabular} \end{subtable} \begin{subtable}[c]{.49\textwidth} \centering \vspace*{6pt} \caption{Detecting \textit{DepBugs} and suggesting incompatible library versions.} \label{tab:dependencies} \footnotesize \begin{tabular}{|c|c|c|c|} \hline Application & Library & \textit{DepBug} & Incompatible Versions \\ \hline cockpit-202.1 & glib>=2.37.6 & 2.39.1 & 2.37.6<=glib<=2.39.1 \\ \hline homebank-5.2.2 & glib>=2.37.3 & 2.39.1 & 2.37.3<=glib<=2.39.1 \\ \hline \end{tabular} \end{subtable} \vspace*{-12pt} \end{table} Third, one incompatible change may cause multiple incompatible versions. \textit{DepOwl}{} suggests all incompatible versions caused by each incompatible change. Users can prevent \textit{CFailures} by avoiding using the incompatible versions. In this step, any version that is both backward and forward compatible to the version reported by the second step (e.g., \textit{glib-2.39.1} for \textit{cockpit-202.1}) will also be regarded as an incompatible version. In our example, the changed functions return void in \textit{glib-2.39.1} and previous versions. Thus, the incompatible version range is \textit{glib<=2.39.1}. Then, \textit{DepOwl}{} calculates the intersection between the incompatible version range and the required version range. For example, the intersection for \textit{cockpit-202.1} is \textit{2.37.6<=glib<=2.39.1}. There are three challenges in the design of \textit{DepOwl}{}: \begin{itemize} \item \textit{DepOwl}{} collects library changes that break either backward or forward compatibility, whereas existing tools mainly focus on detecting backward incompatibilities. To achieve this, we propose a heuristic rule to help \textit{DepOwl}{} detect changes breaking forward compatibilities. \item \textit{DepOwl}{} detects if incompatible changes will cause \textit{DepBugs}. This is challenging because the changes can involve different types (e.g., add a function, remove a parameter). To address this, we categorize the changes and derive a set of rules to detect \textit{DepBugs} for each type. \item \textit{DepOwl}{} suggests all incompatible versions caused by each incompatible change. This is non-trivial because multiple changes may affect the same element. In this regard, \textit{DepOwl}{} performs a global check across all versions to suggest incompatible ones for a changed element. \end{itemize} \section{\textit{DepOwl}{} Approach}\label{sec:design} \begin{figure}[tb] {\centering \resizebox*{1\columnwidth}{!} {\includegraphics{figure/novelty.pdf}} \caption{Difference between \textit{DepOwl}{} and existing tools. \small{\emph{This figure includes source-code level (1, 2) and binary level (3, 4) compatibility between libraries and applications (2, 3), or cross different library versions (1, 4). Existing tools focus on (1, 2, 4), while \textit{DepOwl}{} addresses (3).}}} \label{fig:novelty}} \vspace*{-12pt} \end{figure} There have been some existing techniques (e.g. compilers) on analyzing API usages in applications to check if the application is compatible with a given library version. They work at the source-code level. However, end users often prefer to install binary files directly, instead of downloading source-code files and compiling the applications themselves. Therefore, the users often care more about the binary level compatibility. There has also been some work (e.g. ABI Tracker~\cite{Andrey2019Abi}) on detecting incompatibilities cross different library versions at both source-code and binary levels. This work does not analyze the API usages in applications. As shown in Figure~\ref{fig:novelty}, in this paper, we focus on detecting binary level compatibility between libraries and applications. The compatibility at the source-code level cannot guarantee the compatibility at the binary level, such as modification of virtual tables of classes, change of type sizes of function parameters, change of values of enumeration elements, change of orders of struct fields, change of compilation directives, and so on. Figure~\ref{fig:binary} shows two real-world examples that applications and libraries are compatible at the source-code level, but incompatible at the binary level. In the first example, three APIs in the library \textit{openssl} depend on the compilation directive OPENSSL\_NO\_SSL2. In \textit{openssl-1.0.1s}, the directive is enabled; thus, the APIs are not available in library binaries. While in other versions, the directive is disabled by default. In this case, the source code of \textit{openssl-1.0.1s} is the same as the source code of other versions, but applications using the APIs only fail when linking to \textit{openssl-1.0.1s}. In the second example, the application \textit{ruby-2.5.5} depends on the library \textit{zlib}, which defines \textit{z\_crc\_t} as \textit{unsigned int} after \textit{zlib-1.2.7}. When compiling \textit{ruby} against \textit{zlib-1.2.6}, the compilation directive HAVE\_TYPE\_Z\_CRC\_T is not defined; thus, \textit{z\_crc\_t} is \textit{unsigned long}. When compiling \textit{ruby-2.5.5} against \textit{zlib-1.2.7}, the compilation directive is defined; thus, \textit{z\_crc\_t} is \textit{unsigned int}. The application \textit{ruby-2.5.5} is source-code compatible with both \textit{zlib-1.2.6} and \textit{zlib-1.2.7}. However, when the application is compiled against one version, it will be incompatible to another version at runtime. \begin{figure}[tb] {\centering \resizebox*{0.95\columnwidth}{!} {\includegraphics{figure/binaryexample.pdf}} \caption{Examples of source-code compatible but binary incompatible dependency between libraries and applications.} \label{fig:binary}} \vspace*{-6pt} \end{figure} \ignore{ \begin{figure}[tb] {\centering \resizebox*{1\columnwidth}{!} {\includegraphics{figure/solution.pdf}} \caption{Mismatch examples between applications and libraries. \small{\emph{homebank-5.2.2 and glib-2.39.1 have mismatch and are incompatible, while bluez-5.50 and glib-2.39.2 also have mismatch but are compatible.}}} \label{fig:solution}} \vspace*{-10pt} \end{figure} To achieve this, the straightforward solution is to compare if API usages in application binaries match API definitions in library binaries; if not, further determine if the mismatch can lead to \textit{CFailures}. This is challenging since the mismatch can be in various forms. For example, in Figure~\ref{fig:solution}, \textit{homebank-5.2.2} and \textit{glib-2.39.1} have a mismatch (the symbol signatures are different). They are incompatible since \textit{homebank} may use the return value while \textit{glib} returns void. On the other hand, \textit{bluez-5.50} and \textit{glib-2.39.2} also have a mismatch, which will not lead to \textit{CFailures} since \textit{bluez} returns void and will ignore the return value in \textit{glib}. } \ignore{ Our solution contains three steps: \begin{enumerate} \item \textit{DepOwl}{} leverages existing tools to collect all incompatible changes (e.g., add/remove/change interfaces) during the evolution of the library, including both \textit{BICs} and \textit{FICs}. For example, in Figure~\ref{fig:solution}, there is a \textit{FIC} from \textit{glib-2.39.1} to \textit{glib-2.39.2}. The changes are detected at the binary level. \item Each incompatible change involves two library versions, \textit{DepOwl}{} determines if API usages in applications match API definitions in one of the two library versions. If the change is a \textit{BIC} (\textit{FIC}) and the API usage matches the old (new) library version, the new (old) library version will be regarded as an incompatible version. In Figure~\ref{fig:solution}, \textit{glib} have a \textit{FIC}, and the signature in \textit{homebank-5.2.2} matches the new library version (2.39.2); thus, the old version (2.39.1) is incompatible to \textit{homebank}. \item \textit{DepOwl}{} compares the incompatible version to all other versions. Any version that is both backward and forward compatible to the incompatible version will also be regarded as an incompatible version. For example, in \textit{glib}, the signature of $g\_hash\_table\_insert$ in versions less than 2.39.1 is the same as the signature in 2.39.1. Therefore, \textit{DepOwl}{} suggests \textit{homebank-5.2.2} is incompatible to \textit{glib<=2.39.1}. Users can prevent \textit{CFailures} by avoiding using the incompatible versions. \end{enumerate} } Algorithm~\ref{fig:pseudo} shows how \textit{DepOwl}{} suggests incompatible versions for each pair of library and application <$lib$, $app$> in a software repository (line 1). \textit{DepOwl}{} first collects the set of incompatible changes $IC$ from $lib$ (line 2). Table~\ref{tab:changes} illustrates two examples of incompatible changes. Each incompatible change $ic$ is a three-tuple: <library name, change versions, change content>. The change versions contain the old and new versions involved in the change. For each $ic$ (line 3), \textit{DepOwl}{} then detects whether $ic$ can cause a \textit{DepBug} in $app$, and returns a two-tuple: <$v_{old}$, $v_{new}$> (line 4). If the old (new) version of $ic$ is incompatible to $app$ and included in the version range required by $app$, $v_{old}$ ($v_{new}$) returns the old (new) version number, otherwise $v_{old}$ ($v_{new}$) returns -1. If $v_{old}$ ($v_{new}$) does not return -1 (line 5, line 8), \textit{DepOwl}{} will suggest any version which is both backward and forward compatible to $v_{old}$ ($v_{new}$) as an incompatible version (line 6, line 9). \subsection{Collecting Incompatible Changes}\label{subsec:design1} The first component of \textit{DepOwl}{} takes the library $lib$ as input, and collects its incompatible changes $IC$. As shown in Figure~\ref{fig:failures}, both \textit{BICs} and \textit{FICs} may result in \textit{CFailures}. \textit{DepOwl}{} needs to collect both kinds of library changes. There are existing tools of detecting compatibility problems in libraries, e.g., \textit{ABI-Tracker}~\cite{Andrey2019Abi}, a tool for checking backward compatibility of a C/C++ library. However, the existing tools mainly focus on backward compatibility problems. \textit{DepOwl}{} transfers the forward problems into backward problems. We refer to incompatible changes from version $v_{old}$ to version $v_{new}$ as $IC(v_{old}, v_{new})$: \begin{equation} \small \label{eqn:a} IC(v_{old}, v_{new}) = BIC(v_{old}, v_{new}) \cup FIC(v_{old}, v_{new}), \end{equation} where $BIC(v_{old}, v_{new})$ and $FIC(v_{old}, v_{new})$ stand for \textit{BICs} and \textit{FICs} from $v_{old}$ to $v_{new}$. \textit{DepOwl}{} applies a heuristic rule: forward incompatibility from $v_{old}$ to $v_{new}$ is equivalent to backward incompatibility from $v_{new}$ to $v_{old}$, formalized as: \begin{equation} \small \label{eqn:b} FIC(v_{old}, v_{new}) = BIC(v_{new}, v_{old}). \end{equation} According to Equation~\ref{eqn:a} and Equation~\ref{eqn:b}, we can get: \begin{equation} \small \label{eqn:c} IC(v_{old}, v_{new}) = BIC(v_{old}, v_{new}) \cup BIC(v_{new}, v_{old}). \end{equation} Then, \textit{DepOwl}{} collects both $BIC(v_{old}, v_{new})$ and $BIC(v_{new}, v_{old})$ by using the \textit{ABI-Tracker} tool. For a library with \textit{N} versions, \textit{DepOwl}{} calculates all incompatible changes $IC$ of $lib$: \begin{equation} \small IC = \cup^{i=1}_{i=N-1}IC(v_i, v_{i+1}). \end{equation} During collecting library changes, \textit{DepOwl}{} also consider the following factors: 1)~Library \textit{soname}~\cite{Wikipedia2019soname}. \textit{DepOwl}{} will skip the library changes between $v_{old}$ and $v_{new}$, if $v_{old}$ and $v_{new}$ have different \textit{sonames}. Library versions with different \textit{sonames} will be packaged into different packages; thus will not lead to \textit{DepBugs}. 2)~Symbol versioning~\cite{GNU2019VERSION}. Symbol versioning supports multiple symbol versions in one library version. For example, in \textit{glibc-2.27}, the symbol \textit{glob} has two versions: \textit{glob@@GLIBC\_2.27} and \textit{glob@GLIBC\_2.2.5} (`\textit{@@}' means the default version). \textit{DepOwl}{} regards symbols with different versions as different symbols. \ignore{ 3)~Change severity. The \textit{ABI-Tracker} tool classifies its results according to severity. \textit{DepOwl}{} ignores low-severity changes since they may not lead to \textit{DepBugs}. For example, from \textit{glib-2.63.1} to \textit{glib-2.63.2}, parameter types of some functions change from \textit{char const*} to \textit{gchar const*}. The change will not result in any \textit{CFailures}. } For each library version, \textit{DepOwl}{} requires its binaries compiled with debug symbols. When the input is not available, \textit{DepOwl}{} takes source code as input, and compiles the library with debug symbols itself (we provide compiling scripts to achieve this). \textit{DepOwl}{} uses default compilation directives during the compiling process, and accepts custom directives provided by users at the same time. \begin{algorithm}[tb] \footnotesize \caption{Pseudo-code of the \textit{DepOwl}{} Approach.} \label{fig:pseudo} \begin{algorithmic}[1] \raggedright \Require Library set $Lib$, application set $App$ \Ensure Incompatible version sets $V_{<lib, app>}$ ($lib \in Lib, app \in App$). \For {each pair of <$lib$, $app$>} \State $IC$ = Collect\_Incompatible\_Change($lib$) \For {each $ic \in IC$} \State $[v_{old}, v_{new}]$ = Detect\_Dependency\_Bug($ic$, $app$) \If {$v_{old} \neq -1$} \State $V_{<lib, app>}$ += Suggest\_Incompatible\_Version($ic$, $v_{old}$, $lib$) \EndIf \If {$v_{new} \neq -1$} \State $V_{<lib, app>}$ += Suggest\_Incompatible\_Version($ic$, $v_{new}$, $lib$) \EndIf \EndFor \EndFor \end{algorithmic} \end{algorithm} \subsection{Detecting Dependency Bugs}\label{subsec:design2} The second component of \textit{DepOwl}{} is to analyze usages of the changed element of each $ic$ in $app$, and detect whether $v_{old}$ or $v_{new}$ is incompatible to $app$. If yes, \textit{DepOwl}{} reports a \textit{DepBug} when the incompatible version (i.e., $v_{old}$ or $v_{new}$) is included in the version range required by $app$. When $app$ does not specify any version range, \textit{DepOwl}{} assumes it accepts all versions. As a common usage scenario of \textit{DepOwl}{} is to detect \textit{DepBugs} in a software repository. In this case, \textit{DepOwl}{} takes the repository as input, and for each application package in the repository, \textit{DepOwl}{} detects whether the change can lead to a \textit{DepBug}. It is time consuming to analyze all application packages since a software repository may contain tens of thousands of application packages. In this regard, \textit{DepOwl}{} splits the detecting process into two phases: filtering phase and detecting phase. \textbf{Filtering phase}. \textit{DepOwl}{} first filters out the application package that does not accept the library versions where $ic$ happened. For example, $app$ requires \textit{libfoo>=3.0}, while the $ic$ happened from \textit{libfoo-1.0} to \textit{libfoo-2.0}. To achieve this, \textit{DepOwl}{} analyzes the dependencies of $app$ (e.g. from \textit{control} file in Ubuntu or \textit{.spec} file in Fedora), and extracts the libraries required by $app$, as well as corresponding required version ranges. \textit{DepOwl}{} checks if the library (where $ic$ happens) is included in the required libraries, and if $v_{old}$ and $v_{new}$ of $ic$ are included in the corresponding version range. When either of the above two conditions is not satisfied, it means $ic$ can never affect $app$. In this case, \textit{DepOwl}{} reports no \textit{DepBugs} and stops analyzing. Then, \textit{DepOwl}{} filters out the application package that does not use the changed element in $ic$. For example, the library adds a parameter for a symbol, which is not used in $app$. In general, $ic$ can be classified into two types according to the changed element: change a symbol (e.g., from "\textit{foo()}" to "\textit{foo(node a)}") and change a data type (e.g., from "\textit{struct node \{int i;\}}" to "\textit{struct node \{float f;\}}"). \textit{DepOwl}{} analyzes the binary files contained in $app$. When $ic$ changes a symbol, \textit{DepOwl}{} checks if any binary file requires the symbol by using the \textit{readelf}~\cite{GNU2019Readelf} tool. When $ic$ changes a data type, \textit{DepOwl}{} collects all symbols that use the data type in the library, and checks if any binary file requires any symbol. If yes, it means $ic$ can potentially lead to \textit{CFailures}, and \textit{DepOwl}{} starts the next phase. Otherwise, \textit{DepOwl}{} stops analyzing, and reports no \textit{DepBugs}. \textbf{Detecting phase}. \textit{DepOwl}{} analyzes the usage of the changed element and determines whether $v_{old}$ or $v_{new}$ is incompatible to $app$. If the change is a \textit{BIC} (\textit{FIC}) and the usage matches $v_{old}$ ($v_{new}$), then $v_{new}$ ($v_{old}$) will be regarded as the incompatible version. \textit{DepOwl}{} takes the application binary file with debug symbols as input. When $ic$ changes a symbol, \textit{DepOwl}{} extracts the symbol signature from the binary file. When $ic$ changes a data type, \textit{DepOwl}{} extracts the data-type definition from the binary file. After that, \textit{DepOwl}{} compares if the signature or definition is the same as that of $v_{old}$ or $v_{new}$. If the above input is not available, \textit{DepOwl}{} can also extracts the usage from source code. For example, when working on a software repository, many applications are released without debug symbols. In this case, \textit{DepOwl}{} automatically downloads the source code of each application package. When using the application source code, it is hard to extract symbol signatures or data-type definitions, since the header files are not available. \textit{DepOwl}{} has to apply different rules to determine the incompatible version. For example, when $ic$ adds a field in a \textit{struct}, \textit{DepOwl}{} needs to check if the additional field is used in the source code. When $ic$ changes the type of a return value from \textit{void} to \textit{non-void}, \textit{DepOwl}{} needs to check if the return value is used in the source code. In this regard, we enumerate all types of incompatible changes in C/C++ libraries and define determination rules for each type. The classification and rules are shown in Table~\ref{tab:rules}. We classify library changes into 18 types related to \textit{enum} (1-3), \textit{struct} (4-7), \textit{variable} (8-10), and \textit{function} (11-18). The \textit{struct} and \textit{enum} types are data-type changes, while the \textit{variable} and \textit{function} types are symbol changes. For data-type changes (1-7), \textit{DepOwl}{} needs to confirm that the application uses the changed element in source code, e.g., member for \textit{enum} or field for \textit{struct}. For symbol changes (8-18), \textit{DepOwl}{} has already confirmed that the application uses the changed symbol in the filtering phase. For changes related to "add" or "remove" (1-2, 4-5, 8-9, 11-14, 16-17), once the application uses the changed element, \textit{DepOwl}{} determines the incompatible version is $v_{old}$ or $v_{new}$, respectively. For changes related to "change type" (6, 10, 15, 18), \textit{DepOwl}{} analyzes the usages of changed element, and infers the type in source code. For example, from \textit{zlib-1.2.6.1} to \textit{zlib-1.2.7}, the return type of the function \textit{get\_crc\_table} changed from \textit{long} to \textit{int}. In the source code of package \textit{unalz-0.65}, \textit{DepOwl}{} finds "long *CRC\_TABLE = get\_crc\_table();", i.e., the return type matches version 1.2.6.1. Thus, \textit{DepOwl}{} determines 1.2.7 is the incompatible version. As for change type 3 and 7, it is hard to infer the member value or field order from source code. Thus, \textit{DepOwl}{} cannot determine the incompatible version. We tried to build a complete table with our best effort. We referenced online resources during the enumeration process~\cite{Andrey2019Checker, KDE2019Policies, Josh2019ABI}. For example, changing an inherited class in C++ will generate two totally different symbols in binaries due to name mangling. In this case, \textit{DepOwl}{} will report \emph{function add} and \emph{function remove}. Also, \textit{DepOwl}{} is designed to be flexible to incorporate new rules. \textit{DepOwl}{} uses \textit{srcML}~\cite{Michael2019srcML}, a source-code analysis infrastructure, to achieve the above analyzing. The source code cannot be compiled since the lack of header files, while srcML provides lexical analysis and syntax analysis for non-compilable source code. \textit{DepOwl}{} returns a two-tuple: <$v_{old}$, $v_{new}$> in this step. If the old (new) version in $ic$ is incompatible to $app$ and included in the version range required by $app$, $v_{old}$ ($v_{new}$) returns the old (new) version number, otherwise $v_{old}$ ($v_{new}$) returns -1. \begin{table}[tb] \caption{Rules for determining \textit{DepBugs}.} \label{tab:rules} \footnotesize \begin{tabular}{|c|l|l|c|} \hline ID & Types of Incompatible Changes & \textit{DepOwl}{} Rules & \tabincell{c}{Incomp.\\Version} \\ \hline 1 & Enum adds member & Use the member & $v_{old}$ \\ \hline 2 & Enum removes member & Use the member & $v_{new}$ \\ \hline 3 & Enum changes member value & Use the member & - \\ \hline 4 & Struct adds field$^\dagger$ & Use the field & $v_{old}$ \\ \hline 5 & Struct removes field& Use the field & $v_{new}$ \\ \hline 6 & Struct changes field type & \tabincell{l}{Use the field \& \\ Match the filed type} & $v_{o.}$/$v_{n.}$ \\ \hline 7 & Struct changes field order & Use the field & - \\ \hline 8 & Global variable adds & - & $v_{old}$ \\ \hline 9 & Global variable removes & - & $v_{new}$ \\ \hline 10 & Global variable changes type & Match the var type & $v_{o.}$/$v_{n.}$ \\ \hline 11 & Function adds & - & $v_{old}$ \\ \hline 12 & Function removes & - & $v_{new}$ \\ \hline 13 & Function adds para & Use the para & $v_{old}$ \\ \hline 14 & Function removes para & Use the para & $v_{new}$ \\ \hline 15 & Function changes para type & Match the para type & $v_{o.}$/$v_{n.}$ \\ \hline 16 & Function adds return value& Use the function ret & $v_{old}$ \\ \hline 17 & Function removes return value& Use the function ret & $v_{new}$ \\ \hline 18 & Function changes return type & Match the ret type & $v_{o.}$/$v_{n.}$ \\ \hline \end{tabular} \begin{flushleft} \footnotesize{ $^\dagger$ The \textit{struct} related rules (4-7) also apply for \textit{union} or \textit{class}.\\} \end{flushleft} \vspace*{-6pt} \end{table} \ignore{ \begin{table*}[tb] \caption{Rules for determining \textit{DepBugs}.} \vspace*{-6pt} \label{tab:rules} \small \begin{tabular}{|c|l|c|c|c|c|c|} \hline \multicolumn{2}{|c|}{}&\multirow{2}*{Add}&\multirow{2}*{Remove}&\multicolumn{3}{c|}{Change} \\ \cline{5-7} \multicolumn{2}{|c|}{}&&&Change Type&Change Value&Change Order\\ \hline \multirow{4}*{Type}&Enumeration&&&&& \\ \cline{2-7} &Enumeration Member&$v_{old}$&$v_{new}$&&& \\ \cline{2-7} &Struct/Union/Class&&&&& \\ \cline{2-7} &Struct/Union/Class Field&&&&& \\ \hline \multirow{4}*{Symbol}&Global Variable&&&&& \\ \cline{2-7} &Function&&&&& \\ \cline{2-7} &Function Parameter&&&&& \\ \cline{2-7} &Function Return Value&&&&& \\ \hline \end{tabular} \vspace*{-12pt} \end{table*} } \subsection{Suggesting Incompatible Versions} We refer to the incompatible version reported in the above step (i.e., $v_{old}$ or $v_{new}$) as $v_{bug}$. A library change may lead to multiple incompatible versions beyond $v_{bug}$. In this component, \textit{DepOwl}{} detects all library versions that are incompatible to $app$ caused by $ic$. To achieve this, \textit{DepOwl}{} cannot simply assume the versions less than or greater than $v_{bug}$ as incompatible versions, since the changed element in $ic$ may change again in another $ic$. For example, in \textit{zlib}, developers remove the function \textit{gzgetc} (change \textit{gzgetc} to a macro for speed) from \textit{zlib-1.2.5.1} to \textit{zlib-1.2.5.2}. After that, the developers restore \textit{gzgetc} for compatibility from \textit{zlib-1.2.5.2} to \textit{zlib-1.2.5.3}~\cite{Zlib2019ChangeLog}. In this regard, \textit{DepOwl}{} checks compatibilities of the changed element of $ic$ across all versions of $lib$, and any version that is both backward and forward compatible to $v_{bug}$ will be regarded as an incompatible version. We refer to the changed element in $ic$ as $ele$. Suppose there are \textit{N} library versions. For $\forall i \in [1, N]$, \textit{DepOwl}{} calculates $isIV(v_i)$, a Boolean value indicating whether $v_i$ is an incompatible version: \begin{equation} \small \label{eqn:x} isIV(v_i) = \lnot bbc(v_{bug}, v_i, ele) \land \lnot bfc(v_{bug}, v_i, ele), \end{equation} where $bbc(v_{bug}, v_i, ele)$ and $bfc(v_{bug}, v_i, ele)$ return Boolean values, meaning if $ele$ breaks backward compatibility or breaks forward compatibility from $v_{bug}$ to $v_i$, respectively. If yes, return 1, otherwise return 0. Similar to Section~\ref{subsec:design1}, we have: \begin{equation} \small \label{eqn:y} bfc(v_{bug}, v_i, ele) = bbc(v_i, v_{bug}, ele). \end{equation} Therefore, \textit{DepOwl}{} transforms the above two equations to: \begin{equation} \small isIV(v_i) = \lnot bbc(v_{bug}, v_i, ele) \land \lnot bbc(v_i, v_{bug}, ele). \end{equation} Then, \textit{DepOwl}{} outputs a list of Boolean values $ISIV$, each of them indicates whether a version is incompatible (i.e., 1) or not (i.e., 0): \begin{equation} \small ISIV = [isIV(v_1), isIV(v_2), ..., isIV(v_N)]. \end{equation} For each element (e.g. $isIV(v_i)$) in $ISIV$, if $isIV(v_i)$ equals to 1, and $v_i$ belongs to the version range required by $app$, \textit{DepOwl}{} regards $v_i$ as an incompatible version. Taking the application \textit{cockpit-202.1} as an example, the required version range is \textit{glib>=2.37.6}; while for $\forall j \in$ (\textit{glib<=2.39.1}), $isIV(v_j)$ equals to 1. \textit{DepOwl}{} suggests the incompatible versions are \textit{2.37.6<=glib<=2.39.1}. For an application that is not managed in a software repository, \textit{DepOwl}{} assumes that it accepts all library versions since there is no version ranges. For the given $app$ and $lib$, \textit{DepOwl}{} reports a set of incompatible versions for each $ic$: $IV_{<lib,\ app,\ ic>}$. Suppose there are \textit{M} incompatible changes in $lib$. Finally, \textit{DepOwl}{} suggests all incompatible versions between $app$ and $lib$: \begin{equation} V_{<lib,\ app>} = \cup^{i=1}_{i=M}IV_{<lib,\ app,\ ic_i>}, \end{equation} where $ic_i$ stands for the $i_{th}$ incompatible change. \section{Evaluation}\label{sec:evaluation} To evaluate \textit{DepOwl}{}, we consider three research questions: \vspace*{3pt} \noindent {\bf RQ1:} How effective is \textit{DepOwl}{} at preventing known \textit{CFailures}? This question examines the \textit{recall} of \textit{DepOwl}{} by calculating the percentage of \textit{CFailures} that can be prevented by \textit{DepOwl}{} among all known \textit{CFailures}. \vspace*{3pt} \noindent {\bf RQ2:} How effective is \textit{DepOwl}{} at preventing unknown \textit{CFailures}? This question evaluates the \textit{precision} of \textit{DepOwl}{} by calculating the percentage of correct results among all results reported by \textit{DepOwl}{}. \vspace*{3pt} \noindent {\bf RQ3:} How does \textit{DepOwl}{} compare with existing methods? This question compares \textit{DepOwl}{} with two widely used \textit{DMSs} (i.e., \textit{apt} and \textit{dnf}), as well as the dependencies declared in the build systems (e.g., \textit{autoconf} or \textit{cmake}) by developers\footnote{ The data and source code in this paper are publicly available in https://github.com/ZhouyangJia/DepOwl.}. \vspace*{3pt} \ignore{ \begin{table}[tb] \caption{Library packages used to detect bad dependencies.} \vspace*{-6pt} \label{tab:library} \small \begin{tabular}{|l|l|l|} \hline libglib2.0-0 & libxml2 & libkf5coreaddons5 \\ \hline zlib1g & libcairo2 & libqt5network5 \\ \hline libqt5core5a & libssl1.1 & libpango-1.0-0 \\ \hline libgmp10 & libmpfr6 & libkf5configcore5 \\ \hline libx11-6 & libjpeg8 & libqt5widgets5 \\ \hline libqt5gui5 & libtinfo6 & libgdk-pixbuf2.0-0 \\ \hline libqt5dbus5 & libpng16-16 & dconf-gsettings-backend \\ \hline libgtk-3-0 & libkf5i18n5 & libpangocairo-1.0-0 \\ \hline libxext6 & libsqlite3-0 & libsdl1.2debian \\ \hline libisl21 & libmpc3 & libkf5widgetsaddons5 \\ \hline libasound2 & libqt5xml5 & \\ \hline \end{tabular} \vspace*{-12pt} \end{table} } \begin{table*}[tb] \footnotesize \centering \caption{Examples of reported \textit{DepBugs} in the software repository shipped with Ubuntu-19.10 $^\dagger$.} \label{tab:sample} \begin{tabular}{|c|c|c|l|c|} \hline \multicolumn{2}{|c|}{Application and Library Information} & \multicolumn{3}{|c|}{Results of \textit{DepOwl}{}} \\ \hline Application Package & Library Package & Change Versions & Change Symbol/Data-type& Incompatible Versions \\ \hline qgis-providers\_3.4.10 & libsqlite3-0>=3.5.9 & <3.7.6.3, 3.7.7> & \textit{struct sqlite3\_module} adds \textit{xSavepoint} & [3.5.9, 3.7.6.3] \\ \hline unalz\_0.65-7 & zlib1g>=1.1.4 & <1.2.6.1, 1.2.7> & \textit{get\_crc\_table} changes return value from long to int& [1.2.7, $V_{last}$] \\ \hline elisa\_1.1 & libkf5i18n5>= 5.15.0 & <5.16.0, 5.17.0> & Add \textit{KLocalizedContext(QObject*)} & [5.16.0] \\ \hline gammaray\_2.9.0 & libqt5core5a>=5.12.2 & <5.13.2, 5.14.0> & \textit{qt\_register\_signal\_spy\_callbacks()} changes para type & [5.14.0, $V_{last}$] \\ \hline geeqie\_1:1.5.1-1 & libglib2.0-0>=2.51.0 & <2.51.0, 2.52.0> & \textit{g\_utf8\_make\_valid()} adds parameter \textit{gssize} & [$V_{init}$, 2.51.0] \\ \hline alsa-utils\_1.1.9 & libasound2>=1.1.1 & <1.1.9, 1.2.1> & Remove \textit{snd\_tplg\_new@ALSA\_0.9} & [1.2.1, $V_{last}$] \\ \hline rkward\_0.7.0b-1.1 & libkf5coreaddons5>=5.19.0 & <5.19.0, 5.20.0> & Add \textit{KCoreAddons::versionString()} & [5.19.0] \\ \hline \end{tabular} \begin{flushleft} \footnotesize{$^\dagger$ We illustrate one bug for each library package. The complete \textit{DepBug} list is available in our supplementary materials. } \end{flushleft} \vspace*{-6pt} \end{table*} \subsection{Datasets and Experiment Designs} \label{subsec:dataset} For each research question, we introduce the preparation of datasets, and the measurements used during the evaluation. \textbf{RQ1: Preventing known \textit{CFailures}.} We collected known \textit{CFailures} from StackOverflow by using keyword search. However, simple keywords (e.g., library, dependency, version, etc) may result in tens of thousands of issues, and introduce massive manual efforts in the following analysis. Instead, we used the error messages when users came across compatibility problems as keywords. For example, when a library removes a symbol, the application will echo "symbol lookup error" at runtime. When a library symbol adds or removes a parameter, the complier will complain "too few/many parameter to function" at compiling time. In total, we collected 529 issues by using error-message searching. We then manually analyzed root causes of these issues and found 69 issues involve incompatible changes in libraries. These changes lead to \textit{CFailures} through misuses of library versions. While others are mainly caused by dependency problems but not related to compatibility. Among the 69 issues, 38 of them involve C/C++ programs. Since the current version of \textit{DepOwl}{} handles C/C++ programs, we used the 38 issues to answer RQ1. The applications of 23 issues are code snippets provided by the original posters, while other issues involved 12 mature projects including servers (e.g., Httpd, MongoDB) and clients (e.g., Eclipse, Qt) from different domains. Since the 38 issues were selected by searching error messages, they may not cover certain types of compatibility breaking changes (Table~\ref{tab:rules}) that do not produce observable symptoms. For example, in Table~\ref{tab:rules}, ``changing member values in a enum type (ID 3)" and ``changing field orders in a struct type (ID 7)" may result in errors in a program, but will not generate error messages. Therefore, the 38 issues cannot cover the changes of ID 3 and ID 7. It is hard to collect incompatibilities that have no observable failures, since users cannot be sure if they are actual bugs, thus may not report issues. We measured the effectiveness of preventing known \textit{CFailures} in terms of whether \textit{DepOwl}{} can prevent the \textit{CFailures} in the 38 C/C++ related issues. To achieve this, \textit{DepOwl}{} needs to detect \textit{DepBugs} in these issues. \textit{DepBugs} happen when the version ranges required by applications contain incompatible versions. Fixing the \textit{DepBugs} helps users avoid using incompatible versions and prevent \textit{CFailures}. When an application does not specify a version range, \textit{DepOwl}{} assumes that the application accepts all library versions. \textbf{RQ2: Preventing unknown \textit{CFailures}.} We used the software repository shipped with Ubuntu-19.10 (the latest stable version at the time of writing) to evaluate \textit{DepOwl}{}, since Ubuntu uses \textit{apt}, which can resolve dependencies automatically, while other \textit{DMSs} mainly depend on application developers to manually input dependencies. The repository includes 61,068 packages; each package can be either an application package or a library package. There are 32,069 library packages, which are depended by at least one other package. For each library package, we count the number of application packages that depend on it. We choose the top 1\permil\ (i.e., 32) library packages, which are from 26 different libraries (one library may generate multiple packages, e.g., the \textit{qt} library generates \textit{libqt5core5a}, \textit{libqt5gui5} etc.). For each chosen library, we collect its versions released during about last ten years, and get 841 versions in total (i.e., 32.2 versions for each library on average). It is hard to directly measure the effectiveness of preventing unknown \textit{CFailures}, since the unknown \textit{CFailures} do not happen as yet. Instead, we measure the effectiveness in terms of whether \textit{DepOwl}{} can detect unknown \textit{DepBugs} in the software repository, and prevent potential \textit{CFailures} caused by the \textit{DepBugs}. In specific, for each application package from the software repository, \textit{DepOwl}{} detects whether there are \textit{DepBugs} with regard to the chosen library packages, i.e., the version ranges required by the application package contain incompatible versions. If yes, \textit{DepOwl}{} suggests the incompatible versions that may cause \textit{CFailures}. \textbf{RQ3: Comparing with existing methods.} We used the same dataset in RQ1 to compare \textit{DepOwl}{} with existing methods, and calculated the percentage of issues that can be prevented if the original posters use existing methods. We first compared \textit{DepOwl}{} with two \textit{DMSs} used in industry: 1) \textit{dnf}, used in RPM-based Linux distributions, where application developers manually specify version ranges of required libraries; 2) \textit{apt}, used in DEB-based Linux distributions, where library developers maintain a \textit{symbols} file. We then compared \textit{DepOwl}{} with building scripts (e.g., configure.ac or CMakeList.txt) shipped with application source code, since developers often declare version ranges in the scripts. \ignore{The techniques that are closely related to \textit{DepOwl}{} are the \textit{DMSs} used in industry. In additional, the building scripts (e.g., configure.ac or CMakeList.txt) shipped with application source code can also filter out incompatible library versions. We used two \textit{DMSs} and the build scripts as baselines to assess if \textit{DepOwl}{} is more effective in preventing \textit{CFailures}. The first baseline is \textit{dnf/yum} used in RPM-based Linux distributions, where application developers manually specify the version range of each required library. The second baseline is \textit{apt/apt-get} used in DEB-based Linux distributions, where library developers maintain a \textit{symbols} file. For each application package, the version range of each required library is derived automatically. The third baseline is the version ranges declared in the building scripts shipped with application source code. } \subsection{Results and Analysis}\label{subsec:result} \textbf{RQ1: Preventing known \textit{CFailures}.} Two authors manually evaluated whether \textit{DepOwl}{} can prevent the 38 known \textit{CFailures} by analyzing if the incompatible versions suggested by \textit{DepOwl}{} contain the incompatible version used by the original poster. The result shows \textit{DepOwl}{} successfully suggests incompatible versions for 35 of the 38 C/C++ related issues. The complete list of these issues is available in our supplementary materials. Each issue in the list contains the issue ID, the application name, the library name, and the incompatible versions suggested by \textit{DepOwl}{}. Taking issue 27561492 as an example, library \textit{libpcre} adds function \textit{pcrecpp::RE::Init} from \textit{libpcre-5.0} to \textit{libpcre-6.0}, and changes its parameter type from \textit{libpcre-6.7} to \textit{libpcre-7.0}. Therefore, \textit{DepOwl}{} reports two library changes. Meanwhile, the application \textit{mongodb-2.4} uses \textit{pcrecpp::RE::Init}, and the parameter type is the same as the type from \textit{libpcre-6.0} to \textit{libpcre-6.7}. Thus, \textit{DepOwl}{} reports [$V_{init}$, 5.0]$\cup$[7.0, $V_{last}$]\footnote{$V_{init}$ and $V_{last}$ stand for the first and the last library version that have the same \textit{soname}.} as the incompatible versions. On the other hand, \textit{DepOwl}{} reported three false negatives. Two cases were caused by compilation directives, e.g., the original poster executed and compiled an application on different OS, where the libraries may be compiled with different directives. \textit{DepOwl}{} cannot infer such directives, and thus generates false negatives. The last case missed version information and might have used a very old library version. \textit{DepOwl}{} can prevent \textit{CFailures} in 35 out of the 38 issues. This result indicates \textit{DepOwl}{} can effectively prevent real-world \textit{CFailures} in terms of recall. \textbf{RQ2: Preventing unknown \textit{CFailures}.} \textit{DepOwl}{} collected 27,413 incompatible changes from the 841 versions of the 26 libraries. For each change, \textit{DepOwl}{} detects if the change can cause a \textit{DepBug} for each application package. \textit{DepOwl}{} detected 77 \textit{DepBugs}, of which 49 are caused by backward incompatible changes and 28 are caused by forward incompatible changes. These \textit{DepBugs} involve 69 application packages and 7 library packages. Table~\ref{tab:sample} illustrates one bug for each library package. The complete \textit{DepBug} list is available in our supplementary materials. For example, in the first bug, the application \textit{qgis-providers\_3.4.10} depends on the library \textit{libsqlite3-0>=3.5.9}, which adds the filed \textit{xSavepoint} in \textit{struct sqlite3\_module} from 3.7.6.3 to 3.7.7. The application used the new filed; thus 3.7.6.3 is an incompatible version. \textit{DepOwl}{} then suggests all incompatible versions: [3.5.9, 3.7.6.3]. We searched evidence from new library versions, new application versions, or software repositories to evaluate if the 77 \textit{DepBugs} have been handled in different ways. If not, we further reported them to the repository maintainers. Among the 77 \textit{DepBugs}, library developers undo the library changes of 37 cases in later library version. It means applications may have \textit{CFailures} when using the library versions before undoing the changes. Application developers update the application to adapt the changes in 3 cases, meaning the old application version may have \textit{CFailures}. Besides, 24 \textit{DepBugs} are fixed in the latest version of Ubuntu or Debian. Although these bugs have been handled in different ways, they had been in the system for a long period of time, posing threats to the system reliability. For example, library developers fixed an incompatible version, which had already been released and affected applications. \textit{DepOwl}{} is able to prevent these impacts from the very beginning. For the other 13 cases, we report them to the Ubuntu community, 4 of them have been confirmed by developers, and 8 are pending for response. So far, we only found one potential false-positive case. \textit{DepOwl}{} reported that the library \textit{kcoreaddons-5.19} is incompatible to the application \textit{rkward}, which depends on \textit{kcoreaddons>=5.19}. The developer agreed that the incompatibility may exist, but \textit{kcoreaddons-5.19} is not actually used in any Ubuntu release (Xenial uses kcoreaddons-5.18, Bionic uses kcoreaddons-5.40), thus has zero impact. This result indicates \textit{DepOwl}{} can effectively detect real-world \textit{DepBugs} in terms of precision. This experiment took about 30 hours in a virtual machine with a dual-core CPU and 4G memory. The filtering and detection phases took about five hours (excluding downloading packages). The majority of time was spent on collecting library changes of history versions. This process is one-time effort, since the latest library version can be analyzed incrementally. The execution time of each library depends on its scale and type. When analyzing large C++ libraries like Qt, \textit{DepOwl}{} may need dozens of minutes for each pair of versions. Meanwhile, some other libraries only need several seconds. \ignore{ \begin{table*}[tb] \caption{Evaluation of \textit{DepOwl}{}.} \footnotesize \begin{subtable}[c]{1\textwidth} \centering \caption{Examples of reported \textit{DepBugs} in the software repository shipped with Ubuntu-19.10 $^1$.} \vspace*{-3pt} \label{tab:sample} \begin{tabular}{|c|c|c|c|l|c|} \hline \multicolumn{3}{|c|}{Application and Library Information} & \multicolumn{3}{|c|}{Results of \textit{DepOwl}{}} \\ \hline ID & Application Package & Library Package & Change Versions & Change Symbol/Data-type& Incomp. Versions$^2$ \\ \hline 1 & krita\_1:4.2.7.1 & libqt5gui5>=5.9.0 & <5.9.9, 5.10.0> & Add \textit{QImage::sizeInBytes() const@Qt\_5} & [5.9.0, 5.9.9] \\ \hline 2 & aewan\_1.0.01 & zlib1g>=1.1.4 & <1.2.5.1, 1.2.5.2> & Remove \textit{gzgetc()} & [1.2.5.2] \\ \hline 3 & qgis-providers\_3.4.10 & libsqlite3-0>=3.5.9 & <3.7.6.3, 3.7.7> & \textit{struct sqlite3\_module} adds \textit{xSavepoint} & [3.5.9, 3.7.6.3] \\ \hline 4 & darktable\_2.6.0-1 & libgtk-3-0>=3.21.5 & <3.23.3, 3.24.13> & Remove \textit{gdk\_wayland\_display\_get\_type()} & [3.24.13, $V_{last}$] \\ \hline 5 & krita\_1:4.2.7.1 & libkf5i18n5>=5.19.0 & <5.19.0, 5.20.0> & Add \textit{KLocalizedString::languages()} & [5.19.0] \\ \hline 6 & kmplayer\_1:0.12.0b-3 & libcairo2>=1.6.4 & <1.10.2, 1.12.0> & Add \textit{cairo\_xcb\_surface\_create()} & [1.6.4, 1.10.2] \\ \hline 7 & gammaray\_2.9.0 & libqt5core5a>=5.12.2 & <5.13.2, 5.14.0> & {\scriptsize\textit{qt\_register\_signal\_spy\_callbacks()} changes para type} & [5.14.0] \\ \hline 8 & geeqie\_1:1.5.1-1 & libglib2.0-0>=2.51.0 & <2.51.0, 2.52.0> & \textit{g\_utf8\_make\_valid()} adds parameter \textit{gssize} & [2.51.0] \\ \hline 9 & alsa-utils\_1.1.9 & libasound2>=1.1.1 & <1.1.9, 1.2.1> & Remove \textit{snd\_tplg\_new@ALSA\_0.9} & [1.2.1] \\ \hline 10 & rkward\_0.7.0b-1.1 & libkf5coreaddons5>=5.19.0 & <5.19.0, 5.20.0> & Add \textit{KCoreAddons::versionString()} & [5.19.0] \\ \hline \end{tabular} \begin{flushleft} \footnotesize{$^1$ We randomly illustrate one bug for each library package. The complete \textit{DepBug} list is available in our supplementary materials. \\ $^2$ Incompatible versions reported by \textit{DepOwl}{}. $V_{init}$ and $V_{last}$ stand for the first and the last version, which have the same \textit{soname} to other versions in the range.} \end{flushleft} \end{subtable} \begin{subtable}[c]{1\textwidth} \centering \vspace*{6pt} \caption{Comparison of different methods on preventing \textit{CFailures} of StackOverflow Issues.} \vspace*{-3pt} \footnotesize \label{tab:issues} \begin{tabular}{|c|c|c|c|c|c|c|c|c|} \hline \multicolumn{3}{|c|}{Application and Library Information} & \multicolumn{2}{|c|}{Results of \textit{DepOwl}{}} & \multicolumn{3}{|c|}{Results of Existing Methods} \\ \hline Issue ID & Application & Library & Change Versions & Incompatible Versions & RPM Range$^3$ & DEB Range$^3$ & Source Range \\ \hline 58699992 & code snippet & eigen & <3.3.7, 3.3.9> & [$V_{init}$, 3.3.7] & - & - & - \\ \hline 54086102 & code snippet & libmongoc & <1.6.3, 1.7.0> & [$V_{init}$, 1.6.3] & - & - & - \\ \hline 44767291 & mod\_perl-2.0.10 & libperl & <5.13.5, 5.13.6> & [$V_{init}$, 5.13.5] & \sout{[5.6.1, $V_{last}$]}$^4$ & [5.26.1, $V_{last}$] & \sout{[5.6.1, $V_{last}$]} \\ \hline 41903111 & code snippet & libqt5core & <5.3.2, 5.4.0> & [$V_{init}$, 5.3.2] & - & - & - \\ \hline 32080224 & mongodb-3.0.5 & libssl & <1.0.0t, 1.0.1> & [$V_{init}$, 1.0.0t] & \sout{[$V_{init}$, $V_{last}$]} & [1.0.2d, $V_{last}$] & \sout{[$V_{init}$, $V_{last}$]} \\ \hline 30594269 & libwebkit-1.0.so.2$^5$ & libsoup & <2.29.6, 2.29.90> & [$V_{init}$, 2.29.6] & [2.33.6, $V_{last}$] & [2.29.90, $V_{last}$] & [2.33.6, $V_{last}$] \\ \hline 30571826 & contextBroker-0.22 & libboost & <1.34.1, 1.35.0> & [$V_{init}$, 1.34.1] & \sout{[$V_{init}$, $V_{last}$]} & - & [1.41, $V_{last}$] \\ \hline 29450016 & code snippet & mingwrt & <3.21, 3.22> & - & - & - & - \\ \hline 27561492 & mongodb-2.4 & libpcre & {\scriptsize<5.0, 6.0>, <6.7, 7.0>} & {\scriptsize[$V_{init}$, 5.0]$\cup$[7.0, $V_{last}$]} & \sout{[$V_{init}$, $V_{last}$]} & \sout{[8.35, $V_{last}$]} & \sout{[$V_{init}$, $V_{last}$]} \\ \hline 26795544 & qt-5.3 & xkbcommon & <0.4.0, 0.4.1> & [$V_{init}$, 0.4.0] & [0.4.1, $V_{last}$] & [0.4.1, $V_{last}$] & [0.4.1, $V_{last}$] \\ \hline 23922620 & code snippet & libopencv & <2.4, 3.0> & - & - & - & - \\ \hline 22960067 & asterisk-1.4.0 & ffmpeg & <0.10, 0.11> & - & - & - & - \\ \hline \end{tabular} \begin{flushleft} \footnotesize{ $^3$ The software repository may not include the application version. In this case, we use the version range of the closest application version. For example, in the issue 32080224, \textit{mongodb-3.0.5} does not have a corresponding \textit{deb} package. Alternatively, we use the version range of \textit{mongodb-3.2.11} (which has \textit{mongodb-server\_3.2.11-2+deb9u1\_amd64.deb}). \\ $^4$ The version range contains at least one incompatible version. As a result, there is a \textit{DepBug} in this issue.\\ $^5$ The original poster only provides the object name compiled from source code, but does not provide the application version. } \end{flushleft} \end{subtable} \vspace*{-6pt} \end{table*} } \textbf{RQ3: Comparing with existing methods.} We compared \textit{DepOwl}{} with three existing methods, i.e., \textit{dnf} for \textit{.rpm} packages, \textit{apt} for \textit{.deb} packages, and the building system. For each StackOverflow issue used in RQ1, two authors manually evaluated if the \textit{CFailure} can be prevented by using existing methods when the original poster used the existing methods at first. Taking issue 30594269 as an example, \textit{webkit} has "symbol lookup error" when linking to \textit{libsoup}. The incompatible version range of \textit{libsoup} is [$V_{init}$, 2.29.6]. The version ranges of \textit{libsoup} in three baselines accepted by \textit{webkit} are [2.33.6, $V_{last}$], [2.29.90, $V_{last}$], [2.33.6, $V_{last}$], respectively. Thus, all the three baselines can prevent the failure in this issue. Figure~\ref{fig:range} lists the files where we get these version ranges, including the \textit{webkitgtk.spec} file in the \textit{.rpm} package, the \textit{control} file in the \textit{.deb} package, and the \textit{configure.ac} file in the building system of source code. \begin{figure}[tb] {\centering \resizebox*{0.75\columnwidth}{!} {\includegraphics{figure/range.pdf}} \caption{Version ranges of different baselines.} \label{fig:range}} \vspace*{-6pt} \end{figure} Figure~\ref{fig:compare} shows the results regarding the comparison among \textit{DepOwl}{} and the three baselines. \textit{DepOwl}{} can prevent \textit{CFailures} in 35 issues whereas the baselines can prevent \textit{CFailures} in 3, 7, 5 issues, respectively. Besides, \textit{DepOwl}{} does not report any problems in 3 issues (i.e., 3 false negatives), while the baselines do not report any problems in 27, 27, 26 issues. This is because 23 issues were caused by code snippets provided by the original posters. These code snippets are not managed in any \textit{DMSs} or build systems. Last but not the least, the baselines report \textit{DepBugs} in 8, 4, 7 issues (i.e., the version range contains incompatible versions). \textit{DepOwl}{} successfully prevents 35 \textit{CFailures}, whereas the best baseline prevents 7 \textit{CFailures}. The detailed results are available in our supplementary materials. This result indicates \textit{DepOwl}{} is more accurate than the three baselines. In the mean time, \textit{DepOwl}{} requires no human efforts, while the baselines require manual inputs from either library developers or application developers. \begin{figure}[tb] {\centering \resizebox*{0.9\columnwidth}{!} {\includegraphics{figure/compare.pdf}} \caption{The comparison among \textit{DepOwl}{} and baselines.} \label{fig:compare}} \vspace*{-9pt} \end{figure} \ignore{ \begin{figure}[tb] {\centering \resizebox*{0.8\columnwidth}{!} {\includegraphics{figure/compare.pdf}} \caption{The comparison among \textit{DepOwl}{} and baselines.} \label{fig:compare}} \vspace*{-9pt} \end{figure} \subsection{Threats to validity} \textbf{Threats to external validity.} We do not find any false positives from the 114 \textit{DepBugs} reported by \textit{DepOwl}{}. The result does not indicate \textit{DepOwl}{} can achieve one hundred precent precision for any input. \textit{DepOwl}{} may have bugs during the design or implementation processes, but the bugs are not triggered by our test input. To control this threat, we use a big software repository as the test input, which contains tens of thousands of software packages. \noindent \textbf{Threats to internal validity.} The reported \textit{DepBugs} are evaluated by the authors, who may have limited domain knowledge. As a result, a \textit{DepBug} may be caused by the authors' bad evaluation instead of the detecting ability of \textit{DepOwl}{}. To avoid this, for each reported bug, we simulate the library change and the application usage in a dummy code snippet, and evaluate if the code snippet can cause failures including crashes or unexpected results. \noindent \textbf{Threats to construct validity.} It is hard to evaluate the recall of \textit{DepOwl}{}, since there is no ground truth of false negatives. Alternatively, we reproduce 35 compatibility issues from StackOverflow, and evaluate the percentage of issues that can be prevented by \textit{DepOwl}{}. This result might be biased, since the number of reproduced issues is limited. It is challenge to reproduce issues, as many issues lack important information or require special environments. We reproduce as many issues as possible to approximate the recall. } \section{Discussion and Future Works}\label{sec:discussion} In this section, we discuss limitations in the design of \textit{DepOwl}{}, as well as future works with regard to the limitations. \textbf{Debug symbols of libraries.} To collect incompatible changes (in Section~\ref{subsec:design1}), \textit{DepOwl}{} requires all versions of the library as inputs. Each version should be in the source code form or the binary form with debug symbols. For the binary form, most libraries are released without debug symbols, and do not meet the requirement of \textit{DepOwl}{}. As for the source code form, we need to compile the source code so that \textit{DepOwl}{} can collect Application Binary Interface (ABI) changes. \textit{DepOwl}{} provides scripts to automate the compiling process. This is still limited since \textit{DepOwl}{} uses the default compilation directives; thus cannot collect ABI changes triggered by other directives. As a result, developers have to provide the compilation directives, or \textit{DepOwl}{} may cause false negatives. \textbullet\ \textit{Future work:} The most convenient way to avoid this limitation is to suggest library developers to release binaries with debug symbols when releasing new versions. This practice actually has been applied in some libraries. For example, in the software repository of Ubuntu-19.10, there are 753 packages with the suffix `-dbg' containing debug symbols. \textbf{Code analysis in applications.} When detecting dependency bugs (in Section~\ref{subsec:design2}), \textit{DepOwl}{} requires application binaries compiled with debug symbols. This input is not available in most applications managed in existing \textit{DMSs}. Alternatively, \textit{DepOwl}{} has to use source code as input, but correct usages in source code do not indicate the application is free of \textit{CFailures} in the binary form. For example, the second example of Figure~\ref{fig:binary} shows the usage of \textit{get\_crc\_table} in \textit{ruby-2.5.5}, which works well against both \textit{zlib-1.2.6} and \textit{zlib-1.2.7} in source code level: when \textit{ruby-2.5.5} is compiled against \textit{zlib-1.2.7}, the return type \textit{z\_crc\_t} is \textit{int}; when \textit{ruby-2.5.5} is compiled against \textit{zlib-1.2.6}, the return type \textit{z\_crc\_t} is \textit{long}. However, \textit{ruby-2.5.5} may have \textit{CFailures} when compiled against one version and linked to another version at runtime. This limitation will lead to false negatives. \textbullet\ \textit{Future work:} \textit{DepOwl}{} will provide an interface for application developers to indicate a fixed version for each library. This manual effort is the same to most \textit{DMSs} like \textit{pip} or \textit{Maven}. Thus, \textit{DepOwl}{} can compile the source code against the fixed library version. \textbf{Limitations when using ABI-Tracker.} \textit{DepOwl}{} uses ABI-Tracker to collect incompatible changes of a target library. ABI-Tracker takes source code of the library history versions as inputs and compiles each version with default directives. This process may introduce both false positives and false negatives. For example, in the first example of Figure~\ref{fig:binary}, ABI-Tracker reports that \textit{openssl-1.0.1s} removes three symbols. However, users will not encounter failures when disabling OPENSSL\_NO\_SSL2. In this case, \textit{DepOwl}{} may report false positives, although no false positives directly related to ABI-Tracker are generated in our experiment. On the other hand, when incompatible changes can only be triggered by specific directives, ABI-Tracker may generate false negatives and thus cause \textit{DepOwl}{} to report false negatives. For example, two out of three false negatives in RQ1 are caused by compilation directives not correctly identified by ABI-Tracker. \textbf{Impacts of compilation directives.} The compilation directives of a target library may affect the symbols and data types provided by the library, and further affect the results of \textit{DepOwl}{}. Since ABI-Tracker uses default compilation directives to compile each library version, it may cause \textit{DepOwl}{} to report false negatives (as discussed in the above paragraph). We have mitigated this impact by directly analyzing the binaries of the target libraries without the need of providing compilation directives. In the case where binaries are not available, \textit{DepOwl}{} accepts the directives from users for compiling. In our evaluation, we manually input the directives in most cases. For the two cases that we cannot obtain the directives in RQ1, \textit{DepOwl}{} reports two false negatives, since the directives are hard to be inferred automatically. \ignore{ \begin{figure}[tb] {\centering \resizebox*{0.75\columnwidth}{!} {\includegraphics{figure/fn.pdf}} \caption{A false-negative example of \textit{DepOwl}{}.} \label{fig:fn}} \vspace*{-12pt} \end{figure} } \ignore{ \textbf{Classification of incompatible changes.} We classify incompatible changes into 18 types (in Section~\ref{subsec:design2}) according to 336 symbol/data-type changes used in 3,785 application packages, as well as our experiences learning from online resources. These types may not cover some corner cases, which do not happen in the libraries used in our experiments. Again, \textit{DepOwl}{} may have false negatives caused by this limitation. \textbullet\ \textit{Future work:} \textit{DepOwl}{} will provide interfaces for additional types and rules. In specific, we need to test more libraries to enhance the current classification and corresponding rules for each type. Also, \textit{DepOwl}{} will support custom types and rules from users. \textbf{\textit{DepOwl}{} efficiency.} We evaluated the efficiency of \textit{DepOwl}{}. The experiment in RQ2 took about 30 hours in a virtual machine with a dual-core CPU and 4G memory. Most time was spent on collecting library changes of history versions. This process is an one-time effort, since the latest library version can be analyzed incrementally. In addition, \textit{DepOwl}{} is an offline tool, and not sensitive to efficiency. \textbf{Conflicting dependencies.} When an application accepts a version range of a library, many \textit{DMSs} suggest application developers only specify the minimal library version, e.g., \textit{apt} in Debian or \textit{SDK} in Android~\cite{Android2019Uses}. This is because the \textit{DMSs} assume versions of a library package are backward compatible. There will be no conflicting dependency if no application specifies the maximal library version. However, \textit{DepOwl}{} may introduce the maximal library version. For example, in the fourth example in Table~\ref{tab:sample}, \textit{darktable\_2.6.0-1} depends on \textit{3.21.5<= libgtk-3-0 <=3.23.3}. \textbullet\ \textit{Future work:} One solution is to build a separated environment for each application (e.g. \textit{Maven}). Another solution is to compare the version ranges required by applications, and report conflicts when users install applications with conflicting dependencies. } \section{Related Works}\label{sec:work} We briefly classify the existing works into three types: \textbf{Library changes.} Many works are targeted at library changes. Bagherzadeh~\textit{et al.}~\cite{Bagherzadeh2018} studied the size, type and bug fixes in 8,770 changes that were made to Linux system calls. Brito~\textit{et al.}~\cite{8330214} identified 59 breaking changes and asked the developers to explain the reasons behind their decision to change the APIs. Dig~\textit{et al.}~\cite{doi:10.1002/smr.328, 1510134} discovered that over 80\% of changes that break existing applications are refactorings. Li~\textit{et al.}~\cite{7816486} investigated the Android framework source code, and found inaccessible APIs are common and neither forward nor backward compatible. Li~\textit{et al.}~\cite{10.1145/3196398.3196419} and Wang~\textit{et al.}~\cite{Wang2020Exploring} studied API deprecation in the Android ecosystem and Python libraries. McDonnell~\textit{et al.}~\cite{6676878} found Android updates 115 API per month, and 28\% usages in client applications are outdated with a median lagging of 16 months. Sawant~\textit{et al.}~\cite{8453124} investigated why API producers deprecate features, whether they remove deprecated features, and how they expect consumers to react. Brito~\textit{et al.}~\cite{8330249} identified API breaking and non-breaking changes between two versions of a Java library. Foo~\textit{et al.}~\cite{10.1145/3236024.3275535} presented a static analysis to check if a library upgrade introduces an API incompatibility. Meng~\textit{et al.}~\cite{10.5555/2337223.2337265} aggregated the revision-level rules to obtain framework-evolution rules. Mezzetti~\textit{et al.}~\cite{mezzetti_et_al:LIPIcs:2018:9212} proposed type regression testing to determine whether a library update affects its public interfaces. Ponomarenko~\textit{et al.}~\cite{Ponomarenko2012} presented a new method for automatic detection of backward compatibility problems at the binary level. Wu~\textit{et al.}~\cite{6062100} proposed a hybrid approach to identify framework evolution rules. These works are targeted at detecting changes, refactorings and rules during library evolutions. While \textit{DepOwl}{} is targeted at preventing failures caused by the results of these works. \textbf{Application failures.} Some works focus on \textit{CFailures} in applications. Cai~\textit{et al.}~\cite{10.1145/3293882.3330564} studied compatibility issues in 62,894 Android app to understand the symptoms and causes of these issues. Cossette~\textit{et al.}~\cite{10.1145/2393596.2393661} studied techniques to help migrate client code between library versions with incompatible APIs. Dietrich~\textit{et al.}~\cite{6747226} studied partially upgrading systems, and found some crucial verification steps are skipped in this process. Jezek~\textit{et al.}~\cite{JEZEK2015129} studied the compatibility of API changes, and the impact on programs using these libraries. Lamothe~\textit{et al.}~\cite{10.1145/3196398.3196420} reported their experience migrating the use of Android APIs based on documentation and historical code changes. Linares-V\'{a}squez~\textit{et al.}~\cite{10.1145/2491411.2491428} studied how the fault- and change-proneness of APIs relates to applications' lack of success. Xavier~\textit{et al.}~\cite{7884616} conducted a large-scale study on historical and impact analysis of API breaking changes. Balaban~\textit{et al.}~\cite{10.1145/1094811.1094832} presented an approach to support client refactoring for class library migration. He~\textit{et al.}~\cite{10.1145/3238147.3238185} and Xia~\textit{et al.}~\cite{Xia2020How} studied API compatibility in Android. Henkel~\textit{et al.}~\cite{1553570} captured API refactoring actions, and users of the API can then replay the refactorings to bring their client software components up to date. Jezek~\textit{et al.}~\cite{6619503} proposed an approach that analyses the byte-code of Java classes to find type inconsistencies cross components. Li~\textit{et al.}~\cite{10.1145/3213846.3213857} proposed a approach for modeling the lifecycle of the Android APIs, and analyzing app that can lead to potential compatibility issues. Perkins~\textit{et al.}~\cite{10.1145/1108792.1108818} proposed a technique to generate client refactorings, by replacing calls to deprecated methods by their bodies. Wang~\textit{et al.}~\cite{8812128} proposed an automated approach that generates tests and collects crashing stack traces for Java projects subject to risk of dependency conflicts. Xing~\textit{et al.}~\cite{4359473} recognized the API changes of the reused framework, and proposed plausible replacements to the obsolete API based on working examples. These works focus on detecting incompatible API usages and helping applications co-evolve with library evolutions, so that the latest application version works well. While \textit{DepOwl}{} can prevent \textit{CFailures} for users' in-use versions. \textbf{Application-library dependencies.} There are many works address application-library dependencies. Bavota~\textit{et al.}~\cite{Bavota2015} studied the evolution of dependencies between projects in the Java subset of the Apache ecosystem. Bogart~\textit{et al.}~\cite{10.1145/2950290.2950325} studied three software ecosystems to understand how developers make decisions about change and change-related costs. Decan~\textit{et al.}~\cite{8721084} compared semantic-versioning compliance of four software packaging ecosystems, and studied how this compliance evolves over time. Decan~\textit{et al.}~\cite{Decan2019} analyzed the similarities and differences between the evolution of package dependency networks. Derr~\textit{et al.}~\cite{10.1145/3133956.3134059} studied library updatability in 1,264,118 apps, and found 85.6\% libraries could be upgraded by at least one version. Dietrich~\textit{et al.}~\cite{10.1109/MSR.2019.00061} studied developers' choices between fixed version and version range from 17 package managers. Jezek~\textit{et al.}~\cite{6928807} provided evidences that four types of problems caused by resolving transitive dependencies do occur in practice. Kikas~\textit{et al.}~\cite{10.1109/MSR.2017.55} analyzed the dependency network structure and evolution of the JavaScript, Ruby, and Rust ecosystems. Kula~\textit{et al.}~\cite{Kula2018} studied 4,600 GitHub projects and 2,700 library dependencies to understand if developers update their library. Mirhosseini~\textit{et al.}~\cite{10.5555/3155562.3155577} studied 7,470 GitHub projects to understand if automated pull requests help to upgrade out-of-date dependencies. Pashchenko~\textit{et al.}~\cite{10.1145/3239235.3268920} studied whether dependencies of 200 OSS Java libraries are affected by vulnerabilities. Raemaekers~\textit{et al.}~\cite{6975655} investigated semantic versioning, and found one third of all releases introduce at least one breaking change. Xian~\textit{et al.}~\cite{Xian2020Automated} conducted an experience paper to evaluate existing third-party library detection tools. Wang~\textit{et al.}~\cite{10.1145/3236024.3236056} conducted an empirical study on dependency conflict issues to study their manifestation and fixing patterns. Zerouali~\textit{et al.}~\cite{10.1007/978-3-319-90421-4_6} analyzed the package update practices and technical lag for the npm distributions. These works mainly assist people in understanding application-library dependencies. While \textit{DepOwl}{} is the first research work to help users avoid incompatible application-library dependency automatically. Huang~\textit{et al.}~\cite{Huang2020Interactive} and Wang~\textit{et al.}~\cite{Wang2020Watchman} designed tools to detect dependency conflicts for Maven and PyPI ecosystems. These tools focused on the diamond dependency problem, which detects conflicts among different dependencies. They assume each dependency itself is correct, whereas \textit{DepOwl}{} detects bugs within dependencies. \section{Conclusion}\label{sec:conclusion} In this paper, we find \textit{CFailures} are caused by using incompatible library versions, which are hard to be prevented by the existing research works or industrial \textit{DMSs}. To fill this gap, we design and implement \textit{DepOwl}{}, a practical tool to prevent \textit{CFailures} by avoiding incompatible versions. \textit{DepOwl}{} can detect unknown \textit{DepBugs} in the software repository shipped with Ubuntu-19.10, and prevent \textit{CFailures} in real-world issues collected from StackOverflow. However, \textit{DepOwl}{} still has limitations in practice. With limited helps from library developers (release binaries with debug symbols) and application developers (provide one required library version), \textit{DepOwl}{} could achieve higher accuracy. As a result, applications could be both flexible for library evolutions and reliable for \textit{CFailures}. \section*{Acknowledgment} \bibliographystyle{IEEEtran}
\section{Introduction} \label{sec:intro} To date, the safety assurance of automated vehicles of SAE Levels 4 and 5~\cite{SAE18} (AVs) has been an open issue, which is partially because the environment perception of AVs is subject to uncertainties. AVs perceive their environment through a sensor setup that typically consists of at least camera, radar, and lidar sensors. Perception algorithms, which typically use machine learning, % then process and fuse the raw sensor data to a world model that is handed over to the subsequent functional modules. % Typical world models contain a list of objects, where each object corresponds to a road user or other movable entity surrounding the AV~\cite{Dietmayer2014representation}. Uncertainties in this world model can be caused by environmental influences, sensing hardware, perception software, and other factors. These uncertainties can be divided into state, existence, and classification uncertainties~\cite{dietmayer2016predicting}. Respective examples are that a road user's velocity is estimated too slow, the road user is not detected at all, or a pedestrian is classified as a cyclist. \begin{figure}[t] \centering \vspace*{2mm} \includegraphics[width=\linewidth]{graphics/taxonomy_general.pdf} \caption{Taxonomy of Stellet et al.~\cite{stellet2015testing}, applied to perception testing: A real-world scenario is simultaneously observed by a reference perception system and by a perception subsystem under test. Their results are compared using metrics, which allows to evaluate test criteria.} \label{fig:taxonomy_general} \end{figure} For AV subsystems that are mostly defined by software, the real-world testing effort can be substantially reduced through simulated tests. However, as the sensor hardware interacts with the real environment in complex ways that are hard to replicate in simulations, real-world tests remain pivotal. In the current literature, there does not yet exist a common methodology for the execution of real-world perception tests. Under which criteria is the environment perceived ``well enough"? In which scenarios should the environment perception be tested? How can one obtain the true environment state during these scenarios? Summarizing these questions, the primary research question of this review is: \begin{displayquote} \textit{How can perception tests be realized to assess that an uncertain perception subsystem allows safe AV behavior?} \end{displayquote} To structure the diverse literature contributions to this general question, we apply the axes of the testing taxonomy by Stellet et al.~\cite{stellet2015testing} to perception testing % (Fig.~\ref{fig:taxonomy_general}). The taxonomy states that testing is an evaluation of \begin{displayquote} ``A statement on the system-under-test (\textit{test criteria}) that is expressed quantitatively (\textit{metric}) under a set of specified conditions (\textit{test scenario}) with the use of knowledge of an ideal result (\textit{reference})." \end{displayquote} \begin{figure*}[t] \centering \vspace*{2mm} \includegraphics[width=\linewidth]{graphics/amersbach_layers.pdf} \caption{Left: % Functional decomposition layers and interfaces of Amersbach and Winner~\cite{amersbach2017functional}, focused on perception. Right: terms that are used in this paper, mapped to the layers of~\cite{amersbach2017functional}. % } \label{fig:amersbach_layers} \end{figure*} \subsection{Motivation for a Review} The current literature from the areas of perception development, automotive safety assurance, and safety in artificial intelligence contains valuable approaches to all mentioned testing axes. For a successful safety proof, approaches to individual axes have to seamlessly fit into an overall methodology. Prior to writing, we found it difficult to identify how the available approaches complement each other, which is why we are aiming at providing a structured overview of the state of the art. The goal of this review is to enable the development of holistic concepts for testing the safety-relevant uncertainties of environment perception. % \subsection{Structure and Contributions} Related Reviews, Surveys, and Overviews (Sec.~\ref{sec:related_work}) reviews previous secondary literature. Methods (Sec.~\ref{sec:methods}) defines the scope and the literature search process. Our main contributions are overviews on: \begin{itemize} \item Perception Testing in Safety Standards (Sec.~\ref{sec:standards}) % \item Established perception testing that does not directly target the primary research question (Sec.~\ref{sec:established}) \begin{itemize} \item Perception Algorithm Benchmarking (Sec.~\ref{sec:developer_testing}) \item Object-Lvl. Data-Driven Sensor Modeling (Sec.~\ref{sec:sensor_modeling}) \end{itemize} \item Approaches to the research question, structured by the three individual testing axes \begin{itemize} \item Test Criteria and Metrics (Sec.~\ref{sec:axis_criteria_metrics}) \item Test Scenarios (Sec.~\ref{sec:axis_test_scenarios}) \item Reference Data (Sec.~\ref{sec:axis_ref_data}) \end{itemize} \end{itemize} Finally, the Discussion of Review Results (Sec.~\ref{sec:discussion}) % highlights the largest issues for answering the research question, points out intersection topics between the testing axes, and puts the topics of this review in a larger context. % \begin{table*}[t] \centering \caption{Thematic focus of this review paper} \label{table:focus_of_paper} \begin{tabularx}{\linewidth}{ >{\hsize=0.35\hsize}X >{\hsize=0.75\hsize}X >{\hsize=0.85\hsize}X } \toprule \parnoteclear % \textbf{Category} & \textbf{Focused aspect} & \textbf{Related aspects outside of main focus} \\ \midrule Location in V-model % & Right-hand side (offline testing for verification and validation purposes) & Left-hand side; developer testing; runtime monitoring; data gathering for requirements identification~(\cite{Koopman2018towardFramework}); shadow mode \\ \hline Test method and target & Black-box testing of interface between perception and planning; description of perception output & White-box testing inside the perception or planning subsystems; % description of planning sensitivity \\ \hline Safety concept & Safety of the intended functionality (SOTIF, see~\cite{iso2019sotif}), specifically object and event detection and response (OEDR) for collision mitigation & Functional safety according to ISO 26262; Extension of ISO~26262 w.r.t. machine learning; cybersecurity; physical harm caused by sensors \\ \hline Open/closed loop testing & Open-loop testing (enables offline testing of various perception algorithms on recorded raw sensor data) % & Closed-loop testing \\ \hline Environmental entity & Moving and non-moving other road users & Ego vehicle localization, static obstacles, road infrastructure, traffic signs, traffic lights, drivable space, auditory information \\ \hline Environment representation format & Object list & Sensor raw data, object-independent environmental features, occupancy grid map, parametric drivable space \\ \bottomrule \end{tabularx} \parnotes \end{table*} \subsection{Term Definitions} \label{sec:definitions} The following term definitions are used throughout the rest of this paper. % Fig.~\ref{fig:amersbach_layers} illustrates the relations between different terms by using the the layered decomposition of an automated driving (AD) system by~\cite{amersbach2017functional}. \subsubsection{Perception Subsystem} \label{sec:def_perception_subsystem} The AV's subsystem for environment perception is defined by at least sensor mounting positions (part of Layer~0), the sensors themselves that generate raw data (Layer~1), and perception software (Layer~2) (Fig.~\ref{fig:amersbach_layers}). \subsubsection{System Under Test} \label{sec:def_sut} Perception subsystem of a subject vehicle/ego vehicle. Abbreviation: SUT. \subsubsection{Environment Perception} \label{sec:def_environment_perception} The process of environment perception consists of the mentioned perception subsystem, which is being affected by environmental influences that are outside the control of it (rest of Layer~0; Fig.~\ref{fig:amersbach_layers}). These environmental influences determine if and how the individual parts of the ground truth information are accessible~\cite{amersbach2017functional}. \subsubsection{Perception Algorithm} \label{sec:def_perception_algo} Software that computes an object-based world model from the raw sensor data (adapted from~\cite{VVM2020Begriffsregister}). Generally includes both traditional code and components that are trained on data. Corresponds to Layer~2 (Fig.~\ref{fig:amersbach_layers}). \subsubsection{World Model} \label{sec:def_world_model} Representation of the ego vehicle's environment and own state that is computed by a perception algorithm (adapted from~\cite{VVM2020Begriffsregister}). Equal to a subjective scene at the interface between Layers 2 and 3 (Fig.~\ref{fig:amersbach_layers}). The most essential world model component in this paper is the current state of dynamic object tracks. \subsubsection{Safety} ``absence of accidents, where an accident is an event involving an unplanned and unacceptable loss"~\cite[p.\,11]{leveson2016engineering}. % Unless stated otherwise, safety in this paper means \textit{safety of the intended functionality} (SOTIF) of the AV (see~\cite{iso2019sotif}) rather than functional safety according to ISO 26262~\cite{ISO_26262_2018}. \subsubsection{Reliability} \label{sec:def_reliability} ``probability that something satisfies its specified behavioral requirements over time and under given conditions -- this is, it does not fail"~\cite[p.\,10]{leveson2016engineering}. % \subsubsection{Uncertainty} \label{sec:def_uncertainty} ``doubt about the validity of the result of a measurement", or a quantitative measure of this doubt~\cite{JCGM2008GUM}. Uncertainty in object-based world models can be state, existence, or classification uncertainty~\cite{dietmayer2016predicting}, as mentioned before. \subsubsection{Scenario} \label{sec:def_scenario} ``A scenario describes the temporal development between several scenes in a sequence of scenes. [...]" \cite{Ulbrich2015}. For open-loop perception testing, we assume that the temporal development of all ground truth scenes is given, including environmental influences and all road user trajectories. What is to be determined in a test scenario is how the SUT subjectively observes the objective scenes in its world model (more in Sec.~\ref{sec:what_are_perc_scenarios}). \subsubsection{Metrics} \label{sec:def_metric} Functions that compute properties of interest about the SUT. We use the microscopic/macroscopic terminology for metrics of~\cite{Junietz2019DissRiskMetrics}, where \textit{microscopic} refers to a single scene for a single ego vehicle within a single scenario, and \textit{macroscopic} refers to the average over an entire fleet of identical vehicles that encounters various scenarios and scenes. \section{Related Reviews, Surveys, and Overviews} \label{sec:related_work} Previous reviews partially cover the targeted topic of this paper. For example, the surveys by Stellet et al.~\cite{Stellet2020ValidationSurvey},~\cite{stellet2015testing}, Riedmaier et al.~\cite{Riedmaier2020_surveySBT}, Nalic et al.~\cite{Nalic2020sbt_survey}, and the PEGASUS method~\cite{Pegasus2019Overview} deal with testing and safety assurance of AVs in general, but without specifically analyzing the interface between perception and planning. A systematic literature review of the Swedish SMILE project targets verification and validation for machine learning based systems in AD~\cite{borg2018safely}, however, without focusing specifically on environment perception. Literature reviews about AV sensing and perception like~\cite{marti2019review},~\cite{Rosique2019}, and~\cite{Zhu2017PerceptionOverview} provide the technological state of the art, but do not explicitly focus on testing or safety assurance. Furthermore, there are publications that provide a valuable overview over current safety challenges for AV environment perception, but which are not explicitly literature reviews~\cite{Willers2020safety},~\cite{Burton2017SafetyML_HAD}. For example,~\cite{Willers2020safety} identifies safety concerns and mitigation approaches for safety-critical perception tasks that rely on deep learning. % In summary, we aim to fill the existing gap in literature reviews by analyzing literature related to the main research question in depth throughout the rest of this paper. \section{Methods} \label{sec:methods} The methods of this literature review are loosely inspired by the guidelines for systematic literature reviews~\cite{Kitchenham2007guidelinesSLR} and snowballing search~\cite{wohlin2014snowballing}, and respective example applications of both in~\cite{Schalling2019LidarBenchmarking} % and~\cite{borg2018safely}. The suggested guidelines are purposely not followed exactly, because they were designed for reviewing quantitative and empirical research rather than qualitative or position papers, which are, however, common in the current automotive safety assurance domain. \begin{table*}[t] \centering \caption{Iterations of snowballing literature search. *Considered leaf search results without further search because of thematic distance to primary research question.} \label{table:snowballing_iterations} \begin{tabularx}{\linewidth}{ >{\hsize=0.15\hsize}X >{\hsize=1.85\hsize}X } \toprule \textbf{Snowballing iteration} & \textbf{Found sources for further forward and backward snowballing search (58 publications total)} \\ \midrule Start set \newline & { \textbf{From undocumented search:} Salay et al.~\cite{Salay2020_purss},~\cite{Salay2019_safety_perceptual_components}, Salay and Czarnecki~\cite{Salay2019partialspecifications}, Czarnecki and Salay~\cite{Czarnecki_2018_Framework}, Berk et al.~\cite{berk2019exploiting},~\cite{Berk2019ReferenceTruth}, % Shalev-Shwartz et al.~\cite{shalevshwartz2017formalRSS}, Amersbach and Winnner~\cite{amersbach2017functional}, Stellet et al.~\cite{Stellet2020ValidationSurvey}, Brahmi et al.~\cite{brahmi2013reference}, Cassel et al.~\cite{Cassel2020SAEPerceptionRequirements}; \newline \textbf{From undocumented and keyword search:} Berk~\cite{Berk2019Dissertation}, Stellet et al.~\cite{stellet2015testing}, Salay et al.~\cite{Salay2017MLIso26262}, Ulbrich et al.~\cite{Ulbrich2015}; \newline \textbf{From keyword search:} Borg et al.~\cite{borg2018safely}, Willers et al.~\cite{Willers2020safety}, Burton et al.~\cite{Burton2017SafetyML_HAD}, Ta{\c{s}} et al.~\cite{tas2016functional}, Kaprocki et al.~\cite{kaprocki2019multiunit}, Martin et al.~\cite{Martin2019}, Bai et al.~\cite{Bai2019_external_influence_factors_sensing} (22 publications). } \\ \hline Iteration 1 & Ulbrich et al.~\cite{ulbrich2017functional}*, Althoff~\cite{althoff2010reachability}*, Bagschik et al.~\cite{Bagschik2018_ontology}*, Burton et al.~\cite{Burton2019confidence_arguments}, Koopman and Fratrik~\cite{Koopman2019_howMany}, \cite{Koopman2018towardFramework}, Kubertschak et al.~\cite{Kubertschak2014kamerabasiertes}, Strigel et al.~\cite{Strigel2014_KoPerDataset}, Berk et al.~\cite{Berk2020summary}, % \cite{Berk2017BayesianTestDesign}*, \cite{Berk2019rainfall}*, Johansson and Nilsson~\cite{Johansson2016perceptionASIL}*, Johansson et al.~\cite{Johansson2017assessingUseOfSensors}*, Bock et al.~\cite{Bock2016testEffortEstimation}*, Rivero et al.~\cite{Rivero2017roadDirtLidar}*, Rasshofer et al.~\cite{Rasshofer2011influences}*, Fawcett~\cite{Fawcett2006ROC}*, Cao and Huang~\cite{cao2018application}, Czarnecki et al.~\cite{Czarnecki2018OntologyPart2}*, Meyer~\cite{Meyer1992designByContract}*, Guo~\cite{Guo2017calibration}*, Salay and Czarnecki~\cite{Salay2018UsingMLSafely}, % Schwaiger et al.~\cite{Schwaiger2020uncertainty}, Arnez et al.~\cite{Arnez2020_uq_comparison}, Piazzoni et al.~\cite{Piazzoni2020Modeling_conference}, Weast~\cite{Weast2020}, Klamann et al.~\cite{Klamann2019}*, Aravantinos and Schlicht~\cite{Aravantinos2020}*, Breitenstein et al.~\cite{Breitenstein2020visual}* (29 publications). \\ \hline Iteration 2 % & Henne et al.~\cite{henne2020benchmarking}, Fleck et al.~\cite{Fleck2019testAreaBW}, Spanfelner et al.~\cite{Spanfelner2012ChallengesISO26262}*, Rahimi et al.~\cite{Rahimi2019requirements}, Czarnecki~\cite{Czarnecki2019devOps}*, Feng et al.~\cite{Feng2018uncertainty}*,~\cite{Feng2019calibrationECE} (7 publications). \\ \bottomrule \end{tabularx} \end{table*} \subsection{Thematic Scope} Table~\ref{table:focus_of_paper} summarizes the focus of this literature review. Literature that matches more focused aspects is more likely to be included and discussed in detail, whereas literature about related aspects outside the main focus might still be referenced to provide context where the actually targeted literature was sparse. \subsection{Literature Search Process} Three search processes were performed to accumulate the references of this paper. First, undocumented searches provided an initial knowledge base. Second, a keyword-based search complemented the starting set for a final iterative snowballing search. While the undocumented search provided most references about standards and established testing approaches, the inclusion criteria of the documented search targeted specifically the primary research question and its test axes. \subsubsection{Undocumented Search} All references that are not part of Table~\ref{table:snowballing_iterations} were obtained through undocumented search processes before and during the writing process. % \subsubsection{Keyword Search} The following strings were searched in Google Scholar, allowing results in the time frame between 01/01/2010 and 20/08/2020: \begin{itemize} \item (``automated driving" OR automotive) AND (perception OR sensing) AND (verification OR validation OR safety OR reliability OR sotif OR standard OR requirements OR specification OR testing OR metric) \item (``automated driving" OR automotive) AND (perception OR sensing) AND (reference OR data OR test OR criteria) \end{itemize} For both search strings, the top 250 results were analyzed. 20 publications were identified as candidates for the start set of the subsequent snowballing search, out of which 11 were actually included (see Table~\ref{table:snowballing_iterations}). \subsubsection{Snowballing Search} The results from the other search processes formed a start set, based on which we performed a forward and backward snowballing search~\cite{wohlin2014snowballing} in fall 2020 using Google Scholar to fill possible gaps. Forward snowballing means searching through the citations that a publication has received, while backward snowballing means searching through the references it itself has included. Both directions were searched within the same iteration, respectively (Table~\ref{table:snowballing_iterations}). Included snowballing search results that are not directly related to the primary research question or to at least one of the three testing axes were excluded from the further search (marked with * in Table~\ref{table:snowballing_iterations}) to keep the search process efficient and the overall effort feasible. Eventually, we removed the third iteration, which consisted of two sources, and some sources from iterations 1 and 2 due to irrelevance for the final version. \section{Perception Testing in Safety Standards} \label{sec:standards} Safety standards, guidelines, and frameworks can prescribe certain aspects around perception testing in safety assurance. Thus, we first review the explicit role of perception testing in standardizing literature before moving on to more concrete realizations of perception tests in the subsequent sections. \subsection{ISO 26262} % ISO 26262~\cite{ISO_26262_2018} addresses the assurance of functional safety of electric and electronic systems in the automotive domain. It has been the most essential safety standard for advanced driver assistance systems (ADAS), but has not been developed to assure the safety of AD systems that rely on environment perception or use machine learning~\cite{Salay2017MLIso26262}. Consequently, the literature investigates how ISO 26262 could be adapted or extended to also cover machine-learning-based components such as modern environment perception systems, see e.g.~\cite{borg2018safely}. One major issue that prevents the concepts of ISO 26262 from being applied to AV environment perception is that the perception subsystem is said to be not fully specifiable (except for defining a training set), while ISO 26262 implicitly assumes that all functionality must be specified~\cite{Salay2017MLIso26262},~\cite{Salay2018UsingMLSafely}. This means that the environment perception is also not fully verifiable and perception testing is in general incomplete~\cite{Salay2017MLIso26262}. Nevertheless, ISO 26262's workflow for Safety Elements out of Context (SEooC)~\cite[Part~10]{ISO_26262_2018} might be a hint on how the development of a perception subsystem (safety element) could at least be generally organized while the rest of the driving function (context) is not known. \subsection{ISO/PAS 21448} % A vehicle that is perfectly functionally safe according to ISO 26262 can still cause accidents if its behavioral logic is wrong~\cite{shalevshwartz2017formalRSS}. Addressing this issue, ISO/PAS 21448~\cite{iso2019sotif} introduces the concept of the so-called Safety of the Intended Functionality (SOTIF). The standard describes how SOTIF should be assured for ADAS up to SAE Level 2 and acknowledges that it is likely not sufficient for higher levels of automation. According to~\cite[Clause~7]{iso2019sotif}, so-called \textit{triggering events} ``that can trigger potentially hazardous behavior shall be identified", and their impact on the SOTIF shall be assessed. Triggering events related to sensor disturbances can be caused for example by poor weather conditions or poor-quality reflections. They can cause errors in the world model if corresponding \textit{functional insufficiencies} in the perception subsystem exist~\cite{Willers2020safety}. Once triggering events for the perception subsystem have been identified (see e.g.~\cite{Martin2019}, \cite[Annex~F]{iso2019sotif}) as part of the so-called sensor verification strategy~\cite[Sub-Clause~10.2]{iso2019sotif}, they can also serve as test scenarios for it. Furthermore, \cite[Annex~D]{iso2019sotif} lists non-comprehensive example aspects to consider in verification testing of the perception subsystem, but leaves open the concrete realization of those tests. \subsection{NHTSA Vision and Framework} In ``Automated Driving Systems 2.0: A Vision for Safety"~\cite{NHTSA2017vision_for_safety2}, the National Highway Traffic Safety Administration (NHTSA) and the U.S. Department of Transportation (DOT) follow a ``nonregulatory approach to automated vehicle technology safety". AV manufacturers are allowed and % required to follow and document their own individual safety assurance processes, which intends to support innovation rather than hindering it. Twelve so-called safety design elements are mentioned, where the one most relevant to this paper is \textit{Object and Event Detection and Response} (OEDR) -- the capability to ``detect any circumstance that is relevant to the immediate driving task" and respond to it. A more recent and more detailed publication of NHTSA defines a framework for testing AD systems~\cite{Thorn2018NHTSA}. This framework also addresses OEDR and further defines a taxonomy that can help describing an operational design domain (ODD) for an AV. Such a clear ODD description is necessary to express the requirements of how to also cope with unusual situations such as emergency vehicles. According to~\cite[p.\,65]{Thorn2018NHTSA}, testing the perception outputs can significantly facilitate the assessment of OEDR capabilities as compared to testing only the resulting trajectories. It can answer questions such as at which range obstacles are detected, if obstacles are correctly classified, and if their location and size are correctly estimated. However, this NHTSA document also leaves open many details of technical realization of such tests. \subsection{UL4600} Another approach to achieve a safety standard is UL4600 by Underwriters Laboratories and Edge Case Research~\cite{UL4600_voting_2019} (voting version). Its full name is \textit{Standard for Safety for the Evaluation of Autonomous Products}. UL4600 is a voluntary industry standard for autonomous products and thus also applies to AD functions. The creation of this standard is described in~\cite{Koopman2019}. Similar to the previously addressed standards, UL4600 does not prescribe how to conduct concrete perception tests. Instead, it specifies claims within a safety case for which manufacturers should deliver arguments and evidence. These claims also go into detail about sensing, perception, and machine learning~\cite[Sec. 8.3--8.5]{UL4600_voting_2019}. Manufacturers are given a certain freedom in how to provide evidence for their claims. For example, the claim that the environment perception can provide acceptable functional performance~\cite[Sec.~8.4.1]{UL4600_voting_2019} must be supported at least by the metrics false negative and false positive rate, and can be supported by ``other relevant metrics". In terms of existence uncertainty, false negatives (FNs) are objects missed by the SUT, whereas false positives (FPs) are wrongly detected ghost objects. For completeness, true positives (TPs) are existing objects which are also perceived by the SUT. \subsection{UNECE Regulation for Level 3 ALKS} The UNECE regulation~\cite{UNECE2020lanekeepinglevel3} provides a regulatory framework for automated lane keeping systems (ALKS) of SAE Level 3 on highways. It describes the role of a technical service to whom the manufacturer has to demonstrate its compliance with the framework. Stated requirements related to OEDR are a minimum field of view (FOV) of the perception subsystem and the ability to detect conditions that impair the FOV range \cite[Sec.~7]{UNECE2020lanekeepinglevel3}. A minimum set of scenarios for testing the FOV range is specified verbally in \cite[Annex~5]{UNECE2020lanekeepinglevel3}. For instance, the perception of small targets like pedestrians or powered two-wheelers should be tested near the edges of the minimum FOV. The technical service is supposed to select and vary the concrete parameters of these test scenarios. Furthermore, the scenario parameters for system-level collision avoidance tests include also the perception-related conditions of the roadway and of lighting and weather \cite[Annex~4, Appendix~3]{UNECE2020lanekeepinglevel3}. Even though this regulation provides more specific test scenarios than other standardization approaches, they are not explicitly targeted to perceptual uncertainty, and also lack detailed specifications of for example environmental conditions. \subsection{Safety First for Automated Driving} \label{sec:standards_safetyfirst} This white paper by a consortium of startups, OEMs, and suppliers intends to contribute to an industry-wide safety standard for AD by expanding the considerations of ISO/PAS 21448 to SAE Levels~3 and~4~\cite{SaFAD2019}. Related to this review, \cite[Sec.~3.3--3.6]{SaFAD2019} highlights that testing is essential, but not sufficient to assure the safety of AVs. % It suggests a test methodology that includes decomposing the AD system into elements such as the perception subsystem, and testing these elements separately. For the statistical validation of the perception subsystem in real-world tests, the usage of a reference perception system and the so-called scenario-based approach (see e.g. \cite{Riedmaier2020_surveySBT}) are emphasized. Recorded raw data from the field should be re-processed offline upon perception algorithm updates. % The scenario-based approach can argue about a sufficient coverage of relevant traffic scenarios by grouping recorded data that include certain influencing factors into equivalence classes of scenarios (more about interpreting recorded data as logical scenarios in Sec.~\ref{sec:axis_test_scenarios}). Four constraints regarding perception testing are outlined \cite[Sec.~3.6.3]{SaFAD2019}: \begin{itemize} \item The re-processing environment of the field recordings must be validated in terms of hardware and software. \item The test scenario catalog must be both statistically significant and covering the ODD sufficiently (see also Sec.~\ref{sec:describing_scenarios_odd},~\ref{sec:scenarios_obtaining}). \item The reference data quality must be appropriate for the validation objective (see also Sec.~\ref{sec:ref_data_tradeoffs}). \item Concrete test scenarios or data must be separate from those used in development (see also Sec.~\ref{sec:scenarios_different_sets}). \end{itemize} Additionally, \cite[Appendix~B]{SaFAD2019} explicitly addresses safety challenges regarding machine learning, which is omnipresent in an AV's perception, but has not yet been sufficiently addressed in ISO~26262 and ISO/PAS~21448. \subsection{ISO/TR 4804} The technical report ``Road vehicles - Safety and cybersecurity for automated driving systems - Design, verification and validation"~\cite{ISO_TR_4804_2020} aims at supplementing existing standards and documents on a more technical level. Since its content is closely related to the previously published ``Safety First for Automated Driving" white paper~\cite{SaFAD2019}, we omit a repetition of the key aspects (Sec.~\ref{sec:standards_safetyfirst}). \subsection{Conclusion of Safety Standards} Contemporary automotive safety standards require arguments about successful OEDR for safety assurance, but mostly leave the realization of perception tests open to the AV manufacturer. This motivates the subsequent review of how perception testing is currently realized, and how it could be performed in future to assess if the perception allows safe vehicle behavior. \section{Established Activities of Perception Testing} \label{sec:established} This section expresses perception algorithm benchmarking outside the safety domain (Sec.~\ref{sec:developer_testing}) and data-driven sensor modeling on object-level (Sec.~\ref{sec:sensor_modeling}) in terms of the testing taxonomy~\cite{stellet2015testing}. We include both established activities into this separate section because they only partially target this paper's research question. Thereby, we aim at providing a complete context for AV perception testing while distinguishing between directly safety-relevant and less safety-relevant testing activities. \subsection{Perception Algorithm Benchmarking} \label{sec:developer_testing} Developers of computer vision and moving object tracking algorithms across multiple industries are already using established benchmark datasets and test metrics for their algorithm's results. The idea behind these testing activities is typically to provide a quantitative ranking among different algorithms rather than evaluating whether safety-relevant pass-fail criteria are met. The hardware and software that provide the raw sensor data % are usually not analyzed. In public research, the providers of public benchmark datasets typically determine all of the three testing axes test scenarios, reference data, and metrics (Fig.~\ref{fig:taxonomy_dev}). Test criteria usually mean that novel algorithms should rank higher than previous algorithms. \subsubsection{Scenarios} Test scenarios are captured when the dataset provider records the raw sensor data for the benchmark. The aim for such raw data is typically not to capture safety-relevant scenarios, but rather to provide a diverse set of road user types that the algorithms under test will have to detect and distinguish. Therefore, for the purposes of perception algorithm benchmarking so far, it is sufficient that the recorded scenarios are only characterized in the data format of the recordings, and not in a dedicated scenario description language (Sec.~\ref{sec:describing_scenarios_odd}). Examples for such datasets are KITTI~\cite{Geiger2012CVPR}, nuScenes~\cite{caesar2019nuscenes}, the Waymo Open Dataset~\cite{sun2019waymoopendataset}, or Argoverse~\cite{Chang2019Argoverse3T}. \subsubsection{Reference Data} Besides raw sensor data, algorithm benchmarking datasets typically also provide reference data on object level in the form of bounding boxes that are labeled offline with the help of humans, e.g.~\cite{Geiger2012CVPR, caesar2019nuscenes, sun2019waymoopendataset}. For testing the world model output of the perception subsystem, reference data in a metric coordinate system over the ground plane are relevant, which can be labeled based on dense lidar point clouds. In contrast, pixel-level class labels in camera images do not provide a reference for the resulting world model. Other developer testing activities provide the reference information of target vehicles by means of high-precision global navigation satellite systems (GNSS), e.g.~\cite{stampfle2005performance}. \subsubsection{Metrics} \label{sec:perc_algo_benchm_metrics} After a perception algorithm has produced an object-based world model from the provided raw sensor data, its tracks can be compared to the provided reference tracks using metrics. Metrics that assess untracked object lists % are also widely used, but are not discussed here because tracked object lists seem to be more common at the interface between the perception and planning subsystems. Since a common goal of object tracking metrics is to enable a ranking of algorithms, they often need to summarize various aspects of the perception performance into a small number of scalar values that are used for comparison. This concept of aggregating various detailed low-level metrics into fewer summarizing high-level metrics has already been proposed in 2005 for the performance evaluation of automotive data fusion~\cite{stampfle2005performance}. Computing lower-level metrics such as the rates of FPs and FNs requires to \textit{associate} (or \textit{match}, often used synonymously) the estimated tracks of the SUT to their corresponding reference tracks, which is realized in the following way. The pairwise distances between all estimated and all reference objects or tracks are computed by means of an object distance function. Examples for such distance functions are the Euclidean distance between object centroids in the ground plane (applied in e.g.~\cite{caesar2019nuscenes, sun2019waymoopendataset, Chang2019Argoverse3T}) or the Intersection over Union (IoU) of bounding box areas or volumes (e.g.~\cite{Geiger2012CVPR}). Mathematically speaking, however, IoU is not a proper distance function because it is bounded between 0 and 1 and only its complementary value ($1-IoU$) expresses distance. Using these pairwise distances, a multi-object association algorithm can compute an optimal association such that the sum of distances of all associated object pairs is minimized. Often, a threshold distance is applied to only allow reasonable object associations. For example, two objects with a Euclidean distance larger than, e.g., $\SI{2}{\metre}$~\cite{caesar2019nuscenes}, or with an IoU smaller than, e.g., $\SI{50}{\percent}$~\cite{Geiger2012CVPR}, could be prevented from becoming associated object pairs. Examples for association algorithms include the Hungarian/Munkres algorithm~\cite{Kuhn1955_hungarianAlgo} and the auction algorithm~\cite{Bertsekas1989_auctionAlgo}. \begin{figure}[t] \centering \vspace*{2mm} \includegraphics[width=\linewidth]{graphics/taxonomy_dev.pdf} \caption{Perception algorithm benchmarking expressed in taxonomy (Fig.~\ref{fig:taxonomy_general}).} \label{fig:taxonomy_dev} \end{figure} Once this association is obtained, different higher-level metrics can be computed to describe the overall perception performance. Since the last step of an overall perception algorithm is usually to track the frame-individual objects over time while potentially fusing them into a single list of tracks, the following metrics are often called multiple object tracking (MOT) metrics. The most common MOT metrics are the CLEAR MOT metrics MOTA and MOTP, which stand for MOT accuracy and MOT precision, respectively~\cite{bernardin2008evaluating}. MOTA measures existence uncertainty by penalizing FPs, FNs, and ID switches, where ID switches are times when the ID of the estimated object changes while the ID of its associated reference object stays the same. MOTP measures state uncertainty by penalizing TPs that are not estimated precisely. Another state uncertainty metric that additionally measures whether an estimated object state is consistent with the tracker's estimate of its own Gaussian state uncertainty is the Normalized Estimation Error Squared (NEES, see e.g.~\cite{Chen_2018}). The various forms and derivations of the Optimal Sub-Pattern Assignment (OSPA) metric~\cite{schuhmacher2008consistent,ristic2010performance,he2013track,vu2014new, beard2017ospa, rahmathullah2017generalized, shi2017comprehensive} penalize existence and state uncertainties at the same time by weighing them to obtain a single score. Unlike most other mentioned metrics, the OSPA metric is a metric in the mathematical sense, meaning it satisfies the three properties 1.) identity of indiscernibles, 2.) symmetry, and 3.) the triangle inequality. This property makes it interesting for research on object tracking on a detailed mathematical level, e.g.~\cite{Reuter2014_LMB_paper, granstrom2016extended}. Besides existence and state uncertainties, the nuScenes detection score (NDS)~\cite{caesar2019nuscenes} also considers classification uncertainties, as its goal is to represent the entire object tracking performance by only one scalar. Otherwise, metrics for classification uncertainty would be precision, recall, or the area under the so-called receiver-operating characteristic (ROC) curve~\cite{Fawcett2006ROC}. One evaluation concept that explicitly considers temporal aspects of the object tracking performance is the Mostly tracked/Partially tracked/Mostly lost approach, which counts the number of reference trajectories that were tracked during more than $\SI{80}{\percent}$ or less than $\SI{20}{\percent}$ of their lifetimes~\cite{li2009learning}. The so-called Higher-Order Tracking Accuracy (HOTA) metric has been proposed to balance various sub-metrics in a single higher-order metric~\cite{Luiten2020hota}. While the sub-metrics can describe individual performance aspects in detail, the higher-order metric can balance those sub-metrics without over-emphasizing one aspect over another~\cite{Luiten2020hota}. We refer the reader to the same publication~\cite{Luiten2020hota} for a more general introduction to MOT algorithm benchmarking metrics and an in-depth analysis of popular metrics, which further include the mean average precision for tracking (Track-mAP) and the IDF1-score. Recently, the ``Planning Kullback-Leibler divergence" (PKL)~\cite{Philion2020planner_centric} has emerged from the field of perception algorithm benchmarking. It is the only metric from this field that we are aware of that explicitly considers the actual influence of perceptual uncertainties on the downstream motion planner. Various influences on the metric have been analyzed on the submissions of the nuScenes object detection challenge~\cite{Guo2020efficacy}. Interestingly, the submission rankings would be significantly different if PKL was used as the main benchmark instead of mAP~\cite{Guo2020efficacy}. Moreover, the PKL was found to be more consistent with human intuition than the NDS about which perceptual uncertainties are actually dangerous~\cite{Philion2020planner_centric} and has been included into the official submission evaluation. Due to its direct relevance for this paper's research question, technical details on the PKL are discussed later along with other safety-aware microscopic metrics (Sec.~\ref{sec:downstream_comparison}). \subsubsection{Difficulties with Association Uncertainty} \label{sec:association_uncertainty} There seems to be a fuzzy border between \textit{state} and \textit{existence} uncertainties, because a fixed threshold on the distance function that distinguishes TPs from FPs/FNs is not likely to produce intuitive associations under all circumstances. Therefore, the studies~\cite{Florbaeck2016.matching.offline} and~\cite{Sondell2018} tune their offline object association in a way that it reproduces human annotations of object association. These approaches seem to lead to subjectively better associations, but have the cost of less human understanding of how the trained associator and subsequently also the test metric works. \subsubsection{Relevance for Vehicle Safety} \label{sec:safety_relevance_dev_metrics} Except for PKL~\cite{Philion2020planner_centric}, the mentioned state-of-the art metrics for object perception and tracking do not consider safety, but rather provide information about the average similarity to a reference dataset~\cite[Safety Concern~9]{Willers2020safety}. This issue is described in more detail in~\cite{Piazzoni2020Modeling_conference}. According to~\cite{Salay2019partialspecifications}, it is possible to completely specify pass-fail criteria for such safety-independent metrics. Also ISO/PAS 21448 suggests to use safety-independent perception metrics \cite[Annex~D, 11)]{iso2019sotif}. However, those criteria would only represent non-functional requirements, while functional requirements needed for safety assurance remain an open issue~\cite{Salay2019partialspecifications}. Similarly, the authors of~\cite{Aravantinos2020} point out that metrics like a FP rate cannot provide safety-relevant information because some FPs might be highly safety-relevant while others are not. Therefore, they suggest to formulate realistic fault models, which already exist in ISO 26262 for e.g. hardware faults, also for perception algorithms. Such fault models should depend on the safety requirements of the overall vehicle. Given examples include the differentiation of e.g. a FP for a pedestrian from a FP for a bicycle, or to discretize continuous state uncertainty to obtain boolean faults. Nevertheless, formulating such fault models in accordance with the safety requirements seems non-trivial, which motivates for a further analysis of metrics and test criteria in Sec.~\ref{sec:axis_criteria_metrics}. \subsection{Object-Level Data-Driven Sensor Modeling} \label{sec:sensor_modeling} The idea of data-driven sensor modeling approaches is usually to treat the complex behavior of a sensor as a black box and replace it by a model which can generate artificial sensor data in simulations. To do so, the output of a sensor under test is compared to reference data in order to train or parametrize a model that describes the sensor's perception performance. Hence, sensor modeling can also be interpreted as a testing activity according to the taxonomy of this paper (Fig.~\ref{fig:taxonomy_sensor_modeling}). \subsubsection{System Under Test/System to be Modeled} In the context of sensor modeling, we use the terms \textit{system under test} and \textit{system to be modeled} synonymously. Similar to the research interest of this paper, sensor modeling approaches like~\cite{hirsenkorn2015nonparametric, hanke2016classification, Krajewski2020UsingDrones, Zec2018markovModeling} model object lists, which have been generated through both sensor hardware and perception software. This is common if the sensor's built-in perception algorithm is inaccessible to the modeling engineer due to sensor supplier IP. % Otherwise, the virtually tested AD function could contain parts of the perception algorithm, reducing the system to be modeled to mostly the sensor hardware~\cite{holder2019modeling}. However, modeling the already processed perception data has the advantages of less data volume and more comparable data formats. \subsubsection{Scenarios} Like in Perception Algorithm Benchmarking (Sec.~\ref{sec:developer_testing}), test scenarios for the SUT are captured during data recording. Already seemingly simple test scenarios with dry and sunny weather conditions and with only few other road users often provide enough difficulty for data-driven modeling of the sensor hardware behavior. For example, modeling radar reflections on guardrails on a motorway is a topic of current research~\cite{holder2019modeling}. Unlike for perception software development, the research field of sensor modeling seems to be lacking common benchmarking datasets that would allow a straightforward comparison of different sensor models on the same data. \subsubsection{Reference Data} Modeling the behavior of sensor hardware in a data-driven approach requires an independent reference to the sensor hardware. This makes RTK-GNSS-IMUs (see Sec.~\ref{sec:ref_data_rtk_gnss_imu}) a suitable and typically used source of reference data (see e.g.~\cite{schaermann2017validation, hirsenkorn2015nonparametric} for their application). \subsubsection{Metrics} Metrics in this paper are quantitative statements on the SUT. Since parametrized or trained sensor models can describe how similar the SUT's perception is to the reference perception, they are interpreted as test metrics here. Note that sensor models are usually not single-score metrics, but rather for example probability distributions of the sensor's errors~\cite{hirsenkorn2015nonparametric}. Note also that the term \textit{metric} in sensor modeling literature is used differently - there, metrics make a statement on the modeling approach rather than on the SUT \cite{rosenberger2019towards}. \begin{figure}[t] \centering \vspace*{2mm} \includegraphics[width=\linewidth]{graphics/taxonomy_sensor_modeling.pdf} \caption{Object-level data-driven sensor modeling expressed in taxonomy (Fig.~\ref{fig:taxonomy_general}).} \label{fig:taxonomy_sensor_modeling} \end{figure} Actual statements on the SUT can be for example the mean values and standard deviations of Gaussian distributions that describe the SUT objects' state errors in e.g. position and velocity~\cite{Krajewski2020UsingDrones}. A nonparametric distribution for such errors that is based on a Gaussian mixture model is used e.g. in~\cite{hirsenkorn2015nonparametric}. There are various further ways of expressing the SUT's errors by sensor models, which are however mostly outside the focus of this paper. \subsubsection{Relevance for Safety-Aware Perception Testing} % Typically, sensor models aim at describing the specific phenomena of a sensor modality as detailed as feasible, no matter how safety-relevant these phenomena are~\cite{hanke2016classification, rosenberger2019towards}. However, some sensor modeling activities explicitly address this paper's research question. For example,~\cite{Piazzoni2020Modeling_conference} models perception errors while considering the effect they have on robust decision making. In the context of validation of sensor models,~\cite{Holder2020radarModelPlanningInfluence} argues that a key property of modeled sensor data should be that they induce the same behavior in the downstream driving function like the real sensor data would do. Such topics are further elaborated in Sec.~\ref{sec:metrics_perc_control_linkage} about the perception-control linkage. \section{Test Criteria and Metrics} \label{sec:axis_criteria_metrics} This section and the following two sections each cover one testing axis of the used taxonomy from~\cite{stellet2015testing} (Fig.~\ref{fig:taxonomy_general}) and are dedicated to the primary research question of this paper. According to the taxonomy, test criteria and metrics are ``a statement on the system-under-test (test criteria) that is expressed quantitatively (metric)"~\cite{stellet2015testing}. For example, a criterion % that is qualitative at first could be quantified by means of specifying intervals on a related metric that determine passing or failing a test. After examining how to specify perception requirements and test criteria (Sec.~\ref{sec:requirements}), we deal with safety-aware microscopic metrics and criteria (Sec.~\ref{sec:safety_metrics_micro}). Furthermore, metrics on the self-reporting and confidence estimation capabilities of the SUT are discussed (Sec.~\ref{sec:self_reporting_metrics}), as well as macroscopic metrics towards approval (Sec.~\ref{sec:safety_metrics_macro}). \subsection{Specification of Requirements and Criteria} \label{sec:requirements} A perception subsystem shall enable the AV to reach its destination safely, comfortably, and in reasonable time. Therefore, it shall provide information in sufficient quality about all road users that are relevant for fulfilling the driving task. However, such requirements are not specific enough to be tested~\cite{Philipp2020DecompositionPerception}. Thus, how can one specify ``relevant for fulfilling the driving task", or ``sufficient quality" for usage as binary test criteria? In the following, it may be useful to differentiate between concept specification and performance specification of environment perception~\cite{Czarnecki_2018_Framework}. In the mentioned source, concept specification refers to defining the properties to be perceived such as a pedestrian's pose, extent, and dynamic state, given an ODD. In contrast, the performance specification defines how well these properties should be perceived, for example in terms of detection range, confidence, and timing~\cite{Czarnecki_2018_Framework}. \subsubsection{The Difficulty of Specifying Perception} AVs are expected to operate in unstructured, public, real-world environments, which are called \textit{open context} in~\cite{poddey2019opencontext}. According to~\cite{Spanfelner2012ChallengesISO26262}, a complete concept specification of the environment perception may not be possible because a model about the environment generally cannot cover all necessary relations and properties in such an open context. This issue has also been called ontological uncertainty~\cite{Gansch2020uncertainty}. For example, to specify the perception of pedestrians, one would have to specify what a pedestrian is, which is, however, only partially possible using rules such as necessary or sufficient conditions~\cite{Salay2019partialspecifications}. Providing examples of pedestrians in a training set is how machine learning engineers specify the concept of a pedestrian. On the one hand, this can enable driving automation of SAE Levels 3 and above, but on the other hand, it prevents a traditional specification according to ISO 26262~\cite{Salay2019partialspecifications}. Besides specifying the perception concept and performance for % discrete environmental aspects like the classification of a road user, another key challenge is to identify when uncertainty in continuous and dynamic environmental aspects, like a car's velocity, leads to safety-relevant failures~\cite{Philipp2020DecompositionPerception}. \subsubsection{Concrete Approaches of Specifying Perception} Contributions from the field of machine learning investigate how to specify the perception subsystem by using pedestrian detection as a benchmark example~\cite{Salay2019partialspecifications},~\cite{Rahimi2019requirements}. On a higher level,~\cite{Salay2019partialspecifications} emphasizes the importance of an adequate language for specification and the potential of deliberate \textit{partial} specifications. The paper proposes and evaluates several methods for incorporating partial specifications into the development process. Further literature with concrete specification approaches include creating an ontology of the exemplary ``pedestrian" domain (concept specification)~\cite{Rahimi2019requirements}, and taking human perception performance as a reference (performance specification)~\cite{Hu2020}. A formal language for specifying requirements on the performance of object detection in the absence of reference data is proposed in \cite{Dokhanchi2018qtl,Balakrishnan2019metrics}. Instead of using an environmental concept like a pedestrian as the center of investigation, the methodology of~\cite{Klamann2019} outlines how particular test criteria for AV subsystems can be defined in a top-down way, starting from overall safety goals. The methodology is, however, not yet applied specifically to the perception subsystem. As mentioned earlier, the complexity of the open context can cause gaps in the specified requirements. To fill these gaps, many organizations collect large numbers of real-world mileage to discover so far unknown scenarios~\cite{Koopman2018towardFramework}. These recorded scenarios can also serve as test scenarios if they are identified as test-worthy (Sec.~\ref{sec:scenarios_obtaining}). Besides the approaches mentioned so far, there are also considerations on perception requirements that aim at complying with the traditional ISO 26262 functional safety standard. The sources~\cite{Cassel2020SAEPerceptionRequirements,Johansson2016perceptionASIL,Johansson2017assessingUseOfSensors} propose dynamically associating an Automotive Safety Integrity Level (ASIL) with a given driving situation such that for example, the perception is required to comply with the stricter ASIL D in high-risk situations and with the less strict ASIL A in low-risk situations. An example of how functional safety requirements for the perception subsystem can be derived based on a fault tree analysis (FTA) is given in~\cite{schoenemann2019fault} in the context of automated valet parking. The following subsections deal with metrics for measuring quantitatively whether specified test criteria are met. \begin{figure*}[t] \centering \vspace*{2mm} \includegraphics[width=\textwidth]{graphics/taxonomy_severity_aware_amersbach.pdf} \caption{Safety-aware perception testing of~\cite{shalevshwartz2017formalRSS} and~\cite{Salay2019_safety_perceptual_components} expressed in taxonomy for testing by~\cite{stellet2015testing} (Fig.~\ref{fig:taxonomy_general}), with decomposition layers of the driving function by~\cite{amersbach2017functional} (Fig.~\ref{fig:amersbach_layers}) mapped into the taxonomy. Further explanation is given in Sec.~\ref{sec:downstream_comparison}.} \label{fig:taxonomy_amersbach_layers} \end{figure*} \subsection{Microscopic Test Criteria and Metrics} % \label{sec:safety_metrics_micro} The currently most established perception performance metrics, which are typically used in machine learning, do not represent whether the perception output is sufficient for safe vehicle operation \cite[Safety Concern~9]{Willers2020safety} (Sec.~\ref{sec:safety_relevance_dev_metrics}). This section therefore reviews literature about metrics and criteria that explicitly distinguish safety-relevant from safety-irrelevant perception errors. \subsubsection{Heuristic for the Safety-Relevance} \label{sec:heuristic_safety_relevance} The authors of~\cite{Berk2020summary} provide a simple approach towards the safety-criticality of perception errors in the existence uncertainty domain. Certain fractions of the binary error types FP and FN are assumed to be safety-critical, where the fractions depend on the error's position of occurrence within the ego vehicle's FOV. For example, perception errors directly in front of the ego vehicle can heuristically be estimated to be more likely to be safety-critical than perception errors occurring farther away or with a lateral offset~\cite[Figure~3]{Berk2020summary}. The benefit of this approach is that once its numerical values are set, it does not need to consider any downstream driving function for computing safety-critical failure rates. \subsubsection{Modeling the Perception-Control Linkage} \label{sec:metrics_perc_control_linkage} However, whether a perception error turns out to be safety-critical or not generally does depend on the downstream driving function. Thus, we describe different ways of modeling the interface between perception and planning/control, which is also called the perception-control linkage~\cite{Salay2019_safety_perceptual_components}. The above-mentioned fractions of safety-critical perception errors could be determined by means of closed-loop fault injection simulations~\cite{Berk2020summary}. However, if the downstream driving function receives a minor update, the perception metrics would have to be recomputed, which would render such a direct approach unpractical for iterative development. Alternatively, one could abstract the perception and planning subsystems such that test results of the perception subsystem can be re-used for varying planners. For this purpose, modular functional system architectures~\cite{amersbach2017functional},~\cite{Philipp2020DecompositionPerception}, \cite{ulbrich2017functional},~\cite{tas2016functional} could be implemented with contracts, assumptions, and guarantees at the interfaces between the perception and planning subsystems~\cite{Burton2017SafetyML_HAD},~\cite{Burton2019confidence_arguments},~\cite{Meyer1992designByContract},~\cite{Cassel2020SAEPerceptionRequirements}. Such a modular approach would enable different safety assurance methodologies for the different subsystems. For example, the following section discusses data-driven perception testing and formal safety assurance of the planner. The idea behind such formal methods is to always assure a certain safe planning behavior, given that the environment is perceived well enough. Popular formal models for safe planning include Responsibility-Sensitive Safety (RSS)~\cite{shalevshwartz2017formalRSS} and reachability analysis~\cite{Pek2020onlineVerification, althoff2010reachability}. \subsubsection{Downstream Comparison of SUT and Reference Data} \label{sec:downstream_comparison} Traditionally, perception metrics directly compare the object list of the SUT to the one of the reference system. With an additionally given planner or assumptions about it, safety-aware perception metrics can be computed indirectly. The planner, or a formal abstraction thereof, computes behavior outputs for world model inputs from the SUT and from the reference system. Safety-aware metrics then penalize if the behavior induced by the SUT is different from the one induced by the reference system, especially in terms of danger and worst-case severity (Fig.~\ref{fig:taxonomy_amersbach_layers}). The previously mentioned PKL metric~\cite{Philion2020planner_centric, Guo2020efficacy} (Sec.~\ref{sec:perc_algo_benchm_metrics}) works is this fashion. It uses an end-to-end machine-learned planner, which is trained to imitate the human ego vehicle driving behavior of the recording of the dataset on which it will be applied. During inference, this planner is fed with the reference object list and with the object list of the SUT. For both object lists in a given scene, it computes the likelihoods of the recorded ego vehicle trajectory during a short time interval after the given scene. A ``Planning Kullback-Leibler divergence" (PKL) between these likelihoods then represents the degree to which the SUT's uncertainties influence the planner. While PKL uses a concrete planner, the RSS framework~\cite{shalevshwartz2017formalRSS} defines safety-relevant perception failures using a formal abstraction of the planner and its formal definition of \textit{dangerous} situations. % According to the publication, \textit{safety-critical ghosts} are situations in which the environment perceived by the SUT is formally considered \textit{dangerous} for the ego vehicle even though according to the reference data, it is not. Likewise, \textit{safety-critical misses} are situations in which the environment perceived by the SUT is formally not considered \textit{dangerous} even though it actually is. For example, a safety-critical ghost can be a false-positive pedestrian detection in front of the ego vehicle that could cause a false and dangerous braking maneuver. A safety-critical miss could be a pedestrian at the same location as a false-negative detection, which could lead to the ego vehicle hitting the pedestrian. Safety-critical ghosts and misses can not only be caused by existence uncertainties, but also by state and classification uncertainties~\cite{shalevshwartz2017formalRSS} because their definition is agnostic of the type of uncertainty. This avoids a potentially ambiguous differentiation between state and existence uncertainties (see Sec.~\ref{sec:association_uncertainty}). However, this concept of safety-critical perception failures~\cite{shalevshwartz2017formalRSS} so far seems to have been treated mostly theoretically. For example, we are not aware of its extension to consider multiple time steps % or its practical demonstration on real data. Salay et al.~\cite{Salay2019_safety_perceptual_components} expand this concept of binary safety-critical perception failures to a potentially continuous description of the \textit{risk} that a perception failure can cause. The work formalizes a concept to analyze the so-called \textit{incurred severity} % that an uncertain environment perception can cause. It also requires knowledge about the planning subsystem, for example, the planner's policy for computing actions based on a world model. % Furthermore, for actions that can cause harm, there must be a way to assess the worst-case severity of this harm. With these assumptions, the microscopic and safety-aware perception metric \textit{incurred severity} is defined as the difference between the SUT's and the reference system's induced worst-case severities of control actions~\cite{Salay2019_safety_perceptual_components} (Fig.~\ref{fig:taxonomy_amersbach_layers}). The same work~\cite{Salay2019_safety_perceptual_components} applies this concept in a case study dealing with classification uncertainty of road users. For example, if a pedestrian is correctly perceived as a pedestrian, then the worst-case \textit{incurred severity} is zero. If a pedestrian is however classified as a cyclist, and if the control action for cyclists is less cautious than for pedestrians, then the \textit{incurred severity} of this misclassification is likely positive. Future work not yet covered in~\cite{Salay2019_safety_perceptual_components} is to generalize the computation of \textit{incurred severity} to world models that are also subject to existence and state uncertainty. Moreover, representative real-world exposures (probabilities of occurrence) of scenes would be needed for valid risk computations. A practical challenge in the approach of \cite{Salay2019_safety_perceptual_components} might be the availability of the planner's behavior policy. This challenge is addressed in the subsequent positional paper by Salay et al.~\cite{Salay2020_purss} on perceptual uncertainty-aware RSS (PURSS). It proposes to let the RSS framework handle world model uncertainties in a more advanced and more practical way than originally published. A behavior policy of the concrete planner is not needed; instead, it is assumed that the planner complies with the formal RSS rules for guaranteed safe control actions. The RSS model, which is explained in detail in \cite{shalevshwartz2017formalRSS}, can provide a set of guaranteed safe control actions for any given world model input. Using this set, safety-aware test criteria for the perception subsystem can be defined. The set of safe control actions is computed for both the world model from the SUT and for the reference world model. The safe control actions $S_{SUT}$ for the SUT's world model is what a real planner would execute, whereas the safe control actions $S_{ref}$ for the reference system's world model is what is actually safe. If there are control actions in $S_{SUT}$ that are not part of $S_{ref}$, then the SUT potentially causes a safety risk \cite[Def.~2.1]{Salay2020_purss} (Fig.~\ref{fig:taxonomy_purss}). Furthermore, the authors propose how RSS could be extended to handle imprecise world models, which are sets of SUT world models % that contain the true world model with a certain confidence. % For example, the position of a pedestrian could be estimated by an interval of $[\SI{29}{\metre}, \SI{31}{\metre}]$ with a confidence of $\SI{95}{\percent}$. In practice, contemporary perception algorithms do output confidences about their world models, for example Gaussians for state uncertainties, which could be sampled at the mentioned confidence intervals. A corresponding test criterion for an imprecise world model is that its RSS-defined set of safe control actions must be safe for each precise world model contained in it \cite[(2)]{Salay2020_purss}. The authors show that the mentioned perception confidence can be used as a lower bound for the probability of guaranteed safe control actions~\cite[(3)]{Salay2020_purss}. % \subsection{Metrics for Uncertainty/Confidence Calibration} \label{sec:self_reporting_metrics} As described in the previous section and also in~\cite{Koopman2018towardFramework}, the explicit consideration of world model uncertainty (or inversely, confidence) can facilitate safety assurance, for example through runtime monitoring (more in Sec.~\ref{sec:uncertainty_tolerance}). In this context, it is crucial that the self-reported uncertainty of the SUT correctly reflects its true uncertainty~\cite[Safety Concern~5]{Willers2020safety}. If this holds, then the SUT is \textit{calibrated}~\cite{Guo2017calibration}, which means that it is neither over-confident nor too doubtful of itself. \begin{figure}[t] \centering \vspace*{2mm} \includegraphics[width=\linewidth]{graphics/taxonomy_purss.pdf} \caption{% Testing whether the SUT's world model can induce control actions that would not be safe for the reference world model~\cite[Def.~2.1]{Salay2020_purss}. Figure follows taxonomy of Fig.~\ref{fig:taxonomy_general}. } \label{fig:taxonomy_purss} \end{figure} \subsubsection{Types of Uncertainty} \label{sec:uncertainty_forms} The literature on uncertainty in AD (e.g.~\cite{Arnez2020_uq_comparison}) describes that \textit{epistemic} uncertainty, or model uncertainty, constitutes how uncertain the SUT's model of deep neural networks (DNNs) is in correctly describing the environment. In contrast, \textit{aleatoric} uncertainty is caused by physical sensor properties like finite fields of views, resolutions, and sensor noise. Both types are relevant for correct calibration. Additionally, \cite{Gansch2020uncertainty} proposes the concept of \textit{ontological} uncertainty to describe the complete unawareness of certain aspects of the environment, even in the reference data. \subsubsection{Representations of Uncertainty} \label{sec:uncertainty_representations} In object perception, state estimation is a regression task (continuous true value), while existence and classification estimation are classification tasks (discrete true values)~\cite{Arnez2020_uq_comparison}. % State uncertainties are typically quantified by continuous probability distributions or confidence intervals, while existence and classification uncertainties are usually expressed by scalar probabilities between $0$ and $1$. \subsubsection{Calibration Metrics} \label{sec:uncertainty_metrics_detail} This section focuses on metrics that only describe how well-calibrated the world model uncertainties are. % In contrast, uncertainty-aware classification or regression metrics~\cite{Arnez2020_uq_comparison} are a topic of perception algorithm benchmarking (Sec.~\ref{sec:developer_testing}). Multiple literature sources set up so-called calibration curves~\cite{Naeini2015calibrationError, Kuleshov2018regressionUncertainty, Guo2017calibration} for visualization and numerical analysis. These curves plot the accuracy (or empirical frequency) of a prediction over the prediction's confidence, often using bins. For example, in classification tasks, one specific bin could contain all events where the detector reports a confidence/existence probability in between $\SI{80}{\percent}$ and $\SI{90}{\percent}$. If there is a pedestrian present for only $\SI{70}{\percent}$ of all events in that bin, then the calibration curve would be tilted off from the ideal diagonal line. In regression tasks, a similar calibration curve can be set up by defining the accuracy as the empirical frequency of when the estimated confidence interval contained the true value. Single-score calibration metrics can be computed from such calibration curves~\cite{Arnez2020_uq_comparison}. In classification tasks, the \textit{Expected Calibration Error} (ECE) and the \textit{Maximum Calibration Error} (MCE)~\cite{Naeini2015calibrationError} represent the expected and the maximum difference between confidence and accuracy in such calibration curves, respectively. Similar metrics for regression tasks are the \textit{calibration error}~\cite{Kuleshov2018regressionUncertainty} or the related \textit{Area Under the Calibration Error Curve} (AUCE)~\cite{Gustafsson2020calibrationError}. Concrete applications of uncertainty calibration and evaluation in 3D object detection from lidar point clouds are given for example in~\cite{Feng2018uncertainty} and the follow-up publication~\cite{Feng2019calibrationECE}. The latter publication explicitly uses the mentioned calibration curves and the ECE metric. A further uncertainty evaluation approach that explicitly addresses perception systems in safety-relevant domains is provided in~\cite{henne2020benchmarking} and subsequently~\cite{Schwaiger2020uncertainty}. The publications, which focus on out-of-distribution detection for classification tasks, distinguish four different cases in classification results. The cases are combinations of the properties certain/uncertain (decided by a threshold), and correct/incorrect. Metrics are defined based on the fractions of these individual cases among all classification results. The fraction of certain, but incorrect results is defined as the \textit{Remaining Error Rate} (RER), and the fraction of certain and correct results is defined as the \textit{Remaining Accuracy Rate} (RAR). All mentioned metrics so far assume that a precise world model is available as a reference. However, also reference data are generally uncertain and imprecise (Sec.~\ref{sec:ref_data_uncertainty}), which makes test metrics more complex. \subsection{Macroscopic Metrics Towards Approval} \label{sec:safety_metrics_macro} So far in this paper, the used metrics and test criteria have been statements on the SUT in either individual scenes (microscopic metrics) or in relatively small amounts of test data with a research purpose. While microscopic metrics and criteria are necessary for a detailed analysis of the SUT, they alone are not sufficient for the overall safety assurance of AVs because their results need to be extrapolated to estimate \textit{macroscopic}~\cite{Junietz2018criticalityMetric} metrics (definition in Sec.~\ref{sec:def_metric}). \subsubsection{Terminology: Safety vs. Reliability} Since the term \textit{reliability} is often used in the context of macroscopic safety metrics~\cite{Berk2020summary}, it is first briefly differentiated from the term \textit{safety}. The perception subsystem of an AV must enable the overall vehicle to drive safely. Safety, however, is a property of the overall system and not of the perception subsystem. The perception subsystem can at best be \textit{reliable}, which is generally different from being \textit{safe}~\cite[Sec. 2.1]{leveson2016engineering} (Sec.~\ref{sec:definitions}). Note that a property that includes both safety and reliability is \textit{dependability}~\cite{Avizienis2004dependability}. \subsubsection{Mean Time Between Failures} The RSS publication~\cite{shalevshwartz2017formalRSS} argues that for the acceptance of AVs, the overall probability of occurrence of safety-critical failures must be in the order of magnitude of $10^{-9}$ per hour. This would imply a test criterion of no such failures during about $\SI{e9}{}$ hours of driving, where safety-critical failures in their publication are the previously introduced safety-critical ghosts and misses. The related paper~\cite{Weast2020}, which focuses on perception within RSS, states another large required mean time between failures of $\SI{e7}{\hour}$ for the perception subsystem. Only perception failures that can possibly lead to unsafe vehicle behavior should be counted in that number. Major contributions to the macroscopic reliability assessment of the perception subsystem have come from Berk et~al., e.g.~\cite{Berk2020summary},~\cite{Berk2019Dissertation}. The macroscopic metrics they use are the rate of all perception failures and the rate of safety-critical perception failures, both measured in failures per hour. Safety-critical perception failures are computed by filtering all perception failures with a field-of-view-dependent safety-criticality factor between $0$ and $1$, as explained in Sec.~\ref{sec:heuristic_safety_relevance}. An overall approval criterion according to~\cite{Berk2019Dissertation} is that the sum of the failure rates of the perception, planning, and actuation subsystems is smaller than a given threshold rate, which is called the target level of safety. A corresponding testing methodology to compute these macroscopic perception metrics is discussed in Sec.~\ref{sec:uncertainty_forecasting}. \subsection{Conclusion of Test Criteria and Metrics} Different metrics describe different properties of the SUT like its safety-relevant performance in a single scene, the calibration of its self-reported uncertainties, or its statistical safety impact. Specifically the representation of safety-relevance in microscopic metrics seems challenging. These mentioned different classes of metrics are typically coupled. For example, the SUT's statistical safety impact depends on its safety impact in individual scenes, which in turn may depend on whether the SUT has correctly reported its uncertainty in that scene. Thus, one challenge is to harmonize individually dedicated metrics into an overall framework. Moreover, the specification of test criteria is nontrivial due to the complexity of the open-world context. \section{Test Scenarios} \label{sec:axis_test_scenarios} According to the taxonomy of~\cite{stellet2015testing}, a test scenario is ``a set of specified conditions" under which a test is executed. The following subsections deal with adapting the term \textit{scenario} to the perception context (Sec.~\ref{sec:what_are_perc_scenarios}), describing test scenarios and the ODD (Sec.~\ref{sec:describing_scenarios_odd}), generating a test scenario catalog (Sec.~\ref{sec:scenarios_obtaining}), executing scenarios as test cases (Sec.~\ref{sec:executing_scenarios}), and splitting scenarios into training and test sets (Sec.~\ref{sec:scenarios_different_sets}). Much of the literature on scenario-based testing does not yet focus on perceptual uncertainty, which is why this section also cites related literature with a broader focus. \subsection{Adapting the Term Scenario to the Perception Context} \label{sec:what_are_perc_scenarios} The definition of the term \textit{scenario} has been discussed extensively in the context of scenario-based testing % \cite{Ulbrich2015}. According to the mentioned source, a scenario contains actors (mostly road users) whose actions influence the temporal development of scenes within the scenario. For testing purposes, one of such actors within the scenario is the subject vehicle. So far, the focus of scenario-based testing of AVs has been on the plan and act subsystems instead of on the perception subsystem of the subject vehicle~\cite{Riedmaier2020_surveySBT}. However, if only the perception subsystem is tested in an open-loop fashion, then it typically only has the role of a passive observer of the scenario instead of an influencing actor. At this point, we exclude closed-loop testing because we are interested in the offline test of potentially multiple perception algorithms on the same recorded raw sensor data from the real world. To the best of our knowledge, we are not aware of literature that explicitly considers the influence that an open-loop perception subsystem may have on the temporal development of a scenario. % Such an influence is in fact possible through e.g. electromagnetic waves emitted by active sensors, which could disturb the sensors of other AVs and thus theoretically influence their behavior. However, in this review, we assume for simplicity that perception-specific scenarios are scenarios % whose temporal development of objective scenes is pre-determined, but where the subjective observation of these scenes in world models is left open. % This corresponds to \textit{static scenarios} with an additionally predetermined ego vehicle behavior according to~\cite{Rocklage2017scenarios}. Furthermore, it seems that the different abstraction levels of scenarios (functional, logical, concrete) of~\cite{Menzel2018scenarios} can also be used for perception scenarios. A functional scenario is described verbally (e.g. it rains, among other aspects), whereas a logical scenario has parameters (e.g. uniform precipitation in millimeters per hour), and a concrete scenario gives each parameter a numerical value (e.g. $\SI{2}{mm \per \hour}$). Generally, different logical scenario parameters are of interest for perception tests than for planning tests~\cite{Neurohr2021criticality}. \subsection{Description of Scenarios and ODD} \label{sec:describing_scenarios_odd} Arguing whether test scenarios cover the entire ODD requires ways to describe scenarios and the ODD. Current ODD description approaches are the taxonomy of BSI PAS 1883 \cite{bsi2020ODDStandard}, the NHTSA framework~\cite[Ch.~3]{Thorn2018NHTSA}, and the ongoing standardization of a machine-readable ODD format in ASAM OpenODD~\cite{Asam2020openODD}. Furthermore, ontologies are used to describe ODDs~\cite{Czarnecki2018OntologyPart2} and scenes within scenarios~\cite{Bagschik2018_ontology}. Ontologies are intended to be standardized in ASAM OpenXOntology~\cite{Asam2020openXontology} and have also been proposed to define a schema for world model data~\cite{Salay2020_purss}. For ontology-generated scenarios, the notion of \textit{abstract scenarios} was introduced to describe functional scenarios that are formal and machine-readable, but do not yet have a logical parameter space~\cite{Neurohr2021criticality}. The ontology of~\cite{Bagschik2018_ontology}, which is used to generate traffic scenes for scenario-based testing, organizes all scenario entities by means of a 5-layer-model. % This model was first defined using four layers in~\cite{Schuldt2017diss}, and has been adapted to six layers in~\cite{Bock2018databasis} and most recently~\cite{Scholtes2020_6LM}. The model's individual layers according to the most recent and also summarizing publication~\cite{Scholtes2020_6LM} are \begin{enumerate} \item Road network and traffic guidance objects \item Roadside structures \item Temporary modifications of Layers 1 and 2 \item Dynamic objects \item Environmental conditions \item Digital information. \end{enumerate} These scenario description layers should not be confused with the functional decomposition layers of~\cite{amersbach2017functional} (Fig.~\ref{fig:amersbach_layers}). Even though the present review only focuses on perceiving dynamic objects in Layer 4, the properties of all other layers can influence the perception of dynamic objects and are therefore also relevant. So far, the layer models for scenario description only provide a way for an objective description of the environment within a traffic scenario. Aspects related to a subjective perception of such scenarios through machine perception are not yet explicitly covered, for example surface materials that affect radar reflections~\cite{Scholtes2020_6LM}. Such shortcomings of scenario descriptions for perceptual aspects have also already been identified in the context of sensor modeling~\cite[Sec.~V]{holder2019modeling}. The previously mentioned scenario description methods are suited to describe functional, abstract, and perhaps logical scenarios. In contrast, describing concrete scenarios for the actual test execution requires a certain data format. The ASAM OSI~\cite{Driesten2019osi} classes GroundTruth and SensorView appear to be capable of describing objective scenes and the circumstances for their subjective perception, respectively. However, they are designed for virtual simulations instead of real-world test scenarios. Similarly, the established format \mbox{OpenSCENARIO} \cite{Asam2020openSCENARIO} is also designed for virtual closed-loop testing of the planner instead of open-loop testing of the perception subsystem. \subsection{Generating a Test Scenario Catalog} \label{sec:scenarios_obtaining} The ability to describe and structure test scenarios in an ideally formal way is a prerequisite to subsequently generate a representative test scenario catalog. Such a test scenario catalog might be part of the specification of the perception subsystem (Sec.~\ref{sec:requirements}). The number of test scenarios has to stay feasible, which renders naive sampling of a high-dimensional scenario space unsuitable and instead motivates for the following approaches. We distinguish between knowledge-driven and data-driven scenario generation, as already done in~\cite{stellet2015testing, Nalic2020sbt_survey,Neurohr2021criticality}. As pointed out by~\cite{Nalic2020sbt_survey}, approaches from both categories usually need to complement each other for a holistic testing strategy. Likewise, also ISO/PAS 21448 mentions dedicated expert scenario generation (knowledge-driven), as well as large-scale random data recording (data-driven) for the perception verification strategy~\cite[Annex~D]{iso2019sotif}. In either way, the goal is usually to obtain certain \textit{triggering events}\footnote{or similarly, \textit{triggering conditions}}, which are defined in ISO/PAS 21448~\cite{iso2019sotif} as ``specific conditions of a driving scenario that serve as an initiator for a subsequent system reaction possibly leading to a hazardous event". Such a system reaction can occur either in the sensor hardware, in the perception software, or the downstream driving function. Similar to triggering events, the terms \textit{external influencing factor}~\cite{Bai2019_external_influence_factors_sensing} and \textit{criticality phenomenon}~\cite{Neurohr2021criticality} are also used to describe safety-relevant scenario influences related to perception. \subsubsection{Knowledge-Driven Scenario Generation} % \label{sec:scenario_gen_knowledge_driven} Since human knowledge of traffic scenarios is often qualitative, knowledge-driven scenario generation usually first yields functional or abstract scenarios. Literature on driving scenarios describes the further steps to logical scenarios~\cite{Menzel2019functionalToLogical} and the discretization to concrete scenarios~\cite{Neurohr2020fundamental}. ISO/PAS 21448 enumerates a list of influencing factors, which shall be used to construct scenarios to identify and evaluate triggering conditions for the perception subsystem \cite[Annex F]{iso2019sotif}. This list is included into the standard as an informative example and includes factors like climate, which can be for example fine, cloudy, or rainy. A specific identification of triggering events according to ISO/PAS 21448 is provided in~\cite{Martin2019} by means of a hazard and operability study (HAZOP). The approach is applied to the used sensor modalities camera and lidar as part of an extended automated emergency braking system. Sensor modality-specific influencing factors can be analyzed in even more detail by experts using dedicated tests or simulations. Example studies analyze the influences of weather, road dirt, or rainfall on lidar (\cite{Rasshofer2011influences},~\cite{Rivero2017roadDirtLidar},~\cite{Berk2019rainfall}, respectively), or corner cases specific to visual perception~\cite{Breitenstein2020visual}. Such influencing factors or triggering events could also be queried from a domain ontology for driving scenarios~\cite{Bagschik2018_ontology} or from one that also includes perceptual aspects~\cite{Neurohr2021criticality}. The former source argues that without the use of an ontology, human experts are not likely to generate all possible scenarios based on their knowledge. In contrast, if the knowledge is first encoded in an ontology, then the generation of scenarios or scenes from that ontology can cover all possibilities based on the encoded knowledge. A further approach towards completeness of a scenario catalog is to crowd-source a list of concrete OEDR aspects that are relevant for testing ~\cite{Koopman2019_howMany}. The mentioned publication provides a detailed list that is supposed to serve as a starting point for further extension by the community. While so far, the mentioned influencing factors were selected mostly according to their influence on the perception subsystem, one can also construct perception test scenarios with the downstream driving function in mind. This particularly includes scenarios that would be challenging to the driving function in case a perception failure occurs. Such a concept is applied under the name of application-oriented test case generation in~\cite{Bai2019_external_influence_factors_sensing} and~\cite{cao2018application} with ACC systems in mind. For an ACC function, it appears possible to manually investigate the perception-based influencing factors that negatively affect its behavior. In contrast, if the targeted application is a general-purpose urban Level 4 system, it will be harder to enumerate all related influencing factors. \subsubsection{Data-Driven Scenario Generation} \label{sec:scenario_gen_data_driven} If test scenarios are obtained by analyzing large amounts of randomly recorded vehicle fleet data, then the abstraction level of available data is closer to concrete scenarios than to functional scenarios. However, the recorded data is initially only available in the data schema of the recording format, which usually does not share the same parameters like a logical scenario space. Thus, a challenge in data-driven approaches is to generalize the snippets from the recorded data in a way that they correspond to points in a logical scenario space. This is necessary in order to vary individual parameters such that potentially relevant, but not yet observed scenarios can also be generated. We are not aware of scientific publications that present data-driven scenario generation in the safety context specifically for perception testing, and thus will refer to related literature about general testing, which has already been reviewed in more detail in~\cite{Nalic2020sbt_survey}. One example approach for a data-driven test case generation is described in~\cite{putz2017system}. In the mentioned publication, a database system of relevant scenarios is described. Its input data from various sources such as field operational testing, naturalistic driving studies, accident data, or others, must first be converted to a common input data format of traffic recordings. Afterwards, individual snippets of the input data are affiliated to pre-determined logical scenario types, such that each snippet corresponds to one point in a logical scenario space. The logical scenario parameters can also be obtained through unsupervised learning on the input data~\cite{Krajewski2018traGAN}. If the input data were obtained from large amounts of randomly collected driving data, then one can further compute statistical measures such as the scenario's real-world exposure and its parameters' real-world probability distributions~\cite{putz2017system}. By additionally computing criticality metrics on the given snippets, one could estimate the potential severity of a section of the logical scenario space. The exposure and severity as meta-information on the scenario space then help to turn the obtained logical scenarios into relevant test cases. For example, one could put more testing efforts on scenarios with a high risk, where the risk of a scenario increases with its exposure and severity, and decreases with its controllability~\cite[Appendix A]{Schoener2020challenging}. \subsubsection{Combined Scenario Generation} As pointed out by~\cite{Nalic2020sbt_survey}, knowledge-driven and data-driven approaches for scenario generation often complement each other in practice. For example, the previously mentioned database approach from~\cite{putz2017system} assumes that a concept for logical scenario spaces is given, potentially from expert knowledge. In turn, knowledge-driven scenario generation can also be backed up by measurements and data~\cite{Nalic2020sbt_survey}. One example of a combined test case generation for the perception subsystem is given in~\cite{amersbach2017functional}. Besides the functional decomposition layers (Fig. ~\ref{fig:amersbach_layers}), the publication also proposes a method for defining particular test cases for each of those decomposition layers. The method takes driving scenarios from a database such as~\cite{putz2017system}, assumes an accident if there was none, and then uses a fault tree analysis (FTA) to define pass/fail criteria for the individual subsystems in a given scenario. This combined approach allows the derivation of perception-specific test scenarios from general driving scenarios. \subsubsection{Test Scenarios Specific to the SUT} In the end, it could also be that the test scenarios that result in the highest risk for a given SUT are \textit{not} found by only considering external influencing factors from the space of all possible scenarios. Instead, the unexpected insufficiencies that the DNNs of the SUT have learned might lead to more critical behavior than what a usually suspected external influence could trigger~\cite[Safety Concern~4]{Willers2020safety}. % For example, \cite{Kurzidem2020analyzingPerceptionArchitectures} identifies perception subsystem inputs that lead to highly uncertain world models for a given SUT by propagating uncertainties through the individual perception components. \subsubsection{Difficulties in Covering the ODD with Scenarios} Any attempt to formally describe the ODD and to cover it sufficiently with test scenarios is generally difficult because of the open context problem of the real world~\cite{poddey2019opencontext}. Related to this,~\cite[Safety Concern~1]{Willers2020safety} expresses that the data or scenarios used for the development and training of the perception subsystem are usually not a good approximation of the system's ODD in the real open world. Furthermore, the real world changes over time, which makes it necessary to iteratively update the ODD description and its coverage with test scenarios~\cite[Safety Concern~2]{Willers2020safety}. Moreover, in practice only a finite number of concrete test scenarios can be sampled from the infinite number of concrete scenarios that could be theoretically generated from a logical scenario. This sampling makes it generally unclear whether the results of two similar concrete test scenarios also hold in between these discrete points. In fact, DNNs used for object detection can show a potentially extreme non-linear behavior with respect to only slight input variations for example in weather conditions. This brittleness, which has been pointed out in~\cite[Safety Concern~6]{Willers2020safety}, makes it difficult to argue about a sufficient ODD coverage with sampled test scenarios. Nevertheless, combinatorial testing~\cite{Kuhn2009combinatorialTesting}, which is suggested by ISO/PAS 21448 and already applied to computer vision for AVs~\cite{Gladisch2020combinatorial}, can potentially keep the number of discretized concrete tests feasible while providing certain coverage guarantees. Furthermore, combinatorial testing that explicitly exploits the functional decomposition approach for AVs~\cite{amersbach2017functional} is performed in~\cite{Weber2020simulation} for simulated AV testing. \subsection{Executing Scenarios as Test Cases} \label{sec:executing_scenarios} We assume the execution of a test scenario to be an offline execution of a perception algorithm on previously recorded raw sensor data. In this way, only the sensor mounting positions and sensor hardware are fixed by the recording, whereas multiple perception algorithms can be applied. For scenarios that correspond to snippets from existing real-world vehicle recordings, the corresponding raw data can directly be used for the test without having to be re-recorded. Otherwise, the raw sensor data for the test scenarios must be captured. Public roads offer less influence on the scenario details, but allow encountering many different scenarios over time with little effort per scenario. In contrast, proving grounds allow to set up specific scenarios, which however requires high efforts per scenario and may lack realism, e.g., when reproducing precipitation. \subsection{Training and Test Sets of Scenarios} \label{sec:scenarios_different_sets} If the DNNs of the SUT are trained on data and scenarios that are also used for testing, then overfitting likely takes place during training and an unbiased testing for verification and validation purposes is not possible. Thus, it is important to properly separate recorded perception data into individual datasets for training and for testing~\cite[Safety Concern~7]{Willers2020safety},~\cite{SaFAD2019}. Furthermore, if the developers evaluate the SUT on a test set multiple times, an unintentional optimization with respect to the test set result might take place over multiple development iterations~\cite{Willers2020safety}. \subsection{Conclusion of Test Scenarios} Scenario-based approaches to minimize the overall testing effort of AD functions also seem applicable to the perception subsystem~\cite[Sec.~3.3.4]{SaFAD2019}. An agreed-upon description language and data format of perception scenarios would be beneficial for further research. Various approaches have been proposed to obtain test scenarios, where their combination for a sufficient ODD coverage is an active research topic. Furthermore, it is challenging to obtain real-world recordings of all identified test scenarios. \section{Reference Data} \label{sec:axis_ref_data} The third and final testing axis that this paper covers is the ``knowledge of an ideal result (\textit{reference})"~\cite{stellet2015testing}. For object-based environment perception, such an ideal result is an object list containing all road users that the SUT is supposed to perceive. We distinguish between the terms \textit{ground truth} and \textit{reference} in a way that a ground truth perfectly and objectively describes the world. A reference is a subjective approximation of the ground truth in terms of data that are generated by a perception system that is superior to the SUT. Requirements for reference systems for environment perception have been analyzed in depth in the context of ADAS~\cite{brahmi2013reference}. Apart from the qualitative requirements mobility/portability and reporting of its own uncertainty, the paper states the quantitative requirements reliability, sufficient field-of-view, accuracy, and proper timing of the measurements. The following sections review different ways of generating reference data, where each way has its own advantages and disadvantages in the mentioned categories. % We structure the literature according to the position of the reference sensors, which can be mounted only on the ego vehicle (Sec.~\ref{sec:data_from_ego}), also on other road users (Sec.~\ref{sec:data_from_other_tp}), or externally and not part of any road user (Sec.~\ref{sec:data_from_external}). Uncertainty in reference data and an appropriate choice of the reference data source are discussed in Sec.~\ref{sec:ref_data_uncertainty} and Sec.~\ref{sec:ref_data_tradeoffs}, respectively. \subsection{Reference Data From Ego Vehicle Sensors} \label{sec:data_from_ego} The biggest advantage of reference data from sensors of the ego vehicle is that no external measurement equipment is needed. Without an external perspective, however, road users that are occluded for the sensors under test can also hardly be present in the reference data. \subsubsection{Reference from Sensors Under Test} Perhaps the most common approach of generating reference data is to use the raw sensor data from the SUT such that humans can label the reference objects and their properties. Labels in a sensor-specific coordinate system, such as in a camera's pixel space, need to be transformed to the world model's coordinate system (often in meters and defined over the ground plane) to potentially serve as a reference for it. In practice, the human labeling process is often at least semi-automated by offline perception algorithms, which can go back and forth in time. Such reference data is typically used by datasets for perception algorithm benchmarking such as~\cite{Geiger2012CVPR,caesar2019nuscenes, sun2019waymoopendataset}. Using only offline perception algorithms without human intervention (as also done in e.g.~\cite{Robosense2020reference}) dramatically reduces the overall effort and could still result in superior data to the SUT, but generally impairs the data quality. A~standardization attempt for human-labeled reference data is ASAM \mbox{OpenLABEL}~\cite{Asam2020openLabel}. In either case, no additional sensor hardware is required, which is valid and a big advantage if the perception algorithm is the only component of interest. At the same time, it means that the SUT's sensor mounting positions and sensor hardware do not have an independent reference, which might impede their rigorous assessment. \subsubsection{Separate Reference Sensors on Ego Vehicle} Additional sensors on the ego vehicle that are not part of the SUT can potentially also provide a reference for validating the SUT's sensor mounting positions and hardware performance, see e.g.~\cite{Robosense2020reference}. This approach seems to be more popular in ADAS developments than for AVs because AVs often already use the best available sensors for their regular operation, and hence there are no other sensors of higher quality left as reference. \subsubsection{k-out-of-n-vote of High-Level Fusion Inputs} \label{sec:ref_data_k_out_of_n} The present review paper focuses on testing the world model that is generated from fused inputs of all environment sensors. In contrast, Berk et al.~\cite{Berk2019ReferenceTruth} propose testing the object-level outputs of individual sensor systems \textit{before} those are fused (more in Sec.~\ref{sec:uncertainty_forecasting}). Such testing is needed for the authors' proposed safety assessment strategy for the perception subsystem, where the corresponding reference data could be generated without additional sensors and without manual human effort. If for example, a majority of fusion input systems detects a certain road user while one input system does not, then it can be argued that the majority of agreeing input systems provides the reference data for identifying a perception failure in the single disagreeing system. This idea is generalized to a so-called k-out-of-n vote of sensor systems. It could potentially scale to billions of kilometers of data collection using large vehicle fleets with feasible effort, but its practical implementation on real vehicle data seems to have not yet been described in the available literature. % \subsection{Reference Data from Other Road Users} \label{sec:data_from_other_tp} Other road users can be either equipped with specific test equipment for the estimation of their position and state, or they could communicate their states to the ego vehicle as part of a potential V2X-based regular operation in future. \subsubsection{RTK-GNSS-IMUs} \label{sec:ref_data_rtk_gnss_imu} Global navigation satellite systems (GNSS) with real-time kinematic correction (RTK) and an attached inertial measurement unit (IMU) have been popular for generating reference data of individual road users. Paired systems of those can be installed both in the ego vehicle and at other road users to determine relative positions, velocities, and orientation angles. RTK-GNSS can measure the absolute position up to a few centimeters, but face difficulties when the signal is affected by nearby structures such as buildings, trees, or a tunnel. IMUs work independently of the surroundings, but only provide relative and incremental positioning information. Data fusion algorithms can combine the strengths of both components to estimate a consolidated state of the respective road user. Despite the size of the measurement hardware, also vulnerable road users (VRUs) can wear such hardware as a backpack~\cite{Scheiner2019gnssVRUs}, which, however, alters their appearance to other sensors. In general, only specifically equipped road users can provide reference data using RTK-GNSS-IMUs, which excludes the majority of public road users. % The accuracy of RTK corrections of GNSS signals in automotive applications has been analyzed in more detail in~\cite{Ho2018rtkGpsAccuracy}. Another work has specifically analyzed the accuracy of GNSS systems that are used for relative positioning of local groups of vehicles~\cite{Tahir2018_GPS_Accuracy}. For more information on GNSS in general, we refer to the textbook~\cite{ESA2013gnss}. \subsubsection{Collaborative World Model Through V2X} \label{sec:collaborative_world_model} If target vehicles have the capability to accurately localize themselves without dedicated testing hardware, then they could communicate their state to a cloud-based or edge-based collective environment model~\cite{Lampe2019collectiveDriving}. The mentioned publication hypothesizes how this could enable a mutual verification of the environment perception of individual road users. The key difference to the previously described RTK-GNSS-IMU approaches is that the publication~\cite{Lampe2019collectiveDriving} aims at the regular operation of future production vehicles rather than dedicated testing activities. The targeted crowd-sourced reference data generation follows a similar idea like the previously described k-out-of-n-vote of high-level fusion inputs (Sec.~\ref{sec:ref_data_k_out_of_n}). The difference here is that the inputs to the vote would originate from vehicles instead of from sensors. However, also this approach does not seem to have been demonstrated with real-world vehicles yet. \subsection{Reference Data from Non-Road Users} \label{sec:data_from_external} The analyzed literature on reference data generation with sensors external to the road users includes stationary infrastructure sensors, unmanned aerial vehicles (UAVs, or drones), and helicopters. Those data are often intended as either stand-alone naturalistic traffic data or as online enhancements of the AV perception. They can still serve as a reference for the SUT if their quality is superior to the SUT according to context-specific reference data requirements. A data quality superior to the SUT on the ground can be achieved by a more advantageous bird's eye perspective, by intentional overfitting of the perception algorithms to the sensor's location, and by human error-checking. Humans can detect errors in reference object lists easier when comparing them to a raw video from a bird's eye perspective than by comparing them to a potentially disturbed GNSS signal or to potentially incomplete SUT raw data. \subsubsection{Reference Data from Stationary Infrastructure Sensors} Stationary infrastructure sensors are sensors that are mounted on buildings, streetlamps, gantries, bridges, or other nearby structures. They are used in urban locations for example in the Ko-PER dataset~\cite{Strigel2014_KoPerDataset}, in the test area autonomous driving Baden-Württemberg~\cite{Fleck2019testAreaBW}, and at the AIM test site~\cite{knake2016aimintersection}. Infrastructure sensors at highways or motorways are used in~\cite{notz2020extraction} and at the Providentia sensor system~\cite{Kraemmer2019providentia}, where the latter source assesses its performance using a helicopter-based system, which is covered in Sec.~\ref{sec:ref_data_helicopters}. The projects HDVMess and ACCorD aim at installing mobile and fixed infrastructure sensors at various sites~\cite{Kloeker2020infrastructure_ACK} and evaluate their data generation with a UAV-based reference system~\cite{Kloeker2020trafficRecording}. \subsubsection{Reference Data from UAVs} \label{sec:ref_data_UAVs} Camera-based reference data generation from a bird's eye perspective has been investigated at least since 2014~\cite{Kubertschak2014kamerabasiertes}. The necessary processing steps to track ground vehicles from UAVs were later described in more detail in~\cite{Guido2016uav} and~\cite{Kruber2020uav}. UAVs are used as reference sensors for sensor modeling in~\cite{Krajewski2020UsingDrones} and for assessing infrastructure sensors in~\cite{Kloeker2020trafficRecording}. A qualitative assessment of UAV-based reference systems in contrast to other reference systems is given in~\cite{Krajewski2019dronesfortesting}. Reference data from a UAV's perspective tend to suffer from less occlusions than from perspectives closer to the ground, however, new sorts of occlusions from treetops or bridges occur. \subsubsection{Reference Data from Helicopters} \label{sec:ref_data_helicopters} Additionally, helicopters have been used to record the ground traffic for verification and validation purposes of AD systems. The DLRAD dataset~\cite{kurz2018dlrad} was partially recorded using a helicopter that follows a target vehicle with active environment perception. A previous publication from the same project~\cite{Kurz2015helicopter} describes how such a helicopter-based system can be used to validate the behavior of ADAS. Furthermore, a helicopter-based reference data generation is also described and used in~\cite{Kraemmer2019providentia} to assess a static infrastructure sensor system. \subsection{Uncertainty in Reference Data} \label{sec:ref_data_uncertainty} Reference systems do not provide an absolute ground truth, but only have to come closer to it than the SUT does. This has been pointed out and quantified with respect to labeling uncertainty in~\cite{wang2020inferring}. % Thus, the quality of the reference data (or labels) should be taken into account such that test results are not misleading~\cite[Safety Concern~8]{Willers2020safety}. For automatically generated reference data from external sensors, there might not be labeling uncertainty, but uncertainty in temporal synchronization of reference and SUT data, as well as uncertainty in their spatial alignment. % Moreover, any automatically generated reference data without human error-checking can suffer from unexpected inaccuracies in the reference measurement system. Those inaccuracies might be rare enough to not matter in small-scale R\&D testing, but over large amounts of test scenarios or kilometers, as needed for safety assurance, the probability of encountering relevant reference system errors increases. \subsection{Choice of Reference Data Source} \label{sec:ref_data_tradeoffs} Different ways of generating reference data are used for different aspects of perception testing, where each way has its unique advantages. For example, human labels might be best for testing what a perception algorithm can infer from given raw data in the absence of additional data sources. Separate high-quality sensors on the ego vehicle could be the most useful choice for benchmarking individually inferior sensor systems. RTK-GNSS-IMUs might be best for testing the perception of small numbers of vehicles in the absence of high buildings. Data from an aerial perspective might be most suitable for testing the perception performance under static and dynamic occlusions in complex naturalistic traffic. Infrastructure test fields that spread over a large area can be best suited for investigations that require a large field of view. Finally, reference data from the \mbox{k-out-of-n-vote} might have the best potential for keeping the testing effort feasible for large amounts of kilometers or scenarios. \subsection{Conclusion of Reference Data} \label{sec:ref_data_conclusion} The most appropriate choice of reference data depends on the detailed objectives of the respective testing activity within the safety case (\cite[Sec.~3.6.3]{SaFAD2019}). In any case, the reference data's limitations should be considered. \section{Discussion of Review Results} \label{sec:discussion} Sec.~\ref{sec:discussion_answers} summarizes the particular conclusions of each testing axis in terms of the largest issues regarding the primary research question. % Intersection topics between the axes are covered in Sec.~\ref{sec:discussion_interdependencies}. % Finally, testing as reviewed in this paper is likely necessary, but not sufficient for safety assurance of AVs. Therefore, Sec.~\ref{sec:discussion_other_activities} places the reviewed topics into a broader context by drawing connections to related activities around perceptual aspects in safety assurance. \subsection{Open Issues per Testing Axis} \label{sec:discussion_answers} In terms of metrics and test criteria (Sec.~\ref{sec:axis_criteria_metrics}), current challenges are the incompleteness of criteria due to the open-world context and also the consideration of a potential safety impact in the metrics. % Open issues about perception-specific test scenarios (Sec.~\ref{sec:axis_test_scenarios}) are a common description language and format, a combination of scenario generation approaches for sufficient ODD coverage, and the difficulty of recording the identified test scenarios in the real world. The most appropriate source of reference data (Sec.~\ref{sec:axis_ref_data}) depends on the investigated aspect of environment perception. A combination of multiple such investigations into a harmonized methodology targeting the safety proof appears to be not yet demonstrated in the literature. The mentioned open issues from the literature might be the reason why as of now, safety standards (Sec.~\ref{sec:standards}) leave many details around perception testing open. \subsection{Open Issues Between the Testing Axes} \label{sec:discussion_interdependencies} Solutions to the individual testing axes must be able to fit into a consolidated methodology that also considers intersection topics between the axes. For example, at the intersection of test criteria and scenarios, the criteria on the SUT's FOV might be relaxed if the ego vehicle drives slowly due to rain in the respective scenario. In between the axes scenarios and reference data, the fact that rain is present in the scenario might affect some ways of reference data generation more than others. The intersection between reference data and metrics/criteria includes the metrics' sensitivity to details in the reference data. For example, a metric that penalizes false negatives behind occlusions produces different results depending on whether the reference data contain these occluded objects or not. While an all-encompassing methodology that covers all of such details seems to be not yet demonstrated, approaches such as~\cite{Czarnecki_2018_Framework} or~\cite{Berk2020summary} already propose general ways of how the dependability of the perception subsystem could be managed and tested. \subsection{Further Safety Assurance Activities Regarding Perception} % \label{sec:discussion_other_activities} Testing as described in this review (see Table ~\ref{table:focus_of_paper}) is only one activity out of many within an all-encompassing safety argumentation. The following subsections intend to reveal this larger context by drawing connections to related activities in perception dependability. We structure the approaches according to the means for attaining dependability by \cite{Avizienis2004dependability}, which have recently been adopted to uncertainties in AD \cite{Gansch2020uncertainty}. They consist of prevention, removal, tolerance, and forecasting of faults or uncertainty, respectively. \subsubsection{Uncertainty Prevention} \label{sec:uncertainty_prevention} \textit{Formal verification} of the perception subsystem could ideally prevent the occurrence of certain world model uncertainties. So far, we are not aware of formal verification methods that cover the entire perception subsystem. Also, the review paper~\cite{Riedmaier2020_surveySBT} only mentions formal verification methods for the downstream driving function. % However, formal analysis and verification of DNNs for perception tasks is an active topic of research~\cite{Wang2018formal,Seshia2016verifiedAI}. Moreover, the way in which uncertain world models affect formally verified downstream driving functions is actively being researched, for example in the context of RSS~\cite{Salay2020_purss}. Another means of uncertainty prevention is the restriction to certain ODDs~\cite{Gansch2020uncertainty}. \subsubsection{Uncertainty Removal} \label{sec:uncertainty_removal} Perceptual uncertainties can be removed during development and during its use after the initial release. Uncertainty removal during development includes safety analysis methods such as fault tree analysis (FTA)~\cite{Gansch2020uncertainty}, or insightful developer testing with the goal of reducing found uncertainties afterwards. For example, \textit{white-box-testing of the perception subsystem} can reveal uncertainties related to the physically complex measurement principles (see e.g.~\cite{holder2019modeling}). Human-understandable insights into the DNNs for object detection are, however, difficult~\cite[Safety Concern~3]{Willers2020safety}. \textit{Testing on simulated raw data} % allows the perception algorithm to be tested without the need for physical sensor hardware (e.g.~\cite{Barbier2019PerceptionValidation} for grid mapping). For testing object perception algorithms, a simulation environment such as \cite{NeumannCosel2014vtd} could produce both the raw sensor data as an input to the algorithm under test and a ground truth object list as a reference. A hybrid approach is to test the perception algorithm on recorded real data with simulated injected faults~\cite{Rao2019faultInjection}. After the initial release, \textit{incremental safety assurance} through system updates is a necessary means to remove uncertainties because the ODD of the AV changes continuously~\cite[Safety Concern~2]{Willers2020safety}. Ideally, the safety argumentation should allow minor system updates without having to repeat major testing efforts~\cite{Koopman2018towardFramework}. Agile safety cases~\cite{Myklebust2020agile} could enable the safe deployment of such incremental updates through a DevOps-like workflow~\cite{Czarnecki2019devOps}. \subsubsection{Uncertainty Tolerance} \label{sec:uncertainty_tolerance} \textit{Runtime monitoring} of the uncertainty of the produced world model can help mitigating the safety consequences of perception errors~\cite{Antonante2020perceptionMonitoringv3}. An RSS-compliant planner would become more cautious for uncertain world models due to a reduced set of guaranteed safe control actions~\cite{Salay2020_purss} (Sec.~\ref{sec:downstream_comparison}). Similarly, in a service-oriented architecture, sensor data that is monitored as too uncertain or faulty could lead to a bypass of the usual information processing pipeline in favor of a safe behavior for degraded modes~\cite[Fig.~3]{Woopen2018UNICARagil}. An overview of self-representation and monitoring of subsystems is given in~\cite{Nolte2020selfRepresentation}. % Similarly, in the ISO 26262 context, it was proposed that the perception subsystem dynamically outputs one world model for each ASIL level such that the planner can dynamically take just that world model that it needs to comply to the ASIL requirement of the current driving situation~\cite{Johansson2016perceptionASIL,Johansson2017assessingUseOfSensors, Cassel2020SAEPerceptionRequirements}. In any of such applications, it is crucial to assure that the reported uncertainties are correctly calibrated (Sec.~\ref{sec:self_reporting_metrics}). Furthermore, the mentioned \textit{collaborative world model through V2X} (Sec.~\ref{sec:collaborative_world_model}) can also serve as a means for uncertainty tolerance if participating cars can reduce their world model uncertainties through, e.g., a cloud-based fusion~\cite{Lampe2020reducing}. \subsubsection{Uncertainty Forecasting} \label{sec:uncertainty_forecasting} \begin{figure}[t] \centering \vspace*{2mm} \includegraphics[width=\linewidth]{graphics/taxonomy_macroscopic.pdf} \caption{Perception testing for macroscopic safety assurance without separately generated reference data~\cite{Berk2020summary,Berk2019ReferenceTruth}, expressed in taxonomy (Fig.~\ref{fig:taxonomy_general}).} \label{fig:taxonomy_berk} \end{figure} The failure rates in a fused world model must be extremely low, which means that the direct test effort for proving or forecasting it is extremely high. One approach to overcome this so-called approval trap \cite{Winner2016quoVadis} is to test the more failure-prone world models of individual sensor systems \textit{before} they are fused~\cite{shalevshwartz2017formalRSS},~\cite{Berk2020summary}. The latter source investigates how this could be realized without separately generated reference data, allowing the tests to be potentially executed in shadow-mode by production vehicles. In this approach (Fig.~\ref{fig:taxonomy_berk}), the reference data take the form of a \mbox{k-out-of-n}-vote of object-level fusion inputs (Sec.~\ref{sec:ref_data_k_out_of_n}). Such a mutual cross-referencing mechanism is also suggested in \textit{Safety First for Automated Driving} \cite[Sec.~2.2.2.4]{SaFAD2019}. The mentioned testing approach exploits the redundancy of fusion inputs in the following way~\cite{berk2019exploiting}. If a mean time between failures of for example $\SI{e4}{\hour}$ can be demonstrated for two statistically independent inputs to a data fusion system, then the fusion output has a mean time between failures of about $\SI{e8}{\hour}$. Such a redundancy exploitation has also been stated in the RSS papers~\cite{shalevshwartz2017formalRSS},~\cite{Weast2020} and in literature on perception subsystem architectures~\cite{Grubmuller2019robustFusion},~\cite{kaprocki2019multiunit} and perception requirements~\cite{Cassel2020SAEPerceptionRequirements}. The actual number of necessary test kilometers is then computed in a statistically sound way based on how statistically dependent the inputs to the object-level fusion system actually are~\cite{Berk2017BayesianTestDesign, Bock2016testEffortEstimation}. Whether or not perceptual uncertainties lead to safety-critical failures on the vehicle level might require a \textit{sensitivity analysis of the driving function}. Reachability analysis (e.g.~\cite{althoff2010reachability, Pek2020onlineVerification}) could be used to analyze in detail whether an uncertain world model can lead to unsafe future states, as outlined in the context of the \textit{incurred severity} metric~\cite{Salay2019_safety_perceptual_components}. An impact analysis of perceptual errors on the downstream driving function has also already been described in~\cite{Piazzoni2020Modeling_conference}. Furthermore, uncertainty forecasting for the release argumentation could make use of the tests mentioned under \textit{Uncertainty Removal} (Sec.~\ref{sec:uncertainty_removal}) if they are validated and executed on separate test datasets. \section{Conclusion} \label{sec:conclusion} We analyzed literature from multiple neighboring fields, attempting to provide a structured overview of safety-relevant testing activities for the environment perception of AVs. These neighboring fields included, but are not limited to, AV safety assurance, perception algorithm development, and safeguarding of artificial intelligence. A combined literature search process that consisted of undocumented search, keyword-based search and snowballing search required large efforts, but appeared to be suitable for covering the relevant literature. The analyzed test methods from the available literature seem to be not yet capable of demonstrating the dependability of the perception subsystem for series-production Level~4 vehicles. % To overcome this issue, the provided overview can serve as a common basis for a further harmonization of primary literature contributions into all-encompassing novel testing methodologies. \section*{Acknowledgement} \label{sec:contributions} The authors would like to thank their colleagues at the Institute for Automotive Engineering and their project partners of the project VVM, a project of the PEGASUS family, for their valuable feedback on the initial version of this paper. Furthermore, the authors would like to thank Robert Krajewski for fruitful discussions. Despite all efforts, we might have unintentionally overlooked individual literature contributions to the research question. In that case, we apologize to the corresponding authors and are welcoming such feedback from the community. \bibliographystyle{IEEEtran} %
\section{Introduction} \label{introduction} Neural sequence-to-sequence models are omnipresent in the field of natural language processing due to their impressive performance. They hold state of the art on a myriad of tasks, e.g., neural machine translation \cite[NMT;][]{ott-etal-2018-scaling} and abstractive summarization \cite[AS;][]{lewis2019bart}. Yet, an undesirable property of these models has been repeatedly observed in word-level tasks: When using beam search as the decoding strategy, increasing the beam width beyond a size of $k=5$ often leads to a drop in the quality of solutions \cite{murray-chiang-2018-correcting, yang-etal-2018-breaking,pmlr-v97-cohen19a}. Further, in the context of NMT, it has been shown that the empty string is frequently the most-probable solution under the model \cite{stahlberg-byrne-2019-nmt}. Some suggest this is a manifestation of the general inadequacy of neural models for language generation tasks \cite{koehn-knowles-2017-six, kumar2019calibration,holtzman2019curious,stahlberg_phd}; in this work, we find evidence demonstrating otherwise.\looseness=-1 \begin{table} \centering \adjustbox{width=\linewidth}{ \begin{tabular}{@{}c|llll@{}} \toprule & $k=1$ & $k=10$ &$k=100$ & $k=500$ \\ \hline \bf NMT & 63.1\% & 46.1\% & 44.3\% & 6.4\% \rule{0pt}{3ex}\\ \bf MI & ~0.8\% & ~0.0\% & ~0.0\% & 0.0\% \\ \bottomrule \end{tabular}} \caption{Percentage of search errors---which we define as instances where the search strategy does not find the global optimum under the model---for Transformers trained on IWSLT'14 De-En (NMT) and SIGMORPHON 2020 (Morphological Inflection; MI) when decoding with beam search for varying beam widths ($k$). MI results are averaged across languages.} \label{tab:search_errors_nmt} \end{table} Sequence-to-sequence transducers for character-level tasks often follow the architectures of their word-level counterparts \cite{faruqui-etal-2016-morphological, lee-etal-2017-fully}, and have likewise achieved state-of-the-art performance on e.g., morphological inflection generation \cite{wu2020applying} and grapheme-to-phoneme conversion \cite{G2P}. Given prior findings, we might expect to see the same degenerate behavior in these models---however, we do not. We run a series of experiments on morphological inflection (MI) generators to explore whether neural transducers for this task are similarly poorly calibrated, i.e. are far from the true distribution $p(\mathbf{y}\mid\mathbf{x})$. We evaluate the performance of two character-level sequence-to-sequence transducers using different decoding strategies; our results, previewed in \cref{tab:search_errors_nmt}, show that evaluation metrics do not degrade with larger beam sizes as in NMT or AS. Additionally, only in extreme circumstances, e.g., low-resource settings with less than 100 training samples, is the empty string ever the global optimum under the model.\looseness=-1 Our findings directly refute the claim that neural architectures are inherently inadequate for modeling language generation tasks. Instead, our results admit two potential causes of the degenerate behavior observed in tasks such as NMT and AS: (1) lack of a deterministic mapping between input and output and (2) a (perhaps irreparable) discrepancy between sample complexity and training resources. Our results alone are not sufficient to accept or reject either hypothesis, and thus we leave these as future research directions.\looseness=-1 \section{Neural Transducers} Sequence-to-sequence transduction is the transformation of an input sequence into an output sequence. Tasks involving this type of transformation are often framed probabilistically, i.e., we model the \emph{probability} of mapping one sequence to another. On many tasks of this nature, neural sequence-to-sequence models \cite{sutskever_rnn, Bahdanau} hold state of the art. Formally, a neural sequence-to-sequence model defines a probability distribution $p_{\vtheta}(\mathbf{y}\!\mid\!\mathbf{x})$ parameterized by a neural network with a set of learned weights ${\boldsymbol \theta}$ for an input sequence $\mathbf{x} = \langle x_1, x_2, \dots\rangle$ and output sequence $\mathbf{y} = \langle y_1, y_2, \dots \rangle$. Morphological inflection and NMT are two such tasks, wherein our outputs are both strings. Neural sequence-to-sequence models are typically locally normalized, i.e. $p_{\vtheta}$ factorizes as follows:\looseness=-1 \begin{equation}\label{eq:sequence_probability} p_{\vtheta}(\mathbf{y} \!\mid \!\mathbf{x}) = \prod_{t=1}^{|\mathbf{y}|}p_{\boldsymbol \theta}(y_t \mid\! \mathbf{x}, \mathbf{y}_{<t}) \end{equation} \noindent Given a vocabulary $\mathcal{V}$, each conditional $p_{\vtheta}$ is a distribution over $\mathcal{V} \cup \{\textsc{eos}\xspace\}$ and $y_0 := \textsc{bos}\xspace$. We consider $p_{\vtheta}(\mathbf{y} \!\mid\! \mathbf{x})$ to be \defn{well-calibrated} if its probability estimates are representative of the true likelihood that a solution $\mathbf{y}$ is correct. \paragraph{Morphological Inflection.} In the task of morphological inflection, $\mathbf{x}$ is an encoding of the lemma concatenated with a flattened morphosyntactic description (MSD) and $\mathbf{y}$ is the target inflection. As a concrete example, consider inflecting the German word \textit{Bruder} into the genitive plural, as shown in \cref{tab:inflection_example}. Then, $\mathbf{x}$ is the string $\langle \texttt{B r u d e r GEN PL}\rangle$ and $\mathbf{y}$ is the string $\langle \texttt{B r {\"u} d e r}\rangle$. As this demonstrates, morphological inflection generation is, by its nature, modeled at the character level \cite{faruqui-etal-2016-morphological,wu-cotterell-2019-exact}, i.e., our target vocabulary $\mathcal{V}$ is a set of characters in the language. Note that $\mathbf{y} \in \mathcal{V}^*$, but $\mathbf{x} \not\in \mathcal{V}^*$ due to the additional encoding of the MSD. This stands in contrast to NMT, which is typically performed on a (sub)word level, making the vocabulary size orders of magnitude larger.\looseness=-1 Another important differentiating factor of morphological inflection generation in comparison to many other generation tasks in NLP is the one-to-one mapping between source and target.\footnote{While there are cases where there exist multiple inflected forms of a lemma, e.g., in English the past tense of \textit{dream} can be realized as either \textit{dreamed} or \textit{dreamt}, these cases (termed ``overabundance'') are rare \cite{OverabundanceinMorphology}.} In contrast, there are almost always many correct ways to translate a sentence into another language or to summarize a large piece of text; this characteristic manifests itself in training data where a single phrase has instances of different mappings, making tasks such as translation and summarization inherently ambiguous. \begin{table} \centering \small \adjustbox{max width=\linewidth}{ \begin{tabular}{@{}l|ll@{}} \toprule & Singular & Plural \\ \hline Nominativ & Bruder & Br\"uder \rule{0pt}{3ex} \\ Genitiv & Bruders & Br\"uder \\ Dativ & Bruder & Br\"udern \\ Akkusativ & Bruder & Br\"uder \\ \bottomrule \end{tabular}} \caption{Inflection table for the German word \textit{Bruder}} \label{tab:inflection_example} \end{table} \section{Decoding} In the case of probabilistic models, the decoding problem is the search for the most-probable sequence among valid sequences $\mathcal{V}^*$ under the model $p_{\vtheta}$:\looseness=-1 \begin{equation}\label{eq:decoding} \mathbf{y}^\star = \argmax_{\mathbf{y} \in \mathcal{V}^*} \log p_{\vtheta}(\mathbf{y} \mid \mathbf{x}) \end{equation} \noindent This problem is also known as maximum-a-posteriori (MAP) inference. Decoding is often performed with a heuristic search method such as greedy or beam search \cite{reddy-1977}, since performing exact search can be computationally expensive, if not impossible.\footnote{The search space is exponential in the sequence length and due to the non-Markov nature of (typical) neural transducers, dynamic-programming techniques are not helpful.} While for a deterministic task, greedy search is optimal under a Bayes optimal model,\footnote{Under such a model, the correct token $y_i$ at time step $i$ will be assigned all probability mass.} most text generation tasks benefit from using beam search. However, text quality almost invariably decreases for beam sizes larger than $k=5$. This phenomenon is sometimes referred to as the \defn{beam search curse}, and has been investigated in detail by a number of scholarly works \cite{koehn-knowles-2017-six, murray-chiang-2018-correcting, yang-etal-2018-breaking, stahlberg-byrne-2019-nmt, pmlr-v97-cohen19a, eikema2020map}. \begin{table*} \centering \adjustbox{max width=\textwidth}{ \begin{tabular}{ @{}l|llll|llll@{}} \toprule & \multicolumn{4}{c|}{\bf Transformer} & \multicolumn{4}{c}{\bf HMM}\\ & $k=1$ & $k=10$ & $k=100$ & Dijkstra & $k=1$ & $k=10$ & $k=100$ & Dijkstra\\ \hline Overall & 90.34\% & 90.37\% & 90.37\% & 90.37\% & 86.03\% & 85.62\% & 85.60\% & 85.60\% \rule{0pt}{3ex}\\ Low-resource & 84.10\% & 84.12\% & 84.12\% & 84.12\% & 70.99\% & 69.37\% & 69.31\% & 69.31\%\\ High-resource & 94.05\% & 94.08\% & 94.08\% & 94.08\% & 93.60\% & 93.72\% & 93.72\% & 93.72\%\\ \bottomrule \end{tabular}} \caption{Prediction accuracy (averaged across languages) by decoding strategy for Transformer and HMM. We include breakdown for low-resource and high-resource trained models. $k$ indicates beam width.} \label{tab:accuracies} \end{table*} Exact decoding can be seen as the case of beam search where the beam size is effectively stretched to infinity.\footnote{This interpretation is useful when comparing with beam search with increasing beam widths.} By considering the complete search space, it finds the globally best solution under the model $p_{\vtheta}$. While, as previously mentioned, exact search can be computationally expensive, we can employ efficient search strategies due to some properties of $p_{\vtheta}$. Specifically, from \cref{eq:sequence_probability}, we can see that the scoring function for sequences $\mathbf{y}$ is monotonically decreasing in $t$. We can therefore find the provably optimal solution with Dijkstra's algorithm \cite{dijkstra1959note}, which terminates and returns the global optimum the first time it encounters an \textsc{eos}\xspace. Additionally, to prevent a large memory footprint, we can lower-bound the search using any complete hypothesis, e.g., the empty string or a solution found by beam search \cite{stahlberg-byrne-2019-nmt, meister+al.tacl20}. That is, we can prematurely stop exploring solutions whose scores become less than these hypotheses at any point in time. Although exact search is an exponential-time method in this setting, we see that, in practice, it terminates quickly due to the peakiness of $p_{\vtheta}$ (see \cref{sec:time}). While the effects of exact decoding and beam search decoding with large beam widths have been explored for a number of word-level tasks \cite{stahlberg-byrne-2019-nmt, pmlr-v97-cohen19a, eikema2020map}, to the best of our knowledge, they have not yet been explored for any character-level sequence-to-sequence tasks.\looseness=-1 \section{Experiments} We run a series of experiments using different decoding strategies to generate predictions from morphological inflection generators. We report results for two near-state-of-the-art models: a multilingual Transformer \cite{wu2020applying} and a (neuralized) hidden Markov model \cite[HMM;][]{wu-cotterell-2019-exact}. For reproducibility, we mimic their proposed architectures and exactly follow their data pre-processing steps, training strategies and hyperparameter settings.\footnote{ \url{https://github.com/shijie-wu/neural-transducer/tree/sharedtasks}} \paragraph{Data.} We use the data provided by the SIGMORPHON 2020 shared task \cite{vylomova2020sigmorphon}, which features lemmas, inflections, and corresponding MSDs in the UniMorph schema \cite{kirov-etal-2018-unimorph} in 90 languages in total. The set of languages is typologically diverse (spanning 18 language families) and contains both high- and low-resource examples, providing a spectrum over which we can evaluate model performance. The full dataset statistics can be found on the task homepage.\footnote{\url{https://sigmorphon.github.io/sharedtasks/2020/task0/}} When reporting results, we consider languages with $< 1000$ and $\geq 10000$ training samples as low- and high-resource, respectively. \paragraph{Decoding Strategies.} We decode morphological inflection generators using exact search and beam search for a range of beam widths. We use the SGNMT library for decoding \cite{stahlberg2017sgnmt} albeit adding Dijkstra's algorithm.\looseness=-1 \begin{table} \centering \adjustbox{max width=\linewidth}{ \begin{tabular}{ @{}l|llcl@{}} \toprule & \bf \makecell[c]{Beam\\$k\!=\!1$} & \bf \makecell[c]{Beam\\$k\!=\!10$} & \bf Optimum &\bf \makecell[c]{Empty\\String}\\ \hline Transformer & -0.619 & -0.617 & -0.617 & ~~-6.56 \rule{0pt}{3ex}\\ HMM & -1.08 & -0.89 & -0.80~~ & -20.15\\ \bottomrule \end{tabular}} \caption{Average log probability of inflections generated with various decoding strategies and the empty string (averaged across all languages).} \label{tab:empty_prob_vs_log_prob} \end{table} \subsection{Results} \cref{tab:accuracies} shows that the accuracy of predictions from neural MI generators generally does not decrease when larger beam sizes are used for decoding; this observation holds for both model architectures. While it may be expected that models for low-resource languages generally perform worse than those for high-resource ones, this disparity is only prominent for HMMs, where the difference between high- and low-resource accuracy is $\approx 24\%$ vs. $\approx 10\%$ for the Transformers. Notably, for the HMM, the global optimum under the model is the empty string far more often for low-resource languages than it is for high-resource ones (see \cref{tab:avg_percentage_empty_strings_high_low_resource_mono-hmm_dijkstra}). We can explicitly see the inverse relationship between the log-probability of the empty string and resource size in \cref{fig:empty_string_prob_vs_trn_size_mono-hmm}. In general, across models for all 90 languages, the global optimum is rarely the empty string (\cref{tab:avg_percentage_empty_strings_high_low_resource_mono-hmm_dijkstra}). Indeed, under the Transformer-based transducer, the empty string was \emph{never} the global optimum. This is in contrast to the findings of \citet{stahlberg-byrne-2019-nmt}, who found for word-level NMT that the empty string was the optimal translation in more than 50\% of cases, even under state-of-the-art models. Rather, the average log-probabilities of the empty string (which is quite low) and the chosen inflection lie far apart (\cref{tab:empty_prob_vs_log_prob}).\looseness=-1 \begin{figure} \centering \includegraphics[width=0.49\textwidth]{plots/box_bucketed_trn_size_vs_empty_str_prob_mono-hmm.eps} \caption{Average (log) probability of the empty string for different training dataset sizes for HMM.} \label{fig:empty_string_prob_vs_trn_size_mono-hmm} \end{figure} \section{Discussion} Our findings admit two potential hypotheses for poor calibration of neural models in certain language generation tasks, a phenomenon we do not observe in morphological inflection. First, the tasks in which we observe this property are ones that lack a deterministic mapping, i.e. tasks for which there may be more than one correct solution for any given input. As a consequence, probability mass may be spread over an arbitrarily large number of hypotheses \cite{ott2018analyzing,eikema2020map}. In contrast, the task of morphological inflection has a near-deterministic mapping. We observe this empirically in \cref{tab:empty_prob_vs_log_prob}, which shows that the probability of the global optimum on average covers most of the available probability mass---a phenomenon also observed by \citet{peters-martins-2019-ist}. Further, as shown in \cref{tab:search_errors}, the dearth of search errors even when using greedy search suggests there are rarely competing solutions under the model. We posit it is the lack of ambiguity in morphological inflection that allows for the well-calibrated models we observe.\looseness=-1 Second, our experiments contrasting high- and low-resource settings indicate insufficient training data may be the main cause of the poor calibration in sequence-to-sequence models for language generation tasks. We observe that models for MI trained on fewer data typically place more probability mass on the empty string. As an extreme example, we consider the case of the Zarma language, whose training set consists of only 56 samples. Under the HMM, the average log-probability of the generated inflection and empty string are very close ($-8.58$ and $-8.77$, respectively). Furthermore, on the test set, the global optimum of the HMM model for Zarma is the empty string 81.25\% of the time.\looseness=-1 \begin{table} \begin{center} \begin{tabular}{ @{}l|cc@{} } \toprule & \textbf{HMM} & \textbf{Transformer}\\ \hline Overall & ~~ 2.03\%~~~~ & 0\%\rule{0pt}{3ex}\\ Low-resource & ~~ 8.65\% ~~~ & 0\%\\ High-resource & ~~ 0.0002\% & 0\% \\ \bottomrule \end{tabular} \end{center} \caption{Average percentage of empty strings when decoding with exact inference for HMM and Transformer, with resource group breakdown.} \label{tab:avg_percentage_empty_strings_high_low_resource_mono-hmm_dijkstra} \end{table} \begin{table} \small \centering \adjustbox{max width=\linewidth}{ \begin{tabular}{@{}l|llll@{}} \toprule & $k = 1$ & $k = 10$ & $k = 100$ & $k = 200$ \\ \hline HMM & 6.20\% & 2.33\% & 0.001\% & 0.0\% \rule{0pt}{3ex}\\ Transformer & 0.68\% & 0.0\% & 0.0\% & 0.0\% \\ \bottomrule \end{tabular}} \caption{Average percentage of search errors (averaged across languages) for beam search with beam width $k$.\looseness=-1} \label{tab:search_errors} \end{table} From this example, we can conjecture that lack of sufficient training data may manifest itself as the (relatively) high probability of the empty string or the (relatively) low probability of the optimum. We can extrapolate to models for NMT and other word-level tasks, for which we frequently see the above phenomenon. Specifically, our experiments suggest that when neural language generators frequently place high probability on the empty string, there may be a discrepancy between the available training resources and the number of samples needed to successfully learn the target function. While this at first seems an easy problem to fix, we expect the number of resources needed in tasks such as NMT and AS is much larger than that for MI if not due to the size of the output space alone; perhaps so large that they are essentially unattainable. Under this explanation, for certain tasks, there may not be a straightforward fix to the degenerate behavior observed in some neural language generators.\looseness=-1 \section{Conclusion} In this work, we investigate whether the poor calibration often seen in sequence-to-sequence models for word-level tasks also occurs in models for morphological inflection. We find that character-level models for morphological inflection are generally well-calibrated, i.e. the probability of the globally best solution is almost invariably much higher than that of the empty string. This suggests the degenerate behavior observed in neural models for certain word-level tasks is not due to the inherent incompatibility of neural models for language generation. Rather, we find evidence that poor calibration may be linked to specific characteristics of a subset of these task, and suggest directions for future exploration of this phenomenon.
\section{Introduction} \vspace{-0.3cm} Convolutional neural networks (CNNs) have been used extensively for segmentation problems in computer vision \cite{mask-rcnn,resnet101,deeplabv3,HED2015}. CNNs provide a framework for learning descriptors that are able to discriminate different textured or semantic regions within images. Much progress has been made in segmentation with CNNs but results are still far from human performance. Also, significant engineering must be performed to adapt CNNs to segmentation problems. A basic component in the architecture for segmentation problems involves labeling or grouping dense descriptors returned by a backbone CNN. A difficulty in grouping these descriptors arises, especially near the boundaries of segmentation regions, as CNN descriptors aggregate data from fixed shape (square neighborhoods) at each pixel and may thus aggregate data from different regions. This makes grouping these descriptors into a unique region difficult, which often results in errors in the grouping. In segmentation problems (e.g., semantic segmentation), current methods attempt to mitigate these errors by adding post-processing layers that aim to group simultaneously the (coarse-scale) descriptors from the CNN backbone and the fine-level pixel data. However, the errors introduced might not always be fixed. A more natural approach to avoid this problem is to consider the coarse and fine structure together, avoiding aggregation across boundaries, to prevent errors at the outset. To avoid such errors, one could design descriptors that aggregate data only within boundaries. To this end, \cite{Khan2015} introduced ``shape-tailored'' descriptors that aggregate data within a region of interest, and used these descriptors for segmentation. However, these descriptors are hand-crafted and do not perform on-par with learned approaches. \cite{Khan2018a} introduced learned shape-tailored descriptors by learning a neural network operating on the input channel dimension of input hand-crafted shape-tailored descriptors for segmentation. However, these networks, though deep in the channel dimension, did not filter data spatially within layers. Since an advantage of CNNs comes from exploiting spatial filtering at each depth of the network, in this work, we design shape-tailored networks that are deep and perform shape-tailored filtering in space at \emph{each} layer using solutions of the Poisson PDE. This results in shape-tailored networks that provide more discriminative descriptors than a single shape-tailored kernel. This extension requires development of techniques to back-propagate through PDEs, which we derive in this work. Our contributions are specifically: \begin{enumerate}[leftmargin=0.5cm,topsep=1pt,itemsep=0pt] \item We construct and show how to train ST-DNN, deep networks that perform shape-tailored spatial filtering via the Poisson PDE at each depth so as to generalize a CNN to arbitrarily shaped regions. \item We show analytically and empirically that ST-DNNs are covariant to translations and rotations as they inherit this property from the Poisson PDE. In segmentation, covariance (a.k.a., equivariance) to translation and rotation is a desired property: if a segment in an image is found, then the corresponding segment should be found in the translated / rotated image (or object). This property is not generally present with existing CNN-based segmentation methods even when trained with augmented translated and rotated images \cite{azulay2019deep}, and requires special consideration. \item We show analytically and empirically that ST-DNNs are robust to domain deformations. These result from viewpoint change or object articulation, and so they should not affect the descriptor. \item To demonstrate ST-DNN and the properties above, we validate them on the task of segmentation, an important problem in low-level vision \cite{malik1990preattentive,arbelaez2011contour}. \end{enumerate} Because of properties of the PDE, ST-DNN also have desirable generalization properties. This is because: a) The robustness and covariance properties are built into our descriptors and do not need to be learned from data, b) The PDE solutions, generalizations of Gabor-like filters \cite{Olhausen96, nature_2019}, have natural image structure inherent in their solutions and so this does not need to be learned from data, and c) Our networks have fewer parameters compared to existing networks in segmentation. This is because the PDE solutions form a basis and only linear combinations of a few basis elements are needed to learn discriminative descriptors for segmentation. In contrast, CNNs spend a lot of parameters to learn this structure. \subsection{Related Work} Traditional approaches to segmentation rely on hand-crafted features, e.g., through a filter bank \cite{Haralick1985}. These features are ambiguous near the boundaries of objects. In \cite{Khan2015} hand-crafted descriptors that aggregate data within object boundaries are constructed to avoid this, but lack sufficient capacity to capture the diversity of textures or be invariant to nuisances. \cite{Khan2017} extended the shape-tailored descriptors to a continuum of scale space to achieve coarse to fine segmentation. Deep-learning based approaches have showed state-of-the-art results in edge-based methods \cite{Xie2017,He_2019_CVPR,CrispBoundaries2019}. Watershed is applied on edge-maps to obtain the segmentation. The main drawback of these methods is it is often difficult to form segmentations due to extraneous or faint edges, particularly when "textons" in textures are large. CNNs have been applied to compute descriptors for semantic segmentation, where pixels in an image are classified into certain semantic object classes \cite{Li_2019_ICCV,Huang_2019_ICCV,Du_2019_ICCV,Pang_2019_ICCV,Zhu_2019_ICCV, Liu_2019_CVPR}. Usually these classes are limited to a few object classes and do not tackle general textures, where the number of classes may be far greater, and thus such approaches are not directly applicable to texture segmentation. But semantic segmentation approaches may eventually benefit from our methodology as descriptors aggregating data only within objects or regions are also relevant to these problems. A learned shape-tailored descriptor \cite{Khan2018a} is constructed with a Siamese network on hand-crafted shape-tailored descriptors. However, \cite{Khan2018a} only does shape-tailored filtering in pre-processing as layering these requires new methods to train. We further examine covariance and robustness, not examined in \cite{Khan2018a}. Covariance to rotation in CNNs has been examined in recent works, e.g., \cite{NIPS2018_covariance,NIPS2019_shift, NIPS2019_cormorant}. They, however, are not shape-tailored so do not aggregate data only within shaped regions. Lack of robustness to deformation (and translation) in CNNs is examined in \cite{azulay2019deep} and theoretically in \cite{NIPS2017_invariance}. \cite{sifre2013rotation} constructs deformation robust descriptors inspired by CNNs, but are hand-crafted. \section{Construction of Shape-tailored DNN and Properties} In this section, we design a deep neural network that outputs descriptors at each pixel within an arbitrary shaped region of interest and aggregates data only from within the region. We want the descriptors to be discriminative of different texture, yet robust to nuisances within the region (e.g., local photometric and geometric variability) to be useful for segmentation. Our construction uses a Poisson PDE, which naturally smooths data only within a region of interest. Smoothing naturally yields robustness to geometric nuisances (domain deformations). By taking linear combinations of derivatives of the output of the PDE, we can approximate the effect of general convolutional kernels but avoid mixing data across the boundary of region of interest. ST-DNN is also covariant to translations and rotations, inheriting it from the Poisson equation, which leads to the segmentation algorithm being covariant to such transformations. \subsection{Shape-Tailored DNN Descriptors through Poisson PDE} \label{sec:STDNN} {\bf Shape-tailored Smoothing via Poisson PDE}: To construct a shape-tailored deep network, we first smooth the input to a layer using the Poisson PDE so as to aggregate data only within the region of interest, similar to what is done in \cite{Khan2015} for just the first layer. Let $R\subset \Omega \subset \mathbb{R}^2$ be the region of interest, where $\Omega$ is the domain of the input image $\mathbf{I} : \Omega \to \mathbb{R}^k$ and $k$ is the number of input channels to the layer. Let $\mathbf{u} : R \to \mathbb{R}^M$ ($M$ is the number of output channels) be the result of the smoothing; the components $u$ of $\mathbf{u}$ solve the PDE within $R$: \begin{equation} \label{eq:poisson} \begin{cases} u(x) -\alpha \Delta u(x) = I(x) & x\in R \\ \nabla u(x) \cdot N = 0 & x\in \partial R \end{cases} \quad, \end{equation} where $I$ is a channel of $\mathbf{I}$, $\partial R$ is the boundary of $R$, $N$ is normal to $\partial R$, $\alpha$ is the scale of smoothing and $\Delta / \nabla$ are the Laplacian and the gradient respectively. It can be shown that the smoothing can be written in the form $u(x)=\int_R K(x,y)I(y)dy$ where $K(.,.)$ is the Green's function of the PDE, a smoothing kernel, which further shows that the PDE aggregates data only within $R$. {\bf Shape-tailored Deep Network}: We can now generalize the operation of convolution tailored to the region of interest by taking linear combinations of partial derivatives of the output of the PDE \eqref{eq:poisson}. This is motivated by the fact that in $R=\mathbb{R}^2$, linear combinations of derivatives of Gaussians can approximate any kernel arbitrarily well. Gaussian filters are the solution of the heat equation, and the PDE \eqref{eq:poisson} relates to the heat equation, i.e., \eqref{eq:poisson} is the steady state solution of a heat equation. Thus, linear combinations of derivatives of \eqref{eq:poisson} generalize convolution to an arbitrary shape $R$; in experiments, a few first order directional derivatives are sufficient for our segmentation tasks (see Section~\ref{sec:expts} for details). A layer of the ST-DNN takes such linear combinations and rectifies it as follows: \begin{equation} f_i(x)= r \circ L_{i} \circ T[I] (x), \end{equation} where $I : \mathbb{R} \to \mathbb{R}^k$ is the input to the layer, $T$ is an operator that outputs derivatives of the solution of the Poisson PDE \eqref{eq:poisson}, $L_i(y) = w_i y + b_i$ is a point-wise linear function (i.e., a $1\times 1$ convolution applied to combine different channels), $r$ is the rectified linear function, and $i$ indexes the layer of the network. Notice that since $r$ and $L_i$ are pointwise operations, they preserve the property of $T$ that it aggregates data only within the region $R$. We now compose layers to construct a ST-DNN as follows: \begin{equation} \label{eq:STDNN_eqn} F[I](x) = s \circ f_m \circ f_{m-1} \circ f_{m-2} \circ .... f_0 \circ I(x), \end{equation} where $F[I](x)$ is the output of the ST-DNN, $f_0,...,f_m$ are the $m+1$ layers of the network, $I$ is the input image, and $s$ represents the soft-max operation (to bound the output values). ST-DNN does not have a pooling layer because the PDE already aggregates data from a neighborhood by smoothing; further, the lack of reduction in spatial dimension allows for more accurate shape estimation in our subsequent segmentation, and avoids the need for up-sampling layers. We will show that we can retain efficiency in training and inference. \subsection{Covariance and Robustness of ST-DNN} In addition to ST-DNN generalizing CNNs to arbitrary shaped regions, the ST-DNN is also covariant to in-plane translation and rotation, and robustness to domain deformations due to properties of the Poisson PDE. This means covariance also extends to our segmentation method, which is important as any object segmented in an image will also be segmented if the camera undergoes these transformations. Robustness to deformations is important as this means that small geometric variability (e.g., shape variations in textons, small viewpoint change, object deformation) will not affect the descriptors and the segmentation much. We make these properties more precise, and give intuition for proofs, leaving details to Appendix~\ref{sec:Proofs_supp}. A covariant operator commutes with a set of transformations: \begin{defn} An operator $S : \mathcal{I} \to \mathcal{I}$ (from the set of images $\mathcal I$ to itself) is {\bf covariant} to a class $\mathcal{W}$ of transformations if $S [I \circ w] = [SI]\circ w$ for every $I\in \mathcal{I}$ and $w\in \mathcal{W}$. \end{defn} ST-DNN is covariant to $\mathcal W$, the set of in-plane rotations and translations: \begin{thrm}\label{thrm:covariance} The ST-DNN \eqref{eq:STDNN_eqn} is covariant to the set of translations and rotations, i.e., $x \to \mathcal{R}x+\mathcal{T}$ where $\mathcal{R}$ is a $2\times 2$ rotation matrix and $\mathcal{T}\in \mathbb{R}^2$. \end{thrm} This follows from the covariance of the Laplacian and point-wise operations (rectification, $1\times 1$ convolution), and lack of sub-sampling. We now make precise the robustness of the ST-DNN to domain deformations: \begin{thrm}\label{thrm:robustness} The ST-DNN \eqref{eq:STDNN_eqn} is insensitive to deformations, i.e., \begin{equation} |F[I\circ w]-F[I]| \leq C \| w-\mbox{id} \|_{H^1}, \end{equation} where $w : \Omega\to\Omega$ is a domain deformation, $\mbox{id}$ is the identity map, $H^1$ is the Sobolev norm (measures both the amount and smoothness of the deformation), and $C$ is a constant independent of $w,I$. \end{thrm} Intuitively, this follows from the fact that the Poisson PDE locally averages input data, and local averages are robust to translation and hence deformations, which are locally translations. \section{Training of the Network and Back-Propagation}\label{sec:Backprop} In this section, we describe the training of ST-DNN by introducing a loss function, how the weights can be learned, and the implementation. As the network layers solutions to PDEs, one needs to differentiate through such layers, which we describe. \subsection{Loss Function for Training} Given the ST-DNN of Section \ref{sec:STDNN}, the loss function to train such descriptors from ground truth segmentation masks (motivated by consistency to the segmentation algorithm in Section~\ref{sec:segApp} that is based on classical energies \cite{chan2001active,yezzi1999statistical} from computer vision) is defined as (similar to \cite{sharma2020}): \begin{equation} \label{eq:loss} L({\bf W})= \sum_{i=1}^N \frac{1}{|R_i|}\int_{R_i} || {\bf F}_{\bf W}(x) -{\bf a_i} ||_2^2 dx - \sum_i \sum_{j \neq i}||{\bf a_i} -{\bf a_j}||_2^2 \end{equation} where $i ,j\in \{1,2,...,N\}$ are the indices for the regions in the ground truth segmentation, ${\bf F_W}(x)$ is the output of the ST-DNN, $\mathbf{W}$ are the weights of the network (i.e., weights on derivatives of the Poisson PDE solution), $|R_i|$ is the area of region $i$, and ${\bf a_i}$ is the average descriptor within the $i^{\text{th}}$ region, i.e., ${\bf a_i}= \frac{1}{|R_i|} \int_{R_i} {\bf F_W}(x) dx$. The loss function is comprised of two terms. The first component of the loss is minimized when the learned descriptor is constant within regions $R_i$ so that each region consists of parts of the image with uniform descriptor. The second term forces the learned descriptor of different regions to be different to discriminate different textures. \subsection{Computing Gradients of the Loss and Training} Computing gradients of the loss function for training requires consideration as it involves differentiating through PDEs. The most straightforward way to do this involves discretizing the PDE, so the solution is a linear matrix system as we do below. This allows the use of existing deep learning packages to perform back-propagation by storing the matrix in memory. However, this can lead to large memory consumption as the matrix can be large and is only feasible for small images. Fortunately, our PDEs involve a scale parameter $\alpha$ so we can train using down-sampled images, facilitating the use of existing packages for back-prop, and then infer on native resolution images by simply scaling $\alpha$ by the down-sampling factor, which we do in experiments. The more accurate method, though more difficult to implement, is to avoid storing the matrix and instead compute the PDE solution by an iterative numerical PDE method that does not require storage of matrices. This requires formulating a variant of the back-propagation algorithm, that is similar but involves forward propagation of layer derivatives with respect to the weights through the PDE solutions. This is unfortunately not available in standard deep learning packages. For completeness, we provide the mathematical formulation of this approach in Appendix~\ref{sec:Backprop_supp},for which we have performed experiments for few layer cases. This did not give an appreciable performance increase given the complexity of implementation, but could be useful in other applications. {\bf Implementation}: Using the first method above, we discretize \eqref{eq:poisson} as: \begin{equation}\label{eq:PDE_discretize} u(i,j) - \alpha \cdot \sum_{k,l \in \mathcal{N}(i,j) \cap R } [ u(k,l) - u(i,j) ] = I(i,j), \quad \mbox{ for } \,\, (i,j)\in R \end{equation} where $\mathcal{N}(i,j)$ represents the 4-pixel neighborhood of pixel $(i,j)$, which represents the $i^{\text{th}}$ row and $j^{\text{th}}$ column, and intersection means that only neighbors in the region are considered as implied by the Neumann boundary condition in the PDE, avoiding aggregation outside $R$. The discretization approximately preserves the rotation covariance, and any errors vanish with increasing resolution. Note that more accurate discretizations exist, but our experiments demonstrate the sufficiency of this scheme. We can vectorize $u$ and $I$ and write \eqref{eq:PDE_discretize} as: \begin{equation} \label{eq:invPoisson} \mathbf{A_R} \mathbf{u}= \mathbf{I} \quad \text{and }\quad \mathbf{u}= \mathbf{A_R}^{-1} \mathbf{I}. \end{equation} The above is a linear transformation from $\mathbf I$ to $\mathbf u$. The size of $\mathbf{A}$ is $(mn\times mn)$, where $m$ and $n$ are the number of rows and columns in $I$. With the PDE layers defined through this matrix multiplication, we can use the usual back-propagation method to compute derivatives with respect to weights (see Appendix~\ref{sec:Implementation_supp} for more details). In experiments, we downsampled images to $32\times 32$ for training. \section{Application to Segmentation}\label{sec:segApp} In this section, we describe the procedure for segmentation using the trained ST-DNN. During inference time, the regions of segmentation are estimated iteratively together with updates of the ST-DNN for each of the regions as they evolve. The evolution of the regions to determine the segmentation is obtained by optimizing the following energy (based on the classical energy \cite{chan2001active}): \begin{equation}\label{eq:mulregions} E(\mathbf{R})=\sum_{i=1}^N \int_{R_i} \| {\bf F}_{\bf R_i}(x;W) -{\bf a_i} \|_2^2 dx + \beta \int_{\partial R_i} ds, \end{equation} where $\mathbf{R}=\{R_1,R_2,..., R_N\}$ are regions in segmentation, $\mathbf{F_{R_i}}$ is the shape-tailored descriptor from the DNN given the learned weights $W$ and within $R_i$, and $\beta>0$ is the arclength regularization parameter. Note that this energy differs from the loss function used for training in two ways. First, the second term in \eqref{eq:loss} is omitted as it is used in training to avoid the descriptor from learning to be uniform across different textured regions; during inference, the network is already trained to be different across different regions. Second, we add regularization to keep the region boundaries smooth; it is not needed in training since we do not solve for the regions as ground truth is available. \begin{figure} \centering \includegraphics[scale=0.45]{Figures/fig1.png} \caption{\textbf{ST-DNN computation and joint segmentation.} The input to the network is the image and an initial segmentation mask. ST-DNN dense descriptors are computed for each region of the mask using \eqref{eq:STDNN_eqn}. The segmentation updates by taking a few steps in the gradient direction of \eqref{eq:mulregions}. The process is iterated with the updated segmentation until the regions converge.} \label{fig:segAlgo} \end{figure} To minimize the (non-convex) energy with respect to the region, we use gradient decent. The gradient with respect to the region $R_i$ is approximately given by $[\|{\bf F}_{\bf R_i}(x;W) -{\bf a_i} \|_2^2 -\|{\bf F}_{\bf R_j}(x;W) -{\bf a_j} \|_2^2 + \beta \kappa_i] N_i$ where $N_i$ is the unit outward normal to the region, and $\kappa_i$ is its curvature. The curve (boundary of regions) evolution to determine the regions is implemented with a method analogous to level set methods \cite{osher1988fronts} by evolving smooth indicator functions of regions for convenient implementation, details of the algorithm and implementation are shown in Algorithm~\ref{alg:multilabel_scheme_supp} in Appendix~\ref{sec:Implementation_supp}. The method involves joint updates of the regions and the shape-tailored descriptors within the evolving regions (see Figure~\ref{fig:segAlgo}). We used a box tessellation to initialise the regions, typical of level set methods for segmentation. Our method typically takes a few iterations (approx.~20) to converge in our experiments. \section{Experiments} \label{sec:expts} \textbf{Network Architecture:} We use a 4 layer ST-DNN, which is optimal for the datasets used: fewer layers lead to less accuracy and more layers lead to overfitting (see Appendix~\ref{sec:AddResults_supp}). The layer $f_0$ outputs a 40 dimensional descriptor, with 3 color channels, a gray scale channel and oriented gradients at angles $\{0,\pi/4, \pi/2, 3\pi/4 \}$ over 5 shape-tailored smoothing levels (scales) $\alpha=\{5,10,15,20,25\}$. The four fully-connected layers have 100, 40, 20, 5 hidden units respectively. The smoothing parameter $\alpha$ for all subsequent layers is set to 5. The training on the datasets (below) takes less than 2 hours on Nvidia Quadro RTX 6000 GPU and Intel Xeon 2.60GHz CPU. The inference time (joint segmentation) is 2 seconds on images of size $256\times 256$. \textbf{Datasets:} We apply ST-DNN to texture segmentation (since covariance and robustness properties are important for texture descriptors \cite{julesz1981textons,sifre2013rotation}). We evaluate on two challenging texture segmentation datasets \cite{Khan2015} - the Real-World Texture Segmentation dataset (RWTSD) - 256 complex real-world images (128 training and testing images) and the Synthetic Texture Dataset consists of 200 test images and 300 training images generated from the Brodatz dataset. We have also tested on multi-region segmentation BSDS500 and Synthetic Texture datasets, details are provided below. \textbf{Methods:} We compare our method against popular deep learning architectures in computer vision - DeepLab-v3 \cite{deeplabv3}, and FCN-ResNet101 \cite{resnet101}. In our notation resnet/deeplabv3-x-y, resnet and deeplabv3 represents FCN-Resnet101 and DeepLab-v3 respectively, x denotes the data used in training (subsequently fine-tuned on the texture segmentation dataset). 'x' can be 'm' for MSRA dataset, 'd' for DUTS dataset, 'all' for a combination of all datasets (see Appendix~\ref{sec:AddResults_supp} for more details), and 'TD' for RWTSD (augmented with 8 rotations and 5 scales). 'y' denotes the loss function, 'ce' represents cross-entropy and 'ours' represents the loss introduced in this paper. Segmentation for all methods is done by minimizing \eqref{eq:mulregions}. We also compare our methods against the state-of-the-art methods for texture segmentation, which contain both the classical \cite{arbelaez2011contour,arbelaez2014multiscale,isola2014crisp,Kokkinos2015,Khan2015} and deep-learning methods \cite{Khan2018a}. ST-DNN is trained only on texture datasets. \textbf{Evaluation Metrics}: We compare on evaluation metrics from \cite{Arbelaez2011}. Ground truth covering (GT-Cov), Random Index (RI) and Variation of Information (VOI) measures region accuracy (higher GT-Cov, RI and lower VOI are more accurate), and F-measure (higher is better) measures boundary accuracy. \textbf{Ablation Studies}: We have performed ablations studies that are summarized in Appendix \ref{sec:AddResults_supp} Table \ref{tab:STLDvsST-DNN_supp}. They show that more PDE filtering layers give higher accuracy (up to a point of overfitting at 4 layers), and that shape-tailored descriptors updated as the region updates outperforms non-shape tailored descriptor (ST-DNN computed on the whole image and not updated as the region evolves). \textbf{Testing Covariance:} To demonstrate the covariance of ST-DNN to translation and rotation, we performed an experiment on Real-world Texture Segmentation dataset. Each image in the test set was randomly rotated with $\theta \in \{\pi/6,2\pi/6,3\pi/2,4\pi/6, 5\pi/6,\pi\}$ and cropped to a rectangle at random positions (to simulate translation) in the rotated image; we ensure the rectangle only contains data from the original image. We segment the original and the transformed image, denoted $S[I]$ and $S[I\circ w]$, respectively, where $w$ is the transformation used to produce the translated/rotated image. We then measure the difference between $S[I]\circ w$ and $S[I\circ w]$ through GT-covering; both should be equal if the descriptor is covariant. Results are summarized in Figure~\ref{tab:invariance}. ST-DNN outperforms resnet101-all-ce by a margin of almost 25\%. Note ST-DNN uses no data augmentation, whereas the competing networks are augmented with translated and rotated images from RWTSD. Perfect covariance may not be achieved as translation/rotation also necessarily include occlusion. \def.11\linewidth{.2\linewidth} \def.11\linewidth{0.1\linewidth} \begin{figure}[h] \begin{minipage}{0.5\textwidth} \centering \scriptsize \begin{tabular}{c} \hspace{-1cm}resnet101-all-ce \qquad \qquad \qquad \quad ST-DNN \\ \hspace{0.2cm}image\qquad $90^{\circ}$ rotation\qquad image \qquad $90^{\circ}$ rotation \\ \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/1.jpg.png_1.png}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/1_r.png}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/1_1.png}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/1_s.png}} \end{tabular} \end{minipage} \begin{minipage}{0.5\textwidth} \centering \scriptsize \begin{tabular}{c|c|c|c} \multicolumn{2}{c|}{ST-DNN}& \multicolumn{2}{|c}{resnet101-all-ce}\\ \hline GT Covering & Rand Index& GT Covering & Rand Index \\ \hline 0.87 & 0.89 &0.69 & 0.70 \end{tabular} \end{minipage} \caption{Comparison of covariance to rotation and translation of ST-DNN, and sota CNN descriptor. Left: A sample result with outputs for original and transformed images. Right: Quantitative result on Real-World Texture Dataset: Higher scores indicate better covariance.} \label{tab:invariance} \end{figure} \textbf{Testing Deformation Robustness:} To demonstrate robustness to deformation, we apply the trained networks above to randomly deformed versions of the RWTSD test set. We generate random smooth deformations using truncated Fourier series: $v(x) = \sum_{k=-N}^{N} a_k \exp(i 2\pi k\cdot x)$ where $x\in[0,1]^2, k=(k_1,k_2)$, $w(x)=x+v(x)$ is the deformation, $a_k$ is randomly generated, and $N=10$ (appropriate for the resolution). The Soboev norm is $\|v\|^2 = |a_0|^2 + \sum_{k=-N}^N |k|^2|a_k|^2$. For each image in the dataset we generate 8 random deformations of varying norm $\|v\|^2 $ from 10 to 80 in steps of 10. We examine the robustness of descriptors to deformations of increasing norm by comparing the segmentation of the original and deformed images similar to the previous experiment. Results and qualitative samples are in Figure~\ref{fig:defromExp}, which show that ST-DNN is more robust by large margins than competing descriptors, and the robustness over competing methods increases with increasing norm. Note a descriptor could be robust, but not accurate, but this is not the case for ST-DNN (next experiments). \def.11\linewidth{.135\linewidth} \def.11\linewidth{.08\linewidth} \begin{figure}[h] \begin{minipage}{0.65\textwidth} \scriptsize{ \begin{tabular}{c} original image (left), deformed images (increasing deformation $\longrightarrow$)\\ \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/image10-1-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/image10-2-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/image10-3-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/image10-4-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/image10-6-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/image10-8-eps-converted-to}}\\ ST-DNN\\ \includegraphics[width=.11\linewidth,height=.11\linewidth]{Figures/results10-1-eps-converted-to} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/results10-2-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/results10-3-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/results10-4-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/results10-6-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/results10-8-eps-converted-to}}\\[-\dp\strutbox] DeepLab-v3 \\ \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsDeepLabA10-1-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsDeepLabA10-2-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsDeepLabA10-3-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsDeepLabA10-4-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsDeepLabA10-6-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsDeepLabA10-8-eps-converted-to}}\\[-\dp\strutbox] FCN-ResNet101 \\ \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsResNetA10-1-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsResNetA10-2-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsResNetA10-3-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsResNetA10-4-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsResNetA10-6-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/resultsResNetA10-8-eps-converted-to}}\\[-\dp\strutbox] \end{tabular} } \end{minipage} \begin{minipage}{0.3\textwidth} \centering {\scriptsize \begin{tabular}{ | c | c | c | c | } \hline &\multicolumn{3}{c|}{ GroundTruth Covering} \\ \hline Sobolev Norm & 20 & 40 & 80 \\ \hline DeepLab-v3 & 0.85 & 0.76 & 0.66 \\ \hline FCN-ResNet101 & 0.81 & 0.75 & 0.65 \\ \hline ST-DNN & \textbf{0.88} & \textbf{0.85} & \textbf{0.81} \\ \hline &\multicolumn{3}{c|}{ Rand Index} \\ \hline Sobolev Norm & 20 & 40 & 80 \\ \hline DeepLab-v3 & 0.86 & 0.77 & 0.68 \\ \hline FCN-ResNet101 & 0.82 & 0.77 & 0.68 \\ \hline ST-DNN & \textbf{0.89} & \textbf{0.86} & \textbf{0.82} \\ \hline \end{tabular} } \end{minipage} \caption{\sl Comparison of robustness to deformations of ST-DNN with sota CNN descriptors. Sample results on segmentation of original and deformed images (left), and quantitative results (right): higher values indicates more robustness.} \label{fig:defromExp} \end{figure} \textbf{Comparison of ST-DNN to Standard DNNs}: We segment descriptors (ST-DNN and common deep network backbones) by minimizing \eqref{eq:mulregions}. Quantitative results are in Table~\ref{tab:results_Net} and qualitative samples are shown in Figure~\ref{fig:results_real_textures}. ST-DNN outperforms all other descriptors. ST-DNN has $\mathbf{8900}$ parameters and is trained with only $\mathbf{128}$ training images of real world texture dataset. ST-DNN is around 3 orders of magnitude smaller than standard deep networks and takes around 2 orders of magnitude less training data (e.g., FCN-ResNet101-all-ours uses 50,000 images plus augmented data and has 45 million parameters), but still outperforms these networks (see Figure~\ref{fig:motivation}). \def.11\linewidth{.4\linewidth} \def.11\linewidth{.2\linewidth} \begin{figure} \centering \scriptsize \begin{tabular}{c} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/train.png}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/params.png}} \end{tabular} \caption{\sl ST-DNN is smaller in size and uses fewer training images compared with SOTA DNNs.} \label{fig:motivation} \end{figure} \textbf{Comparison to Texture Segmentation Methods on Real-World \& Brodatz Synthetic Texture Datasets:} We compare to state-of-the-art texture segmentation methods: edge-based (gPb, MCG, Kok, CB) \cite{arbelaez2011contour,arbelaez2014multiscale,isola2014crisp,Kokkinos2015}) and region based (STLD \cite{Khan2015} and Siamese \cite{Khan2018a}). STLD is a shape-tailored (but hand crafted) approach using PDEs, and non-STLD uses the same PDE as STLD but on the whole image so is not shape-tailored. Siamese uses a neural network on the channel dimension returned by STLD, but does not layer PDE solutions as our approach. Quantitative results for both texture datasets are in Table~\ref{tab:results_texture_datasets} and a few qualitative samples of the results are in Figure~\ref{fig:results_real_textures}. Our method out-performs all others by significant margins on all regions metrics and achieves close to the best result on the contour metric on RWTSD, while on the Synthetic Brodatz, our method out performs all methods on all metrics. More visual results and comparison to more methods is in Appendix~\ref{sec:AddResults_supp}. \begin{SCtable}[][h] \centering {\scriptsize \begin{tabular}{l|c|c|c|c} &Contour& \multicolumn{3}{c}{Region metrics} \\\hline &F-meas. & GT-cov. & Rand.~Index & Var.~Info. \\\hline ST-DNN (ours) & {\bf 0.63} & {\bf 0.94} & {\bf 0.94 } & {\bf 0.35} \\ resnet101-d-ce & 0.39 & 0.84 & 0.75 & 0.70 \\ resnet-d-ours & 0.39 & 0.83 & 0.76 & 0.74 \\ resnet101-all-ce & 0.04 &0.79 & 0.55 & 1.39 \\ resnet101-all-ours & 0.48 &0.83 & 0.87 & 0.50 \\ resnet101-TD-ours& 0.17 & 0.83 & 0.66 & 0.94 \\ resnet101-TD-ce& 0.11 & 0.80 & 0.63 & 1.35 \\ deeplabv3-all-ce & 0.42 & 0.86 & 0.85 & 0.66 \\ deeplabv3-all-ours & 0.42 & 0.85 & 0.76 & 0.67 \\ HED\cite{HED2015} & 0.04 & 0.53 & 0.60 & 1.69 \end{tabular} } \caption{{\bf Results on Real-World Segmentation Datasets of Deep Networks}. Algorithms are evaluated on contour/ region metrics. Higher F-measure for the contour metric, ground truth covering (GT-cov), and rand index indicate better fit, and lower variation of information (Var.~Info) indicates a better fit to ground truth.} \label{tab:results_Net} \end{SCtable} \def.11\linewidth{.11\linewidth} \def.11\linewidth{.07\linewidth} \begin{figure} \centering \scriptsize \begin{tabular}{c|c} \vspace{1pt} images& \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/22_figure_Color-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/221_figure_Color-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/244_figure_Color-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/128_figure_Color-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/85_figure_Color-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/337_figure_Color-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/178_figure_Color-eps-converted-to}}\\[-\dp\strutbox] \vspace{1pt} ground truth & \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/22_gt-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/221_gt-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/244_gt-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/128_gt-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/85_gt-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/337_gt-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/178_gt-eps-converted-to}}\\[-\dp\strutbox] \vspace{1pt} STLD & \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/22_RBSD-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/221_RBSD-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/244_RBSD-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/128_RBSD-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/85_RBSD-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/337_RBSD-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/178_RBSD-eps-converted-to}}\\[-\dp\strutbox] resnet101-d-ce & \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/55}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/56}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/61}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/11}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/248}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/119}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/24}}\\[-\dp\strutbox] \vspace{1pt} resnet101-all-ours& \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/55a}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/56a}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/61a}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/11a}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/248a}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/119a}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/24a}}\\[-\dp\strutbox] \vspace{1pt} deeplabv3-all-ours& \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/55b}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/56b}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/61b}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/11b}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/248b}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/119b}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/24b}}\\[-\dp\strutbox] ST-DNN & \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/22_Net-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/221_Net-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/244_Net-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/128_Net-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/85_Net-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/337_Net-eps-converted-to}} \includegraphics[width=.11\linewidth,height=.11\linewidth]{{Figures/178_Net-eps-converted-to}}\\[-\dp\strutbox] \vspace{-0.5cm} \end{tabular} \caption{\sl {\bf Sample representative results on Real-World Texture Dataset}. We compare the ST-DNNs (ours), STLD, and deep learning based methods.} \label{fig:results_real_textures} \end{figure} \begin{table} {\scriptsize \begin{tabular}{l@{}|c@{\hspace{1em}}|c@{\hspace{1em}}cc@{\hspace{1em}}cc@{\hspace{1em}}cc} \multicolumn{5}{c}{\bf Real-World Texture Dataset}\\\hline & {Contour} & \multicolumn{3}{c}{Region metrics} \\\hline & {F-meas.} & {GT-cov.} & {Rand.~Index} & {Var.~Info.} \\ \hline ST-DNN (ours) & 0.64 & {\bf 0.94} & {\bf 0.94 } & {\bf 0.35} \\ Siamese & 0.65 & 0.92 & 0.92 & 0.43 \\ STLD & 0.58 & 0.86 & 0.88 & 0.63 \\ mcg & 0.54 & 0.82 & 0.85 & 0.66 \\ Kok.& 0.64 &0.56 & 0.57 & 0.92 \\ non-STLD & 0.20 & 0.83 & 0.84 & 0.79 \end{tabular} \vline \vspace{1em} \vline \begin{tabular}{l@{}|c@{\hspace{1em}}|c@{\hspace{1em}}cc@{\hspace{1em}}cc@{\hspace{1em}}cc} \multicolumn{5}{c}{\bf Synthetic Brodatz Texture Dataset}\\\hline & {Contour} & \multicolumn{3}{c}{Region metrics} \\\hline & {F-meas.} &{GT-cov.} & {Rand.~Index} & {Var.~Info.} \\\hline ST-DNN (ours) & {\bf 0.49} & {\bf 0.92} & {\bf 0.92 } & {\bf 0.44} \\ Siamese & 0.45& 0.90 & 0.89 & 0.46 \\ STLD& 0.41 & 0.87 & 0.86 & 0.53 \\ gPb & 0.40 &0.81 & 0.82 & 0.75 \\ CB & 0.30 & 0.77 & 0.79 & 1.09 \\ non-STLD & 0.18 & 0.84 & 0.84 & 0.65 \end{tabular}% \caption{{\bf Results on Real-World Segmentation Dataset (left) and Synthetic Dataset (right)}. Comparisons are performed against CB \cite{isola2014crisp}, gPb \cite{arbelaez2011contour}, Siamese \cite{Khan2018a}, Kok.\cite{Kokkinos2015}, mcg \cite{arbelaez2014multiscale}. See Table ~\ref{tab:results_Net} caption for details on the measures. Additional results in Appendix \ref{sec:AddResults_supp}} \label{tab:results_texture_datasets} } \end{table} \textbf{Comparison on Multi-Region Segmentation:} We have also tested our method on two multi-region segmentation datasets, 1) BSDS500 2) Synthetic Texture dataset. For BSDS500 dataset we train our methods and state of the art deep networks on the training + validation set (200+100 images augmented with with 8 rotations and 5 scales) and test on the test-set on BSDS dataset (200 images). Results are summarized in Table \ref{tab:results_mul_region} and a few quantitative samples are show in figure \ref{fig:results_mul_region2} in Appendix \ref{sec:AddResults_supp}. BSDS500 is not the best dataset for training on region segmentation as the regions are not marked based on appearance and instead watershed is used on edge maps to generate segments. Hence region with similar looking appearance are often marked as separate regions in images. Despite this drawback ST-DNN performs on par or better than state of the art Deep Neural Networks. During training all images are resized to 256 $\times$ 256 and normalised to have zero mean and unit variance. In post-processing, the outputs are clustered into 20 regions and then regions with less than 2\% pixels of the entire image are smoothed out using conditional random fields, we use pydensecrf \footnote{https://github.com/lucasb-eyer/pydensecrf} library. Following which we run 20 iterations of ~\ref{alg:multilabel_scheme_supp} . For quantitative comparisons we have provided analyses on region metrics on BSDS500 benchmark. We have also tested on a large scale multi-region synthetic texture segmentation dataset \footnote{https://github.com/MMFa666/Segmentation\_dataset}. This dataset is designed as an extension of \cite{Khan2015}, we have a maximum of 4 regions per image comprising of different appearance textures. The dataset consists of 42000 training images, 3000 validation images and 5000 test images. The images are generated from 1084 textures collected from Brodatz dataset. Our methods is trained on only 200 images from the dataset, other methods are trained on the entire training set. Our method outperforms state of the art deep learning based methods by a healthy margin despite being significantly smaller in number of parameters and training data required for training. Similar to BSDS500 dataset we resize images to 256 $\times$ 256 and normalise them to have zero mean and unit variance. In post-processing we simply cluster the image into 4 regions and run 20 iterations of ~\ref{alg:multilabel_scheme_supp} . For quantitative comparison we have provided analyses on region accuracy metric provided with the dataset, motivated from PascalVOC class accuracy metric. \begin{table} {\centering {\scriptsize \begin{tabular}{l@{}|c@{\hspace{1em}}cc@{\hspace{1em}}cc@{\hspace{1em}}cc} \multicolumn{4}{c}{\bf BSDS}\\\hline & \multicolumn{3}{c}{Region metrics} \\\hline & {GT-cov.} & {Rand.~Index} & {Var.~Info.} \\ \hline Deeplab-V3 & \textbf{0.39} & 0.72 & 1.88 \\ FCN-Resnet & 0.38 & 0.71 & 1.98 \\ ST-DNN(ours) &\textbf{ 0.39} & \textbf{0.73} & \textbf{1.80} \\ \end{tabular} \vline \vspace{1em} \vline \begin{tabular}{l@{}|c@{\hspace{1em}}} \multicolumn{2}{c}{\bf Synthetic Multi-Region Texture Dataset}\\\hline & {Region Metric} \\\hline & {Avg. Accuracy} \\\hline Deeplab-v3 & 0.41 \\ FCN-resnet101 & 0.43 \\ ST-DNN (ours)& \textbf{0.45} \\ \end{tabular}% \caption{{\bf Results on BSDS500 (left) and Synthetic multi-region Dataset (right)}. Comparisons are performed against state-of-the-art deep learning based methods. See Table ~\ref{tab:results_Net} caption for details on the measures}. \label{tab:results_mul_region} } } \end{table} \section{Conclusion} We have introduced ST-DNNs, which generalize CNNs to arbitrary shaped regions by stacking layers that solve PDEs. These are relevant to segmentation since they avoid aggregation of data across segmentation regions. They are also covariant to translations and rotations, and robust to deformations. Experiments showed that ST-DNNs achieve state-of-the-art results on texture segmentation benchmarks: they outperform state-of-the-art deep networks by 20\% on edge metrics and 10\% on region metrics while being \textbf{3} orders of magnitude smaller and using \textbf{2} orders of magnitude less training data. Experiments also validated covariance and robustness of ST-DNNs. To show the strength of the formulation we have tested it on four datasets, which include binary and multi-region segmentation datasets. {\small \bibliographystyle{iclr2021_conference}
\section{Introduction} Presidential primary elections are a critical part of the United States electoral process, since they are used to select the final candidates contesting the Presidential election for each of the major parties. For that reason it is important that the result of these primaries be trustworthy. While the method used for primary elections differs by party and state, the majority of such elections use delegate allocation by proportional representation, the so-called Hamilton method, named after its inventor, Alexander Hamilton. Risk-limiting audits (RLAs)~\cite{stark2008conservative} require a durable, trustworthy record of the votes, typically paper ballots marked by hand, kept demonstrably secure. RLAs end in one of two ways: either they produce strong evidence that the reported winners really won, or they result in a full manual tabulation of the paper records. If a RLA leads to a full manual tabulation, the outcome of the tabulation replaces the original reported outcome if they differ, thus correcting the reported outcome (if the paper trail is trustworthy). The probability that a RLA fails to correct a reported outcome that is incorrect before that outcome becomes official is bounded by a ``risk limit.'' An RLA with a risk limit of 1\%, for example, has at most a 1\% chance of failing to correct a reported election outcome that is wrong; equivalently, it has at least a 99\% chance of correcting the reported outcome if it is wrong. RLAs are becoming the de-facto standard for post-election audits. They are required by statute in Colorado, Nevada, Rhode Island, and Virginia,\footnote{Virginia's audit does not take place until after the outcome is certified, so it cannot limit the risk that an incorrect reported outcome will become final: technically, it is not a RLA.} for some government elections (not primaries which are party elections), and have been piloted in over a dozen US states and Denmark. They are recommended by the US National Academies of Science, Engineering, and Medicine and endorsed by the American Statistical Association. Risk-limiting audits of limited scope have begun to be applied to US primary elections; our methods here would allow RLAs of the full elections. In this paper we describe the first method that we are aware of for conducting an RLA for delegate allocation by proportional representation elections, which we call \emph{Hamiltonian elections}. In addition to primary elections in some states in the USA, this type of election is used in Russia, Ukraine, Tunisia, Taiwan, Namibia and Hong Kong. We do so by adapting auditing methods designed for plurality and instant runoff voting (IRV) elections for auditing the viability of candidates, and generating a new kind of audit for proportional allocation. A delegate allocation election by proportional representation is a complex form of election. Rather than simply electing candidates, the result of the election is to assign some number of delegates to some of the candidates. In the first stage of the election, the process determines the subset of candidates that are eligible or \textit{viable} (for Democratic primaries, candidates need to receive at least 15\% of the vote). In the second step, delegates are awarded to these viable candidates in approximate proportion to their vote. An RLA must determine the correctness of both the set of viable candidates and the number of delegates assigned to each viable candidate. The first stage of the election uses either simple plurality voting, where each ballot is a vote for at most one candidate, or IRV, where each ballot is a ranking of some or all candidates. In IRV, candidates with the fewest first-choice ranks are eliminated and each ballot that ranked them first is reassigned to the next most-preferred ranked candidate on that ballot. There is considerable work on both comparison audits and ballot-polling audits for plurality elections~\cite{lindemanStark12,shangrla}, but few for more complex election types. Sarwate {\it et al.}~\cite{sarwate2013risk} consider IRV and some other preferential elections. Kroll {\it et al.}~\cite{kroll2014} show how to audit the overall US electoral college outcome, but not the allocation of individual delegates. Stark and Teague~\cite{StarkTeague2014} devise audits for the D'Hondt method for proportional representation, which is related to but distinct from Hamiltonian methods. Blom {\it et al.}~\cite{blom18,blom16} describe efficient audits for IRV. As far as we know, there is no other auditing method for Hamiltonian Elections, nor any that combines a proportional representation method with IRV. \section{Hamiltonian Elections} \label{sec:democratic} We have a set of $n$ candidates $\mathcal{C}$, a set of cast ballots\footnote{We do not distinguish between ballots and ballot cards; in general, ballots consist of one or more cards, of which at most one contains any given contest.} $\mathcal{B}$, and a number of delegates $D$ to be awarded to the candidates based on the votes. The \emph{Hamilton} or \emph{largest remainder} method, invented by Alexander Hamilton in 1792, allocates the delegates in approximate proportion to the votes the candidates received. In a \emph{pure Hamiltonian election}, also known as the \emph{Hamilton method}, delegates are directly allocated based on the proportion of the vote. But most delegate elections use some form of \emph{exclusion} of some candidates before the delegates are apportioned. A \emph{Hamiltonian election with exclusion} first determines which candidates in $\mathcal{C}$ are \textit{viable}---eligible to be awarded one or more delegates. Typically, exclusion involves a plurality vote. Each ballot is a vote for at most one candidate. If a candidate receives a threshold proportion $\ensuremath{\tau}$ of the valid votes, the candidate is considered viable.\footnote{There are more complicated alternate rules for the case where no candidate reaches $\ensuremath{\tau}$; we do not consider this case here.} The votes cast for viable candidates are referred to as \textit{qualified votes}. The qualified votes are used to allocate delegates, as described later in this section. \begin{example}\label{ex:plural} Consider an example Hamiltonian election with exclusion with 4~candidates, Ann, Bob, Cal, and Dee and a viability threshold of $\ensuremath{\tau} = 15\%$. Figure~\ref{fig:plural}(a) shows the tally of votes for each candidate, and the percentage of the overall vote that each candidate received. Ann and Bob received more than 15\% of the vote and are viable candidates. \begin{figure*}[t] \centering \begin{tabular}{c@{~~~}c} \begin{tabular}{|l|rr|} \hline Candidate & Votes & Proportion \\ \hline Ann & 57,532 & 76.1\% \\ Bob & 15,630 & 20.6\% \\ Cal & 1,600 & 2.1\% \\ Dee & 846 & 1.1\% \\ \hline Total Votes & \bf 75,608 & \bf 100.0\% \\ \hline \end{tabular} & \begin{tabular}{|l|rr|} \hline Candidate & Votes & Proportion \\ \hline Ann & 57,532 & 78.6\% \\ Bob & 15,630 & 21.4\% \\ \hline Qualified Votes & \bf 73,162 & \bf 100.0\% \\ \hline \end{tabular} \\ (a) & (b) \end{tabular} \caption{(a) Votes and (b) Qualified Votes in a Hamiltonian election with plurality-based exclusion.\label{fig:plural}} \end{figure*} \end{example} For elections with many candidates, a plurality exclusion might eliminate all of them. In an \emph{instant-runoff Hamiltonian election} the viable candidates are determined by a form of IRV. Each ballot is now a partial ranking of the candidates, and the viable candidates are determined as follows: \begin{enumerate} \item Initialize the set of candidates. Each ballot is put in the pile for the candidate ranked highest on that ballot. \item If every (remaining) candidate has $\geqslant \ensuremath{\tau}$ of the votes in their pile, we finish the candidate selection process. All of these remaining candidates are viable. \item Otherwise, the candidate with the lowest tally (fewest ballots in their pile) is eliminated, and each of their ballots is moved to the pile of the next ranked remaining candidate on the ballot. A ballot is \emph{exhausted} if all further candidates mentioned on the ballot have already been eliminated. \item We then return to step~2. \end{enumerate} \begin{example}\label{ex:irv} Consider an instant-runoff Hamiltonian election with the same four candidates as Example~\ref{ex:plural}, the same threshold, and 50,000 ballots with ranking [A,D,C,B] (that is, Ann followed by Dee, then Cal, then Bob), 9,630 of [B,C], 6,000 of [C,B], 1,600 of [C], 7,532 of [D,A,C], and 846 of [D,C]. The IRV election proceeds as follows. In the first round Cal has the lowest tally, 7,600 votes, which is 10.052\% of the total vote, and hence less than 15\%. Cal is eliminated: the 6,000 ballots [C,B] are transferred to Bob, and the 1,600 ballots [C] are exhausted (removed from consideration). In the next round Dee has the lowest tally, 8,378 votes which is 11.080\%, so Dee is eliminated. The 7,632 [D,A,C] ballots are transferred to Ann, and the remaining 836 [D,C] ballots are exhausted. In the final round, Bob has the lowest tally, 20.672\% of the vote, and the process ends since this is greater than 15\%. The election is summarized in Figure~\ref{fig:irv}. \begin{figure*} \begin{tabular}{|l|rrr|rrr|rrr|} \hline & \multicolumn{3}{c|}{Round 1} & \multicolumn{3}{c|}{Round 2} & \multicolumn{3}{c|}{Final Result} \\ Cand. & Ballot & Number & Prop. & Ballot & Number & Prop. & Ballot & Number & Prop. \\ \hline Ann & [\textbf{A},D,C,B] & 50,000 & 66.1\% & [\textbf{A},D,C,B] & 50,000 & 66.1\% & [\textbf{A},D,C,B] & 50,000 & \\ & & & & & & & [D,\textbf{A},C] & 7,532 & 76.1\% \\ \hline Bob & [\textbf{B},C] & 9,630 & 12.7\% & [\textbf{B},C] & 9,630 & & [\textbf{B},C] & 9,630 & \\ & & & & [C,\textbf{B}] &6,000 & 20.7\% & [C,\textbf{B}] &6,000 & 20.7\% \\ \hline Cal & [\textbf{C},B] & 6,000 & & --- & && --- && \\ & [\textbf{C}] & 1,600 & 10.1\% & --- && ---& --- && --- \\ \hline Dee & [\textbf{D},A,C] &7,532 & & [\textbf{D},A,C] & 7,532 & & --- && \\ & [\textbf{D},C] & 846 & 11.1\% & [\textbf{D},C] & 846 & 11.1\% & --- && --- \\ \hline Total & & \bf 75,608 & 100.0\% && 73,738 & 98.6\% & & 73,162 & 96.8\% \\ \hline \end{tabular} \caption{IRV election for four candidates showing the elimination of first Cal, and then Dee, and the final round results.\label{fig:irv}} \end{figure*} \end{example} The second stage in the process is to assign delegates to candidates on the basis of their tallies. We first compute, for each viable candidate $c$, the proportion of the \textit{qualified votes} in their tally, $p_c$. Recall that we refer to ballots belonging to viable candidates as \textit{qualified} votes. We denote the number of qualified votes as $Q$. In the context of IRV, ballots are qualified if they end up in the tally of a viable candidate. Non-qualified ballots result from exhaustion: every candidate in the ballot ranking has been eliminated (is non-viable). Where a plurality contest determines viability, all votes for a viable candidate are qualified. We denote the set of viable candidates as $\mathcal{V}$. Delegates are awarded to viable candidates as follows: \begin{enumerate} \item We compute for each viable candidate $c$ their \textit{delegate quota}, $q_c = D \times p_c$ where $p_c$ is the proportion of the qualified vote given to $c$ (their final tally divided by $Q$). \item We assign $i_c = \lfloor q_c \rfloor$ delegates to each candidate $c \in \mathcal{V}$. \item At this stage, there are $r = D - \sum_{c \in \mathcal{V}} i_c$ remaining delegates to assign. We assign these delegates to the $r$ candidates with the largest value of the remainder $q_c - i_c$. One delegate is given to each of these $r$ candidates. \item At this stage, each viable candidate $c$ has received $a_c$ total delegates, where $a_c$ is $q_c$ rounded either up or down. \end{enumerate} \begin{example}\label{ex:del} The end result of Examples~\ref{ex:plural} and~\ref{ex:irv} is the same. The qualified vote is $Q = 73,162$. The proportions of the qualified vote in viable candidates' tallies are: $p_{Ann} = 0.786$; and $p_{Bob} = 0.214$. Assuming there are $D = 5$ delegates to allocate, we find $q_{Ann} = 3.932$ and $q_{Bob} = 1.068$. We initially allocate 3 delegates to Ann and 1 to Bob. By comparing the remainders $0.932$ and $0.068$, we allocate the last delegate to Ann. So $a_{Ann} = 4$ and $a_{Bob} = 1$. \end{example} \section{Auditing Fundamentals} \label{sec:fund} A risk-limiting audit is a statistical test of the hypothesis that the reported outcome is incorrect. (In the current context, the reported outcome is the number of delegates finally awarded to each candidate.) If that hypothesis is not rejected, there is a full hand tabulation, which reveals the true outcome. If that differs from the reported outcome, it replaces the reported outcome. The significance level of the test is called the \emph{risk limit}. A risk-limiting audit of a trustworthy paper trail of votes limits the risk that an incorrect electoral outcome will go uncorrected. Two common building blocks for audits are to compare manual interpretation of randomly selected ballots or groups of ballots with how the voting system interpreted them (a \emph{comparison} audit~\cite{stark10}), and to use only the manual interpretation of the randomly selected ballots (a \emph{ballot-polling} audit~\cite{lindemanEtal12}). Ballot polling requires less infrastructure (some voting systems do not generate or cannot export the data required for a comparison audit) but generally requires inspecting more ballots. Recent work \cite{shangrla} shows that audits of most social choice functions can be reduced to checking a set of \emph{assertions}. If all the assertions are true, the reported election outcome is correct. Each assertion is checked by conducting a hypothesis test of its logical negation. To reject the hypothesis that the negation is true is to conclude that the assertion is true. Each hypothesis is tested using a statistic calculated from the audit data. Larger values of the statistic are unlikely if the corresponding assertion is false. If the statistic takes a sufficiently large value, that is statistical evidence that the assertion is true, because such a large value would be very unlikely if the assertion were false. The statistic is generally calibrated to give \emph{sequentially valid} tests of the assertions, meaning that the sample of ballots can be expanded at will and the statistic can be recomputed from the expanded sample, while controlling the probability of erroneously concluding that the assertion is true if the assertion is in fact false. The initial sample size is generally chosen so that there is a reasonable chance that the audit will terminate without examining additional ballots if the reported results are approximately correct. If the initial sample does not give sufficiently strong evidence that all the assertions are correct, the sample is augmented and the condition is checked again.\footnote{For sequentially valid test statistics, the sample can be augmented at will; for other methods, there may be an escalation schedule prescribing a sequence of sample sizes before conducting a full manual tabulation.} The sample continues to expand until either all the assertions have been confirmed\footnote{In other words, the hypothesis that the assertion is false has been rejected at a sufficiently small significance level.} or the sample contains every ballot, and the correct result is therefore known. At any point during the audit, the auditor can choose to conduct a full manual tabulation. If the audit leads to a full manual tabulation, the outcome of that tabulation replaces the reported outcome if they differ. The basic assertions for Hamiltonian elections are: \begin{description} \item[(Super/sub) majority $p > t$,] where $p$ is the proportion of ballots that satisfy some condition (usually the condition is that the ballot has a vote for a particular candidate) among ballots that meet some validity condition, and $t$ is a proportion in $(0,1]$. \item[Pairwise majority $p_A > p_B$,] where $p_A$ and $p_B$ are the proportions of ballots that meet two mutually exclusive conditions $A$ and $B$, among ballots that meet some validity condition. (Typically, among the ballots that contain a valid vote, $A$ is a ballot with a vote for one candidate, and $B$ is a ballot with a vote for a different candidate). \item[Pairwise difference $p_A > p_B + d$,] where $p_A$ and $p_B$ are the proportions of ballots that meet two mutually exclusive conditions among ballots that meet some validity condition, and $d$ is a constant in the range $(-1,1)$. This is a new form of assertion not previously used, that extends pairwise majority assertions. It is necessary for auditing delegate assignment in Hamiltonian elections. \end{description} In the SHANGRLA approach to RLAs \cite{shangrla}, each assertion is transformed into a canonical form: the mean of an \emph{assorter} (which assigns each ballot a nonnegative, bounded number) is greater than 1/2. The value the assorter assigns to a ballot is generally a function of the votes on that ballot and others and the voting system's interpretation of the votes on that ballot and others. For majority assertions, a ballot that satisfies the condition is assigned the value $1/(2t)$; a valid ballot that does not satisfy the condition is assigned the value 0; and an invalid ballot is assigned the value 1/2. For pairwise majority assertions, a ballot for class A counts as 1 and a ballot for class B counts as 0. Ballots that fall outside both classes count as 1/2. \ignore{ We now construct an assorter for pairwise differences. Define $$ f(b) \equiv \left \{ \begin{array}{ll} 1-d/2, & \mbox{vote for A} \\ -d/2, & \mbox{vote for B} \\ 1/2-d/2, & \mbox{valid vote in contest but not for A Nor B} \\ 1/2, & \mbox{no valid vote in contest} \end{array} \right . $$ $$ \bar{f} = \frac{n p_A (1-d/2) + n p_B (-d/2) + n (1-p_A-p_B)(1/2-d/2) + (N-n)(1/2)} {N} $$ $$ = \frac{n(p_A/2-p_B/2-d/2) + N/2}{N} $$ $$ = \frac{n}{2N}(p_A-p_B-d) + 1/2. $$ This is greater than 1/2 iff $p_A > p_B + d$, but its minimum is $-d / 2$, not $0$, so make the affine transformation $$ g \equiv \frac{f + d / 2}{1 + d}. $$ } For pairwise difference assertions, we define the assorter $g$ which assigns ballot $b$ the value: $$ g(b) \equiv \left \{ \begin{array}{ll} 1/(1 + d), & \mbox{$b$ has a vote of class A} \\ 0, & \mbox{$b$ has a vote of class B} \\ 1/(2(1 + d)), & \mbox{$b$ has a valid vote in the contest that is not in A or B} \\ 1/2, & \mbox{$b$ does not have a valid vote in the contest.} \end{array} \right . $$ Let $\bar{g}$ be the mean of $g$ over the ballots. We have that $0 \leqslant g(b) \leqslant 1/(1+d)$, and $\bar{g} > 1/2$ iff $p_A > p_B + d$. When $d = 0$ this reduces to the pairwise majority assorter if the ``valid'' category is the same. The \emph{margin} $m$ of an assertion $a$ is equal to 2 times the mean of its assorter (when applied to all ballots $\mathcal{B}$) minus 1. An assertion with a smaller margin will be harder to audit than an assertion with a larger margin. \subsection{Estimating Sample Size and Risk} The sample size required to confirm an assertion depends on the sampling design and the auditing strategy (e.g., sampling individual ballots or batches of ballots, using ballot polling or comparison); the ``risk-measuring function'' (see \cite{shangrla}); and the accuracy of the tally, among other things. Because it depends on what the sample reveals, it is random. There is some flexibility in selecting a set of assertions to confirm IRV contests \cite{evote2018b}, so the set can be chosen to minimize a measure of the anticipated workload. We will estimate the workload on the assumption that the assertion is true but the reported tallies are not exactly correct. We will use the expected sample size as a measure of workload.\footnote{One might instead seek to minimize a quantile of the sample size or some other function of the distribution of sample size, for instance, to account for fixed costs for retrieving and opening a batch of ballots and per-ballot and per-contest costs.} Our auditing approach is applicable to any style of auditing. The workload, given a set of assertions, varies depending on the style of audit (e.g., ballot-level comparison, batch-level comparison, ballot-polling, or a combination of those) and the sampling design (e.g., with or without replacement, Bernoulli, stratified or not, weighted or not). For the purpose of illustration, in the examples and experiments in this paper, we assume that the audit will be a ballot-level comparison audit using sampling with replacement. Because the sample is drawn with replacement, the same ballot can be drawn more than once. Given an assertion $a$, let $ASN(a,\alpha)$ denote the expected number of draws required to verify $a$ to risk limit $\alpha$, and if $\mathcal{A}$ is a set of assertions, let $ASN(\mathcal{A},\alpha)$ denote the expected number of draws required to verify every assertion $a$ in $\mathcal{A}$ to risk limit $\alpha$. $ASN$ depends on several factors: the risk limit $\alpha$; the expected rate of errors (discrepancies) between paper ballots and their electronic records of various signs and magnitudes (in the context of comparison auditing); and the margins of the assertions. We estimate $ASN(\mathcal{A}, \alpha)$ by simulation. We simulate the sampling of ballots, one at a time.\footnote{The procedure used to calculate the $ASN$ for an assertion with margin $m$ is available in the public repositories \url{https://github.com/michelleblom/primaries} and \url{https://github.com/pbstark/SHANGRLA}.} An ``overstatement'' error is introduced with a pre-specified probability $e$. If the sample reveals one or more overstatements, the measured risk (i.e., the $P$-value of the hypothesis that the assertion is false) increases by an amount that depends on margin $m$. Otherwise, the measured risk decreases by an amount that depends on $m$. We continue to sample ballots until the measured risk falls below $\alpha$ or until every ballot has been manually reviewed, in which case the outcome based on the manual interpretations replaces the original reported results. We take the median of the number of ballots sampled over $N$ simulations as an estimate of $ASN(\mathcal{A}, \alpha)$. Inaccuracy of this estimate affects whether the selected assertions result in the smallest expected workload, but does not affect the risk limit. For the examples and experiments in this paper, we use $e = 0.002$ (equivalent to 2 errors per 1,000 ballots), $N = 20$, and a risk limit of 5\%. \ignore{ For the types of assertions listed above, for an unstratified sample of individual ballots, and on the assumption that the sample size remains a small fraction of the total number of ballots, the $ASN$ scales like the reciprocal of the ``assorter margin'' for ballot-level comparison audits and like the square of the reciprocal of the ``assorter margin'' for ballot-polling audits. } \section{Auditing Viability} \label{sec:eligible} The first stage of the election identifies the viable candidates. We introduce notation for the assertions we will use to audit viability, as follows: \begin{itemize} \item $\mbox{\emph{Viable}}(c, E, t)$: Candidate $c$ has at least proportion $t$ of the vote after the candidates in set $E$ have been eliminated. This amounts to a simple majority assertion $p_c > t$ after candidates in $E$ are eliminated. \item $\mbox{\emph{NonViable}}(c, E, t)$: Candidate $c$ has less than proportion $t$ of the vote after candidates $E$ have been eliminated. This amounts to a simple majority assertion $\bar{p}_c > 1-t$ where $\bar{p}_c$ is the proportion of valid votes for candidates other than $c$ after candidates $E$ are eliminated. \item $\mbox{\emph{IRV}}(c, c', E)$: Candidate $c$ has more votes than candidate $c'$ after candidates $E$ have been eliminated. This amounts to a pairwise majority assertion. \end{itemize} If the first stage is a plurality vote, $E \equiv \emptyset$: the elimination in the first stage only occurs for $\mbox{\emph{IRV}}$. Consider an election $\mathcal{E} = \langle \mathcal{C}, \mathcal{B}, \ensuremath{\tau} \rangle$ with candidates $\mathcal{C}$, cast ballots $\mathcal{B}$, and viability threshold $\ensuremath{\tau}$ ($\ensuremath{\tau} = 0.15$ for the primary elections we will examine). The outcome of this election is a set of viable candidates, $\mathcal{V} \subseteq \mathcal{C}$, together with, in the case of instant runoff Hamiltonian elections, a sequence of eliminated candidates, $\pi$. To check that the set of candidates reported to be viable really are the viable candidates, we test assertions that rule out all all other possibilities. Consider the subset $\mathcal{V}' \subseteq \mathcal{C}$, where $\mathcal{V}' \neq \mathcal{V}$. We can demonstrate that $\mathcal{V}'$ is not the true set of viable candidates by showing that some candidate $c \in \mathcal{V}'$ does not belong there. \ignore{-- i.e., they do not have at least $\ensuremath{\tau}$\% of the vote when all candidates not in $\mathcal{V}'$ have been eliminated. } We can also rule out $\mathcal{V}'$ as an outcome by showing that there is a candidate $c \notin \mathcal{V}'$ that does in fact belong in the viable set. We aim to find the `least effort' set of assertions $\mathcal{A}$ that, if shown to hold in a risk-limiting audit, confirm that (i) each candidate in $\mathcal{V}$ is viable, and (ii) no candidate $c' \notin \mathcal{V}$ is viable. \subsection{Viability: Plurality Hamiltonian Elections} For each viable candidate $v \in \mathcal{V}$ we need to verify the assertion $\mbox{\emph{Viable}}(v,\emptyset,\ensuremath{\tau})$. For each non-viable candidate $n \in \mathcal{C}\setminus\mathcal{V}$ we need to verify the assertion $\mbox{\emph{NonViable}}(n,\emptyset,\ensuremath{\tau})$. Let $\mathcal{A}$ be the union of these two sets of assertions. Note that $\mathcal{A}$ rules out any other set of viable candidates $\mathcal{V}' \neq \mathcal{V}$. \begin{example} To audit the first stage of the election of Example~\ref{ex:plural}, we verify the assertions $\mathcal{A} = \{ \mbox{\emph{Viable}}(\text{Ann},\emptyset,0.15)$, $\mbox{\emph{Viable}}(\text{Bob},\emptyset,0.15)$, $\mbox{\emph{NonViable}}(\text{Cal},\emptyset,0.15)$, $\mbox{\emph{NonViable}}(\text{Dee},\emptyset,0.15)\}$. The margins associated with these assertions are 4.073, 0.378, 0.152, and 0.163, respectively. The expected number of ballots we need to compare to the corresponding cast vote records to audit these assertions, assuming an overstatement error rate of 0.002 and a risk limit of $\alpha = 5\%$, are, respectively 1, 17, 46, and 42. The overall ASN for the audit is 46 ballots. \end{example} \ignore{ Ann: 57532, share = 1/0.30, margin= 4.073 Bob: 15630, margin = 0.378 Cal: 1600, margin = 0.152 Dee: 846, margin = 0.163 Total: 75608 ex: 2446 } \subsection{Viability: Instant-Runoff Hamiltonian Elections} Efficient RLAs for IRV have been devised only recently \cite{evote2018b}. To audit the first stage of an IRV Hamiltonian election we must eliminate the possibility that a different set of candidates is viable. This means that we need to look at every other set of candidates, and propose an assertion that will show that set is not viable. In contrast to auditing a simple IRV election, where there are $|\mathcal{C}| - 1$ potential winners other than the reported winner, a Hamiltonian election typically has many more. Let $M = \lfloor 1/\ensuremath{\tau} \rfloor$ be the maximum possible number of viable candidates. The number of possible winner sets $O$ is $$ O \equiv \binom{|\mathcal{C}|}{M} + \binom{|\mathcal{C}|}{M-1} + \cdots + \binom{|\mathcal{C}|}{1}. $$ We can show that a subset of candidates $\mathcal{V}'$ is not the set of viable candidates in a number of ways: \begin{itemize} \item we could show that the tally of at least one $c \in \mathcal{V}'$ does not reach the required threshold assuming all candidates not mentioned in $\mathcal{V}'$ have been eliminated \item we could show that there is a candidate $c' \notin \mathcal{V}'$ that is viable on the basis of their first preferences, so any potential set of viable candidates must include $c'$ \item we could show that the unmentioned candidates could not have been eliminated in a sequence that would result in $\mathcal{V}'$. \end{itemize} \subsubsection{Reducing the set of subsets} While there are many possible alternate winner sets $\mathcal{V}'$, we can rule out many of these easily. We examine the assertions $\mbox{\emph{Viable}}(w, \emptyset, \ensuremath{\tau})$ for any candidate $w \in \mathcal{C}$ who had more than the proportion $\ensuremath{\tau}$ of the vote initially. This assertion will be easy to verify, as long as the proportion is not too close to $\ensuremath{\tau}$. This assertion rules out any subset $\mathcal{V}'$ where $w \not \in \mathcal{V}'$. Let $\mathcal{W}$ be the set of candidates where this assertion is expected to hold. Next we examine the assertions $\mbox{\emph{NonViable}}(l, \mathcal{C} \setminus \mathcal{W} \setminus \{l\}, \ensuremath{\tau})$ for those candidates $l$ who are not mentioned in at least $\ensuremath{\tau}$ of the ballots, when all but the definite winners $\mathcal{W}$ and $l$ are eliminated. In this case candidate $l$ can never reach $\ensuremath{\tau}$ proportion of the votes. Again this assertion is easy to verify as long as the proportion of such votes is not close to $\ensuremath{\tau}$. This assertion removes any subset $\mathcal{V}'$ where $l \in \mathcal{V}'$. Let $\mathcal{L}$ be the set of candidates where this assertion is expected to hold. We collect together $\mathcal{A} = \{ \mbox{\emph{Viable}}(w, \emptyset, \ensuremath{\tau}) \mid w \in \mathcal{W} \} \cup \{ \mbox{\emph{NonViable}}(l, \mathcal{C} \setminus \mathcal{W} \setminus \{l\}, \ensuremath{\tau}) \mid l \in \mathcal{L}\}$. If these assertions hold, we only need to consider subsets of viable candidates $\textbf{V} = \{ \mathcal{V}' \subseteq \mathcal{C} \mid \mathcal{W} \subseteq \mathcal{V}', \mathcal{V}' \cap \mathcal{L} = \emptyset\} \setminus \{ \mathcal{V}\}$. There are only $|\textbf{V}|$ subsets to further examine, where $$ |\textbf{V}| = \binom{|\mathcal{C}\setminus \mathcal{W} \setminus \mathcal{L}|} {M - |\mathcal{W}|} + \cdots + \binom{|\mathcal{C}\setminus \mathcal{W} \setminus\mathcal{L}|}{1} - 1 $$ \subsubsection{Selecting assertions for the remaining subsets} We now need to select a set of assertions that rule out any alternate set of viable candidates $\mathcal{V}' \in \textbf{V}$. To form these assertions, we visualise the space of alternate election outcomes as a tree. We use a branch-and-bound algorithm to find a set of assertions that, if true, will prune (invalidate) all branches of this tree. At the top level of this tree is a node for each possible $\mathcal{V}' \in \textbf{V}$. Each node defines an (initially empty) sequence of candidate eliminations, $\pi$, and a set of viable candidates, $\mathcal{V}'$. These nodes form a frontier, $F$. Our algorithm maintains a lower bound $\text{LB}$ on the estimated auditing effort (EAE) required to invalidate all alternate election outcomes, initially setting $\text{LB} = 0$. For each node $n = (\emptyset, \mathcal{V}')$ in $F$, we consider the set of assertions that could invalidate the outcome that it represents. Two kinds of assertion are considered at this point: \begin{itemize} \item $\mbox{\emph{Viable}}(c', \mathcal{L}, t)$ for each candidate $c' \in \mathcal{C}$ that does not appear in $\mathcal{V}'$, and whose first preference tally exceeds $t$ proportion of the vote when only candidates in $\mathcal{L}$ are eliminated; \item $\mbox{\emph{NonViable}}(c, \mathcal{C}\setminus\mathcal{V}', t)$ for each candidate $c \in \mathcal{V}'$ whose tally, if all candidates $c'\in \mathcal{C}\setminus\mathcal{V}'$ have been eliminated, falls below $t$ proportion of the vote. \end{itemize} We assign to $n$ the assertion $a$ from this set with the smallest EAE (EAE[$n$] = $\mbox{\emph{ASN}}(\{a\},\alpha)$ where we use the method for estimating ASN previously described. If no such assertion can be formed for $n$, we give $n$ an EAE of $\infty$, EAE[$n$] = $\infty$. We then select the node in $F$ with the highest EAE to expand. To expand a node $n = (\pi, \mathcal{V}')$, we consider the set of candidates in $\mathcal{C}$ that do not currently appear in $\pi$ or $\mathcal{V}'$. We denote this set of `unmentioned' candidates, $\mathcal{U}$. For each candidate $c' \in \mathcal{U}$, we form a child of $n$ in which $c'$ is appended to the front of $\pi$. For instance, the node $([c'], \mathcal{V}')$ represents an outcome in which $c'$ is the last candidate to be eliminated, after which all remaining candidates, $c \in \mathcal{V}'$, have at least $t = T$ proportion of the cast votes. All unmentioned candidates are assumed to have been eliminated, in some order, before $c'$. For each newly created node, we look for an assertion that could invalidate the corresponding outcome. Two kinds of assertion are considered to rule out an outcome $n' = ([c'|\pi'], \mathcal{V}')$: \begin{itemize} \item $\mbox{\emph{Viable}}(c', \mathcal{U}\setminus\{c'\},t)$ for each candidate $c' \in U$ that has at least $t$ proportion of the vote in the context where candidates $\mathcal{U}\setminus\{c'\}$ have been eliminated. Candidate $c'$ thus cannot have been eliminated at this point; \item $\mbox{\emph{IRV}}(c', c, \mathcal{U}\setminus\{c'\})$ for each candidate $c' \in U$ that has a higher tally than some candidate $c \in \pi' \cup \mathcal{V}'$ in the context where candidates $\mathcal{U}\setminus\{c'\}$ have been eliminated. Candidate $c'$ thus cannot have been eliminated at this point. \end{itemize} We assign to each child of $n$ the assertion $a$ from this set with the smallest $ASN(\{a\},\alpha)$, and replace $n$ on our frontier with its children. If neither of the above two types of assertion can be created for a given child of $n$, the child is labelled with an EAE of $\infty$ (EAE[$n'$] = $\infty$). We continue to expand nodes in this fashion until we reach a leaf node, $l = (\pi, \mathcal{V}')$, where $\pi \cup \mathcal{V}' = \mathcal{C}$ (all candidates are mentioned either in the elimination sequence $\pi$ or in the viable set $\mathcal{V}'$). We assign to $l$ an invalidating assertion of the above two kinds, if possible. We consider all the nodes in the branch that $l$ sits on, and select the node $n_b$ associated with the least cost assertion $a$. We add $a$ to our set of assertions to audit $\mathcal{A}$, prune $n_b$ and all of its descendants from the tree, and update our lower bound on audit cost $\text{LB}$ to max($\text{LB}$, EAE[$a$]). We then look at all nodes on our frontier that can be pruned with an assertion that has an EAE $\leqslant \text{LB}$. We add those assertions to $\mathcal{A}$, and prune the nodes from the frontier. The algorithm stops when the frontier is empty. If we discover a branch whose best assertion has an EAE of $\infty$, the algorithm stops in failure---indicating that a full manual count of the election is required. This branch-and-bound algorithm is a variation of that described by \cite{evote2018b,RAIRE} for generating an audit specification for an IRV election. It has been altered for the context where the ultimate outcome is a set of winning candidates---the viable candidates---and not one winner, left standing after all others are eliminated. \section{Auditing Delegate Assignment} \label{sec:delegate} The Hamilton method for proportional representation is used to assign delegates to viable candidates. It might appear that auditing the Hamilton method requires checking some delicate results, for instance, whether candidate $A$ received at least 2 delegate quotas when candidate $A$ actually received 2.001 delegate quotas. However, this is not necessary, because candidate $A$ can receive 2 delegates without having at least 2 delegate quotas. For example, if $A$ receives 1.999 quotas $A$ may still end up with 2 delegates. Our auditing method avoids checking such things. The audit instead examines all pairs of viable candidates, including those receiving no delegates. For each pair of viable candidates $n$ and $m$ we check whether $(q_n - (a_n - 1)) < 1 + (q_m - (a_m - 1))$ which requires that the quota of $n$ is not 1 more than the quota for $m$, after removing all received delegates but the last. This can be equivalently rewritten as \begin{equation} p_m > p_n + \frac{a_m - a_n - 1}{D}, \quad n,m \in \mathcal{V}, n \neq m. \label{as:comp} \end{equation} In the case that $q_m$ was rounded up and $q_n$ was rounded down, this captures that the remainder for $m$ was greater than the remainder for $n$: $p_m D - (a_m - 1) > p_n D - a_n$. We show that if the delegates are wrong with respect to the true votes, then one of these assertions is violated. \begin{theorem} Suppose the number of assigned delegates $a_c$ to each viable delegate $c$ is incorrect, then one of the assertions of Equation~\ref{as:comp} will be violated. \end{theorem} \begin{proof} Suppose $a'_c$ is the \emph{true} number of delegates that should have been awarded to each candidate $c$. Since $\sum_{c \in \mathcal{V}} a_c$ $= D$ and $\sum_{c \in \mathcal{V}} a'_c = D$, and they differ, there must be at least one candidate $m \in \mathcal{V}$, where $a_m \geqslant a'_m + 1$, who was awarded too many delegates, and at least one $n \in \mathcal{V}$, where $a_n \leqslant a'_n - 1$, who was awarded too few. Since $a'_m$ is the true number of delegates awarded to $m$ we know that the (\emph{true}) proportion of the vote for $m$, $p_m$, must be (a) $p_m D < a'_m \leqslant a_m-1$ if $m$ was rounded up or (b) $p_mD < a'_m +1 \leqslant a_m$ if $m$ was rounded down. Similarly, since $a'_n$ is the true number of delegates awarded to $n$ we know that either (c) $p_n D \geqslant a'_n - 1 \geqslant a_n$ if $n$ was rounded up, or (d) $p_n D \geqslant a'_n \geqslant a_n + 1$ if $n$ was rounded down. If we add these two inequalities for combinations (a)+(c) or (b)+(d) we get $p_m D + a_n < p_nD + a_m - 1$. For the combination (a)+(d) we get $p_m D + a_n + 1 < p_n D + a_m- 1$. Any of these cause the assertion $p_m > p_n + \frac{a_m- a_n -1}{D}$ to be falsified. For the last case (b)+(c) we need a stricter comparison, which we obtain by comparing the remainders. Since $m$ was rounded down and $n$ was rounded up, we know that remainder for $m$ was less than the remainder for $n$, i.e., $p_m D - a'_m < p_n D - (a'_n - 1)$. Hence $p_m D < p_n D + a'_m - (a'_n - 1) \leqslant p_n D + (a_m - 1) - a_n$. Again the assertion $p_m > p_n + \frac{a_m - a_n - 1}{D}$ is falsified. \qed \end{proof} \begin{example} Consider the delegate allocation of Example~\ref{ex:del}. Recall that the proportions of the qualified vote are $p_{\text{Ann}} = 0.7836$ and $p_{\text{Bob}} = 0.2136$. We audit that $p_{\text{Ann}} < p_{\text{Bob}} + 4/5$ and $p_\text{Bob} < p_{\text{Ann}} - 2/5$. These facts require much less work to prove, than for example auditing that $p_\text{Bob} > 1/5$. The margins associated with the above pairwise difference assertions are 1.1 and 0.12, respectively. Assuming an error rate of 0.002, and a risk limit of $\alpha = 5\%$, the ASNs associated with these assertions are 5, and 59, ballots. \end{example} \section{Experiments} \label{sec:exp} We consider the set of Hamiltonian elections conducted as part of the selection process for the 2020 Democratic National Convention (DNC) presidential nominee. Most of these primaries determine candidate viability via a plurality vote. Several states, including Wyoming and Alaska, use IRV. We estimate the number of ballots we would need to check in a comparison audit of these primaries. For each of these primaries, we audit the viability of candidates on the basis of the statewide vote, and that each viable candidate deserved the delegates that were awarded to them. We consider only the delegates that are awarded on the basis of statewide vote totals (PLEO\footnote{Party Leaders and Elected Officials} and at-large) as these are readily available.\footnote{Data for plurality-based primaries was obtained from www.thegreenpapers.com/P20. Data for IRV-based primaries we consider was provided by the relevant state-level Democrats.} In each proportional DNC primary, viable candidates must attain at least 15\% of the total votes cast. The full code used to generate the assertions for each DNC primary, and estimate the ASN for each audit, is located at: \begin{center} \url{https://github.com/michelleblom/primaries} \end{center} Table \ref{tab:PluralityStates} reports the expected number of ballot samples required to perform three levels of audit in each plurality and IRV-based primary conducted for the 2020 DNC.\footnote{A small number of DNC 2020 primaries that did not use proportional allocation of delegates were not considered, in addition to those for which we could not obtain data.} Level~1 checks only that the reportedly viable candidates have at least 15\% of the vote, and all other candidates do not. Level~2 checks candidate viability and that each viable candidate $c$, with $a_c$ allocated delegates, deserved at least $a_c - 1$ of them. We introduce this level because, as the table shows, sometimes the complete auditing of the final delegate counts is difficult. Level~3 checks candidate viability and that each viable candidate deserved all of their allocated delegates. The assertions required to check the allocation of a candidate's final delegate are the hardest to audit. Of the primaries in Table \ref{tab:PluralityStates}, Maine (ME), New Hampshire (NH), Washington (WA), Texas (TX), Idaho (ID), Massachusetts (MA), California (CA), and Minnesota (MN), were considered to be close with differences of less than 10\% in the statewide vote between the two leading candidates. In Maine, the difference in the statewide vote for Biden and Sanders was less than 1\% of the cast vote. Auditing the Maine primary, however, is expected to require only a sample of 189 ballots. The Rhode Island (RI) primary, in contrast, requires a full manual recount. In RI, Sanders narrowly falls below the 15\% threshold with 14.93\% of the vote to Biden's 76.67\%. The margins that determine the complexity of these audits are the extent to which a candidates' vote falls below or exceeds the relevant threshold, and the relative size of the remainders in candidates' delegate quotas as a proportion of the number of delegates available. \begin{table*}[t] \centering \caption{Estimated sample size required to audit viability and delegate distribution (PLEO and at-large) in all proportional (plurality or IRV-based) DNC primaries in 2020 for which data was available. Levels 1, 2, and 3 audit candidate viability, that each viable candidate deserved almost all of their allocated delegates, and that they deserved all of their delegates, respectively. An error rate of 0.002 (an expectation of 1 error per 1,000 ballots) was used in the estimation of sample sizes. The symbol `--' indicates that a full recount is required. The number of candidates ($|\mathcal{C}|$) and total number of cast ballots ($|\mathcal{B}|$) is stated for each election.} \begin{tabular}{|c|r|r|r|r|r||c|r|r|r|r|r|} \multicolumn{12}{l}{Plurality-based Primaries} \\ \hline & & & \multicolumn{3}{c||}{ASN ($\alpha = $ 5\%)} & & & & \multicolumn{3}{c|}{ ASN ($\alpha = $ 5\%)} \\ \cline{4-6} \cline{10-12} State & $|\mathcal{C}|$ & $|\mathcal{B}|$ & Level 1 & Level 2 & Level 3 & State & $|\mathcal{C}|$ & $|\mathcal{B}|$ & Level 1 & Level 2 & Level 3 \\ \hline AL & 15& 452,093 & 182 & 182 & 1,352 & NC & 16& 1,332,382& 350& 350 &808 \\ AR & 18& 229,122 & 121 & 121 & 1,154 & NE & 4 & 164,582&925 & 925 & 925 \\ AZ & 12& 536,509 & 71 & 71 & 120 & NH & 34& 298,377 & 104& 104 & 155\\ CA & 21& 5,784,364 & 395 & 1,258 & 3,187,080 & NJ& 3 &958,202 &4,514 & 4,515 & 4,514\\ CO & 13& 960,128 & 42& 42 & -- & NM & 7 & 247,880 &1,812& 1,812 & 1,812\\ CT & 4& 260,750 & 174& 174 & 174 & NY & 11 & 752,515 & 56& 731 & 486,495\\ DC & 5& 110,688 & 334& 334& 334 & OH & 11 & 894,383& 61& 334 & -- \\ DE & 3& 91,682 & 80& 80 & 80 & OK & 14 & 304,281& 649& 649 & 649\\ FL & 16& 1,739,214 & 91& 208 & 766 & OR & 5 & 618,711& 111& 111 & 191\\ GA & 12& 1,086,729 & 107&218 & 218 & PA & 3 & 1,595,508& 48& 167 & 642 \\ ID & 14& 1,323,509 & 143& 143& 143 & PR & 11 & 7,022& 412 & 412 & 412 \\ IL & 12& 1,674,133 & 44& 140 & 620 & RI & 7& 103,982&-- & --& -- \\ IN & 9& 474,800 & 391& 391 & 391 & SC & 12 &539,263 & 165& 165 &34,546 \\ KY & 11& 537,905 & 209& 209 & 209 & SD & 2 & 52,661& 13& 13 & 216 \\ LA & 14& 267,286 & 79& 98& 98 & TN & 16& 516,250 &235 & 235 & 1,203 \\ MA & 18& 1,417,498 & 185& 185 & 832& TX &17 & 2,094,428 & 1,282 & 1,282 & 2,133 \\ MD & 15& 1,050,773 & 83& 170 & 170 & UT & 15& 220,582 &262 & 262 &781 \\ ME & 13& 205,937 & 189 & 189 & 189 & VA & 14 & 1,323,509& 143& 204 & 1,309 \\ MI & 16& 1,587,679 & 57& 118 & -- &VT & 17& 158,032 & 289& 289 & 508 \\ MN & 16& 744,198 & 309& 309 & 6,195 & WA & 15& 1,558,776& 103& 127 & 617 \\ MO & 23& 666,112 & 44& 130 & -- &WI &14 & 925,065 & 44& 144 & 878 \\ MS & 10& 274,391 & --& -- & -- & WV & 12& 187,482& 213& 213 & 213 \\ \cline{7-12} MT & 4& 149,973 & 5,159& 5,159 & 5,159 &\multicolumn{6}{c|}{} \\ \hline \multicolumn{12}{l}{} \\ \multicolumn{12}{l}{IRV-based Primaries} \\ \hline AK & 9 & 19,811& 88 & 88 & 88 & WY & 9 & 15,428 & 66 & 87 & 452 \\ \hline \end{tabular} \label{tab:PluralityStates} \end{table*} Table \ref{tab:CompareHardness} contrasts several of the hardest primaries of Table \ref{tab:PluralityStates} to audit with some of the easiest. We record, for each of these primaries: the number of at-large delegates being awarded; the delegate quotas computed for each viable candidate; the difference between the decimal portion of these quotas (the remainder) divided by the number of available delegates; and the estimated auditing effort (ASN) for the primary. For the first four primaries in the table, the last awarded at-large delegate is the hardest to audit. The use of IRV for determining candidate viability does not make a Hamiltonian election more difficult to audit. While more assertions are created to audit an IRV-based primary, the difficulty of any audit is based on the cost (ballot samples required) of its most expensive assertion. Since all assertions are tested on each ballot examined, the principle cost is retrieving the correct ballot. The audit specifications generated for the Wyoming and Alaskan primaries contain 78 and 89 assertions, respectively. The number of assertions formed for a plurality-based primary is proportional to the number of candidates. NH, involving the most candidates at 34, has 48 assertions to audit. \begin{table} \centering \caption{Hard (top) and relatively easy (bottom) primaries for which to audit the last assigned at-large delegate to each candidate. The number of at-large delegates $D$; the delegate quotas for Biden and Sanders; and the difference between the remainder of their quotas (divided by $D$) is reported, since this corresponds to the tightness of equation (1).} \begin{tabular}{|c|c|c|c|c|c|} \hline & & \multicolumn{2}{c|}{Quotas} & Rem. & \\ \cline{3-4} State & $D$ & Biden & Sanders & Diff. / $D$ & ASN \\ \hline CA & 90 & 50.688 & 39.312 & 0.004 & 3.2$\times 10^6$\\ MO & 15 & 9.524 & 5.476 & 0.003 & -- \\ NY & 61 & 47.629 & 13.371 & 0.004 & 486,495 \\ SC & 12 & 8.533 & 3.467 & 0.006 & 34,546 \\ \hline ME & 5 & 2.050 & 1.993 & 0.19 & 189 \\ AZ & 14 & 8.010 & 5.990 & 0.07 & 120 \\ OR & 13 & 9.948 & 3.052 & 0.07 & 191 \\ \hline \end{tabular} \label{tab:CompareHardness} \end{table} The computational cost of generating these audit specifications is not significant. On a machine with an Intel Xeon Platinum 8176 chip (2.1GHz), and 1TB of RAM, the generation of an audit specification for Wyoming and Alaska takes 0.3s and 0.4s, respectively. The time required to generate an audit for each of the plurality-based primaries in Table \ref{tab:PluralityStates} ranges from 0.2ms to 0.24s (and 0.03s on average). \section{Conclusion} \label{sec:conc} We provide an effective method for auditing delegate allocation by proportional representation (the Hamilton method), the first we know of for elections of this kind. Usually the audit only requires examining a small number of ballots. This could be used for primary elections in the USA and other elections in Russia, Ukraine, Tunisia, Taiwan, Namibia and Hong Kong. We provide a version suitable for Democratic primaries in Alaska, Hawaii, Kansas, and Wyoming, which use a modified form where viability is decided using IRV. To audit these elections we defined a new assertion for pairwise differences and corresponding assorter, which may be useful for auditing other methods. \afterpage{\clearpage} \bibliographystyle{splncs04}
\section{\label{sec:intro}Introduction} The High Luminosity phase of the Large Hadron Collider (HL-LHC)~\cite{HLLHC} is scheduled to begin at CERN in 2027, with a designed instantaneous luminosity of $5\times 10^{34}\text{ cm}^{-2}\text{s}^{-1}$. In order to operate in this environment, a new high granularity calorimeter (HGCAL)~\cite{HGCAL} will be installed in the endcap regions of the CMS detector. In regions of the calorimeter where the fluence is highest, the design uses silicon sensors as the active material. In lower fluence regions, the design uses plastic scintillator tiles, with the scintillation light readout by silicon photomultipliers (SiPMs). The design of the scintillator section of HGCAL is driven by the necessity of calibrating the detector with minimum ionizing particles (MIPs) throughout the lifetime of the calorimeter. To achieve the required performance, uniform light collection across the face of individual scintillator tiles is important. The SiPM-on-tile technology, where the SiPM is located in a dimple machined into the tile surface, has been studied by the Calorimeter for Linear Collider Experiment collaboration (CALICE)~\cite{CALICE1, CALICE2, TileOnSiPMtest}. These studies reported that for $97\%$ of a $3\times3~\text{cm}^{2}$ tile area the light yield response is within $10\%$ of the average response. Similar studies are needed for the tile designs that will be used in the HGCAL. Some adjustment of the HGCAL SiPM-on-tile design may be required to cover the full range of tiles in the calorimeter. CMS HGCAL will use scintillator tiles of approximately square shape varying in size from roughly $2.3\times2.3$ to $5.5\times5.5~\text{cm}^{2}$. We describe the apparatus and analysis used to study the responses of different scintillator tile geometries and materials using the Fermilab Test Beam Facility (FTBF)~\cite{FTBF} at the Fermi National Accelerator Laboratory. In this report, we present measurements for various geometries of Eljen Technology EJ-200~\cite{scinti_eff} and Kuraray SCSN-81~\cite{ref:kurary} tiles and their comparison with GEANT4~\cite{geant4-1, geant4-2, geant4-3} based simulations. \section{Test beam setup} The Fermilab Test Beam Facility~\cite{FTBF} provides a primary beam containing 120 GeV protons bunched at 53 MHz. The beam is delivered as a slow spill with a 4.2 second duration once per minute and intensity of approximately $5\times10^{4}$ protons per spill. The beam spot shape is roughly Gaussian, with standard deviation in x and y of about $1.5~\text{cm}$ (x and y are the horizontal and vertical directions transverse to the beam direction, respectively), to provide the sufficiently even population of protons across our scintillator tiles. We present the analysis of data taken during January-February 2020. \begin{figure}[htbp] \centering \hspace*{1cm} \includegraphics[width=1\textwidth]{Testbeam_setup_sketch_black} \caption{\label{fig:testbeam setup} Test beam layout, not to scale. A dark box on a computer-controlled x-y stage contained the SiPM-on-tile sample. Upstream and downstream doublets of silicon strip layers provided particle tracking. Two downstream scintillation counters provided the trigger. } \end{figure} The test beam configuration is shown in Fig~\ref{fig:testbeam setup}. The scintillator sample and the readout SiPM were placed in a dark box mounted on a computer-controlled x-y stage that provided the ability to move the tile transversely to the beam. The readout SiPM was connected to a 2~GHz inverting amplifier~\cite{PORKA}. Bias voltage for the SiPM was provided by a Keithley 6410 source meter. The analog signal from the SiPM was sent to a DRS4 1 -- 5~GS/s waveform digitizer~\cite{PSI}. The firmware of the DRS4 was modified to provide an output "BUSY" signal~\cite{Paul Rubinov}. Silicon strip tracking stations were placed on the upstream and downstream sides of the dark box containing the scintillator sample to measure the beam particle position. Two orthogonal layers of strips (tracker planes) in each tracking station recorded three-bit amplitude signals for each triggered event. The strips were $60~\mu\text{m}\times10.0~\text{cm}$ and with a total of 640 per layer. The total overlap active area was $3.84\times3.84~\text{cm}^{2}$. We used collections of strips with amplitudes above a threshold to find clusters of adjoining strips. Amplitude-weighted coordinates of strips were assigned to these clusters to build particle tracks. Assuming parallel beam propagation, we treated (X, Y) pairs of clusters in the upstream and downstream stations with the minimum transverse distance between them as the most probable track trace. We used the (X, Y) position of the most probable track in the upstream tracker station as the beam particle's measured position (in events with no hits in the downstream tracker station, the first (X, Y) pair of clusters in the upstream station was used). The coincidence of two scintillator counters provided the trigger for the system. The coincidence was fed into a NIM+ module which is based on the CAPTAN+ board designed at Fermilab and a Kintex7 FPGA. This module was configured to accept triggers that occurred in the absence of BUSY signals from the DRS4 and the silicon readout, so that a single event was readout before a new trigger was sent. \section{\label{sec:setup} DAQ setup} The FTBF Data Acquisition System~\cite{OTSDAQ} is called OTSDAQ, "Off The Shelf Data Acquisition." It was designed at Fermilab and is based on the XDAQ libraries developed at CERN for the CMS experiment. OTSDAQ was used to configure the DRS4 board and the silicon strip tracker stations, to provide triggers for both systems, and to perform online data quality monitoring and run control. The digitized waveforms from the DRS4 and the tracker information data streams were collected by the independent DAQ computers. Offline, these streams were combined into events using matching triggers. The operating acquisition rate was about 1K events per beam spill. \section{\label{sec:concept}SiPM-on-Tile Concept} This study investigates prototypes based on the SiPM-on-Tile concept~\cite{CALICE1}. Scintillators of various sizes were machined with a "dimple" as shown in Fig~\ref{fig:tile design}. The dimple provided a physical space for the SiPM and improved uniformity of response. In general, the SiPM will detect more light from a particle passing close to it. To reduce this geometry-induced hot spot, a dimple was machined to reduce the amount of scintillator and hence the amount of light generated near the SiPM. The SiPMs were located at the center of the dimple, with the active face located $0.55~\text{mm}$ into the dimple relative to the tile face. A reflective wrapper surrounded the tile to reflect escaping photons back into the tile, increasing the light yield. The wrapper covered 100\% of the tile area except for a small hole at the dimple to accommodate the SiPM. \subsection{Description of tile geometries} Tiles were prepared from two scintillator materials, $3.8~\text{mm}$ thick SCSN-81 (Kuraray), and $3~\text{mm}$ thick EJ-200 (Eljen Technology). Dimples were machined into a flat face of the tiles. Two different diameters of dimple were used, as shown in Fig~\ref{fig:tile design}: The SCSN-81 tiles had a spherical cap dimple with a diameter on the face of $12.7~\text{mm}$ and depth of $1.7~\text{mm}$, while EJ-200 tiles had a smaller spherical cap dimple of $6.2~\text{mm}$ diameter on the face and depth of $1.6~\text{mm}$. Tiles of various transverse sizes were prepared, ranging from $2.3\times2.3$ to $5.5\times5.5~\text{cm}^{2}$. \subsection{SiPMs used for the study} Two SiPMs from Hamamatsu Photonics were tested: S13360-1350PE~\cite{S13360} and S14160-1315PS~\cite{S14160}. These both have an active area $1.3\times1.3~\text{mm}^{2}$. The S13360-1350 has 50 micron pixels, while the S14160-13115 has 15 micron pixels. The gain of the S13360 is consequently about $10$ times larger. To ensure the pulse height of the two SiPMs were approximately the same, a second $10\times$ 2~GHz amplifier was employed when studying the S14160. \vspace{3mm} \begin{figure}[htbp] \centering \includegraphics[width=.45\textwidth]{Tim_SCSN81.pdf} \qquad \includegraphics[width=.45\textwidth]{Tim_EJ200.pdf} \caption{\label{fig:tile design} Left: Cross section of "SiPM-on-Tile" SCSN-81 Design. Right: Cross section of EJ-200 tile. The dimples are centered on the tile face. } \end{figure} \section{Simulation} \label{sec:simulation} The expected optical responses of the various tiles were simulated using the GEANT4~\cite{geant4-1, geant4-2, geant4-3} toolkit. The results are compared with data in Section~\ref{sec:response}. Fig.~\ref{fig:g4simu} shows the GEANT4 rendering of the simulation geometry. It is separated into three parts: the tile with its dimple, the reflective wrapping, and the SiPM attached to a backplate. The tile is completely wrapped in a reflective coating except for a hole centered on the dimple. For most simulations, the SiPM back was flush with the tile surface. A circular backplate outside of the wrapping was attached to the back of the surface-mount SiPM and was simulated as either printed circuit board white silk screen (WSS) or black tape with reflectivities at a wavelength of $425~\text{nm}$ of 0.68 and 0.05, respectively. \begin{figure}[htbp] \centering \includegraphics[width=.4\textwidth]{tile_front.png} \qquad \includegraphics[height=.4\textwidth]{tile_side.png} \caption{\label{fig:g4simu} GEANT4-rendering of simulated tile geometry as seen by the beam (left) and side view (right). The tile is a rectangle composed of plastic scintillator with a spherical dimple. The square at the center of the dimple is the rendering of the simulated SiPM. The sizes of this geometry follows Fig.~\ref{fig:tile design}~(right). } \end{figure} The simulated scintillator material was set to be the base material for SCSN-81 (polystyrene) and EJ-200 (polyvinyltolulene). Its optical properties were taken from the datasheets of the commercial products SCSN-81~\cite{ref:kurary} and EJ-200~\cite{scinti_eff} except for the absorption length of EJ-200. The effective light attenuation length at $425\text{\,nm}$ was set to $3.8\text{\,m}$ for EJ-200. The wavelength dependence of the attenuation length for EJ-200 was determined using a Varian Cary~300 spectrophotometer. Varying the spectral dependence of the attenuation length within measured uncertainties made negligible differences in our simulations. The attenuation length for SCSN-81 was set to be constant, $1.4\text{\,m}$ ~\cite{ref:kurary}. The SiPM was modeled as a rectangular solid divided into three layers: transparent epoxy, an active silicon layer, and an inert carrier. Its detection efficiency and specification were taken from the Hamamatsu S13360-1350PE ~\cite{S13360} and S14160-1315PS~\cite{S14160} product data sheets. Only photons that hit the front face of the SiPM were recorded. The reflectivities of the inert carrier were set to be 0.5. The tile was modeled to have a perfectly polished surface, where reflection and refraction angles were deterministic. Adding plausible surface imperfections had little effect on our results. Two wrapping materials were simulated, Tyvek\textsuperscript{\textregistered} and 3M Vikuiti\texttrademark ~Enhanced Specular Reflector film (ESR)~\cite{wrapping} with effective reflectivities set to 0.79 and 0.985 at 425 nm, respectively. A thin air gap between the tile and the wrapping was included. A $120~\text{GeV}$ proton beam was generated, oriented perpendicular to the scintillator face. The scintillating efficiency was $10 ~\text{photons}/\text{\,keV}$ for EJ-200~\cite{scinti_eff} and $8.7 ~\text{photons}/\text{\,keV}$ for SCSN-81~\cite{ref:kurary}. A photon entering into the SiPM sensitive area was counted if it passed an acceptance-rejection cut on the SiPM photon detection efficiency curve. The average number of detected photons for each geometry was used as a metric for the simulated light yield. For each geometry, the simulated proton's impact positions were uniformly distributed across the tile face. We studied the effect on the light yield of a uniform beam and a Gaussian beam, with a width similar to the test beam, and found the difference to be less than 2\%. When simulations were compared with the data in Section~\ref{sec:response}, an additional normalization constant was used to scale down the predicted light yield from simulation. It was $1.15$ and $1.01$ for EJ-200 and SCSN-81, respectively. These quantities took into account the difference between the most probable value (MPV) of light yield from data and the mean light yield from simulation and the estimations of the effective reflectivities that were used for the wrappings. \section{SiPM calibration} The DRS4 digitizes the SiPM analog voltage output using a 14 bit ADC with a configurable sampling frequency. For this experiment, we operated the DRS4 at 1~GS/s. For each trigger the SiPM waveform (as shown for example in Figure~\ref{fig:calib1}a) was recorded with 1024 samples. The DRS4 trigger delay was set to provide the pre-signal region of the waveform for the pedestal evaluation. We used integrals of waveform pulses to measure the light output of the scintillator tiles. The waveform pulse was defined as a contiguous set of samples near a local maximum with an ADC amplitude above a threshold of $10~\text{mV}$. Pulse voltage integrals $V_I$ were calculated as the sums of waveform amplitudes in a region of 60~samples, starting with the sample with a signal above 0.25 of those at a pulse maximum. To obtain the conversion factor between the integrated voltage and the number of the photoelectrons (PEs) produced in the SiPM, the following procedure was applied: \begin{itemize} \item we collected 10-20K waveforms for a scintillator tile with a known low light output per incident proton in order to see PE peaks; \item for each waveform, we calculated the signal integrated voltage $V_I$ under the pulse with maximum amplitude; \item the pedestal integrated voltage was calculated using a sample region of the signal pulse width in the pre-signal part of the waveform; \item after subtraction of the pedestal, signals were histogrammed to obtain the PE spectrum; \item a fit (the sum of Gaussian curves) of the first six peaks of the spectra was used to calculate the conversion factor as the mean distance between peaks in the fit region. \end{itemize} Figure~\ref{fig:calib1}a shows a DRS4 waveform collected from a S14160-1315 SiPM, when a 120~GeV proton passes through a Tyvek\textsuperscript{\textregistered}-wrapped SCSN-81 scintillator tile. The difference of integrals in regions [562, 622] (signal) and [482, 542] (pedestal) is taken for the signal histogram in this event. Figure~\ref{fig:calib1}b shows a fitted spectrum with individual PE peaks corresponding to a calibration factor of $0.165\pm 0.001~PE/V.$ Given the number of pixels in the SiPMs and the photon detection efficiency of the SiPMs at the voltages we operated them, the SiPMs response was linear over the PE ranges studied. Numerous calibration measurements were made throughout the data taking to account for any drift in the calibration factor due to temperature or other external factors. \begin{figure}[ht] \centering { \includegraphics[scale=0.37]{Drs4_Event_111_Jan28_scn81esr_r845.pdf} \includegraphics[scale=0.37]{DRS4_Calibration_Jan28clb_scn81tvk_r840_s14160atn6db.pdf} \leftline{ \hspace{3.7cm}{\bf (a)} \hfill\hspace{3.7cm} {\bf (b)} \hfill} \caption{\label{fig:calib1}(a) A typical SiPM signal waveform ($1~\text{ns}$ per sample) and (b) a photoelectron spectrum with multiple Gaussians fit over the peaks. The signal and pedestal regions of the waveform are integrated in regions [562, 622] (signal, green) and [482, 542] (pedestal, red). } } \end{figure} \section{\label{sec:response}Scintillator response} \subsection{Event selection} We selected events which 1)~have a matching trigger number for both DRS4 and tracker data, and 2)~passed quality selection criteria. We required: \begin{itemize} \item a clean waveform - the falling edge of the signal pulse was required to reach the level of 0.25 of the pulse's maximum and the pre-signal region should be wider than the number of samples used for signal integration; \item noise suppression - SiPM signal pulses were required to have the peak amplitude above ten mV; \item clean tracker data - the upstream tracker station was required to have silicon strips fired in both x and y planes but have not more than one two-strip cluster in each. And the hit in the downstream tracker was required to be within $2~\text{mm}$ of the upstream hit in the direction transverse to the beam. \end{itemize} These cuts were sufficient to ensure that a single particle passed through the tile and that the particle can be treated as a MIP. Light yield distributions for the $3\times3~\text{cm}^{2}$ SCSN-81 tile wrapped in ESR before and after quality selections are shown in Figure~\ref{fig:evtsel}a. \subsection{The light yield determination } To determine the light yield of a scintillator tile, the light yield distribution is fit with the sum of a Gaussian and a Landau function, where the lower light yield region is modelled to follow Gaussian statistics, but the high light yield tail is modelled with a Landau. We report the light yield as the most probable value (MPV) of the fit function. We observed that the MPV statistical uncertainty in a typical single measurement (5-10K clean events) was smaller than the $\pm3\%$ optical coupling systematic uncertainty described below in Sec~\ref{sec:OpticalCoupling}. We also note that SiPM optical cross talk corrections to the light yield were not made. The cross talk varied for each type of SiPM and was subsumed in the systematic error quoted. Figure~\ref{fig:evtsel}b shows the fit of the light yield distribution for clean events in the $3\times3~\text{cm}^{2}$ SCSN-81 tile test. \begin{figure}[ht] \centering { \includegraphics[scale=0.37]{EventSelection_Jan28_scn81esr_r845.pdf} \includegraphics[scale=0.37]{LanGaussFit_Jan28_scn81esr_r845.pdf} \leftline{ \hspace{3.7cm}{\bf (a)} \hfill\hspace{3.7cm} {\bf (b)} \hfill} \caption{\label{fig:evtsel} (a) light yield distributions for the $3\times3~\text{cm}^{2}$ SCSN-81 tile wrapped in ESR before (black) and after quality selections (red), and (b) the fit of the PE yield distribution after quality selections.} } \end{figure} \subsection{Tile uniformity} An attractive feature of the experimental setup is the capability for studies of the spatial uniformity of the collected signals across the face of a tile. Fig.~\ref{fig:EJ200_uniformity} shows the average light yield distribution for the $3\times3\times0.3~\text{cm}^{3}$ EJ-200 tile wrapped in ESR (reference tile) as a function of the proton impact position. The observed pattern in the light yield, including a bright spot slightly below the dimple region, is consistent with a slightly misaligned SiPM as reported in~\cite{ref:asymmetry}. Fig.~\ref{fig:uniformity_profilesEJ200} shows profiles of light yield distributions in data and simulation normalized to the maximum value of the entire two dimensional distribution for this EJ-200 tile. The profiles are along $2~\text{mm}$ horizontal and vertical bands that either pass through the tile center or are offset by $8~\text{mm}$ from the tile center in x or y. We observed uniform (within statistical uncertainty) light yield in bands located $8~\text{mm}$ away from the dimple center and $7~\text{mm}$ away from the side edges of the reference tile. To validate the performance of our experimental equipment, we prepared a SCSN-81 tile with a large dimple machined into it. This configuration was expected to exaggerate the effect of the dimple on the uniformity of the tile response. Figure~\ref{fig:uniformity} shows the beam intensity profile and the average light yield distribution as a function of the proton position in the upstream tracker plane for this tile. The depression of the light yield in the tile center is clearly evident and this corresponds to the dimple in the scintillator material. Fig.~\ref{fig:uniformity_profiles} shows profiles of light yield distributions, normalized to the maximum value of the intensity profile for this SCSN-81 tile. Points with error bars correspond to profiles of SiPM signals measured in vertical or horizontal bands of $2~\text{mm}$ width, spanning the tile center. Dashed lines show profiles in bands of $2~\text{mm}$ width that are $8~\text{mm}$ offset from the tile center in x or y. We show in Fig.~\ref{fig:5x5EJ200_uniformity} the average light yield distribution as a function of proton position for a $5.5\times5.5~\text{cm}^{2}$ EJ-200 tile. For the same tile, we show the light yield for annular regions centered on the dimple in Fig.~\ref{fig:5x5EJ200_RadialUniformity}. We observe an increase of the light yield directly in the region outside the dimple. \begin{figure}[ht] \centering { \includegraphics[width=.7\textwidth]{SignalProfile2D_Jan23_ej200esrNIUref_r666r668_s13360.pdf} \caption{\label{fig:EJ200_uniformity} The average light yield distribution of the EJ-200 reference tile as a function of proton position in the upstream tracker.} } \end{figure} \begin{figure}[ht] \centering { \includegraphics[scale=.37]{LYnormalized_Xprofiles_Jan23_ej200esrNIUref_r666_r668_s13360_Center.pdf} \includegraphics[scale=.37]{LYnormalized_Yprofiles_Jan23_ej200esrNIUref_r666_r668_s13360_Center.pdf} \leftline{ \hspace{3.7cm}{\bf (a)} \hfill\hspace{3.7cm} {\bf (b)} \hfill} \includegraphics[scale=.37]{LYnormalized_Xprofiles_Jan23_ej200esrNIUref_r666_r668_s13360_Side.pdf} \includegraphics[scale=.37]{LYnormalized_Yprofiles_Jan23_ej200esrNIUref_r666_r668_s13360_Side.pdf} \leftline{ \hspace{3.7cm}{\bf (c)} \hfill\hspace{3.7cm} {\bf (d)} \hfill} \caption{\label{fig:uniformity_profilesEJ200} Normalized light yield distribution profiles in data and simulation for the EJ-200 reference tile along a) $2~\text{mm}$ y-bands at the tile center, b) $2~\text{mm}$ x-bands at the tile center, c) $2~\text{mm}$ y-bands offset by $8~\text{mm}$ in the x direction from the tile center, and d) $2~\text{mm}$ x-bands offset by $8~\text{mm}$ in the y direction from the tile center. In the top distributions, the sharp peaks in simulation correspond to the edge of the dimple and this feature does not appear in the data due to the machining of the dimple.} } \end{figure} \begin{figure}[ht] \centering { \includegraphics[scale=0.37]{BeamProfile2D_Jan28_scn81esr_r845.pdf} \includegraphics[scale=0.37]{SignalProfile2D_Jan28_scn81esr_r845.pdf} \leftline{ \hspace{3.7cm}{\bf (a)} \hfill\hspace{3.7cm} {\bf (b)} \hfill} \caption{\label{fig:uniformity} The a) beam intensity and b) average light yield distribution profile as a function of proton position in the upstream tracker. The light yield in b) is that of a SCSN-81 tile with large dimple. The reduced light yield at the dimple is clearly seen. } } \end{figure} \begin{figure}[ht] \centering { \includegraphics[scale=0.37]{LYnormalized_Xprofiles_Jan28_scn81esr_r845.pdf} \includegraphics[scale=0.37]{LYnormalized_Yprofiles_Jan28_scn81esr_r845.pdf} \leftline{ \hspace{3.7cm}{\bf (a)} \hfill\hspace{3.7cm} {\bf (b)} \hfill} \caption{\label{fig:uniformity_profiles} Normalized light yield distribution profiles for the tile with an increased dimple size shown in Figure~\ref{fig:uniformity} along a) $2~\text{mm}$ y-bands at the tile center and $8~\text{mm}$ to the right side of the dimple area and b) $2~\text{mm}$ x-bands at the tile center and $8~\text{mm}$ to the top side of the dimple area. Points with error bars correspond to center profiles, while dashed lines show the off-center profiles.} } \end{figure} \begin{figure}[ht] \centering { \includegraphics[width=.7\textwidth]{SignalProfile2D_Jan24_ej200esr_Largetiles41_r704_713_s13360.pdf} \caption{\label{fig:5x5EJ200_uniformity} The average light yield distribution profile of the $5.5\times5.5~\text{cm}^{2}$ EJ-200 tile as a function of proton position in the upstream tracker.} } \end{figure} \begin{figure}[ht] \centering { \includegraphics[width=.7\textwidth]{rGraphMPV_Jan24_ej200esr_Largetiles41_r704_713_s13360.pdf} \caption{\label{fig:5x5EJ200_RadialUniformity} The MPV from concentric annular regions centered at the tile's dimple (black points) for the $5.5\times5.5~\text{cm}$ EJ-200 tile. The error bars are $\pm3\%$ systematic, which dominate the statistical errors in the fits. Simulated results are indicated by open triangles.} } \end{figure} To quantify a tile's uniformity, we divided a tile into $2\times2~\text{mm}^{2}$ bins, determined the average light yield in each bin, and calculated the $\text{RMS}/\text{mean}$ for all average light yield values in a given tile. The average light yield distributions are shown in Fig.~\ref{fig:AvgLY} for the $3\times3~\text{cm}^{2}$ EJ-200 tile, the $5.5\times5.5~\text{cm}^{2}$ EJ-200 tile, and the SCSN-81 tile with large dimple. To establish that the $\text{RMS}/\text{mean}$ distribution provides useful insights on the uniformity of tiles, we performed a simplified simulation of a $3\times3~\text{cm}^{2}$ tile. The simulated light response across the tile was perfectly uniform, following a Poisson distribution with an average light yield of $30$ PE. We simulated 10 events in each $2\times2~\text{mm}^{2}$ bin, the average number of events per bin in data, and compared the result to data by quantifying the non-uniformity as $\frac{\text{RMS}/\text{mean}_{\text{tile}}}{\text{RMS}/\text{mean}_{\text{uniform}}} - 1$. The non-uniformity of the different sized EJ-200 tiles and the special SCSN-81 tile is listed in Table~\ref{tab:uniformity}. As expected, the EJ-200 tiles show considerably lower non-uniformity than the special SCSN-81 tile. \begin{figure}[ht] \centering { \includegraphics[scale=0.37]{BinMeansHisto_3.pdf} \includegraphics[scale=0.37]{BinMeansHisto_5p5.pdf} \leftline{ \hspace{3.7cm}{\bf (a)} \hfill\hspace{3.7cm} {\bf (b)} \hfill} \includegraphics[scale=0.37]{BinMeansHisto_Dimple.pdf} \leftline{ \hspace{7.1cm}{\bf (c)}} \caption{\label{fig:AvgLY} The average light yield in $2\times2~\text{mm}$ bins for a) the $3\times3~\text{cm}^{2}$ EJ-200 tile, b) the $5.5\times5.5~\text{cm}^{2}$ EJ-200 tile, c) and the SCSN-81 tile with large dimple.} } \end{figure} \begin{table}[ht] \caption{ The non-uniformity, $\frac{\text{RMS}/\text{mean}_{\text{tile}}}{\text{RMS}/\text{mean}_{\text{uniform}}} - 1$, of the average light yield for the different sized EJ-200 tiles and the SCSN-81 tile with the large dimple machined into it. } \centering \label{tab:uniformity} \begin{tabular}{cc} Tile & Non-Uniformity \\ \hline EJ-200 $2.3\times2.3$ & $0.14\pm0.03$ \\ EJ-200 $3.0\times3.0$ & $0.39\pm0.05$ \\ EJ-200 $3.4\times3.4$ & $0.61\pm0.05$ \\ EJ-200 $5.5\times5.5$ & $0.40\pm0.04$ \\ SCSN-81 $3.0\times3.0$ & $1.58\pm0.11$ \\ \hline \end{tabular} \end{table} \subsection{Light yield as a function of tile area} The light yield was measured for different sized square tiles composed of $3~\text{mm}$ thick, EJ-200 scintillator wrapped in ESR. Tile sizes ranged from $2.3\times2.3$ -- $5.5\times5.5~\text{cm}^{2}$. The results are compared to simulation and shown in Fig~\ref{fig:MPVvsTileArea}. A $\chi^{2}$ fit to data is performed with the function $p_{0}\times(\mathrm{Tile~Area}/9~\text{cm}^2)^{p_{1}}$, where $p_{0}$ and $p_{1}$ are parameters of the fit and fitted values of $p_{0}=30.16\pm0.48$ PE and $p_{1}=-0.58\pm0.02$ are obtained. The light yield is roughly inversely proportional to the square root of the tile area. \begin{figure}[ht] \centering \includegraphics[trim={0.1cm 0.1cm 0.1cm 0.1cm}, clip, width=.9\textwidth]{Data_vs_Simulation_Area_global_fit.pdf} \caption{\label{fig:MPVvsTileArea} The light yield reported as MPV in data and simulation as a function of tile area for a $3~\text{mm}$ thick, wrapped in ESR, EJ-200 scintillator tile. A systematic uncertainty due to reproduciblitiy of optical coupling is estimated to be $3.0\%$, and is plotted but smaller than the data points. The black curve is the fit to data. } \end{figure} \subsection{Light yield as a function of tile thickness} The light yield was measured for tiles of different thicknesses wrapped in either ESR or Tyvek\textsuperscript{\textregistered}. This was done by stacking $3.8~\text{mm}$ thick, SCSN-81 tiles with a thin layer of Bicron BC-630 optical grease in between to simulate a solid tile. Care was taken to avoid bubbles in the optical grease coupling. The edges of the tiles were diamond fly-cut to polish them. Sets of three square tiles with dimensions $3\times3$, $4\times4$, and $5\times5$ $\text{cm}^{2}$ were prepared. From each set, one tile had a dimple machined in it and the other two tiles had unmachined faces. The results are compared to simulation and shown in Fig~\ref{fig:MPVvsTileThickness}. The discrepancies between data and simulation are caused by imperfections from the optical grease which were not taken into account in the simulation. A $\chi^{2}$ fit is performed to the light yield measured in data of each tile thickness with the function $p_{0}\times(\mathrm{Tile~Thickness}/3.8~\text{mm})^{p_{1}}$, where $p_{0}$ and $p_{1}$ are parameters of the fit and the fitted values are shown in Table~\ref{tab:fitValues}. In all cases the increase in light yield was less than linear in tile thickness. The light yield difference between tiles wrapped with ESR vs. Tyvek\textsuperscript{\textregistered} is shown in Table~\ref{tab:TyvekESR}, where the ratio of MPV from ESR wrapped tiles to Tyvek\textsuperscript{\textregistered} wrapped tiles for each sample size is listed. In all cases, ESR wrapped tiles demonstrate much higher light yields than tiles wrapped in Tyvek\textsuperscript{\textregistered}. \begin{figure}[ht] \centering \includegraphics[width=.47\textwidth]{Data_vs_Simulation_esr_global_fit.pdf} \qquad \includegraphics[width=.47\textwidth]{Data_vs_Simulation_tyvek_global_fit.pdf} \caption{\label{fig:MPVvsTileThickness} The light yield reported as MPV in data and simulation as a function of tile thickness for $3\times3$, $4\times4$, and $5\times5~\text{cm}^{2}$ square SCSN-81 tiles, wrapped in ESR (left) or Tyvek\textsuperscript{\textregistered} (right). The different colored curves are the fits to data.} \end{figure} \begin{table}[ht] \caption{ The fit values of $p_{0}$ and $p_{1}$ in the $p_{0}\times(\mathrm{Tile~Thickness}/3.8~\text{mm})^{p_{1}}$ fit to the different sized and wrapped tiles. } \centering \label{tab:fitValues} \begin{tabular}{cccc} SCSN-81 tile area, mm & Wrapping & $p_{0}$ fit values & $p_{1}$ fit values \\ \hline $30.0\times30.0$ & ESR & $24.03\pm0.74$ & $0.45\pm0.04$ \\ $30.0\times30.0$ & Tyvek\textsuperscript{\textregistered} & $7.73\pm0.22$ & $0.31\pm0.04$ \\ $40.0\times40.0$ & ESR & $14.95\pm0.44$ & $0.66\pm0.04$ \\ $40.0\times40.0$ & Tyvek\textsuperscript{\textregistered} & $5.82\pm0.16$ & $0.34\pm0.04$ \\ $50.0\times50.0$ & ESR & $7.76\pm0.21$ & $0.76\pm0.04$ \\ $50.0\times50.0$ & Tyvek\textsuperscript{\textregistered} & $4.49\pm0.13$ & $0.20\pm0.04$ \\ \hline \end{tabular} \end{table} \begin{table}[ht] \caption{ The ratio of MPV for ESR divided by Tyvek\textsuperscript{\textregistered} wrapped tiles. } \centering \label{tab:TyvekESR} \begin{tabular}{cc} SCSN-81 tile dimensions, mm & ESR/Tyvek\textsuperscript{\textregistered} light yield MPV ratio \\ \hline $30.0\times30.0~\times3.8$ & $3.32 \pm 0.30$ \\ $30.0\times30.0~\times7.6$ & $2.99 \pm 0.27$ \\ $30.0\times30.0~\times11.4$ & $4.11 \pm 0.37$ \\ $40.0\times40.0~\times3.8$ & $2.72 \pm 0.25$ \\ $40.0\times40.0~\times7.6$ & $2.63 \pm 0.24$ \\ $40.0\times40.0~\times11.4$ & $4.03 \pm 0.37$ \\ $50.0\times50.0~\times3.8$ & $1.71 \pm 0.16$ \\ $50.0\times50.0~\times7.6$ & $2.65 \pm 0.24$ \\ $50.0\times50.0~\times11.4$ & $3.15 \pm 0.29$ \\ \hline \end{tabular} \end{table} \subsection{Light yield as a function of hole size in ESR reflective wrapper} The light yield as a function of hole size in the ESR reflector was measured for a $3\times3~\text{cm}^{2}$ EJ200 tile wrapped in ESR. One expects that as the hole diameter in the reflective foil decreases, the light yield should increase, since fewer photons escape through the gap between SiPM and wrapper. Likewise, it is expected that if the white silkscreen is changed to a non-reflective surface, the light yield should decrease, since fewer photons reflect back into the tile through the gap. The light yield was studied for cases of a white silk screened backplate, and holes in the reflector of $3.2~\text{mm}$, $5.1~\text{mm}$, and $6.35~\text{mm}$ diameter. For these hole sizes, the white backplate was compared to data taken with the white backplate covered with black tape, which is a good approximation to a nonreflective surface. The results are compared to simulation and shown in Fig.~\ref{fig:MPVvsHoleSize}. A $\chi^{2}$ fit to data is performed with the function $p_{0}\times(\mathrm{Hole~Diameter}/3.2~\text{mm})^{p_{1}}$ where $p_{0}$ and $p_{1}$ are parameters of the fit and fitted values of $p_{0}=36.53\pm1.56$ PE and $p_{1}=-0.17\pm0.06$ for WSS and $p_{0}=16.44\pm0.70$ PE and $p_{1}=-0.38\pm0.06$ for black tape are extracted. In accordance with our expectations, larger holes had lower light yields, and the effect is stronger for the black backplate. \begin{figure}[ht] \centering \includegraphics[trim={0.1cm 0.1cm 0.1cm 0.1cm}, clip, width=.8\textwidth]{Data_vs_Simulation_HoleSize_global_fit.pdf} \caption{\label{fig:MPVvsHoleSize} The MPV of the light yields in data and simulation as a function of hole size are shown for SiPMs sitting on top of a white silkscreened backplate and a black tape backplate. (S13360 SiPM, EJ-200 tile.)} \end{figure} \section{Systematics} \subsection{Reproducibility of optical coupling} \label{sec:OpticalCoupling} A systematic uncertainty was calculated for the reproducibility of the optical coupling between tile and SiPM by comparing the MPV across nominally identical measurements of the same tile with the same wrapping. A typical reproducibility of $3\times3~\text{cm}^{2}$ tiles was found to be $\pm3\%$, derived from the root mean square deviation from the mean of six measurements of the same tile. \subsection{Misalignment of SiPM relative to the tile dimple} We studied intentional misalignment of the SiPM relative to its nominal location in the x-y plane, and also in its depth into dimple (z direction). For a SiPM misaligned by $1.7~\text{mm}$, about four times larger than our alignment uncertainty, in the x-y~plane, the difference in the MPV response was found at the level of $2.7\%$, an effect that was small compared to our overall reproducibility uncertainty. To study the misalignment in the z-direction, we moved the SiPM $1~\text{mm}$ away from the tile and found the MPV decreased by $36.6\%$. Although this is a significant effect, we believe it is not important for our studies due to the design of the mechanics of our test stand that naturally provided consistent z placement. Additionally, the optical coupling reproducibility measurement, Sec~\ref{sec:OpticalCoupling}, includes any residual effect of z misalignment. Our tile-to-SiPM mounting was very reproducible for most tiles. \subsection{SiPM temperature dependence} The temperature of the SiPM was measured using a PT10000 temperature sensor placed on the PCB close to the SiPM. Using this sensor, we observed a temperature variation between 26 and 28$^{\circ}$C for all runs. For our SiPMs and our choice of over-voltage, the expected change in the number of detected photons due to temperature variation is less than 1\%. The systematic uncertainty in optical coupling covers this uncertainty. \section{Summary} A setup to study the responses of different scintillator tile geometries and materials has been installed at the Fermilab Test Beam Facility. This was used to collect and analyze data in a January-February 2020 test beam run. The light yield and uniformity was measured for various values of the tile size, tile thickness, type of the reflective wrapper, and the hole diameter in the wrapper. ESR was found to be substantially more reflective than Tyvek\textsuperscript{\textregistered}, with a ratio of light yield of roughly $2$ to $4$ times, depending on other tile parameters. The light yield of a tile was measured as approximately inversely proportional to the square root of the tile area. The light yield was observed to increase much less than linearly with thickness, with the exact amount depending on tile size and wrapping material. Simulation was developed that agrees well with the light yield and uniformity measured in test beam data across the different tiles. \acknowledgments Work supported by the Fermi National Accelerator Laboratory, managed and operated by Fermi Research Alliance, LLC under Contract No. DE-AC02-07CH11359 with the U.S. Department of Energy. The U.S. Government retains and the publisher, by accepting the article for publication, acknowledges that the U.S. Government retains a non-exclusive, paid-up, irrevocable, world-wide license to publish or reproduce the published form of this manuscript, or allow others to do so, for U.S. Government purposes. Work also supported by the US-DOE Office of Science (High Energy Physics) under Award Number DE-SC0011845 and DE‐SC0010072. Additional support provided by the University of Maryland Physics Department. \newpage
\section{Introduction} Algorithms for nonsmooth optimization, such as subgradient and semi-smooth Newton methods, crucially rely on first-order approximations of Lipschitz maps. Two seemingly disparate first-order approximation properties underlie existing results. \paragraph{Conservativity.}{ In full generality, Lipschitz continuous functions can be highly pathological, resulting in failure of subgradient methods to find any critical points \cite{daniilidis2020pathological}. Consequently, it is essential to limit the class of functions under consideration. With this in mind, recent analysis of subgradient methods \cite{bolte2020conservative,davis2020stochastic,majewski2018analysis} requires \emph{conservativity} of a {generalized gradient mapping} $G(x)$ for $f$. This property, axiomatically explored by Bolte and Pauwels \cite{bolte2020conservative}, stipulates the validity of a formal chain rule $$ \frac{d}{dt} (f \circ \gamma)(t) = \dotp{G(\gamma(t)), \dot \gamma(t)} \qquad \text{for a.e. $t \in (0, 1)$}, $$ along any absolutely continuous curve $\gamma$. Most importantly, conservativity holds automatically when $f$ is semialgebraic and $G$ is the {Clarke subdifferential} $\partial_C f$~\cite{davis2020stochastic}. More generally, Bolte and Pauwels~\cite{bolte2020conservative,bolte2020mathematical} showed that conservativity holds when $G$ is an output of an automatic differentiation scheme on a composition of semialgebraic functions.} \paragraph{Semismoothness.}{ Newton methods for solving nonsmooth equations $F(x)=0$, for a Lipschitz map $F$ require a \emph{semismoothness} property of $F$ with respect to a generalized Jacobian mapping $G(x)$. This property, introduced by Mifflin \cite{mifflin1977semismooth} and explored for Newton methods by Qi and Sun \cite{qi1993nonsmooth}, stipulates the estimate: $$ F(y) - F(x) - G(y)(y - x) \subset o(\|x - y\|)\mathbb{B} \qquad \textrm{as } y \to x,$$ at any point $x \in {{\bf R}}^n$. Bolte, Daniilidis and Lewis~\cite{bolte2009tame} famously showed that semismoothness holds when $F$ is semialgebraic and $G=\partial_C F$ is the Clarke Jacobian. } \bigskip Seemingly disparate, there is reason to believe conservativity and semismoothness are closely related. For example, Norkin's seminal work~\cite{norkin1980generalized,norkin1986stochastic} analyzed subgradient methods on functions $f$ that are semismooth with respect to certain generalized subdifferential operators. On the other hand, Ruszczy{\'n}ski~\cite{ruszczynski2020convergence} recently showed that semismoothness implies a weaker notion of conservativity along semismooth curves. In this paper, we prove that the notions of conservativity and semismoothness are equivalent for semialgebraic maps. Our proof strategy is to relate the two properties to an intermediate ``stratified derivative'' condition, already known from \cite{lewis2021structure} to be equivalent to conservativity. The end result applies to a natural family of (set-valued) directional derivatives $D(x, u)$, akin to $G(x) u$. In particular, $D(x, u)$ could be a directional derivative, the map induced by the coordinate-wise Clarke Jacobian, or the output of an automatic differentiation procedure. \begin{theorem}[Informal] Suppose $F(\cdot)$ and $D(\cdot,\cdot)$ are semialgebraic. Then conservativity and semismoothness are both equivalent to the following condition: there exists a partition of ${\bf R}^d$ into finitely many semialgebraic $C^1$ manifolds such that for any point $x$ lying in a manifold $M$ equality holds: $$D(x,u)=\{F'(x,u)\}\qquad \forall u\in T_M(x),$$ \end{theorem} Thus both conservativity and semismoothness hold if and only if $D(x,u)$ coincides with the standard directional derivative $F'(\cdot,\cdot)$ on the tangent spaces of some partition of ${\bf R}^n$ into finitely many smooth manifolds. In dual terms, this means that semismooth generalized derivatives are simply selections of the map $(x,u)\to J(x)u$ where the rows of $J(x)$ are Clarke subgradients of $F_i$ shifted by the normal space. Building on \cite{bolte2020conservative}, the authors of \cite{lewis2021structure} recently showed that the latter property is equivalent to $J(x)$ being conservative. Summarizing, the results of our paper together with those already available in the literature \cite{lewis2021structure,bolte2020conservative} imply that semismooth directional derivatives, stratified directional derivatives/subgradients, and conservative set-valued vector fields are equivalent in the semi-algebraic setting. \section{Notation and preliminaries} In this section, we record basic notation and preliminaries from variational analysis and semi-algebraic geometry that will be used in the paper. \subsection{Variational analysis} We follow standard notation of variational analysis, as set out for example in the monographs \cite{RW98,Mord_1,kk_book,CLSW,penot_book,ioffe_book}. Throughout, fix a Euclidean $n$-dimension space, denoted by ${{\bf R}}^n$, equipped with an inner product $\langle \cdot,\cdot\rangle$ and the induced norm $\|x\|=\sqrt{\langle x,x\rangle}$. A set-valued map $G\colon{{\bf R}}^n\to{\bf R}^m$, maps points to subsets $G(x)\subset{\bf R}^m$. The domain and graph of $G$, respectively, are defined by $$\dom G=\{x\in{{\bf R}}^n: G(x)\neq \emptyset\}\qquad \textrm{and}\qquad \gph G=\{(x,y)\in {{\bf R}}^n\times{\bf R}^m: y\in G(x)\}.$$ The set $\operatornamewithlimits{Limsup}_{x\to \bar x} G(x)$ consists of all limits of sequences $y_i\in G(x_i)$ where $x_i$ is any sequence converging to $\bar x$. The map $G$ is called outer-semicontinuous if $\gph G$ is a closed set. We say that $G$ is inner-semicontinuous on a set $Q\subset{{\bf R}}^n$ if for any points $x\in Q$ and $y\in G(x)$ and for any sequence $x_i \xrightarrow[]{Q} x$, there exist points $y_i\in G(x_i)$ converging to $y$. The distance function and the projection onto a set $X\subset{{\bf R}}^n$ are defined by: $${\rm dist}(y,X):=\inf_{x\in X}~\|y-x\|, \qquad \proj(y,X):=\operatornamewithlimits{argmin}_{x\in X}~\|y-x\|.$$ The deviation between sets $X,Y\subset{{\bf R}}^n$ will be measured by the Hausdorff distance $${\rm dist}(X,Y):=\max\left\{\sup_{x\in X}{\rm dist}(x,Y),\sup_{y\in Y}{\rm dist}(y,X)\right\}.$$ The directional derivative of any map $F\colon{{\bf R}}^n\to{\bf R}^m$ is defined by \begin{equation}\label{eqn:dir_deriv} F'(x,u):=\lim_{t\searrow 0}~ \frac{F(x+tu)-F(x)}{t}. \end{equation} The map $F$ is called directionally differentiable if $F'(x,u)$ is well-defined, meaning the limit exists in \eqref{eqn:dir_deriv} for every $x, u\in {{\bf R}}^n$. It is straightforward to verify that when $F$ is locally Lipschitz continuous and directionally differentiable, equality holds: $$F'(x,u)=\lim_{t\searrow 0,~v\to u} \frac{F(x+tv)-F(x)}{t}$$ Abusing notation, for any curve $\gamma\colon [0,1)\to {\bf R}^n$, we define the one-sided velocity $\gamma'(0):=\lim_{t\searrow 0}\frac{\gamma(t)-\gamma(0)}{t}$ and we let $\dot{\gamma}(t)$ denote the derivative of $\gamma$ at any point $t\in (0,1)$ where $\gamma$ is differentiable. Given any locally Lipschitz continuous map $F\colon{{\bf R}}^n\rightrightarrows{\bf R}^m$, the Clarke Jacobian of $F$ at $x$ is the set $$\partial_C F(x)={\rm conv\,}\left\{\lim_{i\to\infty} \nabla F(x_i): x_i\xrightarrow[]{\Omega} x\right\},$$ where $\Omega$ is the set of points at which $F$ is differentiable and ${\rm conv\,}(\cdot)$ denotes the convex hull. Finally, for any $C^1$ manifold $M\subset{{\bf R}}^n$ and a point $x\in M$, the symbols $T_M(x)$ and $N_M(x)$ will denote the tangent and normal spaces to $M$ at $x$. \subsection{Semialgebraic geometry} We next collect a few elementary facts from semialgebraic geometry. For details we refer the reader to \cite{Coste-semi,Coste-min,Dries-Miller96}. All results in the paper hold more generally, and with identical proofs, for sets and functions definable in an o-minimal structure. We focus on the semialgebraic setting only for simplicity. A set $Q\subset{{\bf R}}^n$ is called semialgebraic if it can be written as a union of finitely many sets defined by finitely many polynomial inequalities. A set-valued map $G\colon{{\bf R}}^n\rightrightarrows{\bf R}^m$ is called semi-algebraic if its graph is a semialgebraic set. Univariate semialgebraic functions are particularly simple. \begin{lemma}[Curves]\label{lem:semi_smooth_uni} For any semialgebraic map $\gamma\colon[0,1]\to {{\bf R}}^n$, there exists $\epsilon>0$ such that $\gamma$ is $C^1$-smooth on the open interval $(0,\epsilon)$. Moreover, as long as the quotients $t^{-1}(\gamma(t)-\gamma(0))$ are bounded for all small $t>0$, the derivative $\gamma'(0)$ exists and equality $\gamma'(0)=\lim_{t\searrow 0} \dot{\gamma}(t)$ holds.\end{lemma} Notice that the equality $\gamma'(0)=\lim_{t\searrow 0} \dot{\gamma}(t)$ can be interpreted as semi-smoothness of univariate semi-algebraic functions---an observation we will revisit. An immediate consequence is that locally Lipschitz semi-algebraic maps are directionally differentiable. The following theorem moreover shows that semi-algebraic maps are ``generically smooth.'' To simplify notation, we use the term {\em $C^1$ semialgebraic partition of ${\bf R}^n$} to mean a partition of ${\bf R}^n$ into finitely many semialgebraic $C^1$ manifolds. \begin{thm}[Generic smoothness]\label{thm:gen_smooth} Let $F\colon{{\bf R}}^n\to{\bf R}^m$ be a semialgebraic map. Then there exists a $C^1$-semialgebraic partition $\mathcal{A}$ of ${\bf R}^n$ such that the restriction of $F$ to each manifold $M\in \mathcal{A}$ is $C^1$-smooth. \end{thm} A useful property that blends variational analytic and semialgebraic constructions is the projection formula, proved in \cite[Proposition 4]{Lewis-Clarke}. \begin{thm}[Projection formula]\label{thm:proj_formula} Let $f\colon{{\bf R}}^n\to{\bf R}$ be a semialgebraic locally Lipschitz continuous function. Then there exists a $C^1$-semialgebraic partition $\mathcal{A}$ of ${\bf R}^n$ such that for any point $x$ lying in a manifold $M\in \mathcal{A}$ equality holds: $$\{f'(x,u)\}=\langle \partial_C f(x),u \rangle \qquad \forall u\in T_M(x).$$ \end{thm} The next result shows that any semialgebraic map admits a semialgebraic single-valued selection. \begin{lemma}[Semialgebraic selection]\label{lem:semialgebraic_select} Any semi-algebraic map $G\colon{{\bf R}}^n\rightrightarrows{\bf R}^m$ admits a semialgebraic selection $g\colon\dom G\to {\bf R}$ satisfying $g(x)\in G(x)$ for all $x\in \dom G$. \end{lemma} The following theorem, from \cite[Proposition 2.28]{dim}, shows that semialgebraic set-valued maps are generically inner-semicontinuous. \begin{theorem}[Generic inner semicontinuity]\label{thm:inner_semicont} Let $G\colon {{\bf R}}^n\rightrightarrows{\bf R}^m$ be a semialgebraic map. Then there exists a $C^1$-semialgebraic partition $\mathcal{A}$ of ${\bf R}^n$ such that the restriction $G\mid_{\mathcal{M}}$ is inner-semicontinuous for every $\mathcal{M}\in \mathcal{A}$. \end{theorem} Many of the aforementioned results guarantee existence of certain partitions of ${\bf R}^n$. Consequently, it will be useful to refine partitions. A partition $\mathcal{A}$ of ${\bf R}^n$ is called {\em compatible} with a collection $\mathcal{B}$ of sets in ${\bf R}^n$ if each set in $\mathcal{B}$ is a union of some sets in $\mathcal{A}$. \begin{theorem}[Compatible partitions]\label{thm:com_part} Let $\mathcal{B}$ be a collection of finitely many semialgebraic sets. Then there exists a $C^1$-semialgebraic partition $\mathcal{A}$ of ${\bf R}^n$ that is compatible with $\mathcal{B}$. \end{theorem} \section{Main results} Throughout, we let $F\colon{\bf R}^n\to{\bf R}^m$ be a locally Lipschitz continuous and directionally differentiable map and let $D\colon{{\bf R}}^n\times {{\bf R}}^n\rightrightarrows{\bf R}^m$ be a set-valued map. The reader may view $D(x,u)$ as a ``generalized directional derivative'' of $F$ at $x$ in direction $u$. \begin{assumption}\label{ass:standing} We introduce the following assumptions on $D$. \begin{enumerate} \item {\bf (Full domain)} The image $D(x,u)$ is nonempty for all $x,u\in{{\bf R}}^n$. \item {\bf (Homogeneity)} The map $D$ is positively homogeneous in the second argument: $$D(x,0)=\{0\}\qquad \textrm{and}\qquad D(x,tu)=t D(x,u),$$ for all $x,u\in {{\bf R}}^n$ and $t> 0$. \item {\bf (Lipschitz continuity)} The assignment $D(x,\cdot)$ is Lipschitz continuous locally uniformly in $x$. That is, for every point $\bar x\in {{\bf R}}^n$, there exists $L>0$ such that $${\rm dist}(D(x,u_1),D(x,u_2))\leq L\|u_1-u_2\|,$$ for all $u_1,u_2\in {{\bf R}}^n$ and all $x$ sufficiently close to $\bar x$. \end{enumerate} \end{assumption} The first condition is self-explanatory. The second condition, which asserts that $\gph D(x,\cdot)$ is a cone, is natural for directional derivatives. The third condition is more nuanced but is again mild. In particular, all three conditions hold for the directional derivative $D(x,u)=F'(x,u)$ and for any map of the form $D(x,u)=J(x)u$ where $J\colon{{\bf R}}^n\rightrightarrows{\bf R}^{m\times n}$ is locally bounded. Clearly, $D(x,u)$ can be regarded as a generalized directional derivative of $F$ only if it accurately predicts the variations of $F$ at $x$ in direction $u$. There are a number of seemingly distinct conditions in the literature that model ``goodness of approximation,'' depending on context. We record the most relevant ones for us below and comment on each. \begin{condition} We introduce the following conditions. \begin{enumerate} \item\label{eqn:NewtI} {\bf (Semismooth I)} For any point $x$ it holds: $$\operatornamewithlimits{Limsup}_{y\to x}~\frac{F(y)-F(x)-D(y;y-x)}{\|y-x\|}=\{0\},$$ \item\label{eqn:NewtII} {\bf (Semismooth II)} For any point $x$ it holds: $$\operatornamewithlimits{Limsup}_{y\to x}~\frac{F(y)-F(x)+D(y;x-y)}{\|y-x\|}=\{0\}.$$ \item\label{eqn:conserv} {\bf (Conservative derivative)} For any absolutely continuous curve $\gamma\colon [0,1]\to {\bf R}^n$, equality holds: \begin{equation}\label{eqn:def_cons} \left\{\frac{d}{dt}(F\circ \gamma)(t)\right\}=D(\gamma(t),\dot \gamma(t))\qquad \textrm{for a.e. } t\in (0,1). \end{equation} \item\label{eqn:strat_der} {\bf (Stratified derivative)} There exists a semialgebraic $C^1$ partition $\mathcal{A}$ of ${\bf R}^n$ such that equality $$D(x,u)=\{F'(x,u)\}$$ holds for any manifold $M\in \mathcal{A}$, $x\in M$, and any tangent vector $u\in T_M(x)$. \item \label{it:clarke_strat} {\bf (Stratified subdifferential)} There exists a semialgebraic $C^1$ partition $\mathcal{A}$ of ${\bf R}^n$ such that for any manifold $M\in \mathcal{A}$ and $x\in M$, it holds: $$D(x,u)\subset J(x)u,$$ where we set $$J(x)=\{A\in {\bf R}^{m\times n}: A_i\in \partial_C F_i(x)+N_{M}(x)\},$$ and $A_i$ denote the rows of $A$. \end{enumerate} \end{condition} Let us discuss these conditions in turn. \paragraph{Semismoothness.}{ The first two conditions, \ref{eqn:NewtI} and \ref{eqn:NewtII}, play a central role for ensuring superlinear convergence of Newton-type algorithms for nonsmooth equations. We refer the reader the monograph \cite[Chapter 10]{kk_book} for details. To place these conditions in context, recall that any locally Lipschitz and directionally differentiable map $F$ satisfies the first-order approximation property \cite{shapiro1990concepts}: \begin{equation}\label{eqn:b_der} F(y)=F(x)+F'(x,y-x)+o(\|y-x\|)\qquad \textrm{as } y\to x. \end{equation} Condition \ref{eqn:NewtI} instead asserts $$F(y)- F(x)-D(y,y-x)\subset o(\|y-x\|){\bf B}\qquad \textrm{as } y\to x.$$ Notice that contrary to \eqref{eqn:b_der}, the value $D(y,y-x)$ is computed at the basepoint $y$. Condition~\ref{eqn:NewtII} asserts instead $$F(x)- F(y)-D(y,x-y)\subset o(\|y-x\|){\bf B}\qquad \textrm{as } y\to x.$$ Clearly, when $D$ has the form $D(x,u)=J(x)u$ for some set-valued map $J\colon{{\bf R}}^n\to{\bf R}^{m\times n}$, conditions \ref{eqn:NewtI} and \ref{eqn:NewtII} are equivalent. In particular, if $F$ is directionally differentiable and $J(x)=\partial_C F(x)$ is the Clarke generalized Jacobian, both conditions reduce to the semismoothness property in the sense of \cite{mifflin1977semismooth,qi1993nonsmooth}. In the context of optimization, similar conditions have been used by Norkin \cite{norkin1980generalized,norkin1986stochastic} to establish asymptotic convergence guarantees of subgradient methods. } \paragraph{Conservative derivative.} Condition \ref{eqn:conserv} asserts that the generalized directional derivative $D$ satisfies a formal chain rule at almost every point along any absolutely continuous path $\gamma$. Equivalently, we may write condition \eqref{eqn:def_cons} as: $$\{F'(\gamma(t),\dot\gamma(t))\}=D(\gamma(t),\dot{\gamma}(t))\qquad \textrm{for a.e. } t\in (0,1).$$ This property is equivalent to the conservative derivatives $J(x)$ introduced in \cite{bolte2020conservative}, in the setting $D(x,u)=J(x)u$. Such generalized derivatives play a key role in justifying automatic differentiation techniques for nonsmooth functions \cite{bolte2020mathematical}, as well as for analyzing the asymptotic behavior of subgradient methods \cite{davis2020stochastic}. \paragraph{Stratified derivative/subdifferential}{ Condition~\ref{eqn:strat_der} is geometrically intuitive. It simply asserts that there exists a partition of ${\bf R}^n$ into finitely many smooth manifolds, so that $D(x,\cdot)$ coincides with the directional derivative in directions tangent to the manifold containing the point $x$. Condition~\ref{it:clarke_strat} can be interpreted as a ``dual'' counterpart of \ref{eqn:strat_der}. Namely it stipulates that $D(x,u)$ is a selection of the map $(x,u)\mapsto J(x)u$, where the rows of $J(x)$ consist of the Clarke subdifferentials of the component functions $F_i$ shifted by a normal space $N_M(x)$. The ``duality'' between conditions~\ref{eqn:strat_der} and~\ref{it:clarke_strat} is explored in \cite{Lewis-Clarke}.} \bigskip \subsection{Equivalence of \ref{eqn:NewtI}-\ref{it:clarke_strat}} The goal of our paper is to prove that if Assumption~\ref{ass:standing} holds and $F$ and $D$ are semialgebraic, then conditions \ref{eqn:NewtI}-\ref{it:clarke_strat} are equivalent. The authors of \cite{lewis2021structure}, building on \cite{bolte2020conservative}, recently proved the equivalence $\ref{eqn:conserv}\Leftrightarrow\ref{it:clarke_strat}$ for maps of the form $D(x,u)=J(x)u$ where $J(\cdot)$ locally bounded and outer-semicontinuous. Therefore we claim no originality with respect to the equivalence $\ref{eqn:conserv}\Leftrightarrow \ref{it:clarke_strat}$. We begin by proving that \ref{eqn:conserv} implies \ref{eqn:NewtI} and \ref{eqn:NewtII}. The following simple lemma will be useful. \begin{lemma}\label{lemm:directional_equal} Condition \ref{eqn:conserv} implies that for any absolutely continuous curve $\gamma\colon [0,1]\to {\bf R}^n$, equality holds: \begin{equation*} D(\gamma(t),\dot \gamma(t))=-D(\gamma(t),-\dot \gamma(t))\qquad \textrm{for a.e. } t\in (0,1). \end{equation*} \end{lemma} \begin{proof} Fix an absolutely continuous curve $\gamma\colon [0,1]\to {\bf R}^n$ and define $\alpha(t)=\gamma(1-t)$. Then $\dot\alpha(t)=-\dot\gamma(1-t)$ and $(F\circ\alpha)'(t)=-(F\circ\gamma)'(1-t)$ for a.e. $t\in (0,1)$. Plugging in $\alpha$ in place of $\gamma$ in \eqref{eqn:def_cons} completes the proof. \end{proof} \begin{theorem}[Conservative derivatives and semismoothness]\label{thm:cons_newton} Suppose that $F$ and $D$ are semialgebraic and that Assumption~\ref{ass:standing} holds. Then condition \ref{eqn:conserv} implies both \ref{eqn:NewtI} and \ref{eqn:NewtII}. Moreover, both implications are true if \ref{eqn:conserv} only holds with respect to semialgebraic curves $\gamma$. \end{theorem} \begin{proof} Suppose condition \ref{eqn:conserv} holds; we aim to verify \ref{eqn:NewtI}. To this end, fix a point $x$ and assume without loss of generality $x=0$ and $F(x)=0$. We aim to prove $$\operatornamewithlimits{Limsup}_{d\to0}~\frac{F(d)-D(d,d)}{\|d\|}=\{0\}.$$ For any $t\in [0,1]$ define the function $$\varphi(t):=\sup_{(d,v):~\|d\|= t,\, v\in D(d,d)} ~\|F(d)-v\|.$$ Condition~\ref{eqn:NewtI} will follow immediately once we establish $\varphi'(0)=0$. Clearly, we may assume $\varphi(t)>0$ for all small $t>0$, since otherwise the equality $\varphi'(0)=0$ holds trivially. Lemma~\ref{lem:semialgebraic_select} yields semialgebraic curves $d(\cdot)$ and $v(\cdot)$ satisfying $\|d(t)\|=t$, $v(t)\in D(d(t)$, $d(t))$ and $\|F(d(t))-v(t)\|\geq \frac{1}{2}\varphi(t)$ for all small $t>0$. Observe $d(0)=0$ and $\|d(t)\|/t=1$. Therefore Lemma~\ref{lem:semi_smooth_uni} shows that $d'(0)$ exists and $\lim_{t \to 0}\dot{d}(t)=d'(0)$. Note the inclusion $v(t)/t\in D(d(t),\frac{d(t)}{t})$. Local Lipschitz continuity of $D(x,\cdot)$, implies that there exists $L>0$ and a semialgebraic curve $w(t)$ satisfying $w(t)\in D(d(t),\dot d(t))$ with $$\left\|w(t)-\frac{v(t)}{t}\right\|\leq L\left\|\frac{d(t)}{t}-\dot d(t)\right\|$$ for all small $t>0$. Since the right side tends to zero as $t\searrow 0$, we compute \begin{align*} \varphi'(0)=\lim_{t\searrow 0}\frac{\varphi(t)}{t}&\leq \operatornamewithlimits{limsup}_{t\searrow 0}\frac{2\|F(d(t))-v(t)\|}{t}=2\cdot \operatornamewithlimits{limsup}_{t\searrow 0}\left\|\frac{F(d(t))}{t}-w(t)\right\|. \end{align*} Lemma~\ref{lem:semi_smooth_uni} and condition~\ref{eqn:conserv} guarantee \begin{align*} \lim_{t\searrow 0} w(t)=\lim_{t\searrow 0}(F\circ d)'(t)=\lim_{t\searrow 0}\frac{F(d(t))}{t}, \end{align*} Note that all the limits in the displayed equation exist due to the local monotonicity of semialgebraic functions. We conclude $\varphi'(0)=0$ and therefore condition~\ref{eqn:NewtI} holds. The proof of condition~\ref{eqn:NewtII} follows by identical reasoning, while taking into account Lemma~\ref{lemm:directional_equal}. \end{proof} Combining Theorem~\ref{thm:cons_newton} with Theorem~\ref{thm:proj_formula} immediately shows that semi-algebraic locally Lipschitz maps are semismooth with respect to the Clarke generalized Jacobian---the main result of \cite{bolte2009tame}. The proof just presented appears to be simpler and more direct than the original argument in \cite{bolte2009tame}. \begin{corollary}[Semi-algebraic maps are semismooth] Any locally Lipschitz semi-algebraic map $F\colon{{\bf R}}^n\rightrightarrows{\bf R}^m$ satisfies condition~\ref{eqn:NewtI} for the map $D(x,u)=\partial_C F(x)u$. \end{corollary} \begin{proof} Note the inclusion $\partial_C F(x)\subset \{A\in {\bf R}^{m\times n}: A_i\in \partial_C F_i(x)\}$. Let $\mathcal{A}_i$ be the partition ensured by Theorem~\ref{thm:proj_formula} for each coordinate function $F_i$. Using Theorem~\ref{thm:com_part}, let $\mathcal{A}$ be a semialgebraic partition that is compatible with each $\mathcal{A}_i$. Fix a semialgebraic curve $\gamma$. Semialgebraicity implies that for any $M \in \mathcal{A}$ and a.e.\ $t \in (0, 1)$ with $\gamma(t) \in M$, the inclusion $\dot\gamma(t) \in T_{M}(\gamma(t))$ holds. Consequently, condition \ref{eqn:conserv} holds with respect to all semialgebraic curves. An application of Theorem~\ref{thm:cons_newton} completes the proof. \end{proof} The proof of the full equivalence between conditions~\ref{eqn:NewtI}-\ref{it:clarke_strat} will make use of the following simple linear algebraic fact. \begin{lemma}\label{lem:line_alg} For any sets $A,B\subset{{\bf R}}^n$ and a subspace $V\subset{{\bf R}}^n$, the equivalence holds: $$A\subset B+V\qquad \Longleftrightarrow\qquad \proj(A,V^{\perp})\subset\proj(B,V^{\perp}).$$ \end{lemma} We now have all the ingredients to prove the main the result of the paper. \begin{theorem}[Equivalence]\label{thm:equiv_stat} Suppose that $F$ and $D$ are semialgebraic and that Assumption~\ref{ass:standing} holds. Then conditions~\ref{eqn:NewtI}-\ref{it:clarke_strat} are equivalent. \end{theorem} \begin{proof} We first establish the equivalences $\ref{eqn:NewtII}\Leftrightarrow\ref{eqn:conserv}\Leftrightarrow \ref{eqn:strat_der} \Leftrightarrow\ref{it:clarke_strat}$ by verifying the implications $\ref{eqn:conserv}\Rightarrow\ref{eqn:NewtII}\Rightarrow \ref{eqn:strat_der}\Rightarrow\ref{it:clarke_strat}\Rightarrow\ref{eqn:conserv}$. \smallskip \noindent{\textrm{\em Implication $\ref{eqn:conserv}\Rightarrow \ref{eqn:NewtII}$:}} This was proved in Theorem~\ref{thm:cons_newton}. \smallskip \noindent{\textrm{\em Implication $\ref{eqn:NewtII}\Rightarrow \ref{eqn:strat_der}$}:} Theorems~\ref{thm:gen_smooth} and \ref{thm:inner_semicont} yield a partition $\mathcal{A}$ of ${\bf R}^n$ into finitely many semialgebraic $C^1$ manifolds such that when restricted to each manifold $M\in \mathcal{A}$, the function $F$ is $C^1$-smooth and the map $$x\mapsto \gph D(x,\cdot)$$ is inner semicontinuous. Fix a manifold $M\in \mathcal{A}$, a point $x\in M$, unit tangent vector $u\in T_M(x)$, and $v\in D(x,u)$. Since $-u$ also lies in $T_M(x)$, we may find sequences $x_i \xrightarrow[]{M} x$ and $\tau_i\searrow 0$ with $\tau_i^{-1}(x_i-x)\to -u$. By inner-semicontinuity, there exist sequences $(u_i,v_i)$ converging to $(u,v)$ and satisfying $v_i\in D(x_i,u_i)$. The assumed condition~\ref{eqn:NewtII} therefore guarantees $$\{0\}=\operatornamewithlimits{Limsup}_{i\to 0}~ \frac{F(x_i)-F(x)+D(x_i,x-x_i)}{\|x_i-x\|}.$$ Rearranging and using linearity of $F'(x,\cdot)$ on $T_M(x)$ we deduce \begin{equation}\label{eqn:continue_dis} \{F'(x,u)\}=\{-F'(x,-u)\}=\operatornamewithlimits{Limsup}_{i\to \infty}~D\left(x_i,\frac{x-x_i}{{\|x-x_i\|}}\right). \end{equation} Taking into account local Lipschitz continuity of $D(y,\cdot)$ uniformly for all $y$ near $x$, we deduce that there exists $L>0$ and a sequence $z_i\in D\left(x_i,\frac{x-x_i}{{\|x-x_i\|}}\right)$ satisfying $$\left\|z_i-\frac{v_i}{\|u_i\|}\right\|\leq L \left\|\frac{x-x_i}{\|x-x_i\|}-\frac{u_i}{\|u_i\|}\right\|,$$ for all large indices $i$. Observe that the right side tends to zero. Continuing \eqref{eqn:continue_dis}, we deduce $$ \{F'(x,u)\}=\lim_{i\to\infty} z_i=\lim_{i\to\infty} \frac{v_i}{\|u_i\|}=\{v\}.$$ We have thus proved $D(x,u)=\{F'(x,u)\}$ for all $u\in T_M(x)$, and therefore \ref{eqn:strat_der} holds. \smallskip \noindent{\textrm{\em Implication $\ref{eqn:strat_der}\Rightarrow\ref{it:clarke_strat}$:}} Let $\mathcal{A}$ be the partition of ${\bf R}^n$ into $C^1$ semialgebraic manifolds stipulated by condition \ref{eqn:strat_der}. Using Theorem~\ref{thm:proj_formula} for each coordinate function $F_i$ and refining the partitions using Theorem~\ref{thm:com_part}, we arrive at a finite partition $\mathcal{A}'$ of ${\bf R}^n$ into $C^1$ semialgebraic manifolds that is compatible with $\mathcal{A}$ and satisfies $$\{F'_i(x,u)\}=\langle \partial_C F_i(x),u\rangle,$$ whenever $x$ lies in $M\in\mathcal{A}'$ and $u\in T_M(x)$ is a tangent vector. Since for any such vector $u$, equality $\{F'(x,u)\}=D(x,u)$ holds by $\ref{eqn:strat_der}$, we conclude $$D(x,u)=J(x)u\qquad \forall u\in T_M(x).$$ On the other hand, for any $u\notin T_M(x)$, we trivially have $$J_i(x)u=\langle \partial_C F_i(x),u\rangle +\langle N_M(x),u\rangle=\langle \partial_C F_i(x),u\rangle+{\bf R}={\bf R},$$ where $J_i(x)$ denotes the set of all $i$'th rows of matrices in $J(x)$. Therefore, in this case, the inclusion $D(x,u)\subset J(x)u$ holds trivially. \smallskip \noindent{\textrm{\em Implication $\ref{it:clarke_strat}\Rightarrow\ref{eqn:conserv}$:}} Let $\mathcal{A}$ be the partition of ${\bf R}^n$ into $C^1$ semialgebraic manifolds stipulated by condition \ref{it:clarke_strat}. Refining the partition using Theorems~\ref{thm:proj_formula} and~\ref{thm:com_part}, we may ensure that the equality holds: $$\{F'(x,u)\}=J(x)u \qquad \forall u\in T_M(x),$$ whenever $x$ lies in some manifold $M\in \mathcal{A}$. Consider now any absolutely continuous curve $\gamma\colon [0,1]\to{{\bf R}}^n$. It is elementary to verify that for a.e. $t\in (0,1)$ the implication holds (e.g. \cite[Lemma 4.13]{DIL}): \begin{equation}\label{eqn:implication_tan} \gamma(t)\in M\quad \Longrightarrow \quad \dot{\gamma}(t)\in T_{M}(\gamma(t)). \end{equation} We conclude that for a.e. $t\in (0,1)$ and $M\in\mathcal{A}$ satisfying $\gamma(t)\in M$, we have $$\left\{\frac{d}{dt}(F\circ \gamma)(t)\right\}=\{F'(\gamma(t),\dot{\gamma}(t))\}=J(\gamma(t))\dot\gamma(t)\supset D(\gamma(t),\dot{\gamma}(t)),$$ as claimed. Summarizing, we have proved the equivalence $\ref{eqn:NewtII}\Leftrightarrow\ref{eqn:conserv}\Leftrightarrow \ref{eqn:strat_der}\Leftrightarrow\ref{it:clarke_strat}$. Next, observe that \ref{it:clarke_strat} holds for a map $D(\cdot,\cdot)$ if and only if it holds for the map $\hat D(x,u):=-D(x,-u)$. Noting that condition \ref{eqn:NewtII} for $\hat D$ coincides with condition \ref{eqn:NewtI} for $D$ completes the proof of the theorem. \end{proof} \bibliographystyle{plain}
\section{Introduction \label{Intro}} The single band \ $t$-$J$ \ model \disp{tJ},\cite{tJname,Zhang-Rice}, and the closely related strong coupling Hubbard model have attracted much attention in recent years. In large part the interest is due to the potential relevance of these models in describing the phenomenon of High $T_c$ superconductivity, discovered in cuprate materials in 1987 \cite{Bednorz} and later, in other materials. These models lead to a single sheet of the fermi surface, and are specified by fixing the band hopping $t$ and the exchange energy $J$ for the \ $t$-$J$ \ model, or equivalently $4 t^2/U$ for the strong coupling ($U\gg t$) Hubbard model, \textcolor{black}{where the interaction is given by $V_{Hub.}= U \sum_i n_{i \downarrow} n_{i \uparrow}$}. The exotic possibility of superconductivity arising from such inherently repulsive systems, is surprising from a theoretical perspective, and also challenging. \textcolor{black}{ Significant theoretical work using a variety of tools on the strong coupling Hubbard model and the extremely strong coupling \ $t$-$J$ \ models }\cite{Hirsch,Anderson, BZA,Kotliar,Gros,Yokoyama,Mele,Mohit,Rice,Giamarchi,Ogata,Num-5,TVR} has given useful insights into the role of strong correlations in cuprate superconductivity. However given the non-triviality of the theoretical task of \textcolor{black}{ analytically solving these models, progress in that direction has been slow.} \textcolor{black}{ In this work we extend the extremely correlated fermi liquid theory (ECFL) \cite{ECFL,ECFL-AOP-1} recently formulated to overcome the analytical difficulties of the strong coupling models, to include superconducting type broken symmetry. Upon cooling the normal metallic state, a superconducting instability is expected to arise, and our main goal in this study is to determine the conditions for the occurrence of this state, and to provide its detailed description.} \textcolor{black}{ In order to motivate these calculations of the superconducting state, it is useful to summarize the main features of ECFL theory as applied to the normal (non-superconducting) state so far. We provide a broad overview next, further details can be found in \refdisp{ECFL,ECFL-AOP-1}. } \textcolor{black}{ The methodology developed in this theory starts with exact functional differential equations for the various Greens function, obtained using the Tomonaga-Schwinger approach of external potentials. These equations incorporate the modification of the anti-commutation relations between the fermion operators due to Gutzwiller projection (see \disp{anticommutator}). While providing a formally exact starting point for us, these equations are not yet amenable to systematic approximations. The core difficulty is that an additional set of terms arise from this modified non-canonical anticommutator structure \disp{anticommutator}. These non-canonical terms multiply the most singular term in the equation, namely the Dirac delta function (originating in the time derivative of the time ordering $\Theta$ functions in the Greens functions). For an explicit example, note the $\gamma$ term multiplying the delta function in \disp{G0XY}.} \textcolor{black}{ In order to make progress, we therefore need to go beyond the established framework of Tomonaga-Schwinger. The first development in ECFL is that the above inconvenient feature of a non-canonical coefficient of the delta function, is eliminated by factoring the Greens function into two parts, the auxiliary Greens function ${\bf g}$ and the caparison function $\widetilde{\mu}$ (see \disp{factorize} and the discussion in the text following it). The auxiliary Greens function ${\bf g}$ now satisfies a canonical equation (as in \disp{new-1} by ignoring the term involving ${\bm f}$), while the caparison function $\widetilde{\mu}$ accounts for the non-canonical nature of the original equation (as in \disp{new-2}). This factorization process and the resulting equations are exact. } \textcolor{black}{ As the next development, we introduce a parameter $\lambda$ in the range $0\leq \lambda \leq 1$ into these exact equations. Setting $\lambda$$=$$0$ gives the uncorrelated system, while $\lambda$$=$$1$ gives the exact equations of the strongly correlated system. The $\lambda$ parameter has a formal similarity to the expansion parameter $\frac{1}{2 S}$ used in the Dyson-Maleev (or Holstein-Primakoff) formulations \cite{DM,HP} of the spin-wave theory of magnets. The magnetic models involve spin operators satisfying the SU(2) (angular momentum) Lie algebra. They can be approached using different strategies. On the one hand we may think of spins as canonical bosons with a constraint on their occupation number $n^b_{i}$ at any site $i$, namely $n^b_i=0,1,\ldots 2S$. This constraint can be implemented using a repulsive interaction between bosons $U n^b_i (n^b_i-1)\ldots (n^b_i-2S)$, and finally letting $U$$\to$$ \infty$. This bosonic Hubbard model is difficult to solve, since the large energy scale $U$ makes the use of perturbation theory impractical. On the other hand we can employ the Dyson-Maleev (or Holstein-Primakoff) non-linear mappings to bosons, and expand the relevant Heisenberg equations of motion in a series in $\frac{1}{2 S}$. This gives an efficient way of solving the models to considerable precision at fairly low orders in $\frac{1}{2 S}$. This latter method is parallel to the $\lambda$ expansion employed here, since the modified anticommutators \disp{anticommutator} also yield a (non-canonical) Lie algebra.This analogy is discussed further in \refdisp{ECFL-AOP-1} (Sec. 6). In a different setting, the parameter $\lambda$ can also be related to the fraction of doubly occupied states \cite{ECFL-Formalism} (see Appendix. A). } \textcolor{black}{ The parameter $\lambda$ serves two important and related objectives. Firstly it provides a continuous path between the uncorrelated and the fully correlated system equations. Since $0\leq \lambda\leq 1$, dialing it up from $0$ does not involve invoking a large energy scale, unlike for example, dialing up $U$ in the Hubbard model. This (isothermal) continuity enables the ECFL method to retain the ideal (i.e. non-interacting) fermi surface volume at low T. This ideal volume is expected for weakly interacting fermi systems from the Luttinger-Ward perturbative arguments \cite{Luttinger}, and importantly, survives the transition to extremely strongly correlated regions, as argued recently using non-perturbative arguments \cite{Shastry-FS-Volume}. Lastly, the ideal volume is also seen in photoemission studies of overdoped and optimally doped cuprate superconductors in the normal state \cite{ARPES-Luttinger-Ward}, which provide a useful starting point for our study.} \textcolor{black}{ The second aspect of $\lambda$ is that it can be used to organize a systematic power series expansion, analogous in spirit to the skeleton graph expansion of Dyson \cite{Dyson} in perturbative theories. This $\lambda$ expansion can be carried out order by order, leading to a set of successive equations that are amenable to numerical study. A question might arise, whether a low order calculation in this expansion can capture the strongly correlated limit. For answering this, it is useful to examine the results for the $d=\infty$ Hubbard model at $U=\infty$, where numerically exact results are available from the dynamical mean field theory \cite{DMFT}. The $\lambda$ expansion to ${\cal O}(\lambda^2)$ is compared with the exact numerical result from the dynamical mean field theory \cite{Rok}, in Fig.~(6) of \refdisp{Shastry-Perepelitsky}. This shows that the calculated quasiparticle weight $Z$ vanishes upon approaching a density of $1$-particle per site, i.e. half filling. This vanishing is a hallmark of the strong correlation limit, where the Mott-Hubbard insulating state is realized. In the above $d=\infty$ study, and also in the case of the 2-dimensional \ $t$-$J$ \ model \cite{Resistivity,NJP,PRB-MaiShastry}, the $\lambda$ expansion describes an extremely correlated Fermi liquid state, characterized by a small quasiparticle weight that vanishes near the Mott-Hubbard insulator, accompanied by a rich set of low energy scales located above the (strongly suppressed) effective fermi temperature. The ${\cal O}({\lambda}^2)$ equations for the normal state have been applied to calculations of the asymmetric photoemission lines\cite{Gweon,NJP,PRB-MaiShastry}, and most recently the calculation of the almost T-linear resistivity in single layer cuprates\cite{Resistivity}. } \textcolor{black}{ In this paper we extend the above formalism to the case where superconducting order emerges at low temperatures. This requires a non-trivial generalization to the superconducting state of the various steps of the ECFL theory highlighted above. In a similar fashion to the normal state, we first obtain exact equations for the normal and anomalous Greens functions for the \ $t$-$J$ \ model. These equations generalize Gor'kov's equations for BCS type weak coupling superconductivity\cite{Gorkov} by including the effect of extremely strong local repulsion between electrons. These equations are studied further using a specific decomposition of the Greens functions into two pieces (see \disp{factorize}). This step is followed by a systematic expansion in a parameter $\lambda$. This leads to an set of equations \disp{new-1,new-2,new-3}, iterating these in $\lambda$ to all orders constitutes the exact answer. In the present work, we perform a leading order calculation. } \textcolor{black}{ In order to obtain explicit results, \disp{new-1,new-2,new-3} are further simplified near $T_c$ where the order parameter is small, leading to simplified versions of these in \disp{new-4,new-5,new-6}. These are treated to ${\cal O}({\lambda}^2)$, and the lowest order condition for $T_c$ is formulated in \disp{Tc1}. In summary \disp{Tc1} is the leading order term near $T_c$, within the $\lambda$ expansion, and constitutes an important formal result of the present work. In principle it should be possible to find further systematic equations to higher order, and also to extend the results for $T\ll T_c$ following the procedure laid out here. In this work we are content to study this first set in detail. The transition temperature is given from \disp{Tc1}, which is expressed in terms of the electronic Greens function, renormalized by strong correlations. In this renormalization the short ranged Hubbard-Gutzwiller terms are dominant, and the pairing energy causing the instability, is provided by the much smaller exchange energy $J$. This equation exhibits both a tendency towards an insulating state due to a diminished quasiparticle weight, and a tendency towards superconductivity due to the exchange term $J$. Their competing tendencies play out in \disp{Tc1} and the closely related \disp{Tc2}. These equations determine whether superconductivity is found at all, and further identifies the model parameters that promote it. When the superconducting state is found, they also provides an estimate of the range of densities and temperatures which favor it. } The conditions \disp{Tc1,Tc2} are evaluated using a simple phenomenological electronic spectral function, modeling strong correlations near half filling in terms of a density dependent quasiparticle weight $Z$ and a wide background. This model has the advantage of leading to an explicit analytical formula for $T_c$, in terms of the various parameters of the \ $t$-$J$ \ model, thus allowing for a thorough understanding of the role of different parameters on the result. Evaluating this expression we find that the model supports a d-wave superconducting phase consistent with data \cite{d-wave-experiment,d-wave-review}, located away from half filling. The $T_c$ is found to be typically $\sim$$10^2$K, i.e. an order of magnitude smaller than that of the model \disp{unctJ} \textcolor{black}{where the sole difference from the \ $t$-$J$ \ model is that short ranged Hubbard-Gutzwiller type correlations are ignored}, in a range of densities determined by the band parameters. The temperature-density phase diagram has the form of a tapered tower \figdisp{Fig-1-Tc}. A smooth dome structure reported in cuprates, is replaced here by a somewhat narrow density range and an exaggerated height near the peak. The location of the peak can be varied by choosing the hopping parameters, but always remains well-separated from the insulating limit. The paper is organized as follows. In Section (\ref{Preliminaries}) we define the \ $t$-$J$ \ Hamiltonian, express it in terms of the correlated fermionic operators, and outline the method of external potentials employed to generate the exact dynamical equations for the electron Greens function ${\cal G}$ and the Gor'kov anomalous Greens function ${\cal F}$. In Section (\ref{lambdaexpansion}) the equation is expanded in $\lambda$ and further simplified near $T_c$. In Section (\ref{EquationforTc}) the condition for $T_c$ is evaluated using a model spectral function. This section contains expressions that involve only the electronic spectral function, and might be directly accessible to readers who are more interested in the concrete results. In Section (\ref{Conclusions}) we conclude with a discussion of the results. \section{Theoretical Preliminaries \label{Preliminaries}} The \ $t$-$J$ \ Hamiltonian \cite{tJname,Zhang-Rice} is \begin{eqnarray} H_{\mbox{ tJ}}&=&H_{\mbox{t}}+H_{\mbox{J}} \label{tJ} \\ H_{\mbox t}&=& -\sum_{ij \sigma} t_{ij} \widetilde{c}^\dagger_{i \sigma} \widetilde{c}_{j \sigma} - {\bm \mu} \sum_i n_i \nonumber \\ H_{\mbox{J}}&=& \frac{1}{2} \sum_{ij} J_{ij} (\vec{S}_i.\vec{S}_j - \frac{n_i n_j}{4}) \nonumber \end{eqnarray} \textcolor{black}{where $t_{ij}$ are the band hopping matrix elements detailed below, $J_{ij}$ the nearest neighbor exchange and ${\bm \mu}$ the chemical potential, } with the density operator $n_i = \sum_\sigma \widetilde{c}^\dagger_{i \sigma}\widetilde{c}_{i \sigma}$, and spin density operator $S_i^\alpha =\frac{1}{2} \sum_{\sigma \sigma'} \widetilde{c}^\dagger_{i \sigma} \tau^\alpha_{\sigma \sigma'}\widetilde{c}_{i \sigma'}$, $\tau^\alpha$ is a Pauli matrix and the correlated fermi destruction operator $\widetilde{c}_i$ is found from the plain (i.e. canonical or unprojected) operators $c_i$, by sandwiching it between two Gutzwiller projection operators $\widetilde{c}_{i \sigma}=P_G c_{i \sigma} P_G$, \textcolor{black}{where $P_G\equiv \prod_j(1-n_{j \uparrow} n_{j \downarrow})$ \cite{Gutzwiller}. It acts by eliminating all states with double occupancy in the state space.} The creation operators follow by taking their hermitean conjugate. The physical meaning of this sandwiching process is that the fermi operators act within the subspace where projector $P_G$ enforces single occupancy at each site. \textcolor{black}{The \ $t$-$J$ \ model may be obtained by taking the large $U$ limit of the Hubbard model \cite{tJname}. It has also been argued \cite{Zhang-Rice} to be the low energy effective Hamiltonian for an underlying three-band model, describing the copper oxygen lattice of the cuprate superconductors, where it is found by eliminating high energy states of the model. } In the following work we will also find it useful to study the model \begin{eqnarray} H_{\mbox{unc-tJ}}= -\sum_{ij} t_{ij} {c}^\dagger_{i \sigma} {c}_{j \sigma} - {\bm \mu} \sum_i n_i + \frac{1}{2} \sum_{ij} J_{ij} (\vec{S}_i.\vec{S}_j - \frac{n_i n_j}{4}). \label{unctJ} \end{eqnarray} \textcolor{black}{We may view it as an {\em uncorrelated \ $t$-$J$ \ model} in contrast to the correlated version \disp{tJ}, here the ultra strong short ranged Hubbard-Gutzwiller correlations with $U \gg \mbox{max} \{ |t_{ij}|\}$ are turned off, while the relatively weak exchange term $J\ll \mbox{max} \{ |t_{ij}|\}$ is retained. All operators that appear in \disp{unctJ}, including the density and spin, are defined by the same expression as \disp{tJ} but with the unprojected fermion operators $c_{i \sigma}, c^\dagger_{i \sigma}$'s. In this model the exchange term, which is usually viewed as the mechanism for antiferromagnetism, doubles up to play the role of a superconducting pairing potential. This fruitful observation of Anderson, Baskaran and Zou\cite{Anderson,BZA} follows from viewing the interaction in the crossed or Cooper channel. It is paralleled in our discussion later (see paragraph below \disp{exchange-2}), where the exchange term, after a rearrangement amounting to a crossed channel, leads to a mean Cooper pair expectation in \disp{exchange-3}. Its superconducting solution, found by standard BCS-Gor'kov meanfield theory, is presented below (see \dispmany{Tcuncorr,g}), and serves as a useful reference point in the study of the strongly correlated \ $t$-$J$ \ model. } It is convenient for our calculations to use the operators invented by Hubbard \refdisp{Hubbard,Ovchinnikov} to represent this projection process. \textcolor{black}{ \refdisp{Edward} (Sec.8) discusses the origin of difficulties of the early work employing the Hubbard operators, in reproducing the Luttinger-Ward Fermi surface volume at low temperatures. In contrast the present ECFL formalism achieves this goal successfully, using continuity with the Fermi gas and the $\lambda$ expansion described in \cite{ECFL, Edward} and below.} We denote \begin{eqnarray} \widetilde{c}^\dagger_{i \sigma} \leftrightarrow X_i^{ \sigma 0}, \; \widetilde{c}_{i \sigma} \leftrightarrow X_i^{0 \sigma}, \; \widetilde{c}^\dagger_{i \sigma} \widetilde{c}_{i \sigma'} \leftrightarrow X_i^{\sigma \sigma'}. \end{eqnarray} These operators satisfy the following fundamental anti-commutation relations and their adjoints: \begin{eqnarray} \{X_i^{0 \sigma_i}, X_j^{0 \sigma_j } \}&=&0\\ \{X_i^{0 \sigma_i}, X_j^{\sigma_j 0} \}&=& \delta_{ij} \left( \delta_{\sigma_i \sigma_j}- \sigma_i \sigma_j X_i^{\bar{\sigma}_i \bar{\sigma}_j} \right), \;\;\bar{\sigma}=-\sigma. \label{anticommutator} \end{eqnarray} In physical terms, for a given site index $i$ and with $\{a,b\} \in$ $\{0, \uparrow, \downarrow\}$ limited to the three allowed initial and final states of the projected Hilbert space, the symbol $X_i^{ab}$ represents an operator representing all allowed matrix elements. To yield the correct fermion antisymmetry, the creation operator $X_i^{\sigma_i, 0}$ anti-commutes with creation or destruction operators at {\em different} sites with any spin. In terms of these operators we can rewrite \begin{eqnarray} H_t&=& - \sum_{ij \, \sigma} t_{ij} X_i^{\sigma 0} X_{j}^{0 \sigma} -{\bm \mu} \sum_{i \, \sigma} X_i^{\sigma \sigma}\label{Ht}\\ H_J&=&= - \frac{1}{4} \sum_{ij \, \sigma_i \sigma_j} J_{ij} \sigma_i \sigma_j X_i^{\sigma_i \sigma_j} X_j^{\bar{\sigma}_i \bar{\sigma}_j}. \label{HJ} \end{eqnarray} \textcolor{black}{In the following we employ a convenient repeated internal spin summation convention. We shall follow the convention that in an equation defining any object, often (but not always) indexed by external spin indices, all the {\em internal and repeated} spin indices are to be summed over. As an example, we could drop the explicit summation over spins in \disp{Ht,HJ}, but not in \disp{anticommutator} where $\sigma_i,\sigma_j$ are external spin indices that appear on the left hand side. We also use a repeated internal site index below. } In order to calculate the Greens functions for this model, we add an imaginary time $\tau$ dependent external potential (or source term) ${\cal A}$ to the definition of thermal averages. The expectation of an arbitrary observable $Q(\tau_1,\ldots)$, composed e.g. of a product of several (imaginary) time ordered Heisenberg picture operators, is written in the notation \begin{eqnarray} \langle\langle Q(\tau_1,\ldots) \rangle\rangle= Tr\; P_\beta \; T_\tau \{ e^{-{\cal A}} Q(\tau_1,\ldots) \}. \label{Bracket} \end{eqnarray} Here $T_\tau$ is the time-ordering operator, an external potential term ${\cal A}= \int_0^\beta d\tau {\cal A}(\tau)$, and $P_\beta = e^{-\beta H} /{Tr \left( e^{-\beta H} T_\tau e^{-{\cal A}}\right)} $ is the Boltzmann weight factor including ${\cal A}$. Here ${\cal A}(\tau) $ is a sum of two terms, ${\cal A}_{\rho}(\tau)$ involving a density-spin dependent external potential ${\cal V}$, and $ {\cal A}_C(\tau)$ involving ${\cal J}$ (${\cal J}^*$) Cooper pair generating (destroying) external potentials. These are given by \begin{eqnarray} {\cal A}_{\rho}(\tau)& =& \sum_i {\cal V}_i^{\sigma_i \sigma_j}(\tau) X_i^{\sigma_i \sigma_j}(\tau) \nonumber \\ {\cal A}_{C}(\tau)& =&\frac{1}{2} \sum_{ij} \left( {\cal J}^*_{ j\sigma_j i\sigma_i}(\tau) X_i^{0\sigma_i}(\tau) X_j^{0 \sigma_j}(\tau) +{\cal J}_{i\sigma_i j\sigma_j}(\tau) X_i^{\sigma_i 0}(\tau) X_j^{ \sigma_j 0}(\tau) \right), \nonumber \\ \label{Sources} \end{eqnarray} \textcolor{black}{where the repeated internal spin convention implies summing over $\sigma_i,\sigma_j$, and} where we require the antisymmetry ${\cal J}_{i \sigma_i; j \sigma_j}=-{\cal J}_{j \sigma_j; i \sigma_i}$ and likewise for ${\cal J}^*$. The external potentials ${\cal J}, {\cal J}^*$ in \disp{Sources} couple to operators that add and remove Cooper pairs of correlated electrons, and are essential to describe the superconducting phase. At the end of the calculations, the external potentials are switched off, so that the average in \disp{Bracket} reduces to the standard thermal average. Tomonaga\cite{Tomonaga} in 1946 and Schwinger\cite{Schwinger} in 1948 (TS) pioneered the use of such external potentials \cite{Dyson,Martin}. We next illustrate this technique for the present problem. \subsection{Using external potentials \label{ExternalPotentials}} The advantage of introducing these external potential ( or ``sources'') is that we can take the (functional) derivatives of Greens function with respect to the added external potentials in order to generate higher order Greens functions. If we abbreviate the external term as ${\cal A}= \sum_i {\cal U}_j(\tau) V_j(\tau)$, where ${\cal U}_j(\tau)$ is one of the above c-number potential, and $V_j(\tau)$ is the corresponding operator in the imaginary-time Heisenberg picture, and $Q_i(\tau)$ an arbitrary observable, straightforward differentiation leads to the TS identity \begin{eqnarray} Tr P_\beta T_\tau \{ e^{-{\cal A}} Q_i(\tau') V_j(\tau) \}=\langle\langle Q_i(\tau')\rangle\rangle \; \langle\langle V_j(\tau) \rangle\rangle - \frac{\delta}{\delta {\cal U}_i(\tau)} \langle\langle Q_i(\tau')\rangle\rangle \label{TS} \end{eqnarray} This important identity can be found by taking the functional derivative of \disp{Bracket} with respect to ${\cal U}_j(\tau)$ (see e.g. \refdisp{ECFL-Formalism} Eq.~(18)), and is now illustrated with various choices of the external potential. From \disp{TS} we note the frequently used result \begin{eqnarray} \langle\langle \sigma_i \sigma_j X_i^{\bar{\sigma}_i \bar{\sigma}_j}(\tau) Q(\tau') \rangle\rangle = \left(\gamma_{\sigma_i\sigma_j}(i \tau) - {\cal D}_{\sigma_i\sigma_j}(i \tau) \right) \langle\langle Q(\tau')\rangle\rangle \label{CalD} \end{eqnarray} where \begin{eqnarray} \gamma_{\sigma_i \sigma_j}(i, \tau)&=& \sigma_i \sigma_j \langle\langle X_i^{\bar{\sigma}_i \bar{\sigma}_j}(\tau) \rangle\rangle \nonumber \\ {\cal D}_{\sigma_i \sigma_j}(i, \tau))&=&\sigma_i \sigma_j \frac{\delta}{\delta {\cal V}_i^{\bar{\sigma}_i \bar{\sigma}_j}(\tau)}, \label{Def-gamma} \end{eqnarray} The singlet Cooper pair operator is \begin{eqnarray} \left(X_i^{ 0 \uparrow} X_j^{0 \downarrow }- X_i^{0 \downarrow } X_j^{ 0 \uparrow}\right)= \sigma X_i^{0 \sigma} X_j^{0 \bar{\sigma}}, \end{eqnarray} where summation over $\sigma$ is implied on the right hand side, and its Hermitean conjugate \begin{eqnarray} -\left(X_i^{ \uparrow 0} X_j^{ \downarrow 0}- X_i^{ \downarrow 0 } X_j^{ \uparrow 0}\right)= \bar{\sigma} X_i^{ \sigma 0} X_j^{ \bar{\sigma} 0}. \end{eqnarray} We define the (singlet) Cooper pair correlation functions at time $\tau$ as \begin{eqnarray} C_{ij}(\tau)= \langle\langle \sigma X_i^{0\sigma}(\tau) X_j^{0 \bar{\sigma}}(\tau)\rangle\rangle \label{Cij}\\ C^*_{ij}(\tau)= \langle\langle \bar{\sigma} X_i^{\sigma 0}(\tau) X_j^{ \bar{\sigma} 0}(\tau)\rangle\rangle \label{Cijstar}, \end{eqnarray} \textcolor{black}{where $\sigma$ is summed over.} We note that $C^*_{ij}$ equals the complex conjugate of $C_{ij}$ only after the external potentials are finally turned off, but not so in the intermediate steps. The basic equation \disp{TS} for the Cooper pair operators for an arbitrary operator $Q$ are \begin{eqnarray} \frac{\delta}{\delta {\cal J}^*_{i \sigma_i j \sigma_j}(\tau)}\langle\langle Q\rangle\rangle= \langle\langle X_j^{0\sigma_j}(\tau) X_i^{0 \sigma_i}(\tau)\rangle\rangle \langle\langle Q\rangle\rangle -\langle\langle X_j^{0\sigma_j}(\tau) X_i^{0 \sigma_i}(\tau) Q\rangle\rangle \\ \frac{\delta}{\delta {\cal J}_{i \sigma_i j \sigma_j}(\tau)}\langle\langle Q\rangle\rangle= \langle\langle X_i^{0 \sigma_i}(\tau) X_j^{0\sigma_j}(\tau)\rangle\rangle \langle\langle Q\rangle\rangle -\langle\langle X_i^{0 \sigma_i}(\tau) X_j^{0\sigma_j}(\tau) Q\rangle\rangle \end{eqnarray} From these relations the Cooper-pair correlations can be found by summing over the spins \begin{eqnarray} \langle\langle \sigma X_i^{0\sigma}(\tau) X_j^{0 \bar{\sigma}}(\tau) Q \rangle\rangle = \left[ C_{ij}(\tau)-{\cal K}_{ij}(\tau) \right] \langle\langle Q \rangle\rangle \label{Kappa} \\ \langle\langle \bar{\sigma} X_i^{\sigma 0}(\tau) X_j^{ \bar{\sigma} 0}(\tau) Q \rangle\rangle = \left[ C^*_{ij}(\tau)-{\cal K}^*_{ij}(\tau) \right] \langle\langle Q \rangle\rangle \label{Kappastar} \end{eqnarray} where \begin{eqnarray} {\mathcal K}_{ij}(\tau)=\bar{\sigma} \frac{\delta}{\delta{\cal J}^*_{i \sigma; j \bar{\sigma}}(\tau)} \\ {\cal K}^*_{ij} = \bar{\sigma} \frac{\delta}{\delta{\cal J}_{i \sigma; j \bar{\sigma}}(\tau)}, \end{eqnarray} \textcolor{black}{where $\sigma$ is summed over.} \subsection{Greens functions and their dynamical equations \label{EOMs}} We are interested in the electron Greens function \textcolor{black}{ (see e.g. \refdisp{ECFL-Formalism} Eq.~(17)) expressed compactly by} \begin{eqnarray} {\cal G}_{i \sigma_i j \sigma_f}(\tau,\tau')= - \langle\langle X_i^{0 \sigma_i}(\tau) X_j^{\sigma_f 0 }(\tau') \rangle\rangle, \label{eq-G} \end{eqnarray} where the \textcolor{black}{Dyson time ordering $T_\tau$ and the external potential factor $e^{-{\cal A}}$ are} included in the definition of the brackets \disp{Bracket}. To describe the superconductor, following Gor'kov \cite{Gorkov} we define the anomalous Greens function : \begin{eqnarray} {\cal F}_{i \sigma_i j \sigma_f}(\tau,\tau')= \bar{\sigma}_i \langle\langle X_i^{ \bar{\sigma}_i 0}(\tau) X_j^{\sigma_f 0 }(\tau') \rangle\rangle \label{F} \end{eqnarray} where $\bar{\sigma}\equiv -\sigma$, \textcolor{black}{and as in \disp{eq-G}, the Dyson time ordering $T_\tau$ and the external potential factor $e^{-{\cal A}}$ are} included in the definition of the brackets \disp{Bracket} We note that the Cooper pair correlation functions \disp{Cijstar}, which plays a crucial role in defining the order parameter of the superconductor, can be expressed in terms of the anomalous Greens function using \begin{eqnarray} C^*_{ij}(\tau)&=& {\cal F}_{i \sigma j \sigma}(\tau,\tau), \label{cstarf} \end{eqnarray} where $\sigma$ is to be summed over, as per the convention used. We will also need the equal time correlation of creation operators ${C}_{ij}(\tau)$ \disp{Cij}. It is straightforward to show that when the external potentials ${\cal A}$ are switched off, this object is independent of $\tau$ and can be obtained by complex conjugation of $C_{ij}^*$. It is possible to add another anomalous Greens function with two destruction operators as in \disp{F}, corresponding to Nambu's generalization of Gor'kov's work. In the present context it adds little to the calculation and is avoided by taking the complex conjugate of ${C}^*_{ij}$ to evaluate ${C}_{ij}$. \subsubsection{Greens function ${\cal G}$ \label{EOM-G}} The equations for the Greens functions follow quite easily from the Heisenberg equations, followed by the use of the identity \disp{TS}, and has been discussed extensively by us earlier. There is one new feature, concerning an alternate treatment of the $H_J$ (exchange) term, necessary for describing superconductivity described below. \textcolor{black}{In this section we make use of the internal repeated site index summation convention quite extensively.} Taking the $\tau$ derivative of ${\cal G}$ we obtain \begin{eqnarray} \partial_{\tau} \langle\langle X_i^{0 \sigma_i}(\tau) X_f^{\sigma_f 0}(\tau') \rangle\rangle =\delta(\tau-\tau') \delta_{if} (\delta_{\sigma_i \sigma_f} - \gamma_{\sigma_i \sigma_f}(i \tau) ) \nonumber \\ + \langle\langle[H_t+H_J+{\cal A}(\tau),X_i^{0 \sigma_i}(\tau)]\;\; X_f^{\sigma_f 0}(\tau')\rangle\rangle \end{eqnarray} We work on the terms on the right hand side. At time $\tau$ we note \begin{eqnarray} [H_t+{\cal A}_{\rho},X_i^{0 \sigma_i}]= {\bm \mu} X_i^{0 \sigma_i} - {\cal V}_i^{\sigma_i \sigma_j} X_i^{0 \sigma_j} +t_{ij} (\delta_{\sigma_i \sigma_j}- \sigma_i \sigma_j X_i^{\bar{\sigma}_i \bar{\sigma}_j}) X_j^{0 \sigma_j}, \end{eqnarray} \textcolor{black}{where the repeated internal indices $\sigma_j$ and $j$ are summed over}. From this basic commutator, using \disp{TS}, \disp{CalD} and the definitions \disp{Def-gamma} we obtain \begin{eqnarray} \langle\langle[H_t+{\cal A}_{\rho} (\tau),X_i^{0 \sigma_i}(\tau)]\;\; X_f^{\sigma_f 0}(\tau')\rangle\rangle =\left( {\bm \mu} \delta_{\sigma_i \sigma} - {\cal V}_i^{\sigma_i \sigma} \right) \langle\langle X_i^{0 \sigma}(\tau) X_f^{\sigma_f 0}(\tau')\rangle\rangle \nonumber \\ + t_{ij} \langle\langle X_j^{0 \sigma_i}(\tau) X_f^{\sigma_f 0}(\tau')\rangle\rangle - t_{ij} ( \gamma_{\sigma_i \sigma}(i, \tau)- {\cal D}_{\sigma_i \sigma}(i, \tau))\langle\langle X_j^{0 \sigma}(\tau) X_f^{\sigma_f 0}(\tau')\rangle\rangle, \end{eqnarray} \textcolor{black}{where the repeated spin index $\sigma$, and the site index $j$ are summed over, while $\sigma_i,\sigma_f$ and site indices $i,f$ are held fixed.} For the exchange term \begin{eqnarray} [H_J,X_i^{0 \sigma_i }]&=& \frac{1}{2} J_{ij} \sigma_i \sigma \; X_i^{ 0 \sigma } X_j^{ \bar{\sigma}_i \bar{\sigma} } \label{exchange-1} \\ &=& - \frac{1}{2} J_{ij} \sigma_i X_j^{ \bar{\sigma}_i 0} \left(X_i^{ 0 \uparrow} X_j^{0 \downarrow }- X_i^{0 \downarrow } X_j^{ 0 \uparrow}\right), \label{exchange-2} \end{eqnarray} \textcolor{black}{where the repeated internal indices $\sigma$ and $j$ are summed over}. In order to obtain \disp{exchange-2} from \disp{exchange-1}, we used $X_j^{\bar{\sigma}_i \bar{\sigma}} =X_j^{ \bar{\sigma}_i 0} X_j^{0 \bar{\sigma} }$ and anticommuted the equal time operators $X_i^{ 0 \sigma } X_j^{\bar{\sigma}_i 0} $ into $- X_j^{\bar{\sigma}_i 0} X_i^{ 0 \sigma } $, followed by \textcolor{black}{an explicit sum} over $\sigma$. This subtle step is essential for obtaining the superconducting phase, as discussed (para following \disp{unctJ}) in the Introduction, since the role of exchange in promoting Cooper pairs manifests itself here. Using \disp{Kappa} we find \begin{eqnarray} \langle\langle [H_J,X_i^{0 \sigma_i}(\tau)] X_f^{\sigma_f 0}(\tau')\rangle\rangle =-\frac{1}{2} J_{ij} \sigma_i \left(C_{ij}(\tau^+)-{\cal K}_{ij}(\tau^+) \right) \langle\langle X_j^{\bar{\sigma}_i 0}(\tau) X_f^{\sigma_f 0}(\tau')\rangle\rangle, \nonumber \\ \label{exchange-3} \end{eqnarray} \textcolor{black}{where the repeated internal index $j$ is summed over, and with $\eta$ is a positive infinitesimal we indicate here and elsewhere $ \tau^+ \equiv \tau+ \eta $ and $ \tau^- \equiv \tau- \eta $ }. In treating this term we could have proceeded differently by sticking to \disp{exchange-1}, using \disp{TS} with a different external potential term as in \disp{CalD} to write \begin{eqnarray} &&\langle\langle[H_J,X_i^{0 \sigma_i }(\tau)] X_f^{\sigma_f 0}(\tau') \rangle\rangle=\frac{1}{2} J_{ij} \sigma_i \sigma \; \langle\langle X_i^{ 0 \sigma }(\tau) X_j^{ \bar{\sigma}_i \bar{\sigma} }(\tau) X_f^{\sigma_f0}(\tau') \rangle\rangle \nonumber \\ &=& - \frac{1}{2} J_{ij} \; \left( \gamma_{ \bar{\sigma}_i \bar{\sigma} }(j, \tau) - {\cal D}_{ \bar{\sigma}_i \bar{\sigma} }(j, \tau) \right) \langle\langle X_i^{ 0 \sigma }(\tau) X_f^{\sigma_f0}(\tau')\rangle\rangle, \nonumber \\ \label{exchange-4} \end{eqnarray} \textcolor{black}{where the repeated spin index $\sigma$, and the site index $j$ are summed over, while $\sigma_i,\sigma_f$ and site indices $i,f$ are held fixed.} These two expressions \disp{exchange-3} and \disp{exchange-4} are alternate ways of writing the higher order Greens functions \cite{Engelsberg}. In order to describe a broken symmetry solution with superconductivity, we are required to use \disp{exchange-3}, since using the other alternative disconnects the normal and anomalous Greens functions altogether, thereby precluding a superconducting solution. The term $ \langle\langle [{\cal A}_C(\tau),X_i^{0 \sigma_i}(\tau)]X_f^{\sigma_f 0}(\tau')\rangle\rangle $ generates a term that is linear in ${\cal J}$ which is treated similarly and the final result quoted in \disp{G0XY}. We summarize these equations compactly by defining \begin{eqnarray} G^{-1}_{0 i \sigma_i j \sigma_j}&=&\delta_{ij} \delta_{\sigma_i \sigma_j} \left({\bm \mu} - \partial_\tau \right) + t_{ij} \delta_{\sigma_i \sigma_j} - \delta_{ij} {\cal V}_i^{\sigma_i \sigma_j}\nonumber \\ Y_{i \sigma_i j\sigma_j}&=&t_{ij} \gamma_{\sigma_i \sigma_j}(i, \tau) \nonumber \\ X_{i \sigma_i j\sigma_j}&=& - t_{ij} {\cal D}_{\sigma_i \sigma_j}(i, \tau) , \end{eqnarray} and write the exact equation \begin{eqnarray} && (G^{-1}_{0 i \sigma_i j \sigma_j} - Y_{i \sigma_i j\sigma_j} - X_{i \sigma_i j\sigma_j}) {\cal G}_{j \sigma_j f \sigma_f}(\tau,\tau') = \delta(\tau-\tau') \delta_{if} (\delta_{\sigma_i \sigma_f} - \gamma_{\sigma_i \sigma_f}(i, \tau ))\nonumber \\ &&+ \frac{1}{2} J_{ij} \left( C_{ij}(\tau) - {\mathcal K}_{ij}(\tau) \right)\; {\cal F}_{j \sigma_i f \sigma_f}(\tau,\tau') \nonumber \\ &&+ {\cal J}_{j\sigma_j; i \sigma_k} \left( \delta_{\sigma_i, \sigma_k} - \gamma_{\sigma_i \sigma_k}(i, \tau )+ {\cal D}_{\sigma_i \sigma_k}(i, \tau ) \right) \sigma_j {\cal F}_{j \bar{\sigma}_j f \sigma_f}(\tau, \tau'), \label{G0XY} \end{eqnarray} \textcolor{black}{ where the spins $\sigma_j,\sigma_k$ and the site index $j$ are summed over, while $\sigma_i,\sigma_f$ and site indices $i,f$ are held fixed. The final term drops off when we switch off the external potential ${\cal J}$. Viewing the spin and site indices as joint matrix indices, these equations and their counterparts \disp{GOBACK}, are transformed into matrix equations below.} \subsubsection{Greens function ${\cal F}$\label{EOM-F}} The Gor'kov Greens function ${\cal F}$ in \disp{F} satisfies an exact equation that can be found as follows. First we note \begin{eqnarray} \partial_{\tau} \langle\langle X_i^{ \bar{\sigma}_i 0}(\tau) X_f^{\sigma_f 0}(\tau') \rangle\rangle = \langle\langle[H_t+H_J+{\cal A}(\tau),X_i^{ \bar{\sigma}_i 0}(\tau)]\;\; X_f^{\sigma_f 0}(\tau')\rangle\rangle \end{eqnarray} A part of the right hand side satisfies \begin{eqnarray} \langle\langle[H_t+{\cal A}_{\rho} (\tau),X_i^{ \bar{\sigma}_i 0}(\tau)]\;\; X_f^{\sigma_f 0}(\tau')\rangle\rangle =-\left( {\bm \mu} \delta_{\sigma_i \sigma} - {\cal V}_i^{\bar{\sigma}_i \bar{\sigma}} \right) \langle\langle X_i^{ \bar{\sigma} 0}(\tau)\;\; X_f^{\sigma_f 0}(\tau')\rangle\rangle \nonumber \\ - t_{ij} \langle\langle X_j^{ \bar{\sigma}_i 0}(\tau)\;\; X_f^{\sigma_f 0}(\tau')\rangle\rangle + t_{ij} (\gamma_{\bar{\sigma} \bar{\sigma}_i}(i \tau)- {\cal D}_{\bar{\sigma} \bar{\sigma}_i}(i \tau))\langle\langle X_j^{ \sigma 0}(\tau) ;\; X_f^{\sigma_f 0}(\tau')\rangle\rangle, \end{eqnarray} \textcolor{black}{where the repeated spin index $\sigma$, and the site index $j$ are summed over, while $\sigma_i,\sigma_f$ and site indices $i,f$ are held fixed.} The exchange term is treated similarly to \disp{exchange-1} \begin{eqnarray} [H_J,X_i^{ \bar{\sigma}_i 0 }]&=& \frac{1}{2} J_{ij} \left(X_i^{ \uparrow 0} X_j^{ \downarrow 0 }- X_i^{ \downarrow 0 } X_j^{ \uparrow 0}\right) \sigma_i X_j^{0 \sigma_i } \end{eqnarray} so that using \disp{Kappastar} we get \begin{eqnarray} \langle\langle [H_J,X_i^{ \bar{\sigma}_i 0}]\; X_f^{\sigma_f 0}(\tau') \rangle\rangle= -\frac{1}{2} J_{ij} \sigma_i \left({C}^*_{i j }(\tau^-) - {\cal K}^*_{ i j}(\tau^-) \right) \langle\langle X_j^{0\sigma_i}(\tau) X_f^{\sigma_f 0}(\tau')\rangle\rangle, \nonumber\\ \end{eqnarray} \textcolor{black}{where the repeated internal index $j$ is summed over} We gather and summarize these equation in terms of the variables that are ``time-reversed'' partners of \disp{G0XY} and hence denoted with hats: \begin{eqnarray} \widehat{G}^{-1}_{0 i \sigma_i j \sigma_j}=\delta_{ij} \delta_{\sigma_i \sigma_j} \left({\bm \mu} +\partial_\tau \right) + t_{ij} \delta_{\sigma_i \sigma_j} - \delta_{ij} {\cal V}_i^{\bar{\sigma}_i \bar{\sigma}_j}\nonumber \\ \widehat{Y}_{i \sigma_i j\sigma_j}=t_{ij} \gamma_{\bar{\sigma}_j \bar{\sigma}_i}(i, \tau)\nonumber \\ \widehat{X}_{i \sigma_i j\sigma_j}= - t_{ij} {\cal D}_{\bar{\sigma}_j \bar{\sigma}_i}(i, \tau) \label{G0XYBack} \end{eqnarray} So that \begin{eqnarray} \left( \widehat{G}^{-1}_{0 i \sigma_i j \sigma_j} - \widehat{Y}_{i\sigma_i j\sigma_j}- \widehat{X}_{i \sigma_i j \sigma_j} \right) {\cal F}_{j \sigma_j f \sigma_f}(\tau,\tau')= - \frac{1}{2} J_{ij} \left({C}^*_{ i j} - {\cal K}^*_{i j} \right) {\cal G}_{j \sigma_i f \sigma_f }(\tau,\tau') \nonumber \\ + \sigma_i \sum_{m } {\cal J}^*_{ i \bar{\sigma}_n m\sigma_m} (\delta_{\sigma_i, \sigma_n} -\gamma_{\bar{\sigma}_n \bar{\sigma}_i}(i, \tau) + {\cal D}_{\bar{\sigma}_n \bar{\sigma}_i}(i, \tau)) {\cal G}_{m \sigma_m f \sigma_f}(\tau,\tau')\nonumber \\ \label{GOBACK} \end{eqnarray} \textcolor{black}{ where the repeated spin indices $\sigma_j,\sigma_n,\sigma_m$ and site index $j$ are summed over, while $\sigma_i,\sigma_f$ and $i,f$ are held fixed.} The final term arising from $\langle\langle [{\cal A}_C,X_i^{ \bar{\sigma}_i 0}] X_f^{\bar{\sigma}_f 0}(\tau') \rangle\rangle $ drops off when we switch off the external potential ${\cal J}^*$. \subsubsection{Summary of Equation in Symbolic Notation \label{Symbolic}} The equations \disp{G0XY} and \disp{GOBACK} are exact in the strong correlation limit. Noting that all terms containing $\gamma$ and ${\cal D}$ in \disp{G0XY} and \disp{GOBACK} arise from Gutzwiller projection, we obtain the corresponding equations for the uncorrelated \ $t$-$J$ \ model in \disp{unctJ} by dropping these terms. Recall also that the external potentials ${\cal J,J}^*$ represent the imposed symmetry-breaking terms that force superconductivity, and are meant to be dropped at the end. In this uncorrelated case, let us understand the role of the terms with the Cooper pair derivatives ${\cal K,K}^*$. If we ignore these terms and also set ${\cal J,J}^*\to 0$ right away, the equations \disp{G0XY} and \disp{GOBACK} reduce to the Gor'kov mean-field equations for the uncorrelated model \cite{Gorkov}, with the equation \disp{cstarf} providing a self consistent determination of $C_{ij}^*$ in terms of ${\cal F}$. Thus by neglecting the terms with ${\cal K, K}^*$, the role of the exchange $J$ is confined to providing the lowest order electron-electron attraction in the Cooper channel. This amounts to neglecting the \textcolor{black}{${\cal O}(J^2)$} dressings of the electron self energies and irreducible interaction \textcolor{black}{i.e. the pairing kernel in \disp{new-9}}. \textcolor{black}{When retained, the normal state studies (see \refdisp{PRB-MaiShastry} Figs.~(22,23,24-(a))) show that the self energy terms arising from $J$ change the spectral functions of the model only slightly. Regarding the irreducible interaction in the superconducting channel, the ${\cal O}(J)$ term is already attractive. Since we are in the regime of $J\ll \mbox{max} \{ |t_{ij}|\}$ the retained term is expected to dominate the neglected higher order term. } \textcolor{black}{In summary, strong Hubbard-Gutzwiller type short ranged interactions renormalize} the Greens function to ${\cal G}$ from $G_0$, and the self energy terms due to $J$ are minor\cite{ECFL,PRB-MaiShastry}. The role of $J$ is significant \textcolor{black}{ only insofar as it provides} a mechanism for superconducting pairing, \textcolor{black}{ and potentially magnetic instabilities close to half filling. Keeping these considerations} in mind, we drop the terms involving ${\cal K, K}^*, {\cal J, J}^*$ in \disp{G0XY} and \disp{GOBACK}. This suffices for our initial goal, of generalizing a Gor'kov type\cite{Gorkov} mean-field treatment of \disp{unctJ} to the strongly correlated problem \disp{tJ}. Multiplying the $\gamma$ and ${\cal D}$ terms, or equivalently the $X$ and $Y$ terms with $\lambda$ and expanding the resulting equations systematically in this parameter constitutes the $\lambda$-expansion that we discuss below. With these remarks in mind we make the following changes to the equations \disp{G0XY} and \disp{GOBACK}: \begin{enumerate} \item[(i)] We drop the terms proportional to ${\cal J, J}^*$ and the corresponding derivative terms ${\cal K, K}^*$. \item[(ii)] Defining the gap functions: \begin{eqnarray} \Delta_{ij}= \frac{1}{2} J_{ij} C_{ij} \;\;\mbox{and}\;\; \Delta^*_{ij}= \frac{1}{2} J_{ij} {C}^*_{ij} \label{gap-1} \end{eqnarray} \item[(iii)] We scale the each occurrence of $\gamma,X,Y$,$ \widehat{X}, \widehat{Y}$ by $\lambda$. \end{enumerate} With these changes we write the modified \disp{G0XY} and \disp{GOBACK}: \begin{eqnarray} &&(G^{-1}_{0 i \sigma_i j \sigma_j} - \lambda Y_{i \sigma_i j\sigma_j} - \lambda X_{i \sigma_i j\sigma_j}) {\cal G}_{j \sigma_j f \sigma_f}\nonumber \\ &&= \delta(\tau-\tau') \delta_{if} (\delta_{\sigma_i \sigma_f} - \lambda \gamma_{\sigma_i \sigma_f}(i, \tau )) + \Delta_{ij}\; {\cal F}_{j \sigma_i f \sigma_f} \label{For-1} \end{eqnarray} \begin{eqnarray} \left( \widehat{G}^{-1}_{0 i \sigma_i j \sigma_j} - \lambda \widehat{Y}_{i\sigma_i j\sigma_j}- \lambda \widehat{X}_{i \sigma_i j \sigma_j} \right) {\cal F}_{j \sigma_j f \sigma_f}=- \Delta^*_{ij} {\cal G}_{j \sigma_i f \sigma_f } \label{For-2}, \end{eqnarray} \textcolor{black}{where $\sigma_j$ is summed over in both \disp{For-1} and \disp{For-2}. Note that} the self consistency condition \disp{Cijstar} and \disp{cstarf} fix the correlation functions $C$'s in terms of ${\cal F}$. As $\lambda \to0$ we get back the meanfield equations of Gor'kov for the uncorrelated-J model. The $\lambda$ parameter governs the density of doubly occupied states, and hence a series expansion in this parameter builds in Gutzwiller type correlations systematically. We expand the Greens functions to required order in $\lambda$ and finally set $\lambda=1$. We write \disp{For-1} and \disp{For-2} symbolically as \begin{eqnarray} ({\bf g}_0^{-1} - \lambda Y - \lambda X). {\cal G}& =& (\bm{1} - \lambda \gamma) + \Delta .{\cal F} \label{For-3}\\ (\widehat{{\bf g}}_0^{-1} - \lambda \widehat{Y} - \lambda \widehat{X}). {\cal F} & =& - \Delta^* .{\cal G} \label{For-4} \end{eqnarray} where the symbols ${\cal G},{\cal F}$ etc are regarded as matrices in the space, spin and time variables, $\bm{1}$ is the Dirac delta function in time and a Kronecker delta in space and spin, with the dot indicating matrix multiplication or time convolution. In the case of $X,\widehat{X}$ it also indicates taking the necessary functional derivatives. \section{Expansion of the Equations in $\lambda$ \label{lambdaexpansion}} We decompose of both Greens functions in \disp{For-3} and \disp{For-4} as \begin{eqnarray} {\cal G}= {\bf g}.\widetilde{\mu}, \;\; {\cal F}= {\bm f}. \widetilde{\mu} \label{factorize} \end{eqnarray} where $\widetilde{\mu}$ is a function of spin, space and time that is common to both Greens function. As an example of the notation, the equation ${\cal G}={\bf g}.\widetilde{\mu}$ stands for ${\cal G}_{i \sigma_i j \sigma_j}(\tau_i,\tau_j)=\sum_{k \sigma_k}\int_0^\beta d\tau_k \;{\bf g}_{i \sigma_i k \sigma_k}(\tau_i,\tau_k) \; \widetilde{\mu}_{k \sigma_k j \sigma_j}(\tau_k,\tau_j) $. Here $\widetilde{\mu}$ is called the caparison (i.e. a further dressing) function, in a similar treatment of the normal state Greens function. The terms ${\bf g}$ and ${\bm f}$ are called the auxiliary Greens function. The basic idea is that this type of factorization can reduce \disp{For-3}, to a canonical type equation fo ${\bf g}$, where the terms $\bm{1}- \lambda \gamma$ is replaced by $\bm{1}$. We remark that this is a technically important step since the term $\bm{1}- \lambda \gamma$ modifies the coefficient of the delta function in time, and encodes the distinction between canonical and non-canonical fermions. To simplify further, we note that $X$ contains a functional derivative with respect to ${\cal V}$, acting on objects to its right. When acting on a pair of objects, e.g. $X.{\cal G}=X.{\bf g}.\widetilde{\mu}$, we generate two terms. One term is $ (X.g).\widetilde{\mu}$, where the bracket, temporarily provided here, indicates that the operation of $X$ is confined to it. The second term has the derivative acting on $\widetilde{\mu}$ only, but the matrix product sequence is unchanged from the first term. We write the two terms together as \begin{eqnarray} X.{\bf g}.\widetilde{\mu}&=&\wick{\c X.\c {\bf g} .\widetilde{\mu}}+ \wick{\c X. {\bf g}. \c \widetilde{\mu}}, \label{wicks-1} \end{eqnarray} so that the `contraction' symbol refers to the differentiation by $X$, and the `$.$' symbol refers to the matrix structure. We may view this as the Leibnitz product rule. Let us now operate with $X$ on the identity ${\bf g}.\GH^{-1}= {\bf 1}$, where ${\bf g}^{-1}$ is the matrix inverse of ${\bf g}$. Using the Leibnitz product rule, we find \begin{eqnarray} \wick{ \c X. \c {\bf g}}= - \left( \wick{ \c X .\bf{g} .\c {\bf g}}^{-1}\right).{\bf g} \label{wicks-2} \end{eqnarray} and hence we can rewrite \disp{wicks-1} in the useful form \begin{eqnarray} X.{\bf g}.\widetilde{\mu}&=& - \left( \wick{ \c X .\bf{g} .\c {\bf g}}^{-1}\right).{\bf g} + \wick{\c X. {\bf g}. \c \widetilde{\mu}} \label{wicks-3}. \end{eqnarray} With this preparation we rewrite \disp{For-3} the equation for ${\cal G}$ as \begin{eqnarray} ({\bf g}_0^{-1} - \lambda Y + \lambda \left( \wick{ \c X .\bf{g} .\c {\bf g}}^{-1}\right)). {\bf g} .\widetilde{\mu}= (\bm{1} - \lambda \gamma) + \Delta.{\bm f}.\widetilde{\mu} + \lambda \wick{\c X.{\bf g}.\c \widetilde{\mu}} \label{For-5} \end{eqnarray} We now choose ${\bf g},{\bm f}$ such that \begin{eqnarray} ({\bf g}_0^{-1} - \lambda Y + \lambda \left( \wick{ \c X .\bf{g} .\c {\bf g}}^{-1}\right)). {\bf g} = {\bf 1} + \Delta. {\bm f} . \label{new-1} \end{eqnarray} Substituting \disp{new-1} into \disp{For-5}, we find that $\widetilde{\mu}$ satisfies the equation \begin{eqnarray} \widetilde{\mu}= (\bm{1} - \lambda \gamma) + \lambda \wick{\c X.{\bf g}.\c \widetilde{\mu}}. \label{new-2} \end{eqnarray} Note that \disp{new-1} has the structure of a canonical equation since we replaced the $\bm{1}-\lambda \gamma$ term by $\bm{1}$ in \disp{For-5}. Thus the non-canonical \disp{For-3} for ${\cal G},{\cal F}$ is replaced by a pair of canonical equations for ${\bf g},\widetilde{\mu}$. In \disp{new-1} we note that the action of $X$ is confined to the bracket $\lambda \left( \wick{ \c X .\bf{g} .\c {\bf g}}^{-1}\right)$, unlike the term $\lambda X.{\cal G}$ in the initial \disp{For-3} . We may thus view the term in bracket in \disp{new-1} as a proper self energy for ${\bf g}$. For treating the equation for ${\cal F}$ \disp{For-4} we use the same scheme \disp{factorize} and find \begin{eqnarray} \widehat{X}.{\cal F} = \widehat{X}.{\bm f}.\widetilde{\mu} = -\left( \wick{\c{\widehat{X}} . {\bm f} . \c {\bm f}^{-1}} \right). {\bm f} . \widetilde{\mu} + \wick{\c{\widehat{X}} .{\bm f}. \c\widetilde{\mu}} \end{eqnarray} With this we rewrite \disp{For-4} after cancelling an overall right multiplying factor $\widetilde{\mu}$ \begin{eqnarray} (\widehat{{\bf g}}_0^{-1} - \lambda\widehat{Y} + \lambda \wick{\c {\widehat{X}}. {\bm f} . \c {\bm f}^{-1} } ). {\bm f} & =& - \Delta^* .{\bf g} + \lambda \wick{\c{\widehat{X}} .{\bm f}. \c\widetilde{\mu}}. \widetilde{\mu}^{-1} \label{new-3} \end{eqnarray} Summarizing we need to solve for ${\bm f},{\bf g}, \widetilde{\mu},\Delta^*$ from Eqs.~(\ref{new-1},\ref{new-2},\ref{new-3}) by iteration in powers of $\lambda$. \subsection{Simplified Equations near $T_c$\label{nearTc}} For the present work, we note that the equation \disp{new-3} simplifies considerably, if we work close to $T_c$. In this regime ${\bm f}$ may be assumed to be very small, enabling us to throw away all terms of ${\cal O}(f^2)$ and also to discard terms of ${\cal O}( \lambda f)$. This truncation scheme is sufficient to determine $T_c$ for low orders in $\lambda$. When $T\sim T_c$, throwing away terms of ${\cal O}(f^2)$ and ${\cal O}( \lambda f)$, we obtain the simplified version of \disp{new-3} \begin{eqnarray} {\bm f}= -\widehat{{\bf g}}_0.\Delta^* .{\bf g} + o(\lambda {\bm f}), \label{new-4} \end{eqnarray} so that \disp{new-1} can be written as \begin{eqnarray} {\bf g}^{-1}={\bf g}_0^{-1} - \lambda Y + \lambda \left( \wick{ \c X .\bf{g} .\c {\bf g}}^{-1}\right)+\Delta.\widehat{{\bf g}}_0.\Delta^* \label{new-5} \end{eqnarray} In this limit the above two are the ${\cal O}(\lambda^2)$ equations required to be solved, together with \disp{new-2} and the self consistency condition \disp{gap-1}, \disp{cstarf}. The latter can be combined with \disp{F} as \begin{eqnarray} \Delta_{ij}^*&=& \frac{1}{2} J_{ij} {C}^*_{ij}=- \frac{1}{2} J_{ij} \sum_\sigma {\cal F}_{i \sigma, j \sigma}(\tau^+, \tau) \label{new-6} \end{eqnarray} and further reduced using \disp{factorize}. On turning off the external potentials we regain time translation invariance. We next perform a fourier transform to fermionic Matsubara frequencies $\omega_n = \frac{\pi}{\beta} (2 n+1)$ using the definition ${\cal F}(\tau)= \frac{1}{\beta}\sum_n e^{- i \omega_n \tau} {\cal F}(i \omega_n)$, and write \disp{factorize} in the frequency domain as \begin{eqnarray} {\cal F}_{p \sigma}(i \omega_n) = {\bm f}_{p \sigma}(i \omega_n) \widetilde{\mu}_{p \sigma}( i\omega_n). \end{eqnarray} Thus taking spatial fourier transforms with the definition \begin{eqnarray} J(q) = 2 J \left( \cos q_x+ \cos q_y\right), \end{eqnarray} so that the self consistency condition \disp{new-6} finally reduces to \begin{eqnarray} \Delta^*(k) & =& - \frac{1}{2 \beta}\sum_{p \sigma \omega_n} J(k-p) {\bm f}_{p \sigma}(i \omega_n) \widetilde{\mu}_{p \sigma}(i \omega_n) \label{new-7} \end{eqnarray} We may write \disp{new-4} as \begin{eqnarray} {\bm f}_{p \sigma}(i \omega_n) = - \widehat{{\bf g}}_{0 \sigma}(p, i \omega_n) \Delta^*(p) {\bf g}_{\sigma}(p, i \omega_n) \end{eqnarray} where the time reversed free Greens function \begin{eqnarray} \widehat{{\bf g}}_{0 }(p, i \omega_n)= \frac{1}{- i \omega_n +{\bm \mu}_0 - \varepsilon_{-p}}= \frac{1}{- i \omega_n - \xi_{p}} \end{eqnarray} with $\xi= \varepsilon_p- {\bm \mu}_0$ and by using $\varepsilon_p=\varepsilon_{-p}$, and ${\bm \mu}_0$ is taken as the non-interacting system chemical potential, discarding the corrections of $\mu$ due to $\lambda$. Therefore \disp{new-7} becomes \begin{eqnarray} \Delta^*(k) &=& \frac{1}{2\beta}\sum_{p \sigma \omega_n} J(k-p) \widehat{{\bf g}}_{0 \sigma}(p, i \omega_n) \Delta^*(p) {\bf g}_{\sigma}(p, i \omega_n) \widetilde{\mu}_{p \sigma}(i \omega_n) \nonumber \\ \label{new-8} \end{eqnarray} Here ${\bf g}$ is taken from \disp{new-5}, i.e. the ${\cal O}(\lambda^2)$ Greens function with a small correction (for $T\sim T_c$) from the gap $\Delta$. Performing the spin summation and recombining ${\bf g} .\widetilde{\mu}={\cal G}$, we get the equation in terms of the physical electron Greens function \begin{eqnarray} \Delta^*(k) &=& \frac{1}{\beta}\sum_{p \omega_n} J(k-p) \Delta^*(p) \widehat{{\bf g}}_{0 }(p, i \omega_n) {\cal G}(p, i \omega_n). \label{new-9} \end{eqnarray} This is an important result of our formalism, it represents the leading order Gor`kov equation for the \ $t$-$J$ \ model. It is analogous to a refinement of Gor`kov's equation \cite{Gorkov}, usually called the Eliashberg equation \cite{Eliashberg}, valid for strong electron-phonon coupling superconductivity. Our $\lambda$ expansion plays the role of the Migdal theorem \cite{Migdal} in that problem. The analogy with Migdal \cite{Migdal} and Eliashberg's \cite{Eliashberg} work is only superficial, since the strongly correlated problem does not share the physics of the separation of the electronic and phonon time scales, underlying those results. In \disp{new-9} the physical electron Greens function ${\cal G}$ is taken from the ${\cal O}(\lambda^2)$ theory if we neglect the corrections from the gap, which vanishes above $T_c$ anyway. We express the physical Greens function in terms of its spectral function $A(p,\nu)$ \begin{eqnarray} {\cal G}(p, i \omega_n)= \int d \nu \; \frac{ A(p,\nu)}{i \omega_n - \nu} \label{spectral-rep} \end{eqnarray} The frequency integral in \disp{new-6} can be performed as \begin{eqnarray} \frac{1}{\beta}\sum_{ \omega_n} \widehat{{\bf g}}_{0 }(p, i \omega_n) {\cal G}(p, i \omega_n)= \int d \nu \; A(p,\nu) \frac{1-f(\nu)-f(\xi_p)}{\nu+\xi_p}. \end{eqnarray} where $f$ is the fermi distribution $f(\nu)=1/(1+ \exp{\beta \nu})$. Hence \begin{eqnarray} \Delta^*(k)= \sum_p J(k-p) \Delta^*(p) \; \int d \nu \; A(p,\nu) \frac{1-f(\nu)-f(\xi_p)}{\nu+\xi_p}. \label{imp-1} \end{eqnarray} In summary this eigenvalue type equation for $\Delta^*(k)$, together with the spectral function $A(p,\nu)$ determined from the ${\cal O}(\lambda^2)$ Greens function in \disp{new-5}, gives the self-consistent gap near $T_c$. At sufficiently high temperatures, i.e. in the normal state $T>T_c$ $\Delta^*$ vanishes, so that $A$ is independent of $\Delta^*$. In this case \disp{imp-1} reduces to a linear integral equation for $\Delta^*$. We may then determine $T_c$ from the condition that the largest eigenvalue crosses 1. For this purpose we only need the normal state electron spectral function of the strongly correlated metal. \section{Estimate of $T_c$\label{EquationforTc}} \subsection{Equation for determining $T_c$} The condition for obtaining a d-wave superconducting state is given by setting $T=T_c^+$ in \disp{imp-1} writing $\Delta^*(k)= \Delta_0(\cos k_x-\cos k_y)$, using the normal state spectral function for $A$ and canceling an overall factor $\Delta_0 (\cos k_x-\cos k_y)$. Following these steps we get \begin{eqnarray} 1= J \sum_{p}\left\{\cos(p_x)-\cos(p_y) \right\}^2 \; \int d \nu \; \frac{1-f(\nu)-f( \varepsilon_p - \mu_0)}{\nu+ \varepsilon_p - \mu_0} A(p,\nu)\bigg|_{T_c}. \label{Tc1} \end{eqnarray} Instead of working with \disp{Tc1}, it is convenient to make a useful simplification for the average over angles. Since \disp{Tc1} is largest when $\vec{p}$ is on the fermi surface, we factorize the two terms and write \begin{eqnarray} 1&=& J \Psi(\mu_0) \; \Gamma \label{Tc20} \\ \Gamma&=&\sum_{p} \int d \nu \; \frac{1-f(\nu)-f( \varepsilon_p - \mu_0)}{\nu+ \varepsilon_p - \mu_0} A(p,\nu)\bigg|_{T_c} \label{Tc2} \end{eqnarray} where $\Gamma$ is a particle-particle type susceptibility. Here $\Psi(\mu_0)$ is more correctly the weighted average of $\left\{\cos(p_x)-\cos(p_y) \right\}^2$ with a weight function that is the integrand in \disp{Tc2}. We simplify it to the fermi surface averaged momentum space d-wavefunction \begin{eqnarray} \Psi(\mu_0)&=& \frac{1}{n(\mu_0) }\sum_{p}\left\{\cos(p_x)-\cos(p_y) \right\}^2 ) \delta(\varepsilon_p-\mu_0) \label{D-wave} \end{eqnarray} where $n(\epsilon)$ is the band density of states (DOS) per spin and per site, at energy $\epsilon$, \begin{eqnarray} n(\epsilon) &=&\frac{1}{N_s} \sum_{p} \delta(\varepsilon_p-\epsilon). \end{eqnarray} Using this simplification and performing the angular averaging over the energy surface $\varepsilon_{\vec{p}}=\epsilon$ we write the (particle-particle) susceptibility $\Gamma$ (\disp{Tc2}) as \begin{eqnarray} \Gamma= \int \; d\epsilon \int d \nu \; n(\epsilon) \; A(\epsilon,\nu) \; \frac{1-f(\nu)-f(\epsilon-\mu_0)}{\nu+\epsilon-\mu_0}\bigg|_{T_c} . \label{Tc3} \end{eqnarray} where $A(\epsilon,\nu)$ is the angle-averaged version of the spectral function $A(p,\nu)$. We estimate this expression below for the extremely correlated fermi liquid, by using a simple model for the spectral function $A$. In \disp{Tc3} if we replace the spectral function $A$ by the (fermi gas) non-interacting result $A_{0}(\epsilon,\mu_0)=\delta(\nu-\epsilon+\mu_0)$, we obtain the Gorkov-BCS mean-field theory, where the susceptibility $\Gamma$ reduces to $ \int d\epsilon \; n(\epsilon) \; \frac{\tanh\frac{1}{2} \beta_c (\epsilon-\mu_0)}{2(\epsilon-\mu_0)} $. This is evaluated by expanding around the fermi energy, and utilizing the low T formula $\int _0^{W_0} \frac{d \epsilon}{\epsilon} \, {\tanh\frac{1}{2} \beta_c \epsilon}\sim \log\left[ \frac{\zeta_0 W_0}{k_B T_c}\right] $, where $W_0 $ is the half-bandwidth and $\zeta_0= 1.13387\ldots$. Equating $\Gamma$ to $1/J \Psi(\mu_0)$ gives the d-wave superconducting transition temperature for the uncorrelated \ $t$-$J$ \ model \begin{eqnarray} k_B T_c^{(un)}&\sim& 1.134\; W_0 \; e^{-\frac{1}{g}},\label{Tcuncorr} \end{eqnarray} with the superconducting coupling constant \begin{eqnarray} g&=& J \Psi(\mu_0) n(\mu_0) \label{g}. \end{eqnarray} \subsection{Model spectral function \label{modelspectral}} We next use a simple model spectral function to estimate these integrals. It has the great advantage that we can carry out most integrations analytically and get approximate but closed form analytical expressions for $T_c$, which provide useful insights. The model spectral function contains the following essential features of strong correlations namely: \begin{itemize} \item A quasiparticle part with fermi liquid type parameters, where the quasiparticle weight $Z$ goes to 0 at half filling $n=1$, and \item A wide background. \end{itemize} The model spectral function used is in the spirit of Landau's fermi liquid theory\cite{Landau,Nozieres,AGD} with suitable modifications due to strong correlation effects\cite{ECFL}. We take the spectral function as \begin{eqnarray} A(\epsilon, \nu) = Z \delta( \nu - \frac{m}{m^*} \epsilon) + (1-Z) \frac{1}{2 W_0} \Theta(W_0- |\nu|). \label{FLT} \end{eqnarray} Here $\Theta(x)=\frac{1}{2}(1+\frac{x}{|x|})$, $W_0$ the half-bandwidth $\frac{m}{m^*}$ is the renormalized effective mass of the fermions, and $Z$ is the fermi liquid renormalization factor. The first term is the quasiparticle part with weight $Z$, and second part represents the background modeled as an inverted square-well. Integration over $\nu$ gives unity at each energy $\epsilon$. $Z$ is chosen to reflect the fact that we are dealing with a doped Mott-Hubbard insulator so it must vanish at $n=1$. For providing a simple estimate we use Gutzwiller's result \cite{Gutzwiller,Brinkman} \begin{eqnarray} Z=1-n. \label{GutzZ} \end{eqnarray} The effective mass is related to $Z$ and the k-dependent Dyson self energy $\Sigma$ through the standard fermi liquid theory\cite{Landau,Nozieres,AGD} formula \begin{eqnarray} \frac{m}{m^*}= Z \times (1+ \frac{\partial \Sigma(\vec{k}, \mu)}{\partial \varepsilon_k}\bigg|_{k_F}) \label{mstarFL}. \end{eqnarray} The Landau fermi liquid renormalization factor $\frac{m}{m^*}$ can be inferred from heat capacity experiments provided the bare density of states is assumed known. Using \disp{FLT} in \disp{Tc3} and decomposing the susceptibility $\Gamma$ into a quasiparticle and background part, the equation determining $T_c$ is: \begin{eqnarray} \left( \Gamma_{QP}+\Gamma_{B}\right)\bigg|_{T\to T_c} & = &\frac{1}{J \Psi(\mu_0) } \label{Gorkov1} \\ \Gamma_{QP}&=& Z \int d\epsilon \, n(\epsilon) \frac{1-f(\epsilon-\mu_0)-f(\frac{m}{m^*} (\epsilon-\mu_0))}{(\epsilon-\mu_0) (1+\frac{m}{m^*})} \\ \Gamma_{B}&=&\frac{(1-Z)}{2 W_0}\int d\epsilon \, n(\epsilon)\int_{-W_0}^{W_0} d\nu \frac{1-f(\epsilon-\mu_0)-f(\nu)}{(\epsilon-\mu_0)+\nu }.\nonumber \\ \end{eqnarray} Using the same approximations that lead to \disp{Tcuncorr} the $\Gamma_{QP}$ can be evaluated as \begin{eqnarray} \Gamma_{QP}&=& \frac{Z n(\mu_0)}{1+\frac{m}{m^*}} \int_0^{W_0} \frac{d\epsilon}{\epsilon} \ \left( \tanh \frac{\epsilon}{2 k_B T}- \tanh \frac{\epsilon \, m/m^*}{2 k_B T} \right), \end{eqnarray} and hence at low enough $T$ the estimate \begin{eqnarray} \Gamma_{QP}\sim n(\mu_0) \frac{2 Z}{1+\frac{m}{m^*}} \log\left[\frac{\zeta_0 W_0 \sqrt{\frac{m}{m^*}}}{k_B T} \right]. \label{GammaQP} \end{eqnarray} Unlike the quasiparticle part with this $\log T$ behavior at low T, the background part is nonsingular as $T\to0$, since a double integral over the region of small $\epsilon-\mu_0$ and $\nu$ is involved. It can be estimated by setting $T=0$, $\epsilon-\mu_0\sim\epsilon$ and replacing $n(\epsilon)\sim n(\mu_0)$. With \begin{eqnarray} \Gamma_B&\equiv& n(\mu_0) \gamma_B, \\ \gamma_B&=&\frac{(1-Z)}{2 W_0} \int_{-W_0}^{W_0}\int_{-W_0}^{W_0} \frac{1}{2} \frac{\mbox{sign}(\epsilon)+\mbox{sign}(\nu)}{\epsilon+\nu}\,d \epsilon \, d\nu. \end{eqnarray} Integrating this expression we obtain \begin{eqnarray} \gamma_B=(1-Z) \log 4. \label{gamma} \end{eqnarray} Combining Eqs.~(\ref{Gorkov1},\ref{GammaQP},\ref{gamma}) we find \begin{eqnarray} k_BT_c &\sim& 1.134 \; W_0 \times \sqrt{ \frac{m}{m^*}} \times e^{-\frac{1}{g_{eff}}} \label{Tc} \end{eqnarray} where the effective superconducting coupling: \begin{eqnarray} g_{eff}&=& \frac{ 2 Z}{\left(1+\frac{m}{m^*}\right)} \left\{J_{eff} \Psi(\mu_0) n(\mu_0)\right\} \label{geff} \end{eqnarray} and an effective exchange \begin{eqnarray} J_{eff}= \frac{J}{1- \gamma_B J \Psi(\mu_0) n(\mu_0)}, \label{Jeff} \end{eqnarray} where the denominator represents an enhancement due to the background spectral weight. In comparing \disp{Tc} with the uncorrelated result \disp{Tcuncorr} several changes are visible. The bandwidth prefactor is reduced by correlations due to the factor of $\sqrt\frac{m}{m^*}\ll 1$. This factor vanishes as $n\to 1$ thereby diminishing superconducting $T_c$ in the close proximity of the insulator. A similar but even more drastic effect arises from multiplying factor $\frac{2 Z}{ (1+\frac{m}{m^*})}$ in the coupling $g_{eff}$ \disp{geff}. This term reflects the quasiparticle weight in the pairing process, and vanishes near the insulating state. Being situated in the exponential, it kills superconductivity even more effectively than the bandwidth prefactor. Away from the close proximity of the insulator other terms in $g_{eff}$ become prominent, allowing for the possibility of superconductivity. Amongst them is the replacement of the exchange energy by $J_{eff}$. In a density range where $\Psi(\mu_0) n(\mu_0)$ is appreciable, this enhances $J_{eff}$ over $J$ due to the feedback nature of \disp{Jeff}, and has an important impact on determining the phase region with superconductivity. \subsection{Numerical Estimates of $T_c$\label{NumericalestimatesofTc}} We turn to the task of estimating the order of magnitude of the Tc in this model. When we take typical values for cuprate systems: $W_0\sim 10^4$K (i.e $\sim$1 eV) and $J\sim 10^3$K (i.e. $\sim$0.1 eV), the transition temperature of the uncorrelated model $T_c^{(un)}$ \disp{Tcuncorr} is a few thousand K, at most densities. It remains robustly non-zero at half filling, since in this formula correlation effects are yet to be built in and the Mott-Hubbard insulator is missing. For the correlated system, we estimate $T_c$ from \disp{Tc} using similar values of model parameters. The terms arising from correlations in \disp{Tc} are guaranteed to suppress superconductivity near the insulating state, since $Z\to0$ and the quasiparticle is lost. A more refined question is whether an intermediate density regime ($ \delta > 0$) can support superconductivity. And if so, whether the temperature scales are robust enough to be observable. Within the context and confines of the simplified model spectral function considered, we answer both questions positively here. \subsubsection{Choice of model parameters \label{ModelParameters}} In order to estimate the order of magnitude of the Tc, its dependence on $J$ and band parameters, we choose parameters similar to those used in contemporary studies for the single layer High $T_c$ compound $La_{2-x}Sr_xCuO_4$. The hopping Hamiltonian $-\sum_{ij} t_{ij} \widetilde{C}_{i \sigma}^\dagger \widetilde{C}_{j \sigma}$, gives rise to band energy dispersion $\varepsilon(\vec{k})= -2 t (\cos k_x +\cos k_y ) - 4 t' \cos k_x \cos k_y- 2 t'' (\cos 2 k_x + \cos 2 k_y)$ on a square lattice. Thus the hopping amplitudes $t_{ij}$ are equal to $t$ when $i,j$ are nearest neighbors, $t'$ when $i,j$ are second-nearest neighbors, and $t''$ when $i,j$ are third-nearest neighbors. For this system we will use the values \cite{ARPES-LSCO,Ogata} \begin{eqnarray} t=0.45 \, eV, \;\; t'/t = - 0.16 \pm 0.02, \;\; t''/t=.01. \label{Hoppings} \end{eqnarray} This parameter set is roughly consistent with the experimentally determined fermi surface of $La_{2-x}Sr_xCuO_4$ \cite{ARPES-LSCO}, we comment below on considerations leading to a more precise choice. The tight binding band extends from $-W_{0}\leq \epsilon \leq W_0$, where $W_0= 4 t$, neglecting a small shift due to $t'$. The exchange energy is chosen to be \begin{eqnarray} J/t =0.3, \;\; \mbox{or} \;\;J/k_B\sim 1550K, \end{eqnarray} as determined from two magnon Raman experiments\cite{Rajiv} on the parent insulating $La_2CuO_4$. Note that the \ $t$-$J$ \ model is obtainable from the Hubbard model by performing a large $U/t$ super-exchange expansion, giving $J= \frac{ 4 t^2}{U}$. Thus our choice of $J$ corresponds to a strong coupling type magnitude of $U/t\sim 13.3$ in the Hubbard model, placing it in a perturbatively inaccessible regime of that model. We now discuss the enhancement of effective mass $\frac{m}{m^*}$ \cite{Loram}. In the proximity of the Mott-Hubbard insulating state $n\to 1$, an enhancement in $\frac{m^*}{m}$ is expected on general grounds, reflecting a diminished thermal excitation energy scale due to band narrowing. For illustrating the role of this parameter we use two complementary estimates \begin{eqnarray} \frac{m}{m^*} &\sim& 3.4 \; (1-n), \;\;\mbox{(a)} \label{mstarA} \\ \frac{m}{m^*} &=& Z, \;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\;\mbox{(b)} \label{mstarB} \end{eqnarray} where estimate (a) gives a two-fold enhancement of $\frac{m^\star}{m}$ at $\delta=.15$, while estimate (b), obtained by neglecting the $k$ dependence of the self energy in \disp{mstarFL}, gives a seven-fold enhancement. The formulas used are simple enough so that the effect other estimates for $\frac{m}{m^*}$ should be easy enough for the reader to gauge. \subsubsection{Results \label{Results}} \begin{figure}[htbp] \centering \includegraphics[width=.72\columnwidth]{Tc-Figure-Main.pdf} \caption{\footnotesize The superconducting transition temperature for the correlated model $T_c$ (\disp{Tc}) \label{Fig-1-Tc} ($t'/t=-0.159, \; t''/t=0.01, \; \frac{m}{m^*}=Z$). The scale of the maximum transition temperature is smaller by an order of magnitude from the uncorrelated model. As the insulator is approached $\delta \to 0$, and $T_c$ decreases drastically. This is easy to understand since the quasiparticle weight $Z$ shrinks on approaching the insulating state, killing the coupling $g_{eff}$ \disp{geff}. When $\delta$ goes beyond the peak (optimum) value, the effective superconducting coupling $g_{eff}$ agains falls off as seen in \figdisp{Fig-symmetry} and in \figdisp{Fig-geff} due to the other factors in \disp{geff}. When $g_{eff}$ drops below $\sim0.12$, the resulting $T_c$ is negligible. } \end{figure} In \figdisp{Fig-1-Tc} the superconducting transition temperature for d-wave symmetry is shown as a function of the hole density $\delta=1-n$ where the band parameters are indicated in the caption. It shows that $T_c$ is maximum at $\delta\sim0.15$ and falls off rapidly as one moves away from that density in either direction. The scale of $T_c$ is a few hundred K, which is an order of magnitude lower than that of the uncorrelated system. The small kink-like features to the right of the peak reflect structure in the DOS shown as inset in \figdisp{Fig-symmetry}. \begin{figure}[htbp] \centering \includegraphics[width=0.72\columnwidth]{Symmetries-Figure.pdf} \caption{\footnotesize The figure and inset use $t'/t=-0.159$, $t''/t=0.01$, and $\frac{m}{m^*}=Z$. The effective superconducting coupling $g_{eff}$ (\disp{geff}) for three Cooper pair symmetries: (i)(blue) d-wavefunction $\langle \left\{\cos(k_x)-\cos(k_y)\right\}^2 \rangle_{FS}$, (ii)(brown) extended s-wavefunction $\langle \left\{\cos(k_x)+\cos(k_y)\right\}^2 \rangle_{FS}$, and (iii)(magenta) $s+i d$ wavefunction $\langle \left\{\cos^2(k_x)+\cos^2(k_y)\right\} \rangle_{FS}$. For the d-wavefunction, the drastic decrease of $T_c$ on both sides of the peak values in \figdisp{Fig-1-Tc} can be understood by referring to the the second y-axis, giving the temperature scale $T_c^{appx}= 10^4 \times e^{- \frac{1}{g_{eff}}}$ K. This scale provides an order of magnitude of $T_c$ at a given $g_{eff}$ by assuming a prefactor $10^4$K. It illustrates the rapid reduction of $T_c$ when $g_{eff}\lessim0.12$. The other two symmetries lead to much smaller couplings and are therefore ineffective. {\bf Inset:} The band DOS at the fermi energy shows an enhancement around the hole density $\delta=0.15$. \label{Fig-symmetry} } \end{figure} In \figdisp{Fig-symmetry} the effective superconducting coupling $g_{eff}$ is shown for three different symmetries of the Cooper pairs: $d$-wave, extended $s$-wave, and $s+i d$-wave. It is clear that within this theory, only d-wave symmetry leads to robust superconductivity, the other two symmetries lead to effects too small to be observable. \begin{figure}[htbp] \centering \includegraphics[width=.72\columnwidth]{Tc-Figure-Second.pdf} \caption{\footnotesize The superconducting transition temperature for the correlated model $T_c$ (\disp{Tc}) \label{Figure-Tc-Second} for three parameter sets- (i) (red) $t'/t$$=-0.159$, $t''/t$$=0.01$ with $\delta_{peak}=0.15$, (ii) (blue) $t'/t$$=-0.137$, $t''/t=.01$ with $\delta_{peak}=0.13$ and (iii)(purple) $t'/t$$=-0.181$,$t''/t$$=0.01$ with $\delta_{peak}=0.17$. The solid lines use $\frac{m}{m^*}=Z$ for and the dashed lines $\frac{m}{m^*}=3.4 \delta$. {\bf Inset:} $\Psi(\mu_0)$ the fermi surface averaged d-wavefunction $\langle\left\{\cos(k_x)-\cos(k_y)\right\}^2\rangle_{FS}$ is shown for the three sets of band parameters. The peak values occur at the densities where $T_c$ is highest. Their peak magnitude $\sim 3.2$ indicates a strong constructive interference effect from $\vec{k}\sim\{ \pm \pi,0\},\{ 0,\pm \pi\}$, where $|\cos(k_x)-\cos(k_y)|\sim 2$. } \end{figure} From \figdisp{Figure-Tc-Second} we see that the peak density is shifted by varying the band hopping parameters. As the peak density moves towards small $\delta$, its height falls rapidly. This is understandable as the effect of the quasiparticle weight $Z$ in the formulas Eqs.~(\ref{Tc},\ref{geff}). We also note that the use of different expressions for the effective mass in Eqs.~(\ref{mstarA},\ref{mstarB}) change the width of the allowed regions somewhat, but are quite comparable. The inset in \figdisp{Figure-Tc-Second} displays the d-wavefunction averages corresponding to the same sets of parameters. It is interesting to note that the height of the peaks $\Psi_{max}$$\sim$$3.2$ are close to their upper bound $4$, from a type of constructive interference that requires comment. Note first that the DOS can be expressed as a line integral in the octant of the Brillouin zone $n(\mu_0)= \frac{2}{\pi^2} \int_0^{k_{max}} \frac{d k_x}{|v^y{(\vec{k})}|}$, where the velocity $v^y{(\vec{k})}= 2 \sin(k_y) (t+ 2t' \cos k_x + 4 t'' \cos k_y)$ is evaluated with $k_y\to k_y(k_x,\mu_0)$ on the fermi surface. Thus the region of small $|v^y|$ dominates the integral. If $v^y$ vanishes on the fermi surface, we get a (logarithmic van Hove) peak in the DOS. Now the average of $\Psi(\mu_0)$ is largest, when $\vec{k}$ is close to $\{\pm \pi,0\}$ and $\{0, \pm \pi\}$. Therefore if the fermi surface passes through $\{\pm \pi,0\}$ and $\{0, \pm \pi\}$ for an ``ideal density'', then we simultaneously maximize the average of $\Psi$, {\em and} obtain a large $DOS$. The condition for this is found by equating the band energy at $\{\pm \pi,0\}$ to the chemical potential $\mu_0= 4 t'-4 t''$, thereby fixing the corresponding density $\delta$. It follows that a given $\delta$ can be found from several different sets of the parameters $t', t''$. The inset of \figdisp{Figure-Tc-Second} shows the average $\Psi(\mu_0)$ displays peaks, the middle one (red) coincides in location with the peak in the DOS in the inset of \figdisp{Fig-symmetry}. \begin{figure}[htbp] \centering \includegraphics[width=.63\columnwidth]{Jeff-Figure.pdf} \caption{\footnotesize The effective exchange $J_{eff}$ from \disp{Jeff} for the three parameter sets- (i) (red) $t'/t$$=\!-0.159$, $t''/t$$=0.01$ with $\delta_{peak}=0.15$, (ii) (blue) $t'/t$$=\!-0.137$, $t''/t=.01$ with $\delta_{peak}$$=$$0.13$ and (iii)(purple) $t'/t$$=\!-0.181$, $t''/t$$=0.01$ with $\delta_{peak}$$=$$0.17$. Since we assumed $J/t\sim 0.3$ (\disp{Jeff}), $J_{eff}/t$ is considerably enhanced in the range of densities exhibiting high $T_c$. This enhancement in turn boosts up $g_{eff}$, via \disp{geff}, and hence plays an important role in giving an observable magnitude of $T_c$ in \figdisp{Fig-1-Tc} and \figdisp{Figure-Tc-Second}. \label{Fig-Jeff} } \end{figure} In \figdisp{Fig-Jeff} we illustrate the role of the feedback enhancement of the exchange $J$ due to the background spectral function discussed in \disp{Jeff}. \begin{figure}[htbp] \centering \includegraphics[width=.63\columnwidth]{geff-Figure-Final.pdf} \caption{\footnotesize The effective superconducting coupling $g_{eff}$ (\disp{geff}) for the three curves in \figdisp{Figure-Tc-Second}, with parameter sets- (i) (red) $t'/t$$=-0.159$, $t''/t$$=0.01$ with $\delta_{peak}=0.15$, (ii) (blue) $t'/t$$=-0.137$, $t''/t=.01$ with $\delta_{peak}=0.13$ and (iii)(purple) $t'/t$$=-0.181$, $t''/t$$=0.01$ with $\delta_{peak}=0.17$. The drastic decrease of $T_c$ on both sides of the peak values in \figdisp{Figure-Tc-Second} can be understood by referring to the the second y-axis, giving the approximate temperature scale $T_c^{appx}= 10^4 \times e^{- \frac{1}{g_{eff}}}$ K. \label{Fig-geff} } \end{figure} For each set of parameters, there is a density region where both the DOS at the fermi energy and the averaged d-wavefunction are enhanced, and the confluence directly enhances $J_{eff}$. In turn this is reflected in the superconducting coupling $g_{eff}$. In \figdisp{Fig-geff} we see how the confluence of enhancements in the DOS and in the d-wavefunction $\Psi(\mu_0)$, further boosts the superconducting coupling $g_{eff}$ and offsets to some extent the suppression due to a small magnitude of $Z$, as seen in \disp{geff}. As a result of this competition $T_c$ turns out to be in the observable range. The additional y-axis in \figdisp{Fig-geff} translates the superconducting coupling $g_{eff}$ to an order of magnitude type transition temperature $T^{appx}_c= e^{-1/g_{eff}} \times 10^4 \; K$. This scale helps us to understand why $T_c$ falls off so rapidly when $\delta$ increases beyond the peak value where the coupling $g_{eff}$ falls below $\sim 0.12$, thereby rapidly suppressing $T_c$. \section{Conclusions \label{Conclusions}} This work presents a new methodology for treating extremely correlated superconductors. The exact equations of the normal and anomalous Greens functions in the superconductor are derived. These are further expanded in powers of a control parameter $\lambda$ related to the density of double occupancy, and the second order equations are given in Eqs.~(\ref{new-1},\ref{new-2},\ref{new-3}), together with the self consistency conditions Eqs.~(\ref{cstarf},\ref{gap-1}). A further simplification is possible for $T$$\sim$$T_c$ where the anomalous terms are small. This leads to a tractable condition for $T_c$ given in \disp{Tc20}, expressed in terms of the electron spectral function. Further analysis uses a model spectral function \disp{FLT}, which is simple enough to yield an explicit expression for $T_c$ in \disp{Tc}. More elaborate calculations should be feasible upon the availability of reliable spectral functions, when one may directly solve \disp{Tc1}. \textcolor{black}{ Our calculation delineates the regime of parameters where superconductivity is possible in the \ $t$-$J$ \ model within the ECFL theory. This regime turns out to be quite constrained. The calculation highlights the requirement of a substantial magnitude of the d-wavefunction average and the DOS at the fermi energy. It shows that $T_c$ is maximal at a density where $n(\mu_0)$, the bare DOS is peaked, and is co-located with the peak of the fermi surface average of the d-wavefunction \disp{D-wave} (inset \figdisp{Figure-Tc-Second}). The latter aspect is understandable, since the passing of the Fermi level energy dispersion through the zone boundary points $\{\pm \pi,0\}, \{0,\pm \pi\} $, promotes a peak in the DOS, and also leads to the maximization of $(\cos p_x-\cos p_y)^2$. The prediction of a correlation between the peak in $T_c$ with a peak in the d-wavefunction average is testable, since the latter is amenable to measurement using angle resolved photoemission.} In the approximation used here, the maximum $T_c$ is nominally unbounded in a narrow density range here due to the logarithmic singularity of the DOS. It is expected to be cutoff to a finite value of ${\cal O }(10^2\mbox{K})$ due to a more exact integration over energies, when using a reliable spectral function, in the place of the model used here. Such an integration would also supersede the Gor'kov-type approximation of expanding around the fermi surface ($\int d\epsilon \; n(\epsilon) \sim n(\mu_0) \int d\epsilon$) employed here, thereby flattening out the sharp peak into a smoother shape. Finally this mean-field description of the superconductor is expected to be corrected by fluctuations of the phase, in a strictly two dimensional case, and by interlayer coupling, in the physically realistic case of a three dimensional system of weakly coupled layers. In conclusion this work contains the essential outline of a new formalism to treat superconducting states of models with extremely strong correlations, such as the \ $t$-$J$ \ model. A transparent calculation within a low order approximation is presented here. It demonstrates that the exchange energy $J$ can indeed provide the fundamental binding force between electrons forming Cooper pairs. It leads to superconductivity with $T_c$'s of ${\cal O }(10^2\mbox{K})$, in a finite range of densities located away from the insulator, as also experimentally found in cuprate superconductors. \section{Acknowledgements:} The work at UCSC was supported by the US Department of Energy (DOE), Office of Science, Basic Energy Sciences (BES), under Award No. DE-FG02-06ER46319.
\section{Introduction} \label{sec:intro} While navigating through the environment, our proprioception informs us about our posture, our eyes look for a familiar direction or goal, and our ears watch-out for dangers. The brain deals with multiple data-streams in a continuous and parallel manner. Autonomous vehicles requiring to safely manoeuvre in their environment also have to deal with such high-dimensional data-streams which are conventionally acquired and analysed at a fixed sampling frequency. A fixed sampling frequency limits the temporal resolution of data-processing and the amount of data which can be processed. To address these limitations, two approaches can be combined. First, data-streams can be sparsified by sending only information when an observed quantity changes, i.e. when it is required. Second, the data-stream can be processed in a parallel and asynchronous fashion. This calls for an alternative approach to sensing and computing which, much like the brain, acquires and processes information completely asynchronously and in a distributed network of computing elements, e.g. neurons and synapses. To fully demonstrate the advantages of this approach we use the example of autonomous navigation as it is well studied and algorithmically understood in a variety of environments be they water \cite{Kelasidi2019}, ground \cite{Floreano2014}, air \cite{Barca2013}, or space \cite{Rybus2018}. In the last decades, part of the engineering community has sought inspiration from animals \cite{Floreano2014, Pandey2017, Serres2018}. For example, flying insects such as bees and flies share the same requirements as light-weight flying vehicles manoeuvring in various habitats from almost object-free terrains \cite{Dickinson2014} to overly cluttered forests \cite{Baird2016} via human-made landscapes. They need to avoid collisions to prevent damaging their wings \cite{Mountcastle2016} and they accomplish this task by using limited neuronal resources (less than 1M \cite{Witthoft1967} and 100k \cite{Zheng2018} neurons for honeybees and fruit-flies respectively). At the core of this machinery is a well-described subset of neurons responding to the apparent motion of surrounding objects \cite{Borst2019, Fu2019computationalmodelscollision}. While the animal translates in its environment, the responses of such neurons provide estimates to the time-to-contact to nearby objects by approximating the apparent motion of the objects on the retina (i.e. the optic flow \cite{MartinEgelhaaf2012}). These neurons are thought to steer the animal away from obstacles \cite{Bertrand2015, Cope2016, Lecoeur2019TheRO, Mauss2020optic_flow} or toward gaps \cite{Baird2016gap, Ravi2019, Ravi2020} resulting in a collision-free path. \\ \indent The collision avoidance machinery in insects is thought to be driven by a large array of motion-sensitive neurons, distributed in an omnidirectional visual field. These neurons operate asynchronously. Hence, biology has found an asynchronous and distributed solution to the problem of collision avoidance. We seek to emulate such a solution in bio-inspired neuromorphic hardware which has the advantage of being low-volume and low-power. More importantly, it also requires an asynchronous and parallel information processing implementation yielding a better understanding of neural computation. \\ \indent To date, most of the mimics of the collision avoidance machinery rely on traditional cameras from which every pixel at every time point (i.e. at a fixed sampling frequency) needs to be processed \cite{Bertrand2015, Cope2016,Li2017,Serres2018, Zingg_etal10, Blosch_etal10}. The processing occurs even when nothing is changing in the agent's surroundings. This constant processing leads to a dense stream of data and consequently a high energy consumption. To reduce this, an efficient means of communication can be employed, such as action potentials observed in biological neural circuits. Action potentials or spikes enable to transmit information only when necessary, i.e. event-driven. In an analogous way, event-based cameras send events asynchronously only when a change in luminance over time is observed \cite{Posch2010, Lichtsteiner2008, Brandli2014, Posch2014, Son2017}. This sampling scheme is referred to as Lebesgue sampling \cite{Astrom_Bernhardsson02}. Contrary to frame-based cameras, which employ Riemann sampling \cite{Astrom_Bernhardsson02}, bandwidth and power demands are significantly reduced (see Section~\nameref{sec:vision} for more details). \\ \indent Open-loop collision avoidance based on optic-flow can use event-streams \cite{Benosman_etal13, Conradt2015, Milde2015, Liu2017, Rueckauer2016, Gallego2018, Haessig_etal18, Martel_etal15, Milde2018sEMD}(for more detailed comparison of mentioned approaches refer to \cite{Milde2018sEMD}) and an insect-inspired motion pathway has been suggested for collision avoidance \cite{Milde2018sEMD}. Closed-loop collision avoidance behaviour have been demonstrated previously using fully conventional sensory-processing (frame-based sensor and CPUs/GPUs) approaches \cite{Zingg_etal10, Blosch_etal10} (for extensive review please refer to \cite{Serres_Ruffier17, Fu_etal19}). These insect-inspired approaches reduce the computational demands for collision avoidance by reducing the bandwidth of the visual input. This reduction is achieved by collapsing the visual field into a left and right components. Later processing only needs to compare left versus right signals. These approaches, however, are hardwired processing of visual features. The hard-coded features may not be relevant in other environments. Mixed-system (event-based camera and conventional processing) approaches \cite{MullerConradt_eDVS2011, Gallego2018}, on the other hand, do not reduce the visual input by separating left-right signal pathways, but utilise event-based cameras which only transmit changes. In contrast to biological systems, they do not, however, leverage the advantages of event-based processing until the actuation of the motors. Finally, fully neuromorphic (event-based camera and parallel, asynchronous processing) approaches \cite{Milde2017, Kreiser_etal18} rely on spike-based information processing from sensing to actuation of motors. To date, these approaches rely on hardwired, deterministic decision making processing. The hard-coded decisions, i.e. creating a reflex-like machine, may lead to sub-optimal decisions when multiple directions to avoid collisions are viable. Here, we aim for the first time at closing the action-perception loop \cite{Serres_Ruffier17, Fu_etal19, Indiveri_Sandamirskaya19}, while explicitly extracting insect-inspired visual features, making active decisions, and using neuromorphic spike-based computation from sensing to actuation. \indent Inspired by the collision avoidance algorithm proposed for flies and bees, we developed a \ac{SNN}\footnote{Spiking Neural Network: Massively parallel network consisting of populations of spike-based artificial neurons and synapses.} that profits from the parsimony of event-based cameras and is compatible with state-of-the-art digital and mixed-signal neuromorphic processing systems. The response of the visual motion pathway of our network resembles the activity of motion-sensitive neurons in the visual system of flies. We ran closed-loop experiments with an autonomous agent in a variety of conditions to assess the collision avoidance and gap finding capabilities of our network. These conditions were chosen from the biological evidence for collision avoidance obtained for flying insects (empty box \cite{Schilstra1999}, corridors \cite{Serres2008, Baird2005, Kern2012blowfly, Linander2015}, gap crossing \cite{Baird2016, Ravi2019,Ravi2020}, and cluttered environments \cite{Mountcastle2016}). Our agent, utilising its underlying neural network, manages to stay away from walls in a box, centres in corridors, crosses gaps and meanders in cluttered environments. Therefore, it may find applications for autonomous vehicles. Besides, it may serve as a theoretical playground to understand biological systems by using neuromorphic principles replicating an entire action-perception loop. \section{Results} \label{sec:results} The \ac{SNN} model proposed in this work consists of two main components, namely a retinotopical map of insect-inspired motion detectors, i.e. \acp{sEMD} \cite{Milde2018sEMD}, and an inverse soft \ac{WTA} network (see Figure \ref{fig:network_response}d and Methods Figure \ref{fig:gap_network}). The former extracts \ac{OF} which, during a translation, is anti-proportionally related to the agent's relative distance to objects in the environment. The latter searches for a region of low apparent motion, hence an obstacle free direction (see Figure \ref{fig:network_response}a-c). After the detection of such a path in the environment the agent executes a turn towards the new movement course. We characterised the network in two steps. First we evaluated the \ac{sEMD}'s response and discussed similarities to its biological counterpart, i.e. T4/T5 neurons, which are thought to be at the core of elementary motion processing in fruit flies \cite{arenz2017temporal, drews2020dynamic}. Second, to further prove the real-world applicability of \ac{sEMD} based gap finding in an \ac{SNN}, we performed closed-loop experiments. We simulated an agent seeing the world through an event-based camera in the Neurorobotics physical simulation platform \cite{falotico2017NRP}. The camera output was processed by the \ac{SNN} resulting in a steering command. We selected a set of parameters that yield the agent to keep at least a mean clearance of \texttildelow6 a.u.\footnote{A.u.: Arbitrary unit, distance divided by robot size, see section \nameref{subsection:environments}} to objects in a box and to enter corridors only with a width greater than 10 a.u. (see Appendix section \nameref{sec:appendix_connectivity}). We tested the performance of this simulated agent with these parameters in all reported experimental conditions hereafter. These experimental conditions were inspired by previous experiments with flying insects. \begin{figure}[t] \centering \includegraphics[width=\textwidth]{figures/ensambles/figure1.png} \caption{(a-c) Network response in a cluttered environment, (d) collision avoidance network, (e) normalised \ac{sEMD} mean response to a square wave grating and (f) robot used in real-world experiment. a) Cluttered neurorobotics platform environment. The obstacle walls are covered with vertical square-wave-gratings only visible for the event-based camera b) Green areas: simulated event-based camera events directly extracted from the Neurorobotics visual front-end while the agent is slowly moving through the scene in a). c) Bright blue and orange dots: \ac{TDE} left-right and right-left spike response to the scene in a) binned over \texttildelow0.5 seconds of simulation time, pink stripe: inverse \ac{WTA} spike which indicates an obstacle free direction. This spike activates the agent's next turning movement (saccade) by exciting one of the two motor populations in d). The location of the winning neuron defines the direction and duration of the upcoming turn. d) Collision avoidance network with \acfp{sEMD} which consist of an event-based camera, a \acf{SPTC} population and two \acf{TDE} populations. Event-based camera (sensory input), \ac{SPTC} population (noise filter and downsampling), \ac{TDE} populations (time-to-travel translation to spike rate and \acf{ISI}), \acf{INT} population (reduces 2D retinotopical map to 1D), inverse \acf{WTA} population (detects minimum of \ac{OF}, hence obstacle free direction), \acf{ET} population (triggers turn when inverse \ac{WTA} can not find direction), \acf{MOT} populations (control turn direction and duration), \acf{OFI} population (modulates robot velocity), \acf{POIS} (drive decision process with Poisson spike process) and \acf{GI} population (suppresses loosing neurons in inverse \ac{WTA} population and \ac{ET} population). e) Normalised preferred direction and null direction mean response of two Nest \ac{sEMD} populations to a square wave grating moving in one cardinal direction with a wavelength of \SI{20}{\degree} and \SI{100}{\percent} relative contrast recorded with an event-based camera at \SI{5000}{\lux} illumination. The standard deviation was calculated on the response of the \ac{sEMD} population. f) Robot used for real-world experiment in Figure \ref{fig:behaviours}d. An embedded event-based camera serves as input to a SpiNN-5 board which drives the motor controllers through an Odroid mini-computer.} \label{fig:network_response} \end{figure} \subsection{Spiking Elementary Motion Detector} \label{subsec:results sEMD} The \ac{sEMD} represents an event-driven adaptation for neuromorphic sensory-processing systems of the well established correlation-based elementary motion detector \cite{hassenstein1956emd}. To evaluate the response of the \ac{sEMD} in the Nest simulator \cite{Diesmann2003NESTAE}, we compared the normalised velocity tuning curves of its ON-Pathway (with recorded event-based camera's input) to the corresponding normalised tuning curve of \textit{Drosophila's} T4 and T5 neurons \cite{Haag2016}. Both velocity tuning curves are determined in response to square-wave gratings with \SI{100}{\%} contrast and a wavelength of \SI{20}{\degree} moving at a range of constant velocities (with temporal frequencies from \SI{0.1}{\Hz} to \SI{10}{\Hz}). The \ac{sEMD} preferred direction exhibits a bell-shaped velocity tuning curve (see Figure \ref{fig:network_response} e), which has the maximum response (mean population activity) at \SI{5}{\Hz}. The null direction response is much lower than the preferred direction. The \ac{sEMD} model, which is composed of an event-based camera, a \acf{SPTC} population and the \acf{TDE} (see Figure \ref{fig:gap_network}), exhibits a drop in its output response when the temporal frequency exceeds \SI{5}{\Hz}. This drop is, however, not anticipated from the \ac{TDE}'s response (see Figure \ref{fig:sEMD}). We would expect the response to saturate at high temporal frequencies since the \ac{TDE} produces interspike intervals and firing rates proportional to the time difference between the two inputs of the \ac{TDE}. The drop in response being rather a consequence of the motion detector model itself, we suggest it to be a consequence of the spatio-temporal band-pass filtering installed by the \ac{SPTC} layer. While low temporal frequencies lead to unambiguous spatio-temporally correlated and causal \ac{SPTC} spikes from adjacent neurons, high temporal frequencies lead to anti-correlated and non-causal spikes. Thus, the \ac{TDE} can no longer (spatially) match the spikes unambiguously, which results in a bell-shaped velocity tuning curve of the preferred direction response. A similar bell-shaped velocity tuning curve can be observed in \textit{Drosophila}'s T4 cells \cite{Haag2016,arenz2017temporal, Borst2019}. While \textit{Drosophila}'s velocity tuning curves peak at \SI{3}{\Hz} in a drug induced flying state, the \ac{sEMD}'s preferred direction velocity tuning curve peaks at \SI{5}{\Hz}. This suggests that based on the reported parameter set of the \ac{sEMD}, it is tuned to higher relative velocities. The model performs in a robust way for a wide range of illuminations (from \SI{5}{lux} to \SI{5000}{lux}) and relative contrasts (\SI{50}{\percent} response reached at approximately \SI{35}{\percent} relative contrast), as shown in Figure \ref{fig:IlluminationAndContrast}. The \ac{sEMD} approximates the elementary motion processing in the fly brain. This processing is part of the input to the flight control and collision avoidance machinery, hence it can be used as an input for determining a collision-free path. \subsection{Agent's Behaviour} \label{subsec: results agent} The robot's collision avoidance performance was evaluated in an experiment with the agent moving through environments with varying obstacle density. To further understand the mechanisms underlying the robot's movement performance two more experiments were designed. The agent's gap crossing behaviour and tunnel centering behaviour were investigated. These behaviour were analysed in insects in a plane, therefore little is known about the effect of flying altitude in most behaviour. We limited our agent to a 2D motion due to this limited understanding. \begin{figure}[t] \centering \includegraphics[width = \textwidth]{figures/ensambles/figure2.png} \caption{Agent's behaviour in different environments. a-c) Trajectories recorded in arenas with increasing obstacle densities. d) Comparison of real-world centering behaviour (red) to Neurorobotics Platform behaviour (black) in a corridor with normalised corridor width and an absolute corridor length of approximately one meter. e) Simulated robot's trajectory in the gap crossing experiment in a large arena. Colour represents time ($t_0$: light blue, $t_{end}$: magenta). f) Simulated robot's performance in different environments as shown in a-c with modulated velocity. Simulation time at which the simulated robot leaves the arena, collides or the time is over. g) Trajectories in tunnels with a tunnel width of 15, 12.5 and 11.25 a.u.. h) Gap crossing probability in dependency of the gap width for a large and a small arena. i) Simulated robot's performance in cluttered environments as shown in a-c with modulated velocity (black, calculated from data in f) and fixed velocity (grey). Agent's success rate, hence number of runs without collisions. j-l) Agent's variance from tunnel center for different tunnels.} \label{fig:behaviours} \end{figure} \subsubsection{Densely Cluttered Environments} \label{subsubsec: cluttered} We evaluated the agent's collision avoidance performance in an arena with an obstacle density\footnote{Obstacle density: Percentage of total area covered with objects.} between \SI{0} and \SI{38}{\percent}(0.05 objects per square a.u.). The simulation stops either when the robot collides with an obstacle\footnote{Collision: Simulated robot's outline overlaps with area occupied by object}, when it leaves the arena, or when the simulation real-world-time of six hours is over (see Figure \ref{fig:behaviours}f). At low obstacle densities ($<5\%$) there exist several collision-free paths. The robot exhibits a random walk as the decision making inverse \ac{WTA} neuron population is receiving background spiking activity sampled from a Poisson process (see Figure \ref{fig:behaviours}a,f). In the absence of \ac{OF} input the Poisson distributed background spikes dominates the inverse \ac{WTA} output which results in a probabilistic decision process. The decisions made by the network become less probabilistic with increasing obstacle density since the robot starts to follow the locally low object-density paths forming in the environment (see Figure \ref{fig:behaviours}b,f). At obstacle densities higher than \SI{20}{\percent} most of the gaps in the environment are smaller than the robot's minimum mean obstacle clearance\footnote{Obstacle clearance: Robot's distance to the center of the closest object.} of 7 a.u. (see Figure \ref{fig:clearance} left) so that the agent stays close to its start location (see Figure \ref{fig:clearance} right and Figure \ref{fig:behaviours}c,f). In this range the robot starts to crash into obstacles reaching a minimum success rate of around \SI{60}{\percent} at \SI{22}{\percent} obstacle density. For higher obstacle densities the success rate increases again (see Figure \ref{fig:behaviours}i). A collision of the robot is generally caused by the robot's too long reaction time in an environment with low mean obstacle clearance, hence with high obstacle density (see Figure \ref{fig:clearance}). Since the robot only senses visual stimuli in a 140 degrees horizontal visual field, symmetrically centered around its direction of motion, there is a blind-spot behind the agent. After a strong turn the simulated robot might be confronted with a previously not seen object and directly crash into it. Nevertheless, the agent shows a very robust gap centering behaviour in a large range of different environments with obstacle densities between \SI{0} and \SI{38}{\percent}. The robot's mean success rate amounts to \SI{81}{\percent}. \\ \indent While local \ac{OF} is instrumental in finding gaps, global \ac{OF} provides information about the clutteredness of the environment. Flies and bees decrease their flying speed when the clutteredness of the environment increases \cite{Kern2012blowfly, Baird2005}. Our agent regulates its speed based on the global \ac{OF} and, consequently, moves slower in denser regions of the environment (see Figure \ref{fig:velocity}). To examine the effect of the velocity dependency, we ran a second experiment with the robot moving with constant velocity (see Figure \ref{fig:behaviours}i and Figure \ref{fig:cluttered}). With velocity control collisions were encountered only in few runs, however, for obstacle densities higher than 24 percent the number of collisions significantly increased when the velocity was kept constant. \subsubsection{Gaps} \label{subsubsec: results gaps} When presented with a choice between two gaps of different size bees prefer to pass the larger gap \cite{Baird2016, Ong2017}. This behaviour decreases the insect's collision probability significantly. While bees might choose the gap in a complex decision process \cite{Ravi2020} our agent's preference underlies a simple probabilistic integration mechanism. The simulated robot's upcoming movement direction is determined by an inverse \ac{WTA} spike occurring in an obstacle-free direction as shown in Figure \ref{fig:network_response}a-c. When confronted with a small and a large gap the probability of an inverse \ac{WTA} spike appearing in the greater gap is higher. Hence, we assume that the robot automatically follows pathways with a larger gap size. To evaluate this assumption we observed the robot's gap crossing in an arena with two alternative gaps (see Figure \ref{fig:behaviours}e). The robot can decide to cross any of the two gaps or stay in one half of the arena. There is a competition between staying in the open-space and crossing a gap. The larger the gap size is, the more likely the robot will cross a gap. We investigated the probability to cross gaps by having two gaps, one with a fixed gap size (10 times the agent width), the other with a gap size between 5 a.u and 13 a.u. We calculated the gap entering probability by comparing the number of passes through both gaps. As expected the entering probability increases with gap size until a width of 10 a.u. (see Figure \ref{fig:behaviours}h). For a larger gap width the entering probability does not change significantly. However, for smaller gap sizes the probability of a spike pointing towards open space in the inverse \ac{WTA} becomes significantly higher. Therefore, the robot prefers to pass through gaps of larger size. Besides the gap width the arena size changes the passing probability. In a smaller arena the simulated robot stays closer to the gap entry which increases the relative gap size sensed by the agent. Therefore, a larger part of the vehicle's visual field is occupied by the gap entry which increases the probability of a spike occurring in the gap area. In a smaller arena we observed that the robot's gap entering probability is higher for gaps smaller then 10 a.u. than in a big arena (see Figure \ref{fig:behaviours}h). A decrease in arena size can be compared to an increase in obstacle density since both parameters reduce the robot's obstacle mean clearance (see Figure \ref{fig:clearance}, left). Therefore, the agent tends to enter gaps of smaller size in densely cluttered environments. This automatic scaling mechanism keeps the agent's collision probability very low in sparsely cluttered environments by staying away from small gaps. In environments with high obstacle density the robot still keeps its mobility by passing through smaller gaps. Finally, when the obstacle density exceeds \SI{20}{\percent}, most gaps fall below the gap entering threshold so that the robot can not leave the arena anymore (see Figure \ref{fig:clearance}, right and Figure \ref{fig:behaviours}c,f). \subsubsection{Corridors} \label{subsubsection:resultscorridors} One common experiment to characterise an agent's motion vision response is to observe its centering behaviour in a tunnel equipped with vertical stripes on the walls. The simple geometry of the environment enables the observer to directly relate the received visual input with the agent's actions. In bees and flies an increase in flight velocity proportionally to the tunnel width has been observed \cite{Kern2012blowfly, Lecoeur2019TheRO, Baird2005}. In very narrow tunnels insects show a pronounced centering behaviour which declines with increasing tunnel width. We evaluated the robot's performance in three tunnels with different tunnel widths. Similar to the biological role model the robot's velocity stands in a positive linear relationship with the tunnel width. The measured velocity in a.u. per second is \texttildelow0.79, \texttildelow0.75 and \texttildelow0.72 for a tunnel width of 15, 12.5 and 11.25 a.u. respectively. Furthermore, the robot always stays in the center of the tunnel, especially in very narrow tunnels (see Figure \ref{fig:behaviours}g). The deviation from the tunnel center is proportional to the tunnel width (for the simulated robot, see Figure \ref{fig:behaviours}j--l, physical robot see \ref{fig:behaviours}d). Therefore, similar to observations in blowflies, the robot's lateral position in the tunnel changes linearly with the tunnel width \cite{Kern2012blowfly}. \section{Discussion} \label{sec:discussion} Autonomous agents need to successfully avoid obstacles in a variety of different environments, be they human made or of natural origin. Our investigations present a closed-loop proof of concept of how obstacle avoidance could be performed in a parsimonious, asynchronous and fully distributed fashion. While most results reported here are based on computer simulations, the implementation on digital or mixed-signal neuromorphic hardware of each building block of the simulated \ac{SNN} have been demonstrated for event-based cameras \cite{Lichtsteiner2008}, the \ac{sEMD} \cite{Milde2018sEMD, Schoepe2019sensoryintegration} (see Figure \ref{fig:IlluminationAndContrast}), artificial neurons \cite{Indiveri_etal06} and synapses \cite{Bartolozzi_Indiveri07}, as well as the inverse \ac{WTA} \cite{horiuchi2009batnavigation}. We demonstrated for the first time a simulation of a neuromorphic system that takes informed decisions while moving in its environment by closing the action-perception loop. We emulated this system on neuromorphic sensory-processing hardware carried by a physical robot (see Figure~\ref{fig:network_response}f, ~\ref{fig:behaviours}d,~\ref{fig:robot} and~\ref{fig:real_worl_results}), tested it in a corridor centering experiment, and obtained similar results to the simulation. These real-world experiments suggest that the underlying computational primitives lead to robust decision making in operational real-time. Due to the physical simulation with the engine Gazebo that capture the physics of the movements and our real-world proof of implementation, our simulations are likely to translate to real-world situations. While producing relatively simple, yet crucial decisions, the proposed model represents a critical milestone towards enabling parallel, asynchronous and purely event-driven neuromorphic systems. Our proposed \ac{SNN} architecture comprises of \texttildelow 300k synapses and \texttildelow 4k neurons which yields a low-power, lightweight and robust neural algorithm. When implemented on mixed-signal neuromorphic processing hardware, e.g. \cite{Moradi_etal17, painkras2013spinnaker, Wang_vanSchaik18}, the payload required to perform on-board processing will be drastically reduced. This reduction stems from the low volume and lower power requirements of neuromorphic hardware. In addition such hardware implementation would ensure operational real-time decision making capabilities. The features outlined above are quite desirable in the context of highly constrained autonomous systems such as drones or other unmanned vehicles. \\ \indent We investigated the performance of the \acp{sEMD}, the apparent motion encoders in our \ac{SNN}, in detail. The \acp{sEMD} show a similar velocity response curve to motion-sensitive neurons (e.g. T4 and T5 neurons in the fruitfly's brain \cite{Borst2019, Mauss2020optic_flow}) when presented with a grating of \SI{20}{\degree} spatial frequency and temporal frequencies between \SI{0.1} and \SI{10}{\Hz}. Due to the logarithmic illumination sensitivity of the event-based cameras the motion vision apparatus is very robust against absolute brightness levels in the range of \SI{5} up to \SI{5000}{lux}. The \ac{sEMD} model shows a much higher sensitivity regarding contrast changes than its biological role model. Current research suggest that \textit{Drosophila}'s optical lobe performs contrast normalisation through inhibitory recurrent feedback to evoke a contrast independent response \cite{drews2020dynamic}. In a next step we will implement contrast normalisation in our motion vision network to improve its performance in natural environments. \\ \indent Besides the similarities in neural response, the agent showed many similarities to flying insects in its behaviour in spatially constrained environments. It meandered in cluttered terrain (Section \nameref{subsubsec: cluttered}), modulated its speed as a function of object proximity (Section \nameref{subsubsection:resultscorridors}), selected wider gaps (Section \nameref{subsubsec: results gaps}), centered in tunnels (Section \nameref{subsubsection:resultscorridors}), while using an active gaze strategy known as saccadic flight control (Section \nameref{subsection:GFnetwork})\cite{Kern2012blowfly, Lecoeur2019TheRO, Baird2005, Ong2017, Schnell2017ADN}. The agent moved collision-free through cluttered environments with an obstacle density between \SI{0} and \SI{38}{\percent} with a mean success rate of \SI{81}{\percent}\footnote{Several closed-loop, insect-inspired approaches have been demonstrated \cite{Fu_etal19, Serres_Ruffier17}, however, due to a missing unifying benchmark and evaluation metric, to compare insect-inspired collision avoidance algorithms, we cannot provide a quantitative comparison}. We further examined the simulated robot's performance to understand the essential behavioural components which led to a low collision rate. The most significant ingredient in that regard was the implementation of an \ac{OF} strength dependent locomotion velocity. This insect inspired control mechanism improved the collision avoidance performance of the agent from a mean success rate of \SI{76}{\percent} to \SI{81}{\percent} (Compare Figure \ref{fig:behaviours}i and Figure \ref{fig:cluttered}). We propose that this velocity adaptation mechanism could be regulated in insects by a simple feedback control loop. This loop changes the agent's velocity anti-proportionally to the global \ac{OF} integrated by a subset of neurons (For further explanations see Section \nameref{subsection:GFnetwork}). \\ \indent An \ac{OF}-dependent control of locomotion velocity is only one of at least three mechanisms which decreased the agent's rate of collision. When moving in environments of high obstacle density the simulated robot follows locally low obstacle density paths. We suggest that a probabilistic decision process in the network model automatically keeps the agent's collision probability low by following these pathways. We further investigated this path choice mechanism in a second experiment. Here, the agent had to cross two gaps of different size. The dependence of the agent' probability to cross the gap resembled that of bees \cite{Ong2017}. Similar to insects the agent preferred gaps of larger size. Bees cross gaps with a gap-size as small as 1.5 times their wingspan \cite{Ravi2020}. In contrast our agent crossed gaps of 5 times its body width. This discrepancy in performance may be due to the absence of a goal. A goal can be understood as providing an incentive to cross a gap despite a risk of collision. Indeed in behavioural experiments, bees had to cross the gap to return to their home. Combining different directions, such as a collision-free path and a goal, require an integration of the two signal representations. Such networks have been proposed for navigating insects \cite{Sun_etal20}. Integration of similar streams of information have been demonstrated to work in neuromorphic systems \cite{Kreiser_etal18b,Schoepe2019sensoryintegration, Blum_etal17}, however, we envision that a dynamic competition between collision avoidance and goal reaching neural representations could allow our robot to cross gaps 1.5 times its width. The findings reported here indicate an alternative point of view how flies and bees could use motion-vision input to move through the environment, not by collision avoidance but by gap finding. As also stated by Baird and Dacke \cite{Baird2016}, flies and bees might not actively avoid obstacles but fly towards open space, i.e. gaps. Looking at our network, we suggest that \ac{WTA} alike structures in flying insect brains might integrate different sensory inhibitory and excitatory inputs with previously acquired knowledge to take navigational decisions. One could think of the central complex as such a structure which has been described recently in several insect species \cite{Honkanen2019CXreview}. \\ \indent The third mechanism is the agent's centering behaviour. By staying in the middle of a tunnel with similar patterns on both walls the simulated robot minimises its risk of colliding with a wall. The agent's deviation from the tunnel center changes approximately linearly with the tunnel width. These results show a very strong resemblance with experimental data from blowflies (see Figure \ref{fig:behaviours}j--l) \cite{Kern2012blowfly}. So far centering behaviour was suggested to result from balancing the \ac{OF} on both eyes. Centering in a tunnel can be seen as crossing elongated gaps. Our agent is also able to cross gaps. Two hypothesis have been suggested to cross gaps in flying insects, using the \ac{OF} contrast \cite{Ravi2019} and the brightness \cite{Baird2016}. Our results suggest that collision avoidance could be mediated by identifying minimum optic flow to center in tunnel, cross gaps, or meander in cluttered environment. This strategy has so far not been investigated in flying insects. The main hypothesis to control flight in clutter is to balance either an average or the maximum \ac{OF} on both eyes \cite{Lecoeur2019TheRO}. Further behavioural experiments are required to disentangle between the different strategies and their potential interaction. Building on the work of \cite{Baird2016}, the different hypothesis could be placed into conflict by creating a point-symmetric \ac{OF} around the gap center (leading to centering), a brightest point away from the gap center, and a minimum \ac{OF} away from the center (e.g. by using an \ac{OF} amplitude following a Mexican hat function of the radius from the geometric center). \\ \indent Our model shares several similarities with the neural correlate of visually-guided behaviour in insects, including motion-sensitive neurons \cite{Mauss2020optic_flow}, an integration of direction \cite{Sun2020navigation}, efference copy to motion-sensitive neurons \cite{Kim2015CellularEF}, and neurons controlling the saccade amplitude \cite{Schnell2017ADN}. Our agent was able to adopt an active gaze strategy thanks to a saccadic suppression mechanism (due to an inhibitory efference copy from the motor neurons to the inverse \ac{WTA} and motion-sensitive neurons). When the inverse \ac{WTA} layer did not "find" a collision-free path (i.e. a solution to the gap finding task), an alternative response (here a U-turn) was triggered thanks to global inhibitory neurons and excitatory-inhibitory networks (GI-WTA-ET, for more details see Section~\nameref{subsection:GFnetwork}). The neuronal correlate of such a switch, to our knowledge, has not been described in flying insects. Our model, thus, serves as a working hypothesis for such a neuronal correlate. Furthermore, by varying the connection between \ac{sEMD}-inverse \ac{WTA}, we could allow the agent to cross smaller gaps. We hypothesise that differences in clearance or centering behaviour observed between insect species \cite{Baird2016, Ravi2019} could be due to different wiring or modulation between motion-sensitivity neurons and direction selection layer, likely located in the central complex. \\ \indent In this study we demonstrated a system-level analysis of a distributed, parallel and asynchronous neural algorithm to enable neuromorphic hardware to perform insect-inspired collision avoidance. To perform a wide variety of biological-relevant behaviour the network comprised approximately 4k neurons and 300k synapses. The agent guided by the algorithm robustly avoided collision in a variety of situations and environments, from centering in a tunnel to crossing densely cluttered terrain and even gap finding, solved by flying insects. These behaviour were accomplished with a single set of parameters, which have not been optimised for any of those. From the investigation of the agent and its underlying behaviour, we hypothesise that insects control their flight by identifying regions of low apparent motion, and that excitatory-inhibitory neural structures drive switches between different behaviours. With these investigations we hope to advance our understanding of closed-loop artificial neural computation and start to bridge the gap between biological intelligence and its neuromorphic aspiration. \newpage \section{Methods} \label{sec:methods} Most experiments in this article were conducted in simulation using either the Nest \acf{SNN} simulator \cite{Diesmann2003NESTAE} or the Neurorobotics Platform environment \cite{falotico2017NRP}. A corridor centering experiment was conducted in a real-world corridor centering experiment using a robotic platform equipped with the embedded Dynamic Vision Sensor\footnote{The embedded Dynamic Vision Sensor follows the same operational principles of event-based cameras as described in Section~\nameref{sec:vision} but features a much more compact design} as visual input and a SpiNN-5 \cite{painkras2013spinnaker} board for \ac{SNN} simulation in computational real-time. Sensory data for the \ac{sEMD} characterisation were recorded with an event-based camera in a real world environment. The hardware, software, \ac{SNN} models and methodologies used in this article are explained in the following. \subsection{Spiking Neural Networks} \label{subsec:meth SNNs} In contrast to conventional processing as postulated by von Neumann \cite{Laird2009} which is characterised by synchronous and inherently sequential processing, neural networks, whether rate-based or spike-based, feature parallel and distributed processing. Artificial neural networks, the rate-based counterpart of \acp{SNN}, perform synchronous and clock-driven processing, \acp{SNN}, additionally, feature an asynchronous and event-driven processing style. \acp{SNN} represent a promising alternative to conventional von Neumann processing and hence computing which potentially feature low-latency, low-power, distributed and parallel computation. Neuromorphic hardware present a solution to the aforementioned limitations of conventional von Neumann architectures including parallel, distributed processing \cite{thakur2018neuromorphic} in the absence of a central clock \cite{Mead_1989, Liu_2015}, as well as co-localisation of memory and computation \cite{Payvand_etal19, Serb_etal20}. Moreover, neuromorphic processors benefit from the underlying algorithm to be implemented in a \ac{SNN}. Emulating a \ac{SNN} on a neuromorphic processor (especially a mixed-signal one) enables the network to operate in continuous time\footnote{A time-continuous mode of operation, in contrast to a time-varying one, is characterised by the absence of a fixed sampling frequency} as time represents itself \cite{Mead_1989}. \acp{SNN} consist of massively parallel connected networks of artificial synapses and spiking neurons \cite{gerstner_kistler_2002}. \acp{SNN}, as any processing algorithm, aim to structure and represent incoming information (e.g. measurements) in a stable, robust and compressed manner (e.g. memory). Measurements sampled at fixed time intervals have the disadvantage that collected data is highly redundant and prone to aliasing if the signal of interest varies faster than half the sampling frequency. Event-driven approaches to sampling alleviate these limitations. As incoming measurements shouldn't be sampled at fixed temporal intervals, they need to be taken based on fixed or relative amplitude changes to take full advantage of the time-continuous nature of \acp{SNN} and neuromorphic hardware. Such measurements can be obtained from different sensory domains (e.g. touch \cite{Khalil2017CMOS}, smell \cite{drix2020resolving}, auditory \cite{Liu2014AsynchronousBS, vanSchaik2007AEREAR} and vision \cite{Mahowald1992VLSI, Lichtsteiner2006}), with vision being the most studied and well understood sensory pathway (but see \cite{Olshausen2005How} for a critical review) both in the brain and its artificial aspiration. While images taken with conventional cameras can be converted to spike trains which are proportional to the pixel intensity\footnote{To perform this conversion one can use a different encoding schemes including rank-order code \cite{Thorpe1998Rank}, timing-code \cite{Thorpe1990SpikeAT}, \cite{Masquelier12} or Poisson rate-code.}, event-based cameras directly sample only relative changes of log intensity and transmit events. A variety of event-based cameras have been proposed in the last two decades \cite{Lichtsteiner2006, Lichtsteiner2008, Posch2010} that all feature an asynchronous, parallel sampling scheme\footnote{Level sampling means that a given time-continuous signal is sampled when the level changes by fixed (relative) amount $\epsilon$, whereas time sampling, i.e. Nyquist-Shannon sampling, means that the signal is sampled when the time has changed by fixed amount $\epsilon$} in which changes are reported at the time of occurrence in complete time-continuous manner. The output of event-based cameras is hence ideally suited to be processed by an \ac{SNN} implemented on a neuromorphic processor. We collected real-world data using the DVS128 event-based camera \cite{Lichtsteiner2008} to characterise the \ac{sEMD} response (see Figure \ref{fig:network_response}e). The event-based camera comprises 128$\times$128 independently operating pixels which respond to relative changes in log-intensity, i.e. in temporal contrast. When the change in light intensity exceeds an adaptive threshold the corresponding pixel produces an event. The address and polarity of the pixel are communicated through an Asynchronous Event Representation bus \cite{Mahowald1992VLSI}. Light increments lead to ON-events, whereas light decrements lead to OFF-events. The sensor reaches a dynamic range of more than 120 dB and is highly invariant to the absolute level of illumination due to the logarithmic nature of the switched-capacitor differencing circuit \cite{Lichtsteiner2006, Lichtsteiner2008}. \\ \subsection{Spiking Elementary Motion Detector} \label{subsec: meth sEMD} In 2018 we proposed a new insect-inspired building block for motion vision in the framework of \acp{SNN} designed to operate on the out event-stream of event-based cameras, the \ac{sEMD}\cite{Milde2018sEMD}. The \ac{sEMD} is inspired by the computation of apparent motion, i.e. \acf{OF}, in flying insects. In contrast to its correlation-based role model the \ac{sEMD} is spike-based. It translates the time-to-travel of a spatio-temporally correlated pair of events into direction dependent, output burst of spikes. While the \ac{sEMD} provides \ac{OF} estimates with higher precision when the entire burst is considered (rate-code), the interspike interval distribution (temporal-code) within the burst provides low-latency estimates. The \ac{sEMD} consists of two building blocks, a retina to extract visual information from the environment, and the \ac{TDE} which translates the temporal difference into output spikes (see Figure \ref{fig:sEMD}a). When the \ac{sEMD} receives an input spike at its facilitatory pathway an exponentially decreasing gain variable is generated. The magnitude of the synaptic gain variable during the arrival of a spike at the trigger synapse defines the amplitude of the excitatory post-synaptic current generated. This current integrates onto the \ac{sEMD}'s membrane potential which generates a short burst of output spikes. Therefore, the number of output spikes encodes direction sensitive and anti-proportionally the stimulus' time-to-travel (see Figure \ref{fig:sEMD}e) between two adjacent input pixels. We implemented and evaluated the motion detector model in various software applications (Brian2, Nengo, Nest), in neuromorphic digital hardware (SpiNNaker, Loihi) and also as analog CMOS circuit \cite{Milde2018sEMD, Schoepe2019sensoryintegration}. \begin{figure}[th!] \centering \includegraphics[width = 0.5\textwidth]{figures/TDE_new.png} \caption{Spiking Elementary Motion Detector model adapted from \cite{DAngelo2020EventBasedEM}. a) \ac{sEMD} model consisting of visual input and \ac{TDE} unit. Two adjacent retina inputs are connected to the facilitatory synapse (fac) and the trigger synapse (trig). The fac synapse controls the gain of the trig synapse postsynaptic current (epsc) which integrates onto the \ac{LIF} neuron's membrane potential which produces output spikes (out). b) model behaviour for small positive $\Delta t$. c) behaviour for large positive $\Delta t$. d) behaviour for negative $\Delta t$. e) number of output spikes over $\Delta t$.} \label{fig:sEMD} \end{figure} \subsection{Collision Avoidance Network} \label{subsection:GFnetwork} The collision avoidance network (see Figure \ref{fig:gap_network}) extracts a collision-free direction from its \ac{sEMD} outputs and translates this spatial information into a steering command towards open space. The first layer, the event-based camera, generates an event when a relative change in log-illumination, i.e. temporal contrast, is perceived by a pixel. A macropixel consists of 2 x 2 event-based camera pixels. Each macropixel projects onto a single current-based exponential \ac{LIF} neuron (hereafter referred to as \ac{LIF} for sake of clarity) in the \acf{SPTC} layer (in Nest the neuron model used throughout this study is called iaf\textunderscore psc\textunderscore exp). Each single \ac{SPTC} neuron emits a spike only when more than 50\% of the pixels within a macropixel elicit an event within a rolling window of \SI{20}{ms}. Therefore, the \ac{SPTC} population removes uncorrelated events, which can be interpreted as noise. Additionally, it decreases the network resolution from 128 times 40 pixels to 64 times 20 neurons. The next layer extracts \ac{OF} information from the filtered visual stimulus. It consists of two \ac{TDE} populations sensitive to the two horizontal cardinal directions respectively. Each \ac{TDE} receives facilitatory input from its adjacent \ac{SPTC} neuron and trigger input from its corresponding \ac{SPTC} neuron. The facilitatory input might arise either from the left (left-right population) or from the right (right-left population). The \ac{TDE} output encodes the \ac{OF} as number of spikes in a two-dimensional retinotopical map. Since the agent moves on the ground it only estimates the amount of horizontal \ac{OF}. Hence, the subsequent \ac{INT} population integrates the spikes of each \ac{TDE} column in a single \ac{LIF} neuron. This layer encodes the \ac{OF} in a one-dimensional retinotopical map. The subsequent population, an inverse soft \acf{WTA} determines the agent's movement direction, a minimum of \ac{OF} in the one-dimensional retinotopical map. Since \ac{OF} encodes the relative distance to objects during a translational movement this direction represents an object-free pathway, hence the inverse \acf{WTA} is inverted by sending feed-forward inhibition into the neural population. A population of \ac{POIS} injects Poisson distributed background spikes which ensures a neuron within the inverse \ac{WTA} to win at any moment in time even in the absence of \ac{OF}. In the absence of \ac{INT} input the inverse \ac{WTA} neuron with the strongest \ac{POIS} input wins and suppresses through the \ac{GI} neuron the activity of all others. Local lateral connections in the inverse \ac{WTA} population strengthen the winning neuron due to excitatory feedback (For the sake of clarity recurrent excitation is not shown in Figure \ref{fig:gap_network}). \begin{wrapfigure}{r}{0.52\textwidth} \includegraphics[width=0.5\textwidth]{figures/collision_avoidance_network2.jpg} \caption{Collision avoidance network. The macropixels (2x2 pixels) of the \acf{EBC} project onto single neurons of the \acf{SPTC} population removing uncorrelated noise. Two adjacent \ac{SPTC} neurons are connected to one \acf{TDE} in the left-right sub-population and the right-left sub-population respectively. Trigger and facilitator connection are opposite in the two populations. The \acf{INT} population reduces the two dimensional retinotopical map to a one-dimensional map by integrating the spikes of each \ac{TDE} column onto a single \ac{LIF} neuron. The inverse \acf{WTA} population and \acf{ET} population become excited by Poisson spike sources. The winner-take-all mechanism is driven by recurrent suppression through the \acf{GI} neuron. The two \acf{MOT} populations are activated by a spike in the inverse \ac{WTA} population. The id of the spiking inverse \ac{WTA} neuron defines which \ac{MOT} becomes activated and for how long. When the \ac{ET} neuron spikes the left \ac{MOT} population becomes activated for the maximal time duration. When the \ac{MOT} population is inactive the robot moves straight foward collecting apparent motion information. When one \ac{MOT} population is active the robot turns. All-to-all inhibition between the \ac{MOT} sub-populations guarantees the dis-ambiguity of the steering commands. Inhibition from the \ac{MOT} to the \ac{SPTC} population suppresses rotational \ac{OF} input which contains no relative depth information. Inhibition from \ac{MOT} to inverse \ac{WTA} hinders the network from taking any new decision during a turn.} \label{fig:gap_network} \end{wrapfigure} Because of the consistently changing nature of the \ac{POIS} spike trains the winner changes frequently and the agent executes a random walk (see Figure~\ref{fig:behaviours}a). When the agent approaches an object the position of the obstacle is indicated by a number of spikes in the \ac{INT} population. These spikes strongly inhibit the inverse \ac{WTA} at the corresponding position and its closest neighbours so that this inverse \ac{WTA} direction cannot win. Therefore, the active neurons in the inverse \ac{WTA} always represent an obstacle-free direction. In case no object-free direction has been found for \texttildelow700 milliseconds since the start of an intersaccade the \ac{ET} neuron emits a spike. This neuron is only weakly excited by the \ac{POIS} population and connected to the \ac{GI} neuron similarly to the inverse \ac{WTA} population. Only when the \ac{ET} has not been inhibited for a long time, hence the inverse \ac{WTA} was not able to generate a spike due to strong over all inhibition, the \ac{ET} neuron wins. The final layer called \ac{MOT} population translates the inverse \ac{WTA} population and \ac{ET} neuron activity into a turn direction and duration using pulse-width modulation to control the motors. The left turn \ac{MOT} population becomes activated by inverse \ac{WTA} neurons on the left side and the right turn population by inverse \ac{WTA} neurons on the right side. Since the turning velocity is always constant the angle of rotation is defined by the duration of the turn. This duration of the excitation wave in the \ac{MOT} population relates proportionally to the distance of the inverse \ac{WTA} neuron from the center of the horizontal visual field. The duration saturates for neuron distances higher than nine. Since a left turn and a right turn are exclusive events, strong inhibition between the two \ac{MOT} populations assures to disambiguate the \ac{MOT} layer outputs. In case the \ac{ET} neuron emits a spike the excitation wave passes through most neurons of the left \ac{MOT} population. Hence, the turning duration is slightly higher than for any turn induced by the inverse \ac{WTA} population. The agent turns completely away from the faced scene since no collision free path was found in that direction. During the execution of a turn the gap finding network receives mainly rotational \ac{OF}. This type of apparent motion does not contain any depth information and therefore no new movement direction should be chosen during or shortly after a turn. Because of that the \ac{MOT} layer strongly inhibits the inverse \ac{WTA} and \ac{SPTC} populations as well as the \ac{ET} neuron. After a turn has finished and none of the \ac{MOT} populations is spiking anymore the agent moves purely translatory. The movement speed during this phase $v_{ints}$ is defined in equation \ref{eq:velocity agent} where $\bar{f}_{OFI}$ is the mean firing rate of the \ac{OFI} population. During this movement phase, called intersaccade, the agent integrates translational \ac{OF} information in its \ac{INT} population. The inverse \ac{WTA} population slowly depolarizes from its strongly inhibited state and releases a spike indicating the new movement direction. This spike triggers the next saccadic turn of the robot while the id of the winning neuron defines the direction and duration of the movement. \begin{equation} \label{eq:velocity agent} v_{ints} (\frac{m}{s}) = 1 - \bar{f}_{OFI} \times 0.001 \end{equation} \subsection{Neurorobotics Platform} \label{subsection:NRP} To perform our behavioural experiments we decided to simulate the entire system, from visual input to actions, using the Neurorobotics Platform. This platform combines simulated \acp{SNN} with physical realistic robot models in a simulated 3D environment \cite{falotico2017NRP}. The platform consists of three main parts, the world simulator Gazebo, the \ac{SNN} simulator Nest and the Transfer Function Manager \ac{BIBI}. The \ac{BIBI} middleware consists of a set of transfer functions which enables the communication between Gazebo and NEST via \ac{ROS} \cite{Quigley2009ROS} and PyNN adapters. The \ac{CLE} synchronizes the two simulators Gazebo and Nest and controls the data exchange through transfer functions. The simulation front-end virtual coach is useful to control the whole simulation procedure through a single python script. Furthermore, the State Machines Manager of the SMACH framework can be used to write State Machines which manipulate the robot or world environment during the experiment. \subsection{Real World Robot} \label{subsec: real robot} The robot receives visual input from the embedded Dynamic Vision Sensor with a 60 degrees lens. The event-based camera sends its events to a SpiNN-5 board which simulates a simplified version of the collision avoidance network decribed in the section \nameref{subsection:GFnetwork}. The robot's visual field consists of 128x128 pixels which project onto 32x32 \acp{SPTC}. The robot computes ON-event and OFF-events in two separate pathways from the retina until the \acp{sEMD}. The \ac{INT} layer integrates the spikes of the ON- and OFF-pathway in a single population. The network does not contain any \ac{OFI} neuron and the agent moves with a constant velocity of around 0.5 m/s. There are also no \ac{MOT} populations and no \ac{ET} population. The inhibition from the \ac{MOT} population to the \ac{SPTC} population is replaced by inhibition from inverse \ac{WTA} to \ac{SPTC}. The motor control is regulated on an Odroid mini-computer. The computer receives inverse \ac{WTA} spikes from the SpiNN-3 board via Ethernet and translates these spikes into a motor command which is then send via USB to the motor controller. This causes a long delay between perception and action. The motor controller drives the six-wheeled robot in a differential manner. \subsection{Event-Based Cameras in Gazebo} \label{sec:vision} \indent Kaiser et al. 2016 \cite{kaiser2016DVSNRP} developed a Neurorobotics Platform implementation of an event-based camera based on the world simulator Gazebo. This model samples the environment with a fixed update rate and produces an event when the brightness change between old and new frame exceeds a threshold. We used this camera model in our closed-loop simulations as visual input to the collision avoidance network. Even though Gazebo produces an event-stream from regularly sampled synchronous frame-difference, our \ac{sEMD} characterisation and open-loop experiments (see Section \nameref{subsection:characterisation} and \cite{Milde2018sEMD}) confirmed the working principle of the motion detector model with real-world event-based camera data. We could further demonstrate the real-world fully-neuromorphic applicability in closed-loop of most parts of the simulated agent including the apparent motion computation by the \acp{sEMD} and the saccadic suppression \cite{Schoepe2020integration}. We set the resolution of the Gazebo event-based camera model to 128 times 40 pixels. The reduction of the vertical resolution from 128 to 40 pixels was done to speed up the simulation time and to make the model fit onto a SpiNN-3 board \cite{painkras2013spinnaker}. To further accelerate the simulation we limited the number of events per update-cycle to 1000 and set the refresh rate to 200 Hz. Therefore, the \ac{sEMD} can only detect time differences with a resolution of 5 ms. We decided for a large horizontal visual angle of 140 degrees so that the robot does not crash into unforeseen objects after a strong turn. At the same time the uniform distribution of 128 pixels over a 140 degrees horizontal visual field leads to an inter-pixel angle of approximately 1.1 degrees. This visual acuity lies in a biologically plausible range of inter-ommatidial angles measured in Diptera and Hymneoptera which varies between 0.4 and 5.8 degrees \cite{Land97ommatidiae}. \subsection{Driving Agent} We designed a four-wheeled simulated robot Gazebo model. The robot's dimensions are $20\times20\times10$ cm and it is equipped with an event-based camera (see Section \nameref{sec:vision}) and the husky differential motor controller plugin. The \ac{BIBI}\cite{falotico2017NRP} connects the robot with the collision avoidance network implemented in NEST (see Section~\nameref{subsection:GFnetwork}). The connections consist of one transfer function from the vision sensor to the \ac{SPTC} population and another one from the \ac{MOT} population to the differential motor controller as well as two Poisson input spike sources. The first transfer function sends visual input events. The second transfer function controls the agent's insect-inspired movement pattern. During inactivity of the \ac{MOT} populations the robot drives purely translatory with a maximum speed of 2.5 a.u/s. The movement velocity changes anti-proportionally to the environment's obstacle density as explained in the section \nameref{subsubsec: cluttered}. When one of the two \ac{MOT} populations spikes the robot fixes its forward velocity to 0.38 a.u/s and turns either to the left or to the right with an angular velocity of 4 $^{\circ}/s$. The two Poisson spike source populations send spikes with a medium spike rate of 100 Hz to the inverse, soft \ac{WTA} population and the \ac{ET} neuron (For more details see Table \ref{tab:connections} and Table \ref{tab:parameters}). \subsection{\ac{sEMD} characterisation} \label{subsection:characterisation} For the \ac{sEMD} characterisation we stimulated an event-based camera with a \SI{79}{\degree} lens (see Section~\nameref{sec:vision}) using square-wave gratings with a wavelength of \SI{20}{\degree} and various constant velocities (from 0.1 to 10 Hz). These recordings were performed in a controlled environment containing an event-based camera, an LED light ring and a moving screen which projects exchangeable stimuli (see Figure \ref{fig:Box}). The controllable light ring illuminates the screen. The camera's lens is positioned in the light ring's centre to ensure a homogeneous illumination of the pattern. The screen itself is moved by an Arduino controlled motor. During recordings, the box can be closed and thus be isolated from interfering light sources. The contrast refers to absolute grey-scale values printed on white paper to form the screen. However, given the printed contrast we calculated the Michelson contrast as follows: \begin{equation} \label{eq:Contrast} \frac{I_{max} - I_{min}}{I_{max} + I_{min}} = \frac{I_{max} - I_{max}(1-C_{printed})}{I_{max} + I_{max}(1-C_{printed})} = \frac{C_{printed}}{2-C_{printed}} \end{equation} To show the model's robustness to a wide range of environments, we varied the following three parameters in the recordings: The illumination, the grating velocity and the grating's contrast (see Table \ref{tab:parametersSEMD}). Each possible parameter combination was recorded three times, with a recording duration of four seconds, to allow statistical evaluation of the results. The event-based camera was biased for slow velocities. The model (see Figure~\ref{fig:gap_network} the first three populations) was simulated in Nest with the connections and neuron parameters defined in Table \ref{tab:connections} and Table \ref{tab:parameters} respectively. The network was simulated for four seconds, receiving the events as emitted by the event-based camera as spike-source array input. To define a response to the various stimuli, from the simulation results, the mean population activity of the preferred direction and null direction population were calculated (see Figure \ref{fig:network_response}e). For the closest comparability to the biologically imposed environment parameters, we chose to compare and discuss the \ac{sEMD}'s velocity tuning curve for a grating contrast of \SI{100}{\percent} and an illumination of \SI{5000}{lux}. \subsection{Closed-loop simulation in environments} \label{subsection:environments} Five different environments were designed to evaluate the agent's performance, a cluttered environment with randomly distributed obstacles sizing $1 \times 1$ m, an environment with two arenas connected by two gaps of variable size, a tunnel with varying width, an empty box environment and a narrowing tunnel. No obstacles were placed in a radius of two meters around the agent's start point so that the system can reach a stable state of activity before confronted with the first object. At obstacle densities higher than 35 percent the agent stays at its start point since no obstacle free direction can be detected anymore. Therefore, we limited the tested obstacle density range to 0 up to 38 percent. All obstacles placed in the environment including walls were covered with vertical black-and-white square-wave-gratings. \\ A state-machine was written within the Neurorobotics Platform environment to automatise the experiments. The state-machine consists of eight states as shown in Figure \ref{fig:statemachine} \begin{figure}[h!] \includegraphics[width = 0.6\textwidth]{figures/state_machine_collisionavoidance.png} \caption{State machine to create the cluttered environment and check the agent's collision avoidance performance.} \label{fig:statemachine} \end{figure} Additionally, a virtual coach script was composed which starts and stops the single runs in a for-loop. After creating the simulation environment the virtual coach script starts the simulation for 10 seconds so that the state machine becomes activated. After that the simulation stops for five minutes which are long enough for the state machine to place all objects in the environment. When five minutes have passed the simulation is activated again and the agent starts moving through the environment. CSV files containing the spiking data of the network, the robot position and angular alignment as well as the placement of the objects in the arena were saved for all experiments. 100 data points were collected for the collision avoidance experiment in a cluttered environment with adaptive velocity, 70 data points were collected for the experiment with fixed velocity (see Figure \ref{fig:behaviours}f,i \ref{fig:clearance},\ref{fig:velocity} ). The tunnel centering experiment, gap entering experiment and all other simulation experiments in the appendix were repeated three times for each individual configuration (see Table \ref{tab:parameterssim}). \\ Obstacle densities were calculated by plotting the cluttered environment and counting the number of pixels occupied by the objects. The occurrence of collisions was also measured visually by plotting the cluttered environment with the robot's trajectory while considering the agent size and angular alignment. Since the $can\textunderscore collide$ feature of the objects in the cluttered environment was turned off the agent moves through the obstacles when colliding. Therefore, an overlap of obstacle and robot can be interpreted as a collision. The collision avoidance run was marked as failed when such an overlap occurred and the first time of overlap was noted as collision time. Since there is no physical collision the robot's size can be varied during the analysis to evaluate the effect of agent size on the performance. To enhance the comparability of the robotic system to the biological role model, flying insects, we normalised all distance measures by dividing them by the chosen robot's size of 40x40 centimeters. The normalised distance measures were complemented with an arbitrary unit (a.u.). \subsection{Data Availability Statement} The data generated during this study will be available at dataverse.nl/dataset.xhtml?persistentId=doi:10.34894/QTOJJP. \subsection{Code Availability Statement} The code generated during this study will be made available at dataverse.nl/dataset.xhtml?persistentId=doi:10.34894/QTOJJP. \section{Acknowledgements} The authors would like to thank Daniel Gutierrez-Galan and Florian Hofmann for their technical support. The authors would also like to acknowledge the SpiNNaker Manchester team for their help with the sEMD implementation and the robot setup. Furthermore the authors acknowledge the Neurorobotics Platform team for their technical support. \section{Author contribution} T.S., E.C. and E.J. conceived and designed the experiments. M.B.M., T.S. and E.J. designed and optimised the tested algorithm. T.S. and E.J. carried out and analyzed the experiments. M.B.M., O.J.B., E.C. and M.E. developed the original sEMD model. O.J.B., M.B.M, T.S., E.J., E.C. and M.E. wrote the manuscript. \section{Competing Interests} The authors declare no competing interests.