diff --git "a/data_all_eng_slimpj/shuffled/split2/finalzzgicc" "b/data_all_eng_slimpj/shuffled/split2/finalzzgicc" new file mode 100644--- /dev/null +++ "b/data_all_eng_slimpj/shuffled/split2/finalzzgicc" @@ -0,0 +1,5 @@ +{"text":"\\section{Introduction}\n\nThe gas kinetic temperature $T_{\\rm gas}$ is a central parameter for\nthe stability of the clouds, their evolution, and their chemistry\n\\citep[e.g.][]{Galli02, Keto05}. The properties of pre-stellar cores\nare of particular interest because they have a direct impact on the\nensuing star formation. The understanding of the temperature\nvariations within the cores is thus crucial for the interpretation of\nobservations and for the development of the theory of star formation\n\\citep{Bergin2007}.\n\nThe early models of the cloud cores were spherically symmetric and\nisothermal, in the case of both stable and collapsing cores \n\\citep[e.g.][]{Bonnor56,Shu77}. The spherical symmetry will eventually\nbreak down because of rotational flattening or core fragmentation but,\nin early evolutionary stages, it is often a reasonable first\napproximation \\citep[e.g.][]{Evans05,Alves01}. The observations of the\ndetailed temperatures structure can be more difficult because the\nmeasured intensities are non-linear averages of the emission\noriginating in different regions along the line-of-sight. The dust\ncolour temperature is known to be a biased estimate of the true grain\ntemperature $T_{\\rm dust}$ \\citep[][]{Shetty09,Malinen11}. The\nsituation is potentially even worse for $T_{\\rm gas}$ where, because\nof abundance variations, the observations may represent conditions in\na small fraction of the source. This is particularly true for cold\npre-stellar cores where many molecules are severely depleted\n\\citep[e.g.][]{Bergin97, Belloche04, Whittet10, Ford11, Parise11}.\nThere are measurements suggesting that, in the centre of a starless\ncore, the kinetic temperature can decrease down to $\\sim$6\\,K\n\\citep{Crapsi07,Harju08}. However, our knowledge of the radial\ntemperature variations depends heavily on models that also form the\nbasis for the interpretation of molecular line data.\n\nThe principles of the thermal balance of dense clouds are well\nunderstood, the main factors being the heating by cosmic rays, the\ncooling by line emission, and the energy exchange between gas and dust\n\\citep{Goldsmith78, Goldsmith01}. Despite the apparent simplicity of\nthe problem, reliable predictions of $T_{\\rm gas}$ are not easy to\nobtain because of the uncertainty of the fractional abundances and\ndust grain sizes, and the potentially complex radiative transfer\neffects. The problem of line cooling has been examined separately,\nwith the Large Velocity Gradient (LVG) approximation \\citep{Neufeld95}\nand with Monte Carlo methods \\citep{Juvela01}, the latter also\nenabling the study of the role of an inhomogeneous medium.\n\nIn this paper, we investigate the uncertainties of the modelled\n$T_{\\rm gas}$ profiles of dense cloud cores. The cores are known or\nare suspected to have significant radial variations in the gas phase\nabundances, grain size distributions, and the velocity field. We wish\nestimate the maximum effects on $T_{\\rm gas}$ that could arise from\nthese systematic changes. This is important for the evaluation of the\nuncertainties of chemical model and, more directly, the interpretation\nof any line observations of dense cores.\n\nWe describe our models in Sect.~\\ref{sect:model}. The results are\npresented in Sect.~\\ref{sect:results}, both for homogeneous models\n(Sect.~\\ref{sect:goldsmith}) and for a Bonnor-Ebert type cloud\n(Sect.~\\ref{sect:BE}), and our conclusions are presented in\nSect.~\\ref{sect:conclusions}. \n\n\n\n\n\\section{The Modelling} \\label{sect:model}\n\nWe examine the thermal balance of spherical clouds without small scale\ninhomogeneity. All models are divided to one hundred concentric\nshells, the innermost shell being 6\\% and the outermost shell 0.6\\% of\nthe outer radius. The same discretization is used for in continuum and\nline radiative transfer calculations and for the determination of the\ntemperature profiles. \nTo separate the radiative transfer effects from those\nof the density, we start by examining homogeneous clouds. The dust\ntemperatures are determined with Monte Carlo radiative transfer\ncalculations \\citep{Juvela05}, using the dust model of\n\\citet{Draine03} and the interstellar radiation field (ISRF) given by\n\\citet{Black94}. \nThe rate for the energy exchange between gas and dust\nis calculated from\n\\begin{eqnarray}\n\\Lambda_{g,d} = 2 \\times 10^{-33} [ n(H_2)\/cm^{3} ]^2\n (T_{\\rm gas}-T_{\\rm dust}) \n \\nonumber \\\\\n (T_{gas}\/10.0\\,K)^{0.5} \n \\, erg \\,cm^{-3} \\,s^{-1}.\n \\label{eq:gd}\n\\end{eqnarray}\nand the rate for cosmic ray heating from\n\\begin{equation}\n\\Gamma_{gas, cr} = 10^{-27} [ n(H_2)\/cm^{3} ] \\, erg\\, cm^{-3} \\,\ns^{-1}\n\\end{equation}\n\\citep{Goldsmith01}. Following \\cite{Goldsmith01}, we calculate the\nline cooling $\\Lambda_{\\rm gas}$ by $^{12}$CO, $^{13}$CO, C$^{18}$O,\nC, CS, and o-H$_2$O, multiplying the last two rates by 10 and two,\nrespectively, to take into account the cooling by other species. The\nradiative transfer problem is solved with Monte Carlo methods\n\\citep{Juvela01}, with abundances given in Table 1 in\n\\citet{Goldsmith01}. As part of the Monte Carlo simulation, the\nprogram saves the net radiative cooling rates for each model cell.\n\nAs a more realistic cloud model we examine a one solar mass,\nmarginally stable Bonnor-Ebert sphere with a value of the stability\nparameter $\\xi=6.5$ \\citep{Bonnor56}. The radial density profile is\ncalculated assuming a constant temperature of 10\\,K. The variations of\nkinetic temperature modify the density profile only slightly\n\\citep[][]{Evans01} and this will not affect the conclusions drawn\nfrom the models.\nAn external UV field can affect the cloud temperatures but, in\nprinciple, only in a thin surface layer. We consider this heating\nthrough the photoelectric effect in connection with some Bonnor-Ebert\nmodels. To estimate the photoelectric heating rate $\\Gamma_{\\rm PE}$,\nwe first calculate the energy that dust absorbs in the energy range\n6--13.6\\,eV. The values are obtained from the continuum radiative\ntransfer calculations. Following \\cite{Juvela03}, $\\Gamma_{\\rm PE}$ is\nobtained by multiplying these energies with an constant efficiency of\n$\\epsilon=0.029$. \nThe dust temperatures are calculated assuming the clouds are heated by\nthe normal ISRF, even when UV heating of gas is ignored. \nPhotoelectric heating is almost completely eliminated if the cloud is\nsurrounded by a dust layer of $A_{\\rm V}\\sim 2^{\\rm m}$ (see\nSect.~\\ref{sect:BE_T}). This would reduce the central dust\ntemperature only by $\\sim$0.5 degrees, less than the uncertainty\nassociated with the selection of a dust model.\n\nBelow we modify several model parameters to determine how their\nvariations are reflected on the gas temperature. These include (1) the\nthermal coupling between gas and dust, $\\Lambda_{g,d}$, that depends\non the grain size distribution, (2) the abundances of the cooling\nspecies that depend on the degree of depletion, (3) the cosmic ray\nheating $\\Gamma_{gas, cr}$ that depends on the rate of cosmic rays,\nand finally (4) the large scale infall motion and (5) the small scale\nvelocity field that both affect the radiative cooling $\\Lambda_{\\rm\ng}$. The degree of modification for each parameter is indicated in\nTable~\\ref{table:parameters} and discussed further in the following\nsection.\n\n\n\n\\section{Results} \\label{sect:results}\n\n\n\\subsection{Homogeneous models} \\label{sect:goldsmith}\n\nAs a first test, before modifying any parameters listed in\nTable~\\ref{table:parameters}, we compared our calculations with those of\n\\citet{Goldsmith01} who estimated the line cooling with LVG modelling\nassuming a velocity gradient of 1\\,km\\,s$^{-1}$\\,pc$^{-1}$. The cloud\nis taken to be well shielded from the external UV field so that the\nheating through the photoelectric effect can be neglected.\nCorresponding to the idea of the LVG models, we calculated $T_{\\rm\ngas}$ at the centre of homogeneous, microturbulent spheres with a\nradius of $R=1$\\,pc and the line Doppler width equal to\n1\\,km\\,s$^{-1}$. The correspondence was found to be good, mostly\nwithin $\\sim$10\\% in $T_{\\rm gas}$ (see Fig.~\\ref{fig:goldsmith}a), in\nspite several basic differences in the respective models. Firstly,\n\\cite{Goldsmith01} calculated the dust temperature for a constant\nshielding that, in the absence of gas-dust coupling resulted in a\ntemperature of $T_{\\rm dust}\\sim$6\\,K. In our calculations the dust\ntemperature was solved self-consistently. The model was assumed to be\nilluminated by the full ISRF, and the radiation field inside the cloud\nwas solved with radiative transfer calculations \\citep{Juvela05}. The\ndifference in dust temperature has no effect on $T_{\\rm gas}$ at low\n$n({\\rm H_2})$. At $n({\\rm H_2})=10^5$\\,cm$^{-3}$ $T_{\\rm dust}$ is\nclose to the value used by \\citet{Goldsmith01} and the $T_{\\rm gas}$\nvalues are in very good agreement. Secondly, in our model the\nexcitation temperature $T_{\\rm ex}$ varies as a function of radius so\nthat the LVG assumption of a uniform medium is not valid. This affects\nthe radiative connection between different parts of the model, is\nreflected in the excitation, and can thus affect the cooling rates.\nThirdly, the photon escape probabilities in the LVG model and our\nMonte Carlo model are not identical even when the total optical depths\nare equal. In our calculations, even at high optical depths, some\nphotons can always escape in the line wings. These effects do not\nappear important for the estimated central temperature of the cores.\nThere are also some differences. For example, in our calculations the\ngas-dust coupling has a smaller effect on $T_{\\rm dust}$ at high\ndensities, apparently because our dust cooling rate is higher than\nthat given by \\citet{Goldsmith01} Eq. 13.\n\n\nWe used the homogeneous models to investigate the effect of the grain\nsize distribution. The gas--dust coupling becomes significant around\n$n({\\rm H}_2)\\sim 10^5$\\,cm$^{-3}$ depending, however, on the total\ngrain area. Equation.~\\ref{eq:gd} is valid for a size distribution\n$dn\/da~\\sim a^{-3.5}$ with $a$ in the range 0.01--1.0\\,$\\mu$m. If the\nlower limit is reduced to 10\\AA\\, \\citep[e.g.][]{Li01}, without\nmodifying the gas-to-dust ratio, $\\Lambda_{g,d}$ increases by a factor\nof $\\sim$3. On the other hand, at the centre of dense cores the size\nof the large grains increases through grain coagulation while small\ngrains may disappear entirely \\citep[e.g.][]{Stepnik03, Ormel09,\nSteinacker10}. If the lower limit of grain sizes increases to 500\\AA,\nthe rate $\\Lambda_{g,d}$ is reduced by 60\\%. If the upper limit is\nfurther increased to 2\\,$\\mu$m, the effect is a factor of three. The\nvalue of $\\Lambda_{g,d}$ is similarly increased (decreased) by a\nfactor of three if the powerlaw exponent of the size distribution is\ndecreased (increased) by $\\sim0.75$, without modifying the size\nlimits.\n\nFigure~\\ref{fig:radial} illustrates the consequences for the gas\ntemperature. The solid lines show the radial profiles of $T_{\\rm gas}$\nand $T_{\\rm dust}$ for the model $n=10^5$\\,cm$^{-3}$ of\nFig.~\\ref{fig:goldsmith}. The increased photon escape probability\nalways decreases $T_{\\rm gas}$ at the cloud surface in spite of the\nincreasing $T_{\\rm dust}$ (Eq.~\\ref{eq:gd}). The other curves\ncorrespond to a three times stronger and a three times weaker gas-dust\ncoupling. The dash-dotted line is schematically the expected behaviour\nwhere, for given density, the coupling becomes weaker in the central\npart because of the grain growth. This is not to be taken so much as a\nmodel of an actual core as an illustration of the uncertainty of\n$T_{\\rm gas}$.\n\n\n\n\n\n\n\n\\subsection{Bonnor-Ebert spheres} \\label{sect:BE}\n\n\nAs more realistic models of dense cores, we examine critically stable\n0.5 and 1.0 solar mass Bonnor-Ebert spheres. We will first investigate\ndifferent factors that could affect their radial temperature profiles\nand then have a look at the predicted line profiles.\n\n\n\n\\subsubsection{Temperature profiles} \\label{sect:BE_T}\n\nWe investigate first the one solar mass Bonnor-Ebert sphere. The basic\nmodel has a constant turbulent line width of $\\sigma_{\\rm\nV}=1$\\,km\\,s$^{-1}$ and no large scale gas motions. The central\ndensity rises above $10^5$\\,cm$^{-3}$ but, because of the smaller\ncloud size, the column densities are lower than in the\nSect.~\\ref{sect:goldsmith} models of similar density. The photon\nescape probability increases outwards and the model predicts a\nsignificant decrease of $T_{\\rm gas}$ towards the cloud surface. This\nis in contrast with the \\citet{Galli02} calculations that employed a\nparameterization of LVG results to estimate $\\Lambda_{gas}$ (see their\nFig. 3; note also the difference in $T_{\\rm dust}$ due to a different\ndust model). The actual surface temperature will be sensitive to the\nabundance profiles and will depend on the amount of UV and cooling\nline radiation entering the cloud from the outside, both effects\nignored in the present model.\n\nFigure~\\ref{fig:BE_1.0} shows the quantitative effects resulting from\npossible variations of the abundances, the velocity field, and\n$\\Lambda_{g,d}$. The question of depletion was already examined by\n\\citet{Goldsmith01}. To illustrate the effect in the context of our\nmodel, we decrease the abundance of all cooling species by a factor of\nten in the cloud centre, within a radius of 0.025\\,pc\n(Fig.~\\ref{fig:BE_1.0}a). Because many lines are already optically\nthick, $\\Lambda_{\\rm g}$ is not expected to decrease linearly with the\nabundances. In the model, $T_{\\rm gas}$ increases by $\\sim$2 degrees\nin the inner part, with only a small effect reflected in the outer\ncloud.\n\nIn quiescent cores the line widths are sometimes observed to be close\nto that determined by thermal broadening \\citep[e.g.][]{Harju08}. When\nthe turbulent line width is reduced to $\\sigma_{\\rm\nV}=0.1$\\,km\\,s$^{-1}$ within innermost 0.025\\,pc, the central\ntemperature again increases by about two degrees \n(Fig.~\\ref{fig:BE_1.0}b). The observed linewidths will remain much\nbroader because of the thermal and opacity broadening and because of\nthe emission from the outer cloud layers where the turbulent line width\nis still $\\sigma_{\\rm V}=1.0$\\,km\\,s$^{-1}$.\n\nAlthough the Bonnor-Ebert model is static, we can introduce a large\nscale velocity field to check its importance on the escape of line\nemission. We add an infall velocity that is zero at the cloud surface\nand increases linearly to 1\\,km\\,s$^{-1}$ in the centre. This is a very\nsimplistic model of the velocity field but the magnitude of the\nvelocity gradient is realistic \\citep[e.g.][]{Zhou93} and the model\nshould capture the main effect on the radiative transfer. In the very\ncentral part of the model, the gas temperature by reduced little less\nthan one degree (Fig.~\\ref{fig:BE_1.0}c). Both the large scale and\nsmall scale velocity fields affect $\\Lambda_{\\rm g}$ through the line\noptical depths. \n\nThe density of the one solar mass model ranges from 1.4$\\times 10^4$\nto 2$\\times 10^5$\\,cm$^{-3}$, a region of densities where the coupling\nbetween gas and dust becomes important. As discussed in\nSect.~\\ref{sect:goldsmith}, changes in the grain size distribution are\nreflected on the efficiency of $\\Lambda_{g,d}$ so that it could be\ndecreased by up to a factor of three in the cloud centre and enhanced\nby up to a factor of three at the surface. It may be very improbable\nthat a single source would exhibit the full range of variation.\nHowever, Fig.~\\ref{fig:BE_1.0}d shows this case where the efficiency\nof $\\Lambda_{g,d}$ jumps from one extreme to the other again at\n0.025\\,pc radius. Because the dust temperature is {\\em above} the gas\ntemperature, the weaker coupling reduces $T_{\\rm gas}$ in the centre\nof the cloud. The effect is again of the order of one degree.\n\nFigure~\\ref{fig:BE_0.5} shows the corresponding results for a half\nsolar mass cloud where the central density is four times the value of\nthe previous model. The main differences result from the enhanced\ngas-dust coupling that, together with lower dust temperature, reduces\nthe central gas temperature by $\\sim 1$\\,K in the cases of low\nabundances and low velocity dispersion. On the other hand, the outer\ncloud is warmer by a similar amount, both because of the stronger\n$\\Lambda_{g,d}$ but also because of the general density dependence\nalready seen in Fig.~\\ref{fig:goldsmith}.\n\n\n\nAn external UV field can directly impact the cloud temperature at\nleast at its surface. We examined another set of one solar mass\nBonnor-Ebert spheres where the photoelectric heating was included and\ncalculated as described in Sect.~\\ref{sect:model}. The ISRF impinging\non the cloud is attenuated by $A_{\\rm V}$=0, 1, or 2$^{\\rm m}$,\ncorresponding to a shielding dust layer that is thought to exist\naround the actual model cloud. This applies to the calculation of both\n$T_{\\rm dust}$ and $\\Gamma_{\\rm PE}$. The resulting temperature\nprofiles inside the model are shown in Fig.~\\ref{fig:PEH}. The effect\nof photoelectric heating becomes negligible once the cloud is shielded\nby $A_{\\rm V}\\sim 2^{\\rm m}$. However, in an unshielded cloud the UV\nfield has a small effect, $\\sim$0.4\\,K, even in the cloud centre. This\nis caused not by a direct photoelectric heating but by the change of\nthe excitation in the outer cloud layers (cf.\nSect.~\\ref{sect:nonlocal}, Fig.~\\ref{fig:goldsmith}b). Again, the\nactual effect will depend critically on the molecular abundances in\nthe region heated by $\\Gamma_{\\rm PE}$.\n\n\n\nAs a final source of uncertainty we consider the rate of cosmic rays.\nThe heating term $\\Gamma_{gas, cr}$ is based on the assumption of a\nrate $\\zeta=3\\times 10^{-17}$\\,s$^{-1}$ but, in diffuse clouds, there\nare reports of rates that are up to two orders of magnitude higher \n\\citep[e.g.][]{McCall03, Liszt03, Shaw06}. To reflect this uncertainty\nwe calculated temperature profiles with $\\zeta$ scaled by factors 1,\n2, 5, and 10. Figure~\\ref{fig:CR} shows the resulting temperature\nprofiles, again for the one solar mass model. With the highest rate,\n$\\zeta=3\\times 10^{-16}$\\,s$^{-1}$, the central temperature has risen\nfrom the original $\\sim$7.5\\,K to $\\sim$17\\,K. For comparison, we show\ntemperatures calculated with the $\\Lambda_{gas}$ parameterization given\nby \\citet{Goldsmith01}. The calculation is done shell by shell using\nthe local density and the local dust temperature ($\\Gamma_{cr}$ and\n$\\Lambda_{gas, dust}$ are as in our calculations). These\n$\\Lambda_{gas}$ rates correspond to a model that has much higher\ncolumn density (per velocity interval and for given density) than the\nBonnor-Ebert spheres. Therefore, also the derived $T_{\\rm gas}$ values\nare higher. Furthermore, the parameterization does not catch the\nincreased photon escape probability at the cloud surface that, in our\nMonte Carlo calculations, results in the decrease of temperature in\nthe outer part.\n\n\n\n\n\n\n\n\\subsubsection{Spectral lines}\n\nFigures~\\ref{fig:spectra_1.0} and \\ref{fig:spectra_0.5} show $^{13}$CO\nand C$^{18}$O line profiles that were calculated for the models of\nFigs.~\\ref{fig:BE_1.0} and \\ref{fig:BE_0.5}. The $J=$1--0, $J=$2--1,\nand $J=$3--2 spectra were calculated as observed towards the centre of\nthe cloud with a beam with the FWHM equal to the half of the cloud\nradius. At 100\\,pc distance, this corresponds to $\\sim$52\\arcsec and\n$\\sim$26\\arcsec for the 1.0\\,$M_{\\sun}$ and the 0.5\\,$M_{\\sun}$\nmodels, respectively.\n\nIn the one solar mass model, the $^{13}$CO(1--0) beam averaged optical\ndepth is only $\\tau \\sim$2.5 through the cloud. In the 0.5\\,$M_{\\sun}$\nthe corresponding optical depth is $\\sim$7.5 meaning that there the\n$^{13}$CO transitions and C$^{18}$O lines originate partially in\ndifferent regions with different kinetic temperatures. One example of\nthis are the line profiles of the 0.5\\,$M_{\\sun}$ cloud with the\ninfall velocity. The $^{13}$CO(2-1) line shows the expected infall\nprofile while in the optically thinner $J=$1-0 line ($\\tau$=3.9 vs\n$\\tau$=6.5 for the second transition) the effect is weaker. The beam\naveraged C$^{18}$O(1--0) lines remain symmetric. When observed with a\npencil beam, the C$^{18}$O $J$=1--0 and $J$=2--1 lines would show\nslight asymmetry but with line profiles with stronger emission on the\nred shifted side. This is caused by the $T_{\\rm gas}$ which decreases\ntowards the cloud centre (see Fig.~\\ref{fig:BE_0.5}c). \n\n\nWe carried out LTE analysis of the $^{13}$CO and C$^{18}$O lines to\ncheck how accurate those column density estimates would be. We used\nthe method described by \\citet{Myers83}. The ratio of the $^{13}$CO\nand C$^{18}$O lines is used to calculate the optical depth\n$\\tau_{18}$, and the excitation temperature of C$^{18}$O,\n$T^{18}_{ex}$, is solved from the radiative transfer equation \n\\citep[see][Eqs. 3-4]{Myers83}. Assuming Gaussian line shapes, the\ncolumn density of C$^{18}$O in the $J=1$ state is \n\\begin{equation}\nN_{J=1} = 3.86 \\times 10^{14} \\tau_{18} J(T^{18}_{\\rm ex}) \\Delta v_{18}\n\\; {\\rm cm}^{-2}\n\\end{equation}\nwhere $J(T) = T_0 \/ [exp(T_0\/T) - 1 ]$ and $T_0 = 5.27$ K. The total\nC$^{18}$O column density is obtained by summing all levels, assuming\nthey are populated according to $T^{18}_{ex}$.\nTable~\\ref{table:LTE} summarizes the results when the line\nparameters are taken from Gaussian fits to the modelled spectral\nprofiles. The errors of these estimates are less than 5\\% which shows\nthat the temperature gradients have little impact on the column\ndensity estimates.\n\n\n\n\n\n\\section{The importance of non-local radiative couplings}\n\\label{sect:nonlocal}\n\nThe LVG method is based on the assumption that the excitation is\nconstant within the radiatively coupled volume. This is not a good\napproximation in dense cores where the gas velocities are small\nand the radial gradients of $T_{\\rm ex}$ are large. To illustrate the\npotential problem further in a schematic way, we took from\nFig.~\\ref{fig:goldsmith} the $n=10^5$\\,cm$^{-3}$ model and forced the\ninner part, $r<0.5$\\,pc, to local thermodynamic equilibrium (LTE) at\n5\\,K or 20\\,K. Fig.~\\ref{fig:LTE} shows the resulting $T_{\\rm\ngas}$ values in the outer part of the cloud, $r>0.5$\\,pc. The assumed\nexcitation of the inner cloud has a strong impact on the remaining\ncloud volume. The same effect was seen in Sect.~\\ref{sect:BE}, where\nthe increased surface temperature caused by photoelectric heating was\nreflected all the way to the centre of the optically thick cloud.\n\n\nOur final example of a system with non-trivial radiative couplings\nconsists of two Bonnor-Ebert spheres with properties identical to\nthose in Sect.~\\ref{sect:BE}. The spheres are touching each other and\nthe mutual shielding and exchange of radiative energy modifies the\ntemperature distributions. Figure~\\ref{fig:two_spheres} shows the\n$T_{\\rm gas}$ estimated without and with photoelectric heating. The\ncalculations were carried out with the same continuum and line\nradiative transfer programs as in the case of spherical models but\ndiscretizing the cloud onto a 128$^3$ cartesian grid. When\nphotoelectric heating is not considered, the absorption of line\nradiation from the other core increases the temperatures between the\ncores. The effect on $T_{\\rm gas}$ is $\\sim 1$ degree at the surface\nbetween the two cores. When UV heating is included, the mutual\nshielding becomes important and $T_{\\rm gas}$ is reduced by up to 3\\,K\nbetween the cores. Compared to the gravitational attraction between\nthe spheres, the force exerted by the resulting pressure asymmetry is\nof the order of one percent (assuming the change of $\\Delta T \\sim\n3$\\,K affects a few percent of the surface area). However, if the\nspheres were to partially coalesce, the affected area and the\ntemperature asymmetry would both increase making the effect\npotentially even dynamically important.\n\n\n\n\n\n\n\n\n\\section{Discussion} \\label{sect:conclusions}\n\n\nWe have modelled the gas and dust temperature of dense clouds. The\nresults emphasize the difference between the $T_{\\rm gas}$\ndistributions obtained with consistent radiative transfer calculation\nand those resulting from the blind application of LVG model results.\nIf LVG calculations are used, also the increased photon escape\nprobability near cloud surface must be taken into account. The effect\ncan be several degrees and this will have consequences for chemical\nmodels and the interpretation of observations. The photoelectric\nheating is capable of raising the surface temperature significantly\nbut only if the cloud is shielded by less than $A_{\\rm V}\\sim 1^{\\rm\nm}$ of extinction. However, the indirect impact of this heating is\nfelt well beyond the region directly penetrated by UV photons. The\ndetails of the radial temperature profile will depend on the\nabundances of the outer cloud layers and the external radiation field,\nboth in terms of line radiation and the UV flux. Further studies\ncoupling the chemistry and the modelling of the thermal balance are\nclearly needed.\n\nWe examined the effects on $T_{\\rm gas}$ resulting from such spatial\nvariation of molecular abundances, velocity field, and dust grain size\ndistribution that are expected in dense cores. Each factor alone can\nchange $T_{\\rm gas}$ by $\\sim$1\\,K or more. In the core, a strong\ndepletion of molecules and the reduction of turbulent motions is\ncapable of rising the temperature by several degrees. As pointed out\nby \\cite{Goldsmith01}, the effect of depletion will become less\nimportant at higher densities when $\\Lambda_{g,d}$ dominates over line\ncooling. The same applies to any effect resulting from the velocity\nfield. However, the increase of grain sizes will significantly\ndecrease the coupling between gas and dust. When $T_{\\rm dust}>T_{\\rm\ngas}$ and the density is close to $10^5$\\,cm$^{-3}$, this can\ncompensate some of the temperature increase predicted for the inner\ncore. There is no observational evidence of a temperature increase at\nthe centre of quiescent cores but also this possibility should be\nconsidered when interpreting observations. In more opaque clouds\n(especially in conjunction with dust coagulation) $T_{\\rm dust}$ will\nbe reduced below $T_{\\rm gas}$ and, at high enough densities, will\neventually force gas temperature down at the centre of starless cores.\nAn increase in the grain sizes can shift this transition to densities\nhigher than usually assumed. However, because of the long time scale\nof dust coagulation \\citep[e.g.][]{Ormel09}, the effect is often\nlikely to be smaller than in our model.\n\nThe value of $T_{\\rm gas}$ is particularly uncertain at the cloud\nsurface where the photoelectric heating and the dissociation of CO \nproduce strong temperature gradients. However, for the dense clouds\nthe largest source of uncertainty still appears to be the rate of\ncosmic ray heating. In the case of the one solar mass Bonnor-Ebert\nsphere, a factor of five increase in $\\zeta$ would raise the central\ntemperature by five degrees to $T_{\\rm gas}\\sim$12.5\\,K. This may\nalready be excluded by direct observational evidence of much lower gas\ntemperatures in dense clouds \\citep{Crapsi07,Harju08}. Nevertheless,\nthe theoretical prediction of the temperatures -- and temperature\nprofiles -- of dense cores still contains significant uncertainty.\n\nThe observed temperature gradients will not strongly modify the radial\ndensity distribution of cores nor significantly affect the core\nstability \\citep[e.g.][]{Harju08, Galli02}. However, in the critically\nstable Bonnor-Ebert models of one solar mass, the difference between\n{\\em isothermal} temperatures of 8\\,K and 10\\,K corresponds to a\nfactor of two increase in the central density. This shows that even\nsmall temperature changes are important in theoretical studies.\nIn Figs.~\\ref{fig:BE_1.0} and \\ref{fig:BE_0.5} we examined separately\nthe effect of various parameters on $T_{\\rm gas}$. In more dense\ncores, with $T_{\\rm dust} < T_{\\rm gas}$, the effects of the $\\chi$,\n$\\sigma_{\\rm v}$, and $\\Lambda_{g,d}$ parameters could accumulate,\nmaking the temperature gradients more pronounced. If gas is not\ncoupled to dust, $T_{\\rm gas}$ could in the central parts remain\nseveral degrees above the temperature of the outer cloud. However, in\nthe centre of the 0.5\\,$M_{\\sun}$ model cloud the gas temperature was\nalready largely determined by the gas-dust coupling. In that case the\nquestion of the dust properties becomes important because different\ndust models can, in the cloud centre, lead to $T_{\\rm dust}$ values\ndiffering by more than one degree (e.g. our $T_{\\rm dust}$ vs. the\n\\citep{Galli02} models).\nThe case of the two Bonnor-Ebert spheres in Sect.~\\ref{sect:nonlocal}\nsuggests that even small temperature anisotropies may sometimes play a\nrole in the long term evolution of clouds. Further studies are also\nrequired to find out how the early evolution of spherical cores is\nmodified relative to the isothermal case.\n\nHowever, the main importance of small $T_{\\rm gas}$ variations may\ncome via chemistry. The gas temperature directly affects chemical\nreaction rates and, in particular, the depletion onto dust grains.\nTherefore, the precise value of the gas temperature is relevant for\ninterpretation of both line and continuum data. Because the collision\nrates are only proportional to $\\sqrt{T_{\\rm gas}}$, the direct effect\non the time scales of depletion and grain mantle accumulation is\nsmall, less than 50\\% for the kind of temperature variations observed\nin our models. However, the effect on steady state abundances is more\nnoticeable. \\citet{Aikawa05} studied chemical evolution in collapsing\nclouds with initial conditions close to critical Bonnor-Ebert spheres.\nIf the evolution was slow enough, significant depletion was observed\nin the central parts of the model clouds. In particular,\n\\citet{Aikawa05} included a comparison of identical models (central\ndensity $3\\times 10^6$\\,cm$^{-3}$) with kinetic temperatures of 10\\,K,\n12\\,K, and 15\\,K. The ice composition was found to be very sensitive\nto the temperature and this was reflected in the gas phase abundances.\nA difference of two degrees could modify some abundances by a factor\nof two and, in the centre where the depletion becomes significant, by\nan order of magnitude or even more \\citep[e.g. NH$_{3}$ and\nN$_2$H$^{\\rm +}$, see][Figs. 2 and 6]{Aikawa05}. It is conceivable\nthat in some cases the depletion will be regulated by the temperature\nrise that results from the decreasing line cooling.\n\nWhen observations are analyzed, there is no guarantee that different\nlines (e.g., different isotopomers or different transitions of the\nsame molecule) would originate in identical gas volume. We already\nnoted that, depending on the opacity of the lines, the spatial\nresolution, and the radial $T_{\\rm gas}$ profile, it is possible to\nobserve both blueshifted and redshifted spectra towards a collapsing\ncloud. In the same fashion, the kinetic temperature measured, e.g.\nwith NH$_3$, may not be representative for other lines. This could\nlead to errors that are propagated to the derived column densities.\nThe evaluation of these uncertainties requires simultaneous modelling\nof the thermal balance, radiative transfer and, in particular, of the\nchemistry. Such a full study is beyond the scope of the present\npaper. However, we did carry out LTE analysis of the $^{13}$CO and\nC$^{18}$O lines calculated for the Bonnor-Ebert models. The\ntemperature gradients did not affect the column density estimates by\nmore than 5\\% and, at least in this case, the LTE analysis would\nproduce accurate estimates for the total $^{13}$CO and C$^{18}$O\ncolumn density.\nThus, the temperature variations examined in this paper mainly affect\nour expectations of the radial abundance profiles. These are important\nconsiderations when line data are used to estimate the central density\nor temperature of a dense core. The direct implications on the\nstability or dynamic evolution of the cores are probably of secondary\nimportance.\n\n\n\n\n\\acknowledgments\n\nMJ and NY acknowledge the financial support by the Academy of Finland Grant\n127015.\n\n\n\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Calculation of the linear-response coefficients}\n\\label{sec:linear-response}\nIn what follows we calculate all the linear response coefficients entering Eqs.~(\\ref{w}) and~(\\ref{q}) in the weak-coupling limit between the qubit and the reservoir, following Ref.~\\cite{masterkeldysh}.\nWe rely on the adiabatic quantum-master equation approach under small temperature bias $\\Delta T$ to evaluate the coefficients $\\Lambda_{\\mu,\\nu}$, which enable the calculation of the net transferred heat and work defined in Eqs.~(\\ref{w}) and~(\\ref{q}). \n\nThe derivation of the master equation corresponds to solving the non-equilibrium problem of the driven qubit coupled to the two reservoirs \nexactly up to second order in the coupling constants $V_{\\alpha}^2$ and up to linear order in the velocities of the driving parameters $d_t \\vec{B}$.\n\n\\subsection{Reduced density matrix}\\label{appA:reducedDensityMatrix}\nThe Hamiltonian for the qubit can be expressed, after an appropriate unitary transformation $U$, in the instantaneous diagonal basis $|j\\rangle, j=1,2$ as follows:\n\\begin{equation}\n\\label{hs1}\n{\\cal H}_{\\rm qb}(t)=E_{1}(t) |1\\rangle \\langle 1| + E_{2}(t) |2\\rangle \\langle 2|, \n\\end{equation}\nwhere $E_{1,2}(t)=\\mp B_r(t)$ are the eigenvalues of the Hamiltonian of Eq.~(\\ref{qs}). We focus on the reduced density matrix $\\rho(t)$ expressed in this basis, in the slow-driving regime. We split it into a {\\em frozen} plus an {\\em adiabatic} contribution as \n\\begin{equation}\\label{split}\n\\rho(t) = \\rho^f + \\rho^a,\n\\end{equation}\nwhere\nthe first term corresponds to the description with the Hamiltonian frozen at a given time, for which the parameters take values ${\\vec B}$, while the second one corresponds to the correction $\\propto d_t \\vec B$.\n\nThe master equation for the corresponding matrix elements, $\\rho_{ij}(t)$, reads \\cite{masterkeldysh},\n\\begin{align}\\label{eq:masterEq}\n \\frac{d\\rho_{ij}(t)}{dt} = \\frac{i \\epsilon_{ij}(t)}{h} \\rho_{ij}\n +\\sum_{m,n,\\alpha} \n &\\left[ M^{jn}_{mi,\\alpha}(t) \\rho_{mn}\n + M^{in}_{jm,\\alpha}(t) \\rho_{nm} \\right. \\nonumber \\\\\n &\\left. - M^{mn}_{jm,\\alpha}(t) \\rho_{in}\n - M^{mn}_{mi,\\alpha}(t) \\rho_{nj}\n \\right]\n\\end{align}\nwhere we have introduced a shorthand notation for $E_i(t)-E_j(t) =\\epsilon_{ij}(t)$ for the instantaneous energy differences. The transition rates $M^{ju}_{ml,\\alpha}(t)$ for the present problem are given by\n\\begin{equation}\n\\label{eq:me_coefficients}\n M^{ju}_{ml,\\alpha}(t) = \\frac{\\xi_{\\alpha, ml}(t) \\xi_{\\alpha, ju}(t)}{h}\n \\left(\n n_\\alpha(\\epsilon_{ju}) \\Gamma_\\alpha(\\epsilon_{ju}) +\n [1+n_\\alpha(\\epsilon_{uj})] \\Gamma(\\epsilon_{uj})\n \\right),\n\\end{equation}\nbeing $\\alpha=h,c$ the reservoir indices, $n_\\alpha(\\varepsilon)=1\/\\left(e^{\\varepsilon\/(k_BT_{\\alpha})}-1\\right)$ the Bose-Einstein distribution function corresponding to the temperature of the $\\alpha$-reservoir and \n$\\Gamma_\\alpha(\\varepsilon>0) = \\gamma_\\alpha \\varepsilon e^{-\\varepsilon\/\\varepsilon_C}$ the bath spectral function. The functions $\\xi_\\alpha$ are defined for each bath as $\\xi_\\alpha=\\hat U(t) \\hat \\pi_\\alpha \\hat U^\\dagger(t)$, where $\\pi_\\alpha$ is defined in Eq.~\\eqref{qcont}. In the present problem we use $\\hat \\pi_{h,c} = \\hat \\sigma_{x,z}$. For this problem we consider Ohmic baths with a cutoff frequency $\\varepsilon_C$, and $\\Gamma_\\alpha(\\varepsilon\\leq 0)=0$. The value of $\\gamma_\\alpha$ depends on the coupling strength as $|V_{\\alpha}|^2$. This quantity defines the relaxation time between the q-bit and the reservoirs, $\\tau_{\\rm rel}\\propto \\gamma_{\\alpha}^{-1} \\varepsilon \\approx \\gamma_\\alpha^{-1} k_B T$. \nIn Eq. (\\ref{eq:masterEq}) we have neglected a term proportional to\n$|V_{\\alpha}|^2 |d_t \\vec B|$ \\cite{mak3,riwar2010nov,calvo2012dec,masterkeldysh}.\nThis equation can be written in a compact form as\n\\begin{equation}\n \\frac{d \\mathbf{p}(t)}{dt}= \\mathbf{M}(t) \\mathbf{p}(t),\n\\end{equation}\nby defining $\\mathbf{p}(t)=(\\rho_{11}(t),\\rho_{12}(t),\\rho_{21}(t),\\rho_{22}(t))^T$ with the contributions $\\mathbf{p}^f$ and $\\mathbf{p}^a$ as in Eq. \\eqref{split} and $\\mathbf{M}(t)$ accordingly.\n\nThe frozen contribution $\\mathbf{p}^f$ is calculated as a function of the time-dependent parameters $\\vec B$ only (frozen time), and satisfies the stationary (static) limit $\\frac{d \\mathbf{p}^f(t)}{dt} = 0$. Hence, it can be calculated from\n\\begin{equation}\n\\label{eq:pf}\n 0 = \\mathbf{M}({\\vec B})\\cdot \\mathbf{p}^f({\\vec B}),\n\\end{equation}\nwith the normalization condition $\\rho^f_{11}+\\rho^f_{22}=1$. On the other hand, \nthe adiabatic component satisfies\n\\begin{equation}\n\\label{eq:pa}\n \\sum_\\ell \\frac{\\partial \\mathbf{p}^f({\\vec B})}{\\partial B_\\ell} \\dot B_\\ell(t) = \\mathbf{M}({\\vec B})\\cdot \\mathbf{p^a}(t),\n\\end{equation}\nwith the normalization condition $\\rho^a_{11}+\\rho^a_{22}=0$. An important detail for the calculation of the partial derivatives appearing in the left side of Eq. \\eqref{eq:pa} is to take into account the effects of the basis dependence in $\\vec B$. A practical way to perform the derivative is by expressing $\\rho^f$ in the laboratory (fixed) basis first, and then rotate back to the instantaneous diagonal basis.\n\nWe can modify $\\mathbf{M}$ to include the normalization condition for $\\mathbf{p}^a$ in a single equation~\\cite{riwar2010nov,calvo2012dec}. Naming $\\mathbf{\\tilde M}$ the resulting matrix, we can finally invert Eq. (\\ref{eq:pa}) to obtain the closed expression\n\\begin{equation}\n\\label{pa}\n \\mathbf{p}^a(t) = \\sum_n \\mathbf{\\tilde M}^{-1}({\\vec B}) \\cdot \\frac{\\partial \\mathbf{p}^f}{\\partial B_n}\\dot B_n(t).\n\\end{equation}\n\n\\subsection{Linear-response coefficients}\\label{app-lin-res}\nWe can now use the described approach in (\\ref{appA:reducedDensityMatrix}) to obtain explicit expressions for the linear-response coefficients entering in the thermal geometric tensor $\\Lambda_{\\mu,\\nu}$. To this end we calculate the power developed by the ac-driving sources as follows,\n\\begin{equation}\n\\label{pac}\n P_{ac}(t) = \\mbox{Tr}\\left[\n \\dot {\\cal H}_{\\rm qb}(t)\n \\rho(t)\n \\right],\n\\end{equation}\nbeing\n\\begin{equation}\n\\label{Hdot}\n \\dot {\\cal H}_{\\rm qb}(t) = \\sum_\\ell \n \\frac{\\partial {\\cal H}_{\\rm qb}(t)}{\\partial B_\\ell}\n \\dot B_\\ell(t).\n\\end{equation}\nWe now write \n\\begin{equation}\n W=-\\int_0^{\\tau} dt P_{ac}(t), \n\\end{equation}\nand replace Eq.~(\\ref{split}) into Eq.~(\\ref{pac}), to finally use the solutions for $\\mathbf{p}^f$ and $\\mathbf{p}^a$ obtained in the previous subsection. The resulting expression can be directly compared to the formal relation in Eq. \\eqref{w} for $W$, where the matrix elements of the thermal geometric tensor are multiplied by different powers of $\\dot B_k$.\n\nIn order to discriminate the contribution of the developed power $\\propto \\Delta T$, and recalling that we are considering small temperature differences, we introduce the following extra expansion in frozen component:\n${\\rho}^f= {\\rho}^f_T + \\delta_T {\\rho}^f \\Delta T $. Therefore,\n\\begin{equation}\n \\Lambda_{\\ell, 3}(\\vec B) =-\n \\mbox{Tr} \\left[\n \\frac{\\partial {\\cal H}_{\\rm qb}}{\\partial B_\\ell} \\delta_T {\\rho}^f,\n \\right]. \n\\end{equation}\nwhile \n\\begin{equation}\n\\label{eq:lambda-diss-formal}\n \\Lambda_{\\ell, n}(\\vec B) =\n [\\underline{\\Lambda}]_{\\ell, n}(\\vec B) =\n \\mbox{Tr} \\left[\n \\frac{\\partial {\\cal H}_{\\rm qb}}{\\partial B_\\ell} \n \\left( \\mathbf{\\tilde M}^{-1}_T({\\vec B})\n \\frac{\\partial \\mathbf{p^f}_T}{\\partial B_n} \n \\right)\n \\right],\n\\end{equation}\nwhere we highlight with the sub-index $T$ that the quantities are calculated with the reservoirs at the same temperature $T$ and the quantity between parentheses is to be understood as a $2x2$ matrix.\nNotice that the contribution of Eq. (\\ref{pac}) evaluated with ${\\rho}^f_T$ corresponds to an equilibrium quantity. It represents the power developed by the conservative ac forces, and it, thus, leads to a vanishing value when averaged over the cycle. \n\n\n\nIn the same formalism used to derive the reduced density matrix, the heat current entering the reservoir $\\alpha$, calculated at the second order of perturbation theory \nin the coupling to the reservoirs and within the adiabatic regime, reads \\cite{calvo2012dec,masterkeldysh},\n\\begin{equation}\n\\label{Jheat}\n J_\\alpha(t) = \\sum_{m,n,u}\n \\epsilon_{un}(t)\\mbox{Re}\\left[ M^{nu}_{mn,\\alpha}(t) \\rho_{un}(t) \\right].\n\\end{equation}\nWe can follow the same logic as before to calculate this current at the first order in $\\Delta T$ and $\\dot{\\vec B}$. The first one is \n``thermal'' component \nassociated to the\nthe frozen components evaluated with a thermal bias $\\Delta T$, while the second one is the heat current ``pumped'' by the ac driving without temperature bias.\n\nThe linear-response net transported heat between the two reservoirs is\n\\begin{equation}\n Q=\\int_0^{\\tau} dt J_{\\rm c}(t)=-\\int_0^{\\tau} dt J_{\\rm h}(t).\n\\end{equation}\n\nWe follow the convention of Ref. \\cite{adiageo} and consistently with the definition \\eqref{q}, we focus on the current entering the cold reservoir to define the net transported heat.\nAssociating each term of Eq. \\eqref{q} with those arising from Eq. \\eqref{Jheat} upon substituting ${\\rho}$ by its expansion in $\\Delta T$ and $\\dot{\\vec B}$, we identify the linear coefficients,\n\\begin{equation}\n\\label{L3j}\n \\Lambda_{3,\\ell}(\\vec B) =\n \\vec{\\Lambda}_{\\ell}(\\vec B) = \\sum_{m,n,u}\n \\epsilon_{un} \n \\mbox{Re} \\left[ M^{nu}_{mn,{\\rm c}, T}\n \\left( \\mathbf{\\tilde M}_T^{-1}\n \\frac{\\partial \\mathbf{p^f}}{\\partial B_\\ell} \n \\right)_{un}\n \\right]\n\\end{equation}\nand\n\\begin{equation}\n\\label{L33}\n \\Lambda_{3,3}(\\vec B) =\n \\frac{\\kappa(\\vec B)}{T}\n = \\sum_{m,n,u} \\epsilon_{um}\n \\mbox{Re} \\left[ M^{nu}_{mn,{\\rm c}, T}\n \\delta_T \\rho^f \\right]_{un}\n\\end{equation}\nThese coefficients satisfy the following Onsager equations \\cite{ludovico2016feb,adiageo},\n\\begin{equation}\n\\Lambda_{3,\\ell}=-\\Lambda_{\\ell,3},\\;\\;\\;\\Lambda_{1,2}=\\Lambda_{2,1}.\n\\end{equation}\n\n\n\\section{Explicit expressions for \\texorpdfstring{$\\underline{\\Lambda}(\\vec B)$}{L(B)}, \\texorpdfstring{$\\vec{\\Lambda}(\\vec B)$}{L(B)} and \\texorpdfstring{$\\kappa(\\vec B)$}{k(B)} in the case of equal baths coupling}\n\\label{appendix:sameCouplingStrength}\n\nAssuming equal spectral density in the $L$ and $R$ baths, i.e.\n\\begin{equation}\n\\begin{split}\n \\Gamma_L(\\epsilon) &= \\bar \\Gamma_L \\epsilon e^{-\\epsilon\/\\epsilon_C} =\\Gamma(\\epsilon) \\\\\n \\Gamma_R(\\epsilon) &= \\bar \\Gamma_R \\epsilon e^{-\\epsilon\/\\epsilon_C} =\\Gamma(\\epsilon) \n\\end{split}\n\\end{equation}\n\nwith $\\bar \\Gamma_L = \\bar \\Gamma_R$ constants, we get explicit expressions for the complete geometric tensor. Using $(B_x, B_z) = B_r(\\sin \\phi, \\cos \\phi)$ and $\\beta=1\/(k_B T)$ we arrive to the following results.\n\n\\subsection*{Explicit expression for \\texorpdfstring{$\\underline{\\Lambda}$}{L(B)}}\nUsing Eq. \\eqref{hs1} and the expression for the reduced density matrix in the same basis, we can write for the terms with partial derivatives in Eq. \\eqref{eq:lambda-diss-formal}:\n\n\\begin{equation}\n\\frac {\\partial {\\cal H}_{\\rm qb}}{\\partial B_\\ell}=\n\\sum_j \\partial_\\ell E_j(\\vec{B}) |j\\rangle \\langle j|\n+ E_j(\\vec{B}) ( |\\partial_\\ell j\\rangle \\langle j|\n +|j\\rangle \\langle \\partial_\\ell j|)\n\\end{equation}\n\n\\begin{equation}\n \\frac{\\partial \\mathbf{p^f}_T}{\\partial B_n} =\n \\sum_{ij} \\partial_\\ell p^f_{T,ij}(\\vec{B}) |i\\rangle \\langle j|\n+ p^f_{T,ij}(\\vec{B}) ( |\\partial_\\ell i\\rangle \\langle j|\n +|i\\rangle \\langle \\partial_\\ell j|)\n\\end{equation}\n\nwith the notation $\\frac{\\partial}{\\partial B_\\ell} = \\partial_\\ell$. We note that the term $E_j(\\vec{B})$ depends only on the absolute value of the magnetic field $B_r$. In addition, the density matrix $\\mathbf{p}^f_T(\\vec{B})$ is a function of the energy spectrum, since it is computed in thermal equilibrium considering both baths at equal temperature $T$, and thus depends only on $B_r$ as well.\n\nOn the other hand, the operators $|\\partial_\\ell i\\rangle \\langle j|$ and $|i\\rangle \\langle \\partial_\\ell j|$ are nonzero only for variations in the polar coordinate $\\phi$ because the eigenvectors $|i\\rangle$ are associated to the unitary transformation that makes ${\\cal H}_{\\rm qb}$ diagonal, and do not change when $\\vec{B}$ stays in the same direction.\n\nThese facts allows us to separate the linear response coefficient $\\underline{\\Lambda}$ into a radial contribution ${\\lambda}_{r}$ (changes in the energy spectrum) and a polar contribution ${\\lambda}_{\\phi}$ (basis rotation). Inserting the solution to \\eqref{eq:pf} and \\eqref{pa} into Eq. \\eqref{eq:lambda-diss-formal} we get:\n\n\\begin{equation}\n\\label{eq:lambda_diss_radial}\n\\langle r| \\underline{\\Lambda} |r \\rangle =\n{\\lambda}_{r}(\\vec B)=\n\\frac{\\hbar \\beta \\text{sinh}(\\beta B_r)}{\\Gamma (2 B_r) \\text{cosh}^3(\\beta B_r)}\n\\end{equation}\n\n\\begin{equation}\n\\label{eq:lambda_diss_polar}\n\\langle \\phi| \\underline{\\Lambda} |\\phi \\rangle =\n{\\lambda}_{\\phi}(\\vec B)=\n\\frac{\\hbar \\Gamma (2 B_r)}{4 B_r^3}\n\\end{equation}\n\nEq. \\eqref{eq:lambda-diss-formal} finally reads:\n\n\\begin{equation}\n\\underline{\\Lambda} =\n\\lambda_{r}|r\\rangle \\langle r|+\n\\lambda_{\\phi}|\\phi\\rangle \\langle \\phi|.\n\\end{equation}\n\nWe now turn to analyze $L^2$, which quantifies the dissipated energy for a particular protocol, determined by $\\underline{\\Lambda}$ through Eq. \\eqref{eq:geometric_k}. In the upper panel of Fig. \\ref{fig:dissipation_change} we show the maximum eigenvalue, $\\mbox{max}\\left[\\lambda_{r}, \\lambda_{\\phi}\\right]$ as a function of $(B_z,B_x)$.\nThis plot reflects the behavior resulting from the analytical expressions of Eqs. \\eqref{eq:lambda_diss_radial} and \\eqref{eq:lambda_diss_polar}. \nAt every point, and depending on the values of $\\bar \\Gamma$ and $T$, this maximum eigenvalue corresponds to a pure polar or pure radial displacement of $\\vec{B}$.\nWithin the small circle plotted in dashed lines and outside the one in solid lines, the highest eigenvalue is $\\lambda_{\\phi}$, while within the two circles, $\\lambda_{r}$ is the largest one.\nThis means that for small $B_r < B_{r,\\rm low}$ as well as for large $B_r > B_{r, \\rm high}$, protocols leading to the smallest dissipation are those associated to changes in $B_r$, while \nfor $B_{r,\\rm low}< B_r < B_{r, \\rm high}$, protocols associated to rotations are the least dissipative ones.\nThe specific values $B_{r,\\rm low},\\; B_{r,\\rm high}$\ndepend on the temperature and the coupling between the qubit and the reservoirs, as shown in Fig.~\\ref{fig:dissipation} for two values of $\\Gamma$.\n\nThe precise shape of the interval $B_{r,\\rm low},\\; B_{r,\\rm high}$ is shown in the lower panel of Fig.~\\ref{fig:dissipation_change} and depends only on $\\bar \\Gamma$, while the final value has a linear dependence on $k_B T$. We see that for $\\bar\\Gamma \\gtrapprox 0.6$ the rotational dissipation dominates for all values of $|\\vec B|$.\n\n\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.45\\textwidth]{diss_change_panel.png}\n \\includegraphics[width=0.45\\textwidth]{diss_change.png}\n \\caption{Upper panel: Maximum eigenvalue $\\mbox{max}\\left[\\lambda_{r}, \\lambda_{\\phi}\\right]$, which ultimately defines the maximum possible dissipation at a given point $\\vec B$.\n Right panel: $B_{r,\\rm low}$ (dash line) and $B_{r,\\rm high}$ (solid line) as function of $\\bar\\Gamma$. The values $B_r$ for which $\\lambda_{r}=\\lambda_{\\phi}$ are determined by $\\bar \\Gamma$ only and scales linearly with $k_B T$.}\n \\label{fig:dissipation_change}\n\\end{figure}\n\n\n\\subsection*{Explicit expression for \\texorpdfstring{$\\vec \\Lambda$}{L} and \\texorpdfstring{$\\kappa$}{k}}\nAgain, plugging the expressions describing $\\mathbf{p}(t)$ given by Eqs. \\eqref{eq:pf} and \\eqref{pa} into Eq. \\eqref{L3j} we get for the qbit:\n\n\\begin{equation}\n \\vec \\Lambda_{1}(\\vec B) = -\\beta B_r \\sin ^3(\\phi ) \\text{sech}^2(\\beta B_r)\n\\end{equation}\n\\begin{equation}\n \\vec \\Lambda_{2}(\\vec B) = -\\beta B_r \\sin ^2(\\phi ) \\cos (\\phi ) \\text{sech}^2(\\beta B_r).\n\\end{equation}\n\nAnd lastly, using Eq. \\eqref{L33}, the thermal conductance is explicitly written as:\n\n\\begin{equation}\n \\kappa(\\vec B) = \\frac{4 B_r^2 \\sin ^2( \\phi ) \\cos ^2( \\phi ) \\Gamma (2 B_r) \\text{csch}\\left(\\frac{2 B_r}{T k_B}\\right)}{\\hbar k_B T}.\n\\end{equation}\n\\section{More discussion on the circular sector}\n\\label{app:pizzaProtocol}\nHere we present a more detailed study on the power and the efficiency of the circular sector defined in section \\ref{sec:results-C}. In Fig. \\ref{fig:pizza_power} we compute the geometrical value $A^2\/\\mathcal{L}^2$ as a function of the two parameters $R$ and $\\Omega$ that define the curves of this class.\n\n\n\\begin{figure}[h]\n \\centering\n \\includegraphics[width=0.5\\textwidth]{pizza_power.png}\n \\caption{Geometrical values $A^2\/\\mathcal{L}^2$ for the circular-sector protocols. We found a saturation value equal to $0.022 (k_B T)^2\/\\hbar$ which corresponds to the trajectory defined by $\\Omega=\\pi\/2$ and $R \\rightarrow \\infty$.}\n \\label{fig:pizza_power}\n\\end{figure}\n\nWe see from Fig. \\ref{fig:pizza_power} that for big enough $R$ the value of $A^2\/\\mathcal{L}^2$ depends only on $\\Omega$. This fact can be understood by looking at the upper panel of Fig. \\ref{fig:dissipation_change}: for $B_r>B_{r,{\\rm high}}$ we have $\\underline{\\Lambda} \\approx 0$, which implies that the dissipation outside the solid circle is negligible, and only the radial sections contained in the solid circle contributes significantly to $L^2$. Furthermore, since $\\underline{\\Lambda}$ has rotational symmetry, the value of $L^2$ is independent of the direction of the radial parts. These two observations leads us to the conclusion that $\\mathcal{L}^2$ has a saturation value in the circular sectors with $R>>B_{r,{\\rm high}}$. Finally, the dependence on $\\Omega$ is explained by looking at Fig. \\ref{fig:curl_lambda}, where it is clear that $A=A(\\Omega)$ for $R>>B_{r,{\\rm high}}$ as well, and the maximum occurs at $\\Omega=\\pi\/2$. The saturation value of $A^2\/\\mathcal{L}^2$ for the circular sector is found to be $\\max_{\\rm circ-sec} \\frac{A^2}{\\mathcal{L}^2} = 0.022 (k_B T)^2\/\\hbar$, which comparing to Fig. \\ref{fig:optimal_ellipses} is around $30\\%$ smaller than the ellipses case.\n\nIn Fig. \\ref{fig:pizza_efficiency} we show the computed maximum efficiency $\\eta_{\\rm max}$ in Eq. \\eqref{eq:Etamax} of the circular-sector protocol with $\\Omega=\\pi\/2$ as a function of $R$.\n\n\\begin{figure}[ht]\n \\centering\n \\includegraphics[width=0.5\\textwidth]{pizza_efficiency.png}\n \\caption{Computed efficiency for the circular sector with $\\Omega = \\pi\/2$ as a function of the $R$ parameter. At $R \\rightarrow \\infty$ we recover Carnot efficiency for the optimal parametrization.}\n \\label{fig:pizza_efficiency}\n\\end{figure}\n\nRecall from discussion in section~\\ref{sec:max_efficiency} that the limiting case of the circular sectors with the mentioned $\\Omega$ and $R\\rightarrow\\infty$ defines a Carnot cycle when optimized for maximum efficiency. This fact is clearly seen in Fig.~\\ref{fig:pizza_efficiency} as the saturation value of $\\eta_{max}\/\\eta_C$ goes to $1$ as $R >> B_{r,{\\rm high}}$.\n\n\n\\section{Introduction}\n\nThe development and implementation of thermodynamic processes in few-level quantum systems is currently a very active area of research. Thermodynamic cycles conceived for macroscopic working substances (WS), such as the Otto or Carnot cycle, are now realized \nin single atoms~\\cite{pekola2019mar,von2019spin,rossnagel2016apr,ronzani2018oct,deassis2019jun,peterson2019dec}\nand large theoretical efforts are devoted to its characterization and optimization at the microscopic scale \\cite{rezakhani2009aug,Schmiedl2007,sivak2012may,Kosloff2017,paolo,paolo2,abiuso2019non,cavina2021maximum,adiageo}.\nIn these standard thermodynamic cycles, the WS operates in four steps, of which two are in contact to reservoirs at different temperatures connected one at a time, while the other two steps consist in an evolution decoupled from the reservoirs. \nIt is however typically hard to fully isolate a quantum WS from the environment, which is required to emulate ideal classical cycles. This motivates the study of non-equilibrium systems, where the driven WS is permanently in contact with two or more reservoirs. Unlike standard thermodynamic cycles, these microscopic machines operate away from equilibrium during all the cycle. Thermoelectric devices \\cite{Benenti2017} as well as autonomous refrigerators \\cite{Palao2001,Youssef2009,Brunner2012} are seminal examples of this type of operation. \n\nWhen the WS is connected \nat the same time to two or more thermal reservoirs, it is permanently thread by a heat flux. Hence, the very operation as a machine relies on the mechanism of heat--work conversion\nin order to overcome this effect as well as the dissipation generated by the driving sources. The optimal machine is the one leading to the optimal balance between these two processes.\nIn quantum systems, the operation under a small temperature bias and\n``adiabatic driving\" through parameters which slowly vary on time is of paramount relevance, since this is an appealing scenario to control the non-equilibrium mechanisms. \nIn this regime, the period of the cycle is larger than any characteristic time of the quantum system, including the relaxation time between system and reservoirs~\\cite{thouless1983may,brouwer1998oct,zhou1999jan,moskalets2002nov,moskalets2004dec,reckermann2010jun,cavina2017slow}. \n\nRecently, it was proposed that the dissipation and the heat--work conversion mechanisms are respectively described by different components of the thermal geometric tensor. Furthermore,\n the heat--work conversion component can be expressed in terms of a Berry-type phase~\\cite{adiageo}, which has an associated Berry-type curvature~\\cite{berry1984quantal}, and similar ideas were followed in \\cite{Hino2021,Izumida2021}.\nHence, a length and an area in the parameter space can be defined. Besides, it is well known that dissipation and entropy production admit a geometric description in terms of the concept of thermodynamic length~\\cite{weinhold1975sep,salamon1980jul,salamon1983sep,nulton1985jul,schlogl1985dec,andresen1996nov,diosi1996dec,\ncrooks2007sep,campisi2012,VanVu2021}. This geometric approach has proven useful to optimize finite-time thermodynamic processes (examples can be found in ~\\cite{sivak2012may,Zulkowski2012,Zulkowski2013,bonanca2014jun} for classical and~\\cite{zulkowski2015sep,scandi2019oct,paolo2} for quantum systems), including the finite-time Carnot cycle \\cite{paolo,paolo2} and slowly driven engines~\\cite{brandner2020jan,millermoha,millerTUR,frim2021optimal,topical}.\nAs mentioned before, these cycles are characterized by the WS being coupled to a single reservoir or completely decoupled from reservoirs.\n\n\n\n\n \n \nThe aim of the present work is to optimise the performance of thermal machines with cycles in permanent contact to two or more reservoirs at different temperatures by a geometrical approach. To this end we combine the geometrical description of the two competing mechanisms of the non-equilibrium thermal machine (namely heat-work conversion and dissipation) in order to find optimal protocols for maximizing power generation of the heat-engine operation and the efficiency of the heat engine and refrigerator operational modes. We show that the problem of finding such optimal protocols reduces to an \\emph{isoperimetric problem}~\\cite{ros2001isoperimetric} (also studied as \\emph{Cheeger Problem}~\\cite{parini2011introduction,leonardi2015overview}), that is the task of finding the shape which maximizes the ratio between area and length. This is one of the oldest geometric problems in history, and was solved already by the ancient Greeks in the standard 2-dimensional Euclidean plane~\\cite{blaasjo2005isoperimetric}. Nevertheless, when the underlying area density or length metrics are nontrivial~\\cite{howards1999isoperimetric,morgan2005manifolds,rosales2008isoperimetric,carroll2008isoperimetric}, no general solution is known.\n\nWe illustrate these ideas in a prominent quantum system playing the role of the WS: a qubit driven by two parameters slowly changing in time and asymmetrically coupled to two thermal reservoirs at different temperature (see Fig.~\\ref{fig:pic_model}). We show analytically that the limiting value for the area in the parameter space is given by the celebrated\nLandauer bound~\\cite{landauer61,landauer88}, which has been the motivation of many studies including several experiments (see e.g. \\cite{berut2012experimental,jun2014high}). \nWe also find that, operating as a heat engine, the qubit thermal machine offers a very good ratio between generated power and efficiency in a wide range of parameters. \n\n\n\n\nThe paper is structured as follows. In Sec.~\\ref{sec:setup}, we introduce the set-up and define the relevant thermodynamic quantities to characterize the cycle. In Sec.~\\ref{sec:geom-opt}, we describe the underlying geometry of the system. In Sec.~\\ref{sec:timeopt} we describe the heat engine and refrigeration modes of the machine, and perform the optimization with respect to the driving time. In Sec.~\\ref{sec:results}, we develop the full optimization of the machine. We then compute in detail all the relevant quantities in a model of one of the most paradigmatic and simplest quantum engines, namely a driven qubit system (see Refs.~\\cite{karimi2016nov,paolo2,adiageo}). \n\n\n\n\\section{The setup and its thermodynamics}\n\\label{sec:setup}\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.5\\textwidth]{machine_model3.png}\n \\caption{Schematic configuration of the setup. A working substance WS is in contact with two reservoirs at different temperatures, $T_c$ and $T_h$. The state $\\hat \\rho$ of the system changes at slow but finite speed along a closed path defined by the Hamiltonian $\\mathcal{H}(\\vec B(t))$ in a quasistatic process.\n }\n \\label{fig:pic_model}\n\\end{figure}\n\n\nWe focus on the usual configuration where the WS operates in contact to two reservoirs at different temperatures $T_{\\rm h}$ (hot) and $T_{\\rm c}$ (cold), with $T_{\\rm h}=T+\\Delta T$ and $T_{\\rm c} \\equiv T$. A particular example, which will be studied in detail in forthcoming sections is sketched in Fig.~\\ref{fig:pic_model}.\nThe full system is described by the Hamiltonian \n \\begin{equation}\n {\\cal H}(t)= \\sum_{\\alpha={\\rm c,h}} \\left( {\\cal H}_{\\alpha} + {\\cal H}_{\\rm cont,\\alpha} \\right) + {\\cal H}_{\\rm WS}(t).\n \\label{hamtot}\n \\end{equation}\nThe Hamiltonian for the WS depends on time through a set of control parameters $B_j(t),\\; j=1,N$, which we enclose in a vector $\\vec{ B}(t)=\\left(B_1(t), \\ldots, B_N(t)\\right)$. Hence,\n${\\cal H}_{\\rm WS}(t)={\\cal H}_{\\rm WS}(\\vec{ B}(t))$. We are interested in cycles, so that we consider time-dependent protocols satisfying $\\vec{ B}(t+\\tau)= \\vec{B}(t)$, being $\\tau$ the period of the cycle.\nThe reservoirs are represented by the Hamiltonian\n\\begin{equation}\\label{qres}\n{\\cal H}_{\\alpha}=\\sum_{k}\\varepsilon_{k\\alpha}b_{k\\alpha}^\\dagger b_{k\\alpha}, \\;\\;\\; \\alpha={\\rm c, h},\n\\end{equation}\n with $b_{k\\alpha}$ and $b_{k\\alpha}^\\dagger$ being the annihilation and creation operators of a bosonic excitation.\nThe coupling is represented by\n\\begin{equation}\\label{qcont}\n{\\cal H}_{\\rm cont,\\alpha}=\\sum_{k}V_{k\\alpha}\\hat{\\pi}_{\\alpha}\\Big(b_{k\\alpha}+b_{k\\alpha}^\\dagger\\Big),\n\\end{equation}\nwhere $\\hat{\\pi}_{\\alpha}$ is a matrix with the dimension of the Hilbert space of the WS. \n\n\n\nThe crucial concepts that characterize the operation of the thermal machine are the work performed and the net heat exchanged between the two reservoirs during the cycle. The operation of the driven quantum system as a thermal machine in the presence of a temperature bias relies on the mechanism of heat--work conversion. \nIn the present case we make two main assumptions: \\begin{enumerate}[label=(\\roman*)]\n \\item slow driving \\cite{cavina2017slow}, characterized by a small rate of change of the driving parameters with time, $d_t \\vec{B}$ (short for $\\frac{d}{dt}\\vec{B}$), as well as\n \\item a small temperature bias $\\Delta T$ between the two reservoirs.\n\\end{enumerate} \nThis enables us to work in the linear-response regime with respect to $d_t \\vec{B}$ and $\\Delta T$. \n\nA natural theoretical framework in this context is the adiabatic linear response theory \nproposed in Ref.~\\cite{ludovico2016feb} in the geometric perspective of Ref.~\\cite{adiageo}. This formalism applies to the regime where the period of the cycle is much larger than the longest time-scale characterizing the WS coupled to the reservoirs. In most of the cases, such time scale is determined by the relaxation time $\\tau_{\\rm rel}$ of the WS with the reservoirs.\nMore precisely, the dynamical perturbation to the steady state $\\hat{\\rho}_B$ (corresponding to no driving, i.e. ``frozen\" value of $B$), can be estimated to $\\delta\\hat{\\rho}\\sim\\tau_{\\rm rel}(\\partial_B \\hat{\\rho}_{B}) d_t B$ (cf.~\\cite{cavina2017slow,ludovico2016feb,adiageo} or Appendix~\\ref{appA:reducedDensityMatrix}). Hence, this approach is useful when $\\tau\\gg \\tau_{\\rm rel}$. We also consider small temperature bias, such that $\\Delta T\/T\\ll 1$. This description leads to a linear relation between the relevant energy fluxes operating the cycle and the components of the vector \n$d_t{\\bf X}=(d_t \\vec{B},\\Delta T\/T)$. The relevant quantities are the net {\\em output work} \nand {\\em transferred heat} between the hot and cold reservoirs. They are, respectively, defined as the average over one period of the power developed by the driving sources, and the energy flux into the $\\alpha$-reservoir,\n\\begin{eqnarray}\nW &=&\n-\\int_0^{\\tau}dt\\;\\langle \\frac{\\partial {\\cal H}_{\\rm WS}}{\\partial \\vec{B}}\\rangle \\cdot d_t {\\vec{B}}, \\\\\nQ_\\alpha &=&\n-\\frac{i}{\\hbar}\\int_0^{\\tau} dt\\; \\langle \\left[{\\cal H}_{\\alpha},{\\cal H}\\right] \\rangle\\;, \n\\end{eqnarray}\nwhere $\\langle O \\rangle=\\mbox{Tr}\\left[\\rho O\\right]$, being $\\rho$ the global state of system and baths (which in general will be correlated due to the contacts). The corresponding expectations values are evaluated in linear response with respect to $d_t{\\bf X}$. In such regime $Q_{\\rm c}=- Q_{\\rm h}\\equiv Q$~\\footnote{While the heat flux at each reservoir contains\nboth transported and dissipated components, the latter contributes at the second order in $d_t{\\bf X}$~\\cite{adiageo}, as explicitly shown in Eq. (\\ref{w}).}.\nThe result is \n\\begin{align}\n W &=\\frac{\\Delta T}{T}\\int_0^\\tau dt\\;\\Vec{\\Lambda}\\cdot d_t \\vec{B} -\\int_0^\\tau dt\\; d_t\\vec{B} \\cdot \\underline{\\Lambda}\\cdot d_t \\vec{B} \\;,\n \n \\label{w}\\\\\n Q &=\\int_0^\\tau dt\\;\\Vec{\\Lambda}\\cdot d_t \\vec{B}+\\frac{\\Delta T}{T}\\int_0^\\tau\\ dt\\; \\kappa \\;.\n \n \\label{q}\n\\end{align}\nThese expressions can be derived in the adiabatic linear-response regime as from Ref.~\\cite{adiageo} and we defer the reader to that paper for further details.\nFor the moment it is enough to stress that \\{$\\underline{\\Lambda}$, $\\vec{\\Lambda}$, $\\kappa$\\} are all local functions of $\\vec{B}$, while they also depend on the coupling parameters, the density of states of the thermal baths and $T$.\n\nIn Eq.~(\\ref{w}), the first term represents the mechanism of {\\em heat--work} conversion and the second one corresponds to finite-time dissipation developed by the time-dependent controls. \n\n\nMoreover, in Eq.~\\eqref{q}, the transferred heat $Q$ also contains two terms associated to two different physical processes. The first one describes the heat exchange between the reservoirs related to the driving while the second one is the heat transport as a response to the temperature bias. \nNotice that the fundamental component for the thermal machine to operate is the heat--work conversion term $\\int_0^\\tau dt\\;\\Vec{\\Lambda}\\cdot d_t \\vec{B}$. In fact, without this component, the only surviving processes are the dissipation of the energy supplied by the driving forces and the trivial conduction of heat as a response to the thermal bias.\n\nThe different terms in Eqs.~(\\ref{w}) and (\\ref{q}) can be reinterpreted geometrically, as explained in the following Sec.~\\ref{sec:geom-opt}. This allows for the optimization of the thermodynamic protocols in terms of clear geometrical quantities.\n\nIt is important to notice that the second terms of Eqs.~(\\ref{w}) and (\\ref{q}) have a defined sign. \nIn our convention, $\\underline{\\Lambda}$ is positive definite since it is directly related to the entropy production rate~\\cite{adiageo}, which means that it is detrimental for the work output. Similarly, $\\kappa$ can be seen to be positive, as a consequence of the fact that this component of the transferred heat describes the flux from the hottest to the coldest reservoir. These are direct consequences of the second law of thermodynamics. Instead, the line integral $\\int_0^\\tau dt\\;\\Vec{\\Lambda}\\cdot d_t \\vec{B}$ may have any sign, depending on the driving protocol and it is enough to time-reverse the function $\\vec{B}(t)$ to flip the sign. As mentioned before, this term describes the {\\em heat--work} conversion process and its sign defines the type of operation of the machine.\nIn fact, when it is negative, the contribution of the first term of Eq.~(\\ref{q}) may overcome the heat flowing into the coldest reservoir and enable the operation of the machine as a \\emph{refrigerator}. This has an associated cost, described by the first term of Eq.~(\\ref{w}), which must be developed by the driving sources. In the opposite situation where\n$\\int_0^\\tau dt\\;\\Vec{\\Lambda}\\cdot d_t \\vec{B}\\geq 0$, the first term of Eq.~(\\ref{w}) may overcome the second one, enabling the mechanism of work output. This has an associated\nextra heat transfer from the hot to the cold reservoirs, which is accounted for the first term of Eq.~(\\ref{q}). This operation corresponds to a \\emph{heat engine}. \n\n\n\n\\section{Geometry of the problem}\n\\label{sec:geom-opt}\n\nWe now elaborate on the geometrical interpretation of the quantities presented in the previous section.\n\nFirst, we factorize the total duration $\\tau$ in the expressions Eqs.~\\eqref{w} and \\eqref{q}, such to decouple the time-rescaling from the geometrical contribution to the different quantities. \nIndeed by considering an adimensional time unit $\\theta$ such that\n\\begin{align}\n \\vec{ B}(t)=\\vec{ B}(\\theta \\tau)\\;,\\quad \\theta\\in[0,1]\\;,\n\\end{align}\nwe can define, identifying from now on the adimensional time derivative $\\dot{\\vec B} \\equiv{\\partial \\vec B}\/{\\partial\\theta}=\\tau d_t \\vec{B}$,\n\\begin{align}\n\\label{eq:geometric_A}\n A=& \\int_0^1 d\\theta\\; \\Vec{\\Lambda}\\cdot\\dot{\\vec B}\\;,\n\\\\\n\\label{eq:geometric_L}\n L^2=& \\int_0^1 d\\theta\\; \\dot{\\vec B} \\cdot \\underline{\\Lambda}\\cdot\\dot{\\vec B}\\;,\n\\\\\n\\label{eq:geometric_k}\n \\langle\\kappa\\rangle=& \\int_0^1 d\\theta\\; \\kappa\\;.\n\\end{align}\n\nAccordingly, Eqs. \\eqref{w} and \\eqref{q} can be expressed as follows,\n\\begin{eqnarray}\n\\label{eq:def_W}\n W \n &= & \\frac{\\Delta T}{T}A - \\frac{L^2}{\\tau} \\label{w1}\\\\\n Q \n &= & A+\\frac{\\Delta T}{T}\\tau\\langle\\kappa\\rangle. \\label{q1}\n\\end{eqnarray}\n\n\nThe names $A$ and $L^2$ are related the geometrical meaning of the quantities above, as we discuss below. The representation of Eq.~(\\ref{eq:geometric_A}) highlights the fact that $A$ corresponds to a Berry-type phase in the parameter space as discussed in Ref. \\cite{adiageo}. Notice, that, in order to have a non-vanishing value of $A$, at least two time-dependent parameters are necessary. \nThis is basically the same argument widely discussed in the literature of adiabatic charge pumping\n~\\cite{brouwer1998oct,avron2001nov,moskalets2002nov,arrachea2006}.\nIn addition, it is necessary to break some symmetries in the system to have a finite value of this closed integral \\cite{adiageo}, as discussed below.\n\nGiven that $\\vec B(\\theta)$ represents a closed trajectory in space, we can use Stokes' theorem --in a three-dimensional space or its corresponding generalization in higher dimensions-- to re-express the line-integral defining $A$\n\\begin{align}\n\\label{eq:definition:A}\n A=\\int_{\\partial\\Sigma} \\vec{\\Lambda} \\cdot d\\vec{B}\n =\\int_\\Sigma (\\vec{\\nabla}_B\\wedge \\vec{\\Lambda} )\\cdot d\\vec{\\Sigma}\\;,\n\\end{align}\nwhere $\\Sigma$ is a surface in the $\\vec B$ space, with boundary $\\partial\\Sigma$ coinciding with the control trajectory. In the case of having 4 or more parameters, Eq.~\\eqref{eq:definition:A} should be replaced by the Generalized Stokes' Theorem applied to differential forms in the appropriate dimension~\\footnote{Identifying $\\vec \\Lambda \\cdot d\\vec B$ with a 1-form $\\omega$ over $\\mathbf{R}^n$, we can express Eq.~\\eqref{eq:definition:A} as $A = \\int_{\\partial \\Sigma} \\omega = \\int_{\\Sigma} d\\omega$, where $d\\omega$ is the exterior derivative of $\\omega$.}.\nIn this representation, $A$ is the flux of the vector $\\vec{\\nabla}_B\\wedge \\vec{\\Lambda}$ through the area enclosed by the control trajectory, and can be also interpreted as the integral over this area weighted by the Berry curvature \\cite{berry1984quantal}. \nWe can therefore \\emph{think of $A$ as the area of the surface defined by the control trajectory} (with local weight depending on the Berry curvature). Note that this geometrical translation clarifies as well that $A$ depends $\\emph{only}$ on the geometry of the trajectory $\\vec B(\\theta)$: that is, not only $A$ is independent of $\\tau$, but it is also invariant under any reparametrization $\\theta'(\\theta)$ which might change the local speed and time spent on different points of the trajectory.\n\n\nConcerning $L^2$, \\emph{it can be interpreted as a length squared of the control trajectory} $\\vec{B}(\\theta)$, as it is clear from~\\eqref{eq:geometric_L} that it represents the integral of a quadratic form that defines a metric in the $\\vec B$ space. At the same time, given the presence of two time derivatives, $L^2$ can depend in general on reparametrizations $\\theta'(\\theta)$. However, $L^2$ represents losses due to dissipation in the driving -- see Eq.~\\eqref{w} -- and we are therefore interested in its minimum value, which can be obtained through a Cauchy-Schwarz inequality\n\\begin{align}\n\\label{eq:definition:L}\n L^2\\geq \\left(\\int_0^1 d\\theta\\;\\sqrt{\\dot{\\vec B} \\cdot \\underline{\\Lambda}\\cdot\\dot{\\vec B}}\\right)^2=\\left(\\int_{\\partial\\Sigma}\\sqrt{d\\vec{B}\\cdot \\underline{\\Lambda}\\cdot d\\vec{B}}\\right)^2\\equiv\\mathcal{L}^2\\;.\n\\end{align}\nThe lower bound $\\mathcal{L}$ is fully geometric (it depends solely on $\\partial\\Sigma$) and it is always achievable by choosing the time-parametrization $\\theta'$ such that $\\dot{\\vec B} \\cdot \\underline{\\Lambda}\\cdot\\dot{\\vec B}$ is constant. $\\mathcal{L}$ is a natural extension of the standard thermodynamic length \\cite{weinhold1975sep,salamon1980jul,salamon1983sep,nulton1985jul,schlogl1985dec,andresen1996nov,diosi1996dec,crooks2007sep,sivak2012may,deffner2013feb,bonanca2014jun,scandi2019oct} to non-equilibrium set-ups where the WS is simultaneously interacting with several baths. \n\nFinally, it is apparent that $\\langle\\kappa\\rangle$ Eq.\\eqref{eq:geometric_k} represents the simple average of a scalar number (the heat conductance) along the trajectory. In general it clearly also depends on reparametrizations of the adimensional time $\\theta'(\\theta)$, as the average can be arbitrarily close to the maximum value $\\kappa_{\\max}$ of the trajectoy, in case $\\theta'$ is such to spend almost all the time close to $\\kappa_{\\max}$. Similarly $\\langle\\kappa\\rangle$ can be arbitrarily close to the minimum value along the trajectory $\\kappa_{\\min}$.\n\n\\section{Performance of the machine and time-optimization}\n\\label{sec:timeopt}\n\nIn this section we discuss the different operation modes of the thermal machine, and introduce the relevant figures of merit for its characterization. \n\n\\subsection{Heat engine}\n\\label{sec:heat_eng}\nThe system described in the previous sections can be used to extract work from two reservoirs with a temperature bias. This is the \\emph{engine} operating mode of the system.\nWe write the power of the heat engine and its efficiency as\n\\begin{align}\n\\label{eq:pow_def}\nP=&\\frac{W}{\\tau}=\\frac{\\Delta T}{T}\\frac{A(1-\\frac{\\tau_D}{\\tau})}{\\tau}\\;,\\\\\n\\label{eq:eta_def}\n\\eta=&\\frac{W}{Q}=\\eta_C\n\\frac{1-\\frac{\\tau_D}{\\tau}}{1+\\frac{\\tau}{\\tau_k}}\\;,\n\\end{align}\nwhere we substituted Eqs.~\\eqref{w}-\\eqref{q} and we defined the dissipation and heat leak timescales\n\\begin{align}\n\\label{eq:timescales}\n \\tau_D=\\frac{T}{\\Delta T}\\frac{L^2}{A}\\;,\\quad \\tau_\\kappa= \\frac{T}{\\Delta T}\\frac{A}{\\langle\\kappa\\rangle}\\;.\n\\end{align}\nIn the previous expressions $\\eta_C=\\Delta T\/T$ is the Carnot efficiency.\nGiven the expressions above, we can optimize the duration of the cycles in order to maximize the power or the efficiency, obtaining correspondingly\n\\begin{align}\n \\tau_{P}=2\\tau_D,\\quad \\tau_\\eta=\\tau_D+\\sqrt{\\tau_D(\\tau_D+\\tau_\\kappa)}\\;.\n \\label{eq:opt_taus}\n\\end{align}\nWe see that the duration for maximum efficiency is always larger than the duration for maximum power.\nThe corresponding maximum power and efficiency at maximum power are\n\\begin{align}\n\\label{eq:Pmax}\nP_{\\rm max}=\\frac{1}{4}\\frac{(\\Delta T)^2}{T^2}\\frac{A^2}{L^2}\\;,\\quad \\eta_{P_{\\rm max}}=\n\\frac{\\eta_C}{2} \\frac{x-1}{x+1}\n\\end{align}\nwhile the maximum efficiency and power at maximum efficiency\n\\begin{align}\n\\label{eq:Etamax}\n\\eta_{\\rm max}=\n\\eta_C\\left(1-\\frac{2}{\\sqrt{x}+1}\\right)\\;,\\quad P_{\\eta_{\\rm max}}=\\frac{(\\Delta T)^2}{T^2}\\langle \\kappa\\rangle \\frac{(\\sqrt{x}-1)^2}{\\sqrt{x}}\\;,\n\\end{align}\nwith \n\\begin{equation}\\label{eq:x}\nx=1+\\frac{A^2}{L^2\\langle\\kappa\\rangle}.\n\\end{equation}\nSee Fig.~\\ref{fig:pow-eff_engine} for a summary and visual explanation of these results.\n\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.5\\textwidth]{pow-eff}\n \\caption{\\underline{Engine mode: Power and efficiency vs. cycle duration.} \\\\\n The optimal operating region is the gray interval between the two dashed lines: indeed for any point outside the region, there is a point inside with both larger efficiency and larger power.\\\\\n In the limit of big heat leaks $\\langle\\kappa\\rangle$ the corresponding heat leaks timescale $\\tau_\\kappa$ \\eqref{eq:timescales} is small, and the difference between $\\tau_P$ and $\\tau_\\eta$ \\eqref{eq:opt_taus} shrinks. That is, when the heat leak is the dominant loss, power and efficiency maximization tend to coincide, as one could expect (this can be verified by direct inspection of \\eqref{eq:pow_def} and \\eqref{eq:eta_def}); the corresponding maximum efficiency is also small in this limit. \\\\\n In the opposite limit of no leaks $\\langle \\kappa\\rangle\\rightarrow 0$, $\\tau_\\kappa$ tends to infinite, and we recover the standard scenario in which power is maximized for a finite time, while the efficiency is maximum for $\\tau\\rightarrow\\infty$, where it tends to the Carnot efficiency, as the dominant loss is due to finite-time dissipation. For finite values of $\\langle \\kappa\\rangle$, the scenario is intermediate. In the plot $\\tau_D=1$ and $\\tau_\\kappa=2.5$.\n }\n \\label{fig:pow-eff_engine}\n\\end{figure}\n\n\n\n\\subsection{Refrigerator}\n\\label{sec:heat_pump}\nIn the \\emph{heat pump} or \\emph{refrigerating} mode, external work is supplied to the system to extract heat from the cold bath and transfer it to the hot one. Therefore we define the cooling power $P'$ and the coefficient of performance (COP) $\\eta'$ \n\\begin{align}\n\\label{eq:P'ref}\n P'=&\\frac{-Q}{\\tau}=A\\frac{1-\\frac{\\tau}{|\\tau_k|}}{\\tau}\\;,\\\\\n\\label{eq:eta'ref}\n \\eta'=&\\frac{Q}{W}=\\eta'_C \n \n \\frac{1-\\frac{\\tau}{|\\tau_k|}}{1+\\frac{|\\tau_D|}{\\tau}}\\;,\n\\end{align}\nwhere $\\eta'_C =T\/\\Delta T$ is the Carnot COP.\nThe difference with the engine operating mode is that in this case both $Q$ and $W$ are negative (heat is transferred against the thermal bias and work is performed \\emph{on} the system).\nWe have therefore $A<0$ which implies $\\tau_\\kappa<0$ and $\\tau_D<0$ are formally negative as well (which is the reason of the absolute values in the equations). \nBy direct inspection of~\\eqref{eq:P'ref} we see that the maximum power of such mode is unbounded, as in the limit $\\tau\\rightarrow 0$ the power tends to infinity. \nThe slow-driving approximation $\\tau_{\\rm rel}\/\\tau \\ll 1$ prevents us from analyzing the limit of arbitrary small $\\tau$ and a reliable analysis of the cooling power requires a description beyond linear response~\\cite{hajiloo2020detailed,mateos2021thermoelectric}. Thus, we focus only on maximizing the efficiency of this operation, for which we get\n\\begin{align}\n \\tau_{\\eta'}&=\\tau_{\\eta}=\\sqrt{\\tau_D(\\tau_D+\\tau_\\kappa)}-|\\tau_D|\\;,\n\\end{align}\n\\begin{align}\n \\eta'_{\\rm max}=\\frac{T}{\\Delta T}\\left(1-\\frac{2}{\\sqrt{x}+1}\\right)\\;,\n\\end{align}\n\\begin{align}\n P'_{\\eta'_{\\rm max}}=\\frac{\\Delta T}{T}\\langle \\kappa\\rangle \\sqrt{x}\\;,\n\\end{align}\nwith $x$ defined as in Eq.~(\\ref{eq:x}).\n\n\n\n\n\\section{Full optimization and the isoperimetric problem}\n\\label{sec:results}\nIn the previous section we showed how to choose the optimal duration for cycles of two kinds of thermal machines, and we derived formal expressions for the resulting powers and efficiencies. The resulting figures of merit still depend on the particular trajectory chosen for the cycle. Finding the fully-optimal solution is nontrivial, but we show in the following how the geometrical picture of the thermodynamics introduced in Sections~\\ref{sec:geom-opt} and \\ref{sec:timeopt}, helps in finding the most advantageous control trajectories to be exerted on the machine.\n\nAn interesting question in the present problem is whether we can find a protocol that maximizes the output power of the system. We have shown in Section~\\ref{sec:geom-opt} that, given a parametrization $\\vec B(\\theta\\tau)$ defined over $\\partial \\Sigma$ in the parameter space, we can compute the duration $\\tau$ that upper bounds the power for that protocol. The result is expressed in Eq.~\\eqref{eq:Pmax}.\nBesides, we know from the definition in Eq.~\\eqref{eq:definition:A} that the value of $A^2$ does not depend on reparametrizations $\\theta'$, while the value of $L^2$ can be lower-bounded by $\\mathcal{L}^2$ according to Eq.~\\eqref{eq:definition:L}.\nWith all these considerations, we find that the maximum power developed by a protocol moving along a curve $\\partial \\Sigma$ is expressed by\n\\begin{align}\n\\label{eq:PmaxC}\n \n \n \n P_{{\\rm max}} (\\partial \\Sigma)=\n \\frac{1}{4}\\frac{(\\Delta T)^2}{T^2}\n \\frac{A^2}{\\mathcal{L}^2}.\n\\end{align}\n\nEq.~\\eqref{eq:PmaxC} tells us that the problem of finding the maximum output power of the system is equivalent to the problem of maximizing the term~$A^2 \/ \\mathcal{L}^2$ over the set of all closed curves~$\\partial \\Sigma$ in the parameter space (known as isoperimetric or Cheeger problem \\cite{ros2001isoperimetric,parini2011introduction,leonardi2015overview}).\nThe optimization of this geometrical quantity is not a simple task in general, since one must choose a test curve $\\partial \\Sigma$ that maximizes~$A^2$, while keeping~$\\mathcal{L}^2$ small, being those quantities nontrivial functions of~$ \\partial \\Sigma$ when the corresponding metrics are not flat \\cite{howards1999isoperimetric,morgan2005manifolds,rosales2008isoperimetric,carroll2008isoperimetric}.\n\nFor what concerns the efficiencies, $\\eta_{\\rm max}$, $\\eta'_{\\rm max}$, $\\eta_{P_{\\rm max}}$ are all increasing functions of the same parameter $A^2\/(L^2\\langle\\kappa\\rangle)$. Like in Eq.~\\eqref{eq:definition:L} the denominator can be lower bounded with a Cauchy-Schwarz inequality\n\\begin{multline}\n\\label{eq:CS_eff}\n L^2\\langle \\kappa\\rangle=\\left(\\int_0^1 d\\theta\\; \\dot{\\vec{B}} \\cdot \\underline{\\Lambda}\\cdot\\dot{\\vec{B}}\\right)\\left( \\int_0^1 d\\theta\\; \\kappa\\right)\\\\\n \\geq \\left(\\int_0^1 d\\theta\\;\\sqrt{\\kappa} \\sqrt{\\dot{\\vec{B}} \\cdot \\underline{\\Lambda}\\cdot \\dot{\\vec{B}}}\\right)^2\\;.\n\\end{multline}\nIn complete analogy to Eq.~\\eqref{eq:definition:L}, the bound can be always saturated, by choosing a reparametrization $\\theta'(\\theta)$ such that $\\dot{\\vec{B}} \\cdot \\underline{\\Lambda}\\cdot\\dot{\\vec{B}}\/\\kappa$ is constant in time, and can be interpreted again as a length defined by an underlying metric\n\\begin{align}\n \\left(\\int_{\\partial \\Sigma}\\sqrt{d\\vec{B} \\cdot \\underline{\\Lambda_\\kappa} \\cdot d\\vec{B}}\\right)^2\\equiv \\mathcal{L}^2_\\kappa\\;,\n\\qquad\n\\underline{\\Lambda_\\kappa}=\\underline{\\Lambda}\\kappa\\;.\n \\label{eq:LambdaK_def}\n\\end{align}\nThe length $\\mathcal{L}_\\kappa$ is fully geometric, i.e. it depends only on the set of points defined by the trajectory $\\partial\\Sigma$, and the maximization of $\\eta_{\\rm max}$, $\\eta'_{\\rm max}$, $\\eta_{P_{\\rm max}}$ is also mapped to an isoperimetric problem\n\\begin{align}\n\\label{eq:etamaxC}\n \\max \\frac{A^2}{L^2\\langle\\kappa\\rangle}=\\max_{\\partial\\Sigma} \\frac{A^2}{\\mathcal{L}^2_\\kappa}\\;.\n\\end{align}\nThe geometric expressions \\eqref{eq:PmaxC} and \\eqref{eq:etamaxC}, which map the thermodynamic optimization to an isoperimetric (Cheeger) problem, are the main results of this paper.\n\n\\section{A qubit thermal machine}\\label{sec:qubit}\nWe will exemplify these results for the specific case of a driven qubit, in which case, the Hamiltonian for the working substance entering Eq.~(\\ref{hamtot}) is ${\\cal H}_{\\rm WS}(t)={\\cal H}_{\\rm qb}(t)$, where\n\\begin{equation}\\label{qs}\n{\\cal H}_{\\rm qb}(t)= \\vec{ B}(t) \\cdot \\hat{\\vec{\\sigma}}\n\\end{equation}\nwith $\\hat{\\vec{\\sigma}}=(\\hat{\\sigma}_z,\\hat{\\sigma}_x)$ being the Pauli matrices and $\\vec{ B}(t) \\equiv \\left(B_z(t), B_{x}(t) \\right)$,\nbeing periodic with period $\\tau$. \n\nAs already highlighted in Section~\\ref{sec:setup}, a key ingredient to have the heat--work mechanism in the linear response regime, is some protocol leading to $A \\neq 0$. We recall that this quantity represents also the net pumped heat as a consequence of the time-dependent driving. \nIn linear response, $A$ depends on response functions that are evaluated with the two reservoirs at the same temperature $T$ (see \\cite{ludovico2016feb,adiageo} and Appendix \\ref{app-lin-res}). When the two reservoirs are equally coupled, \nany protocol implemented via changing $\\vec{B}$ generates the same energy flow between them and the qubit. This prevents a net energy transfer between the reservoirs and $A=0$. Therefore, it is necessary to introduce some asymmetry in the coupling between the qubit and the reservoirs in order to have $A \\neq 0$.\nFor this reason, we consider the Hamiltonian describing the coupling to the reservoirs introduced in Eq.~\\eqref{qcont} with $\\hat{\\pi}_{\\rm h} \\equiv \\hat{\\sigma}_{x}, ~\\hat{\\pi}_{\\rm c}=\\hat{\\sigma}_z$, which breaks the c $\\leftrightarrow$ h symmetry in the absence of a temperature bias. Any other combination of Pauli matrices with\n$\\hat{\\sigma}_{\\rm h}\\neq \\hat{\\sigma}_{\\rm c}$ would lead to similar results. As mentioned before, the other crucial ingredient is a protocol depending on at least two parameters, which is necessary to define a non-trivial surface $\\Sigma$. In our case, we consider just two parameters: $B_z(t)$ and $B_x(t)$.\n\nWe solve the problem in the limit of weak coupling between the WS and the reservoirs by deriving the adiabatic master equation by means of the non-equilibrium Green's function formalism at second order of perturbation theory in $V_{\\alpha}$ as explained in Ref.~\\cite{masterkeldysh}. Details are shown in Appendices ~\\ref{sec:linear-response} and ~\\ref{appendix:sameCouplingStrength}.\nIn the specific calculations discussed below, we considered the simplest case, where the two reservoirs have the same spectral density, $\\Gamma_{\\rm c}(\\epsilon)=\\Gamma_{\\rm h}(\\epsilon)=\n\\Gamma(\\epsilon)=\\bar \\Gamma \\epsilon e^{-\\epsilon\/\\epsilon_C}$ for $\\epsilon \\geq 0$. \n\n\\subsection{Adiabatic linear-response coefficients}\nThe adiabatic linear response matrix $\\underline{\\Lambda}$ is originally expressed as a function of the coordinates $(B_z,B_x)$. This matrix is positive defined and symmetric. \nWhen diagonalized it is found that the eigenvectors, $|r\\rangle=\\left(\\sin(\\phi), \\cos(\\phi)\\right)^T$, $|\\phi\\rangle=\\left(\\cos(\\phi), -\\sin(\\phi)\\right)^T$ \ncorrespond to radial and tangential directions and thus $\\underline\\Lambda$ can be expressed as follows,\n\\begin{equation}\\label{eq:underlam}\n\\underline{\\Lambda} =\n\\lambda_{r}|r\\rangle \\langle r|+\n\\lambda_{\\phi}|\\phi\\rangle \\langle \\phi|,\n\\end{equation}\nwith $\\lambda_{r}, \\lambda_{\\phi}\\geq 0$.\nThis suggests that it is natural to implement the following change of coordinates $B_z=B_r\\cos\\phi, \\; B_x=B_r\\sin\\phi$. We get\n\\begin{equation}\n\\dot{\\vec B} \\cdot \\underline{\\Lambda} \\cdot \\dot{\\vec B} \\equiv {\\lambda_{r}} {\\dot B}_r^2 + \n\\lambda_{\\phi} B_r^2 {\\dot \\phi}^2\n\\equiv\n\\lambda_{r} |\\dot{\\vec B}_r|^2\n+ \\lambda_{\\phi} |\\dot{\\vec B}_\\phi|^2.\n\\end{equation}\n\n\n The analytical expression for the radial component reads,\n\\begin{equation}\n\\label{eq:lambda_diss_radial-t}\n\\lambda_{r}(\\vec B)=\n\\frac{\\hbar \\beta \\sinh (\\beta B_r) }{\\Gamma (2 B_r)\\cosh^3{(\\beta B_r)}\n}\n\\end{equation}\n\nand for the tangential one\n is\n\\begin{equation}\n\\label{eq:lambda_diss_polar-t}\n\\lambda_{\\phi}(\\vec B)=\n\\frac{\\hbar \\Gamma (2 B_r)}{4 B_r^3}\n,\n\\end{equation}\nbeing $\\beta=1\/k_B T$.\nThe first component is associated to changes in the energy gap between the two states of the qubit, while the second one leaves the spectrum unchanged but introduces a rotation of the eigenstate basis.\n\nRegarding the other coefficients, the components of the vector $\\vec{\\Lambda}({\\vec B})=(\\Lambda_z, \\Lambda_x) = \\Lambda_r \\langle r| + \\Lambda_\\phi \\langle \\phi|$ \nread\n\\begin{equation}\n \\Lambda_{r}(\\vec B) = \\frac{\\beta B_r \\sin ^2(\\phi) }{\\cosh^2 (\\beta B_r) },\\;\\;\\;\n \\Lambda_{\\phi}(\\vec B) = 0\\;,\n\\end{equation}\nwhile the parametric thermal conductance is\n\\begin{equation}\n\\label{eq:qubit_kappa}\n \\kappa(\\vec B) = \\frac{\\beta B_r^2 \\sin^2 (2 \\phi ) \\Gamma (2 B_r)}{\\sinh{(2\\beta B_r)}\\hbar}.\n\\end{equation}\n\n\\subsection{Geometrical quantities and bound for the heat--work conversion}\n\\label{sec:results-C}\nGiven the above coefficients we can now calculate all \n the relevant geometrical quantities for the characterization of the machine, namely, $A$, $L$ and $\\langle\\kappa\\rangle$ defined respectively in Eqs. \\eqref{eq:geometric_A}, \\eqref{eq:geometric_L} and \\eqref{eq:geometric_k}.\n\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.5\\textwidth]{curl_lambda.png}\n \\caption{The Berry-type curvature $\\left[\\vec\\nabla_B \\wedge \\vec\\Lambda(B)\\right]_y$. The integration of this quantity over the area enclosed by the control trajectory defines the $A$ as in Eq. (\\ref{eq:definition:A}). Parameters are $\\epsilon_C=120 k_B T$ and $\\bar\\Gamma=0.2$. Curves (a), (b) and (c) \n are heuristically searched protocols of elliptic shape, centered in $(0,0)$, $(1,1)$ and $(-1.5, -0.45)$ respectively, that maximize the value $A^2\/\\mathcal{L}^2$ (see Sec. \\ref{subsec:maximum_power}). Curve (d) is a protocol with the shape of a circular sector\n centered at $(0,0)$, with radius $R$ and spanning an angle $\\Omega$ symmetrically with respect to the quadrant's bisector.\n \n }\n \\label{fig:curl_lambda}\n\\end{figure}\nAs already mentioned when the representation of Eq.~\\eqref{eq:definition:A} was introduced, the net pumped heat quantified by $A$ is simply the value of the Berry curvature integrated over the area of the $(B_z,B_x)$ plane enclosed by a particular protocol. \n The Berry curvature as a function of $(B_z,B_x)$ is shown in Fig. \\ref{fig:curl_lambda}.\nBecause of the nature of the setup, this quantity changes sign at $B_x=0$ and $B_z=0$. Therefore, \nprotocols with constant $B_r$ lead to $A=0$. For any protocol, the sign can be simply switched by changing the circulation of the boundary curve, hence switching the operation from heat engine to refrigerator or viceversa.\n\nIt is also easy to visualize in Fig. (\\ref{fig:curl_lambda}), that protocols enclosing a large portion of the dark blue or bright yellow areas lead to a large value of $|A|$.\nFocusing on simple curves that do not cross themselves we consider a circular-sector trajectory like the curve $(d)$ depicted in Fig.~(\\ref{fig:curl_lambda}), characterized by a radius $R$ and an aperture angle $\\Omega$ symmetric with respect to the the quadrant's bisector. \nIt is clear from the figure that the protocol leading to the maximum achievable value of $|A|$ in the present setup corresponds to a trajectory fully enclosing a quadrant.\nSuch a trajectory is, for instance, the special case of the circular-sector trajectory with $\\Omega=\\pi\/2$ that:\ni) starts at the origin and goes to infinity along the $B_x$ axis,\nii) rotates $\\pi\/2$ counterclockwise and aligns in the $B_z$ axis,\niii) returns to the origin along the $B_z$ axis.\n\nThis limiting protocol corresponds to a quasistatic Carnot cycle and the resulting value of $A$ is\n\\begin{equation}\\label{landauer}\n A_{\\rm lim}=\\int_{\\text{quadrant}} (\\vec{\\nabla}_B\\wedge \\vec{\\Lambda} )\\cdot d\\hat{y}=\\pm k_B T \\log(2),\n\\end{equation}\nwhere the signs are determined by the enclosed quadrant and the circulation considered. Notice that, according to Eq.~(\\ref{q}), this corresponds to the extreme values for the energy that could be transported \nbetween the two reservoirs at the same temperature $T$ through the qubit, and coincides with the famous bound obtained by Landauer's argument~\\cite{landauer61} according to which the change of Shannon entropy in the process of erasing the information encoded in a bit is $\\pm \\log(2)$. In the present case, it is associated to the transfer of the same amount of entropy between the reservoirs (a similar result was found quantum dots \\cite{janine}). At finite $\\Delta T$, according to Eq.~(\\ref{w}) this quantity also sets the maximum value of the work that can be extracted in the heat-engine operational mode (for $A_{\\rm lim}>0$) in the limit of\n vanishing dissipation. This result is, respectively,\n\\begin{equation}\n\\label{eq:limitW}\n W_{\\rm lim}= k_B (T_{\\rm h}- T_{\\rm c}) \\log(2)= A_{\\rm lim} \\; \\eta_C.\n\\end{equation}\n\n\n\n\n\n\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.45\\textwidth]{dissipation.png}\n \\caption{Positive eigenvalues of $\\underline{\\Lambda}$ -see Eq. \\eqref{eq:underlam}- as a function of $|\\vec B|=B_r$. Parameters are $\\epsilon_C=120 k_B T$ and $\\bar\\Gamma=0.2$ (solid lines), $\\bar\\Gamma=0.05$ (dashed lines). Note for $\\bar \\Gamma=0.2$ (solid lines) that most of the relevant region of Fig. \\ref{fig:curl_lambda} lies inside the interval $(B_{r,\\rm low}, B_{r, \\rm high})$ where the radial dissipation is about one order of magnitude bigger than the polar dissipation.}\n \\label{fig:dissipation}\n\\end{figure}\n\nWe now turn to analyze $L^2$, which assesses\nthe dissipated energy for a particular protocol.\nThis quantity is determined by $\\underline{\\Lambda}$ given by Eq.~(\\ref{eq:geometric_L}). For the qubit, \nthis matrix can be decomposed in two contributions, as expressed in Eq.~(\\ref{eq:underlam}) which are associated to the dissipation of energy originated in the radial and polar changes of $\\vec{B}$.\n\nWe see from the analytical expressions of Eqs. (\\ref{eq:lambda_diss_radial-t}) and (\\ref{eq:lambda_diss_polar-t}) that $\\underline{\\Lambda}$ is symmetric along the polar axis, i.e. it only depends on $B_r$. This is illustrated in the upper panel of Fig. \\ref{fig:dissipation_change} of Appendix~\\ref{appendix:sameCouplingStrength}. In Fig. \\ref{fig:dissipation} we show the dependence of the coefficients $\\lambda_{r}$ and $\\lambda_{\\phi}$ on $B_r$ for two different values of the $\\bar \\Gamma$ parameter. For some values of $\\bar\\Gamma$ we find an interval $(B_{r,{\\rm low}}, B_{r,{\\rm high}})$ for which the dissipation is mainly due to changes in the energy spectrum induced by finite $\\dot B_r$.\nThe specific values $B_{r,\\rm low},\\; B_{r,\\rm high}$\ndepend on the working temperature and the coupling constant $\\bar \\Gamma$ between the qubit and the reservoirs. More details on the $\\underline{\\Lambda}$ submatrix and the dissipation structure of the qubit can be found in Appendix~\\ref{appendix:sameCouplingStrength}.\n\nThe final value of $L^2$ for a protocol $\\vec B(\\theta \\tau)$ defined over $\\partial \\Sigma$ in the parameter space still depends on the chosen parametrization $\\theta$.\nOut of all the possible parametrizations, Eq.~\\eqref{eq:definition:L} tells us that there exists a particular one for which\n $L^2=\\mathcal{L}^2$.\nFurthermore, this corresponds to the lower bound for $L^2$ and, importantly, it is a function of $\\partial \\Sigma$ only (it is geometrical).\n\nIn addition, for a given $\\theta$ associated to $\\partial \\Sigma$, we are able to obtain the optimal parametrization $\\bar\\theta (\\theta)$ that saturates the bound, and defines the less dissipative protocol $\\vec{B} (\\bar{\\theta}\\tau)$ around $\\partial \\Sigma$ in time $\\tau$. The new value of the velocity at a given time can be computed using \\eqref{eq:definition:L}, demanding that $\\dot{\\vec B}(\\theta \\tau)\n\\cdot \\underline{\\Lambda} (\\vec B)\n\\cdot \\dot{\\vec B}(\\theta \\tau)$ is constant at each point.\nThe result is\n\\begin{align}\n\\label{eq:optimal_parametrization_velocity}\n \\frac{\\partial \\vec {B} (\\bar{\\theta}\\tau)}{\\partial \\bar{\\theta}}=\n \\dot{\\vec B}(\\theta \\tau)\n \\sqrt{\\frac{\\mathcal{L}^2}\n {\\dot{\\vec B}(\\theta \\tau)\n \\cdot \\underline{\\Lambda} (\\vec B)\n \\cdot \\dot{\\vec B}(\\theta \\tau)}\n }\n\\end{align}\nwhere the dot in $\\dot{\\vec{B}}$ is the derivative with respect to the original parametrization $\\theta$. This driving ensures constant entropy production along the cycle. \n\n\\subsection{Maximum power}\n\\label{subsec:maximum_power}\nAlthough a global maximum for $P_{\\rm max}(\\partial\\Sigma)$ in Eq.~\\eqref{eq:PmaxC} is hard to find, it is still possible to design simple trajectories with useful output power and reasonable efficiency. \nWe perform a numerical search of $\\mbox{max}_{\\partial \\Sigma} A^2\/\\mathcal{L}^2$ using a gradient descent method, restricted to the space of elliptic trajectories centered at a given point $\\vec B$. The trajectories $(a)$, $(b)$ and $(c)$ shown in Fig.~\\ref{fig:curl_lambda} are examples of the resulting curves. We choose this type of curves because elliptical trajectories are easy to implement and flexible enough to perform an extensive optimal search.\nThe advantage of the elliptical protocols is not obvious, taking into account that Fig.~\\ref{fig:curl_lambda} suggests that\nthe circular-sector protocols are better than the ellipses for maximising~$A$. However, this is not the case for~$A^2\/\\mathcal{L}^2$: we show in Appendix~\\ref{app:pizzaProtocol} that suitable chosen ellipses can clearly outperform circular-sector protocols in terms of power output. \n\n\nFocusing on the elliptic protocols, we see that the highest values of power are achieved for test curves that avoid the region of small $|\\vec B|$, where the dissipation coefficient $\\lambda_{\\phi}$ diverges. The curve $(a)$ centered at~$(0,0)$ is an interesting example. It maximizes $A^2$ by enclosing the two lobes in the first and third quadrant of Fig. \\ref{fig:curl_lambda}, and closes the curve near infinity in order to avoid the central region of high dissipation.\n\nIn Fig.~\\ref{fig:optimal_ellipses} we depict the value of $\\mbox{max}_{\\partial \\Sigma} A^2\/\\mathcal{L}^2$ found by the mentioned heuristic method, as a function of the (fixed) central point of the ellipse.\n We distinguish two different regimes leading to the optimal power, as a consequence of the crossover between the two mechanisms of dissipation discussed in the context of Fig. \\ref{fig:dissipation}. For small $B_r$, where the less dissipative protocol is radial, the optimal trajectories are like the case (a) in Fig. \\ref{fig:curl_lambda}, while in the opposite limit where $B_r$ is large, the optimal protocols are like the ones indicated with (b) and (c) in that Fig.\n\n\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.45\\textwidth]{optEllipses.png}\n \\caption{max $A^2\/\\mathcal{L}^2$ as a function of $\\vec B$, for an heuristic optimization of elliptic trajectories centered at $\\vec B$. Parameters are $\\epsilon_C=120 k_B T$ and $\\bar\\Gamma=0.2$. Only positive values of $B_x$ and $B_z$ are shown, since this quantity is symmetric with respect to $B_x=0$ and $B_z=0$.} \n\\label{fig:optimal_ellipses}\n\\end{figure}\n\n\n\\subsection{Maximum efficiency}\n\\label{sec:max_efficiency}\n\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.5\\textwidth]{lambda_K.png}\n \\caption{Maximum eigenvalue of $\\underline{\\Lambda}_{\\kappa}$,\n \n indicating the losses due to the combined effect of dissipation and thermal conduction. Parameters are $\\epsilon_C=120 k_B T$ and $\\bar\\Gamma=0.2$. Curves (b) and (c) are heuristically searched protocols of elliptic shape, centered at $(1,1)$ and $(-1.5, -0.45)$ respectively, that maximize the value $A^2\/\\mathcal{L}_\\kappa^2$. Curve (d) (circular sector) is a quarter of circumference centered at $(0,0)$, joined by two radial lines of length $R$ along the axis.}\n \\label{fig:lambdaK}\n\\end{figure}\n\nFollowing the same philosophy of the analysis of $L^2$ presented in Fig.~\\ref{fig:dissipation}, we plot in Fig.~\\ref{fig:lambdaK} the maximum eigenvalue of \n$\\underline{\\Lambda}_{\\kappa}$ (defined in Eq.~\\eqref{eq:LambdaK_def})\nin order to visualize the value of the thermal losses when the system evolves in the direction of maximum dissipation. Note that since $\\kappa(\\vec B)$ is a scalar, hence, an equivalent decomposition to Eq.~\\eqref{eq:underlam} can be done for $\\Lambda_\\kappa^2$ as follows:\n\\begin{equation}\n\\label{eq:underlamKappa}\n\\underline{\\Lambda_k} =\n{\\lambda_k}_{r}|r\\rangle \\langle r|+\n{\\lambda_k}_{\\phi}|\\phi\\rangle \\langle \\phi|.\n\\end{equation}\nFurthermore the analysis presented for $L^2$ in Section~\\ref{sec:results-C}, and particularly the results shown in Fig.~\\ref{fig:dissipation} and Appendix \\ref{appendix:sameCouplingStrength} still hold for the eigenvalues and eigenvectors of $\\underline{\\Lambda}_\\kappa$.\n\nIn the case of the efficiency, an optimal solution is trivially found by looking at Fig.~\\ref{fig:lambdaK} and considering again the circular-sector curve $(d)$ with $\\Omega=\\pi\/2$. From \\eqref{eq:qubit_kappa} we see that along the $B_x$ and $B_z$ axis we have $\\kappa=0$, because in those regions the system is coupled to only one of the reservoirs. \nIt is clear from Eq.~\\eqref{eq:LambdaK_def} that for the limiting circular-sector protocol with $R \\rightarrow \\infty$, enclosing the full quadrant and leading to Eq.~(\\ref{landauer}) we have $\\left< \\kappa \\right>=0$, which implies $x=\\infty$ in Eq.~\\eqref{eq:Etamax}, hence $\\eta_{\\rm max}=\\eta_C$. In fact, as already mentioned, this protocol is an equilibrium Carnot cycle for the qubit, where the changes along the axis are the isothermal compression and expansion. More details of the efficiency of this protocol can be found in Appendix \\ref{app:pizzaProtocol}.\n\nIn addition to this particular solution of special interest, we illustrate the usefulness of the method in a more generic way. The strong equivalence between the geometrical quantities $A^2\/\\mathcal{L}^2$ and $A^2\/\\mathcal{L}_\\kappa^2$ allows us to replicate the analysis done in the previous subsection in a straightforward manner. Once again, for a given a trajectory the value of $A^2$ is computed from Eq.~\\eqref{eq:definition:A} while the lower bound for $L^2\\left<\\kappa\\right>$ and the corresponding optimal parametrization is given by~\\eqref{eq:LambdaK_def} in complete analogy with Eqs.~\\eqref{eq:definition:L} and~\\eqref{eq:optimal_parametrization_velocity} from the maximum power analysis.\n \nWe perform the numerical search of $\\max_{\\partial \\Sigma}\\lbrace A^2\/\\mathcal{L}_\\kappa^2 \\rbrace(\\vec B)$ again for the special case of closed elliptic curves centered at a given point $\\vec B$. The computed result is presented in Fig.~\\ref{fig:optimal_ellipses_lambdaK}.\nIn Fig.~\\ref{fig:lambdaK} we also show some of these trajectories, centered at the points $\\vec B= \\lbrace (1,1),(-1.5,-0.45) \\rbrace$. Note that, while some differences can be spotted between these trajectories and the ones shown in Fig.~\\ref{fig:curl_lambda}, the qualitative intuition is that efficient protocols are the ones with big $A^2$.\n\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.5\\textwidth]{optEllipsesLambdaK_interp.png}\n \\caption{Maximum $A^2\/\\mathcal{L}_\\kappa^2$ as a function of $\\vec B$ for a heuristic optimization of elliptic trajectories centered at $\\vec B$. Parameters are $\\epsilon_C=120 k_B T$ and $\\bar\\Gamma=0.2$.}\n\\label{fig:optimal_ellipses_lambdaK}\n\\end{figure}\n\n\n\n\n\\subsection{The impact of optimizing the driving speed} \nThe aim of this section is to gather further insight on the effect of selecting the optimal protocol, regarding the trajectory $\\partial \\Sigma$ and the optimal speed for the circulation on the resulting power and efficiency of a heat engine. \n\nWe consider an elliptical protocol for which we can define a ``trivial'' circulation with constant angular velocity. \nFor the case of the power, we compare the results of such trivial circulation with the one corresponding to \n the optimal velocity as defined in\nEq. (\\ref{eq:optimal_parametrization_velocity}). For the case of the efficiency we compare the trivial circulation with \n with the one corresponding to the optimal velocity,\nas defined in Eq. (\\ref{eq:optimal_parametrization_velocity}) with the replacements ${\\cal L} \\rightarrow {\\cal L}_{\\kappa}$\nand $\\underline{\\Lambda} \\rightarrow \\underline{\\Lambda}_{\\kappa}$.\n\nFor sake of concreteness we focus on $\\partial \\Sigma$ given by the protocol (b) of Fig.~\\ref{fig:curl_lambda}. Results are shown in Fig.~\\ref{fig:curve_b_performance}, where we show the power and efficiency of the machine as a function of the cycle total duration. Plots in solid and dashed lines correspond, respectively, to the protocols with constant angular velocity and optimal velocity. \n We note from this figure that the optimized parametrization is around two times bigger in power, and around four times more efficient, with respect to the trivial parametrization of the ellipse circulated at a constant angular velocity.\nDashed lines in Fig.~\\ref{fig:curve_b_performance} are akin to those of Fig.~\\ref{fig:pow-eff_engine} where power values are normalized to $P_{\\rm max}$ and efficiencies to $\\eta_{\\rm max}$, and summarizes the performance of the machine. \n\n\n\n\n\n\n\\subsection{Estimates for the performance}\nTo finalize the analysis of the qubit heat engine, it is interesting to analyze concrete values characterizing its performance.\nAs before, we focus on the protocol (b) of Fig. \\ref{fig:curl_lambda}, \nfor which we have\n\\begin{equation}\\label{al-b}\n A^2 = 0.233 k_B^2 T^2 \\quad\n \\mathcal{L}^2 = 7.71 \\hbar.\n\\end{equation}\nFor these values, we find using Eq.~\\eqref{eq:Pmax}:\n\\begin{align*}\nP_{\\rm max}= \\left( 1.364 \\times 10^{-2} \\frac{pW}{K^2}\\right) (\\Delta T)^2,\n\\end{align*}\nwhich for a working temperature of $T=100mK$ and a temperature bias corresponding to $\\Delta T=0.05 T$, as in previous Figures, gives\n$P_{\\rm max}= \n0.341 aW $\nwith efficiency $\\eta_{P_{max}} = 0.23\\eta_C$. The total time $\\tau_P$ for maximum power output per cycle is computed through Eq.~\\eqref{eq:opt_taus}:\n\\begin{align*}\n \\tau_P = 2 \\tau_D = 48.8 ns\n\\end{align*}\nwhich corresponds to an operation frequency in the order of $0.1GHz$. \n\nIt is interesting to compare the value obtained for the maximum power in the protocol under consideration with the power associated to the limiting value for the work given by Eq. (\\ref{landauer}). Such limiting power can be obtained by \nreplacing $\\tau_P$ of Eq. \\eqref{eq:timescales} in Eq. \\eqref{eq:def_W}, where we see that at finite time the net work done by the machine operating at maximum power is $W_{P_{\\rm max}}= A \\;\\eta_C\/2$. Taking into account that for the heat engine\n$A \\leq \\log(2) k_B T$ -- see Eq. (\\ref{landauer})-- we conclude that the bound for the maximum operating power\nin a cycle of duration $\\tau_P$\nis $P_{\\rm lim}=\\log(2) \\; k_B T \\;\\eta_C\/(2\\tau_P)$. For the case of the protocol (b), given the values of Eq. (\\ref{al-b}), we get\n$P_{\\rm max}=0.7 P_{\\rm lim} $.\n\n\n\nIn a similar way using Eq. \\eqref{eq:Etamax}, the optimized parametrization that maximizes the efficiency of the cycle give us the value\n$\\eta_{\\rm max}=0.34 \\eta_C$.\n\nSpecific values for the maximum efficiency of the machine operating under other protocols can be obtained by substituting in Eq.~(\\ref{eq:x}) the values shown in Fig.\\ref{fig:optimal_ellipses_lambdaK}. This calculation shows that this machine can achieve a performance as high as $\\eta_{\\rm max} > 0.55 \\eta_C$. \nThese results are very encouraging regarding the possibility of the experimental implementation of this system.\n\n\n\n\n\n\n\n\n\n\\begin{figure}\n \\centering\n \\includegraphics[width=0.5\\textwidth]{machinePerformance.png}\n \\caption{Power (blue) and efficiency (orange) for curve (b) of Fig. \\ref{fig:lambdaK} as a function of the cycle duration $\\tau$. Solid lines: circulating around the curve at constant angular velocity. Dashed lines: Using the optimal velocities given by Eqs. \\eqref{eq:definition:L} (for power) and \\eqref{eq:LambdaK_def} (for efficiency).}\n\\label{fig:curve_b_performance}\n\\end{figure}\n\n\\section{Summary and conclusions}\nWe have followed a geometrical approach to describe the two competing mechanisms of a non-equilibrium adiabatic thermal machine: the dissipation of energy and the heat--work conversion. While the first mechanism is described in terms of a length, the second one can be represented by and area in the parameter space. \n We then showed that the problem of finding optimal protocols reduces to an isoperimetric problem, which consists in finding the optimal ratio between area and length in a space with non-trivial metrics.\n \n We applied this description to a thermal machine which consists of a single qubit asymmetrically coupled to two bosonic reservoirs at small different temperatures and driven by a cyclic protocol controlled by two parameters that vary slowly in time. \n We solved this problem in the limit of weak coupling between the qubit and the reservoirs. \n We analytically show the limiting value of the pumped heat between reservoirs is given by Landauer bound in an ideal Carnot cycle. We analyzed in this problem the type of cycles leading to optimal performance of the machine. Interestingly, \n the qubit machine has a very good ratio between performance and power within a wide set of parameters. \n \n According to our analysis, efficiencies larger \n than $0.55$ of the Carnot cycle can be achieved and values of the corresponding output power of $0.7$ of the limiting power, corresponding to the work done in an ideal Carnot cycle divided by the duration of the cycle at which the maximum power is achieved.\n These estimates are very encouraging for \n the experimental implementation of this machine. In this sense, a very promising platform is a superconducting qubit coupled to\n resonators, in which there are several configurations under study for some years now \\cite{niskanen2003fast,mottonen2008experimental,cottet2017observing,senior2020heat,upadhyay2021robust,guthrie2021cooper}. Other possible platforms are those in which the Otto cycle has been already implemented, like\n AMO systems \\cite{abah2012nov,von2019spin,brantut2013nov}, as well as spin systems in NMR setups \\cite{peterson2019dec}.\n Quantum dots, where electron pumping has been observed \\cite{pothier1992jan,switkes1999adiabatic} are also candidates for implementing the heat engine and refrigerator operations as well as nanomechanical systems \\cite{bachtold,ares}.\n This geometrical optimization can be also very naturally extended to analyze other systems like motors operating under slow driving and a bias voltage \\cite{marun,magnet,ludovico-capone,lucas1}. In the present work we have focused on the linear-response regime, where the geometric description becomes explicit. The weak-coupling calculations of the heat and work presented in Section \\ref{sec:qubit} and Appendix \\ref{appA:reducedDensityMatrix} can be extended to analyze the operation beyond this regime for specific thermal machines, representing an outlook to further works.\n \n \n \n \\section{Acknowledgements}\n \nWe thank Rosario Fazio and Jukka Pekola for stimulating discussions.\nP.A. is supported by ``la Caixa\" Foundation (ID 100010434, Grant No. LCF\/BQ\/DI19\/11730023), and by the Government of Spain (FIS2020-TRANQI and Severo Ochoa CEX2019-000910-S), Fundacio Cellex, Fundacio Mir-Puig, Generalitat de Catalunya (CERCA, AGAUR SGR 1381).\n L.A. and P.T.A. are supported by CONICET, and acknowledge financial support from PIP-2015 and ANPCyT, Argentina, through PICT-2017-2726, PICT-2018-04536. L.A. thanks KITP for the hospitality in the framework of the activity \"Energy and Information Transport in Non-equilibrium Quantum Systems\" and the support by\n the National Science Foundation under Grant No. PHY-1748958, and the Alexander von Humboldt Foundation, Germany. M. P.-L. acknowledges funding from Swiss National Science Foundation through an Ambizione grant PZ00P2-186067.\n\n\n\\input{appendix.tex}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction} \\label{sec:hajimeni}\nPassword authentication has long been essential for remote access to services that require user authentication \\cite{password-security-a-case-history}, but there remain many problems with it \\cite{quest-to-replace-passwords}. \nPhishing, for example, is a problem caused by asking users to present their passwords every time they use a service \\cite{anti-phishing}.\nIt is also a problem that users use the same password for many services or use short passwords because they don't want to remember many complex passwords \\cite{users-are-not-the-enemy, password-management-strategies-for-online-accounts}.\n\nPublic key authentication is an alternative to password authentication for stronger authentication.\nPublic key authentication assumes that only a user has a private key, and a service has the corresponding public key.\nA service authenticates a user in the following three steps.\nFirst, the service sends a random number called a challenge to the user.\nSecond, she signs the challenge by the private key corresponding to the public key registered with the service.\nThird, the service verifies the signature by any one of the public keys bound to her account.\n\nServices have to manage the binding of public keys to a user's account.\nServices trust this binding based on several models, where trusted third parties ensure the binding (e.g., Individual Number Card in Japan \\cite{my-number} and WebPKI \\cite{rfc5280}) and where they receive keys from users directly via trusted channels (e.g., FIDO \\cite{how-fido-works} and SSH \\cite{rfc4252}).\nThis study will focus on the last model.\n\nUsers have to manage private keys corresponding to registered public keys on their devices.\nWe call these devices authenticators.\nAuthenticators, such as Yubikey \\cite{yubico-product-doc} and Keychain \\cite{apple-keychain}, store key pairs in secure storage where corresponding private keys cannot be exported nor easily accessed by the outside of the authenticator.\nOperations using keys stored in secure storage require local authentication by authenticators, like PIN or biometrics.\nThis study assumes that users use authenticators having secure storage.\n\nAn authenticator has a mechanism called attestation \\cite{fido-attestation} that proves that an operation is done surely by the authenticator.\nAn attestation includes information about the manufacturer of the authenticator which generates the attestation, the model name of the authenticator, and results of the operation done by the authenticator, such as the public key of a generated key pair.\nAttestations are signed by the attestation key embedded in an authenticator by its manufacturer so that services can validate whether received attestations are generated by the authenticator.\nDuring account registration, an authenticator sends a public key, an attestation about the public key, and the certificate of the attestation key.\nServices can determine the trustworthiness of the received public key and the authenticator that stores the corresponding private key by verifying the attestation with the certificates received from the manufacturer of the authenticator.\n\nPublic key authentication (PKA) is stronger than password authentication for the following reason.\nFirst, PKA is resistant to data breaches on services because attackers cannot sign in to services with only public keys.\nSecond, PKA can be phishing resistant when an authenticator verifies whether the requested service is the same as the service accessed previously without interaction with a user.\nLastly, users don't have to use weak private keys for convenience, because authenticators, not users, remember and manage these keys.\nBesides, Malicious services cannot correlate their account using registered public keys because authenticators generate different public keys for each service.\n\nHowever, public key authentication has the problem that users can only use authenticators storing private keys corresponding to registered public keys when accessing services.\nGiven the following two concerns, it is a burden for users to register, update and revoke public keys in many services.\nFirst, users usually have multiple authenticators such as smartphones, PCs, and tablets.\nThey have to register multiple public keys with their authenticators, but simply registering public keys with each of all authenticators annoys users \\cite{fido-usability}.\nSecond, users add, replace, and throw away their authenticators according to the lifecycles of the authenticators.\nOnce such an event occurs, users need to update and revoke registered public keys in many services.\nCurrently, users can manage registered public keys on services via an authenticated session.\nIf an attacker steals an authenticator and revokes the public keys of authenticators held by a legitimate user before the user revokes the public key of the stolen authenticator, the user may become inaccessible.\n\nThe purpose of this study is that users can access services with public key authentication using any owned authenticators without explicitly registering public keys.\nTo realize this purpose, we propose the mechanism where users and services manage public keys based on the owner of authenticators storing the corresponding private keys.\nWe introduce a key pair, called an Ownership Verification Key (OVK).\nA user proves the ownership of authenticators by the private key of an OVK (Ownership Verification Secret Key; OVSK).\nA service verifies the possession of the authenticators by the public key of the OVK (Ownership Verification Public Key; OVPK).\nAll authenticators owned by a user can derive an OVSK from a seed pre-shared among them.\nA service manages the corresponding OVPK by binding it to her account.\nA service binds public keys signed by the OVSK to her account if verification by the OVPK is successful.\nTo protect user privacy while maintaining convenience, authenticators generate a different OVK for each service from the seed independently. \nUsers and services update OVKs according to the lifecycles of users' authenticators.\nWhen a user changes a set of her authenticators, she updates an OVSK, and services update an OVPK bound to her accounts.\n\nThe main contribution of this paper is that users and services can manage public keys based on the owner of the authenticators storing the corresponding private keys to facilitate their key management in public key authentication.\nWe implemented the Proof of Concept and confirmed that key management works as expected for typical use cases.\nWe analyzed the proposed mechanism to find threats with threat modeling and evaluated what measures our proposal takes against the found threats.\nWe confirmed that our proposal achieves some security goals such as that services cannot correlate accounts and can correctly bind public keys to accounts.\nWe discussed how our proposal mitigates threats for which measures are not sufficient. \n\nThe following is the structure of this paper.\nSection \\ref{sec:haikei} describes related work.\nSection \\ref{sec:teian} describes the key management using OVK.\nSection \\ref{sec:poc} describes the implementation of the Proof of Concept and use cases using the Proof of Concept.\nSection \\ref{sec:eval} describes evaluation with threat modeling.\nSection \\ref{sec:kousatsu} discusses the proposal.\nFinally, Section \\ref{sec:conclusion} summarizes this paper.\n\n\\section{Related Work} \\label{sec:haikei}\nNishimura \\cite{ntt-owner-identity} proposes sharing private keys among authenticators that users own.\nAuthenticators verify the owner of other authenticators to determine whether sharing private keys or not.\nTo verify the owner, a trusted third party issues certificates to authenticators.\nHowever, this approach weakens the authentication level of public key authentication because authenticators export private keys from secure storage.\nThis approach also weakens the trustworthiness of a registered public key because services cannot verify attestations.\nBesides, reliance on a trusted third party has a large management cost and the impact like a certificate authority in WebPKI if it becomes untrustworthy.\n\nJames \\cite{conners-19-lets-authenticate} introduces certificate chains like TLS client authentication to FIDO public keys so that FIDO is capable of registering multiple authenticators and recovering accounts.\nWhen a user registers a new public key generated in her authenticator with a service, she requests a certificate authority to issue the certificate binding the public key to her account of the service.\nThe authenticator sends the certificate to the service and the service can verify the owner of the public key by checking the subject of the certificate.\nHowever, this approach has the problem that it is not clear how a certificate authority authenticates users using multiple authenticators in addition to the same problem due to a trusted third party as \\cite{ntt-owner-identity}.\n\nOogami \\cite{fido-multi-registration} proposes the mechanism in which users register a new FIDO public key of an authenticator via authenticated sessions established by the registered public key of other authenticators.\nPublic keys have high assurance because users use registered authenticators every time users register a new public key of an authenticator. \nHowever, users have to keep multiple authenticators at the same time when registering a new public key, so that users cannot register a new public key when they have only unregistered authenticators.\n\nFrymann \\cite{yubico-webauthn-account-recovery} and Lundberg \\cite{yubico-webatuhn-account-recovery-impl} propose a mechanism for account recovery when losing registered authenticators that users use daily.\nIn this mechanism, a user has two authenticators.\nOne is for daily use by users, called the main authenticator.\nThe other is for backup use by users, called the backup authenticator.\nThe user deposits the backup authenticator in a vault.\nThe main authenticator receives the seed for deriving public keys from the backup authenticator in advance.\nOn behalf of the backup authenticator, the main authenticator generates a different public key of the backup authenticator for each service and registers the public key whose corresponding private key the backup authenticator can only derive.\nThe user can access services with the backup authenticator when losing the main authenticator.\nAs a result, this approach prevents services from correlating their account based on the registered public keys.\nHowever, services cannot verify the attestation of the public key of the backup authenticator during registration.\nBesides, when attackers gain control of the backup authenticator, they sign in with the backup authenticator and can revoke the public key of the main authenticator, and the user cannot sign in with the main authenticator.\n\nIdentity Federations using OpenID Connect \\cite{oidc-core} or SAML \\cite{saml-v2} allow users to reduce the number of services where users register public keys.\nHowever, users still register public keys with several services.\nBesides, there are also privacy issues where the service authenticating users, called an Identity Provider, can know what services they are using.\n\n\\section{Key Management with an Ownership Verification Key} \\label{sec:teian}\n\\subsection{Overview}\nWe propose the mechanism where a user and a service manage keys for authentication based on a public key cryptographic key pair called an Ownership Verification Key (OVK).\nAn OVK is derived by all authenticators of a user to prove that the private key corresponding to the public key to be registered is stored in her owned authenticator.\nThe public key of the OVK (Ownership Verification Public Key; OVPK) is registered with the service via the trusted channel established when registering a new account.\nThe service binds the OVPK to her account.\nThe private key of the OVK (Ownership Verification Secret Key; OVSK) is used for signing the public key to be registered.\nThe service binds the public key to her account if verification by the OVPK is successful.\n\nFig.\\ \\ref{fig:ovk-gaiyou-1} illustrates how a user registers a public key when she has two authenticators (A and B).\nShe shares an OVSK among Authenticators A and B in advance.\nWhen she registers a new account using Authenticator A, she attaches a public key for Authenticator A and an OVPK to the service.\nThen she seamlessly registers a new public key for Authenticator B by signing the public key with the OVSK whose corresponding OVPK has been already registered with Authenticator A.\nThe service verifies the signature by the registered OVPK and, if succeeded, binds the public key to her account.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/ovk-gaiyou-1.png}\n \\caption{Registering Public Keys Using An OVK}\n \\label{fig:ovk-gaiyou-1}\n\\end{figure}\n\nUsers and services update OVKs according to the lifecycles of users' authenticators.\nWhen a user changes a set of her authenticators, she updates an OVK in her all authenticators and notifies services of updating the OVPK.\nTo make an updating message, registered authenticators sign the new OVPK to be updated by the previous OVSK whose corresponding OVPK is now registered with services.\nServices update an OVPK bound to her account based on the most trustworthy updating message and re-bind public keys to her account based on the new OVPK.\nA user can still sign in with authenticators that have notified services of the new OVPK.\nTo invalidate the authenticators that are no longer in use, services revoke the public key corresponding to the authenticators that are not bounded to the new OVPK.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/ovk-gaiyou-2.png}\n \\caption{Updating an OVK}\n \\label{fig:ovk-gaiyou-2}\n\\end{figure}\n\nFig,\\ \\ref{fig:ovk-gaiyou-2} illustrates how a user updates an OVK when she has had two authenticators (A and B) and registered them with a service and replaces Authenticator A with Authenticator C because of losing Authenticator A.\nAfter losing Authenticator A, she shares a new OVSK between Authenticators B and C.\nAuthenticator B derives the new OVK ($OVK^2$) and signs the new OVPK ($OVPK^2$) by the previous OVSK ($OVSK^1$) to make an updating message.\nAuthenticator B notifies the service of the new OVPK ($OVPK^2$) by sending the updating message.\nThe service evaluates the message received from Authenticator B as the most trustworthy and binds the new OVPK to her account.\nIt re-binds the public key for Authenticator B to her account because B has sent the most trustworthy message and revokes the public key for Authenticator A because A has sent no messages.\nThen she can seamlessly register a new public key for Authenticator C by signing the public key with the new OVSK ($OVSK^2$) whose corresponding OVPK ($OVPK^2$) has been already registered by Authenticator B.\n\nThe following is the structure of this section.\nSection \\ref{sec:teian:ovk-derive} describes how to derive an OVK among authenticators.\nWe introduce a pre-shared secret called a seed to derive an OVK.\nSection \\ref{sec:teian:seed-sharing} describes how to share a seed among authenticators.\nSection \\ref{sec:teian:ovk-trust} describes how services verify the trustworthiness of an OVK requested to be registered.\nSection \\ref{sec:teian:ovk-update} describes how to update an OVK after sharing a new seed.\n\n\\subsection{Deriving an OVK from a Shared Secret} \\label{sec:teian:ovk-derive}\nIn this section, we describe how to derive an OVK from the pre-shared secret, called the seed.\nWe assume that the seed has been shared among all authenticators owned by the same user.\nWe also explain how to register public keys using an OVK.\n\n\\subsubsection{Requirement} \\label{sec:teian:ovk-derive:youken}\nWe define the requirements in such a way that our proposal does not interfere with what public key authentication described in Section \\ref{sec:hajimeni}, which we call PKA, can achieve during public key registration \\cite{fido-sec-ref, fido-privacy-principles}.\n\nFirst, our proposed method should not rely on trusted third parties for proving the owner of authenticators except for verifying attestations and establishing secure channels.\nIn PKA, users can register public keys via a trusted channel established when registering a new account or established by registered authenticators.\n\nSecond, our proposed method must prevent services from correlating their account by using the proof of the owner of authenticators.\nIn PKA, users can register different public keys with each service to protect user privacy against services seeking to correlate their accounts based on registered public keys.\n\nThird, in our proposed method, services should verify the attestation of the public key requested to be registered.\nServices can calculate the trustworthiness of the public key by verifying the attestation generated by the authenticator that has the corresponding private key.\n\nFinally, our proposed method should minimize the number of times a user operates multiple authenticators at the same time for convenience.\nOperating multiple authenticators at the same time whenever registering a new public key annoys a user.\n\n\\subsubsection{Deriving an OVK} \\label{sec:teian:ovk-derive:process}\nWe explain our proposal using Fig.\\ \\ref{fig:ovk-derive}, which shows a case where a user has two authenticators, A and B.\nA user registers a new account with service $\\alpha$ using Authenticator A at first, and then she accesses the service using Authenticator B.\nNote that we assume that messages between authenticators and the service have protected in terms of service authentication, confidentiality, and integrity (e.g., via TLS).\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/ovk-derive.png}\n \\caption{Deriving an OVK from the shared seed}\n \\label{fig:ovk-derive}\n\\end{figure}\n\nThe two authenticators agree in advance on the following parameters and the identifier of service $\\alpha$ ($sid_\\alpha$).\n\n\\begin{itemize}\n \\item \\texttt{s}: The seed value shared among authenticators (\\textcircled{\\scriptsize 1})\n \\item \\texttt{N}: The number of authenticators sharing the same seed (equal to the number of her authenticators) \n \\item The public key cryptographic algorithm for an OVK\n \\item \\texttt{KDF}: The key derivation function that takes a seed and a random value as inputs and outputs pseudorandom numbers of the length required for an OVSK\n \\item \\texttt{MAC}: The message authentication code function that takes an OVSK as a key\n\\end{itemize}\n\nFirst, the user registers a new account with service $\\alpha$ using Authenticator A.\nAuthenticator A generates a new key pair ($sk_A, pk_A$) and an attestation of the public key (\\textcircled{\\scriptsize 2} in Fig.\\ \\ref{fig:ovk-derive}).\nAt the same time, Authenticator A derives an OVPK and the corresponding metadata and registers them in addition to the public key ($pk_A$) with service $\\alpha$.\nThe derivation consists of the following three steps.\n\n\\begin{enumerate}\n \\renewcommand{\\labelenumi}{\\textcircled{\\scriptsize \\theenumi}}\n \\setcounter{enumi}{2}\n \\item Generate a random number ($R_\\alpha$).\n \\item Calculate an OVSK ($OVSK_\\alpha = \\mathtt{KDF}(\\mathtt{s}, R_\\alpha)$) and the corresponding OVPK ($OVPK_\\alpha$).\n If the authenticator cannot derive validate OVSK using the random number ($R_\\alpha$), start over from \\textcircled{\\scriptsize 3}.\n \\item Register $OVPK_\\alpha$ and the corresponding metadata consisting the following three values.\n \\begin{itemize}\n \\item $R_\\alpha$: The generated random number\n \\item $M_\\alpha$: The message authentication code ($\\mathtt{MAC}(OVSK_\\alpha, R_\\alpha + sid_\\alpha)$)\n \\item \\texttt{N}\n \\end{itemize}\n\\end{enumerate}\nNow, the user has registered a new account with service $\\alpha$.\nThe service binds the public key ($pk_A$), $OVPK_\\alpha$, and the corresponding metadata ($R_\\alpha, M_\\alpha, N$) to the new account.\n\nSecond, the user access service $\\alpha$ using unregistered Authenticator B.\nWhen the service returns a challenge for public key authentication by replying to an authentication request, it also returns the metadata ($R_\\alpha$ and $M_\\alpha$).\nAuthenticator B starts on seamless registration of a new public key because B has no public key for signing in to service $\\alpha$.\nAuthenticator B generates a new key pair ($sk_B, pk_B$) and the attestation of the public key (\\textcircled{\\scriptsize 8} in Fig.\\ \\ref{fig:ovk-derive}).\nAuthenticator B signs the public key ($pk_B$) by $OVSK_\\alpha$ so that service $\\alpha$ verifies whether the owner of Authenticator B storing the corresponding private key ($pk_B$) is the same as the owner of registered authenticators.\nTo derive $OVSK_\\alpha$ from the received metadata, the following two steps are performed.\n\n\\begin{enumerate}\n \\renewcommand{\\labelenumi}{\\textcircled{\\scriptsize \\theenumi}}\n \\setcounter{enumi}{5}\n \\item Derive $OVK_\\alpha$ using the received metadata $R_\\alpha$ in the same way as \\textcircled{\\scriptsize 4}.\n \\item Verify the received metadata $M_\\alpha$ using the derived $OVSK_\\alpha$. \n If this verification failed, the derived OVSK or the received metadata is not for service $\\alpha$.\n\\end{enumerate}\n\nService $\\alpha$ registers the public key ($pk_B$) if the attestation (\\textcircled{\\scriptsize 8}) and the signature (\\textcircled{\\scriptsize 9}) is valid and the number of the registered public keys is not more than \\texttt{N}.\n\n\\subsubsection{Different OVKs per Service} \\label{sec:teian:ovk-derive:ovk-per-svc}\nAuthenticators can derive different OVKs per service because of generating different random numbers (\\texttt{R}) per service.\nFig.\\ \\ref{fig:ovk-derive-per-svc} shows a situation where the user registers with Services $\\alpha$ and $\\beta$.\nIt is impossible to determine the seed value of an OVSK because of the properties of a key derivation function (\\texttt{KDF}).\nBy using a different random number for each service ( $R_\\alpha$ for Service $\\alpha$ and $R_\\beta$ for Service $\\beta$), authenticators can register unlinkable OVPKs with different services.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/ovk-derive-per-svc.png}\n \\caption{Deriving different OVKs per services}\n \\label{fig:ovk-derive-per-svc}\n\\end{figure}\n\nAuthenticators only need to remember the value of the seed. This is because authenticators store random numbers \\texttt{R} to services in a verifiable format. \nMoreover, even though the number of registered services increases, a user does not have to operate multiple authenticators to share a new OVSK.\nThis is convenience for a user.\n\n\\subsection{Sharing a Seed among Authenticators} \\label{sec:teian:seed-sharing}\nIn this section, we describe how to share a seed among authenticators of a user.\n\n\\subsubsection{Requirement} \\label{sec:teian:seed-sharing:youken}\nA user operates multiple authenticators and makes them communicate to share a seed.\nThere are various kinds of short-range communication protocols (e.g., Bluetooth, NFC, and generating and reading QR codes), each of which has its different characteristics in the security of the communication channel.\nWe define the following requirement to be independent of specific communication protocols.\n\n\\begin{itemize}\n \\item Assuming no security features of communication channels\n\\end{itemize}\n\nThis requires that attackers cannot calculate a seed using only the information that authenticators send to the channel (resistance to eavesdropping).\nThis also requires that authenticators can validate whether the received information is generated by the legitimate authenticator to be resistant to tampering.\n\n\\subsubsection{Two Authenticators} \\label{sec:teian:seed-sharing:2-party}\nFig.\\ \\ref{fig:seed-sharing-2-party} shows the case where a user has two authenticators.\nTwo authenticators agree on the same seed based on the Diffie-Hellman key agreement algorithm.\nThey encrypt DH public keys using an authenticated encryption based on a password set by the user to ensure the confidentiality of DH public keys and verify the authenticity.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/seed-sharing-2-party.png}\n \\caption{Sharing a seed between two authenticators}\n \\label{fig:seed-sharing-2-party}\n\\end{figure}\n\nThe authenticators agree on the following parameters in advance.\n\n\\begin{itemize}\n \\item \\texttt{pw}: The password set by the user (\\textcircled{\\scriptsize 1})\n \\item \\texttt{DH}: A Diffie-hellman key agreement algorithm\n \\item The list of authenticated encryption algorithms for encrypting DH public keys (Each algorithm has assigned an identifier)\n \\item The list of password-based encryption algortihms (Each algorithm has assigned an identifier)\n\\end{itemize}\n\nFirst, the user operates Authenticator A.\n\n\\begin{enumerate}\n \\renewcommand{\\labelenumi}{\\textcircled{\\scriptsize \\theenumi}}\n \\setcounter{enumi}{1}\n \\item Generate a DH key pair ($SK_A, PK_A$).\n \\item Generate a random number called a Content Encryption Key ($CEK_A$).\n \\item Encrypt the DH public key ($PK_A$) using $CEK_A$. \n Authenticator A determines the authenticated encryption algorithm from the list.\n \\item Encrypt $CEK_A$ using the password (\\texttt{pw}).\n Authenticator A determines the password-based algorithm from the list.\n\\end{enumerate}\nAuthenticator A sends the generated ciphertexts and the algorithm identifiers (at \\textcircled{\\scriptsize 4} and \\textcircled{\\scriptsize 5}) to Authenticator B.\n\nIn the same way, Authenticator B generates a DH key pair ($(SK_B, PK_B)$ at \\textcircled{\\scriptsize 6}) and a random number ($CEK_B$ at \\textcircled{\\scriptsize 7}), encrypts the DH public key ($PK_B$) using $CEK_B$, and encrypts $CEK_B$ using the password (\\texttt{pw}).\nNote that $CEK_B$ is not necessarily the same as $CEK_A$ generated by Authenticator A.\n\nAuthenticator A receives the ciphertexts from Authenticator B.\n\\begin{enumerate}\n \\renewcommand{\\labelenumi}{\\textcircled{\\scriptsize \\theenumi}}\n \\setcounter{enumi}{7}\n \\item Decrypt a received CEK ($CEK_B$) using the password (\\texttt{pw}).\n Authenticator A identifies the password-based algorithm by the received identifier.\n \\item Decrypt a received DH public key ($PK_B$) using the decrypted CEK ($CEK_B$).\n Authenticator A identifies the authenticated encryption algorithm by the received identifier.\n \\item Agree the same seed using the Diffie-hellman key agreement algorithm.\n\\end{enumerate}\n\n\\subsubsection{Three or More Authenticators}\nWhen a user has three or more authenticators, the authenticators share a seed like the situation in Fig.\\ \\ref{fig:seed-sharing-3-party}.\nFig.\\ \\ref{fig:seed-sharing-3-party} uses the algorithm \\cite{multi-party-diffie-hellman}.\nAll authenticators agree on the following parameters in advance in addition to the agreement for two authenticators.\n\n\\begin{itemize}\n \\item Each authenticator identifier (These identifiers are temporary identifiers used only to share a seed)\n \\item The partner authenticator identifier of each authenticator (Each authenticator receives calculated DH public keys from the same authenticator, called the partner authenticator, every step. The user assigns identifiers without overlap.)\n\\end{itemize}\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/seed-sharing-3-party.png}\n \\caption{Sharing a seed among three authenticators}\n \\label{fig:seed-sharing-3-party}\n\\end{figure}\n\nThe user operates authenticators according to the following steps.\nIn each step, encryption means that an authenticator generates a CEK, encrypts a DH public key using the CEK, and encrypts the CEK using the password set by a user.\n\n\\begin{description}\n \\item[Step1] Generate a DH key pair on each authenticator.\n \\item[Step2] \\begin{itemize}\n \\item Authenticator A sends the DH public key ($PK_A$) to Authenticator B with encryption.\n \\item B sends the DH public key ($PK_B$) to C with encryption.\n \\item C sends the DH public key ($PK_C$) to A with encryption.\n \\end{itemize}\n \\item[Step3] \\begin{itemize}\n \\item Authenticator A sends the calculated DH public value ($SK_A * PK_C$) using its DH private key ($SK_A$) and received DH public key ($PK_C$) to Authenticator B with encryption.\n \\item B sends the calculated DH public value ($SK_B * PK_A$) using its DH private key ($SK_B$) and received DH public key ($PK_A$) to C with encryption.\n \\item C sends the calculated DH public value ($SK_C * PK_B$) using its DH private key ($SK_C$) and received DH public key ($PK_B$) to A with encryption.\n \\end{itemize}\n \\item[Step4] \\begin{itemize}\n \\item Authenticator A calculates the DH public value ($SK_A * (SK_C * PK_B)$) and agrees the same seed.\n \\item B calculates the DH public value ($SK_B * (SK_A * PK_C)$) and agrees the same seed.\n \\item C calculates the DH public value ($SK_C * (SK_B * PK_A)$) and agrees the same seed.\n \\end{itemize}\n\\end{description}\n\nWhen a user has more than three authenticators ($N$: the number of her authenticators), she processes the above Step1 to Step $N+1$ with repeating the above Step3.\n\n\\subsection{Verifying the Trustworthiness of an OVK} \\label{sec:teian:ovk-trust}\nBecause a service binds public keys to an account by an OVK, the trustworthiness of public keys can never be higher than the trustworthiness of the OVK.\nWe propose how a service verifies the trustworthiness of an OVK.\n\nA service can evaluate the trustworthiness of an OVK using the following two criteria.\n\n\\begin{description}\n \\item[Criterion1] Whether an OVK is derived as described in Section \\ref{sec:teian:ovk-derive}\n \\item[Criterion2] Whether a seed is securely stored in all authenticators\n\\end{description}\n\nThe proposed verification mechanism depends on the attestation mechanism that authenticators already have.\nAuthenticators send an OVPK as well as the attestation of the OVPK at \\textcircled{\\scriptsize 5} on Fig.\\ \\ref{fig:ovk-derive}.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/ovk-attestation.png}\n \\caption{Sending the attestation of an OVPK}\n \\label{fig:ovk-attestation}\n\\end{figure}\n\nFig.\\ \\ref{fig:ovk-attestation} extracts the registration flow of an OVPK from Fig.\\ \\ref{fig:ovk-derive} and describes more details about attestations of public keys.\nAn attestation private key ($AttsKey_A$) is embedded in an authenticator by its manufacturer. \nA certificate for the attestation public key ($Certificate(AttsKey_A)$) is issued by the manufacturer.\nThe authenticator signs the public key generated at \\textcircled{\\scriptsize 2} and the information about the public key by using $AttsKey_A$ and sends them to a service. \n\nThe authenticator also signs a derived OVPK by $AttsKey_A$ to notify the service that the OVPK is derived from the seed stored in the authenticator as described in Section \\ref{sec:teian:ovk-derive:process}.\nThe service can verify the attestation of the OVPK based on the trusted policy about what authenticators comply with Section \\ref{sec:teian:ovk-derive}.\nThe service can validate Criterion1.\n\nMoreover, an attestation of an OVPK contains the OVPK itself and model names of the other authenticators sharing the same seed.\nAn authenticator gets the model names of the other authenticators by receiving the attestation of their DH public key while sharing the seed at \\textcircled{\\scriptsize 2} on Fig.\\ \\ref{fig:seed-sharing-2-party} (Fig.\\ \\ref{fig:seed-sharing-attestation}).\nA service can verify whether they store the seed securely based on the trusted policy about what authenticator model has secure storage and stores the seed in the storage.\nThe service can validate Criterion2.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/seed-sharing-attestation.png}\n \\caption{Attestation when sharing a seed}\n \\label{fig:seed-sharing-attestation}\n\\end{figure}\n\n\\subsection{Re-sharing a New Seed and Updating an OVK} \\label{sec:teian:ovk-update}\nA user updates a set of her authenticators according to lifecycles of the authenticators, such as theft or loss.\nWe propose a mechanism where a user can revoke an OVPK registered with a service and update a new OVPK in the service.\n\n\\subsubsection{Assumption} \\label{sec:teian:ovk-update:assumption}\nWe assume the following for this proposal.\n\n\\begin{enumerate}\n \\item Attackers can operate the seed and the private keys corresponding to registered public keys stored in a stolen authenticator.\n \\item It takes time for attackers to gain control of a stolen authenticator. \n\\end{enumerate}\n\nAssumption 2 is reasonable when authenticators protect the seed and private keys by local authentication like PIN or biometric.\nIn Section \\ref{sec:kousatsu:update}, we consider the case where authenticators have no local authentication, or where local authentication is immediately passed.\n\n\\subsubsection{Overview}\nAuthenticators share a new seed as described in Section \\ref{sec:teian:seed-sharing}.\nThey hold the previous seed along with a new one without erasing the previous one.\nThey notify a service of updating an OVK by sending an updating message described in Section \\ref{sec:teian:ovk-update:update-message} when a user signs in for the first time after re-sharing the new seed.\nThe service that receives updating messages waits for some period (OVK migration period) and accepts the new OVPK from the most trustworthy updating message.\nA service calculates the trustworthiness of each updating message in the way described in Section \\ref{sec:teian:ovk-update:eval-trust}.\nThe service re-binds public keys to the user's account by verifying with the new OVPK and revokes the public key bound only to the previous OVPK.\n\n\\subsubsection{An Updating Message for a New OVK} \\label{sec:teian:ovk-update:update-message}\nWe describe how an authenticator generates an updating message for a new OVK in Fig.\\ \\ref{fig:ovk-update}.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/ovk-update.png}\n \\caption{Generating an updating message for a new OVK}\n \\label{fig:ovk-update}\n\\end{figure}\n\n\\begin{enumerate}\n \\renewcommand{\\labelenumi}{\\textcircled{\\scriptsize \\theenumi}}\n \\item The authenticator receives the metadata from the service to derive OVKs from seeds.\n There are two kinds of received metadata. \n The first one is the metadata ($R^1, M^1$) for the previously registered OVK ($OVK^1$).\n The second one is the metadata ($[(R^2_i, M^2_i)]$) for OVK ($OVK^2$) candidates that other authenticators have registered as new OVKs.\n The authenticator receives the second one as a list because attackers can also generate a malicious updating message derived from a seed by using a stolen authenticator.\n \\item The authenticator derives the previously registered OVK ($OVK^1$) from the received metadata ($R^1, M^1$) and the previous seed ($s^1$) as described in Section \\ref{sec:teian:ovk-derive}.\n The authenticator uses the same key derivation function (\\texttt{KDF}) as the one used in Section \\ref{sec:teian:ovk-derive}.\n The authenticator verifies whether the derived OVK ($OVK^1$) is legitimate by comparing calculated MAC value with $M^1$.\n If the verification fails, the authenticator aborts this update process.\n \\item The authenticator derives the new OVK ($OVK^2$) from the received metadata ($[(R^2_i, M^2_i)]$) and the newly shared seed ($s^2$).\n If the metadata is not an empty list, the authenticator derives the new OVK from the legitimate metadata ($ (R^2, M^2) = (R^2_l, M^2_l)$) with which the authenticator can verify the MAC value ($M^2_l == MAC(s^2, R^2_l + sid)$).\n If the metadata is an empty list or the metadata has no legitimate metadata, the authenticator generates a new random value ($R^2$) and then derives a new OVK.\n Note that the previously registered OVK ($OVK^1$) is not used to derive the new OVK ($OVK^2$), but used to generate an updating message.\n \\item The authenticator signs the new OVPK ($OVPK^2$) by the OVSK ($OVSK^1$) corresponding to the previously registered OVPK ($OVPK^1$).\n The authenticator sends the signature as an updating message when signing in.\n Because the updating message is signed by the private key corresponding to the registered public key, the service can identify the authenticator sending the updating message.\n\\end{enumerate}\n\nIn the above explanation, we assume that authenticators have two shared seeds.\nHowever, authenticators may have more than two seeds because users change their authenticators many times.\nUsers replace their authenticators when purchasing new devices and may lose their authenticators more than once.\nWe explain that authenticators can generate the correct updating message even when they have more than two seeds.\nAuthenticators select the latest seed as the new seed.\nAs the seed corresponds to registered OVPK, authenticators can select the seed successfully by verifying the MAC value of the received metadata.\nFrom the above, authenticators can send a legitimate updating message to services even when they have more than two seeds.\n\n\\subsubsection{Evaluating the Trustworthiness of an Updating Message} \\label{sec:teian:ovk-update:eval-trust}\nWhen a service receives an updating message from a registered authenticator, it enters the OVK migration period.\nIn this migration period, no authenticators can register a new public key by the registered OVK.\nIf the same updating message comes from more than half of the registered authenticators during the period, the service trusts the message.\nOtherwise, the service trusts the updating message sent from the most registered authenticators at the end of the period.\nIf there is more than one message sent by the most registered authenticators, the service trusts the earliest received message.\n\n\\subsubsection{Reducing the Number of Seed Held by Authenticators}\nAs described in Section \\ref{sec:teian:ovk-derive:ovk-per-svc}, an authenticator can derive many different OVKs for different services from a seed.\nAn authenticator can update OVKs multiple times without consuming a lot of storage space.\nHowever, the secure storage space that an authenticator has is limited.\nTherefore, we propose two methods for limiting the number of seeds that an authenticator holds.\n\n\\begin{enumerate}\n \\item Set a limit on the number of seeds that an authenticator holds.\n If the number of seeds exceeds the limit, it deletes the oldest seed with the consent of the user.\n \\item Set an expiration date for a seed.\n If an authenticator has a seed that is about to expire, it prompts a user to share a new seed and update OVKs.\n It deletes any seed that has expired.\n\\end{enumerate}\n\nThe first method is easier to implement because a user decides whether to delete seeds.\nThe first method does not require a user to renew OVKs periodically, even though she continues to use the same authenticators.\nOn the other hand, in the second method, since a seed has an expiration date, OVKs also have the same expiration date.\nThis means that a service can know when to update a seed.\nIn the second method, a service can send security notifications to reduce operational risks such as forgetting to update OVKs.\n\nBoth have their advantages, and both can reduce disadvantages by setting limits to a large value in the first method or a longer expiration date in the second method.\nThe choice of either method depends on a user's preference or the limitations of authenticators.\n\n\\section{Proof of Concept and Use Cases} \\label{sec:poc}\nWe implement the Proof of Concept (PoC) to demonstrate the feasibility that our proposal allows users to access services with multiple authenticators.\nWe implement the PoC using JavaScript.\nIn the PoC implementation, one browser window is treated as one authenticator, so that we can emulate multiple authenticators on the same device.\nNote that the PoC stores seed, private keys, and the attestation key in not secure storage.\nThe source code is available on GitHub \\footnote{\\url{https:\/\/github.com\/hatake5051\/ovk-poc}}.\n\n\\subsection{Implementation Detail}\n\\subsubsection{Implementation of an Authenticator}\nFig.\\ \\ref{fig:impl-authnor} illustrates the implementation of an authenticator based on data flow diagrams \\cite{dfd}.\nIn this figure, an ellipse represents a process, an entity between an upper line and a lower line represents a data store, and an arrow represents data flow.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=\\columnwidth]{assets\/impl-authnor.png}\n \\caption{Authenticator Implementation}\n \\label{fig:impl-authnor}\n\\end{figure}\n\n\\texttt{SeedGenerator} implements Section \\ref{sec:teian:ovk-derive}.\n\\texttt{Seed} stores shared seeds.\nThe bit length of each seed is 256.\nWe statically define the following parameters required in Section \\ref{sec:teian:ovk-derive} and a service identifier as the origin of the service URL.\n\n\\begin{itemize}\n \\item The algorithm of an OVK is elliptic curve cryptography \\cite{sec1} with secp256r1 \\cite{sec2}.\n An OVK is calculated using a KDF output as pseudorandomly selected an integer d of Section 3.2.1 in \\cite{sec1}.\n \\item The key derivation function (\\texttt{KDF}) is HMAC \\cite{rfc2104} using SHA-256 \\cite{fips180-4}.\n \\item The MAC function (\\texttt{MAC}) is HMAC \\cite{rfc2104} using SHA-256 \\cite{fips180-4}.\n\\end{itemize}\n\n\\texttt{SeedNegotiator} implements Section \\ref{sec:teian:seed-sharing} except for encrypting and decrypting a DH public key by a CEK and a CEK by a password, and sending and receiving ciphertexts.\n\\texttt{Device} implements these exceptions instead of \\texttt{SeedNegotiator}.\n\\texttt{SeedNegotiator} stores an ephemeral private key for the DH key agreement algorithm in \\texttt{EDH}.\n\n\\texttt{EDH} stores the seed calculated as a result of the key agreement in \\texttt{Seed} and deletes the ephemeral private key.\nWe statically define the following parameters required in Section \\ref{sec:teian:seed-sharing}.\nWe also use JSON Web Encryption Compact Serialization \\cite{rfc7516} to serialize ciphertexts and algorithm identifiers.\n\n\\begin{itemize}\n \\item The key agreement algorithm (\\texttt{DH}) is elliptic curve diffie-hellman based on elliptic curve cryptography \\cite{sec1} with secp256r1 \\cite{sec2}.\n \\item The authenticated encryption algorithm is AES using 128 bit key \\cite{fips197} in Galois\/Counter Mode (GCM) \\cite{nistsp800-38d}.\n \\item The password-based encryption algorithm is Password Based Encryption Scheme 2 \\cite{rfc8018} using AES-KW \\cite{rfc3394} and SHA-256 \\cite{fips180-4}.\n\\end{itemize}\n\n\\texttt{SeedUpdater} implements Section \\ref{sec:teian:ovk-update}.\nOnly this process and \\texttt{SeedGenerator} can access \\texttt{Seed}.\n\n\\texttt{Device} is the process of generating key pairs and attestations and managing them based on an OVK.\n\\texttt{Credential} stores generated key pairs.\n\\texttt{Attestation} stores the attestation private key and the certificate of the corresponding attestation public key.\n\\texttt{Negotiating} stores data used for Section \\ref{sec:teian:seed-sharing} like a password.\n\\texttt{Device} generates an attestation for these type of keys: public keys stored in \\texttt{Credential}, OVPKs generated by \\texttt{SeedGenerator}, and DH public keys calculated by \\texttt{SeedNegotiator}. \n\n\\texttt{UI} is the process of communicating ciphertexts generated by \\texttt{Device} with other authenticators and interacting with a user.\nWe use reading and generating QR codes as the communication channel among authenticators used for Section \\ref{sec:teian:seed-sharing}.\n\\texttt{FetchAPI} communicates with a service via a secure channel established by TLS.\n\n\\subsubsection{Implementation of a Service}\nFig.\\ \\ref{fig:impl-svc} illustrates the implementation of a service based on data flow diagrams.\n\n\\begin{figure}[htb]\n \\centering\n \\includegraphics[width=0.9\\linewidth]{assets\/impl-svc.png}\n \\caption{Service Implementation}\n \\label{fig:impl-svc}\n\\end{figure}\n\n\\texttt{StartAuthn} accepts authentication requests from a user.\nIt receives the account name of the user and responds with a challenge bound to the account and, if registered, public keys, an OVPK, and the metadata of OVPK.\n\n\\texttt{Register} accepts requests for registering a new account and a new public key bound to an account as described in Section \\ref{sec:teian:ovk-derive}.\nWhen registering a new account, a user sends a new public key, an OVPK, and the metadata of the OVPK.\nThe user also sends an attestation of the public key and, if requested, an attestation of the OVPK.\nA service verifies attestations to determine whether it accepts the registration.\n\n\\texttt{Authn} accepts challenge responses for authentication.\nWe use elliptic curve digital signature algorithm \\cite{sec1} with secp256r1 \\cite{sec2} for authentication.\nIt also receives an updating message as described in Section \\ref{sec:teian:ovk-update}.\n\\texttt{Update} processes updating OVKs.\n\n\\texttt{CredManager} manages the bindings of public keys and OVPKs to accounts.\n\\texttt{Creds} stores public keys bound to OVPKs.\n\\texttt{OVKM} stores OVPKs and the corresponding metadata bound to accounts.\n\\texttt{Updating} stores updating messages when processing updating OVPKs.\n\n\\subsection{Use Cases}\nUsing the PoC in the following scenario, we confirm that our proposal allows authenticators to share a seed, derive an OVK, register a new public key with an OVK seamlessly, and update a registered OVPK.\n\n\\begin{enumerate}\n \\item Three Authenticator A, B, and C share a seed.\n \\item With Authenticator A, the user registers a new public key and an OVPK with Service 1 during account registration.\n \\item With Authenticator B and C, she seamlessly registers new public keys with Service 1.\n \\item With Authenticator B, she registers a new public key and an OVPK with Service 2 during account registration.\n \\item With Authenticator C (not A), she seamlessly registers a new public key with Service 2.\n \\item Two Authenticator A and B updates a new seed (Assuming that Authenticator C is lost). \n \\item With Authenticator A, she notifies Service 1 of updating a new OVPK.\n At this time, it is still possible to sign in to Service 1 with Authenticator C.\n \\item With Authenticator B, she notifies Service 1 of updating the same new OVPK as the one notified with Authenticator A.\n At this time, Service 1 updates an OVPK bound to her account, so that it is impossible to sign in to Service 1 with Authenticator C.\n \\item With Authenticator B, she notifies Service 2 of updating a new OVPK.\n At this time, it is still possible to sign in to Service 2 with Authenticator C.\n After finishing the migration period, Service 2 updates an OVPK bound to her account and revokes the public key of Authenticator C.\n Then, with Authenticator A, she can seamlessly register a new public key with Service 2.\n\\end{enumerate}\n\n\\section{Evaluation with Threat Analysis} \\label{sec:eval}\nWe evaluate our proposal by analyzing the PoC described in Section \\ref{sec:poc} based on threat modeling \\cite{threat-modeling, fido-sec-ref}.\n\n\\subsection{Security Requirement}\n\\subsubsection{Assets to be Protected}\nWe enumerate the assets to be protected in this proposal.\n\\begin{enumerate}\n \\item Private keys stored in authenticators\n \\item Public keys managed by services\n \\item The attestation key stored in each authenticator\n \\item The key signing attestation certificates managed by each authenticator manufacturer\n \\item The trusted root certificate and policy for services to validate attestations\n \\item The TLS private key managed by services\n \\item The trusted root certificate and policy for authenticators to validate TLS certificates\n \\item The seed stored in authenticators\n \\item The OVPK and corresponding metadata stored in services\n \\item The ephemeral DH private key generated by authenticators for sharing a seed\n \\item The temporary password stored in authenticators for sharing a seed\n\\end{enumerate}\n\n\\subsubsection{Security Goals} \\label{sec:eval:sec-goals}\nWe enumerate the goals to achive in our proposal.\nWe define the following goals while referring to goals in \\cite{fido-sec-ref}.\n\n\\begin{description}\n \\item[SG-1] Strong User Authentication: Services can authenticate users based on public key authentication.\n \\item[SG-2] Unlinkability: Services cannot correlate their accounts.\n \\item[SG-3] Credential Binding: Services can bind public keys to legitimate accounts.\n \\item[SG-4] Attestable Properties: Services and authenticators can validate public keys by verifying attestations.\n \\item[SG-5] Forgery Resistance: Be resilient from attempting to modify intercepted communications to masquerade as legitimate users.\n\\end{description}\n\n\\subsubsection{Security Assumptions}\nWe enumerate the assumptions about the environment where our proposal works.\n\n\\begin{description}\n \\item[SA-1] The processes and data stores surrounded by the trusted boundary represented by the inner dotted line in Fig.\\ \\ref{fig:impl-authnor} are isolated from other processes on the authenticator.\n The authenticator requires local authentication before accessing these processes and data stores.\n \\item[SA-2] The cryptographic algorithms used can achieve the objectives of each algorithm.\n \\item[SA-3] A service can correctly validate the certificate chain of attestations.\n \\item[SA-4] A service and an authenticator can establish a secure channel for service authentication, confidentiality for message, and integrity for messages (like TLS).\n\\end{description}\n\n\\subsection{Threat Analysis}\nWe enumerate the threats on data flow diagrams described in Section \\ref{sec:poc}, and explain what goals listed in Section \\ref{sec:eval:sec-goals} each threat violates and what measures our proposal takes.\n\n\\subsubsection{Threats on an Authenticator}\nIn Fig.\\ \\ref{fig:impl-authnor}, a dotted line represents a trusted boundary.\nWe focus on data flows across trusted boundaries and enumerate the threats in each of them.\n\nFirst, threats arising between a user and \\texttt{UI} include the following.\n\n\\begin{description}\n \\item[Homograph Mis-Registration] A malicious service pretends a legitimate service to make the user believes it is legitimate.\n It prompts the user to register a new public key seamlessly, and sends metadata stolen from other services.\n The malicious service correlates OVPKs by whether the user requests a new public key registration or not.\n This threat violates SG-2 because the malicious service can correlate different OVPKs generated for different services.\n Our proposal addresses this threat because authenticators verify the MAC value of the received metadata.\n The data protected by the MAC value contains the identifier of the service that the authenticator communicates.\n Because Assumption SA-4 allows authenticators to trust the communicating service identifier, authenticators can detect spoofing of services by malicious actors.\n \\item[User Verification By-pass] An attacker can operate the authenticator, or an attacker can bypass the local authentication of the authenticator to operate it.\n This threat violates SG-1 because the attacker can masquerade as the legitimate user.\n Our proposal addresses this threat by transferring it to SA-1.\n We consider the case where this SA-1 assumption is not satisfied during the OVK update in Section \\ref{sec:kousatsu:update}.\n\\end{description}\n\nThreats arising between a service and \\texttt{FetchAPI} include the following.\n\n\\begin{description}\n \\item[Service Verification Error] The authenticator cannot properly authenticate services, thus it cannot correctly identify services.\n As a result, an attacker can eavesdrop and tamper with the communication channel.\n This threat violates SG-1 and SG-5 because the attacker can hijack the authenticated session.\n This threat also violates SG-2 because the authenticator fails to address the threat Homograph Mis-Registration described above.\n Our proposal addresses this threat by transferring it to SA-4.\n\\end{description}\n\nThreats arising between another authenticator and \\texttt{UI} include the following.\n\n\\begin{description}\n \\item[Malicious Authenticator Linking] An attacker's authenticator participates in sharing a seed.\n The attacker gets the seed value itself.\n The attacker can use this authenticator to register a new public key with any service that a legitimate user has registered.\n This threat violates SG-3.\n Our proposal addresses this threat because a user protects sharing a seed with a password.\n Users are required to use passwords that are not guessable during sharing a seed.\n \\item[Weak Authenticator] A user allows a weak authenticator to participate in sharing a seed.\n The weak authenticator does not securely protect a seed, so, when an attacker compromises the weak authenticator, the seed may be leaked.\n This threat violates SG-3 because the attacker can register a new public key of the attacker's authenticator by generating the OVK with the compromised seed.\n Our proposal addresses this threat because each authenticator validates the security properties of other authenticators through attestations when sharing a seed.\n\\end{description}\n\nThreats arising between \\texttt{Device} and \\texttt{UI} include the following.\n\n\\begin{description}\n \\item[Malicious Authenticator] A user uses a malicious authenticator.\n Because a user cannot rely on the malicious authenticators, this threat violates any goals.\n It is difficult for users to determine whether it is a legitimate authenticator from a trusted manufacturer.\n Our proposal addresses this threat because services maintain a list of attestation certificates of trusted manufacturers.\n\\end{description}\n\nThreats to the authenticator include the following.\n\n\\begin{description}\n \\item[Side Channel Attack] Access to the data store that is not described in Fig.\\ \\ref{fig:impl-authnor} compromises assets to be protected.\n This threat violates SG-1 if key pairs are compromised and SG-2 and SG-3 if seeds are compromised.\n This threat also arises another threat like Malicious Authenticator Linking if a temporary password for sharing a seed is compromised.\n Our proposal addresses this threat by transferring it to SA-1.\n \\item[Bad Cryptography Primitives] An authenticator uses a compromised cryptographic algorithm or a weak pseudo-random number generator in the process.\n This threat violates SG-3 if an attacker derives the OVK.\n This threat also violates SG-2 if an attacker gets the seed.\n Our proposal addresses this threat by transferring it to SA-2.\n\\end{description}\n\n\\subsubsection{Threat on a Service}\nIn Fig.\\ \\ref{fig:impl-svc}, we focus on data flows across trusted boundaries and enumerate the threats in each of them.\n\nThreats arising between an authenticator and \\texttt{StartAuthn} include the following.\n\n\\begin{description}\n \\item[Linking OVPK] An attacker can obtain the OVPK and metadata associated with the account.\n The attacker receives OVPKs and corresponding metadata from many services and attempts to derive corresponding OVSKs.\n The attacker also attempts to correlate collected OVPKs by checking whether OVPKs are derived from the same seed.\n This threat violates SG-2 and SG-3.\n Our proposal addresses this threat by transferring it to SA-2.\n\\end{description}\n\nThreats arising between an authenticator and \\texttt{Register} include the following.\n\n\\begin{description}\n \\item[Malicious Authenticator Registration] An attacker attempts to register a new public key of his authenticator to a legitimate user account.\n This threat violates SG-3.\n Our proposal addresses this threat because an attacker cannot get the OVSK corresponding to the OVPK bound to the account.\n An attacker cannot also get the seed corresponding to the OVPK.\n The service can verify that trusted authenticators store a seed and OVSKs by verifying OVPK attestations.\n Even if a seed is compromised, our proposal mitigates this threat because the number of authenticators that can be registered is restricted.\n After a user registers public keys of her all authenticators an attacker cannot register his public keys.\n\\end{description}\n\nThreats arising between an authenticator and \\texttt{Authn} include the following.\n\n\\begin{description}\n \\item[Updating Malicious OVPK] An attacker attempts to update to an OVPK derived from the seed held by his authenticator.\n This threat violates SG-3 because the attacker can register his public keys.\n This threat also violates SG-1 because the attacker can revoke the user's public keys.\n Our proposal addresses this threat because an attacker cannot know the seed corresponding to the registered OVPK.\n We consider the case where this SA-1 assumption is not satisfied during updating an OVK in Section \\ref{sec:kousatsu:update}.\n We disscuss whether our proposal mitigates this threat even if the seed is compromised in Section \\ref{sec:kousatsu:update}.\n\\end{description}\n\n\\section{Discussion} \\label{sec:kousatsu}\n\\subsection{Deriving an OVK}\nWe confirm that our proposal achieves the requirements of Section \\ref{sec:teian:ovk-derive:youken}.\nFirst, a user registers an OVK during new account registration where a service can trust information received from a user.\nA service can verify the owner of the authenticator storing a private key corresponding to the public key to be registered without a trusted third party.\nNote that attestation and the safety of communications rely on a trusted third party.\nSecond, malicious services cannot correlate their accounts with sharing OVPKs and corresponding metadata because the security property of a key derivation function makes it impossible to derive a seed from an OVPK and the corresponding metadata.\nBesides, a malicious service cannot correlate the user's account by checking whether a user can use the OVPK and the metadata of another service to request a new public key registration.\nThis is because authenticators verify the MAC value of the received metadata to determine whether the received metadata is for the service.\nThird, an authenticator generates an attestation of the public key to be registered.\nA service can verify the attestation to evaluate the trustworthiness of the public key requested to be registered.\nFinally, once authenticators of a user share a seed, they derive an OVK per service independently.\nShe does not have to operate multiple authenticators whenever registering a new public key.\n\n\\subsection{Sharing a Seed}\nWe confirm that our proposal achieves the requirements of Section \\ref{sec:teian:seed-sharing:youken}.\nOnly authenticators having a password can participate in sharing a seed.\nOnly authenticators having a password can decrypt the ciphertexts generated by other authenticators having the same password.\nThey can also verify the integrity of received ciphertexts by a password.\nA user enters a password directly into each authenticator so that the password does not flow on the communication channel where authenticators share a seed.\nBecause a long enough password allows an attacker to take an extremely long time to decrypt ciphertexts and a secure encryption algorithm prevents him from compromising ciphertexts, it is difficult for the attacker to compromise the password and participate in sharing a seed before the sharing is complete.\nBesides, because the assumption that a DH key agreement algorithm is secure against eavesdropping prevents an attacker from deriving a seed from decrypted ciphertexts including DH public keys, an attacker cannot compromise a seed.\nFrom the above, without assuming the security of the communication channel, we can prevent the leakage of the seed by eavesdropping and tampering.\n\n\\subsection{The Trustworthiness of a Key for Authentication}\nA service considers the next two to determine whether it trusts a key for authentication.\nOne is the trustworthiness of the key itself.\nThe other is the trustworthiness of the binding of a public key to an account.\nA service evaluates the former by verifying that a trusted authenticator stores a private key and that a used cryptographic algorithm has not been compromised.\nTo verify that, a service verifies the attestation of a public key.\n\nA service evaluates the latter by verifying whether the private key corresponding to the public key bound to an account is stored in the authenticator owned by the user having the account.\nThis trustworthiness depends on how a user registers the public key.\nFor example, in \\cite{fido-multi-registration}, a user registers a new public key via an authenticated session established by a registered public key.\nIn our proposal (Section \\ref{sec:teian:ovk-derive} and Section \\ref{sec:teian:seed-sharing}), a user registers a new public key with an OVK derived from the seed shared among authenticators.\nIn the former method, a public key has high assurance because a user uses registered authenticators every time she registers a new public key.\nThe method is not convenient because she has to have a registered authenticator for registering a new one.\nThe latter method (our proposal) is convenient because, once she has shared a seed, a user must have only an authenticator to append a new public key to a service.\nA public key does not have high assurance if the seed can be compromised.\n\nTo make a public key higher assurance in our proposal, We propose a method for a service to verify the trustworthiness of an OVPK (Section \\ref{sec:teian:ovk-trust}).\nBy verifying an attestation of an OVPK to be registered, a service can evaluate whether the seed deriving the OVPK is stored securely on the authenticator communicating with the service.\nBy verifying an attestation of a DH public key when sharing a seed, authenticators can evaluate whether the other authenticators store the seed securely.\nA service can also verify whether all authenticators securely store the seed deriving the registered OVPK by verifying an attestation of the OVPK.\nThis is because the attestation includes the model names of all authenticators storing the seed.\nA service can verify whether they store the seed securely based on the trusted policy about what authenticator model has secure storage and stores the seed in the storage.\n\n\\subsection{Updating an OVK} \\label{sec:kousatsu:update}\nA service calculates the trustworthiness of an updating message and selects the OVK of the most trusted message as the new OVK.\nA service considers the number of registered authenticators sending the same updating message as the trustworthiness of the updating message.\nWe consider that the trustworthiness of all registered authenticators before the OVK migration period is equal.\nThis is because it is difficult for a service to determine whether an authenticator is stolen or held by a legitimate user.\nBased on the assumption that it takes time for an attacker to gain control of a stolen authenticator (Assumption 2 in Section \\ref{sec:teian:ovk-update:assumption}), a service selects the earlier sent message when two or more updating messages have the same and most trustworthiness. \n\nWe discuss what attacks the proposed method prevents when an attacker can operate the seed and the private key with a stolen authenticator (Assumption 1 in Section \\ref{sec:teian:ovk-update:assumption}).\nIn our proposal, the number of registered authenticators is limited to $N$, which is in the metadata sent when an OVK registration.\nNote that an attacker can increase the number of registered authenticators by registering public keys in the way described in Section \\ref{sec:teian:ovk-derive} before sending updating messages.\n\nWe disscuss cases based on the following numbers.\n\\begin{itemize}\n \\item $N$: the number of authenticators sent when an OVK registration\n \\item $N_u$: the number of registered authenticators owned by a legitimate user before an OVK migration period\n \\item $N_a$: the number of registered authenticators controlled by an attacker before an OVK migration period\n\\end{itemize}\n\nIn the case of $N=2$, the service trusts the authenticator that sends updating messages earlier.\nTherefore, in the case of $N_a =1$, if the attacker sends an updating message earlier (Assumption 2 in Section \\ref{sec:teian:ovk-update:assumption} is broken), the service trusts the OVK sending from the authenticator stolen by the attacker and revokes the public key whose corresponding private key is held by the authenticator of the legitimate user.\n\nIn the case of $N \\geq 3$, if $N_u \\geq N \/ 2$ or $N_u > N_a$, then a legitimate user can update an OVK and prevent the attacker from updating an OVK because public keys whose corresponding private keys is stored in stolen authenticators are correctly revoked.\n\n\\section{Conclusion} \\label{sec:conclusion}\nWe introduce a key pair called an Ownership Verification Key (OVK) and propose the mechanism where users and services manage public keys based on the owner of authenticators storing the corresponding private keys.\nThe mechanism allows users to access services with any of their authenticators without registering each of their public keys explicitly.\n\nA user can derive the private key of an OVK (OVSK) on her authenticators from the seed sharing among the authenticators.\nA service binds the public key of OVK (OVPK) to a user's account.\nA service binds a public key signed by an OVSK to the user's account bound to the corresponding OVPK.\nWhen a user changes a set of her authenticators, she updates an OVSK, and a service updates an OVPK binding to her accounts based on the most trustworthy updating message.\n\nWe implemented the Proof of Concept and confirmed that key management works as expected for typical use cases.\nWith threat modeling, we evaluated what measures our proposal takes against the threats.\nWe confirmed that our proposal achieves some security goals, such as that services cannot correlate accounts and can correctly bind public keys to accounts.\nWe discussed how our proposal mitigates threats for which measures are not sufficient. \n\nFuture work includes a model where, in updating an OVK, the trustworthiness of each authenticator having the private key corresponding to a registered public key differs.\nFor example, when a service receives a message that some authenticator is not trustworthy from the registered email address, the service reduces the trustworthiness of the authenticator.\n\n\\bibliographystyle{ACM-Reference-Format}\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\n\nIn this paper, we introduce and discuss the possibility to obtain\nsteady solutions with power-like tails starting from conservative\nmolecular systems described by the Boltzmann equation with\nMaxwell-type collision kernels. The starting point of our model is\nto consider binary collisions that result in a linear combination\nof an inelastic collision and a random contribution. As we\nshall see, the random addition to the post-collision velocities\ncan only increase the mean of the collisional energy, and, among\nother things, it gives the possibility to construct a binary collision\nthat preserves (in the mean) mass, momentum and energy. Our model\nis closely related to a kinetic model for economics introduced by\nPareschi and two of the present authors \\cite{CPT}. There, the\nrandom contribution to the collision (trade) was introduced to\ntake into account the returns of the market.\n\nInelastic Maxwell models were introduced by Bobylev, Gamba and one\nof the authors in 2000 \\cite{Bobylev-Carrillo-Gamba}; see also\n\\cite{BK00} for the one dimensional case. Maybe the most\ninteresting result (absent in the elastic case) is the existence\nof self-similar solutions in the homogeneous cooling problem and\nthe non-Maxwellian behavior of these solutions, which displays\npower-like decay for large velocities. It was conjectured in\n\\cite{EB2} and later proved in \\cite{Bobylev-Cercignani2,\nBobylev-Cercignani-Toscani, BisiCT2} that such solutions represent\nintermediate asymptotics for a wide class of initial data. Other\nresults concerned with self-similar solutions in the theory of\nthe classical (elastic) Boltzmann equation for Maxwell molecules were\nalso recently published in \\cite{Bobylev-Cercignani,\nBobylev-Cercignani2}. In light of these results, it looks\nclear that in many aspects both elastic and inelastic Maxwell\nmodels must be studied from a unified point of view. As observed\nby Bobylev and Gamba in\n\\cite{Bobylev-Cercignani-Gamba,Bobylev-Cercignani-Gamba2}, an\ninteresting question arises in connection with power-like tails\nfor high velocities. Is it possible to observe a similar effect,\ni.e., an appearance of power-like tails from initial data with\nexponential tails, in a system of particles interacting according\nto laws of classical mechanics without energy loss? In\n\\cite{Bobylev-Gamba} Bobylev and Gamba gave a partial answer to\nthis question by showing that, under a certain limiting procedure,\nsuch behavior can in principle be observed if one considers a\nmixture of classical Maxwell gases. More precisely, self-similar\nsolutions converging towards maxwellian equilibrium were proved to\nhave power-like tails once normalized by the equilibrium.\n\nIn this paper, we will try to elucidate the same question,\nstarting from a somewhat different point of view. Our starting\npoint will be a suitable modification to the homogeneous Boltzmann\nequation for the inelastic Maxwell molecules introduced in Ref.\n\\cite{Bobylev-Carrillo-Gamba}, in such a way that the usual\nconservations of mass, momentum and energy in the binary\ncollisions still continue to hold in the mean sense. The\nscaled-in-time inelastic Boltzmann equation introduced in\n\\cite{Bobylev-Carrillo-Gamba} reads\n \\begin{equation}\n\\frac{\\p f}{\\p t}=Q_e(f,f)\\,. \\label{BE1}\n \\end{equation}\nHere, $f(v,t)$ is the density for the velocity space distribution\nof the molecules at time $t$, while $Q_e(f,f)$ is the inelastic\nBoltzmann collision operator, which contains the effects of binary\ncollisions of grains. As usual in this context, the collision\noperator $Q_e(f,f)$ is more easily treated if expressed in weak\nform. This corresponds to writing, for every suitable test\nfunction~$\\varphi$,\n \\begin{equation}\n(\\varphi,Q_e(f,f))= \\frac{1}{4 \\pi} \\int_{\\Realr^3}\n\\int_{\\Realr^3} \\int_{S^2} f(v) f(w) \\Big[ \\varphi (v^*)- \\varphi\n(v) \\Big] dv\\,dw\\,d\\sigma. \\label{Qweak}\n \\end{equation}\nIn \\fer{Qweak}, $v^*$ is the outgoing velocity corresponding to a\nparticle in the collision defined by the incoming velocities $v,w$\nand the angular parameter $\\sigma \\in S^2$:\n\\begin{equation}\n \\begin{split}\n &\\displaystyle v^*= \\frac{1}{2} (v+w)+ \\frac{1-e}{4}(v-w)+\\frac{1+e}{4}\n|v-w|\\sigma,\n\\\\*[.3cm]\n&\\displaystyle w^*= \\frac{1}{2} (v+w)- \\frac{1-e}{4}(v-w)-\\frac{1+e}{4}\n|v-w|\\sigma\\,.\n\\end{split}\n\\label{post}\n \\end{equation}\n The parameter $0\\leq e \\leq 1$ represents the restitution coefficient.\n\nIn the model we consider, this restitution coefficient will be chosen as a\nrandom variable that can be interpreted from a physical point of view as the\nstochasticity in the microscopic process of collision due to the randomness of\nthe grains' geometry and the mechanical properties of the medium. We will show in\nthe next section that this random behavior in restoring energy leads to a precise\nform of the energy gain term that differs from the usually chosen diffusion\nterm, the so-called \"thermal bath\". This new form of \"thermal bath\" is thus related\nto the process generated by the randomness of the granular media. We prove\nthat this particular thermal bath yields equilibrium states with power law\ntails.\n\nSuch over-populated tails in distributions at equilibrium arise in\nother contexts. We shall present similar results on the large\ntime behavior of collisional kinetic theory applied to economic\nmodelling. In this framework, the kinetic variable represents the\nwealth of agents and the collision operator describes the\nevolution of the wealth distribution through exchanges. We refer\nto \\cite{CPT, MaTo06} and references therein for a mathematical\npresentation of these models closely related to so called\n\"econo-physics\". In such models, the equations between pre- and\npost-collisional values involve some randomness that is related\nto the stochasticity of the market that provides random returns.\n\n\n\n\nIn the remainder of this paper, we will study in detail the large time\nbehavior of the solution of the Boltzmann equation involving such a stochastic\nprocess. We show that the validity (at a macroscopic level) of the classical\ncollision invariants is enough to guarantee convergence towards a steady\nprofile, but not enough to reach a Maxwellian-like profile. In fact, we will\nshow that there is a class of random perturbations of the coefficient of\nrestitution such that the steady state possesses power-like tails.\n\nA crucial role in our analysis is played by the weak norm\nconvergence, which is obtained by further pushing the development\nof a method first used in \\cite{Gabetta-Toscani-Wennberg} to\ncontrol the exponential convergence of Maxwellian molecules in\ncertain weak norms. This will be done by using the fact that the\nnonlinear operator in the Boltzmann equation (see \\fer{BE2})\n can be expressed in Fourier\nvariables in a simple closed form using Bobylev's identity\n\\cite{Bobylev}. Estimates of the evolution of the Wasserstein\ndistance \\cite{Wasserstein69,Vil03,Vil06} between solutions will\nbe presented for the economic and the inelastic model since they\ngive complementary information with respect to the results in\n\\cite{MaTo06}. Concerning this second aspect, we will take\nadvantage of the recent analysis of Bolley and Carrillo\n\\cite{Bolley-Carrillo, CTPE} of the inelastic Boltzmann equation\nfor Maxwell molecules. From this analysis, we will obtain the\nuniqueness and asymptotic stability of stationary states for this\nmodel. Finally, the appearance of power-like tails for the\nasymptotically stable stationary states will be discussed for both\nmodels, giving explicit examples of random variables producing this\nbehavior.\n\n\nThe paper is organized as follows: in section \\ref{Modeling} we\ndetail the collisional models for both granular media and economy\napplications including random coefficients in the relations\nbetween pre- and post-collisional variables. In section\n\\ref{quick}, we recall the main properties of probability metrics. In\nsection \\ref{eco2}, we investigate large time behavior of the solution\nof the kinetic economy model and section \\ref{seccontr} is devoted to\nlarge time behavior of stochastic granular media.\n\nLastly, let us summarize the two main results of this paper :\nfirst, we give some insight into conditions for a collision\noperator to lead to power-law tails (conservatism in mean being\nsome kind of necessary condition); second, we propose a new form\nfor the thermal bath with a physically relevant origin (the\nrestitution coefficient taking into account the randomness of\ngranular media).\n\n\n\\section{Modelling issues and diffusion approximation}\n\\label{Modeling}\n\n\nLet us present the proposed stochastic granular model\n(with a random restitution coefficient) and its diffusion limit and then\nrecall briefly the similar analysis for the economy model following\n\\cite{CPT}.\n\n\n\\subsection{Stochastic granular media}\n\nConsidering the weak formulation \\fer{Qweak},\neasy computations show that $(\\varphi(v),Q_e(f,f))=0 $ whenever\n$\\varphi(v) =1$ and $\\varphi(v) =v$, while\n$(\\varphi(v),Q_e(f,f))<0 $ if $\\varphi(v) =v^2$. This corresponds\nto conservation of mass and momentum, and, respectively, to loss\nof energy for the solution to equation \\fer{BE1}. For this reason,\nif we fix the initial data to be a centered probability density\nfunction, the solution will remain centered at any subsequent time\n$t>0$. The loss of energy in a single collision\nwith a constant restitution coefficient $e$ is given by\n \\begin{equation}\n \\label{loss}\n |v'|^2+ |w'|^2 = |v|^2 +|w|^2 -\\frac{1-e^2}4 \\left( |v-w|^2 -|v-w|(v-w)\\cdot\n \\sigma \\right).\n \\end{equation}\nThe previous formula is the key to our modification of the collisions.\nLet us replace the constant coefficient of restitution $e$ with\na stochastic coefficient of restitution $\\et$, such that for a\ngiven random variable $\\eta$\n \\begin{equation}\\label{re}\n \\et = e +\\eta, \\qquad \\mbox{with} \\quad\\langle \\eta\\rangle =0 \\quad \\mbox{and} \\quad \\langle \\eta^2 \\rangle =\n \\beta^2.\n \\end{equation}\nIn \\fer{re} and in the rest of the paper, $\\langle \\cdot \\rangle$ denotes the\nmathematical expectation of the real-valued random variable $\\eta$, i.e.,\nintegration against a measure $\\mu$. For obvious physical reasons, the random\nvariable $\\eta$ has to be chosen to satisfy $\\eta \\ge -e$, in order to\nguarantee that the (random) coefficient of restitution $\\et\\geq0$. Using $\\et$\ninstead of $e$ in \\fer{post} gives that the momentum is {\\it conserved in\naverage} for a suitable choice of the variance. In fact, since\n \\begin{equation}\\label{1new}\n \\left\\langle |v'|^2+ |w'|^2\\right\\rangle = |v|^2 +|w|^2 -\\frac{1-e^2 -\\beta^2}4 \\left( |v-w|^2 -|v-w|(v-w)\\cdot\n \\sigma \\right),\n \\end{equation}\nby choosing the variance $\\beta^2 = 1-e^2 >0$, we obtain\n \\begin{equation}\\label{cons}\n\\left\\langle |v'|^2+ |w'|^2\\right\\rangle = |v|^2 +|w|^2.\n \\end{equation}\n We will call a collision process (or equivalently a random cross section)\n satisfying \\fer{cons} \\emph{conservative\n in the mean}.\n\n Let us remark that condition \\fer{cons} \\emph{cannot be satisfied\nif $\\et$ takes only values less than $1$}, since in that case\n$\\et^2$ remains also less than 1 and so does its average\n$<\\et^2>=e^2+\\beta^2 <1$.\n The main idea behind\nthis is that particles can even gain energy in collisions even though\nthe total energy is conserved in the mean.\n\n From the physical point of view, this assumption of energy-gain particle\ncollisions may seem strange. We will show in the sequel that this energy input\ncan be interpreted as a sort of thermal bath. Particles are immersed in a medium\nthat produces this random change in the strength of their relative velocity. We\nwill argue, based on a derivation of a Fokker-Planck approximation, that this\nrandom component in the collision operator can be approximated by a\nsecond-order differential operator whose diffusion matrix depends on the second\nmoments of the solution $f$ itself and the random variable $\\eta$ (see\n\\cite{CPT, PaTo06} for a similar approach in one dimension).\n\n\nThis idea allows us to consider a new class of Maxwell-type models,\nfrom now on called \\emph{conservative in the mean}, which are\nobtained from (post-collision) velocities given by\n\\begin{equation}\n \\begin{split}\n &\\displaystyle v'= \\frac{1}{2} (v+w)+ \\frac{1-\\et}{4}(v-w)+\\frac{1+\\et}{4}\n|v-w|\\sigma,\n\\\\*[.3cm]\n&\\displaystyle w'= \\frac{1}{2} (v+w)- \\frac{1-\\et}{4}(v-w)-\\frac{1+\\et}{4}\n|v-w|\\sigma\\,.\n\\end{split}\n\\label{postcon}\n \\end{equation}\nwhere $\\et$ is the random coefficient of restitution defined in \\fer{re}, and\n$\\beta^2 = 1-e^2$. The corresponding Boltzmann equation reads\n \\begin{equation}\n\\frac{\\p f}{\\p t}= \\tilde{Q}_e(f,f) = \\left\\langle Q_{\\et}(f,f)\n\\right\\rangle\\, , \\label{BE2}\n \\end{equation}\nand its corresponding weak form is\n \\begin{equation}\n(\\varphi,\\tilde{Q}_e(f,f))= \\frac{1}{4 \\pi}\\left\\langle\n\\int_{\\Realr^3} \\int_{\\Realr^3} \\int_{S^2} f(v) f(w) \\Big[ \\varphi\n(v')- \\varphi (v) \\Big] dv\\,dw\\,d\\sigma \\right\\rangle.\n\\label{Qweak1}\n \\end{equation}\nIn view of our choice of the random contribution to the\ncoefficient of restitution, we now have\n$(\\varphi(v),\\tilde{Q}_e(f,f))=0 $ whenever $\\varphi(v) =1,v,\n|v|^2$, that is, the classical collision invariants of the elastic\nBoltzmann equation.\n\n\n\\subsection{ Formal diffusive asymptotics }\n\\label{formal}\n\nBefore entering into the study of the large-time behavior of the\nBoltzmann equation \\fer{BE2}, we shall present here some formal\narguments that hopefully clarify the action of the random\nrestitution coefficient in the collision mechanism \\fer{postcon}.\n\n\n\nTo this end, following the same method as in \\cite{To-Diss}, letting\n$(v',w')$ denote the post-collision velocities \\fer{postcon} in our\nrandom collision with $(v^*,w^*)$ as post collision velocities\ndefined by\nthe classic inelastic collision \\fer{post}, we can split the\nvelocities into their deterministic and random parts\n \\begin{equation}\\label{rel2}\n v' = v^* + \\eta \\Delta(u, \\sigma) \\, , \\quad w' = w^* - \\eta \\Delta(u,\n \\sigma),\n \\end{equation}\n where we let $u = v-w$ and\n \\[\n \\Delta(u, \\sigma) = \\frac 14 \\left( |u|\\sigma - u\\right).\n \\]\nLet us consider a Taylor expansion of $\\varphi(v')$ around $\\varphi(v^*)$\nup to second order in $\\eta$.\nThanks to \\fer{rel2} we get\n\\begin{eqnarray}\\label{exp}\n\\varphi(v') = \\varphi(v^*) + \\eta\\,\\left(\\nabla \\varphi(v^*) \\cdot\n\\Delta(u, \\sigma)\\right) + \\frac 12 \\eta^2\n\\sum_{i,j}\\frac{\\partial^2 \\varphi(v^*)}{\\partial v^*_i\\partial\nv^*_j}\\Delta_i\\Delta_j + \\dots\n\\end{eqnarray}\nThus, taking the mean of the expansion \\fer{exp}, and using the property\n$\\langle \\eta \\rangle= 0$, we get\n \\begin{equation}\\label{exp2}\n\\langle\\varphi(v')\\rangle = \\varphi(v^*) + \\frac 12 \\beta^2\n\\sum_{i,j}\\frac{\\partial^2 \\varphi(v^*)}{\\partial v^*_i\\partial\nv^*_j}\\Delta_i\\Delta_j + \\dots.\n \\end{equation}\nTruncating the expansion \\fer{exp2} after the second--order term and\ninserting \\fer{exp2} into \\fer{Qweak1}, we conclude\n \\begin{align}\\label{weak2}\n(\\varphi\\, , \\, \\tilde Q_e(f,f)) \\, &\\simeq (\\varphi\\, , \\,\nQ_e(f,f)) + (\\varphi, D_e(f,f)) \\\\\n &=(\\varphi\\, , \\, Q_e(f,f))+ \\frac {\\beta^2}{8\\pi}\n\\int_{\\Realr^3}\\int_{\\Realr^3}\\int_{S^2}\\sum_{i,j}\\frac{\\partial^2\n\\varphi(v^*)}{\\partial v^*_i\\partial v^*_j}\\Delta_i\\Delta_j\nf(v)f(w)dv\\, dw\\, d\\sigma \\,\\, .\\nonumber\n \\end{align}\nWhile the first term in \\fer{weak2} $Q_e(f,f)$ is the classical inelastic\nBoltzmann collision operator, the second term $D_e(f,f)$ needs to be further\nanalyzed.\n\nDenoting by $(\\null^{*}v, \\null^{*}w)$ the pre-collision\nvelocities in the inelastic collision, and taking into account the\nfact that the Jacobian of the transformation\n$d\\null^*v\\,d\\null^*w$ into $dv\\,dw$ for a constant restitution\ncoefficient is equal to $e^{-1}$, one obtains\n \\begin{align}\\label{weak3}\n(\\varphi\\, , \\,D_e(f,f)) \\,\\, &= \\frac {\\beta^2}{8\\pi}\n\\int_{\\Realr^3}\\int_{\\Realr^3}\\int_{S^2}\\sum_{i,j}\\frac{\\partial^2\n\\varphi(v^*)}{\\partial v^*_i\\partial v^*_j}\\Delta_i\\Delta_j\nf(v)f(w)dv\\, dw\\, d\\sigma\\nonumber \\\\\n&= \\frac {\\beta^2}{8\\pi}\n\\int_{\\Realr^3}\\int_{\\Realr^3}\\int_{S^2}\\frac\n1e\\sum_{i,j}\\frac{\\partial^2 \\varphi(v)}{\\partial v_i\\partial v_j}\n\\null^*\\Delta_i\\null^*\\Delta_j f(\\null^*v)f(\\null^*w)dv\\, dw\\,\nd\\sigma\\nonumber \\\\\n&= \\frac {\\beta^2}{8\\pi} \\int_{\\Realr^3}\\,\\left[\n\\sum_{i,j}\\frac{\\partial^2 \\varphi(v)}{\\partial v_i\\partial v_j}\n\\int_{\\Realr^3}\\int_{S^2}\\frac 1e \\null^*\\Delta_i\\null^*\\Delta_j\nf(\\null^*v)f(\\null^*w)\\, dw\\, d\\sigma\\right]\\, dv\n\\nonumber \\\\\n&= \\int_{\\Realr^3} \\!\\!\\varphi(v) \\!\\left[\\frac\n{\\beta^2}{8\\pi}\\sum_{i,j}\\frac{\\partial^2 }{\\partial v_i\\partial\nv_j}\\int_{\\Realr^3}\\int_{S^2}\\frac 1e\n\\null^*\\Delta_i\\null^*\\Delta_j f(\\null^*v)f(\\null^*w)\\, dw\\,\nd\\sigma\\right] dv.\n \\end{align}\nThis shows that, at least for small inelasticity, the random part of the\ncollision corresponds to a correction given by the nonlinear diffusion operator\n$D_e(f,f)(v)$, where\n \\begin{equation}\\label{corr}\n D_e(f,f)(v) =\n\\frac {\\beta^2}{8\\pi}\\sum_{i,j}\\frac{\\partial^2 }{\\partial\nv_i\\partial v_j}\\int_{\\Realr^3}\\int_{S^2}\\frac 1e\n\\null^*\\Delta_i\\null^*\\Delta_j f(\\null^*v)f(\\null^*w)\\, dw\\,\nd\\sigma.\n \\end{equation}\nDifferent expressions of the operator \\fer{corr} can be recovered\nowing to the definition of $\\Delta$. For the purposes of the\npresent paper, however, we simply remark that, choosing the test\nfunction $\\varphi(v) = |v|^2$, direct computations show that the\ncorrection $D_e(f,f)$ is such that\n \\begin{align}\\label{temp}\n(|v|^2\\, , \\,D_e(f,f)) \\,\\, &= \\frac {\\beta^2}{64\\pi}\n\\int_{\\Realr^3}\\int_{\\Realr^3}\\int_{S^2}\\left||u|\\sigma-u\\right|^2\nf(v)f(w)dv\\, dw\\, d\\sigma\\nonumber \\\\\n&= \\frac {1}{4}\\beta^2\\left[ \\int_{\\Realr^3}|v|^2f(v)\\, dv -\n\\left|\\int_{\\Realr^3}v\\,f(v)\\, dv\\right|^2\\right].\n\\end{align}\nThis reveals the fundamental fact that the diffusion operator produces a\ngrowth of the second moment proportional to the second moment itself. This\naction is clearly different from the action of a linear diffusion operator (a\nthermal bath), which induces a growth of the second moment proportional to the\nmass. This supports the fact that the Boltzmann equation \\fer{BE2} can\nproduce fat tails.\n\n\n\n\n\n\\subsection{Simple economy market modelling}\n\\label{eco1}\n\n\nIn one dimension of the \"velocity\" variable, a similar construction\nleads to kinetic models for wealth redistribution \\cite{CPT,\nMaTo06}. In this case, the variable\n $v \\in \\Realr_+$ represents\nthe wealth of the agents, binary collisions are trades between\nagents, and the (eventual) power-like tails of the steady\ndistribution of wealth are known in the pertinent literature as\nPareto tails. Due to the fact that the variable is in $\\Realr_+$,\nthe possible conserved quantities reduce to mass and momentum. In\n\\cite{CPT} the collision mechanism is given by\n\\begin{equation}\n\\label{mixing}\nv' = (1-\\lambda)v +\\lambda w + \\eta v; \\qquad\n w' = \\lambda v + (1-\\lambda) w + \\eta^* w\n\\end{equation}\nwhere $0\\leq \\lambda\\leq 1$ represents the constant saving rate\nand $\\eta$ and $\\eta^*$ are random variables with law given by a measure\n$\\mu(s)$ of zero mean, variance $\\beta^2$ and support in\n$[-\\lambda,+\\infty)$. In this way, for all realizations of the\nrandom variable we have $\\eta\\geq -\\lambda$ and wealths after\ntrading are well defined\ni.e.,\nremain nonnegative. This is the so-called {\\em no debt} condition.\nIn this\ncontext, the Boltzmann equation \\fer{BE2} is replaced by\n \\begin{equation}\n(\\varphi,\\tQ_\\lambda(f,f))= \\left\\langle \\int_{\\Realr_+}\n\\int_{\\Realr_+} f(v) f(w) \\Big[ \\varphi (v')- \\varphi (v) \\Big]\ndv\\,dw\\ \\right\\rangle. \\label{Qweak2}\n \\end{equation}\n Here, we use the notation\n$$\n\\left< h\\right> :=\\int_{-\\lambda}^\\infty h(s)d\\mu(s).\n$$\nThe unique possible collision invariants of the one-dimensional Boltzmann\nequation are obtained for $\\varphi(v) =1$ and $\\varphi(v) =v$.\n\n\nThe weak formulation of the Boltzmann equation can also be rewritten\n\\begin{equation}\n\\label{Max1d}\n\\int_{\\rr^+} \\varphi(v)\\,\\tQ_\\lambda(f,f)\\, dv \\!=\\! \\frac12\n\\int_{\\rr^+} \\!\\int_{\\rr^+}\\!\\! f(v) f(w) \\left< \\varphi (v') +\n\\varphi (w')- \\varphi (v)- \\varphi (w) \\right> \\,dv\\, dw .\n \\end{equation}\nIn \\eqref{Max1d} the wealth variables $v,w$ are nonnegative quantities, and the\ncollision mechanism is given by \\fer{mixing}.\nA one-dimensional Boltzmann type equation of the form\n\\begin{equation}\\label{ibe1d}\n \\frac{\\p f}{\\p t} = \\tQ_{\\lambda}(f,f)\n\\end{equation}\nbased on the binary interaction given in \\eqref{mixing} has been\nconsidered in \\cite{CPT,MaTo06} and we refer to them for a deeper\ndiscussion of the model. Without loss of generality, we can fix\nthe initial density $f_0(v) \\in {\\cal P}_2(\\rr)$, with the\nnormalization condition\n\\begin{equation}\\label{norm1}\n m(t):=\\int_{\\rr^+} v f(v,t)\\, dv = \\bar{m},\n\\end{equation}\nsince by choosing $\\varphi(v) = v$, \\eqref{Max1d} shows that\n$m(t)=m(0)$ for all $t\\geq0$.\\\\\n\nAs in section \\ref{formal}, one splits the collision mechanisms into\na deterministic inelastic part and the random part :\n$$v' = v^* + \\eta v; \\qquad\nw' = w^* + \\eta^* w\n$\nwhere $v^*, w^*$ are deterministic wealth (corresponding to inelastic\ncollision with constant restitution coefficient $(1-\\lambda)$)\n$$\nv^* = (1-\\lambda)v +\\lambda w ; \\qquad\nw^* = \\lambda v + (1-\\lambda) w .\n$$\n\n\nA formal Taylor expansion similar to \\fer{formal}, in the limit for\n$\\lambda$ and $\\eta$ small, leads to a drift term for the\ndifference between $(v,w)$ and $(v^*,w^*)$ and a diffusion\nterm proportional to the variance $\\beta^2$.\n$$\n\\varphi(v') = \\varphi(v^*) + \\eta v \\partial_v \\varphi(v^*) +\n\\frac 12 \\eta^2 v^2 \\partial_v^2 \\varphi\"(v^*)+ \\dots\n$$\nTaking the average\n$$\n<\\varphi(v')> = \\varphi(v^*) + \\frac 12 \\beta^2 v^2 \\partial_v^2 \\varphi(v^*)+ \\dots,\n$$\nand on the other hand, the deterministic part gives\n$$\n\\varphi(v^*) = \\varphi(v) + \\lambda (w-v) \\partial_v \\varphi(v) +\n\\frac 12 \\lambda^2 (v-w)^2 \\partial_v^2 \\varphi(v)+ \\dots\n$$\nInserting these expansions into the weak formulation\nof the Boltzmann equation \\fer{Qweak2} and rescaling the time\ngives\n$$\n< (\\varphi,\\tQ_\\lambda(f,f))> = \\int_{\\Realr_+^2}\n f(v) f(w) \\Big[ \\lambda (w-v) \\partial_v \\varphi (v)\n+ \\frac 12 ( \\lambda^2 (v-w)^2 + \\beta^2 v^2 ) \\partial_v^2 \\varphi (v) \\Big]\ndv\\, dw.\n$$\n\nMore precisely, the asymptotics of the\none-dimensional Boltzmann equation for\nwealth distribution \\fer{Qweak2} for\n$\\lambda$ sufficiently small,\nand in the limit $\\frac \\lambda{\\beta^2} \\to \\gamma$,\nhas been studied in \\cite{CPT}. In this so-called\n\"continuous trading limit\",\nit is proved that the solution\nto the Boltzmann equation converges toward the solution to the\nFokker-Planck equation\n \\begin{equation}\\label{FP2b}\n \\frac{\\partial f}{\\partial t} = \\frac \\gamma{2}\\frac{\\partial^2 }\n {\\partial v^2}\\left( v^2 f\\right) + \\frac{\\partial }{\\partial v}\\left((v - \\bar m)\n f\\right),\n \\end{equation}\n which admits a unique stationary state of unit mass, given by the\n $\\Gamma$-distribution\n \\begin{equation}\\label{equi}\nM_\\lambda(v)=\\frac{(\\mu-1)^\\mu}{\\Gamma(\\mu)}\\frac{\\exp\\left(-\\frac{\\mu-1}{v}\\right)}{v^{1+\\mu}}\n \\end{equation}\n where\n $$ \\mu = 1 + \\frac{2}{\\lambda} >1.\n$$\nThis stationary distribution exhibits a Pareto power law tail for large\nvelocities. We remark that in \\fer{FP2b} the growth of the second moment\nfollows the same law as the Boltzmann equation \\fer{BE2}.\n\n\n\n\n\\section{Quick overview of probability metrics}\n\\label{quick}\n\nIn this section, we first briefly recall the main definitions and results\nabout probability metrics and, more precisely, on Wasserstein ($W_2$)\nand Fourier ($d_s$) distances between two probability measures.\n\n\n\\subsection{Wasserstein distances}\n\\label{Wass1}\n\nGiven two probability measures $f,g\\in\\Pn$, the Euclidean\nWasserstein Distance is defined as\n\\begin{equation}\\label{w2def1}\nW_2(f, g) = \\inf_{\\Pi\\in\\Gamma} \\left\\{ \\iint_{\\Rn \\times \\Rn}\n\\vert v -x \\vert^2 \\, d\\Pi(v, x) \\right\\}^{1\/2}\n\\end{equation}\nwhere $\\Pi$ runs over the set of transference plans $\\Gamma$, that\nis, the set of joint probability measures on $\\Rn \\times \\Rn$ with\nmarginals $f$ and $g\\in \\Pn$. From a probabilistic point of view,\nthe Wasserstein distance can be alternatively defined as\n\\begin{equation}\\label{w2def2}\nW_2(f, g) = \\inf_{(V,X)\\in\\tilde\\Gamma} \\left\\{ \\expec\\left[ \\vert\nV-X \\vert^2 \\right] \\right\\}^{1\/2}\n\\end{equation}\nwhere $\\tilde\\Gamma$ is the set of all possible couples of random\nvariables $(V,X)$ with $f$ and $g$ as respective laws. Let us\nremark that $W_2$ is finite for any two probability measures with\nfinite second moments $f,g \\in\\Ptwo$.\n\nThe main properties of the Euclidean Wasserstein distance $W_2$\nare summarized in the following proposition. We refer to\n\\cite{Bolley,Vil03,Vil07} for the proofs and further information\non the connections to optimal mass transport theory.\n\n\\begin{proposition}[$W_2$-properties]\\label{w2properties}\nThe space $(\\Ptwo,W_2)$ is a complete metric space. Moreover, the\nfol\\-lowing properties of the distance $W_2$ hold:\n\\begin{enumerate}\n\\item[i)] {\\bf Optimal transference plan:} The infimum in the\ndefinition of the distance $W_2$ is achieved at a joint\nprobability measure $\\Pi_o$ called an optimal transference plan\nsatisfying:\n$$\nW_2^2(f, g) = \\iint_{\\Rn \\times \\Rn} \\vert v -x \\vert^2 \\,\nd\\Pi_o(v, x).\n$$\n\n\\item[ii)] {\\bf Convergence of measures:} Given $\\{f_n\\}_{n\\ge 1}$\nand $f$ in $\\Ptwo$, the following three assertions are equivalent:\n\\begin{itemize}\n\\item[a)] $W_2(f_n, f)$ tends to $0$ as $n$ goes to infinity.\n\n\\item[b)] $f_n$ tends to $f$ weakly-* as a measure and\n$$\n \\int_{\\Rn} \\vert v \\vert^2 \\, f_n(v) \\, dv \\to\n\\int_{\\Rn} \\vert v \\vert^2 \\, f(v) \\, dv \\, \\mbox{ as } \\,\n\\mbox{n} \\to + \\infty.\n$$\n\\end{itemize}\n\n\\item[iii)] {\\bf Convexity:} Given $f_1$, $f_2$, $g_1$ and $g_2$\nin $\\Ptwo$ and $\\alpha$ in $[0,1]$,\n$$\nW_2^2(\\alpha f_1 + (1-\\alpha) f_2,\\alpha g_1 + (1-\\alpha) g_2)\n\\leq \\alpha W_2^2(f_1,g_1) + (1-\\alpha) W_2^2(f_2,g_2).\n$$\nAs a simple consequence, given $f,g$ and $h$ in $\\Ptwo$,\n$$\nW_2(h * f,h * g) \\leq W_2(f,g)\n$$\nwhere $*$ stands for the convolution in $\\Rn$.\n\n\\item[iv)] {\\bf Additivity with respect to convolution:} Given\n$f_1$, $f_2$, $g_1$ and $g_2$ in ${\\cal P}_2(\\Rn)$ with equal mean values,\n$$\nW_2^2(f_1 * f_2, g_1 * g_2) \\leq W_2^2(f_1,g_1) + W_2^2(f_2,g_2).\n$$\n\n\\end{enumerate}\n\\end{proposition}\n\n\n\n\\subsection{Fourier metrics}\n\\label{Four1}\n\nGiven $f\\in\\Pn$, its Fourier transform or characteristic function\nis defined as\n\\[\n\\hat{f}(k) = \\int_{\\Rn} e^{-iv\\cdot k}\\, df(v).\n\\]\nGiven any $s>0$, the Fourier-based metric $d_s$ is defined as\n\\begin{equation}\\label{d2def}\nd_s(f,g)= \\sup_{k \\in \\Rno} \\frac{|\\hat{f}(k)-\\hat{g}(k)|}{|k|^s}\n\\end{equation}\nwhere $\\Rno=\\Rn-\\{0\\}$, for any pair of probability measures\n$f,g\\in\\Pn$. This metric was introduced in\n\\cite{Gabetta-Toscani-Wennberg} and further used in\n\\cite{CGT,CCG1,Toscani-Villani,GJT}. Only recently, various\napplications to the large-time behavior of the dissipative\nBoltzmann equation \\cite{PT03, BisiCT, BisiCT2} have revealed the\nimportance of this distance.\nWe refer to\n\\cite{CTPE} for a complete survey of this metric and the proofs of\nthe statements below.\n\nThe metric $d_s$ with $s>0$ is well-defined and finite for any two\nprobability measures $f,g\\in {\\cal P}_s(\\Rn)$ with\nequal moments up to $[s]$ if $s\\notin\\N$, or equal moments up to\n$s-1$ if $s\\in \\N$. The main properties of the $d_s$ metrics\nrelevant to the ongoing discussion are summarized in the following\nresult:\n\n\\begin{proposition}\\label{dsproperties}\nThe distances $d_s$ with $s>0$ verify the following properties:\n\\begin{enumerate}\n\n\\item[i)] {\\bf Convexity:} Given $f_1$, $f_2$, $g_1$ and $g_2$ in\n${\\cal P}_s(\\Rn)$ with equal moments up to $[s]$ if\n$s\\notin\\N$, or equal moments up to $s-1$ if $s\\in \\N$ and\n$\\alpha$ in $[0,1]$,\n$$\nd_s(\\alpha f_1 + (1-\\alpha) f_2,\\alpha g_1 + (1-\\alpha) g_2) \\leq\n\\alpha d_s(f_1,g_1) + (1-\\alpha) d_s(f_2,g_2).\n$$\n\n\\item[ii)] {\\bf Superadditivity with respect to convolution:}\nGiven $f_1$, $f_2$, $g_1$ and $g_2$ in ${\\cal P}_s(\\Rn)$\nwith equal moments up to $[s]$ if $s\\notin\\N$, or equal\nmoments up to $s-1$ if $s\\in \\N$,\n$$\nd_s(f_1 * f_2, g_1 * g_2) \\leq d_s(f_1,g_1) + d_s(f_2,g_2).\n$$\n\\end{enumerate}\n\\end{proposition}\n\n\n\n\\section{ Large time behavior for economy model}\n\\label{eco2}\n\n\\subsection{Evolution of Wasserstein distance}\n\nThe Boltzmann equation \\eqref{ibe1d} can be rewritten as\n$$\n\\frac{\\p f}{\\p t}= \\left -f ,\n$$\nwhere we use the shorthand $f_p(v) = (1\/p)f(v\/p)$ with\n$p=\\lambda$ and $q=1-\\lambda$. Here, $f$ is extended by 0 to the\nwhole of $\\rr$ in the convolution. The gain operator is defined as\nthe measure given by\n\\[\n (\\varphi,\\tQ_{\\lambda}^+(f,f))= \\left<\\int_{\\rr^+} \\int_{\\rr^+} f(v) \\, f(w) \\, (\\varphi, \\delta_{(p+\\eta)v+qw}) \\, dv \\,\n dw\\right>\n\\]\nwhere $\\delta_{(p+\\eta)v+qw}$ is the Delta Dirac at the\npost-collisional velocity $v'$ and $(\\cdot,\\cdot)$ is the duality\npair between continuous functions and probability measures. In\nprobabilistic terms, the gain operator is defined as an\nexpectation:\n$$\n \\tQ_{\\lambda}^+(f,f)= =\\expec \\left[ \\delta_{(p+\\eta)V+qW}\\right]\n$$\nwhere $V$ and $W$ are independent random variables with law $f$\nand independent with respect to the random variable $\\eta$. Here\nthe expectation is taken with respect to all random variables.\n\nLet us take two independent pairs of random variables $(V,X)$ and\n$(W,Y)$ such that $V$ and $W$ have law $f_1$ and $X$ and $Y$ have\nlaw $f_2$. From the convexity of $W_2^2$ and the independence of\nthe pairs, it follows that\n$$\nW_2^2(\\tQ_{\\lambda}^+(f_1,f_1),\\tQ_{\\lambda}^+(f_2,f_2))\\leq\n\\expec\\left[\nW_2^2(\\delta_{(p+\\eta)V+qW},\\delta_{(p+\\eta)X+qY})\\right]\n$$\nfor any probability densities $f_1,f_2\\in{\\cal P}_2(\\rr)$. Now, the last term\nis directly computed as the Euclidean distance between the two points $(p+\\eta)V+qW$\nand $(p+\\eta)X+qY$, and thus,\n$$\nW_2^2(\\tQ_{\\lambda}^+(f_1,f_1),\\tQ_{\\lambda}^+(f_2,f_2))\\leq\n\\expec\\left[ |(p+\\eta)(V-X)+q(W-Y)|^2 \\right].\n$$\nUsing independence of the pairs and taking the pairs to be optimal\ncouples for the $W_2(f_1,f_2)$ in the probabilistic definition\n\\eqref{w2def2}, we deduce finally the property\n$$\nW_2^2(\\tQ_{\\lambda}^+(f_1,f_1),\\tQ_{\\lambda}^+(f_2,f_2))\\leq\n\\left[<(p+\\eta)^2>+q^2\\right] \\, W_2^2(f_1,f_2).\n$$\nLet us define, for $s \\ge 1$\n \\begin{equation}\\label{key}\n \\mathfrak{S}(s) := \\langle (p +\\eta)^s\\rangle +q^s -1;\n \\end{equation}\nthen $\\mathfrak{S}(2)=<(p+\\eta)^2>+q^2-1= 2\\lambda(\\lambda\n-1)+\\beta^2$. It is not difficult to see that the convexity\nproperty of $W_2^2$ together with the Duhamel formula for\n\\eqref{ibe1d} and the contractive estimate of the gain operator in\n$W_2$ leads to the result:\n\n\\begin{theorem}\\label{cont1d}\nLet $f_1(t)$ and $f_2(t)$ be two solutions of the one dimensional Boltzmann\nequation \\eqref{ibe1d} corresponding to initial values $f_1^0$ and $f_2^0$ in\n${\\cal P}_2(\\rr^+)$, satisfying conditions \\eqref{norm1}. Then, for all times\n$t \\geq 0$,\n\\begin{equation}\\label{decc}\n W_2(f_1(t), f_2(t)) \\leq \\exp\\left\\{ \\mathfrak{S}(2) t\\right\\} W_2(f_1^0,f_2^0).\n\\end{equation}\nIf $\\beta^2 < 2\\lambda(1-\\lambda)$, then $\\mathfrak{S}(2) <0$, and\nthe Wasserstein metric decays exponentially to zero in time.\n\\end{theorem}\n\n\n\\subsection{Evolution of Fourier metrics}\n\nAnalogous results for the evolution of the $d_s$-metric\n\\fer{d2def} have been obtained recently in \\cite{MaTo06} by a\nsuitable generalization of results in \\cite{PaTo06}. For the\ndetailed computations we refer to \\cite{MaTo06}. The study of the\nevolution of the metric \\fer{d2def}, leading to the understanding\nof the large-time behavior of the solution to the kinetic equation\n\\fer{ibe1d}, requires a fine analysis of the quantity \\fer{key}. As\nshown for the Wasserstein metric in the previous subsection, the\nsign of this quantity is in fact related to the contraction\nproperties of the metric. Moreover, as has been noted in\n\\cite{MaTo06}, the sign of \\fer{key} is also related both to the\nnumber of moments of the solution which remain uniformly bounded\nin time, and to the possibility to conclude the existence and\nuniqueness of a steady state. The results in \\cite{MaTo06} can be\nbriefly summarized into the following\n\n\\begin{theorem}\\label{main}\nTake $s>0$ with $\\mathfrak{S}(s)<\\infty$ and let $f_1(t)$ and\n$f_2(t)$ be two solutions of the one dimensional Boltzmann\nequation \\eqref{ibe1d} corresponding to initial values $f_1^0$\nand $f_2^0$ in ${\\cal P}_r(\\rr^+)$, satisfying conditions\n\\eqref{norm1} with $r = \\max\\{ 1,s\\}$. Then the following bound\nholds:\n\\begin{equation}\\label{conv1}\n d_{s}(f_1(t),f_2(t) ) \\leq\n \\exp\\left\\{\\mathfrak{S}(s) t\\right\\}\\,d_{s}(f_1^0,f_2^0),\n \\end{equation}\n where $ \\mathfrak{S}(s)$ is given by \\fer{key}.\n\\end{theorem}\n\nAlso, the temporal behavior of the moments is almost completely\ndetermined by the function $\\mathfrak{S}(s)$.\n\n\\begin{theorem} \\label{mom1}\nLet $s>1$ and $f_0\\in{\\cal P}_s(\\rr^+)$ with\n$0<\\mathfrak{S}(s)<\\infty$ and let us denote\n$$\nM_s^0:=\\int_{\\rr^+} v^s\\,f_0(v)\\,dv.\n$$\nThen, for the weak solution to the Boltzmann equation, the\nfollowing estimates hold:\n \\begin{enumerate}\n \\item If $\\mathfrak{S}(s)>0$, then, as $t\\to\\infty$,\n \\begin{align*}\n { \\int_{\\Realr_+} v^s f(v,t)\\,dv } \\ge M_s^0 \\,{\\exp\\{\\mathfrak{S}(s)t\\}\n } + o(1).\n \\end{align*}\n \\item If $\\mathfrak{S}(s)<0$, then the $s$th moment is bounded for all times.\n Moreover, as $t\\to\\infty$,\n \\begin{align*}\n { \\int_{\\Realr_+} v^s f(v,t)\\,dv } \\leq M_s^0 \\,{\\exp\\{\\mathfrak{S}(s)t\\}\n } + o(1).\n \\end{align*}\n \\end{enumerate}\nHere, the remainder terms $o(1)$ converge to zero exponentially\nfast.\n\\end{theorem}\n\nAnother important conclusion of the analysis of \\cite{MaTo06} is that the\nessential function $\\mathfrak{S}(s)$ does not only decide whether or not the\nsteady state $f_\\infty$ develops a Pareto tail. In fact, the positive zero of\n$\\mathfrak{S}(s)$ actually determines the value of the Pareto index.\n\nA comparison of the contraction results for the Boltzmann equation\n\\eqref{ibe1d} shows that the contraction properties are heavily linked, through\nthe key function \\fer{key}, to the (eventual) formation of tails. While the\nsituation for equation \\eqref{ibe1d} is reasonably well understood, the\ncorresponding analysis for the Boltzmann equation \\fer{BE2} deserves further\ninvestigation. We will discuss equation \\fer{BE2} in detail in the\nfollowing section.\n\n\n\\section{Large time behavior for stochastic granular media}\n\\label{seccontr}\n\nLet us consider here the modification of the Inelastic Maxwell Model introduced\nin \\cite{Bobylev-Carrillo-Gamba}\n\\begin{align}\\label{him}\n\\frac{\\partial f}{\\partial t} = \\tQ_e(f,f),\n\\end{align}\nwhere the collision operator is defined weakly as\n\\begin{align}\\label{wfqm2}\n(\\varphi,\\tQ_e(f,f)) & = \\frac{1}{4 \\pi} \\left< \\int_{\\rr^3} \\int_{\\rr^3}\n\\int_{S^2} f(v) f(w) \\Big[ \\varphi (v')- \\varphi (v) \\Big] d\\sigma \\,dv\\,dw\n\\right> .\n\\end{align}\nAs discussed in the introduction, the collision mechanism relies\non a random coefficient of restitution,\n\\begin{eqnarray}\nv' &=& \\frac12 (v+w) + \\frac{1-\\et}{4}u+\\frac{1+\\et}{4} |u|\\sigma\n\\nonumber\n\\\\[-2mm]\n\\label{colmech2}\n\\\\[-2mm]\nw' &=& \\frac12 (v+w) - \\frac{1-\\et}{4}u-\\frac{1+\\et}{4} |u|\\sigma. \\nonumber\n\\end{eqnarray}\nAs before, we write $u=v-w$, $\\et=e+\\eta$ and $\\eta$ is a\nreal-valued random variable, with zero mean and variance $\\beta^2$,\ngiven by a measure $\\mu(s)$ with support on $[-e,\\infty)$. Here,\n$<\\cdot>$ means the expectation with respect to $\\eta$, i.e., the\nintegral over $\\rr$ with respect to $\\mu$.\n\nIt is quite straightforward to check that conservation of mass and\nmomentum remains and that\n$$\n\\left<|v'|^2 + |w'|^2- |v|^2 - |w|^2 \\right> =0\n$$\nfor the model that is conservative in the mean in which $\\beta^2=1-e^2$. From\n\\eqref{wfqm2}, we deduce that the temperature evolution is\n$$\\frac{d}{d t} \\int_{\\rr^3} |v|^2 \\,f(t,v)\\,dv = 0,$$ and thus we\ndeduce that $\\theta(t)=\\theta(0)$ for all times $t\\geq0$ and we\nwill fix it to one for convenience.\n\n\n\\subsection{Evolution of Wasserstein distance }\n\nGiven a probability measure $f$ on $\\rr^3$, the gain operator is\nin fact a probability measure $\\tQ_e^+(f, f)$ defined by\n\\[\n (\\varphi,\\tQ_e^+(f,f))= \\left<\\int_{\\rr^3} \\int_{\\rr^3} f(v) \\, f(w) \\, (\\varphi, {\\cal U}_{v, w,\\eta}) \\, dv \\,\n dw\\right>\n\\]\nwhere ${\\cal U}_{v, w,\\eta}$ is the uniform probability\ndistribution on the sphere $S_{v, w}$ with center $c_{v, w} =\n\\frac{1}{2} (v+w)+ \\left[\\frac{1-\\et}{4}+\\eta\\right](v-w)$ and\nradius $r_{v, w} = \\frac{1+\\et}{4} |v-w|$ as in\n\\cite{Bolley-Carrillo}. In probabilistic terms, the gain operator\nis defined as an expectation:\n$$\n\\tQ_e^+(f, f)=\\expec \\left[ {\\cal U}_{V, W,\\eta}\\right]\n$$\nwhere $V$ and $W$ are independent random variables with law $f$\nand independent of the law of $\\eta$. As in\n\\cite{Bolley-Carrillo}, we get the following result:\n\n\\begin{theorem}\\label{contrqw2} Given $f$ and $g$ in\n$\\Ptwot$ with equal mean velocity, then\n\\[\nW_2(\\tQ_e^+(f, f) , \\tQ_e^+(g, g) ) \\leq W_2(f, g).\n\\]\n\\end{theorem}\n\n\\par{\\it Proof.-} \\ignorespaces Let us take two independent pairs of random variables\n$(V,X)$ and $(W,Y)$ such that $V$ and $W$ have law $f$ and $X$ and\n$Y$ have law $g$. Also, let us take two independent random\nvariables $\\eta$ and $\\tilde{\\eta}$ with law $\\mu$. Convexity of\n$W_2^2$ implies\n\\begin{equation}\nW_2^2(\\tQ_e^+(f,f), \\tQ_e^+(g,g)) = W_2^2(\\expec \\left[ {\\cal\nU}_{V, W,\\eta}\\right], \\expec \\left[ {\\cal U}_{X,\nY,\\tilde{\\eta}}\\right])\\leq \\expec \\left[ W_2^2({\\cal U}_{V,\nW,\\eta}, {\\cal U}_{X, Y,\\tilde{\\eta}})\\right]\\label{tech8}\n\\end{equation}\nwhere the expectation is taken with respect to the joint\nprobability density in $\\rr^{14}$ of the six random variables.\nHere, the independence of the pairs of random variables has been\nused.\n\nAs proved in \\cite{Bolley-Carrillo}, the $W_2^2$ distance between\nthe uniform distributions on the sphere with center $O$ and radius\n$r$, ${\\mathcal U}_{O,r}$, and on the sphere with center $O'$ and\nradius $r'$, ${\\mathcal U}_{O',r'}$, in $\\rr^3$ is bounded by\n$\\vert O'-O \\vert^2 + (r' - r)^2$.\n\nWe now estimate the right-hand side of \\eqref{tech8} by using the\nformulas for the center and radii of the spheres given in\n\\eqref{colmech2} to deduce\n\\begin{align*}\nW_2^2(\\tQ_e^+(f,f), \\tQ_e^+(g,g)) \\!\\leq \\!& \\; \\left<\\frac{5 - 2\n\\, \\et + \\et^2}{8}\\right> \\expec \\left[ \\vert V-X \\vert^2 \\right]\n+ \\, \\left<\\frac{(1 + \\et)^2}{8}\\right> \\, \\expec \\left[\n\\vert W-Y \\vert^2 \\right] \\\\\n& + \\, \\left<\\frac{1-\\et^2}{4}\\right> \\, \\expec \\left[ (V-X) \\cdot\n(W-Y)\\right]\n\\end{align*}\nwhere the Cauchy-Schwartz inequality has been used.\n\nFinally, we take both pairs $(V,X)$ and $(W,Y)$ as independent\npairs of variables with each of them being an optimal couple for\n$W_2(f,g)$ in the probabilistic definition \\eqref{w2def2}\nto obtain\n\\begin{align*}\nW_2^2(\\tilde{Q}_e^+(f,f), \\tilde{Q}_e^+(g,g)) \\leq & \\; \\frac{3 +\ne^2+\\beta^2}{4} \\, W_2^2(f,g) + \\, \\frac{1-e^2-\\beta^2}{4} \\,\n\\expec \\left[ (V-X) \\cdot (W-Y)\\right],\n\\end{align*}\nwhere the last term is zero because the random variables are independent\nand have equal means. Since $\\beta^2 =1-e^2$\nin the conservative case, the result is proved.\\endproof\n\n\\\n\nAs a consequence of the previous property of the gain operator, we\ndraw the following conclusion about controlling the distance\nbetween any two solutions of \\eqref{him} in the conservative case.\n\n\\begin{theorem}\\label{contrw2eb} If $f_1$ and $f_2$ are two solutions\nto \\eqref{him} with respective initial data $f_1^0$ and $f_2^0$ in\n$\\Ptwot$ with zero mean velocity, then, for all $t \\geq 0$,\n\\begin{align*}\nW_2^2(f_1(t), f_2(t)) \\leq W_2^2(f_1^0, f_2^0).\n\\end{align*}\n\\end{theorem}\n\n\\par{\\it Proof.-} \\ignorespaces Duhamel's formula for \\eqref{him} reads as\n\\[\nf_i(t) = {\\rm e}^{-t} \\, f_i^0 + \\int_0^{t} {\\rm e}^{-(t-s)} \\,\n\\tilde{Q}_e^+(f_i(s), f_i(s)) \\, ds, \\qquad i=1,2.\n\\]\nAs before, the convexity of the squared Wasserstein distance in\nProposition \\ref{w2properties} and the contraction of the gain\noperator in Theorem \\ref{contrqw2} imply\n\\begin{align*}\nW_2^2(f_1(t), f_2(t)) & \\leq {\\rm e}^{-t} \\, W_2^2(f_1^0, f_2^0) +\n\\int_0^{t} \\!\\! {\\rm e}^{-(t-s)} \\, W_2^2 \\big(\n\\tilde{Q}_e^+(f_1(s), f_1(s)), \\tilde{Q}_e^+(f_2(s), f_2(s)) \\big) \\, ds \\\\\n& \\leq {\\rm e}^{-t} \\, W_2^2(f_1^0, f_2^0) + \\, \\int_0^{t} \\!\\!\n{\\rm e}^{-(t-s)} \\, W_2^2 (f_1(s), f_2(s))\\, ds.\n\\end{align*}\nTherefore, the function $y(t) = {\\rm e}^{t} \\, W_2^2(f_1(t),\nf_2(t))$ satisfies the inequality\n \\[\n y(t) \\leq y(0) + \\int_0^{t} y(s) \\, ds\n \\]\nand thus $y(t) \\leq y(0) \\, {\\rm e}^{t}$ by Gronwall's lemma,\nconcluding the argument.\n\\endproof\n\n\n\\subsection{Evolution of Fourier metrics}\n\nWe start by writing a closed form of the Boltzmann equation in\nFourier variables. In fact, it is not difficult using Bobylev's\nidentity in \\cite{Boby75,Bobylevid,Bobylev,Bobylev-Carrillo-Gamba}\nto get\n$$\n\\widehat{\\tQ_e^+(f,f)} = \\frac{1}{4 \\pi} \\left<\\int_{S^2} \\hat{f}\n(t, k_-) \\hat{f} (t, k_+) \\, d\\sigma\\right>\n$$\nwhere\n$$\nk_-=\\frac{1+\\et}{4} k - \\frac{1+\\et}{4}|k|\\sigma \\quad \\mbox{and}\n\\quad k_+=\\frac{3-\\et}{4}\\, k + \\frac{1+\\et}{4}\\, |k|\\sigma\\,.\n$$\nLet us start by analyzing the evolution of the distance $d_2$ that\nin view of the properties in Propositions \\ref{w2properties} and\n\\ref{dsproperties} should verify the same non-strict contraction\nas the transport distance $W_2$.\n\n\\begin{theorem}\\label{contrqd2} Given $f$ and $g$ in $\\P_2(\\rr^3)$\nwith equal mean velocity,\n\\[\nd_2(\\tQ_e^+(f, f),\\tQ_e^+(g, g) ) \\leq \\frac{3+ e^2+\\beta^2}{4} \\,\nd_2(f,g).\n\\]\n\\end{theorem}\n\n\\par{\\it Proof.-} \\ignorespaces Using the Fourier representation formula above, we deduce\n$$\n\\frac{\\widehat{\\tQ_e^+(f, f)}(k) -\n\\widehat{\\tQ_e^+(g,g)(k)}}{|k|^2} = \\frac{1}{4 \\pi}\\!\\left<\n\\int_{S^2} \\left[ \\frac{\\hat{f}(k_-) \\hat{f}(k_+) - \\hat{g}(k_-)\n\\hat{g}(k_+)}{|k|^2} \\right] d\\sigma\\right>\n$$\nfor all $k\\in\\Rto$. We now estimate the integrand as\n\\begin{align*}\n\\left| \\frac{\\hat{f}(k_-) \\hat{f}(k_+)-\\hat{g}(k_-)\n\\hat{g}(k_+)}{|k|^2} \\right| &\\leq \\sup_{k \\in \\Rto} \\left\\{\n \\frac{|\\hat{f}(k)-\\hat{g}(k)|}{|k|^2} \\right\\} \\left( \\frac{|k_-|^2+\n |k_+|^2}{|k|^2} \\right) \\\\\n & = d_2(f,g) \\left( \\frac{|k_-|^2+\n |k_+|^2}{|k|^2} \\right),\n\\end{align*}\nand thus\n$$\nd_2(\\tQ_e^+(f, f) , \\tQ_e^+(g, g) ) \\leq \\frac{1}{4 \\pi}\\!\n\\left<\\int_{S^2} \\left( \\frac{|k_-|^2+\n |k_+|^2}{|k|^2} \\right) d\\sigma \\right> \\, d_2(f,g).\n$$\n\nWe observe that\n \\[\n \\frac{|k_-|^2+|k_+|^2}{|k|^2}\n \\]\n is a function of\nthe angle between the unit vectors $k\/|k|$ and $\\sigma$ and the\nrandom variable $\\eta$, and that\n$$\nI:=\\frac{1}{4 \\pi} \\left<\\int_{S^2} \\frac{|k_-|^2+|k_+|^2}{|k|^2}\n\\,d\\sigma \\right>= \\frac{3+e^2+\\beta^2}{4}.\n$$\nIn fact, we can compute\n\\begin{equation} \\label{modulusk+-}\n\\begin{split}\n&\\displaystyle |k_-|^2= |k|^2 \\left( \\frac{1+\\et}{4} \\right)^2 2\\,\n\\Big( 1- \\cos \\vartheta \\Big)\n\\\\*[.3cm] &\\displaystyle |k_+|^2=\n|k|^2 \\left[ \\left( \\frac{3-\\et}{4} \\right)^2 + \\left(\n\\frac{1+\\et}{4} \\right)^2 + 2 \\left( \\frac{3-\\et}{4} \\right)\n\\left( \\frac{1+\\et}{4} \\right) \\cos \\vartheta \\right]\n\\end{split}\n\\end{equation}\nwhere $\\vartheta$ is the angle between the unit vectors $k\/|k|$\nand $\\sigma$ from which the value of $I$ is obtained. Putting\ntogether previous estimates we get the contraction in $d_2$ with\nthe same constant as $W_2^2$ as desired.\n\\endproof\n\n\\\n\nNow, let us see that we can also control Fourier-based distances\nwith exponent $2+\\alpha$, $\\alpha\\in [0,\\infty)$. Let us set\n\\begin{align}\\label{key2}\n\\mathfrak{A}(\\alpha,e,\\eta) & := \\displaystyle \\frac{1}{2}\\left< \\int_0^\\pi\n\\left\\{ \\left[ \\left( \\frac{1+\\et}{4} \\right)^2 2 (1- \\cos\n\\vartheta ) \\right]^{\\frac{2+\\alpha}{2}}\n\\right.\\right. \\vspace{0.2 cm} \\nonumber\\\\\n& \\,\\,\\,\\,\\,\\,\\left.\\left. +\\, \\left[ \\left( \\frac{3-\\et}{4} \\right)^2 + \\left(\n\\frac{1+\\et}{4} \\right)^2 + 2 \\left( \\frac{3-\\et}{4} \\right) \\left(\n\\frac{1+\\et}{4} \\right) \\cos \\vartheta \\right]^{\\frac{2+\\alpha}{2}} \\right\\}\n\\sin \\vartheta\\, d\\vartheta \\right>\n \\vspace{0.2 cm} \\nonumber\\\\\n& = \\displaystyle \\frac{2}{4+\\alpha} \\left< \\left( \\frac{1+\\et}{2}\n\\right)^{2+\\alpha} + \\frac{1- \\left| \\frac{1-\\et}{2}\n\\right|^{4+\\alpha}}{1-\\left| \\frac{1-\\et}{2} \\right|^2} \\right> .\n\\end{align}\nWhenever there is no confusion, i.e. for $e$ and $\\eta$ fixed, we\nwill denote just by $\\mathfrak{A}(\\alpha)$ the above constant.\n\n\\begin{theorem}\\label{contrqd2alpha} Given $f,g\\in\n\\P_{2+\\alpha}(\\rr^3)$ with equal moments up to order $2+[\\alpha]$, there\nexists an explicit constant $\\mathfrak{A}(\\alpha,e,\\eta)>0$ given by \\fer{key2}\nsuch that\n\\[\nd_{2+\\alpha}(\\tQ_e^+(f, f) , \\tQ_e^+(g, g) ) \\leq \\mathfrak{A}(\\alpha,e,\\eta) \\,\nd_{2+\\alpha}(f,g).\n\\]\n\\end{theorem}\n\n\\par{\\it Proof.-} \\ignorespaces As in the proof of the previous theorem, we compute\n\\begin{align*}\n\\left| \\frac{\\widehat{\\tQ_e^+(f, f)}(k) -\n\\widehat{\\tQ_e^+(g,g)}(k)}{|k|^{2+\\alpha}} \\right| & = \\frac{1}{4\n\\pi} \\left|\\left< \\int_{S^2} \\frac{\\hat{f}(k^+) \\hat{f}(k^-)\n-\\hat{g}(k^+) \\hat{g}(k^-)}{|k|^{2+\\alpha}}\\, d\\sigma \\right>\\right| \\vspace{0.1 cm}\\nonumber\\\\\n & \\leq A \\, \\sup_{k \\in \\Rto} \\frac{|\\hat{f}(k)-\\hat{g}(k)|}{|k|^{2+\\alpha}}\n\\end{align*}\nwhere $A$ is given by\n\\begin{equation}\nA := \\frac{1}{4 \\pi} \\left< \\int_{S^2} \\frac{|k_+|^{2+\\alpha} +\n|k_-|^{2+\\alpha}}{|k|^{2+\\alpha}}\\, d\\sigma \\right>.\\label{Aalpha}\n\\end{equation}\nBy inserting the expressions of $k_-$ and $k_+$ into\n\\eqref{Aalpha} and computing the integral we conclude\n$A=\\mathfrak{A}(\\alpha,e,\\eta)$ and the proof follows.\n\\endproof\n\n\\\n\nAs a consequence, we obtain an estimate on contraction\/expansion\nof the Fourier distances $d_{2+\\alpha}$ between solutions.\n\n\\begin{theorem}\\label{contrdseb} Let $\\alpha>0$ be such that\n$\\mathfrak{A}(\\alpha,e,\\eta) <\\infty$. Let $f_1$ and $f_2$ be two\nsolutions to~\\eqref{him} corresponding to initial values~$f_1^0$,\n$f_2^0$ with equal moments up to $2+[\\alpha]$. Then, for all $t\n\\geq 0$,\n\\begin{equation} \\label{d2alphadecayeb}\nd_{2+\\alpha}(f_1(t),f_2(t)) \\leq d_{2+\\alpha}(f_1^0,f_2^0)\\, {\\rm\ne}^{-C(\\alpha,e,\\eta) t},\n\\end{equation}\nwith $C(\\alpha,e,\\eta)=1-\\mathfrak{A}(\\alpha,e,\\eta)$.\n\\end{theorem}\n\n\\par{\\it Proof.-} \\ignorespaces The Fourier expression of equation \\eqref{him} is given by\n$$\n\\frac{\\p \\hat{f}}{\\p t} = \\frac{1}{4 \\pi} \\int_{S^2} \\hat{f}(k_+)\n\\hat{f}(k_-) d\\sigma - \\hat{f} = \\widehat{\\tilde{Q}_e^+(f,f)} -\n\\hat{f},\n$$\nwhose solution satisfies\n\\begin{equation}\n\\hat{f}(t,k) = {\\rm e}^{-t} \\hat{f}(0,k) + \\int_0^t {\\rm e}^{-\n(t-s)} \\widehat{\\tilde{Q}_e^+(f,f)}(s,k) \\,ds\\,. \\label{finalg}\n\\end{equation}\n\nTaking the expressions of the two solutions $\\hat{f}_1(t)$ and\n$\\hat{f}_2(t)$ in \\eqref{finalg}, subtracting them and dividing by\n$|k|^{2+\\alpha}$ with $k\\in\\Rto$, we get\n$$\n{\\rm e}^{t} \\frac{(\\hat{f}_1-\\hat{f}_2) (t, k)}{|k|^{2+\\alpha}} =\n\\, \\frac{\\hat{f}_1(0,k)-\\hat{f}_2(0,k)}{|k|^{2+\\alpha}}\\, +\n\\int_0^t \\!{\\rm e}^{s} \\frac{\\Big(\n\\widehat{\\tilde{Q}_e^+(f_1,f_1)}- \\widehat{\\tilde{Q}_e^+(f_2,f_2)}\n\\Big) (s,k)}{|k|^{2+\\alpha}}\\, ds.\n$$\nUsing Theorem \\ref{contrqd2alpha} and taking the supremum in\n$k\\in\\Rto$, we obtain\n\\begin{eqnarray*}\n{\\rm e}^{t} d_{2+\\alpha}(\\hat{f}_1,\\hat{f}_2)(t) \\leq d_{2+\\alpha}\n\\big(\\hat{f}_1(0),\\hat{f}_2(0) \\big) + \\mathfrak{A}(\\alpha,e,\\eta) \\int_0^t\n\\!\\!{\\rm e}^{s} d_{2+\\alpha}(\\hat{f}_1,\\hat{f}_2)(s)ds.\n\\end{eqnarray*}\nLet us set $w(\\tau)={\\rm e}^{t} d_{2+\\alpha}\n(\\hat{f}_1,\\hat{f}_2)(t)$. Then\n$$\nw(t) \\leq w(0) + \\mathfrak{A}(\\alpha,e,\\eta)\\int_0^t w(s)\\, ds ,\n$$\nwhich by Gronwall's inequality implies $w(t) \\leq w(0)\\, {\\rm\ne}^{\\mathfrak{A}(\\alpha,e,\\eta) t}$, concluding the proof.\n\\endproof\n\n\\\n\nThe function $\\mathfrak{A}(\\alpha):[0,\\infty)\\longrightarrow\\rr^+$ is convex\nby direct inspection. Taking into account that $\\mathfrak{A}(0) =\n1$, there are only three possible scenarios for the qualitative\nbehavior of $\\mathfrak{A}$. These are characterized by the sign of\n$\\mathfrak{A}'(0)$. In case $\\mathfrak{A}'(0) \\geq 0$, the\nfunction $\\mathfrak{A}(\\alpha)$ has a minimum at $\\alpha=0$ due\nto convexity, and thus $\\mathfrak{A}(\\alpha) > 1$ for all\n$\\alpha>0$. In this case, there does not exist any $\\bar \\alpha \\in\n\\Realr_+$ such that $\\mathfrak{A}(\\bar \\alpha)<1$ and there are no\ncontraction, only expansion, estimates of $d_s$ for $s> 2$.\n\nSuppose that $\\mathfrak{A}'(0) < 0$. In this case, the\ncontraction properties of $d_s$ depend on whether\n \\[\n \\lim_{\\alpha \\to \\infty} \\mathfrak{A}(\\alpha) < 1\n \\]\n or\n \\[\n \\lim_{\\alpha \\to \\infty} \\mathfrak{A}(\\alpha) > 1.\n \\]\nIn the former case, $\\mathfrak{A}(\\alpha)< 1$ for $\\alpha >0 $.\nTheorem \\ref{contrqd2alpha} then implies that the $d_s$-metric is\ncontractive for all values of the parameter $s>2$. In the latter,\nsince $\\mathfrak{A}(0) = 0$,\nthe convex function\n$\\mathfrak{A}(\\alpha)$ has a minimum attained at some point\n$\\tilde \\alpha\n> 0$, and at the same time there exists $\\bar \\alpha > \\tilde \\alpha$ for which\n$\\mathfrak{A}(\\bar \\alpha)= 1$. Thus, $\\mathfrak{A}(\\alpha)< 1$ in\nthe interval $0 < \\alpha < \\bar \\alpha $, and at the same time\n$\\mathfrak{A}(\\alpha)> 1$ for $\\alpha >\\bar \\alpha$. In this case\nTheorem \\ref{contrqd2alpha} implies that the Boltzmann equation is\ncontractive up to but not including order $\\bar \\alpha$.\n\n\\begin{remark}\nIn order to clarify the behavior of $\\mathfrak{A}(\\alpha,e,\\eta)$, we can\nfix the random variable $\\eta$ to assume only two values, while\nrespecting conditions \\fer{re}. This can be done by assuming that\n$\\eta$ only takes the value ${\\sqrt{1-e^2}}\/\\varrho$ with\nprobability ${\\varrho^2}\/(1+\\varrho^2)$ and the value\n${\\sqrt{1-e^2}}\\varrho$ with probability ${1}\/(1+\\varrho^2)$. By\nvarying the parameters $\\varrho$ and $e$ one encounters the whole\nvariety of possible behaviors of the function $\\mathfrak{A}(\\alpha,e,\\eta)$.\nSince\n \\[\n\\mathfrak{A}(\\alpha,e,\\eta) = \\displaystyle \\frac{2}{4+\\alpha} \\left< \\left(\n\\frac{1+\\et}{2} \\right)^{2+\\alpha} + \\frac{1- \\left| \\frac{1-\\et}{2}\n\\right|^{4+\\alpha}}{1-\\left| \\frac{1-\\et}{2} \\right|^2} \\right>,\n \\]\n$\\mathfrak{A}(\\alpha,e,\\eta)$ results in the sum of four contributions, one\nof which is\n \\[\nC(\\alpha,e,\\eta) = \\displaystyle\n\\frac{1}{1+\\varrho^2}\\frac{2}{4+\\alpha}\\left( \\frac{1+e +\n\\sqrt{1-e^2}{\\varrho}}{2} \\right)^{2+\\alpha}.\n \\]\nFor any fixed values of $\\bar\\alpha >0$ and $e$, since the\nnumerator grows like $\\varrho^{2+\\alpha}$, we can choose\n$\\varrho>>1$ in such a way that $C(\\alpha,e,\\eta) >1$, and Theorem\n{\\rm\\ref{contrqd2alpha}} implies that the Boltzmann equation is\ncontractive up to but not including order $\\bar \\alpha$.\n\nOn the other hand, choosing for example $\\alpha= 2$ to simplify computations, one\nobtains easily\n \\begin{equation}\\label{A4}\n\\mathfrak{A}(2,e,\\eta) = \\displaystyle \\frac{1}{3} \\left< \\left( \\frac{1+\\et}{2}\n\\right)^{4} + 1 + \\left( \\frac{1-\\et}{2} \\right)^{2} + \\left( \\frac{1-\\et}{2}\n\\right)^{4}\\right> =\n \\frac{23 - e + \\langle \\et^4 \\rangle}{24}.\n \\end{equation}\nChoosing now $1-e <<1$, and $\\varrho = \\sqrt{1- e^2}\/e$, one\nobtains that $\\et$ assumes the value $0$ with probability $1-\ne^2$ and the value $1\/e$ with probability $e^2$. Therefore\n$\\langle \\et^4 \\rangle = 1\/e^2$, which implies $\\mathfrak{A}(2,e,\\eta) < 1$\nas long as $1\/e^2 -e < 2$. In this second case Theorem\n{\\rm\\ref{contrqd2alpha}} implies that the Boltzmann equation is\ncontractive at least up to order $4$.\n\\end{remark}\n\n\\subsection{Existence and uniqueness of regular isotropic steady states}\n\nExistence and uniqueness of steady states, as well as the size of their\noverpopulated tails, can be derived in full generality (that is, without imposing\nrestrictive conditions on the random coefficient of restitution) by adapting\nto the present situation the methodology of \\cite{BisiCT2}, which refers to the\ninelastic Boltzmann equation for Maxwell molecules. This methodology, in fact,\nis based only on the contractivity properties of the $d_s$-metric, which are\nanalogous to Theorems \\ref{contrqd2alpha} and \\ref{contrdseb}.\n\nIt has to be remarked that the approach in \\cite{BisiCT2} is not suitable to\nrecover the (eventual) regularity of the steady profile. A regularity result\nfor the steady state of the inelastic Boltzmann equation for Maxwell molecules\nhas been obtained in a recent paper by Bobylev and Cercignani\n\\cite{Bobylev-Cercignani2}. In this paper they were concerned with properties\nof the self-similar profiles of the Boltzmann equation for both elastic and\ninelastic collisions, and, in addition to the existence, they obtained results\non the regularity of the steady profiles by showing that the Fourier transform\nof the steady profile satisfies a suitable upper bound. Their method takes\nadvantage of the existence of a super-solution to the rescaled equation in\nFourier variables (BKW-mode). In our collisional setting, the situation is more\ninvolved, and it requires a precise analysis.\n\nIn Fourier variables, the steady state of \\fer{BE2} is a solution of the\nintegral equation\n \\begin{equation}\\label{sta1}\n\\frac{1}{4 \\pi} \\left<\\int_{S^2} \\hat{f} (k_-) \\hat{f} (k_+) \\, d\\sigma\\right>\n= \\hat{f}(k),\n \\end{equation}\nwhere $k_+$ and $k_-$ are given by the relations\n$$\nk_-=\\frac{1+\\et}{4} k - \\frac{1+\\et}{4}|k|\\sigma \\quad \\mbox{and} \\quad\nk_+=\\frac{3-\\et}{4}\\, k + \\frac{1+\\et}{4}\\, |k|\\sigma\\,.\n$$\nSince isotropy is not destroyed by the collision operator, by choosing\nisotropic initial values, one concludes with the isotropy of the (eventual)\nsteady state. Taking this property into account, the following result can be\nobtained as a consequence of Theorem \\ref{contrdseb} (see \\cite{BisiCT2} for\ndetails).\n\n\\begin{corollary}\\label{exissteadyebds}\nEquation~\\eqref{him} has a unique isotropic steady state $f_\\infty$ in the set\nof isotropic probability measures with unit mass, zero mean velocity and unit\ntemperature. Moreover, given any solution $f$ to \\eqref{him} for the initial\ndata $f_0\\in \\P_2(\\rr^3)$ with zero mean velocity and unit pressure tensor,\n$$\nd_{2+\\alpha}(f(t),f_\\infty) \\leq d_{2+\\alpha}(f_0,f_\\infty)\\, {\\rm\ne}^{-C(\\alpha,e,\\eta) t}\n$$\nfor all $t \\geq 0$, $0<\\alpha<1$. Thus, if $\\mathfrak{A}(\\alpha,e,\\eta) < 1$, $f(t)$\nconverges to the stationary state as $t\\to\\infty$ in the $d_{2+\\alpha}$ sense.\n\\end{corollary}\n\n\\begin{remark}\nThe previous result shows that the stationary states attract all solutions with\ninitial data having zero mean velocity and unit pressure tensor. The assumption\nof having unit pressure tensor can be weakened to having initial unit temperature\nby proceeding similarly to the homogeneous cooling state analysis in\n{\\rm\\cite{Bobylev-Cercignani-Toscani,BisiCT2}}.\n\\end{remark}\n\nLet us define\n\\begin{equation} \\label{+-}\n\\begin{split}\n&\\displaystyle a^2(e,\\eta,\\theta)= \\frac{|k_-|^2}{|k|^2}= \\left(\n\\frac{1+\\et}{4} \\right)^2 2\\, \\Big( 1- \\cos \\vartheta \\Big)\n\\\\*[.3cm] &\\displaystyle b^2(e,\\eta,\\theta)= \\frac{|k_+|^2}{|k|^2}=\n \\left[ \\left( \\frac{3-\\et}{4} \\right)^2 + \\left( \\frac{1+\\et}{4}\n\\right)^2 + 2 \\left( \\frac{3-\\et}{4} \\right) \\left( \\frac{1+\\et}{4} \\right)\n\\cos \\vartheta \\right]\n\\end{split}\n\\end{equation}\n Recalling the definition of $k_+$ and $k_-$ given in\n\\fer{modulusk+-}, it is immediate to show that\n \\begin{equation}\\label{cc1}\n a+b \\ge 1; \\qquad \\frac{1}{2} \\left<\\int_{0}^\\pi (a^2 +b^2) \\,\n \\sin \\theta d\\theta\\right> =1\n \\end{equation}\nThe first property in \\fer{cc1} is a direct consequence of the equality $k_+\n+k_- = k$, while the second is the equality $\\mathfrak{A}(0) =1$ in\n\\fer{Aalpha}.\n Let us set $x= |k|$. Then, for any function $\\psi(x)$, the\n left-hand side of \\fer{sta1} can be rewritten\n in the form\n \\begin{equation}\\label{sta2}\n R[\\psi(x)] = \\frac{1}{2} \\left<\\int_{0}^\\pi \\psi(ax) \\psi(bx) \\,\n \\sin \\theta d\\theta\\right>.\n \\end{equation}\nUnder the conditions of Corollary \\ref{exissteadyebds}, the Boltzmann equation\nhas a unique steady state $\\ff_\\infty(x)$, of unit mass, zero mean velocity and\nunit second moment.\n\nLet us remark that $0 \\le R[\\psi] \\le 1$ if $0 \\le \\psi \\le 1$, and $R[\\psi]\n\\le R[\\phi]$ if $0 \\le \\psi \\le \\phi$. Hence the iteration is monotone\nincreasing and converges point-wise if we choose the initial approximation $0\n\\le \\phi_0 \\le 1$ in such a way that $\\phi_0 \\le R[\\phi_0]$.\n As observed in \\cite{Bobylev-Cercignani2}, $\\phi_0(x) = \\exp\\{-x^2\/2\\}$\nallows us to obtain a monotone increasing sequence. In fact, since the\n function $e^{-r}$, $r \\ge 0$ is convex, by Jensen's inequality we obtain\n \\begin{equation}\\label{in5}\n \\left\\langle {\\rm e}^{-\\frac 12(a^2+b^2)x^2}\\right\\rangle \\ge e^{ -\\left\\langle\n\\frac 12(a^2+b^2)x^2 \\right\\rangle } = e^{-{x^2}\/2}.\n \\end{equation}\nThis implies that the limit $\\ff_\\infty(x) \\ge 0$. The trivial limit\n$\\ff_\\infty(x)=1$ will be excluded if there exists a non-zero function\n$\\phi_0(x)$ such that\n \\begin{equation}\\label{in4}\n \\phi_0(x) \\le \\psi_0(x),\n \\end{equation}\nand at the same time $\\psi_0(x)$ generates a monotone decreasing sequence.\n\nInspired by the ideas of Desvillettes et al in \\cite{DFT}, given a fixed\npositive constant $\\R$, we introduce the fixed point operator\n\\begin{align*}\n {\\mathbf R}[\\psi](x) &:= \\left\\{ \\begin{array}{cl}\n \\ff_\\infty(x) & \\mbox{if $x< \\R$} \\\\\n R[\\psi(x)] & \\mbox{if $x \\geq \\R$}\n \\end{array} \\right.\n\\end{align*}\non bounded complex functions $\\psi:{\\mathbb R}\\to{\\mathbb C}$. Notice that ${\\mathbf R}$ is\nclosely related to the Fourier transform of the collision kernel.\n\n\n\n\n\n\\begin{lemma}\\label{bound}\nLet $0 \\le \\ff_\\infty(x)\\le 1$ be the steady state of the Boltzmann equation,\nand let us define\n\\begin{align*}\n \\psi_0(x) &:= \\left\\{ \\begin{array}{cl}\n \\ff_\\infty(x) & \\mbox{if $ x < \\R$} \\\\\n \\exp(-\\mu x)& \\mbox{if $ x \\geq \\R$.}\n \\end{array} \\right.\n\\end{align*}\nThen, if the random variables $a(e, \\eta, \\theta)$ and $b(e, \\eta, \\theta)$ are\nsuch that\n \\begin{equation} \\label{condd}\n P(a < \\delta) + P(b < \\delta) \\to 0 \\qquad {\\rm as} \\,\\,\\, \\delta \\to 0 ,\n \\end{equation}\n there exist positive constants $\\R$ and $\\mu$ such that\n \\[\n{\\mathbf R}[\\psi_0](x) \\le \\psi_0(x).\n \\]\n \\end{lemma}\n\n \\par{\\it Proof.-} \\ignorespaces\nSince the steady state is an isotropic probability density function of unit\nmass, zero mean velocity and unit second moment, there exist positive constants\n$M < 1\/2$ and $\\R$ such that (cfr. \\cite{DFT})\n \\begin{equation} \\label{max}\n 0 \\le \\ff_\\infty(x) \\le e^{-Mx^2} \\qquad {\\rm if}\\,\\,\\, x \\le \\R.\n \\end{equation}\nHence, we can fix $\\R$ and $M$ to obtain\n \\begin{equation}\\label{bbb}\n \\psi_0(x) \\le e^{-Mx^2} \\qquad {\\rm if}\\,\\,\\, x \\le \\R.\n \\end{equation}\nClearly, thanks to the definition of $\\psi_0$, if $x \\le \\R$, there is nothing\nto prove. Therefore, let us consider the possible cases corresponding to $x\n>\\R$. Since $a+b \\ge 1$, if both $ax \\ge \\R$, $bx \\ge \\R$,\n\\[\n \\langle \\psi_0(ax)\\psi_0(bx)e^{\\mu x} \\rangle \\le 1.\n \\]\nIf now both $ax <\\R$ and $bx <\\R$, using bound \\fer{bbb}, we obtain\n \\[\n \\langle \\psi_0(ax)\\psi_0(bx)e^{\\mu x} \\rangle \\le \\langle e^{g(x)} \\rangle,\n \\]\n where\n \\[\n g(x) = \\mu x - M(a^2 + b^2)x^2.\n \\]\n Since $ a +b \\ge 1$, it follows that $a^2 + b^2 \\ge 1\/2$. Thus\n \\begin{equation} \\label{b2}\n g(x) \\le \\mu x - \\frac 12 (a^2 + b^2)x^2 \\le 0 \\qquad {\\rm if} \\,\\,\\, \\mu \\le \\frac\n M{2\\R}.\n \\end{equation}\n Consider now the case in which $ax \\le \\R$, while $bx >\\R$. In this case\n\\[\n \\langle \\psi_0(ax)\\psi_0(bx)e^{\\mu x} \\rangle \\le \\langle e^{h(x)} \\rangle,\n \\]\n where\n \\[\n h(x) = \\mu(1-a) x - M b^2 x^2.\n \\]\nSince $ a +b \\ge 1$, it follows that $b \\ge 1-a$, and\n \\begin{equation}\\label{b3}\n h(x) \\le z(bx) = \\mu bx - M(bx)^2 \\le \\frac{\\mu^2}{4M^2}.\n \\end{equation}\nIn fact, the function $z(r)$ has a maximum at $\\bar r = \\mu\/(2M)$. Moreover,\nsince $z(r)$ decreases for $r >\\bar r$, if $ r \\ge 3 \\bar r$,\n \\begin{equation}\\label{b4}\n z(r) \\le z(3\\bar r) = -3 \\frac{\\mu^2}{4M^2} .\n \\end{equation}\nLet us split the calculation of the mean value into the sets $A = \\{ bx \\ge 3\n\\bar r\\}$ and $A^c= \\{ bx < 3 \\bar r\\}$. Thanks to conditions \\fer{b3} and\n\\fer{b4} one obtains\n \\begin{equation}\\label{mm}\n\\langle e^{h(x)}\\rangle \\le P(A) \\exp\\left\\{-3 \\frac{\\mu^2}{4M^2}\\right\\} +\nP(A^c)\\exp\\left\\{ \\frac{\\mu^2}{4M^2}\\right\\}.\n \\end{equation}\nLet us set $\\delta = 3\\bar r = 3\\mu\/(2M)$. By hypothesis, since $x >\\rho$,\n \\[\n P(A^c) = P(bx < \\delta) \\le P(b\\rho < \\delta) \\to 0 \\qquad {\\rm if} \\,\\,\\, \\delta \\to 0.\n \\]\n Consider that we can rewrite \\fer{mm} as\n \\[\n\\langle e^{h(x)}\\rangle \\le (1- P(A^c) \\exp\\left\\{- \\frac 13 M\\delta^2 \\right\\}\n+ P(A^c)\\exp\\left\\{ \\frac 13 M\\delta^2\\right\\} =\n \\]\n \\[\n 1 - \\frac 13 (1- 4P(A^c)) M \\delta^2 + o(\\delta^2) \\le 1\n \\]\n if $\\delta$ is sufficiently small. Now, this condition on $\\delta$ can be\n satisfied by choosing $\\mu$ sufficiently small. This is not in contrast with\ncondition \\fer{b2}. Since the case in which $ax > \\R$ while $bx \\le \\R$ can\nbe treated likewise, the lemma is proven.\n\\endproof\n \\\n\n\\begin{remark}\nCondition \\fer{condd} excludes some pathological situations related to the\ndefinition of the random variable $\\eta$ that describes the randomness of the\ncoefficient of restitution $e$. For example, condition \\fer{condd} is violated\nif $\\eta$ is concentrated on some particular point,\n \\[\n P( \\eta = 1-e) = p >0 .\n \\]\nIn this case, in fact, $P(b(e,\\eta, 0) = 0) = p$, and condition \\fer{condd} is\nfalse.\n\\end{remark}\n\nLemma \\ref{bound} implies that, starting from $\\psi_0$, the iteration process\nleads to a monotone decreasing sequence. On the other hand, it is clear that,\nfor $\\mu$ sufficiently small,\n \\[\n 0 \\le \\phi_0(x) \\le \\psi_0(x) \\le 1.\n \\]\n\n\nGiven $\\mu>0$, define $K_\\mu$ as the set of functions $\\psi$ with $\\psi(0)=1$,\n$\\psi'(0)=\\ff_\\infty'(0)$, and satisfying the estimates\n\\begin{align}\n \\label{eq.gevrey}\n |\\psi(x)| \\leq \\exp(-\\kappa x^2) \\quad \\mbox{for $ x < \\R$},\n \\qquad\n |\\psi(x)| \\leq \\exp(-\\mu x) \\quad \\mbox{for $x \\geq \\R$}.\n\\end{align}\n\nThe previous inequalities prove the following\n\n\\begin{theorem}\nFor any pair of functions $a$ and $b$ satisfying conditions \\fer{cc1}and\n\\fer{condd}, the integral equation \\fer{sta2} has a nontrivial solution\n$\\ff_\\infty(x)$ such that $\\ff_\\infty(x)$ belongs to the Gevrey class $K_\\mu$\ndefined by \\fer{eq.gevrey}.\n\\end{theorem}\n\n\\begin{remark}\nAn analogous regularity result can be proven for the steady state to the\none-dimensional kinetic model \\fer{ibe1d} \\cite{MaTo06}. In this case, it is\nimportant to know that the mean wealth of the stationary state is equal to one.\n\\end{remark}\n\n\\subsection{Fat tails of stationary states}\n\nIn this work, we will only examine the case of the fourth moment,\npostponing the complete analysis of moment evolution to future\nresearch. Here, we will show that under certain conditions on the\nrandom variable, the fourth moment diverges or is controlled\nuniformly.\n\n\\begin{lemma}\\label{prop-mom4} Let the restitution coefficient $e$ and\nthe random variable $\\eta$ be chosen so that $\\mathfrak{A}(2,e,\\eta) < 1$. If\n$f^0$ is a Borel probability measure on $\\rr^3$ such that\n$$\n\\int_{\\rr^3} \\vert v \\vert^4 \\, f^0(v) \\, dv<\\infty,\n$$\nthen the solution $f$ to \\eqref{him} with initial datum $f^0$\nsatisfies\n$$\n\\sup_{\\tau \\geq 0} \\int_{\\rr^3} \\vert v \\vert^4 \\, f(t, v) \\,\ndv<\\infty.\n$$\n\\end{lemma}\n\n\\par{\\it Proof.-} \\ignorespaces Without loss of generality we can assume that $f^0$, and\nhence $f(t)$ for all $ \\tau \\geq 0$, has zero mean velocity and\nunit temperature. We let\n$$\nm_4(t) = \\int_{\\rr^3} \\vert v \\vert^4 \\, f(t, v) \\, dv\n$$\ndenote the fourth order moment of $f(t)$. Then, using the weak\nformulation of the inelastic Boltzmann equation, we have:\n\\begin{equation}\\label{eq-mom4}\n\\frac{d m_4(t)}{d t} = \\int_{\\rr^3} \\vert v \\vert^4 \\,\n\\tilde{Q}_e(f(t), f(t)) (v) \\, dv\n\\end{equation}\nthat can be computed as in \\cite{Bolley-Carrillo} by\n\\begin{align*}\n\\int_{\\rr^3} \\vert v \\vert^4 \\, \\tilde{Q}_e(f, f) (v) \\, dv = &-\n<\\zeta> \\, \\int_{\\rr^3} \\vert v \\vert^4 \\, f(v) \\, dv + <\\mu_1>\n\\Big( \\int_{\\rr^3} \\vert v \\vert^2 \\, f(v) \\, dv \\Big)^2\n\\\\ &+ <\\mu_2> \\iint_{\\rr^3 \\times \\rr^3} (v \\cdot w)^2 \\, f(v) \\,\nf(w) \\, dv \\, dw\n\\end{align*}\nwhere\n$$\n\\mu_1 = \\frac{1}{8} (\\nu_1 + \\nu_2 - \\nu_3) \\quad {\\textrm{and}}\n\\quad \\mu_2 = \\frac{1}{4} (\\nu_1 - \\nu_2)\n$$\nwith\n$$\n\\nu_1 = (\\epsilon^2 + \\epsilon'^2)^2 -1 + \\frac{4}{3} \\epsilon^2\n\\epsilon'^2, \\quad \\nu_2 = 2 \\big[ \\epsilon^2 + \\epsilon'^2 -1 +\n\\frac{2}{3} \\epsilon'^2 \\big], \\quad \\nu_3 = 4 (\\epsilon^2 - 1),\n$$\nand\n$$\n\\zeta = \\frac{1}{3} ( 1 + 4 \\, \\epsilon - 7 \\, \\epsilon^2 + 4 \\,\n\\epsilon^3 - 2 \\, \\epsilon^4) \\qquad \\mbox{with} \\qquad \\epsilon =\n\\frac{1-\\et}{2} \\qquad \\mbox{and} \\qquad \\epsilon'=1-\\epsilon .\n$$\nNow, \\eqref{eq-mom4} reads\n\\begin{equation}\\label{new}\n\\frac{d m_4(t)}{d t} = -<\\zeta> m_4(t) + m(t)\n\\end{equation}\nwhere $m(t)$ is a combination of second order moments, which are bounded in\ntime since the kinetic energy is preserved by equation \\eqref{him}. Moreover\none can check from the expression of $\\zeta$ in terms of $e$ that $<\\zeta> = 1-\n\\mathfrak{A}(2,e,\\eta)>0$. This ensures that $m_4(t)$ is bounded uniformly in time if\ninitially finite, and concludes the argument.\n\\endproof\n\n\\\n\nThe preceding result also shows the divergence of the fourth moment in case the\nrandom variable $\\eta$ and the restitution coefficient $e$ are chosen to\nsatisfy $\\mathfrak{A}(2,e,\\eta)\n> 1$ but $\\mathfrak{A}(\\alpha,e,\\eta) < 1$ for some $0<\\alpha<2$.\n\n\\begin{corollary}\nLet the restitution coefficient $e$ and the random variable $\\eta$\nbe chosen so that $\\mathfrak{A}(2,e,\\eta)>1$ but $\\mathfrak{A}(\\alpha,e,\\eta)<1$ for\nsome $0<\\alpha<2$. Then, the unique isotropic steady state\n$f_\\infty$ in $\\Ptwot$ of equation~\\eqref{him} with zero mean\nvelocity and unit pressure tensor has unbounded fourth moment.\n\\end{corollary}\n\n\\par{\\it Proof.-} \\ignorespaces With the notation of the previous subsection, the evolution of the\nfourth moment for isotropic densities given in Lemma \\ref{prop-mom4} ensures\nthat\n$$\n\\frac{d m_4(t)}{d t} = -<\\zeta> m_4(t) + m(t),\n$$\nwhere $m(t)$, which is a combination of second order moments, is bounded from\nbelow. Recall that $<\\zeta>=1-\\mathfrak{A}(2,e,\\eta)<0$ to conclude.\n\\endproof\n\n\n\\bigskip\n\n\\noindent {\\bf Acknowledgements:} JAC acknowledges the support from DGI-MEC\n(Spain) FEDER-project MTM2005-08024 and 2005SGR00611. G.T. acknowledges the\nsupport of the Italian MIUR project ``Kinetic and hydrodynamic equations of\ncomplex collisional systems''. JAC and GT acknowledge partial support of the\nAcc. Integ. program HI2006-0111. JAC acknowledges partial support of the Acc.\nInteg. program HF2006-0198.\n\n\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}} +{"text":"\\section{Introduction}\\label{sec:introduction}\nQuantum Computers (QCs) are specialized devices that will be able to solve some problems faster than Classic Computers (CCs)~\\cite{bernstein1997quantum, deutsch1985quantum}. This is known as `quantum advantage'. Examples of such problems (originating in various fields of science) are scalable simulations of quantum systems in physics~\\cite{feynman1982simulating}, efficient modelling of chemical reactions~\\cite{aspuru2005simulated}, accurate pricing of financial instruments and credit scores~\\cite{ORUS2019100028}, and fast breaking of encryption codes in cryptography~\\cite{shor1997}.\n\n\\subsection{QC timeline} \\label{sec:timeline}\n\nThe field of quantum computing is young: Feynman introduced the idea of quantum computing in 1982~\\cite{feynman1982simulating}; Shor proposed the first practically relevant algorithm (for breaking encryption protocols based on integer factorization) that can be efficiently computed on a QC in 1994~\\cite{shor1997}.\n\nIt took a while to implement an actual QC. A partnership between academia and IBM created the first working 2-qubit\\footnote{\nAt any point of execution, the state of a CC is given by a vector of bits taking the values of $0$ and $1$. The state of a QC is, however, given by a vector of qubits and bits. Qubit is the basic unit of quantum information, on which QC operate.\nWe will give a more formal definition of a qubit and compare it with a bit in Section~\\ref{sec:quant_comp}.} QC in 1998~\\cite{Chuang1998}, but it took the company 18 years to make a 5-qubit QC accessible to the public in 2016~\\cite{ibm2016}. \n\nAt present, a few QCs are commercially available. D-Wave started selling adiabatic QC in 2011 (although debate about adiabatic QC being a `true' QC is ongoing\\footnote{A hybrid of adiabatic and gate-based QC is promising~\\cite{barends_digitized_2016}, but no commercial implementation is available.}~\\cite{albash2017}) with the current offerings having $>$~5000 qubits~\\cite{DWaveAnn7:online}. \n\nQCs are also available via fully-managed Cloud services. IBM gave access to 20- and 50-qubit gate-based superconducting QCs to academic and industrial partners to explore practical applications in 2017~\\cite{ibm2017} (and the 65-qubit machine was offered in 2020~\\cite{IBMsRoad67:online}). For non-commercial use, IBM offers 5- and 15-qubit QCs via IBM Q Experience online platform based on IBM Cloud (along with local- and Cloud-based simulators)~\\cite{ibm_quantum}. Rigetti offered 8-qubit superconducting QC in 2017~\\cite{RigettiC96:online}. Google built 72-qubit gate-based superconducting QC in 2018~\\cite{google2018}. IonQ introduced ion-trapped 11-qubit QC in 2019~\\cite{Wright2019}. Honeywell created ion-trapped 10-qubit QC in 2020~\\cite{QuantumC77:online}. Xanadu offered 8- and 12-qubit photonic QCs in 2020~\\cite{XanaduRe21:online,CloudPla55:online}. Microsoft provides access to a simulator\\footnote{A QC can be simulated on a CC~\\cite{ibm_quantum,ms_quantum}. A quantum simulator interprets a mathematical function as part of a physical model~\\cite{Johnson2014}; however, it will not yield performance improvement that a QC would provide, as the underlying host system of the simulator is still based on bits rather than qubits (a basic unit of quantum information). Thus, one needs a real QC to reap performance benefits.} of a topological QC via Microsoft Quantum Development Kit~\\cite{ms_quantum} (and is planning to give access to an actual QC in the future).\n\n\nAggregated Cloud services are starting to appear as well. For example, Amazon Web Services started offering access to QC from various vendors via its Braket service in 2019~\\cite{aws_braket_intro}. Currently, it offers D-Wave adiabatic 2048- and 5640-qubit QCs, IonQ trapped-ion-based 11-qubit QC, and Rigetti 32-qubit superconducting QC~\\cite{AmazonBr86:online}. \n\n\n\\subsection{QC performance} When discussing the performance of the abovementioned QCs, we have to be mindful of the fact that the performance of the QCs (which are based on different architectures) cannot be compared merely based on the number of qubits that each QC has. Conceptually, it is similar to the fact that we cannot compare the performance of CC based solely on the number of central processing unit (CPU) cores and the cores' frequency. Standardization of benchmarks for QC is currently in the works by an IEEE Working Group~\\cite{ieee_wg}. \n\n\nOne of the measurements of the QC performance, introduced by IBM, is the Quantum Volume~\\cite{cross2019}, deemed $V_Q$. This metric combines the number of physical qubits, their inter-connectivity, and measurements error rates. For example, while the Honeywell H1 QC has only 10 ion-trapped physical qubits~\\cite{QuantumC77:online}, its $V_Q=128$~\\cite{Achievin40:online}. In comparison, the IBM's 27-qubit QC has $V_Q=64$~\\cite{jurcevic2020demonstration,IBMDeliv10:online}.\n\nRecently, IonQ introduced a QC with 32 ion-trapped perfect qubits with low gate errors, giving it an expected $V_Q > 4 \\times 10^6$~\\cite{IonQPres32:online}. They have also introduces another measure of QC performance, called Algorithmic Qubit, defined as `the largest number of effectively perfect qubits you can deploy for a typical quantum program~\\cite{ScalingI73:online}.'\n\n\n\n\\subsection{QC applicability} \n\\subsubsection{Theoretical perspective} \\label{sec:applicability_theory}\nOnly those problems falling under the bounded error quantum polynomial time ($\\BQP$) class defined in computational complexity theory~\\cite{nielsen_chuang_2010} can benefit from the QC architecture. The time complexity of algorithms, which solve $\\BQP$ class problems, grows polynomially with the increase of the input size on a QC. On the contrary, the time complexity of the algorithms solving the same problems on a CC is not bounded above by a polynomial function and may grow faster (e.g., exponentially) with the increase of the size of the input. \n\nFormally, it was shown that the relations between $\\BQP$ and other popular complexity classes are as follows: $\\P \\subseteq \\BPP \\subseteq \\BQP \\subseteq \\P^{\\#\\P} \\subseteq \\PSPACE$, where $\\P$ is a polynomial time complexity class, $\\BPP$ is a bounded-error probabilistic polynomial time class, $\\P^{\\#\\P}$ is $\\P$ with $\\#\\P$ oracle class ($\\#\\P$ is a set of counting problems and a class of function problems rather than decision problems), and $\\PSPACE$ is a polynomial space class, see~\\cite{vazirani2002survey} for details. \n\nCurrently, the consensus (although not formally proven) is that some of the nondeterministic polynomial time ($\\NP$) problems do belong to the $\\BQP$ set; however, $\\BQP$ and $\\NP$-complete sets of problems do not overlap (see~\\cite{vazirani2002survey,nielsen_chuang_2010} for review). That is, a QC will not be able to solve an $\\NP$-complete problem.\n\n\n\n\\subsubsection{Practical perspective}\\label{sec:practical_perspective}\n\nQuantum advantage was demonstrated on a superconducting QC in 2019~\\cite{arute2019quantum}. Another demonstration of quantum advantage on a photonic QC was done in 2020~\\cite{zhong2020quantum} (although the setup used in the experiment may be difficult to scale up or generalize~\\cite{choi2021}).\n\nBut when will QCs start solving real-world problems? Quantum chemists are already able to improve simulations of small chemical systems~\\cite{kandala2017hardware} and some large ones, albeit with approximations~\\cite{tavernelli2020resource}, using the existing QCs. Quantitative finacists will need a machine with $\\approx$~7.5K logical qubits to price financial instruments~\\cite{chakrabarti2020threshold}. Hackers will need a computer with 20M qubits to break the 2048-bit RSA key in less than a day~\\cite{gidney2019factor}. \n\nAnother promising area for application of QCs is machine learning. Modern QCs are already capable of solving simple machine learning problems~\\cite{johri2020nearest,broughton2020tensorflow}. They will be able to tackle larger problems as computer size increases. However, we have to be mindful that many subroutines required for machine learning (especially related to the linear algebra computations) will achieve polynomial rather than exponential speedup on QC~\\cite{johri2020nearest,DBLP:conf\/stoc\/Tang19}. Thus, quantum machine learning frameworks (such as Tensorflow Quantum~\\cite{TensorFl66:online}) will have to carefully decide\\footnote{The same strategy is currently used by CC machine learning frameworks to distribute the workload between CPUs and graphics processing units (GPUs).} which subroutines should be executed on a QC and which should stay on a CC. \n\n\nTo start addressing practical use-cases within the next decade, IBM stated that they `need to at least double the Quantum Volume of our quantum computing systems every year.~\\cite{chow2020}' So far, IBM is on track, demonstrating the Quantum Volume of 64 on a QC with 27 qubits in 2020~\\cite{IBMsRoad67:online}. By 2023, IBM plans to ship a computer with 1,121 qubits~\\cite{IBMsRoad67:online} (with the expectation of proportional Quantum Volume growth).\n\n\\subsubsection{Effect of QC on software engineering workloads: vision}\\label{sec:vision}\n\nAs discussed in Section~\\ref{sec:practical_perspective}, currently, the programs for QC are targeting problems from the Science, Technology, Engineering and Mathematics (STEM) domain, e.g., factor integers~\\cite{shor1997} or sample boson particles~\\cite{giordani_experimental_2018}. They are not of interest to a mainstream consumer. Thus, QCs, at the current stage of their evolution, conceptually resemble computers from the 1940s and 1950s. For example, the Electronic Numerical Integrator and Computer (ENIAC), completed in 1945, was used for comparable tasks: to compute the highest factor of $2^{18}$ and simulate decay of neutron particles during nuclear fusion~\\cite{haigh2016eniac}. Peculiarly, this parallel is further supported by the fact that languages designed for QC operate at the level of qubits and quantum circuits~\\cite{heim2020quantum}. \n\n\nDoes this mean that history will repeat itself, and a new Software Crisis~\\cite{DBLP:conf\/qce\/MoguelBGM20}, similar to the one that led to the inception of Software Engineering in the 1960s, is upon us? The authors' position is cautiously optimistic: below, we argue that this is not the case and that the history of computing evolves in an upward spiral rather than a circle.\n\nOn the surface, the current situation with programming QC is similar to programming CC in the 1950s: we are dealing with expensive machines which have to be manipulated at the level of registers and gates. A highly-qualified personnel is required for the machine's maintenance. However, the situation is much better than back in the day. We now understand how to deal with large codebases, e.g., by applying Lehman's laws of software evolution~\\cite{lehman1980}. The tools and access to resources have also improved dramatically. Punched cards and fights for machine time have been replaced with powerful integrated development environment (IDEs) and trivial access to computing resources (as a lot of QC development can be done in a simulator). Thus, programming modern QC is a much more pleasant and forgiving experience than that of early generations of CCs.\n\nFor example, we are programming QCs at the gate level, but we are typically doing from higher-level languages. For example, the QisKit library is coded in Python. Thus, we get superior language constructs, such as for-loops, modularity, or classes\\footnote{A reader interested in exploring high-level language constructs may want to examine the source code~\\cite{qiskit:shor:online} of the \\texttt{Shor} class, used in Figure~\\ref{fig:aqua_shor}.}. We can build automatic test cases using test harnesses designed for these high-level languages. We use potent IDEs with integrated source code management, code-completion, and spell-checking. The code can be executed in the simulators and, in some cases, debugged using an interactive debugger (e.g.,~\\cite{ibm_quantum,ms_ide}). Finally, we have amassed decades of knowledge on requirements engineering and design --- a lot of this knowledge can and will be transferable to the QC programming (see~\\cite{DBLP:journals\/corr\/abs-2007-07047} for review of the latest works). We will also show how we can readily transfer some of software engineering (SE) knowledge, especially in the context of System of Systems (SoS), in Sections~\\ref{sec:usage} and \\ref{sec:qa}.\n\nIronically, the ability of future QCs to break modern encryption schemes may trigger a crisis related to the maintenance of the legacy software executed on a CC (rather than a crisis of developing code for QCs). While the breakage of RSA keys discussed in Section~\\ref{sec:practical_perspective} is years away, we need to start protecting ourselves against these future potential attacks right now. This is because malicious entities can harvest sensitive data communications now and~--- when a powerful QC becomes available~--- leverage that computing power to break today's non-quantum-resistant encryption and gain access to such sensitive data. Many QC-resistant encryption methods have been proposed (see~\\cite{zhang2020quantum} for details). However, their implementations will require significant changes to various software, such as web browsers and web servers, mail and hard drive encryptors. We conjecture that the amount of work required to introduce these changes into legacy software may be similar to that of the Y2K problem~\\cite{britannica_y2k}. For details on protection steps, see~\\cite{zhang2020quantum}.\n\n\n\\subsection{Overview of the rest of the paper}\\label{sec:overview}\n\nThe programming languages for QC are mainly low-level, operating at the level of QC register, e.g., Open Quantum Assembly (OpenQASM) language~\\cite{cross2017open}. However, higher-level languages are being developed (e.g., Scaffold~\\cite{JavadiAbhari2014ScaffCC}). \n\nTo enable usage of the QC, libraries with pre-packaged quantum algorithms start to appear. For example, Qiskit Aqua~\\cite{Qiskit} (an open-source library written in Python) implements quantum algorithms for various domains, such as artificial intelligence, chemistry, and finance. Such a library enables a programmer to treat QC as a black-box and leverage quantum algorithms without having a deep understanding of the QC field. We will discuss the usage of quantum components based on such libraries as part of a software solution in Section~\\ref{sec:usage}. We will then cover the implications of quantum components to testing and debugging SoS and standalone QC programs in Section~\\ref{sec:qa}. \n\nThe quantum libraries themselves have to be developed by programmers with expertise in the QC field. These programmers, inevitably, inject defects in their code (uniting CC and QC programming worlds). After that, the code has to be debugged. We will touch on existing debugging tactics and their applicability to quantum programs in Section~\\ref{sec:traditional}. To better understand programmers' challenges, we will review and compare classic and quantum models of computation in Section~\\ref{sec:quant_comp}. Armed with this knowledge, we will then show tricks for analyzing quantum programs during runtime in Section~\\ref{sec:debug_quantum}. We conclude the paper in Section~\\ref{sec:conclusions}.\n\n\\section{Creation and Usage of Quantum Software Components}\\label{sec:usage}\n\nAs discussed in Section~\\ref{sec:applicability_theory}, $\\P \\subseteq \\BQP$. Thus, one may argue that QCs will replace CCs at some point in time. However, we conjecture~\\cite{miranskyy2019testing} that QCs will not replace CCs in the short run. Rather, QCs will be integrated into an SoS, where QC-based components will solve $\\BQP$ problems (that CCs cannot solve), while the solution will be passed to CC components for post-processing. Let us elaborate on this conjecture.\n\nThe reasons for this lie in economics. Modern QCs are expensive: e.g., D-Wave QC is valued at \\$15 million~\\cite{wired2017}. Many require low-temperature cooling and specialized training to use and maintain. The QCs are bulky, taking significant amount of space. The costs, size, and maintenance requirements will probably be reduced over time (as it happened during the transition of mainframes to personal computers). Let us speculate how various QC architectures may evolve in the future.\n\nThe superconducting QCs, such as the ones from IBM, Google, and Rigetti, require cryogenic cooling. This is the fundamental physics requirement and will not change with time. Thus, even though such QCs may become smaller and cheaper, they will require specialized cooling and maintenance personnel. Thus, these machines will have to be hosted in a public or private Cloud and accessed as a service.\n\nThere are at least two QC architectures for Quantum Processing Units (QPU) that may one day be integrated into a CC, similar to a GPU. The first one is ion-trap QC, such as the one from Honeywell and IonQ, which do not require cryogenic cooling (ion trap QC use vacuum and lasers to `slow down' atoms). IonQ plans to have a rack-based QC by 2023 and a desktop unit by 2025~\\cite{IonQplan81:online}.\n\nThe second architecture is photonic, such as the one from Xanadu. The photonic QC chip operates at room temperature~\\cite{arrazola2021quantum}. However, photon detectors in photonic QC do require cooling~\\cite{choi2021}. Potentially, engineers may be able to come up with a sensor that does not require cooling. This will allow photonic QC to be miniaturized and operate at room temperature.\n\nAnother argument for using QC in an SoS comes from the cost of software development. Theoretically, one can port any CC code to a QC code. However, the cost of porting will make it economically infeasible. Modern QC programming languages, such as IBM QisKit Python package~\\cite{ibm_quantum}, Google Cirq framework~\\cite{cirq:developers:2021:4586899}, or Microsoft Q\\# language~\\cite{svore2018}, operate at the level of qubits and quantum circuits. Creation of, e.g., a graphical user interface, in such a language would be very time-consuming and expensive\\footnote{Notwithstanding, these languages integrate nicely into CC domain, simplifying the creation of SoS. As mentioned above, QisKit is implemented as a Python library, running on a CC. Once translated to QC machine language (via OpenQASM), the code is passed to the QC for execution (the complexities of the call are encapsulated in the library's code). Cirq and Q\\# behaviour is similar: the code is developed on a CC and then passed to a QC for execution.}. \nIn the distant future, as the higher-level languages for QC are created, the replacement of CC with QC will become more probable. \n\nFor now, it is easier to keep the existing code on CC and outsource parts that can run efficiently on a quantum machine to a QC. How can this be done? Let us look at an example.\n\n\\begin{exmp}\\label{ex:sos}\nSuppose that we need to create a software-as-a-service for factoring large integers to break the RSA cryptosystem. The time complexity of the best algorithms available for a CC in the family of general number field sieves) is sub-exponential~\\cite{pomerance96atale}. Thus, these algorithms will be ineffective for large integers. Instead, we will build a software component running Shor's algorithm on a QC, which will be more efficient for large integers, because Shor's algorithm computation time (as other $\\BQP$ class algorithms) will grow polynomially with the growth of the input integer $N$ (when executed on a QC). The rest of the components, such as user interface (UI) and application program interface (API) for obtaining input (i.e., the value of $N$) to be passed to the QC component and to return the vector of factors $\\vec{L}$ back to the user will be implemented on a CC, as depicted in Figure~\\ref{fig:arch}. \n\n\nModern libraries that abstract QC computations can already enable this scheme. For example, the QisKit Aqua library (written in Python) already has Shor's algorithm built-in~\\cite{qiskitaq4:online}. Thus, a programmer does not need to know anything about quantum algorithms and the implementation details. Instead, they will simply call the Python class implementing Shor's algorithm. We show a sample implementation of this approach in Figure~\\ref{fig:aqua_shor}.\n\n\\begin{figure*}[tb]\n \\centering\n \\resizebox{0.9\\linewidth}{!}{\n \\begin{tikzpicture}[outer\/.style={draw=gray,dashed,fill=green!1,thick,inner sep=5pt}]\n \\begin{umlseqdiag}\n \\umlactor[scale = 0.5]{user}\n \\umlbasicobject{WebApp's UI}\n \\umlbasicobject{WebApp's Backend}\n \\umlbasicobject{QC's Controller}\n \\umlbasicobject{QC's Core}\n \\begin{umlcall}[op=$N$, type=synchron, return=Return $\\vec{L}$]{user}{WebApp's UI}\n \\begin{umlcall}[op=$N$, type=synchron, return=Return $\\vec{L}$]{WebApp's UI}{WebApp's Backend}\n \\begin{umlcall}[op=QASM, type=synchron, return=Return $\\vec{L}$]{WebApp's Backend}{QC's Controller}\n \\begin{umlcall}[op=Control sequence, type=synchron, return= Return qubits' state]{QC's Controller}{QC's Core}\n \\end{umlcall}\n \\end{umlcall}\n \\end{umlcall}\n \\end{umlcall}\n \\node (text1) [anchor=north] at ([xshift=5.5em, yshift=1.5em]WebApp's UI.north) {WebApp};\n \\node (text2) [anchor=north] at ([xshift=5.5em, yshift=1.5em]QC's Controller.north) {QC};\n \\begin{pgfonlayer}{background}\n \\node[outer,fit=(WebApp's UI) (WebApp's Backend) (text1)] (A) {};\n \\node[outer,fit=(QC's Controller) (QC's Core) (text2)] (B) {};\n \\end{pgfonlayer}\n \\end{umlseqdiag}\n \\end{tikzpicture}\n }\n \\caption{Sequence diagram for Example~\\ref{ex:sos}. A user submits the value of integer $N$ for factorization via UI of a Web App, which passes $N$ to the WebApp's backend. At the backend where the value of $N$ is passed to, Shor's algorithm is implemented using, say QisKit library~\\cite{ibm_quantum}. The library translates QisKit code into OpenQASM and passes QASM listing to the Controller of a QC. The Controller, which initializes the QC Core based on the OpenQASM code, triggers its execution and measures the values of the qubits once execution ends. The Controller converts the measurements into the elements of $\\vec{L}$. These values are then returned to the Backend, UI, and, finally, the user. The sequence is depicted as synchronous, but can be made asynchronous if required by a use case. Note that the WebApp UI and Backend, as well as the QC Controller, are running on CCs. The QC Core represents the `true' QC. However, the QC Controller and the QC Core can be thought of as one QC system from practical perspective. The figure and example are adopted from~\\cite{miranskyy2019testing}.}\n \\label{fig:arch}\n\\end{figure*}\n\n\\begin{figure}[tbh]\n\\centering\n\\begin{minted}[xleftmargin = 4mm, fontsize = \\scriptsize, numbersep = 2mm, linenos = true]{python3}\nfrom qiskit import Aer\nfrom qiskit.aqua.algorithms import Shor\n\ndef factorize_integer(my_int):\n # Specify the backend\/QC,\n # which will be used for computations.\n # here, we pick a simulator rather than a live QC.\n backend = Aer.get_backend('qasm_simulator')\n # Factor the integer N, \n # a is a random integer that satisfies \n # a < N and gcd(a, N) = 1.\n algorithm = Shor(N = my_int, a = 2)\n result = algorithm.run(backend)\n return result['factors']\n\nint_to_factor = 15\nprint(f\"The factors for {int_to_factor} are \" \n f\"{factorize_integer(int_to_factor)}\")\n# Output:\n# The factors for 15 are [[3, 5]]\n\\end{minted}\n\n\\caption{Factor integer $N=15$ using Qiskit Aqua Python package. The code can be implemented as a one-liner, but we split it into multiple code lines to improve code comprehension.}\\label{fig:aqua_shor}\n\\end{figure}\n\n\\end{exmp}\n\n\n\nThe above example can be easily integrated into any existing SoS. For example, a microservice on a CC can be instantiated to make an asynchronous call to a QC backend offered as a managed Cloud service (such as the ones discussed in Section~\\ref{sec:timeline}). \n\nThe same approach will be readily applicable to rack-based or desktop-based QPU units when they become available. In this case, the backend will simply point to a local rather than a remote device.\n\n\n\\section{Quality Assurance}\\label{sec:qa}\nIn this section, we will look at various viewpoints on quality assurance. We start with a comparison of the white- and black-box testing in Section~\\ref{sec:wb_bb}. Then, we explore black-box testing focusing on using QC as a component in an SoS in Section~\\ref{sec:bb_sos}, followed by the black-box testing of the QC component itself, concentrating on verification and validation in Section~\\ref{sec:vv}. Finally, in Section~\\ref{sec:mapping}, we discuss mapping to test phases of the activities covered in Sections~\\ref{sec:wb_bb}--\\ref{sec:vv}.\n\n\\subsection{White- and black-box testing}\\label{sec:wb_bb}\n\nTwo widespread methods of testing are white- and black-box testing. The former method tests internal data structures and program flow. The latter method tests the functionality, ignoring the inner workings of the software, answering the following question: will we get an expected output for a given input?\n\nWe can perform all of the standard white-box activities on the code listing, such as code reviews and code inspections. We can build linting and code inspection tools similar to those available for CC languages and run them automatically in an IDE.\n\nHowever, interactive debugging (another popular white-box activity) is challenging by construction because a QC is a black-box. Based on the classical quantum mechanics, we cannot observe the inner working of a program (executed on a QC) without altering the program's state and the final result, as measuring a qubit destroys superposition~\\cite{kaye2007introduction}. \n\nThis implies that, currently, we cannot perform interactive debugging of a program running on a QC, as we have to stop the program and take the measurements. Having said that, we may be able to debug the code in a CC simulator\\footnote{For example, Microsoft Q\\#~\\cite{svore2018} provides language constructs to define facts and assertions, and take registry measurements that can be visualized in the Microsoft Visual Studio IDE~\\cite{ms_ide}. } if the CC is powerful enough to perform the computations. \n\nMoreover, suppose the QC program can be decomposed into modules, and a given module produces the measurable expected output. In that case, we can write xUnit test cases for this module that can be tested in a simulator~\\cite{svore2018} or on a real QC\\footnote{Given that most of QC architectures are noisy, we have to run the program multiple times and compute an expected value and the confidence interval for these measurements, which may require the creation of probabilistic test cases similar to~\\cite{DBLP:conf\/icse\/Honarvar0N20}. This comes at a cost~\\cite{miranskyy2019testing}, see Section~\\ref{sec:verification} for details.}. \nWe can even estimate the coverage that our test cases provide using input and output coverage criteria~\\cite{ali2021assessing}. Finally, we can apply clever tricks, such as separate qubits into subgroups and measure them individually to perform approximate measurements; we will discuss these tricks further in Section~\\ref{sec:debug_quantum}.\n\nYet, it is often easier to resort to black-box testing when dealing with a program running on an actual QC. Let us explore the black-box testing further.\n\n\\subsection{Black-box testing: component in an SoS}\\label{sec:bb_sos}\n\nAs we discussed in~\\cite{miranskyy2019testing} and reiterated in Section~\\ref{sec:usage}, we believe that for the foreseeable future, the QC will be used as a component in an SoS, where the code running on a CC will request to compute parts of the code on a QC component. Using a REST interface, we pass the request to the QC (residing in a public or private Cloud) and then get the response to our request via the same interface. The interface is abstracted and hidden in a library, e.g., QisKit, so that the programmer does not have to worry about the details of the interface.\n\nLet us revisit Example~\\ref{ex:sos}, which depicts this flow in a UML sequence diagram in Figure~\\ref{fig:arch}, where the app programmer's `visibility' stops at the WebApp's Backend level. An example of such backend code is given in Figure~\\ref{fig:aqua_shor}. The programmer interacts with the QC as with any generic Platform as a Service (PaaS) via an API (hidden in the QisKit library).\n\nIf we operate at this `granularity level', then we have the full power of existing SE tools at our disposal. For example, we can build UML diagrams to understand the relationship between components, interaction sequences, or system states. Note that we do not need to extend the UML notation at this level of granularity\\footnote{For the actual quantum code, UML extensions might be useful~\\cite{DBLP:conf\/icse\/Perez-DelgadoP20}.}: an architect\/designer with no specialized training in quantum computing can create such diagrams. These diagrams, along with the specifications and requirements for the SoS, can help a tester create test plans without any knowledge of the QC.\n\nWhen testers create automatic test cases, they can either use a simulator backend or, which may be even more efficient, use test doubles and replace calls to the QC with mocks or stubs~\\cite{meszaros2007xunit}. For example, going back to the code in Figure~\\ref{fig:aqua_shor}, as QisKit is written in Python, we can use our favourite Python Mock library (e.g., a built-in library unittest.mock~\\cite{unittest43}) to create test-doubles for the calls to the QC on lines 8, 12, and 13. Alternatively, we can generate a test-double for the whole function \\texttt{factorize\\_integer}.\n\nThe difficulty of creating the unit test may depend on the type of output returned by the QC. Let us explore this further.\n\n\n\\subsection{Black-box testing: verification and validation}\\label{sec:vv}\n\nWhen testing the programs, how can we ensure that our code follows the design document and that the QC is doing what it is supposed to do? And even if our code reflects the design, how can we make certain that the output of the program delivers what a user needs? The former will be discussed in Section~\\ref{sec:verification}, the latter --- in Section~\\ref{sec:validation}. We will conclude with examples of code validation in Sections~\\ref{sec:val_p} and~\\ref{sec:val_super-p}.\n\n\\subsubsection{Verification}\\label{sec:verification}\n\nAs discussed in Section~\\ref{sec:wb_bb}, we can apply the full spectra of verification techniques on the code listings, but verification of a running program on an actual QC is more challenging, as we cannot properly use interactive debugger. To verify the correctness, we can try to run and debug our program in a local or online simulator, such as~\\cite{ibm_quantum,ms_quantum}. However, as the simulators run on CC, we will have to limit the complexity of our test cases to obtain results within a reasonable amount of time. This will help us to eliminate some of the defects (a taxonomy of QC bugs is being developed~\\cite{huang2018qdb}), but does not guarantee that no other defects will be encountered while solving production-scale problems. The same issue, conceptually, arises with CCs too, e.g., when dealing with buffer-overrun- and resource-leak-related defects.\n\nThe above test assumes that a simulator correctly and accurately resembles the actual QC, which is not always the case. Thus, a more definitive verification of correctness should be done on the the actual QC. Given the probabilistic nature of QC, we may have to execute the same code multiple times to increase the accuracy of our answer using Chernoff bound~\\cite{nielsen_chuang_2010} (which is similar to probabilistic algorithms in $\\BPP$ class running on CC~\\cite{nielsen_chuang_2010}). This repeating functionality is built into packages like QisKit, but it requires a higher amount of computing resources (proportional to the number of repetitions).\n\n\nThe above approach assumes that the QC hardware, its operating system, and the compiler\/translator of our program are running correctly, which is not always the case. To verify their correctness, we may need to execute the same program on multiple QCs (preferably from different manufacturers) and compare the results. If results differ significantly --- it may be a sign that there is an issue with one or more QCs under test. This is akin to correctness testing of a database engine by running the same query against different database engines~\\cite{cialini2007method}.\n\nAn award-winning protocol, verifying QC computations with the help of a CC has been proposed~\\cite{mahadev_2018}. It requires a significant amount of computational resources and, probably, will not be implemented shortly. However, as the computing power of QCs will increase, this protocol will become implementable in practice.\n\nFinally, even if all of the above tests pass, it does not guarantee that the actual results returned by the QC are correct. This is where validation comes into play.\n\n\\subsubsection{Validation}\\label{sec:validation}\n\nWhen doing the validation, we need to make sure that the output of the algorithm satisfies the conditions provided in the requirements document (assuming that requirements were captured correctly). In other words, validation of a program running on a QC is similar to that of a program executed by a CC. Essentially, the ease of validation will depend on the difficulty of implementing a program for validating the results and the time needed\\footnote{As discussed in Section~\\ref{sec:applicability_theory}, many problems in $\\BQP$ are solved efficiently on a QC, but are challenging to solve on a CC. However, the time needed to solve a problem is independent of the time needed to validate this solution.} to execute the validation. \n\nBefore implementing a program, we need to estimate how long the validation process would take. To do so, we can resort to complexity analysis. Say, if the execution time of the validation\\footnote{In the algorithm-related literature, the term verification rather than validation is used. We will use the term validation for consistency with the name of this section.} program would belong to $O(1)$, the validation process (given that it is easy to code up) would be straightforward. However, if the execution time would belong, say, to $O(n!)$, where $n$ would be proportionate to the length of input into the validation process (and to the length of the solution), then the validation process for a significantly large $n$ would be formidable. \n\nFor simplicity, we can split the complexity of validation into two classes: polynomial time $\\P$ bounded by $O(n^k)$ (i.e., validation time is bounded above asymptotically by $n^k$, where $k>0$) and super-polynomial time $\\P^\\C$, which is complementary to $\\P$, bounded by $\\omega(n^k)$ (i.e., validation time dominates asymptotically the $n^k$). We will look at examples of the algorithms belonging to these classes in subsections below.\n\nWhere should we implement the validation program: on a CC or a QC? In the program belongs to $\\P$ class, it can be implemented on either one, as $\\P \\subseteq \\BQP$. However, as discussed in Section~\\ref{sec:usage}, it is challenging to program a QC as we are dealing with low-level programming language. Moreover, the cost of running a QC in comparison with a CC is high. Thus, it is simpler and more economically feasible to implement a validation program on a CC, if possible.\n\nIn the case of $\\P^\\C$ class, the answer is less straightforward. If the size of the input into validation program is small, we may be able to still leverage a CC (especially if we can parallelize the validation on a CC cluster). However, we may have to resort to a QC for larger problems. If the validation program belongs to classes which are a subset of $\\BQP$, such as $\\BPP$ class, then QC is a good match. However, if the validation belongs to a `harder' class, such as $\\NP$-complete, then QC may also fail to deliver timely results. In this case, we may have to resort to a heuristic that tries to roughly validate the solution, but does not guarantee that solution is correct.\n\nLet us look at examples of algorithms from both classes and ways to run the validation.\n\n\\subsubsection{Validation: Polynomial $\\left( \\P \\right)$}\\label{sec:val_p}\n\n\\begin{exmp}\\label{ex:shor}\nShor's integer factoring algorithm (which we used in Example~\\ref{ex:sos}) takes integer $N$ as input and returns a vector of prime factors $\\vec{L}$ for $N$~\\cite{shor1997}. The solution runs on a QC in polynomial time, $O((\\log N)^2 (\\log \\log N) (\\log\\log\\log N) )$ to be specific~\\cite{shor1997}. The validation complexity is independent of the solution complexity, growing linearly with the number of elements in $\\vec{L}$, deemed $l$, as we simply need to multiply the elements in $\\vec{L}$ to do the validation. That is, the complexity of validation of Shor's algorithm is $O(l)$. Thus, we can easily\\footnote{Although we may have to leverage existing libraries for multiplication of integers with arbitrary precision, such as Java's BigInteger~\\cite{BigInteg48}.} perform validation on a CC. \n\\end{exmp}\n\n\\begin{exmp}\nGrover's algorithm~\\cite{grover1996fast} takes an unsorted list of $M$ items, out of which there is one item with a unique property (e.g., a unique value) that we would like to retrieve. The algorithm returns the index $i$ of this item of interest. Its complexity on a QC is $O(\\sqrt{M})$, while complexity of the fastest solution running on a CC is $O(M)$~\\cite{grover1996fast}. Suppose that the item is retrieved at $i$; then the time complexity of validation of Grover's algorithm is $O(1)$, because we only need to perform one evaluation of the item at $i$. This can be easily done on a CC. \n\\end{exmp}\n\nTechnically, validation of the two algorithms can all be carried out on a QC. But this is economically inferior, as discussed above.\n\n\\subsubsection{Validation: Super-polynomial $\\left( \\P^\\C \\right)$}\\label{sec:val_super-p}\n\n\\begin{exmp}\nBoson sampling is a good example of a problem that is challenging to validate. Yet, the algorithm is crucial\\footnote{It may lead to the implementation of a non-universal QC, which will still be more efficient than CC for some tasks, see~\\cite{aaronson2011} for details.}. Experimentally, the algorithm is typically implemented using photons (belonging to the family of boson particles~\\cite{nielsen_chuang_2010}). To implement the algorithm, we need a linear-optical circuit with $m$ modes that is injected with $h$ individual photons ($m>h$)~\\cite{giordani_experimental_2018}. In this implementation, the boson sampling task reduces to creating a sample from the probability distribution of individual photon measurements at the circuit's output. \n\nThis algorithm cannot be computed on a CC for large values of $m$ and $h$, as it requires computing a permanent of a matrix which is a $\\#\\P$-hard problem~\\cite{aaronson2011,valiant1979}. At best, it requires $O(h 2^h + mh^2)$ operations~\\cite{clifford2018}.\n\nHowever, the problem does fall~\\cite{aaronson2011} into $\\PostBQP$ class ($\\BQP$ class with post-selection), which can be efficiently computed on a QC. Validation of the results on a CC is also a $\\#\\P$-hard problem, as we again need to compute the permanent of a matrix. However, one may adopt a heuristic to estimate goodness of findings (essentially, performing approximate validation) using machine learning approach~\\cite{giordani_experimental_2018}.\n\\end{exmp}\n\n\\begin{exmp}\\label{ex:gauss}\nThe second example is estimating Gauss sums. The classical algorithm for estimating Gauss sums on CCs (for polynomials of degree $\\geq 3$) belong to the $\\#\\P$-hard class~\\cite{cai10}. However, QCs can estimate Gauss sums to polynomial precision in polynomial time~\\cite{van2002efficient}. To validate the Gauss sums on a CC, we need to take the same inputs and compute the Gauss sum, which, as we know, is a $\\#\\P$-hard problem. Hypothetically, one may invent an approximate validation heuristic (like in the boson sampling case discussed above); to the best of our knowledge, none exist at the time of writing. \n\\end{exmp}\n\nIn the above examples, to perform an accurate validation, we need to do it on a QC. Ideally, this should be done on a different QC to simultaneously check the correctness of the computer itself (as was discussed in Section~\\ref{sec:verification}). The code of the validation software would be similar to the one of the solution software. Thus, if resources permit, one may want to create the validation code from scratch (rather than reusing the existing code from the solution) to avoid migration of the defects from the solution code into the validation code.\n\n\\subsection{Mapping of activities to test phases}\\label{sec:mapping}\n\nLet us now discuss which testing phases we can apply to a QC. Techniques for some of the later test phases are readily transferable from the CC domain. For example, the performance quality assurance team can time the execution of the software on a QC to detect performance degradation during the performance testing phase. Another example is users helping to uncover defects by reporting failures during one of the acceptance test phases (say, beta testing).\n\nIf we treat a QC as a black-box component in an SoS, based on the discussion in Section~\\ref{sec:bb_sos}, the situation is straightforward. We can perform integration testing of a QC component and then see how it behaves in the SoS during the execution of a test scenario during system testing. Given that the QC component is black-box, the testing will be no different from the testing incorporation of yet another PaaS component into the SoS.\n\nHowever, dealing with testing the QC component itself is more convoluted. Let us explore three core testing phases: unit testing (UT), functional testing (FT), and system testing (ST). \n\nUnit tests in the CC domain can leverage black- and white-box testing. Here, we can use the techniques discussed in Section~\\ref{sec:wb_bb}. For the white-box testing, we may be able to debug parts of the QC program on a simulator or a QC. For the black-box (or grey-box) unit testing, we can create test cases for the modules that return a measurable value. \n\nWhat about FT? As we discussed in Section~\\ref{sec:vision}, QC machines are targeting STEM-oriented problems with relatively simple inputs and outputs (for concrete cases revisit Examples~\\ref{ex:shor}--\\ref{ex:gauss}). \nThus, the problems, which algorithms on QC are trying to solve, are self-contained. In other words, an algorithm implemented on QC represents a piece of functionality. Unit testing typically focuses on individual units\/modules of code, where a combination of these modules yields a piece of functionality. FT, on the other hand, tests a particular piece of functionality. This implies that when we perform black-box testing (i.e., checking the correctness of output for a given input) on a program that implemented such an algorithm on a QC, we are doing FT rather than UT. That is, if we are to test expected output of function \\texttt{factorize\\_integer} in Figure~\\ref{fig:aqua_shor}, we may classify this test as FT rather than UT.\n\nWhat about ST? There exists a number of (sometimes conflicting) definitions of FT and ST. Let us adopt the definition that FT `verifies a program by checking it against ... design document(s) or specification(s)' while ST `validate[s] a program by checking it against the published user or system requirements'~\\cite[p. 52]{kaner1999testing}. In the case of usage QC component in SoS, QC output can be tested in isolation to check it against design and specs, hence the FT. Then we can perform inegration testing and then execute QC component in a test workload as part of ST efforts.\n\nWhat if running QC component standalone (akin to Figure~\\ref{fig:aqua_shor}) is all that is required? This is not uncommon for STEM use-cases, where we often would like to compute and save a value. In that case, the boundary between FT and ST blurs. We may argue that we are doing ST (of a small system) rather than FT, as we are mainly checking the correctness based on requirements. For example, if we are to implement Shor's integer factorization algorithm on a QC, the requirement would be as follows. `Given a composite number $N$ as input, the algorithm should output a vector of integers $\\vec{L}$ (with the integers strictly between $1$ and $N$), such that the product of these integers is equal to $N$.' To check the correctness of our implementation of Shor's algorithm, we will multiply the returned integers and compare the resulting product against $N$, thus validating our implementation of the algorithm. Note that we resort to a requirements document rather than a design document to check correctness, thus performing the ST rather than the FT. We can also perform verification, hence the FT, by checking the reproducibility of the results.\n\n\n\\section{Debugging Tactics}\\label{sec:traditional}\nDebugging is a process of removing an error, once this error has been exposed and is often a consequence of successful testing practices~\\cite{pressman2014software} (some of which we discussed above). While we hope that one day debugging will become an orderly and automated process (e.g., by automatically mapping bug reports to code where the defect resides, and then issuing a patch for this code~\\cite{TufanoPWBP19}), currently it is an art more than a science~\\cite{pressman2014software}. \n\nThe high-level tactics~\\cite[Chapter 8]{myers2011art} for debugging a software had not changed significantly over the last 42 years (when the first edition of the seminal work~\\cite{myers2011art} was published), although integrated development environments and various automation tools have streamlined a lot of mundane tasks~\\cite{zeller09debugging, MargineanBCH0MM19}. The three common tactics~\\cite{myers2011art,pressman2014software} are backtracking, cause elimination, and brute force, discussed below.\n\n\\textit{Backtracking} debugging centers around examining the execution tree from the point of the error until a perpetrating code block is found. The analysis techniques for a code listing (such as code reviews and inspections) of a CC program can be readily applied to a QC program~\\cite{miranskyy2019testing}. Thus, these tactics are transferable. Anecdotally, based on discussions with practitioners, code reviews and inspections are the most popular debugging techniques of quantum programs nowadays.\n\n\\textit{Cause elimination} debugging formulates a hypothesis (using inductive or deductive reasoning), specifying a root cause for a bug under study. Then, data are devised, and experiments are conducted to refute or prove this hypothesis. This approach can be applied to QC. Given the probabilistic nature of the QC programs~\\cite{nielsen_chuang_2010, miranskyy2019testing}, we will have to execute the program multiple times to obtain a distribution of the results and assess the accuracy of the answer. Thus, we may be able to extend the techniques used for testing probabilistic programs running on CC, such as~\\cite{DuttaLHM18, DuttaZHM19}, to the QC domain. Such techniques already start to appear~\\cite{huang2019statistical,DBLP:journals\/pacmpl\/LiZYDY020,DBLP:conf\/icse\/Honarvar0N20}.\n\n\\textit{Brute force} debugging --- centred around the analysis of runtime traces, memory dumps, and output statements --- focuses on runtime data analysis. Of the three tactics, this is the most common one~\\cite{pressman2014software}. Some of the analyses of the runtime artifacts can be automated; however, a lot of the brute force debugging is still performed manually~\\cite{pressman2014software}. Can we transfer these tactics? \n\nIf we treat a QC program as a black-box, then the short answer is `yes'. As discussed in Sections~\\ref{sec:usage} and \\ref{sec:bb_sos}, if a QC program will be used as part of an SoS, then we can trace the input (passed from the CC component to the QC component) and the output (from the QC component to the CC component). The input and output data can be recorded in a log, and these data can be compared against the expected values. \n\nBut what if we would like to analyze a QC program at runtime using a white-box approach, e.g., to capture the execution trace of a QC program or perform interactive debugging of the code executed on the QC? In such a case, the short answer is `it depends'~\\cite{DBLP:conf\/icse\/Miranskyy0D20}. Before we delve into the answers, let us compare and formally define classic and quantum models of computation, which will help us understand the issues with debugging quantum programs.\n\n\n\\section{Quantum Computation}\\label{sec:quant_comp}\n\n\nIn this section, we review the basic concepts of quantum computation and set up the conventions and notions that are used in the rest of the paper.\n\n\\subsection{The classical model of computation}\n\\label{sec:cls-cmm-model}\n\nClassical computation can be modeled using the language of circuits. Abstractly, a circuit is a network of gates and wires: the wires transmit bits to gates, the gates perform elementary operations on the input bits, and the results of these operations are again bits that are carried by wires. Figure \\ref{fig:cls-crct} shows a schematic example of a classical circuit. \n\n\\begin{figure}[ht]\n \\centering\n \\begin{quantikz}[row sep = {0.8cm,between origins}]\n \\lstick{$x_0$} & \\ctrl{1} & \\gate{G_2} & \\gate[wires = 2]{G_3} & \\qw & \\qw \\\\\n \\lstick{$x_1$} & \\gate[wires = 2]{G_1} & \\qw & & \\gate{G_5} & \\qw \\\\\n \\lstick{$x_2$} & & \\qw & \\gate{G_4} & \\octrl{-1}\n \\end{quantikz}\n \\caption{A classical circuit.}\n \\label{fig:cls-crct}\n\\end{figure}\n\nAn important concept regarding the circuit model of computation is \\textit{universality}. A set $G$ of gate are said to be universal if given any function $f: \\{0, 1\\}^m \\rightarrow \\{0, 1\\}^n$, where $m$ and $n$ are positive integers, a circuit for $f$ can be constructed using only gates from $G$. For example the set of gates $G = \\{\\textsc{and, not}\\}$ and $G = \\{\\textsc{nand, fanout}\\}$ are universal. Classical computation is generally not reversible. A computation is reversible if for every output it is always possible to uniquely recover the corresponding input. Every classical computation, however, can be made reversible. To do this, one needs to replace every gate in a given circuit with its reversible version. This in turn can be done by constructing the reversible version of the gates in a universal set. \n\nFor example, the set $\\{\\textsc{nand, not}\\}$ is universal. The gate $\\textsc{not}$ is already reversible. The gate $\\textsc{nand}$ can be made reversible by adding an additional input and two additional outputs. This is known as Toffoli gate~\\cite{DBLP:conf\/icalp\/Toffoli80}, \\cite[Section 1.4.1]{nielsen_chuang_2010}. The two new outputs keep a copy of the original inputs, see Figure \\ref{fig:rev-and}.\n\n\\begin{figure}[ht]\n \\centering\n \\begin{quantikz}[row sep = {0.4cm,between origins}]\n \\lstick{$x_0$} & \\gate[wires = 2]{\\textsc{nand}} \\\\\n \\lstick{$x_1$} & & \\qw\\rstick{$\\neg (x_0 \\wedge x_1)$} \\\\ [3mm]\n \\lstick{$x_0$} & \\gate[wires = 3]{\\textsc{nand}} & \\qw\\rstick{$x_0$} \\\\\n \\lstick{$x_1$} & & \\qw\\rstick{$x_1$} \\\\\n \\lstick{$1 \\rightarrow x_2$} & & \\qw\\rstick{$1 \\oplus (x_0 \\wedge x_1) = \\neg (x_0 \\wedge x_1)$}\n \\end{quantikz}\n \\caption{Irreversible (top) to reversible (bottom) \\textsc{nand} gate, where $\\neg$ denotes negation, $\\oplus$ denotes Boolean operator \\textsc{xor}, and $\\wedge$ denotes Boolean operator \\textsc{and}. The reversible gate is implemented using a particular setup of the Toffoli gate: the first two bits are control bits; the third one is a target bit, its input is always set to $1$.}\n \\label{fig:rev-and}\n\\end{figure}\n\nNote that any reversible gate has the same number of inputs and output bits~\\cite{DBLP:conf\/icalp\/Toffoli80}. This means that any reversible circuit has the same number of input and output bits. A bit is usually denoted by a two-dimensional column vector: $[1, 0]^T$ for the bit $0$ and $[0, 1]^T$ for the bit $1$. This notation is used so that one can describe the probabilistic model of computation as well. Encoding bits using vectors leads to the natural representation of gates as linear operators. More concretely, any gate can be represented as a matrix. For example, the \\textsc{not} gate is the following matrix\n\\begin{equation}\n \\label{equ:not}\n \\textsc{not} = \\begin{bmatrix} 0 & 1 \\\\ 1 & 0 \\end{bmatrix},\n\\end{equation}\nwhich flips $0$ to $1$ and vice versa:\n\\begin{equation*}\n \\textsc{not} \\begin{bmatrix} 0 \\\\ 1 \\end{bmatrix} = \\begin{bmatrix} 1 \\\\ 0 \\end{bmatrix}, \\quad \\textsc{not} \\begin{bmatrix} 1 \\\\ 0 \\end{bmatrix} = \\begin{bmatrix} 0 \\\\ 1 \\end{bmatrix}.\n\\end{equation*}\nTherefore, any circuit can be represented as a matrix that operates on the input bits as a vector and produces the output bits as vector. This formulation of the circuit model of computation proves useful for the quantum model of computation as well. \n\n\n\\subsection{The quantum model of computation}\n\n\n\\subsubsection{The Dirac notation}\n\nThe mathematical formulation of quantum computing is based on that of quantum mechanics. The main mathematical objects used in quantum mechanics are complex Euclidean spaces. These are vector spaces over the complex numbers called Hilbert spaces. For quantum computing we only deal with finite dimensional Euclidean spaces. A complex Euclidean space of dimension $n$ is denoted by $\\mathbb{C}^n$ where $\\mathbb{C}$ is the set of complex numbers and the exponent $n$ means Cartesian product $n$ times. \n\nAn element of $\\mathbb{C}^n$ is called a vector and is usually denoted by an arrow over a letter, for example $\\vec{x}$. In quantum mechanics, however, a vector is denoted by $\\ket{x}$, and its adjoint is denoted by $\\bra{x}$. This is called the Dirac notation, which we will also use in this paper. The standard basis of $\\mathbb{C}^n$ is denoted by $\\ket{0}, \\ket{1}, \\dots, \\ket{n - 1}$, every vector is a unique linear combination of these vectors, i.e., $\\ket{a} = a_0\\ket{0} + \\cdots + a_{n - 1}\\ket{n - 1}$, where $a_i \\in \\mathbb{C}$ for all $i$. If $n$ is a power of two, say $n = 2^k$, then basis vectors are written using binary strings of length $k$: $\\ket{00 \\dots 00}, \\ket{00 \\dots 01}, \\dots, \\ket{11 \\dots 10}, \\ket{11 \\dots 11}$. This basis is usually referred to as the \\textit{computational basis}. \n\nOther equivalent notations for a basis vector $\\ket{b_1, \\dots, b_n}$ in the computational basis are $\\ket{b_1} \\ket{b_2} \\cdots \\ket{b_n}$ or $\\ket{b_1} \\otimes \\ket{b_2} \\otimes \\cdots \\otimes \\ket{b_n}$, where $\\otimes$ is the tensor product operation. Tensor product is an operation that combines two spaces together. For example if $\\{ \\ket{a_i} \\}_{1 \\le i \\le m}$ is a basis for the space $\\mathbb{C}^m$ and $\\{ \\ket{b_j}_{1 \\le j \\le n} \\}$ is a basis for the space $\\mathbb{C}^n$ then $\\{ \\ket{a_i} \\otimes \\ket{b_j} \\}_{1 \\le i \\le m, 1 \\le j \\le n}$ is a basis for the space $\\mathbb{C}^m \\otimes \\mathbb{C}^n$.\n\n\n\n\\subsubsection{Qubits and quantum mechanics}\n\nIn the following, we briefly review the four postulates of quantum mechanics that form the conceptual foundations of quantum computing; see~\\cite{kaye2007introduction,nielsen_chuang_2010} for additional details.\n\nWe start with the \\textit{State Space Postulate}, which says that the state space of a 1-qubit quantum system is described by the set of unit vectors in $\\mathbb{C}^2$. Therefore, in the computational basis, a qubit is described by a linear combination $\\ket{\\psi} = \\alpha \\ket{0} + \\beta \\ket{1}$ where $\\abs{\\alpha}^2 + \\abs{\\beta}^2 = 1$. We refer to $\\ket{\\psi}$ as a quantum state, in this case the state of a 1-qubit system. We also say that $\\ket{\\psi}$ is a \\textit{superposition} of the states $\\ket{0}$ and $\\ket{1}$. The \\textit{Composition of Systems Postulate} states that the combined system of two quantum systems is described by the tensor product of the corresponding state spaces. More precisely, if two quantum systems have state spaces $H_1$ and $H_2$ then the composite system has states space $H_1 \\otimes H_2$. This means that, for example, a $2$-qubit system is described by the superposition of the basis states $\\ket{00}, \\ket{01}, \\ket{10}, \\ket{11}$. More generally, the state of an $n$-qubit system can be written as the superposition\n\\begin{equation}\n \\label{equ:superpos}\n \\ket{\\psi} = \\sum_{x \\in \\{ 0, 1 \\}^n} \\alpha_x \\ket{x}\n\\end{equation}\nof basis states, where $\\alpha_x \\in \\mathbb{C}$ and $\\sum_{x \\in \\{ 0, 1 \\}^n} \\abs{\\alpha_x}^2 = 1$. The quantum state of a system can evolve, over time, to another quantum state. \n\nThe \\textit{Evolution Postulate} says that the state of a closed quantum systems evolves according to unitary operators. This means for any evolution of a system from a state $\\ket{\\psi_1}$ to a state $\\ket{\\psi_2}$ there exists a unitary operator $U$ such that $U \\ket{\\psi_1} = \\ket{\\psi_2}$. An operator is called unitary if $U^* \\, U = I$, where $U^*$ is the adjoint of $U$, and $I$ is the identity operators. If we fix a basis for the state space of the quantum system, an operator is represented by a unique matrix. In that case, the adjoint of an operator is the conjugate-transpose of the corresponding matrix. As explained in the previous section, the evolution of classical systems can also be described by matrices. Therefore, loosely speaking, quantum operations can be thought of as a generalization of classical operations that act on continuous state spaces. A $1$-qubit operator is represented by a $2 \\times 2$ matrix acting on the space $\\mathbb{C}^2$. For example, for the computational basis, the unitary operator that takes the qubit $\\alpha\\ket{0} + \\beta\\ket{1}$ to $\\alpha\\ket{1} + \\beta\\ket{0}$ and vice versa, is the \\textsc{not} operation in \\eqref{equ:not}. Another example is given by a set of well-known $1$-qubit operators deemed the Pauli operators:\n\\begin{equation}\n \\label{eq:pauli}\n \\sigma_0 = \\begin{bmatrix} 1 & 0 \\\\ 0 & 1 \\end{bmatrix}, \\; \\sigma_1 = \\begin{bmatrix} 0 & 1 \\\\ 1 & 0 \\end{bmatrix}, \\; \\sigma_2 = \\begin{bmatrix} 0 & -i \\\\ i & 0 \\end{bmatrix}, \\; \\sigma_3 = \\begin{bmatrix} 1 & 0 \\\\ 0 & -1 \\end{bmatrix}.\n\\end{equation}\nNote that $\\textsc{not} = \\sigma_1$.\n\nAccording to the \\textit{Measurement Postulate}, quantum measurement on a system $A$ is described by a set of measurement operators which act on the state space of A. The state of the system and the probability of being in that state after the measurement depends on the measurement operators. A concrete example of quantum measurement is the von Neumann measurement with respect to the computational basis: given the state $\\ket{\\psi}$ in \\eqref{equ:superpos}, performing a von Neumann measurement with respect to the basis $\\{ \\ket{x} \\}$ outputs $y$ with probability $\\abs{\\alpha_y}^2$, and the state of the system after the measurement is $\\ket{y}$. In general, performing a measure produces some classical information and leaves the system in a (possibly) new quantum state.\n\n\n\n\\subsubsection{The quantum circuit model}\n\nAs explained in Section \\ref{sec:cls-cmm-model}, any classical circuit can be efficiently converted to a reversible circuit. The reversible model of computation can naturally be generalized to a model of quantum computation. The quantum circuit model is similar to the reversible circuit model with bits and gates replaced by qubits and quantum gates: wires carry qubits to quantum gates, the gates perform quantum operations on the input qubits, and the resulting qubits are again carried by wires. Figure \\ref{fig:qtm-crct} shows a schematic example of a quantum circuit.\n\n\\begin{figure}[ht]\n \\centering\n \\begin{quantikz}[row sep = {0.8cm,between origins}]\n \\lstick{$q_0$} & \\gate{G_1} & \\qw & \\qw & \\gate[wires = 2]{G_5} & \\qw \\\\\n \\lstick{$q_1$} & \\ctrl{-1} & \\gate[wires = 2]{G_3} & \\gate{G_4} & & \\qw \\\\\n \\lstick{$q_2$} & \\gate{G_2} & & \\meter{} & \\qw & \\qw\n \\end{quantikz}\n \\caption{A quantum circuit.}\n \\label{fig:qtm-crct}\n\\end{figure}\n\nNote that since quantum gates represent unitary operations, the number of input wires to a quantum circuit is the same as the number of output wires. This is not the case for classical circuits. As mentioned above, a $1$-qubit operator is a unitary operator that acts on the $2$-dimensional $\\mathbb{C}^2$. Such an operator is called a $1$-qubit gate. When used as quantum gates, the Pauli operators $\\sigma_0, \\sigma_1, \\sigma_2, \\sigma_3$, defined in~\\eqref{eq:pauli}, are denoted by $I, X, Y, Z$, respectively. The gate $X$ is quantum \\textsc{not} gate. Just like classical gates, quantum gates can have \\textit{control} inputs. For example, the control-\\textsc{not} (\\textsc{cnot}) gate acts on a $2$-qubits state as $\\ket{a}\\ket{b} \\mapsto \\ket{a}\\ket{a \\oplus b}$, where $\\oplus$ is the \\textsc{xor} operation. Here, the first qubit is the control qubit, based on the value of which a \\textsc{not} gate is applied to the second qubit. Since \\textsc{cnot} acts on $\\mathbb{C}^4$, it is represented by a $4 \\times 4$ matrix which, with respect to the computational basis, is\n\\[\n\\textsc{cnot} =\n\\begin{bmatrix}\n 1 & 0 & 0 & 0 \\\\\n 0 & 1 & 0 & 0 \\\\\n 0 & 0 & 0 & 1 \\\\\n 0 & 0 & 1 & 0\n\\end{bmatrix}.\n\\]\nThe measurement gate is usually depicted by a meter where the input is a quantum state and the output is classical information (and a post-measurement quantum state).\n\\begin{center}\n \\begin{quantikz}\n \\lstick{quantum state} & \\meter{} & \\qw\\rstick{classical information}\n \\end{quantikz}\n\\end{center}\n\nThe concept of universality can be generalized to quantum computation. A fundamental difference with the classical case is that the set of unitary operations is not discrete, hence a discrete set of quantum gates cannot be used to implement arbitrary unitary operations exactly. \n\nA set $G$ of quantum gates is called universal if any unitary operation can be approximated to arbitrary accuracy by quantum circuits involving only gates from $G$. It can be proved~\\cite[Section 4.3]{kaye2007introduction} that the set $\\{H, T\\}$, where $H$ and $T$ are the Hadamard gate and the $\\frac{\\pi}{8}$-gate defined by\n\\[ H = \\frac{1}{\\sqrt{2}}\\begin{bmatrix} 1 & 1 \\\\ 1 & -1 \\end{bmatrix}, \\quad T = \\begin{bmatrix} 1 & 0 \\\\ 0 & e^{i\\pi \/ 8} \\end{bmatrix}, \\]\nis universal for $1$-qubit gates. It means that any $1$-qubit gate can be arbitrarily approximated by circuits involving only $H$ and $T$. If we add \\textsc{cnot} to the above set, we obtain the universal set of gates $G = \\{\\textsc{cnot}, H, T\\}$ for quantum computation~\\cite[Section 4.3]{kaye2007introduction}.\n\n\n\\section{Debugging Quantum Programs}\\label{sec:debug_quantum}\n\nA quantum program executed on a modern gate-based QC leverages a register of qubits for performing quantum operations and a register of classic bits for recording the measurements of qubits' states and conditionally applying quantum operators~\\cite{cross2017open}. Thus, a typical QC program mixes traditional instructions (to alter the state of bits and apply conditional statements) and quantum instructions (to alter the state of qubits and to measure qubit value).\n\nAs mentioned above, a general quantum program consists of blocks of code each containing classical and quantum instructions. \nQuantum operations can be divided into two kinds: unitary and non-unitary. Unitary operations are \nreversible and preserve the norm of the operands. Non-unitary operations are not reversible and have \nprobabilistic implementations. \n\nThe classical parts of a quantum program can be debugged using traditional methods. The quantum parts, \nhowever, can not be treated in the same way because of the properties of a QC~--- such as superposition, \nentanglement, and no-cloning~--- which are governed by the laws of quantum mechanics. The purpose of \ndebugging a program is to present the user with human readable, i.e., classical, information about \nthe runtime state of the system. Extracting classical information from a quantum state is done using \nmeasurement which is non-unitary and results in collapse of the state, and hence \nan unintended behavior of the program. We shall describe, in the following, different scenarios in a \nQC to which classical debugging techniques cannot be applied, and discuss some potential solutions.\n\n\n\\subsection{Superposition}\\label{sec:superposition}\n\nLet $\\ket{\\psi}$ be the state of an $n$-qubit register. Then we can uniquely write $\\ket{\\psi}$ using a superpostion in the computational basis as in \\eqref{equ:superpos}. By \nthe measurement postulate of quantum mechanics, measuring the state $\\ket{\\psi}$ in the \ncomputational basis results in an outcome $x \\in \\{ 0, 1 \\}^n$ with probability $\\abs{\\alpha_x}^2$, \nand the state of the system after the measurement is $\\ket{x}$. For example, consider the initial state\n$\\ket{010}$ and perform the following steps: first apply a Hadamard transform to each qubit (creating superposition), then\na controlled-not \\textsc{cnot} to qubits 2 and 3, and finally measure qubit 3. If the measured qubit is $0$ \n(which happens with probability $1\/2$), then the state collapses to $\\frac{1}{2}(\\ket{00} - \\ket{01} \n+ \\ket{10} - \\ket{11})$. An implementation of this example in OpenQASM 2.0 is shown in Figure \\ref{fig:spp}.\n\n\\begin{figure}[ht]\n\t\\centering\n\t\\begin{subfigure}[b]{0.25\\columnwidth}\n\t\t\\centering\n\t\t\\includegraphics[width = \\textwidth]{sup_coll_circuit.pdf}\n\t\t\\caption{Circuit}\n\t\t\\label{fig:spp-circ}\n\t\\end{subfigure}\n\t%\n\t\\hspace*{1cm}\n\t%\n\t\\begin{subfigure}[b]{0.25\\columnwidth}\n\t\t\\centering\n\t\t\\begin{minted}[fontsize = \\footnotesize, numbersep = 2mm, linenos = true, autogobble]{cpp}\n OPENQASM 2.0;\n include \"qelib1.inc\";\n \n qreg q[3];\n creg c[1];\n \n x q[1];\n h q[0];\n h q[1];\n h q[2];\n cx q[1],q[2];\n measure q[2] -> c[0];\n \\end{minted}\n \\vspace{-4mm}\n\t\t\\caption{Assembly code}\n\t\t\\label{fig:spp-code}\n\t\\end{subfigure}\n\t\\caption{Example of measuring a superposition. In OpenQASM, \\textsc{not} is denoted by $x$, Hadamard by $h$, and \\textsc{cnot} by $cx$. }\n\t\\label{fig:spp}\n\\end{figure}\n\nA natural feature of a debugger for quantum programs would be to check if the state \nof a variable is in superposition. There are two possible scenarios: when the input state is unknown (e.g., when it is generated as an output of another quantum program) and when the input state is known. Let us elaborate on each of these cases.\n\n\\subsubsection{Unknown input state.}\\label{sec:unknown-inp}\nIf the input to the program is an unknown state $\\ket{\\psi}$, then there is no known general \nalgorithm that can efficiently decide if $\\ket{\\psi}$ is in a superposition. \nNot much can be done here in terms of a general method for debugging, \ndifferent approaches should be considered for different problems.\n\nFor example, in the hidden subgroup problem \\cite[Chapter 7]{kaye2007introduction}, if the group is abelian, then it can be efficiently \ndecided if the coset state of a subgroup is in superposition. For non-abelian groups, however, the same problem is often hard. For example, \nthe best known algorithm for the following problem has subexponential runtime \\cite{kuperberg2005subexponential}: let $N$ be a positive \ninteger, and let $\\mathbb{Z}_N$ be the group of integers mod $N$. For a random unknown $x \\in \\mathbb{Z}_N$ and fixed unknown \n$d \\in \\mathbb{Z}_N$, decide whether a given state is of the form $\\ket{b}\\ket{x}$ or $\\frac{1}{\\sqrt{2}}(\\ket{0}\\ket{x} + \\ket{1}\\ket{x + d})$, where $b \\in \\{0, 1\\}$.\n\n\\subsubsection{Known input state.}\\label{sec:known-inp}\nIf a state is the result of applying a known unitary operation to a known initial state, i.e., \n$\\ket{\\psi} = U \\ket{\\psi_0}$ where $\\ket{\\psi_0}$ and $U$ are both known, then $\\ket{\\psi}$ can be regenerated by the \ndebugger. For example, consider the state \n\\[ \\ket{\\psi} = \\frac{1}{\\sqrt{2^n}} \\sum_{x \\in \\{ 0, 1 \\}^n} (-1)^{h(x)} \\ket{x}, \\]\nwhere $h(x)$ is the Hamming weight of $x$, i.e., the number of non-zero bits in $x$. Then $\\ket{\\psi}$ can be generated by applying the Hadamard transform $U = H^{\\otimes n}$ to the $n$-qubit register $\\ket{11 \\dots 1}$. This is an example of the Quantum Fourier Transform (QFT) over the group $\\mathbb{Z}_2^{\\oplus n}$. QFT can be implemented efficiently over the group $\\mathbb{Z}_N$ where $N$ is an integer, although in this case the implementation is more involved. A toy implementation of QFT for $N = 8$ is shown in Figure \\ref{fig:qft}. \n\n\\begin{figure*}[ht]\n\t\\centering\n\t\\begin{subfigure}[b]{0.45\\columnwidth}\n\t\t\\centering\n\t\t\\includegraphics[width = \\textwidth]{qft_8_circuit.pdf}\n\t\t\\caption{Circuit}\n\t\t\\label{fig:qft-circ}\n\t\\end{subfigure}\n\t%\n\t\\hspace*{10mm}\n\t%\n\t\\begin{subfigure}[b]{0.25\\columnwidth}\n\t\t\\centering\n\t\t\\begin{minted}[fontsize = \\footnotesize, numbersep = 2mm, linenos = true, autogobble]{cpp}\n OPENQASM 2.0;\n include \"qelib1.inc\";\n \n qreg q[3];\n \n h q[0];\n cp(pi\/2) q[1],q[0];\n cp(pi\/4) q[2],q[0];\n h q[1];\n cp(pi\/2) q[2],q[1];\n h q[2];\n swap q[0],q[2];\n \\end{minted}\n \\vspace{-4mm}\n\t\t\\caption{Assembly code}\n\t\t\\label{fig:qft-code}\n\t\\end{subfigure}\n\t\\caption{Quantum Fourier Transform over $\\mathbb{Z}_8$. In OpenQASM, $P_{\\pi \/ 2}$ and $P_{\\pi \/ 4}$ phase gates are denoted by $cp(\\cdot)$; \\textsc{swap} gate by $swap$. }\n\t\\label{fig:qft}\n\\end{figure*}\n\n\nIn the cases as above, there are various methods (depending on \nthe problem) to characterize the state $\\ket{\\psi}$. Often, one relies on \\textit{quantum state \ntomography}, which is the process of reconstructing a quantum state through a series of measurements \\cite{d2003quantum, cramer2010efficient}. \n\n\n\\subsection{Entanglement}\n\nIn a QC, a set of memory cells or registers is said to be in an entangled state if it is impossible \nto classically specify the correlations among them. More precisely, let $X_1, \\dots, X_n$ be the \nstate spaces of a set of quantum systems that represent $n$ registers. The state space of the \ncomposite of these systems, that represents an array, is given by the tensor product $X = X_1 \n\\otimes \\cdots \\otimes X_n$. A state $\\ket{\\psi} \\in X$ that can be written in the form \n$\\ket{\\psi} = \\ket{\\psi_1} \\otimes \\cdots \\otimes \\ket{\\psi_n}$, where $\\ket{\\psi_j} \\in \nX_j$ for $j = 1, \\dots, n$, is called separable. A state that is not separable is called entangled. \nWhen debugging a program that operates on an entangled state, the following problems can be \nconsidered.\n\n\\subsubsection{Checking for separability.}\\label{sec:separability}\nGiven a state $\\ket{\\psi} \\in X$, deciding whether $\\ket{\\psi}$ is separable is an NP-hard \nproblem \\cite{gharibian2010strong, gurvits2003classical}. This is called the \\textit{separability \nproblem} in quantum information theory, see \\cite[Chapter 6]{watrous2018theory} for details. There are a variety of methods (see~\\cite{leinaas2006geometrical,guhne2009entanglement}) for separability\/entanglement detection \nthat can be implemented in practice, specially for lower dimensions. For example, if the debugger can generate \nseveral copies of $\\ket{\\psi}$, then one way to detect the nonlinear properties of \n$\\ket{\\psi}$ is via direct measurement. For the sake of brevity, we do not provide technical details here; see \\cite{leinaas2006geometrical} for a numerical method \nfor examining separability and \\cite{guhne2009entanglement} for other interesting methods and their \nimplementations.\n\n\\subsubsection{Extracting classical information.}\\label{sec:classical}\nMeasuring a subsystem of a larger composite system that is in an entangle state will likely alter \nother subsystems. In debugging terms, if a set of variables are in an entangled state, a debugger will not be able to present any classical information about a subset of those variables to the user without disturbing the state of the whole set. \n\nFor example, consider the entangled state $\\frac{1}{\\sqrt{2}}(\\ket{00} + \\ket{11})$ of two qubits.\nMeasuring any of the two qubits alters the result of the subsequent measurement on the other qubit.\nMore precisely, if the first qubit is measured, then state collapses to $\\ket{00}$ or $\\ket{11}$ with probability $|1\/\\sqrt{2}|^2 =\n1\/2$; the outcome of measuring the second qubit is always $0$ if the resulting state is $\\ket{00}$, and it is always $1$ if the resulting state is $\\ket{11}$. Such a state is called maximally entangled. \n\nA composite system, however, often has subsystems that are not entangled with any other subsystem. In \nthis case, we can measure that subsystem without disturbing the whole state. For example, in the following state of a \n3-qubit register\n\\begin{equation}\n\\label{equ:sep-subsys}\n\t\\frac{1}{2} (\\ket{000} - \\ket{001} + \\ket{110} - \\ket{111}),\n\\end{equation}\nthe last qubit is not entangled with the first two while the first and the second qubits are \nentangled, see \\eqref{equ:gen-clas}. The algorithms for separability detection (discussed in Section~\\ref{sec:separability}) could be used to identify separable subsystems. \n\nThings would be much simpler if the debugger could somehow estimate a given state with a state that \nis generated by applying some operation to a basis state (i.e., classical information). For example, \nthe state in \\eqref{equ:sep-subsys} can be generated as\n\\begin{equation}\n \\label{equ:gen-clas}\n \\begin{aligned}\n & (\\textsc{cnot} \\otimes H)(H \\otimes I_4) \\ket{001} \\\\\n & = \\frac{1}{\\sqrt{2}}(\\ket{00} + \\ket{11}) \\otimes \\frac{1}{\\sqrt{2}}(\\ket{0} - \\ket{1}),\n \\end{aligned}\n\\end{equation}\nwhere $I_4$ is the $4 \\times 4$ identity gate. Therefore, the state in \\eqref{equ:sep-subsys} can be described by the debugger using the classical information \n$\\ket{001}$ and the names of the above operators. An implementation of the sequence of operations in \\eqref{equ:gen-clas} is \nshown in Figure \\ref{fig:entg-sep}.\n\n\\begin{figure}[ht]\n\t\\centering\n\t\\begin{subfigure}[b]{0.25\\columnwidth}\n\t\t\\centering\n\t\t\\includegraphics[width = \\textwidth]{entg_sep_circuit.pdf}\n\t\t\\caption{Circuit}\n\t\t\\label{fig:entg-circ}\n\t\\end{subfigure}\n\t%\n\t\\hspace*{1cm}\n\t%\n\t\\begin{subfigure}[b]{0.25\\columnwidth}\n\t\t\\centering\n\t\t\\begin{minted}[fontsize = \\footnotesize, numbersep = 2mm, linenos = true, autogobble]{cpp}\n OPENQASM 2.0;\n include \"qelib1.inc\";\n \n qreg q[3];\n creg c[2];\n \n x q[2];\n h q[0];\n cx q[0], q[1];\n h q[2];\n measure q[0] -> c[0];\n measure q[1] -> c[1];\n \\end{minted}\n \\vspace{-4mm}\n\t\t\\caption{Assembly code}\n\t\t\\label{fig:entg-code}\n\t\\end{subfigure}\n\t\\caption{A circuit for generating state \\eqref{equ:sep-subsys}.}\n\t\\label{fig:entg-sep}\n\\end{figure}\n\n\n\n\\subsection{No-cloning}\\label{sec:no-cloning}\n\nThe most general method of obtaining information about a variable without disturbing its state is \nto make a copy of the variable and work on the copy. In the classical setting, this is often \nstraightforward. In the quantum setting, however, the situation is much more complicated. In fact, \nit is impossible to make a copy of a given general unknown quantum state. More precisely, given an \nunknown state $\\ket{\\psi}$ and an arbitrary state $\\ket{\\phi}$, it can be shown~\\cite[Theorem 10.4.1]{kaye2007introduction} that \nthere is no unitary operator $U$ that can perform the following:\n\\[ \\ket{\\psi} \\otimes \\ket{\\phi} \\overset{U}{\\longmapsto} \\ket{\\psi} \\otimes \n\\ket{\\psi}. \\] \nIn many practical scenarios, however, a debugger will only need to make an \\textit{approximate copy} \nof a state; a state that is `close enough' to the given state but provides useful debugging \ninformation. For example, for a state $\\ket{\\psi}$ that encodes a probability distribution \\cite{grover2002creating}, such as\nthe Gaussian distribution, an approximate clone would provide valuable information about the distribution.\nThe possibility of approximate cloning was first discussed in \\cite{buvzek1996quantum}. \nMuch research has been done on different cloning methods each optimizing particular aspects of a \ncloner that are desired for different situations, see \\cite{scarani2005quantum} for a survey. \n\nAlso, it is possible to perform exact cloning if the given state belongs to a set of known mutually orthogonal states. Recall that two states $\\ket{\\psi_1}$, $\\ket{\\psi_2}$ are orthogonal if $\\braket{\\psi_1}{\\psi_2} = 0$. For example, consider the set of $n$-qubit states $S = \\{ \\ket{\\psi_j} \\}$ where\n\\[ \\ket{\\psi_j} = \\frac{1}{\\sqrt{2^n}} \\sum_{x \\in \\{ 0, 1 \\}^n} (-1)^{\\lrang{j, x}} \\ket{x}, \\]\nfor $j \\in \\{0, 1\\}^n$. The set $S$ is exponentially large, but for any given state $\\ket{\\psi_j} \\in S$ where $j$ is unknown, we can efficiently make a copy of $\\ket{\\psi_j}$. An example of such a cloning procedure, for $n = 2$, is shown in Figure \\ref{fig:clone-orth}.\n\n\\begin{figure}[ht]\n\t\\centering\n\t\\begin{subfigure}[b]{0.25\\columnwidth}\n\t\t\\centering\n\t\t\\includegraphics[width = \\textwidth]{clone_orth_circuit.pdf}\n\t\t\\caption{Circuit}\n\t\t\\label{fig:clone-orth-circ}\n\t\\end{subfigure}\n\t%\n\t\\hspace{1cm}\n\t%\n\t\\begin{subfigure}[b]{0.25\\columnwidth}\n\t\t\\centering\n\t\t\\begin{minted}[fontsize = \\footnotesize, numbersep = 2mm, linenos = true, autogobble]{cpp}\n OPENQASM 2.0;\n include \"qelib1.inc\";\n \n qreg q[4];\n \n h q[0];\n h q[1];\n cx q[0],q[2];\n h q[0];\n cx q[1],q[3];\n h q[1];\n h q[2];\n h q[3];\n \\end{minted}\n \\vspace{-4mm}\n\t\t\\caption{Assembly code}\n\t\t\\label{fig:clone-orth-code}\n\t\\end{subfigure}\n\t\\caption{A circuit for cloning $2$-qubit states in the set $S$. Here, the state of the first two qubits $q_0, q_1$ is copied into the last two qubits $q_2, q_3$.}\n\t\\label{fig:clone-orth}\n\\end{figure}\n\n\n\n\n\\subsection{Discussion}\nIn Sections~\\ref{sec:superposition}--\\ref{sec:no-cloning}, we discussed various issues preventing the application of the classic debugging techniques and identified some potential solutions. \n\nAs discussed in~\\cite{miranskyy2019testing}, if the input size and the amount of required qubits is small, we can run a quantum program in a simulator (running on a CC). However, the increase of the input size and the qubit register length may force us to run the program on a QC. \n\nIf we can generate multiple approximate copies of the state \\cite{buvzek1996quantum}, then we can produce an empirical distribution of the qubit state and compare it against the expected distribution, to detect problems in the code. The generation of the multiple approximate copies can be readily implemented for moderate inputs sizes using universal cloning methods~\\cite{werner1998optimal, buvzek1998universal, fan2001quantum}. More efficient cloning can be achieved using state-dependent (i.e. non-universal) cloning methods~\\cite{niu1999two, scarani2005quantum}. This would address issues related to superposition with known input state (discussed in Section~\\ref{sec:known-inp}), extraction of classical information (discussed in Section~\\ref{sec:classical}), and no-cloning (discussed in Section~\\ref{sec:no-cloning}). A compiler can automatically generate the code for the approximate copying (akin to compilers for CC that can instrument the code to add debugging information), translating higher-level language into quantum assembly~\\cite{huang2019statistical}. The same principle of multiple approximate copies (aggregated using statistics) can be used to generate runtime assertions~\\cite{li2014debugging,zhou2019quantum,zhou2019quantum_extended,DBLP:journals\/pacmpl\/LiZYDY020}.\n\nFor the case of unknown input states, discussed in Section~\\ref{sec:unknown-inp}, no general solution exists and will require a programmer to make decisions on a case-by-case basis.\n\nFinally, separability checking, discussed in Section~\\ref{sec:separability}, demands the implementation of numerical methods that will require changes to the QC and, hopefully, will be implemented in the future. \n\n\\section{Conclusions}\\label{sec:conclusions}\n\nQC field is rapidly evolving, and the SE community should start bringing SE practices into the QC world.\nIn this paper, we focus on analyzing testing and debugging tactics, highlighting classic ones that are readily applicable and showing that new ones have to be created.\nWe believe that this work would be of interest to practitioners, creating quantum programs, as well as researchers, developing the next generations of tooling for QC.\n\n\\section*{Acknowledgments}\nWe express profuse thanks to the anonymous reviewers of this paper and of~\\cite{miranskyy2019testing} and~\\cite{DBLP:conf\/icse\/Miranskyy0D20}. We are also grateful to the ICSE 2020 committee for rewarding~\\cite{DBLP:conf\/icse\/Miranskyy0D20} with the New Ideas and Emerging Results Distinguished Paper Award.\n\n","meta":{"redpajama_set_name":"RedPajamaArXiv"}}